WinItem Class Reference
[Windows Adapter]

Rapresents an item object for Windows Clients. More...

#include <WinItem.h>

Inheritance diagram for WinItem:
[legend]

List of all members.

Public Member Functions

 WinItem ()
 Default Constructor.
virtual ~WinItem ()
 Destructor.
int getPropertyMapSize ()
 Returns the size of propertyMap;.
map< wstring, wstring > & getPropertyMap ()
 Returns a reference to the internal propertyMap.
void setProperty (const wstring propertyName, const wstring propertyValue)
 Sets a property value of name 'propertyName'.
void setIntProperty (const wstring propertyName, const int intValue)
 Sets a integer property value of name 'propertyName'.
bool getProperty (const wstring propertyName, wstring &propertyValue)
 Gets a property value from its name.
wstring & getPropertyRef (const wstring propertyName, bool *found)
 Gets a property value from its name.
bool getIntProperty (const wstring propertyName, int *intValue)
 Gets a property value from its name, and convert into a integer value.
void removeElement (wstring key)
void resetPropertyMap ()
 Reset the propertyMap (clear all rows).
void resetAllValues ()
 Reset all fields values of the propertyMap (only values).
virtual wstring & toString ()=0
 Format and return a string from the propertyMap.
virtual int parse (const wstring dataString)=0
 Parse a string and fills the propertyMap.
virtual long getCRC ()
 Return the crc value of the internal map with all values.
WCHAR * getVObjectPropertyValue (VObject *vo, const WCHAR *propertyName)
 Utility to safe-retrieve the property value inside VObject 'vo'.
virtual wstring & getName ()
 Util function that returns the name of the item, usually the "Subject" property.

Public Attributes

map< wstring, wstring > propertyMap
 Map <propertyName, propertyValue> of props exchanged.

Static Protected Attributes

static unsigned long crc32Table [256]
 The table used to calculate the crc.

Static Private Attributes

static wstring badString
 A dummy bad string "<NULL>", used by methods that return a reference to an internal property value, when the property is missing.


Detailed Description

Rapresents an item object for Windows Clients.

Contains a map of <propertyName,propertyValue> for all properties exchanged and methods to get/set them.


Member Function Documentation

virtual long WinItem::getCRC (  )  [virtual]

Return the crc value of the internal map with all values.

It uses only the values of the map not the key. Can be overrided by derived classes if other properties are involved (e.g. Events have recucurrence props and exceptions)

Reimplemented in WinEvent, and WinTask.

bool WinItem::getIntProperty ( const wstring  propertyName,
int *  intValue 
)

Gets a property value from its name, and convert into a integer value.

Retrieves the value from the propertyMap. If property is not found or not correctly converted into int, returns false.

Parameters:
propertyName the name of property to retrieve
propertyValue [IN-OUT] the value of property, integer value
Returns:
true if property found, false if not found or wrong format

virtual wstring& WinItem::getName (  )  [virtual]

Util function that returns the name of the item, usually the "Subject" property.

It should be implemented by derived classes to return a desired value. If property doesn't exist, returns "<NULL>"

Reimplemented in WinContact.

bool WinItem::getProperty ( const wstring  propertyName,
wstring &  propertyValue 
)

Gets a property value from its name.

Retrieves the value from the propertyMap. If property is not found, returns false.

Parameters:
propertyName the name of property to retrieve
propertyValue [IN-OUT] the value of property, it's set to empty string if the property is not found
Returns:
true if property found, false if not found

Referenced by WindowsSyncSource::extractFolder(), and fillClientItem().

wstring& WinItem::getPropertyRef ( const wstring  propertyName,
bool *  found 
)

Gets a property value from its name.

Retrieves the value from the propertyMap. Returns a reference to the internal value of property inside the map (value not copied).

Note:
If property not found, returns a reference to the 'badString' static member of this class.
Parameters:
propertyName the name of property to retrieve
propertyValue [IN-OUT] true if property found, false if not found
Returns:
the value of property found, by reference

WCHAR* WinItem::getVObjectPropertyValue ( VObject *  vo,
const WCHAR *  propertyName 
)

Utility to safe-retrieve the property value inside VObject 'vo'.

Parameters:
vo : VObject to read from
propertyName : the property name requested
Returns:
the property value (NULL if not found)

virtual int WinItem::parse ( const wstring  dataString  )  [pure virtual]

Parse a string and fills the propertyMap.

The map is cleared and will contain only found properties at the end of the parsing.

Parameters:
dataString input vCard string to be parsed
Returns:
0 if no errors

Implemented in WinContact, WinContactSIF, WinEvent, WinEventSIF, WinNote, WinNoteSIF, WinRecipient, WinRecurrence, WinRecurrenceSIF, WinTask, and WinTaskSIF.

void WinItem::setIntProperty ( const wstring  propertyName,
const int  intValue 
)

Sets a integer property value of name 'propertyName'.

Like 'setProperty', but the input value is integer and it's formatted into a string.

Parameters:
propertyName the name of property to set
propertyValue the integer value of property to set

void WinItem::setProperty ( const wstring  propertyName,
const wstring  propertyValue 
)

Sets a property value of name 'propertyName'.

Stores the value into the propertyMap, adds a new row <name, value> if the property is not found, otherwise existing value is overwritten.

Parameters:
propertyName the name of property to set
propertyValue the value of property to set

Referenced by convertToSyncItem().

virtual wstring& WinItem::toString (  )  [pure virtual]

Format and return a string from the propertyMap.

Not supported properties are ignored and so not formatted as they don't have a correspondence in propertyMap.

Returns:
the string formatted, reference to internal wstring

Implemented in WinContact, WinContactSIF, WinEvent, WinEventSIF, WinNote, WinNoteSIF, WinRecipient, WinRecurrence, WinRecurrenceSIF, WinTask, and WinTaskSIF.

Referenced by convertToSyncItem().


Member Data Documentation

wstring WinItem::badString [static, private]

A dummy bad string "<NULL>", used by methods that return a reference to an internal property value, when the property is missing.

map<wstring,wstring> WinItem::propertyMap

Map <propertyName, propertyValue> of props exchanged.

  • Client to Server: contains props supported by Client, MUST be filled by Client calling setProperty() for each property, before calling toString().
  • Server to Client: contains props parsed from vCard/vCalendar, it's automatically filled by parsers of derived classes. Client SHOULD call getProperty() for each property he wants to retrieve, after calling parse().


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

Generated on Tue Apr 6 13:00:44 2010 for Funambol Outlook Plug-in Library by  doxygen 1.5.7.1