Puma Reference Manual | Puma::Printable Class Reference |
Provides that possibility for an object to be used with output streams (std::ostream). More...
#include <Puma/Printable.h>
Public Member Functions | |
virtual | ~Printable () |
Destructor. | |
virtual void | print (ostream &os) const =0 |
Print something on the given output stream. |
Provides that possibility for an object to be used with output streams (std::ostream).
Derived classes have to implement method Printable::print().
Example:
class Name : public Puma::Printable { const char* the_name; public: Name(const char* n) : the_name(n) {} void print(ostream &os) { os << "[name: " << the_name << "]"; } }; Name adam("adam"); std::cout << adam << std::endl; // prints "[name: adam]\n"
virtual Puma::Printable::~Printable | ( | ) | [inline, virtual] |
Destructor.
virtual void Puma::Printable::print | ( | ostream & | os | ) | const [pure virtual] |
Print something on the given output stream.
os | The output stream. |
Implemented in Puma::CT_QualName, Puma::CT_SimpleName, Puma::CTypeInfo, Puma::ManipError, Puma::Unit, and Puma::Filename.