Changes in src/Common/utility.h [f57668a:3ad7978]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Common/utility.h
rf57668a r3ad7978 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Andrew Beach12 // Last Modified On : Fri May 5 11:03:00 201713 // Update Count : 3 211 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Dec 14 21:25:25 2016 13 // Update Count : 31 14 14 // 15 15 … … 322 322 std::string filename; 323 323 324 /// Create a new unset CodeLocation. 325 CodeLocation() 324 CodeLocation() 326 325 : linenumber( -1 ) 327 326 , filename("") 328 327 {} 329 328 330 /// Create a new CodeLocation with the given values.331 329 CodeLocation( const char* filename, int lineno ) 332 330 : linenumber( lineno ) 333 331 , filename(filename ? filename : "") 334 332 {} 335 336 bool isSet () const {337 return -1 != linenumber;338 }339 340 bool isUnset () const {341 return !isSet();342 }343 344 void unset () {345 linenumber = -1;346 filename = "";347 }348 349 // Use field access for set.350 333 }; 351 334 352 335 inline std::string to_string( const CodeLocation& location ) { 353 return location. isSet()? location.filename + ":" + std::to_string(location.linenumber) + " " : "";336 return location.linenumber >= 0 ? location.filename + ":" + std::to_string(location.linenumber) + " " : ""; 354 337 } 355 338 #endif // _UTILITY_H
Note: See TracChangeset
for help on using the changeset viewer.