ClientFolder Class Reference
[Items]

Wraps the Outlook folder object. More...

#include <ClientFolder.h>

Collaboration diagram for ClientFolder:
[legend]

List of all members.

Public Member Functions

 ClientFolder ()
 Constructor.
 ClientFolder (ClientFolder &f)
 Copy Constructor.
ClientFolder operator= (ClientFolder &f)
 Operator =.
 ~ClientFolder ()
 Destructor.
void setCOMPtr (MAPIFolderPtr &f, const std::wstring &type)
 Set a COM pointer to this object: refresh all members.
void setCOMPtr (MAPIFolderPtr &f)
 Here itemType is derived from the defaultItemType of the folder.
MAPIFolderPtr & getCOMPtr ()
 Returns a reference to the internal COM pointer.
const std::wstring & getID ()
const std::wstring & getType ()
const std::wstring & getName ()
const std::wstring & getPath ()
const int getSubfoldersCount ()
const int getSubfoldersIndex ()
ClientFoldergetFirstSubfolder ()
 Returns the first subfolder of this folder.
ClientFoldergetNextSubfolder ()
 Returns the next subfolder of this folder.
ClientFoldergetPreviousSubfolder ()
 Returns the previous subfolder of this folder.
ClientFoldergetLastSubfolder ()
 Returns the last subfolder of this folder.
ClientFoldergetSubfolder (const int index)
 Returns the subfolder from its index.
ClientFoldergetSubfolderFromName (const std::wstring &subName)
 Returns the subfolder from its name.
ClientFolderaddSubFolder (const std::wstring &subName, const std::wstring &type)
 Adds a new Subfolder for this folder, then a pointer is returned.
const int getItemsCount ()
const int getItemsIndex ()
ClientItemgetFirstItem ()
 Returns the first item of this folder.
ClientItemgetNextItem ()
 Returns the next item of this folder.
ClientItemgetPreviousItem ()
 Returns the previous item of this folder.
ClientItemgetLastItem ()
 Returns the last item of this folder.
ClientItemgetItem (const int index)
ClientItemaddItem ()
 Adds a new Item for this folder, then a pointer is returned.

Private Member Functions

ClientItemsetInternalItem (IDispatchPtr &pItem)
 Set the appropriate internal item, based on the item type.

Private Attributes

std::wstring ID
 The object entry-ID.
