http://wiki.makerfire.com/index.php?title=Print.h&feed=atom&action=historyPrint.h - Revision history2024-03-19T03:22:20ZRevision history for this page on the wikiMediaWiki 1.30.0http://wiki.makerfire.com/index.php?title=Print.h&diff=229&oldid=prevRickylone: Created page with "<pre style="color:blue"> /* Print.h - Base class that provides print() and println() Copyright (c) 2008 David A. Mellis. All right reserved. This library is free softw..."2018-03-09T06:39:53Z<p>Created page with "<pre style="color:blue"> /* Print.h - Base class that provides print() and println() Copyright (c) 2008 David A. Mellis. All right reserved. This library is free softw..."</p>
<p><b>New page</b></p><div><pre style="color:blue"><br />
/*<br />
Print.h - Base class that provides print() and println()<br />
Copyright (c) 2008 David A. Mellis. All right reserved.<br />
<br />
This library is free software; you can redistribute it and/or<br />
modify it under the terms of the GNU Lesser General Public<br />
License as published by the Free Software Foundation; either<br />
version 2.1 of the License, or (at your option) any later version.<br />
<br />
This library is distributed in the hope that it will be useful,<br />
but WITHOUT ANY WARRANTY; without even the implied warranty of<br />
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU<br />
Lesser General Public License for more details.<br />
<br />
You should have received a copy of the GNU Lesser General Public<br />
License along with this library; if not, write to the Free Software<br />
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA<br />
*/<br />
<br />
#ifndef Print_h<br />
#define Print_h<br />
<br />
#include <inttypes.h><br />
#include <stdio.h> // for size_t<br />
<br />
#include "WString.h"<br />
#include "Printable.h"<br />
<br />
#define DEC 10<br />
#define HEX 16<br />
#define OCT 8<br />
#define BIN 2<br />
<br />
class Print<br />
{<br />
private:<br />
int write_error;<br />
size_t printNumber(unsigned long, uint8_t);<br />
size_t printFloat(double, uint8_t);<br />
protected:<br />
void setWriteError(int err = 1) { write_error = err; }<br />
public:<br />
Print() : write_error(0) {}<br />
<br />
int getWriteError() { return write_error; }<br />
void clearWriteError() { setWriteError(0); }<br />
<br />
virtual size_t write(uint8_t) = 0;<br />
size_t write(const char *str) {<br />
if (str == NULL) return 0;<br />
return write((const uint8_t *)str, strlen(str));<br />
}<br />
virtual size_t write(const uint8_t *buffer, size_t size);<br />
<br />
size_t print(const __FlashStringHelper *);<br />
size_t print(const String &);<br />
size_t print(const char[]);<br />
size_t print(char);<br />
size_t print(unsigned char, int = DEC);<br />
size_t print(int, int = DEC);<br />
size_t print(unsigned int, int = DEC);<br />
size_t print(long, int = DEC);<br />
size_t print(unsigned long, int = DEC);<br />
size_t print(double, int = 2);<br />
size_t print(const Printable&);<br />
<br />
size_t println(const __FlashStringHelper *);<br />
size_t println(const String &s);<br />
size_t println(const char[]);<br />
size_t println(char);<br />
size_t println(unsigned char, int = DEC);<br />
size_t println(int, int = DEC);<br />
size_t println(unsigned int, int = DEC);<br />
size_t println(long, int = DEC);<br />
size_t println(unsigned long, int = DEC);<br />
size_t println(double, int = 2);<br />
size_t println(const Printable&);<br />
size_t println(void);<br />
};<br />
<br />
#endif<br />
<br />
</pre></div>Rickylone