mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-09-07 10:34:54 -06:00
.uppdev
git-svn-id: svn://ultimatepp.org/upp/trunk@6643 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
cad4abfaf5
commit
11e183b774
5 changed files with 79 additions and 1 deletions
55
uppdev/XmlNodeFilter/XmlNodeFilter.cpp
Normal file
55
uppdev/XmlNodeFilter/XmlNodeFilter.cpp
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
#include <Core/Core.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
void MakeMap(VectorMap<String, int>& map, const XmlNode& n, const String& path, int& tag_count)
|
||||
{
|
||||
if(map.GetCount() > 1000)
|
||||
return;
|
||||
for(int i = 0; i < n.GetCount(); i++) {
|
||||
if(n[i].IsTag()) {
|
||||
map.GetAdd(path, 0)++;
|
||||
MakeMap(map, n[i], path + "/" + n[i].GetTag(), tag_count);
|
||||
tag_count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DumpMap(const XmlNode& n)
|
||||
{
|
||||
VectorMap<String, int> map;
|
||||
int tag_count = 0;
|
||||
MakeMap(map, n, String(), tag_count);
|
||||
SortByKey(map);
|
||||
DUMPM(map);
|
||||
DUMP(tag_count);
|
||||
}
|
||||
|
||||
//const char *xmlfile = "/home/cxl/20131117_ST_ZZSZ.xml";
|
||||
const char *xmlfile = "/home/cxl/20131106_ST_ZZSZ.xml";
|
||||
|
||||
CONSOLE_APP_MAIN
|
||||
{
|
||||
RLOG(MemoryProfile());
|
||||
{
|
||||
RTIMING("Parse with ignore!");
|
||||
IgnoreXmlPaths ignore("/vf:VymennyFormat/vf:Data/vf:AdresniMista/vf:AdresniMisto/ami:Geometrie;/vf:VymennyFormat/vf:Data/vf:Parcely");
|
||||
XmlNode n = ParseXML(LoadFile(xmlfile), ignore);
|
||||
RLOG("-----------");
|
||||
RLOG("With ignore");
|
||||
RLOG(MemoryUsedKb() << " KB used -------");
|
||||
RLOG(MemoryProfile());
|
||||
DumpMap(n);
|
||||
}
|
||||
{
|
||||
RTIMING("Parse all!");
|
||||
XmlNode n = ParseXML(LoadFile(xmlfile));
|
||||
RLOG("-----------");
|
||||
RLOG("ALL");
|
||||
RLOG(MemoryUsedKb() << " KB used -------");
|
||||
RLOG(MemoryProfile());
|
||||
DumpMap(n);
|
||||
}
|
||||
RLOG("-----------");
|
||||
RLOG(MemoryProfile());
|
||||
}
|
||||
10
uppdev/XmlNodeFilter/XmlNodeFilter.upp
Normal file
10
uppdev/XmlNodeFilter/XmlNodeFilter.upp
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
uses
|
||||
Core;
|
||||
|
||||
file
|
||||
XmlNodeFilter.cpp,
|
||||
info.txt;
|
||||
|
||||
mainconfig
|
||||
"" = "SSE2";
|
||||
|
||||
9
uppdev/XmlNodeFilter/info.txt
Normal file
9
uppdev/XmlNodeFilter/info.txt
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
39460 KB used -------
|
||||
TIMING Parse! : 147.00 ms - 147.00 ms (147.00 ms / 1 ), min: 147.00 ms, max: 147.00 ms, nesting: 1 - 1
|
||||
|
||||
=======================
|
||||
-----------
|
||||
40484 KB used -------
|
||||
TIMING Parse! : 152.00 ms - 152.00 ms (152.00 ms / 1 ), min: 152.00 ms, max: 152.00 ms, nesting: 1 - 1
|
||||
|
||||
=======================
|
||||
4
uppdev/XmlNodeFilter/init
Normal file
4
uppdev/XmlNodeFilter/init
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
#ifndef _XmlNodeFilter_icpp_init_stub
|
||||
#define _XmlNodeFilter_icpp_init_stub
|
||||
#include "Core/init"
|
||||
#endif
|
||||
|
|
@ -85,7 +85,7 @@ CONSOLE_APP_MAIN
|
|||
{
|
||||
// StdLogSetup(LOG_COUT|LOG_FILE);
|
||||
|
||||
if(!server.Listen(80, 10)) {
|
||||
if(!server.Listen(8000, 10)) {
|
||||
LOG("Cannot open server port for listening\r\n");
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue