Richard Boegli's CnC_Generals_Zero_Hour Fork
WIP
This is documentation of Richard Boegil's Zero Hour Fork
Loading...
Searching...
No Matches
ustring.h
Go to the documentation of this file.
1
/*
2
** Command & Conquer Generals Zero Hour(tm)
3
** Copyright 2025 Electronic Arts Inc.
4
**
5
** This program is free software: you can redistribute it and/or modify
6
** it under the terms of the GNU General Public License as published by
7
** the Free Software Foundation, either version 3 of the License, or
8
** (at your option) any later version.
9
**
10
** This program is distributed in the hope that it will be useful,
11
** but WITHOUT ANY WARRANTY; without even the implied warranty of
12
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
** GNU General Public License for more details.
14
**
15
** You should have received a copy of the GNU General Public License
16
** along with this program. If not, see <http://www.gnu.org/licenses/>.
17
*/
18
19
#ifndef USTRING_HEADER
20
#define USTRING_HEADER
21
22
#include <stdlib.h>
23
#include <stdio.h>
24
#include <iostream.h>
25
#include <string>
26
27
// Windows headers have a tendency to redefine IN
28
#ifdef IN
29
#undef IN
30
#endif
31
#define IN const
32
33
#define MAX_BYTES_PER_CHAR 1
34
35
template
<
class
char
T>
36
class
UstringT
:
public
basic_string<charT, string_char_traits<charT> >
37
{
38
public
:
39
explicit
UstringT
(
int
max_charlength) {
40
set_max_bytelength
(max_charlength*
MAX_BYTES_PER_CHAR
);
41
}
42
43
UstringT
() { max_bytelength=4000; }
44
45
size_t
get_max_bytelength
(
void
) {
return
(max_bytelength); }
46
void
set_max_bytelength
(
size_t
max
) { max_bytelength=
max
; }
47
48
bool
operator==
(
const
UstringT<charT>
&other)
49
{
50
const
basic_string<charT, string_char_traits<charT> > *other_basic=&other;
51
const
basic_string<charT, string_char_traits<charT> > *this_basic=
this
;
52
return
((*other_basic)==(*this_basic));
53
}
54
55
private
:
56
size_t
max_bytelength;
57
};
58
59
typedef
UstringT<char>
Ustring
;
60
61
#endif
max
#define max(x, y)
Definition
BaseType.h:105
UstringT
Definition
ustring.h:37
UstringT::set_max_bytelength
void set_max_bytelength(size_t max)
Definition
ustring.h:46
UstringT::get_max_bytelength
size_t get_max_bytelength(void)
Definition
ustring.h:45
UstringT::operator==
bool operator==(const UstringT< charT > &other)
Definition
ustring.h:48
UstringT::UstringT
UstringT(int max_charlength)
Definition
ustring.h:39
UstringT::UstringT
UstringT()
Definition
ustring.h:43
Ustring
UstringT< char > Ustring
Definition
ustring.h:59
MAX_BYTES_PER_CHAR
#define MAX_BYTES_PER_CHAR
Definition
ustring.h:33
Code
Tools
mangler
wlib
ustring.h
Generated by
1.13.2