Skip to content

Commit

Permalink
kill tchar_t, tstring, tstream(s)
Browse files Browse the repository at this point in the history
  • Loading branch information
gorlak committed Jun 10, 2013
1 parent 3c546a8 commit 5ae1988
Show file tree
Hide file tree
Showing 37 changed files with 207 additions and 224 deletions.
20 changes: 10 additions & 10 deletions Assert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,27 @@ volatile int32_t Assert::sm_active = 0;
/// @param[in] pFile File in which the assertion occurred.
/// @param[in] line Line number at which the assertion occurred.
AssertResult Assert::Trigger(
const tchar_t* pExpression,
const tchar_t* pFunction,
const tchar_t* pFile,
const char* pExpression,
const char* pFunction,
const char* pFile,
int line,
const tchar_t* pMessage,
const char* pMessage,
... )
{
// Only allow one assert handler to be active at a time.
while( AtomicCompareExchangeAcquire( sm_active, 1, 0 ) != 0 )
{
}

tchar_t messageText[ 1024 ];
char messageText[ 1024 ];

if( pExpression )
{
if( pMessage )
{
va_list args;
va_start(args, pMessage);
tchar_t message[1024];
char message[1024];
StringPrint(message, pMessage, args);
va_end(args);

Expand Down Expand Up @@ -72,7 +72,7 @@ AssertResult Assert::Trigger(
{
va_list args;
va_start(args, pMessage);
tchar_t message[1024];
char message[1024];
StringPrint(message, pMessage, args);
va_end(args);

Expand Down Expand Up @@ -104,18 +104,18 @@ AssertResult Assert::Trigger(
std::vector<uintptr_t> trace;
Helium::GetStackTrace( trace );

tstring str = TXT("Stack Trace:\n");
std::string str = TXT("Stack Trace:\n");
Helium::TranslateStackTrace( trace, str );

HELIUM_TRACE( TraceLevels::Error, str.c_str() );
}
else
{
tstring str = TXT("Stack trace unavailable - symbols not loaded\n");
std::string str = TXT("Stack trace unavailable - symbols not loaded\n");
HELIUM_TRACE( TraceLevels::Error, str.c_str() );
}
#else
tstring str = TXT("Stack trace unavailable - symbols not loaded\n");
std::string str = TXT("Stack trace unavailable - symbols not loaded\n");
HELIUM_TRACE( TraceLevels::Error, str.c_str() );
#endif
#endif
Expand Down
4 changes: 2 additions & 2 deletions Assert.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ namespace Helium
public:
/// @name Static Utility Functions
//@{
static AssertResult Trigger( const tchar_t* pExpression, const tchar_t* pFunction, const tchar_t* pFile, int line, const tchar_t* pMessage, ... );
static AssertResult Trigger( const char* pExpression, const char* pFunction, const char* pFile, int line, const char* pMessage, ... );
//@}

private:
Expand All @@ -82,7 +82,7 @@ namespace Helium

/// @name Private Static Utility Functions
//@{
static AssertResult TriggerImplementation( const tchar_t* pMessageText );
static AssertResult TriggerImplementation( const char* pMessageText );
//@}
};
}
Expand Down
4 changes: 2 additions & 2 deletions AssertWin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ void Helium::FatalExit( int exitCode )
/// Handle an assertion.
///
/// @param[in] pMessageText Assert message text.
AssertResult Assert::TriggerImplementation( const tchar_t* pMessageText )
AssertResult Assert::TriggerImplementation( const char* pMessageText )
{
tchar_t messageBoxText[ 1024 ];
char messageBoxText[ 1024 ];
StringPrint(
messageBoxText,
( TXT( "%s\n\nChoose \"Abort\" to terminate the program, \"Retry\" to debug the program (if a debugger " )
Expand Down
4 changes: 2 additions & 2 deletions ConsoleWin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ int PrintArgs(ConsoleColor color, FILE* stream, const T* fmt, va_list args)
}

template< class T >
int PrintString(ConsoleColor color, FILE* stream, const std::basic_string< T >& tstring)
int PrintString(ConsoleColor color, FILE* stream, const std::basic_string< T >& str)
{
CONSOLE_SCREEN_BUFFER_INFO info;

Expand All @@ -264,7 +264,7 @@ int PrintString(ConsoleColor color, FILE* stream, const std::basic_string< T >&
SetConsoleTextAttribute(GetStdHandle(STD_ERROR_HANDLE), color | FOREGROUND_INTENSITY | background);
}

int result = FilePrint(stream, TXT("%s"), tstring.c_str());
int result = FilePrint(stream, TXT("%s"), str.c_str());

fflush(stream);

Expand Down
2 changes: 1 addition & 1 deletion Error.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
namespace Helium
{
HELIUM_PLATFORM_API uint32_t GetLastError();
HELIUM_PLATFORM_API tstring GetErrorString( uint32_t errorOverride = 0 );
HELIUM_PLATFORM_API std::string GetErrorString( uint32_t errorOverride = 0 );
}
4 changes: 2 additions & 2 deletions ErrorWin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ uint32_t Helium::GetLastError()
return ::GetLastError();
}

tstring Helium::GetErrorString( uint32_t errorOverride )
std::string Helium::GetErrorString( uint32_t errorOverride )
{
// get the system error
DWORD error = ( errorOverride != 0 ) ? errorOverride : ::GetLastError();
Expand All @@ -36,7 +36,7 @@ tstring Helium::GetErrorString( uint32_t errorOverride )
result.resize( result.size() - 1 );
}

tstring str;
std::string str;
ConvertString( result, str );
return str;
}
12 changes: 6 additions & 6 deletions Exception.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,30 @@ Helium::Exception::Exception()

}

const tchar_t* Helium::Exception::What() const
const char* Helium::Exception::What() const
{
return m_Message.c_str();
}

Exception::Exception( const tchar_t *msgFormat, ... )
Exception::Exception( const char *msgFormat, ... )
{
va_list msgArgs;
va_start( msgArgs, msgFormat );
SetMessage( msgFormat, msgArgs );
va_end( msgArgs );
}

void Exception::SetMessage( const tchar_t* msgFormat, ... )
void Exception::SetMessage( const char* msgFormat, ... )
{
va_list msgArgs;
va_start( msgArgs, msgFormat );
SetMessage( msgFormat, msgArgs );
va_end( msgArgs );
}

void Exception::SetMessage( const tchar_t* msgFormat, va_list msgArgs )
void Exception::SetMessage( const char* msgFormat, va_list msgArgs )
{
tchar_t msgBuffer[ERROR_STRING_BUF_SIZE];
StringPrintArgs( msgBuffer, sizeof(msgBuffer) / sizeof( tchar_t ), msgFormat, msgArgs );
char msgBuffer[ERROR_STRING_BUF_SIZE];
StringPrintArgs( msgBuffer, sizeof(msgBuffer) / sizeof( char ), msgFormat, msgArgs );
m_Message = msgBuffer;
}
22 changes: 11 additions & 11 deletions Exception.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,21 @@ namespace Helium
Exception();

public:
Exception( const tchar_t *msgFormat, ... );
Exception( const char *msgFormat, ... );

// These accessors are thow that re-throw blocks can amend the exception message
inline tstring& Get();
inline const tstring& Get() const;
inline void Set(const tstring& message);
inline std::string& Get();
inline const std::string& Get() const;
inline void Set(const std::string& message);

// This allow operation with std::exception case statements
virtual const tchar_t* What() const;
virtual const char* What() const;

protected:
void SetMessage( const tchar_t* msgFormat, ... );
void SetMessage( const tchar_t* msgFormat, va_list msgArgs );
void SetMessage( const char* msgFormat, ... );
void SetMessage( const char* msgFormat, va_list msgArgs );

mutable tstring m_Message;
mutable std::string m_Message;
};

/// @defgroup debugutility Debug Utility Functions
Expand All @@ -54,11 +54,11 @@ namespace Helium
HELIUM_PLATFORM_API bool IsDebuggerPresent();

#if !HELIUM_RELEASE && !HELIUM_PROFILE
HELIUM_PLATFORM_API bool InitializeSymbols( const tstring& path = TXT("") );
HELIUM_PLATFORM_API bool InitializeSymbols( const std::string& path = TXT("") );
HELIUM_PLATFORM_API bool GetSymbolsInitialized();
HELIUM_PLATFORM_API size_t GetStackTrace( void** ppStackTraceArray, size_t stackTraceArraySize, size_t skipCount = 1 );
HELIUM_PLATFORM_API void GetAddressSymbol( tstring& rSymbol, void* pAddress );
HELIUM_PLATFORM_API void DebugLog( const tchar_t* pMessage );
HELIUM_PLATFORM_API void GetAddressSymbol( std::string& rSymbol, void* pAddress );
HELIUM_PLATFORM_API void DebugLog( const char* pMessage );
#endif
//@}
}
Expand Down
6 changes: 3 additions & 3 deletions Exception.inl
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
tstring& Helium::Exception::Get()
std::string& Helium::Exception::Get()
{
return m_Message;
}

const tstring& Helium::Exception::Get() const
const std::string& Helium::Exception::Get() const
{
return m_Message;
}

void Helium::Exception::Set(const tstring& message)
void Helium::Exception::Set(const std::string& message)
{
m_Message = message;
}
Loading

0 comments on commit 5ae1988

Please sign in to comment.