Files
pip/doc/examples/picout.cpp

37 lines
811 B
C++

#include "pip.h"
//! [own]
inline PICout operator <<(PICout s, const PIByteArray & ba) {
s.space(); // insert space after previous output
s.quote(); // ONLY if you want to quoted your type
s.setControl(0, true); // clear all features and
// save them to stack,
// now it`s behavior similar to std::cout
// your output
for (uint i = 0; i < ba.size(); ++i)
s << ba[i];
s.restoreControl(); // restore features from stack
s.quote(); // ONLY if you want to quoted your type
return s;
}
//! [own]
void _() {
//! [0]
int a = 10, b = 32, c = 11;
piCout << a << Hex << b << Bin << c;
// 10 20 1011
piCout << "this" << "is" << Green << "green" << Default << "word";
// this is green word
PICout(AddSpaces | AddNewLine | AddQuotes) << Tab << "tab and" << "quotes";
// "tab and" "quotes"
//! [0]
};