OpenBarnyard
 
Loading...
Searching...
No Matches
TPString8Pool Class Reference

#include <TPString8.h>

Public Member Functions

 TPString8Pool (T2Allocator *a_pAllocator)
 
 TPString8Pool (TINT a_iUnknown1, TINT a_iUnknown2, T2Allocator *a_pAllocator, void *m_pUnknown3)
 
void Get (TPooledString8 *&a_pOutString, const TCHAR *a_szString, bool *a_pWasInPool=nullptr)
 
void Remove (TPooledString8 *a_pString)
 
void InitialiseStatic ()
 
T2AllocatorGetAllocator () const
 
T2Map< constTCHAR *, TPooledString8 *, T2String8Comparator >::Iterator Begin ()
 
T2Map< constTCHAR *, TPooledString8 *, T2String8Comparator >::Iterator End ()
 

Detailed Description

Definition at line 48 of file TPString8.h.

Constructor & Destructor Documentation

◆ TPString8Pool() [1/2]

TPString8Pool::TPString8Pool ( T2Allocator * a_pAllocator)

Definition at line 46 of file TPString8.cpp.

47 : m_pAllocator( a_pAllocator ), m_oMap( a_pAllocator )
48{
49 // TODO: Initialise some unknown values
50}

◆ TPString8Pool() [2/2]

TPString8Pool::TPString8Pool ( TINT a_iUnknown1,
TINT a_iUnknown2,
T2Allocator * a_pAllocator,
void * m_pUnknown3 )

Definition at line 52 of file TPString8.cpp.

53 : m_pAllocator( a_pAllocator ), m_oMap( a_pAllocator )
54{
55 // TODO: Initialise some unknown values
56
57 for ( auto it = TPString8Initialiser::Head(); it != TNULL; it = it->Next() )
58 {
59 it->Initialise( this );
60 }
61}
#define TNULL
Definition Typedefs.h:23
TPString8Initialiser * Next() const
Definition TPString8.h:321
static TPString8Initialiser * Head()
Definition TPString8.h:324

Member Function Documentation

◆ Begin()

T2Map< constTCHAR *, TPooledString8 *, T2String8Comparator >::Iterator TPString8Pool::Begin ( )
inline

Definition at line 75 of file TPString8.h.

76 {
77 return m_oMap.Begin();
78 }

◆ End()

T2Map< constTCHAR *, TPooledString8 *, T2String8Comparator >::Iterator TPString8Pool::End ( )
inline

Definition at line 80 of file TPString8.h.

81 {
82 return m_oMap.End();
83 }

◆ Get()

void TPString8Pool::Get ( TPooledString8 *& a_pOutString,
const TCHAR * a_szString,
bool * a_pWasInPool = nullptr )

Definition at line 14 of file TPString8.cpp.

15{
16 a_pOutString = TNULL;
17
18 if ( a_szString != TNULL )
19 {
20 auto iStrLen = TStringManager::String8Length( a_szString );
21
22 if ( iStrLen != 0 )
23 {
24 auto it = m_oMap.Find( a_szString );
25
26 if ( m_oMap.IsValid( it ) )
27 {
28 if ( a_pWasInPool )
29 *a_pWasInPool = TTRUE;
30
31 a_pOutString = it->GetSecond();
32 a_pOutString->IncRefCount();
33 }
34 else
35 {
36 TPooledString8* pString = m_pAllocator->New<TPooledString8>( a_szString, this, m_pAllocator );
37 m_oMap.Insert( pString->GetString8().GetString(), pString );
38
39 a_pOutString = pString;
40 pString->IncRefCount();
41 }
42 }
43 }
44}
#define TTRUE
Definition Typedefs.h:25
const TString8 & GetString8() const
Definition TPString8.h:39
TINT IncRefCount()
Definition TRefCounted.h:13
const TCHAR * GetString(TINT a_iIndex=0) const
Definition TString8.cpp:286
static TSIZE String8Length(const TCHAR *str)

◆ GetAllocator()

T2Allocator * TPString8Pool::GetAllocator ( ) const
inline

Definition at line 70 of file TPString8.h.

71 {
72 return m_pAllocator;
73 }

◆ InitialiseStatic()

void TPString8Pool::InitialiseStatic ( )
inline

Definition at line 65 of file TPString8.h.

66 {
67 TIMPLEMENT();
68 }
#define TIMPLEMENT()
Definition Defines.h:136

◆ Remove()

void TPString8Pool::Remove ( TPooledString8 * a_pString)
inline

Definition at line 59 of file TPString8.h.

60 {
61 TASSERT( a_pString->GetRefCount() == 0 );
62 m_oMap.Remove( a_pString->GetString8() );
63 }
#define TASSERT(X,...)
Definition Defines.h:138
TINT GetRefCount()
Definition TRefCounted.h:12

The documentation for this class was generated from the following files: