KanoopDatabaseQt 1.1.1
Qt database abstraction library
Loading...
Searching...
No Matches
QueryLoadable Class Referenceabstract

QueryLoadable. More...

#include <queryloadable.h>

Public Member Functions

virtual bool loadFromQuery (const QSqlQuery &query)=0
 Load the object's state from the current row of a query result.
 

Static Protected Member Functions

static QDateTime utcTime (const QVariant &value)
 Convert a QVariant database value to a UTC QDateTime.
 
template<typename T >
static T enumFromString (const QString &value)
 Convert a single-character string to an enum value by casting the first character.
 

Detailed Description

QueryLoadable.

A pure abstract class to provide an interface to classes which are able to load themselves via an active QSqlQuery.

Stephen Punak, January 11 2025

Pure abstract interface for classes that can populate themselves from an active QSqlQuery.

Definition at line 14 of file queryloadable.h.

Member Function Documentation

◆ enumFromString()

template<typename T >
static T QueryLoadable::enumFromString ( const QString &  value)
inlinestaticprotected

Convert a single-character string to an enum value by casting the first character.

Parameters
valueThe string representation of the enum.
Returns
The enum value, or a default-constructed T if the string is empty.

Definition at line 35 of file queryloadable.h.

◆ loadFromQuery()

virtual bool QueryLoadable::loadFromQuery ( const QSqlQuery &  query)
pure virtual

Load the object's state from the current row of a query result.

Parameters
queryThe active QSqlQuery positioned at the row to load from.
Returns
true on success, false on failure.

◆ utcTime()

static QDateTime QueryLoadable::utcTime ( const QVariant &  value)
staticprotected

Convert a QVariant database value to a UTC QDateTime.

Parameters
valueThe QVariant containing the datetime value.
Returns
The corresponding QDateTime in UTC.

The documentation for this class was generated from the following file: