X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.databoard%2Fcpp%2FDataBoardTest%2FDataBoard%2FConstants.cpp;fp=bundles%2Forg.simantics.databoard%2Fcpp%2FDataBoardTest%2FDataBoard%2FConstants.cpp;h=bcff2bcdd3f1bab7708a50eee5fbd6014761531f;hb=969bd23cab98a79ca9101af33334000879fb60c5;hp=0000000000000000000000000000000000000000;hpb=866dba5cd5a3929bbeae85991796acb212338a08;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.databoard/cpp/DataBoardTest/DataBoard/Constants.cpp b/bundles/org.simantics.databoard/cpp/DataBoardTest/DataBoard/Constants.cpp new file mode 100644 index 000000000..bcff2bcdd --- /dev/null +++ b/bundles/org.simantics.databoard/cpp/DataBoardTest/DataBoard/Constants.cpp @@ -0,0 +1,68 @@ +#include "Constants.h" + +#include + +namespace Databoard { + + void printout(pANTLR3_BASE_TREE type) + { + std::cout << type->getText(type)->chars << " : " << type->getType(type) << std::endl; + } + + std::string removeQuotes(std::string str) + { + if(str.length() > 0) + { + if(str.at(0) == '"') + { + str = str.substr(1, str.length()-1); + } + } + + if(str.length() > 0) + { + if(str.at(str.length()-1) == '"') + { + str = str.substr(0, str.length()-1); + } + } + + return str; + } + + bool strEquals(const char* a, const char* b) + { + while(*a != '\0' && *b != '\0') + { + char c1 = *a; + char c2 = *b; + + if(c1 >= 'a' && c1 <= 'z') + { + c1 += 'A'-'a'; + } + + if(c2 >= 'a' && c2 <= 'z') + { + c2 += 'A'-'a'; + } + + if(c1 != c2) + { + return false; + } + + ++a; + ++b; + } + + if((*a == *b) && (*a == 0)) + { + return true; + } + else + { + return false; + } + } +}