10#if !defined(OWL_STRING_H)
14#if defined(BI_HAS_PRAGMA_ONCE)
39 ~TSysStr() {
if (P) TOleAuto::SysFreeString(P);}
42 operator const BSTR()
const {
return P;}
43 operator BSTR() {
return P;}
46 operator BSTR *() {
if (P) {TOleAuto::SysFreeString(P); P = 0;}
return &P;}
54 void*
operator new(
size_t)
noexcept {
return nullptr;}
55 void operator delete(
void*) {}
100 operator const char *()
const;
102 operator const wchar_t*()
const;
110 BSTR RelinquishSysStr()
const;
111 wchar_t* RelinquishWide()
const;
112 char* RelinquishNarrow()
const;
113 tchar* Relinquish()
const;
128# define OleStr(s) ::owl::TString(s)
129# define OleText(s) L##s
147 static TUString* Create(
const char * str);
149 static TUString* Create(
const wchar_t* str);
150 static TUString* Create(
wchar_t* str);
162 operator const char *()
const;
164 operator const wchar_t*()
const;
175 void RevokeBstr(
BSTR s);
176 void ReleaseBstr(
BSTR s);
178 static wchar_t* ConvertAtoW(
const char*
src,
size_t len = (
size_t)-1);
179 static char* ConvertWtoA(
const wchar_t*
src,
size_t len = (
size_t)-1);
180 static BSTR ConvertAtoBSTR(
const char*
src);
181 BSTR ConvertToBSTR();
183#if defined(BI_COMP_MSC)
202 const tstring& GetOWLString()
const;
205 char* ChangeToCopy();
206 wchar_t* ChangeToWCopy();
231 TUString() : Lang(0),Kind(isNull),RefCnt(1),Const(0) {}
245inline TString::TString(
const char * s)
389inline TString::operator
const char *()
const
391 return S->operator
const char *();
397inline TString::operator
char*()
399 return S->operator
char*();
405inline TString::operator
const wchar_t*()
const
407 return S->operator
const wchar_t*();
413inline TString::operator
wchar_t*()
415 return S->operator
wchar_t*();
506 return Kind == isNull;
514 return Kind == isWConst || Kind == isWCopy || Kind == isBstr || Kind == isExtBstr;
517inline tstring& TUString::GetOWLString()
519 CHECK(Kind == isString);
523inline const tstring& TUString::GetOWLString()
const
525 CHECK(Kind == isString);
529inline void TUString::AllocOWLString(
const tstring&
as)
delay loading OLEAUT32.DLL/OLE2DISP.DLL
static BSTR SysAllocString(const OLECHAR *)
Reference to reference counted string object TUString Lightweight reference object consisting of a po...
tchar * Relinquish() const
Return a pointer (tchar*) to a copy of the string.
BSTR RelinquishSysStr() const
Return a pointer (BSTR) to a copy of the string.
char * RelinquishNarrow() const
Return a pointer (char*) to a copy of the string.
wchar_t * RelinquishWide() const
Return a pointer (wchar_t*) to a copy of the string.
int Length() const
The length in characters of this string.
TString(const char *s=0)
Construct a TString from any type of string.
TString & operator=(const TString &s)
Copy contents of TString s into this string.
BSTR AsBSTR() const
Return a BSTR object owned by 'this' (not by the caller)
bool IsWide() const
Are the string contents any kind of wide?
bool IsNull() const
Is the string NULL?
TLangId GetLangId()
Get Language Id of this string.
void SetLangId(TLangId id)
Set Language Id of this string.
System string (BSTR) encapsulation.
TSysStr(const TSysStr &src)
Privately used by TString to manage string pointers This is a reference counted union of various stri...
const wchar_t * WConst
Unicode version of Const (Win32)
TUString & operator--()
Predecrement operator only.
TUString & operator++()
Preincrement operator only.
bool IsNull() const
Is the string a null string?
int Length() const
Return appropriate string length.
TUString * Assign(const TUString &s)
const char * Const
Passed-in string, NOT owned here, read-only.
bool IsWide() const
Are the string contents any kind of wide?
wchar_t * WCopy
Unicode version of Copy (Win32)
char StringMem[sizeof(tstring)]
Placeholder for string:: object.
BSTR Bstr
Copy of pointer, owned here.
char * Copy
Local copy, must be deleted, read-write.
TLocaleString - localized name support.
Reliable platform independent header for common memory and string functions.
char * strnewdup(const char *s, size_t minAllocSize=0)
Definition of class TModule.
Object Windows Library (OWLNext Core)
owl::uint16 TLangId
Holds a language ID, a predefined number that represents a base language and dialect.
BSTR SysAllocString(const char *str)