Remove dynamic exceptions
[anna.git] / include / anna / xml / XPath.hpp
index abf02e9..9bdaec8 100644 (file)
@@ -1,37 +1,9 @@
-// ANNA - Anna is Not Nothingness Anymore
-//
-// (c) Copyright 2005-2014 Eduardo Ramos Testillano & Francisco Ruiz Rayo
-//
-// https://bitbucket.org/testillano/anna
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Authors: eduardo.ramos.testillano@gmail.com
-//          cisco.tierra@gmail.com
+// ANNA - Anna is Not Nothingness Anymore                                                         //
+//                                                                                                //
+// (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo                         //
+//                                                                                                //
+// See project site at http://redmine.teslayout.com/projects/anna-suite                           //
+// See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
 
 
 #ifndef anna_xml_XPath_hpp
@@ -53,9 +25,10 @@ namespace anna {
 namespace xml {
 
 /**
-   XPath es un lenguaje para encontrar información dentro de un documento XML.
+   XPath is a language to navigate an XML document.
 
-   \see http://www.w3schools.com/xpath/default.asp
+   \see https://www.w3schools.com/xml/xpath_intro.asp
+   \see http://www.whoishostingthis.com/resources/xpath
 */
 class XPath : Parser {
 public:
@@ -88,7 +61,7 @@ public:
      \warning La instancia del documento debe estar correctamente inicializada.
      \see Document::initialize
   */
-  void apply(const Document& document, const char* expression, const int mode = Mode::Simple) throw(RuntimeException);
+  void apply(const Document& document, const char* expression, const int mode = Mode::Simple) noexcept(false);
 
   /**
    * Aplica la expresión XPath sobre el documento recibido como parámetro y devuelve
@@ -103,7 +76,7 @@ public:
    *
    * \return \em true si algún nodo del documento que cumpla la expressión o \em false en otro caso.
    */
-  bool match(const Document& document, const char* expression, const int mode = Mode::Simple) throw(RuntimeException);
+  bool match(const Document& document, const char* expression, const int mode = Mode::Simple) noexcept(false);
 
   /**
      Aplica la expresión XPath sobre el documento recibido como parámetro y devuelve el primer
@@ -118,37 +91,37 @@ public:
    * \warning Si no hay ningún nodo que cumpla la expresión devolverá una excepción.
    */
   const Node* find(const Document& document, const char* expression, const int mode = Mode::Full, const Exception::Mode::_v emode = Exception::Mode::Throw)
-  throw(RuntimeException);
+  noexcept(false);
 
   /**
    * Devuelve \em true si existen nodos que cumplieron la condición de #apply o \em false en otro caso.
    * \return  \em true si existen nodos que cumplieron la condición de #apply o \em false en otro caso.
    */
-  bool isEmpty() const throw() { return a_root->a_children.size() == 0; }
+  bool isEmpty() const { return a_root->a_children.size() == 0; }
 
   /**
    * Devuelve el número de nodos que han sido seleccionados al invocar al método #apply.
    * \return El número de nodos que han sido seleccionados al invocar al método #apply.
    */
-  int size() const throw() { return a_root->a_children.size(); }
+  int size() const { return a_root->a_children.size(); }
 
   /**
    * Devuelve el primer nodo del documento que cumple la expresión indicada al invocar al método #apply.
    * \return El primer nodo del documento que cumple la expresión indicada al invocar al método #apply.
    */
-  Node::const_child_iterator node_begin() const throw() { return a_root->child_begin(); }
+  Node::const_child_iterator node_begin() const { return a_root->child_begin(); }
 
   /**
    * Devuelve el final de la lista de nodos que cumplen la expresión indicada al invocar al método #apply.
    * \return El final de la lista de nodos que cumplen la expresión indicada al invocar al método #apply.
    */
-  Node::const_child_iterator node_end() const throw() { return a_root->child_end(); }
+  Node::const_child_iterator node_end() const { return a_root->child_end(); }
 
   /**
    * Devuelve la instancia del nodo apuntado por el iterador recibido como parámetro.
    * \return la instancia del nodo apuntado por el iterador recibido como parámetro.
    */
-  static const Node* node(Node::const_child_iterator& ii) throw() { return xml::Node::node(ii); }
+  static const Node* node(Node::const_child_iterator& ii) { return xml::Node::node(ii); }
 
 private:
   // Modo pasado al callback del apply
@@ -172,12 +145,12 @@ private:
 
   XPath(const XPath&);
 
-  void text(Node* node, _xmlNode* xmlNode) throw(RuntimeException);
+  void text(Node* node, _xmlNode* xmlNode) noexcept(false);
 
-  void skeleton(const Document&, const char* expression, ConfigSkeleton&) throw(RuntimeException);
+  void skeleton(const Document&, const char* expression, ConfigSkeleton&) noexcept(false);
 
-  void initializeNamespaces(_xmlXPathContext*, const Document&) throw(RuntimeException);
-  void forwardNamespaces(_xmlXPathContext*, _xmlNode*) throw(RuntimeException);
+  void initializeNamespaces(_xmlXPathContext*, const Document&) noexcept(false);
+  void forwardNamespaces(_xmlXPathContext*, _xmlNode*) noexcept(false);
   void callbackApply(const _xmlNodeSet*);
   void callbackMatch(const _xmlNodeSet*);
 };