1 | #include "tree_manager.hpp" |
---|
2 | |
---|
3 | #include "attribute_template_impl.hpp" |
---|
4 | #include "object_template_impl.hpp" |
---|
5 | #include "group_template_impl.hpp" |
---|
6 | |
---|
7 | namespace xmlioserver |
---|
8 | { |
---|
9 | namespace tree |
---|
10 | { |
---|
11 | /// ////////////////////// Définitions ////////////////////// /// |
---|
12 | |
---|
13 | void CTreeManager::SetCurrentContextId(const StdString & id) |
---|
14 | { |
---|
15 | CObjectFactory::SetCurrentContextId(id); |
---|
16 | CGroupFactory::SetCurrentContextId(id); |
---|
17 | } |
---|
18 | |
---|
19 | boost::shared_ptr<CContext> CTreeManager::CreateContext(const StdString & id) |
---|
20 | { |
---|
21 | boost::shared_ptr<CContextGroup> group_context = |
---|
22 | CContext::GetContextGroup(); |
---|
23 | CTreeManager::SetCurrentContextId(id); |
---|
24 | boost::shared_ptr<tree::CContext> context = |
---|
25 | CObjectFactory::CreateObject<tree::CContext>(id); |
---|
26 | CGroupFactory::AddChild(group_context, context); |
---|
27 | |
---|
28 | #define DECLARE_NODE(Name_, name_) \ |
---|
29 | CObjectFactory::CreateObject<C##Name_##Definition>(C##Name_##Definition::GetDefName()); |
---|
30 | #define DECLARE_NODE_PAR(Name_, name_) |
---|
31 | #include "../config/node_type.conf" |
---|
32 | |
---|
33 | return (context); |
---|
34 | } |
---|
35 | |
---|
36 | //-------------------------------------------------------------- |
---|
37 | void CTreeManager::PrintTreeToFile(const StdString & path) |
---|
38 | { |
---|
39 | StdOFStream ofs(path.c_str()); |
---|
40 | CTreeManager::PrintTreeToStream(ofs); |
---|
41 | ofs.close(); |
---|
42 | } |
---|
43 | |
---|
44 | void CTreeManager::PrintTreeToString(StdString & content) |
---|
45 | { |
---|
46 | StdOStringStream ostrstream; |
---|
47 | tree::CContext::ShowTree(ostrstream); |
---|
48 | content.assign(CIndentedXml::Indented(ostrstream.str())); |
---|
49 | } |
---|
50 | |
---|
51 | void CTreeManager::PrintTreeToStream(StdOStream & out) |
---|
52 | { |
---|
53 | StdOStringStream ostrstream; |
---|
54 | tree::CContext::ShowTree(ostrstream); |
---|
55 | out << CIndentedXml::Indented(ostrstream.str()); |
---|
56 | } |
---|
57 | |
---|
58 | //-------------------------------------------------------------- |
---|
59 | |
---|
60 | void CTreeManager::ParseFile(const StdString & filename) |
---|
61 | { xml::CXMLParser::ParseFile(filename); } |
---|
62 | |
---|
63 | void CTreeManager::ParseString(const StdString & xmlContent) |
---|
64 | { xml::CXMLParser::ParseString(xmlContent); } |
---|
65 | |
---|
66 | void CTreeManager::ParseStream(StdIStream & stream) |
---|
67 | { xml::CXMLParser::ParseStream(stream); } |
---|
68 | |
---|
69 | ///------------------------------------------------------------- |
---|
70 | |
---|
71 | } // namespace tree |
---|
72 | } // namespace xmlioserver |
---|