From fb0822d3719a4668b58e8959232a04ddccd9a521 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 19 Mar 2014 22:13:04 +0000 Subject: [PATCH] Add new Document constructor. --- libcxml.pc.in | 2 +- src/cxml.cc | 7 +++++++ src/cxml.h | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/libcxml.pc.in b/libcxml.pc.in index ebf8bbf..8b7c15c 100644 --- a/libcxml.pc.in +++ b/libcxml.pc.in @@ -5,6 +5,6 @@ includedir=@includedir@ Name: libcxml Description: Library to simplify XML parsing with libxml++ Version: @version@ -Requires: libxml++-2.6 +Requires: libxml++-2.6 glibmm-2.4 Libs: @libs@ Cflags: -I${includedir} diff --git a/src/cxml.cc b/src/cxml.cc index 2ca46ed..a955b91 100644 --- a/src/cxml.cc +++ b/src/cxml.cc @@ -214,6 +214,13 @@ cxml::Document::Document (string root_name) _parser = new xmlpp::DomParser; } +cxml::Document::Document (string root_name, boost::filesystem::path file) + : _root_name (root_name) +{ + _parser = new xmlpp::DomParser (); + read_file (file); +} + cxml::Document::~Document () { delete _parser; diff --git a/src/cxml.h b/src/cxml.h index 9a816a2..df99056 100644 --- a/src/cxml.h +++ b/src/cxml.h @@ -175,6 +175,7 @@ class Document : public Node { public: Document (std::string root_name); + Document (std::string root_name, boost::filesystem::path); void read_file (boost::filesystem::path); void read_stream (std::istream &); -- 2.30.2