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