Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members | Related Pages | Examples

psourceinfo.h

Go to the documentation of this file.
00001 /*
00002  *   P::Classes - Portable C++ Application Framework
00003  *   Copyright (C) 2000-2003  Christian Prochnow <cproch@seculogix.de>
00004  *
00005  *   This library is free software; you can redistribute it and/or
00006  *   modify it under the terms of the GNU Lesser General Public
00007  *   License as published by the Free Software Foundation; either
00008  *   version 2 of the License, or (at your option) any later version.
00009  *
00010  *   This library is distributed in the hope that it will be useful,
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  *   Lesser General Public License for more details.
00014  *
00015  *   You should have received a copy of the GNU Lesser General Public
00016  *   License along with this library; if not, write to the Free Software
00017  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018  */
00019 
00020 #ifndef _psourceinfo_h_
00021 #define _psourceinfo_h_
00022 
00023 #include <pclasses/pexport.h>
00024 
00025 /* GNU C++ compiler */
00026 #ifdef __GNUC__
00027   #define P_PRETTY_FUNCTION __PRETTY_FUNCTION__
00028 /* Borland C++ */
00029 #elif defined(__BORLANDC__)
00030   #define P_PRETTY_FUNCTION __FUNC__
00031 /* Microsoft C++ compiler */
00032 #elif defined(_MSC_VER_)
00033   /* .NET 2003 support's demangled function names */
00034   #if _MSC_VER_ >= 1300
00035     #define P_PRETTY_FUNCTION __FUNCDNAME__
00036   #else
00037     #define P_PRETTY_FUNCTION __FUNCTION__
00038   #endif
00039 /* otherwise use standard macro */
00040 #else
00041   #define P_PRETTY_FUNCTION __FUNCTION__
00042 #endif
00043 
00044 #define P_SOURCEINFO P::SourceInfo(__FILE__,__LINE__,P_PRETTY_FUNCTION)
00045 
00046 namespace P {
00047 
00049 
00055 class PCORE_EXPORT SourceInfo {
00056   public:
00058     SourceInfo() throw();
00059 
00061     SourceInfo(const SourceInfo& si) throw();
00062 
00064 
00069     SourceInfo(const char* _file, unsigned int _line, const char* _func) throw();
00070 
00072 
00077     inline const char* file() const throw() {
00078       return m_file;
00079     }
00080 
00082 
00087     inline unsigned int line() const throw() {
00088       return m_line;
00089     }
00090 
00092 
00097     inline const char* func() const throw() {
00098       return m_func;
00099     }
00100 
00102     SourceInfo& operator=(const SourceInfo& si);
00103 
00104   private:
00105     const char*   m_file;
00106     unsigned int  m_line;
00107     const char*   m_func;
00108 
00109 };
00110 
00111 }
00112 
00113 #endif

Generated on Fri Mar 12 21:08:31 2004 for P::Classes by doxygen 1.3.3