1 /*****************************************************************************
3 *****************************************************************************
4 * Copyright (C) 2003 the VideoLAN team
7 * Authors: Cyril Deguet <asmax@via.ecp.fr>
8 * Olivier Teulière <ipkiss@via.ecp.fr>
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.
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.
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 *****************************************************************************/
25 #ifndef VAR_MANAGER_HPP
26 #define VAR_MANAGER_HPP
28 #include "../utils/var_text.hpp"
33 class VarManager
: public SkinObject
36 /// Get the instance of VarManager
37 static VarManager
*instance( intf_thread_t
*pIntf
);
39 /// Delete the instance of VarManager
40 static void destroy( intf_thread_t
*pIntf
);
42 /// Register a named variable in the manager
43 void registerVar( const VariablePtr
&rcVar
, const string
&rName
);
45 /// Register an anonymous variable in the manager
46 void registerVar( const VariablePtr
&rcVar
);
48 /// Get a variable by its name (NULL if not found)
49 Variable
*getVar( const string
&rName
);
51 /// Get a variable by its name and check the type (NULL if not found)
52 Variable
*getVar( const string
&rName
, const string
&rType
);
54 /// Get the tooltip text variable
55 VarText
&getTooltipText() { return *m_pTooltipText
; }
57 /// Get the help text variable
58 VarText
&getHelpText() { return *m_pHelpText
; }
60 /// Register a constant value
61 void registerConst( const string
&rName
, const string
&rValue
);
63 /// Get a constant value by its name
64 string
getConst( const string
&rName
);
68 VarText
*m_pTooltipText
;
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
;
80 /// Private because it is a singleton
81 VarManager( intf_thread_t
*pIntf
);
82 virtual ~VarManager();