Loading...
Searching...
No Matches
format.h
Go to the documentation of this file.
// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
********************************************************************************
* Copyright (C) 1997-2011, International Business Machines Corporation and others.
* All Rights Reserved.
********************************************************************************
*
* File FORMAT.H
*
* Modification History:
*
* Date Name Description
* 02/19/97 aliu Converted from java.
* 03/17/97 clhuang Updated per C++ implementation.
* 03/27/97 helena Updated to pass the simple test after code review.
********************************************************************************
*/
// *****************************************************************************
// This file was generated from the java source file Format.java
// *****************************************************************************
#ifndef FORMAT_H
#define FORMAT_H
#include "unicode/utypes.h"
#if U_SHOW_CPLUSPLUS_API
#if !UCONFIG_NO_FORMATTING
#include "unicode/unistr.h"
#include "unicode/fmtable.h"
#include "unicode/fieldpos.h"
#include "unicode/fpositer.h"
#include "unicode/parsepos.h"
#include "unicode/parseerr.h"
#include "unicode/locid.h"
U_NAMESPACE_BEGIN
class U_I18N_API_CLASS Format : public UObject {
public:
U_I18N_API virtual ~Format();
U_I18N_API virtual bool operator==(const Format& other) const = 0;
U_I18N_API bool operator!=(const Format& other) const { return !operator==(other); }
U_I18N_API virtual Format* clone() const = 0;
U_I18N_API UnicodeString& format(const Formattable& obj,
UnicodeString& appendTo,
UErrorCode& status) const;
U_I18N_API virtual UnicodeString& format(const Formattable& obj,
UnicodeString& appendTo,
FieldPosition& pos,
UErrorCode& status) const = 0;
U_I18N_API virtual UnicodeString& format(const Formattable& obj,
UnicodeString& appendTo,
FieldPositionIterator* posIter,
UErrorCode& status) const;
U_I18N_API virtual void parseObject(const UnicodeString& source,
Formattable& result,
ParsePosition& parse_pos) const = 0;
U_I18N_API void parseObject(const UnicodeString& source,
Formattable& result,
UErrorCode& status) const;
U_I18N_API Locale getLocale(ULocDataLocaleType type, UErrorCode& status) const;
#ifndef U_HIDE_INTERNAL_API
U_I18N_API const char* getLocaleID(ULocDataLocaleType type, UErrorCode& status) const;
#endif /* U_HIDE_INTERNAL_API */
protected:
U_I18N_API void setLocaleIDs(const char* valid, const char* actual);
protected:
U_I18N_API Format();
U_I18N_API Format(const Format&); // Does nothing; for subclasses only
U_I18N_API Format& operator=(const Format&); // Does nothing; for subclasses
U_I18N_API static void syntaxError(const UnicodeString& pattern,
int32_t pos,
UParseError& parseError);
private:
Locale actualLocale;
Locale validLocale;
};
U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_FORMATTING */
#endif /* U_SHOW_CPLUSPLUS_API */
#endif // _FORMAT
//eof
icu::FieldPositionIterator
FieldPositionIterator returns the field ids and their start/limit positions generated by a call to Fo...
Definition fpositer.h:58
icu::FieldPosition
FieldPosition is a simple class used by Format and its subclasses to identify fields in formatted out...
Definition fieldpos.h:110
icu::Format::parseObject
U_I18N_API void parseObject(const UnicodeString &source, Formattable &result, UErrorCode &status) const
Parses a string to produce an object.
icu::Format::getLocale
U_I18N_API Locale getLocale(ULocDataLocaleType type, UErrorCode &status) const
Get the locale for this format object.
icu::Format::operator!=
U_I18N_API bool operator!=(const Format &other) const
Return true if the given Format objects are not semantically equal.
Definition format.h:123
icu::Format::~Format
virtual U_I18N_API ~Format()
Destructor.
icu::Format::clone
virtual U_I18N_API Format * clone() const =0
Clone this object polymorphically.
icu::Format::Format
U_I18N_API Format(const Format &)
icu::Format::format
virtual U_I18N_API UnicodeString & format(const Formattable &obj, UnicodeString &appendTo, FieldPosition &pos, UErrorCode &status) const =0
Format an object to produce a string.
icu::Format::operator==
virtual U_I18N_API bool operator==(const Format &other) const =0
Return true if the given Format objects are semantically equal.
icu::Format::parseObject
virtual U_I18N_API void parseObject(const UnicodeString &source, Formattable &result, ParsePosition &parse_pos) const =0
Parse a string to produce an object.
icu::Format::syntaxError
static U_I18N_API void syntaxError(const UnicodeString &pattern, int32_t pos, UParseError &parseError)
Simple function for initializing a UParseError from a UnicodeString.
icu::Format::setLocaleIDs
U_I18N_API void setLocaleIDs(const char *valid, const char *actual)
icu::Format::Format
U_I18N_API Format()
Default constructor for subclass use only.
icu::Format::getLocaleID
U_I18N_API const char * getLocaleID(ULocDataLocaleType type, UErrorCode &status) const
Get the locale for this format object.
icu::Format::operator=
U_I18N_API Format & operator=(const Format &)
icu::Format::format
virtual U_I18N_API UnicodeString & format(const Formattable &obj, UnicodeString &appendTo, FieldPositionIterator *posIter, UErrorCode &status) const
Format an object to produce a string.
icu::Format::format
U_I18N_API UnicodeString & format(const Formattable &obj, UnicodeString &appendTo, UErrorCode &status) const
Formats an object to produce a string.
icu::Formattable
Formattable objects can be passed to the Format class or its subclasses for formatting.
Definition fmtable.h:63
icu::Locale
A Locale object represents a specific geographical, political, or cultural region.
Definition locid.h:198
icu::ParsePosition
ParsePosition is a simple class used by Format and its subclasses to keep track of the current positi...
Definition parsepos.h:52
icu::UObject
UObject is the common ICU "boilerplate" class.
Definition uobject.h:222
icu::UnicodeString
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition unistr.h:303
fieldpos.h
C++ API: FieldPosition identifies the fields in a formatted output.
fmtable.h
C++ API: Formattable is a thin wrapper for primitive types used for formatting and parsing.
fpositer.h
C++ API: FieldPosition Iterator.
locid.h
C++ API: Locale ID object.
icu::operator==
U_COMMON_API UBool operator==(const StringPiece &x, const StringPiece &y)
Global operator == for StringPiece.
parseerr.h
C API: Parse Error Information.
parsepos.h
C++ API: Canonical Iterator.
UParseError
A UParseError struct is used to returned detailed information about parsing errors.
Definition parseerr.h:58
ULocDataLocaleType
ULocDataLocaleType
Constants for *_getLocale() Allow user to select whether she wants information on requested,...
Definition uloc.h:338
unistr.h
C++ API: Unicode String.
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition utypes.h:509
U_I18N_API_CLASS
#define U_I18N_API_CLASS
Set to export library symbols from inside the i18n library, and to import them from outside,...
Definition utypes.h:457
U_I18N_API
#define U_I18N_API
Set to export library symbols from inside the i18n library, and to import them from outside.
Definition utypes.h:316