Add wxHtmlTag::GetParamAsString() convenience method.
This is more convenient to use than HasParam() + GetParam() and also slightly more efficient as we search for the tag name only once. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74879 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -579,6 +579,7 @@ All (GUI):
|
|||||||
- wxPropertyGrid: improve composite flags handling (Jens Lody).
|
- wxPropertyGrid: improve composite flags handling (Jens Lody).
|
||||||
- Don't crash laying out wxGridBagSizer with only hidden elements (briceandre).
|
- Don't crash laying out wxGridBagSizer with only hidden elements (briceandre).
|
||||||
- Fix alignment and transparency of bitmaps in wxDataViewCtrl (Eric Jensen).
|
- Fix alignment and transparency of bitmaps in wxDataViewCtrl (Eric Jensen).
|
||||||
|
- Add wxHtmlTag::GetParamAsString() convenience method.
|
||||||
|
|
||||||
wxGTK:
|
wxGTK:
|
||||||
|
|
||||||
|
@@ -101,6 +101,7 @@ public:
|
|||||||
static bool ParseAsColour(const wxString& str, wxColour *clr);
|
static bool ParseAsColour(const wxString& str, wxColour *clr);
|
||||||
|
|
||||||
// Convenience functions:
|
// Convenience functions:
|
||||||
|
bool GetParamAsString(const wxString& par, wxString *str) const;
|
||||||
bool GetParamAsColour(const wxString& par, wxColour *clr) const;
|
bool GetParamAsColour(const wxString& par, wxColour *clr) const;
|
||||||
bool GetParamAsInt(const wxString& par, int *clr) const;
|
bool GetParamAsInt(const wxString& par, int *clr) const;
|
||||||
bool GetParamAsIntOrPercent(const wxString& param,
|
bool GetParamAsIntOrPercent(const wxString& param,
|
||||||
|
@@ -78,8 +78,11 @@ public:
|
|||||||
wxString GetName() const;
|
wxString GetName() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the value of the parameter. You should check whether the
|
Returns the value of the parameter.
|
||||||
parameter exists or not (use wxHtmlTag::HasParam) first.
|
|
||||||
|
You should check whether the parameter exists or not (use
|
||||||
|
wxHtmlTag::HasParam) first or use GetParamAsString() if you need to
|
||||||
|
distinguish between non-specified and empty parameter values.
|
||||||
|
|
||||||
@param par
|
@param par
|
||||||
The parameter's name.
|
The parameter's name.
|
||||||
@@ -121,6 +124,22 @@ public:
|
|||||||
*/
|
*/
|
||||||
bool GetParamAsInt(const wxString& par, int* value) const;
|
bool GetParamAsInt(const wxString& par, int* value) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Get the value of the parameter.
|
||||||
|
|
||||||
|
If the tag doesn't have such parameter at all, simply returns @false.
|
||||||
|
Otherwise, fills @a value with the parameter value and returns @true.
|
||||||
|
|
||||||
|
@param par
|
||||||
|
The parameter's name.
|
||||||
|
@param value
|
||||||
|
Pointer to the string to be filled with the parameter value, must
|
||||||
|
be non-@NULL.
|
||||||
|
|
||||||
|
@since 3.0
|
||||||
|
*/
|
||||||
|
bool GetParamAsString(const wxString& par, wxString* value) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns @true if this tag is paired with ending tag, @false otherwise.
|
Returns @true if this tag is paired with ending tag, @false otherwise.
|
||||||
See the example of HTML document:
|
See the example of HTML document:
|
||||||
|
@@ -511,6 +511,19 @@ wxString wxHtmlTag::GetParam(const wxString& par, bool with_quotes) const
|
|||||||
return m_ParamValues[index];
|
return m_ParamValues[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool wxHtmlTag::GetParamAsString(const wxString& par, wxString *str) const
|
||||||
|
{
|
||||||
|
wxCHECK_MSG( str, false, wxT("NULL output string argument") );
|
||||||
|
|
||||||
|
int index = m_ParamNames.Index(par, false);
|
||||||
|
if (index == wxNOT_FOUND)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
*str = m_ParamValues[index];
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
int wxHtmlTag::ScanParam(const wxString& par,
|
int wxHtmlTag::ScanParam(const wxString& par,
|
||||||
const char *format,
|
const char *format,
|
||||||
void *param) const
|
void *param) const
|
||||||
|
Reference in New Issue
Block a user