All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
UserApplicationSettings.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file terralib/common/UserApplicationSettings.cpp
22 
23  \brief A singleton for managing application settings applied to a single user.
24 */
25 
26 // TerraLib
27 #include "Exception.h"
28 //#include "OSSettingsDir.h"
30 #include "Translator.h"
32 
33 // STL
34 #include <cstdlib>
35 
36 // Boost
37 #include <boost/filesystem.hpp>
38 
39 //void te::common::UserApplicationSettings::load()
40 //{
41 // std::string user_conf_file_name = SystemApplicationSettings::getInstance().getValue("Application.UserSettingsFile.<xmlattr>.xlink:href");
42 //
43 // if(user_conf_file_name.empty())
44 // user_conf_file_name = TERRALIB_USER_SETTINGS_FILE;
45 //
46 //// first: current application dir
47 // boost::filesystem::path user_settings_file = boost::filesystem::current_path();
48 //
49 // user_settings_file /= TERRALIB_CONFIG_DIR;
50 //
51 // user_settings_file /= user_conf_file_name;
52 //
53 // if(boost::filesystem::is_regular_file(user_settings_file))
54 // {
55 // load(user_settings_file.string());
56 // return;
57 // }
58 //
59 //// second: user data dir
60 // //const std::string& user_data_dir = OSSettingsDir::getInstance().getUserSettingsPath();
61 //
62 // //if(!user_data_dir.empty())
63 // //{
64 // // user_settings_file = user_data_dir;
65 //
66 // // user_settings_file /= TERRALIB_DIR;
67 //
68 // // user_settings_file /= user_conf_file_name;
69 //
70 // // if(boost::filesystem::is_regular_file(user_settings_file))
71 // // {
72 // // load(user_settings_file.string());
73 // // return;
74 // // }
75 // //}
76 //
77 //// the last chance...
78 // char* mgis_dir = getenv(TERRALIB_DIR_VAR_NAME);
79 //
80 // if(mgis_dir != 0)
81 // {
82 // user_settings_file = mgis_dir;
83 //
84 // user_settings_file /= TERRALIB_CONFIG_DIR;
85 //
86 // user_settings_file /= user_conf_file_name;
87 //
88 // if(boost::filesystem::is_regular_file(user_settings_file))
89 // {
90 // load(user_settings_file.string());
91 // return;
92 // }
93 // }
94 //}
95 
96 void te::common::UserApplicationSettings::load(const std::string& fileName)
97 {
98  ApplicationSettings::load(fileName);
99 }
100 
102 {
103 }
104 
106 {
107 }
108 
109 
void load(const std::string &settingsFile)
It initializes the application settings.
A singleton for managing application settings applied to a single user.
This class is designed for dealing with multi-language text translation in TerraLib.
void load(const std::string &fileName)
It tries to find a default config file based on system macros and default condigurations.
This class is designed to declare objects to be thrown as exceptions by TerraLib. ...
A singleton for managing application settings applied to the whole system (all users).
UserApplicationSettings()
It initializes the singleton.