MCPcopy Create free account
hub / github.com/MaxBelkov/visualsyslog / Load

Method Load

source/cfg.cpp:65–118  ·  view source on GitHub ↗

---------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

63}
64//---------------------------------------------------------------------------
65void TMainCfg::Load(String file, TStorageFileList * sfl)
66{
67 XMLError err;
68 try
69 {
70 tinyxml2::XMLDocument doc;
71 err = doc.LoadFile(file.c_str());
72 if( err == XML_SUCCESS )
73 {
74 XMLElement * hls;
75 hls = doc.RootElement();
76 if( ! hls )
77 throw 1;
78 if( strcmpi(hls->Name(), szSetupNode) != 0 )
79 throw 1;
80
81 //
82 for(XMLElementEx * p = (XMLElementEx *)hls->FirstChildElement();
83 p;
84 p = (XMLElementEx *)p->NextSiblingElement())
85 {
86 if( strcmpi(p->Name(), szMainNode)==0 )
87 {
88 UdpEnable = p->rb("UdpEnable", true);
89 UdpInterface = p->rs("UdpInterface", "0.0.0.0");
90 UdpPort = p->ri("UdpPort", 514);
91 TcpEnable = p->rb("TcpEnable", false);
92 TcpInterface = p->rs("TcpInterface", "0.0.0.0");
93 TcpPort = p->ri("TcpPort", 514);
94 b3D = p->rb("D3", true);
95 bWriteRaw = p->rb("WriteRaw", false);
96 bReceiveUTF8 = p->rb("ReceiveUTF8", false);
97 }
98 else if( strcmpi(p->Name(), szMailNode)==0 )
99 {
100 Letter.Load(p);
101 }
102 else if( strcmpi(p->Name(), szStorageFiles)==0 )
103 {
104 sfl->Load(p);
105 }
106 }
107 }
108 else
109 throw 0;
110 }
111 catch(int i)
112 {
113 if( i==0 )
114 ReportError2("Error reading file: \"%s\" [%d]", file.c_str(), err);
115 else
116 ReportError2("Incorrect format of file: \"%s\"", file.c_str());
117 }
118}
119//---------------------------------------------------------------------------
120#pragma package(smart_init)

Callers 6

TFormFunction · 0.45
TFormFunction · 0.45
FormCreateMethod · 0.45
InitMethod · 0.45
aProcessSetupExecuteMethod · 0.45

Calls 8

ReportError2Function · 0.85
LoadFileMethod · 0.80
NameMethod · 0.80
FirstChildElementMethod · 0.80
NextSiblingElementMethod · 0.80
rbMethod · 0.80
rsMethod · 0.80
riMethod · 0.80

Tested by

no test coverage detected