/*
===========================================================================
Copyright (C) 2000 - 2013, Raven Software, Inc.
Copyright (C) 2001 - 2013, Activision, Inc.
Copyright (C) 2013 - 2015, OpenJK contributors
This file is part of the OpenJK source code.
OpenJK is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, see .
===========================================================================
*/
// Filename:- sstring.h
//
// Gil's string template, used to replace Microsoft's vrsion which doesn't compile under certain stl map<>
// conditions...
#ifndef SSTRING_H
#define SSTRING_H
#include "../qcommon/q_shared.h"
#include "qcommon/safe/gsl.h"
#include
template
class sstring
{
struct SStorage
{
char data[MaxSize];
};
SStorage mStorage;
public:
/* don't figure we need this
template
sstring(const sstring &o)
{
assert(strlen(o.mStorage.data) &o)
{
//strcpy(mStorage.data,o.mStorage.data);
Q_strncpyz(mStorage.data,o.mStorage.data,sizeof(mStorage.data));
}
sstring(const char *s)
{
//assert(strlen(s) sizeof( mStorage.data ) )
{
Com_Error( ERR_FATAL, "String dest buffer too small (%d) to hold string of length %d", sizeof( mStorage.data ), v.size() );
}
std::copy( v.begin(), v.end(), mStorage.data );
mStorage.data[ v.size() ] = '\0';
}
sstring()
{
mStorage.data[0]=0;
}
/* don't figure we need this
template
sstring & operator =(const sstring &o)
{
assert(strlen(o.mStorage.data) & operator=(const sstring &o)
{
//strcpy(mStorage.data,o.mStorage.data);
Q_strncpyz(mStorage.data,o.mStorage.data,sizeof(mStorage.data));
return *this;
}
sstring & operator=(const char *s)
{
assert(strlen(s) &o) const
{
if (!Q_stricmp(mStorage.data,o.mStorage.data))
{
return true;
}
return false;
}
bool operator!=(const sstring &o) const
{
if (Q_stricmp(mStorage.data,o.mStorage.data)!=0)
{
return true;
}
return false;
}
bool operator<(const sstring &o) const
{
if (Q_stricmp(mStorage.data,o.mStorage.data)<0)
{
return true;
}
return false;
}
bool operator>(const sstring &o) const
{
if (Q_stricmp(mStorage.data,o.mStorage.data)>0)
{
return true;
}
return false;
}
};
typedef sstring sstring_t;
#endif // #ifndef SSTRING_H
/////////////////// eof ////////////////////