Making Print::write(char *) non-virtual.
http://code.google.com/p/arduino/issues/detail?id=607
This commit is contained in:
parent
3c66dc1b8d
commit
8b13206e65
|
@ -10,7 +10,6 @@ public:
|
||||||
virtual int connect(IPAddress ip, uint16_t port) =0;
|
virtual int connect(IPAddress ip, uint16_t port) =0;
|
||||||
virtual int connect(const char *host, uint16_t port) =0;
|
virtual int connect(const char *host, uint16_t port) =0;
|
||||||
virtual size_t write(uint8_t) =0;
|
virtual size_t write(uint8_t) =0;
|
||||||
virtual size_t write(const char *str) =0;
|
|
||||||
virtual size_t write(const uint8_t *buf, size_t size) =0;
|
virtual size_t write(const uint8_t *buf, size_t size) =0;
|
||||||
virtual int available() = 0;
|
virtual int available() = 0;
|
||||||
virtual int read() = 0;
|
virtual int read() = 0;
|
||||||
|
|
|
@ -29,16 +29,6 @@
|
||||||
|
|
||||||
// Public Methods //////////////////////////////////////////////////////////////
|
// Public Methods //////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
/* default implementation: may be overridden */
|
|
||||||
size_t Print::write(const char *str)
|
|
||||||
{
|
|
||||||
size_t n = 0;
|
|
||||||
while (*str) {
|
|
||||||
n += write(*str++);
|
|
||||||
}
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* default implementation: may be overridden */
|
/* default implementation: may be overridden */
|
||||||
size_t Print::write(const uint8_t *buffer, size_t size)
|
size_t Print::write(const uint8_t *buffer, size_t size)
|
||||||
{
|
{
|
||||||
|
|
|
@ -46,7 +46,7 @@ class Print
|
||||||
void clearWriteError() { setWriteError(0); }
|
void clearWriteError() { setWriteError(0); }
|
||||||
|
|
||||||
virtual size_t write(uint8_t) = 0;
|
virtual size_t write(uint8_t) = 0;
|
||||||
virtual size_t write(const char *str);
|
size_t write(const char *str) { return write((const uint8_t *)str, strlen(str)); }
|
||||||
virtual size_t write(const uint8_t *buffer, size_t size);
|
virtual size_t write(const uint8_t *buffer, size_t size);
|
||||||
|
|
||||||
size_t print(const __FlashStringHelper *);
|
size_t print(const __FlashStringHelper *);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#ifndef server_h
|
#ifndef server_h
|
||||||
#define server_h
|
#define server_h
|
||||||
|
|
||||||
class Server {
|
class Server : public Print {
|
||||||
public:
|
public:
|
||||||
virtual void begin() =0;
|
virtual void begin() =0;
|
||||||
};
|
};
|
||||||
|
|
|
@ -57,8 +57,6 @@ public:
|
||||||
virtual int endPacket() =0;
|
virtual int endPacket() =0;
|
||||||
// Write a single byte into the packet
|
// Write a single byte into the packet
|
||||||
virtual size_t write(uint8_t) =0;
|
virtual size_t write(uint8_t) =0;
|
||||||
// Write a string of characters into the packet
|
|
||||||
virtual size_t write(const char *str) =0;
|
|
||||||
// Write size bytes from buffer into the packet
|
// Write size bytes from buffer into the packet
|
||||||
virtual size_t write(const uint8_t *buffer, size_t size) =0;
|
virtual size_t write(const uint8_t *buffer, size_t size) =0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue