|
||||
Warning, file /include/unicode/fmtable.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 // © 2016 and later: Unicode, Inc. and others. 0002 // License & terms of use: http://www.unicode.org/copyright.html 0003 /* 0004 ******************************************************************************** 0005 * Copyright (C) 1997-2014, International Business Machines 0006 * Corporation and others. All Rights Reserved. 0007 ******************************************************************************** 0008 * 0009 * File FMTABLE.H 0010 * 0011 * Modification History: 0012 * 0013 * Date Name Description 0014 * 02/29/97 aliu Creation. 0015 ******************************************************************************** 0016 */ 0017 #ifndef FMTABLE_H 0018 #define FMTABLE_H 0019 0020 #include "unicode/utypes.h" 0021 0022 #if U_SHOW_CPLUSPLUS_API 0023 0024 /** 0025 * \file 0026 * \brief C++ API: Formattable is a thin wrapper for primitive types used for formatting and parsing 0027 */ 0028 0029 #if !UCONFIG_NO_FORMATTING 0030 0031 #include "unicode/unistr.h" 0032 #include "unicode/stringpiece.h" 0033 #include "unicode/uformattable.h" 0034 0035 U_NAMESPACE_BEGIN 0036 0037 class CharString; 0038 namespace number { 0039 namespace impl { 0040 class DecimalQuantity; 0041 } 0042 } 0043 0044 /** 0045 * Formattable objects can be passed to the Format class or 0046 * its subclasses for formatting. Formattable is a thin wrapper 0047 * class which interconverts between the primitive numeric types 0048 * (double, long, etc.) as well as UDate and UnicodeString. 0049 * 0050 * <p>Internally, a Formattable object is a union of primitive types. 0051 * As such, it can only store one flavor of data at a time. To 0052 * determine what flavor of data it contains, use the getType method. 0053 * 0054 * <p>As of ICU 3.0, Formattable may also wrap a UObject pointer, 0055 * which it owns. This allows an instance of any ICU class to be 0056 * encapsulated in a Formattable. For legacy reasons and for 0057 * efficiency, primitive numeric types are still stored directly 0058 * within a Formattable. 0059 * 0060 * <p>The Formattable class is not suitable for subclassing. 0061 * 0062 * <p>See UFormattable for a C wrapper. 0063 */ 0064 class U_I18N_API Formattable : public UObject { 0065 public: 0066 /** 0067 * This enum is only used to let callers distinguish between 0068 * the Formattable(UDate) constructor and the Formattable(double) 0069 * constructor; the compiler cannot distinguish the signatures, 0070 * since UDate is currently typedefed to be either double or long. 0071 * If UDate is changed later to be a bonafide class 0072 * or struct, then we no longer need this enum. 0073 * @stable ICU 2.4 0074 */ 0075 enum ISDATE { kIsDate }; 0076 0077 /** 0078 * Default constructor 0079 * @stable ICU 2.4 0080 */ 0081 Formattable(); // Type kLong, value 0 0082 0083 /** 0084 * Creates a Formattable object with a UDate instance. 0085 * @param d the UDate instance. 0086 * @param flag the flag to indicate this is a date. Always set it to kIsDate 0087 * @stable ICU 2.0 0088 */ 0089 Formattable(UDate d, ISDATE flag); 0090 0091 /** 0092 * Creates a Formattable object with a double number. 0093 * @param d the double number. 0094 * @stable ICU 2.0 0095 */ 0096 Formattable(double d); 0097 0098 /** 0099 * Creates a Formattable object with a long number. 0100 * @param l the long number. 0101 * @stable ICU 2.0 0102 */ 0103 Formattable(int32_t l); 0104 0105 /** 0106 * Creates a Formattable object with an int64_t number 0107 * @param ll the int64_t number. 0108 * @stable ICU 2.8 0109 */ 0110 Formattable(int64_t ll); 0111 0112 #if !UCONFIG_NO_CONVERSION 0113 /** 0114 * Creates a Formattable object with a char string pointer. 0115 * Assumes that the char string is null terminated. 0116 * @param strToCopy the char string. 0117 * @stable ICU 2.0 0118 */ 0119 Formattable(const char* strToCopy); 0120 #endif 0121 0122 /** 0123 * Creates a Formattable object of an appropriate numeric type from a 0124 * a decimal number in string form. The Formattable will retain the 0125 * full precision of the input in decimal format, even when it exceeds 0126 * what can be represented by a double or int64_t. 0127 * 0128 * @param number the unformatted (not localized) string representation 0129 * of the Decimal number. 0130 * @param status the error code. Possible errors include U_INVALID_FORMAT_ERROR 0131 * if the format of the string does not conform to that of a 0132 * decimal number. 0133 * @stable ICU 4.4 0134 */ 0135 Formattable(StringPiece number, UErrorCode &status); 0136 0137 /** 0138 * Creates a Formattable object with a UnicodeString object to copy from. 0139 * @param strToCopy the UnicodeString string. 0140 * @stable ICU 2.0 0141 */ 0142 Formattable(const UnicodeString& strToCopy); 0143 0144 /** 0145 * Creates a Formattable object with a UnicodeString object to adopt from. 0146 * @param strToAdopt the UnicodeString string. 0147 * @stable ICU 2.0 0148 */ 0149 Formattable(UnicodeString* strToAdopt); 0150 0151 /** 0152 * Creates a Formattable object with an array of Formattable objects. 0153 * @param arrayToCopy the Formattable object array. 0154 * @param count the array count. 0155 * @stable ICU 2.0 0156 */ 0157 Formattable(const Formattable* arrayToCopy, int32_t count); 0158 0159 /** 0160 * Creates a Formattable object that adopts the given UObject. 0161 * @param objectToAdopt the UObject to set this object to 0162 * @stable ICU 3.0 0163 */ 0164 Formattable(UObject* objectToAdopt); 0165 0166 /** 0167 * Copy constructor. 0168 * @stable ICU 2.0 0169 */ 0170 Formattable(const Formattable&); 0171 0172 /** 0173 * Assignment operator. 0174 * @param rhs The Formattable object to copy into this object. 0175 * @stable ICU 2.0 0176 */ 0177 Formattable& operator=(const Formattable &rhs); 0178 0179 /** 0180 * Equality comparison. 0181 * @param other the object to be compared with. 0182 * @return true if other are equal to this, false otherwise. 0183 * @stable ICU 2.0 0184 */ 0185 bool operator==(const Formattable &other) const; 0186 0187 /** 0188 * Equality operator. 0189 * @param other the object to be compared with. 0190 * @return true if other are unequal to this, false otherwise. 0191 * @stable ICU 2.0 0192 */ 0193 bool operator!=(const Formattable& other) const 0194 { return !operator==(other); } 0195 0196 /** 0197 * Destructor. 0198 * @stable ICU 2.0 0199 */ 0200 virtual ~Formattable(); 0201 0202 /** 0203 * Clone this object. 0204 * Clones can be used concurrently in multiple threads. 0205 * If an error occurs, then nullptr is returned. 0206 * The caller must delete the clone. 0207 * 0208 * @return a clone of this object 0209 * 0210 * @see getDynamicClassID 0211 * @stable ICU 2.8 0212 */ 0213 Formattable *clone() const; 0214 0215 /** 0216 * Selector for flavor of data type contained within a 0217 * Formattable object. Formattable is a union of several 0218 * different types, and at any time contains exactly one type. 0219 * @stable ICU 2.4 0220 */ 0221 enum Type { 0222 /** 0223 * Selector indicating a UDate value. Use getDate to retrieve 0224 * the value. 0225 * @stable ICU 2.4 0226 */ 0227 kDate, 0228 0229 /** 0230 * Selector indicating a double value. Use getDouble to 0231 * retrieve the value. 0232 * @stable ICU 2.4 0233 */ 0234 kDouble, 0235 0236 /** 0237 * Selector indicating a 32-bit integer value. Use getLong to 0238 * retrieve the value. 0239 * @stable ICU 2.4 0240 */ 0241 kLong, 0242 0243 /** 0244 * Selector indicating a UnicodeString value. Use getString 0245 * to retrieve the value. 0246 * @stable ICU 2.4 0247 */ 0248 kString, 0249 0250 /** 0251 * Selector indicating an array of Formattables. Use getArray 0252 * to retrieve the value. 0253 * @stable ICU 2.4 0254 */ 0255 kArray, 0256 0257 /** 0258 * Selector indicating a 64-bit integer value. Use getInt64 0259 * to retrieve the value. 0260 * @stable ICU 2.8 0261 */ 0262 kInt64, 0263 0264 /** 0265 * Selector indicating a UObject value. Use getObject to 0266 * retrieve the value. 0267 * @stable ICU 3.0 0268 */ 0269 kObject 0270 }; 0271 0272 /** 0273 * Gets the data type of this Formattable object. 0274 * @return the data type of this Formattable object. 0275 * @stable ICU 2.0 0276 */ 0277 Type getType(void) const; 0278 0279 /** 0280 * Returns true if the data type of this Formattable object 0281 * is kDouble, kLong, or kInt64 0282 * @return true if this is a pure numeric object 0283 * @stable ICU 3.0 0284 */ 0285 UBool isNumeric() const; 0286 0287 /** 0288 * Gets the double value of this object. If this object is not of type 0289 * kDouble then the result is undefined. 0290 * @return the double value of this object. 0291 * @stable ICU 2.0 0292 */ 0293 double getDouble(void) const { return fValue.fDouble; } 0294 0295 /** 0296 * Gets the double value of this object. If this object is of type 0297 * long, int64 or Decimal Number then a conversion is performed, with 0298 * possible loss of precision. If the type is kObject and the 0299 * object is a Measure, then the result of 0300 * getNumber().getDouble(status) is returned. If this object is 0301 * neither a numeric type nor a Measure, then 0 is returned and 0302 * the status is set to U_INVALID_FORMAT_ERROR. 0303 * @param status the error code 0304 * @return the double value of this object. 0305 * @stable ICU 3.0 0306 */ 0307 double getDouble(UErrorCode& status) const; 0308 0309 /** 0310 * Gets the long value of this object. If this object is not of type 0311 * kLong then the result is undefined. 0312 * @return the long value of this object. 0313 * @stable ICU 2.0 0314 */ 0315 int32_t getLong(void) const { return (int32_t)fValue.fInt64; } 0316 0317 /** 0318 * Gets the long value of this object. If the magnitude is too 0319 * large to fit in a long, then the maximum or minimum long value, 0320 * as appropriate, is returned and the status is set to 0321 * U_INVALID_FORMAT_ERROR. If this object is of type kInt64 and 0322 * it fits within a long, then no precision is lost. If it is of 0323 * type kDouble, then a conversion is performed, with 0324 * truncation of any fractional part. If the type is kObject and 0325 * the object is a Measure, then the result of 0326 * getNumber().getLong(status) is returned. If this object is 0327 * neither a numeric type nor a Measure, then 0 is returned and 0328 * the status is set to U_INVALID_FORMAT_ERROR. 0329 * @param status the error code 0330 * @return the long value of this object. 0331 * @stable ICU 3.0 0332 */ 0333 int32_t getLong(UErrorCode& status) const; 0334 0335 /** 0336 * Gets the int64 value of this object. If this object is not of type 0337 * kInt64 then the result is undefined. 0338 * @return the int64 value of this object. 0339 * @stable ICU 2.8 0340 */ 0341 int64_t getInt64(void) const { return fValue.fInt64; } 0342 0343 /** 0344 * Gets the int64 value of this object. If this object is of a numeric 0345 * type and the magnitude is too large to fit in an int64, then 0346 * the maximum or minimum int64 value, as appropriate, is returned 0347 * and the status is set to U_INVALID_FORMAT_ERROR. If the 0348 * magnitude fits in an int64, then a casting conversion is 0349 * performed, with truncation of any fractional part. If the type 0350 * is kObject and the object is a Measure, then the result of 0351 * getNumber().getDouble(status) is returned. If this object is 0352 * neither a numeric type nor a Measure, then 0 is returned and 0353 * the status is set to U_INVALID_FORMAT_ERROR. 0354 * @param status the error code 0355 * @return the int64 value of this object. 0356 * @stable ICU 3.0 0357 */ 0358 int64_t getInt64(UErrorCode& status) const; 0359 0360 /** 0361 * Gets the Date value of this object. If this object is not of type 0362 * kDate then the result is undefined. 0363 * @return the Date value of this object. 0364 * @stable ICU 2.0 0365 */ 0366 UDate getDate() const { return fValue.fDate; } 0367 0368 /** 0369 * Gets the Date value of this object. If the type is not a date, 0370 * status is set to U_INVALID_FORMAT_ERROR and the return value is 0371 * undefined. 0372 * @param status the error code. 0373 * @return the Date value of this object. 0374 * @stable ICU 3.0 0375 */ 0376 UDate getDate(UErrorCode& status) const; 0377 0378 /** 0379 * Gets the string value of this object. If this object is not of type 0380 * kString then the result is undefined. 0381 * @param result Output param to receive the Date value of this object. 0382 * @return A reference to 'result'. 0383 * @stable ICU 2.0 0384 */ 0385 UnicodeString& getString(UnicodeString& result) const 0386 { result=*fValue.fString; return result; } 0387 0388 /** 0389 * Gets the string value of this object. If the type is not a 0390 * string, status is set to U_INVALID_FORMAT_ERROR and a bogus 0391 * string is returned. 0392 * @param result Output param to receive the Date value of this object. 0393 * @param status the error code. 0394 * @return A reference to 'result'. 0395 * @stable ICU 3.0 0396 */ 0397 UnicodeString& getString(UnicodeString& result, UErrorCode& status) const; 0398 0399 /** 0400 * Gets a const reference to the string value of this object. If 0401 * this object is not of type kString then the result is 0402 * undefined. 0403 * @return a const reference to the string value of this object. 0404 * @stable ICU 2.0 0405 */ 0406 inline const UnicodeString& getString(void) const; 0407 0408 /** 0409 * Gets a const reference to the string value of this object. If 0410 * the type is not a string, status is set to 0411 * U_INVALID_FORMAT_ERROR and the result is a bogus string. 0412 * @param status the error code. 0413 * @return a const reference to the string value of this object. 0414 * @stable ICU 3.0 0415 */ 0416 const UnicodeString& getString(UErrorCode& status) const; 0417 0418 /** 0419 * Gets a reference to the string value of this object. If this 0420 * object is not of type kString then the result is undefined. 0421 * @return a reference to the string value of this object. 0422 * @stable ICU 2.0 0423 */ 0424 inline UnicodeString& getString(void); 0425 0426 /** 0427 * Gets a reference to the string value of this object. If the 0428 * type is not a string, status is set to U_INVALID_FORMAT_ERROR 0429 * and the result is a bogus string. 0430 * @param status the error code. 0431 * @return a reference to the string value of this object. 0432 * @stable ICU 3.0 0433 */ 0434 UnicodeString& getString(UErrorCode& status); 0435 0436 /** 0437 * Gets the array value and count of this object. If this object 0438 * is not of type kArray then the result is undefined. 0439 * @param count fill-in with the count of this object. 0440 * @return the array value of this object. 0441 * @stable ICU 2.0 0442 */ 0443 const Formattable* getArray(int32_t& count) const 0444 { count=fValue.fArrayAndCount.fCount; return fValue.fArrayAndCount.fArray; } 0445 0446 /** 0447 * Gets the array value and count of this object. If the type is 0448 * not an array, status is set to U_INVALID_FORMAT_ERROR, count is 0449 * set to 0, and the result is nullptr. 0450 * @param count fill-in with the count of this object. 0451 * @param status the error code. 0452 * @return the array value of this object. 0453 * @stable ICU 3.0 0454 */ 0455 const Formattable* getArray(int32_t& count, UErrorCode& status) const; 0456 0457 /** 0458 * Accesses the specified element in the array value of this 0459 * Formattable object. If this object is not of type kArray then 0460 * the result is undefined. 0461 * @param index the specified index. 0462 * @return the accessed element in the array. 0463 * @stable ICU 2.0 0464 */ 0465 Formattable& operator[](int32_t index) { return fValue.fArrayAndCount.fArray[index]; } 0466 0467 /** 0468 * Returns a pointer to the UObject contained within this 0469 * formattable, or nullptr if this object does not contain a UObject. 0470 * @return a UObject pointer, or nullptr 0471 * @stable ICU 3.0 0472 */ 0473 const UObject* getObject() const; 0474 0475 /** 0476 * Returns a numeric string representation of the number contained within this 0477 * formattable, or nullptr if this object does not contain numeric type. 0478 * For values obtained by parsing, the returned decimal number retains 0479 * the full precision and range of the original input, unconstrained by 0480 * the limits of a double floating point or a 64 bit int. 0481 * 0482 * This function is not thread safe, and therefore is not declared const, 0483 * even though it is logically const. 0484 * 0485 * Possible errors include U_MEMORY_ALLOCATION_ERROR, and 0486 * U_INVALID_STATE if the formattable object has not been set to 0487 * a numeric type. 0488 * 0489 * @param status the error code. 0490 * @return the unformatted string representation of a number. 0491 * @stable ICU 4.4 0492 */ 0493 StringPiece getDecimalNumber(UErrorCode &status); 0494 0495 /** 0496 * Sets the double value of this object and changes the type to 0497 * kDouble. 0498 * @param d the new double value to be set. 0499 * @stable ICU 2.0 0500 */ 0501 void setDouble(double d); 0502 0503 /** 0504 * Sets the long value of this object and changes the type to 0505 * kLong. 0506 * @param l the new long value to be set. 0507 * @stable ICU 2.0 0508 */ 0509 void setLong(int32_t l); 0510 0511 /** 0512 * Sets the int64 value of this object and changes the type to 0513 * kInt64. 0514 * @param ll the new int64 value to be set. 0515 * @stable ICU 2.8 0516 */ 0517 void setInt64(int64_t ll); 0518 0519 /** 0520 * Sets the Date value of this object and changes the type to 0521 * kDate. 0522 * @param d the new Date value to be set. 0523 * @stable ICU 2.0 0524 */ 0525 void setDate(UDate d); 0526 0527 /** 0528 * Sets the string value of this object and changes the type to 0529 * kString. 0530 * @param stringToCopy the new string value to be set. 0531 * @stable ICU 2.0 0532 */ 0533 void setString(const UnicodeString& stringToCopy); 0534 0535 /** 0536 * Sets the array value and count of this object and changes the 0537 * type to kArray. 0538 * @param array the array value. 0539 * @param count the number of array elements to be copied. 0540 * @stable ICU 2.0 0541 */ 0542 void setArray(const Formattable* array, int32_t count); 0543 0544 /** 0545 * Sets and adopts the string value and count of this object and 0546 * changes the type to kArray. 0547 * @param stringToAdopt the new string value to be adopted. 0548 * @stable ICU 2.0 0549 */ 0550 void adoptString(UnicodeString* stringToAdopt); 0551 0552 /** 0553 * Sets and adopts the array value and count of this object and 0554 * changes the type to kArray. 0555 * @stable ICU 2.0 0556 */ 0557 void adoptArray(Formattable* array, int32_t count); 0558 0559 /** 0560 * Sets and adopts the UObject value of this object and changes 0561 * the type to kObject. After this call, the caller must not 0562 * delete the given object. 0563 * @param objectToAdopt the UObject value to be adopted 0564 * @stable ICU 3.0 0565 */ 0566 void adoptObject(UObject* objectToAdopt); 0567 0568 /** 0569 * Sets the the numeric value from a decimal number string, and changes 0570 * the type to to a numeric type appropriate for the number. 0571 * The syntax of the number is a "numeric string" 0572 * as defined in the Decimal Arithmetic Specification, available at 0573 * http://speleotrove.com/decimal 0574 * The full precision and range of the input number will be retained, 0575 * even when it exceeds what can be represented by a double or an int64. 0576 * 0577 * @param numberString a string representation of the unformatted decimal number. 0578 * @param status the error code. Set to U_INVALID_FORMAT_ERROR if the 0579 * incoming string is not a valid decimal number. 0580 * @stable ICU 4.4 0581 */ 0582 void setDecimalNumber(StringPiece numberString, 0583 UErrorCode &status); 0584 0585 /** 0586 * ICU "poor man's RTTI", returns a UClassID for the actual class. 0587 * 0588 * @stable ICU 2.2 0589 */ 0590 virtual UClassID getDynamicClassID() const override; 0591 0592 /** 0593 * ICU "poor man's RTTI", returns a UClassID for this class. 0594 * 0595 * @stable ICU 2.2 0596 */ 0597 static UClassID U_EXPORT2 getStaticClassID(); 0598 0599 /** 0600 * Convert the UFormattable to a Formattable. Internally, this is a reinterpret_cast. 0601 * @param fmt a valid UFormattable 0602 * @return the UFormattable as a Formattable object pointer. This is an alias to the original 0603 * UFormattable, and so is only valid while the original argument remains in scope. 0604 * @stable ICU 52 0605 */ 0606 static inline Formattable *fromUFormattable(UFormattable *fmt); 0607 0608 /** 0609 * Convert the const UFormattable to a const Formattable. Internally, this is a reinterpret_cast. 0610 * @param fmt a valid UFormattable 0611 * @return the UFormattable as a Formattable object pointer. This is an alias to the original 0612 * UFormattable, and so is only valid while the original argument remains in scope. 0613 * @stable ICU 52 0614 */ 0615 static inline const Formattable *fromUFormattable(const UFormattable *fmt); 0616 0617 /** 0618 * Convert this object pointer to a UFormattable. 0619 * @return this object as a UFormattable pointer. This is an alias to this object, 0620 * and so is only valid while this object remains in scope. 0621 * @stable ICU 52 0622 */ 0623 inline UFormattable *toUFormattable(); 0624 0625 /** 0626 * Convert this object pointer to a UFormattable. 0627 * @return this object as a UFormattable pointer. This is an alias to this object, 0628 * and so is only valid while this object remains in scope. 0629 * @stable ICU 52 0630 */ 0631 inline const UFormattable *toUFormattable() const; 0632 0633 #ifndef U_HIDE_DEPRECATED_API 0634 /** 0635 * Deprecated variant of getLong(UErrorCode&). 0636 * @param status the error code 0637 * @return the long value of this object. 0638 * @deprecated ICU 3.0 use getLong(UErrorCode&) instead 0639 */ 0640 inline int32_t getLong(UErrorCode* status) const; 0641 #endif /* U_HIDE_DEPRECATED_API */ 0642 0643 #ifndef U_HIDE_INTERNAL_API 0644 /** 0645 * Internal function, do not use. 0646 * TODO: figure out how to make this be non-public. 0647 * NumberFormat::format(Formattable, ... 0648 * needs to get at the DecimalQuantity, if it exists, for 0649 * big decimal formatting. 0650 * @internal 0651 */ 0652 number::impl::DecimalQuantity *getDecimalQuantity() const { return fDecimalQuantity;} 0653 0654 /** 0655 * Export the value of this Formattable to a DecimalQuantity. 0656 * @internal 0657 */ 0658 void populateDecimalQuantity(number::impl::DecimalQuantity& output, UErrorCode& status) const; 0659 0660 /** 0661 * Adopt, and set value from, a DecimalQuantity 0662 * Internal Function, do not use. 0663 * @param dq the DecimalQuantity to be adopted 0664 * @internal 0665 */ 0666 void adoptDecimalQuantity(number::impl::DecimalQuantity *dq); 0667 0668 /** 0669 * Internal function to return the CharString pointer. 0670 * @param status error code 0671 * @return pointer to the CharString - may become invalid if the object is modified 0672 * @internal 0673 */ 0674 CharString *internalGetCharString(UErrorCode &status); 0675 0676 #endif /* U_HIDE_INTERNAL_API */ 0677 0678 private: 0679 /** 0680 * Cleans up the memory for unwanted values. For example, the adopted 0681 * string or array objects. 0682 */ 0683 void dispose(void); 0684 0685 /** 0686 * Common initialization, for use by constructors. 0687 */ 0688 void init(); 0689 0690 UnicodeString* getBogus() const; 0691 0692 union { 0693 UObject* fObject; 0694 UnicodeString* fString; 0695 double fDouble; 0696 int64_t fInt64; 0697 UDate fDate; 0698 struct { 0699 Formattable* fArray; 0700 int32_t fCount; 0701 } fArrayAndCount; 0702 } fValue; 0703 0704 CharString *fDecimalStr; 0705 0706 number::impl::DecimalQuantity *fDecimalQuantity; 0707 0708 Type fType; 0709 UnicodeString fBogus; // Bogus string when it's needed. 0710 }; 0711 0712 inline UDate Formattable::getDate(UErrorCode& status) const { 0713 if (fType != kDate) { 0714 if (U_SUCCESS(status)) { 0715 status = U_INVALID_FORMAT_ERROR; 0716 } 0717 return 0; 0718 } 0719 return fValue.fDate; 0720 } 0721 0722 inline const UnicodeString& Formattable::getString(void) const { 0723 return *fValue.fString; 0724 } 0725 0726 inline UnicodeString& Formattable::getString(void) { 0727 return *fValue.fString; 0728 } 0729 0730 #ifndef U_HIDE_DEPRECATED_API 0731 inline int32_t Formattable::getLong(UErrorCode* status) const { 0732 return getLong(*status); 0733 } 0734 #endif /* U_HIDE_DEPRECATED_API */ 0735 0736 inline UFormattable* Formattable::toUFormattable() { 0737 return reinterpret_cast<UFormattable*>(this); 0738 } 0739 0740 inline const UFormattable* Formattable::toUFormattable() const { 0741 return reinterpret_cast<const UFormattable*>(this); 0742 } 0743 0744 inline Formattable* Formattable::fromUFormattable(UFormattable *fmt) { 0745 return reinterpret_cast<Formattable *>(fmt); 0746 } 0747 0748 inline const Formattable* Formattable::fromUFormattable(const UFormattable *fmt) { 0749 return reinterpret_cast<const Formattable *>(fmt); 0750 } 0751 0752 U_NAMESPACE_END 0753 0754 #endif /* #if !UCONFIG_NO_FORMATTING */ 0755 0756 #endif /* U_SHOW_CPLUSPLUS_API */ 0757 0758 #endif //_FMTABLE 0759 //eof
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |