]> git.sesse.net Git - vlc/blob - modules/gui/skins2/src/var_manager.hpp
Remove useless vlc_object_detach() before vlc_object_release()
[vlc] / modules / gui / skins2 / src / var_manager.hpp
1 /*****************************************************************************
2  * var_manager.hpp
3  *****************************************************************************
4  * Copyright (C) 2003 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
8  *          Olivier Teulière <ipkiss@via.ecp.fr>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License along
21  * with this program; if not, write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23  *****************************************************************************/
24
25 #ifndef VAR_MANAGER_HPP
26 #define VAR_MANAGER_HPP
27
28 #include "../utils/var_text.hpp"
29 #include <list>
30 #include <map>
31
32
33 class VarManager: public SkinObject
34 {
35 public:
36     /// Get the instance of VarManager
37     static VarManager *instance( intf_thread_t *pIntf );
38
39     /// Delete the instance of VarManager
40     static void destroy( intf_thread_t *pIntf );
41
42     /// Register a named variable in the manager
43     void registerVar( const VariablePtr &rcVar, const string &rName );
44
45     /// Register an anonymous variable in the manager
46     void registerVar( const VariablePtr &rcVar );
47
48     /// Get a variable by its name (NULL if not found)
49     Variable *getVar( const string &rName );
50
51     /// Get a variable by its name and check the type (NULL if not found)
52     Variable *getVar( const string &rName, const string &rType );
53
54     /// Get the tooltip text variable
55     VarText &getTooltipText() { return *m_pTooltipText; }
56
57     /// Get the help text variable
58     VarText &getHelpText() { return *m_pHelpText; }
59
60     /// Register a constant value
61     void registerConst( const string &rName, const string &rValue);
62
63     /// Get a constant value by its name
64     string getConst( const string &rName );
65
66 private:
67     /// Tooltip text
68     VarText *m_pTooltipText;
69     /// Help text
70     VarText *m_pHelpText;
71     /// Map of named registered variables
72     map<string, VariablePtr> m_varMap;
73     /// List of named registed variables
74     list<string> m_varList;
75     /// List of anonymous registed variables
76     list<VariablePtr> m_anonVarList;
77     /// Map of constant values
78     map<string, string> m_constMap;
79
80     /// Private because it is a singleton
81     VarManager( intf_thread_t *pIntf );
82     virtual ~VarManager();
83 };
84
85
86 #endif