CLAM-Development  1.4.0
NullDomReadingContext.hxx
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2001-2004 MUSIC TECHNOLOGY GROUP (MTG)
3  * UNIVERSITAT POMPEU FABRA
4  *
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  *
20  */
21 
22 #ifndef _NullDomReadingContext_hxx_
23 #define _NullDomReadingContext_hxx_
24 
25 
26 // Dummy implementation that will fail when used
27 
28 #include "Assert.hxx"
29 #include <sstream>
30 #include <list>
31 #include <string>
32 
33 namespace CLAM
34 {
35 
36 class NullDomDocumentHandler;
37 
43 {
44  std::stringstream _plainContentToParse;
45 
46 public:
48  {
49  CLAM_ASSERT(false, "Using XML support with no xmlbackend. Reconfigure CLAM using the 'xmlbackend' option.");
50  }
51 
52  NullDomReadingContext(NullDomReadingContext * oldContext, const char * name)
53  {
54  CLAM_ASSERT(false, "Using XML support with no xmlbackend. Reconfigure CLAM using the 'xmlbackend' option.");
55  }
56  bool findElement(const char * name)
57  {
58  return false;
59  }
60 
62  {
63  return this;
64  }
65 
66  bool extractAttribute(const char * attributeName, std::ostream & os)
67  {
68  return false;
69  }
70 
71  std::istream & reachableContent()
72  {
73  return _plainContentToParse;
74  }
75 
76  std::list<std::string> errors()
77  {
78  static std::list<std::string> errors;
79  return errors;
80  }
81 
82  std::string getPath()
83  {
84  return "Bad Path";
85  }
86 
87 };
88 
89 } // Namespace CLAM
90 
91 
92 #endif//_NullDomReadingContext_hxx_
93 
94 
95