akonadi
Akonadi::ProtocolHelper Class Reference
#include <protocolhelper_p.h>
Public Types | |
| enum | PartNamespace { PartGlobal, PartPayload, PartAttribute } |
Static Public Member Functions | |
| static QByteArray | attributesToByteArray (const Entity &entity, bool ns=false) |
| static QByteArray | cachePolicyToByteArray (const CachePolicy &policy) |
| static QByteArray | decodePartIdentifier (const QByteArray &data, PartNamespace &ns) |
| static QByteArray | encodePartIdentifier (PartNamespace ns, const QByteArray &label, int version=0) |
| template<typename T > | |
| static QByteArray | entityIdToByteArray (const T &object, const QByteArray &command) |
| template<typename T > | |
| static QByteArray | entitySetToByteArray (const QList< T > &_objects, const QByteArray &command) |
| static QByteArray | hierarchicalRidToByteArray (const Collection &col) |
| static QByteArray | hierarchicalRidToByteArray (const Item &item) |
| static QByteArray | itemFetchScopeToByteArray (const ItemFetchScope &fetchScope) |
| static void | parseAncestors (const QByteArray &data, Entity *entity, int start=0) |
| static int | parseCachePolicy (const QByteArray &data, CachePolicy &policy, int start=0) |
| static int | parseCollection (const QByteArray &data, Collection &collection, int start=0) |
| static void | parseItemFetchResult (const QList< QByteArray > &lineTokens, Item &item) |
Detailed Description
For internal use only.
Helper methods for converting between libakonadi objects and their protocol representation.
- Todo:
Add unit tests for this.
Use exceptions for a useful error handling
Definition at line 45 of file protocolhelper_p.h.
Member Enumeration Documentation
| enum Akonadi::ProtocolHelper::PartNamespace |
Part namespaces.
Definition at line 49 of file protocolhelper_p.h.
Member Function Documentation
| static QByteArray Akonadi::ProtocolHelper::attributesToByteArray | ( | const Entity & | entity, | |
| bool | ns = false | |||
| ) | [static] |
Convert attributes to their protocol representation.
| static QByteArray Akonadi::ProtocolHelper::cachePolicyToByteArray | ( | const CachePolicy & | policy | ) | [static] |
Convert a cache policy object into its protocol representation.
| static QByteArray Akonadi::ProtocolHelper::decodePartIdentifier | ( | const QByteArray & | data, | |
| PartNamespace & | ns | |||
| ) | [static] |
Decode part label and namespace.
| static QByteArray Akonadi::ProtocolHelper::encodePartIdentifier | ( | PartNamespace | ns, | |
| const QByteArray & | label, | |||
| int | version = 0 | |||
| ) | [static] |
Encodes part label and namespace.
| static QByteArray Akonadi::ProtocolHelper::entityIdToByteArray | ( | const T & | object, | |
| const QByteArray & | command | |||
| ) | [inline, static] |
Converts the given object identifier into a protocol representation.
- Exceptions:
-
A Akonadi::Exception if the item set contains items with missing/invalid identifiers.
Definition at line 173 of file protocolhelper_p.h.
| static QByteArray Akonadi::ProtocolHelper::entitySetToByteArray | ( | const QList< T > & | _objects, | |
| const QByteArray & | command | |||
| ) | [inline, static] |
Converts the given set of items into a protocol representation.
- Exceptions:
-
A Akonadi::Exception if the item set contains items with missing/invalid identifiers.
Definition at line 103 of file protocolhelper_p.h.
| static QByteArray Akonadi::ProtocolHelper::hierarchicalRidToByteArray | ( | const Collection & | col | ) | [static] |
Converts the given collection's hierarchical RID into a protocol representation.
Assumes col has a valid hierarchical RID, so check that before!
| static QByteArray Akonadi::ProtocolHelper::hierarchicalRidToByteArray | ( | const Item & | item | ) | [static] |
Converts the HRID of the given item into an ASAP protocol representation.
Assumes item has a valid HRID.
| static QByteArray Akonadi::ProtocolHelper::itemFetchScopeToByteArray | ( | const ItemFetchScope & | fetchScope | ) | [static] |
Converts a given ItemFetchScope object into a protocol representation.
| static void Akonadi::ProtocolHelper::parseAncestors | ( | const QByteArray & | data, | |
| Entity * | entity, | |||
| int | start = 0 | |||
| ) | [static] |
Convert a ancestor chain from its protocol representation into an Entity object.
| static int Akonadi::ProtocolHelper::parseCachePolicy | ( | const QByteArray & | data, | |
| CachePolicy & | policy, | |||
| int | start = 0 | |||
| ) | [static] |
Parse a cache policy definition.
- Parameters:
-
data The input data. policy The parsed cache policy. start Start of the data, ie. postion after the label.
- Returns:
- Position in data after the cache policy description.
| static int Akonadi::ProtocolHelper::parseCollection | ( | const QByteArray & | data, | |
| Collection & | collection, | |||
| int | start = 0 | |||
| ) | [static] |
Parse a collection description.
- Parameters:
-
data The input data. collection The parsed collection. start Start of the data.
- Returns:
- Position in data after the collection description.
| static void Akonadi::ProtocolHelper::parseItemFetchResult | ( | const QList< QByteArray > & | lineTokens, | |
| Item & | item | |||
| ) | [static] |
Parses a single line from an item fetch job result into an Item object.
The documentation for this class was generated from the following file:
KDE 4.5 API Reference