/* The software in this package is distributed under the GNU General Public License version 2 (with a special exception described below). A copy of GNU General Public License (GPL) is included in this distribution, in the file COPYING.GPL. As a special exception, if other files instantiate templates or use macros or inline functions from this file, or you compile this file and link it with other works to produce a work based on this file, this file does not by itself cause the resulting work to be covered by the GNU General Public License. However the source code for this file must still be made available in accordance with section (3) of the GNU General Public License. This exception does not invalidate any other reasons why a work based on this file might be covered by the GNU General Public License. */ /** @file * * @copyright © Copyright 2007-2008 by Intra2net AG */ #ifndef __I2N_COMMON_SOURCE_TRACK_BASICS_HPP__ #define __I2N_COMMON_SOURCE_TRACK_BASICS_HPP__ #include #include /* ** some helper macros */ /** * macro which encapsulates the construction of a source location. */ #define HERE ::I2n::SourceLocation(__FILE__,__LINE__,BOOST_CURRENT_FUNCTION) namespace I2n { /** * (helper) struct for providing a source location. * Construction should be done with appropriate macros (like @a HERE) */ struct SourceLocation { std::string File; long Line; std::string FunctionName; SourceLocation(); SourceLocation( const std::string& file, long line, const std::string& funcname); operator bool() const { return Line>0 and not File.empty() and not FunctionName.empty(); } // eo operator bool std::string get_function_name() const { return FunctionName; } std::string get_filename() const { return File; } long get_line_number() const { return Line; } std::string get_location_tag() const; private: mutable std::string LocationTag; }; // eo struct SourceLocation } // eo namepsace I2n #endif