Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

uobject.h

Go to the documentation of this file.
00001 /*
00002 ******************************************************************************
00003 *
00004 *   Copyright (C) 2002, International Business Machines
00005 *   Corporation and others.  All Rights Reserved.
00006 *
00007 ******************************************************************************
00008 *   file name:  uobject.h
00009 *   encoding:   US-ASCII
00010 *   tab size:   8 (not used)
00011 *   indentation:4
00012 *
00013 *   created on: 2002jun26
00014 *   created by: Markus W. Scherer
00015 */
00016 
00017 #ifndef __UOBJECT_H__
00018 #define __UOBJECT_H__
00019 
00020 #include "unicode/utypes.h"
00021 
00022 U_NAMESPACE_BEGIN
00023 
00039 #ifndef U_OVERRIDE_CXX_ALLOCATION
00040 #define U_OVERRIDE_CXX_ALLOCATION 1
00041 #endif
00042 
00058 class U_COMMON_API UMemory {
00059 public:
00060 
00061 #if U_OVERRIDE_CXX_ALLOCATION
00062 
00070     void *operator new(size_t size);
00071 
00077     void *operator new[](size_t size);
00078 
00087     void operator delete(void *p);
00088 
00094     void operator delete[](void *p);
00095 #endif
00096 };
00097 
00111 class U_COMMON_API UObject : public UMemory {
00112 public:
00118     virtual inline ~UObject() {}
00119 
00125     virtual inline UClassID getDynamicClassID() const = 0;
00126 
00127 protected:
00128     // the following functions are protected to prevent instantiation and
00129     // direct use of UObject itself
00130 
00131     // default constructor
00132     // commented out because UObject is abstract (see getDynamicClassID)
00133     // inline UObject() {}
00134 
00135     // copy constructor
00136     // commented out because UObject is abstract (see getDynamicClassID)
00137     // inline UObject(const UObject &other) {}
00138 
00139 #if U_ICU_VERSION_MAJOR_NUM>2 || (U_ICU_VERSION_MAJOR_NUM==2 && U_ICU_VERSION_MINOR_NUM>4)
00140     // TODO post ICU 2.4  (This comment inserted in 2.2)
00141     // some or all of the following "boilerplate" functions may be made public
00142     // in a future ICU4C release when all subclasses implement them
00143 
00144     // assignment operator
00145     // (not virtual, see "Taligent's Guide to Designing Programs" pp.73..74)
00146     // commented out because the implementation is the same as a compiler's default
00147     // UObject &operator=(const UObject &other) { return *this; }
00148 
00149     // comparison operators
00150     virtual inline UBool operator==(const UObject &other) const { return this==&other; }
00151     inline UBool operator!=(const UObject &other) const { return !operator==(other); }
00152 
00153     // clone() commented out from the base class:
00154     // some compilers do not support co-variant return types
00155     // (i.e., subclasses would have to return UObject * as well, instead of SubClass *)
00156     // virtual UObject *clone() const;
00157 #endif
00158 };
00159 
00160 U_NAMESPACE_END
00161 
00162 #endif

Generated on Wed Dec 18 16:50:03 2002 for ICU 2.4 by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001