MCPcopy Create free account
hub / github.com/Geant4/geant4 / Show

Method Show

source/interfaces/core/src/G4UIArrayString.cc:159–197  ·  view source on GitHub ↗

/////////////////////////////////

Source from the content-addressed store, hash-verified

157
158//////////////////////////////////////
159void G4UIArrayString::Show(G4int ncol)
160//////////////////////////////////////
161{
162 // calculate #colums in need...
163 while (CalculateColumnWidth() < ncol) {
164 nColumn++;
165 }
166 while (CalculateColumnWidth() > ncol && nColumn > 1) {
167 nColumn--;
168 }
169
170 for (G4int iy = 1; iy <= GetNRow(1); iy++) {
171 G4int nc = (G4int)nColumn;
172 if (iy == GetNRow(1)) { // last row
173 nc = G4int(nElement % nColumn);
174 if (nc == 0) nc = (G4int)nColumn;
175 }
176 for (G4int ix = 1; ix <= nc; ++ix) {
177 G4String word = GetElement(ix, iy)->data();
178
179 // care for color code
180 G4String colorWord;
181 const char tgt = word[(std::size_t)0];
182 if (strESC == tgt) {
183 colorWord = word.substr(0, 5);
184 word.erase(0, 5);
185 }
186 if (! colorWord.empty()) G4cout << colorWord << std::flush;
187
188 G4cout << std::setiosflags(std::ios::left) << std::setw(GetNField(ix)) << word.c_str()
189 << std::flush;
190 // against problem w/ g++ iostream
191 if (ix != nc)
192 G4cout << " " << std::flush;
193 else
194 G4cout << G4endl;
195 }
196 }
197}

Callers 1

ListCommandMethod · 0.80

Calls 4

substrMethod · 0.80
c_strMethod · 0.80
dataMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected