summaryrefslogtreecommitdiff
path: root/gentoobrowse-api/domain/converters.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gentoobrowse-api/domain/converters.cpp')
-rw-r--r--gentoobrowse-api/domain/converters.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/gentoobrowse-api/domain/converters.cpp b/gentoobrowse-api/domain/converters.cpp
index 9d0b795..9f1f6d8 100644
--- a/gentoobrowse-api/domain/converters.cpp
+++ b/gentoobrowse-api/domain/converters.cpp
@@ -5,6 +5,32 @@
#include <boost/algorithm/string/join.hpp>
namespace Slicer {
+ PqTextArray::PqTextArray(::Gentoo::StringList & sl) :
+ ModelPartForSequence<::Gentoo::StringList>(sl)
+ {
+ }
+
+ void PqTextArray::SetValue(ValueSourcePtr s)
+ {
+ Model.clear();
+ std::string v;
+ s->set(v);
+ std::stringstream ss(v);
+ ::Portage::Utils::UnpackPqTextArray l(ss, Model);
+ l.yylex();
+ }
+
+ void PqTextArray::GetValue(ValueTargetPtr s)
+ {
+ if (Model.empty()) s->get("{}");
+ ::Gentoo::StringList l2(Model);
+ for(auto & i : l2) {
+ boost::algorithm::replace_all(i, "\"", "\\\"");
+ i = "\"" + i + "\"";
+ }
+ s->get("{" + boost::algorithm::join(l2, ",") + "}");
+ }
+
::Gentoo::StringList
unpackPqTextArray(const std::string & s)
{