#include <G4UIArrayString.hh>
Public Member Functions | |
G4UIArrayString (const G4String &stream) | |
~G4UIArrayString () | |
void | Show (G4int ncol) |
Private Member Functions | |
G4String * | GetElement (G4int icol, G4int irow) const |
G4int | GetNRow (G4int icol) const |
G4int | GetNField (G4int icol) const |
G4int | CalculateColumnWidth () const |
Private Attributes | |
G4String * | stringArray |
G4int | nElement |
G4int | nColumn |
|
Definition at line 37 of file G4UIArrayString.cc. References nColumn, nElement, and stringArray.
00039 { 00040 nElement=0; 00041 nColumn=5; // temporal assignment 00042 00043 G4String tmpstr= stream; // G4String::strip() CONST !! 00044 G4String astream= tmpstr.strip(G4String::both); 00045 00046 // tokenize... 00047 G4int indx=0; 00048 while(1) { 00049 G4int jc= astream.index(" ", indx); 00050 nElement++; 00051 if(jc == G4int(G4String::npos)) break; 00052 jc++; // fix a tiny mistake... 00053 for(; jc< G4int(astream.length()); ) { // skip continuing spaces 00054 if(astream[(size_t)(jc)]==' ') jc++; 00055 else break; 00056 } 00057 indx= jc; 00058 } 00059 00060 // allocate string array 00061 stringArray= new G4String[nElement]; 00062 00063 // push... 00064 indx=0; 00065 for(G4int i=0; i<nElement; i++){ 00066 G4int jc= astream.index(" ", indx); 00067 if(jc != G4int(G4String::npos)) 00068 stringArray[i]= astream(indx, jc-indx); 00069 else { // last token 00070 jc= astream.length()+1; 00071 stringArray[i]= astream(indx, jc-indx); 00072 } 00073 for(G4int j=1; jc+j< G4int(astream.length()); j++ ) { // skip continuing spaces 00074 if(astream(jc+j)==' ') jc++; 00075 else break; 00076 } 00077 indx= jc+1; 00078 } 00079 } |
|
Definition at line 82 of file G4UIArrayString.cc. References stringArray.
00084 { 00085 delete [] stringArray; 00086 } |
|
Definition at line 140 of file G4UIArrayString.cc. Referenced by Show().
|
|
Definition at line 89 of file G4UIArrayString.cc. Referenced by Show().
00091 { 00092 if( !(icol>=1 && irow>=1)) // offset of column/row is "1". 00093 G4cerr << "G4UIArrayString: overrange" << G4endl; 00094 if(icol>nColumn) G4cerr << "G4UIArrayString: overrange" << G4endl; 00095 00096 G4int jq= (irow-1)*nColumn + icol; 00097 if(jq> nElement) G4cerr << "G4UIArrayString: overrange" << G4endl; 00098 00099 jq--; 00100 return &stringArray[jq]; 00101 } |
|
Referenced by Show(). |
|
Referenced by Show(). |
|
Definition at line 156 of file G4UIArrayString.cc. References CalculateColumnWidth(), GetElement(), GetNField(), GetNRow(), nColumn, nElement, and strESC. Referenced by G4VUIshell::ListCommand().
00158 { 00159 // calculate #colums in need... 00160 while( CalculateColumnWidth()< ncol ) { 00161 nColumn++; 00162 } 00163 while( CalculateColumnWidth()> ncol && nColumn>1 ) { 00164 nColumn--; 00165 } 00166 00167 for(G4int iy=1; iy<= GetNRow(1); iy++) { 00168 G4int nc= nColumn; 00169 if(iy == GetNRow(1)) { // last row 00170 nc= nElement%nColumn; 00171 if(nc==0) nc= nColumn; 00172 } 00173 for(G4int ix=1; ix<=nc; ix++) { 00174 G4String word= GetElement(ix,iy)-> data(); 00175 00176 // care for color code 00177 G4String colorWord; 00178 //if(word.index(strESC,0) != G4String::npos) { 00179 //if(strESC == word[0]) { 00180 const char tgt = word[(size_t)0]; 00181 if(strESC == tgt) { 00182 colorWord= word(0,5); 00183 word.erase(0,5); 00184 } 00185 if(!colorWord.empty()) G4cout << colorWord << std::flush; 00186 00187 G4cout << std::setiosflags(std::ios::left) << std::setw(GetNField(ix)) 00188 << word.c_str() << std::flush; 00189 // against problem w/ g++ iostream 00190 if(ix != nc) G4cout << " " << std::flush; 00191 else G4cout << G4endl; 00192 } 00193 } 00194 } |
Here is the call graph for this function:
|
Definition at line 46 of file G4UIArrayString.hh. Referenced by G4UIArrayString(), and Show(). |
|
Definition at line 45 of file G4UIArrayString.hh. Referenced by G4UIArrayString(), and Show(). |
|
Definition at line 44 of file G4UIArrayString.hh. Referenced by G4UIArrayString(), and ~G4UIArrayString(). |