diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 1998-01-02 06:38:41 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 1998-01-02 06:38:41 +0000 |
commit | f611d5dca8cc705a728dafc8d0cd80cdfb93182e (patch) | |
tree | 056ab9034763cfb3f3ce929ac991503fb3459334 /ace/Env_Value_T.i | |
parent | 242a9609919b5b0e00731108069b99c4d7b8be8f (diff) | |
download | ATCD-f611d5dca8cc705a728dafc8d0cd80cdfb93182e.tar.gz |
*** empty log message ***
Diffstat (limited to 'ace/Env_Value_T.i')
-rw-r--r-- | ace/Env_Value_T.i | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/ace/Env_Value_T.i b/ace/Env_Value_T.i index 0770f86c79c..31828bfe385 100644 --- a/ace/Env_Value_T.i +++ b/ace/Env_Value_T.i @@ -9,18 +9,22 @@ ACE_Env_Value<T>::operator const T (void) const template <class T> ACE_INLINE ACE_Env_Value<T>::ACE_Env_Value (void) : varname_ (0) -{} +{ +} template <class T> ACE_INLINE -ACE_Env_Value<T>::ACE_Env_Value (const char* varname, const T& defval) - : varname_ (varname), value_(defval) +ACE_Env_Value<T>::ACE_Env_Value (const char *varname, + const T &defval) + : varname_ (varname), + value_(defval) { this->fetch_value (); } template <class T> ACE_INLINE void -ACE_Env_Value<T>::open (const char* varname, const T& defval) +ACE_Env_Value<T>::open (const char *varname, + const T &defval) { varname_ = varname; value_ = defval; @@ -28,20 +32,19 @@ ACE_Env_Value<T>::open (const char* varname, const T& defval) } template <class T> ACE_INLINE void -ACE_Env_Value<T>::fetch_value () +ACE_Env_Value<T>::fetch_value (void) { - const char* env = ACE_OS::getenv (varname_); + const char *env = ACE_OS::getenv (varname_); + if (env != 0) ACE_Convert (env, value_); } - template <class T> ACE_INLINE ACE_Env_Value<T>::~ACE_Env_Value (void) { } - // Default calls a CTOR on type T of the form 'T::T(const char*)', but // users can feel free to create their own specialized conversion // functions if necessary, as shown below. Note that for 'char*' the @@ -49,43 +52,43 @@ ACE_Env_Value<T>::~ACE_Env_Value (void) // conversion will be necessary. template <class T> ACE_INLINE void -ACE_Convert (const char* s, T& t) +ACE_Convert (const char *s, T &t) { - t = T(s); + t = T (s); } ACE_INLINE void -ACE_Convert (const char* s, char*& v) +ACE_Convert (const char *s, char *&v) { - v = (char*)s; + v = (char *) s; } ACE_INLINE void -ACE_Convert (const char* s, short& si) +ACE_Convert (const char *s, short &si) { si = ACE_OS::strtol (s, 0, 10); } ACE_INLINE void -ACE_Convert (const char* s, long& l) +ACE_Convert (const char *s, long &l) { l = ACE_OS::strtol (s, 0, 10); } ACE_INLINE void -ACE_Convert (const char* s, int& i) +ACE_Convert (const char *s, int &i) { i = ACE_OS::strtol (s, 0, 10); } ACE_INLINE void -ACE_Convert (const char* s, unsigned long& ul) +ACE_Convert (const char *s, u_long &ul) { ul = ACE_OS::strtoul (s, 0, 10); } ACE_INLINE void -ACE_Convert (const char* s, double& d) +ACE_Convert (const char *s, double &d) { d = ACE_OS::strtod (s, 0); } |