log4cpp 1.1

PortabilityImpl.hh

Go to the documentation of this file.
00001 /*
00002  * PortabilityImpl.hh
00003  *
00004  * Copyright 2002, Log4cpp Project. All rights reserved.
00005  *
00006  * See the COPYING file for the terms of usage and distribution.
00007  */
00008 
00009 #ifndef _LOG4CPP_PORTABILITYIMPL_HH
00010 #define _LOG4CPP_PORTABILITYIMPL_HH
00011 
00012 #include <log4cpp/Portability.hh>
00013 
00014 #ifdef LOG4CPP_CSTDLIB_NOT_IN_STD
00015 #include <cstdlib>
00016 namespace std {
00017     static inline char *getenv(const char *name) { return ::getenv(name); };
00018     static inline int atoi(const char *nptr) { return ::atoi(nptr); };
00019     static inline unsigned long int
00020         strtoul(const char *nptr, char **endptr, int base) { 
00021         return ::strtol(nptr, endptr, base); 
00022     };
00023     static inline void abort(void) { ::abort(); };
00024 
00025 }
00026 #endif
00027     
00028 #ifdef LOG4CPP_CSTRING_NOT_IN_STD
00029 #include <cstring>
00030 namespace std {
00031     static inline void *memmove(void *dest, const void *src, size_t n) {
00032         return ::memmove(dest, src, n);
00033     };
00034 }
00035 #endif
00036 
00037 #ifdef LOG4CPP_CTIME_NOT_IN_STD
00038 #include <ctime>
00039 namespace std {
00040     static inline size_t strftime(char *strDest, size_t maxsize, const char *format, const struct tm *timeptr ) {
00041         return ::strftime(strDest,maxsize,format,timeptr);
00042     }
00043     static inline struct tm *localtime( const time_t *timer ) { return ::localtime(timer); }
00044     using ::clock;
00045     using ::tm;
00046     using ::time_t;
00047 }
00048 #endif
00049 
00050 #ifdef LOG4CPP_CMATH_NOT_IN_STD
00051 #include <cmath>
00052 namespace std {
00053     static inline int abs(int i) { return ::abs(i); }
00054 }
00055 #endif
00056 
00057 namespace log4cpp
00058 {
00059     template<typename T> const T& min(const T& a, const T& b)
00060     {
00061        return a < b ? a : b;
00062     }
00063 
00064     template<typename T> const T& max(const T& a, const T& b)
00065     {
00066        return a > b ? a : b;
00067     }
00068 }
00069 
00070 #endif // _LOG4CPP_PORTABILITYIMPL_HH
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines