Go to the documentation of this file.00001 #ifndef FORIA_MESSAGEBOX_HH
00002 #define FORIA_MESSAGEBOX_HH
00003
00004 #include <string>
00005 #include <vector>
00006 #include <utility>
00007
00008 #include "boost/lexical_cast.hpp"
00009
00010 namespace ForIA{
00011
00012 using std::string;
00013 using std::vector;
00014 using std::pair;
00015
00016 class MessageBox{
00017
00018 public:
00019
00020 MessageBox(const string &title);
00021 MessageBox();
00022
00023 MessageBox &setTitle(const string &title);
00024 MessageBox &addEntry(const string &leftCol, const vector<string> &rightCol);
00025 MessageBox &addEntry(const string &leftCol, const string &rightCol);
00026
00027 template <typename T>
00028 MessageBox &addEntry(const string &leftCol, const T& val){
00029 return addEntry(leftCol, boost::lexical_cast<string>(val));
00030 }
00031
00032
00033
00034 int width() const;
00035 const string &title()const;
00036
00037 MessageBox &setWidth(unsigned int newWidth);
00038
00039 private:
00040
00041 friend std::ostream &operator << (std::ostream &out, const MessageBox &box);
00042
00043 void increaseWidth(unsigned int newWidth);
00044 void titleWidth();
00045
00046 string m_title;
00047 unsigned int m_width;
00048 unsigned int m_leftPad;
00049 unsigned int m_rightPad;
00050 unsigned int m_titleLeftPad;
00051 unsigned int m_titleRightPad;
00052 vector<pair<string, vector<string> > > m_entries;
00053
00054 };
00055 }
00056
00057 #endif