MyGUI: MyGUI_IResource.h Source File

MyGUI 3.4.3

MyGUI_IResource.h
Go to the documentation of this file.
1/*
2 * This source file is part of MyGUI. For the latest info, see http://mygui.info/
3 * Distributed under the MIT License
4 * (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
5 */
6
7#ifndef MYGUI_I_RESOURCE_H_
8#define MYGUI_I_RESOURCE_H_
9
10#include "MyGUI_Prerequest.h"
11#include "MyGUI_XmlDocument.h"
12#include "MyGUI_Version.h"
13#include "MyGUI_ISerializable.h"
14
15namespace MyGUI
16{
17
18 class IResource;
19 using IResourcePtr = IResource*;
20
21 class ResourceManager;
22
23 class MYGUI_EXPORT IResource : public ISerializable
24 {
25 // для серелизации и удаления
26 friend class ResourceManager;
27
28 MYGUI_RTTI_DERIVED(IResource)
29
30 public:
31 const std::string& getResourceName() const
32 {
33 return mResourceName;
34 }
35
36 void setResourceName(std::string_view _value)
37 {
38 mResourceName = _value;
39 }
40
41 IResource(IResource const&) = delete;
42 IResource& operator=(IResource const&) = delete;
43
44 protected:
45 IResource() = default;
46 ~IResource() override = default;
47
48 void deserialization(xml::ElementPtr _node, Version /*_version*/) override
49 {
50 _node->findAttribute("name", mResourceName);
51 }
52
53 protected:
54 std::string mResourceName;
55 };
56
57} // namespace MyGUI
58
59#endif // MYGUI_I_RESOURCE_H_
MyGUI_ISerializable.h
MYGUI_EXPORT
#define MYGUI_EXPORT
Definition MyGUI_Platform.h:77
MyGUI_Prerequest.h
MYGUI_RTTI_DERIVED
#define MYGUI_RTTI_DERIVED(DerivedType)
Definition MyGUI_RTTI.h:69
MyGUI_Version.h
MyGUI_XmlDocument.h
MyGUI::IResource
Definition MyGUI_IResource.h:24
MyGUI::IResource::deserialization
void deserialization(xml::ElementPtr _node, Version) override
Definition MyGUI_IResource.h:48
MyGUI::IResource::IResource
IResource(IResource const &)=delete
MyGUI::IResource::getResourceName
const std::string & getResourceName() const
Definition MyGUI_IResource.h:31
MyGUI::IResource::mResourceName
std::string mResourceName
Definition MyGUI_IResource.h:54
MyGUI::IResource::ResourceManager
friend class ResourceManager
Definition MyGUI_IResource.h:26
MyGUI::IResource::operator=
IResource & operator=(IResource const &)=delete
MyGUI::IResource::IResource
IResource()=default
MyGUI::IResource::~IResource
~IResource() override=default
MyGUI::IResource::setResourceName
void setResourceName(std::string_view _value)
Definition MyGUI_IResource.h:36
MyGUI::ISerializable
Definition MyGUI_ISerializable.h:19
MyGUI::ResourceManager
Definition MyGUI_ResourceManager.h:23
MyGUI::Version
Definition MyGUI_Version.h:18
MyGUI::xml::Element::findAttribute
bool findAttribute(std::string_view _name, std::string &_value)
Definition MyGUI_XmlDocument.cpp:242
MyGUI::xml::ElementPtr
Element * ElementPtr
Definition MyGUI_XmlDocument.h:112
MyGUI
Definition MyGUI_ActionController.h:15
MyGUI::IResourcePtr
IResource * IResourcePtr
Definition MyGUI_IResource.h:19