soui 5.0.0.1
Soui5 Doc
 
Loading...
Searching...
No Matches
SGradientPool.cpp
1#include "souistd.h"
3#include <core/SGradient.h>
4
5SNSBEGIN
6
7//////////////////////////////////////////////////////////////////////////
8// SGradientPool
9IGradient *SGradientPool::GetGradient(const SStringW &strName)
10{
11 if (!HasKey(strName))
12 return NULL;
13 return GetKeyObject(strName);
14}
15
16// Load SGradientPool from xml tree
18{
19 if (!xmlRoot)
20 return FALSE;
21 for (SXmlNode xmlChild = xmlRoot.first_child(); xmlChild; xmlChild = xmlChild.next_sibling())
22 {
23 SGradient *pGradient = new SGradient();
24 pGradient->SetName(xmlChild.name());
25 pGradient->InitFromXml(&xmlChild);
26 AddKeyObject(xmlChild.name(), pGradient);
27 pGradient->Release();
28 }
29
30 return TRUE;
31}
32
33SNSEND
Gradient Pool Management.
bool GetKeyObject(const SStringW &key, SAutoRefPtr< IGradient > &obj) const
Definition SCmnMap.h:65
bool AddKeyObject(const SStringW &key, const SAutoRefPtr< IGradient > &obj)
Definition SCmnMap.h:94
bool HasKey(const SStringW &key) const
Definition SCmnMap.h:52
Gradient management class.
Definition SGradient.h:18
BOOL Init(SXmlNode xmlNode)
Initializes the gradient pool from an XML node.
IGradient * GetGradient(const SStringW &strName)
Retrieves the gradient object by its name.
void SetName(LPCWSTR pszName) OVERRIDE
Sets the object's name.
Definition Sobject.hpp:126
BOOL InitFromXml(IXmlNode *pXmlNode) OVERRIDE
Initializes the object from an XML node.
Definition Sobject.hpp:83
A class representing an ASCII string.
Definition sstringw.h:96
Class representing an XML node.
Definition SXml.h:352
SXmlNode next_sibling() const
Gets the next sibling node in the children list of the parent node.
Definition SXml.cpp:393
SXmlNode first_child() const
Gets the first child node of the node.
Definition SXml.cpp:383
long Release() override
Decrements the reference count and deletes the object if the count reaches zero.