Commit 97435b08 authored by Sylvain Berfini's avatar Sylvain Berfini 🎩

Forgot to add RFC 6474 properties to BelCard

parent b8d8e986
......@@ -13,6 +13,7 @@
#include "belcard_explanatory.hpp"
#include "belcard_security.hpp"
#include "belcard_calendar.hpp"
#include "belcard_rfc6474.hpp"
#include <string>
#include <list>
......@@ -32,6 +33,9 @@ namespace belcard {
shared_ptr<BelCardProductId> _pid;
shared_ptr<BelCardRevision> _rev;
shared_ptr<BelCardUniqueId> _uid;
shared_ptr<BelCardBirthPlace> _bplace;
shared_ptr<BelCardDeathPlace> _dplace;
shared_ptr<BelCardDeathDate> _ddate;
list<shared_ptr<BelCardNickname>> _nicknames;
list<shared_ptr<BelCardPhoto>> _photos;
list<shared_ptr<BelCardAddress>> _addr;
......@@ -93,6 +97,15 @@ namespace belcard {
void setUniqueId(const shared_ptr<BelCardUniqueId> &uid);
const shared_ptr<BelCardUniqueId> &getUniqueId() const;
void setBirthPlace(const shared_ptr<BelCardBirthPlace> &place);
const shared_ptr<BelCardBirthPlace> &getBirthPlace() const;
void setDeathPlace(const shared_ptr<BelCardDeathPlace> &place);
const shared_ptr<BelCardDeathPlace> &getDeathPlace() const;
void setDeathDate(const shared_ptr<BelCardDeathDate> &date);
const shared_ptr<BelCardDeathDate> &getDeathDate() const;
void addNickname(const shared_ptr<BelCardNickname> &nickname);
const list<shared_ptr<BelCardNickname>> &getNicknames() const;
......
......@@ -42,7 +42,10 @@ void BelCard::setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser
->setCollector("KEY", make_sfn(&BelCard::addKey))
->setCollector("FBURL", make_sfn(&BelCard::addFBURL))
->setCollector("CALADRURI", make_sfn(&BelCard::addCALADRURI))
->setCollector("CALURI", make_sfn(&BelCard::addCALURI));
->setCollector("CALURI", make_sfn(&BelCard::addCALURI))
->setCollector("BIRTHPLACE", make_sfn(&BelCard::setBirthPlace))
->setCollector("DEATHDATE", make_sfn(&BelCard::setDeathDate))
->setCollector("DEATHPLACE", make_sfn(&BelCard::setDeathPlace));
}
BelCard::BelCard() : BelCardGeneric() {
......@@ -150,6 +153,39 @@ const shared_ptr<BelCardUniqueId> &BelCard::getUniqueId() const {
return _uid;
}
void BelCard::setBirthPlace(const shared_ptr<BelCardBirthPlace> &place) {
if (_bplace) {
removeProperty(_bplace);
}
_bplace = place;
addProperty(_bplace);
}
const shared_ptr<BelCardBirthPlace> &BelCard::getBirthPlace() const {
return _bplace;
}
void BelCard::setDeathPlace(const shared_ptr<BelCardDeathPlace> &place) {
if (_dplace) {
removeProperty(_dplace);
}
_dplace = place;
addProperty(_dplace);
}
const shared_ptr<BelCardDeathPlace> &BelCard::getDeathPlace() const {
return _dplace;
}
void BelCard::setDeathDate(const shared_ptr<BelCardDeathDate> &date) {
if (_ddate) {
removeProperty(_ddate);
}
_ddate = date;
addProperty(_ddate);
}
const shared_ptr<BelCardDeathDate> &BelCard::getDeathDate() const {
return _ddate;
}
void BelCard::addNickname(const shared_ptr<BelCardNickname> &nickname) {
_nicknames.push_back(nickname);
addProperty(nickname);
......
......@@ -66,6 +66,10 @@ shared_ptr<BelCard> BelCardParser::parse(const string &input) {
BelCardFBURL::setHandlerAndCollectors(&parser);
BelCardCALADRURI::setHandlerAndCollectors(&parser);
BelCardCALURI::setHandlerAndCollectors(&parser);
BelCardBirthPlace::setHandlerAndCollectors(&parser);
BelCardDeathPlace::setHandlerAndCollectors(&parser);
BelCardDeathDate::setHandlerAndCollectors(&parser);
size_t parsedSize = 0;
shared_ptr<BelCardGeneric> ret = parser.parseInput("vcard", vcard, &parsedSize);
......
This diff was suppressed by a .gitattributes entry.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment