00001 //-------------------------------------------------------------------------- 00002 // File and Version Information: 00003 // $Id: Context.cpp 1471 2011-01-31 18:08:54Z salnikov $ 00004 // 00005 // Description: 00006 // Class Context... 00007 // 00008 // Author List: 00009 // Andrei Salnikov 00010 // 00011 //------------------------------------------------------------------------ 00012 00013 //----------------------- 00014 // This Class's Header -- 00015 //----------------------- 00016 #include "ErrSvc/Context.h" 00017 00018 //----------------- 00019 // C/C++ Headers -- 00020 //----------------- 00021 #include <iostream> 00022 00023 //------------------------------- 00024 // Collaborating Class Headers -- 00025 //------------------------------- 00026 00027 //----------------------------------------------------------------------- 00028 // Local Macros, Typedefs, Structures, Unions and Forward Declarations -- 00029 //----------------------------------------------------------------------- 00030 00031 // ---------------------------------------- 00032 // -- Public Function Member Definitions -- 00033 // ---------------------------------------- 00034 00035 namespace ErrSvc { 00036 00037 //---------------- 00038 // Constructors -- 00039 //---------------- 00040 Context::Context (const char* file, int line, const char* func) 00041 : m_file(file) 00042 , m_func(func) 00043 , m_line(line) 00044 { 00045 } 00046 00047 // Stream insertion operator 00048 std::ostream& 00049 operator<<(std::ostream& out, const Context& ctx) 00050 { 00051 return out << "in function " << ctx.function() << " at " 00052 << ctx.file() << ":" << ctx.line(); 00053 } 00054 00055 } // namespace ErrSvc