aboutsummaryrefslogtreecommitdiff
path: root/cores/arduino/Print.h
diff options
context:
space:
mode:
authoramcewen <amcewen@bcs.org.uk>2011-08-28 20:28:53 +0100
committeramcewen <amcewen@bcs.org.uk>2011-08-28 20:28:53 +0100
commit8ce77304f796e077f594859f270f9f024dc05605 (patch)
tree285233e5b57f0029551056b1951e4e539b265951 /cores/arduino/Print.h
parente852be3e97763e621a0f8014a3db4bf92a650b50 (diff)
parentf9d50a793010db3a2968262f35d34edaf048a650 (diff)
Merge branch 'master' into wifly_integration
Diffstat (limited to 'cores/arduino/Print.h')
-rwxr-xr-xcores/arduino/Print.h62
1 files changed, 37 insertions, 25 deletions
diff --git a/cores/arduino/Print.h b/cores/arduino/Print.h
index b092ae5..fce302e 100755
--- a/cores/arduino/Print.h
+++ b/cores/arduino/Print.h
@@ -24,43 +24,55 @@
#include <stdio.h> // for size_t
#include "WString.h"
+#include "Printable.h"
#define DEC 10
#define HEX 16
#define OCT 8
#define BIN 2
-#define BYTE 0
class Print
{
private:
- void printNumber(unsigned long, uint8_t);
- void printFloat(double, uint8_t);
+ int write_error;
+ size_t printNumber(unsigned long, uint8_t);
+ size_t printFloat(double, uint8_t);
+ protected:
+ void setWriteError(int err = 1) { write_error = err; }
public:
- virtual void write(uint8_t) = 0;
- virtual void write(const char *str);
- virtual void write(const uint8_t *buffer, size_t size);
+ Print() : write_error(0) {}
+
+ int writeError() { return write_error; }
+ void clearWriteError() { setWriteError(0); }
+
+ virtual size_t write(uint8_t) = 0;
+ virtual size_t write(const char *str);
+ virtual size_t write(const uint8_t *buffer, size_t size);
- void print(const String &);
- void print(const char[]);
- void print(char, int = BYTE);
- void print(unsigned char, int = BYTE);
- void print(int, int = DEC);
- void print(unsigned int, int = DEC);
- void print(long, int = DEC);
- void print(unsigned long, int = DEC);
- void print(double, int = 2);
+ size_t print(const __FlashStringHelper *);
+ size_t print(const String &);
+ size_t print(const char[]);
+ size_t print(char);
+ size_t print(unsigned char, int = DEC);
+ size_t print(int, int = DEC);
+ size_t print(unsigned int, int = DEC);
+ size_t print(long, int = DEC);
+ size_t print(unsigned long, int = DEC);
+ size_t print(double, int = 2);
+ size_t print(const Printable&);
- void println(const String &s);
- void println(const char[]);
- void println(char, int = BYTE);
- void println(unsigned char, int = BYTE);
- void println(int, int = DEC);
- void println(unsigned int, int = DEC);
- void println(long, int = DEC);
- void println(unsigned long, int = DEC);
- void println(double, int = 2);
- void println(void);
+ size_t println(const __FlashStringHelper *);
+ size_t println(const String &s);
+ size_t println(const char[]);
+ size_t println(char);
+ size_t println(unsigned char, int = DEC);
+ size_t println(int, int = DEC);
+ size_t println(unsigned int, int = DEC);
+ size_t println(long, int = DEC);
+ size_t println(unsigned long, int = DEC);
+ size_t println(double, int = 2);
+ size_t println(const Printable&);
+ size_t println(void);
};
#endif