Commit Graph

80 Commits

Author SHA1 Message Date
Max Horn
17014c4f47 Merged internal 'matchPath' method of class Archive into global matchString function (via an optional 'path mode' in the latter). Also changed Archive::listMatchingMembers to use path mode when matching, just like FSDirectory::listMatchingMembers
svn-id: r38277
2009-02-15 18:45:53 +00:00
Jordi Vilalta Prat
b1999a2a16 Fixed indentation and removed whitespaces at the end of line
svn-id: r35481
2008-12-22 11:22:15 +00:00
Max Horn
95474b048a COMMON: Added a new ObjectPool class, with matching operator new/delete overloads
svn-id: r34785
2008-10-12 22:05:26 +00:00
Max Horn
0aa9e6ff4c Ignore String::deleteLastChar when called on an empty string
svn-id: r34718
2008-10-02 17:17:18 +00:00
Max Horn
f9650f0b6a Changed Common::String to use a MemoryPool for its refcounts
svn-id: r34642
2008-09-24 20:29:29 +00:00
Max Horn
bbba275913 Little readability tweak
svn-id: r34615
2008-09-20 15:53:17 +00:00
Max Horn
0dcb30e75c Optimized matchString for the common case where there is a trailing * (if that is the case, abort immediately instead of scanning the rest of the string)
svn-id: r34367
2008-09-05 20:29:03 +00:00
Max Horn
9bf7aa308e Moved matchString from util.* to str.*; added new String::matchString method; fixed matchString doxygen comment (it confused pattern & string); added unit tests for matchString
svn-id: r34364
2008-09-05 20:07:34 +00:00
Max Horn
3cb4cfa06f Fix nasty off-by-one errors
svn-id: r34317
2008-09-03 18:38:01 +00:00
Max Horn
c3d7c908e8 Modified Common::Str to use exponential growth for its storage; also changed the meaning of 'capacity' from 'max length of string' to 'size of storage' (i.e. added one)
svn-id: r34313
2008-09-03 17:39:18 +00:00
Max Horn
155b8606c1 Added two new global funcs which ease proper handling of 'path' strings: Common::lastPathComponent() and Common::normalizePath()
svn-id: r34272
2008-09-02 11:32:38 +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
Max Horn
918e0fe473 Reorder stuff a little bit, moving private String methods together: cleanup
svn-id: r33248
2008-07-23 16:49:45 +00:00
Max Horn
15c610a069 Added convenience method String::makeUnique(); simplified String::operator=(char c); extended String unit tests
svn-id: r33246
2008-07-23 16:33:53 +00:00
Max Horn
d5e2c6d4bf Fix String::trim to work right for shared strings; augemented test cases to cover this
svn-id: r33234
2008-07-23 09:53:29 +00:00
Max Horn
705c92ddc3 Added String::trim() method
svn-id: r33203
2008-07-22 14:39:26 +00:00
Max Horn
c625a6a647 Fixed potential issue in Common::String when asserting a substring of a string X back to X (memcpy -> memmove); also added some other sanity checks, and merged some duplicate code into a new method String::initWithCStr
svn-id: r33137
2008-07-20 16:42:56 +00:00
Max Horn
57ad73faee Removed char &operator [] from class String -- it had the potential to wreak havoc when used on shared strings (thanks to tramboi for pointing this out)
svn-id: r31334
2008-03-30 18:37:09 +00:00
Kari Salminen
b6cad0f0ce Added a simple non-optimized StringTokenizer-class for tokenizing strings. Also added a contains(char)-function to the String-class because it was handy in implementing the StringTokenizer.
svn-id: r30828
2008-02-08 04:11:20 +00:00
Nicola Mettifogo
258901bab9 Merged common/stdafx.h into common/scummsys.h. All referencing files have been updated.
svn-id: r28966
2007-09-19 08:40:12 +00:00
Max Horn
95ba2986d3 Enhanced Common::String by adding char constructor and operator+ for chars
svn-id: r27051
2007-06-02 12:42:40 +00:00
Max Horn
218e132e37 Updated legal headers in source files, based on what Pidgin (the IM client formerly knowns as Gaim) does; added new (incomplete) COPYRIGHT file; updated copyright dates in a few spots
svn-id: r27024
2007-05-30 21:56:52 +00:00
Max Horn
aecd100f93 Added Common::String::contains() method
svn-id: r26514
2007-04-15 18:27:10 +00:00
Max Horn
728d01cb17 Removing some unnecessary #includes
svn-id: r26044
2007-03-09 23:46:45 +00:00
Gregory Montoir
1ce912e106 made rtrim() and ltrim() global functions, to reduce code duplication (it seems parallaction/parser.cpp code re-use them too
svn-id: r25564
2007-02-13 21:06:57 +00:00
Willem Jan Palenstijn
9543231685 replace ensureCapacity(_len-1) by ensureCapacity(_len) (fixes bug #1617410)
svn-id: r24865
2006-12-17 19:41:41 +00:00
Gregory Montoir
b2fb23a134 Changed the way String::_storage is initialised, to help GCC 2.95 (see tracker item #1602879)
svn-id: r24793
2006-11-27 00:51:14 +00:00
Max Horn
a6c3257c5e Rewrote class String to use an internal (stack based) storage for small strings, thus avoiding a couple ten thousand heap allocations
svn-id: r24043
2006-09-30 18:55:38 +00:00
Max Horn
53f73eac85 Added explicit string equals/hash functors to a new header common/hash-str.h; removed Hash functor specialization for String and char pointers; changed all code using hashmaps with string keys to explicitly specify whether they honor or ignore case
svn-id: r23634
2006-07-30 12:21:54 +00:00
Max Horn
bd49091afd Added new equals(IgnoreCase) and compareTo(IgnoreCase) methods to class String
svn-id: r23633
2006-07-30 12:17:51 +00:00
Eugene Sandulenko
5b1aaf4ea0 Patch #1503718: "Strange results from Common::computeCapacity"
svn-id: r22998
2006-06-10 07:56:09 +00:00
Max Horn
6d0a06463a Lazily allocate _refCount in class String
svn-id: r22935
2006-06-05 17:36:08 +00:00
Torbjörn Andersson
2e071b59d6 When ensureCapacity() does not have an old string to copy, make sure the newly
allocated one is terminated. Hopefully this will keep the SCUMM save dialog
from randomly adding garbage to my savegame names.

svn-id: r22908
2006-06-04 09:14:07 +00:00
Max Horn
cbe66f3360 Allocate and grow Common::String objects in multiples of 32, and leave at least 16 spare bytes at the end, in case the string grows a little bit.
svn-id: r22896
2006-06-03 16:33:42 +00:00
Travis Howell
179f097202 Fix mingw compile
svn-id: r22835
2006-06-02 13:34:41 +00:00
Eugene Sandulenko
8c7abdf024 Allocate minimum 16 bytes on String(str) call. Reduces 2.500 malloc() calls
on startup

svn-id: r22834
2006-06-02 13:00:27 +00:00
Max Horn
1f07432927 Fixed evil longstanding bug in String::toLowercase & toUppercase: Before modifying the string content, make sure we do not share it with any other string). This should help (hopefully fix) bug #1470892
svn-id: r21931
2006-04-16 09:12:27 +00:00
Max Horn
eb1459334f Tiny optimization for empty strings, which avoids allocating a single byte just to store an empty string (we pass around empty strings in lots of places)
svn-id: r21892
2006-04-14 22:29:51 +00:00
Max Horn
36934b611d Change CVS keywords to SVN keywords
svn-id: r20510
2006-02-11 09:53:53 +00:00
Eugene Sandulenko
ea42bad781 Update copyright notice
svn-id: r20088
2006-01-18 17:39:49 +00:00
Eugene Sandulenko
edfae828f6 Patch #1341626: "New GP32 port"
svn-id: r19710
2005-11-27 02:35:57 +00:00
Eugene Sandulenko
b36677af71 Update FSF address. Eek. Actually that took place on May 1, 2005
svn-id: r19142
2005-10-18 01:30:26 +00:00
Chris Apers
12f40ae777 PalmOS: cannot use global objects in ARM
svn-id: r18962
2005-10-08 19:07:18 +00:00
Eugene Sandulenko
6b4484472b Remove trailing whitespaces.
svn-id: r18604
2005-07-30 21:11:48 +00:00
Max Horn
8b1d7b9166 When including files from common/, explicitly use the common/ prefix
svn-id: r18444
2005-06-24 15:23:51 +00:00
Max Horn
4e66139a4e Added String::hasSuffix and hasPrefix
svn-id: r16744
2005-02-06 19:00:59 +00:00
Max Horn
fcad363886 Get rid of the ConstString class
svn-id: r16564
2005-01-15 21:42:59 +00:00
Max Horn
47280d9433 Updated copyright
svn-id: r16398
2005-01-01 16:09:25 +00:00
Max Horn
0605918ab4 Small tweaks for the String class
svn-id: r14293
2004-07-21 14:20:37 +00:00
Max Horn
4744538752 Added operator + for strings
svn-id: r14093
2004-06-27 23:58:41 +00:00