00001
00002
00003
00004 #ifndef __FORMATTEDVALUE_H__
00005 #define __FORMATTEDVALUE_H__
00006
00007 #include "unicode/utypes.h"
00008
00009 #if U_SHOW_CPLUSPLUS_API
00010
00011 #if !UCONFIG_NO_FORMATTING
00012
00013 #include "unicode/appendable.h"
00014 #include "unicode/fpositer.h"
00015 #include "unicode/unistr.h"
00016 #include "unicode/uformattedvalue.h"
00017
00018 U_NAMESPACE_BEGIN
00019
00029
00030
00031
00032 #ifndef U_FORCE_HIDE_DRAFT_API
00033
00046 class U_I18N_API ConstrainedFieldPosition : public UMemory {
00047 public:
00048
00056 ConstrainedFieldPosition();
00057
00059 ~ConstrainedFieldPosition();
00060
00061 #ifndef U_HIDE_DRAFT_API
00062
00070 void reset();
00071
00094 void constrainCategory(int32_t category);
00095
00119 void constrainField(int32_t category, int32_t field);
00120
00130 inline int32_t getCategory() const {
00131 return fCategory;
00132 }
00133
00143 inline int32_t getField() const {
00144 return fField;
00145 }
00146
00155 inline int32_t getStart() const {
00156 return fStart;
00157 }
00158
00167 inline int32_t getLimit() const {
00168 return fLimit;
00169 }
00170
00175
00186 inline int64_t getInt64IterationContext() const {
00187 return fContext;
00188 }
00189
00198 void setInt64IterationContext(int64_t context);
00199
00210 UBool matchesField(int32_t category, int32_t field) const;
00211
00226 void setState(
00227 int32_t category,
00228 int32_t field,
00229 int32_t start,
00230 int32_t limit);
00231 #endif
00232
00233 private:
00234 int64_t fContext = 0LL;
00235 int32_t fField = 0;
00236 int32_t fStart = 0;
00237 int32_t fLimit = 0;
00238 #ifndef U_HIDE_DRAFT_API
00239 int32_t fCategory = UFIELD_CATEGORY_UNDEFINED;
00240 #else
00241 int32_t fCategory = 0;
00242 #endif
00243 int8_t fConstraint = 0;
00244 };
00245
00246
00247
00254 class U_I18N_API FormattedValue {
00255 public:
00257 virtual ~FormattedValue();
00258
00269 virtual UnicodeString toString(UErrorCode& status) const = 0;
00270
00285 virtual UnicodeString toTempString(UErrorCode& status) const = 0;
00286
00298 virtual Appendable& appendTo(Appendable& appendable, UErrorCode& status) const = 0;
00299
00322 virtual UBool nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const = 0;
00323 };
00324 #endif // U_FORCE_HIDE_DRAFT_API
00325
00326 U_NAMESPACE_END
00327
00328 #endif
00329
00330 #endif
00331
00332 #endif // __FORMATTEDVALUE_H__