ICU-8454 virtual destructors should be explicit, and defined in a .cpp file, so that they can serve as key functions

X-SVN-Rev: 30423
This commit is contained in:
Markus Scherer 2011-07-26 05:32:25 +00:00
parent d0c495ee99
commit 2862296471
45 changed files with 312 additions and 99 deletions

View file

@ -17,6 +17,8 @@
U_NAMESPACE_BEGIN
Appendable::~Appendable() {}
UBool
Appendable::appendCodePoint(UChar32 c) {
if(c<=0xffff) {

View file

@ -222,12 +222,16 @@ BreakIterator::~BreakIterator()
// -------------------------------------
class ICUBreakIteratorFactory : public ICUResourceBundleFactory {
public:
virtual ~ICUBreakIteratorFactory();
protected:
virtual UObject* handleCreate(const Locale& loc, int32_t kind, const ICUService* /*service*/, UErrorCode& status) const {
return BreakIterator::makeInstance(loc, kind, status);
}
};
ICUBreakIteratorFactory::~ICUBreakIteratorFactory() {}
// -------------------------------------
class ICUBreakIteratorService : public ICULocaleService {
@ -239,6 +243,8 @@ public:
registerFactory(new ICUBreakIteratorFactory(), status);
}
virtual ~ICUBreakIteratorService();
virtual UObject* cloneInstance(UObject* instance) const {
return ((BreakIterator*)instance)->clone();
}
@ -256,6 +262,8 @@ public:
}
};
ICUBreakIteratorService::~ICUBreakIteratorService() {}
// -------------------------------------
U_NAMESPACE_END

View file

