itom
Loading...
Searching...
No Matches
helperCommon.h
1/* ********************************************************************
2 itom software
3 URL: http://www.uni-stuttgart.de/ito
4 Copyright (C) 2020, Institut für Technische Optik (ITO),
5 Universität Stuttgart, Germany
6
7 This file is part of itom and its software development toolkit (SDK).
8
9 itom is free software; you can redistribute it and/or modify it
10 under the terms of the GNU Library General Public Licence as published by
11 the Free Software Foundation; either version 2 of the Licence, or (at
12 your option) any later version.
13
14 In addition, as a special exception, the Institut für Technische
15 Optik (ITO) gives you certain additional rights.
16 These rights are described in the ITO LGPL Exception version 1.0,
17 which can be found in the file LGPL_EXCEPTION.txt in this package.
18
19 itom is distributed in the hope that it will be useful, but
20 WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
22 General Public Licence for more details.
23
24 You should have received a copy of the GNU Library General Public License
25 along with itom. If not, see <http://www.gnu.org/licenses/>.
26*********************************************************************** */
27
28#pragma once
29
30#include "param.h"
31#include "retVal.h"
32#include "typeDefs.h"
33
34#include <qobject.h>
35#include <qstring.h>
36#include <qvector.h>
37
38// only moc this file in itomCommonQtLib but not in other libraries or executables linking against
39// this itomCommonQtLib
40#if !defined(Q_MOC_RUN) || defined(ITOMCOMMONQT_MOC)
41
42namespace ito {
43
45ITOMCOMMONQT_EXPORT ito::RetVal checkParamVector(const QVector<ito::Param>* params);
46
49ITOMCOMMONQT_EXPORT ito::RetVal checkParamVectors(
50 QVector<ito::Param>* paramsMand,
51 QVector<ito::Param>* paramsOpt,
52 QVector<ito::Param>* paramsOut);
53
55ITOMCOMMONQT_EXPORT ito::Param* getParamByName(
56 QVector<ito::Param>* paramVec, const char* name, ito::RetVal* retval = nullptr);
57
59ITOMCOMMONQT_EXPORT ito::ParamBase* getParamByName(
60 QVector<ito::ParamBase>* paramVec, const char* name, ito::RetVal* retval = nullptr);
61
63ITOMCOMMONQT_EXPORT bool checkNumericParamRange(
64 const ito::Param& param, double& value, bool* ok = nullptr);
65
67ITOMCOMMONQT_EXPORT ito::RetVal parseParamName(
68 const QString& key, QString& paramName, bool& hasIndex, int& index, QString& additionalTag);
69
71ITOMCOMMONQT_EXPORT ito::RetVal getParamValue(
72 const QMap<QString, Param>* params,
73 const QString& key,
74 ito::Param& value,
75 QString& name,
76 int& index);
77
79ITOMCOMMONQT_EXPORT ito::RetVal setParamValue(
80 QMap<QString, Param>* params,
81 const QString& key,
82 const ito::ParamBase& value,
83 QString& name,
84 int& index);
85
89ITOMCOMMONQT_EXPORT QString
90getMetaDocstringFromParam(const Param& param, bool translate, QString& pythonLikeTypename);
91
92}; // end namespace ito
93
94#endif //#if !defined(Q_MOC_RUN) || defined(ITOMCOMMONQT_MOC)
<
Definition param.h:95
class for parameter handling e.g. to pass parameters to plugins
Definition param.h:477
Class for managing status values (like errors or warning)
Definition retVal.h:54
Definition apiFunctionsGraph.cpp:40
ITOMCOMMONQT_EXPORT bool checkNumericParamRange(const ito::Param &param, double &value, bool *ok=nullptr)
parses a parameter name key and extracts the real name, an optional index and / or suffix tag.
Definition helperCommon.cpp:212
ITOMCOMMONQT_EXPORT ito::Param * getParamByName(QVector< ito::Param > *paramVec, const char *name, ito::RetVal *retval=nullptr)
searches for a specific base parameter in the vector and returns it.
Definition helperCommon.cpp:119
ITOMCOMMONQT_EXPORT ito::RetVal setParamValue(QMap< QString, Param > *params, const QString &key, const ito::ParamBase &value, QString &name, int &index)
Sets the value of a parameter to a given new value val.
Definition helperCommon.cpp:494
ITOMCOMMONQT_EXPORT ito::RetVal checkParamVector(const QVector< ito::Param > *params)
< checks param vector to be not a nullptr.
Definition helperCommon.cpp:46
ITOMCOMMONQT_EXPORT ito::RetVal checkParamVectors(QVector< ito::Param > *paramsMand, QVector< ito::Param > *paramsOpt, QVector< ito::Param > *paramsOut)
searches for a specific parameter in the vector and returns it.
Definition helperCommon.cpp:70
ITOMCOMMONQT_EXPORT ito::RetVal parseParamName(const QString &key, QString &paramName, bool &hasIndex, int &index, QString &additionalTag)
searches and returns a parameter from a map based on its full key.
Definition helperCommon.cpp:676
ITOMCOMMONQT_EXPORT ito::RetVal getParamValue(const QMap< QString, Param > *params, const QString &key, ito::Param &value, QString &name, int &index)
searches a parameter from a map based on its full key and sets its value.
Definition helperCommon.cpp:300