ICU-2244 change internal classes to inherit UMemory, not UObject

X-SVN-Rev: 9960
This commit is contained in:
Markus Scherer 2002-10-04 01:23:34 +00:00
parent 409a9247ba
commit 87ab6dcc57
17 changed files with 32 additions and 249 deletions

View file

@ -18,8 +18,6 @@
U_NAMESPACE_BEGIN
const char BreakDictionary::fgClassID=0;
//=================================================================================
// deserialization
//=================================================================================

View file

@ -29,7 +29,7 @@ U_NAMESPACE_BEGIN
* transitions. Indexes are used to compress this array, taking
* advantage of the fact that this array will always be very sparse.
*/
class BreakDictionary : public UObject {
class BreakDictionary : public UMemory {
//=================================================================================
// data members
//=================================================================================
@ -146,20 +146,6 @@ public:
*/
int16_t at(int32_t row, int32_t col) const;
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
*
* @draft ICU 2.2
*/
virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); }
/**
* ICU "poor man's RTTI", returns a UClassID for this class.
*
* @draft ICU 2.2
*/
static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; }
private:
/**
* Given (logical) row and column numbers, returns true if the
@ -182,12 +168,6 @@ private:
// (if you don't declare them, you get default implementations)
BreakDictionary(const BreakDictionary& that);
BreakDictionary& operator=(const BreakDictionary& that);
/**
* The address of this static class variable serves as this class's ID
* for ICU "poor man's RTTI".
*/
static const char fgClassID;
};
U_NAMESPACE_END

View file

@ -19,8 +19,6 @@
U_NAMESPACE_BEGIN
const char DictionaryBasedBreakIteratorTables::fgClassID=0;
//=======================================================================
// constructor
//=======================================================================

View file

@ -34,7 +34,7 @@ class DictionaryBasedBreakIterator;
// BreakDictionary and get rid of this class, but doing it this way
// was a convenient transition from earlier code, and time is short...
//
class DictionaryBasedBreakIteratorTables : public UObject {
class DictionaryBasedBreakIteratorTables : public UMemory {
private:
int32_t fRefCount;
@ -60,20 +60,6 @@ public:
*/
virtual ~DictionaryBasedBreakIteratorTables();
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
*
* @draft ICU 2.2
*/
virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); }
/**
* ICU "poor man's RTTI", returns a UClassID for this class.
*
* @draft ICU 2.2
*/
static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; }
private:
/**
* The copy constructor is declared private and not implemented.
@ -97,12 +83,6 @@ private:
*/
DictionaryBasedBreakIteratorTables& operator=(
const DictionaryBasedBreakIteratorTables& that);
/**
* The address of this static class variable serves as this class's ID
* for ICU "poor man's RTTI".
*/
static const char fgClassID;
};
U_NAMESPACE_END

View file

@ -23,8 +23,6 @@
U_NAMESPACE_BEGIN
const char RBBIDataWrapper::fgClassID=0;
//-----------------------------------------------------------------------------
//
// Constructors.

View file

@ -97,11 +97,10 @@ struct RBBIStateTable {
//
// The reference counting wrapper class
//
class RBBIDataWrapper : public UObject {
class RBBIDataWrapper : public UMemory {
public:
RBBIDataWrapper(const RBBIDataHeader *data, UErrorCode &status);
RBBIDataWrapper(UDataMemory* udm, UErrorCode &status);
RBBIDataWrapper(const RBBIDataWrapper &other);
~RBBIDataWrapper();
void init(const RBBIDataHeader *data, UErrorCode &status);
@ -122,30 +121,13 @@ public:
UTrie fTrie;
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
*
* @draft ICU 2.2
*/
virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); }
/**
* ICU "poor man's RTTI", returns a UClassID for this class.
*
* @draft ICU 2.2
*/
static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; }
private:
int32_t fRefCount;
UDataMemory *fUDataMem;
UnicodeString fRuleString;
/**
* The address of this static class variable serves as this class's ID
* for ICU "poor man's RTTI".
*/
static const char fgClassID;
RBBIDataWrapper(const RBBIDataWrapper &other); // forbid copying of this class
RBBIDataWrapper &operator=(const RBBIDataWrapper &other); // forbid copying of this class
};
U_NAMESPACE_END

