Bastien Bouclet
955e18c648
COMMON: Use nullptr instead of NULL or 0 where appropriate
2018-05-10 08:35:46 +02:00
Colin Snover
f037d4df16
COMMON: Allow construction of Arrays of non-copyable members
...
Although the previous count-constructor would never make a copy of
a member at runtime, Array<T>::reserve *may* copy-construct, so
the compiler would forbid creation of arrays of NonCopyable objects
even when the array was created only once and then never resized
(and thus never actually tried to perform a copy-construction).
2017-10-06 22:10:50 -05:00
Colin Snover
5e2e6e9e8a
COMMON: Switch to compile-time checking of invalid SortedArray calls
...
Runtime error detection is error-prone and unnecessary.
2017-10-06 22:10:49 -05:00
Colin Snover
4938d5cc76
COMMON: Add standard data method to Common::Array
...
This matches the C++11 std::vector method of the same name, and
replaces usage of taking the address of the first element of an
array by &array[0] or &array.front() or &*array.begin(). The data
method is better than these usages because it can be used even
when the array is empty.
2017-09-30 11:17:53 +02:00
Colin Snover
c867a1834f
COMMON: Add standard count & count+copy array constructors
...
These are additions to match C++11 std::vector common init
patterns, to make Common::Array cover more common use cases where
C-style arrays are currently used (and should not be).
2017-09-30 11:17:53 +02:00
Eugene Sandulenko
603fccf74b
COMMON: Fixed SortedArray implementation
2016-06-04 13:50:15 +02:00
Eugene Sandulenko
cdbf10ca81
COMMON: Fix another warning.
...
We're shadowing the class variables with local ones.
2016-05-23 22:47:03 +02:00
Eugene Sandulenko
c383ed4104
COMMON: Remove const qualifiers.
...
We have to cast it back to void *, which loses const qualifier
2016-05-23 22:44:36 +02:00
Eugene Sandulenko
419211733e
COMMON: Fix warning
2016-05-23 22:41:21 +02:00
Eugene Sandulenko
3d89af272b
COMMON: Fix SortedArray implementation for empty array
2016-05-23 16:36:34 +02:00
Eugene Sandulenko
a6fd06074d
COMMON: Fix SortedArray implementation.
...
Had to use a modified bsearch for finding the nearest element.
2016-05-22 22:59:41 +02:00
Eugene Sandulenko
cc54c7723c
COMMON: Implement SortedArray
2016-05-22 22:12:59 +02:00
Colin Snover
7d54f0aaaf
COMMON: Add methods for inserting and erasing with iterators
...
This provides improved feature parity to Common::List and is used
in SCI32 engine.
2016-02-18 13:18:01 -06:00
Johannes Schickel
854e22b38b
COMMON: Make GPL headers consistent in themselves.
2014-02-18 02:39:33 +01:00
Johannes Schickel
89abab97e3
JANITORIAL: Remove trailing whitespaces.
...
Powered by:
git ls-files "*.cpp" "*.h" "*.m" "*.mm" | xargs sed -i -e 's/[ \t]*$//'
2012-09-26 04:17:55 +02:00
Johannes Schickel
417cd7625c
COMMON: Slight formatting fixes in array.h.
2012-02-22 20:00:11 +01:00
Johannes Schickel
d6ac369303
COMMON: Add a size_type to Array and take advantage of it.
...
size_type is an unsigned integer type and is used for all indices etc.
2012-02-22 19:59:26 +01:00
Johannes Schickel
f14eba23d9
COMMON: Improve storage management of Array.
...
Now our Array class distinguishs between initialized and uninitialized
objects. It furthermore always calls the destructor of no longer contained
elements. This should help with non-POD objects stored in our Array class.
Thanks to Bertrand for his feedback on this.
2011-11-16 19:28:02 +01:00
Christoph Mallon
c876e87efc
COMMON: Correct error message.
...
The message displays bytes, but capacity is the count of objects, so multiply by their size.
2011-08-07 15:19:07 +02:00
Christoph Mallon
79729d03e0
COMMON: Use correct format specifier.
2011-08-07 15:19:07 +02:00
Christoph Mallon
84220d2ca0
COMMON: Remove superfluous Common:: qualifiers.
2011-08-07 15:19:07 +02:00
Max Horn
7be9a57524
COMMON: Fix code formatting, rename stuff for consistency
2011-06-15 23:21:54 +02:00
Vladimir
e4c9ae7a54
COMMON: fixed resize
2011-06-15 17:30:43 +02:00
Vladimir
e3178397ce
COMMON: added assign(T*, T*)
2011-06-15 17:29:52 +02:00
Max Horn
88319a727a
COMMON: Fix inserting an array into itself under certain conditions
2011-05-16 15:23:17 +02:00
Willem Jan Palenstijn
ffd0b20af7
COMMON: Don't allocate zero-sized storage in array
2011-05-16 14:44:45 +02:00
Max Horn
9081ab4402
COMMON: Unify Array memory allocation
...
We also change how alloc failures are handled: Instead of using
assert(), which is usually disabled in release builds on various
platforms, we now *always* catch this situation and invoke error() if
necessary.
2011-05-16 14:22:54 +02:00
Max Horn
eedb2d721f
COMMON: Change Array::insert_aux to immediately assign newly allocated memory to _storage
2011-05-16 13:58:59 +02:00
Max Horn
85d5eec950
COMMON: Set _capacity to just _size in Common::Array::operator=
2011-05-16 13:50:06 +02:00
strangerke
69b1485a22
GIT: Clean up: Suppress SVN tags, now useless
2011-05-12 01:16:22 +02:00
Jordi Vilalta Prat
8388e0dfea
JANITORAL: Clean trailing whitespaces.
...
svn-id: r53160
2010-10-12 02:18:11 +00:00
Willem Jan Palenstijn
f98536eef5
SCI: Allow multiple word groups in parser
...
In SCI01 and up, each typed word may be interpreted as multiple
class,group pairs. This patch adds support to the vocabulary and
parser. It uses the matcher support added in r52985.
This fixes parser issues in German LSL3, but needs testing.
svn-id: r52989
2010-10-03 10:49:42 +00:00
Max Horn
4d43c8a121
Added operator== and != to Common::Array
...
svn-id: r45247
2009-10-19 17:46:50 +00:00
Max Horn
3ed4f388d7
Unify PS2 and non-PS2 alloc code in Common::Array code (if this causes regressions somewhere, we better find a fix that also works on PS2)
...
svn-id: r42455
2009-07-13 22:08:56 +00:00
Max Lingua
13a1dc0a58
Added a temporary work-around for PS2 backend in common/array.h
...
cause its vintage compiler does not support "new T[newCapacity]()"
but only "new T[newCapacity]", this will let it compile through.
It's ifdef'd as __PLAYSTATION2__, so it won't make a difference
for other backends with more modern tools.
svn-id: r42402
2009-07-12 05:34:46 +00:00
Max Horn
94dfc8f638
Fixed a bug in Common::Array (including a unit test for it), and changed the way the internal storage growth over time.
...
The bug could result in incorrect results when using push_back (or insert_at)
to insert data from an array into itself if this insertions would cause the
internal array storage to grow. Also added a unit test for this bug.
Furthermore, if the internal storage needs to grow, it will now be resized to the next power of two,
instead of being increased by 32.
svn-id: r40907
2009-05-26 11:28:38 +00:00
Max Horn
36818ced2a
Changed Common::Array::resize() to default init new array elements
...
svn-id: r40430
2009-05-10 19:17:11 +00:00
Max Horn
61dcaad888
COMMON: Changed Array destructor to reset _storage and _size to 0 -- this helps to find 'Array used after being disposed' bugs
...
svn-id: r40326
2009-05-05 12:29:15 +00:00
Max Horn
689511a56f
COMMON: Made Array::resize() init/zero the memory it allocates
...
svn-id: r40304
2009-05-04 15:04:39 +00:00
Max Horn
882c24d2ee
COMMON: Check for failed memory allocations; changed Common::String to use new/delete instead of malloc/free
...
svn-id: r40291
2009-05-03 22:45:31 +00:00
Max Horn
4d57c1f9a9
COMMON: Changed Array::resize to not shrink the internal storage if we shrink the array
...
svn-id: r40262
2009-05-03 09:00:53 +00:00
Max Horn
7f20f3bb3e
COMMON: Improved efficiency of some Common::List methods; added more unit tests and some doxygen comments for Common::List and Common::Array
...
svn-id: r40164
2009-04-27 14:25:16 +00:00
Max Horn
e579f91b5c
COMMON: Made sure Common::List and Common::array each have all front/back/push_back/push_front, as have their STL counterparts
...
svn-id: r40163
2009-04-27 14:23:20 +00:00
Max Horn
b98f79fe12
COMMON: changed class StringList to a simple typedef; enhanced the Common::Array constructor which converts regular arrays to Array objects to be more flexible in its type (allows e.g. to assign an array of char* to a StringList
...
svn-id: r40077
2009-04-22 17:52:56 +00:00
Max Horn
78cf5a4ccf
COMMON & TESTS: Added new constructor to Array<T>, namely Array(const T* data, int n), which makes it possible to clone a regular array into a Common::Array; added a unit test for that and slightly extended existing Common::Array unit tests
...
svn-id: r40027
2009-04-20 19:27:11 +00:00
Max Horn
a79e9385a1
Unified member names in container/storage classes Array, HashMap and String: _storage, _size, _capacity
...
svn-id: r34052
2008-08-20 11:07:16 +00:00
Johannes Schickel
311e9165ed
Proper delete[] formatting (this time all occurences should've been changed...)
...
svn-id: r31929
2008-05-07 15:09:10 +00:00
Johannes Schickel
db04dd427d
Formatting.
...
svn-id: r31852
2008-05-03 23:02:05 +00:00
Max Horn
805f21e369
Removed Common::Array::contains()
...
svn-id: r31501
2008-04-14 12:11:10 +00:00
Max Horn
142a39da22
Added Array::resize() method
...
svn-id: r30983
2008-02-27 14:06:06 +00:00