Go to the documentation of this file.
17 #ifndef SDF_PLUGIN_HH_
18 #define SDF_PLUGIN_HH_
35 #pragma warning(disable: 4251)
41 inline namespace SDF_VERSION_NAMESPACE {
68 public:
Plugin(
const std::string &_filename,
const std::string &_name,
69 const std::string &_xmlContent =
"");
80 const std::string &_name,
81 const std::string &_xmlContent =
"");
95 public:
const std::string &Name()
const;
101 public:
void SetName(
const std::string &_name);
105 public:
const std::string &Filename()
const;
109 public:
void ClearContents();
114 public:
const std::vector<sdf::ElementPtr> &Contents()
const;
137 public:
bool InsertContent(
const std::string _content);
148 const std::string _content);
153 public:
void SetFilename(
const std::string &_filename);
190 public:
bool operator==(
const Plugin &_plugin)
const;
196 public:
bool operator!=(
const Plugin &_plugin)
const;
204 return _out << _plugin.
ToElement()->ToString(
"");
213 std::ostringstream stream;
214 stream <<
"<sdf version='" << SDF_VERSION <<
"'>";
215 stream << std::string(std::istreambuf_iterator<char>(_in), {});
225 _plugin.
Load(sdfParsed->Root()->GetFirstElement());
237 private:
void Init(
sdf::Errors &_errors,
const std::string &_filename,
238 const std::string &_name,
const std::string &_xmlContent);
241 public: std::unique_ptr<sdf::PluginPrivate>
dataPtr;
std::shared_ptr< SDF > SDFPtr
Definition: SDFImpl.hh:52
Errors Load(ElementPtr _sdf)
Load the plugin based on a element pointer.
GZ_SDFORMAT_VISIBLE bool init(SDFPtr _sdf)
Initialize the SDF interface from the embedded root spec file.
namespace for Simulation Description Format parser
Definition: Actor.hh:34
Base SDF class.
Definition: SDFImpl.hh:166
#define SDFORMAT_VISIBLE
Definition: system_util.hh:25
friend std::istream & operator>>(std::istream &_in, sdf::Plugin &_plugin)
Input stream operator for a Plugin.
Definition: Plugin.hh:210
std::unique_ptr< sdf::PluginPrivate > dataPtr
Private data pointer.
Definition: Plugin.hh:241
class GZ_SDFORMAT_VISIBLE Element
Definition: Element.hh:51
GZ_SDFORMAT_VISIBLE bool readString(const std::string &_xmlString, SDFPtr _sdf, Errors &_errors)
Populate the SDF values from a string.
std::vector< Error > Errors
A vector of Error.
Definition: Types.hh:80
void ClearContents()
Remove the contents of the plugin, this is everything that is a child element of the <plugin>.
friend std::ostream & operator<<(std::ostream &_out, const sdf::Plugin &_plugin)
Output stream operator for a Plugin.
Definition: Plugin.hh:201
std::vector< Plugin > Plugins
A vector of Plugin.
Definition: Plugin.hh:245
std::shared_ptr< Element > ElementPtr
Definition: Element.hh:55
sdf::ElementPtr ToElement() const
Create and return an SDF element filled with data from this plugin.