From c10ca98fc1256bf87ee1ad4649ff3bc97cdc8d60 Mon Sep 17 00:00:00 2001 From: Michael Hansen Date: Tue, 1 Jan 2013 14:20:29 -0800 Subject: [PATCH] Remove xtl::istring and xtl::iwstring --- Sources/Plasma/CoreLib/hsStlUtils.cpp | 63 ---------------- Sources/Plasma/CoreLib/hsStlUtils.h | 75 ------------------- .../Plasma/NucleusLib/pnMessage/plMessage.cpp | 33 -------- .../Plasma/NucleusLib/pnMessage/plMessage.h | 9 --- 4 files changed, 180 deletions(-) diff --git a/Sources/Plasma/CoreLib/hsStlUtils.cpp b/Sources/Plasma/CoreLib/hsStlUtils.cpp index f93e0962..1860d3ea 100644 --- a/Sources/Plasma/CoreLib/hsStlUtils.cpp +++ b/Sources/Plasma/CoreLib/hsStlUtils.cpp @@ -107,69 +107,6 @@ std::wstring & trim(std::wstring & s, const wchar_t * charset) return s; } -//xtl::istring -xtl::istring & trimleft(xtl::istring & s, const char * charset) -{ - s.erase(0, s.find_first_not_of(charset)); - return s; -} - -xtl::iwstring & trimleft(xtl::iwstring & s, const wchar_t * charset) -{ - s.erase(0, s.find_first_not_of(charset)); - return s; -} - -xtl::istring & trimright(xtl::istring & s, const char * charset) -{ - int idx = s.find_last_not_of(charset); - - if (xtl::istring::npos == idx) - { - s.erase(); - } - else - { - char c = s.at(idx); - s.erase(idx, xtl::istring::npos); - s.append(1, c); - } - - return s; -} - -xtl::iwstring & trimright(xtl::iwstring & s, const wchar_t * charset) -{ - int idx = s.find_last_not_of(charset); - - if (xtl::iwstring::npos == idx) - { - s.erase(); - } - else - { - wchar_t c = s.at(idx); - s.erase(idx, xtl::iwstring::npos); - s.append(1, c); - } - - return s; -} - -xtl::istring & trim(xtl::istring & s, const char * charset) -{ - trimleft(s,charset); - trimright(s,charset); - return s; -} - -xtl::iwstring & trim(xtl::iwstring & s, const wchar_t * charset) -{ - trimleft(s,charset); - trimright(s,charset); - return s; -} - // c-string std::string trim(const char * s, const char * charset) { diff --git a/Sources/Plasma/CoreLib/hsStlUtils.h b/Sources/Plasma/CoreLib/hsStlUtils.h index f419f997..b69f084b 100644 --- a/Sources/Plasma/CoreLib/hsStlUtils.h +++ b/Sources/Plasma/CoreLib/hsStlUtils.h @@ -101,74 +101,6 @@ struct delete_map_ptr_T void operator()( typename A::value_type & pair ) const { delete pair.second;} }; -// case insensitive string comparer -// useful in maps that use strings -struct stricmp_less : public std::binary_function -{ - bool operator()(const std::string & _X, const std::string & _Y) const - {return ( stricmp(_X.c_str(),_Y.c_str()) < 0); } -}; -struct wstricmp_less : public std::binary_function -{ - bool operator()(const std::wstring & _X, const std::wstring & _Y) const - {return ( wcsicmp(_X.c_str(),_Y.c_str()) < 0); } -}; - -// struct stricmp_char_traits -// case insensitive char_traits. used in creating istring class below -#ifdef __SGI_STL_PORT -struct stricmp_char_traits : public __std_alias::char_traits< char > -#else -struct stricmp_char_traits : public std::char_traits< char > -#endif -{ - static int compare(const char * A, const char * B, size_t N) - { - for (size_t I=0; I -#else -struct wstricmp_char_traits : public std::char_traits< wchar_t > -#endif -{ - static int compare(const wchar_t * A, const wchar_t * B, size_t N) - { - for (size_t I=0; I istring; -typedef std::basic_string iwstring; - // std::string trim std::string & trimleft(std::string & s, const char * charset=" \t\n\r"); std::wstring & trimleft(std::wstring & s, const wchar_t * charset=L" \t\n\r"); @@ -176,13 +108,6 @@ std::string & trimright(std::string & s, const char * charset=" \t\n\r"); std::wstring & trimright(std::wstring & s, const wchar_t * charset=L" \t\n\r"); std::string & trim(std::string & s, const char * charset=" \t\n\r"); std::wstring & trim(std::wstring & s, const wchar_t * charset=L" \t\n\r"); -// xtl::istring trim -xtl::istring & trimleft(xtl::istring & s, const char * charset=" \t\n\r"); -xtl::iwstring & trimleft(xtl::iwstring & s, const wchar_t * charset=L" \t\n\r"); -xtl::istring & trimright(xtl::istring & s, const char * charset=" \t\n\r"); -xtl::iwstring & trimright(xtl::iwstring & s, const wchar_t * charset=L" \t\n\r"); -xtl::istring & trim(xtl::istring & s, const char * charset=" \t\n\r"); -xtl::iwstring & trim(xtl::iwstring & s, const wchar_t * charset=L" \t\n\r"); // c-string trim std::string trim(const char * s, const char * charset=" \t\n\r"); std::wstring trim(const wchar_t * s, const wchar_t * charset=L" \t\n\r"); diff --git a/Sources/Plasma/NucleusLib/pnMessage/plMessage.cpp b/Sources/Plasma/NucleusLib/pnMessage/plMessage.cpp index b79ec0a5..a950574b 100644 --- a/Sources/Plasma/NucleusLib/pnMessage/plMessage.cpp +++ b/Sources/Plasma/NucleusLib/pnMessage/plMessage.cpp @@ -329,39 +329,6 @@ int plMsgStdStringHelper::PeekBig(plString & stringref, hsStream* stream, const return pos; } -///////////////////////////////////////////////////////////////// - -// STATIC -int plMsgXtlStringHelper::Poke(const xtl::istring & stringref, hsStream* stream, const uint32_t peekOptions) -{ - plMessage::plStrLen strlen; - strlen = stringref.length(); - stream->WriteLE(strlen); - if (strlen) - stream->Write(strlen,stringref.data()); - return stream->GetPosition(); -} - -// STATIC -int plMsgXtlStringHelper::Peek(xtl::istring & stringref, hsStream* stream, const uint32_t peekOptions) -{ - plMessage::plStrLen strlen; - stream->LogSubStreamStart("push me"); - stream->LogReadLE(&strlen,"StrLen"); - stringref.erase(); - if (strlen <= stream->GetSizeLeft()) - { - stringref.resize(strlen); - if (strlen){ - stream->LogRead(strlen,(void*)stringref.data(),"XtlString"); - stream->LogStringString(xtl::format("Value: %s", stringref.data()).c_str()); - } - } - stream->LogSubStreamEnd(); - return stream->GetPosition(); -} - - ///////////////////////////////////////////////////////////////// // STATIC diff --git a/Sources/Plasma/NucleusLib/pnMessage/plMessage.h b/Sources/Plasma/NucleusLib/pnMessage/plMessage.h index d0f841ba..7dada990 100644 --- a/Sources/Plasma/NucleusLib/pnMessage/plMessage.h +++ b/Sources/Plasma/NucleusLib/pnMessage/plMessage.h @@ -180,15 +180,6 @@ struct plMsgStdStringHelper static int PeekBig(plString & stringref, hsStream* stream, const uint32_t peekOptions=0); }; -///////////////////////////////////////////////////////////////// -// reads/writes your xtl::istring field - -struct plMsgXtlStringHelper -{ - static int Poke(const xtl::istring & stringref, hsStream* stream, const uint32_t peekOptions=0); - static int Peek(xtl::istring & stringref, hsStream* stream, const uint32_t peekOptions=0); -}; - ///////////////////////////////////////////////////////////////// // reads/writes your char * field (deprecated)