soui 5.0.0.1
Soui5 Doc
 
Loading...
Searching...
No Matches
SStylePool.h
Go to the documentation of this file.
1#ifndef __SSTYLEPOOL__H__
2#define __SSTYLEPOOL__H__
3
4#include <core/SCmnMap.h>
5#include <interface/obj-ref-i.h>
6#include <helper/obj-ref-impl.hpp>
7
8SNSBEGIN
9
10/**
11 * @file SStylePool.h
12 * @brief Style Pool Management
13 * @version v1.0
14 * @author SOUI团队
15 * @date 2014-05-28
16 *
17 * @details Manages a pool of styles and templates, providing functionality to load, retrieve, and manage styles and templates from XML.
18 */
19
20/**
21 * @class SStylePool
22 * @brief Manages the mapping of style names to XML nodes.
23 *
24 * @details This class provides functionality to load styles from an XML node and retrieve them by name.
25 */
26class SOUI_EXP SStylePool
27 : public SCmnMap<SXmlNode, SStringW>
28 , public TObjRefImpl<IObjRef> {
29 public:
30 /**
31 * @brief Retrieves a style XML node by name.
32 * @param strName Name of the style.
33 * @return XML node containing the style, or an invalid node if not found.
34 */
35 SXmlNode GetStyle(const SStringW &strName);
36
37 /**
38 * @brief Initializes the style pool from an XML node.
39 * @param xmlNode XML node containing the style definitions.
40 * @return TRUE if initialization is successful, FALSE otherwise.
41 */
42 BOOL Init(SXmlNode xmlNode);
43
44 protected:
45 SXmlDoc m_xmlDoc; // XML document containing the styles
46};
47
48/**
49 * @class STemplatePool
50 * @brief Manages the mapping of template names to template strings.
51 *
52 * @details This class provides functionality to load templates from an XML node and retrieve them by name.
53 */
54class SOUI_EXP STemplatePool
55 : public SCmnMap<SStringW, SStringW>
56 , public TObjRefImpl<IObjRef> {
57 public:
58 /**
59 * @brief Initializes the template pool from an XML node.
60 * @param xmlNode XML node containing the template definitions.
61 * @return TRUE if initialization is successful, FALSE otherwise.
62 */
63 BOOL Init(SXmlNode xmlNode);
64
65 /**
66 * @brief Retrieves a template string by name.
67 * @param strName Name of the template.
68 * @return Template string, or an empty string if not found.
69 */
70 SStringW GetTemplateString(const SStringW &strName) const;
71};
72
73SNSEND
74
75#endif // __SSTYLEPOOL__H__
SCmnMap(void(*funOnKeyRemoved)(const SXmlNode &)=NULL)
Definition SCmnMap.h:28
A class representing an ASCII string.
Definition sstringw.h:96
Manages the mapping of style names to XML nodes.
Definition SStylePool.h:28
SXmlNode GetStyle(const SStringW &strName)
Retrieves a style XML node by name.
BOOL Init(SXmlNode xmlNode)
Initializes the style pool from an XML node.
Manages the mapping of template names to template strings.
Definition SStylePool.h:56
BOOL Init(SXmlNode xmlNode)
Initializes the template pool from an XML node.
SStringW GetTemplateString(const SStringW &strName) const
Retrieves a template string by name.
Implementation of IXmlDoc.
Definition SXml.h:912
Class representing an XML node.
Definition SXml.h:352