Commit Graph

127 Commits

Author SHA1 Message Date
Paul Cornett
a3598ba33f Remove unnecessary copy ctors/copy assignment operators
C++11 deprecates having one without the other.
Eliminates many, many GCC -Wdeprecated-copy warnings.
2019-10-14 09:07:21 -07:00
Vadim Zeitlin
664b8c153f Don't export sorted dynamic arrays from the shared library
This shouldn't be necessary and doing it seems to result in duplicate
symbol errors when using MSVC under some not completely elucidated
circumstances.

See https://github.com/utelle/wxpdfdoc/pull/48

Closes https://github.com/wxWidgets/wxWidgets/pull/1013
2018-11-10 12:17:53 +01:00
Vadim Zeitlin
26b4701ebd Define wxShrinkToFit() helper for wxVector<>
Unlike member shrink_to_fit(), this function is always defined, even
when wxVector is pre-C++11 std::vector<>.
2018-09-17 23:19:23 +02:00
Vadim Zeitlin
02ffdd16f6 Fix using WX_DECLARE_OBJARRAY() with pointer types
While this doesn't make, and never made, any sense (pointers should be
stored in a plain, non-object array), we still should continue to
support it for compatibility.

Fix the problem introduced by 97684a9267
by writing "T const&" instead of "const T&" as the latter didn't have
the same meaning when the macro parameter "T" expanded into "U*" as
"const" applied to "U", making this type incompatible with the actual
one.

Also extend the unit test to check for this.
2018-07-15 14:48:08 +02:00
Vadim Zeitlin
b227875f98 Remove CMPFUNC##T definition from WX_DECLARE_OBJARRAY macro
It is unnecessary and fails to compile when "T" is not an identifier
(but e.g. a pointer type).
2018-07-15 14:38:01 +02:00
Vadim Zeitlin
93edcaef20 Fix wrong function pointer casts in dynamic arrays code
Don't cast function pointers of incompatible types, this resulted in gcc
8 -Wcast-function-type warnings and could hide real errors.

To fix this, overload wxBaseArray::Sort() to accept either the "legacy"
sort function compatible with qsort() or a function compatible with
std::sort(), as it seems both variants could be used before. Also make
the type of the latter function customizable via a new optional Sorter
template parameter in wxBaseArray in order to allow wxSortedArrayString
to specify its own variant of it, taking (const) references instead of
values.

This complicates things, but should preserve compatibility while being
type-safe and, also, allows to simplify _WX_DEFINE_SORTED_TYPEARRAY_2 by
not passing the sort function signature to it any more.
2018-06-10 23:51:13 +02:00
Vadim Zeitlin
546604ab55 Fix wrong function pointer casts in dynamic arrays code
Don't cast function pointers of incompatible types, this resulted in gcc
8 -Wcast-function-type warnings and could hide real errors.

Use normal, taking elements by value, sort function for in wxBaseArray
methods used by the sorted arrays only and provide Sort() overloads for
both this sort function variant and the compatible with qsort() one
taking pointers to the elements.
2018-06-03 23:27:38 +02:00
Vadim Zeitlin
0e99ab2c49 Use template functions instead of WX_XXX_ARRAY() macros
Trivially rewrite macros as functions.

No real changes.
2018-06-03 17:12:12 +02:00
Vadim Zeitlin
97684a9267 Replace object array macros with template class too
Put the code implementing object arrays, i.e. arrays owning pointers to
the objects, into wxBaseObjectArray<> instead of _WX_DECLARE_OBJARRAY
macro.

Also simplify WX_DEFINE_OBJARRAY() by leaving only the definitions of
functions creating and destroying the objects in it (they have to be
there and not in the template itself to allow using template with
incomplete classes).
2018-06-03 17:12:12 +02:00
Vadim Zeitlin
aaa9c80d66 Replace most of _WX_DEFINE_SORTED_TYPEARRAY_2 with template too
Add wxBaseSortedArray<> template instead of putting all the code inside
_WX_DEFINE_SORTED_TYPEARRAY_2 macro.

