Commit Graph

406 Commits

Author SHA1 Message Date
Vadim Zeitlin
2415cf6725 Remove support for MetroWerks CodeWarrior compiler.
This compiler doesn't exist any more and was probably unsupported even in 2.8,
let alone 2.9, so remove all the __MWERKS__ tests to simplify things.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71102 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-04-05 18:40:11 +00:00
Vadim Zeitlin
52dc2108ae Add helper wxString::IterOffsetInMBStr() method.
This method can be used to recover the pointer in char* buffer containing
multi-byte string representation corresponding to the given iterator which is
useful for implementing backwards-compatible functions that must be able to
return such pointers.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70995 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-03-25 16:45:50 +00:00
Vadim Zeitlin
42e86f64b7 Don't cache incorrect length in wxString::DoUngetWriteBuf().
The length here is the size of the buffer in bytes and is not necessarily the
string length in code points (notably not for non-ASCII strings in UTF-8
build).

Closes #14130.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70988 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-03-23 15:13:16 +00:00
Vadim Zeitlin
556a836e0f Don't cache incorrect length in wxString::assign(char*, size_t).
The length of the string here is specified in bytes and is not the same as the
string length for non-ASCII UTF-8 strings, so don't cache it as the string
length.

Just invalidate the cached length instead as we simply don't know what the
real length of the string is going to be.

See #14130.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70987 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-03-23 15:13:13 +00:00
Vadim Zeitlin
bd42a07c7a Fix caching wrong length in wxString(str, len) ctor in UTF-8 build.
A length greater than that of the source string could be passed to this ctor.
This worked correctly, i.e. created a string which was a copy of the source
one but cached a wrong length for it.

Avoid this by explicitly checking the length before caching it in
wxString::assign(str, len).

See #14130.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70986 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-03-23 15:13:08 +00:00
Vadim Zeitlin
d98a58c543 Use __WINDOWS__ for OS kind checks and reserve __WXMSW__ for GUI toolkit.
This change prepares the way for using wxGTK under Windows as this would
still define __WINDOWS__ but use __WXGTK__ instead of __WXMSW__.

Closes #14064.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70796 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-03-04 00:29:31 +00:00
Vadim Zeitlin
bd362275b8 Remove Palm OS port.
The platform targeted by this port doesn't exist any more and the port never
achieved really working state so remove the code to avoid having to maintain
it.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70345 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-01-15 01:05:28 +00:00
Vadim Zeitlin
01871bf642 Add wxUSE_STD_CONTAINERS and turn it on by default.
Previously, wxUSE_STL enabled both implicit conversion of wxString to
std::[w]string and use of standard containers for the implementation of their
wx equivalents. Split up the two roles now by allowing to enable the use of
the standard containers independently of (backwards incompatible) implicit
conversion in wxString and actually enable wxUSE_STD_CONTAINERS by default.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67343 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-03-30 14:16:04 +00:00
Vadim Zeitlin
fd3a4cb92d Added precision parameter to wxString::From[C]Double().
Optionally support fixed precision in wxString::FromDouble() and FromCDouble()
methods. This is mostly useful for the latter to be able to format numbers in
portable way (using dot as decimal separator) without loss of precision but
also do it for the former for consistency.

Closes #12973.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67181 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-03-13 13:53:54 +00:00
Vadim Zeitlin
066e5e3fd2 Add wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG symbol.
Instead of writing a rather unreadable "defined(wxLongLong_t) &&
!defined(wxLongLongIsLong)" expression every time we need to decide if a
function needs to be overloaded for both long and long long, add a new symbol
which can be tested directly.

No real changes in the code.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66711 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-01-19 10:47:49 +00:00
Vadim Zeitlin
bd63e363c2 Compilation fix for wxUSE_UNICODE_WCHAR && !wxUSE_STL_BASED_WXSTRING.
Construct wxScopedWCharBuffer using CreateNonOwned() in
wxString::ToStdWstring() in this case, creating it directly from wc_str()
doesn't work (intentionally, as this doesn't tell if the buffer owns the
string or not).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65928 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-26 15:11:00 +00:00
Vadim Zeitlin
6becc1e617 Added "rest" argument to wxString::Before{First,Last}().
This allows to search the string just once, in BeforeXXX(), when both the
parts of the string before and after some character are needed instead of
having to do it twice in both BeforeXXX() and AfterXXX().

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65862 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-22 14:17:37 +00:00
Vadim Zeitlin
53dfbfa5c9 Add missing comparison operator declarations in wxString::iterator.
Fix compilation in !wxUSE_UNICODE_UTF8 case after r65857.

