Commit Graph

29 Commits

Author SHA1 Message Date
David A. Mellis 06eafe4df2 Restoring concatenation of built-in types with String. 2011-03-31 10:56:14 -04:00
David A. Mellis e7dea10170 Adding F("foo") syntax for flash strings. 2011-03-27 15:06:20 -04:00
David A. Mellis f88d528afa 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 d1857a7987 Commenting String API behavior. 2011-03-23 22:42:05 -04:00
David A. Mellis 117bdcb3dd Return an invalid string (not a partial one) when operator+() fails. 2011-03-19 11:14:17 -04:00
David A. Mellis fb4e318ffa Starting to distinguish between empty strings and invalid (null) ones. 2011-03-18 21:45:27 -04:00
David A. Mellis 2bc205c5b8 Protecting String copy() and move(). 2011-03-13 19:39:04 -04:00
David A. Mellis 5a2ab1c058 Adding additional String + operators for disambiguation.
The operator bool() means that you could implicitly convert a String to a bool and then add it to it an int, for example.  Which means our operator+ has to match exactly or it will be ambiguous.
2011-03-13 19:31:10 -04:00
David A. Mellis 68f97155ec Moving move() to __GXX_EXPERIMENTAL_CXX0X__ only, adding operator bool(). 2011-03-13 16:46:06 -04:00
David A. Mellis 82fcee457c 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 cc3671e0c8 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 5c29add087 Renaming append() back to concat(). 2011-03-11 18:04:31 -05:00
David A. Mellis 5797e9bbbe 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 3b952ba168 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 f2af8883a7 Renamed WProgram.h to Arduino.h. 2011-03-01 19:52:13 -05:00
David A. Mellis d656974cee 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 393ca89a01 Revert "added toInt() function to WString".
This reverts commit 448222e4b65e0cf44dfc0c494f7f76901f1fabea.
2010-11-29 15:14:10 -05:00
Tom Igoe 711f4f95a0 added toInt() function to WString 2010-11-29 11:31:00 -05:00
David A. Mellis 3616c3aac6 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 b616c157ae 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 2aa9853c59 No longer requiring WProgram.h for Print / Stream classes (replaced Arduino-specific type names in String). 2010-08-06 01:23:19 +00:00
Tom Igoe 0b56973766 added more String examples 2010-07-27 22:59:18 +00:00
David A. Mellis 7d91fb31c2 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 8a48e1bc5e removed append() from String library 2010-07-27 10:18:04 +00:00
Tom Igoe e8a2b8421d checked in Xiaoyang Feng's changes to String library 2010-07-27 10:09:09 +00:00
Tom Igoe c54f647f0e Checked in Xiaoyang's changes to String library 2010-07-27 10:06:49 +00:00
David A. Mellis a1a3978adb Adding support for printing Strings to the Print class. 2010-07-04 23:22:34 +00:00
David A. Mellis 09315f91a9 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 1d2fc4fb33 Adding WString.h and WString.cpp straight from Wiring (r. 726). Won't actually work yet. 2010-07-04 16:27:23 +00:00