All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
SystemApplicationSettings.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/SystemApplicationSettings.cpp
22 
23  \brief A singleton for managing application settings applied to the whole system (all users).
24 */
25 
26 // TerraLib
27 #include "Exception.h"
28 //#include "OSSettingsDir.h"
30 #include "Translator.h"
31 
32 // STL
33 #include <cstdlib>
34 
35 // Boost
36 #include <boost/filesystem.hpp>
37 
38 //void te::common::SystemApplicationSettings::load()
39 //{
40 //// look in the application current dir for a file TERRALIB_SYSTEM_SETTINGS_FILE inside the folder TERRALIB_CONFIG_DIR
41 // boost::filesystem::path config_file = boost::filesystem::current_path();
42 //
43 // config_file /= TERRALIB_CONFIG_DIR;
44 //
45 // config_file /= TERRALIB_SYSTEM_SETTINGS_FILE;
46 //
47 // if(boost::filesystem::is_regular_file(config_file))
48 // {
49 // load(config_file.string());
50 // return;
51 // }
52 //
53 //// if not found let's try to search in the system application data dir
54 // //const std::string& app_data_dir = OSSettingsDir::getInstance().getSystemSettingsPath();
55 //
56 // //if(!app_data_dir.empty())
57 // //{
58 // // config_file = app_data_dir;
59 //
60 // // config_file /= TERRALIB_DIR;
61 //
62 // // config_file /= TERRALIB_SYSTEM_SETTINGS_FILE;
63 //
64 // // if(boost::filesystem::is_regular_file(config_file))
65 // // {
66 // // load(config_file.string());
67 // // return;
68 // // }
69 // //}
70 //
71 //// the last chance...
72 // char* mgis_dir = getenv(TERRALIB_DIR_VAR_NAME);
73 //
74 // if(mgis_dir != 0)
75 // {
76 // config_file = mgis_dir;
77 //
78 // config_file /= TERRALIB_CONFIG_DIR;
79 //
80 // config_file /= TERRALIB_SYSTEM_SETTINGS_FILE;
81 //
82 // if(boost::filesystem::is_regular_file(config_file))
83 // {
84 // load(config_file.string());
85 // return;
86 // }
87 // }
88 //
89 // throw Exception(TE_TR("Could not find system application config file!"));
90 //}
91 
92 void te::common::SystemApplicationSettings::load(const std::string& fileName)
93 {
94  ApplicationSettings::load(fileName);
95 }
96 
98 {
99 }
100 
102 {
103 }
104 
105 
void load(const std::string &settingsFile)
It initializes the application settings.
SystemApplicationSettings()
It initializes the singleton.
This class is designed for dealing with multi-language text translation in TerraLib.
This class is designed to declare objects to be thrown as exceptions by TerraLib. ...
void load(const std::string &fileName)
It tries to find a default config file based on system macros and default condigurations.
A singleton for managing application settings applied to the whole system (all users).