ICU-1962 call UObject constructor at least in derived-class copy constructor to avoid compiler warnings

X-SVN-Rev: 9019
This commit is contained in:
Markus Scherer 2002-07-02 23:58:34 +00:00
parent 8d14ce3a2e
commit 156e2f983f
26 changed files with 89 additions and 55 deletions

View File

@ -47,16 +47,19 @@ U_NAMESPACE_BEGIN
const char UnicodeConverter::fgClassID=0;
UnicodeConverter::UnicodeConverter()
: UObject()
{
UErrorCode err = U_ZERO_ERROR;
myUnicodeConverter = ucnv_open(NULL, &err);
}
UnicodeConverter::UnicodeConverter(const char* name, UErrorCode& err)
: UObject()
{
myUnicodeConverter = ucnv_open(name, &err);
}
UnicodeConverter::UnicodeConverter(const UnicodeString& name, UErrorCode& err)
: UObject()
{
char myName[UCNV_MAX_CONVERTER_NAME_LENGTH];
name.extract(myName, sizeof(myName), 0, err);
@ -67,6 +70,7 @@ UnicodeConverter::UnicodeConverter(const UnicodeString& name, UErrorCode& err)
UnicodeConverter::UnicodeConverter(int32_t codepageNumber,
UConverterPlatform platform,
UErrorCode& err)
: UObject()
{
myUnicodeConverter = ucnv_openCCSID(codepageNumber,
platform,
@ -116,6 +120,7 @@ UBool UnicodeConverter::operator!=(const UnicodeConverter& that) const
}
UnicodeConverter::UnicodeConverter(const UnicodeConverter& that)
: UObject(that)
{
/*increments the referenceCounter to let the static table know
*it has one more client

View File

@ -60,6 +60,7 @@ const char DigitList::fgClassID=0;
// default constructor
DigitList::DigitList()
: UObject()
{
clear();
}
@ -74,6 +75,7 @@ DigitList::~DigitList()
// copy constructor
DigitList::DigitList(const DigitList &other)
: UObject(other)
{
fDigits = fDecimalDigits + 1; // skip the decimal
*this = other;

View File

@ -217,7 +217,7 @@ Locale::~Locale()
}
Locale::Locale()
: fullName(fullNameBuffer)
: UObject(), fullName(fullNameBuffer)
{
init(NULL);
}
@ -225,7 +225,7 @@ Locale::Locale()
Locale::Locale( const char * newLanguage,
const char * newCountry,
const char * newVariant)
: fullName(fullNameBuffer)
: UObject(), fullName(fullNameBuffer)
{
if( (newLanguage==NULL) && (newCountry == NULL) && (newVariant == NULL) )
{
@ -345,7 +345,7 @@ Locale::Locale( const char * newLanguage,
}
Locale::Locale(const Locale &other)
: fullName(fullNameBuffer)
: UObject(other), fullName(fullNameBuffer)
{
*this = other;
}

View File

@ -25,7 +25,7 @@ const char Normalizer::fgClassID=0;
//-------------------------------------------------------------------------
Normalizer::Normalizer(const UnicodeString& str, UNormalizationMode mode) :
fUMode(mode), fOptions(0),
UObject(), fUMode(mode), fOptions(0),
currentIndex(0), nextIndex(0),
buffer(), bufferPos(0)
{
@ -33,7 +33,7 @@ Normalizer::Normalizer(const UnicodeString& str, UNormalizationMode mode) :
}
Normalizer::Normalizer(const UChar *str, int32_t length, UNormalizationMode mode) :
fUMode(mode), fOptions(0),
UObject(), fUMode(mode), fOptions(0),
currentIndex(0), nextIndex(0),
buffer(), bufferPos(0)
{
@ -41,7 +41,7 @@ Normalizer::Normalizer(const UChar *str, int32_t length, UNormalizationMode mode
}
Normalizer::Normalizer(const CharacterIterator& iter, UNormalizationMode mode) :
fUMode(mode), fOptions(0),
UObject(), fUMode(mode), fOptions(0),
currentIndex(0), nextIndex(0),
buffer(), bufferPos(0)
{
@ -52,7 +52,7 @@ Normalizer::Normalizer(const CharacterIterator& iter, UNormalizationMode mode) :
Normalizer::Normalizer(const UnicodeString& str,
EMode mode) :
fUMode(getUMode(mode)), fOptions(0),
UObject(), fUMode(getUMode(mode)), fOptions(0),
currentIndex(0), nextIndex(0),
buffer(), bufferPos(0)
{
@ -62,7 +62,7 @@ Normalizer::Normalizer(const UnicodeString& str,
Normalizer::Normalizer(const UnicodeString& str,
EMode mode,
int32_t options) :
fUMode(getUMode(mode)), fOptions(options),
UObject(), fUMode(getUMode(mode)), fOptions(options),
currentIndex(0), nextIndex(0),
buffer(), bufferPos(0)
{
@ -70,7 +70,7 @@ Normalizer::Normalizer(const UnicodeString& str,
}
Normalizer::Normalizer(const UChar *str, int32_t length, EMode mode) :
fUMode(getUMode(mode)), fOptions(0),
UObject(), fUMode(getUMode(mode)), fOptions(0),
currentIndex(0), nextIndex(0),
buffer(), bufferPos(0)
{
@ -79,7 +79,7 @@ Normalizer::Normalizer(const UChar *str, int32_t length, EMode mode) :
Normalizer::Normalizer(const CharacterIterator& iter,
EMode mode) :
fUMode(getUMode(mode)), fOptions(0),
UObject(), fUMode(getUMode(mode)), fOptions(0),
currentIndex(0), nextIndex(0),
buffer(), bufferPos(0)
{
@ -89,7 +89,7 @@ Normalizer::Normalizer(const CharacterIterator& iter,
Normalizer::Normalizer(const CharacterIterator& iter,
EMode mode,
int32_t options) :
fUMode(getUMode(mode)), fOptions(options),
UObject(), fUMode(getUMode(mode)), fOptions(options),
currentIndex(0), nextIndex(0),
buffer(), bufferPos(0)
{
@ -97,7 +97,7 @@ Normalizer::Normalizer(const CharacterIterator& iter,
}
Normalizer::Normalizer(const Normalizer &copy) :
fUMode(copy.fUMode), fOptions(copy.fOptions),
UObject(copy), fUMode(copy.fUMode), fOptions(copy.fOptions),
currentIndex(copy.currentIndex), nextIndex(copy.nextIndex),
buffer(copy.buffer), bufferPos(copy.bufferPos)
{

View File

@ -42,7 +42,7 @@ int RBBINode::gLastSerial = 0;
// Constructor. Just set the fields to reasonable default values.
//
//-------------------------------------------------------------------------
RBBINode::RBBINode(NodeType t) {
RBBINode::RBBINode(NodeType t) : UObject() {
fSerialNum = ++gLastSerial;
fType = t;
fParent = NULL;
@ -67,7 +67,7 @@ RBBINode::RBBINode(NodeType t) {
};
RBBINode::RBBINode(const RBBINode &other) {
RBBINode::RBBINode(const RBBINode &other) : UObject(other) {
fSerialNum = ++gLastSerial;
fType = other.fType;
fParent = NULL;

View File

@ -172,20 +172,20 @@ const char ResourceBundle::fgClassID=0;
ResourceBundle::ResourceBundle( const UnicodeString& path,
const Locale& locale,
UErrorCode& error)
:locName(NULL)
:UObject(), locName(NULL)
{
constructForLocale(path, locale, error);
}
ResourceBundle::ResourceBundle(UErrorCode &err)
:locName(NULL)
:UObject(), locName(NULL)
{
resource = ures_open(0, Locale::getDefault().getName(), &err);
}
ResourceBundle::ResourceBundle( const UnicodeString& path,
UErrorCode& error)
:locName(NULL)
:UObject(), locName(NULL)
{
constructForLocale(path, Locale::getDefault(), error);
}
@ -193,13 +193,13 @@ ResourceBundle::ResourceBundle( const UnicodeString& path,
ResourceBundle::ResourceBundle(const wchar_t* path,
const Locale& locale,
UErrorCode& err)
:locName(NULL)
:UObject(), locName(NULL)
{
constructForLocale(path, locale, err);
}
ResourceBundle::ResourceBundle(const ResourceBundle &other)
:locName(NULL)
:UObject(other), locName(NULL)
{
UErrorCode status = U_ZERO_ERROR;
@ -212,7 +212,7 @@ ResourceBundle::ResourceBundle(const ResourceBundle &other)
}
ResourceBundle::ResourceBundle(UResourceBundle *res, UErrorCode& err)
:locName(NULL)
:UObject(), locName(NULL)
{
if (res) {
resource = ures_copyResb(0, res, &err);
@ -222,8 +222,8 @@ ResourceBundle::ResourceBundle(UResourceBundle *res, UErrorCode& err)
}
}
ResourceBundle::ResourceBundle( const char* path, const Locale& locale, UErrorCode& err)
:locName(NULL)
ResourceBundle::ResourceBundle(const char* path, const Locale& locale, UErrorCode& err)
:UObject(), locName(NULL)
{
resource = ures_open(path, locale.getName(), &err);
}

View File

@ -505,7 +505,7 @@ private:
* They are provided to make the compiler happy. Do not call.
*/
BreakIterator& operator=(const BreakIterator&) { return *this; }
BreakIterator (const BreakIterator&) {}
BreakIterator (const BreakIterator &other) : UObject(other) {}
};
inline UBool BreakIterator::isBufferClone()

View File

@ -154,8 +154,8 @@ public:
virtual UBool hasNext() = 0;
protected:
ForwardCharacterIterator() {}
ForwardCharacterIterator(const ForwardCharacterIterator&) {}
ForwardCharacterIterator() : UObject() {}
ForwardCharacterIterator(const ForwardCharacterIterator &other) : UObject(other) {}
ForwardCharacterIterator &operator=(const ForwardCharacterIterator&) { return *this; }
};

View File

@ -44,6 +44,7 @@ public:
* @stable
*/
ParsePosition()
: UObject()
{ this->index = 0; this->errorIndex = -1; }
/**
@ -52,6 +53,7 @@ public:
* @stable
*/
ParsePosition(int32_t newIndex)
: UObject()
{ this->index = newIndex; this->errorIndex = -1; }
/**
@ -60,6 +62,7 @@ public:
* @stable
*/
ParsePosition(const ParsePosition& copy)
: UObject(copy)
{ this->index = copy.index; this->errorIndex = copy.errorIndex; }
/**

View File

@ -4046,11 +4046,12 @@ private:
inline
UCharReference::UCharReference(UnicodeString *string,
int32_t pos)
: fString(string), fPos(pos)
: UObject(), fString(string), fPos(pos)
{}
inline
UCharReference::UCharReference(const UCharReference& that)
: UObject(that)
{ this->operator=(that); }
inline

View File

@ -87,7 +87,8 @@ const char Calendar::kDateTimeElements[] = "DateTimeElements";
// -------------------------------------
Calendar::Calendar(UErrorCode& success)
: fIsTimeSet(FALSE),
: UObject(),
fIsTimeSet(FALSE),
fAreFieldsSet(FALSE),
fAreAllFieldsSet(FALSE),
fNextStamp(kMinimumUserStamp),
@ -103,7 +104,8 @@ Calendar::Calendar(UErrorCode& success)
// -------------------------------------
Calendar::Calendar(TimeZone* zone, const Locale& aLocale, UErrorCode& success)
: fIsTimeSet(FALSE),
: UObject(),
fIsTimeSet(FALSE),
fAreFieldsSet(FALSE),
fAreAllFieldsSet(FALSE),
fNextStamp(kMinimumUserStamp),
@ -125,7 +127,8 @@ Calendar::Calendar(TimeZone* zone, const Locale& aLocale, UErrorCode& success)
// -------------------------------------
Calendar::Calendar(const TimeZone& zone, const Locale& aLocale, UErrorCode& success)
: fIsTimeSet(FALSE),
: UObject(),
fIsTimeSet(FALSE),
fAreFieldsSet(FALSE),
fAreAllFieldsSet(FALSE),
fNextStamp(kMinimumUserStamp),
@ -148,6 +151,7 @@ Calendar::~Calendar()
// -------------------------------------
Calendar::Calendar(const Calendar &source)
: UObject(source)
{
fZone = 0;
*this = source;

View File

@ -43,7 +43,7 @@ int32_t const CollationElementIterator::NULLORDER = 0xffffffff;
CollationElementIterator::CollationElementIterator(
const CollationElementIterator& other)
: isDataOwned_(TRUE)
: UObject(other), isDataOwned_(TRUE)
{
UErrorCode status = U_ZERO_ERROR;
m_data_ = ucol_openElements(other.m_data_->iteratordata_.coll, NULL, 0,

View File

@ -178,6 +178,7 @@ UnicodeString& Collator::getDisplayName(const Locale& objectLocale,
* is left to the child class.
*/
Collator::Collator()
: UObject()
{
}
@ -192,6 +193,7 @@ Collator::Collator()
*/
Collator::Collator(UCollationStrength /* collationStrength */,
UNormalizationMode /* decompositionMode */)
: UObject()
{
}
@ -199,7 +201,8 @@ Collator::~Collator()
{
}
Collator::Collator(const Collator& /* other */)
Collator::Collator(const Collator &other)
: UObject(other)
{
}

View File

@ -36,6 +36,7 @@ const char DecimalFormatSymbols::fgCurrencyElements[] = "CurrencyElements";
// Initializes this with the decimal format symbols in the default locale.
DecimalFormatSymbols::DecimalFormatSymbols(UErrorCode& status)
: UObject()
{
initialize(Locale::getDefault(), status, TRUE);
}
@ -44,6 +45,7 @@ DecimalFormatSymbols::DecimalFormatSymbols(UErrorCode& status)
// Initializes this with the decimal format symbols in the desired locale.
DecimalFormatSymbols::DecimalFormatSymbols(const Locale& loc, UErrorCode& status)
: UObject()
{
initialize(loc, status);
}
@ -57,7 +59,9 @@ DecimalFormatSymbols::~DecimalFormatSymbols()
// -------------------------------------
// copy constructor
DecimalFormatSymbols::DecimalFormatSymbols(const DecimalFormatSymbols &source) {
DecimalFormatSymbols::DecimalFormatSymbols(const DecimalFormatSymbols &source)
: UObject(source)
{
int i;
for(i = 0; i < (int)kFormatSymbolCount; ++i) {
fSymbols[(ENumberFormatSymbol)i] = source.fSymbols[(ENumberFormatSymbol)i];

View File

@ -60,6 +60,7 @@ const char DigitList::fgClassID=0;
// default constructor
DigitList::DigitList()
: UObject()
{
clear();
}
@ -74,6 +75,7 @@ DigitList::~DigitList()
// copy constructor
DigitList::DigitList(const DigitList &other)
: UObject(other)
{
fDigits = fDecimalDigits + 1; // skip the decimal
*this = other;

View File

@ -138,16 +138,19 @@ const char DateFormatSymbols::fgLocalPatternCharsTag[]="localPatternChars";
DateFormatSymbols::DateFormatSymbols(const Locale& locale,
UErrorCode& status)
: UObject()
{
initializeData(locale, status);
}
DateFormatSymbols::DateFormatSymbols(UErrorCode& status)
: UObject()
{
initializeData(Locale::getDefault(), status, TRUE);
}
DateFormatSymbols::DateFormatSymbols(const DateFormatSymbols& other)
: UObject(other)
{
copyData(other);
}

View File

@ -28,7 +28,7 @@ const char Formattable::fgClassID=0;
// Creates a formattable object with a long value 0.
Formattable::Formattable()
: fType(kLong)
: UObject(), fType(kLong)
{
fValue.fLong = 0;
}
@ -37,7 +37,7 @@ Formattable::Formattable()
// Creates a formattable object with a Date instance.
Formattable::Formattable(UDate date, ISDATE /*isDate*/)
: fType(kDate)
: UObject(), fType(kDate)
{
fValue.fDate = date;
}
@ -46,7 +46,7 @@ Formattable::Formattable(UDate date, ISDATE /*isDate*/)
// Creates a formattable object with a double value.
Formattable::Formattable(double value)
: fType(kDouble)
: UObject(), fType(kDouble)
{
fValue.fDouble = value;
}
@ -55,7 +55,7 @@ Formattable::Formattable(double value)
// Creates a formattable object with a long value.
Formattable::Formattable(int32_t value)
: fType(kLong)
: UObject(), fType(kLong)
{
fValue.fLong = value;
}
@ -64,7 +64,7 @@ Formattable::Formattable(int32_t value)
// Creates a formattable object with a char* string.
Formattable::Formattable(const char* stringToCopy)
: fType(kString)
: UObject(), fType(kString)
{
fValue.fString = new UnicodeString(stringToCopy);
}
@ -73,7 +73,7 @@ Formattable::Formattable(const char* stringToCopy)
// Creates a formattable object with a UnicodeString instance.
Formattable::Formattable(const UnicodeString& stringToCopy)
: fType(kString)
: UObject(), fType(kString)
{
fValue.fString = new UnicodeString(stringToCopy);
}
@ -83,7 +83,7 @@ Formattable::Formattable(const UnicodeString& stringToCopy)
// (adopting symantics)
Formattable::Formattable(UnicodeString* stringToAdopt)
: fType(kString)
: UObject(), fType(kString)
{
fValue.fString = stringToAdopt;
}
@ -91,7 +91,7 @@ Formattable::Formattable(UnicodeString* stringToAdopt)
// -------------------------------------
Formattable::Formattable(const Formattable* arrayToCopy, int32_t count)
: fType(kArray)
: UObject(), fType(kArray)
{
fValue.fArrayAndCount.fArray = createArrayCopy(arrayToCopy, count);
fValue.fArrayAndCount.fCount = count;
@ -101,7 +101,7 @@ Formattable::Formattable(const Formattable* arrayToCopy, int32_t count)
// copy constructor
Formattable::Formattable(const Formattable &source)
: fType(kLong)
: UObject(source), fType(kLong)
{
*this = source;
}

View File

@ -33,6 +33,7 @@ const char FieldPosition::fgClassID=0;
// default constructor
Format::Format()
: UObject()
{
}
@ -45,7 +46,8 @@ Format::~Format()
// -------------------------------------
// copy constructor
Format::Format(const Format& /*that*/)
Format::Format(const Format &that)
: UObject(that)
{
}

View File

@ -17,7 +17,7 @@ U_NAMESPACE_BEGIN
const char TransliterationRuleData::fgClassID=0;
TransliterationRuleData::TransliterationRuleData(UErrorCode& status)
: ruleSet(status),
: UObject(), ruleSet(status),
variableNames(0), variables(0)
{
if (U_FAILURE(status)) {
@ -37,7 +37,7 @@ TransliterationRuleData::TransliterationRuleData(UErrorCode& status)
}
TransliterationRuleData::TransliterationRuleData(const TransliterationRuleData& other) :
ruleSet(other.ruleSet),
UObject(other), ruleSet(other.ruleSet),
variablesBase(other.variablesBase),
variablesLength(other.variablesLength)
{

View File

@ -57,6 +57,7 @@ TransliterationRule::TransliterationRule(const UnicodeString& input,
UBool anchorStart, UBool anchorEnd,
const TransliterationRuleData* theData,
UErrorCode& status) :
UObject(),
segments(0),
data(theData) {
@ -154,6 +155,7 @@ TransliterationRule::TransliterationRule(const UnicodeString& input,
* Copy constructor.
*/
TransliterationRule::TransliterationRule(TransliterationRule& other) :
UObject(other),
anteContext(NULL),
key(NULL),
postContext(NULL),

View File

@ -155,7 +155,7 @@ const char TransliterationRuleSet::fgClassID=0;
/**
* Construct a new empty rule set.
*/
TransliterationRuleSet::TransliterationRuleSet(UErrorCode& status) {
TransliterationRuleSet::TransliterationRuleSet(UErrorCode& status) : UObject() {
ruleVector = new UVector(&_deleteRule, NULL, status);
rules = NULL;
maxContextLength = 0;
@ -168,6 +168,7 @@ TransliterationRuleSet::TransliterationRuleSet(UErrorCode& status) {
* Copy constructor.
*/
TransliterationRuleSet::TransliterationRuleSet(const TransliterationRuleSet& other) :
UObject(other),
ruleVector(0),
rules(0),
maxContextLength(other.maxContextLength) {

View File

@ -17,6 +17,7 @@
U_NAMESPACE_BEGIN
SearchIterator::SearchIterator(const SearchIterator &other)
: UObject(other)
{
m_breakiterator_ = other.m_breakiterator_;
m_text_ = other.m_text_;

View File

@ -42,14 +42,14 @@ U_NAMESPACE_BEGIN
const char CollationKey::fgClassID=0;
CollationKey::CollationKey()
: fBogus(FALSE), fCount(0), fCapacity(0),
: UObject(), fBogus(FALSE), fCount(0), fCapacity(0),
fHashCode(kEmptyHashCode), fBytes(NULL)
{
}
// Create a collation key from a bit array.
CollationKey::CollationKey(const uint8_t* newValues, int32_t count)
: fBogus(FALSE), fCount(count), fCapacity(count),
: UObject(), fBogus(FALSE), fCount(count), fCapacity(count),
fHashCode(kInvalidHashCode)
{
fBytes = (uint8_t *)uprv_malloc(count);
@ -64,7 +64,7 @@ CollationKey::CollationKey(const uint8_t* newValues, int32_t count)
}
CollationKey::CollationKey(const CollationKey& other)
: fBogus(FALSE), fCount(other.fCount), fCapacity(other.fCapacity),
: UObject(other), fBogus(FALSE), fCount(other.fCount), fCapacity(other.fCapacity),
fHashCode(other.fHashCode), fBytes(NULL)
{
if (other.fBogus)

View File

@ -211,13 +211,14 @@ TimeZone::getGMT(void)
// *****************************************************************************
TimeZone::TimeZone()
: UObject(), fID()
{
}
// -------------------------------------
TimeZone::TimeZone(const UnicodeString &id)
: fID(id)
: UObject(), fID(id)
{
}
@ -230,7 +231,7 @@ TimeZone::~TimeZone()
// -------------------------------------
TimeZone::TimeZone(const TimeZone &source)
: fID(source.fID)
: UObject(source), fID(source.fID)
{
}

View File

@ -117,7 +117,7 @@ inline UBool positionIsValid(UTransPosition& index, int32_t len) {
*/
Transliterator::Transliterator(const UnicodeString& theID,
UnicodeFilter* adoptedFilter) :
ID(theID), filter(adoptedFilter),
UObject(), ID(theID), filter(adoptedFilter),
maximumContextLength(0) {}
/**
@ -131,7 +131,7 @@ Transliterator::~Transliterator() {
* Copy constructor.
*/
Transliterator::Transliterator(const Transliterator& other) :
ID(other.ID), filter(0),
UObject(other), ID(other.ID), filter(0),
maximumContextLength(other.maximumContextLength) {
if (other.filter != 0) {
// We own the filter, so we must have our own copy

View File

@ -105,7 +105,7 @@ public:
* @stable
*/
FieldPosition()
: fField(DONT_CARE), fBeginIndex(0), fEndIndex(0) {}
: UObject(), fField(DONT_CARE), fBeginIndex(0), fEndIndex(0) {}
/**
* Creates a FieldPosition object for the given field. Fields are
@ -119,7 +119,7 @@ public:
* @stable
*/
FieldPosition(int32_t field)
: fField(field), fBeginIndex(0), fEndIndex(0) {}
: UObject(), fField(field), fBeginIndex(0), fEndIndex(0) {}
/**
* Copy constructor
@ -127,7 +127,7 @@ public:
* @stable
*/
FieldPosition(const FieldPosition& copy)
: fField(copy.fField), fBeginIndex(copy.fBeginIndex), fEndIndex(copy.fEndIndex) {}
: UObject(copy), fField(copy.fField), fBeginIndex(copy.fBeginIndex), fEndIndex(copy.fEndIndex) {}
/**
* Destructor