2 @Copyright Looking Glass Studios, Inc.
3 1996,1997,1998,1999,2000 Unpublished Work.
6 // $Header: r:/t2repos/thief2/src/object/propimp.cpp,v 1.14 1997/10/14 23:05:03 mahk Exp $
20 // Must be last header
23 uint
cPropValueFuncs::Version(void)
28 ////////////////////////////////////////////////////////////
30 // cDefaultPropValueFuncs
32 ////////////////////////////////////////////////////////////
34 cDefaultPropValueFuncs::~cDefaultPropValueFuncs()
38 uint
cDefaultPropValueFuncs::Version(void)
43 void cDefaultPropValueFuncs::Init(ObjID
, void* )
47 void cDefaultPropValueFuncs::New(ObjID obj
, void* value
, void *sug
)
52 memset(value
,0,size_
);
55 void cDefaultPropValueFuncs::Term(ObjID
, void*)
59 void cDefaultPropValueFuncs::Copy(ObjID
, void* t
, void* s
)
64 void cDefaultPropValueFuncs::Read (ObjID obj
, void* value
, uint version
, PropReadFunc read
, PropFile
* file
)
66 // in default, version == size
70 read(file
,value
,version
);
73 read(file
,value
,size_
);
76 void cDefaultPropValueFuncs::Write(ObjID
, void* value
, PropWriteFunc write
, PropFile
* file
)
78 write(file
,value
,size_
);
81 ////////////////////////////////////////////////////////////
85 ////////////////////////////////////////////////////////////
88 cPropertyImpl::cPropertyImpl(int size
, cPropValueFuncs
* f
)
89 : elem_size_(size
),vfunc_(f
), sponsored_(TRUE
)
92 vfunc_
= new cDefaultPropValueFuncs(size
);
95 ////////////////////////////////////////
97 cPropertyImpl::~cPropertyImpl()
103 ////////////////////////////////////////
105 void cPropertyImpl::SetValueFuncs(cPropValueFuncs
* f
)
117 ////////////////////////////////////////////////////////////
119 // CreatePropertyImpl
121 // Creates an impl based on the ePropertyImpl value.
124 cPropertyImpl
*CreatePropertyImpl (ePropertyImpl impl
, int size
, cPropValueFuncs
* f
)
126 sPropertyDatabases
* db
= sPropertyDatabases::DB
;
127 cPropertyImpl
*pimpl
;
131 case kPropertyImplLlist
:
132 pimpl
= new cPropertyImplLlist(size
);
135 case kPropertyImplHash
:
136 pimpl
= CreateUniHashImpl(size
);
139 case kPropertyImplSparseHash
:
140 pimpl
= CreateMultiHashImpl(size
,db
->PropHash
);
143 case kPropertyImplBigArray
:
144 pimpl
= CreateArrayImpl(size
);
147 case kPropertyImplBoolean
:
148 pimpl
= new cPImpBitVec(size
);
152 // Add more implementation types here
154 default: Warning (("CreateProperty: Bad impl %d\n", impl
)); return NULL
;
158 pimpl
->SetValueFuncs(f
);
168 typedefs:("BOOL" "GUID" "IComplexProperty" "IID" "INTERFACE" "IProperty" "ISimpleProperty" "LlistHeader" "ObjID" "PropertyID" "REFIID" "TYPE" "cComplexProperty" "cMetaPropertyImpl" "cMetaPropertyIterator" "cProperty" "cPropertyImpl" "cPropertyManager" "cSimpleProperty" "ePropertyImpl")