PropWare  3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Hybrid_Demo.cpp
Go to the documentation of this file.
1 
14 #include <simpletext.h>
15 
17 using PropWare::Printer;
18 
19 class SimplePrinter : public PrintCapable {
20  public:
21  SimplePrinter () {}
22 
23  virtual void put_char (const char c) {
24  ::putChar(c);
25  }
26 
27  virtual void puts (char const string[]) {
28  ::putStr(string);
29  }
30 };
31 
40 int main () {
41  SimplePrinter mySimpleCompatiblePrinter;
42  const Printer myPrinter(mySimpleCompatiblePrinter);
43 
44  putStr("Hello from the Simple function!\n");
45  myPrinter.puts("Hello from PropWare's Printer!\n");
46  myPrinter.print("Hello from yet another Printer function!\n");
47  myPrinter.printf("All methods have their own merits. Choose one that works well for you.\n");
48  myPrinter.println("Printer::println() can be handy if you just want to print a single string");
49  myPrinter << "For lovers of C++ streams, you can even use the << operator!\n";
50 
51  return 0;
52 }
53 
54 
SimplePrinter::put_char
virtual void put_char(const char c)
Print a single character.
Definition: Hybrid_Demo.cpp:23
printer.h
SimplePrinter::puts
virtual void puts(char const string[])
Send a null-terminated character array. Though this method could be created using put_char,...
Definition: Hybrid_Demo.cpp:27
PropWare::PrintCapable
Interface for all classes capable of printing.
Definition: printcapable.h:38
main
int main(void)
Definition: GraphicsTest.c:20
simpletext.h
This library provides a collection of functions for communicating with text devices such as SimpleIDE...
putChar
void putChar(char c)
Print a char to the debug port.
Definition: putChar.c:30
printcapable.h
PropWare::Printer
Container class that has formatting methods for human-readable output. This class can be constructed ...
Definition: printer.h:76
putStr
int putStr(const char *str)
Print string to the debug port.
Definition: putStr.c:10
SimplePrinter
Definition: Hybrid_Demo.cpp:19