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 =
"");
83 public: std::string
Name()
const;
89 public:
void SetName(
const std::string &_name);
102 public:
const std::vector<sdf::ElementPtr> &
Contents()
const;
165 return _out << _plugin.
ToElement()->ToString(
"");
174 std::ostringstream stream;
175 stream <<
"<sdf version='" << SDF_VERSION <<
"'>";
176 stream << std::string(std::istreambuf_iterator<char>(_in), {});
186 _plugin.
Load(sdfParsed->Root()->GetFirstElement());
sdf::ElementPtr ToElement() const
Create and return an SDF element filled with data from this plugin.
void SetFilename(const std::string &_filename)
Set the filename of the shared library.
Plugin & operator=(const Plugin &_plugin)
Copy assignment operator.
bool InsertContent(const std::string _content)
Insert XML content into this plugin.
Plugin & operator=(Plugin &&_plugin) noexcept
Move assignment operator.
sdf::ElementPtr Element() const
Get a pointer to the SDF element that was used during load.
friend std::istream & operator>>(std::istream &_in, sdf::Plugin &_plugin)
Input stream operator for a Plugin.
Definition: Plugin.hh:171
void ClearContents()
Remove the contents of the plugin, this is everything that is a child element of the <plugin>.
std::string Filename() const
Get the filename of the shared library.
Plugin(const std::string &_filename, const std::string &_name, const std::string &_xmlContent="")
A constructor that initializes the plugin's filename, name, and optionally the content.
bool operator!=(const Plugin &_plugin) const
Plugin inequality operator.
~Plugin()
Default destructor.
friend std::ostream & operator<<(std::ostream &_out, const sdf::Plugin &_plugin)
Output stream operator for a Plugin.
Definition: Plugin.hh:162
Plugin(Plugin &&_plugin) noexcept
Move constructor.
bool operator==(const Plugin &_plugin) const
Plugin equality operator.
Errors Load(ElementPtr _sdf)
Load the plugin based on a element pointer.
void SetName(const std::string &_name)
Set the name of the plugin.
Plugin()
Default constructor.
std::string Name() const
Get the name of the plugin.
void InsertContent(const sdf::ElementPtr _elem)
Insert an element into the plugin content.
const std::vector< sdf::ElementPtr > & Contents() const
Get the plugin contents.
std::unique_ptr< sdf::PluginPrivate > dataPtr
Private data pointer.
Definition: Plugin.hh:192
Plugin(const Plugin &_plugin)
Copy constructor.
Base SDF class.
Definition: SDFImpl.hh:119
IGNITION_SDFORMAT_VISIBLE bool readString(const std::string &_xmlString, SDFPtr _sdf, Errors &_errors)
Populate the SDF values from a string.
IGNITION_SDFORMAT_VISIBLE bool init(SDFPtr _sdf)
Initialize the SDF interface from the embedded root spec file.
std::shared_ptr< SDF > SDFPtr
Definition: SDFImpl.hh:52
std::vector< Plugin > Plugins
A vector of Plugin.
Definition: Plugin.hh:196
std::vector< Error > Errors
A vector of Error.
Definition: Types.hh:106
std::shared_ptr< Element > ElementPtr
Definition: Element.hh:54
namespace for Simulation Description Format parser
Definition: Actor.hh:35
#define SDFORMAT_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system_util.hh:25