Modify the second declaration of wxString::iterator class which was not
updated by the previous commit in the same way, i.e. add declaration of
comparison operators taking const_iterator to iterator class.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65859 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-21 19:51:40 +00:00
Vadim Zeitlin
bdb40fa63e Implement comparisons between wxString::iterator and const_iterator.
Only comparisons between const_iterator and iterator worked before (because of
implicit conversion from the latter to the former), implement the ones in the
other direction explicitly now.

Closes #12594.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65857 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-21 19:22:33 +00:00
Václav Slavík
908c405611 Use wxScopedCharBuffer in To8BitData() in ANSI build too.
This allows one to write code compatible with both Unicode and ANSI
builds.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64789 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-07-01 15:28:30 +00:00
Vadim Zeitlin
951201d81c Add wxString::FromDouble() and FromCDouble().
wxString::FromCDouble() is needed inside wxWidgets itself to format numbers
independently of the current locale. FromDouble() was added for symmetry with
ToDouble/ToCDouble() functions.

Use std::locale for the implementation if available and manual wxLocale-based
fallback otherwise.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64449 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-05-31 11:55:48 +00:00
Vadim Zeitlin
105993f7b6 Make wxString::ToCXXX() methods always available.
We use these methods inside wxWidgets itself and so want to always have them,
even when wxUSE_XLOCALE==0. Provide replacement manual implementations for
this case.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64448 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-05-31 11:55:41 +00:00
Vadim Zeitlin
e3ab69523b Add wxString::ToStdString() and ToStdWstring().
These trivial helper functions are available in all builds (provided that
wxUSE_STD_STRING is not explicitly set to non-default 0 value) unlike implicit
conversions to std::[w]string which are only available when wxUSE_STL==1.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63938 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-04-11 11:08:49 +00:00
Vadim Zeitlin
05d676f558 Always declare wxCStrData::As[W]Char() as being inline.
This fixes warnings with IRIX mipsPro and not only mingw32 and probably
doesn't do any harm with the other compilers.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63581 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-02-28 11:09:07 +00:00
Vadim Zeitlin
651548666a Change wxLongLongFmtSpec to be a non-wide string.
As with other ANSI/Unicode unification changes, we choose to preserve
compatibility with the existing code using wxLongLongFmtSpec in ANSI build
and require people using it in Unicode build to change their code.

Closes #11372.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62562 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-11-05 14:59:55 +00:00
Vadim Zeitlin
03647350fc No changes, just removed hard tabs and trailing white space.
This commit is huge but there are no non-white-space changes in it.

