9 #ifndef KTEXTENSIBLESTRUCT_HH_ 10 #define KTEXTENSIBLESTRUCT_HH_ 21 template<
class XBaseType >
33 virtual void Clear(
void);
35 template<
class XStructType >
inline XStructType&
Of(
void);
37 template<
class XStructType >
inline const XStructType&
Of(
void)
const;
39 template<
class XStructType >
inline bool Has(
void)
const;
41 template<
class XStructType >
inline XStructType*
Detatch(
void);
62 template<
class XInstanceType,
class XBaseType >
77 void SetIsCopyDisabled(
bool flag);
84 template<
class XBaseType>
91 template<
class XBaseType>
98 template<
class XBaseType>
105 template<
class XBaseType>
112 template<
class XBaseType>
119 template<
class XBaseType>
120 template<
class XStructType>
123 XStructType* target =
dynamic_cast<XStructType*
>(
this);
131 fNext =
new XStructType();
135 return fNext->
Of<XStructType>();
138 template<
class XBaseType>
139 template<
class XStructType>
142 const XStructType* target =
dynamic_cast<const XStructType*
>(
this);
150 fNext =
new XStructType();
154 return fNext->
Of<XStructType>();
159 template<
class XBaseType>
160 template<
class XStructType>
163 if (dynamic_cast<const XStructType*>(
this))
177 template<
class XBaseType>
178 template<
class XStructType>
185 XStructType* next =
dynamic_cast<XStructType*
>(
fNext);
201 template<
class XBaseType>
207 template<
class XBaseType>
213 template<
class XBaseType>
216 if (
fNext == 0)
return this;
220 template<
class XBaseType>
223 if (
fPrev == 0)
return this;
227 template<
class XBaseType>
236 template<
class XInstanceType,
class XBaseType>
239 fIsCopyDisabled =
false;
242 template<
class XInstanceType,
class XBaseType>
245 fIsCopyDisabled =
false;
248 template<
class XInstanceType,
class XBaseType>
253 fIsCopyDisabled =
false;
261 template<
class XInstanceType,
class XBaseType>
265 if ((&
object ==
this) || fIsCopyDisabled)
283 template<
class XInstanceType,
class XBaseType>
288 XInstanceType* instance =
new XInstanceType(dynamic_cast<const XInstanceType&>(*
this));
298 template<
class XInstanceType,
class XBaseType>
306 fIsCopyDisabled =
true;
307 XInstanceType* instance =
dynamic_cast<XInstanceType*
>(
this);
308 if (
object.
template Has<XInstanceType>())
310 instance->operator=(
object.template Of<XInstanceType>());
314 instance->operator=(XInstanceType());
316 fIsCopyDisabled =
false;
324 template<
class XInstanceType,
class XBaseType>
327 fIsCopyDisabled = flag;
virtual KTExtensibleStructCore< XBaseType > * Clone(void) const
Duplicates the extended object.
bool Has(void) const
Returns true if XStructType is or is below this object.
virtual void Pull(const KTExtensibleStructCore< XBaseType > &object)
Duplicates object only.
KTExtensibleStruct(void)
Default constructor.
virtual void Pull(const KTExtensibleStructCore< XBaseType > &object)=0
Duplicates object only.
KTExtensibleStructCore * Next() const
Returns the pointer to the next field.
XStructType & Of(void)
Returns a reference to the object of type XStructType; creates that object if it doesn't exist...
virtual void Clear(void)
Removes extended fields.
void SetIsCopyDisabled(bool flag)
KTExtensibleStructCore * Prev() const
Returns the pointer to the previous field.
virtual ~KTExtensibleStruct()
KTExtensibleStruct & operator=(const KTExtensibleStruct &object)
Duplicates the extended object.
virtual KTExtensibleStructCore * Clone(void) const =0
Duplicates the extended object.
KTExtensibleStructCore & operator=(const KTExtensibleStructCore &)
Duplicates the extended object.
KTExtensibleStructCore * fPrev
virtual ~KTExtensibleStructCore()
KTExtensibleStructCore * Last() const
Returns the pointer to the last field.
KTExtensibleStructCore * fNext
KTExtensibleStructCore * First() const
Returns the pointer to the first field.
XStructType * Detatch(void)
Extracts object of type XStructType.
KTExtensibleStructCore(void)
Default constructor.