All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OSSettingsDir.h
Go to the documentation of this file.
1 /* Copyright (C) 2011-2012 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/OSSettingsDir.h
22 
23  \brief A singleton class for discovering the Operational System settings directories.
24 */
25 
26 #ifndef __TERRALIB_COMMON_INTERNAL_OSSETTINGSDIR_H
27 #define __TERRALIB_COMMON_INTERNAL_OSSETTINGSDIR_H
28 
29 // TerraLib
30 #include "Config.h"
31 #include "Singleton.h"
32 
33 // STL
34 #include <string>
35 
36 namespace te
37 {
38  namespace common
39  {
40  /*!
41  \class OSSettingsDir
42 
43  \brief A singleton class for discovering Operational System settings dir.
44 
45  Each Operational System has a default directory
46  where applications may store user settings or the whole
47  application settings (or system settings).
48 
49  This class is a wrapper around each Operational System.
50 
51  \todo This class must be revisited! On Windows it uses some routines that we must pay
52  a special attention, they can retrieve wrong places depending on the policies
53  installed on the machine.
54 
55  \ingroup common
56  */
57  class TECOMMONEXPORT OSSettingsDir : public Singleton<OSSettingsDir>
58  {
59  friend class Singleton<OSSettingsDir>;
60 
61  public:
62 
63  /*!
64  \brief It returns the folder location to store per user data.
65 
66  \return The folder location to store per user data.
67  */
68  const std::string& getUserSettingsPath() const;
69 
70  /*!
71  \brief It returns the folder location to store application data applied to all users.
72 
73  \return The folder location to store application data applied to all users.
74  */
75  const std::string& getSystemSettingsPath() const;
76 
77  protected:
78 
79  /*! \brief It initializes the singleton. */
80  OSSettingsDir();
81 
82  /*! \brief Destructor. */
83  ~OSSettingsDir();
84 
85  private:
86 
87  std::string m_userSettingsPath; //!< Folder to output data by user.
88  std::string m_systemSettingsPath; //!< Folder to output data for all users.
89  };
90 
91  } // end namespace common
92 } // end namespace te
93 
94 #endif // __TERRALIB_COMMON_INTERNAL_OSSETTINGSDIR_H
95 
Template support for singleton pattern.
Definition: Singleton.h:100
#define TECOMMONEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:455
Template support for singleton pattern.
A singleton class for discovering Operational System settings dir.
Definition: OSSettingsDir.h:57
std::string m_systemSettingsPath
Folder to output data for all users.
Definition: OSSettingsDir.h:88
std::string m_userSettingsPath
Folder to output data by user.
Definition: OSSettingsDir.h:87
Configuration flags for the TerraLib Common Runtime module.