18 template<
typename ConfigType = util::ConfigurationObject,
typename ParamType = util::ConfigParameters>
27 std::ostringstream Ostr;
30 if(hsize == 0) hsize=1;
32 for(
unsigned int npchar = 0;npchar < (menuspace+2);npchar+=hsize)
39 std::ostringstream Ostr;
42 int nspaces = (menuspace-message.size())/2;
45 while(spaces++ < nspaces)
51 int space_left =
_menu_width - (Ostr.str().size() + 2);
60 std::ostringstream Ostr;
66 ParamType ¶ms = config.Section(section);
67 int npp = params.size();
71 int lines_per_col = (npp + ncol)/ncol;
72 std::vector<int> npercol(ncol,0);
73 std::vector<int>::iterator npci = npercol.begin();
74 while(npci != npercol.end()){
75 *npci = (npp < lines_per_col ? npp : lines_per_col);
78 int rule_size = vrule_size * (ncol - 1);
81 int column_size = (menuspace - rule_size)/ncol;
82 int field_space = column_size - button_size - field_separator_size;
83 unsigned int field_size = field_space/2;
84 int total_size = rule_size + (ncol * (button_size+(2*field_size)+field_separator_size));
85 int xtraspace = (menuspace-total_size);
86 int fieldspace = xtraspace/(ncol*2);
92 field_size += fieldspace;
93 xtraspace -= (fieldspace*ncol*2);
103 for(line_count = 1; line_count <= npercol[0];line_count++){
104 int extraspace = xtraspace;
105 for(
int cc = 0;cc < ncol;cc++){
106 unsigned int param_index = line_count-1;
107 for(
int ccount = 0;ccount < cc;ccount++)
108 param_index += npercol[ccount];
111 if(param_index < params.size()){
112 key = params[param_index].Key();
113 value = params[param_index].Value();
114 if(key.size() > field_size){
115 key = std::string(
"*") + key.substr(key.size() - field_size + 1);
117 if(value.size() > field_size){
118 value = std::string(
"*")+ value.substr(value.size() - field_size + 1);
121 if(param_index < params.size())
122 Ostr << std::setw(2) << std::setiosflags(std::ios::left) << param_index+1 << std::setw(2) <<
") ";
124 Ostr << std::setw(4) <<
"";
125 Ostr << std::setw(field_size) << std::setiosflags(std::ios::left)
126 << (param_index < params.size() ? key :
"")
127 << std::setw(3) << (param_index < params.size() ?
" = " :
"")
128 << std::setw(field_size)
129 << (param_index < params.size() ? value :
"") << ((extraspace--) > 0 ?
" " :
"")
130 << ((cc == (ncol-1)) ?
"" : (std::string(std::string(
" ") +
_vertical_rule + std::string(
" "))));
132 while(extraspace-- > 0)
134 Ostr <<
" " << _external_border << std::endl;
135 if(line_count < npercol[0])
136 Ostr << _external_border <<
" ";
144 std::ostringstream Ostr;
145 int section_index = config.SectionIndex(section);
146 ParamType ¶ms = config.Section(section);
150 int npp = params.size();
154 int lines_per_col = (npp + ncol)/ncol;
155 std::vector<int> npercol(ncol,0);
156 std::vector<int>::iterator npci = npercol.begin();
157 while(npci != npercol.end()){
158 *npci = (npp < lines_per_col ? npp : lines_per_col);
161 int rule_size = vrule_size * (ncol - 1);
164 int column_size = (menuspace - rule_size)/ncol;
165 int field_space = column_size - button_size - field_separator_size;
166 unsigned int field_size = field_space/2;
167 int total_size = rule_size + (ncol * (button_size+(2*field_size)+field_separator_size));
168 int xtraspace = (menuspace-total_size);
169 int menuitem = params.size()+1;
170 int navsize = button_size + field_size + 1;
171 int nnavperline = menuspace/navsize;
172 xtraspace = menuspace - navsize*nnavperline + 1;
174 std::string topName(config.Name());
175 if(topName.size() > menuspace){
176 topName = std::string(
"*") + topName.substr(topName.size() - menuspace + 1);
180 std::ostringstream OnavStr;
182 << 0 <<
")" << std::setiosflags(std::ios::left)
183 << std::setw(topName.size()) << topName;
184 std::string navSectionString(config.NavigationSections()[section_index]);
185 std::istringstream Istr(navSectionString);
186 std::string navString;
187 bool first_on_line =
false;
189 while(Istr >> navString){
191 if(navString.size() > menuspace){
192 navString = std::string(
"*") + navString.substr(navString.size() - menuspace +1);
194 if((
int)(button_size + navString.size()+3) > xtraspace){
198 Ostr << OnavStr.str();
201 first_on_line =
true;
203 OnavStr << (first_on_line ?
"" :
" | ") << menuitem++ <<
")" << std::setw(std::ios::left)
204 << std::setw(navString.size()) << navString;
213 Ostr << OnavStr.str() << std::endl <<
hRule();
std::string::size_type strsize
Defines MPI-specific parallel global and program classes.
Configuration object interface (for config files, etc).