ICU 4.8.1.1  4.8.1.1
selfmt.h
Go to the documentation of this file.
00001 /********************************************************************
00002  * COPYRIGHT:
00003  * Copyright (c) 1997-2011, 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/messagepattern.h"
00020 #include "unicode/numfmt.h"
00021 #include "unicode/utypes.h"
00022 
00028 #if !UCONFIG_NO_FORMATTING
00029 
00030 U_NAMESPACE_BEGIN
00031 
00032 class MessageFormat;
00033 
00183 class U_I18N_API SelectFormat : public Format {
00184 public:
00185 
00194     SelectFormat(const UnicodeString& pattern, UErrorCode& status);
00195 
00200     SelectFormat(const SelectFormat& other);
00201 
00206     virtual ~SelectFormat();
00207 
00219     void applyPattern(const UnicodeString& pattern, UErrorCode& status);
00220 
00221 
00222     using Format::format;
00223 
00237     UnicodeString& format(const UnicodeString& keyword,
00238                             UnicodeString& appendTo,
00239                             FieldPosition& pos,
00240                             UErrorCode& status) const;
00241 
00248     SelectFormat& operator=(const SelectFormat& other);
00249 
00257     virtual UBool operator==(const Format& other) const;
00258 
00266     virtual UBool operator!=(const Format& other) const;
00267 
00273     virtual Format* clone(void) const;
00274 
00290     UnicodeString& format(const Formattable& obj,
00291                          UnicodeString& appendTo,
00292                          FieldPosition& pos,
00293                          UErrorCode& status) const;
00294 
00303     UnicodeString& toPattern(UnicodeString& appendTo);
00304 
00327     virtual void parseObject(const UnicodeString& source,
00328                             Formattable& result,
00329                             ParsePosition& parse_pos) const;
00330 
00335     static UClassID U_EXPORT2 getStaticClassID(void);
00336 
00341     virtual UClassID getDynamicClassID() const;
00342 
00343 private:
00344     friend class MessageFormat;
00345 
00346     SelectFormat();   // default constructor not implemented.
00347 
00356     static int32_t findSubMessage(const MessagePattern& pattern, int32_t partIndex,
00357                                   const UnicodeString& keyword, UErrorCode& ec);
00358 
00359     MessagePattern msgPattern;
00360 };
00361 
00362 U_NAMESPACE_END
00363 
00364 #endif /* #if !UCONFIG_NO_FORMATTING */
00365 
00366 #endif // _SELFMT
00367 //eof
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines