/*
*******************************************************************************
-* Copyright (C) 2011, International Business Machines
+* Copyright (C) 2011-2012, International Business Machines
* Corporation and others. All Rights Reserved.
*******************************************************************************
* file name: appendable.cpp
return scratch;
}
-UOBJECT_DEFINE_NO_RTTI_IMPLEMENTATION(Appendable)
-
// UnicodeStringAppendable is implemented in unistr.cpp.
U_NAMESPACE_END
originalString = result;
}
-UOBJECT_DEFINE_NO_RTTI_IMPLEMENTATION(ListFormatter)
-
U_NAMESPACE_END
parseError->postContext[length]=0;
}
-UOBJECT_DEFINE_NO_RTTI_IMPLEMENTATION(MessagePattern)
-
// MessageImpl ------------------------------------------------------------- ***
void
return 0;
}
-UOBJECT_DEFINE_NO_RTTI_IMPLEMENTATION(Normalizer2)
-
// Normalizer2 implementation for the old UNORM_NONE.
class NoopNormalizer2 : public Normalizer2 {
virtual ~NoopNormalizer2();
return *(const Node *)left==*(const Node *)right;
}
-UOBJECT_DEFINE_NO_RTTI_IMPLEMENTATION(StringTrieBuilder)
-
UBool
StringTrieBuilder::Node::operator==(const Node &other) const {
return this==&other || (typeid(*this)==typeid(other) && hash==other.hash);
return edgeNumber;
}
-UOBJECT_DEFINE_NO_RTTI_IMPLEMENTATION(StringTrieBuilder::Node)
-
UBool
StringTrieBuilder::FinalValueNode::operator==(const Node &other) const {
if(this==&other) {
int32_t desiredCapacityHint,
UChar *scratch, int32_t scratchCapacity,
int32_t *resultCapacity);
-
-private:
- // No ICU "poor man's RTTI" for this class nor its subclasses.
- virtual UClassID getDynamicClassID() const;
};
/**
virtual void
nameToUnicodeUTF8(const StringPiece &name, ByteSink &dest,
IDNAInfo &info, UErrorCode &errorCode) const;
-
-private:
- // No ICU "poor man's RTTI" for this class nor its subclasses.
- virtual UClassID getDynamicClassID() const;
};
class UTS46;
ListFormatter& operator = (const ListFormatter&);
void addNewString(const UnicodeString& pattern, UnicodeString& originalString,
const UnicodeString& newString, UErrorCode& errorCode) const;
- virtual UClassID getDynamicClassID() const;
const ListFormatData& data;
};
void setParseError(UParseError *parseError, int32_t index);
- // No ICU "poor man's RTTI" for this class nor its subclasses.
- virtual UClassID getDynamicClassID() const;
-
UBool init(UErrorCode &errorCode);
UBool copyStorage(const MessagePattern &other, UErrorCode &errorCode);
* @stable ICU 4.4
*/
virtual UBool isInert(UChar32 c) const = 0;
-
-private:
- // No ICU "poor man's RTTI" for this class nor its subclasses.
- virtual UClassID getDynamicClassID() const;
};
/**
protected:
int32_t hash;
int32_t offset;
- private:
- // No ICU "poor man's RTTI" for this class nor its subclasses.
- virtual UClassID getDynamicClassID() const;
};
// This class should not be overridden because
virtual int32_t writeValueAndType(UBool hasValue, int32_t value, int32_t node) = 0;
/** @internal */
virtual int32_t writeDeltaTo(int32_t jumpTarget) = 0;
-
-private:
- // No ICU "poor man's RTTI" for this class nor its subclasses.
- virtual UClassID getDynamicClassID() const;
};
U_NAMESPACE_END
* operator==(). Nothing else should be done with them.
*
* \par
- * getDynamicClassID() is declared in the base class of the hierarchy as
- * a pure virtual. Each concrete subclass implements it in the same way:
+ * In class hierarchies that implement "poor man's RTTI",
+ * each concrete subclass implements getDynamicClassID() in the same way:
*
* \code
- * class Base {
- * public:
- * virtual UClassID getDynamicClassID() const = 0;
- * }
- *
* class Derived {
* public:
* virtual UClassID getDynamicClassID() const
* and all other public ICU C++ classes
* are derived from UObject (starting with ICU 2.2).
*
- * UObject contains common virtual functions like for ICU's "poor man's RTTI".
- * It does not contain default implementations of virtual methods
- * like getDynamicClassID to allow derived classes such as Format
- * to declare these as pure virtual.
+ * UObject contains common virtual functions, in particular a virtual destructor.
*
* The clone() function is not available in UObject because it is not
* implemented by all ICU classes.
/**
* ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class.
+ * The base class implementation returns a dummy value.
+ *
+ * Use compiler RTTI rather than ICU's "poor man's RTTI".
+ * Since ICU 4.6, new ICU C++ class hierarchies do not implement "poor man's RTTI".
*
* @stable ICU 2.2
*/
- virtual UClassID getDynamicClassID() const = 0;
+ virtual UClassID getDynamicClassID() const;
protected:
// the following functions are protected to prevent instantiation and
// direct use of UObject itself
// default constructor
- // commented out because UObject is abstract (see getDynamicClassID)
// inline UObject() {}
// copy constructor
- // commented out because UObject is abstract (see getDynamicClassID)
// inline UObject(const UObject &other) {}
#if 0
* here would be to declare and empty-implement a protected or public one.
UObject &UObject::operator=(const UObject &);
*/
-
-// Future implementation for RTTI that support subtyping. [alan]
-//
-// public:
-// /**
-// * @internal
-// */
-// static UClassID getStaticClassID();
-//
-// /**
-// * @internal
-// */
-// UBool instanceOf(UClassID type) const;
};
#ifndef U_HIDE_INTERNAL_API
return (UClassID)&classID; \
}
-/**
- * This is a simple macro to express that a class and its subclasses do not offer
- * ICU's "poor man's RTTI".
- * Beginning with ICU 4.6, ICU requires C++ compiler RTTI.
- * This does not go into the header. This should only be used in *.cpp files.
- * Use this with a private getDynamicClassID() in an immediate subclass of UObject.
- *
- * @param myClass The name of the class that needs RTTI defined.
- * @internal
- */
-#define UOBJECT_DEFINE_NO_RTTI_IMPLEMENTATION(myClass) \
- UClassID myClass::getDynamicClassID() const { return NULL; }
-
-// /**
-// * This macro adds ICU RTTI to an ICU concrete class implementation.
-// * This macro should be invoked in *.cpp files. The corresponding
-// * header should declare getDynamicClassID and getStaticClassID.
-// *
-// * @param myClass The name of the class that needs RTTI defined.
-// * @param myParent The name of the myClass's parent.
-// * @internal
-// */
-/*#define UOBJECT_DEFINE_RTTI_IMPLEMENTATION(myClass, myParent) \
- UOBJECT_DEFINE_ABSTRACT_RTTI_IMPLEMENTATION(myClass, myParent) \
- UClassID myClass::getDynamicClassID() const { \
- return myClass::getStaticClassID(); \
- }
-*/
#endif /* U_HIDE_INTERNAL_API */
U_NAMESPACE_END
UObject::~UObject() {}
-// Future implementation for RTTI that support subtyping. [alan]
-//
-// UClassID UObject::getStaticClassID() {
-// return (UClassID) NULL;
-// }
-//
-// UBool UObject::instanceOf(UClassID type) const {
-// UClassID c = getDynamicClassID();
-// for (;;) {
-// if (c == type) {
-// return TRUE;
-// } else if (c == (UClassID) NULL) {
-// return FALSE;
-// }
-// c = * (UClassID*) c;
-// }
-// }
+UClassID UObject::getDynamicClassID() const { return NULL; }
U_NAMESPACE_END
}
}
-UOBJECT_DEFINE_NO_RTTI_IMPLEMENTATION(IDNA)
-
// UTS46 class declaration ------------------------------------------------- ***
class UTS46 : public IDNA {
//#include <iostream>
U_NAMESPACE_BEGIN
-UOBJECT_DEFINE_NO_RTTI_IMPLEMENTATION(AlphabeticIndex)
-
// Forward Declarations
static int32_t U_CALLCONV
PreferenceComparator(const void *context, const void *left, const void *right);
/*
******************************************************************************
-* Copyright (C) 2009-2010, International Business Machines Corporation and
+* Copyright (C) 2009-2012, International Business Machines Corporation and
* others. All Rights Reserved.
******************************************************************************
* Date Name Description
U_NAMESPACE_BEGIN
-UOBJECT_DEFINE_NO_RTTI_IMPLEMENTATION(FieldPositionIterator)
-
FieldPositionIterator::~FieldPositionIterator() {
delete data;
data = NULL;
GenderInfo::~GenderInfo() {
}
-UOBJECT_DEFINE_NO_RTTI_IMPLEMENTATION(GenderInfo)
-
const GenderInfo* GenderInfo::getInstance(const Locale& locale, UErrorCode& status) {
if (U_FAILURE(status)) {
return NULL;
LocaleDisplayNames::~LocaleDisplayNames() {}
-UOBJECT_DEFINE_NO_RTTI_IMPLEMENTATION(LocaleDisplayNames)
-
////////////////////////////////////////////////////////////////////////////////////////////////////
#if 0 // currently unused
// -------------------------------------
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(MessageFormat)
-UOBJECT_DEFINE_NO_RTTI_IMPLEMENTATION(MessageFormat::DummyFormat)
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(FormatNameEnumeration)
//--------------------------------------------------------------------
// ---------------------------------------------------
// TimeZoneNames base class
// ---------------------------------------------------
-UOBJECT_DEFINE_NO_RTTI_IMPLEMENTATION(TimeZoneNames)
-
TimeZoneNames::~TimeZoneNames() {
}
virtual AlphabeticIndex &resetRecordIterator();
private:
- // No ICU "poor man's RTTI" for this class nor its subclasses.
- virtual UClassID getDynamicClassID() const;
-
/**
* No Copy constructor.
* @internal
/*
********************************************************************************
-* Copyright (C) 2010, International Business Machines
+* Copyright (C) 2010-2012, International Business Machines
* Corporation and others. All Rights Reserved.
********************************************************************************
*
UVector32 *data;
int32_t pos;
-
- // No ICU "poor man's RTTI" for this class nor its subclasses.
- virtual UClassID getDynamicClassID() const;
};
U_NAMESPACE_END
private:
int32_t _style;
-
- /**
- * No "poor man's RTTI"
- */
- virtual UClassID getDynamicClassID() const;
-
/**
* Copy constructor. One object per locale invariant. Clients
* must never copy GenderInfo objects.
*/
virtual UnicodeString& keyValueDisplayName(const char* key, const char* value,
UnicodeString& result) const = 0;
-
-private:
- // No ICU "poor man's RTTI" for this class nor its subclasses.
- virtual UClassID getDynamicClassID() const;
};
inline LocaleDisplayNames* LocaleDisplayNames::createInstance(const Locale& locale) {
virtual void parseObject(const UnicodeString&,
Formattable&,
ParsePosition&) const;
- virtual UClassID getDynamicClassID() const;
};
friend class MessageFormatAdapter; // getFormatTypeList() access
* @internal
*/
virtual MatchInfoCollection* find(const UnicodeString& text, int32_t start, uint32_t types, UErrorCode& status) const = 0;
-
-private:
- // No ICU "poor man's RTTI" for this class nor its subclasses.
- virtual UClassID getDynamicClassID() const;
};
U_NAMESPACE_END
/********************************************************************
- * COPYRIGHT:
+ * COPYRIGHT:
* Copyright (c) 1997-2012, International Business Machines Corporation and
* others. All Rights Reserved.
- * Copyright (C) 2010 , Yahoo! Inc.
+ * Copyright (C) 2010 , Yahoo! Inc.
********************************************************************/
#include <stdio.h>
ids_count = 0;
UErrorCode status = U_ZERO_ERROR;
+ TESTCLASSID_NONE_CTOR(UObject, ());
+
#if !UCONFIG_NO_TRANSLITERATION || !UCONFIG_NO_FORMATTING
UParseError parseError;
#endif