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

Improved BelCard API

parent b2b31336
......@@ -24,6 +24,8 @@ using namespace::belr;
namespace belcard {
class BelCard : public BelCardGeneric {
private:
std::string _folded_string;
shared_ptr<BelCardKind> _kind;
shared_ptr<BelCardFullName> _fn;
shared_ptr<BelCardName> _n;
......@@ -191,8 +193,8 @@ namespace belcard {
const list<shared_ptr<BelCardProperty>> &getProperties() const;
void removeProperty(const shared_ptr<BelCardProperty> &property);
const string toFoldedString() const;
const bool assertRFCCompliance() const;
string& toFoldedString();
bool assertRFCCompliance() const;
virtual void serialize(ostream &output) const;
};
......
......@@ -418,12 +418,13 @@ void BelCard::serialize(ostream& output) const {
output << "END:VCARD\r\n";
}
const string BelCard::toFoldedString() const {
string vcard = toString();
return belcard_fold(vcard);
string& BelCard::toFoldedString() {
string temp = toString();
_folded_string = belcard_fold(temp);
return _folded_string;
}
const bool BelCard::assertRFCCompliance() const {
bool BelCard::assertRFCCompliance() const {
if (!_fn) {
return false;
}
......
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