var_manager.hpp

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * var_manager.hpp
00003  *****************************************************************************
00004  * Copyright (C) 2003 the VideoLAN team
00005  * $Id: 1e49aac154c99c89a2026054c9d3d769f9a46c5f $
00006  *
00007  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
00008  *          Olivier Teulière <ipkiss@via.ecp.fr>
00009  *
00010  * This program is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2 of the License, or
00013  * (at your option) any later version.
00014  *
00015  * This program is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  * GNU General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU General Public License along
00021  * with this program; if not, write to the Free Software Foundation, Inc.,
00022  * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
00023  *****************************************************************************/
00024 
00025 #ifndef VAR_MANAGER_HPP
00026 #define VAR_MANAGER_HPP
00027 
00028 #include "../utils/var_text.hpp"
00029 #include <list>
00030 #include <map>
00031 
00032 
00033 class VarManager: public SkinObject
00034 {
00035 public:
00036     /// Get the instance of VarManager
00037     static VarManager *instance( intf_thread_t *pIntf );
00038 
00039     /// Delete the instance of VarManager
00040     static void destroy( intf_thread_t *pIntf );
00041 
00042     /// Register a named variable in the manager
00043     void registerVar( const VariablePtr &rcVar, const string &rName );
00044 
00045     /// Register an anonymous variable in the manager
00046     void registerVar( const VariablePtr &rcVar );
00047 
00048     /// Get a variable by its name (NULL if not found)
00049     Variable *getVar( const string &rName );
00050 
00051     /// Get a variable by its name and check the type (NULL if not found)
00052     Variable *getVar( const string &rName, const string &rType );
00053 
00054     /// Get the tooltip text variable
00055     VarText &getTooltipText() { return *m_pTooltipText; }
00056 
00057     /// Get the help text variable
00058     VarText &getHelpText() { return *m_pHelpText; }
00059 
00060     /// Register a constant value
00061     void registerConst( const string &rName, const string &rValue);
00062 
00063     /// Get a constant value by its name
00064     string getConst( const string &rName );
00065 
00066 private:
00067     /// Tooltip text
00068     VarText *m_pTooltipText;
00069     /// Help text
00070     VarText *m_pHelpText;
00071     /// Map of named registered variables
00072     map<string, VariablePtr> m_varMap;
00073     /// List of named registed variables
00074     list<string> m_varList;
00075     /// List of anonymous registed variables
00076     list<VariablePtr> m_anonVarList;
00077     /// Map of constant values
00078     map<string, string> m_constMap;
00079 
00080     /// Private because it is a singleton
00081     VarManager( intf_thread_t *pIntf );
00082     virtual ~VarManager();
00083 };
00084 
00085 
00086 #endif

Generated on Tue May 25 08:04:58 2010 for VLC by  doxygen 1.5.6