Apache log4cxx  Version 0.12.1
locationinfo.h
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef _LOG4CXX_SPI_LOCATION_LOCATIONINFO_H
19 #define _LOG4CXX_SPI_LOCATION_LOCATIONINFO_H
20 
21 #include <log4cxx/log4cxx.h>
22 #include <string>
24 
25 namespace log4cxx
26 {
27 namespace spi
28 {
33 class LOG4CXX_EXPORT LocationInfo
34 {
35  public:
36 
37 
38 
43  static const char* const NA;
44  static const char* const NA_METHOD;
45 
46  static const LocationInfo& getLocationUnavailable();
47 
48 
49 
55  LocationInfo( const char* const fileName,
56  const char* const functionName,
57  int lineNumber);
58 
62  LocationInfo();
63 
68  LocationInfo( const LocationInfo& src );
69 
74  LocationInfo& operator = ( const LocationInfo& src );
75 
79  void clear();
80 
81 
83  const std::string getClassName() const;
84 
89  const char* getFileName() const;
90 
95  int getLineNumber() const;
96 
98  const std::string getMethodName() const;
99 
101 
102 
103  private:
105  int lineNumber;
106 
108  const char* fileName;
109 
111  const char* methodName;
112 
113 
114 };
115 }
116 }
117 
118 #if !defined(LOG4CXX_LOCATION)
119 #if defined(_MSC_VER)
120  #if _MSC_VER >= 1300
121  #define __LOG4CXX_FUNC__ __FUNCSIG__
122  #endif
123 #else
124  #if defined(__GNUC__)
125  #define __LOG4CXX_FUNC__ __PRETTY_FUNCTION__
126  #else
127  #if defined(__BORLANDC__)
128  #define __LOG4CXX_FUNC__ __FUNC__
129  #endif
130  #endif
131 #endif
132 #if !defined(__LOG4CXX_FUNC__)
133  #define __LOG4CXX_FUNC__ ""
134 #endif
135 #define LOG4CXX_LOCATION ::log4cxx::spi::LocationInfo(__FILE__, \
136  __LOG4CXX_FUNC__, \
137  __LINE__)
138 #endif
139 
140 #endif //_LOG4CXX_SPI_LOCATION_LOCATIONINFO_H
static const char *const NA_METHOD
Definition: locationinfo.h:44
Emulates java serialization.
Definition: objectoutputstream.h:33
Definition: pool.h:32
This class represents the location of a logging statement.
Definition: locationinfo.h:33
Definition: appender.h:32
static const char *const NA
When location information is not available the constant NA is returned.
Definition: locationinfo.h:43