There should be no changes, but the code is now easier to read and
modify.
2018-06-03 17:12:12 +02:00
Vadim Zeitlin
b0d6b11ebe Always use wxVector<> for dynamic arrays implementation
Dramatically simplify dynamic array macros by keeping only the
implementation previously used in wxUSE_STD_CONTAINERS case and dropping
the other one, as we can use the std::vector-based implementation on top
of our own wxVector<>, which is available whether wxUSE_STD_CONTAINERS
is 0 or 1.

This allows to get rid of tons of ugly macro-based code without breaking
compatibility.
2018-06-02 13:56:06 +02:00
Vadim Zeitlin
9042a3fb16 Use shrink_to_fit() to implement Shrink() in C++11 build
If std::vector<> has shrink_to_fit() method, just use it instead of
using the swap-with-a-temporary hack.
2018-06-01 01:47:40 +02:00
Vadim Zeitlin
f9721266ae Replace 90% of _WX_DECLARE_BASEARRAY_2 with a template class
Use template class instead of a macro to make it easier to read and
modify this code.

No real changes.
2018-05-31 23:39:39 +02:00
Vadim Zeitlin
724409a10c Simplify wxSortedArray_SortFunction used in STL build
There is no need to pass the function type as the template parameter as
it's determined by the type of the objects being compared anyhow.
2018-05-31 19:47:08 +02:00
Vadim Zeitlin
c4907129f4 Don't export container classes from DLLs when using STL containers
Exporting these classes doesn't seem necessary as they only have inline
functions and doing it results in problems with MSVC as it also, apparently,
exports the corresponding specialization of std::vector<T> from the wxWidgets
DLLs which can clash with the use of std::vector<T> in the user code or even
in 3rd party libraries included in wx itself, such as Scintilla, so this
change fixes link errors in "DLL Debug" build configuration when using MSVC.

Closes #10884.
2016-02-26 13:10:59 +01: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
41da7d974a Add ctor from two input iterators to wxArray in STL build too.
This ctor already existed in non-STL build but was omitted from the STL
version.

Closes #15216.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74044 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-05-22 14:13:22 +00:00
Vadim Zeitlin
bed4928779 Allow shrinking the array with wxArray::resize().
This method did nothing if its argument was less than the current array size,
as it was just a synonym for SetSize() which was documented to behave like
this, but this was inconsistent with std::vector and wxVector resize() which
does shrink the array, so change wxArray version to shrink it too.

Closes #15195.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73986 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-05-15 13:05:40 +00:00
Václav Slavík
12a7fb5f0b Fix wxArray::Index() with bFromEnd=true in STL build.
This function incorrectly returned index from the end of the array when
searching from the end. Fixed to work as the non-STL version.

Fixes #13626.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69688 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-11-05 15:20:32 +00:00
Vadim Zeitlin
0287ae5c75 Re-define push_back() in wxSortedArrayString to behave correctly.
Adding items to wxSortedArrayString should always keep them sorted but while
Add() did this, push_back() didn't breaking the class invariant.

Redefine push_back() in _WX_DEFINE_SORTED_TYPEARRAY_2 macro to fix this and
add a unit test checking that wxSortedArrayString::push_back() does work now.

Closes #13134.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67429 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-04-10 15:36:07 +00:00
Dimitri Schoolwerth
d13b34d3f2 No code changes, fixed various typos.
Applied patch by snowleopard2 fixing typos in interface/. Extended the fixes throughout trunk.

