Goose  Artifact [2f72948331]

Artifact 2f729483317c98dc690c6e8c95ca97613cc8cce5e4c6a79c4a89b1f97dde7491:

  • File bs/ir/location.h — part of check-in [0ecc93dff5] at 2019-01-13 16:24:54 on branch trunk — Lexer: fix token locations. (user: achavasse size: 750)

#ifndef EMPATHY_IR_LOCATION_H
#define EMPATHY_IR_LOCATION_H

namespace empathy::ir
{
    class Location
    {
        public:
            Location() {}

            template< typename S >
            Location( S&& filename, uint32_t line, uint32_t column ) :
                m_filename( forward< S >( filename ) ),
                m_line( line ),
                m_column( column )
            {}

            friend ostream& operator<<( ostream& out, const Location& loc )
            {
                return out << *loc.m_filename << ':' << loc.m_line << ':' << loc.m_column;
            }

        private:
            ptr< string >   m_filename;
            uint32_t        m_line = 0;
            uint32_t        m_column = 0;
    };
}

#endif