Commit ed1e592f authored by Sylvain Berfini's avatar Sylvain Berfini 🎩

Finished grammar/tests for properties + factorized tests code

parent 705a7a1d
......@@ -27,6 +27,9 @@ namespace belcard {
shared_ptr<BelCardBirthday> _bday;
shared_ptr<BelCardAnniversary> _anniversary;
shared_ptr<BelCardGender> _gender;
shared_ptr<BelCardProductId> _pid;
shared_ptr<BelCardRevision> _rev;
shared_ptr<BelCardUniqueId> _uid;
list<shared_ptr<BelCardNickname>> _nicknames;
list<shared_ptr<BelCardPhoto>> _photos;
list<shared_ptr<BelCardAddress>> _addr;
......@@ -36,6 +39,23 @@ namespace belcard {
list<shared_ptr<BelCardLang>> _langs;
list<shared_ptr<BelCardSource>> _sources;
list<shared_ptr<BelCardXML>> _xml;
list<shared_ptr<BelCardTimezone>> _timezones;
list<shared_ptr<BelCardGeo>> _geos;
list<shared_ptr<BelCardTitle>> _titles;
list<shared_ptr<BelCardRole>> _roles;
list<shared_ptr<BelCardLogo>> _logos;
list<shared_ptr<BelCardOrganization>> _organizations;
list<shared_ptr<BelCardMember>> _members;
list<shared_ptr<BelCardRelated>> _related;
list<shared_ptr<BelCardCategories>> _categories;
list<shared_ptr<BelCardNote>> _notes;
list<shared_ptr<BelCardSound>> _sounds;
list<shared_ptr<BelCardClientProductIdMap>> _clientpidmaps;
list<shared_ptr<BelCardURL>> _urls;
list<shared_ptr<BelCardKey>> _keys;
list<shared_ptr<BelCardFBURL>> _fburls;
list<shared_ptr<BelCardCALADRURI>> _caladruris;
list<shared_ptr<BelCardCALURI>> _caluris;
list<shared_ptr<BelCardProperty>> _properties;
public:
......@@ -67,6 +87,15 @@ namespace belcard {
void setGender(const shared_ptr<BelCardGender> &gender);
const shared_ptr<BelCardGender> &getGender() const;
void setProductId(const shared_ptr<BelCardProductId> &pid);
const shared_ptr<BelCardProductId> &getProductId() const;
void setRevision(const shared_ptr<BelCardRevision> &rev);
const shared_ptr<BelCardRevision> &getRevision() const;
void setUniqueId(const shared_ptr<BelCardUniqueId> &uid);
const shared_ptr<BelCardUniqueId> &getUniqueId() const;
void addNickname(const shared_ptr<BelCardNickname> &nickname);
const list<shared_ptr<BelCardNickname>> &getNicknames() const;
......@@ -93,6 +122,57 @@ namespace belcard {
void addXML(const shared_ptr<BelCardXML> &xml);
const list<shared_ptr<BelCardXML>> &getXML() const;
void addTimezone(const shared_ptr<BelCardTimezone> &tz);
const list<shared_ptr<BelCardTimezone>> &getTimezones() const;
void addGeo(const shared_ptr<BelCardGeo> &geo);
const list<shared_ptr<BelCardGeo>> &getGeos() const;
void addTitle(const shared_ptr<BelCardTitle> &title);
const list<shared_ptr<BelCardTitle>> &getTitles() const;
void addRole(const shared_ptr<BelCardRole> &role);
const list<shared_ptr<BelCardRole>> &getRoles() const;
void addLogo(const shared_ptr<BelCardLogo> &logo);
const list<shared_ptr<BelCardLogo>> &getLogos() const;
void addOrganization(const shared_ptr<BelCardOrganization> &org);
const list<shared_ptr<BelCardOrganization>> &getOrganizations() const;
void addMember(const shared_ptr<BelCardMember> &member);
const list<shared_ptr<BelCardMember>> &getMembers() const;
void addRelated(const shared_ptr<BelCardRelated> &related);
const list<shared_ptr<BelCardRelated>> &getRelated() const;
void addCategories(const shared_ptr<BelCardCategories> &categories);
const list<shared_ptr<BelCardCategories>> &getCategories() const;
void addNote(const shared_ptr<BelCardNote> &note);
const list<shared_ptr<BelCardNote>> &getNotes() const;
void addSound(const shared_ptr<BelCardSound> &sound);
const list<shared_ptr<BelCardSound>> &getSounds() const;
void addClientProductIdMap(const shared_ptr<BelCardClientProductIdMap> &clientpidmap);
const list<shared_ptr<BelCardClientProductIdMap>> &getClientProductIdMaps() const;
void addURL(const shared_ptr<BelCardURL> &url);
const list<shared_ptr<BelCardURL>> &getURLs() const;
void addKey(const shared_ptr<BelCardKey> &key);
const list<shared_ptr<BelCardKey>> &getKeys() const;
void addFBURL(const shared_ptr<BelCardFBURL> &fburl);
const list<shared_ptr<BelCardFBURL>> &getFBURLs() const;
void addCALADRURI(const shared_ptr<BelCardCALADRURI> &caladruri);
const list<shared_ptr<BelCardCALADRURI>> &getCALADRURIs() const;
void addCALURI(const shared_ptr<BelCardCALURI> &caluri);
const list<shared_ptr<BelCardCALURI>> &getCALURIs() const;
void addProperty(const shared_ptr<BelCardProperty> &property);
const list<shared_ptr<BelCardProperty>> &getProperties() const;
......
......@@ -16,6 +16,11 @@ using namespace::belr;
namespace belcard {
class BelCardGeneric {
public:
template<typename T>
static shared_ptr<T> create() {
return make_shared<T>();
}
BelCardGeneric() { }
virtual ~BelCardGeneric() { } //put a virtual destructor to enable polymorphism and dynamic casting.
......@@ -26,53 +31,24 @@ namespace belcard {
string _name;
string _value;
public:
static shared_ptr<BelCardParam> create() {
return make_shared<BelCardParam>();
}
static shared_ptr<BelCardParam> parse(const string& input) {
ABNFGrammarBuilder grammar_builder;
shared_ptr<Grammar> grammar = grammar_builder.createFromAbnf((const char*)vcard_grammar, make_shared<CoreRules>());
Parser<shared_ptr<BelCardGeneric>> parser(grammar);
setHandlerAndCollectors(&parser);
shared_ptr<BelCardGeneric> ret = parser.parseInput("any-param", input, NULL);
return dynamic_pointer_cast<BelCardParam>(ret);
}
static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser) {
parser->setHandler("any-param", make_fn(&BelCardParam::create))
->setCollector("param-name", make_sfn(&BelCardParam::setName))
->setCollector("param-value", make_sfn(&BelCardParam::setValue));
}
BelCardParam() : BelCardGeneric() {
}
static shared_ptr<BelCardParam> create();
static shared_ptr<BelCardParam> parse(const string& input);
static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
virtual void setName(const string &name) {
_name = name;
}
virtual const string &getName() const {
return _name;
}
virtual void setValue(const string &value) {
_value = value;
}
virtual const string &getValue() const {
return _value;
}
virtual string serialize() const {
stringstream output;
output << getName() << "=" << getValue();
return output.str();
}
BelCardParam();
friend ostream &operator<<(ostream &output, const BelCardParam &param) {
output << param.serialize();
return output;
}
virtual void setName(const string &name);
virtual const string &getName() const;
virtual void setValue(const string &value) ;
virtual const string &getValue() const;
virtual string serialize() const;
};
class BelCardProperty : public BelCardGeneric {
......@@ -83,62 +59,30 @@ namespace belcard {
list<shared_ptr<BelCardParam>> _params;
public:
static shared_ptr<BelCardProperty> create() {
return make_shared<BelCardProperty>();
}
static shared_ptr<BelCardProperty> create();
static shared_ptr<BelCardProperty> parse(const string& input);
static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
BelCardProperty() : BelCardGeneric() {
}
BelCardProperty();
virtual void setGroup(const string &group) {
_group = group;
}
virtual const string &getGroup() const {
return _group;
friend ostream &operator<<(ostream &output, const BelCardProperty &prop) {
output << prop.serialize();
return output;
}
virtual void setName(const string &name) {
_name = name;
}
virtual const string &getName() const {
return _name;
}
virtual void setGroup(const string &group);
virtual const string &getGroup() const;
virtual void setValue(const string &value) {
_value = value;
}
virtual const string &getValue() const {
return _value;
}
virtual void setName(const string &name);
virtual const string &getName() const;
virtual void addParam(const shared_ptr<BelCardParam> &param) {
_params.push_back(param);
}
virtual const list<shared_ptr<BelCardParam>> &getParams() const {
return _params;
}
virtual void setValue(const string &value);
virtual const string &getValue() const;
virtual string serialize() const {
stringstream output;
if (getGroup().length() > 0) {
output << getGroup() << ".";
}
output << getName();
for (auto it = getParams().begin(); it != getParams().end(); ++it) {
output << ";" << (**it);
}
output << ":" << getValue() << "\r\n";
return output.str();
}
virtual void addParam(const shared_ptr<BelCardParam> &param);
virtual const list<shared_ptr<BelCardParam>> &getParams() const;
friend ostream &operator<<(ostream &output, const BelCardProperty &prop) {
output << prop.serialize();
return output;
}
virtual string serialize() const;
};
}
......
......@@ -6,6 +6,7 @@ vcard_grammar.cpp: vcard.grammar
xxd -i vcard.grammar | sed s/}\;/,0x00}\;/ >> vcard_grammar.cpp
libbelcard_la_SOURCES=belcard_parser.cpp \
belcard_generic.cpp \
belcard.cpp \
belcard_general.cpp \
belcard_identification.cpp \
......
......@@ -24,7 +24,27 @@ void BelCard::setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser
->setCollector("TEL", make_sfn(&BelCard::addTel))
->setCollector("EMAIL", make_sfn(&BelCard::addEmail))
->setCollector("IMPP", make_sfn(&BelCard::addImpp))
->setCollector("LANG", make_sfn(&BelCard::addLang));
->setCollector("LANG", make_sfn(&BelCard::addLang))
->setCollector("TZ", make_sfn(&BelCard::addTimezone))
->setCollector("GEO", make_sfn(&BelCard::addGeo))
->setCollector("TITLE", make_sfn(&BelCard::addTitle))
->setCollector("ROLE", make_sfn(&BelCard::addRole))
->setCollector("LOGO", make_sfn(&BelCard::addLogo))
->setCollector("ORG", make_sfn(&BelCard::addOrganization))
->setCollector("MEMBER", make_sfn(&BelCard::addMember))
->setCollector("RELATED", make_sfn(&BelCard::addRelated))
->setCollector("CATEGORIES", make_sfn(&BelCard::addCategories))
->setCollector("NOTE", make_sfn(&BelCard::addNote))
->setCollector("PRODID", make_sfn(&BelCard::setProductId))
->setCollector("REV", make_sfn(&BelCard::setRevision))
->setCollector("SOUND", make_sfn(&BelCard::addSound))
->setCollector("UID", make_sfn(&BelCard::setUniqueId))
->setCollector("CLIENTPIDMAP", make_sfn(&BelCard::addClientProductIdMap))
->setCollector("URL", make_sfn(&BelCard::addURL))
->setCollector("KEY", make_sfn(&BelCard::addKey))
->setCollector("FBURL", make_sfn(&BelCard::addFBURL))
->setCollector("CALADRURI", make_sfn(&BelCard::addCALADRURI))
->setCollector("CALURI", make_sfn(&BelCard::addCALURI));
}
BelCard::BelCard() {
......@@ -78,6 +98,30 @@ void BelCard::setGender(const shared_ptr<BelCardGender> &gender) {
const shared_ptr<BelCardGender> &BelCard::getGender() const {
return _gender;
}
void BelCard::setProductId(const shared_ptr<BelCardProductId> &pid) {
_pid = pid;
addProperty(_pid);
}
const shared_ptr<BelCardProductId> &BelCard::getProductId() const {
return _pid;
}
void BelCard::setRevision(const shared_ptr<BelCardRevision> &rev) {
_rev = rev;
addProperty(_rev);
}
const shared_ptr<BelCardRevision> &BelCard::getRevision() const {
return _rev;
}
void BelCard::setUniqueId(const shared_ptr<BelCardUniqueId> &uid) {
_uid = uid;
addProperty(_uid);
}
const shared_ptr<BelCardUniqueId> &BelCard::getUniqueId() const {
return _uid;
}
void BelCard::addNickname(const shared_ptr<BelCardNickname> &nickname) {
_nicknames.push_back(nickname);
......@@ -151,6 +195,142 @@ const list<shared_ptr<BelCardXML>> &BelCard::getXML() const {
return _xml;
}
void BelCard::addTimezone(const shared_ptr<BelCardTimezone> &tz) {
_timezones.push_back(tz);
addProperty(tz);
}
const list<shared_ptr<BelCardTimezone>> &BelCard::getTimezones() const {
return _timezones;
}
void BelCard::addGeo(const shared_ptr<BelCardGeo> &geo) {
_geos.push_back(geo);
addProperty(geo);
}
const list<shared_ptr<BelCardGeo>> &BelCard::getGeos() const {
return _geos;
}
void BelCard::addTitle(const shared_ptr<BelCardTitle> &title) {
_titles.push_back(title);
addProperty(title);
}
const list<shared_ptr<BelCardTitle>> &BelCard::getTitles() const {
return _titles;
}
void BelCard::addRole(const shared_ptr<BelCardRole> &role) {
_roles.push_back(role);
addProperty(role);
}
const list<shared_ptr<BelCardRole>> &BelCard::getRoles() const {
return _roles;
}
void BelCard::addLogo(const shared_ptr<BelCardLogo> &logo) {
_logos.push_back(logo);
addProperty(logo);
}
const list<shared_ptr<BelCardLogo>> &BelCard::getLogos() const {
return _logos;
}
void BelCard::addOrganization(const shared_ptr<BelCardOrganization> &org) {
_organizations.push_back(org);
addProperty(org);
}
const list<shared_ptr<BelCardOrganization>> &BelCard::getOrganizations() const {
return _organizations;
}
void BelCard::addMember(const shared_ptr<BelCardMember> &member) {
_members.push_back(member);
addProperty(member);
}
const list<shared_ptr<BelCardMember>> &BelCard::getMembers() const {
return _members;
}
void BelCard::addRelated(const shared_ptr<BelCardRelated> &related) {
_related.push_back(related);
addProperty(related);
}
const list<shared_ptr<BelCardRelated>> &BelCard::getRelated() const {
return _related;
}
void BelCard::addCategories(const shared_ptr<BelCardCategories> &categories) {
_categories.push_back(categories);
addProperty(categories);
}
const list<shared_ptr<BelCardCategories>> &BelCard::getCategories() const {
return _categories;
}
void BelCard::addNote(const shared_ptr<BelCardNote> &note) {
_notes.push_back(note);
addProperty(note);
}
const list<shared_ptr<BelCardNote>> &BelCard::getNotes() const {
return _notes;
}
void BelCard::addSound(const shared_ptr<BelCardSound> &sound) {
_sounds.push_back(sound);
addProperty(sound);
}
const list<shared_ptr<BelCardSound>> &BelCard::getSounds() const {
return _sounds;
}
void BelCard::addClientProductIdMap(const shared_ptr<BelCardClientProductIdMap> &clientpidmap) {
_clientpidmaps.push_back(clientpidmap);
addProperty(clientpidmap);
}
const list<shared_ptr<BelCardClientProductIdMap>> &BelCard::getClientProductIdMaps() const {
return _clientpidmaps;
}
void BelCard::addURL(const shared_ptr<BelCardURL> &url) {
_urls.push_back(url);
addProperty(url);
}
const list<shared_ptr<BelCardURL>> &BelCard::getURLs() const {
return _urls;
}
void BelCard::addKey(const shared_ptr<BelCardKey> &key) {
_keys.push_back(key);
addProperty(key);
}
const list<shared_ptr<BelCardKey>> &BelCard::getKeys() const {
return _keys;
}
void BelCard::addFBURL(const shared_ptr<BelCardFBURL> &fburl) {
_fburls.push_back(fburl);
addProperty(fburl);
}
const list<shared_ptr<BelCardFBURL>> &BelCard::getFBURLs() const {
return _fburls;
}
void BelCard::addCALADRURI(const shared_ptr<BelCardCALADRURI> &caladruri) {
_caladruris.push_back(caladruri);
addProperty(caladruri);
}
const list<shared_ptr<BelCardCALADRURI>> &BelCard::getCALADRURIs() const {
return _caladruris;
}
void BelCard::addCALURI(const shared_ptr<BelCardCALURI> &caluri) {
_caluris.push_back(caluri);
addProperty(caluri);
}
const list<shared_ptr<BelCardCALURI>> &BelCard::getCALURIs() const {
return _caluris;
}
void BelCard::addProperty(const shared_ptr<BelCardProperty> &property) {
_properties.push_back(property);
}
......
......@@ -5,7 +5,7 @@ using namespace::belr;
using namespace::belcard;
shared_ptr<BelCardAddress> BelCardAddress::create() {
return make_shared<BelCardAddress>();
return BelCardGeneric::create<BelCardAddress>();
}
shared_ptr<BelCardAddress> BelCardAddress::parse(const string& input) {
......
......@@ -5,7 +5,7 @@ using namespace::belr;
using namespace::belcard;
shared_ptr<BelCardFBURL> BelCardFBURL::create() {
return make_shared<BelCardFBURL>();
return BelCardGeneric::create<BelCardFBURL>();
}
shared_ptr<BelCardFBURL> BelCardFBURL::parse(const string& input) {
......@@ -30,7 +30,7 @@ BelCardFBURL::BelCardFBURL() : BelCardProperty() {
}
shared_ptr<BelCardCALADRURI> BelCardCALADRURI::create() {
return make_shared<BelCardCALADRURI>();
return BelCardGeneric::create<BelCardCALADRURI>();
}
shared_ptr<BelCardCALADRURI> BelCardCALADRURI::parse(const string& input) {
......@@ -55,7 +55,7 @@ BelCardCALADRURI::BelCardCALADRURI() : BelCardProperty() {
}
shared_ptr<BelCardCALURI> BelCardCALURI::create() {
return make_shared<BelCardCALURI>();
return BelCardGeneric::create<BelCardCALURI>();
}
shared_ptr<BelCardCALURI> BelCardCALURI::parse(const string& input) {
......
......@@ -5,7 +5,7 @@ using namespace::belr;
using namespace::belcard;
shared_ptr<BelCardTel> BelCardTel::create() {
return make_shared<BelCardTel>();
return BelCardGeneric::create<BelCardTel>();
}
shared_ptr<BelCardTel> BelCardTel::parse(const string& input) {
......@@ -30,7 +30,7 @@ BelCardTel::BelCardTel() : BelCardProperty() {
}
shared_ptr<BelCardEmail> BelCardEmail::create() {
return make_shared<BelCardEmail>();
return BelCardGeneric::create<BelCardEmail>();
}
shared_ptr<BelCardEmail> BelCardEmail::parse(const string& input) {
......@@ -55,7 +55,7 @@ BelCardEmail::BelCardEmail() : BelCardProperty() {
}
shared_ptr<BelCardImpp> BelCardImpp::create() {
return make_shared<BelCardImpp>();
return BelCardGeneric::create<BelCardImpp>();
}
shared_ptr<BelCardImpp> BelCardImpp::parse(const string& input) {
......@@ -80,7 +80,7 @@ BelCardImpp::BelCardImpp() : BelCardProperty() {
}
shared_ptr<BelCardLang> BelCardLang::create() {
return make_shared<BelCardLang>();
return BelCardGeneric::create<BelCardLang>();
}
shared_ptr<BelCardLang> BelCardLang::parse(const string& input) {
......
......@@ -5,7 +5,7 @@ using namespace::belr;
using namespace::belcard;
shared_ptr<BelCardCategories> BelCardCategories::create() {
return make_shared<BelCardCategories>();
return BelCardGeneric::create<BelCardCategories>();
}
shared_ptr<BelCardCategories> BelCardCategories::parse(const string& input) {
......@@ -30,7 +30,7 @@ BelCardCategories::BelCardCategories() : BelCardProperty() {
}
shared_ptr<BelCardNote> BelCardNote::create() {
return make_shared<BelCardNote>();
return BelCardGeneric::create<BelCardNote>();
}
shared_ptr<BelCardNote> BelCardNote::parse(const string& input) {
......@@ -55,7 +55,7 @@ BelCardNote::BelCardNote() : BelCardProperty() {
}
shared_ptr<BelCardProductId> BelCardProductId::create() {
return make_shared<BelCardProductId>();
return BelCardGeneric::create<BelCardProductId>();
}
shared_ptr<BelCardProductId> BelCardProductId::parse(const string& input) {
......@@ -80,7 +80,7 @@ BelCardProductId::BelCardProductId() : BelCardProperty() {
}
shared_ptr<BelCardRevision> BelCardRevision::create() {
return make_shared<BelCardRevision>();
return BelCardGeneric::create<BelCardRevision>();
}
shared_ptr<BelCardRevision> BelCardRevision::parse(const string& input) {
......@@ -105,7 +105,7 @@ BelCardRevision::BelCardRevision() : BelCardProperty() {
}
shared_ptr<BelCardSound> BelCardSound::create() {
return make_shared<BelCardSound>();
return BelCardGeneric::create<BelCardSound>();
}
shared_ptr<BelCardSound> BelCardSound::parse(const string& input) {
......@@ -130,7 +130,7 @@ BelCardSound::BelCardSound() : BelCardProperty() {
}
shared_ptr<BelCardUniqueId> BelCardUniqueId::create() {
return make_shared<BelCardUniqueId>();
return BelCardGeneric::create<BelCardUniqueId>();
}
shared_ptr<BelCardUniqueId> BelCardUniqueId::parse(const string& input) {
......@@ -155,7 +155,7 @@ BelCardUniqueId::BelCardUniqueId() : BelCardProperty() {
}
shared_ptr<BelCardClientProductIdMap> BelCardClientProductIdMap::create() {
return make_shared<BelCardClientProductIdMap>();
return BelCardGeneric::create<BelCardClientProductIdMap>();
}
shared_ptr<BelCardClientProductIdMap> BelCardClientProductIdMap::parse(const string& input) {
......@@ -180,7 +180,7 @@ BelCardClientProductIdMap::BelCardClientProductIdMap() : BelCardProperty() {
}
shared_ptr<BelCardURL> BelCardURL::create() {
return make_shared<BelCardURL>();
return BelCardGeneric::create<BelCardURL>();
}
shared_ptr<BelCardURL> BelCardURL::parse(const string& input) {
......
......@@ -5,7 +5,7 @@ using namespace::belr;
using namespace::belcard;
shared_ptr<BelCardKind> BelCardKind::create() {
return make_shared<BelCardKind>();
return BelCardGeneric::create<BelCardKind>();
}
shared_ptr<BelCardKind> BelCardKind::parse(const string& input) {
......@@ -30,7 +30,7 @@ BelCardKind::BelCardKind() : BelCardProperty() {
}
shared_ptr<BelCardSource> BelCardSource::create() {
return make_shared<BelCardSource>();
return BelCardGeneric::create<BelCardSource>();
}
shared_ptr<BelCardSource> BelCardSource::parse(const string& input) {
......@@ -55,7 +55,7 @@ BelCardSource::BelCardSource() : BelCardProperty() {
}
shared_ptr<BelCardXML> BelCardXML::create() {
return make_shared<BelCardXML>();
return BelCardGeneric::create<BelCardXML>();
}
shared_ptr<BelCardXML> BelCardXML::parse(const string& input) {
......
#include "belcard/belcard_generic.hpp"
using namespace::std;
using namespace::belr;
using namespace::belcard;
shared_ptr<BelCardParam> BelCardParam::create() {
return BelCardGeneric::create<BelCardParam>();
}
shared_ptr<BelCardParam> BelCardParam::parse(const string& input) {
ABNFGrammarBuilder grammar_builder;
shared_ptr<Grammar> grammar = grammar_builder.createFromAbnf((const char*)vcard_grammar, make_shared<CoreRules>());
Parser<shared_ptr<BelCardGeneric>> parser(grammar);
setHandlerAndCollectors(&parser);
shared_ptr<BelCardGeneric> ret = parser.parseInput("any-param", input, NULL);
return dynamic_pointer_cast<BelCardParam>(ret);
}
void BelCardParam::setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser) {
parser->setHandler("any-param", make_fn(&BelCardParam::create))
->setCollector("param-name", make_sfn(&BelCardParam::setName))
->setCollector("param-value", make_sfn(&BelCardParam::setValue));
}
BelCardParam::BelCardParam() : BelCardGeneric() {
}
void BelCardParam::setName(const string &name) {
_name = name;
}
const string &BelCardParam::getName() const {
return _name;
}
void BelCardParam::setValue(const string &value) {
_value = value;
}
const string &BelCardParam::getValue() const {
return _value;
}
string BelCardParam::serialize() const {
stringstream output;
output << getName() << "=" << getValue();
return output.str();
}
shared_ptr<BelCardProperty> BelCardProperty::create() {
return BelCardGeneric::create<BelCardProperty>();
}
shared_ptr<BelCardProperty> BelCardProperty::parse(const string& input) {
return NULL;
}
void BelCardProperty::setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser) {
}
BelCardProperty::BelCardProperty() : BelCardGeneric() {
}
void BelCardProperty::setGroup(const string &group) {
_group = group;
}
const string &BelCardProperty::getGroup() const {