added convenience accessors to wxHtmlTag and modified wxHTML code to use them; improved colours parsing

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10747 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2001-07-01 18:07:33 +00:00
parent fef8557d30
commit 8bd72d9065
8 changed files with 167 additions and 97 deletions

View File

@@ -18,6 +18,8 @@
#include "wx/defs.h"
#if wxUSE_HTML
class WXDLLEXPORT wxHtmlEntitiesParser;
//-----------------------------------------------------------------------------
// wxHtmlTagsCache
// - internal wxHTML class, do not use!
@@ -58,7 +60,9 @@ public:
// constructs wxHtmlTag object based on HTML tag.
// The tag begins (with '<' character) at position pos in source
// end_pos is position where parsing ends (usually end of document)
wxHtmlTag(const wxString& source, int pos, int end_pos, wxHtmlTagsCache* cache);
wxHtmlTag(const wxString& source, int pos, int end_pos,
wxHtmlTagsCache *cache,
wxHtmlEntitiesParser *entParser = NULL);
// Returns tag's name in uppercase.
inline wxString GetName() const {return m_Name;}
@@ -75,7 +79,11 @@ public:
// (or ("WhaT.jpg") if with_commas == TRUE)
wxString GetParam(const wxString& par, bool with_commas = FALSE) const;
// Scans param like scanf() functions family do.
// Convenience functions:
bool GetParamAsColour(const wxString& par, wxColour *clr) const;
bool GetParamAsInt(const wxString& par, int *clr) const;
// Scans param like scanf() functions family does.
// Example : ScanParam("COLOR", "\"#%X\"", &clr);
// This is always with with_commas=FALSE
// Returns number of scanned values
@@ -85,7 +93,7 @@ public:
int ScanParam(const wxString& par, wxChar *format, void *param) const;
// Returns string containing all params.
inline const wxString& GetAllParams() const {return m_Params;}
wxString GetAllParams() const;
// return TRUE if this is ending tag (</something>) or FALSE
// if it isn't (<something>)
@@ -107,9 +115,10 @@ public:
inline int GetEndPos2() const {return m_End2;}
private:
wxString m_Name, m_Params;
wxString m_Name;
int m_Begin, m_End1, m_End2;
bool m_Ending;
wxArrayString m_ParamNames, m_ParamValues;
};