Class Box can be used used to print values and their name in the box. More...
#include <Box.hpp>
Public Member Functions | |
| Box () | |
| Default constructor. | |
| Box (const std::string &boxName, const int width=-1) | |
| Constructor with parameters. | |
| void | SetName (const std::string &boxName) |
| Set box name. | |
| void | SetWidth (const int width) |
| Set box width. | |
| void | AddEntry (const std::string &name, const double value, const unsigned int precision=2) |
| Add double-precision floating type value to the box with the set precision. | |
| void | AddEntry (const std::string &name, const int value) |
| Add int type value to the box. | |
| void | AddEntry (const std::string &name, const short value) |
| Add short type value to the box. | |
| void | AddEntry (const std::string &name, const long value) |
| Add long type value to the box. | |
| void | AddEntry (const std::string &name, const unsigned int value) |
| Add unsigned int type value to the box. | |
| void | AddEntry (const std::string &name, const unsigned short value) |
| Add unsigned short type value to the box. | |
| void | AddEntry (const std::string &name, const unsigned long value) |
| Add unsigned long type value to the box. | |
| void | AddEntry (const std::string &name, const std::string &value) |
| Add std::string type value to the box. | |
| void | AddEntry (const std::string &name, const bool value) |
| Add bool type value to the box. | |
| void | AddEntry (const std::string &name, const std::vector< double > &values, const unsigned int precision=2) |
| Add double-precision floating type values to the box with the set precision. | |
| void | AddEntry (const std::string &name, const std::vector< int > &values) |
| Add int type values to the box. | |
| void | AddEntry (const std::string &name, const std::vector< short > &values) |
| Add short type values to the box. | |
| void | AddEntry (const std::string &name, const std::vector< long > &values) |
| Add long type values to the box. | |
| void | AddEntry (const std::string &name, const std::vector< unsigned int > &values) |
| Add unsigned int type values to the box. | |
| void | AddEntry (const std::string &name, const std::vector< unsigned short > &values) |
| Add unsigned short type values to the box. | |
| void | AddEntry (const std::string &name, const std::vector< unsigned long > &values) |
| Add unsigned long type values to the box. | |
| void | AddEntry (const std::string &name, const std::vector< std::string > &values) |
| Add std::string type values to the box. | |
| void | AddEntry (const std::string &name, const std::vector< bool > &values) |
| Add bool type values to the box. | |
| void | Print (const std::string &titleColor=COLOR_GREEN) |
| Print the box. | |
| void | Clear () |
| Remove box entries. | |
| virtual | ~Box () |
| Descructor. | |
Class Box can be used used to print values and their name in the box.
Example:
Result:
╔════════════════╗ ║ text ║ ╟────────────────╢ ║ value1 1 ║ ║ value2 true ║ ║ value3 0.40 ║ ║ value4 true ║ ╚════════════════╝
| CppTools::Box::Box | ( | const std::string & | boxName, |
| const int | width = -1 ) |
Constructor with parameters.
| [in] | boxName | text to be printed in the head of the box |
| [in] | width | width of the box (negative value will result for the box to be printed with the width of a terminal) |
| void CppTools::Box::AddEntry | ( | const std::string & | name, |
| const bool | value ) |
Add bool type value to the box.
| [in] | name | value's name |
| [in] | value | it will converted into std::string and printed as either "true" or "false" |
| void CppTools::Box::AddEntry | ( | const std::string & | name, |
| const double | value, | ||
| const unsigned int | precision = 2 ) |
Add double-precision floating type value to the box with the set precision.
| [in] | name | value's name |
| [in] | value | |
| [in] | precision | floating point precision |
| void CppTools::Box::AddEntry | ( | const std::string & | name, |
| const int | value ) |
Add int type value to the box.
| [in] | name | value's name |
| [in] | value |
| void CppTools::Box::AddEntry | ( | const std::string & | name, |
| const long | value ) |
Add long type value to the box.
| [in] | name | value's name |
| [in] | value |
| void CppTools::Box::AddEntry | ( | const std::string & | name, |
| const short | value ) |
Add short type value to the box.
| [in] | name | value's name |
| [in] | value |
| void CppTools::Box::AddEntry | ( | const std::string & | name, |
| const std::string & | value ) |
Add std::string type value to the box.
| [in] | name | value's name |
| [in] | value |
| void CppTools::Box::AddEntry | ( | const std::string & | name, |
| const std::vector< bool > & | values ) |
Add bool type values to the box.
| [in] | name | values names |
| [in] | value | each value will converted into std::string and printed as either "true" or "false" |
| void CppTools::Box::AddEntry | ( | const std::string & | name, |
| const std::vector< double > & | values, | ||
| const unsigned int | precision = 2 ) |
Add double-precision floating type values to the box with the set precision.
| [in] | name | values names |
| [in] | values | |
| [in] | precision | floating point precision |
| void CppTools::Box::AddEntry | ( | const std::string & | name, |
| const std::vector< int > & | values ) |
Add int type values to the box.
| [in] | name | values names |
| [in] | values |
| void CppTools::Box::AddEntry | ( | const std::string & | name, |
| const std::vector< long > & | values ) |
Add long type values to the box.
| [in] | name | values names |
| [in] | values |
| void CppTools::Box::AddEntry | ( | const std::string & | name, |
| const std::vector< short > & | values ) |
Add short type values to the box.
| [in] | name | values names |
| [in] | values |
| void CppTools::Box::AddEntry | ( | const std::string & | name, |
| const std::vector< std::string > & | values ) |
Add std::string type values to the box.
| [in] | name | values names |
| [in] | values |
| void CppTools::Box::AddEntry | ( | const std::string & | name, |
| const std::vector< unsigned int > & | values ) |
Add unsigned int type values to the box.
| [in] | name | values names |
| [in] | values |
| void CppTools::Box::AddEntry | ( | const std::string & | name, |
| const std::vector< unsigned long > & | values ) |
Add unsigned long type values to the box.
| [in] | name | values names |
| [in] | values |
| void CppTools::Box::AddEntry | ( | const std::string & | name, |
| const std::vector< unsigned short > & | values ) |
Add unsigned short type values to the box.
| [in] | name | values names |
| [in] | values |
| void CppTools::Box::AddEntry | ( | const std::string & | name, |
| const unsigned int | value ) |
Add unsigned int type value to the box.
| [in] | name | value's name |
| [in] | value |
| void CppTools::Box::AddEntry | ( | const std::string & | name, |
| const unsigned long | value ) |
Add unsigned long type value to the box.
| [in] | name | value's name |
| [in] | value |
| void CppTools::Box::AddEntry | ( | const std::string & | name, |
| const unsigned short | value ) |
Add unsigned short type value to the box.
| [in] | name | value's name |
| [in] | value |
| void CppTools::Box::Print | ( | const std::string & | titleColor = COLOR_GREEN | ) |
Print the box.
| [in] | titleColor | color of the text in the head of the box |
| void CppTools::Box::SetName | ( | const std::string & | boxName | ) |
Set box name.
| [in] | boxName | text to be printed in the head of the box |
| void CppTools::Box::SetWidth | ( | const int | width | ) |
Set box width.
| [in] | width | width of the box (negative value will result in a box to be printed with the width of a terminal) |