std::wstring itemType
 The item-type of all items contained in the folder (contact/task/mail.
std::wstring name
std::wstring path
int subfoldersCount
 Subfolders for this folder.
int subfoldersIndex
int itemsCount
 Items inside folder.
int itemsIndex
MAPIFolderPtr pFolder
 COM Pointers to microsoft outlook objects.
_FoldersPtr pSubFolders
MAPIFolderPtr pSubFolder
_ItemsPtr pItems
IDispatchPtr pItem
_ContactItemPtr pContact
_AppointmentItemPtr pAppointment
_MailItemPtr pMail
_NoteItemPtr pNote
_TaskItemPtr pTask
ClientFoldersubFolder
 Internal Objects: 'get.
ClientMailmail
ClientContactcontact
ClientAppointmentappointment
ClientTasktask
ClientNotenote
HRESULT hr
 Result of COM pointers operations.


Detailed Description

Wraps the Outlook folder object.

Contains pointers of eventual items and folders inside this folder.


Constructor & Destructor Documentation

ClientFolder::ClientFolder (  ) 

ClientFolder::~ClientFolder (  ) 

Destructor.

Destructor: Delete internal objects.

References pFolder, and subFolder.


Member Function Documentation

ClientItem * ClientFolder::addItem (  ) 

Adds a new Item for this folder, then a pointer is returned.

The pointer returned is a generic ClientItem, but it is casted from a specific Item based on the folder item type (contact / task / ...) In case of errors throws a ClientException.

Returns:
the ClientItem* pointer returned is a reference to the internal object. (internal objects are deleted in the destructor)

References itemsCount, setInternalItem(), and throwClientException().

Referenced by WindowsSyncSource::addItem().

ClientFolder * ClientFolder::addSubFolder ( const std::wstring &  subName,
const std::wstring &  type 
)

Adds a new Subfolder for this folder, then a pointer is returned.

'type' param is required because the subfolder could not be of the same type of the parent folder. In case of errors throws a ClientException.

Returns:
the ClientFolder* pointer returned is a reference to the internal object. (internal objects are deleted in the destructor)

References ClientFolder(), setCOMPtr(), subFolder, subfoldersCount, and throwClientException().

Referenced by ClientApplication::getFolderFromPath().

ClientItem * ClientFolder::getFirstItem (  ) 

Returns the first item of this folder.

The pointer returned is a generic ClientItem, but it is casted from a specific Item based on the folder item type (contact / task / ...) If item not found returns NULL. In case of errors throws a ClientException.

Returns:
the ClientItem* pointer returned is a reference to the internal object. (internal objects are deleted in the destructor)

References itemsCount, setInternalItem(), and throwClientException().

Referenced by WindowsSyncSource::pushAllItemsToList().

ClientFolder * ClientFolder::getFirstSubfolder (  ) 

Returns the first subfolder of this folder.

If subfolder not found returns NULL. In case of errors throws a ClientException.

Returns:
the ClientFolder* pointer returned is a reference to the internal object. (internal objects are deleted in the destructor)

References ClientFolder(), setCOMPtr(), subFolder, subfoldersCount, and throwClientException().

Referenced by WindowsSyncSource::pushAllSubfolderItemsToList().

ClientItem * ClientFolder::getLastItem (  ) 

Returns the last item of this folder.

The pointer returned is a generic ClientItem, but it is casted from a specific Item based on the folder item type (contact / task / ...) If item not found returns NULL. In case of errors throws a ClientException.

Returns:
the ClientItem* pointer returned is a reference to the internal object. (internal objects are deleted in the destructor)

References itemsCount, setInternalItem(), and throwClientException().

Referenced by WindowsSyncSource::deleteAppointment().

ClientFolder * ClientFolder::getLastSubfolder (  ) 

Returns the last subfolder of this folder.

If subfolder not found returns NULL. In case of errors throws a ClientException.

Returns:
the ClientFolder* pointer returned is a reference to the internal object. (internal objects are deleted in the destructor)

References ClientFolder(), setCOMPtr(), subFolder, subfoldersCount, and throwClientException().

ClientItem * ClientFolder::getNextItem (  ) 

Returns the next item of this folder.

The pointer returned is a generic ClientItem, but it is casted from a specific Item based on the folder item type (contact / task / ...) If item not found returns NULL. In case of errors throws a ClientException.

Returns:
the ClientItem* pointer returned is a reference to the internal object. (internal objects are deleted in the destructor)

References itemsCount, setInternalItem(), and throwClientException().

Referenced by WindowsSyncSource::pushAllItemsToList().

ClientFolder * ClientFolder::getNextSubfolder (  ) 

Returns the next subfolder of this folder.

If subfolder not found returns NULL. In case of errors throws a ClientException.

Returns:
the ClientFolder* pointer returned is a reference to the internal object. (internal objects are deleted in the destructor)

References ClientFolder(), setCOMPtr(), subFolder, subfoldersCount, and throwClientException().

Referenced by WindowsSyncSource::pushAllSubfolderItemsToList().

ClientItem * ClientFolder::getPreviousItem (  ) 

Returns the previous item of this folder.

The pointer returned is a generic ClientItem, but it is casted from a specific Item based on the folder item type (contact / task / ...) If item not found returns NULL. In case of errors throws a ClientException.

Returns:
the ClientItem* pointer returned is a reference to the internal object. (internal objects are deleted in the destructor)

References itemsCount, setInternalItem(), and throwClientException().

Referenced by WindowsSyncSource::deleteAppointment().

ClientFolder * ClientFolder::getPreviousSubfolder (  ) 

Returns the previous subfolder of this folder.

If subfolder not found returns NULL. In case of errors throws a ClientException.

Returns:
the ClientFolder* pointer returned is a reference to the internal object. (internal objects are deleted in the destructor)

References ClientFolder(), setCOMPtr(), subFolder, subfoldersCount, and throwClientException().

ClientFolder * ClientFolder::getSubfolder ( const int  index  ) 

Returns the subfolder from its index.

If subfolder not found returns NULL. In case of errors throws a ClientException.

Returns:
the ClientFolder* pointer returned is a reference to the internal object. (internal objects are deleted in the destructor)
Note:
'index + 1' is used, as first outlook folder has index = 1.

References ClientFolder(), setCOMPtr(), subFolder, and subfoldersCount.

Referenced by getSubfolderFromName().

ClientFolder * ClientFolder::getSubfolderFromName ( const std::wstring &  subName  ) 

Returns the subfolder from its name.

If subfolder not found returns NULL.

Returns:
the ClientFolder* pointer returned is a reference to the internal object. (internal objects are deleted in the destructor)

References getName(), getSubfolder(), subFolder, and subfoldersCount.

Referenced by ClientApplication::getFolderFromPath().

void ClientFolder::setCOMPtr ( MAPIFolderPtr &  f,
const std::wstring &  type 
)

Set a COM pointer to this object: refresh all members.

Set a COM pointer to this object.

This method is used to link the object to the correspondent outlook COM pointer. All class members are overwrited by this call. The method MUST be called before using this object, as the constructor doesn't link the class COM pointer. If 'type' parameter is an empty string, then item type is derived from the defaultItemType of the folder.

References hr, ID, itemsCount, pFolder, subfoldersCount, and throwClientException().

Referenced by addSubFolder(), ClientApplication::getDefaultFolder(), getFirstSubfolder(), ClientApplication::getFolderFromID(), getLastSubfolder(), getNextSubfolder(), getPreviousSubfolder(), ClientApplication::getRootFolder(), getSubfolder(), ClientApplication::pickFolder(), and setCOMPtr().

ClientItem * ClientFolder::setInternalItem ( IDispatchPtr &  pItem  )  [private]

Set the appropriate internal item, based on the item type.

If the internal item is NULL, it is created new. Then the item is linked with the COM pointer passed.

Parameters:
pItem the generic Item COM pointer to link the item object <-- *** NOW class member / remove parameter...
Returns:
a ClientItem pointer to the internal object updated (NULL if is a bad item for the item-type)

References ClientMail::setCOMPtr(), ClientNote::setCOMPtr(), ClientTask::setCOMPtr(), ClientContact::setCOMPtr(), ClientAppointment::setCOMPtr(), and throwClientException().

Referenced by addItem(), getFirstItem(), getLastItem(), getNextItem(), and getPreviousItem().


Member Data Documentation

std::wstring ClientFolder::ID [private]

The object entry-ID.

Referenced by ClientFolder(), operator=(), and setCOMPtr().

std::wstring ClientFolder::itemType [private]

The item-type of all items contained in the folder (contact/task/mail.

..)

Referenced by ClientFolder(), and operator=().

Internal Objects: 'get.

..' methods always return references to these objects

Referenced by addSubFolder(), ClientFolder(), getFirstSubfolder(), getLastSubfolder(), getNextSubfolder(), getPreviousSubfolder(), getSubfolder(), getSubfolderFromName(), operator=(), and ~ClientFolder().


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

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