Changeset 987 for trunk/source/persistency/gdml/src
- Timestamp:
- Apr 17, 2009, 10:58:56 AM (15 years ago)
- Location:
- trunk/source/persistency/gdml/src
- Files:
-
- 17 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/persistency/gdml/src/G4GDMLEvaluator.cc
r850 r987 25 25 // 26 26 // 27 // $Id: G4GDMLEvaluator.cc,v 1.2 0 2008/07/16 15:46:34gcosmo Exp $27 // $Id: G4GDMLEvaluator.cc,v 1.22 2009/02/26 10:13:35 gcosmo Exp $ 28 28 // GEANT4 tag $ Name:$ 29 29 // … … 144 144 G4String G4GDMLEvaluator::SolveBrackets(const G4String& in) 145 145 { 146 const std::string::size_type open = in.find("[",0); 147 const std::string::size_type close = in.find("]",0); 146 std::string::size_type full = in.size(); 147 std::string::size_type open = in.find("[",0); 148 std::string::size_type close = in.find("]",0); 148 149 149 150 if (open==close) { return in; } … … 158 159 std::string::size_type begin = open; 159 160 std::string::size_type end = 0; 160 161 std::string::size_type end1 = 0; 161 162 std::string out; 162 163 out.append(in,0,open); 164 165 do // Loop for all possible matrix elements in 'in' 166 { 167 do // SolveBrackets for one matrix element 168 { 169 end = in.find(",",begin+1); 170 end1= in.find("]",begin+1); 171 if (end>end1) { end = end1; } 172 if (end==std::string::npos) { end = close;} 173 174 std::stringstream indexStream; 175 indexStream << "_" << EvaluateInteger(in.substr(begin+1,end-begin-1))-1; 176 177 out.append(indexStream.str()); 178 179 begin = end; 180 181 } while (end<close); 182 183 if (full==close) { return out; } 184 185 open = in.find("[",begin); 186 close = in.find("]",begin+1); 187 188 if (open==close) { out.append(in.substr(end+1,full-end-1)); return out; } 189 out.append(in.substr(end+1,open-end-1)); 190 191 begin=open; 192 193 } while (close<full); 163 194 164 do165 {166 end = in.find(",",begin+1);167 if (end==std::string::npos) { end = close; }168 169 std::stringstream indexStream;170 indexStream << "_" << EvaluateInteger(in.substr(begin+1,end-begin-1));171 172 out.append(indexStream.str());173 174 begin = end;175 176 } while (end<close);177 178 195 return out; 179 196 }
Note: See TracChangeset
for help on using the changeset viewer.