- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

# selfmt.h

Go to the documentation of this file.

    00001 /********************************************************************
    00002  * COPYRIGHT:
    00003  * Copyright (c) 1997-2010, International Business Machines Corporation and
    00004  * others. All Rights Reserved.
    00005  * Copyright (C) 2010 , Yahoo! Inc.
    00006  ********************************************************************
    00007  *
    00008  * File SELFMT.H
    00009  *
    00010  * Modification History:
    00011  *
    00012  *   Date        Name        Description
    00013  *   11/11/09    kirtig      Finished first cut of implementation.
    00014  ********************************************************************/
    00015
    00016 #ifndef SELFMT
    00017 #define SELFMT
    00018
    00019 #include "unicode/utypes.h"
    00020 #include "unicode/numfmt.h"
    00021
    00027 #if !UCONFIG_NO_FORMATTING
    00028
    00029 U_NAMESPACE_BEGIN
    00030
    00031 class Hashtable;
    00032
    00184 class U_I18N_API SelectFormat : public Format {
    00185 public:
    00186
    00195     SelectFormat(const UnicodeString& pattern, UErrorCode& status);
    00196
    00201     SelectFormat(const SelectFormat& other);
    00202
    00207     virtual ~SelectFormat();
    00208
    00220     void applyPattern(const UnicodeString& pattern, UErrorCode& status);
    00221
    00222
    00223     using Format::format;
    00224
    00238     UnicodeString& format(const UnicodeString& keyword,
    00239                             UnicodeString& appendTo,
    00240                             FieldPosition& pos,
    00241                             UErrorCode& status) const;
    00242
    00249     SelectFormat& operator=(const SelectFormat& other);
    00250
    00258     virtual UBool operator==(const Format& other) const;
    00259
    00267     virtual UBool operator!=(const Format& other) const;
    00268
    00274     virtual Format* clone(void) const;
    00275
    00291     UnicodeString& format(const Formattable& obj,
    00292                          UnicodeString& appendTo,
    00293                          FieldPosition& pos,
    00294                          UErrorCode& status) const;
    00295
    00304     UnicodeString& toPattern(UnicodeString& appendTo);
    00305
    00328     virtual void parseObject(const UnicodeString& source,
    00329                             Formattable& result,
    00330                             ParsePosition& parse_pos) const;
    00331
    00336     static UClassID U_EXPORT2 getStaticClassID(void);
    00337
    00342     virtual UClassID getDynamicClassID() const;
    00343
    00344 private:
    00345     typedef enum classesForSelectFormat{
    00346         tStartKeyword,
    00347         tContinueKeyword,
    00348         tLeftBrace,
    00349         tRightBrace,
    00350         tSpace,
    00351         tOther
    00352     }CharacterClass;
    00353
    00354     UnicodeString pattern;
    00355     //Hash to store the keyword, phrase pairs.
    00356     Hashtable  *parsedValuesHash;
    00357
    00358     SelectFormat();   // default constructor not implemented.
    00359     void init(UErrorCode& status);
    00360     //For the applyPattern , classifies char.s in one of the characterClass.
    00361     CharacterClass classifyCharacter(UChar ch) const;
    00362     //Checks if the "other" keyword is present in pattern.
    00363     UBool checkSufficientDefinition();
    00364     //Checks if the keyword passed is valid.
    00365     UBool checkValidKeyword(const UnicodeString& argKeyword) const;
    00366     void parsingFailure();
    00367     void copyHashtable(Hashtable *other, UErrorCode& status);
    00368 };
    00369
    00370 U_NAMESPACE_END
    00371
    00372 #endif /* #if !UCONFIG_NO_FORMATTING */
    00373
    00374 #endif // _SELFMT
    00375 //eof

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines