Skip to content

Commit

Permalink
Update Engine headers.
Browse files Browse the repository at this point in the history
  • Loading branch information
tx00100xt committed Dec 24, 2023
1 parent 1c454bb commit 1b33799
Show file tree
Hide file tree
Showing 55 changed files with 6,437 additions and 6,644 deletions.
3 changes: 3 additions & 0 deletions Sources/Engine/Base/Assert.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,

#ifdef PLATFORM_UNIX /* rcg10042001 */
#include "SDL_assert.h"
#ifdef PLATFORM_FREEBSD
#undef _assert
#define _assert(x, y, z) SDL_assert(0)
#endif
#include <signal.h> // raise()
#endif

Expand Down
3 changes: 3 additions & 0 deletions Sources/Engine/Base/Base.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#define PLATFORM_MACOSX 1
#elif (defined __FreeBSD__)
#define PLATFORM_FREEBSD 1
#elif (defined __OpenBSD__) || (defined __NetBSD__)
#define PLATFORM_OPENBSD 1
#define PLATFORM_FREEBSD 1
#else
#warning "UNKNOWN PLATFORM IDENTIFIED!!!!"
#define PLATFORM_UNKNOWN 1
Expand Down
238 changes: 119 additions & 119 deletions Sources/Engine/Base/CTString.inl
Original file line number Diff line number Diff line change
@@ -1,119 +1,119 @@
#ifndef SE_INCL_CTSTRING_INL
#define SE_INCL_CTSTRING_INL
#ifdef PRAGMA_ONCE
#pragma once
#endif

#include <Engine/Base/Memory.h>
#include <Engine/Base/Assert.h>

/*
* Default constructor.
*/
ENGINE_API CTString::CTString(void)
{
str_String = StringDuplicate("");
}

/*
* Copy constructor.
*/
ENGINE_API CTString::CTString(const CTString &strOriginal)
{
ASSERT(strOriginal.IsValid());

// make string duplicate
str_String = StringDuplicate(strOriginal.str_String);
}

/*
* Constructor from character string.
*/
ENGINE_API CTString::CTString( const char *strCharString)
{
ASSERT(strCharString!=NULL);

// make string duplicate
str_String = StringDuplicate( strCharString);
}

/* Constructor with formatting. */
ENGINE_API CTString::CTString(INDEX iDummy, const char *strFormat, ...)
{
str_String = StringDuplicate("");
va_list arg;
va_start(arg, strFormat);
VPrintF(strFormat, arg);
va_end(arg);
}

/*
* Destructor.
*/
ENGINE_API CTString::~CTString()
{
// check that it is valid
ASSERT(IsValid());
// free memory
FreeMemory(str_String);
}

/*
* Clear the object.
*/
ENGINE_API void CTString::Clear(void)
{
operator=("");
}

/*
* Conversion into character string.
*/
ENGINE_API CTString::operator const char*() const
{
ASSERT(IsValid());

return str_String;
}

/*
* Assignment.
*/
ENGINE_API CTString &CTString::operator=(const char *strCharString)
{
ASSERT(IsValid());
ASSERT(strCharString!=NULL);

/* The other string must be copied _before_ this memory is freed, since it could be same
pointer!
*/
// make a copy of character string
char *strCopy = StringDuplicate(strCharString);
// empty this string
FreeMemory(str_String);
// assign it the copy of the character string
str_String = strCopy;

return *this;
}
ENGINE_API CTString &CTString::operator=(const CTString &strOther)
{
ASSERT(IsValid());
ASSERT(strOther.IsValid());

/* The other string must be copied _before_ this memory is freed, since it could be same
pointer!
*/
// make a copy of character string
char *strCopy = StringDuplicate(strOther.str_String);
// empty this string
FreeMemory(str_String);
// assign it the copy of the character string
str_String = strCopy;

return *this;
}


#endif /* include-once check. */

#ifndef SE_INCL_CTSTRING_INL
#define SE_INCL_CTSTRING_INL
#ifdef PRAGMA_ONCE
#pragma once
#endif

#include <Engine/Base/Memory.h>
#include <Engine/Base/Assert.h>

/*
* Default constructor.
*/
ENGINE_API CTString::CTString(void)
{
str_String = StringDuplicate("");
}

/*
* Copy constructor.
*/
ENGINE_API CTString::CTString(const CTString &strOriginal)
{
ASSERT(strOriginal.IsValid());

// make string duplicate
str_String = StringDuplicate(strOriginal.str_String);
}

/*
* Constructor from character string.
*/
ENGINE_API CTString::CTString( const char *strCharString)
{
ASSERT(strCharString!=NULL);

// make string duplicate
str_String = StringDuplicate( strCharString);
}

/* Constructor with formatting. */
ENGINE_API CTString::CTString(INDEX iDummy, const char *strFormat, ...)
{
str_String = StringDuplicate("");
va_list arg;
va_start(arg, strFormat);
VPrintF(strFormat, arg);
va_end(arg);
}

/*
* Destructor.
*/
ENGINE_API CTString::~CTString()
{
// check that it is valid
ASSERT(IsValid());
// free memory
FreeMemory(str_String);
}

/*
* Clear the object.
*/
ENGINE_API void CTString::Clear(void)
{
operator=("");
}

/*
* Conversion into character string.
*/
ENGINE_API CTString::operator const char*() const
{
ASSERT(IsValid());

return str_String;
}

/*
* Assignment.
*/
ENGINE_API CTString &CTString::operator=(const char *strCharString)
{
ASSERT(IsValid());
ASSERT(strCharString!=NULL);

/* The other string must be copied _before_ this memory is freed, since it could be same
pointer!
*/
// make a copy of character string
char *strCopy = StringDuplicate(strCharString);
// empty this string
FreeMemory(str_String);
// assign it the copy of the character string
str_String = strCopy;

return *this;
}
ENGINE_API CTString &CTString::operator=(const CTString &strOther)
{
ASSERT(IsValid());
ASSERT(strOther.IsValid());

/* The other string must be copied _before_ this memory is freed, since it could be same
pointer!
*/
// make a copy of character string
char *strCopy = StringDuplicate(strOther.str_String);
// empty this string
FreeMemory(str_String);
// assign it the copy of the character string
str_String = strCopy;

return *this;
}


#endif /* include-once check. */

Loading

0 comments on commit 1b33799

Please sign in to comment.