Heart 1.3.842.34c2ab5
Heart is base back end library for your c++ Qt projects.
iobjectprovider.cpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2018-2024 QuasarApp.
3 * Distributed under the lgplv3 software license, see the accompanying
4 * Everyone is permitted to copy and distribute verbatim copies
5 * of this license document, but changing it is not allowed.
6*/
7
8#include "iobjectprovider.h"
9
10namespace QH {
11using namespace PKG;
12
13QSharedPointer<DBObject> iObjectProvider::getObjectRaw(
14 const DBObject &templateVal) {
15
16 if (!dynamic_cast<const DBObject*>(&templateVal)) {
17 return nullptr;
18 }
19
20 QList<QSharedPointer<PKG::DBObject>> list;
21 if (!getAllObjects(templateVal, list)) {
22 return nullptr;
23 }
24
25 if (!list.size())
26 return nullptr;
27
28 if (list.size() > 1) {
29 QuasarAppUtils::Params::log("getObject method returned more than one object,"
30 " the first object was selected as the result,"
31 " all the rest were lost.",
32 QuasarAppUtils::Warning);
33 }
34
35 return list.first();
36}
37
38}
The DBObject class- main class for work with data base.
Definition dbobject.h:94
QSharedPointer< PKG::DBObject > getObjectRaw(const PKG::DBObject &templateVal)
getObjectRaw This method return object without test object type.
virtual bool getAllObjects(const PKG::DBObject &templateObject, QList< QSharedPointer< PKG::DBObject > > &result)=0
getAllObjects This method execute a select method of the templateObject and return list of all select...
The QH namespace - QuasarApp Heart namespace. This namespace contains all classes of the Heart librar...
Definition heart.cpp:13