00001 /* 00002 CLAW - a C++ Library Absolutely Wonderful 00003 00004 CLAW is a free library without any particular aim but being useful to 00005 anyone. 00006 00007 Copyright (C) 2005-2008 Julien Jorge 00008 00009 This library is free software; you can redistribute it and/or 00010 modify it under the terms of the GNU Lesser General Public 00011 License as published by the Free Software Foundation; either 00012 version 2.1 of the License, or (at your option) any later version. 00013 00014 This library is distributed in the hope that it will be useful, 00015 but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00017 Lesser General Public License for more details. 00018 00019 You should have received a copy of the GNU Lesser General Public 00020 License along with this library; if not, write to the Free Software 00021 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00022 00023 contact: julien_jorge@yahoo.fr 00024 */ 00031 #ifndef __CLAW_SYSTEM_INFO_WIN32_HPP__ 00032 #define __CLAW_SYSTEM_INFO_WIN32HPP__ 00033 00034 #include <cstdlib> 00035 #include <string> 00036 00037 namespace claw 00038 { 00044 class system_info 00045 { 00046 public: 00047 /*------------------------------------------------------------------------*/ 00051 static std::string get_user_name() 00052 { 00053 return get_environment("USERNAME"); 00054 } // get_user_name() 00055 00056 /*------------------------------------------------------------------------*/ 00060 static std::string get_user_directory() 00061 { 00062 return get_environment("USERPROFILE"); 00063 } // get_user_directory() 00064 00065 /*------------------------------------------------------------------------*/ 00069 template<typename Sequence> 00070 static void get_path( Sequence& path ) 00071 { 00072 // 00073 } // get_path() 00074 00075 /*------------------------------------------------------------------------*/ 00079 static std::string get_host_name() 00080 { 00081 return get_environment("COMPUTERNAME"); 00082 } // get_host_name() 00083 00084 /*------------------------------------------------------------------------*/ 00089 static std::string get_temporary_directory() 00090 { 00091 return get_environment("TEMP"); 00092 } // get_temporary_directory() 00093 00094 /*------------------------------------------------------------------------*/ 00099 static std::string get_environment( const std::string& var ) 00100 { 00101 char* value = getenv( var.c_str() ); 00102 std::string result; 00103 00104 if ( value ) 00105 result = value; 00106 00107 return result; 00108 } // get_environment() 00109 00110 }; // class system_info 00111 } // namespace claw 00112 00113 #endif // __CLAW_SYSTEM_INFO_WIN32_HPP__