diff options
author | Patrick Ohly <patrick.ohly@intel.com> | 2012-09-05 14:05:27 +0200 |
---|---|---|
committer | Patrick Ohly <patrick.ohly@intel.com> | 2012-10-25 16:43:46 +0200 |
commit | 7651b432c29e71f13e90748d8793238dbdc4c178 (patch) | |
tree | 6b7e22ff41e2b534c4b076e354891b57aa8b8c04 /src/dbus/server/pim/folks.cpp | |
parent | d260b5e0328eb5356596a52d03dc455e9043f625 (diff) |
folks: added support for retrieving contacts
The choice of std::vector in getContacts() comes from the goal of
using this function more or less directly in a D-Bus implementation.
It works efficiently because the size can be computed in advance.
A more general API, like for example one which stores via some append
iterator, would also have been possible but probably isn't worth
the effort.
Diffstat (limited to 'src/dbus/server/pim/folks.cpp')
-rw-r--r-- | src/dbus/server/pim/folks.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/dbus/server/pim/folks.cpp b/src/dbus/server/pim/folks.cpp index 9dff5523..0c43719f 100644 --- a/src/dbus/server/pim/folks.cpp +++ b/src/dbus/server/pim/folks.cpp @@ -26,6 +26,21 @@ #include <syncevo/declarations.h> SE_BEGIN_CXX +void IndividualView::readContacts(int start, int count, std::vector<FolksIndividualCXX> &contacts) +{ + contacts.clear(); + if (start < size()) { + int actualCount = size() - start; + if (actualCount > count) { + actualCount = count; + } + contacts.reserve(actualCount); + for (int i = start; i < start + actualCount; i++) { + contacts.push_back(getContact(i)); + } + } +} + bool IndividualCompare::compare(const Criteria_t &a, const Criteria_t &b) const { Criteria_t::const_iterator ita = a.begin(), |