annotate src/util.h @ 295:0f345852b3ed

Bump copyright years.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 09 May 2023 13:18:38 +0300
parents df3f902588af
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
246
43a5e09bb832 Split some utility functions to util.{h,cpp}
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1 //
43a5e09bb832 Split some utility functions to util.{h,cpp}
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
2 // Syntilista - debt list/management database program
43a5e09bb832 Split some utility functions to util.{h,cpp}
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
3 // Programmed and designed by Matti Hämäläinen <ccr@tnsp.org>
295
0f345852b3ed Bump copyright years.
Matti Hamalainen <ccr@tnsp.org>
parents: 271
diff changeset
4 // (C) Copyright 2017-2023 Tecnic Software productions (TNSP)
246
43a5e09bb832 Split some utility functions to util.{h,cpp}
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
5 //
43a5e09bb832 Split some utility functions to util.{h,cpp}
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
6 // Distributed under 3-clause BSD style license, refer to
43a5e09bb832 Split some utility functions to util.{h,cpp}
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
7 // included file "COPYING" for exact terms.
43a5e09bb832 Split some utility functions to util.{h,cpp}
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
8 //
43a5e09bb832 Split some utility functions to util.{h,cpp}
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
9 #ifndef SL_UTIL_H
43a5e09bb832 Split some utility functions to util.{h,cpp}
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
10 #define SL_UTIL_H
43a5e09bb832 Split some utility functions to util.{h,cpp}
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
11
252
4d2b37a0acf2 Move SQL table creation from schema array to util-module.
Matti Hamalainen <ccr@tnsp.org>
parents: 246
diff changeset
12
271
df3f902588af Add parent window argument to slErrorMsg() and use it.
Matti Hamalainen <ccr@tnsp.org>
parents: 255
diff changeset
13 #include <QWidget>
df3f902588af Add parent window argument to slErrorMsg() and use it.
Matti Hamalainen <ccr@tnsp.org>
parents: 255
diff changeset
14
df3f902588af Add parent window argument to slErrorMsg() and use it.
Matti Hamalainen <ccr@tnsp.org>
parents: 255
diff changeset
15
252
4d2b37a0acf2 Move SQL table creation from schema array to util-module.
Matti Hamalainen <ccr@tnsp.org>
parents: 246
diff changeset
16 #define SQL_MAX_SCHEMA_INSERTS 16
4d2b37a0acf2 Move SQL table creation from schema array to util-module.
Matti Hamalainen <ccr@tnsp.org>
parents: 246
diff changeset
17
4d2b37a0acf2 Move SQL table creation from schema array to util-module.
Matti Hamalainen <ccr@tnsp.org>
parents: 246
diff changeset
18
4d2b37a0acf2 Move SQL table creation from schema array to util-module.
Matti Hamalainen <ccr@tnsp.org>
parents: 246
diff changeset
19 //
4d2b37a0acf2 Move SQL table creation from schema array to util-module.
Matti Hamalainen <ccr@tnsp.org>
parents: 246
diff changeset
20 // SQL schema / table definitions
4d2b37a0acf2 Move SQL table creation from schema array to util-module.
Matti Hamalainen <ccr@tnsp.org>
parents: 246
diff changeset
21 //
4d2b37a0acf2 Move SQL table creation from schema array to util-module.
Matti Hamalainen <ccr@tnsp.org>
parents: 246
diff changeset
22 typedef struct
4d2b37a0acf2 Move SQL table creation from schema array to util-module.
Matti Hamalainen <ccr@tnsp.org>
parents: 246
diff changeset
23 {
4d2b37a0acf2 Move SQL table creation from schema array to util-module.
Matti Hamalainen <ccr@tnsp.org>
parents: 246
diff changeset
24 QString name;
4d2b37a0acf2 Move SQL table creation from schema array to util-module.
Matti Hamalainen <ccr@tnsp.org>
parents: 246
diff changeset
25 QString schema;
253
eadffc38ab43 Add support for initial INSERT statements for database creation in schema array.
Matti Hamalainen <ccr@tnsp.org>
parents: 252
diff changeset
26 QString inserts[SQL_MAX_SCHEMA_INSERTS];
252
4d2b37a0acf2 Move SQL table creation from schema array to util-module.
Matti Hamalainen <ccr@tnsp.org>
parents: 246
diff changeset
27 } SLSQLSchemaDef;
4d2b37a0acf2 Move SQL table creation from schema array to util-module.
Matti Hamalainen <ccr@tnsp.org>
parents: 246
diff changeset
28
4d2b37a0acf2 Move SQL table creation from schema array to util-module.
Matti Hamalainen <ccr@tnsp.org>
parents: 246
diff changeset
29
4d2b37a0acf2 Move SQL table creation from schema array to util-module.
Matti Hamalainen <ccr@tnsp.org>
parents: 246
diff changeset
30 //
4d2b37a0acf2 Move SQL table creation from schema array to util-module.
Matti Hamalainen <ccr@tnsp.org>
parents: 246
diff changeset
31 // Various helper utility functions
4d2b37a0acf2 Move SQL table creation from schema array to util-module.
Matti Hamalainen <ccr@tnsp.org>
parents: 246
diff changeset
32 //
246
43a5e09bb832 Split some utility functions to util.{h,cpp}
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
33 double slMoneyStrToValue(const QString &str);
43a5e09bb832 Split some utility functions to util.{h,cpp}
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
34 QString slMoneyValueToStr(double val);
43a5e09bb832 Split some utility functions to util.{h,cpp}
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
35 QString slMoneyValueToStrSign(double val);
252
4d2b37a0acf2 Move SQL table creation from schema array to util-module.
Matti Hamalainen <ccr@tnsp.org>
parents: 246
diff changeset
36
246
43a5e09bb832 Split some utility functions to util.{h,cpp}
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
37 QString slCleanupStr(const QString &str);
252
4d2b37a0acf2 Move SQL table creation from schema array to util-module.
Matti Hamalainen <ccr@tnsp.org>
parents: 246
diff changeset
38
246
43a5e09bb832 Split some utility functions to util.{h,cpp}
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
39 const QDateTime slDateTimeToLocal(const QDateTime &val);
43a5e09bb832 Split some utility functions to util.{h,cpp}
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
40 const QString slDateTimeToStr(const QDateTime &val);
43a5e09bb832 Split some utility functions to util.{h,cpp}
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
41
43a5e09bb832 Split some utility functions to util.{h,cpp}
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
42 void slLog(const QString &mtype, const QString &msg);
271
df3f902588af Add parent window argument to slErrorMsg() and use it.
Matti Hamalainen <ccr@tnsp.org>
parents: 255
diff changeset
43 int slErrorMsg(QWidget *parent, const QString &title, const QString &msg);
252
4d2b37a0acf2 Move SQL table creation from schema array to util-module.
Matti Hamalainen <ccr@tnsp.org>
parents: 246
diff changeset
44
255
55581d90c55d Change API for slCheckAndReportSQLError().
Matti Hamalainen <ccr@tnsp.org>
parents: 253
diff changeset
45 bool slCheckAndReportSQLError(const QSqlQuery &query, const QString where, bool report = false);
252
4d2b37a0acf2 Move SQL table creation from schema array to util-module.
Matti Hamalainen <ccr@tnsp.org>
parents: 246
diff changeset
46 bool slConditionallyCreateSQLTables(QSqlDatabase &db, const SLSQLSchemaDef *schema, const int nschema);
246
43a5e09bb832 Split some utility functions to util.{h,cpp}
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
47
43a5e09bb832 Split some utility functions to util.{h,cpp}
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
48
43a5e09bb832 Split some utility functions to util.{h,cpp}
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
49 #endif // SL_UTIL_H