ome-common  5.2.0
Transformer.h
1 /*
2  * #%L
3  * OME-XALAN C++ library for working with Xalan C++.
4  * %%
5  * Copyright © 2016 Open Microscopy Environment:
6  * - Massachusetts Institute of Technology
7  * - National Institutes of Health
8  * - University of Dundee
9  * - Board of Regents of the University of Wisconsin-Madison
10  * - Glencoe Software, Inc.
11  * %%
12  * Redistribution and use in source and binary forms, with or without
13  * modification, are permitted provided that the following conditions are met:
14  *
15  * 1. Redistributions of source code must retain the above copyright notice,
16  * this list of conditions and the following disclaimer.
17  * 2. Redistributions in binary form must reproduce the above copyright notice,
18  * this list of conditions and the following disclaimer in the documentation
19  * and/or other materials provided with the distribution.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
25  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31  * POSSIBILITY OF SUCH DAMAGE.
32  *
33  * The views and conclusions contained in the software and documentation are
34  * those of the authors and should not be interpreted as representing official
35  * policies, either expressed or implied, of any organization.
36  * #L%
37  */
38 
39 #ifndef OME_COMMON_XSL_TRANSFORMER_H
40 #define OME_COMMON_XSL_TRANSFORMER_H
41 
42 #include <ome/compat/memory.h>
43 
44 #include <ome/common/filesystem.h>
45 #include <ome/common/xml/EntityResolver.h>
46 
47 #include <xalanc/XalanTransformer/XalanTransformer.hpp>
48 
49 namespace ome
50 {
51  namespace common
52  {
53  namespace xsl
54  {
55 
68  {
69  public:
73  Transformer();
74 
78  ~Transformer();
79 
86  getEntityResolver() const;
87 
96  void
98 
104  bool
105  getUseValidation() const;
106 
115  void
116  setUseValidation(bool validate);
117 
131  void
132  transform(xalanc::XSLTInputSource& xsl,
133  xalanc::XSLTInputSource& input,
134  xalanc::XSLTResultTarget& output);
135 
144  void
145  transform(const boost::filesystem::path& xsl,
146  const boost::filesystem::path& input,
147  const boost::filesystem::path& output);
148 
157  void
158  transform(const boost::filesystem::path& xsl,
159  std::istream& input,
160  const boost::filesystem::path& output);
161 
170  void
171  transform(const boost::filesystem::path& xsl,
172  const std::string& input,
173  const boost::filesystem::path& output);
174 
183  void
184  transform(const boost::filesystem::path& xsl,
185  const boost::filesystem::path& input,
186  std::ostream& output);
187 
196  void
197  transform(const boost::filesystem::path& xsl,
198  std::istream& input,
199  std::ostream& output);
200 
209  void
210  transform(const boost::filesystem::path& xsl,
211  const std::string& input,
212  std::ostream& output);
213 
222  void
223  transform(const boost::filesystem::path& xsl,
224  const boost::filesystem::path& input,
225  std::string& output);
226 
235  void
236  transform(const boost::filesystem::path& xsl,
237  std::istream& input,
238  std::string& output);
239 
248  void
249  transform(const boost::filesystem::path& xsl,
250  const std::string& input,
251  std::string& output);
252 
253  private:
255  xalanc::XalanTransformer transformer;
258  };
259 
260  }
261  }
262 }
263 
264 #endif // OME_COMMON_XSL_TRANSFORMER_H
265 
266 /*
267  * Local Variables:
268  * mode:C++
269  * End:
270  */
Memory type substitution.
xalanc::XalanTransformer transformer
Xalan-C transformer being wrapped.
Definition: Transformer.h:255
bool getUseValidation() const
Check if validation is enabled.
Definition: Transformer.cpp:241
void setUseValidation(bool validate)
Enable or disable validation.
Definition: Transformer.cpp:247
void setEntityResolver(xml::EntityResolver *resolver)
Set the entity resolver to use.
Definition: Transformer.cpp:234
Xerces entity resolver.
Definition: EntityResolver.h:66
void transform(xalanc::XSLTInputSource &xsl, xalanc::XSLTInputSource &input, xalanc::XSLTResultTarget &output)
Apply transform (XSLT abstract input and output).
Definition: Transformer.cpp:253
Boost.Filesystem compatibility.
Definition: boolean.h:48
XSL Transformer.
Definition: Transformer.h:67
Transformer()
Construct a Transformer instance.
Definition: Transformer.cpp:217
xml::EntityResolver * getEntityResolver() const
Get the entity resolver in use.
Definition: Transformer.cpp:228
xml::EntityResolver * resolver
EntityResolver to use with the transformer.
Definition: Transformer.h:257
~Transformer()
Destructor.
Definition: Transformer.cpp:223