Public Member Functions | Public Attributes | List of all members
sdf::SDF_VERSION_NAMESPACE::Plugin Class Reference

#include <Plugin.hh>

Public Member Functions

 Plugin ()
 Default constructor. More...
 
 Plugin (const Plugin &_plugin)
 Copy constructor. More...
 
 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. More...
 
 Plugin (Plugin &&_plugin) noexcept
 Move constructor. More...
 
 Plugin (sdf::Errors &_errors, 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. More...
 
 ~Plugin ()
 Default destructor. More...
 
void ClearContents ()
 Remove the contents of the plugin, this is everything that is a child element of the <plugin>. More...
 
const std::vector< sdf::ElementPtr > & Contents () const
 Get the plugin contents. More...
 
sdf::ElementPtr Element () const
 Get a pointer to the SDF element that was used during load. More...
 
const std::string & Filename () const
 Get the filename of the shared library. More...
 
void InsertContent (const sdf::ElementPtr _elem)
 Insert an element into the plugin content. More...
 
bool InsertContent (const std::string _content)
 Insert XML content into this plugin. More...
 
void InsertContent (sdf::Errors &_errors, const sdf::ElementPtr _elem)
 Insert an element into the plugin content. More...
 
bool InsertContent (sdf::Errors &_errors, const std::string _content)
 Insert XML content into this plugin. More...
 
Errors Load (ElementPtr _sdf)
 Load the plugin based on a element pointer. More...
 
const std::string & Name () const
 Get the name of the plugin. More...
 
bool operator!= (const Plugin &_plugin) const
 Plugin inequality operator. More...
 
Pluginoperator= (const Plugin &_plugin)
 Copy assignment operator. More...
 
Pluginoperator= (Plugin &&_plugin) noexcept
 Move assignment operator. More...
 
bool operator== (const Plugin &_plugin) const
 Plugin equality operator. More...
 
void SetFilename (const std::string &_filename)
 Set the filename of the shared library. More...
 
void SetName (const std::string &_name)
 Set the name of the plugin. More...
 
sdf::ElementPtr ToElement () const
 Create and return an SDF element filled with data from this plugin. More...
 
sdf::ElementPtr ToElement (sdf::Errors &_errors) const
 Create and return an SDF element filled with data from this plugin. More...
 

Public Attributes

std::unique_ptr< sdf::PluginPrivate > dataPtr
 Private data pointer. More...
 

Constructor & Destructor Documentation

◆ Plugin() [1/5]

sdf::SDF_VERSION_NAMESPACE::Plugin::Plugin ( )

Default constructor.

◆ ~Plugin()

sdf::SDF_VERSION_NAMESPACE::Plugin::~Plugin ( )

Default destructor.

◆ Plugin() [2/5]

sdf::SDF_VERSION_NAMESPACE::Plugin::Plugin ( const Plugin _plugin)

Copy constructor.

Parameters
[in]_pluginPlugin to copy.

◆ Plugin() [3/5]

sdf::SDF_VERSION_NAMESPACE::Plugin::Plugin ( Plugin &&  _plugin)
noexcept

Move constructor.

Parameters
[in]_pluginPlugin to copy.

◆ Plugin() [4/5]

sdf::SDF_VERSION_NAMESPACE::Plugin::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.

Parameters
[in]_filenameFilename of the shared library associated with this plugin.
[in]_nameThe name of the plugin.
[in]_xmlContentOptional XML content that will be stored in this plugin.

◆ Plugin() [5/5]

sdf::SDF_VERSION_NAMESPACE::Plugin::Plugin ( sdf::Errors _errors,
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.

Parameters
[out]_errorsVector of errors.
[in]_filenameFilename of the shared library associated with this plugin.
[in]_nameThe name of the plugin.
[in]_xmlContentOptional XML content that will be stored in this plugin.

Member Function Documentation

◆ ClearContents()

void sdf::SDF_VERSION_NAMESPACE::Plugin::ClearContents ( )

Remove the contents of the plugin, this is everything that is a child element of the <plugin>.

◆ Contents()

const std::vector<sdf::ElementPtr>& sdf::SDF_VERSION_NAMESPACE::Plugin::Contents ( ) const

Get the plugin contents.

This is all the SDF elements that are children of the <plugin>.

Returns
The child elements of this plugin.

◆ Element()

sdf::ElementPtr sdf::SDF_VERSION_NAMESPACE::Plugin::Element ( ) const

Get a pointer to the SDF element that was used during load.

Returns
SDF element pointer. The value will be nullptr if Load has not been called.

◆ Filename()

const std::string& sdf::SDF_VERSION_NAMESPACE::Plugin::Filename ( ) const

Get the filename of the shared library.

Returns
Filename of the shared library associated with the plugin.

◆ InsertContent() [1/4]

void sdf::SDF_VERSION_NAMESPACE::Plugin::InsertContent ( const sdf::ElementPtr  _elem)

Insert an element into the plugin content.

This does not modify the values in the sdf::ElementPtr returned by the Element() function.

Parameters
[in]_elemElement to insert.

◆ InsertContent() [2/4]

bool sdf::SDF_VERSION_NAMESPACE::Plugin::InsertContent ( const std::string  _content)

Insert XML content into this plugin.

This function does not modify the values in the sdf::ElementPtr returned by the Element() function. The provided content must be valid XML.

Parameters
[in]_contentA string that contains valid XML. The XML is inserted into this plugin if it is valid.
Returns
False if the provided content was invalid, in which case the content of this plugin is not modified. True otherwise

◆ InsertContent() [3/4]

void sdf::SDF_VERSION_NAMESPACE::Plugin::InsertContent ( sdf::Errors _errors,
const sdf::ElementPtr  _elem 
)

Insert an element into the plugin content.

This does not modify the values in the sdf::ElementPtr returned by the Element() function.

Parameters
[out]_errorsVector of errors.
[in]_elemElement to insert.

◆ InsertContent() [4/4]

bool sdf::SDF_VERSION_NAMESPACE::Plugin::InsertContent ( sdf::Errors _errors,
const std::string  _content 
)

Insert XML content into this plugin.

This function does not modify the values in the sdf::ElementPtr returned by the Element() function. The provided content must be valid XML.

Parameters
[out]_errorsVector of errors.
[in]_contentA string that contains valid XML. The XML is inserted into this plugin if it is valid.
Returns
False if the provided content was invalid, in which case the content of this plugin is not modified. True otherwise

◆ Load()

Errors sdf::SDF_VERSION_NAMESPACE::Plugin::Load ( ElementPtr  _sdf)

Load the plugin based on a element pointer.

This is not the usual entry point. Typical usage of the SDF DOM is through the Root object.

Parameters
[in]_sdfThe SDF Element pointer
Returns
Errors, which is a vector of Error objects. Each Error includes an error code and message. An empty vector indicates no error.

◆ Name()

const std::string& sdf::SDF_VERSION_NAMESPACE::Plugin::Name ( ) const

Get the name of the plugin.

The name of the plugin should be unique within the scope of its parent.

Returns
Name of the plugin.

◆ operator!=()

bool sdf::SDF_VERSION_NAMESPACE::Plugin::operator!= ( const Plugin _plugin) const

Plugin inequality operator.

Parameters
[in]_pluginPlugin to compare against.
Returns
True if this plugin does not match the provided plugin. The name, filename, or contents must be different to return false.

◆ operator=() [1/2]

Plugin& sdf::SDF_VERSION_NAMESPACE::Plugin::operator= ( const Plugin _plugin)

Copy assignment operator.

Parameters
[in]_pluginPlugin to copy
Returns
A reference to this plugin

◆ operator=() [2/2]

Plugin& sdf::SDF_VERSION_NAMESPACE::Plugin::operator= ( Plugin &&  _plugin)
noexcept

Move assignment operator.

Parameters
[in]_pluginPlugin to move
Returns
A reference to this plugin

◆ operator==()

bool sdf::SDF_VERSION_NAMESPACE::Plugin::operator== ( const Plugin _plugin) const

Plugin equality operator.

Parameters
[in]_pluginPlugin to compare against.
Returns
True if this plugin matches the provided plugin. The name, filename, and contents must all match to return true.

◆ SetFilename()

void sdf::SDF_VERSION_NAMESPACE::Plugin::SetFilename ( const std::string &  _filename)

Set the filename of the shared library.

Parameters
[in]_filenameFilename of the shared library associated with this plugin.

◆ SetName()

void sdf::SDF_VERSION_NAMESPACE::Plugin::SetName ( const std::string &  _name)

Set the name of the plugin.

The name of the plugin should be unique within the scope of its parent.

Parameters
[in]_nameName of the plugin.

◆ ToElement() [1/2]

sdf::ElementPtr sdf::SDF_VERSION_NAMESPACE::Plugin::ToElement ( ) const

Create and return an SDF element filled with data from this plugin.

Note that parameter passing functionality is not captured with this function.

Returns
SDF element pointer with updated plugin values.

◆ ToElement() [2/2]

sdf::ElementPtr sdf::SDF_VERSION_NAMESPACE::Plugin::ToElement ( sdf::Errors _errors) const

Create and return an SDF element filled with data from this plugin.

Note that parameter passing functionality is not captured with this function.

Parameters
[out]_errorsVector of errors.
Returns
SDF element pointer with updated plugin values.

Member Data Documentation

◆ dataPtr

std::unique_ptr<sdf::PluginPrivate> sdf::SDF_VERSION_NAMESPACE::Plugin::dataPtr

Private data pointer.


The documentation for this class was generated from the following file: