UserApplicationSettings.h
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.h
22 
23  \brief A singleton for managing application settings applied to a single user.
24 */
25 
26 #ifndef __TERRALIB_COMMON_INTERNAL_USERAPPLICATIONSETTINGS_H
27 #define __TERRALIB_COMMON_INTERNAL_USERAPPLICATIONSETTINGS_H
28 
29 // TerraLib
30 #include "ApplicationSettings.h"
31 #include "Singleton.h"
32 
33 namespace te
34 {
35  namespace common
36  {
37  /*!
38  \class UserApplicationSettings
39 
40  \brief A singleton for managing application settings applied to a single user.
41 
42  This singleton can be used to keep user preferences that
43  customize the application's appearance and behavior for a given user.
44 
45  It will look for an user configuration file as follows:
46  <ul>
47  <li>first, searchs for the user settings file name in the system application settings singleton</li>
48  <li>if not found, use the file name defined by the macro TERRALIB_USER_SETTINGS_FILE</li>
49  <li>then it check for this file in the current application dir under the folder TERRALIB_CONFIG_DIR</li>
50  <li>if not found, it checks for in the user data dir (plataform dependent!)</li>
51  <li>and finally it uses a location defined by an environment variable TERRALIB_DIR_ENVVAR and a sub-dir defined by the macro TERRALIB_CONFIG_DIR</li>
52  </ul>
53 
54  \ingroup common
55  */
57  : public ApplicationSettings,
58  public Singleton<UserApplicationSettings>
59  {
61 
62  public:
63 
64  /*! \brief It tries to find a default config file based on system macros and default condigurations. */
65  //void load();
66 
67  /*!
68  \brief It loads the setting from the given file.
69 
70  \param fileName It must be the full path to the settings file.
71  */
72  void load(const std::string& fileName);
73 
74  protected:
75 
76  /*! \brief It initializes the singleton. */
78 
79  /*! \brief Destructor. */
81  };
82 
83  } // end namespace common
84 } // end namespace te
85 
86 #endif // __TERRALIB_COMMON_INTERNAL_USERAPPLICATIONSETTINGS_H
87 
A singleton for managing application settings applied to a single user.
A class for managing application settings.
Template support for singleton pattern.
URI C++ Library.
#define TECOMMONEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:65
A class for managing application settings.
Template support for singleton pattern.
Definition: Singleton.h:100