ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkDOMNodeXMLReader.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 
19 #ifndef itkDOMNodeXMLReader_h
20 #define itkDOMNodeXMLReader_h
21 
22 #include "itkDOMNode.h"
23 #include "itkObject.h"
24 #include "ITKIOXMLExport.h"
25 
26 #include <istream>
27 
28 namespace itk
29 {
30 
61 class ITKIOXML_EXPORT DOMNodeXMLReader : public Object
62 {
63 public:
64 
67  typedef Object Superclass;
70 
72  itkNewMacro(Self);
73 
75  itkTypeMacro(DOMNodeXMLReader, Object);
76 
77  typedef DOMNode OutputType;
79 
81  itkSetStringMacro(FileName);
82 
84  itkGetStringMacro(FileName);
85 
90  itkSetObjectMacro( Output, OutputType );
91  itkGetModifiableObjectMacro(Output, OutputType );
93 
98  void Update( std::istream& is );
99 
103  virtual void Update();
104 
108  virtual void StartElement( const char* name, const char** atts );
109 
113  virtual void EndElement( const char* name );
114 
118  virtual void CharacterDataHandler( const char* text, int len );
119 
120 protected:
122 
123 private:
124  ITK_DISALLOW_COPY_AND_ASSIGN(DOMNodeXMLReader);
125 
127  std::string m_FileName;
128 
131 
134 };
135 
136 } // namespace itk
137 
139 inline std::istream& operator>>( std::istream& is, itk::DOMNode& object )
140 {
142  reader->SetOutput( &object );
143  reader->Update( is );
144  return is;
145 }
147 
148 #endif // itkDOMNodeXMLReader_h
Light weight base class for most itk classes.
Class to represent a node in a Document Object Model (DOM) tree structure.
Definition: itkDOMNode.h:53
std::istream & operator>>(std::istream &is, itk::DOMNode &object)
SmartPointer< const Self > ConstPointer
static Pointer New()
SmartPointer< Self > Pointer
OutputType::Pointer OutputPointer
Base class for most ITK classes.
Definition: itkObject.h:59
Class to read a DOM object from an XML file or an input stream.