Some files containing third-party sources (src/msw/wince/time.cpp,
src/x11/pango*.cpp) were left unchanged.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61724 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-08-21 10:41:26 +00:00
Vadim Zeitlin
9a83f86094 Globally replace _T() with wxT().
Standardize on using a single macro across all wxWidgets sources and solve the name clash with Sun CC standard headers (see #10660).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61508 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-07-23 20:30:22 +00:00
Vadim Zeitlin
fb330c2ec3 disable MSVC warning 4275 correctly (closes #10885)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61010 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-06-12 03:37:47 +00:00
Vadim Zeitlin
f6363458bc avoid g++ 4.3 warnings about conflict between parameter and method names (closes #10843)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60772 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-05-28 09:49:20 +00:00
Vadim Zeitlin
113f623379 remove dll export declaration from wxCStrData now that all its methods are inline (fixes mingw32 warning in DLL build)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60184 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-04-15 21:31:33 +00:00
Vadim Zeitlin
582886dde5 return empty string instead of NULL from mb_str()/wc_str() when conversion fails to avoid crashing badly written code which doesn't check for conversion failures
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60125 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-04-13 17:48:11 +00:00
Vadim Zeitlin
f54cb154d5 return persistent buffers from mb_str()/wc_str() to allow assigning the returned value to simple pointers
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60116 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-04-12 19:49:45 +00:00
Václav Slavík
ed5e656088 fixed wxString::utf8_str() in UTF8 build to return buffer with length
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60108 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-04-12 10:12:44 +00:00
Václav Slavík
197380a09f always return (owned or non-owned, depending on build) wxScopedCharBuffer from utf8_str() and ToUTF8()
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59945 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-03-30 18:28:42 +00:00
Václav Slavík
38d26d6040 fixes or embedded NULs handling in wxString
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59940 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-03-30 15:35:47 +00:00
Václav Slavík
e542e141a3 compilation fix for wxUSE_UTF8_LOCALE_ONLY case
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59936 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-03-30 00:00:15 +00:00
Václav Slavík
6df09f32fd added length to wx(Scoped)CharBuffer to improve handling of embedded NULs
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59927 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-03-29 20:58:39 +00:00
Václav Slavík
de4983f323 split wxCharTypeBuffer<T> into wxScopedCharTypeBuffer<T> and wxCharTypeBuffer<T> -- the former is for transient data with validity limited to parent's lifetime, the latter is for permanent storage of string data (bug #9638)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59887 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-03-27 15:33:55 +00:00
Václav Slavík
52988b5f63 added some clarifying comments to wxCStrData
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59813 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-03-24 17:55:04 +00:00
Francesco Montorsi
529e491ce0 add the ToCLong, ToCULong and ToCDouble functions, with docs and test units
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59645 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-03-20 14:50:06 +00:00
Václav Slavík
862bb5c73a renamed ATTRIBUTE_PRINTF to WX_ATTRIBUTE_PRINTF to avoid naming conflicts (e.g. with latest libxml2)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59479 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-03-11 07:51:38 +00:00
Vadim Zeitlin
c0c133e13b add wx-prefixed and semicolon-requiring versions of DECLARE_NO_{COPY,ASSIGN}_CLASS macros
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58757 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-02-08 11:45:59 +00:00
Francesco Montorsi
cbec0f401a add wxStringCheck templated utility function
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58565 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-01-31 21:19:37 +00:00
Stefan Csomor
b69470e4ee workaround for crashes in release builds
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58527 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-01-30 20:58:08 +00:00
Vadim Zeitlin
5c33522fca replace wx_{const,static,reinterpret}_cast with their standard C++ equivalents
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56644 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-11-02 02:39:52 +00:00
Vadim Zeitlin
6b583d40a8 fix linking problems due to MSVC implicitly considering template classes specializations used as base classes DLL-exported even though it doesn't actually export them when building the DLL (with or without explicit declspec(dllexport)); also replace wxCharTypeBuffer::NullData with a static function to allow not DLL-exporting this class
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56602 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-10-30 23:04:29 +00:00
Vadim Zeitlin
7929902d65 no real changes, just fixed all occurences of 'occurence' typo
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55945 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-09-29 12:10:58 +00:00
Vadim Zeitlin
18666b42ca no changes, just clarified meaning of various conversion functions in a comment
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55792 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-09-22 12:43:35 +00:00
Stefan Csomor
6e42b980d9 fixing compilo
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55543 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-09-11 07:40:58 +00:00
Stefan Csomor
e317bd3f10 solving osx problems (default inlines-hidden) by explicitely exporting the involved methods
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55540 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-09-11 06:46:23 +00:00
Stefan Csomor
c1158f7b91 avoiding crashes on osx during app shutdown
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55518 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-09-07 20:36:41 +00:00
Vadim Zeitlin
24f86c43c4 implement Empty() using clear() instead of Truncate(0)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55502 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-09-06 22:19:42 +00:00
Vadim Zeitlin
e810df36b3 access TLS cache variable directly and not via a helper function when using compiler with native TLS support to work around an apparent bug in g++
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55501 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-09-06 22:12:04 +00:00
Paul Cornett
1224b8a386 silence warning with GCC -Wextra
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55400 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-08-31 23:48:33 +00:00
Vadim Zeitlin
8c3b65d941 rename ShowCacheStats to wxStrCacheStatsDumper
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55395 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-08-31 15:07:12 +00:00