Closes #13076.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67384 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-04-03 20:31:32 +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
638205e547 don't use WXDLLIMPEXP_BASE with wx[Sorted]Array_SortFunction, this results in link errors with VC[89] when building a DLL and shouldn't be necessary with any other compilers neither as these classes have only inline methods
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56600 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-10-30 15:57:18 +00:00
Vadim Zeitlin
1372f8ccd0 use wxSwap()
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55650 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-09-15 16:13:06 +00:00
Vadim Zeitlin
b2794028de added swap() for the other arrays too (and now committing the right files)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55551 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-09-11 13:52:48 +00:00
Vadim Zeitlin
35d5da677d get rid of base arrays in wxUSE_STL build, we don't need them there and deriving wxFooPtr from wxBaseArrayPtrVoid makes it iterators return void pointers instead of those of the correct type; added test case to check for this
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54761 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-07-22 01:01:56 +00:00
Francesco Montorsi
53a2db124c substitute WXDLLEXPORT with WXDLLIMPEXP_CORE and WXDLLEXPORT_DATA with WXDLLIMPEXP_DATA_CORE
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52834 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-03-26 15:06:00 +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
Vadim Zeitlin
b1f8bee533 add std::vector-compatible ctors taking array size and array size and initial value for wxUSE_STL==1 too
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49858 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-11-12 13:58:48 +00:00
Vadim Zeitlin
5041b46fed added array(size_t count) ctor initializing the array with count items with default value for compatibility with STL version
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49801 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-11-10 00:53:47 +00:00
Václav Slavík
43de415736 _WX_DECLARE_OBJARRAY was missing reserve() declaration
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48993 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-09-30 10:52:08 +00:00
Václav Slavík
cd64344431 use reserve() instead of Alloc() in WX_APPEND_ARRAY so that it works with std classes too
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48992 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-09-30 10:44:45 +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
Vadim Zeitlin
b4a980f4f5 don't use obsolete functions (mostly copystring() and Count()), remove their documentation (patch 1697956)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45395 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-04-11 00:23:19 +00:00
Vadim Zeitlin
c75cc2e832 avoid warnings about missing macro parameters (only given by VC6 apparently) when building as static library and, hence, having passing expmode parameters to various array definition macros
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43620 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-11-24 00:56:22 +00:00
Vadim Zeitlin
1ffc8d7a55 define arrays of chartoo as the existing ones can't be used to store char values (bug 1572314)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43030 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-11-04 12:51:01 +00:00
Vadim Zeitlin
17cb6ff641 use Alloc() in WX_PRE/APPEND_ARRAY (part of patch 1590194)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43024 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-11-04 12:15:19 +00:00
Włodzimierz Skiba
ce7208d49d Minor header cleaning.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42713 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-10-30 11:56:12 +00:00
Vadim Zeitlin
7788fc4046 Alloc() doesn't clear the array any more, for consistency with reserve()
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42571 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-10-28 14:16:20 +00:00
Robert Roebling
bf7f7793e9 [ 1585253 ] Various important bugfixes to wxFileName::Normalize
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42471 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-10-26 21:08:21 +00:00
Stefan Csomor
87cc1cc772 adding wxArrayDouble for later use in graphics context APIs
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41483 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-09-28 08:00:16 +00:00
Vadim Zeitlin
bf00495160 implemented declared but never defined resize() method
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39025 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-05-04 15:01:37 +00:00
Vadim Zeitlin
17a1ebd101 first round of Intel compiler warning fixes: down from a few thousands just to slightly more than 100
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35688 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2005-09-25 19:59:19 +00:00
Vadim Zeitlin
fbfb8bcc3f added missing consts and pass objects by const reference instead of by value (patch 1205869)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35665 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2005-09-24 21:43:15 +00:00
Mart Raudsepp
8907154c1a Nuke #pragma implementation/interface's
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35650 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2005-09-23 12:56:45 +00:00
Włodzimierz Skiba
222702b112 [ 1216436 ] cleanup 'shadow variable' warnings from gcc in headers.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34597 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2005-06-08 15:17:42 +00:00
Vadim Zeitlin
60d8e88654 iterator methods fixes (patch 1164808)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32876 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2005-03-17 23:19:13 +00:00
Vadim Zeitlin
1d6560d796 reverted last commit, still broken for VC6
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30364 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2004-11-08 14:43:04 +00:00
Vadim Zeitlin
edad629344 don't use wxCOMPILE_TIME_ASSERT2, wxCOMPILE_TIME_ASSERT works for VC++ too now
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30027 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2004-10-20 00:34:40 +00:00