OpenAB  1.0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
OpenAB::PIMItemIndex Class Referenceabstract

Documentation for class PIMItemIndex. PIMItemIndex is a PIMItem representation used to match and compare PIMItems. Set of PIMItem fields is stored along with comparison rules allowing matching and comparing of PIMItems. PIMItemIndex is intended to be used by OpenAB_Sync::Sync plugins. More...

#include <PIMItemIndex.hpp>

Inheritance diagram for OpenAB::PIMItemIndex:
Collaboration diagram for OpenAB::PIMItemIndex:

Classes

struct  PIMItemCheck
 Definition of check that will be made on PIMItemIndex instances when comparing them. Each check checks single field of PIMItem, and based on its role, detects if items are totally different, or items are modified version of the same item. More...
 

Public Member Functions

 PIMItemIndex (OpenAB::PIMItemType t)
 Constructor. More...
 
virtual ~PIMItemIndex ()
 Destructor, virtual by default. More...
 
virtual bool operator== (const PIMItemIndex &other) const =0
 Compare operator. Checks if two PIMItemIndex matches (may not be exactly the same) More...
 
virtual bool operator!= (const PIMItemIndex &other) const =0
 Compare operator. Checks if two PIMItemIndex not matches (are totally different) More...
 
virtual bool operator< (const PIMItemIndex &other) const =0
 Compare operator. More...
 
virtual void addKeyField (const std::string &name, const std::string &value)
 Adds new PIMItemCheck::eKey field. More...
 
virtual void addConflictField (const std::string &name, const std::string &value)
 Adds new PIMItemCheck::eConflict field. More...
 
virtual bool compare (const PIMItemIndex &other) const =0
 Compares two PIMItemIndex object, checks if two PIMItemIndex are exactly the same. In opposite to compare operator it checks PIMItemCheck::eConflict fields. More...
 
virtual std::string toString () const =0
 Returns string version of PIMItemIndex. It contains only PIMItemCheck::eKey fields. More...
 
virtual std::string toStringFull () const =0
 Returns string version of PIMItemIndex. It contains both PIMItemCheck::eKey and PIMItemCheck::eConflict fields. More...
 
OpenAB::PIMItemType getType () const
 Returns type of item that index is representing. More...
 

Protected Member Functions

bool compareVectors (const std::vector< std::string > &v1, const std::vector< std::string > &v2) const
 

Protected Attributes

std::vector< std::string > key_fields
 
std::vector< std::string > conflict_fields
 
std::vector< std::string > key_fields_names
 
std::vector< std::string > conflict_fields_names
 
std::string cached_to_string
 

Detailed Description

Documentation for class PIMItemIndex. PIMItemIndex is a PIMItem representation used to match and compare PIMItems. Set of PIMItem fields is stored along with comparison rules allowing matching and comparing of PIMItems. PIMItemIndex is intended to be used by OpenAB_Sync::Sync plugins.

Constructor & Destructor Documentation

OpenAB::PIMItemIndex::PIMItemIndex ( OpenAB::PIMItemType  t)

Constructor.

Parameters
[in]ttype of item that index is representing.
OpenAB::PIMItemIndex::~PIMItemIndex ( )
virtual

Destructor, virtual by default.

Member Function Documentation

void OpenAB::PIMItemIndex::addConflictField ( const std::string &  name,
const std::string &  value 
)
virtual

Adds new PIMItemCheck::eConflict field.

Parameters
[in]namename of field
[in]valueof field
void OpenAB::PIMItemIndex::addKeyField ( const std::string &  name,
const std::string &  value 
)
virtual

Adds new PIMItemCheck::eKey field.

Parameters
[in]namename of field
[in]valueof field
virtual bool OpenAB::PIMItemIndex::compare ( const PIMItemIndex other) const
pure virtual

Compares two PIMItemIndex object, checks if two PIMItemIndex are exactly the same. In opposite to compare operator it checks PIMItemCheck::eConflict fields.

Note
PIMItemCheck::eKey fields are not checked by this function, assumption is made that items were compared using operator ==() before, and only matching items are tested using this function.
Parameters
[in]otherinstance of PIMItemIndex to be compared with.
Returns
true if all PIMItemCheck::eConflict fields are the same in both PIMItemIndex objects, false otherwise.

Implemented in OpenAB::PIMCalendarItemIndex, and OpenAB::PIMContactItemIndex.

bool OpenAB::PIMItemIndex::compareVectors ( const std::vector< std::string > &  v1,
const std::vector< std::string > &  v2 
) const
protected
OpenAB::PIMItemType OpenAB::PIMItemIndex::getType ( ) const

Returns type of item that index is representing.

Returns
type of item that index is representing
virtual bool OpenAB::PIMItemIndex::operator!= ( const PIMItemIndex other) const
pure virtual

Compare operator. Checks if two PIMItemIndex not matches (are totally different)

Parameters
[in]otherinstance of PIMItemIndex to be compared with.
Returns
true if any PIMItemCheck::eKey fields is different in both PIMItemIndex objects, false otherwise.

Implemented in OpenAB::PIMCalendarItemIndex, and OpenAB::PIMContactItemIndex.

virtual bool OpenAB::PIMItemIndex::operator< ( const PIMItemIndex other) const
pure virtual

Compare operator.

Parameters
[in]otherinstance of PIMItemIndex to be compared with.
Returns
true if index should be sorted before other index, according to theirs PIMItemCheck::eKey fields alphabetic order.
Note
Required to be able to store PIMItemIndex objects in std::map containers.

Implemented in OpenAB::PIMCalendarItemIndex, and OpenAB::PIMContactItemIndex.

virtual bool OpenAB::PIMItemIndex::operator== ( const PIMItemIndex other) const
pure virtual

Compare operator. Checks if two PIMItemIndex matches (may not be exactly the same)

Parameters
[in]otherinstance of PIMItemIndex to be compared with.
Returns
true if all PIMItemCheck::eKey fields are the same in both PIMItemIndex objects, false otherwise.

Implemented in OpenAB::PIMCalendarItemIndex, and OpenAB::PIMContactItemIndex.

virtual std::string OpenAB::PIMItemIndex::toString ( ) const
pure virtual

Returns string version of PIMItemIndex. It contains only PIMItemCheck::eKey fields.

Returns
string version of PIMItemIndex

Implemented in OpenAB::PIMContactItemIndex, and OpenAB::PIMCalendarItemIndex.

virtual std::string OpenAB::PIMItemIndex::toStringFull ( ) const
pure virtual

Returns string version of PIMItemIndex. It contains both PIMItemCheck::eKey and PIMItemCheck::eConflict fields.

Returns
string version of PIMItemIndex

Implemented in OpenAB::PIMContactItemIndex, and OpenAB::PIMCalendarItemIndex.

Member Data Documentation

std::string OpenAB::PIMItemIndex::cached_to_string
mutableprotected
std::vector<std::string> OpenAB::PIMItemIndex::conflict_fields
protected
std::vector<std::string> OpenAB::PIMItemIndex::conflict_fields_names
protected
std::vector<std::string> OpenAB::PIMItemIndex::key_fields
protected
std::vector<std::string> OpenAB::PIMItemIndex::key_fields_names
protected

The documentation for this class was generated from the following files: