Remove dynamic exceptions
[anna.git] / source / html / Parser.cpp
1 // ANNA - Anna is Not Nothingness Anymore                                                         //
2 //                                                                                                //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo                         //
4 //                                                                                                //
5 // See project site at http://redmine.teslayout.com/projects/anna-suite                           //
6 // See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
7
8
9 #include <anna/html/Parser.hpp>
10
11 using namespace std;
12 using namespace anna;
13
14 const html::Node* html::Parser::getHead()
15 noexcept(false) {
16   if(a_head != NULL)
17     return a_head;
18
19   const html::Node* root = getRoot();
20
21   if(root == NULL)
22     throw RuntimeException("anna::html::Parser::apply was not called", ANNA_FILE_LOCATION);
23
24   return a_head = root->find("head");
25 }
26
27 const html::Node* html::Parser::getBody()
28 noexcept(false) {
29   if(a_body != NULL)
30     return a_body;
31
32   const html::Node* root = getRoot();
33
34   if(root == NULL)
35     throw RuntimeException("anna::html::Parser::apply was not called", ANNA_FILE_LOCATION);
36
37   return a_body = root->find("body");
38 }