Apache log4cxx  Version 0.10.0
CachedDateFormat Class Reference
Inheritance diagram for CachedDateFormat:
DateFormat ObjectImpl Object

Public Types

enum  { NO_MILLISECONDS = -2, UNRECOGNIZED_MILLISECONDS = -1 }
 

Public Member Functions

 CachedDateFormat (const log4cxx::helpers::DateFormatPtr &dateFormat, int expiration)
 Creates a new CachedDateFormat object. More...
 
virtual void format (LogString &sbuf, log4cxx_time_t date, log4cxx::helpers::Pool &p) const
 Formats a Date into a date/time string. More...
 
virtual void setTimeZone (const log4cxx::helpers::TimeZonePtr &zone)
 Set timezone. More...
 
virtual void numberFormat (LogString &s, int n, log4cxx::helpers::Pool &p) const
 Format an integer consistent with the format method. More...
 
- Public Member Functions inherited from DateFormat
virtual ~DateFormat ()
 Destructor. More...
 
virtual void setTimeZone (const TimeZonePtr &zone)
 Sets the time zone. More...
 
- Public Member Functions inherited from ObjectImpl
 ObjectImpl ()
 
virtual ~ObjectImpl ()
 
void addRef () const
 
void releaseRef () const
 
- Public Member Functions inherited from Object
virtual const helpers::ClassgetClass () const
 
virtual ~Object ()
 
virtual bool instanceof (const Class &clazz) const =0
 
virtual const void * cast (const Class &clazz) const =0
 

Static Public Member Functions

static int findMillisecondStart (log4cxx_time_t time, const LogString &formatted, const log4cxx::helpers::DateFormatPtr &formatter, log4cxx::helpers::Pool &pool)
 Finds start of millisecond field in formatted time. More...
 
static int getMaximumCacheValidity (const LogString &pattern)
 Gets maximum cache validity for the specified SimpleDateTime conversion pattern. More...
 
- Static Public Member Functions inherited from Object
static const helpers::ClassgetStaticClass ()
 
static const log4cxx::helpers::ClassRegistrationregisterClass ()
 

Additional Inherited Members

- Protected Member Functions inherited from DateFormat
 DateFormat ()
 Constructor. More...
 
- Protected Attributes inherited from ObjectImpl
unsigned int volatile ref
 

Member Enumeration Documentation

anonymous enum
Enumerator
NO_MILLISECONDS 
UNRECOGNIZED_MILLISECONDS 

Constructor & Destructor Documentation

CachedDateFormat ( const log4cxx::helpers::DateFormatPtr &  dateFormat,
int  expiration 
)

Creates a new CachedDateFormat object.

Parameters
dateFormatDate format, may not be null.
expirationmaximum cached range in microseconds. If the dateFormat is known to be incompatible with the caching algorithm, use a value of 0 to totally disable caching or 1 to only use cache for duplicate requests.

Member Function Documentation

static int findMillisecondStart ( log4cxx_time_t  time,
const LogString formatted,
const log4cxx::helpers::DateFormatPtr &  formatter,
log4cxx::helpers::Pool pool 
)
static

Finds start of millisecond field in formatted time.

Parameters
timelong time, must be integral number of seconds
formattedString corresponding formatted string
formatterDateFormat date format
poolpool.
Returns
int position in string of first digit of milliseconds, -1 indicates no millisecond field, -2 indicates unrecognized field (likely RelativeTimeDateFormat)
virtual void format ( LogString sbuf,
log4cxx_time_t  date,
log4cxx::helpers::Pool p 
) const
virtual

Formats a Date into a date/time string.

Parameters
datethe date to format.
sbufthe string buffer to write to.
pmemory pool.

Implements DateFormat.

static int getMaximumCacheValidity ( const LogString pattern)
static

Gets maximum cache validity for the specified SimpleDateTime conversion pattern.

Parameters
patternconversion pattern, may not be null.
Returns
Duration in microseconds from an integral second that the cache will return consistent results.
virtual void numberFormat ( LogString s,
int  n,
log4cxx::helpers::Pool p 
) const
virtual

Format an integer consistent with the format method.

Parameters
sstring to which the numeric string is appended.
ninteger value.
pmemory pool used during formatting.

Reimplemented from DateFormat.

virtual void setTimeZone ( const log4cxx::helpers::TimeZonePtr &  zone)
virtual

Set timezone.

Remarks
Setting the timezone using getCalendar().setTimeZone() will likely cause caching to misbehave.
Parameters
zoneTimeZone new timezone

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