Commit Graph

306 Commits

Author SHA1 Message Date
Václav Slavík
7978bc7293 remove implicit conversion to C strings from wxString if wxUSE_STL=1; this fixes problems with converting between wxString and std::string in some situations at the cost of having to use c_str() explicitly just as you have to when using std::string
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46554 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-06-20 07:47:51 +00:00
Václav Slavík
300b44a933 fixed wxString iterators linked list corruption
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46515 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-06-18 08:55:11 +00:00
Václav Slavík
f966a73d40 fixed FromUTF8() to accept NULL as well as len==npos; this fixes crashes when loading XML files in UTF-8 build with wxUSE_STL=1
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46491 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-06-16 14:29:52 +00:00
Václav Slavík
541aa82180 fixed VC6 warnings about non-dllexported members in dllexported classes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46407 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-06-11 19:59:11 +00:00
Václav Slavík
3a3dde0d44 use wx/crt.h as the 'official' header for wxCRT wrappers instead of wxchar.h; add comments explaining that users should include wx/crt.h to implementation headers
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46395 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-06-11 06:08:13 +00:00
Václav Slavík
52de37c78f 1. made CRT wrappers definitions indepenent of wxUSE_UNICODE: both ANSI and Unicode variants are now defined
2. split wxcrt.h into wxcrtbase.h with lowlevel compiler-specific definitions and wxcrt.h with ANSI- and Unicode-compatible wx wrappers


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46390 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-06-10 17:14:14 +00:00
Václav Slavík
442cd17f74 removed unused iterators ctors
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46092 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-05-17 15:31:55 +00:00
Václav Slavík
be39d6f592 make operators for comparing wxString and wx[W]CharBuffer available in both builds
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46047 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-05-15 14:54:25 +00:00
Václav Slavík
5d0fac27c4 added operators for comparing wxString to wxCStrData
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46046 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-05-15 14:50:46 +00:00
Václav Slavík
b0c4d5d792 fixed non-const wxString iterators to work when a character is changed to another with different UTF-8 sequence length
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46043 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-05-15 13:16:01 +00:00
Václav Slavík
c67b782d27 reverted accidental commit
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46041 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-05-15 13:11:31 +00:00
Václav Slavík
c7dc005723 added wxSTRING_TEXT() convenience macro for defining literals in wx's internal strings format
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46037 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-05-15 12:51:34 +00:00
Václav Slavík
bfb6847df6 compilation fix for STL implementations that use (const) char* for std::string iterators
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46002 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-05-13 00:17:32 +00:00
Václav Slavík
5487ff0f50 use const wxMBConv& instead of wxMBConv& in public methods so that it's possible to pass in temporary objects;
don't use global wxConvUTF8 object internally, it may be unavailable at static objects destruction time


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45973 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-05-11 20:55:24 +00:00
Václav Slavík
564ab31a53 fixed wxString::Last() to run in O(1), not O(n), in UTF-8 build
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45940 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-05-10 11:17:38 +00:00
Václav Slavík
1545d942ec fixed creation of wxString from another wxString's substring in UTF-8 build
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45939 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-05-10 10:37:52 +00:00
Václav Slavík
c5e7a7d769 changed wxString::StartsWidth/EndsWidth to take wxString argument instead of wxChar*
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45922 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-05-09 21:07:08 +00:00
Václav Slavík
59a14f6984 fix compation with Watcom after latest vararg templates changes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45862 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-05-06 14:11:14 +00:00
Václav Slavík
06c73b9852 fixed FromUTF8 in ANSI builds
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45846 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-05-05 19:19:48 +00:00
Václav Slavík
5f167b77d2 added wxString::FromUTF8/ToUTF8/utf8_str()
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45842 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-05-05 18:53:24 +00:00
Václav Slavík
1528e0b85f use wxFormatString helper class for 'vararg' functions' format argument; this prepares the code for removal of implicit wxString conversion to char* in STL build and also fixes VC6 compilation
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45803 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-05-04 10:41:08 +00:00
Václav Slavík
e905fd1c79 fixed typo in Watcom code
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45796 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-05-03 18:03:39 +00:00
Václav Slavík
111d99489d added code for optimized handling of UTF-8 locales: some string operations are more efficient under it and it's possible to completely compile-out support for other locales if the target system is known to only use UTF-8 locales
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45782 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-05-03 11:05:04 +00:00
Václav Slavík
d1f6e2cfe2 fixed vararg functions with format argument to not use wxString or reference argument (the latter is invalid C++, the former doesn't work with Watcom and produces at least warnings with GCC 3.3)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45781 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-05-03 10:50:25 +00:00
Václav Slavík
d3cefe87d7 added wx[W]CharBuffer/wxCStrData overloads to remaining wxString methods that need them
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45778 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-05-03 10:23:20 +00:00
Václav Slavík
cb2f2135b0 added convenience functions wxString::To/From8BitData() for storing g binary data in wxStrings
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45763 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-05-02 18:08:56 +00:00
Václav Slavík
e3e8e3c0aa include wxchar.h from string.h in 2.8 compatibility mode to prevent lots of compilation errors
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45688 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-04-27 10:08:53 +00:00
Václav Slavík
92a17abc1b added copy ctor to wxCStrData to fix crashes when passing to vararg functions
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45687 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-04-27 08:48:56 +00:00
Václav Slavík
2523e9b700 use UTF8-encoded char* strings in UTF8 build instead of wchar_t* if the current locale uses UTF8;
fall back to widechar CRT functions in the locale is not UTF8


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45663 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-04-26 11:40:04 +00:00
Václav Slavík
c2ac2afd09 removed wxCStrData::operator bool(), using c_str() return value as bool doesn't make any sense and any code that stops compiling because of this is almost certainly buggy
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45626 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-04-24 16:19:27 +00:00
Václav Slavík
c87a0bc8cb corrected (Do)GetWriteBuf() return types to use more appropriate type (no real difference)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45625 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-04-24 15:51:51 +00:00
Vadim Zeitlin
353a4edc6e added implicit conversion of wxString to const void * for compatibility with the code doing things like file.Write(s, len)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45607 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-04-23 20:14:18 +00:00
Václav Slavík
378964d49d fixed wxCStrData::operator[] to use wxString::operator[] instead of at()
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45539 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-04-19 18:33:35 +00:00
Václav Slavík
82a99c692c fixed compilation of STL non-UTF8 builds
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45534 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-04-19 10:57:35 +00:00
Václav Slavík
467175ab3f moved primitive string and string iterators operations to stringops.h/cpp files to make wxString code easier to read
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45533 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-04-19 10:05:55 +00:00
Václav Slavík
59953bf4ba added conversion to and from std::string and std::wstring (if wxUSE_STD_STRING)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45519 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-04-17 15:32:05 +00:00
Vadim Zeitlin
831faf970a corrected the direction of comparisons between wxString and char/wxChar strings
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45500 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-04-16 14:56:51 +00:00
Václav Slavík
8060b0be0e added wxMBConv argument to char_str()
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45496 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-04-16 11:04:35 +00:00
Václav Slavík
681e441286 added wxCStrData::As[W]CharBuf() that doesn't keep converted string in memory for longer than needed
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45495 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-04-16 06:59:04 +00:00
Václav Slavík
cf9a878b54 removed implicit conversion from wxString::iterator to wxStringImpl::iterator (fixes VC6 compilation)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45484 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-04-15 19:02:38 +00:00
Vadim Zeitlin
67cff9dc2f added overloads of ctor/insert/assign/append taking a pair of wxCStrData objects to allow compilation of expression like wxString(s.c_str()+1, s.c_str()+2) (fixes wxUniv compilation)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45472 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-04-14 23:15:57 +00:00
Václav Slavík
817270659e initial version of UTF-8 strings representation (still converting to wchar_t* a lot); it has to be explicitly enabled with --enable-utf8 for now
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45433 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-04-12 21:15:07 +00:00
Václav Slavík
05f32fc39e don't crash if (char*)c_str() is used twice in a row on the same string and both pointers are used at the same time
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45389 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-04-10 19:13:52 +00:00
Václav Slavík
89360a8c87 string iterator's operator- should return difference_type, not size_t or unsigned
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45347 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-04-09 08:18:33 +00:00
Václav Slavík
1bb592b878 removed spurious semicolons
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45346 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-04-09 06:50:28 +00:00
Václav Slavík
132276cf0d fix crash in ~wxString with global wxString objects: temporarily move conversion buffers from a hash to wxString
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45335 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-04-08 17:52:00 +00:00
Vadim Zeitlin
cc5bd48eff added operator-(const wxChar *, const wxCStrData&) to allow compilation of the code doing "p - s.c_str()" where p is a pointer into the string s
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45290 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-04-06 22:56:06 +00:00
Vadim Zeitlin
9aee0061fe wxCStrData must be dllexport'd now that it has non-inline methods
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45288 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-04-06 22:48:54 +00:00
Vadim Zeitlin
30d560f4cf wxString::[const_]iterator operators -= and += should return reference and not iterator object
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45266 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-04-05 21:56:21 +00:00
Vadim Zeitlin
f2a1b1bd23 added overloads taking pairs of const char/wchar_t pointers for wxString methods working with const_iterators for backwards compatibility with old wxString::const_iterator which used to be convertible to/from const wxChar *
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45265 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-04-05 21:55:29 +00:00