Logo Search packages:      
Sourcecode: icu version File versions

UnicodeString & DateIntervalFormat::format ( const Formattable obj,
UnicodeString appendTo,
FieldPosition fieldPosition,
UErrorCode status 
) const [virtual]

Format an object to produce a string. This method handles Formattable objects with a DateInterval type. If a the Formattable object type is not a DateInterval, then it returns a failing UErrorCode.

obj The object to format. Must be a DateInterval.
appendTo Output parameter to receive result. Result is appended to existing contents.
fieldPosition On input: an alignment field, if desired. On output: the offsets of the alignment field.
status Output param filled with success/failure status.
Reference to 'appendTo' parameter. ICU 4.0

Implements Format.

Definition at line 234 of file dtitvfmt.cpp.

References UObject::getDynamicClassID(), Formattable::getObject(), DateInterval::getStaticClassID(), Formattable::getType(), Formattable::kObject, U_FAILURE, and U_ILLEGAL_ARGUMENT_ERROR.

Referenced by DateIntervalFormatTest::expect(), DateIntervalFormatTest::expectUserDII(), format(), DateIntervalFormatTest::stress(), and DateIntervalFormatTest::testAPI().

    if ( U_FAILURE(status) ) {
        return appendTo;

    if ( obj.getType() == Formattable::kObject ) {
        const UObject* formatObj = obj.getObject();
        if (formatObj->getDynamicClassID() == DateInterval::getStaticClassID()){
            return format((DateInterval*)formatObj, appendTo, fieldPosition, status);
    return appendTo;

Generated by  Doxygen 1.6.0   Back to index