Commit Graph

86 Commits

Author SHA1 Message Date
richiesams
e1ff60da7a COMMON: Add erase method to String class 2013-06-20 15:40:25 -05:00
Christoph Mallon
84220d2ca0 COMMON: Remove superfluous Common:: qualifiers. 2011-08-07 15:19:07 +02:00
Max Horn
e792adb1b8 COMMON: Add vformat() function (Common::String analog to vsprintf) 2011-06-18 01:36:15 +02:00
Max Horn
e06ca6560f COMMON: Move scumm_str(n)icmp declaration to str.h 2011-05-31 14:19:25 +02:00
Matthew Hoops
eea482fa43 ALL: behaviour -> behavior 2011-05-25 10:50:46 -04:00
strangerke
69b1485a22 GIT: Clean up: Suppress SVN tags, now useless 2011-05-12 01:16:22 +02:00
Jordi Vilalta Prat
d5a4f554af ALL: Fix a few typos
svn-id: r54716
2010-12-01 20:03:05 +00:00
Max Horn
e27b05ef35 COMMON: Rename String::printf() to String::format()
This is a first step towards getting rid of all uses of regular printf,
fprintf, vprintf, vfprintf, puts, fputs, etc. in our codebase.

The name format() reflects the purpose of the function, and parallels
String.format() in Java, boost::format, and others.

svn-id: r54004
2010-11-01 16:02:28 +00:00
Eugene Sandulenko
f7645fea45 Revert "COMMON: Implement Common::vprintf(). Patch by littleboy"
svn-id: r53586
2010-10-18 20:20:14 +00:00
Eugene Sandulenko
4b5640883c COMMON: Implement Common::vprintf(). Patch by littleboy
svn-id: r53576
2010-10-18 19:04:41 +00:00
Willem Jan Palenstijn
a3202eab7c Note Common::String's behaviour may be undefined with \0 characters.
Also make operator=(char) and String(char) behave the same.

svn-id: r50712
2010-07-05 21:29:52 +00:00
Johannes Schickel
9521f8d008 Typo fixes.
svn-id: r49324
2010-05-30 13:41:40 +00:00
Johannes Schickel
f02e31f2fc Fix non-const version of Common::String::begin.
Common::String::begin now assures the storage is a unique one, i.e. there are
no other Common::String objects pointing at it. This allows for safe use of
the writable iterators (and thus fixes the test case added with my last commit)

svn-id: r49323
2010-05-30 13:10:44 +00:00
Johannes Schickel
388e4b65bf Add a custom implementation of OpenBSD's strlcat and strlcpy.
This includes both an implementation and some basic unit tests for
the above mentioned functions.

svn-id: r48953
2010-05-05 17:52:59 +00:00
Max Horn
c934642bdb COMMON: Move typedef StringList from str.h to new header str-array.h
This removes the dependency on array.h from str.h.
Also, begun migration from the confusing type name "StringList" to
the more appropriate StringArray.

svn-id: r48282
2010-03-18 15:09:24 +00:00
Max Horn
30c84d2cff COMMON: Move tag2str from util.h to str.h
svn-id: r48281
2010-03-18 15:07:48 +00:00
Johannes Schickel
5278b82f33 Slight formatting fixes to comply to our coding guidelines.
svn-id: r47744
2010-01-31 10:22:09 +00:00
Max Horn
b0e02675e7 Get rid of Common::String::emptyString, and also of some port specific hackery (getting rid of certain global C++ objs)
svn-id: r46781
2009-12-30 23:01:36 +00:00
Johannes Schickel
75113ad5f3 COMMON: Add "ignoreCase" parameter to matchString.
svn-id: r44265
2009-09-23 00:14:06 +00:00
Willem Jan Palenstijn
744112ceb0 Add Common::String::printf to format a string
svn-id: r42743
2009-07-25 10:25:57 +00:00
Max Horn
a39048877a Added some new method variants to Common::String
svn-id: r41333
2009-06-07 13:04:03 +00:00
Max Horn
c91a6c97ae Clarified docstring for String::insertChar
svn-id: r40382
2009-05-08 12:37:28 +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
Johannes Schickel
a9e424f177 Formatting.
svn-id: r39789
2009-04-01 13:59:53 +00:00
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
0d34b772a4 Fixed a nasty bug in SearchManager::addDirectory; made the 'char' constructor of Common::String explicit, to avoid such bugs in the future
svn-id: r34660
2008-09-27 18:34:24 +00:00
Max Horn
a408f4a776 Changed builtin Common::String capacity to 24 (on 32 bit systems), to make sizeof(String) 32; reduces overall memory req by 200k on my system; overall # of mallocs after this + the refcount memory pool change is almost unchanged
svn-id: r34644
2008-09-24 20:35:31 +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
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
Johannes Schickel
df5c0b6d0c And for all of those who love recompiling most of ScummVM... fixed typo properly :-P
svn-id: r34188
2008-08-26 13:56:58 +00:00
Johannes Schickel
61f750832a Fixed typo. (Thanks to salty-horse for spotting it).
svn-id: r34187
2008-08-26 13:51:26 +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
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
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
Max Horn
7e1ba4732e Dropped superfluous 'virtual' keyword (saves us a few bytes for each String)
svn-id: r31327
2008-03-30 12:44:05 +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
Jordi Vilalta Prat
d6c34bdc4b Fixed the spaces before tabs.
svn-id: r30667
2008-01-28 00:14:17 +00:00
Jordi Vilalta Prat
66e9d4f5e8 Removed trailing spaces.
svn-id: r30664
2008-01-27 19:47:41 +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
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
bd49091afd Added new equals(IgnoreCase) and compareTo(IgnoreCase) methods to class String
svn-id: r23633
2006-07-30 12:17:51 +00:00
Max Horn
6d0a06463a Lazily allocate _refCount in class String
svn-id: r22935
2006-06-05 17:36:08 +00:00