OpenBarnyard
 
Loading...
Searching...
No Matches
T2Locale Class Referenceabstract

#include <T2Locale.h>

Inheritance diagram for T2Locale:

Classes

struct  LocaleStrings
 

Public Types

using Lang = TINT32
 

Public Member Functions

 T2Locale (const T2Locale &)=delete
 
 T2Locale (const T2Locale &&)=delete
 
virtual ~T2Locale ()
 
virtual const TCHARGetLanguageFilename (Lang lang)=0
 
void SetLanguage (Lang langid)
 
Lang GetLanguage () const
 
TINT GetNumStrings () const
 
T2LocalisedString GetString (TINT a_iNumString)
 

Protected Member Functions

 T2Locale (TINT langCount, size_t bufferSize, void *buffer)
 
void * TRBAlloc (size_t size)
 

Static Protected Member Functions

static void * TRBAllocator (TTRB::AllocType alloctype, size_t size, short unk, size_t unk2, void *userData)
 
static void TRBDeallocator (TTRB::AllocType alloctype, void *ptr, short unk, size_t unk2, void *userData)
 

Protected Attributes

TTRB m_Locale
 
void * m_pBuffer
 
void * m_BufferPos
 
LocaleStringsm_StringTable
 
Lang m_LangId
 
TBOOL m_bOwnsBuffer
 

Detailed Description

Definition at line 20 of file T2Locale.h.

Member Typedef Documentation

◆ Lang

Definition at line 23 of file T2Locale.h.

Constructor & Destructor Documentation

◆ T2Locale() [1/3]

T2Locale::T2Locale ( const T2Locale & )
delete

◆ T2Locale() [2/3]

T2Locale::T2Locale ( const T2Locale && )
delete

◆ ~T2Locale()

T2Locale::~T2Locale ( )
virtual

Definition at line 33 of file T2Locale.cpp.

34{
35 m_Locale.Close();
36
37 if ( m_bOwnsBuffer )
38 {
40 }
41}
void TFree(void *a_pMem)
Frees previously allocated memory.
Definition TMemory.cpp:1054
void * m_pBuffer
Definition T2Locale.h:59
TTRB m_Locale
Definition T2Locale.h:58
TBOOL m_bOwnsBuffer
Definition T2Locale.h:63

◆ T2Locale() [3/3]

T2Locale::T2Locale ( TINT langCount,
size_t bufferSize,
void * buffer )
protected

Member Function Documentation

◆ GetLanguage()

Toshi::T2Locale::Lang T2Locale::GetLanguage ( ) const

Definition at line 66 of file T2Locale.cpp.

67{
68 return m_LangId;
69}
Lang m_LangId
Definition T2Locale.h:62

◆ GetLanguageFilename()

virtual const TCHAR * T2Locale::GetLanguageFilename ( Lang lang)
pure virtual

◆ GetNumStrings()

TINT T2Locale::GetNumStrings ( ) const

Definition at line 71 of file T2Locale.cpp.

72{
73 return m_StringTable->m_numstrings;
74}
LocaleStrings * m_StringTable
Definition T2Locale.h:61

◆ GetString()

T2LocalisedString T2Locale::GetString ( TINT a_iNumString)

Definition at line 76 of file T2Locale.cpp.

77{
78 TASSERT( a_iNumString >= 0 && a_iNumString < GetNumStrings() );
79 return m_StringTable->Strings[ a_iNumString ];
80}
#define TASSERT(X,...)
Definition Defines.h:138
TINT GetNumStrings() const
Definition T2Locale.cpp:71

◆ SetLanguage()

void T2Locale::SetLanguage ( Lang langid)

Definition at line 53 of file T2Locale.cpp.

54{
55 // 00662e30
56 if ( langid != m_LangId && ( m_Locale.Close(), -1 < langid ) )
57 {
58 m_Locale.Load( GetLanguageFilename( langid ) );
59 m_StringTable = m_Locale.CastSymbol<LocaleStrings>( "LocaleStrings" );
60
62 m_LangId = langid;
63 }
64}
virtual const TCHAR * GetLanguageFilename(Lang lang)=0
void * m_BufferPos
Definition T2Locale.h:60

◆ TRBAlloc()

void * T2Locale::TRBAlloc ( size_t size)
inlineprotected

Definition at line 50 of file T2Locale.h.

51 {
52 void* ptr = m_BufferPos;
53 m_BufferPos = static_cast<TCHAR*>( ptr ) + size;
54 return ptr;
55 }
char TCHAR
Definition Typedefs.h:20

◆ TRBAllocator()

void * T2Locale::TRBAllocator ( TTRB::AllocType alloctype,
size_t size,
short unk,
size_t unk2,
void * userData )
staticprotected

Definition at line 43 of file T2Locale.cpp.

44{
45 return TSTATICCAST( T2Locale, userData )->TRBAlloc( size );
46}
#define TSTATICCAST(POINTERTYPE, VALUE)
Definition Defines.h:69
T2Locale(const T2Locale &)=delete

◆ TRBDeallocator()

void T2Locale::TRBDeallocator ( TTRB::AllocType alloctype,
void * ptr,
short unk,
size_t unk2,
void * userData )
staticprotected

Definition at line 48 of file T2Locale.cpp.

49{
50 // T2Locale doesn't have deallocator
51}

Member Data Documentation

◆ m_bOwnsBuffer

TBOOL T2Locale::m_bOwnsBuffer
protected

Definition at line 63 of file T2Locale.h.

◆ m_BufferPos

void* T2Locale::m_BufferPos
protected

Definition at line 60 of file T2Locale.h.

◆ m_LangId

Lang T2Locale::m_LangId
protected

Definition at line 62 of file T2Locale.h.

◆ m_Locale

TTRB T2Locale::m_Locale
protected

Definition at line 58 of file T2Locale.h.

◆ m_pBuffer

void* T2Locale::m_pBuffer
protected

Definition at line 59 of file T2Locale.h.

◆ m_StringTable

LocaleStrings* T2Locale::m_StringTable
protected

Definition at line 61 of file T2Locale.h.


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