Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Common/utility.h

    rf57668a r3ad7978  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Fri May 5 11:03:00 2017
    13 // Update Count     : 32
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Wed Dec 14 21:25:25 2016
     13// Update Count     : 31
    1414//
    1515
     
    322322        std::string filename;
    323323
    324     /// Create a new unset CodeLocation.
    325         CodeLocation()
     324        CodeLocation()
    326325                : linenumber( -1 )
    327326                , filename("")
    328327        {}
    329328
    330     /// Create a new CodeLocation with the given values.
    331329        CodeLocation( const char* filename, int lineno )
    332330                : linenumber( lineno )
    333331                , filename(filename ? filename : "")
    334332        {}
    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.
    350333};
    351334
    352335inline 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) + " " : "";
    354337}
    355338#endif // _UTILITY_H
Note: See TracChangeset for help on using the changeset viewer.