Commit Graph

48 Commits

Author SHA1 Message Date
Vadim Zeitlin
c294ad284c Add missing "inline" to std::swap() specialization for wxUniCharRef.
Avoid multiple definitions of this function.

See #16234.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76481 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-05-07 13:43:14 +00:00
Vadim Zeitlin
b445166012 Define std::swap() correctly for wxUniCharRef.
The default implementation doesn't work for this reference-like class, and
this breaks not only swap() itself (see #14694), but also any algorithms using
it, such as std::reverse().

Fix this by providing our own specialization which does work correctly.

Closes #16234.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76474 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-05-07 13:09:40 +00:00
Paul Cornett
1e35c3b915 Silence warnings in headers with MSC -W4
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75014 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-10-16 16:45:53 +00:00
Vadim Zeitlin
3f66f6a5b3 Remove all lines containing cvs/svn "$Id$" keyword.
This keyword is not expanded by Git which means it's not replaced with the
correct revision value in the releases made using git-based scripts and it's
confusing to have lines with unexpanded "$Id$" in the released files. As
expanding them with Git is not that simple (it could be done with git archive
and export-subst attribute) and there are not many benefits in having them in
the first place, just remove all these lines.

If nothing else, this will make an eventual transition to Git simpler.

Closes #14487.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74602 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-07-26 16:02:46 +00:00
Václav Slavík
17473a770a Fix lots of warnings reported by Clang.
Mostly potentially lossy implicit conversions in headers (long->int). Also dangling else warnings. Struct/class mismatches.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74473 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-07-10 16:41:34 +00:00
Vadim Zeitlin
622bc15f11 Add conversions to/from long long to wxUniChar.
Allow conversions to/from long long and unsigned long long values in wxUniChar
for consistency with the other integral types.

Also make the code shorter by using helper wxDO_FOR_INT_TYPES() and
wxDO_FOR_CHAR_INT_TYPES() macros to avoid duplicating the same code for all of
the integral types and having to handle wchar_t (and wxLongLong_t now)
specially because sometimes we may need to overload on it and sometimes not.

Finally, add more tests to check that all the wxUniChar methods compile and
work with all the different types.

Closes #15206.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74029 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-05-19 12:38:12 +00:00
Vadim Zeitlin
6d93e28adf Fix comparisons of char and wchar_t with wxUniChar[Ref].
Comparisons didn't work correctly in the other direction as they were not
reversed as needed. Fix this by adding wxDEFINE_COMPARISON_REV() macro which
defines comparisons in terms of the reverse operations and use it for both
wxUniChar and wxUniCharRef.

Closes #14547.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72268 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-07-31 16:49:36 +00:00
Vadim Zeitlin
874dbd3a4a Allow calling wxStrchr() with a narrow string and wide character.
Calls to wxStrchr(char-string, wide-char) would previously fail if wide
character couldn't be converted to a single character in the current locale
encoding. Change it to simply return NULL in this case as it's a safe and
useful generalization: a narrow string will never contain a wide character not
representable in the current locale.

Add wxUniChar::GetAsChar() to help with implementing this.

Closes #11487.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62738 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-11-28 14:37:03 +00:00
Vadim Zeitlin
5c69ef61f3 fix some of icc 11.0 warnings and disable a few others
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56792 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-11-16 14:24:13 +00:00
Václav Slavík
22188d7396 pch-less compilation fix for r55285
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55286 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-08-26 13:29:38 +00:00
Václav Slavík
6bd4f2812d fixed writing to wxUniCharRef after its 'parent' iterator was destroyed
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55285 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-08-26 13:02:38 +00:00
Paul Cornett
162e998c2f check for self-assignment in operator=
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51123 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-01-09 04:08:33 +00:00
Václav Slavík
a4535b9f39 don't attempt to convert 8bit values to Unicode in ANSI build
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48060 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-08-13 18:48:58 +00:00
Vadim Zeitlin
ce65118e62 make To/From8bit() inline for performance reasons
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47578 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-07-20 01:10:22 +00:00
Václav Slavík
b5dbe15d0b added WXDLLIMPEXP_FWD_FOO macros in addition to WXDLLIMPEXP_FOO for use with forward declarations (in preparation for GCC visibility support)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47254 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-07-09 10:09:52 +00:00
Václav Slavík
c5cf866314 removed wxWCHAR_T_IS_SEPARATE_TYPE: there already was wxWCHAR_T_IS_REAL_TYPE with the exact same meaning and definition
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47230 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-07-08 07:04:38 +00:00
Václav Slavík
c2d122aa7d added missing wxUniChar::operator=(wxUniCharRef)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47194 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-07-06 12:40:36 +00:00
Václav Slavík
d4e5987995 explicitly cast m_value to the resulting type in wxUniChar's integer conversion operators to silence compiler warnings
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47053 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-07-01 12:32:10 +00:00
Václav Slavík
4d62edfb07 wxUniChar wchar_t handling fixes for Borland, DMC and Watcom compilers
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47028 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-06-29 19:11:09 +00:00
Václav Slavík
21f0762a1a fixes to wint_t and wchar_t handling in unichar.h (fixes FreeBSD compilation and Mingw compilation with -pedantic)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46967 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-06-26 20:44:58 +00:00
Václav Slavík
13f071c06b include wxUniCharRef::operator&& unconditionally too, not just wxUniChar one
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46960 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-06-26 14:36:06 +00:00
Vadim Zeitlin
8019a67305 remove #if around operator&&(), its needed for other compilers too (Sun CC 5.9) and doesnt seem to hurt the ones which do not need it
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46656 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-06-22 20:27:07 +00:00
Vadim Zeitlin
be3dcfb31a Sun CC (at least version 5.9) has wint_t as a separate type too
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46628 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-06-22 13:59:48 +00:00
Václav Slavík
4e5b3a4eb5 added long int operators to wxUniChar (fixes wxMac compilation)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46404 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-06-11 12:16:14 +00:00
Václav Slavík
1fc10687bf added wxUniChar::AsUTF8() for easy conversion in UTF8 build
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46376 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-06-08 20:17:34 +00:00
Václav Slavík
2c6725e622 restored accidentally commented-out code
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46069 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-05-16 13:42:23 +00:00
Václav Slavík
db18be5792 added missing operators for int and unsigned char
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46048 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-05-15 15:02:31 +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
Vadim Zeitlin
fddca1dce4 djgpp doesn't have wint_t as separate type
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46027 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-05-14 23:21:40 +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
bc5443ba07 fixed wxUniCharRef::IsAscii() definition
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45452 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-04-14 10:45:58 +00:00
Václav Slavík
47b378bd88 removed extra semicolons (patch #1700459; fixes compilation with gcc's -pedantic flag)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45450 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-04-14 09:58:37 +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
Vadim Zeitlin
153bc803a8 add conversion of wxUniChar[Ref] to unsigned int if it's not already covered by conversion to wint_t
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45291 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-04-06 23:16:00 +00:00
Václav Slavík
9cea4218b1 wint_t is wchar_t on OS/2 too
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45195 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-04-01 08:04:32 +00:00
Václav Slavík
171d613212 added creation of wxUniChar from int and conversion to int, for backward compatibility
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45123 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-03-29 18:35:16 +00:00
Vadim Zeitlin
436bb9f539 added overloads of operators for wint_t for VC when the code is compiled with /Zc:wchar_t option (default in VC8)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45112 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-03-29 15:05:34 +00:00
Václav Slavík
a7ea63e21f split string.{h,cpp} into {string,stringimpl,arrstr}.{h,cpp} to make the files more managable
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45098 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-03-28 11:35:07 +00:00
Václav Slavík
a962cdf410 re-enabled using std::string for wxStringImpl if wxUSE_STL again
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45095 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-03-28 09:37:34 +00:00
Vadim Zeitlin
c961c0cfca fixed compilation for Windows compilers now after last change: replaced conversions to ushort and uint with a conversion to wint_t but do it for (non-Apple) gcc only
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45037 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-03-23 15:16:08 +00:00
Vadim Zeitlin
2a686bd333 added conversions to unsigned short: this fixes compilation for some platforms where wint_t is ushort (mingw32)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45036 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-03-23 15:00:12 +00:00
Vadim Zeitlin
98c4eb3910 remove wxWINT_T_IS_TYPEDEF as it seems wint_t is always a typedef (although it can be either unsigned short or unsigned int or possibly something else)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45023 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-03-22 19:13:50 +00:00
Vadim Zeitlin
fb52c2b671 added macros to avoid code repetition when defining comparison operators; use them to replace existing operators in wxUniChar and wxUniCharRef (fixing bug in the operator== and != of the latter) and added comparison operators for const wxChar * and wxCStrData which are needed to compile existing code comparing pointers with s.c_str()
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45019 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-03-22 18:03:02 +00:00
Vadim Zeitlin
bd72306dc8 added conversion to unsigned int too: this is needed to be able to pass s[n] to standard toxxx/isyyy() functions under Windows when _MBCS is defined as they're mapped to _mbzzz(unsigned int) in this case
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45016 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-03-22 15:24:28 +00:00
Václav Slavík
9f1b1b78e1 added wxUniChar <-> unsigned char conversion
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44976 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-03-20 15:49:45 +00:00
Václav Slavík
dbecee02ed use wxUin32 for wxUniChar::value_type: we need 32bit for it regardless of the platform
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44941 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-03-19 16:22:11 +00:00
Václav Slavík
d1b7ed6792 wxUniChar::unicode_type -> value_type
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44940 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-03-19 16:17:37 +00:00
Václav Slavík
e3f6cbd99c split wxchar.h into several smaller headers
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44927 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-03-19 14:45:38 +00:00