DateFilter Class Reference
[Client DLL]

Rapresents the filter entity on the start/end dates, for appointments. More...

#include <DateFilter.h>

List of all members.

Public Types

enum  FilterDirection { DIR_NONE = 0, DIR_OUT = 1, DIR_IN = 2, DIR_INOUT = 3 }
 Filter direction, bitmask value (MSb is IN, LSb is OUT):
  • NONE = filter disabled
  • OUT = filter only outgoing items
  • IN = filter only incoming items
  • INOUT = filter both incoming and outgoing items.
More...
enum  RelativeLowerDate {
  NONE = 0, LAST_WEEK = 1, LAST_2_WEEKS = 2, LAST_MONTH = 3,
  LAST_3_MONTHS = 4, LAST_6_MONTHS = 5, ALL = 6
}
 Codes to set the lowerDate, relatively to the current time. More...
typedef enum
DateFilter::FilterDirection 
FilterDirection
 Filter direction, bitmask value (MSb is IN, LSb is OUT):
  • NONE = filter disabled
  • OUT = filter only outgoing items
  • IN = filter only incoming items
  • INOUT = filter both incoming and outgoing items.

typedef enum
DateFilter::RelativeLowerDate 
RelativeLowerDate
 Codes to set the lowerDate, relatively to the current time.

Public Member Functions

void setDirection (const FilterDirection dir)
void setLowerDate (const DATE lower)
void setUpperDate (const DATE upper)
 _declspec (dllexport) void setRelativeLowerDate(const RelativeLowerDate value)
 Setting this property will also set 'lowerDate' accordingly.
FilterDirection getDirection ()
DATE getLowerDate ()
DATE getUpperDate ()
 _declspec (dllexport) RelativeLowerDate getRelativeLowerDate()
bool isEnabled ()
 Returns true if filter enabled at least in one direction.
bool execute (ClientItem *cItem)
 Checks whether the item passed verifies the current filter.
bool execute (_AppointmentItemPtr &app)
 Checks whether the item passed verifies the current filter.
void updateNow ()
 Refreshes filter's parameters, based on the current time.

Private Member Functions

DATE subtractMonths (const DATE inputTime, const unsigned int numMonths)
 Internal use, to subrtract x months from a DATE value.

Private Attributes

FilterDirection direction
 The filter direction, one of FilterDirection enum.
DATE lowerDate
 The lower limit of startDate. In local time.
DATE upperDate
 The upper limit of startDate. In local time.
RelativeLowerDate relativeLowerDate
 A code, to identify the lowerDate referring to now. One of RelativeLowerDate enum.
bool usingRelativeLowerDate
 Internal use: it's set to 'true' if we set the lowerDate through the relativeLowerDate.


Detailed Description

Rapresents the filter entity on the start/end dates, for appointments.

Client can use this class to filter out appointment items that are not included in a specific range of time: events that verifies this filter must exist in the range between 2 dates: 'lowerDate' and 'upperDate'.

These dates must be set by the Client before using the filter; if one of them (or both) is NULL, it will not be used for the check. The 'lowerDate' can also be set through a RelativeLowerDate code, to specify a value that is always relative to the current time.

Use the method updateNow() to refresh the filter's members (e.g. if using relative dates). This method should be called before every sync session. Use the method execute() to check if a ClientItem verifies the filter or not.


Member Typedef Documentation

Filter direction, bitmask value (MSb is IN, LSb is OUT):

  • NONE = filter disabled
  • OUT = filter only outgoing items
  • IN = filter only incoming items
  • INOUT = filter both incoming and outgoing items.

TODO: this enum should be defined in a more generic 'ClientFilter' class.

Codes to set the lowerDate, relatively to the current time.

NONE means we filter out all items before now LAST_WEEK means we filter out all items before last week ALL means we don't filter anything


Member Enumeration Documentation

Filter direction, bitmask value (MSb is IN, LSb is OUT):

  • NONE = filter disabled
  • OUT = filter only outgoing items
  • IN = filter only incoming items
  • INOUT = filter both incoming and outgoing items.

TODO: this enum should be defined in a more generic 'ClientFilter' class.

Codes to set the lowerDate, relatively to the current time.

NONE means we filter out all items before now LAST_WEEK means we filter out all items before last week ALL means we don't filter anything


Member Function Documentation

bool DateFilter::execute ( _AppointmentItemPtr &  app  ) 

Checks whether the item passed verifies the current filter.

Like 'execute(ClientItem*)', but uses the COM pointer object directly:

  • better performance
  • independent on changes to getProperty() methods / format of dates
  • avoid reading all rec props that are not used here

Note:
This method should be used for outgoing items, because the COMPtr is already set. Incoming items have an incomplete COMPtr until the item is effectively saved!
Returns:
true if the filter is verified (event within the range) false if not

References isEnabled(), lowerDate, REFERRED_MAX_DATE, throwClientException(), upperDate, and vBoolToBool().

bool DateFilter::execute ( ClientItem cItem  ) 

Checks whether the item passed verifies the current filter.

Two checks are done, both MUST be verified to return true: 1. event MUST NOT END before lowerDate 2. event MUST NOT START after upperDate

Note:
This method is less performing than 'execute(_AppointmentItemPtr&)' as it checks the string values stored by the wrapper objects, so we need to convert them into Variant DATE values. But it's necessary for items not yet saved in Outlook (if filtering incoming items) because in this case the COMPtr does not reflect the real values.
Returns:
true if the filter is verified (event within the range) false if not

References ClientAppointment::getCOMPtr(), ClientRecurrence::getNoEndDate(), ClientRecurrence::getPatternEndDate(), ClientRecurrence::getPatternStartDate(), ClientItem::getProperty(), ClientAppointment::getRecPattern(), isEnabled(), lowerDate, REFERRED_MAX_DATE, systemTimeToDouble(), throwClientException(), and upperDate.

Referenced by WindowsSyncSource::filterClientItem().

DATE DateFilter::subtractMonths ( const DATE  inputTime,
const unsigned int  numMonths 
) [private]

Internal use, to subrtract x months from a DATE value.

We use SYSTEMTIME structure, it's easier (http://msdn.microsoft.com/en-us/library/aa908737.aspx)

Parameters:
inputTime the input date (VariantTime)
numMonths number of months to subtract (MUST NOT be > 12)
Returns:
the output date (VariantTime)

Referenced by updateNow().


Member Data Documentation

The filter direction, one of FilterDirection enum.

0 means the filter is not enabled.

Referenced by isEnabled().


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

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