]> git.sesse.net Git - xml-template/commitdiff
Add a passthru test for C++0x.
authorsgunderson@bigfoot.com <>
Wed, 21 Sep 2011 19:42:44 +0000 (21:42 +0200)
committersgunderson@bigfoot.com <>
Wed, 21 Sep 2011 19:42:44 +0000 (21:42 +0200)
c++0x/Makefile
c++0x/passthru.cpp [new file with mode: 0644]

index fe1f331ac63264c3523e4b5a24cb13d25b4dc3ce..9c74fc073ec6d096ca70b2edcb774334dafca50e 100644 (file)
@@ -1,8 +1,11 @@
 CXX=g++
 CXXFLAGS=-std=gnu++0x -g -Wall $(shell xml2-config --cflags)
 LDFLAGS=$(shell xml2-config --libs)
-OBJS=simple.o xml-template.o
+LIBS=xml-template.o
 
-simple: $(OBJS)
-       $(CXX) -o $@ $(OBJS) $(LDFLAGS)
+passthru: passthru.o $(LIBS)
+       $(CXX) -o $@ $< $(LIBS) $(LDFLAGS)
+
+simple: simple.o $(LIBS)
+       $(CXX) -o $@ $< $(LIBS) $(LDFLAGS)
 
diff --git a/c++0x/passthru.cpp b/c++0x/passthru.cpp
new file mode 100644 (file)
index 0000000..2db2e3d
--- /dev/null
@@ -0,0 +1,22 @@
+#include <stdio.h>
+#include <string.h>
+#include <libxml/parser.h>
+
+#include "xml-template.h"
+
+using namespace std;
+
+int main(int argc, char **argv)
+{
+       LIBXML_TEST_VERSION
+
+       unordered_map<string, Directive*> master_map;
+
+       xmlDocPtr doc = xmlParseFile("../xml/passthru.xml");
+       Substitute(master_map).process(xmlDocGetRootElement(doc), false);
+       xmlSaveFile(argv[1], doc);
+
+       xmlCleanupParser();
+       xmlMemoryDump();
+       return(0);
+}