Apache log4cxx  Version 0.11.0
inetaddress.h
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_HELPER_INETADDRESS_H
19 #define _LOG4CXX_HELPER_INETADDRESS_H
20 
21 #if defined(_MSC_VER)
22  #pragma warning ( push )
23  #pragma warning ( disable: 4231 4251 4275 4786 )
24 #endif
25 
26 
27 
28 #include <log4cxx/helpers/objectimpl.h>
29 #include <log4cxx/helpers/objectptr.h>
30 #include <log4cxx/logstring.h>
31 #include <vector>
32 #include <log4cxx/helpers/exception.h>
33 
34 namespace log4cxx
35 {
36 namespace helpers
37 {
38 class LOG4CXX_EXPORT UnknownHostException : public Exception
39 {
40  public:
41  UnknownHostException(const LogString& msg);
43  UnknownHostException& operator=(const UnknownHostException& src);
44 };
45 
46 
47 class InetAddress;
48 LOG4CXX_PTR_DEF(InetAddress);
49 LOG4CXX_LIST_DEF(InetAddressList, InetAddressPtr);
50 
51 class LOG4CXX_EXPORT InetAddress : public ObjectImpl
52 {
53  public:
54  DECLARE_ABSTRACT_LOG4CXX_OBJECT(InetAddress)
55  BEGIN_LOG4CXX_CAST_MAP()
56  LOG4CXX_CAST_ENTRY(InetAddress)
57  END_LOG4CXX_CAST_MAP()
58 
59  InetAddress(const LogString& hostName, const LogString& hostAddr);
60 
63  static InetAddressList getAllByName(const LogString& host);
64 
67  static InetAddressPtr getByName(const LogString& host);
68 
71  LogString getHostAddress() const;
72 
75  LogString getHostName() const;
76 
79  static InetAddressPtr getLocalHost();
80 
85  static InetAddressPtr anyAddress();
86 
89  LogString toString() const;
90 
91  private:
92  LogString ipAddrString;
93 
94  LogString hostNameString;
95 
96 }; // class InetAddress
97 } // namespace helpers
98 } // namespace log4cxx
99 
100 #if defined(_MSC_VER)
101  #pragma warning ( pop )
102 #endif
103 
104 
105 #endif // _LOG4CXX_HELPER_INETADDRESS_H
106 
Implementation class for Object.
Definition: objectimpl.h:28
Definition: inetaddress.h:38
Definition: inetaddress.h:51
Definition: appender.h:33
The class Exception and its subclasses indicate conditions that a reasonable application might want t...
Definition: exception.h:37