18 #ifndef C4STRINGTABLE_H
19 #define C4STRINGTABLE_H
43 void operator=(
const char *
s);
109 operator T * () {
return p; }
110 operator const T * ()
const {
return p; }
111 T *
Get()
const {
return p; }
113 void IncRef() {
if (p) p->IncRef(); }
114 void DecRef() {
if (p) p->DecRef(); }
120 unsigned int Capacity{2};
121 unsigned int Size{0};
123 T * GetPlaceFor(T
const & e)
125 unsigned int h =
Hash(e);
126 T * p = &Table[h % Capacity];
127 while (*p && !
Equals(*p, e))
129 p = &Table[++h % Capacity];
133 T * AddInternal(T
const & e)
135 T * p = GetPlaceFor(e);
139 T * AddInternal(T && e)
141 T * p = GetPlaceFor(e);
147 for (
unsigned int i = 0; i < Capacity; ++i)
150 void MaintainCapacity()
152 if (Capacity - Size < std::max(2u, Capacity / 4))
154 unsigned int OCapacity = Capacity;
157 Table =
new T[Capacity];
159 for (
unsigned int i = 0; i < OCapacity; ++i)
162 AddInternal(std::move(OTable[i]));
168 template<
typename H>
static unsigned int Hash(
const H &);
169 template<
typename H>
static bool Equals(
const T &,
const H &);
170 static bool Equals(
const T &
a,
const T &
b) {
return a ==
b; }
185 Capacity =
b.Capacity;
188 Table =
new T[Capacity];
189 for (
unsigned int i = 0; i < Capacity; ++i)
190 Table[i] =
b.Table[i];
199 template<
typename H> T &
Get(H e)
const
201 unsigned int h =
Hash(e);
202 T * r = &Table[h % Capacity];
203 while (*r && !
Equals(*r, e))
205 r = &Table[++h % Capacity];
209 template<
typename H>
bool Has(H e)
const
211 unsigned int h =
Hash(e);
212 T * r = &Table[h % Capacity];
213 while (*r && !
Equals(*r, e))
215 r = &Table[++h % Capacity];
223 T * r = AddInternal(e);
230 T * r = AddInternal(std::move(e));
236 unsigned int h =
Hash(e);
237 T * r = &Table[h % Capacity];
238 while (*r && !
Equals(*r, e))
240 r = &Table[++h % Capacity];
246 while (*(r = &Table[++h % Capacity]))
250 AddInternal(std::move(m));
254 T
const *
Next(T
const * p)
const
256 while (++p != &Table[Capacity])
264 unsigned int Capacity2 = S2->Capacity;
265 unsigned int Size2 = S2->Size;
266 T * Table2 = S2->Table;
267 S2->Capacity = Capacity;
270 Capacity = Capacity2;
285 std::list<const T *> result;
286 for (
const T *p =
First(); p; p =
Next(p)) result.push_back(p);
292 template<>
template<>
297 template<>
template<>
C4String * String(const char *str)
@ P_EditorPropertyChanged
@ P_Reverb_Late_Reverb_Gain
@ P_MusicMaxPositionMemory
@ P_Reverb_Late_Reverb_Delay
@ P_Reverb_Reflections_Delay
@ P_Reverb_Room_Rolloff_Factor
@ P_Equalizer_Mid2_Center
@ P_Reverb_Reflections_Gain
@ P_PictureTransformation
@ P_Equalizer_Mid1_Center
@ P_Reverb_Air_Absorption_GainHF
@ P_Equalizer_High_Cutoff
virtual ~C4RefCnt()=default
C4RefCntPointer(C4RefCntPointer< U > &&r)
C4RefCntPointer(const C4RefCntPointer< T > &r)
C4RefCntPointer & operator=(C4RefCntPointer< T > &&r)
C4RefCntPointer(C4RefCntPointer< T > &&r)
C4RefCntPointer(const C4RefCntPointer< U > &r)
void Swap(C4Set< T > *S2)
void CompileFunc(class StdCompiler *pComp, class C4ValueNumbers *)
T const * Next(T const *p) const
C4Set & operator=(const C4Set &b)
std::list< const T * > GetSortedListOfElementPointers() const
static bool Equals(const T &, const H &)
static bool SortFunc(const T *p1, const T *p2)
static bool Equals(const T &a, const T &b)
unsigned int GetSize() const
static unsigned int Hash(const H &)
StdStrBuf GetData() const
const char * GetCStr() const
C4String * FindString(const char *strString) const
C4String * RegString(StdStrBuf String)
C4String * RegString(const char *s)
const char * getData() const