summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2012-04-11 17:04:26 (GMT)
committerChristian Mollekopf <chrigi_1@fastmail.fm>2012-04-11 17:04:26 (GMT)
commit5d5a3c53f4a2a5a5c672f512b6ffea5a693d1231 (patch)
treebc77a9309e4ed8d78988323d59979defd529adc5
parentec1f10aeafe258099e131b2166c69100a5a81b39 (diff)
downloadlibkolabxml-5d5a3c53f4a2a5a5c672f512b6ffea5a693d1231.tar.gz
Fixed build.
Due to some rvalue detection bug in gcc, we get an (invalid) warning, breaking the boost_foreach with -Wconversion. See https://svn.boost.org/trac/boost/ticket/5522 for further information. The applied fix is more to type but shouldn't have other disandvantages.
-rw-r--r--src/kolabconversions.h6
-rw-r--r--src/xcalconversions.h25
-rw-r--r--src/xcardconversions.h42
3 files changed, 48 insertions, 25 deletions
diff --git a/src/kolabconversions.h b/src/kolabconversions.h
index 056839a..a48c2ae 100644
--- a/src/kolabconversions.h
+++ b/src/kolabconversions.h
@@ -59,7 +59,8 @@ std::string serializeObject(const Kolab::Note &note, const std::string prod = st
if (!note.categories().empty()) {
KolabXSD::Note::categories_sequence categories;
- BOOST_FOREACH(const std::string &c, note.categories()) {
+ const std::vector<std::string> &l = note.categories();
+ BOOST_FOREACH(const std::string &c, l) {
categories.push_back(c);
}
n.categories(categories);
@@ -84,7 +85,8 @@ std::string serializeObject(const Kolab::Note &note, const std::string prod = st
n.color(note.color());
if (!note.customProperties().empty()) {
- BOOST_FOREACH(const Kolab::CustomProperty &a, note.customProperties()) {
+ const std::vector<Kolab::CustomProperty> &l = note.customProperties();
+ BOOST_FOREACH(const Kolab::CustomProperty &a, l) {
n.x_custom().push_back(KolabXSD::CustomType(a.identifier, a.value));
}
}
diff --git a/src/xcalconversions.h b/src/xcalconversions.h
index 1390016..759893a 100644
--- a/src/xcalconversions.h
+++ b/src/xcalconversions.h
@@ -1014,7 +1014,8 @@ std::auto_ptr< icalendar_2_0::RrulePropType > recurrenceProperty(const Recurrenc
if (!r.byday().empty()) {
RecurType::byday_sequence byday;
- BOOST_FOREACH(const Kolab::DayPos &daypos, r.byday()) {
+ const std::vector<Kolab::DayPos> &l = r.byday();
+ BOOST_FOREACH(Kolab::DayPos daypos, l) {
byday.push_back(fromDayPos(daypos));
}
recur.byday(byday);
@@ -1112,8 +1113,8 @@ void getIncidenceProperties(T &prop, const I &inc)
}
if (!inc.attendees().empty()) {
-
- BOOST_FOREACH(const Kolab::Attendee &a, inc.attendees()) {
+ const std::vector<Kolab::Attendee> &l = inc.attendees();
+ BOOST_FOREACH(const Kolab::Attendee &a, l) {
const Kolab::ContactReference &c = a.contact();
typename properties::attendee_type attendee = fromContactReference<typename properties::attendee_type>(c);
@@ -1140,13 +1141,15 @@ void getIncidenceProperties(T &prop, const I &inc)
}
if (!inc.attachments().empty()) {
- BOOST_FOREACH(const Kolab::Attachment &a, inc.attachments()) {
+ const std::vector<Kolab::Attachment> &l = inc.attachments();
+ BOOST_FOREACH(const Kolab::Attachment &a, l) {
prop.attach().push_back(fromAttachment(a));
}
}
if (!inc.customProperties().empty()) {
- BOOST_FOREACH(const Kolab::CustomProperty &a, inc.customProperties()) {
+ const std::vector<Kolab::CustomProperty> &l = inc.customProperties();
+ BOOST_FOREACH(const Kolab::CustomProperty &a, l) {
prop.x_custom().push_back(typename properties::x_custom_type(a.identifier, a.value));
}
}
@@ -1206,7 +1209,8 @@ void getTodoEventProperties(T &prop, const I &inc)
template <typename KolabType, typename IncidenceType>
void setAlarms(typename KolabType::components_type& components, const IncidenceType &incidence)
{
- BOOST_FOREACH(const Kolab::Alarm &alarm, incidence.alarms()) {
+ const std::vector<Kolab::Alarm> &alarms = incidence.alarms();
+ BOOST_FOREACH(const Kolab::Alarm &alarm, alarms) {
typedef icalendar_2_0::ValarmType::properties_type PropType;
PropType::trigger_type trigger;
@@ -1237,14 +1241,16 @@ void setAlarms(typename KolabType::components_type& components, const IncidenceT
p = std::auto_ptr<PropType>(new PropType(PropType::action_type(DISPLAYALARM), trigger));
p->description(PropType::description_type(alarm.description()));
break;
- case Kolab::Alarm::EMailAlarm:
+ case Kolab::Alarm::EMailAlarm: {
p = std::auto_ptr<PropType>(new PropType(PropType::action_type(EMAILALARM), trigger));
p->summary(PropType::summary_type(alarm.summary()));
p->description(PropType::description_type(alarm.description()));
- BOOST_FOREACH(const Kolab::ContactReference &attendee, alarm.attendees()) {
+ const std::vector<Kolab::ContactReference> &l = alarm.attendees();
+ BOOST_FOREACH(const Kolab::ContactReference &attendee, l) {
p->attendee().push_back(icalendar_2_0::ContactType(toMailto(attendee.email(), attendee.name())));
}
break;
+ }
case Kolab::Alarm::AudioAlarm:
p = std::auto_ptr<PropType>(new PropType(PropType::action_type(AUDIOALARM), trigger));
p->description(PropType::description_type(alarm.description()));
@@ -1493,7 +1499,8 @@ template < > struct IncidenceTrait <Kolab::Todo>
if (!todo.relatedTo().empty()) {
icalendar_2_0::KolabTodo::properties_type::related_to_sequence list;
- BOOST_FOREACH(std::string relatedTo, todo.relatedTo()) {
+ const std::vector<std::string> &l = todo.relatedTo();
+ BOOST_FOREACH(const std::string &relatedTo, l) {
list.push_back(icalendar_2_0::KolabTodo::properties_type::related_to_type(relatedTo));
}
prop.related_to(list);
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));
}
}