2007-03-24 14:59:28 +00:00
|
|
|
/*
|
|
|
|
** zstring.h
|
|
|
|
**
|
|
|
|
**---------------------------------------------------------------------------
|
|
|
|
** Copyright 2005-2007 Randy Heit
|
|
|
|
** All rights reserved.
|
|
|
|
**
|
|
|
|
** Redistribution and use in source and binary forms, with or without
|
|
|
|
** modification, are permitted provided that the following conditions
|
|
|
|
** are met:
|
|
|
|
**
|
|
|
|
** 1. Redistributions of source code must retain the above copyright
|
|
|
|
** notice, this list of conditions and the following disclaimer.
|
|
|
|
** 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
** notice, this list of conditions and the following disclaimer in the
|
|
|
|
** documentation and/or other materials provided with the distribution.
|
|
|
|
** 3. The name of the author may not be used to endorse or promote products
|
|
|
|
** derived from this software without specific prior written permission.
|
|
|
|
**
|
|
|
|
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
**---------------------------------------------------------------------------
|
|
|
|
**
|
|
|
|
*/
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
#ifndef ZSTRING_H
|
|
|
|
#define ZSTRING_H
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <string.h>
|
2006-05-16 02:50:18 +00:00
|
|
|
#include <stddef.h>
|
2006-02-24 04:48:15 +00:00
|
|
|
#include "tarray.h"
|
2007-01-31 00:30:42 +00:00
|
|
|
#include "name.h"
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2006-09-14 00:02:31 +00:00
|
|
|
#ifdef __GNUC__
|
|
|
|
#define PRINTFISH(x) __attribute__((format(printf, 2, x)))
|
|
|
|
#else
|
|
|
|
#define PRINTFISH(x)
|
|
|
|
#endif
|
|
|
|
|
2014-12-27 00:58:59 +00:00
|
|
|
#ifdef __clang__
|
|
|
|
#define IGNORE_FORMAT_PRE \
|
2014-12-27 01:10:41 +00:00
|
|
|
_Pragma("GCC diagnostic push") \
|
2014-12-27 00:58:59 +00:00
|
|
|
_Pragma("GCC diagnostic ignored \"-Wformat-invalid-specifier\"") \
|
|
|
|
_Pragma("GCC diagnostic ignored \"-Wformat-extra-args\"")
|
|
|
|
#define IGNORE_FORMAT_POST _Pragma("GCC diagnostic pop")
|
|
|
|
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ >= 6)))
|
|
|
|
#define IGNORE_FORMAT_PRE \
|
2014-12-27 01:10:41 +00:00
|
|
|
_Pragma("GCC diagnostic push") \
|
2014-12-27 00:58:59 +00:00
|
|
|
_Pragma("GCC diagnostic ignored \"-Wformat=\"") \
|
|
|
|
_Pragma("GCC diagnostic ignored \"-Wformat-extra-args\"")
|
|
|
|
#define IGNORE_FORMAT_POST _Pragma("GCC diagnostic pop")
|
|
|
|
#else
|
|
|
|
#define IGNORE_FORMAT_PRE
|
|
|
|
#define IGNORE_FORMAT_POST
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2006-05-16 02:50:18 +00:00
|
|
|
struct FStringData
|
|
|
|
{
|
|
|
|
unsigned int Len; // Length of string, excluding terminating null
|
|
|
|
unsigned int AllocLen; // Amount of memory allocated for string
|
|
|
|
int RefCount; // < 0 means it's locked
|
|
|
|
// char StrData[xxx];
|
|
|
|
|
|
|
|
char *Chars()
|
|
|
|
{
|
|
|
|
return (char *)(this + 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *Chars() const
|
|
|
|
{
|
|
|
|
return (const char *)(this + 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
char *AddRef()
|
|
|
|
{
|
|
|
|
if (RefCount < 0)
|
|
|
|
{
|
|
|
|
return (char *)(MakeCopy() + 1);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
RefCount++;
|
|
|
|
return (char *)(this + 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Release()
|
|
|
|
{
|
|
|
|
assert (RefCount != 0);
|
|
|
|
|
|
|
|
if (--RefCount <= 0)
|
|
|
|
{
|
|
|
|
Dealloc();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
FStringData *MakeCopy();
|
|
|
|
|
|
|
|
static FStringData *Alloc (size_t strlen);
|
|
|
|
FStringData *Realloc (size_t newstrlen);
|
|
|
|
void Dealloc ();
|
|
|
|
};
|
|
|
|
|
|
|
|
struct FNullStringData
|
|
|
|
{
|
|
|
|
unsigned int Len;
|
|
|
|
unsigned int AllocLen;
|
|
|
|
int RefCount;
|
|
|
|
char Nothing[2];
|
|
|
|
};
|
|
|
|
|
2007-01-25 04:02:06 +00:00
|
|
|
enum ELumpNum
|
|
|
|
{
|
|
|
|
};
|
|
|
|
|
2006-05-03 22:45:01 +00:00
|
|
|
class FString
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
public:
|
2006-05-16 02:50:18 +00:00
|
|
|
FString () : Chars(&NullString.Nothing[0]) { NullString.RefCount++; }
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// Copy constructors
|
2006-05-16 02:50:18 +00:00
|
|
|
FString (const FString &other) { AttachToOther (other); }
|
2006-05-03 22:45:01 +00:00
|
|
|
FString (const char *copyStr);
|
|
|
|
FString (const char *copyStr, size_t copyLen);
|
|
|
|
FString (char oneChar);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// Concatenation constructors
|
2006-05-03 22:45:01 +00:00
|
|
|
FString (const FString &head, const FString &tail);
|
|
|
|
FString (const FString &head, const char *tail);
|
|
|
|
FString (const FString &head, char tail);
|
|
|
|
FString (const char *head, const FString &tail);
|
|
|
|
FString (const char *head, const char *tail);
|
|
|
|
FString (char head, const FString &tail);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2007-01-25 04:02:06 +00:00
|
|
|
// Other constructors
|
|
|
|
FString (ELumpNum); // Create from a lump
|
|
|
|
|
2006-05-03 22:45:01 +00:00
|
|
|
~FString ();
|
|
|
|
|
2007-12-06 19:15:07 +00:00
|
|
|
// Discard string's contents, create a new buffer, and lock it.
|
|
|
|
char *LockNewBuffer(size_t len);
|
|
|
|
|
2006-05-16 02:50:18 +00:00
|
|
|
char *LockBuffer(); // Obtain write access to the character buffer
|
|
|
|
void UnlockBuffer(); // Allow shared access to the character buffer
|
|
|
|
|
2006-05-03 22:45:01 +00:00
|
|
|
operator const char *() const { return Chars; }
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2006-05-16 02:50:18 +00:00
|
|
|
const char *GetChars() const { return Chars; }
|
2008-08-03 03:54:48 +00:00
|
|
|
|
2006-05-16 02:50:18 +00:00
|
|
|
const char &operator[] (int index) const { return Chars[index]; }
|
2008-08-03 03:54:48 +00:00
|
|
|
#if defined(_WIN32) && !defined(_WIN64) && defined(_MSC_VER)
|
|
|
|
// Compiling 32-bit Windows source with MSVC: size_t is typedefed to an
|
|
|
|
// unsigned int with the 64-bit portability warning attribute, so the
|
|
|
|
// prototype cannot substitute unsigned int for size_t, or you get
|
|
|
|
// spurious warnings.
|
|
|
|
const char &operator[] (size_t index) const { return Chars[index]; }
|
|
|
|
#else
|
2008-07-19 12:40:10 +00:00
|
|
|
const char &operator[] (unsigned int index) const { return Chars[index]; }
|
2008-08-03 03:54:48 +00:00
|
|
|
#endif
|
2008-07-31 17:13:21 +00:00
|
|
|
const char &operator[] (unsigned long index) const { return Chars[index]; }
|
|
|
|
const char &operator[] (unsigned long long index) const { return Chars[index]; }
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2006-05-03 22:45:01 +00:00
|
|
|
FString &operator = (const FString &other);
|
|
|
|
FString &operator = (const char *copyStr);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2006-05-03 22:45:01 +00:00
|
|
|
FString operator + (const FString &tail) const;
|
|
|
|
FString operator + (const char *tail) const;
|
|
|
|
FString operator + (char tail) const;
|
|
|
|
friend FString operator + (const char *head, const FString &tail);
|
|
|
|
friend FString operator + (char head, const FString &tail);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2006-05-03 22:45:01 +00:00
|
|
|
FString &operator += (const FString &tail);
|
|
|
|
FString &operator += (const char *tail);
|
|
|
|
FString &operator += (char tail);
|
2007-01-31 00:30:42 +00:00
|
|
|
FString &operator += (const FName &name) { return *this += name.GetChars(); }
|
2006-08-31 00:16:12 +00:00
|
|
|
FString &AppendCStrPart (const char *tail, size_t tailLen);
|
2014-05-13 22:52:16 +00:00
|
|
|
FString &CopyCStrPart(const char *tail, size_t tailLen);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2007-02-24 17:56:43 +00:00
|
|
|
FString &operator << (const FString &tail) { return *this += tail; }
|
|
|
|
FString &operator << (const char *tail) { return *this += tail; }
|
|
|
|
FString &operator << (char tail) { return *this += tail; }
|
|
|
|
FString &operator << (const FName &name) { return *this += name.GetChars(); }
|
|
|
|
|
2006-05-03 22:45:01 +00:00
|
|
|
FString Left (size_t numChars) const;
|
|
|
|
FString Right (size_t numChars) const;
|
2008-04-30 05:36:24 +00:00
|
|
|
FString Mid (size_t pos, size_t numChars = ~(size_t)0) const;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2006-05-03 22:45:01 +00:00
|
|
|
long IndexOf (const FString &substr, long startIndex=0) const;
|
2006-02-24 04:48:15 +00:00
|
|
|
long IndexOf (const char *substr, long startIndex=0) const;
|
|
|
|
long IndexOf (char subchar, long startIndex=0) const;
|
|
|
|
|
2006-05-03 22:45:01 +00:00
|
|
|
long IndexOfAny (const FString &charset, long startIndex=0) const;
|
2006-02-24 04:48:15 +00:00
|
|
|
long IndexOfAny (const char *charset, long startIndex=0) const;
|
|
|
|
|
2006-05-03 22:45:01 +00:00
|
|
|
long LastIndexOf (const FString &substr) const;
|
2006-02-24 04:48:15 +00:00
|
|
|
long LastIndexOf (const char *substr) const;
|
|
|
|
long LastIndexOf (char subchar) const;
|
2006-05-03 22:45:01 +00:00
|
|
|
long LastIndexOf (const FString &substr, long endIndex) const;
|
2006-02-24 04:48:15 +00:00
|
|
|
long LastIndexOf (const char *substr, long endIndex) const;
|
|
|
|
long LastIndexOf (char subchar, long endIndex) const;
|
|
|
|
long LastIndexOf (const char *substr, long endIndex, size_t substrlen) const;
|
|
|
|
|
2006-05-03 22:45:01 +00:00
|
|
|
long LastIndexOfAny (const FString &charset) const;
|
2006-02-24 04:48:15 +00:00
|
|
|
long LastIndexOfAny (const char *charset) const;
|
2006-05-03 22:45:01 +00:00
|
|
|
long LastIndexOfAny (const FString &charset, long endIndex) const;
|
2006-02-24 04:48:15 +00:00
|
|
|
long LastIndexOfAny (const char *charset, long endIndex) const;
|
|
|
|
|
|
|
|
void ToUpper ();
|
|
|
|
void ToLower ();
|
|
|
|
void SwapCase ();
|
|
|
|
|
|
|
|
void StripLeft ();
|
2006-05-03 22:45:01 +00:00
|
|
|
void StripLeft (const FString &charset);
|
2006-02-24 04:48:15 +00:00
|
|
|
void StripLeft (const char *charset);
|
|
|
|
|
|
|
|
void StripRight ();
|
2006-05-03 22:45:01 +00:00
|
|
|
void StripRight (const FString &charset);
|
2006-02-24 04:48:15 +00:00
|
|
|
void StripRight (const char *charset);
|
|
|
|
|
|
|
|
void StripLeftRight ();
|
2006-05-03 22:45:01 +00:00
|
|
|
void StripLeftRight (const FString &charset);
|
2006-02-24 04:48:15 +00:00
|
|
|
void StripLeftRight (const char *charset);
|
|
|
|
|
2006-05-03 22:45:01 +00:00
|
|
|
void Insert (size_t index, const FString &instr);
|
2006-02-24 04:48:15 +00:00
|
|
|
void Insert (size_t index, const char *instr);
|
|
|
|
void Insert (size_t index, const char *instr, size_t instrlen);
|
|
|
|
|
|
|
|
void ReplaceChars (char oldchar, char newchar);
|
|
|
|
void ReplaceChars (const char *oldcharset, char newchar);
|
|
|
|
|
|
|
|
void StripChars (char killchar);
|
|
|
|
void StripChars (const char *killchars);
|
|
|
|
|
|
|
|
void MergeChars (char merger);
|
|
|
|
void MergeChars (char merger, char newchar);
|
|
|
|
void MergeChars (const char *charset, char newchar);
|
|
|
|
|
2006-05-03 22:45:01 +00:00
|
|
|
void Substitute (const FString &oldstr, const FString &newstr);
|
|
|
|
void Substitute (const char *oldstr, const FString &newstr);
|
|
|
|
void Substitute (const FString &oldstr, const char *newstr);
|
2006-02-24 04:48:15 +00:00
|
|
|
void Substitute (const char *oldstr, const char *newstr);
|
|
|
|
void Substitute (const char *oldstr, const char *newstr, size_t oldstrlen, size_t newstrlen);
|
|
|
|
|
2006-09-14 00:02:31 +00:00
|
|
|
void Format (const char *fmt, ...) PRINTFISH(3);
|
|
|
|
void AppendFormat (const char *fmt, ...) PRINTFISH(3);
|
|
|
|
void VFormat (const char *fmt, va_list arglist) PRINTFISH(0);
|
|
|
|
void VAppendFormat (const char *fmt, va_list arglist) PRINTFISH(0);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
bool IsInt () const;
|
|
|
|
bool IsFloat () const;
|
|
|
|
long ToLong (int base=0) const;
|
|
|
|
unsigned long ToULong (int base=0) const;
|
|
|
|
double ToDouble () const;
|
|
|
|
|
2006-05-16 02:50:18 +00:00
|
|
|
size_t Len() const { return Data()->Len; }
|
2006-02-24 04:48:15 +00:00
|
|
|
bool IsEmpty() const { return Len() == 0; }
|
2007-12-06 19:15:07 +00:00
|
|
|
bool IsNotEmpty() const { return Len() != 0; }
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2006-05-16 02:50:18 +00:00
|
|
|
void Truncate (long newlen);
|
2006-05-03 22:45:01 +00:00
|
|
|
|
|
|
|
int Compare (const FString &other) const { return strcmp (Chars, other.Chars); }
|
2006-02-24 04:48:15 +00:00
|
|
|
int Compare (const char *other) const { return strcmp (Chars, other); }
|
2014-05-13 21:16:13 +00:00
|
|
|
int Compare(const FString &other, int len) const { return strncmp(Chars, other.Chars, len); }
|
|
|
|
int Compare(const char *other, int len) const { return strncmp(Chars, other, len); }
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2006-05-03 22:45:01 +00:00
|
|
|
int CompareNoCase (const FString &other) const { return stricmp (Chars, other.Chars); }
|
2006-02-24 04:48:15 +00:00
|
|
|
int CompareNoCase (const char *other) const { return stricmp (Chars, other); }
|
2014-05-13 21:16:13 +00:00
|
|
|
int CompareNoCase(const FString &other, int len) const { return strnicmp(Chars, other.Chars, len); }
|
|
|
|
int CompareNoCase(const char *other, int len) const { return strnicmp(Chars, other, len); }
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
protected:
|
2006-05-16 02:50:18 +00:00
|
|
|
const FStringData *Data() const { return (FStringData *)Chars - 1; }
|
|
|
|
FStringData *Data() { return (FStringData *)Chars - 1; }
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2006-05-16 02:50:18 +00:00
|
|
|
void AttachToOther (const FString &other);
|
|
|
|
void AllocBuffer (size_t len);
|
|
|
|
void ReallocBuffer (size_t newlen);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
static int FormatHelper (void *data, const char *str, int len);
|
|
|
|
static void StrCopy (char *to, const char *from, size_t len);
|
2006-05-03 22:45:01 +00:00
|
|
|
static void StrCopy (char *to, const FString &from);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
char *Chars;
|
|
|
|
|
2006-05-16 02:50:18 +00:00
|
|
|
static FNullStringData NullString;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2006-05-16 02:50:18 +00:00
|
|
|
friend struct FStringData;
|
2015-01-17 00:13:51 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
// Prevent these from being called as current practices are to use Compare.
|
|
|
|
// Without this FStrings will be accidentally compared against char* ptrs.
|
|
|
|
bool operator == (const FString &illegal) const;
|
|
|
|
bool operator != (const FString &illegal) const;
|
|
|
|
bool operator < (const FString &illegal) const;
|
|
|
|
bool operator > (const FString &illegal) const;
|
|
|
|
bool operator <= (const FString &illegal) const;
|
|
|
|
bool operator >= (const FString &illegal) const;
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
namespace StringFormat
|
|
|
|
{
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
// Format specification flags
|
|
|
|
F_MINUS = 1,
|
|
|
|
F_PLUS = 2,
|
|
|
|
F_ZERO = 4,
|
|
|
|
F_BLANK = 8,
|
|
|
|
F_HASH = 16,
|
|
|
|
|
|
|
|
F_SIGNED = 32,
|
|
|
|
F_NEGATIVE = 64,
|
|
|
|
F_ZEROVALUE = 128,
|
About a week's worth of changes here. As a heads-up, I wouldn't be
surprised if this doesn't build in Linux right now. The CMakeLists.txt
were checked with MinGW and NMake, but how they fair under Linux is an
unknown to me at this time.
- Converted most sprintf (and all wsprintf) calls to either mysnprintf or
FStrings, depending on the situation.
- Changed the strings in the wbstartstruct to be FStrings.
- Changed myvsnprintf() to output nothing if count is greater than INT_MAX.
This is so that I can use a series of mysnprintf() calls and advance the
pointer for each one. Once the pointer goes beyond the end of the buffer,
the count will go negative, but since it's an unsigned type it will be
seen as excessively huge instead. This should not be a problem, as there's
no reason for ZDoom to be using text buffers larger than 2 GB anywhere.
- Ripped out the disabled bit from FGameConfigFile::MigrateOldConfig().
- Changed CalcMapName() to return an FString instead of a pointer to a static
buffer.
- Changed startmap in d_main.cpp into an FString.
- Changed CheckWarpTransMap() to take an FString& as the first argument.
- Changed d_mapname in g_level.cpp into an FString.
- Changed DoSubstitution() in ct_chat.cpp to place the substitutions in an
FString.
- Fixed: The MAPINFO parser wrote into the string buffer to construct a map
name when given a Hexen map number. This was fine with the old scanner
code, but only a happy coincidence prevents it from crashing with the new
code
- Added the 'B' conversion specifier to StringFormat::VWorker() for printing
binary numbers.
- Added CMake support for building with MinGW, MSYS, and NMake. Linux support
is probably broken until I get around to booting into Linux again. Niceties
provided over the existing Makefiles they're replacing:
* All command-line builds can use the same build system, rather than having
a separate one for MinGW and another for Linux.
* Microsoft's NMake tool is supported as a target.
* Progress meters.
* Parallel makes work from a fresh checkout without needing to be primed
first with a single-threaded make.
* Porting to other architectures should be simplified, whenever that day
comes.
- Replaced the makewad tool with zipdir. This handles the dependency tracking
itself instead of generating an external makefile to do it, since I couldn't
figure out how to generate a makefile with an external tool and include it
with a CMake-generated makefile. Where makewad used a master list of files
to generate the package file, zipdir just zips the entire contents of one or
more directories.
- Added the gdtoa package from netlib's fp library so that ZDoom's printf-style
formatting can be entirely independant of the CRT.
SVN r1082 (trunk)
2008-07-23 04:57:26 +00:00
|
|
|
F_FPT = 256,
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// Format specification size prefixes
|
|
|
|
F_HALFHALF = 0x1000, // hh
|
|
|
|
F_HALF = 0x2000, // h
|
|
|
|
F_LONG = 0x3000, // l
|
|
|
|
F_LONGLONG = 0x4000, // ll or I64
|
2008-05-14 03:39:30 +00:00
|
|
|
F_BIGI = 0x5000, // I
|
|
|
|
F_PTRDIFF = 0x6000, // t
|
|
|
|
F_SIZE = 0x7000, // z
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
typedef int (*OutputFunc)(void *data, const char *str, int len);
|
|
|
|
|
|
|
|
int VWorker (OutputFunc output, void *outputData, const char *fmt, va_list arglist);
|
|
|
|
int Worker (OutputFunc output, void *outputData, const char *fmt, ...);
|
|
|
|
};
|
|
|
|
|
2006-09-14 00:02:31 +00:00
|
|
|
#undef PRINTFISH
|
|
|
|
|
2007-03-24 14:59:28 +00:00
|
|
|
// FName inline implementations that take FString parameters
|
|
|
|
|
2016-02-05 09:40:45 +00:00
|
|
|
inline FName::FName(const FString &text) { Index = NameData.FindName (text.GetChars(), text.Len(), false); }
|
|
|
|
inline FName::FName(const FString &text, bool noCreate) { Index = NameData.FindName (text.GetChars(), text.Len(), noCreate); }
|
|
|
|
inline FName &FName::operator = (const FString &text) { Index = NameData.FindName (text.GetChars(), text.Len(), false); return *this; }
|
|
|
|
inline FName &FNameNoInit::operator = (const FString &text) { Index = NameData.FindName (text.GetChars(), text.Len(), false); return *this; }
|
2007-03-24 14:59:28 +00:00
|
|
|
|
2009-09-25 03:43:00 +00:00
|
|
|
// Hash FStrings on their contents. (used by TMap)
|
|
|
|
extern unsigned int SuperFastHash (const char *data, size_t len);
|
|
|
|
template<> struct THashTraits<FString>
|
|
|
|
{
|
2016-02-05 09:40:45 +00:00
|
|
|
hash_t Hash(const FString &key) { return (hash_t)SuperFastHash(key.GetChars(), key.Len()); }
|
2011-05-08 00:30:32 +00:00
|
|
|
// Compares two keys, returning zero if they are the same.
|
2009-09-25 03:43:00 +00:00
|
|
|
int Compare(const FString &left, const FString &right) { return left.Compare(right); }
|
|
|
|
};
|
2006-02-24 04:48:15 +00:00
|
|
|
#endif
|