Commit Graph

29 Commits

Author SHA1 Message Date
David A. Mellis 95b51c7728 Fixing warnings (unsigned comparisons to 0). (maniacbug) 2012-01-02 12:57:23 -05:00
David A. Mellis 5c9d10ad94 Bug fix in replace().
http://code.google.com/p/arduino/issues/detail?id=694
2011-10-25 11:15:14 -04:00
David A. Mellis 77cdeb5b93 Fixing more warnings (Paul Stoffregen). 2011-10-10 11:28:44 -04:00
David A. Mellis 1cac0f3eb7 Restoring concatenation of built-in types with String. 2011-03-31 10:56:14 -04:00
David A. Mellis 99e642a26d String: removing implicit numeric conversions and new approach to "if (s)".
This makes explicit the String constructors that take numeric types and chars and removes the versions of concat() and operator=() and operator+() that accept numberic types.

It also replaces the operator bool() with a operator that converts to a function pointer.  This allows for uses like "if (s)" but not "s + 123".  See: http://www.artima.com/cppsource/safebool.html.  This allowed removing the disambiguating operator+() functions and relying solely on StringSumHelper and anonymous temporaries once again.

Also, now treating unsigned char's like int when constructing Strings from them, i.e. String(byte(65)) is now "65" not "A".  This is consistent with the new behavior of Serial.print(byte).
2011-03-26 18:52:54 -04:00
David A. Mellis 58d04ab3a3 Return an invalid string (not a partial one) when operator+() fails. 2011-03-19 11:14:17 -04:00
David A. Mellis 7dea0522f4 Starting to distinguish between empty strings and invalid (null) ones. 2011-03-18 21:45:27 -04:00
David A. Mellis 76776e7a46 Moving move() to __GXX_EXPERIMENTAL_CXX0X__ only, adding operator bool(). 2011-03-13 16:46:06 -04:00
David A. Mellis 98b403114c Modifying String.concat() to return success or failure, not this.
Which means you can't chain multiple concat() calls together, but you can check if they succeeded or not.
2011-03-12 14:03:34 -05:00
David A. Mellis b4b32f60f1 Don't return the string when modifying its value.
Changing toLowerCase(), toUpperCase(), trim() and replace() to return void instead of a reference to the string that's just been changed.  That way, it's clear that the functions modify the string they've been called on.
2011-03-11 18:54:58 -05:00
David A. Mellis 99e0c131fc Renaming append() back to concat(). 2011-03-11 18:04:31 -05:00
David A. Mellis 22786eaed2 Removing F("string") syntax for now.
We should probably add something like this back in later, but I want to do one thing at a time.  This removes the __FlashStringHelper class as well.
2011-03-11 18:01:40 -05:00
David A. Mellis 438bca3cb2 Rewrite of the String class by Paul Stoffregen.
http://www.pjrc.com/teensy/string_class_experimental.html
2011-03-11 17:56:10 -05:00
David A. Mellis e009c5c6c6 Renamed WProgram.h to Arduino.h. 2011-03-01 19:52:13 -05:00
David A. Mellis 11dd06436d Changing String append to use realloc(); thanks to Paul Stoffregen.
http://code.google.com/p/arduino/issues/detail?id=332
2010-12-11 15:22:07 -05:00
David A. Mellis 053ec1b989 Replacing custom String.toInt() function with a call to atol(). 2010-12-03 23:12:41 -05:00
David A. Mellis 4a90c4bd40 Redoing 448222e4b65e0cf44dfc0c494f7f76901f1fabea without all the extra files.
Adds toInt() to String, WCharacter.h (from Wiring), and an SD Datalogger example.
2010-11-29 15:20:30 -05:00
David A. Mellis 80c5173bfd Revert "added toInt() function to WString".
This reverts commit 448222e4b65e0cf44dfc0c494f7f76901f1fabea.
2010-11-29 15:14:10 -05:00
Tom Igoe 15f51fc1f8 added toInt() function to WString 2010-11-29 11:31:00 -05:00
David A. Mellis 4bbd4f7448 Changing String::toCharArray() and getBytes() to accept a buffer, rather than return one. That way they don't expose the internal representation of the String class, allowing future optimization. Thanks to Paul Stoffregen. 2010-08-28 10:23:54 +00:00
David A. Mellis 1362ca26c1 Returning a reference to a dummy character for indices beyond the string length (in operator[]). 2010-08-28 09:55:26 +00:00
David A. Mellis 14831247bc Adding some basic error checking to the String class (i.e. checking for a non-null buffer before modifying its contents). 2010-08-18 21:39:28 +00:00
David A. Mellis e871ae5236 Reverting changes to String class and modifying to allow + and += to work on more types. 2010-07-27 14:20:56 +00:00
Tom Igoe 8eea4576c4 removed append() from String library 2010-07-27 10:18:04 +00:00
Tom Igoe 58f5b67b71 checked in Xiaoyang Feng's changes to String library 2010-07-27 10:09:09 +00:00
Tom Igoe 445d1688c9 Checked in Xiaoyang's changes to String library 2010-07-27 10:06:43 +00:00
David A. Mellis 9f1e60ffa0 whitespace. 2010-07-05 16:08:35 +00:00
David A. Mellis 50bfce889e Modifying String from new/delete to malloc()/free(). Also #include'ing WString.h from WProgram.h. 2010-07-04 16:36:52 +00:00
David A. Mellis 0c09741c72 Adding WString.h and WString.cpp straight from Wiring (r. 726). Won't actually work yet. 2010-07-04 16:27:23 +00:00