80 if (
pNames == pnNames)
return;
91 pNames->UnRegister(
this);
94 pnNames->Register(
this);
97 OnNameListChanged(
const_cast<const char **
>(pOldNames), iOldSize);
118 if (pnNames) pnNames->Register(
this);
126 void C4ValueMapData::UnRegister()
134 pNames->UnRegister(
this);
152 Register(pTempNames);
167 void C4ValueMapData::ReAllocList()
184 void C4ValueMapData::OnNameListChanged(
const char **pOldNames, int32_t iOldSize)
203 for (i = 0; i < iOldSize; i++)
207 pData[i] = pOldData[i];
213 pData[j] = pOldData[i];
225 assert(iNr < pNames->
iSize);
228 if (!
pNames)
return nullptr;
238 if (!
pNames)
return nullptr;
243 if (iNr == -1)
return nullptr;
265 if (deserializing)
Reset();
271 if (!iValueCnt)
return;
275 char **ppNames = !deserializing ?
pNames->
pNames :
new char * [iValueCnt];
276 if (deserializing)
for (int32_t i = 0; i < iValueCnt; i++) ppNames[i] =
nullptr;
281 for (int32_t i = 0; i < iValueCnt; i++)
287 if (!deserializing) Name.
Ref(ppNames[i]);
289 if (deserializing) ppNames[i] = Name.
GrabPointer();
301 for (int32_t i = 0; i < iValueCnt; i++)
if (ppNames[i]) free(ppNames[i]);
313 for (int32_t i = 0; i < iValueCnt; i++) free(ppNames[i]);
314 delete [] ppNames;
delete []
pData;
327 ChangeNameList(
const_cast<const char **
>(NamesToCopy.
pNames), NamesToCopy.
iSize);
332 ChangeNameList(
const_cast<const char **
>(NamesToCopy.
pNames), NamesToCopy.
iSize);
344 while (pFirst) UnRegister(pFirst);
346 for (int32_t i = 0; i <
iSize; i++)
356 pData->pNext = pFirst;
366 while (pAktData && pAktData != pData)
368 pLastData = pAktData;
369 pAktData = pAktData->pNext;
378 pLastData->pNext = pData->pNext;
380 pFirst = pData->pNext;
381 pData->pNext =
nullptr;
386 void C4ValueMapNames::ChangeNameList(
const char **pnNames, int32_t nSize)
389 char **pOldNames =
pNames;
390 int32_t iOldSize =
iSize;
394 pNames =
new char *[nSize];
398 for (i = 0; i < nSize; i++)
411 pAktData->OnNameListChanged(
const_cast<const char **
>(pOldNames), iOldSize);
412 pAktData = pAktData->pNext;
416 for (i = 0; i < iOldSize; i++)
417 delete[] pOldNames[i];
426 ChangeNameList(pnNames, nSize);
437 const char **pDummyNames =
new const char *[
iSize + 1];
443 for (i = 0; i <
iSize; i++)
445 pDummyNames[i] =
pNames[i];
447 pDummyNames[i] = pnName;
450 ChangeNameList(pDummyNames,
iSize + 1);
453 delete[] pDummyNames;
461 for (int32_t i = 0; i <
iSize; i++)
void SCopy(const char *szSource, char *sTarget, size_t iMaxL)
bool SEqual(const char *szStr1, const char *szStr2)
size_t SLen(const char *sptr)
StdDefaultAdapt< T, D > mkDefaultAdapt(T &&rValue, const D &rDefault)
StdParameterAdapt< T, P > mkParAdapt(T &&rObj, P &&rPar)
C4ValueMapData & operator=(const C4ValueMapData &DataToCopy)
virtual ~C4ValueMapData()
C4ValueMapNames * CreateTempNameList()
void Denumerate(C4ValueNumbers *)
friend class C4ValueMapNames
bool operator==(const C4ValueMapData &Data) const
C4Value * GetItem(const char *strName)
void SetNameList(C4ValueMapNames *pnNames)
void CompileFunc(StdCompiler *pComp, C4ValueNumbers *)
C4ValueMapNames & operator=(const C4ValueMapNames &NamesToCopy)
int32_t AddName(const char *pnName)
virtual ~C4ValueMapNames()
void SetNameArray(const char **pnNames, int32_t nSize)
int32_t GetItemNr(const char *strName) const
virtual bool Separator(Sep eSep=SEP_SEP)
void Value(const T &rStruct)
virtual bool isDeserializer()
void Ref(const char *pnData)