Akonadi::Server::PartHelper

Akonadi::Server::PartHelper Namespace Reference

Functions

bool insert (Part *part, qint64 *insertId=nullptr)
 
bool remove (const QString &column, const QVariant &value)
 
bool remove (Part *part)
 
QByteArray translateData (const Part &part)
 
QByteArray translateData (const QByteArray &data, Part::Storage storageType)
 
bool truncate (Part &part)
 
void update (Part *part, const QByteArray &data, qint64 dataSize)
 
bool verify (Part &part)
 

Detailed Description

Helper methods that store data in a file instead of the database.

Author
Andras Mantia amant.nosp@m.ia@k.nosp@m.de.or.nosp@m.g
Todo
Use exceptions for error handling in all these methods. Requires that all callers can handle that first though.

Function Documentation

◆ insert()

bool Akonadi::Server::PartHelper::insert ( Part * part,
qint64 * insertId = nullptr )

Adds a new part to the database and if necessary to the filesystem.

part must not be in the database yet (ie. valid() == false) and must have a data size set.

Definition at line 58 of file parthelper.cpp.

◆ remove() [1/2]

bool Akonadi::Server::PartHelper::remove ( const QString & column,
const QVariant & value )

Deletes all parts which match the given constraint, including all corresponding filesystem data.

Definition at line 102 of file parthelper.cpp.

◆ remove() [2/2]

bool Akonadi::Server::PartHelper::remove ( Part * part)

Deletes part from the database and also removes existing filesystem data if needed.

Definition at line 90 of file parthelper.cpp.

◆ translateData() [1/2]

QByteArray Akonadi::Server::PartHelper::translateData ( const Part & part)

Convenience overload of the above.

Definition at line 147 of file parthelper.cpp.

◆ translateData() [2/2]

QByteArray Akonadi::Server::PartHelper::translateData ( const QByteArray & data,
Part::Storage storageType )

Returns the payload data.

Definition at line 122 of file parthelper.cpp.

◆ truncate()

bool Akonadi::Server::PartHelper::truncate ( Part & part)

Truncate the payload of part and update filesystem/database accordingly.

This is more efficient than using update since it does not require the data to be loaded.

Definition at line 152 of file parthelper.cpp.

◆ update()

void Akonadi::Server::PartHelper::update ( Part * part,
const QByteArray & data,
qint64 dataSize )

Update payload of an existing part part to data and size dataSize.

Automatically decides whether or not the data should be stored in the database or the file system.

Exceptions
PartHelperExceptionif file operations failed

Definition at line 22 of file parthelper.cpp.

◆ verify()

bool Akonadi::Server::PartHelper::verify ( Part & part)

Verifies and if necessary fixes the external reference of this part.

Definition at line 164 of file parthelper.cpp.

This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:03:34 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.