View file

@ -33,8 +33,6 @@
U_NAMESPACE_BEGIN
const char RBBINode::fgClassID=0;
int RBBINode::gLastSerial = 0;
@ -44,7 +42,7 @@ int RBBINode::gLastSerial = 0;
// Constructor. Just set the fields to reasonable default values.
//
//-------------------------------------------------------------------------
RBBINode::RBBINode(NodeType t) : UObject() {
RBBINode::RBBINode(NodeType t) : UMemory() {
fSerialNum = ++gLastSerial;
fType = t;
fParent = NULL;
@ -70,7 +68,7 @@ RBBINode::RBBINode(NodeType t) : UObject() {
};
RBBINode::RBBINode(const RBBINode &other) : UObject(other) {
RBBINode::RBBINode(const RBBINode &other) : UMemory(other) {
fSerialNum = ++gLastSerial;
fType = other.fType;
fParent = NULL;

View file

@ -16,7 +16,7 @@ U_NAMESPACE_BEGIN
class UnicodeSet;
class UVector;
class RBBINode : public UObject {
class RBBINode : public UMemory {
public:
enum NodeType {
setRef,
@ -91,32 +91,12 @@ class RBBINode : public UObject {
void printTree(UBool withHeading=TRUE, UBool doVars=FALSE);
static void printUnicodeString(const UnicodeString &s, int minWidth=0);
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
*
* @draft ICU 2.2
*/
virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); }
/**
* ICU "poor man's RTTI", returns a UClassID for this class.
*
* @draft ICU 2.2
*/
static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; }
private:
void operator = (const RBBINode &other); // No defs.
RBBINode &operator = (const RBBINode &other); // No defs.
UBool operator == (const RBBINode &other); // Private, so these functions won't accidently be used.
int fSerialNum; // Debugging aids.
static int gLastSerial;
/**
* The address of this static class variable serves as this class's ID
* for ICU "poor man's RTTI".
*/
static const char fgClassID;
};
U_NAMESPACE_END

View file

@ -36,8 +36,6 @@
U_NAMESPACE_BEGIN
const char RBBIRuleBuilder::fgClassID=0;
//----------------------------------------------------------------------------------------
//

View file

@ -39,32 +39,16 @@ class RBBITableBuilder;
// UnicodeSet parser to resolve references to $variables.
//
//--------------------------------------------------------------------------------
class RBBISymbolTableEntry : public UObject { // The symbol table hash table contains one
class RBBISymbolTableEntry : public UMemory { // The symbol table hash table contains one
public: // of these structs for each entry.
RBBISymbolTableEntry();
UnicodeString key;
RBBINode *val;
~RBBISymbolTableEntry();
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
*
* @draft ICU 2.2
*/
virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); }
/**
* ICU "poor man's RTTI", returns a UClassID for this class.
*
* @draft ICU 2.2
*/
static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; }
private:
/**
* The address of this static class variable serves as this class's ID
* for ICU "poor man's RTTI".
*/
static const char fgClassID;
RBBISymbolTableEntry(const RBBISymbolTableEntry &other); // forbid copying of this class
RBBISymbolTableEntry &operator=(const RBBISymbolTableEntry &other); // forbid copying of this class
};
@ -125,7 +109,7 @@ private:
// class RBBIRuleBuilder The top-level class handling RBBI rule compiling.
//
//--------------------------------------------------------------------------------
class RBBIRuleBuilder : public UObject {
class RBBIRuleBuilder : public UMemory {
public:
// Create a rule based break iterator from a set of rules.
@ -136,20 +120,6 @@ public:
UParseError &parseError,
UErrorCode &status);
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
*
* @draft ICU 2.2
*/
virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); }
/**
* ICU "poor man's RTTI", returns a UClassID for this class.
*
* @draft ICU 2.2
*/
static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; }
public:
// The "public" functions and data members that appear below are accessed
// (and shared) by the various parts that make up the rule builder. They
@ -179,11 +149,8 @@ public:
RBBIDataHeader *flattenData(); // Create the flattened (runtime format)
// data tables..
private:
/**
* The address of this static class variable serves as this class's ID
* for ICU "poor man's RTTI".
*/
static const char fgClassID;
RBBIRuleBuilder(const RBBIRuleBuilder &other); // forbid copying of this class
RBBIRuleBuilder &operator=(const RBBIRuleBuilder &other); // forbid copying of this class
};

