29 #include <AK/Tools/Common/AkFNVHash.h>
30 #include <AK/Tools/Common/AkHashList.h>
32 template<
typename TAlloc,
typename T_CHAR>
44 TAlloc::Free((
void*)
pStr);
55 template<
typename TAlloc,
typename T_CHAR>
59 template<
typename TAlloc,
typename T_CHAR>
69 template<
typename T_CHAR2>
70 AkString(
const T_CHAR2* in_pStr) { tImpl::Set(in_pStr); }
74 template<
typename TAlloc2,
typename T_CHAR2>
84 AkUInt32 uLen = tImpl::Length();
87 tData::pStr = (T_CHAR*)TAlloc::Alloc((uLen + 1) *
sizeof(T_CHAR));
89 return AK_InsufficientMemory;
110 in_from.tData::pStr = NULL;
111 in_from.tData::bOwner =
false;
121 tImpl::Set(in_rhs.
Get());
125 template<
typename TAlloc2,
typename T_CHAR2>
128 tImpl::Set(in_rhs.
Get());
132 template<
typename T_CHAR2>
140 #ifdef AK_SUPPORT_WCHAR
141 template<
typename TAlloc>
151 AKRESULT Set(
const char* in_pStr)
157 size_t uLen = strlen(in_pStr);
160 tData::pStr = (
wchar_t*)TAlloc::Alloc((uLen + 1) *
sizeof(wchar_t));
161 if (tData::pStr == NULL)
162 return AK_InsufficientMemory;
165 tData::bOwner =
true;
176 AKRESULT Set(
const wchar_t* in_pStr)
179 tData::pStr = in_pStr;
184 AkUInt32 Length()
const
186 return (AkUInt32)wcslen(tData::pStr);
191 template<
typename TAlloc>
201 AKRESULT
Set(
const wchar_t* in_pStr)
207 size_t uLen = wcslen(in_pStr);
210 tData::pStr = (
char*)TAlloc::Alloc((uLen + 1) *
sizeof(char));
211 if (tData::pStr == NULL)
212 return AK_InsufficientMemory;
215 tData::bOwner =
true;
226 AKRESULT
Set(
const char* in_pStr)
229 tData::pStr = in_pStr;
236 return (AkUInt32)strlen(tData::pStr);
246 template<
typename TAlloc,
typename T_CHAR>
249 AkUInt32 uLen = in_str.Length();
253 return hash.
Compute(in_str.
Get(), uLen *
sizeof(T_CHAR));
262 template<
typename TAlloc,
typename T_CHAR,
typename tLock = AkNonThreaded>
290 if (pInstance == NULL)
293 AkPlacementNew(pInstance)
Instance();
303 if (pInstance != NULL)
305 pInstance->~Instance();
306 pInstance->TAlloc::Free(pInstance);
316 static Instance* pInstance;
325 template<
typename TAlloc2,
typename T_CHAR2>
335 template<
typename TAlloc2,
typename T_CHAR2>
343 template<
typename T_CHAR2>
361 AKASSERT(pEntry != NULL);
369 template<
typename TAlloc2,
typename T_CHAR2>
372 AKRESULT res = AK_Success;
376 if (in_str.
Get() != NULL)
387 if (pEntry->
str.
Get() == NULL)
389 pEntry->
str = in_str;
392 if (pEntry->
str.
Get() == NULL)
394 pInstance->table.Unset(
m_uHash);
415 AKRESULT res = AK_Success;
425 AKASSERT(pEntry != NULL);
428 AKASSERT(pEntry->
str.
Get() != NULL);
443 typename tStringTable::IteratorEx it = table.
FindEx(
m_uHash);
444 AKASSERT(it != table.
End());
445 Entry& entry = (*it).item;
464 template<
typename TAlloc,
typename T_CHAR,
typename tLock>
HashParams::HashType Compute(const void *in_pData, unsigned int in_dataSize)
AkString & operator=(const AkString< TAlloc, T_CHAR > &in_rhs)
tThis & operator=(const AkString< TAlloc2, T_CHAR2 > &in_rhs)
AKRESULT Set(const char *in_pStr)
const T_CHAR * Get() const
void Transfer(AkString< TAlloc, T_CHAR > &in_from)
AkStringData(const T_CHAR *in_pStr)
AkString(const T_CHAR2 *in_pStr)
AKRESULT Aquire(const AkString< TAlloc2, T_CHAR2 > &in_str)
AkString< TAlloc, T_CHAR > tString
AkHashList< AkUInt32, Entry, TAlloc > tStringTable
AkString & operator=(const T_CHAR2 *in_pStr)
IteratorEx Erase(const IteratorEx &in_rIter)
AkForceInline void AkMemCpy(void *pDest, const void *pSrc, AkUInt32 uSize)
Platform Independent Helper.
AkForceInline void Unlock()
AkDbString< TAlloc, T_CHAR, tLock > tThis
const T_CHAR * Get() const
AkString(const AkString< TAlloc, T_CHAR > &in_other)
AkForceInline void Lock()
AKRESULT Aquire(AkUInt32 in_uHash)
AKRESULT Set(const wchar_t *in_pStr)
IteratorEx FindEx(T_KEY in_Key)
AkString & operator=(const AkString< TAlloc2, T_CHAR2 > &in_rhs)
AkForceInline AkInt32 AkCharToWideChar(const char *in_pszAnsiString, AkUInt32 in_uiOutBufferSize, void *io_pvUnicodeStringBuffer)
String conversion helper.
tThis & operator=(const tThis &in_rhs)
AkForceInline AkInt32 AkWideCharToChar(const wchar_t *in_pszUnicodeString, AkUInt32 in_uiOutBufferSize, char *io_pszAnsiString)
String conversion helper.
AkDbString(const AkString< TAlloc2, T_CHAR2 > &in_fromStr)
AkDbString(const tThis &in_fromDbStr)
AkString(const AkString< TAlloc2, T_CHAR2 > &in_other)
tThis & operator=(const T_CHAR2 *in_rhs)
Besoin d'aide ?
Des questions ? Des problèmes ? Besoin de plus d'informations ? Contactez-nous, nous pouvons vous aider !
Visitez notre page d'Aide
Décrivez-nous de votre projet. Nous sommes là pour vous aider.
Enregistrez votre projet et nous vous aiderons à démarrer sans aucune obligation !
Partir du bon pied avec Wwise