KItinerary::File

Search for usage in LXR

#include <file.h>

Public Types

enum  OpenMode { Read , Write }
 

Public Member Functions

 File (const File &)=delete
 
 File (const QString &fileName)
 
 File (File &&)
 
 File (QIODevice *device)
 
void addCustomData (const QString &scope, const QString &id, const QByteArray &data)
 
void addDocument (const QString &id, const QVariant &docInfo, const QByteArray &docData)
 
void addPass (const QString &passId, const QByteArray &rawData)
 
void addPass (KPkPass::Pass *pass, const QByteArray &rawData)
 
void addReservation (const QString &id, const QVariant &res)
 
void addReservation (const QVariant &res)
 
void close ()
 
QByteArray customData (const QString &scope, const QString &id) const
 
QByteArray documentData (const QString &id) const
 
QVariant documentInfo (const QString &id) const
 
QList< QStringdocuments () const
 
QString errorString () const
 
QList< QStringlistCustomData (const QString &scope) const
 
bool open (OpenMode mode) const
 
Fileoperator= (const File &)=delete
 
Fileoperator= (File &&)
 
QByteArray passData (const QString &passId) const
 
QList< QStringpasses () const
 
QVariant reservation (const QString &resId) const
 
QList< QStringreservations () const
 
void setFileName (const QString &fileName)
 

Static Public Member Functions

static QString normalizeDocumentFileName (const QString &name)
 
static QString passId (const KPkPass::Pass *pass)
 
static QString passId (const QString &passTypeIdenfier, const QString &serialNumber)
 

Detailed Description

A file containing a bundle of reservations and associated documents.

This is used to export or transfer a set of reservation-related documents while keeping the associations between them.

A KItinerary::File can contain the following elements:

  • JSON-LD reservation objects (see KItinerary::Reservation). Each reservation has a UUID.
  • PkPass files. Their identifier is determined by their pass type identifier and their serial number.
  • JSON-LD document objects (see KItinerary::CreativeWork) and their associated file content. Each document has a UUID.
  • Application-specific data in custom namespaces.

Definition at line 37 of file file.h.

Member Enumeration Documentation

◆ OpenMode

enum KItinerary::File::OpenMode

Definition at line 54 of file file.h.

Constructor & Destructor Documentation

◆ File() [1/3]

File::File ( )
explicit

Definition at line 36 of file file.cpp.

◆ File() [2/3]

File::File ( const QString & fileName)
explicit

Create a File instance for the file named fileName.

Definition at line 41 of file file.cpp.

◆ File() [3/3]

File::File ( QIODevice * device)
explicit

Create a File instance for the given i/o device.

Definition at line 47 of file file.cpp.

◆ ~File()

File::~File ( )

Definition at line 55 of file file.cpp.

Member Function Documentation

◆ addCustomData()

void File::addCustomData ( const QString & scope,
const QString & id,
const QByteArray & data )

Adds a custom data element with identifier id in to namespace scope.

Definition at line 374 of file file.cpp.

◆ addDocument()

void File::addDocument ( const QString & id,
const QVariant & docInfo,
const QByteArray & docData )

Adds a document and associated meta data to the file.

Definition at line 318 of file file.cpp.

◆ addPass() [1/2]

void File::addPass ( const QString & passId,
const QByteArray & rawData )

Add a pkpass file with the given pass id.

Definition at line 225 of file file.cpp.

◆ addPass() [2/2]

void File::addPass ( KPkPass::Pass * pass,
const QByteArray & rawData )

Add a pkpass file to this file.

Definition at line 220 of file file.cpp.

◆ addReservation() [1/2]

void File::addReservation ( const QString & id,
const QVariant & res )

Add a reservation to this file.

The given identifier will be used.

Definition at line 154 of file file.cpp.

◆ addReservation() [2/2]

void File::addReservation ( const QVariant & res)

Add a reservation to this file.

A new unique identifier will be generated for the reservation.

Definition at line 149 of file file.cpp.

◆ close()

void File::close ( )

Save and close the file.

Automatically called from the dtor.

Definition at line 91 of file file.cpp.

◆ customData()

QByteArray File::customData ( const QString & scope,
const QString & id ) const

Returns the custom data in the given namespace and with the given id.

Definition at line 357 of file file.cpp.

◆ documentData()

QByteArray File::documentData ( const QString & id) const

Loads the content of document id.

Definition at line 281 of file file.cpp.

◆ documentInfo()

QVariant File::documentInfo ( const QString & id) const

Loads the document meta data of document id.

Definition at line 252 of file file.cpp.

◆ documents()

QList< QString > File::documents ( ) const

Lists all document identifiers.

Definition at line 233 of file file.cpp.

◆ errorString()

QString File::errorString ( ) const

Error message in case opening the file failed.

Definition at line 83 of file file.cpp.

◆ listCustomData()

QList< QString > File::listCustomData ( const QString & scope) const

List custom data in the given namespace.

Definition at line 342 of file file.cpp.

◆ normalizeDocumentFileName()

QString File::normalizeDocumentFileName ( const QString & name)
static

Makes sure the resulting file name is something that can safely be used without messing up the file system or archive structure.

Definition at line 300 of file file.cpp.

◆ open()

bool File::open ( File::OpenMode mode) const

Open the file for reading or writing.

A filename needs to be set before calling this. All read/write operations require the file to be open as a precondition.

Definition at line 67 of file file.cpp.

◆ passData()

QByteArray File::passData ( const QString & passId) const

Pass data for the given pass id.

Definition at line 203 of file file.cpp.

◆ passes()

QList< QString > File::passes ( ) const

Lists all pkpass files in this file.

Definition at line 176 of file file.cpp.

◆ passId() [1/2]

QString File::passId ( const KPkPass::Pass * pass)
static

Returns the pass identifier used in here for pass.

Definition at line 162 of file file.cpp.

◆ passId() [2/2]

QString File::passId ( const QString & passTypeIdenfier,
const QString & serialNumber )
static

Definition at line 167 of file file.cpp.

◆ reservation()

QVariant File::reservation ( const QString & resId) const

Loads the reservation with the given identifier.

Definition at line 120 of file file.cpp.

◆ reservations()

QList< QString > File::reservations ( ) const

Lists the identifiers of all reservations in this file.

Definition at line 99 of file file.cpp.

◆ setFileName()

void File::setFileName ( const QString & fileName)

Sets the file name.

Needs to be done before calling open().

Definition at line 62 of file file.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sun Feb 25 2024 18:40:33 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.