6#if !defined(AFX_CUSTOMDATA_H__5D9D5366_1E68_11D3_A381_EA02A046C52E__INCLUDED_)
7#define AFX_CUSTOMDATA_H__5D9D5366_1E68_11D3_A381_EA02A046C52E__INCLUDED_
13#include "XThreadSync.h"
15BEGIN_MOOTOOLS_NAMESPACE
21typedef struct CustomPrivateDataInfo
26} CustomPrivateDataInfo;
30 CustomPrivateDataInfo info;
31 unsigned int beginOfData;
34#define CUSTOMDATA_NODATA 0
35#define CUSTOMDATA_UNDEFINED MAKE_CUSTOM_ID(' ', ' ', ' ', ' ')
36#define CUSTOMDATA_ANSI_TEXT MAKE_CUSTOM_ID('A', 'N', 'S', 'I')
37#define CUSTOMDATA_UTF8_TEXT MAKE_CUSTOM_ID('U', 'T', 'F', '8')
38#define CUSTOMDATA_UNICODE_TEXT MAKE_CUSTOM_ID('U', 'N', 'I', 'C')
39#define CUSTOMDATA_BOOL MAKE_CUSTOM_ID('B', 'O', 'O', 'L')
40#define CUSTOMDATA_CHAR MAKE_CUSTOM_ID('C', 'H', 'A', 'R')
41#define CUSTOMDATA_UCHAR MAKE_CUSTOM_ID('U', 'C', 'H', 'R')
42#define CUSTOMDATA_FLOAT MAKE_CUSTOM_ID('F', 'L', 'O', 'A')
43#define CUSTOMDATA_DOUBLE MAKE_CUSTOM_ID('D', 'O', 'U', 'B')
44#define CUSTOMDATA_BIN MAKE_CUSTOM_ID(' ', 'B', 'I', 'N')
45#define CUSTOMDATA_OLDCUSTDATA MAKE_CUSTOM_ID('C', 'D', 'A', 'T')
46#define CUSTOMDATA_CUSTDATA MAKE_CUSTOM_ID('C', 'D', 'A', '2')
47#define CUSTOMDATA_UINT MAKE_CUSTOM_ID('U', 'I', 'N', 'T')
48#define CUSTOMDATA_INT MAKE_CUSTOM_ID(' ', 'I', 'N', 'T')
49#define CUSTOMDATA_LONG MAKE_CUSTOM_ID('L', 'O', 'N', 'G')
50#define CUSTOMDATA_ULONG MAKE_CUSTOM_ID('U', 'L', 'O', 'N')
51#define CUSTOMDATA_LONGINT MAKE_CUSTOM_ID('L', 'L', 'O', 'N')
52#define CUSTOMDATA_ULONGINT MAKE_CUSTOM_ID('U', 'L', 'L', 'O')
53#define CUSTOMDATA_ANSI_STRINGS MAKE_CUSTOM_ID('A', 'S', 'T', 'R')
54#define CUSTOMDATA_UTF8_STRINGS MAKE_CUSTOM_ID('U', '8', 'T', 'R')
55#define CUSTOMDATA_UNICODE_STRINGS MAKE_CUSTOM_ID('U', 'S', 'T', 'R')
56#define CUSTOMDATA_PTR MAKE_CUSTOM_ID('P', 'T', 'R', ' ')
57#define CUSTOMDATA_PTR64 MAKE_CUSTOM_ID('P', 'T', 'R', '6')
58#define CUSTOMDATA_ARRAY MAKE_CUSTOM_ID('A', 'R', 'R', 'A')
59#define CUSTOMDATA_UTCTIME MAKE_CUSTOM_ID('T', 'I', 'M', 'E')
60#define CUSTOMDATA_XTIME MAKE_CUSTOM_ID('T', 'I', 'M', 'X')
63#define PREFERENCE_DATA_ID MAKE_CUSTOM_ID('S', 'E', '6', '4')
65#define PREFERENCE_DATA_ID MAKE_CUSTOM_ID('S', 'E', 'T', 'T')
86 virtual void InitData() = 0;
121 void UpdateOffsetMap(
unsigned int defaultSize = 0);
126 STRING_DEFAULT = 0x00,
127 STRING_UNICODE = 0x01,
133 unsigned int cursize, totalsize;
136#ifndef MOOTOOLS_NO_ARCHIVE_SUPPORT
141 bool ReplaceCustom(
unsigned int id,
const void *ptr,
unsigned int size,
unsigned int kindof);
142 void SetCustom(
unsigned int id,
const void *ptr,
unsigned int size,
unsigned int kindof);
143 unsigned int GetCustom(
unsigned int id,
void *ptr,
unsigned int size,
unsigned int kindof)
const;
145 void SetStrings(
unsigned int id,
const void *
strings,
bool array);
146 int GetStrings(
unsigned int id,
void *
strings,
bool array)
const;
156 void SetBinary(
unsigned int id,
const void *ptr,
unsigned int size);
157 void SetCustomData(
unsigned int id,
const CCustomData& data);
159 void SetFloat(
unsigned int id,
float value);
160 void SetDouble(
unsigned int id,
double value);
161 void SetChar(
unsigned int id,
char value);
162 void SetUChar(
unsigned int id,
unsigned char value);
163 void SetBool(
unsigned int id,
BOOL value);
164 void SetPtr(
unsigned int id,
const void *ptr);
165 void SetInt(
unsigned int id,
int value);
166 void SetUInt(
unsigned int id,
unsigned int value);
167 void SetLong(
unsigned int id,
long value);
168 void SetULong(
unsigned int id,
unsigned long value);
169 void SetSizet(
unsigned int id,
SIZET value);
170 void SetLongInt(
unsigned int id,
longint value);
171 void SetULongInt(
unsigned int id,
longuint value);
172 bool SetArray(
unsigned int id,
const void *ptr,
unsigned int elementCount,
unsigned int sizeOfElement);
173 void SetString(
unsigned int id,
const CXString&
string);
174 void SetStringA(
unsigned int id,
const CXStringA&
string);
175 void SetStringW(
unsigned int id,
const CXStringW&
string);
176#ifdef MOOTOOLS_MFC_PRODUCT_BUILD
180 void SetUTCTime(
unsigned int id,
const CXTime& time);
181 void SetXTime(
unsigned int id,
const CXTime& time);
185 bool HasData()
const;
186 bool HasData(
unsigned int id)
const;
187 unsigned int GetDataKindOf(
unsigned int id)
const;
188 bool ChangeID(
unsigned int srcid,
unsigned int newid);
191 static void *Alloc(
unsigned int size);
192 static void Free(
void *data);
195 void *Detach(
unsigned int& size);
196 void Attach(
void *data,
unsigned int size);
197 const void *GetData(
unsigned int& totalsize)
const;
198 void SetData(
const void *data,
unsigned int totalsize);
200 unsigned int GetDataSize(
unsigned int id)
const;
201 const void *GetCustomPtr(
unsigned int id,
unsigned int& size)
const;
202 unsigned int GetChecksum(
unsigned int id)
const;
204 bool GetBinary(
unsigned int id,
void *ptr,
unsigned int size)
const;
205 bool GetCustomData(
unsigned int id,
CCustomData& data)
const;
207 bool GetFloat(
unsigned int id,
float& value,
float defaultvalue)
const;
208 bool GetDouble(
unsigned int id,
double& value,
double defaultvalue)
const;
209 bool GetBool(
unsigned int id,
bool& value,
bool defaultvalue)
const;
211 bool GetChar(
unsigned int id,
char& value,
char defaultvalue)
const;
212 bool GetUChar(
unsigned int id,
unsigned char& value,
unsigned char defaultvalue)
const;
213 bool GetPtr(
unsigned int id,
void *&value)
const;
214 void *GetPtr(
unsigned int id)
const;
215 bool GetInt(
unsigned int id,
int& value,
int defaultvalue)
const;
216 bool GetUInt(
unsigned int id,
unsigned int& value,
unsigned int defaultvalue)
const;
217 bool GetLong(
unsigned int id,
long& value,
long defaultvalue)
const;
220 bool GetULong(
unsigned int id,
unsigned long& value,
unsigned long defaultvalue)
const;
226#ifdef MOOTOOLS_MFC_PRODUCT_BUILD
230 bool GetUTCTime(
unsigned int id,
CXTime& time,
const CXTime& = CXTime::GetCurrentTime().GetTime())
const;
231 bool GetXTime(
unsigned int id,
CXTime& time,
const CXTime & = CXTime::GetCurrentTime().GetTime())
const;
234 bool RemoveCustom(
unsigned int id);
236 unsigned int GetIDCount()
const;
237 unsigned int GetIDByIndex(
unsigned int index,
unsigned int& kindof)
const;
241#ifndef MOOTOOLS_NO_ARCHIVE_SUPPORT
244 virtual void *SerializeToData(
fileuint& size)
const;
263END_MOOTOOLS_NAMESPACE
CUSTOMDATA_COPY_FLAGS
Definition CustomData.h:71
@ CUSTOMDATA_COPY_NEWID
Copy only id from source that are not in destination.
Definition CustomData.h:73
@ CUSTOMDATA_COPY_KEEP_CONTENT
Keep content of destination when copying.
Definition CustomData.h:74
@ CUSTOMDATA_COPY_DEFAULT
Same has operator =.
Definition CustomData.h:72
CXTString< wchar_t > CXStringW
CXStringA is an unicode wchar_t string. Cf. CXTString.
Definition XString.h:120
CXTString< char > CXStringA
CXStringA is an ansi / utf8 char string. Cf. CXTString.
Definition XString.h:119
CXTString< TCHAR > CXString
CXString depend on the target OS. Could be CXStringW (Windows) or CXStringA (Linux / Macos)
Definition XString.h:118
The class defines an x, y, z 3D point which can use int, float or double.
Definition 3DPoint.h:27
CCustomDataClass can be derived to use CCustomData::GetCustomClass / CCustomData::SetCustomClass.
Definition CustomData.h:82
CCustomData is a handly class for storing any kind of data.
Definition CustomData.h:106
Definition XThreadSync.h:20
Definition XThreadSync.h:38
CXStringArray implement an array of CXString.
Definition XStringArray.h:25
Definition CustomData.h:29