28#ifndef HPL_SYSTEM_TYPES_H
29#define HPL_SYSTEM_TYPES_H
31#include "common/array.h"
32#include "common/list.h"
33#include "common/str.h"
34#include "hpl1/algorithms.h"
35#include "hpl1/engine/system/Container.h"
36#include "hpl1/std/set.h"
44#define eFlagBit_None (0x00000000)
45#define eFlagBit_All (0xFFFFFFFF)
47#define eFlagBit_0 (0x00000001)
48#define eFlagBit_1 (0x00000002)
49#define eFlagBit_2 (0x00000004)
50#define eFlagBit_3 (0x00000008)
51#define eFlagBit_4 (0x00000010)
52#define eFlagBit_5 (0x00000020)
53#define eFlagBit_6 (0x00000040)
54#define eFlagBit_7 (0x00000080)
55#define eFlagBit_8 (0x00000100)
56#define eFlagBit_9 (0x00000200)
57#define eFlagBit_10 (0x00000400)
58#define eFlagBit_11 (0x00000800)
59#define eFlagBit_12 (0x00001000)
60#define eFlagBit_13 (0x00002000)
61#define eFlagBit_14 (0x00004000)
62#define eFlagBit_15 (0x00008000)
64#define _W(t) Common::U32String(t)
75typedef unsigned int tFlag;
86typedef tStringSet::iterator tStringSetIt;
98typedef tWStringSet::iterator tWStringSetIt;
139#define STLCallInAll(ContType, aCont, aFunc) \
141 ##ContType## ::iterator it = ##aCont##.begin(); \
142 for (; it != ##aCont##.end(); ++it) \
168 snprintf(buff, 256,
"%d/%d-%d %d:%d:%d", month_day, month, 1900 + year, hours, minutes, seconds);
173 bool operator==(
const cDate &aDate)
const {
174 if (seconds == aDate.seconds &&
175 minutes == aDate.minutes &&
176 hours == aDate.hours &&
177 month_day == aDate.month_day &&
178 month == aDate.month &&
179 year == aDate.year) {
186 bool operator!=(
const cDate &aDate)
const {
187 return !(*
this == aDate);
190 bool operator>(
const cDate &aDate)
const {
191 if (year > aDate.year)
193 else if (year < aDate.year)
196 if (month > aDate.month)
198 else if (month < aDate.month)
201 if (month_day > aDate.month_day)
203 else if (month_day < aDate.month_day)
206 if (hours > aDate.hours)
208 else if (hours < aDate.hours)
211 if (minutes > aDate.minutes)
213 else if (minutes < aDate.minutes)
216 if (seconds > aDate.seconds)
218 else if (seconds < aDate.seconds)
224 bool operator<(
const cDate &aDate)
const {
225 if (year < aDate.year)
227 else if (year > aDate.year)
230 if (month < aDate.month)
232 else if (month > aDate.month)
235 if (month_day < aDate.month_day)
237 else if (month_day > aDate.month_day)
240 if (hours < aDate.hours)
242 else if (hours > aDate.hours)
245 if (minutes < aDate.minutes)
247 else if (minutes > aDate.minutes)
250 if (seconds < aDate.seconds)
252 else if (seconds > aDate.seconds)
267 Hpl1::resizeAndFill(mvData, alSize,
nullptr);
270 mpCreateFunc = apCreateFunc;
272 for (
size_t i = 0; i < mvData.
size(); ++i) {
274 mvData[i] = mpCreateFunc();
276 mvData[i] = hplNew(T, ());
283 for (
size_t i = 0; i < mvData.
size(); ++i)
284 hplDelete(mvData[i]);
290 T *pData = mvData[mlCurrentData];
292 if (mlCurrentData == mvData.
size() - 1) {
293 size_t lNewSize = mvData.
size() * 2;
294 size_t lStart = mvData.
size();
297 for (
size_t i = lStart; i < mvData.
size(); ++i) {
299 mvData[i] = mpCreateFunc();
301 mvData[i] = hplNew(T, ());
314 void Release(T *apData) {
315 if (mlCurrentData == 0)
319 mvData[mlCurrentData] = apData;
325 for (
size_t i = mlCurrentData + 1; i < mvData.
size(); ++i) {
326 hplDelete(mvData[i]);
328 mvData.
resize(mlCurrentData + 1);
336 size_t mlCurrentData;
338 T *(*mpCreateFunc)();
349template<
class CONT,
class T>
350void STLFindAndRemove(CONT &aCont, T *pObject) {
351 typename CONT::iterator it = aCont.begin();
352 for (; it != aCont.end(); it++) {
353 if (*it == pObject) {
361template<
class CONT,
class T>
362void STLFindAndDelete(CONT &aCont, T *pObject) {
363 typename CONT::iterator it = aCont.begin();
364 for (; it != aCont.end(); it++) {
365 if (*it == pObject) {
376void *STLFindByName(CONT &aCont,
const tString &asName) {
377 typename CONT::iterator it = aCont.begin();
378 for (; it != aCont.end(); it++) {
379 if ((*it)->GetName() == asName) {
389void STLDeleteAll(T &aCont) {
390 typename T::iterator it = aCont.begin();
391 for (; it != aCont.end(); it++) {
400void STLMapDeleteAll(T &aCont) {
401 typename T::iterator it = aCont.begin();
402 for (; it != aCont.end(); it++) {
403 hplDelete(it->second);
410template<
class T,
class CONT,
class IT>
416 mIt = mpCont->begin();
422 return mIt != mpCont->end();
426 if (mIt == mpCont->end())
429 T &temp =
const_cast<T &
>(*mIt);
438 if (mIt == mpCont->end())
441 T &temp =
const_cast<T &
>(*mIt);
450 if (mIt == mpCont->end())
466template<
class T,
class CONT,
class IT>
472 mIt = mpCont->begin();
478 return mIt != mpCont->end();
482 if (mIt == mpCont->end())
485 T &temp = mIt->second;
494 if (mIt == mpCont->end())
497 T temp = mIt->second;
506 if (mIt == mpCont->end())
tString * iterator
Definition: array.h:54
size_type size() const
Definition: array.h:316
void resize(size_type newSize)
Definition: array.h:412
ListInternal::Iterator< tString > iterator
Definition: list.h:52
Definition: SystemTypes.h:154
Definition: SystemTypes.h:262
Definition: SystemTypes.h:411
Definition: SystemTypes.h:467
Definition: Container.h:40