From 2115170a6f8c3fa0cec8c15fc3f3b81282a6e87f Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 8 Jan 2021 21:54:28 +0100 Subject: Remove unused stuff. --- src/xml.h | 95 --------------------------------------------------------------- 1 file changed, 95 deletions(-) delete mode 100644 src/xml.h (limited to 'src') diff --git a/src/xml.h b/src/xml.h deleted file mode 100644 index bf1477b..0000000 --- a/src/xml.h +++ /dev/null @@ -1,95 +0,0 @@ -/* - Copyright (C) 2014 Carl Hetherington - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -/** @file src/xml.h - * @brief Some useful XML helper functions. - */ - -#ifndef LIBSUB_XML_H -#define LIBSUB_XML_H - -#include "exceptions.h" -#include - -namespace sub -{ - -template -std::shared_ptr -optional_type_child (cxml::Node const & node, std::string name) -{ - std::list > n = node.node_children (name); - if (n.size() > 1) { - throw XMLError ("duplicate XML tag"); - } else if (n.empty ()) { - return std::shared_ptr (); - } - - return std::shared_ptr (new T (n.front ())); -} - -template -std::shared_ptr type_child (std::shared_ptr node, std::string name) { - return std::shared_ptr (new T (node->node_child (name))); -} - -template -std::shared_ptr -optional_type_child (std::shared_ptr node, std::string name) -{ - return optional_type_child (*node.get(), name); -} - -template -std::list > -type_children (cxml::Node const & node, std::string name) -{ - std::list > n = node.node_children (name); - std::list > r; - for (typename std::list >::iterator i = n.begin(); i != n.end(); ++i) { - r.push_back (std::shared_ptr (new T (*i))); - } - return r; -} - -template -std::list > -type_children (std::shared_ptr node, std::string name) -{ - return type_children (*node.get(), name); -} - -template -std::list > -type_grand_children (cxml::Node const & node, std::string name, std::string sub) -{ - std::shared_ptr p = node.node_child (name); - return type_children (p, sub); -} - -template -std::list > -type_grand_children (std::shared_ptr node, std::string name, std::string sub) -{ - return type_grand_children (*node.get(), name, sub); -} - -} - -#endif -- cgit v1.2.3