libXpertMassCore and libXpertMassGui Developer Documentation
  • libXpertMassCore
  • Prop
  • Prop Class

    class MsXpS::libXpertMassCore::Prop

    The Prop class is the abstract base class for a number of specialized properties. More...

    Header: #include <Prop.hpp>
    Inherited By:

    MsXpS::libXpertMassCore::ChemicalGroupProp, MsXpS::libXpertMassCore::DoubleProp, MsXpS::libXpertMassCore::IntProp, MsXpS::libXpertMassCore::NoDeletePointerProp, and MsXpS::libXpertMassCore::StringProp

    Public Functions

    Prop()
    Prop(const QString &name)
    Prop(const MsXpS::libXpertMassCore::Prop &other)
    virtual ~Prop()
    virtual void *data() const
    virtual void deleteData()
    virtual QString formatXmlElement(int offset, const QString &indent = Utils::xmlIndentationToken)
    const QString &name()
    virtual bool renderXmlElement(const QDomElement &element, int version = 1)
    void setData(void *data)
    void setName(QString &name)
    virtual MsXpS::libXpertMassCore::Prop &operator=(const MsXpS::libXpertMassCore::Prop &other)

    Protected Variables

    QString m_name
    void *mpa_data

    Detailed Description

    Properties are libXpertMassCore' way of extending the capabilities of objects. A property is merely an encapsulation of:

    In order to perform tasks in the derived classes using dynamic binding, virtual functions are available to derived classes to perform:

    Derived classes should be named according the following scheme: XxxYyyZzzzProp, like StringProp or MonomerProp.

    The classes that benefit from this Property-based extension mechanism all derive from PropListHolder.

    See also StringProp and PropListHolder.

    Member Function Documentation

    Prop::Prop()

    Constructs a Prop instance.

    Prop::Prop(const QString &name)

    Constructs a Prop instance with name.

    Prop::Prop(const MsXpS::libXpertMassCore::Prop &other)

    Constructs a Prop instance as a copy of other.

    Note: The data are not duplicated.

    [virtual noexcept] Prop::~Prop()

    Destructs this Prop instance.

    Note: No action is taken here.

    [virtual] void *Prop::data() const

    Returns the data.

    See also setData().

    [virtual] void Prop::deleteData()

    Deletes the data.

    Nothing is done in this implementation.

    [virtual] QString Prop::formatXmlElement(int offset, const QString &indent = Utils::xmlIndentationToken)

    Formats and returns a string representing this Prop instance.

    The formatting of the XML element is performed using offset and indent.

    Nothing is done in this implementation. Returns an empty string.

    const QString &Prop::name()

    Returns the name.

    See also setName().

    [virtual] bool Prop::renderXmlElement(const QDomElement &element, int version = 1)

    Renders the element, with the specified version.

    Nothing is done in this implementation and this function returns false.

    void Prop::setData(void *data)

    Sets the data.

    If mpa_data is non-nullptr, deleteData() is called before assigning data to mpa_data.

    Ownership passes to this Prop instance.

    See also data().

    void Prop::setName(QString &name)

    Sets the name.

    See also name().

    [virtual] MsXpS::libXpertMassCore::Prop &Prop::operator=(const MsXpS::libXpertMassCore::Prop &other)

    Assigns other to this Prop instance.

    The data are not duplicated because their type is not known.

    Member Variable Documentation

    QString Prop::m_name

    This variable holds the name of the property. Initialized to "NOT_SET".

    void *Prop::mpa_data

    This variable holds the allocated data belonging to this Prop instance. Initialized to nullptr.