5#include <string/strcpcvt.h>
10#ifndef ENABLE_SOBJ_XML
12#define ENABLE_SOBJ_XML 1
14#define ENABLE_SOBJ_XML 0
34 return T::GetClassType();
42 return T::GetClassName();
50 return T::GetClassAlias();
86 if (!xmlNode)
return FALSE;
89 pXmlNode->ToString(&m_strXml);
108 STDMETHOD_(LPCWSTR,
GetName)(THIS) SCONST OVERRIDE {
116 STDMETHOD_(LPCSTR,
GetNameA)(THIS) SCONST OVERRIDE {
126 STDMETHOD_(
void,
SetName)(THIS_ LPCWSTR pszName) OVERRIDE {
134 STDMETHOD_(
int,
GetID)(THIS) SCONST OVERRIDE {
142 STDMETHOD_(
void,
SetID)(THIS_
int nID) OVERRIDE {
154 STDMETHOD_(HRESULT,
AfterAttribute)(THIS_ LPCWSTR strAttribName, LPCWSTR strValue, BOOL bLoading, HRESULT hr) OVERRIDE {
155 UNREFERENCED_PARAMETER(strAttribName);
156 UNREFERENCED_PARAMETER(strValue);
157 UNREFERENCED_PARAMETER(bLoading);
168 STDMETHOD_(HRESULT,
SetAttributeA)(THIS_ LPCSTR pszAttr, LPCSTR pszValue, BOOL bLoading) OVERRIDE {
169 return SetAttribute(S_CA2W(pszAttr, CP_UTF8), S_CA2W(pszValue, CP_UTF8), bLoading);
179 STDMETHOD_(HRESULT,
SetAttribute)(THIS_ LPCWSTR pszAttr, LPCWSTR pszValue, BOOL bLoading) OVERRIDE {
180 SStringW strName(pszAttr), strValue(pszValue);
182 HRESULT hr =
m_attrHandler(
this, &strName, &strValue, bLoading);
197 STDMETHOD_(HRESULT,
ISetAttribute)(THIS_
const IStringW *strAttr,
const IStringW *strValue, BOOL bLoading) OVERRIDE {
199 HRESULT hr =
m_attrHandler(
this, strAttr, strValue, bLoading);
228 STDMETHOD_(BOOL,
IsClass)(THIS_ LPCWSTR lpszName) SCONST OVERRIDE {
238 STDMETHOD_(BOOL,
GetAttribute)(THIS_ LPCWSTR strAttr, IStringW *pValue) SCONST OVERRIDE {
239 UNREFERENCED_PARAMETER(strAttr);
240 UNREFERENCED_PARAMETER(pValue);
249 UNREFERENCED_PARAMETER(xmlNode);
283 m_nID = _wtoi(strValue);
Template class for implementing the SObject interface.
void SetName(LPCWSTR pszName) OVERRIDE
static int GetClassType()
Retrieves the class type.
BOOL GetAttribute(LPCWSTR strAttr, IStringW *pValue) SCONST OVERRIDE
virtual HRESULT DefAttributeProc(const SStringW &strAttr, const SStringW &strValue, BOOL bLoading)
Default attribute processing.
FunAttrHandler m_attrHandler
BOOL IsClass(LPCWSTR lpszName) SCONST OVERRIDE
HRESULT SetAttribute(LPCWSTR pszAttr, LPCWSTR pszValue, BOOL bLoading) OVERRIDE
Sets an attribute using wide strings.
LPCSTR GetNameA() SCONST OVERRIDE
virtual HRESULT SetAttribute(const SStringW &strAttr, const SStringW &strValue, BOOL bLoading)
Sets an attribute using wide strings.
void SetID(int nID) OVERRIDE
static LPCWSTR GetClassAlias()
Retrieves the class alias.
static void MarkAttributeHandled(SXmlAttr xmlAttr, bool bHandled)
Marks an attribute as handled.
HRESULT ISetAttribute(const IStringW *strAttr, const IStringW *strValue, BOOL bLoading) OVERRIDE
int GetID() SCONST OVERRIDE
LPCWSTR GetName() SCONST OVERRIDE
static bool IsAttributeHandled(SXmlAttr xmlAttr)
Checks if an attribute is handled.
BOOL InitFromXml(IXmlNode *pXmlNode) OVERRIDE
int GetObjectType() SCONST OVERRIDE
void OnInitFinished(IXmlNode *xmlNode) OVERRIDE
Handles initialization completion.
HRESULT SetAttributeA(LPCSTR pszAttr, LPCSTR pszValue, BOOL bLoading) OVERRIDE
void SetAttrHandler(FunAttrHandler attrHandler) OVERRIDE
HRESULT AfterAttribute(LPCWSTR strAttribName, LPCWSTR strValue, BOOL bLoading, HRESULT hr) OVERRIDE
SObjectImpl()
Constructor.
LPCWSTR GetObjectClass() SCONST OVERRIDE
static LPCWSTR GetClassName()
Retrieves the class name.
A class representing an ASCII string.
const char * c_str() SCONST
Retrieves a C-style string representation of the string.
A class representing an ASCII string.
int CompareNoCase(const wchar_t *psz) SCONST
Compares the string with another string, ignoring case.
Class representing an XML attribute.
BOOL set_userdata(int data) OVERRIDE
Sets user data for the attribute.
int get_userdata() SCONST OVERRIDE
Gets user data for the attribute.
Class representing an XML node.
SXmlAttr first_attribute() const
Gets the first attribute of the node.
Bitfield structure for font style attributes.