35 # include <sys/types.h> 56 : logger(
"ProfileManager", std::cerr)
94 message =
"Loaded profile: " + filename;
103 message =
"Failed to load profile: " + filename;
115 std::list<std::string> profiles;
131 if (! profilename.empty()) {
132 profiles.push_back(profilename);
138 for (std::list<std::string>::const_iterator it = profiles.begin();
139 it != profiles.end();
163 res = RegOpenKeyExA (HKEY_CURRENT_USER,
"Software\\Presage", 0,
166 if (res == ERROR_SUCCESS)
169 dst = (
char*) malloc (size);
171 res = RegQueryValueExA (reg_key,
"", 0, &type,
172 (LPBYTE) dst, &size);
173 if (res == ERROR_MORE_DATA && type == REG_SZ) {
174 char* tmp_dst = (
char*) realloc (dst, size);
175 if (tmp_dst != NULL) {
180 dst = (
char*) malloc (size);
186 res = RegQueryValueExA (reg_key,
"", 0,
191 if (type != REG_SZ || res != ERROR_SUCCESS)
203 RegCloseKey (reg_key);
219 const char* USERPROFILE =
"USERPROFILE";
220 char* value = getenv(USERPROFILE);
228 struct passwd *my_passwd;
231 my_passwd = getpwuid (me);
235 result = my_passwd->pw_dir;
239 # endif // HAVE_PWD_H 241 const char*
HOME =
"HOME";
242 char* value = getenv(
HOME);
266 logger << ERROR <<
"Failed to save configuration to profile " <<
endl;
static const char * DEFAULT_PROFILE_FILENAME
Configuration * get_configuration()
std::string get_system_etc_dir() const
static const char * LOGGER
void save_profile() const
std::list< CachedLogMessage > cached_log_messages
_SetLevel setlevel(std::string __l)
Manipulator for level.
Variable * find(const std::string &variable) const
bool file_read_ok() const
bool loaded_at_least_one_profile
bool write_to_file() const
void read_from_configuration(Configuration *configuration)
void set_autopersist(const std::string &value)
std::string get_value() const
void init_profiles(const std::string &profilename)
void cache_log_message(Logger< char >::Level level, const std::string &message)
static const char * AUTOPERSIST
void read_into_configuration(Configuration *configuration)
static bool isTrue(const char *)
void flush_cached_log_messages()
Profile * create_profile_from_xml(const std::string &filename)
ProfileManager(const std::string="")
const Logger< _charT, _Traits > & endl(const Logger< _charT, _Traits > &lgr)
std::string get_user_home_dir() const