Data Tranformation functions
[Client DLL]

Collaboration diagram for Data Tranformation functions:


Modules

 Static SIF Fields tables
 VObject conversion functions

Functions

WinItemcreateWinItem (bool useSIF, const std::wstring itemType)
 Creates an empty WinItem object of the desired type (Client to Server).
WinItemcreateWinItem (bool useSIF, const std::wstring itemType, const std::wstring &data, const WCHAR **sifFields)
 Creates and fills a WinItem object of the desired type (Server to Client).
SyncItem * convertToSyncItem (ClientItem *cItem, const char *dataType, const std::wstring &defaultFolder)
 ClientItem object -> SyncItem object (client to server).
int fillClientItem (const std::wstring &sif, ClientItem *cItem, const std::wstring &itemType, const WCHAR *dataType)
 data string (SIF/VCard/.
std::wstring formatAppExceptions (ClientAppointment *cApp)
 Format appointment exceptions (client to server).
int parseAppExceptions (const std::wstring &sifString, ClientItem *cItem)
 Parse appointment exceptions from SIF data (server to client).
int checkFreeOccurrence (ClientAppointment *cApp, const std::wstring &sifString, const std::wstring &originalDate)
WCHAR ** getProperSifArray (const std::wstring &type)
 Utility to return the right pointer to the static WCHAR** array of SIF fields, given the 'type' itemType.
int normalizeExceptions (ClientItem *cItem, itemKeyList &allItems, itemKeyList &allItemsPaths)
 Normalize all appointment exceptions for passed item (client to server).
int deleteOccurrencesInInterval (const DATE startDate, const DATE originalDate, ClientRecurrence *cRec)
 Deletes all existing occurrences in the interval [startDate - originalDate[ , from ClientRecurrence object 'cRec'.
int setRecurrenceExceptions (ClientItem *cItem, std::list< std::wstring > &excludeDates, std::list< std::wstring > &includeDates)
int checkIllegalXMLChars (char *data)
 Check for illegal XML chars inside 'data'.
std::wstring getVPropertyValue (const std::wstring &dataString, const std::wstring &propertyName)
 Get a property value from a string formatted vCard / vCalendar.
void addPropertyToSIF (const std::wstring propertyName, std::wstring propertyValue, std::wstring &sif)
 Adds a tag <PropertyName>PropertyValue</PropertyName> into sifString.
std::wstring adaptToSIFSpecs (const std::wstring &propName, const std::wstring &propValue, const std::wstring &type)
 Transform the value of the specified property according to the SIF specifications.
std::wstring adaptFromSIFSpecs (const std::wstring &propName, const std::wstring &propValue, const std::wstring &type)
 Transform the value of the specified property found in SIF structure to the one expected by outlook.
void replaceDefaultPath (std::wstring &path, const std::wstring &defaultFolder)
 Replaces the 'defaultFolder' string with "DEFAULT_FOLDER" inside 'path'.

Function Documentation

std::wstring adaptFromSIFSpecs ( const wstring &  propName,
const wstring &  propValue,
const wstring &  type 
)

Transform the value of the specified property found in SIF structure to the one expected by outlook.

The values are formatted following the vcard and icalendar specs that in some cases they are different from the SIF expectations. If there are no differences the same value is returned.

Parameters:
propName [IN] the property name
propValue [IN] the property value
type [IN] the type of the data (contact, calendar...)
Returns:
the converted value if necessary

std::wstring adaptToSIFSpecs ( const wstring &  propName,
const wstring &  propValue,
const wstring &  type 
)

Transform the value of the specified property according to the SIF specifications.

The values are formatted following the vcard and icalendar specs that in some cases they are different from the SIF expectations. If there are no differences, propValue is returned.

Parameters:
propName [IN] the property name
propValue [IN] the property value
type [IN] the type of the data (contact, calendar...)
Returns:
the converted value if necessary

int checkIllegalXMLChars ( char *  data  ) 

Check for illegal XML chars inside 'data'.

Chars < 0x20 are converted to 0x21 (space) - preserved '' '
' ''.

Parameters:
data [IN/OUT] the buffer to analyze
Returns:
1 if some char is converted, 0 otherwise

SyncItem* convertToSyncItem ( ClientItem cItem,
const char *  dataType,
const wstring &  defaultFolder 
)

ClientItem object -> SyncItem object (client to server).

SyncItem data is the string generated from all ClientItem properties. Data is converted into SIF or other mime types, based on 'dataType' parameter.

Parameters:
cItem [INPUT] pointer to ClientItem
dataType the mime type of data we want into the SyncItem (SIF/VCard/...)
defaultFolder the default folder path for this syncsource
Returns:
the (new allocated) SyncItem object. Returned pointer MUST be freed by the caller

WinItem* createWinItem ( bool  useSIF,
const wstring  itemType,
const wstring &  data,
const WCHAR **  sifFields 
)

Creates and fills a WinItem object of the desired type (Server to Client).

Fills the WinItem map parsing the passed 'data' wstring.

Parameters:
useSIF true if we use SIF data
itemType the item type ("contact", "task", ...)
data the data input string to parse
sifFields pointer to the static array of SIF fields used
Returns:
a new allocated WinItem* of the desired type (WinContact, WinEvent,...)

WinItem* createWinItem ( bool  useSIF,
const wstring  itemType 
)

Creates an empty WinItem object of the desired type (Client to Server).

Parameters:
useSIF true if we use SIF data
itemType the item type ("contact", "task", ...)
Returns:
a new allocated WinItem* of the desired type (WinContact, WinEvent,...)

int deleteOccurrencesInInterval ( const DATE  startDate,
const DATE  originalDate,
ClientRecurrence cRec 
)

Deletes all existing occurrences in the interval [startDate - originalDate[ , from ClientRecurrence object 'cRec'.

When an occurrence is found in the given interval, a proper exception is added to 'cRec' (a 'deleted occurrence' exception).

Parameters:
startDate : the start date (included in interval)
originalDate : the original date (excluded from interval)
cRec : the ClientRecurrence pointer to work on
Returns:
the number of occurrences deleted ( = number of exceptions created in cRec)

int fillClientItem ( const wstring &  data,
ClientItem cItem,
const wstring &  itemType,
const WCHAR *  dataType 
)

data string (SIF/VCard/.

..) -> ClientItem (server to client). Fill the passed ClientItem object with all properties from 'data' string. Data is parsed from SIF or other mime types, based on 'dataType' parameter.

Parameters:
data : the input string to read from
cItem : [IN-OUT] the ClientItem object to fill
itemType : the type of item (contact/task/...)
dataType : the mime type of data sent by server
Returns:
0 if no errors

std::wstring formatAppExceptions ( ClientAppointment cApp  ) 

Format appointment exceptions (client to server).

Parameters:
cApp the ClientAppointment pointer to retrieve data
Returns:
a SIF string formatted like this:
<Exceptions> <ExcludeDate>...</ExcludeDate> // each of these is an exception (deleted occurrence) <ExcludeDate>...</ExcludeDate> <ExcludeDate>...</ExcludeDate> <IncludeDate> // Outlook does not support added occurrences: we MUST send this empty. </Exceptions>

std::wstring getVPropertyValue ( const wstring &  dataString,
const wstring &  propertyName 
)

Get a property value from a string formatted vCard / vCalendar.

Parses the string, and returns the property value from the passed name.

Note:
Used if vObject is not available, to parse properties it's better to use the vConveter::parse() method.
Parameters:
dataString the input string (vCard/vCalendar)
propertyName the name of property to retrieve
Returns:
the property value (empty if not found)

int normalizeExceptions ( ClientItem cItem,
itemKeyList &  allItems,
itemKeyList &  allItemsPaths 
)

Normalize all appointment exceptions for passed item (client to server).

This is done before sending items to server. After normalization we will have only exceptions that are 'deleted occurrences', and new unlinked appointments for other exceptions. New appointments are also added to the 'allItems' list. In case of errors, 'lastErrorMsg' is set and '1' is returned.

Parameters:
allItems : [IN-OUT] the list of all appointments to scan
Returns:
0 if no errors

int parseAppExceptions ( const wstring &  sifString,
ClientItem cItem 
)

Parse appointment exceptions from SIF data (server to client).

Lists of exceptions are created and passed to 'setRecurrenceExceptions()' function.

Parameters:
sifString : the SIF string to read from
cItem : the ClientItem object to modify (it's an appointment)
Returns:
0 if exceptions saved with no errors. 1 if nothing done. -1 if errors.

void replaceDefaultPath ( wstring &  path,
const wstring &  defaultFolder 
)

Replaces the 'defaultFolder' string with "DEFAULT_FOLDER" inside 'path'.

We need to temporary add a "\" char at the end, to avoid replacing folders names such as "\\Personal Folder\Contacts2" into "DEFAULT_FOLDER2".

Parameters:
path the wstring to search (IN/OUT: it can be modified here)
defaultFolder the wstring to search for


Generated on Fri Nov 9 12:21:28 2007 for Funambol Outlook Plug-in Library by  doxygen 1.5.2