/** * @return The number of items in the array resource.
*/
int32_t getSize() const { return length; } /** * @param i Array item index. * @param value Output-only, receives the value of the i'th item. * @return true if i is non-negative and less than getSize().
*/
UBool getValue(int32_t i, ResourceValue &value) const;
/** Only for implementation use. @internal */
uint32_t internalGetResource(const ResourceData *pResData, int32_t i) const;
/** * @return The number of items in the array resource.
*/
int32_t getSize() const { return length; } /** * @param i Table item index. * @param key Output-only, receives the key of the i'th item. * @param value Output-only, receives the value of the i'th item. * @return true if i is non-negative and less than getSize().
*/
UBool getKeyAndValue(int32_t i, constchar *&key, ResourceValue &value) const;
/** * @param key Key string to find in the table. * @param value Output-only, receives the value of the item with that key. * @return true if the table contains the key.
*/
UBool findValue(constchar *key, ResourceValue &value) const;
/** * Represents a resource bundle item's value. * Avoids object creations as much as possible. * Mutable, not thread-safe.
*/ class U_COMMON_API ResourceValue : public UObject { public: virtual ~ResourceValue();
/** * @return ICU resource type, for example, URES_STRING
*/ virtual UResType getType() const = 0;
/** * Sets U_RESOURCE_TYPE_MISMATCH if this is not a string resource. * * @see ures_getString()
*/ virtualconst char16_t *getString(int32_t &length, UErrorCode &errorCode) const = 0;
/** * Sets U_RESOURCE_TYPE_MISMATCH if this is not an alias resource.
*/ virtualconst char16_t *getAliasString(int32_t &length, UErrorCode &errorCode) const = 0;
/** * Sets U_RESOURCE_TYPE_MISMATCH if this is not an integer resource. * * @see ures_getInt()
*/ virtual int32_t getInt(UErrorCode &errorCode) const = 0;
/** * Sets U_RESOURCE_TYPE_MISMATCH if this is not an integer resource. * * @see ures_getUInt()
*/ virtual uint32_t getUInt(UErrorCode &errorCode) const = 0;
/** * Sets U_RESOURCE_TYPE_MISMATCH if this is not an intvector resource. * * @see ures_getIntVector()
*/ virtualconst int32_t *getIntVector(int32_t &length, UErrorCode &errorCode) const = 0;
/** * Sets U_RESOURCE_TYPE_MISMATCH if this is not a binary-blob resource. * * @see ures_getBinary()
*/ virtualconst uint8_t *getBinary(int32_t &length, UErrorCode &errorCode) const = 0;
/** * Sets U_RESOURCE_TYPE_MISMATCH if this is not an array resource
*/ virtual ResourceArray getArray(UErrorCode &errorCode) const = 0;
/** * Sets U_RESOURCE_TYPE_MISMATCH if this is not a table resource
*/ virtual ResourceTable getTable(UErrorCode &errorCode) const = 0;
/** * Is this a no-fallback/no-inheritance marker string? * Such a marker is used for * CLDR no-fallback data values of (three empty-set symbols)=={2205, 2205, 2205} * when enumerating tables with fallback from the specific resource bundle to root. * * @return true if this is a no-inheritance marker string
*/ virtual UBool isNoInheritanceMarker() const = 0;
/** * Sets the dest strings from the string values in this array resource. * * @return the number of strings in this array resource. * If greater than capacity, then an overflow error is set. * * Sets U_RESOURCE_TYPE_MISMATCH if this is not an array resource * or if any of the array items is not a string
*/ virtual int32_t getStringArray(UnicodeString *dest, int32_t capacity,
UErrorCode &errorCode) const = 0;
/** * Same as * <pre> * if (getType() == URES_STRING) { * return new String[] { getString(); } * } else { * return getStringArray(); * } * </pre> * * Sets U_RESOURCE_TYPE_MISMATCH if this is * neither a string resource nor an array resource containing strings * @see getString() * @see getStringArray()
*/ virtual int32_t getStringArrayOrStringAsArray(UnicodeString *dest, int32_t capacity,
UErrorCode &errorCode) const = 0;
/** * Same as * <pre> * if (getType() == URES_STRING) { * return getString(); * } else { * return getStringArray()[0]; * } * </pre> * * Sets U_RESOURCE_TYPE_MISMATCH if this is * neither a string resource nor an array resource containing strings * @see getString() * @see getStringArray()
*/ virtual UnicodeString getStringOrFirstOfArray(UErrorCode &errorCode) const = 0;
protected:
ResourceValue() {}
private:
ResourceValue(const ResourceValue &); // no copy constructor
ResourceValue &operator=(const ResourceValue &); // no assignment operator
};
/** * Sink for ICU resource bundle contents.
*/ class U_COMMON_API ResourceSink : public UObject { public:
ResourceSink() {} virtual ~ResourceSink();
/** * Called once for each bundle (child-parent-...-root). * The value is normally an array or table resource, * and implementations of this method normally iterate over the * tree of resource items stored there. * * @param key The key string of the enumeration-start resource. * Empty if the enumeration starts at the top level of the bundle. * @param value Call getArray() or getTable() as appropriate. Then reuse for * output values from Array and Table getters. Note: ResourceTable and * ResourceArray instances must outlive the ResourceValue instance for * ResourceTracer to be happy. * @param noFallback true if the bundle has no parent; * that is, its top-level table has the nofallback attribute, * or it is the root bundle of a locale tree.
*/ virtualvoid put(constchar *key, ResourceValue &value, UBool noFallback,
UErrorCode &errorCode) = 0;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.