Object

Represents PPS objects in the /pps filepath.

Synopsis:

#include <qpps/object.h>

namespace QPps
{
    class QPPS_EXPORT Object : public QObject
    {
        Q_OBJECT

    public:

        enum PublicationMode
        {
            PublishMode = 0,
            SubscribeMode,
            PublishAndSubscribeMode
        };
    
        explicit Object( const QString &path, 
                         PublicationMode mode = 
                               PublishAndSubscribeMode, 
                         bool create = false,
                         QObject *parent = 0 );
    
        ~Object();
        
        bool attributeCacheEnabled() const;
    
        void setAttributeCacheEnabled( bool cacheEnabled );
    
        bool isValid() const;
    
        QString errorString() const;
    
        QString path() const;
    
        Variant attribute( const QString &name, 
                           const Variant &defaultValue = 
                                          Variant() ) const;
    
        QStringList attributeNames() const;
    
        bool setAttributes( const Changeset &changes );
    
    Q_SIGNALS:

        void attributesChanged( 
                           const QPps::Changeset &changes );
    
        void attributeChanged( const QString &name,
                               const QPps::Variant &value );
    
        void attributeRemoved( const QString &name );
    
        void objectRemoved();
    
    public Q_SLOTS:

        bool setAttribute( const QString &name, 
                           const QPps::Variant &value );
    
        bool removeAttribute( const QString &name );
    
    };
}

Library:

libqpps

Description:

Represents PPS objects in the /pps filepath. The Object class communicates with these filesystem objects so you can work with PPS at the level of objects and attributes instead of POSIX system calls.

Each PPS object holds key-value pairs called attributes, which store the object's state. By default, the state is saved across reboots. The PPS service provides mechanisms for changing object attributes and sending notifications of attribute changes. The Object class uses these mechanisms and provides methods to set one or many attributes at a time and also emits signals containing information on attribute updates or removals.