]> git.sesse.net Git - vlc/blob - modules/gui/skins2/src/var_manager.hpp
c9f0398b70b300381641fbeab14fe22d8a525b6f
[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
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 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     private:
61         /// Tooltip text
62         VarText *m_pTooltipText;
63         /// Help text
64         VarText *m_pHelpText;
65         /// Map of named registered variables
66         map<string, VariablePtr> m_varMap;
67         /// List of named registed variables
68         list<string> m_varList;
69         /// List of anonymous registed variables
70         list<VariablePtr> m_anonVarList;
71
72         /// Private because it is a singleton
73         VarManager( intf_thread_t *pIntf );
74         virtual ~VarManager();
75 };
76
77
78 #endif