libXpertMass Developer Documentation
  • libXpertMass
  • StringProp
  • StringProp Class

    class MsXpS::libXpertMass::StringProp

    The StringProp class is the specialized class for properties that hold data in the form of string objects. More...

    Header: #include <StringProp>
    Inherits: MsXpS::libXpertMass::Prop

    Public Functions

    StringProp(const QString &name = QString(), const QString &data = QString())
    StringProp(const QString &name = QString(), QString *data = nullptr)
    StringProp(const StringProp &other)
    virtual ~StringProp()
    virtual StringProp &operator=(const StringProp &other)

    Reimplemented Public Functions

    virtual StringProp *cloneOut() const override
    virtual void deleteData() override
    virtual QString *formatXmlElement(int offset, const QString &indent = QString(" ")) override
    virtual bool renderXmlElement(const QDomElement &element, int version = 1) override

    Detailed Description

    A StringProp property is a simple property in which the data is a pointer to an allocated QString.

    Member Function Documentation

    StringProp::StringProp(const QString &name = QString(), const QString &data = QString())

    Constructs a StringProp instance.

    The string passed as data is used to dynamically allocate a new string with the same contents and then is set to the member mpa_data pointer.

    StringProp::StringProp(const QString &name = QString(), QString *data = nullptr)

    Constructs a StringProp instance.

    The string passed as data is used to dynamically allocate a new string with the same contents and then is set to the member mpa_data pointer.

    StringProp::StringProp(const StringProp &other)

    Constructs a StringProp instance as a copy of other.

    [virtual noexcept] StringProp::~StringProp()

    Destructs this StringProp instance.

    Deletion of the data is delegated to deleteData().

    [override virtual] StringProp *StringProp::cloneOut() const

    Duplicates this StringProp instance and returns a pointer to it.

    [override virtual] void StringProp::deleteData()

    Deletes the member data.

    [override virtual] QString *StringProp::formatXmlElement(int offset, const QString &indent = QString(" "))

    Formats a string suitable to use as an XML element.

    Formats a string suitable to be used as an XML element in a polymer sequence file. Typical string-only property elements that might be generated in this function look like this:

    <prop>
    <name>MODIF</name>
    <data>Phosphorylation</data>
    </prop>
    <prop>
    <name>COMMENT</name>
    <data>Phosphorylation is only partial</data>
    </prop>

    offset times the indent string must be used as a lead in the formatting of elements.

    Returns a dynamically allocated string that needs to be freed after use.

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

    Parses the string-only property XML element using a versioned function.

    Parses the string-only property XML element passed as argument and for each encountered data(name and data) will set the data to this string-only property (this is called XML rendering).

    Returns true if parsing was successful, false otherwise.

    [virtual] StringProp &StringProp::operator=(const StringProp &other)

    Assigns other to this StringProp instance.

    Returns a reference to this StringProp instance.