aboutsummaryrefslogtreecommitdiff
path: root/common/array.h
AgeCommit message (Collapse)Author
2018-05-10COMMON: Use nullptr instead of NULL or 0 where appropriateBastien Bouclet
2017-10-06COMMON: Allow construction of Arrays of non-copyable membersColin Snover
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-06COMMON: Switch to compile-time checking of invalid SortedArray callsColin Snover
Runtime error detection is error-prone and unnecessary.
2017-09-30COMMON: Add standard data method to Common::ArrayColin Snover
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-30COMMON: Add standard count & count+copy array constructorsColin Snover
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).
2016-06-04COMMON: Fixed SortedArray implementationEugene Sandulenko
2016-05-23COMMON: Fix another warning.Eugene Sandulenko
We're shadowing the class variables with local ones.
2016-05-23COMMON: Remove const qualifiers.Eugene Sandulenko
We have to cast it back to void *, which loses const qualifier
2016-05-23COMMON: Fix warningEugene Sandulenko
2016-05-23COMMON: Fix SortedArray implementation for empty arrayEugene Sandulenko
2016-05-22COMMON: Fix SortedArray implementation.Eugene Sandulenko
Had to use a modified bsearch for finding the nearest element.
2016-05-22COMMON: Implement SortedArrayEugene Sandulenko
2016-02-18COMMON: Add methods for inserting and erasing with iteratorsColin Snover
This provides improved feature parity to Common::List and is used in SCI32 engine.
2014-02-18COMMON: Make GPL headers consistent in themselves.Johannes Schickel
2012-09-26JANITORIAL: Remove trailing whitespaces.Johannes Schickel
Powered by: git ls-files "*.cpp" "*.h" "*.m" "*.mm" | xargs sed -i -e 's/[ \t]*$//'
2012-02-22COMMON: Slight formatting fixes in array.h.Johannes Schickel
2012-02-22COMMON: Add a size_type to Array and take advantage of it.Johannes Schickel
size_type is an unsigned integer type and is used for all indices etc.
2011-11-16COMMON: Improve storage management of Array.Johannes Schickel
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-08-07COMMON: Correct error message.Christoph Mallon
The message displays bytes, but capacity is the count of objects, so multiply by their size.
2011-08-07COMMON: Use correct format specifier.Christoph Mallon
2011-08-07COMMON: Remove superfluous Common:: qualifiers.Christoph Mallon
2011-06-15COMMON: Fix code formatting, rename stuff for consistencyMax Horn
2011-06-15COMMON: fixed resizeVladimir
2011-06-15COMMON: added assign(T*, T*)Vladimir
2011-05-16COMMON: Fix inserting an array into itself under certain conditionsMax Horn
2011-05-16COMMON: Don't allocate zero-sized storage in arrayWillem Jan Palenstijn
2011-05-16COMMON: Unify Array memory allocationMax Horn
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-16COMMON: Change Array::insert_aux to immediately assign newly allocated ↵Max Horn
memory to _storage
2011-05-16COMMON: Set _capacity to just _size in Common::Array::operator=Max Horn
2011-05-12GIT: Clean up: Suppress SVN tags, now uselessstrangerke
2010-10-12JANITORAL: Clean trailing whitespaces.Jordi Vilalta Prat
svn-id: r53160
2010-10-03SCI: Allow multiple word groups in parserWillem Jan Palenstijn
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
2009-10-19Added operator== and != to Common::ArrayMax Horn
svn-id: r45247
2009-07-13Unify PS2 and non-PS2 alloc code in Common::Array code (if this causes ↵Max Horn
regressions somewhere, we better find a fix that also works on PS2) svn-id: r42455
2009-07-12Added a temporary work-around for PS2 backend in common/array.hMax Lingua
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-05-26Fixed a bug in Common::Array (including a unit test for it), and changed the ↵Max Horn
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-10Changed Common::Array::resize() to default init new array elementsMax Horn
svn-id: r40430
2009-05-05COMMON: Changed Array destructor to reset _storage and _size to 0 -- this ↵Max Horn
helps to find 'Array used after being disposed' bugs svn-id: r40326
2009-05-04COMMON: Made Array::resize() init/zero the memory it allocatesMax Horn
svn-id: r40304
2009-05-03COMMON: Check for failed memory allocations; changed Common::String to use ↵Max Horn
new/delete instead of malloc/free svn-id: r40291
2009-05-03COMMON: Changed Array::resize to not shrink the internal storage if we ↵Max Horn
shrink the array svn-id: r40262
2009-04-27COMMON: Improved efficiency of some Common::List methods; added more unit ↵Max Horn
tests and some doxygen comments for Common::List and Common::Array svn-id: r40164
2009-04-27COMMON: Made sure Common::List and Common::array each have all ↵Max Horn
front/back/push_back/push_front, as have their STL counterparts svn-id: r40163
2009-04-22COMMON: changed class StringList to a simple typedef; enhanced the ↵Max Horn
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-20COMMON & TESTS: Added new constructor to Array<T>, namely Array(const T* ↵Max Horn
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
2008-08-20Unified member names in container/storage classes Array, HashMap and String: ↵Max Horn
_storage, _size, _capacity svn-id: r34052
2008-05-07Proper delete[] formatting (this time all occurences should've been changed...)Johannes Schickel
svn-id: r31929
2008-05-03Formatting.Johannes Schickel
svn-id: r31852
2008-04-14Removed Common::Array::contains()Max Horn
svn-id: r31501
2008-02-27Added Array::resize() methodMax Horn
svn-id: r30983