Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions Interfaces/ORM/intfActionLogs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ intfActionLogs::intfActionLogs(
const QString& _module,
const QString& _schema
) :
intfSQLBasedModule(
_module,
_schema,
tblActionLogs::Name,
tblActionLogs::Private::ORMFields,
tblActionLogs::Private::Relations,
tblActionLogs::Private::Indexes
) { ; }
intfSQLBasedModule(
_module,
_schema,
tblActionLogs::Name,
tblActionLogs::Private::ORMFields,
tblActionLogs::Private::Relations,
tblActionLogs::Private::Indexes
) { ; }

QVariant IMPL_ORMGET_USER(intfActionLogs) {
// Authorization::checkPriv(APICALLBOOM_PARAM, { this->ModuleName + ":ActionLogs:CRUD~0100" });
Expand Down
1 change: 1 addition & 0 deletions Interfaces/ORM/intfAlerts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ intfAlerts::intfAlerts(
intfSQLBasedModule(
_module,
_schema,
tblAlerts::Name,
tblAlerts::Private::ORMFields,
tblAlerts::Private::Relations,
tblAlerts::Private::Indexes
Expand Down
16 changes: 8 additions & 8 deletions Interfaces/ORM/intfConfigurations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ intfConfigurations::intfConfigurations(
const QString &_module,
const QString &_schema
) :
intfSQLBasedModule(
_module,
_schema,
tblConfigurations::Name,
tblConfigurations::Private::ORMFields,
tblConfigurations::Private::Relations,
tblConfigurations::Private::Indexes
) { ; }
intfSQLBasedModule(
_module,
_schema,
tblConfigurations::Name,
tblConfigurations::Private::ORMFields,
tblConfigurations::Private::Relations,
tblConfigurations::Private::Indexes
) { ; }

QVariant IMPL_ORMGET_ANONYMOUSE(intfConfigurations) {
return this->Select(GET_METHOD_ARGS_CALL_VALUES);
Expand Down
16 changes: 8 additions & 8 deletions Interfaces/ORM/intfFAQ.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ intfFaqQuestions::intfFaqQuestions(
const QString& _module,
const QString& _schema
) :
intfSQLBasedModule(
_module,
_schema,
tblFaqQuestions::Name,
tblFaqQuestions::Private::ORMFields,
tblFaqQuestions::Private::Relations(_schema),
tblFaqQuestions::Private::Indexes
) { ; }
intfSQLBasedModule(
_module,
_schema,
tblFaqQuestions::Name,
tblFaqQuestions::Private::ORMFields,
tblFaqQuestions::Private::Relations(_schema),
tblFaqQuestions::Private::Indexes
) { ; }

QVariant IMPL_ORMGET_ANONYMOUSE(intfFaqQuestions) {
return this->Select(GET_METHOD_ARGS_CALL_VALUES);
Expand Down
16 changes: 8 additions & 8 deletions Interfaces/ORM/intfI18N.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ intfI18N::intfI18N(
const QString &_module,
const QString &_schema
) :
intfSQLBasedModule(
_module,
_schema,
tblI18N::Name,
tblI18N::Private::ORMFields,
tblI18N::Private::Relations,
tblI18N::Private::Indexes
) { ; }
intfSQLBasedModule(
_module,
_schema,
tblI18N::Name,
tblI18N::Private::ORMFields,
tblI18N::Private::Relations,
tblI18N::Private::Indexes
) { ; }

QString intfI18N::translated(
INTFAPICALLBOOM_IMPL &APICALLBOOM_PARAM,
Expand Down
16 changes: 8 additions & 8 deletions Interfaces/ORM/intfMigrations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ intfMigrations::intfMigrations(
const QString& _module,
const QString& _schema
) :
intfSQLBasedModule(
_module,
_schema,
tblMigrations::Name,
tblMigrations::Private::ORMFields,
tblMigrations::Private::Relations,
tblMigrations::Private::Indexes
) { ; }
intfSQLBasedModule(
_module,
_schema,
tblMigrations::Name,
tblMigrations::Private::ORMFields,
tblMigrations::Private::Relations,
tblMigrations::Private::Indexes
) { ; }

QVariant IMPL_ORMGET_ANONYMOUSE(intfMigrations) {
// Authorization::checkPriv(APICALLBOOM_PARAM, { this->ModuleName + ":Migrations:CRUD~0100" });
Expand Down
46 changes: 46 additions & 0 deletions devtools/checkQObject.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# check_code v1.0
# run from root of repository
from subprocess import check_output

_qt_autogen_macro_list = (\
'signals:', \
'Q_CLASSINFO', \
'Q_PLUGIN_METADATA', \
'Q_INTERFACES', \
'Q_PROPERTY', \
'Q_PRIVATE_PROPERTY', \
'Q_REVISION', \
'Q_OVERRIDE', \
'Q_ENUM', \
'Q_FLAGS', \
'Q_SCRIPTABLE', \
'Q_INVOKABLE', \
'Q_SIGNAL', \
'Q_SLOT' \
)
_qt_autogen_macro_regexp = '({0})'.format('|'.join(_qt_autogen_macro_list))

def _FnamesToBaseFileNames(fnames_list):
result = []
for fn in fnames_list:
start = fn.rfind('/')
end = fn.rfind('.')
if end > start:
result.append(fn[start + 1 : end])
return result

def CheckQObject():
def get_files(pattern):
files = check_output('git grep -E "{0}"'.format(pattern)).split('\n')
files = [s[:s.find(':')] for s in files]
return set([s for s in files if len(s) > 0])
qobject_files = _FnamesToBaseFileNames(get_files('Q_OBJECT'))
macro_files = _FnamesToBaseFileNames(get_files(_qt_autogen_macro_regexp))
include_moc_files = _FnamesToBaseFileNames(get_files('#include \\"moc_.*?\.cpp\\"'))
for fn in qobject_files:
if fn not in include_moc_files:
print 'looks like {0} misses include for moc_* file'.format(fn)
if fn not in macro_files:
print 'probably {0} has redundant Q_OBJECT macro'.format(fn)

CheckQObject()
7 changes: 7 additions & 0 deletions devtools/gdb-runTargomanAPI-dev.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

export LD_LIBRARY_PATH=../out/lib:../out/lib64
export AWS_EC2_METADATA_DISABLED=true

gdb --args \
../out/bin/targomanAPI --plugins ../out/modules -c ../conf/api.conf --dbprefix dev_ $@
9 changes: 9 additions & 0 deletions devtools/valgrind-runTargomanAPI-dev.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

export LD_LIBRARY_PATH=../out/lib:../out/lib64
export AWS_EC2_METADATA_DISABLED=true

#valgrind --log-file=val.log --show-leak-kinds=all --leak-check=full --undef-value-errors=yes

valgrind --leak-check=full --undef-value-errors=yes --log-file=val.log \
../out/bin/targomanAPI --plugins ../out/modules -c ../conf/api.conf --dbprefix dev_ $@
4 changes: 3 additions & 1 deletion runTargomanAPI-dev.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/bin/bash

export LD_LIBRARY_PATH=out/lib:out/lib64
AWS_EC2_METADATA_DISABLED=true out/bin/targomanAPI --plugins out/modules -c conf/api.conf --dbprefix dev_ $@
export AWS_EC2_METADATA_DISABLED=true

out/bin/targomanAPI --plugins out/modules -c conf/api.conf --dbprefix dev_ $@
4 changes: 3 additions & 1 deletion runTargomanAPI.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/bin/bash

export LD_LIBRARY_PATH=out/lib:out/lib64
AWS_EC2_METADATA_DISABLED=true out/bin/targomanAPI --plugins out/modules -c conf/api.conf $@
export AWS_EC2_METADATA_DISABLED=true

out/bin/targomanAPI --plugins out/modules -c conf/api.conf $@
139 changes: 139 additions & 0 deletions unitTest/testNullable.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
#ifndef TESTMACROS_HPP
#define TESTMACROS_HPP

//#include <QtGlobal>
//#include <QString>
#include <QtTest/QtTest>
//#include <optional>
using namespace std;

#include "Interfaces/Common/APIArgHelperMacros.hpp"
#include "Interfaces/Common/QtTypes.hpp"
#include "Interfaces/Common/GenericTypes.h"
#include "Interfaces/Helpers/IteratorHelper.hpp"
#include "Interfaces/Helpers/URLHelper.h"

using namespace Targoman;
using namespace Targoman::API::Helpers;
using namespace TAPI;

class Code_t : public QString {
public:
Code_t() { ; }
Code_t(const QString& _other) : QString(_other) { ; }
};

class testNullable : public QObject
{
Q_OBJECT

private:
void func1(tmplNullable<Code_t> s = NULLABLE_NULL_VALUE) {
}

void func2() {
QString s = "aaa";

func1(s);

tmplNullable<Code_t> s2;
s2 = s;

tmplNullable<Code_t> s3 = s;

bool b = s3 == nullopt;

if ("aaa" == s2) {

}
}

private slots:
void testOptional() {
optional<quint32> a;
a = 1234;
}

void testQSharedPointer() {
QSharedPointer<quint32> a = QSharedPointer<quint32>::create();
*a = 1234;
}

void test_bad_Nullable() {
std::optional<int> i1 = 1000;

//-> OK : stored 1000
std::map<std::string, std::optional<int>> aa;
aa.insert({ "b_1", i1 });

//-> OK : stored 1000
std::map<QString, std::optional<int>> bb;
bb.insert({ "b_1", i1 });

//-> FAILED : stored null
QMap<QString, std::optional<int>> cc;
cc.insert( "b_1", i1 );

//-> FAILED : stored null
QList<std::optional<int>> dd;
dd.append(i1);
}

void test_tmplNullable() {
tmplNullable<quint32> a;

a = std::nullopt;
qDebug() << "a=null" << a;

a = 1234;
qDebug() << "a=1234" << a;

quint32 b = a.value();
qDebug() << "b=a.val" << b;

tmplNullable<quint32> c = a;
qDebug() << "c=a" << c;

bool z = a > c;
qDebug() << "a > c : z" << z;
qDebug() << "a > c" << (a > c);

quint32 o = (a < c)
? NULLABLE_VALUE(a)
: NULLABLE_VALUE(c);

QMap<QString, tmplNullable<quint32>> aa;
aa.insert("a", a);
aa.insert("b", b);
aa.insert("c", c);
tmplNullable<quint32> d;
aa.insert("d", d);
qDebug() << "a,b,c,d(null)" << aa;


// TAPI::setFromVariant(a, QVariant());

const tmplNullable<quint32> a2 = std::nullopt;

// const std::optional<int> a3 = std::nullopt;

tmplNullable<quint8> u1, u2;
if (u1 < u2) {
u1 = u2;
}

if (u1 < 12) { ; }

if (34 < u2) { ; }
}

// void test_tmplNullable_JWT_t() {
// tmplNullable<TAPI::JWT_t) a;
// a = NULLABLE_NULL_VALUE;

// TAPI::setFromVariant(a, QVariant());
// }

};

#endif // TESTMACROS_HPP