View file

@ -38,8 +38,6 @@
U_NAMESPACE_BEGIN
const char RBBIRuleScanner::fgClassID=0;
//----------------------------------------------------------------------------------------
//
// Unicode Set init strings for each of the character classes needed for parsing a rule file.

View file

@ -50,7 +50,7 @@ enum EParseAction {dummy01, dummy02}; // Placeholder enum for the
// actions that are specified in the
// rule parsing state table.
class RBBIRuleScanner : public UObject {
class RBBIRuleScanner : public UMemory {
public:
struct RBBIRuleChar {
@ -73,20 +73,6 @@ public:
// trees, one each for the forward and
// reverse rules,
// and a list of UnicodeSets encountered.
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
*
* @draft ICU 2.2
*/
virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); }
/**
* ICU "poor man's RTTI", returns a UClassID for this class.
*
* @draft ICU 2.2
*/
static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; }
private:
UBool doParseActions(EParseAction a);
@ -158,11 +144,8 @@ private:
UnicodeSet *gRuleSet_name_char;
UnicodeSet *gRuleSet_name_start_char;
/**
* The address of this static class variable serves as this class's ID
* for ICU "poor man's RTTI".
*/
static const char fgClassID;
RBBIRuleScanner(const RBBIRuleScanner &other); // forbid copying of this class
RBBIRuleScanner &operator=(const RBBIRuleScanner &other); // forbid copying of this class
};
U_NAMESPACE_END

View file

@ -45,8 +45,6 @@
U_NAMESPACE_BEGIN
const char RBBISetBuilder::fgClassID=0;
//------------------------------------------------------------------------
//
// Constructor
@ -465,8 +463,6 @@ void RBBISetBuilder::printSets() {
//
//-------------------------------------------------------------------------------------
const char RangeDescriptor::fgClassID=0;
RangeDescriptor::RangeDescriptor(const RangeDescriptor &other, UErrorCode &status) {
int i;

View file

@ -35,7 +35,7 @@ U_NAMESPACE_BEGIN
// All of them are strung together in a linked list, which is kept in order
// (by character)
//
class RangeDescriptor : public UObject {
class RangeDescriptor : public UMemory {
public:
UChar32 fStartChar; // Start of range, unicode 32 bit value.
UChar32 fEndChar; // End of range, unicode 32 bit value.
@ -53,26 +53,9 @@ public:
void setDictionaryFlag(); // Check whether this range appears as part of
// the Unicode set named "dictionary"
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
*
* @draft ICU 2.2
*/
virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); }
/**
* ICU "poor man's RTTI", returns a UClassID for this class.
*
* @draft ICU 2.2
*/
static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; }
private:
/**
* The address of this static class variable serves as this class's ID
* for ICU "poor man's RTTI".
*/
static const char fgClassID;
RangeDescriptor(const RangeDescriptor &other); // forbid copying of this class
RangeDescriptor &operator=(const RangeDescriptor &other); // forbid copying of this class
};
@ -91,7 +74,7 @@ private:
//
class RBBISetBuilder : public UObject {
class RBBISetBuilder : public UMemory {
public:
RBBISetBuilder(RBBIRuleBuilder *rb);
~RBBISetBuilder();
@ -107,20 +90,6 @@ public:
void printRanges();
void printRangeGroups();
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
*
* @draft ICU 2.2
*/
virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); }
/**
* ICU "poor man's RTTI", returns a UClassID for this class.
*
* @draft ICU 2.2
*/
static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; }
private:
void numberSets();
@ -139,11 +108,8 @@ private:
// Index 0 is not used. Funny counting.
int32_t fGroupCount;
/**
* The address of this static class variable serves as this class's ID
* for ICU "poor man's RTTI".
*/
static const char fgClassID;
RBBISetBuilder(const RBBISetBuilder &other); // forbid copying of this class
RBBISetBuilder &operator=(const RBBISetBuilder &other); // forbid copying of this class
};

