log4cpp  1.1.6
PortabilityImpl.hh
Go to the documentation of this file.
1 /*
2  * PortabilityImpl.hh
3  *
4  * Copyright 2002, Log4cpp Project. All rights reserved.
5  *
6  * See the COPYING file for the terms of usage and distribution.
7  */
8 
9 #ifndef _LOG4CPP_PORTABILITYIMPL_HH
10 #define _LOG4CPP_PORTABILITYIMPL_HH
11 
12 #include <log4cpp/Portability.hh>
13 
14 #ifdef LOG4CPP_CSTDLIB_NOT_IN_STD
15 #include <cstdlib>
16 namespace std {
17  static inline char* getenv(const char* name) {
18  return ::getenv(name);
19  };
20  static inline int atoi(const char* nptr) {
21  return ::atoi(nptr);
22  };
23  static inline unsigned long int strtoul(const char* nptr, char** endptr, int base) {
24  return ::strtol(nptr, endptr, base);
25  };
26  static inline void abort(void) {
27  ::abort();
28  };
29 
30 } // namespace std
31 #endif
32 
33 #ifdef LOG4CPP_CSTRING_NOT_IN_STD
34 #include <cstring>
35 namespace std {
36  static inline void* memmove(void* dest, const void* src, size_t n) {
37  return ::memmove(dest, src, n);
38  };
39 } // namespace std
40 #endif
41 
42 #ifdef LOG4CPP_CTIME_NOT_IN_STD
43 #include <ctime>
44 namespace std {
45  static inline size_t strftime(char* strDest, size_t maxsize, const char* format, const struct tm* timeptr) {
46  return ::strftime(strDest, maxsize, format, timeptr);
47  }
48  static inline struct tm* localtime(const time_t* timer) {
49  return ::localtime(timer);
50  }
51  using ::clock;
52  using ::time_t;
53  using ::tm;
54 } // namespace std
55 #endif
56 
57 #ifdef LOG4CPP_CMATH_NOT_IN_STD
58 #include <cmath>
59 namespace std {
60  static inline int abs(int i) {
61  return ::abs(i);
62  }
63 } // namespace std
64 #endif
65 
66 namespace log4cpp {
67  template <typename T> const T& min(const T& a, const T& b) {
68  return a < b ? a : b;
69  }
70 
71  template <typename T> const T& max(const T& a, const T& b) {
72  return a > b ? a : b;
73  }
74 } // namespace log4cpp
75 
76 #endif // _LOG4CPP_PORTABILITYIMPL_HH
const T & min(const T &a, const T &b)
Definition: PortabilityImpl.hh:67
Definition: Portability.hh:61
const T & max(const T &a, const T &b)
Definition: PortabilityImpl.hh:71
The top level namespace for all &#39;Log for C++&#39; types and classes.
Definition: AbortAppender.hh:16
void localtime(const ::time_t *time, ::tm *t)
Definition: Localtime.cpp:27