ICU 52.1  52.1
selfmt.h
Go to the documentation of this file.
1 /********************************************************************
2  * COPYRIGHT:
3  * Copyright (c) 1997-2011, International Business Machines Corporation and
4  * others. All Rights Reserved.
5  * Copyright (C) 2010 , Yahoo! Inc.
6  ********************************************************************
7  *
8  * File SELFMT.H
9  *
10  * Modification History:
11  *
12  * Date Name Description
13  * 11/11/09 kirtig Finished first cut of implementation.
14  ********************************************************************/
15 
16 #ifndef SELFMT
17 #define SELFMT
18 
19 #include "unicode/messagepattern.h"
20 #include "unicode/numfmt.h"
21 #include "unicode/utypes.h"
22 
28 #if !UCONFIG_NO_FORMATTING
29 
31 
32 class MessageFormat;
33 
184 public:
185 
194  SelectFormat(const UnicodeString& pattern, UErrorCode& status);
195 
200  SelectFormat(const SelectFormat& other);
201 
206  virtual ~SelectFormat();
207 
219  void applyPattern(const UnicodeString& pattern, UErrorCode& status);
220 
221 
222  using Format::format;
223 
237  UnicodeString& format(const UnicodeString& keyword,
238  UnicodeString& appendTo,
239  FieldPosition& pos,
240  UErrorCode& status) const;
241 
248  SelectFormat& operator=(const SelectFormat& other);
249 
257  virtual UBool operator==(const Format& other) const;
258 
266  virtual UBool operator!=(const Format& other) const;
267 
273  virtual Format* clone(void) const;
274 
290  UnicodeString& format(const Formattable& obj,
291  UnicodeString& appendTo,
292  FieldPosition& pos,
293  UErrorCode& status) const;
294 
303  UnicodeString& toPattern(UnicodeString& appendTo);
304 
327  virtual void parseObject(const UnicodeString& source,
328  Formattable& result,
329  ParsePosition& parse_pos) const;
330 
335  static UClassID U_EXPORT2 getStaticClassID(void);
336 
341  virtual UClassID getDynamicClassID() const;
342 
343 private:
344  friend class MessageFormat;
345 
346  SelectFormat(); // default constructor not implemented.
347 
356  static int32_t findSubMessage(const MessagePattern& pattern, int32_t partIndex,
357  const UnicodeString& keyword, UErrorCode& ec);
358 
359  MessagePattern msgPattern;
360 };
361 
363 
364 #endif /* #if !UCONFIG_NO_FORMATTING */
365 
366 #endif // _SELFMT
367 //eof