Introduction
cppbind introduction
Features
- Data-binding C++ Class Object to and from JSON/CSV. Not oly
- Type of a Class member variable could be primitive type, other Class type or C++ standard container template(vector, list, map, set).
- Class memeber variable could be optional, predefined default value.
- Foreigner table support.
- Dynamic type decode support.
- User defined serialization and deserialization behavior.
Code example
class Person {
public:
std::string name;
boost::gregorian::date born_date;
boost::shared_ptr< std::map<std::string, int> > optional_skills_score;
void setBind(Binder *binder, bool load){
binder->bind("name", name);
binder->bind("bornDate", born_date);
binder->bind("skillsScore", optional_skills_score);
}
};
Person* parsePerson(std::istream &json_input){
return JsonDecoder().decode<Student>(json_str);
}