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

Factorized some code

parent bffd6ff0
......@@ -24,7 +24,6 @@ namespace belcard {
shared_ptr<BelCardLabelParam> _label_param;
public:
static shared_ptr<BelCardAddress> create();
static shared_ptr<BelCardAddress> parse(const string& input);
static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
......
......@@ -13,7 +13,6 @@ using namespace::belr;
namespace belcard {
class BelCardFBURL : public BelCardProperty {
public:
static shared_ptr<BelCardFBURL> create();
static shared_ptr<BelCardFBURL> parse(const string& input);
static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
......@@ -22,7 +21,6 @@ namespace belcard {
class BelCardCALADRURI : public BelCardProperty {
public:
static shared_ptr<BelCardCALADRURI> create();
static shared_ptr<BelCardCALADRURI> parse(const string& input);
static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
......@@ -31,7 +29,6 @@ namespace belcard {
class BelCardCALURI : public BelCardProperty {
public:
static shared_ptr<BelCardCALURI> create();
static shared_ptr<BelCardCALURI> parse(const string& input);
static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
......
......@@ -14,7 +14,6 @@ using namespace::belr;
namespace belcard {
class BelCardPhoneNumber : public BelCardProperty {
public:
static shared_ptr<BelCardPhoneNumber> create();
static shared_ptr<BelCardPhoneNumber> parse(const string& input);
static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
......@@ -23,7 +22,6 @@ namespace belcard {
class BelCardEmail : public BelCardProperty {
public:
static shared_ptr<BelCardEmail> create();
static shared_ptr<BelCardEmail> parse(const string& input);
static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
......@@ -32,7 +30,6 @@ namespace belcard {
class BelCardImpp : public BelCardProperty {
public:
static shared_ptr<BelCardImpp> create();
static shared_ptr<BelCardImpp> parse(const string& input) ;
static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
......@@ -41,7 +38,6 @@ namespace belcard {
class BelCardLang : public BelCardProperty {
public:
static shared_ptr<BelCardLang> create();
static shared_ptr<BelCardLang> parse(const string& input);
static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
......
......@@ -13,7 +13,6 @@ using namespace::belr;
namespace belcard {
class BelCardCategories : public BelCardProperty {
public:
static shared_ptr<BelCardCategories> create();
static shared_ptr<BelCardCategories> parse(const string& input);
static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
......@@ -22,7 +21,6 @@ namespace belcard {
class BelCardNote : public BelCardProperty {
public:
static shared_ptr<BelCardNote> create();
static shared_ptr<BelCardNote> parse(const string& input);
static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
......@@ -31,7 +29,6 @@ namespace belcard {
class BelCardProductId : public BelCardProperty {
public:
static shared_ptr<BelCardProductId> create();
static shared_ptr<BelCardProductId> parse(const string& input);
static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
......@@ -40,7 +37,6 @@ namespace belcard {
class BelCardRevision : public BelCardProperty {
public:
static shared_ptr<BelCardRevision> create();
static shared_ptr<BelCardRevision> parse(const string& input);
static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
......@@ -49,7 +45,6 @@ namespace belcard {
class BelCardSound : public BelCardProperty {
public:
static shared_ptr<BelCardSound> create();
static shared_ptr<BelCardSound> parse(const string& input);
static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
......@@ -58,7 +53,6 @@ namespace belcard {
class BelCardUniqueId : public BelCardProperty {
public:
static shared_ptr<BelCardUniqueId> create();
static shared_ptr<BelCardUniqueId> parse(const string& input);
static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
......@@ -67,7 +61,6 @@ namespace belcard {
class BelCardClientProductIdMap : public BelCardProperty {
public:
static shared_ptr<BelCardClientProductIdMap> create();
static shared_ptr<BelCardClientProductIdMap> parse(const string& input);
static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
......@@ -76,7 +69,6 @@ namespace belcard {
class BelCardURL : public BelCardProperty {
public:
static shared_ptr<BelCardURL> create();
static shared_ptr<BelCardURL> parse(const string& input);
static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
......
......@@ -13,7 +13,6 @@ using namespace::belr;
namespace belcard {
class BelCardKind : public BelCardProperty {
public:
static shared_ptr<BelCardKind> create();
static shared_ptr<BelCardKind> parse(const string& input);
static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
......@@ -22,7 +21,6 @@ namespace belcard {
class BelCardSource : public BelCardProperty {
public:
static shared_ptr<BelCardSource> create();
static shared_ptr<BelCardSource> parse(const string& input);
static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
......@@ -31,7 +29,6 @@ namespace belcard {
class BelCardXML : public BelCardProperty {
public:
static shared_ptr<BelCardXML> create();
static shared_ptr<BelCardXML> parse(const string& input);
static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
......
......@@ -13,7 +13,6 @@ using namespace::belr;
namespace belcard {
class BelCardTimezone : public BelCardProperty {
public:
static shared_ptr<BelCardTimezone> create();
static shared_ptr<BelCardTimezone> parse(const string& input);
static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
......@@ -22,7 +21,6 @@ namespace belcard {
class BelCardGeo : public BelCardProperty {
public:
static shared_ptr<BelCardGeo> create();
static shared_ptr<BelCardGeo> parse(const string& input);
static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
......
......@@ -15,7 +15,6 @@ using namespace::belr;
namespace belcard {
class BelCardFullName : public BelCardProperty {
public:
static shared_ptr<BelCardFullName> create();
static shared_ptr<BelCardFullName> parse(const string& input);
static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
......@@ -31,7 +30,6 @@ namespace belcard {
string _suffixes;
public:
static shared_ptr<BelCardName> create();
static shared_ptr<BelCardName> parse(const string& input);
static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser) ;
......@@ -57,7 +55,6 @@ namespace belcard {
class BelCardNickname : public BelCardProperty {
public:
static shared_ptr<BelCardNickname> create();
static shared_ptr<BelCardNickname> parse(const string& input);
static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
......@@ -66,7 +63,6 @@ namespace belcard {
class BelCardBirthday : public BelCardProperty {
public:
static shared_ptr<BelCardBirthday> create();
static shared_ptr<BelCardBirthday> parse(const string& input);
static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
......@@ -75,7 +71,6 @@ namespace belcard {
class BelCardAnniversary : public BelCardProperty {
public:
static shared_ptr<BelCardAnniversary> create();
static shared_ptr<BelCardAnniversary> parse(const string& input);
static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
......@@ -84,7 +79,6 @@ namespace belcard {
class BelCardGender : public BelCardProperty {
public:
static shared_ptr<BelCardGender> create();
static shared_ptr<BelCardGender> parse(const string& input);
static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
......@@ -93,7 +87,6 @@ namespace belcard {
class BelCardPhoto : public BelCardProperty {
public:
static shared_ptr<BelCardPhoto> create();
static shared_ptr<BelCardPhoto> parse(const string& input);
static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
......
......@@ -13,7 +13,6 @@ using namespace::belr;
namespace belcard {
class BelCardTitle : public BelCardProperty {
public:
static shared_ptr<BelCardTitle> create();
static shared_ptr<BelCardTitle> parse(const string& input);
static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
......@@ -22,7 +21,6 @@ namespace belcard {
class BelCardRole : public BelCardProperty {
public:
static shared_ptr<BelCardRole> create();
static shared_ptr<BelCardRole> parse(const string& input);
static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
......@@ -31,7 +29,6 @@ namespace belcard {
class BelCardLogo : public BelCardProperty {
public:
static shared_ptr<BelCardLogo> create();
static shared_ptr<BelCardLogo> parse(const string& input);
static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
......@@ -40,7 +37,6 @@ namespace belcard {
class BelCardOrganization : public BelCardProperty {
public:
static shared_ptr<BelCardOrganization> create();
static shared_ptr<BelCardOrganization> parse(const string& input);
static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
......@@ -49,7 +45,6 @@ namespace belcard {
class BelCardMember : public BelCardProperty {
public:
static shared_ptr<BelCardMember> create();
static shared_ptr<BelCardMember> parse(const string& input);
static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
......@@ -58,7 +53,6 @@ namespace belcard {
class BelCardRelated : public BelCardProperty {
public:
static shared_ptr<BelCardRelated> create();
static shared_ptr<BelCardRelated> parse(const string& input);
static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
......
......@@ -18,7 +18,6 @@ namespace belcard {
string _name;
string _value;
public:
static shared_ptr<BelCardParam> create();
static shared_ptr<BelCardParam> parse(const string& input);
static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
......@@ -40,7 +39,6 @@ namespace belcard {
class BelCardLanguageParam : public BelCardParam {
public:
static shared_ptr<BelCardLanguageParam> create();
static shared_ptr<BelCardLanguageParam> parse(const string& input);
static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
......@@ -49,7 +47,6 @@ namespace belcard {
class BelCardValueParam : public BelCardParam {
public:
static shared_ptr<BelCardValueParam> create();
static shared_ptr<BelCardValueParam> parse(const string& input);
static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
......@@ -58,7 +55,6 @@ namespace belcard {
class BelCardPrefParam : public BelCardParam {
public:
static shared_ptr<BelCardPrefParam> create();
static shared_ptr<BelCardPrefParam> parse(const string& input);
static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
......@@ -67,7 +63,6 @@ namespace belcard {
class BelCardAlternativeIdParam : public BelCardParam {
public:
static shared_ptr<BelCardAlternativeIdParam> create();
static shared_ptr<BelCardAlternativeIdParam> parse(const string& input);
static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
......@@ -76,7 +71,6 @@ namespace belcard {
class BelCardParamIdParam : public BelCardParam {
public:
static shared_ptr<BelCardParamIdParam> create();
static shared_ptr<BelCardParamIdParam> parse(const string& input);
static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
......@@ -85,7 +79,6 @@ namespace belcard {
class BelCardTypeParam : public BelCardParam {
public:
static shared_ptr<BelCardTypeParam> create();
static shared_ptr<BelCardTypeParam> parse(const string& input);
static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
......@@ -94,7 +87,6 @@ namespace belcard {
class BelCardMediaTypeParam : public BelCardParam {
public:
static shared_ptr<BelCardMediaTypeParam> create();
static shared_ptr<BelCardMediaTypeParam> parse(const string& input);
static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
......@@ -103,7 +95,6 @@ namespace belcard {
class BelCardCALSCALEParam : public BelCardParam {
public:
static shared_ptr<BelCardCALSCALEParam> create();
static shared_ptr<BelCardCALSCALEParam> parse(const string& input);
static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
......@@ -112,7 +103,6 @@ namespace belcard {
class BelCardSortAsParam : public BelCardParam {
public:
static shared_ptr<BelCardSortAsParam> create();
static shared_ptr<BelCardSortAsParam> parse(const string& input);
static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
......@@ -121,7 +111,6 @@ namespace belcard {
class BelCardGeoParam : public BelCardParam {
public:
static shared_ptr<BelCardGeoParam> create();
static shared_ptr<BelCardGeoParam> parse(const string& input);
static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
......@@ -130,7 +119,6 @@ namespace belcard {
class BelCardTimezoneParam : public BelCardParam {
public:
static shared_ptr<BelCardTimezoneParam> create();
static shared_ptr<BelCardTimezoneParam> parse(const string& input);
static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
......@@ -139,7 +127,6 @@ namespace belcard {
class BelCardLabelParam : public BelCardParam {
public:
static shared_ptr<BelCardLabelParam> create();
static shared_ptr<BelCardLabelParam> parse(const string& input);
static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
......
......@@ -34,7 +34,6 @@ namespace belcard {
list<shared_ptr<BelCardParam>> _params;
public:
static shared_ptr<BelCardProperty> create();
static shared_ptr<BelCardProperty> parse(const string& input);
static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
......
......@@ -13,7 +13,6 @@ using namespace::belr;
namespace belcard {
class BelCardKey : public BelCardProperty {
public:
static shared_ptr<BelCardKey> create();
static shared_ptr<BelCardKey> parse(const string& input);
static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
......
......@@ -4,10 +4,6 @@ using namespace::std;
using namespace::belr;
using namespace::belcard;
shared_ptr<BelCardAddress> BelCardAddress::create() {
return BelCardGeneric::create<BelCardAddress>();
}
shared_ptr<BelCardAddress> BelCardAddress::parse(const string& input) {
ABNFGrammarBuilder grammar_builder;
shared_ptr<Grammar> grammar = grammar_builder.createFromAbnf((const char*)vcard_grammar, make_shared<CoreRules>());
......@@ -19,7 +15,7 @@ shared_ptr<BelCardAddress> BelCardAddress::parse(const string& input) {
}
void BelCardAddress::setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser) {
parser->setHandler("ADR", make_fn(&BelCardAddress::create))
parser->setHandler("ADR", make_fn(BelCardGeneric::create<BelCardAddress>))
->setCollector("group", make_sfn(&BelCardProperty::setGroup))
->setCollector("any-param", make_sfn(&BelCardProperty::addParam))
->setCollector("VALUE-param", make_sfn(&BelCardProperty::setValueParam))
......
......@@ -4,10 +4,6 @@ using namespace::std;
using namespace::belr;
using namespace::belcard;
shared_ptr<BelCardFBURL> BelCardFBURL::create() {
return BelCardGeneric::create<BelCardFBURL>();
}
shared_ptr<BelCardFBURL> BelCardFBURL::parse(const string& input) {
ABNFGrammarBuilder grammar_builder;
shared_ptr<Grammar> grammar = grammar_builder.createFromAbnf((const char*)vcard_grammar, make_shared<CoreRules>());
......@@ -19,7 +15,7 @@ shared_ptr<BelCardFBURL> BelCardFBURL::parse(const string& input) {
}
void BelCardFBURL::setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser) {
parser->setHandler("FBURL", make_fn(&BelCardFBURL::create))
parser->setHandler("FBURL", make_fn(BelCardGeneric::create<BelCardFBURL>))
->setCollector("group", make_sfn(&BelCardProperty::setGroup))
->setCollector("any-param", make_sfn(&BelCardProperty::addParam))
->setCollector("VALUE-param", make_sfn(&BelCardProperty::setValueParam))
......@@ -35,10 +31,6 @@ BelCardFBURL::BelCardFBURL() : BelCardProperty() {
setName("FBURL");
}
shared_ptr<BelCardCALADRURI> BelCardCALADRURI::create() {
return BelCardGeneric::create<BelCardCALADRURI>();
}
shared_ptr<BelCardCALADRURI> BelCardCALADRURI::parse(const string& input) {
ABNFGrammarBuilder grammar_builder;
shared_ptr<Grammar> grammar = grammar_builder.createFromAbnf((const char*)vcard_grammar, make_shared<CoreRules>());
......@@ -50,7 +42,7 @@ shared_ptr<BelCardCALADRURI> BelCardCALADRURI::parse(const string& input) {
}
void BelCardCALADRURI::setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser) {
parser->setHandler("CALADRURI", make_fn(&BelCardCALADRURI::create))
parser->setHandler("CALADRURI", make_fn(BelCardGeneric::create<BelCardCALADRURI>))
->setCollector("group", make_sfn(&BelCardProperty::setGroup))
->setCollector("any-param", make_sfn(&BelCardProperty::addParam))
->setCollector("VALUE-param", make_sfn(&BelCardProperty::setValueParam))
......@@ -66,10 +58,6 @@ BelCardCALADRURI::BelCardCALADRURI() : BelCardProperty() {
setName("CALADRURI");
}
shared_ptr<BelCardCALURI> BelCardCALURI::create() {
return BelCardGeneric::create<BelCardCALURI>();
}
shared_ptr<BelCardCALURI> BelCardCALURI::parse(const string& input) {
ABNFGrammarBuilder grammar_builder;
shared_ptr<Grammar> grammar = grammar_builder.createFromAbnf((const char*)vcard_grammar, make_shared<CoreRules>());
......@@ -81,7 +69,7 @@ shared_ptr<BelCardCALURI> BelCardCALURI::parse(const string& input) {
}
void BelCardCALURI::setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser) {
parser->setHandler("CALURI", make_fn(&BelCardCALURI::create))
parser->setHandler("CALURI", make_fn(BelCardGeneric::create<BelCardCALURI>))
->setCollector("group", make_sfn(&BelCardProperty::setGroup))
->setCollector("any-param", make_sfn(&BelCardProperty::addParam))
->setCollector("VALUE-param", make_sfn(&BelCardProperty::setValueParam))
......
......@@ -4,10 +4,6 @@ using namespace::std;
using namespace::belr;
using namespace::belcard;
shared_ptr<BelCardPhoneNumber> BelCardPhoneNumber::create() {
return BelCardGeneric::create<BelCardPhoneNumber>();
}
shared_ptr<BelCardPhoneNumber> BelCardPhoneNumber::parse(const string& input) {
ABNFGrammarBuilder grammar_builder;
shared_ptr<Grammar> grammar = grammar_builder.createFromAbnf((const char*)vcard_grammar, make_shared<CoreRules>());
......@@ -19,7 +15,7 @@ shared_ptr<BelCardPhoneNumber> BelCardPhoneNumber::parse(const string& input) {
}
void BelCardPhoneNumber::setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser) {
parser->setHandler("TEL", make_fn(&BelCardPhoneNumber::create))
parser->setHandler("TEL", make_fn(BelCardGeneric::create<BelCardPhoneNumber>))
->setCollector("group", make_sfn(&BelCardProperty::setGroup))
->setCollector("any-param", make_sfn(&BelCardProperty::addParam))
->setCollector("VALUE-param", make_sfn(&BelCardProperty::setValueParam))
......@@ -34,10 +30,6 @@ BelCardPhoneNumber::BelCardPhoneNumber() : BelCardProperty() {
setName("TEL");
}
shared_ptr<BelCardEmail> BelCardEmail::create() {
return BelCardGeneric::create<BelCardEmail>();
}
shared_ptr<BelCardEmail> BelCardEmail::parse(const string& input) {
ABNFGrammarBuilder grammar_builder;
shared_ptr<Grammar> grammar = grammar_builder.createFromAbnf((const char*)vcard_grammar, make_shared<CoreRules>());
......@@ -49,7 +41,7 @@ shared_ptr<BelCardEmail> BelCardEmail::parse(const string& input) {
}
void BelCardEmail::setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser) {
parser->setHandler("EMAIL", make_fn(&BelCardEmail::create))
parser->setHandler("EMAIL", make_fn(BelCardGeneric::create<BelCardEmail>))
->setCollector("group", make_sfn(&BelCardProperty::setGroup))
->setCollector("any-param", make_sfn(&BelCardProperty::addParam))
->setCollector("VALUE-param", make_sfn(&BelCardProperty::setValueParam))
......@@ -64,10 +56,6 @@ BelCardEmail::BelCardEmail() : BelCardProperty() {
setName("EMAIL");
}
shared_ptr<BelCardImpp> BelCardImpp::create() {
return BelCardGeneric::create<BelCardImpp>();
}
shared_ptr<BelCardImpp> BelCardImpp::parse(const string& input) {
ABNFGrammarBuilder grammar_builder;
shared_ptr<Grammar> grammar = grammar_builder.createFromAbnf((const char*)vcard_grammar, make_shared<CoreRules>());
......@@ -79,7 +67,7 @@ shared_ptr<BelCardImpp> BelCardImpp::parse(const string& input) {
}
void BelCardImpp::setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser) {
parser->setHandler("IMPP", make_fn(&BelCardImpp::create))
parser->setHandler("IMPP", make_fn(BelCardGeneric::create<BelCardImpp>))
->setCollector("group", make_sfn(&BelCardProperty::setGroup))
->setCollector("any-param", make_sfn(&BelCardProperty::addParam))
->setCollector("VALUE-param", make_sfn(&BelCardProperty::setValueParam))
......@@ -95,10 +83,6 @@ BelCardImpp::BelCardImpp() : BelCardProperty() {
setName("IMPP");
}
shared_ptr<BelCardLang> BelCardLang::create() {
return BelCardGeneric::create<BelCardLang>();
}
shared_ptr<BelCardLang> BelCardLang::parse(const string& input) {
ABNFGrammarBuilder grammar_builder;
shared_ptr<Grammar> grammar = grammar_builder.createFromAbnf((const char*)vcard_grammar, make_shared<CoreRules>());
......@@ -110,7 +94,7 @@ shared_ptr<BelCardLang> BelCardLang::parse(const string& input) {
}
void BelCardLang::setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser) {
parser->setHandler("LANG", make_fn(&BelCardLang::create))
parser->setHandler("LANG", make_fn(BelCardGeneric::create<BelCardLang>))
->setCollector("group", make_sfn(&BelCardProperty::setGroup))
->setCollector("any-param", make_sfn(&BelCardProperty::addParam))
->setCollector("VALUE-param", make_sfn(&BelCardProperty::setValueParam))
......
......@@ -4,10 +4,6 @@ using namespace::std;
using namespace::belr;
using namespace::belcard;
shared_ptr<BelCardCategories> BelCardCategories::create() {
return BelCardGeneric::create<BelCardCategories>();
}
shared_ptr<BelCardCategories> BelCardCategories::parse(const string& input) {
ABNFGrammarBuilder grammar_builder;
shared_ptr<Grammar> grammar = grammar_builder.createFromAbnf((const char*)vcard_grammar, make_shared<CoreRules>());
......@@ -19,7 +15,7 @@ shared_ptr<BelCardCategories> BelCardCategories::parse(const string& input) {
}
void BelCardCategories::setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser) {
parser->setHandler("CATEGORIES", make_fn(&BelCardCategories::create))
parser->setHandler("CATEGORIES", make_fn(BelCardGeneric::create<BelCardCategories>))
->setCollector("group", make_sfn(&BelCardProperty::setGroup))
->setCollector("any-param", make_sfn(&BelCardProperty::addParam))
->setCollector("VALUE-param", make_sfn(&BelCardProperty::setValueParam))
......@@ -34,10 +30,6 @@ BelCardCategories::BelCardCategories() : BelCardProperty() {
setName("CATEGORIES");
}
shared_ptr<BelCardNote> BelCardNote::create() {
return BelCardGeneric::create<BelCardNote>();
}
shared_ptr<BelCardNote> BelCardNote::parse(const string& input) {
ABNFGrammarBuilder grammar_builder;
shared_ptr<Grammar> grammar = grammar_builder.createFromAbnf((const char*)vcard_grammar, make_shared<CoreRules>());
......@@ -49,7 +41,7 @@ shared_ptr<BelCardNote> BelCardNote::parse(const string& input) {
}
void BelCardNote::setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser) {
parser->setHandler("NOTE", make_fn(&BelCardNote::create))
parser->setHandler("NOTE", make_fn(BelCardGeneric::create<BelCardNote>))
->setCollector("group", make_sfn(&BelCardProperty::setGroup))
->setCollector("any-param", make_sfn(&BelCardProperty::addParam))
->setCollector("VALUE-param", make_sfn(&BelCardProperty::setValueParam))
......@@ -65,10 +57,6 @@ BelCardNote::BelCardNote() : BelCardProperty() {
setName("NOTE");
}
shared_ptr<BelCardProductId> BelCardProductId::create() {
return BelCardGeneric::create<BelCardProductId>();
}
shared_ptr<BelCardProductId> BelCardProductId::parse(const string& input) {
ABNFGrammarBuilder grammar_builder;
shared_ptr<Grammar> grammar = grammar_builder.createFromAbnf((const char*)vcard_grammar, make_shared<CoreRules>());
......@@ -80,7 +68,7 @@ shared_ptr<BelCardProductId> BelCardProductId::parse(const string& input) {
}
void BelCardProductId::setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser) {
parser->setHandler("PRODID", make_fn(&BelCardProductId::create))
parser->setHandler("PRODID", make_fn(BelCardGeneric::create<BelCardProductId>))
->setCollector("group", make_sfn(&BelCardProperty::setGroup))
->setCollector("any-param", make_sfn(&BelCardProperty::addParam))
->setCollector("VALUE-param", make_sfn(&BelCardProperty::setValueParam))
......@@ -91,10 +79,6 @@ BelCardProductId::BelCardProductId() : BelCardProperty() {
setName("PRODID");
}
shared_ptr<BelCardRevision> BelCardRevision::create() {
return BelCardGeneric::create<BelCardRevision>();
}
shared_ptr<BelCardRevision> BelCardRevision::parse(const string& input) {
ABNFGrammarBuilder grammar_builder;
shared_ptr<Grammar> grammar = grammar_builder.createFromAbnf((const char*)vcard_grammar, make_shared<CoreRules>());
......@@ -106,7 +90,7 @@ shared_ptr<BelCardRevision> BelCardRevision::parse(const string& input) {
}
void BelCardRevision::setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser) {
parser->setHandler("REV", make_fn(&BelCardRevision::create))
parser->setHandler("REV", make_fn(BelCardGeneric::create<BelCardRevision>))
->setCollector("group", make_sfn(&BelCardProperty::setGroup))
->setCollector("any-param", make_sfn(&BelCardProperty::addParam))
->setCollector("VALUE-param", make_sfn(&BelCardProperty::setValueParam))
......@@ -117,10 +101,6 @@ BelCardRevision::BelCardRevision() : BelCardProperty() {
setName("REV");
}
shared_ptr<BelCardSound> BelCardSound::create() {
return BelCardGeneric::create<BelCardSound>();
}
shared_ptr<BelCardSound> BelCardSound::parse(const string& input) {
ABNFGrammarBuilder grammar_builder;
shared_ptr<Grammar> grammar = grammar_builder.createFromAbnf((const char*)vcard_grammar, make_shared<CoreRules>());
......@@ -132,7 +112,7 @@ shared_ptr<BelCardSound> BelCardSound::parse(const string& input) {
}
void BelCardSound::setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser) {
parser->setHandler("SOUND", make_fn(&BelCardSound::create))
parser->setHandler("SOUND", make_fn(BelCardGeneric::create<BelCardSound>))
->setCollector("group", make_sfn(&BelCardProperty::setGroup))
->setCollector("any-param", make_sfn(&BelCardProperty::addParam))
->setCollector("VALUE-param", make_sfn(&BelCardProperty::setValueParam))
......@@ -149,10 +129,6 @@ BelCardSound::BelCardSound() : BelCardProperty() {
setName("SOUND");
}
shared_ptr<BelCardUniqueId> BelCardUniqueId::create() {
return BelCardGeneric::create<BelCardUniqueId>();
}
shared_ptr<BelCardUniqueId> BelCardUniqueId::parse(const string& input) {
ABNFGrammarBuilder grammar_builder;
shared_ptr<Grammar> grammar = grammar_builder.createFromAbnf((const char*)vcard_grammar, make_shared<CoreRules>());
......@@ -164,7 +140,7 @@ shared_ptr<BelCardUniqueId> BelCardUniqueId::parse(const string& input) {
}
void BelCardUniqueId::setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser) {
parser->setHandler("UID", make_fn(&BelCardUniqueId::create))
parser->setHandler("UID", make_fn(BelCardGeneric::create<BelCardUniqueId>))
->setCollector("group", make_sfn(&BelCardProperty::setGroup))
->setCollector("any-param", make_sfn(&BelCardProperty::addParam))
->setCollector("VALUE-param", make_sfn(&BelCardProperty::setValueParam))
......@@ -175,10 +151,6 @@ BelCardUniqueId::BelCardUniqueId() : BelCardProperty() {
setName("UID");
}
shared_ptr<BelCardClientProductIdMap> BelCardClientProductIdMap::create() {
return BelCardGeneric::create<BelCardClientProductIdMap>();
}
shared_ptr<BelCardClientProductIdMap> BelCardClientProductIdMap::parse(const string& input) {
ABNFGrammarBuilder grammar_builder;
shared_ptr<Grammar> grammar = grammar_builder.createFromAbnf((const char*)vcard_grammar, make_shared<CoreRules>());
......@@ -190,7 +162,7 @@ shared_ptr<BelCardClientProductIdMap> BelCardClientProductIdMap::parse(const str
}
void BelCardClientProductIdMap::setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser) {
parser->setHandler("CLIENTPIDMAP", make_fn(&BelCardClientProductIdMap::create))
parser->setHandler("CLIENTPIDMAP", make_fn(BelCardGeneric::create<BelCardClientProductIdMap>))
->setCollector("group", make_sfn(&BelCardProperty::setGroup))
->setCollector("any-param", make_sfn(&BelCardProperty::addParam))
->setCollector("CLIENTPIDMAP-value", make_sfn(&BelCardProperty::setValue));
......@@ -200,10 +172,6 @@ BelCardClientProductIdMap::BelCardClientProductIdMap() : BelCardProperty() {
setName("CLIENTPIDMAP");
}
shared_ptr<BelCardURL> BelCardURL::create() {
return BelCardGeneric::create<BelCardURL>();
}
shared_ptr<BelCardURL> BelCardURL::parse(const string& input) {
ABNFGrammarBuilder grammar_builder;
shared_ptr<Grammar> grammar = grammar_builder.createFromAbnf((const char*)vcard_grammar, make_shared<CoreRules>());
......@@ -215,7 +183,7 @@ shared_ptr<BelCardURL> BelCardURL::parse(const string& input) {
}
void BelCardURL::setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser) {
parser->setHandler("URL", make_fn(&BelCardURL::create))
parser->setHandler("URL", make_fn(BelCardGeneric::create<BelCardURL>))
->setCollector("group", make_sfn(&BelCardProperty::setGroup))
->setCollector("any-param", make_sfn(&BelCardProperty::addParam))
->setCollector("VALUE-param", make_sfn(&BelCardProperty::setValueParam))
......
......@@ -4,10 +4,6 @@ using namespace::std;
using namespace::belr;
using namespace::belcard;
shared_ptr<BelCardSource> BelCardSource::create() {
return BelCardGeneric::create<BelCardSource>();
}
shared_ptr<BelCardSource> BelCardSource::parse(const string& input) {
ABNFGrammarBuilder grammar_builder;
shared_ptr<Grammar> grammar = grammar_builder.createFromAbnf((const char*)vcard_grammar, make_shared<CoreRules>());
......@@ -19,7 +15,7 @@ shared_ptr<BelCardSource> BelCardSource::parse(const string& input) {
}
void BelCardSource::setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser) {
parser->setHandler("SOURCE", make_fn(&BelCardSource::create))
parser->setHandler("SOURCE", make_fn(BelCardGeneric::create<BelCardSource>))
->setCollector("group", make_sfn(&BelCardProperty::setGroup))
->setCollector("any-param", make_sfn(&BelCardProperty::addParam))
->setCollector("VALUE-param", make_sfn(&BelCardProperty::setValueParam))
......@@ -34,10 +30,6 @@ BelCardSource::BelCardSource() : BelCardProperty() {
setName("SOURCE");
}