32static const char strESC=
'\033';
49 if(jc ==
G4int(G4String::npos))
break;
51 for(; jc<
G4int(astream.length()); ) {
52 if(astream[(
size_t)(jc)]==
' ') jc++;
63 for(
G4int i=0; i<nElement; i++){
65 if(jc !=
G4int(G4String::npos))
66 stringArray[i]= astream(indx, jc-indx);
68 jc= astream.length()+1;
69 stringArray[i]= astream(indx, jc-indx);
71 for(
G4int j=1; jc+j<
G4int(astream.length()); j++ ) {
72 if(astream(jc+j)==
' ') jc++;
83 delete [] stringArray;
90 if( !(icol>=1 && irow>=1))
92 if(icol>nColumn)
G4cerr <<
"G4UIArrayString: overrange" <<
G4endl;
94 G4int jq= (irow-1)*nColumn + icol;
95 if(jq> nElement)
G4cerr <<
"G4UIArrayString: overrange" <<
G4endl;
98 return &stringArray[jq];
102G4int G4UIArrayString::GetNRow(
int icol)
const
106 if(nElement%nColumn ==0) ni= nElement/nColumn;
107 else ni= nElement/nColumn + 1;
110 if(nn==0)
nn= nColumn;
112 if(icol<= nn)
return ni;
117G4int G4UIArrayString::GetNField(
int icol)
const
121 for (
G4int iy=1; iy<= GetNRow(icol); iy++) {
122 G4int ilen= GetElement(icol,iy)-> length();
126 const char tgt = (*GetElement(icol,iy))[(
size_t)0];
131 if(ilen> maxWidth) maxWidth= ilen;
138int G4UIArrayString::CalculateColumnWidth() const
143 for(
G4int ix=1; ix<= nColumn; ix++) {
144 totalWidth+= GetNField(ix);
147 const G4int nwSpace= 2;
148 totalWidth+= (nColumn-1)*nwSpace;
158 while( CalculateColumnWidth()< ncol ) {
161 while( CalculateColumnWidth()> ncol && nColumn>1 ) {
165 for(
G4int iy=1; iy<= GetNRow(1); iy++) {
167 if(iy == GetNRow(1)) {
168 nc= nElement%nColumn;
169 if(nc==0) nc= nColumn;
171 for(
G4int ix=1; ix<=nc; ix++) {
172 G4String word= GetElement(ix,iy)-> data();
178 const char tgt = word[(size_t)0];
180 colorWord= word(0,5);
183 if(!colorWord.empty())
G4cout << colorWord << std::flush;
185 G4cout << std::setiosflags(std::ios::left) << std::setw(GetNField(ix))
186 << word.c_str() << std::flush;
188 if(ix != nc)
G4cout <<
" " << std::flush;
G4GLOB_DLL std::ostream G4cerr
G4GLOB_DLL std::ostream G4cout
str_size index(const char *, G4int pos=0) const
G4String strip(G4int strip_Type=trailing, char c=' ')
G4UIArrayString(const G4String &stream)