soui 5.0.0.1
Soui5 Doc
 
Loading...
Searching...
No Matches
SObjDefAttr.h
1#ifndef __SOBJDEFATTR__H__
2#define __SOBJDEFATTR__H__
3
4#include "core/SSingletonMap.h"
5
6SNSBEGIN
7
8/**
9 * @class SObjDefAttr
10 * @brief Class for managing default attributes of objects.
11 *
12 * @details This class manages default attributes for objects using an XML document. It allows initialization from an XML node,
13 * checking if the attribute list is empty, and retrieving default attributes for specific classes.
14 */
15class SOUI_EXP SObjDefAttr
16 : public SCmnMap<SXmlNode, SStringW>
17 , public TObjRefImpl<IObjRef> {
18 public:
19 /**
20 * @brief Constructor.
21 */
23 {
24 }
25
26 /**
27 * @brief Destructor.
28 */
29 virtual ~SObjDefAttr()
30 {
31 }
32
33 /**
34 * @brief Initializes the default attributes from an XML node.
35 * @param xmlNode XML node containing the default attributes.
36 * @return TRUE if initialization is successful, FALSE otherwise.
37 */
38 BOOL Init(SXmlNode xmlNode);
39
40 /**
41 * @brief Checks if the attribute list is empty.
42 * @return TRUE if the attribute list is empty, FALSE otherwise.
43 */
44 bool IsEmpty()
45 {
46 return !m_xmlRoot.root();
47 }
48
49 /**
50 * @brief Retrieves the default attributes for a specific class.
51 * @param pszClassName Name of the class.
52 * @return XML node containing the default attributes for the class, or an invalid node if not found.
53 */
54 SXmlNode GetDefAttribute(LPCWSTR pszClassName);
55
56 protected:
57 /**
58 * @brief Builds the class attributes from an XML node.
59 * @param xmlNode XML node containing the class attributes.
60 * @param pszClassName Name of the class.
61 */
62 void BuildClassAttribute(SXmlNode &xmlNode, LPCWSTR pszClassName);
63
64 SXmlDoc m_xmlRoot; // XML document containing the default attributes
65};
66
67SNSEND
68
69#endif // __SOBJDEFATTR__H__
SCmnMap(void(*funOnKeyRemoved)(const SXmlNode &)=NULL)
Definition SCmnMap.h:28
virtual ~SObjDefAttr()
Destructor.
Definition SObjDefAttr.h:29
bool IsEmpty()
Checks if the attribute list is empty.
Definition SObjDefAttr.h:44
SObjDefAttr()
Constructor.
Definition SObjDefAttr.h:22
Implementation of IXmlDoc.
Definition SXml.h:912
Class representing an XML node.
Definition SXml.h:352