summaryrefslogtreecommitdiff
path: root/src/xcardconversions.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/xcardconversions.h')
-rw-r--r--src/xcardconversions.h42
1 files changed, 28 insertions, 14 deletions
diff --git a/src/xcardconversions.h b/src/xcardconversions.h
index 1960c71..39d6db1 100644
--- a/src/xcardconversions.h
+++ b/src/xcardconversions.h
@@ -447,7 +447,8 @@ void writeCard<Kolab::Contact>(vcard_4_0::vcard &vcard, const Kolab::Contact &co
if (!contact.categories().empty()) {
vcard_4_0::vcard::categories_type cat;
vcard_4_0::vcard::categories_type::text_sequence seq;
- BOOST_FOREACH(const std::string &s, contact.categories()) {
+ const std::vector<std::string> &l = contact.categories();
+ BOOST_FOREACH(const std::string &s, l) {
seq.push_back(s);
}
cat.text(seq);
@@ -479,14 +480,16 @@ void writeCard<Kolab::Contact>(vcard_4_0::vcard &vcard, const Kolab::Contact &co
if (!contact.affiliations().empty()) {
vcard::group_sequence affiliations;
- BOOST_FOREACH(const Affiliation &a, contact.affiliations()) {
+ const std::vector<Affiliation> &l = contact.affiliations();
+ BOOST_FOREACH(const Affiliation &a, l) {
if (a == Affiliation()) { //skip empty ones
LOG("skipped empty affiliation");
continue;
}
affiliationPropType::org_type org;
org.text().push_back(a.organisation());
- BOOST_FOREACH(const std::string &unit, a.organisationalUnits()) {
+ const std::vector<std::string> &orgUnits = a.organisationalUnits();
+ BOOST_FOREACH(const std::string &unit, orgUnits) {
org.text().push_back(unit);
}
vcard::group_type group(org);
@@ -494,10 +497,12 @@ void writeCard<Kolab::Contact>(vcard_4_0::vcard &vcard, const Kolab::Contact &co
group.logo(affiliationPropType::logo_type(uriInlineEncoding(a.logo(), a.logoMimetype())));
}
group.role(fromList<affiliationPropType::role_type>(a.roles()));
- BOOST_FOREACH(const Related &rel, a.relateds()) {
+ const std::vector<Related> &relateds = a.relateds();
+ BOOST_FOREACH(const Related &rel, relateds) {
group.related().push_back(fromRelated(rel));
}
- BOOST_FOREACH(const Address &adr, a.addresses()) {
+ const std::vector<Address> &addersses = a.addresses();
+ BOOST_FOREACH(const Address &adr, addersses) {
group.adr().push_back(fromAddress(adr));
}
@@ -508,7 +513,8 @@ void writeCard<Kolab::Contact>(vcard_4_0::vcard &vcard, const Kolab::Contact &co
if (!contact.urls().empty()) {
vcard_4_0::vcard::url_sequence urls;
- BOOST_FOREACH(const Kolab::Url &url, contact.urls()) {
+ const std::vector<Url> &l = contact.urls();
+ BOOST_FOREACH(const Kolab::Url &url, l) {
vcard::url_type u(url.url());
if (url.type() == Kolab::Url::Blog) {
vcard::adr_type::parameters_type b;
@@ -525,7 +531,8 @@ void writeCard<Kolab::Contact>(vcard_4_0::vcard &vcard, const Kolab::Contact &co
if (!contact.addresses().empty()) {
vcard::adr_sequence adrs;
int index = 0;
- BOOST_FOREACH(const Kolab::Address &address, contact.addresses()) {
+ const std::vector<Address> &l = contact.addresses();
+ BOOST_FOREACH(const Kolab::Address &address, l) {
vcard::adr_type a = fromAddress(address);
if(contact.addressPreferredIndex() == index) {
if (a.parameters()) {
@@ -544,7 +551,8 @@ void writeCard<Kolab::Contact>(vcard_4_0::vcard &vcard, const Kolab::Contact &co
if (!contact.nickNames().empty()) {
vcard::nickname_type::text_sequence textsequence;
- BOOST_FOREACH(const std::string &s, contact.nickNames()) {
+ const std::vector<std::string> &l = contact.nickNames();
+ BOOST_FOREACH(const std::string &s, l) {
textsequence.push_back(s);
}
vcard::nickname_type nickName;
@@ -554,7 +562,8 @@ void writeCard<Kolab::Contact>(vcard_4_0::vcard &vcard, const Kolab::Contact &co
if (!contact.relateds().empty()) {
vcard::related_sequence seq;
- BOOST_FOREACH(const Kolab::Related &r, contact.relateds()) {
+ const std::vector<Related> &l = contact.relateds();
+ BOOST_FOREACH(const Kolab::Related &r, l) {
seq.push_back(fromRelated(r));
}
vcard.related(seq);
@@ -606,7 +615,8 @@ void writeCard<Kolab::Contact>(vcard_4_0::vcard &vcard, const Kolab::Contact &co
if (!contact.telephones().empty()) {
vcard::tel_sequence seq;
int index = 0;
- BOOST_FOREACH(const Kolab::Telephone &t, contact.telephones()) {
+ const std::vector<Telephone> &l = contact.telephones();
+ BOOST_FOREACH(const Kolab::Telephone &t, l) {
vcard::tel_type tel(t.number());
vcard_4_0::typeParamType telTypeParam;
if (t.types() & Kolab::Telephone::Car) {
@@ -664,7 +674,8 @@ void writeCard<Kolab::Contact>(vcard_4_0::vcard &vcard, const Kolab::Contact &co
if (!contact.gpsPos().empty()) {
vcard_4_0::vcard::geo_sequence list;
- BOOST_FOREACH(const Kolab::Geo &g ,contact.gpsPos()) {
+ const std::vector<Geo> &l = contact.gpsPos();
+ BOOST_FOREACH(const Kolab::Geo &g, l) {
list.push_back(vcard_4_0::vcard::geo_type(toGeoUri(g.latitude, g.longitude)));
}
vcard.geo(list);
@@ -700,7 +711,8 @@ void writeCard<Kolab::Contact>(vcard_4_0::vcard &vcard, const Kolab::Contact &co
if (!contact.keys().empty()) {
vcard_4_0::vcard::key_sequence keys;
- BOOST_FOREACH (const Kolab::Key &k, contact.keys()) {
+ const std::vector<Key> &l = contact.keys();
+ BOOST_FOREACH (const Kolab::Key &k, l) {
switch (k.type()) {
case Kolab::Key::PGP:
keys.push_back(vcard_4_0::keyPropType(uriInlineEncoding(k.key(), MIME_PGP_KEYS)));
@@ -727,7 +739,8 @@ void writeCard<Kolab::DistList>(vcard_4_0::vcard &vcard, const Kolab::DistList &
{
if (!distlist.members().empty()) {
vcard_4_0::vcard::member_sequence members;
- BOOST_FOREACH (const Kolab::ContactReference &m, distlist.members()) {
+ const std::vector<ContactReference> &l = distlist.members();
+ BOOST_FOREACH (const Kolab::ContactReference &m, l) {
members.push_back(vcard_4_0::vcard::member_type(Shared::fromContactReference(m)));
}
vcard.member(members);
@@ -759,7 +772,8 @@ std::string serializeCard(const T &card, const std::string prod = std::string())
writeCard<T>(vcard, card);
if (!card.customProperties().empty()) {
- BOOST_FOREACH(const Kolab::CustomProperty &a, card.customProperties()) {
+ const std::vector<Kolab::CustomProperty> &l = card.customProperties();
+ BOOST_FOREACH(const Kolab::CustomProperty &a, l) {
vcard.x_custom().push_back(vcard_4_0::CustomType(a.identifier, a.value));
}
}