]> git.sesse.net Git - vlc/blobdiff - modules/gui/skins2/parser/skin_parser.hpp
Win32: correctly bump resource version
[vlc] / modules / gui / skins2 / parser / skin_parser.hpp
index 7813d87e444ff03c4a613768d224de9ea81db3d7..4d6ab63a68ac82aafcc54c191b70f18a1ab57578 100644 (file)
@@ -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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, 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
 /// Parser for the skin DTD
 class SkinParser: public XMLParser
 {
-    public:
-        SkinParser( intf_thread_t *pIntf, const string &rFileName,
-                    const string &rPath, bool useDTD = true,
-                    BuilderData *pData = NULL );
-        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_pData; }
+    const BuilderData &getData() const { return *m_pData; }
 
-        static int convertColor( const char *transcolor );
+    static int convertColor( const char *transcolor );
 
-    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<int> m_popupPosList;
-        /// Current offset of the controls
-        int m_xOffset, m_yOffset;
-        list<int> m_xOffsetList, m_yOffsetList;
-        /// Layer of the current control in the layout
-        int m_curLayer;
-        /// Set of used id
-        set<string> m_idSet;
+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<int> m_popupPosList;
+    /// Current offset of the controls
+    int m_xOffset, m_yOffset;
+    list<int> m_xOffsetList, m_yOffsetList;
+    /// Stack of panel ids
+    list<string> m_panelStack;
+    /// Layer of the current control in the layout
+    int m_curLayer;
+    /// Set of used id
+    set<string> m_idSet;
 
-        /// Callbacks
-        virtual void handleBeginElement( const string &rName,
-                                         AttrList_t &attr );
-        virtual void handleEndElement( const string &rName );
+    /// Callbacks
+    virtual void handleBeginElement( const string &rName,
+                                     AttrList_t &attr );
+    virtual void handleEndElement( const string &rName );
 
-        /// 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;
-        //@}
+    /// 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;
+    /// 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