View file

@ -208,7 +208,7 @@ void RBBISymbolTable::addEntry (const UnicodeString &key, RBBINode *
};
const char RBBISymbolTableEntry::fgClassID=0;
RBBISymbolTableEntry::RBBISymbolTableEntry() : UMemory(), key(), val(NULL) {}
RBBISymbolTableEntry::~RBBISymbolTableEntry() {
// The "val" of a symbol table entry is a variable reference node.

View file

@ -23,8 +23,6 @@
U_NAMESPACE_BEGIN
const char RBBITableBuilder::fgClassID=0;
RBBITableBuilder::RBBITableBuilder(RBBIRuleBuilder *rb, RBBINode **rootNode) :
fTree(*rootNode) {
fRB = rb;
@ -720,8 +718,6 @@ void RBBITableBuilder::printStates() {
//
//-----------------------------------------------------------------------------
const char RBBIStateDescriptor::fgClassID=0;
RBBIStateDescriptor::RBBIStateDescriptor(int lastInputSymbol, UErrorCode *fStatus) {
fMarked = FALSE;
fAccepting = 0;

View file

@ -32,7 +32,7 @@ class RBBIRuleBuilder;
// There is no user-visible public API here.
//
class RBBITableBuilder : public UObject {
class RBBITableBuilder : public UMemory {
public:
RBBITableBuilder(RBBIRuleBuilder *rb, RBBINode **rootNode);
~RBBITableBuilder();
@ -44,20 +44,6 @@ public:
// Sufficient memory must exist at
// the specified location.
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
*
* @draft ICU 2.2
*/
virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); }
/**
* ICU "poor man's RTTI", returns a UClassID for this class.
*
* @draft ICU 2.2
*/
static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; }
private:
void calcNullable(RBBINode *n);
void calcFirstPos(RBBINode *n);
@ -89,17 +75,14 @@ private:
// Index is state number
// Contents are RBBIStateDescriptor pointers.
/**
* The address of this static class variable serves as this class's ID
* for ICU "poor man's RTTI".
*/
static const char fgClassID;
RBBITableBuilder(const RBBITableBuilder &other); // forbid copying of this class
RBBITableBuilder &operator=(const RBBITableBuilder &other); // forbid copying of this class
};
//
// RBBIStateDescriptor - The DFA is constructed as a set of these descriptors,
// one for each state.
class RBBIStateDescriptor : public UObject {
class RBBIStateDescriptor : public UMemory {
public:
UBool fMarked;
int32_t fAccepting;
@ -117,27 +100,9 @@ public:
RBBIStateDescriptor(int maxInputSymbol, UErrorCode *fStatus);
~RBBIStateDescriptor();
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
*
* @draft ICU 2.2
*/
virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); }
/**
* ICU "poor man's RTTI", returns a UClassID for this class.
*
* @draft ICU 2.2
*/
static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; }
private:
/**
* The address of this static class variable serves as this class's ID
* for ICU "poor man's RTTI".
*/
static const char fgClassID;
RBBIStateDescriptor(const RBBIStateDescriptor &other); // forbid copying of this class
RBBIStateDescriptor &operator=(const RBBIStateDescriptor &other); // forbid copying of this class
};