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

#include <TError.h>

Inheritance diagram for TError:
TSingleton< TError >

Public Member Functions

 TError (TUINT32 size1, TUINT32 size2)
 
 ~TError ()
 
void AddError (const TCHAR *error,...)
 
const TCHARGetError (TUINT32 index)
 
- Public Member Functions inherited from TSingleton< TError >
 TSingleton (const TSingleton &)=delete
 
 TSingleton (const TSingleton &&)=delete
 
TSingletonoperator= (const TSingleton &)=delete
 
TSingletonoperator= (const TSingleton &&)=delete
 

Public Attributes

TCHARm_Buffer1
 
TUINT32 m_size1
 
TINTm_Buffer2
 
TUINT32 m_size2
 
TUINT32 m_currentSize
 
TUINT32 m_currentSize2
 

Additional Inherited Members

- Static Public Member Functions inherited from TSingleton< TError >
static TFORCEINLINE TErrorCreateSingleton (Args &&... args)
 
static TFORCEINLINE D * CreateSingleton (Args &&... args)
 
static TFORCEINLINE void DestroySingleton ()
 
static TFORCEINLINE TErrorGetSingletonSafe ()
 
static TFORCEINLINE TBOOL IsSingletonCreated ()
 
static TFORCEINLINE TErrorGetSingleton ()
 
- Protected Member Functions inherited from TSingleton< TError >
TFORCEINLINE TSingleton ()
 
TFORCEINLINE ~TSingleton ()
 
- Static Protected Attributes inherited from TSingleton< TError >
static TErrorms_pSingleton
 

Detailed Description

Definition at line 5 of file TError.h.

Constructor & Destructor Documentation

◆ TError()

TError::TError ( TUINT32 size1,
TUINT32 size2 )

Definition at line 10 of file TError.cpp.

11{
12 m_size1 = size1;
13 m_size2 = size2;
14 m_Buffer1 = new TCHAR[ size1 ];
15 m_Buffer2 = new TINT[ size2 ];
16 m_currentSize = 0;
18}
char TCHAR
Definition Typedefs.h:20
int TINT
Definition Typedefs.h:7
TUINT32 m_size1
Definition TError.h:15
TUINT32 m_currentSize2
Definition TError.h:19
TINT * m_Buffer2
Definition TError.h:16
TUINT32 m_currentSize
Definition TError.h:18
TCHAR * m_Buffer1
Definition TError.h:14
TUINT32 m_size2
Definition TError.h:17

◆ ~TError()

TError::~TError ( )

Definition at line 20 of file TError.cpp.

21{
22 delete[] m_Buffer1;
23 delete[] m_Buffer2;
24}

Member Function Documentation

◆ AddError()

void TError::AddError ( const TCHAR * error,
... )

Definition at line 26 of file TError.cpp.

27{
29 {
31
32 va_list args;
33
34 va_start( args, error );
35
36 TCHAR str[ 0x400 ];
37
38 T2String8::Format( str, sizeof( str ), error, args );
39
40 TSIZE size = strlen( str );
41
42 if ( size + m_currentSize <= m_size1 && TUtil::MemCopy( m_Buffer1 + m_currentSize, str, size ) )
43 {
45 m_currentSize += size + 1;
46 }
47 }
48}
size_t TSIZE
Definition Typedefs.h:9
static TINT Format(TCHAR *a_pcString, TINT size, const TCHAR *a_pcFormat,...)
Definition T2String8.cpp:41
static void * MemCopy(void *dst, const void *src, TSIZE size)
Definition TUtil.h:90

◆ GetError()

const TCHAR * TError::GetError ( TUINT32 index)
inline

Definition at line 12 of file TError.h.

12{ return index > -1 && index < m_currentSize2 ? &m_Buffer1[ m_Buffer2[ index ] ] : "invalid error id"; }

Member Data Documentation

◆ m_Buffer1

TCHAR* TError::m_Buffer1

Definition at line 14 of file TError.h.

◆ m_Buffer2

TINT* TError::m_Buffer2

Definition at line 16 of file TError.h.

◆ m_currentSize

TUINT32 TError::m_currentSize

Definition at line 18 of file TError.h.

◆ m_currentSize2

TUINT32 TError::m_currentSize2

Definition at line 19 of file TError.h.

◆ m_size1

TUINT32 TError::m_size1

Definition at line 15 of file TError.h.

◆ m_size2

TUINT32 TError::m_size2

Definition at line 17 of file TError.h.


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