# PIP: PICout Class Reference

PICout Class Reference

Class for formatted output similar std::cout. More...

## Public Member Functions

| PICout (PIFlags< PICoutManipulators::PICoutControl > controls=PICoutManipulators::AddSpaces|PICoutManipulators::AddNewLine)
| Default constructor with default features (AddSpaces and AddNewLine)
PICout | operator<< (const char *v)
| Output operator for strings with `"const char * "` type.
PICout | operator<< (const std::string &v)
| Output operator for strings with `"std::string"` type.
PICout | operator<< (const bool v)
| Output operator for boolean values.
PICout | operator<< (const char v)
| Output operator for `"char"` values.
PICout | operator<< (const uchar v)
| Output operator for `"unsigned char"` values.
PICout | operator<< (const short v)
| Output operator for `"short"` values.
PICout | operator<< (const ushort v)
| Output operator for `"unsigned short"` values.
PICout | operator<< (const int v)
| Output operator for `"int"` values.
PICout | operator<< (const uint v)
| Output operator for `"unsigned int"` values.
PICout | operator<< (const long v)
| Output operator for `"long"` values.
PICout | operator<< (const ulong v)
| Output operator for `"unsigned long"` values.
PICout | operator<< (const llong v)
| Output operator for `"long long"` values.
PICout | operator<< (const ullong v)
| Output operator for `"unsigned long long"` values.
PICout | operator<< (const float v)
| Output operator for `"float"` values.
PICout | operator<< (const double v)
| Output operator for `"double"` values.
PICout | operator<< (const void *v)
| Output operator for pointers.
PICout | operator<< (const PIObject *v)
| Output operator for PIObject and ancestors.
PICout | operator<< (const PICoutManipulators::PICoutSpecialChar v)
| Output operator for PICoutSpecialChar values.
PICout | operator<< (const PIFlags< PICoutManipulators::PICoutFormat > v)
| Output operator for PIFlags<PICoutFormat> values.
PICout | operator<< (const PICoutManipulators::PICoutFormat v)
| Output operator for PICoutFormat values.
PICout | operator<< (const PICoutManipulators::PICoutAction v)
| Do some action. More...
PICout & | setControl (PICoutManipulators::PICoutControl c, bool on=true)
| Set control flag "c" is "on" state.
PICout & | setControl (PICoutManipulators::PICoutControls c, bool save=false)
| Set control flags "c" and if "save" exec saveControl()
PICout & | saveControl ()
| Save control flags to internal stack. More...
PICout & | restoreControl ()
| Restore control flags from internal stack. More...
PICout & | space ()
| Conditional put space character to output. More...
PICout & | quote ()
| Conditional put quote character to output. More...
PICout & | newLine ()
| Conditional put new line character to output. More...

## Related Functions

(Note that these are not member functions.)
PICout | operator<< (PICout s, const PIString &v)
| Output operator to PICout.
PICout | operator<< (PICout s, const PIStringList &v)
| Output operator to PICout.

## Detailed Description

Class for formatted output similar std::cout.

# Synopsis

This class provide many stream operators for output with some features. Output to PICout is thread-sequential, i.e. doesn`t mixed from parallel threads.

# Features

- insertion spaces between entries
- insertion new line at the end of output
- strings are quoted
- custom output operator can be easily written

# Usage

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"

# Writing your own output operator

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;
}

## Member Function Documentation

PICout PICout::operator<< | ( | const PICoutManipulators::PICoutAction | v | ) |

Do some action.

TODO !!!

PICout & PICout::saveControl | ( |  | ) |

Save control flags to internal stack.

See also
  restoreControl()

PICout & PICout::restoreControl | ( |  | ) |

Restore control flags from internal stack.

See also
  saveControl()

PICout & PICout::space | ( |  | ) |

Conditional put space character to output.

If it is not a first output and control AddSpaces is set space character is put

See also
  quote(), newLine()

PICout & PICout::quote | ( |  | ) |

Conditional put quote character to output.

If control AddQuotes is set quote character is put

See also
  space(), newLine()

PICout & PICout::newLine | ( |  | ) |

Conditional put new line character to output.

If control AddNewLine is set new line character is put

See also
  space(), quote()