1 #include "StringValue.h"
4 #include "StringType.h"
8 #include "..\slre\slre.h"
13 StringValue::StringValue(Databoard::Type::DataType* dataBoard) : Value(dataBoard)
17 StringValue::~StringValue()
21 void StringValue::setValue(std::string value)
26 std::string StringValue::getValue()
31 std::string StringValue::writeOut(int /*indent*/)
40 std::string StringValue::isValid()
42 std::string retValue = STR_EMPTY;
45 Databoard::Type::StringType* stringType = (Databoard::Type::StringType*)dataBoard;
47 std::string p = stringType->getPattern();
52 struct cap captures[4 + 1];
54 if (!slre_compile(&slre, p.c_str()))
56 retValue = "StringValue: pattern error."; // slre internal error
58 // todo: this is not working completely
59 else if (!slre_match(&slre, value.c_str(), value.length(), captures))
61 retValue = "StringValue: value error.";
77 bool StringValue::equals(const Value* other)
79 StringValue* o = (StringValue*)other;
81 return (this->value < o->value);