Variant

Stores the value and type information for a PPS attribute.

Synopsis:

#include <qpps/variant.h>

namespace QPps
{
    class QPPS_EXPORT Variant
    {
    public:

        Variant();
    
        Variant( const QByteArray &value, 
                 const QByteArray &encoding );
    
        Variant( const QString &stringValue );
    
        Variant( const QByteArray &value );
    
        Variant( bool value );
    
        Variant( int value );
    
        Variant( double value );
    
        Variant( const QJsonObject &value );
    
        Variant( const QJsonDocument &value );
    
        bool isValid() const;
    
        QByteArray value() const;
    
        QByteArray encoding() const;
    
        QString toString() const;
    
        QByteArray toByteArray() const;
    
        bool toBool() const;
    
        int toInt( bool *ok = 0 ) const;
    
        double toDouble( bool *ok = 0 ) const;
    
        QJsonDocument toJson( 
                   QJsonParseError *error = 0 ) const;
    
        bool operator==( const Variant &other ) const;
    
        bool operator!=( const Variant &other ) const;
    
    };
}

Library:

libqpps

Description:

Stores the value and type information for a PPS attribute. Each attribute consists of a raw value and an encoding, both stored as strings. The encoding indicates the attribute value's "real" type and how to translate between the string representation and the real type.

PPS doesn't standardize any encodings but a few are common in practice:

This class handles all of these encodings.