#ifndef VCZH_STRING
#define VCZH_STRING
#include <memory.h>
#include "Basic.h"
namespace
{
template
<
typename
>
class
:
public
{
private
:
static
const
;
mutable
*
;
mutable
volatile
*
;
mutable
;
mutable
;
mutable
;
static
(
const
*
)
{
=
0
;
while
(*
++)
result
++;
return
result
;
}
static
(
const
*
,
const
<
>&
)
{
const
*
=
.
+
.
;
const
*
=
;
=
.
;
while
(
length
-- && *
)
{
=*
++-*
bufB
++;
if
(
diff
!=
0
)
{
return
diff
;
}
};
return
(
bufAOld
)-
.
;
}
public
:
static
(
const
<
>&
,
const
<
>&
)
{
const
*
=
.
+
.
;
const
*
=
.
+
.
;
=
.
<
.
?
.
:
.
;
while
(
length
--)
{
=*
bufA
++-*
bufB
++;
if
(
diff
!=
0
)
{
return
diff
;
}
};
return
.
-
.
;
}
private
:
void
()
const
{
if
(
)
{
}
}
void
()
const
{
if
(
)
{
if(DECRC(counter)==0)
if
((
((
volatile
long
*)(
)))==
0
)
{
delete
[]
;
delete
;
}
}
}
(
const
<
>&
,
,
)
{
if
(
<=
0
)
{
=(
*)&
;
=
0
;
=
0
;
=
0
;
=
0
;
}
else
{
=
.
;
=
.
;
=
.
+
;
=
;
=
.
;
();
}
}
(
const
<
>&
,
const
<
>&
,
,
)
{
if
(
==
0
&&
==
.
&&
.
==
0
)
{
=(
*)&
;
=
0
;
=
0
;
=
0
;
=
0
;
}
else
{
=
new
(
1
);
=
0
;
=
.
-
+
.
;
=
;
=
new
[
+
1
];
(
,
.
+
.
,
sizeof
(
)*
);
(
+
,
.
+
.
,
sizeof
(
)*
.
);
(
+
+
.
, (
.
+
.
+
+
),
sizeof
(
)*(
.
-
-
));
[
]=
0
;
}
}
public
:
static
<
>
;
()
{
=(
*)&
;
=
0
;
=
0
;
=
0
;
=
0
;
}
(
const
&
)
{
=
new
(
1
);
=
0
;
=
1
;
=
new
[
2
];
[
0
]=
;
[
1
]=
0
;
=
;
}
(
const
*
,
)
{
if
(
<=
0
)
{
=(
*)&
;
=
0
;
=
0
;
=
0
;
=
0
;
}
else
{
=
new
[
+
1
];
(
,
,
*
sizeof
(
));
[
]=
0
;
=
new
(
1
);
=
0
;
=
;
=
;
}
}
(
const
*
,
bool
=
true
)
{
CHECK_ERROR(_buffer!=0, L"ObjectString<T>::ObjectString(const T*, bool)#Cannot construct a string from nullptr.");
do
{
if
(!(
!=
0
))
throw
(
L"ObjectString<T>::ObjectString(const T*, bool)#Cannot construct a string from nullptr."
);}
while
(
0
);
if
(
)
{
=
new
(
1
);
=
0
;
=
(
);
=
new
[
+
1
];
(
,
,
sizeof
(
)*(
+
1
));
=
;
}
else
{
=(
*)
;
=
0
;
=
0
;
=
(
);
=
;
}
}
(
const
<
>&
)
{
=
.
;
=
.
;
=
.
;
=
.
;
=
.
;
();
}
(
<
>&&
)
{
=
.
;
=
.
;
=
.
;
=
.
;
=
.
;
.
=(
*)&
;
.
=
0
;
.
=
0
;
.
=
0
;
.
=
0
;
}
()
{
();
}
const
*
()
const
{
if
(
+
!=
)
{
*
=
new
[
+
1
];
(
newBuffer
,
+
,
sizeof
(
)*
);
newBuffer
[
]=
0
;
();
=
newBuffer
;
=
new
(
1
);
=
0
;
=
;
}
return
+
;
}
<
>&
(
const
<
>&
)
{
if
(
this
!=&
)
{
();
=
.
;
=
.
;
=
.
;
=
.
;
=
.
;
();
}
return
*
this
;
}
<
>&
(
<
>&&
)
{
if
(
this
!=&
)
{
();
=
.
;
=
.
;
=
.
;
=
.
;
=
.
;
.
=(
*)&
;
.
=
0
;
.
=
0
;
.
=
0
;
.
=
0
;
}
return
*
this
;
}
<
>&
(
const
<
>&
)
{
return
*
this
=*
this
+
;
}
<
>
(
const
<
>&
)
const
{
return
<
>(*
this
,
,
,
0
);
}
bool
(
const
<
>&
)
const
{
return
(*
this
,
)==
0
;
}
bool
(
const
<
>&
)
const
{
return
(*
this
,
)!=
0
;
}
bool
(
const
<
>&
)
const
{
return
(*
this
,
)>
0
;
}
bool
(
const
<
>&
)
const
{
return
(*
this
,
)>=
0
;
}
bool
(
const
<
>&
)
const
{
return
(*
this
,
)<
0
;
}
bool
(
const
<
>&
)
const
{
return
(*
this
,
)<=
0
;
}
bool
(
const
*
)
const
{
return
(
, *
this
)==
0
;
}
bool
(
const
*
)
const
{
return
(
, *
this
)!=
0
;
}
bool
(
const
*
)
const
{
return
(
, *
this
)<
0
;
}
bool
(
const
*
)
const
{
return
(
, *
this
)<=
0
;
}
bool
(
const
*
)
const
{
return
(
, *
this
)>
0
;
}
bool
(
const
*
)
const
{
return
(
, *
this
)>=
0
;
}
(
)
const
{
CHECK_ERROR(index>=0 && index<length, L"ObjectString:<T>:operator[](vint)#Argument index not in range.");
do
{
if
(!(
>=
0
&&
<
))
throw
(
L"ObjectString:<T>:operator[](vint)#Argument index not in range."
);}
while
(
0
);
return
[
+
];
}
()
const
{
return
;
}
(
)
const
{
const
*
=
+
;
for
(
=
0
;
i
<
;
i
++)
{
if
(
reading
[
i
]==
)
return
i
;
}
return
-
1
;
}
<
>
(
)
const
{
CHECK_ERROR(count>=0 && count<=length, L"ObjectString<T>::Left(vint)#Argument count not in range.");
do
{
if
(!(
>=
0
&&
<=
))
throw
(
L"ObjectString<T>::Left(vint)#Argument count not in range."
);}
while
(
0
);
return
<
>(*
this
,
0
,
);
}
<
>
(
)
const
{
CHECK_ERROR(count>=0 && count<=length, L"ObjectString<T>::Right(vint)#Argument count not in range.");
do
{
if
(!(
>=
0
&&
<=
))
throw
(
L"ObjectString<T>::Right(vint)#Argument count not in range."
);}
while
(
0
);
return
<
>(*
this
,
-
,
);
}
<
>
(
,
)
const
{
CHECK_ERROR(index>=0 && index<=length, L"ObjectString<T>::Sub(vint, vint)#Argument index not in range.");
do
{
if
(!(
>=
0
&&
<=
))
throw
(
L"ObjectString<T>::Sub(vint, vint)#Argument index not in range."
);}
while
(
0
);
CHECK_ERROR(index+count>=0 && index+count<=length, L"ObjectString<T>::Sub(vint, vint)#Argument count not in range.");
do
{
if
(!(
+
>=
0
&&
+
<=
))
throw
(
L"ObjectString<T>::Sub(vint, vint)#Argument count not in range."
);}
while
(
0
);
return
<
>(*
this
,
,
);
}
<
>
(
,
)
const
{
CHECK_ERROR(index>=0 && index<length, L"ObjectString<T>::Remove(vint, vint)#Argument index not in range.");
do
{
if
(!(
>=
0
&&
<
))
throw
(
L"ObjectString<T>::Remove(vint, vint)#Argument index not in range."
);}
while
(
0
);
CHECK_ERROR(index+count>=0 && index+count<=length, L"ObjectString<T>::Remove(vint, vint)#Argument count not in range.");
do
{
if
(!(
+
>=
0
&&
+
<=
))
throw
(
L"ObjectString<T>::Remove(vint, vint)#Argument count not in range."
);}
while
(
0
);
return
<
>(*
this
,
<
>(),
,
);
}
<
>
(
,
const
<
>&
)
const
{
CHECK_ERROR(index>=0 && index<=length, L"ObjectString<T>::Insert(vint)#Argument count not in range.");
do
{
if
(!(
>=
0
&&
<=
))
throw
(
L"ObjectString<T>::Insert(vint)#Argument count not in range."
);}
while
(
0
);
return
<
>(*
this
,
,
,
0
);
}
friend
bool
(
const
*
,
const
<
>&
)
{
return
(
,
)<
0
;
}
friend
bool
(
const
*
,
const
<
>&
)
{
return
(
,
)<=
0
;
}
friend
bool
(
const
*
,
const
<
>&
)
{
return
(
,
)>
0
;
}
friend
bool
(
const
*
,
const
<
>&
)
{
return
(
,
)>=
0
;
}
friend
bool
(
const
*
,
const
<
>&
)
{
return
(
,
)==
0
;
}
friend
bool
(
const
*
,
const
<
>&
)
{
return
(
,
)!=
0
;
}
friend
<
>
(
const
*
,
const
<
>&
)
{
return
<
>(
,
false
)+
;
}
};
template
<
typename
>
<
>
<
>::
=
<
>();
template
<
typename
>
const
<
>::
=
0
;
typedef
<
char
>
;
typedef
<
wchar_t
>
;
extern
(
const
&
,
bool
&
);
extern
(
const
&
,
bool
&
);
extern
(
const
&
,
bool
&
);
extern
(
const
&
,
bool
&
);
extern
(
const
&
,
bool
&
);
extern
(
const
&
,
bool
&
);
extern
(
const
&
,
bool
&
);
extern
(
const
&
,
bool
&
);
extern
double
(
const
&
,
bool
&
);
extern
double
(
const
&
,
bool
&
);
extern
(
const
&
);
extern
(
const
&
);
extern
(
const
&
);
extern
(
const
&
);
extern
(
const
&
);
extern
(
const
&
);
extern
(
const
&
);
extern
(
const
&
);
extern
double
(
const
&
);
extern
double
(
const
&
);
extern
(
);
extern
(
);
extern
(
);
extern
(
);
extern
(
);
extern
(
);
extern
(
);
extern
(
);
extern
(
double
);
extern
(
double
);
extern
(
const
wchar_t
*
,
char
*
,
);
extern
(
const
&
);
extern
(
const
char
*
,
wchar_t
*
,
);
extern
(
const
&
);
extern
(
const
&
);
extern
(
const
&
);
extern
(
const
&
);
extern
(
const
&
);
#if defined VCZH_GCC
extern void _itoa_s(vint32_t value, char* buffer, size_t size, vint radix);
extern void _itow_s(vint32_t value, wchar_t* buffer, size_t size, vint radix);
extern void _i64toa_s(vint64_t value, char* buffer, size_t size, vint radix);
extern void _i64tow_s(vint64_t value, wchar_t* buffer, size_t size, vint radix);
extern void _uitoa_s(vuint32_t value, char* buffer, size_t size, vint radix);
extern void _uitow_s(vuint32_t value, wchar_t* buffer, size_t size, vint radix);
extern void _ui64toa_s(vuint64_t value, char* buffer, size_t size, vint radix);
extern void _ui64tow_s(vuint64_t value, wchar_t* buffer, size_t size, vint radix);
extern void _gcvt_s(char* buffer, size_t size, double value, vint numberOfDigits);
extern void _strlwr_s(char* buffer, size_t size);
extern void _strupr_s(char* buffer, size_t size);
extern void _wcslwr_s(wchar_t* buffer, size_t size);
extern void _wcsupr_s(wchar_t* buffer, size_t size);
extern void wcscpy_s(wchar_t* buffer, size_t size, const wchar_t* text);
#endif
enum
class
{
,
,
,
};
extern
(
,
);
extern
(
);
extern
(
);
extern
(
);
}
#endif