45 #include <Wt/Json/Object.h> 46 #include <Wt/Json/Value.h> 47 #include <Wt/Json/Parser.h> 48 #include <Wt/Json/Serializer.h> 52 std::string Wtx::Dbo::FieldVar::value(
const std::string & field )
const 56 if( Field::value() !=
"" )
58 Wt::Json::Object jobj;
60 Wt::Json::parse( Field::value(), jobj );
62 catch( std::exception & e )
67 retVal = jobj.get(field).orIfNull(
"");
74 void Wtx::Dbo::FieldVar::setValue(
const std::string & value )
76 Field<std::string>::setValue( value );
79 void Wtx::Dbo::FieldVar::setValue(
const std::string & field,
const std::string & val )
81 Wt::Json::Object jobj;
83 Wt::Json::parse( Field::value(), jobj );
85 catch( std::exception & e )
90 jobj[field] = Wt::WString(val);
92 setValue( Wt::Json::serialize(jobj) );
96 void Wtx::Dbo::FieldVar::setValue(
const std::string & field,
int val )
98 Wt::Json::Object jobj;
100 Wt::Json::parse( Field::value(), jobj );
102 catch( std::exception & e )
107 jobj[field] = Wt::WString(
"{1}").arg(val);
109 setValue( Wt::Json::serialize(jobj) );