2 The software in this package is distributed under the GNU General
3 Public License version 2 (with a special exception described below).
5 A copy of GNU General Public License (GPL) is included in this distribution,
6 in the file COPYING.GPL.
8 As a special exception, if other files instantiate templates or use macros
9 or inline functions from this file, or you compile this file and link it
10 with other works to produce a work based on this file, this file
11 does not by itself cause the resulting work to be covered
12 by the GNU General Public License.
14 However the source code for this file must still be made available
15 in accordance with section (3) of the GNU General Public License.
17 This exception does not invalidate any other reasons why a work based
18 on this file might be covered by the GNU General Public License.
22 * @copyright © Copyright 2007-2008 by Intra2net AG
25 #ifndef __I2N_COMMON_SOURCE_TRACK_BASICS_HPP__
26 #define __I2N_COMMON_SOURCE_TRACK_BASICS_HPP__
29 #include <boost/current_function.hpp>
36 * macro which encapsulates the construction of a source location.
38 #define HERE ::I2n::SourceLocation(__FILE__,__LINE__,BOOST_CURRENT_FUNCTION)
46 * (helper) struct for providing a source location.
47 * Construction should be done with appropriate macros (like @a HERE)
53 std::string FunctionName;
58 const std::string& file,
60 const std::string& funcname);
64 return Line>0 and not File.empty() and not FunctionName.empty();
67 std::string get_function_name() const { return FunctionName; }
68 std::string get_filename() const { return File; }
69 long get_line_number() const { return Line; }
71 std::string get_location_tag() const;
75 mutable std::string LocationTag;
77 }; // eo struct SourceLocation