-#include "StringValue.h"\r
-\r
-#include "Constants.h"\r
-#include "StringType.h"\r
-\r
-//#define SLRE_REGEXP\r
-#ifdef SLRE_REGEXP\r
-#include "..\slre\slre.h"\r
-#endif\r
-\r
-namespace Databoard {\r
- namespace Value {\r
- StringValue::StringValue(Databoard::Type::DataType* dataBoard) : Value(dataBoard)\r
- {\r
- }\r
-\r
- StringValue::~StringValue()\r
- {\r
- }\r
-\r
- void StringValue::setValue(std::string value)\r
- {\r
- this->value = value;\r
- }\r
-\r
- std::string StringValue::getValue()\r
- {\r
- return value;\r
- }\r
-\r
- std::string StringValue::writeOut(int /*indent*/)\r
- {\r
- std::string s;\r
-\r
- s += value;\r
-\r
- return s;\r
- }\r
-\r
- std::string StringValue::isValid()\r
- {\r
- std::string retValue = STR_EMPTY;\r
-\r
-#ifdef SLRE_REGEXP\r
- Databoard::Type::StringType* stringType = (Databoard::Type::StringType*)dataBoard;\r
-\r
- std::string p = stringType->getPattern();\r
-\r
- if(p.length() > 0)\r
- {\r
- struct slre slre;\r
- struct cap captures[4 + 1];\r
-\r
- if (!slre_compile(&slre, p.c_str()))\r
- {\r
- retValue = "StringValue: pattern error."; // slre internal error\r
- }\r
- // todo: this is not working completely\r
- else if (!slre_match(&slre, value.c_str(), value.length(), captures))\r
- {\r
- retValue = "StringValue: value error.";\r
- }\r
- else\r
- {\r
- retValue = STR_EMPTY;\r
- }\r
- }\r
- else\r
- {\r
- retValue = STR_EMPTY;\r
- }\r
-#endif\r
-\r
- return retValue;\r
- }\r
-\r
- bool StringValue::equals(const Value* other)\r
- {\r
- StringValue* o = (StringValue*)other;\r
-\r
- return (this->value < o->value);\r
-\r
- }\r
- }\r
-}\r
+#include "StringValue.h"
+
+#include "Constants.h"
+#include "StringType.h"
+
+//#define SLRE_REGEXP
+#ifdef SLRE_REGEXP
+#include "..\slre\slre.h"
+#endif
+
+namespace Databoard {
+ namespace Value {
+ StringValue::StringValue(Databoard::Type::DataType* dataBoard) : Value(dataBoard)
+ {
+ }
+
+ StringValue::~StringValue()
+ {
+ }
+
+ void StringValue::setValue(std::string value)
+ {
+ this->value = value;
+ }
+
+ std::string StringValue::getValue()
+ {
+ return value;
+ }
+
+ std::string StringValue::writeOut(int /*indent*/)
+ {
+ std::string s;
+
+ s += value;
+
+ return s;
+ }
+
+ std::string StringValue::isValid()
+ {
+ std::string retValue = STR_EMPTY;
+
+#ifdef SLRE_REGEXP
+ Databoard::Type::StringType* stringType = (Databoard::Type::StringType*)dataBoard;
+
+ std::string p = stringType->getPattern();
+
+ if(p.length() > 0)
+ {
+ struct slre slre;
+ struct cap captures[4 + 1];
+
+ if (!slre_compile(&slre, p.c_str()))
+ {
+ retValue = "StringValue: pattern error."; // slre internal error
+ }
+ // todo: this is not working completely
+ else if (!slre_match(&slre, value.c_str(), value.length(), captures))
+ {
+ retValue = "StringValue: value error.";
+ }
+ else
+ {
+ retValue = STR_EMPTY;
+ }
+ }
+ else
+ {
+ retValue = STR_EMPTY;
+ }
+#endif
+
+ return retValue;
+ }
+
+ bool StringValue::equals(const Value* other)
+ {
+ StringValue* o = (StringValue*)other;
+
+ return (this->value < o->value);
+
+ }
+ }
+}