Skip to content
Snippets Groups Projects
Commit a8e45b48 authored by ilor's avatar ilor
Browse files

add UnicodeString variants of to_raw_string and to_string to Value

parent 2253e762
Branches
No related merge requests found
......@@ -23,6 +23,23 @@ std::string StrSet::to_raw_string() const
return ss.str();
}
UnicodeString StrSet::to_raw_string_u() const
{
UnicodeString u;
u.append(UNICODE_STRING("[", 1));
value_type::const_iterator it = set_.begin();
while(it != set_.end()) {
u.append(UNICODE_STRING("\"", 1));
u.append(*it); //TODO escaping
u.append(UNICODE_STRING("\"", 1));
if(++it != set_.end()) {
u.append(UNICODE_STRING(", ", 2));
}
}
u.append(UNICODE_STRING("]", 1));
return u;
}
bool StrSet::intersects(const StrSet &other) const {
if (empty() || other.empty()) {
return false;
......
......@@ -96,6 +96,9 @@ public:
/// Value override
std::string to_raw_string() const;
/// Value override
UnicodeString to_raw_string_u() const;
private:
value_type set_;
};
......
......@@ -49,6 +49,13 @@ public:
return to_raw_string();
}
/**
* Unicode variant of to_string
*/
virtual UnicodeString to_string_u(const Corpus2::Tagset& /*tagset*/) const {
return to_raw_string_u();
}
/**
* String representation of the Value that does not require a tagset,
* might be incomplete and/or contain internal info.
......@@ -57,6 +64,13 @@ public:
*/
virtual std::string to_raw_string() const = 0;
/**
* Unicode variant of to_raw_string
*/
virtual UnicodeString to_raw_string_u() const {
return UnicodeString::fromUTF8(to_raw_string());
}
protected:
Value() {}
};
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment