MCPcopy Create free account
hub / github.com/bruderstein/nppPluginManager / parsePluginFile

Method parsePluginFile

pluginManager/src/PluginList.cpp:151–382  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

149
150
151BOOL PluginList::parsePluginFile(CONST TCHAR *filename)
152{
153 clearPluginList();
154
155 TiXmlDocument doc(filename);
156
157 doc.LoadFile();
158 if (doc.Error())
159 {
160#ifdef ALLOW_OVERRIDE_XML_URL
161 tstring error = doc.ErrorDesc();
162 error += _T(" at row ");
163 TCHAR tmp[10];
164 tmp[0] = '\0';
165 if (!_itot_s(doc.ErrorRow(), tmp, 10, 10))
166 error += tmp;
167
168 error += _T(", col ");
169
170 if (!_itot_s(doc.ErrorCol(), tmp, 10, 10))
171 error += tmp;
172
173
174 ::MessageBox(_nppData->_nppHandle, error.c_str(), _T("Error parsing XML File"), 0);
175#endif
176 return FALSE;
177 }
178
179 TiXmlNode *pluginsDoc = doc.FirstChildElement(_T("plugins"));
180 if (pluginsDoc)
181 {
182 TiXmlElement *pluginNode = pluginsDoc->FirstChildElement();
183 Plugin *plugin;
184
185 while(pluginNode)
186 {
187 if (!_tcscmp(pluginNode->Value(), _T("pluginNames")))
188 {
189 addPluginNames(pluginNode);
190 }
191 else if (!_tcscmp(pluginNode->Value(), _T("plugin")))
192 {
193 plugin = new Plugin();
194
195 plugin->setName(pluginNode->Attribute(_T("name")));
196
197 BOOL available = FALSE;
198
199 if (g_isUnicode)
200 {
201 if (g_isX64)
202 {
203 TiXmlElement *versionUrlElement = pluginNode->FirstChildElement(_T("x64Version"));
204 if (versionUrlElement && versionUrlElement->FirstChild())
205 {
206 plugin->setVersion(PluginVersion(versionUrlElement->FirstChild()->Value()));
207 available = TRUE;
208 }

Callers

nothing calls this directly

Calls 15

ErrorMethod · 0.80
ErrorDescMethod · 0.80
ErrorRowMethod · 0.80
ErrorColMethod · 0.80
c_strMethod · 0.80
setNameMethod · 0.80
setVersionMethod · 0.80
setDescriptionMethod · 0.80
setFilenameMethod · 0.80
addVersionMethod · 0.80
addBadVersionMethod · 0.80
NoChildrenMethod · 0.80

Tested by

no test coverage detected