Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Common/utility.h

    r4a9ccc3 r138e29e  
    2525#include <sstream>
    2626#include <string>
     27
    2728#include <cassert>
    28 
    2929template< typename T >
    3030static inline T * maybeClone( const T *orig ) {
     
    303303        return group_iterate_t<Args...>(args...);
    304304}
     305
     306struct CodeLocation {
     307        int linenumber;
     308        std::string filename;
     309
     310        CodeLocation()
     311                : linenumber( -1 )
     312                , filename("")
     313        {}
     314
     315        CodeLocation( const char* filename, int lineno )
     316                : linenumber( lineno )
     317                , filename(filename ? filename : "")
     318        {}
     319};
     320
     321inline std::string to_string( const CodeLocation& location ) {
     322        return location.linenumber >= 0 ? location.filename + ":" + std::to_string(location.linenumber) + " " : "";
     323}
    305324#endif // _UTILITY_H
    306325
Note: See TracChangeset for help on using the changeset viewer.