X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fgui%2Fskins2%2Fparser%2Fskin_parser.hpp;h=4d6ab63a68ac82aafcc54c191b70f18a1ab57578;hb=b7b88f91d07b1da032c5583f1ce9759e386b1bce;hp=19278051b80342a78fdecbcb9f3584c2e97f9d10;hpb=85b29bdc288a1573d43bd524908be5748a9b3640;p=vlc diff --git a/modules/gui/skins2/parser/skin_parser.hpp b/modules/gui/skins2/parser/skin_parser.hpp index 19278051b8..4d6ab63a68 100644 --- a/modules/gui/skins2/parser/skin_parser.hpp +++ b/modules/gui/skins2/parser/skin_parser.hpp @@ -1,7 +1,7 @@ /***************************************************************************** * skin_parser.hpp ***************************************************************************** - * Copyright (C) 2004 VideoLAN (Centrale Réseaux) and its contributors + * Copyright (C) 2004 the VideoLAN team * $Id$ * * Authors: Cyril Deguet @@ -16,9 +16,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ #ifndef SKIN_PARSER_HPP @@ -32,51 +32,70 @@ /// Parser for the skin DTD class SkinParser: public XMLParser { - public: - SkinParser( intf_thread_t *pIntf, const string &rFileName, - const string &rPath ); - virtual ~SkinParser() {} +public: + SkinParser( intf_thread_t *pIntf, const string &rFileName, + const string &rPath, bool useDTD = true, + BuilderData *pData = NULL ); + virtual ~SkinParser(); - const BuilderData &getData() const { return m_data; } + const BuilderData &getData() const { return *m_pData; } - private: - /// Container for mapping data from the XML - BuilderData m_data; - /// Current IDs - string m_curWindowId; - string m_curLayoutId; - string m_curListId; - /// Current offset of the controls - int m_xOffset, m_yOffset; - list m_xOffsetList, m_yOffsetList; - /// Layer of the current control in the layout - int m_curLayer; - /// Set of used id - set m_idSet; - /// Path of the XML file being parsed - const string m_path; + static int convertColor( const char *transcolor ); - /// Callbacks - virtual void handleBeginElement( const string &rName, - AttrList_t &attr ); - virtual void handleEndElement( const string &rName ); +private: + /// Path of the theme + const string m_path; + /// Container for mapping data from the XML + BuilderData *m_pData; + /// Indicate whether the class owns the data + bool m_ownData; + /// Current IDs + string m_curBitmapId; + string m_curWindowId; + string m_curLayoutId; + string m_curPopupId; + string m_curListId; + string m_curTreeId; + /// Current position of menu items in the popups + list m_popupPosList; + /// Current offset of the controls + int m_xOffset, m_yOffset; + list m_xOffsetList, m_yOffsetList; + /// Stack of panel ids + list m_panelStack; + /// Layer of the current control in the layout + int m_curLayer; + /// Set of used id + set m_idSet; - /// Helper functions - //@{ - bool convertBoolean( const char *value ) const; - int convertColor( const char *transcolor ) const; - string convertFileName( const char *fileName ) const; - /// Transform to int, and check that it is in the given range (if not, - /// the closest range boundary will be used) - int convertInRange( const char *value, int minValue, int maxValue, - const string &rAttribute ) const; - //@} + /// Callbacks + virtual void handleBeginElement( const string &rName, + AttrList_t &attr ); + virtual void handleEndElement( const string &rName ); - /// Generate a new id - const string generateId() const; + /// Helper functions + //@{ + bool convertBoolean( const char *value ) const; + /// Transform to int, and check that it is in the given range (if not, + /// the closest range boundary will be used) + int convertInRange( const char *value, int minValue, int maxValue, + const string &rAttribute ) const; + //@} + + /// Generate a new id + const string generateId() const; + + /// Check if the id is unique, and if not generate a new one + const string uniqueId( const string &id ); + + /// Helper for handleBeginElement: Provide default attribute if missing. + static void DefaultAttr( AttrList_t &attr, const char *a, const char *b ) + { + if( attr.find(a) == attr.end() ) attr[strdup(a)] = strdup(b); + } + /// Helper for handleBeginElement: Complain if a named attribute is missing. + bool MissingAttr( AttrList_t &attr, const string &name, const char *a ); - /// Check if the id is unique, and if not generate a new one - const string uniqueId( const string &id ); }; #endif