![]() |
Gray C++ Libraries
0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
|
#include <cString.h>
Public Member Functions | |
CStringT () noexcept | |
CStringT (const wchar_t *pwText) | |
CStringT (const wchar_t *pwText, StrLen_t iLenMax) | |
CStringT (const char *pszStr) | |
CStringT (const char *pszStr, StrLen_t iLenMax) | |
CStringT (const THIS_t &ref) noexcept | |
CStringT (THIS_t &&ref) noexcept | |
~CStringT () | |
CStringData * | GetData () const noexcept |
const _TYPE_CH * | GetString () const noexcept |
bool | isValidString () const noexcept |
bool | IsEmpty () const noexcept |
StrLen_t | GetLength () const noexcept |
void | Empty () |
const _TYPE_CH & | ReferenceAt (StrLen_t nIndex) const |
_TYPE_CH | GetAt (StrLen_t nIndex) const |
void | SetAt (StrLen_t nIndex, _TYPE_CH ch) |
_TYPE_CH * | GetBuffer (StrLen_t iMinLength) |
void | ReleaseBuffer (StrLen_t nNewLength=k_StrLen_UNK) |
const THIS_t & | operator= (const THIS_t &ref) |
const THIS_t & | operator= (THIS_t &&ref) |
void | AssignLenT (const _TYPE_CH *pszStr, StrLen_t iLenMax) |
void | AssignLen (const char *pszStr, StrLen_t iSizeMax=StrT::k_LEN_MAX) |
const THIS_t & | operator= (const char *pStr) |
void | AssignLen (const wchar_t *pwText, StrLen_t iSizeMax=StrT::k_LEN_MAX) |
const THIS_t & | operator= (const wchar_t *pStr) |
void | FormatV (const _TYPE_CH *pszStr, va_list args) |
void _cdecl | Format (const _TYPE_CH *pszStr,...) |
COMPARE_t | Compare (const _TYPE_CH *pszStr) const |
COMPARE_t | CompareNoCase (const _TYPE_CH *pszStr) const |
void | MakeUpper () |
void | MakeLower () |
THIS_t | Left (StrLen_t nCount) const |
THIS_t | Right (StrLen_t nCount) const |
THIS_t | Mid (StrLen_t nFirst, StrLen_t nCount=StrT::k_LEN_MAX) const |
void | TrimRight () |
void | TrimLeft () |
StrLen_t | Find (_TYPE_CH ch, StrLen_t nPosStart=0) const |
_TYPE_CH | operator[] (StrLen_t nIndex) const |
const _TYPE_CH & | operator[] (StrLen_t nIndex) |
operator const _TYPE_CH * () const | |
StrLen_t | Insert (StrLen_t nIndex, _TYPE_CH ch) |
const THIS_t & | operator+= (_TYPE_CH ch) |
StrLen_t | Insert (StrLen_t nIndex, const _TYPE_CH *pszStr, StrLen_t iLenCat) |
StrLen_t | Insert (StrLen_t nIndex, const _TYPE_CH *pszStr) |
const THIS_t & | operator+= (const _TYPE_CH *psz) |
void | Assign (const THIS_t &str) |
void | Assign (const wchar_t *pwText) |
void | Assign (const char *pszStr) |
void | AssignLen (const wchar_t *pwStr, StrLen_t iLenMax) |
void | AssignLen (const char *pszStr, StrLen_t iLenMax) |
void | Assign (const wchar_t *pwStr) |
void | Assign (const char *pszStr) |
void | AssignLen (const char *pszStr, StrLen_t iLenMax) |
void | AssignLen (const wchar_t *pwStr, StrLen_t iLenMax) |
void | Assign (const wchar_t *pwStr) |
void | Assign (const char *pszStr) |
Protected Member Functions | |
void | Init () noexcept |
void | EmptyValid () |
void | AssignFirst (const THIS_t &s) noexcept |
void | AllocBuffer (StrLen_t iStrLength) |
void | CopyBeforeWrite () |
const char | m_Nil |
const wchar_t | m_Nil |
Protected Attributes | |
_TYPE_CH * | m_pchData |
Static Protected Attributes | |
static const _TYPE_CH | m_Nil |
Friends | |
bool | operator== (const THIS_t &str1, const _TYPE_CH *str2)((void) 0) |
bool | operator!= (const THIS_t &str1, const _TYPE_CH *str2)((void) 0) |
Mimic the MFC ATL::CStringT<> functionality.
|
inlinenoexcept |
|
inline |
? Init and convert UNICODE is needed.
|
inline |
|
inline |
Init and convert UNICODE is needed.
|
inline |
|
inlinenoexcept |
|
inlinenoexcept |
Move constructor
|
inline |
|
protected |
Dynamic allocate a buffer to hold the string.
void Gray::CStringT< _TYPE_CH >::Assign | ( | const char * | pszStr | ) |
void Gray::CStringT< char >::Assign | ( | const char * | pszStr | ) |
void Gray::CStringT< wchar_t >::Assign | ( | const char * | pszStr | ) |
Convert UTF8 to unicode
|
inline |
void Gray::CStringT< char >::Assign | ( | const wchar_t * | pwStr | ) |
Convert unicode to UTF8
void Gray::CStringT< wchar_t >::Assign | ( | const wchar_t * | pwStr | ) |
void Gray::CStringT< _TYPE_CH >::Assign | ( | const wchar_t * | pwText | ) |
|
inlineprotectednoexcept |
void Gray::CStringT< char >::AssignLen | ( | const char * | pszStr, |
StrLen_t | iLenMax | ||
) |
void Gray::CStringT< wchar_t >::AssignLen | ( | const char * | pszStr, |
StrLen_t | iLenMax | ||
) |
Convert UTF8 to unicode iLenMax = STRMAX = _countof(StrT::k_LEN_MAX)-1 default
void Gray::CStringT< _TYPE_CH >::AssignLen | ( | const char * | pszStr, |
StrLen_t | iSizeMax = StrT::k_LEN_MAX |
||
) |
void Gray::CStringT< char >::AssignLen | ( | const wchar_t * | pwStr, |
StrLen_t | iLenMax | ||
) |
Convert UNICODE to UTF8 iLenMax = _countof(StrT::k_LEN_MAX)-1 default iLenMax = max chars, not including null ! NOT sizeof() or _countof() like StrT::CopyLen
void Gray::CStringT< wchar_t >::AssignLen | ( | const wchar_t * | pwStr, |
StrLen_t | iLenMax | ||
) |
void Gray::CStringT< _TYPE_CH >::AssignLen | ( | const wchar_t * | pwText, |
StrLen_t | iSizeMax = StrT::k_LEN_MAX |
||
) |
void Gray::CStringT< _TYPE_CH >::AssignLenT | ( | const _TYPE_CH * | pszStr, |
StrLen_t | iLenMax | ||
) |
Copy pszStr into this string. iLenMax = max chars, not including null ! NOT sizeof() or _countof() like StrT::CopyLen DEBUG_MSG(( "cString:Assign" ));
|
inline |
|
inline |
|
protected |
We are about to modify/change this. so make sure we don't interfere with other refs. Dupe this string. This might not be thread safe ! if we start with 1 ref we may make another before we are done !
|
inline |
|
inlineprotected |
StrLen_t Gray::CStringT< _TYPE_CH >::Find | ( | _TYPE_CH | ch, |
StrLen_t | nPosStart = 0 |
||
) | const |
|
inline |
use the normal sprintf() style.
void Gray::CStringT< _TYPE_CH >::FormatV | ( | const _TYPE_CH * | pszStr, |
va_list | args | ||
) |
_vsntprintf use the normal sprintf() style.
|
inline |
_TYPE_CH * Gray::CStringT< _TYPE_CH >::GetBuffer | ( | StrLen_t | iMinLength | ) |
like MFC GetBufferSetLength also iMinLength = not including null
|
inlinenoexcept |
like MFC
|
inlinenoexcept |
|
inlinenoexcept |
like MFC
|
inlineprotectednoexcept |
StrLen_t Gray::CStringT< _TYPE_CH >::Insert | ( | StrLen_t | nIndex, |
_TYPE_CH | ch | ||
) |
|
inline |
StrLen_t Gray::CStringT< _TYPE_CH >::Insert | ( | StrLen_t | nIndex, |
const _TYPE_CH * | pszStr, | ||
StrLen_t | iLenCat | ||
) |
insert substring at zero-based index; concatenates if index is past end of string
insert in the middle.
|
inlinenoexcept |
|
inlinenoexcept |
Is the string properly terminated?
CStringT< _TYPE_CH > Gray::CStringT< _TYPE_CH >::Left | ( | StrLen_t | nCount | ) | const |
|
protected |
|
protected |
void Gray::CStringT< _TYPE_CH >::MakeLower |
replaces strlwr() No portable linux equiv to strlwr()? Like MFC CString::MakeLower(), Similar to .NET String.ToLower() BUT NOT THE SAME.
void Gray::CStringT< _TYPE_CH >::MakeUpper |
replaces _strupr No portable linux equiv to _strupr()? Like MFC CString::MakeUpper(), Similar to .NET String.ToUpper(). BUT NOT THE SAME.
CStringT< _TYPE_CH > Gray::CStringT< _TYPE_CH >::Mid | ( | StrLen_t | nFirst, |
StrLen_t | nCount = StrT::k_LEN_MAX |
||
) | const |
Same as STL substr() function.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Copy assignment
|
inline |
|
inline |
Move assignment
|
inline |
|
inline |
|
inline |
void Gray::CStringT< _TYPE_CH >::ReleaseBuffer | ( | StrLen_t | nNewLength = k_StrLen_UNK | ) |
Call this after using GetBuffer() or GetBufferSetLength(); Reset size to actual used size. nNewLength = count of chars, not including null char at the end.
CStringT< _TYPE_CH > Gray::CStringT< _TYPE_CH >::Right | ( | StrLen_t | nCount | ) | const |
|
inline |
void Gray::CStringT< _TYPE_CH >::TrimLeft |
Like MFC CString::TrimLeft(), Similar to .NET String.TrimStart()
void Gray::CStringT< _TYPE_CH >::TrimRight |
Like MFC CString::TrimRight(), Similar to .NET String.TrimEnd()
|
friend |
|
friend |
|
staticprotected |
|
protected |