2001-10-06 18:13:28 +04:00
|
|
|
#ifndef CSTRING_H
|
|
|
|
#define CSTRING_H
|
|
|
|
|
|
|
|
#include "common.h"
|
2002-06-01 23:26:11 +04:00
|
|
|
#include "stdpre.h"
|
2001-10-06 18:13:28 +04:00
|
|
|
#include <string>
|
2002-06-01 23:26:11 +04:00
|
|
|
#include "stdpost.h"
|
|
|
|
|
|
|
|
#if defined(_MSC_VER)
|
|
|
|
#pragma warning(push, 4)
|
|
|
|
#pragma warning(disable: 4097) // typedef-name used as synonym
|
|
|
|
#endif
|
2001-10-06 18:13:28 +04:00
|
|
|
|
|
|
|
#ifndef CSTRING_DEF_CTOR
|
|
|
|
#define CSTRING_ALLOC1
|
|
|
|
#define CSTRING_ALLOC2
|
|
|
|
#define CSTRING_DEF_CTOR CString() : _Myt() { }
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// use to get appropriate type for string constants. it depends on
|
|
|
|
// the internal representation type of CString.
|
|
|
|
#define _CS(_x) _x
|
|
|
|
|
|
|
|
class CString : public std::string {
|
2002-04-29 18:40:01 +04:00
|
|
|
public:
|
2001-10-06 18:13:28 +04:00
|
|
|
typedef char _e;
|
|
|
|
typedef _e CharT;
|
|
|
|
typedef std::allocator<_e> _a;
|
|
|
|
typedef std::string _Myt;
|
|
|
|
typedef const_iterator _It;
|
|
|
|
|
|
|
|
// same constructors as base class
|
|
|
|
CSTRING_DEF_CTOR
|
|
|
|
CString(const _Myt& _x) : _Myt(_x) { }
|
|
|
|
CString(const _Myt& _x, size_type _p, size_type _m CSTRING_ALLOC1) :
|
|
|
|
_Myt(_x, _p, _m CSTRING_ALLOC2) { }
|
|
|
|
CString(const _e *_s, size_type _n CSTRING_ALLOC1) :
|
|
|
|
_Myt(_s, _n CSTRING_ALLOC2) { }
|
|
|
|
CString(const _e *_s CSTRING_ALLOC1) :
|
|
|
|
_Myt(_s CSTRING_ALLOC2) { }
|
|
|
|
CString(size_type _n, _e _c CSTRING_ALLOC1) :
|
|
|
|
_Myt(_n, _c CSTRING_ALLOC2) { }
|
|
|
|
CString(_It _f, _It _l CSTRING_ALLOC1) :
|
|
|
|
_Myt(_f, _l CSTRING_ALLOC2) { }
|
|
|
|
};
|
|
|
|
|
2002-06-03 20:34:22 +04:00
|
|
|
class CStringUtil {
|
|
|
|
public:
|
|
|
|
class CaselessCmp {
|
|
|
|
public:
|
|
|
|
bool operator()(const CString&, const CString&) const;
|
|
|
|
static bool less(const CString&, const CString&);
|
|
|
|
static bool equal(const CString&, const CString&);
|
|
|
|
static bool cmpLess(const CString::value_type&,
|
|
|
|
const CString::value_type&);
|
|
|
|
static bool cmpEqual(const CString::value_type&,
|
|
|
|
const CString::value_type&);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2002-06-01 23:26:11 +04:00
|
|
|
#if defined(_MSC_VER)
|
|
|
|
#pragma warning(pop)
|
|
|
|
#endif
|
|
|
|
|
2001-10-06 18:13:28 +04:00
|
|
|
#endif
|
|
|
|
|