| <large>libXpertMassCore and libXpertMassGui Developer Documentation</large>

- libXpertMassCore
- StringProp

# MsXpS::libXpertMassCore::StringProp Class

class MsXpS::libXpertMassCore::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::libXpertMassCore::Prop

- List of all members, including inherited members
- StringProp is part of The property system.

## Public Functions

| StringProp(const QString &name = QString(), const QString &data = QString())
| StringProp(const MsXpS::libXpertMassCore::StringProp &other)
virtual | ~StringProp()
virtual MsXpS::libXpertMassCore::StringProp & | operator=(const MsXpS::libXpertMassCore::StringProp &other)

## Reimplemented Public Functions

virtual MsXpS::libXpertMassCore::StringProp * | cloneOut() const override
virtual void | deleteData() override
virtual QString | formatXmlElement(int offset, const QString &indent = Utils::xmlIndentationToken) 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.

- name: The name of the property.
- data: The data of the property.

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 MsXpS::libXpertMassCore::StringProp &other)

Constructs a StringProp instance as a copy of other.

The member data, if non-, are first deleted.

### `[virtual noexcept]` StringProp::~StringProp()

Destructs this StringProp instance.

Deletion of the data is delegated to deleteData().

### `[override virtual]` MsXpS::libXpertMassCore::StringProp *StringProp::cloneOut() const

Duplicates this StringProp instance and returns a pointer to it.

### `[override virtual]` void StringProp::deleteData()

Reimplements: Prop::deleteData().

Deletes the member data.

### `[override virtual]` QString StringProp::formatXmlElement(int offset, const QString &indent = Utils::xmlIndentationToken)

Reimplements: Prop::formatXmlElement(int offset, const QString &indent).

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.

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

Reimplements: Prop::renderXmlElement(const QDomElement &element, int version).

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).

The XML element looks like this:

    <prop>
      <name>MODIF</name>
      <data>acetylation</data>
    </prop>

Returns true if parsing was successful, false otherwise.

### `[virtual]` MsXpS::libXpertMassCore::StringProp &StringProp::operator=(const MsXpS::libXpertMassCore::StringProp &other)

Assigns other to this StringProp instance.

Returns a reference to this StringProp instance.