Detailed Description
The QDSData class encapsulates data shared by Qt Extended Data Sharing (QDS) services.
The QDSData class is used by QDS services as an efficient means of sharing data between client and provider applications. The data is implicitly shared between QDSData objects, and can be stored persistently.
For larger data sizes, methods which use QFile and QIODevice are recommended.
See also QDSAction, QDSActionRequest, and Qt Extended Data Sharing (QDS).
Member Function Documentation
QDSData::QDSData ()
Constructs an empty QDSData object.
QDSData::QDSData ( const QDSData & other )
Constructs a deep copy of other.
QDSData::QDSData ( const QUniqueId & key )
Constructs a data object from key key should be a key previously created by QDSData::store().
QDSData::QDSData ( const QByteArray & data, const QMimeType & type )
Constructs a data object with data of type.
QDSData::QDSData ( const QString & data, const QMimeType & type )
Constructs a data object with data of type. data should not contain non-Latin1 characters as it is converted to a Latin1 representation.
QDSData::QDSData ( QFile & data, const QMimeType & type )
Constructs a data object with data of type. The data in data is copied into the QDS data store.
QDSData::~QDSData ()
Destroys the QDSData object.
QByteArray QDSData::data () const
Returns the data as a QByteArray.
bool QDSData::isValid () const
Returns true if the data object is valid; otherwise returns false.
bool QDSData::modify ( const QByteArray & data )
Replaces the data with data. It is assumed that data is of the same data type as the original data.
Returns true on successful completion of the request; otherwise returns false.
bool QDSData::modify ( const QString & data )
This is an overloaded member function, provided for convenience.
Replaces the data with data. It is assumed that data is of the same data type as the original data.
bool QDSData::modify ( QFile & data )
This is an overloaded member function, provided for convenience.
Replaces the data with data. It is assumed that data is of the same data type as the original data.
bool QDSData::modify ( const QByteArray & data, const QMimeType & type )
This is an overloaded member function, provided for convenience.
Replaces the data with data of type.
bool QDSData::modify ( const QString & data, const QMimeType & type )
This is an overloaded member function, provided for convenience.
Replaces the data with data of type.
bool QDSData::modify ( QFile & data, const QMimeType & type )
This is an overloaded member function, provided for convenience.
Replaces the data with data of type.
bool QDSData::remove ()
Removes the data from the persistent data store. When the reference count is zero, indicating that no-one requires the data, the data is permanently deleted from the data store.
Returns true on successful completion of the request; otherwise returns false.
Adds the data to the persistent data store, and returns a key for accessing the data in the future.
If the data was incorrectly stored, the returned key will be null.
The persistent data is reference counted so all applications who wish to access the data from the data store should call this method.
QIODevice * QDSData::toIODevice () const
Provides direct read-only access to the data using the QIODevice interface. The caller owns the returned QIODevice pointer, and must delete it when finished.
The pointer can be used to access the data using a QDataStream.
QString QDSData::toString () const
Returns the data as a QString.
QMimeType QDSData::type () const
Returns the data type.
bool QDSData::operator!= ( const QDSData & other ) const
Returns true if the data object is not equal to the other data object specified; otherwise returns false.
const QDSData & QDSData::operator= ( const QDSData & other )
Makes a deep copy of other and assigns it to this QDSData object. Returns a reference to this QDSData object.
bool QDSData::operator== ( const QDSData & other ) const
Returns true if the data object is equal to the other data object specified; otherwise returns false.