lsst.astshim  14.0-17-g5b2b7de
XmlChan.h
1 /*
2  * LSST Data Management System
3  * Copyright 2017 AURA/LSST.
4  *
5  * This product includes software developed by the
6  * LSST Project (http://www.lsst.org/).
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the LSST License Statement and
19  * the GNU General Public License along with this program. If not,
20  * see <https://www.lsstcorp.org/LegalNotices/>.
21  */
22 #ifndef ASTSHIM_XMLCHAN_H
23 #define ASTSHIM_XMLCHAN_H
24 
25 #include "astshim/base.h"
26 #include "astshim/Object.h"
27 #include "astshim/Stream.h"
28 #include "astshim/Channel.h"
29 
30 namespace ast {
31 
46 class XmlChan : public Channel {
47 public:
58  explicit XmlChan(Stream &stream, std::string const &options = "")
59  : Channel(reinterpret_cast<AstChannel *>(
60  astXmlChan(detail::source, detail::sink, "%s", options.c_str())),
61  stream) {}
62 
63  virtual ~XmlChan() {}
64 
65  XmlChan(XmlChan const &) = delete;
66  XmlChan(XmlChan &&) = default;
67  XmlChan &operator=(XmlChan const &) = delete;
68  XmlChan &operator=(XmlChan &&) = default;
69 
71  std::string getXmlFormat() const { return getC("XmlFormat"); }
72 
74  int getXmlLength() const { return getI("XmlLength"); }
75 
77  std::string getXmlPrefix() { return getC("XmlPrefix"); }
78 
80  void setXmlFormat(std::string const &format) { setC("XmlFormat", format); }
81 
83  void setXmlLength(int len) { setI("XmlLength", len); }
84 
86  void setXmlPrefix(std::string const &prefix) { setC("XmlPrefix", prefix); }
87 };
88 
89 } // namespace ast
90 
91 #endif
void setXmlPrefix(std::string const &prefix)
Set XmlPrefix: the namespace prefix to use when writing.
Definition: XmlChan.h:86
int getI(std::string const &attrib) const
Definition: Object.h:399
AST wrapper classes and functions.
Definition: attributes_channel.dox:1
XmlChan(Stream &stream, std::string const &options="")
Definition: XmlChan.h:58
Definition: Channel.h:60
void setC(std::string const &attrib, std::string const &value)
Definition: Object.h:460
std::string getXmlFormat() const
Get XmlFormat System for formatting Objects as XML.
Definition: XmlChan.h:71
std::string getXmlPrefix()
Get XmlPrefix: the namespace prefix to use when writing.
Definition: XmlChan.h:77
Definition: XmlChan.h:46
void setI(std::string const &attrib, int value)
Definition: Object.h:496
std::string const getC(std::string const &attrib) const
Definition: Object.h:360
int getXmlLength() const
Get XmlLength: controls output buffer length.
Definition: XmlChan.h:74
void setXmlLength(int len)
Set XmlLength: controls output buffer length; 0 for no limit.
Definition: XmlChan.h:83
Definition: Stream.h:41
void setXmlFormat(std::string const &format)
Set XmlFormat System for formatting Objects as XML.
Definition: XmlChan.h:80