Samchon Framework for CPP  1.0.0
FTFolder.cpp
1 #include <samchon/library/FTFolder.hpp>
2 # include <samchon/library/FTFactory.hpp>
3 # include <samchon/library/FTFile.hpp>
4 
5 #include <samchon/library/XML.hpp>
6 
7 using namespace std;
8 
9 using namespace samchon;
10 using namespace samchon::library;
11 using namespace samchon::protocol;
12 
13 auto FTFolder::CHILD_TAG() const -> string { return FTInstance::TAG(); }
14 
15 FTFolder::FTFolder(FTFactory *factory, FTFolder *parent)
16  : super(),
17  FTInstance(parent)
18 {
19  this->factory = factory;
20 }
21 void FTFolder::construct(shared_ptr<XML> xml)
22 {
23  super::construct(xml);
24  FTInstance::construct(xml);
25 }
26 
27 auto FTFolder::createChild(shared_ptr<XML> xml) -> FTInstance*
28 {
29  FTInstance *file = nullptr;
30  if (xml->hasProperty("extension") == false)
31  file = new FTFolder(factory, this);
32  else
33  file = factory->createFile(this, xml);
34 
36  return file;
37 }
38 
39 auto FTFolder::toXML() const -> shared_ptr<XML>
40 {
41  shared_ptr<XML> &xml = super::toXML();
42  xml->addAllProperty(FTInstance::toXML());
43 
44  return xml;
45 }
virtual auto toXML() const -> std::shared_ptr< library::XML > override
Get an XML object represents the Entity.
Definition: FTFolder.cpp:39
An interface of file-tree.
Definition: FTInstance.hpp:22
FTFactory * factory
Factory instance for creating sub files.
Definition: FTFolder.hpp:36
virtual auto createFile(FTFolder *, std::shared_ptr< XML >) -> FTFile *=0
Factory method of a file.
FTFolder(FTFactory *, FTFolder *)
Construct from factory and parent folder.
Definition: FTFolder.cpp:15
Definition: RWMutex.hpp:4
Package of libraries.
Definition: library.hpp:84
void registerInstance(FTInstance *)
Register file instance to map.
Definition: FTFactory.cpp:16
An Entity and a container of children Entity objects.
Definition: EntityGroup.hpp:52
virtual auto toXML() const -> std::shared_ptr< library::XML >
Get an XML object represents the EntityGroup.
A Factory and manager for file-tree.
Definition: FTFactory.hpp:29
Package of network protocol and libraries.
Definition: protocol.hpp:185
virtual auto toXML() const -> std::shared_ptr< library::XML >
Get an XML object represents the Entity.
Definition: FTInstance.cpp:46
XML is a class representing xml object.
Definition: XML.hpp:72
virtual void construct(std::shared_ptr< library::XML > xml)
Construct data of the Entity from an XML object.
Definition: EntityGroup.hpp:90
Top level namespace of products built from samchon.
Definition: ByteArray.hpp:7