/*
*******************************************************************************
-* Copyright (C) 1997-2003, International Business Machines Corporation and *
+* Copyright (C) 1997-2004, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*
#if !UCONFIG_NO_FORMATTING
#include "unicode/format.h"
+#include "unicode/ures.h"
+#include "cstring.h"
+#include "locbased.h"
// *****************************************************************************
// class Format
U_NAMESPACE_BEGIN
-const char FieldPosition::fgClassID=0;
+UOBJECT_DEFINE_RTTI_IMPLEMENTATION(FieldPosition)
+
+FieldPosition::~FieldPosition() {}
+
+FieldPosition *
+FieldPosition::clone() const {
+ return new FieldPosition(*this);
+}
// -------------------------------------
// default constructor
Format::Format()
: UObject()
{
+ *validLocale = *actualLocale = 0;
}
// -------------------------------------
Format::Format(const Format &that)
: UObject(that)
{
+ *this = that;
}
// -------------------------------------
// assignment operator
Format&
-Format::operator=(const Format& /*that*/)
+Format::operator=(const Format& that)
{
+ uprv_strcpy(validLocale, that.validLocale);
+ uprv_strcpy(actualLocale, that.actualLocale);
return *this;
}
{
if (U_FAILURE(status)) return toAppendTo;
- // {sfb} should really be FieldPosition::DONT_CARE, not 0
- // leave at 0 for now, to keep in sync with Java
- FieldPosition pos(0);
+ FieldPosition pos(FieldPosition::DONT_CARE);
return format(obj, toAppendTo, pos, status);
}
// -------------------------------------
UBool
-Format::operator==(const Format& /*that*/) const
+Format::operator==(const Format& that) const
{
- // Add this implementation to make linker happy.
- return TRUE;
+ // Subclasses: Call this method and then add more specific checks.
+ return getDynamicClassID() == that.getDynamicClassID();
}
//---------------------------------------
parseError.postContext[stop-start]= 0;
}
+Locale
+Format::getLocale(ULocDataLocaleType type, UErrorCode& status) const {
+ U_LOCALE_BASED(locBased, *this);
+ return locBased.getLocale(type, status);
+}
+
+const char *
+Format::getLocaleID(ULocDataLocaleType type, UErrorCode& status) const {
+ U_LOCALE_BASED(locBased, *this);
+ return locBased.getLocaleID(type, status);
+}
+
+void
+Format::setLocaleIDs(const char* valid, const char* actual) {
+ U_LOCALE_BASED(locBased, *this);
+ locBased.setLocaleIDs(valid, actual);
+}
+
U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_FORMATTING */