@ -1,4 +1,4 @@
// Copyright (C) 2009-2010, International Business Machines
// Copyright (C) 2009-2011, International Business Machines
// Corporation and others. All Rights Reserved.
//
// Copyright 2007 Google Inc. All Rights Reserved.
@ -10,6 +10,8 @@
U_NAMESPACE_BEGIN
ByteSink::~ByteSink() {}
char* ByteSink::GetAppendBuffer(int32_t min_capacity,
int32_t /*desired_capacity_hint*/,
char* scratch, int32_t scratch_capacity,
@ -29,6 +31,8 @@ CheckedArrayByteSink::CheckedArrayByteSink(char* outbuf, int32_t capacity)
size_(0), appended_(0), overflowed_(FALSE) {
}
CheckedArrayByteSink::~CheckedArrayByteSink() {}
CheckedArrayByteSink& CheckedArrayByteSink::Reset() {
size_ = appended_ = 0;
overflowed_ = FALSE;

View file

@ -1,6 +1,6 @@
/*
**********************************************************************
* Copyright (C) 1999-2004, International Business Machines
* Copyright (C) 1999-2011, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
*/
@ -63,6 +63,8 @@ CharacterIterator::CharacterIterator(int32_t length, int32_t textBegin, int32_t
}
}
CharacterIterator::~CharacterIterator() {}
CharacterIterator::CharacterIterator(const CharacterIterator &that) :
ForwardCharacterIterator(that),
textLength(that.textLength), pos(that.pos), begin(that.begin), end(that.end)

View file

@ -1,7 +1,7 @@
/*
*******************************************************************************
*
* Copyright (C) 2009, International Business Machines
* Copyright (C) 2009-2011, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@ -19,6 +19,8 @@
U_NAMESPACE_BEGIN
ErrorCode::~ErrorCode() {}
UErrorCode ErrorCode::reset() {
UErrorCode code = errorCode;
errorCode = U_ZERO_ERROR;

View file

@ -26,6 +26,8 @@
U_NAMESPACE_BEGIN
FilteredNormalizer2::~FilteredNormalizer2() {}
UnicodeString &
FilteredNormalizer2::normalize(const UnicodeString &src,
UnicodeString &dest,

View file

@ -982,9 +982,7 @@ public:
}
}
virtual ~KeywordEnumeration() {
uprv_free(keywords);
}
virtual ~KeywordEnumeration();
virtual StringEnumeration * clone() const
{
@ -1034,6 +1032,10 @@ public:
const char KeywordEnumeration::fgClassID = '\0';
KeywordEnumeration::~KeywordEnumeration() {
uprv_free(keywords);
}
StringEnumeration *
Locale::createKeywords(UErrorCode &status) const
{

View file

@ -33,8 +33,12 @@ U_NAMESPACE_BEGIN
// Public API dispatch via Normalizer2 subclasses -------------------------- ***
Normalizer2::~Normalizer2() {}
// Normalizer2 implementation for the old UNORM_NONE.
class NoopNormalizer2 : public Normalizer2 {
virtual ~NoopNormalizer2();
virtual UnicodeString &
normalize(const UnicodeString &src,
UnicodeString &dest,
@ -95,11 +99,14 @@ class NoopNormalizer2 : public Normalizer2 {
virtual UBool isInert(UChar32) const { return TRUE; }
};
NoopNormalizer2::~NoopNormalizer2() {}
// Intermediate class:
// Has Normalizer2Impl and does boilerplate argument checking and setup.
class Normalizer2WithImpl : public Normalizer2 {
public:
Normalizer2WithImpl(const Normalizer2Impl &ni) : impl(ni) {}
virtual ~Normalizer2WithImpl();
// normalize
virtual UnicodeString &
@ -234,9 +241,12 @@ public:
const Normalizer2Impl &impl;
};
Normalizer2WithImpl::~Normalizer2WithImpl() {}
class DecomposeNormalizer2 : public Normalizer2WithImpl {
public:
DecomposeNormalizer2(const Normalizer2Impl &ni) : Normalizer2WithImpl(ni) {}
virtual ~DecomposeNormalizer2();
private:
virtual void
@ -264,10 +274,13 @@ private:
virtual UBool isInert(UChar32 c) const { return impl.isDecompInert(c); }
};
DecomposeNormalizer2::~DecomposeNormalizer2() {}
class ComposeNormalizer2 : public Normalizer2WithImpl {
public:
ComposeNormalizer2(const Normalizer2Impl &ni, UBool fcc) :
Normalizer2WithImpl(ni), onlyContiguous(fcc) {}
virtual ~ComposeNormalizer2();
private:
virtual void
@ -335,9 +348,12 @@ private:
const UBool onlyContiguous;
};
ComposeNormalizer2::~ComposeNormalizer2() {}
class FCDNormalizer2 : public Normalizer2WithImpl {
public:
FCDNormalizer2(const Normalizer2Impl &ni) : Normalizer2WithImpl(ni) {}
virtual ~FCDNormalizer2();
private:
virtual void
@ -362,6 +378,8 @@ private:
virtual UBool isInert(UChar32 c) const { return impl.isFCDInert(c); }
};
FCDNormalizer2::~FCDNormalizer2() {}
// instance cache ---------------------------------------------------------- ***
struct Norm2AllModes : public UMemory {

View file

@ -120,6 +120,8 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(ICUServiceKey)
******************************************************************
*/
ICUServiceFactory::~ICUServiceFactory() {}
SimpleFactory::SimpleFactory(UObject* instanceToAdopt, const UnicodeString& id, UBool visible)
: _instance(instanceToAdopt), _id(id), _visible(visible)
{
@ -188,6 +190,8 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(SimpleFactory)
******************************************************************
*/
ServiceListener::~ServiceListener() {}
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(ServiceListener)
/*

View file

@ -211,6 +211,7 @@ public:
*/
class U_COMMON_API ICUServiceFactory : public UObject {
public:
virtual ~ICUServiceFactory();
/**
* <p>Create a service object from the key, if this factory
@ -367,6 +368,8 @@ public:
*/
class U_COMMON_API ServiceListener : public EventListener {
public:
virtual ~ServiceListener();
/**
* <p>This method is called when the service changes. At the time of the
* call this listener is registered with the service. It must

View file

@ -199,7 +199,7 @@ public:
return NULL;
}
virtual ~ServiceEnumeration() {}
virtual ~ServiceEnumeration();
virtual StringEnumeration *clone() const {
UErrorCode status = U_ZERO_ERROR;
@ -248,6 +248,8 @@ public:
virtual UClassID getDynamicClassID(void) const;
};
ServiceEnumeration::~ServiceEnumeration() {}
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(ServiceEnumeration)
StringEnumeration*

View file

@ -1,6 +1,6 @@
/**
*******************************************************************************
* Copyright (C) 2006-2008, International Business Machines Corporation *
* Copyright (C) 2006-2011, International Business Machines Corporation *
* and others. All Rights Reserved. *
*******************************************************************************
*/
@ -249,10 +249,9 @@ public:
fBranchStack.push(kLessThan, status);
unistr.remove();
}
virtual ~MutableTrieEnumeration() {
}
virtual ~MutableTrieEnumeration();
virtual StringEnumeration *clone() const {
UErrorCode status = U_ZERO_ERROR;
return new MutableTrieEnumeration(fRoot, status);
@ -340,6 +339,8 @@ public:
}
};
MutableTrieEnumeration::~MutableTrieEnumeration() {}
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(MutableTrieEnumeration)
StringEnumeration *
@ -558,10 +559,9 @@ public:
fIndexStack.push(0, status);
unistr.remove();
}
virtual ~CompactTrieEnumeration() {
}
virtual ~CompactTrieEnumeration();
virtual StringEnumeration *clone() const {
UErrorCode status = U_ZERO_ERROR;
return new CompactTrieEnumeration(fHeader, status);
@ -588,6 +588,8 @@ public:
}
};
CompactTrieEnumeration::~CompactTrieEnumeration() {}
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(CompactTrieEnumeration)
const UnicodeString *
@ -689,10 +691,9 @@ class BuildCompactTrieNode: public UMemory {
fNodeID = nodes.size();
nodes.push(this, status);
}
virtual ~BuildCompactTrieNode() {
}
virtual ~BuildCompactTrieNode();
virtual uint32_t size() {
return sizeof(uint16_t);
}
@ -705,6 +706,8 @@ class BuildCompactTrieNode: public UMemory {
}
};
BuildCompactTrieNode::~BuildCompactTrieNode() {}
class BuildCompactTrieHorizontalNode: public BuildCompactTrieNode {
public:
UStack fLinks;
@ -713,10 +716,9 @@ class BuildCompactTrieHorizontalNode: public BuildCompactTrieNode {
BuildCompactTrieHorizontalNode(UBool parentEndsWord, UStack &nodes, UErrorCode &status)
: BuildCompactTrieNode(parentEndsWord, FALSE, nodes, status), fLinks(status) {
}
virtual ~BuildCompactTrieHorizontalNode() {
}
virtual ~BuildCompactTrieHorizontalNode();
virtual uint32_t size() {
return offsetof(CompactTrieHorizontalNode,entries) +
(fChars.length()*sizeof(CompactTrieHorizontalEntry));
@ -745,6 +747,8 @@ class BuildCompactTrieHorizontalNode: public BuildCompactTrieNode {
}
};
BuildCompactTrieHorizontalNode::~BuildCompactTrieHorizontalNode() {}
class BuildCompactTrieVerticalNode: public BuildCompactTrieNode {
public:
BuildCompactTrieNode *fEqual;
@ -754,10 +758,9 @@ class BuildCompactTrieVerticalNode: public BuildCompactTrieNode {
: BuildCompactTrieNode(parentEndsWord, TRUE, nodes, status) {
fEqual = NULL;
}
virtual ~BuildCompactTrieVerticalNode() {
}
virtual ~BuildCompactTrieVerticalNode();
virtual uint32_t size() {
return offsetof(CompactTrieVerticalNode,chars) + (fChars.length()*sizeof(uint16_t));
}
@ -786,6 +789,8 @@ class BuildCompactTrieVerticalNode: public BuildCompactTrieNode {
}
};
BuildCompactTrieVerticalNode::~BuildCompactTrieVerticalNode() {}
// Forward declaration
static void walkHorizontal(const TernaryNode *node,
BuildCompactTrieHorizontalNode *building,

View file

@ -48,6 +48,12 @@ class UnicodeString;
*/
class U_COMMON_API Appendable : public UObject {
public:
/**
* Destructor.
* @draft ICU 4.8
*/
~Appendable();
/**
* Appends a 16-bit code unit.
* @param c code unit
@ -155,6 +161,12 @@ public:
*/
explicit UnicodeStringAppendable(UnicodeString &s) : str(s) {}
/**
* Destructor.
* @draft ICU 4.8
*/
~UnicodeStringAppendable();
/**
* Appends a 16-bit code unit to the string.
* @param c code unit

View file

@ -1,4 +1,4 @@
// Copyright (C) 2009-2010, International Business Machines
// Copyright (C) 2009-2011, International Business Machines
// Corporation and others. All Rights Reserved.
//
// Copyright 2007 Google Inc. All Rights Reserved.
@ -56,7 +56,7 @@ public:
* Virtual destructor.
* @stable ICU 4.2
*/
virtual ~ByteSink() { }
virtual ~ByteSink();
/**
* Append "bytes[0,n-1]" to this.
@ -149,6 +149,11 @@ public:
* @stable ICU 4.2
*/
CheckedArrayByteSink(char* outbuf, int32_t capacity);
/**
* Destructor.
* @stable ICU 4.2
*/
virtual ~CheckedArrayByteSink();
/**
* Returns the sink to its original state, without modifying the buffer.
* Useful for reusing both the buffer and the sink for multiple streams.

View file

@ -1,7 +1,7 @@
/*
********************************************************************
*
* Copyright (C) 1997-2005, International Business Machines
* Copyright (C) 1997-2011, International Business Machines
* Corporation and others. All Rights Reserved.
*
********************************************************************
@ -361,6 +361,12 @@ public:
*/
enum EOrigin { kStart, kCurrent, kEnd };
/**
* Destructor.
* @stable ICU 2.0
*/
virtual ~CharacterIterator();
/**
* Returns a pointer to a new CharacterIterator of the same
* concrete class as this one, and referring to the same

View file

@ -1,7 +1,7 @@
/*
*******************************************************************************
*
* Copyright (C) 2009-2010, International Business Machines
* Copyright (C) 2009-2011, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@ -57,7 +57,7 @@ U_NAMESPACE_BEGIN
* \code
* class IcuErrorCode: public icu::ErrorCode {
* public:
* virtual ~IcuErrorCode() {
* virtual ~IcuErrorCode() { // should be defined in .cpp as "key function"
* // Safe because our handleFailure() does not throw exceptions.
* if(isFailure()) { handleFailure(); }
* }
@ -84,7 +84,7 @@ public:
*/
ErrorCode() : errorCode(U_ZERO_ERROR) {}
/** Destructor, does nothing. See class documentation for details. @stable ICU 4.2 */
virtual ~ErrorCode() {}
virtual ~ErrorCode();
/** Conversion operator, returns a reference. @stable ICU 4.2 */
operator UErrorCode & () { return errorCode; }
/** Conversion operator, returns a pointer. @stable ICU 4.2 */

View file

@ -1,6 +1,6 @@
/*
*******************************************************************************
* Copyright (C) 2010, International Business Machines
* Copyright (C) 2010-2011, International Business Machines
* Corporation and others. All Rights Reserved.
*******************************************************************************
* file name: idna.h
@ -47,6 +47,12 @@ class U_COMMON_API IDNAInfo;
*/
class U_COMMON_API IDNA : public UObject {
public:
/**
* Destructor.
* @draft ICU 4.6
*/
~IDNA();
/**
* Returns an IDNA instance which implements UTS #46.
* Returns an unmodifiable instance, owned by the caller.

View file

@ -77,6 +77,12 @@ U_NAMESPACE_BEGIN
*/
class U_COMMON_API Normalizer2 : public UObject {
public:
/**
* Destructor.
* @stable ICU 4.4
*/
~Normalizer2();
/**
* Returns a Normalizer2 instance which uses the specified data file
* (packageName/name similar to ucnv_openPackage() and ures_open()/ResourceBundle)
@ -338,6 +344,12 @@ public:
FilteredNormalizer2(const Normalizer2 &n2, const UnicodeSet &filterSet) :
norm2(n2), set(filterSet) {}
/**
* Destructor.
* @stable ICU 4.4
*/
~FilteredNormalizer2();
/**
* Writes the normalized form of the source string to the destination string
* (replacing its contents) and returns the destination string.

View file

@ -1626,6 +1626,8 @@ UnicodeString::cloneArrayIfNeeded(int32_t newCapacity,
// UnicodeStringAppendable ------------------------------------------------- ***
UnicodeStringAppendable::~UnicodeStringAppendable() {}
UBool
UnicodeStringAppendable::appendCodeUnit(UChar c) {
return str.doReplace(str.length(), 0, &c, 0, 1).isWritable();

View file

@ -66,6 +66,8 @@ isASCIIOkBiDi(const char *s, int32_t length);
// IDNA class default implementations -------------------------------------- ***
IDNA::~IDNA() {}
void
IDNA::labelToASCII_UTF8(const StringPiece &label, ByteSink &dest,
IDNAInfo &info, UErrorCode &errorCode) const {

View file

@ -1,6 +1,6 @@
/************************************************************************
* Copyright (C) 1996-2008, International Business Machines Corporation *
* and others. All Rights Reserved. *
* Copyright (C) 1996-2011, International Business Machines Corporation
* and others. All Rights Reserved.
************************************************************************
* 2003-nov-07 srl Port from Java
*/
@ -721,9 +721,12 @@ CalendarAstronomer::AngleFunc::~AngleFunc() {}
*/
class SunTimeAngleFunc : public CalendarAstronomer::AngleFunc {
public:
virtual ~SunTimeAngleFunc();
virtual double eval(CalendarAstronomer& a) { return a.getSunLongitude(); }
};
SunTimeAngleFunc::~SunTimeAngleFunc() {}
UDate CalendarAstronomer::getSunTime(double desired, UBool next)
{
SunTimeAngleFunc func;
@ -738,9 +741,12 @@ CalendarAstronomer::CoordFunc::~CoordFunc() {}
class RiseSetCoordFunc : public CalendarAstronomer::CoordFunc {
public:
virtual ~RiseSetCoordFunc();
virtual void eval(CalendarAstronomer::Equatorial& result, CalendarAstronomer&a) { a.getSunPosition(result); }
};
RiseSetCoordFunc::~RiseSetCoordFunc() {}
UDate CalendarAstronomer::getSunRiseSet(UBool rise)
{
UDate t0 = fTime;
@ -1217,9 +1223,12 @@ const CalendarAstronomer::MoonAge CalendarAstronomer::FULL_MOON() {
class MoonTimeAngleFunc : public CalendarAstronomer::AngleFunc {
public:
virtual ~MoonTimeAngleFunc();
virtual double eval(CalendarAstronomer&a) { return a.getMoonAge(); }
};
MoonTimeAngleFunc::~MoonTimeAngleFunc() {}
/*const CalendarAstronomer::MoonAge CalendarAstronomer::LAST_QUARTER() {
return CalendarAstronomer::MoonAge((CalendarAstronomer::PI*3)/2);
}*/
@ -1260,9 +1269,12 @@ UDate CalendarAstronomer::getMoonTime(const CalendarAstronomer::MoonAge& desired
class MoonRiseSetCoordFunc : public CalendarAstronomer::CoordFunc {
public:
virtual ~MoonRiseSetCoordFunc();
virtual void eval(CalendarAstronomer::Equatorial& result, CalendarAstronomer&a) { result = a.getMoonPosition(); }
};
MoonRiseSetCoordFunc::~MoonRiseSetCoordFunc() {}
/**
* Returns the time (GMT) of sunrise or sunset on the local date to which
* this calendar is currently set.

View file

@ -357,7 +357,7 @@ public:
BasicCalendarFactory()
: LocaleKeyFactory(LocaleKeyFactory::INVISIBLE) { }
virtual ~BasicCalendarFactory() {}
virtual ~BasicCalendarFactory();
protected:
//virtual UBool isSupportedID( const UnicodeString& id, UErrorCode& status) const {
@ -416,6 +416,7 @@ protected:
}
};
BasicCalendarFactory::~BasicCalendarFactory() {}
/**
* A factory which looks up the DefaultCalendar resource to determine which class of calendar to use
@ -423,7 +424,8 @@ protected:
class DefaultCalendarFactory : public ICUResourceBundleFactory {
public:
DefaultCalendarFactory(): ICUResourceBundleFactory() { }
DefaultCalendarFactory() : ICUResourceBundleFactory() { }
virtual ~DefaultCalendarFactory();
protected:
virtual UObject* create(const ICUServiceKey& key, const ICUService* /*service*/, UErrorCode& status) const {
@ -443,6 +445,8 @@ protected:
}
};
DefaultCalendarFactory::~DefaultCalendarFactory() {}
// -------------------------------------
class CalendarService : public ICULocaleService {
public:
@ -453,6 +457,8 @@ public:
registerFactory(new DefaultCalendarFactory(), status);
}
virtual ~CalendarService();
virtual UObject* cloneInstance(UObject* instance) const {
UnicodeString *s = dynamic_cast<UnicodeString *>(instance);
if(s != NULL) {
@ -492,6 +498,8 @@ public:
}
};
CalendarService::~CalendarService() {}
// -------------------------------------
static inline UBool

View file

@ -112,11 +112,14 @@ CollatorFactory::getDisplayName(const Locale& objectLocale,
class ICUCollatorFactory : public ICUResourceBundleFactory {
public:
ICUCollatorFactory(): ICUResourceBundleFactory(UnicodeString(U_ICUDATA_COLL, -1, US_INV)) { }
ICUCollatorFactory() : ICUResourceBundleFactory(UnicodeString(U_ICUDATA_COLL, -1, US_INV)) { }
virtual ~ICUCollatorFactory();
protected:
virtual UObject* create(const ICUServiceKey& key, const ICUService* service, UErrorCode& status) const;
};
ICUCollatorFactory::~ICUCollatorFactory() {}
UObject*
ICUCollatorFactory::create(const ICUServiceKey& key, const ICUService* /* service */, UErrorCode& status) const {
if (handlesKey(key, status)) {
@ -142,7 +145,9 @@ public:
UErrorCode status = U_ZERO_ERROR;
registerFactory(new ICUCollatorFactory(), status);
}
virtual ~ICUCollatorService();
virtual UObject* cloneInstance(UObject* instance) const {
return ((Collator*)instance)->clone();
}
@ -188,6 +193,8 @@ public:
}
};
ICUCollatorService::~ICUCollatorService() {}
// -------------------------------------
static ICULocaleService*
@ -630,13 +637,9 @@ public:
}
}
}
virtual ~CFactory()
{
delete _delegate;
delete _ids;
}
virtual ~CFactory();
virtual UObject* create(const ICUServiceKey& key, const ICUService* service, UErrorCode& status) const;
protected:
@ -652,6 +655,12 @@ protected:
getDisplayName(const UnicodeString& id, const Locale& locale, UnicodeString& result) const;
};
CFactory::~CFactory()
{
delete _delegate;
delete _ids;
}
UObject*
CFactory::create(const ICUServiceKey& key, const ICUService* /* service */, UErrorCode& status) const
{
@ -722,8 +731,7 @@ public:
//isAvailableLocaleListInitialized(status);
}
virtual ~CollationLocaleListEnumeration() {
}
virtual ~CollationLocaleListEnumeration();
virtual StringEnumeration * clone() const
{
@ -765,6 +773,8 @@ public:
}
};
CollationLocaleListEnumeration::~CollationLocaleListEnumeration() {}
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(CollationLocaleListEnumeration)

View file

@ -1,6 +1,6 @@
/*
**********************************************************************
* Copyright (C) 2005-2009, International Business Machines
* Copyright (C) 2005-2011, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
*/
@ -136,6 +136,8 @@ static const uint8_t escapeSequences_2022CN[][5] = {
{0x1b, 0x4f, 0x00, 0x00, 0x00}, // SS3
};
CharsetRecog_2022JP::~CharsetRecog_2022JP() {}
const char *CharsetRecog_2022JP::getName() const
{
return "ISO-2022-JP";
@ -146,6 +148,8 @@ int32_t CharsetRecog_2022JP::match(InputText *textIn)
return match_2022(textIn->fInputBytes, textIn->fInputLen, escapeSequences_2022JP, ARRAY_SIZE(escapeSequences_2022JP));
}
CharsetRecog_2022KR::~CharsetRecog_2022KR() {}
const char *CharsetRecog_2022KR::getName() const
{
return "ISO-2022-KR";
@ -156,6 +160,8 @@ int32_t CharsetRecog_2022KR::match(InputText *textIn)
return match_2022(textIn->fInputBytes, textIn->fInputLen, escapeSequences_2022KR, ARRAY_SIZE(escapeSequences_2022KR));
}
CharsetRecog_2022CN::~CharsetRecog_2022CN() {}
const char *CharsetRecog_2022CN::getName() const
{
return "ISO-2022-CN";

View file

@ -1,6 +1,6 @@
/*
**********************************************************************
* Copyright (C) 2005-2006, International Business Machines
* Copyright (C) 2005-2011, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
*/
@ -52,8 +52,8 @@ protected:
class CharsetRecog_2022JP :public CharsetRecog_2022
{
public:
virtual ~CharsetRecog_2022JP() {}
public:
virtual ~CharsetRecog_2022JP();
const char *getName() const;
@ -61,8 +61,8 @@ public:
};
class CharsetRecog_2022KR :public CharsetRecog_2022 {
public:
virtual ~CharsetRecog_2022KR() {}
public:
virtual ~CharsetRecog_2022KR();
const char *getName() const;
@ -72,8 +72,8 @@ public:
class CharsetRecog_2022CN :public CharsetRecog_2022
{
public:
virtual ~CharsetRecog_2022CN() {}
public:
virtual ~CharsetRecog_2022CN();
const char* getName() const;

View file

@ -1539,6 +1539,8 @@ PatternMap::getDuplicateElem(
DateTimeMatcher::DateTimeMatcher(void) {
}
DateTimeMatcher::~DateTimeMatcher() {}
DateTimeMatcher::DateTimeMatcher(const DateTimeMatcher& other) {
copyFrom(other.skeleton);
}
@ -1832,6 +1834,8 @@ FormatParser::isPatternSeparator(UnicodeString& field) {
return TRUE;
}
DistanceInfo::~DistanceInfo() {}
void
DistanceInfo::setTo(DistanceInfo &other) {
missingFieldMask = other.missingFieldMask;

View file

@ -166,7 +166,7 @@ public:
int32_t extraFieldMask;
DistanceInfo() {}
virtual ~DistanceInfo() {}
virtual ~DistanceInfo();
void clear() { missingFieldMask = extraFieldMask = 0; }
void setTo(DistanceInfo& other);
void addMissing(int32_t field) { missingFieldMask |= (1<<field); }
@ -188,7 +188,7 @@ public:
int32_t getDistance(const DateTimeMatcher& other, int32_t includeMask, DistanceInfo& distanceInfo);
DateTimeMatcher();
DateTimeMatcher(const DateTimeMatcher& other);
virtual ~DateTimeMatcher() {}
virtual ~DateTimeMatcher();
int32_t getFieldMask();
};

View file

@ -145,6 +145,8 @@ ICUDataTable::getNoFallback(const char* tableKey, const char* subTableKey, const
////////////////////////////////////////////////////////////////////////////////////////////////////
LocaleDisplayNames::~LocaleDisplayNames() {}
UOBJECT_DEFINE_NO_RTTI_IMPLEMENTATION(LocaleDisplayNames)
////////////////////////////////////////////////////////////////////////////////////////////////////

View file

@ -1,6 +1,6 @@
/*
**********************************************************************
* Copyright (c) 2004, International Business Machines
* Copyright (c) 2004-2011, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Author: Alan Liu
@ -19,6 +19,8 @@ U_NAMESPACE_BEGIN
MeasureFormat::MeasureFormat() {}
MeasureFormat::~MeasureFormat() {}
MeasureFormat* U_EXPORT2 MeasureFormat::createCurrencyFormat(const Locale& locale,
UErrorCode& ec) {
CurrencyFormat* fmt = NULL;

View file

@ -51,6 +51,7 @@ public:
const RuleBasedNumberFormat* formatter,
const UnicodeString& description,
UErrorCode& status);
virtual ~SameValueSubstitution();
virtual int64_t transformNumber(int64_t number) const { return number; }
virtual double transformNumber(double number) const { return number; }
@ -63,6 +64,8 @@ public:
virtual UClassID getDynamicClassID(void) const;
};
SameValueSubstitution::~SameValueSubstitution() {}
class MultiplierSubstitution : public NFSubstitution {
double divisor;
int64_t ldivisor;
@ -81,6 +84,7 @@ public:
status = U_PARSE_ERROR;
}
}
virtual ~MultiplierSubstitution();
virtual void setDivisor(int32_t radix, int32_t exponent, UErrorCode& status) {
divisor = uprv_pow(radix, exponent);
@ -118,6 +122,8 @@ public:
virtual UClassID getDynamicClassID(void) const;
};
MultiplierSubstitution::~MultiplierSubstitution() {}
class ModulusSubstitution : public NFSubstitution {
double divisor;
int64_t ldivisor;
@ -130,6 +136,7 @@ public:
const RuleBasedNumberFormat* formatter,
const UnicodeString& description,
UErrorCode& status);
virtual ~ModulusSubstitution();
virtual void setDivisor(int32_t radix, int32_t exponent, UErrorCode& status) {
divisor = uprv_pow(radix, exponent);
@ -170,6 +177,8 @@ public:
virtual UClassID getDynamicClassID(void) const;
};
ModulusSubstitution::~ModulusSubstitution() {}
class IntegralPartSubstitution : public NFSubstitution {
public:
IntegralPartSubstitution(int32_t _pos,
@ -178,6 +187,7 @@ public:
const UnicodeString& description,
UErrorCode& status)
: NFSubstitution(_pos, _ruleSet, formatter, description, status) {}
virtual ~IntegralPartSubstitution();
virtual int64_t transformNumber(int64_t number) const { return number; }
virtual double transformNumber(double number) const { return uprv_floor(number); }
@ -190,6 +200,8 @@ public:
virtual UClassID getDynamicClassID(void) const;
};
IntegralPartSubstitution::~IntegralPartSubstitution() {}
class FractionalPartSubstitution : public NFSubstitution {
UBool byDigits;
UBool useSpaces;
@ -200,6 +212,7 @@ public:
const RuleBasedNumberFormat* formatter,
const UnicodeString& description,
UErrorCode& status);
virtual ~FractionalPartSubstitution();
virtual UBool operator==(const NFSubstitution& rhs) const;
@ -224,6 +237,8 @@ public:
virtual UClassID getDynamicClassID(void) const;
};
FractionalPartSubstitution::~FractionalPartSubstitution() {}
class AbsoluteValueSubstitution : public NFSubstitution {
public:
AbsoluteValueSubstitution(int32_t _pos,
@ -232,6 +247,7 @@ public:
const UnicodeString& description,
UErrorCode& status)
: NFSubstitution(_pos, _ruleSet, formatter, description, status) {}
virtual ~AbsoluteValueSubstitution();
virtual int64_t transformNumber(int64_t number) const { return number >= 0 ? number : -number; }
virtual double transformNumber(double number) const { return uprv_fabs(number); }
@ -244,6 +260,8 @@ public:
virtual UClassID getDynamicClassID(void) const;
};
AbsoluteValueSubstitution::~AbsoluteValueSubstitution() {}
class NumeratorSubstitution : public NFSubstitution {
double denominator;
int64_t ldenominator;
@ -267,6 +285,7 @@ public:
ldenominator = util64_fromDouble(denominator);
withZeros = description.endsWith(LTLT, 2);
}
virtual ~NumeratorSubstitution();
virtual UBool operator==(const NFSubstitution& rhs) const;
@ -293,6 +312,8 @@ public:
virtual UClassID getDynamicClassID(void) const;
};
NumeratorSubstitution::~NumeratorSubstitution() {}
class NullSubstitution : public NFSubstitution {
public:
NullSubstitution(int32_t _pos,
@ -301,6 +322,7 @@ public:
const UnicodeString& description,
UErrorCode& status)
: NFSubstitution(_pos, _ruleSet, formatter, description, status) {}
virtual ~NullSubstitution();
virtual void toString(UnicodeString& /*result*/) const {}
virtual void doSubstitution(double /*number*/, UnicodeString& /*toInsertInto*/, int32_t /*_pos*/) const {}
@ -324,6 +346,8 @@ public:
virtual UClassID getDynamicClassID(void) const;
};
NullSubstitution::~NullSubstitution() {}
NFSubstitution*
NFSubstitution::makeSubstitution(int32_t pos,
const NFRule* rule,

View file

@ -755,12 +755,16 @@ NumberFormat::getAvailableLocales(int32_t& count)
// -------------------------------------
class ICUNumberFormatFactory : public ICUResourceBundleFactory {
public:
virtual ~ICUNumberFormatFactory();
protected:
virtual UObject* handleCreate(const Locale& loc, int32_t kind, const ICUService* /* service */, UErrorCode& status) const {
return NumberFormat::makeInstance(loc, (UNumberFormatStyle)kind, status);
}
};
ICUNumberFormatFactory::~ICUNumberFormatFactory() {}
// -------------------------------------
class NFFactory : public LocaleKeyFactory {
@ -776,11 +780,7 @@ public:
{
}
virtual ~NFFactory()
{
delete _delegate;
delete _ids;
}
virtual ~NFFactory();
virtual UObject* create(const ICUServiceKey& key, const ICUService* service, UErrorCode& status) const
{
@ -824,6 +824,12 @@ protected:
}
};
NFFactory::~NFFactory()
{
delete _delegate;
delete _ids;
}
class ICUNumberFormatService : public ICULocaleService {
public:
ICUNumberFormatService()
@ -833,6 +839,8 @@ public:
registerFactory(new ICUNumberFormatFactory(), status);
}
virtual ~ICUNumberFormatService();
virtual UObject* cloneInstance(UObject* instance) const {
return ((NumberFormat*)instance)->clone();
}
@ -850,6 +858,8 @@ public:
}
};
ICUNumberFormatService::~ICUNumberFormatService() {}
// -------------------------------------
static ICULocaleService*

View file

@ -75,7 +75,7 @@ The RTTI code was also removed due to lack of code coverage.
*/
class LocalizationInfo : public UMemory {
protected:
virtual ~LocalizationInfo() {}
virtual ~LocalizationInfo();
uint32_t refcount;
public:
@ -109,6 +109,8 @@ public:
// static UClassID getStaticClassID(void);
};
LocalizationInfo::~LocalizationInfo() {}
//UOBJECT_DEFINE_ABSTRACT_RTTI_IMPLEMENTATION(LocalizationInfo)
// if both strings are NULL, this returns TRUE

View file

@ -143,6 +143,8 @@ public:
const UVector* variablesVector = 0,
const Hashtable* variableNames = 0);
virtual ~ParseData();
virtual const UnicodeString* lookup(const UnicodeString& s) const;
virtual const UnicodeFunctor* lookupMatcher(UChar32 ch) const;
@ -171,6 +173,8 @@ ParseData::ParseData(const TransliterationRuleData* d,
const Hashtable* vNames) :
data(d), variablesVector(sets), variableNames(vNames) {}
ParseData::~ParseData() {}
/**
* Implement SymbolTable API.
*/

View file

@ -931,11 +931,7 @@ public:
}
}
virtual ~TZEnumeration() {
if (localMap != NULL) {
uprv_free(localMap);
}
}
virtual ~TZEnumeration();
virtual StringEnumeration *clone() const {
return new TZEnumeration(*this);
@ -963,6 +959,12 @@ public:
virtual UClassID getDynamicClassID(void) const;
};
TZEnumeration::~TZEnumeration() {
if (localMap != NULL) {
uprv_free(localMap);
}
}
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(TZEnumeration)
StringEnumeration* U_EXPORT2

View file

@ -102,6 +102,9 @@ static void sweepCache() {
}
}
TimeZoneNameMatchInfo::~TimeZoneNameMatchInfo() {
}
class TimeZoneNamesDelegate : public TimeZoneNames {
public:
TimeZoneNamesDelegate(const Locale& locale, UErrorCode& status);
@ -261,6 +264,9 @@ TimeZoneNamesDelegate::find(const UnicodeString& text, int32_t start, uint32_t t
TimeZoneNames::~TimeZoneNames() {
}
TimeZoneNames*
TimeZoneNames::createInstance(const Locale& locale, UErrorCode& status) {
return new TimeZoneNamesDelegate(locale, status);

View file

@ -47,10 +47,6 @@ public:
virtual UnicodeString& getMetaZoneID(int32_t index, UnicodeString& mzID) const = 0;
};
inline
TimeZoneNameMatchInfo::~TimeZoneNameMatchInfo() {
}
class U_I18N_API TimeZoneNames : public UMemory {
public:
virtual ~TimeZoneNames();
@ -72,10 +68,6 @@ public:
virtual TimeZoneNameMatchInfo* find(const UnicodeString& text, int32_t start, uint32_t types, UErrorCode& status) const = 0;
};
inline
TimeZoneNames::~TimeZoneNames() {
}
U_NAMESPACE_END
#endif
#endif

View file

@ -4281,7 +4281,7 @@ public:
capacity_ = 0;
}
}
virtual ~SortKeyByteSink() { uprv_free(ownedBuffer_); }
virtual ~SortKeyByteSink();
virtual void Append(const char *bytes, int32_t n);
void Append(const uint8_t *bytes, int32_t n) { Append(reinterpret_cast<const char *>(bytes), n); }
@ -4350,6 +4350,10 @@ private:
uint8_t SortKeyByteSink::lastResortByte_ = 0;
SortKeyByteSink::~SortKeyByteSink() {
uprv_free(ownedBuffer_);
}
void
SortKeyByteSink::Append(const char *bytes, int32_t n) {
if (n <= 0) {

View file

@ -1,7 +1,7 @@
/*
******************************************************************************
* Copyright (C) 2010-2011, International Business Machines Corporation and *
* others. All Rights Reserved. *
* Copyright (C) 2010-2011, International Business Machines Corporation and
* others. All Rights Reserved.
******************************************************************************
*/
@ -174,9 +174,6 @@ private:
virtual UClassID getDynamicClassID() const;
};
inline LocaleDisplayNames::~LocaleDisplayNames() {
}
inline LocaleDisplayNames* LocaleDisplayNames::createInstance(const Locale& locale) {
return LocaleDisplayNames::createInstance(locale, ULDN_STANDARD_NAMES);
}

View file

@ -1,6 +1,6 @@
/*
**********************************************************************
* Copyright (c) 2004-2006, International Business Machines
* Copyright (c) 2004-2011, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Author: Alan Liu
@ -39,8 +39,12 @@ U_NAMESPACE_BEGIN
* @stable ICU 3.0
*/
class U_I18N_API MeasureFormat : public Format {
public:
/**
* Destructor.
* @stable ICU 3.0
*/
virtual ~MeasureFormat();
/**
* Return a formatter for CurrencyAmount objects in the given

View file

@ -705,7 +705,7 @@ group: errorcode # ErrorCode base class
errorcode.o
deps
utypes
PIC
platform
group: utypes # u_errorName()
utypes.o

View file

@ -32,8 +32,15 @@ _obj_files = {}
_symbols_to_files = {}
_return_value = 0
# Classes with vtables (and thus virtual methods).
_virtual_classes = set()
# Classes with weakly defined destructors.
# nm shows a symbol class of "W" rather than "T".
_weak_destructors = set()
def _ReadObjFile(root_path, library_name, obj_name):
global _ignored_symbols, _obj_files, _symbols_to_files
global _virtual_classes, _weak_destructors
lib_obj_name = library_name + "/" + obj_name
if lib_obj_name in _obj_files:
print "Warning: duplicate .o file " + lib_obj_name
@ -60,9 +67,15 @@ def _ReadObjFile(root_path, library_name, obj_name):
if type == "U":
obj_imports.add(name)
else:
# TODO: Investigate weak symbols (V, W) with or without values.
obj_exports.add(name)
_symbols_to_files[name] = lib_obj_name
# Is this a vtable? E.g., "vtable for icu_49::ByteSink".
if name.startswith("vtable for icu"):
_virtual_classes.add(name[name.index("::") + 2:])
# Is this a destructor? E.g., "icu_49::ByteSink::~ByteSink()".
index = name.find("::~")
if index >= 0 and type == "W":
_weak_destructors.add(name[index + 3:name.index("(", index)])
_obj_files[lib_obj_name] = {"imports": obj_imports, "exports": obj_exports}
def _ReadLibrary(root_path, library_name):
@ -126,6 +139,7 @@ def Process(root_path):
Modifies dependencies.items: Recursively builds each item's system_symbols and exports.
"""
global _ignored_symbols, _obj_files, _return_value
global _virtual_classes, _weak_destructors
dependencies.Load()
for name_and_item in dependencies.items.iteritems():
name = name_and_item[0]
@ -150,6 +164,14 @@ def Process(root_path):
if not _return_value:
for library_name in dependencies.libraries:
_Resolve(library_name, [])
if not _return_value:
virtual_classes_with_weak_destructors = _virtual_classes & _weak_destructors
if virtual_classes_with_weak_destructors:
sys.stderr.write("Error: Some classes have virtual methods, and "
"an implicit or inline destructor "
"(see ICU ticket #8454 for details):\n%s\n" %
sorted(virtual_classes_with_weak_destructors))
_return_value = 1
def main():
global _return_value

View file

@ -16,6 +16,7 @@
#include "umutex.h"
#include "threadtest.h"
AbstractThreadTest::~AbstractThreadTest() {}
//------------------------------------------------------------------------------
//

View file

@ -1,6 +1,6 @@
//
//********************************************************************
// Copyright (C) 2002, International Business Machines
// Copyright (C) 2002-2011, International Business Machines
// Corporation and others. All Rights Reserved.
//********************************************************************
//
@ -37,10 +37,9 @@
class AbstractThreadTest {
public:
AbstractThreadTest() {};
virtual ~AbstractThreadTest() {};
virtual ~AbstractThreadTest();
virtual void check() = 0;
virtual void runOnce() = 0;
};
#endif // ABSTRACTTHREADTEST_H

View file

@ -1,6 +1,6 @@
/*
**********************************************************************
* Copyright (c) 2002-2007, International Business Machines
* Copyright (c) 2002-2011, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
*/
@ -64,6 +64,11 @@ U_NAMESPACE_USE
*/
class T_CTEST_EXPORT_API UPerfFunction {
public:
/**
* destructor
*/
virtual ~UPerfFunction();
/**
* Subclasses must implement this method to do the action to be
* measured.
@ -85,11 +90,6 @@ public:
virtual long getEventsPerIteration(){
return -1;
}
/**
* destructor
*/
virtual ~UPerfFunction() {}
/**
* Call call() n times in a tight loop and return the elapsed
* milliseconds. If n is small and call() is fast the return

View file

@ -15,6 +15,9 @@
#include <stdlib.h>
#if !UCONFIG_NO_CONVERSION
UPerfFunction::~UPerfFunction() {}
static const char delim = '/';
static int32_t execCount = 0;
UPerfTest* UPerfTest::gTest = NULL;