KDbRecordData

Search for usage in LXR

KDbRecordData Class Reference

#include <KDbRecordData.h>

Public Member Functions

 KDbRecordData ()
 
 KDbRecordData (int numCols)
 
const QVariantat (int i) const
 
void clear ()
 
void clearValues ()
 
int count () const
 
bool isEmpty () const
 
bool isNull (int i) const
 
QVariantoperator[] (int i)
 
const QVariantoperator[] (int i) const
 
void resize (int numCols)
 
int size () const
 
QList< QVarianttoList () const
 
QVariant value (int i) const
 
QVariant value (int i, const QVariant &defaultValue) const
 

Detailed Description

Structure for storing single record with type information.

Todo:

consider forking QVariant to a non-shared Variant class, with type information stored elsewhere.

Variant should have toQVariant() method

look if we can have zero-copy strategy for SQLite and other backends

look if we can use memory allocator for strings, etc.

Definition at line 36 of file KDbRecordData.h.

Constructor & Destructor Documentation

◆ KDbRecordData() [1/2]

KDbRecordData::KDbRecordData ( )
inline

Creates a new empty record.

Definition at line 40 of file KDbRecordData.h.

◆ KDbRecordData() [2/2]

KDbRecordData::KDbRecordData ( int  numCols)
inlineexplicit

Creates a new record data with numCols columns. Values are initialized to null.

Definition at line 44 of file KDbRecordData.h.

Member Function Documentation

◆ at()

const QVariant& KDbRecordData::at ( int  i) const
inline
Returns
the value at position i. i must be a valid index. i.e. 0 <= i < size().
See also
value(), operator[]().

Definition at line 72 of file KDbRecordData.h.

◆ clear()

void KDbRecordData::clear ( )

Clears all columns, the record is set empty.

Definition at line 47 of file KDbRecordData.cpp.

◆ clearValues()

void KDbRecordData::clearValues ( )

Sets all column values to null, current number of columns is preserved.

Definition at line 74 of file KDbRecordData.cpp.

◆ isNull()

bool KDbRecordData::isNull ( int  i) const
inline
Returns
true id value at position i is null. i must be a valid index, i.e. 0 <= i < size().
See also
at(), value().

Definition at line 91 of file KDbRecordData.h.

◆ operator[]() [1/2]

QVariant& KDbRecordData::operator[] ( int  i)
inline
Returns
the value at position i as a modifiable reference. i must be a valid index, i.e. 0 <= i < size().
See also
at(), value().

Definition at line 81 of file KDbRecordData.h.

◆ operator[]() [2/2]

const QVariant& KDbRecordData::operator[] ( int  i) const
inline

Overloaded function.

Definition at line 94 of file KDbRecordData.h.

◆ resize()

void KDbRecordData::resize ( int  numCols)

Resizes the record to numCols. If numCols differ from size(), new with record with all values set to null is created. If numCols equals size() nothing is performed.

Definition at line 58 of file KDbRecordData.cpp.

◆ toList()

QList< QVariant > KDbRecordData::toList ( ) const

Converts this record to QList<QVariant>

Definition at line 82 of file KDbRecordData.cpp.

◆ value() [1/2]

QVariant KDbRecordData::value ( int  i) const
inline
Returns
the value at index position i in the vector. If the index i is out of bounds, the function returns a default-constructed value. If you are certain that i is within bounds, you can use at() or operator[] instead, which is slightly faster.

Definition at line 104 of file KDbRecordData.h.

◆ value() [2/2]

QVariant KDbRecordData::value ( int  i,
const QVariant defaultValue 
) const
inline
Returns
the value at index position i in the vector. This is an overloaded function. If the index i is out of bounds, the function returns a defaultValue. If you are certain that i is within bounds, you can use at() instead, which is slightly faster.

Definition at line 114 of file KDbRecordData.h.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Wed Sep 28 2022 04:08:41 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.