Changeset 1157 in Sophya for trunk/SophyaLib/BaseTools/dvlist.cc
- Timestamp:
- Aug 29, 2000, 6:11:42 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/BaseTools/dvlist.cc
r1080 r1157 195 195 /*! Returns the value corresponding to name \b key, converted to integer 196 196 Default value \b def is returned if name \b key not found */ 197 int_8 DVList::GetI(string const& key, int_8 def) 198 { 199 ValList:: iterator it = mvlist.find(key);197 int_8 DVList::GetI(string const& key, int_8 def) const 198 { 199 ValList::const_iterator it = mvlist.find(key); 200 200 if (it == mvlist.end()) return(def); 201 201 return((*it).second.elval.iv); … … 205 205 /*! Returns the value corresponding to name \b key, converted to double 206 206 Default value \b def is returned if name \b key not found */ 207 r_8 DVList::GetD(string const& key, r_8 def) 208 { 209 ValList:: iterator it = mvlist.find(key);207 r_8 DVList::GetD(string const& key, r_8 def) const 208 { 209 ValList::const_iterator it = mvlist.find(key); 210 210 if (it == mvlist.end()) return(def); 211 211 return((*it).second.elval.dv); … … 215 215 /*! Returns the value corresponding to name \b key, converted to complex 216 216 Default value \b def is returned if name \b key not found */ 217 complex<r_8> DVList::GetZ(string const& key, complex<r_8> def) 218 { 219 ValList:: iterator it = mvlist.find(key);217 complex<r_8> DVList::GetZ(string const& key, complex<r_8> def) const 218 { 219 ValList::const_iterator it = mvlist.find(key); 220 220 if (it == mvlist.end()) return(def); 221 221 return((*it).second.elval.dv); … … 225 225 /*! Returns the value corresponding to name \b key, converted to string 226 226 Default value \b def is returned if name \b key not found */ 227 string DVList::GetS(string const& key, char* def) 228 { 229 ValList:: iterator it = mvlist.find(key);227 string DVList::GetS(string const& key, char* def) const 228 { 229 ValList::const_iterator it = mvlist.find(key); 230 230 if (it == mvlist.end()) return(def); 231 231 return(*((*it).second.elval.strv)); … … 234 234 /* --Methode-- */ 235 235 /*! Returns the comment associated with name \b key */ 236 string DVList::GetComment(string const& key) 237 { 238 ValList:: iterator it = mvlist.find(key);236 string DVList::GetComment(string const& key) const 237 { 238 ValList::const_iterator it = mvlist.find(key); 239 239 if (it == mvlist.end()) return(""); 240 240 return((*it).second.elcomm); … … 259 259 260 260 /* --Methode-- */ 261 /*! Removes the definition and value associated with the name \b key. 262 Return \c true if the \b key is found in the list, \c false otherwise. */ 263 bool DVList::DeleteKey(string const& key) 264 { 265 ValList::iterator it = mvlist.find(key); 266 if (it == mvlist.end()) return(false); 267 mvlist.erase(it); 268 return(true); 269 } 270 271 /* --Methode-- */ 272 /*! Return \c true if the \b key is found in the list, \c false otherwise. */ 273 bool DVList::HasKey(string const& key) const 274 { 275 ValList::const_iterator it = mvlist.find(key); 276 if (it == mvlist.end()) return(false); 277 return(true); 278 } 279 280 281 /* --Methode-- */ 261 282 /*! Appends or sets the integer value \b val in the list with name \b key */ 262 283 void DVList::SetI(string const& key, int_8 val) … … 316 337 // Renvoie une référence sur le champ commentaire de l'objet. 317 338 //-- 339 340 /* --Methode-- */ 341 /*! Return the MuTyV value associated with name \b key . 342 Integer 0 is returned if \b key is not present in the list */ 343 MuTyV DVList::Get(string const& key) const 344 { 345 ValList::const_iterator it = mvlist.find(key); 346 if (it == mvlist.end()) return(MuTyV(0)); 347 else return((*it).second.elval); 348 } 318 349 319 350 /* --Methode-- */
Note:
See TracChangeset
for help on using the changeset viewer.