Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8d84344990
|
||
|
|
98ba7450a4
|
||
|
|
b82a36142c
|
||
|
|
d35854691c
|
||
|
|
9e1a3e336b
|
||
|
|
e897cfbd14
|
||
|
|
5a92edc6b0
|
||
|
|
c32ed6ce28
|
||
|
|
6631ba0641
|
||
|
|
98320fe174
|
||
|
|
b8105cf9cc
|
||
|
|
d7a93916e3
|
||
|
|
cec9dfc0e1
|
||
|
|
893b3d9fff
|
||
|
|
7de9d1a819
|
||
|
|
8748a63532
|
||
|
|
5eed025419
|
||
|
|
f2e416b0f8
|
||
|
|
1c7043fa3e
|
||
|
|
2bd4c5b35e
|
||
|
|
f4481a84f4
|
||
|
|
4c740690e0
|
||
|
|
128c79cdc4
|
||
|
|
7082677b2f
|
||
|
|
257d8bbade
|
||
|
|
a6ca71b131
|
||
|
|
8634716aa7
|
||
|
|
8a12629740
|
||
|
|
b07f2f7a59
|
||
|
|
da90ef8e40
|
||
|
|
197f684488
|
||
|
|
e63838faeb
|
||
|
|
89b37db48e
|
||
|
|
68e7f44a76
|
||
|
|
2490e2cc68
|
||
|
|
b2f4c065ea
|
||
|
|
20b40597fd
|
||
|
|
7df78838aa
|
||
|
|
b3bd9c6cf0
|
||
|
|
dadff8329e
|
||
|
|
c30b7db041
|
||
|
|
6aa100f12c
|
||
|
|
5d457f3d4b
|
||
|
|
af0d34beb9
|
||
|
|
d122917f83
|
||
|
|
612501217c
|
||
|
|
d86ab8f9c0
|
||
|
|
5a33563722
|
||
|
|
1c850b12ec
|
||
|
|
140b4495df
|
||
|
|
8b0b25ed0a
|
||
|
|
eacdcfb980
|
||
|
|
132e7aa937
|
||
|
|
d9f3b69dde
|
||
|
|
de753070a8
|
||
|
|
c1c6e6a588
|
||
|
|
291147503f
|
||
|
|
dbf7dfab82
|
||
|
|
b753464608
|
||
|
|
544ef298aa
|
||
|
|
065a2d182f
|
||
|
|
f4470ccbe7
|
||
|
|
71ad4869ce
|
||
|
|
09dc6782c8
|
||
|
|
0cebb2dc52
|
||
|
|
0724ca8eb3
|
||
|
|
53991e54e1
|
||
|
|
df7ae1c6ea
|
||
|
|
d1f5d9aa88
|
||
|
|
a54d70bed4
|
||
|
|
bcde5c628a
|
||
|
|
f241eb0a18
|
||
|
|
74c0c936f6
|
||
|
|
79babc916a
|
||
|
|
a08bf9f804
|
||
|
|
966577cd58
|
||
|
|
8f20c8f67c
|
||
|
|
f6c04b2d00
|
||
|
|
0474c76a3d
|
||
|
|
7a29a072be
|
||
|
|
24c2ecb8dd
|
||
|
|
7a1cea63bf
|
||
|
|
e600aebaae
|
||
|
|
5e45ad3417
|
||
|
|
79e971cb76
|
||
|
|
edee581ecf
|
||
|
|
f7e077a7c5
|
||
|
|
6a9504fd5f
|
||
|
|
6d256e6512
|
||
|
|
cf383fa026
|
||
|
|
c86536d660
|
||
|
|
dba87d6213
|
||
|
|
52f9d399ca
|
||
|
|
7b7a962f19
|
||
|
|
c37722c29a
|
||
|
|
ca509d3a86
|
||
|
|
bf79e46411
|
||
|
|
08821eb440
|
||
|
|
d7878b5564
|
||
|
|
0b52ae80dd
|
||
|
|
3e46d8b4b4
|
||
|
|
1655ae3562
|
||
|
|
dda325bbbf
|
||
|
|
c326c2a095
|
||
|
|
bf386e2286
|
||
|
|
e822e13dc8
|
||
|
|
cc2c008bfd
|
||
|
|
b8a8013d4c
|
||
|
|
12ed77aeb1
|
||
|
|
7476048da6
|
||
|
|
8a307790c0
|
||
|
|
a49b10ed2d
|
||
|
|
6a2da642b0
|
||
|
|
b836c77950
|
||
|
|
2aa4eee20d
|
||
|
|
9ada82c4aa
|
||
|
|
aa9b83f740
|
||
|
|
4ddfd2cd3a
|
||
|
|
d15f5e4fa4
|
||
|
|
2e455f97ac
|
||
|
|
f664cc1a53
|
||
|
|
ae505f3201
|
||
|
|
d5433cddf1
|
||
|
|
52773a271c
|
||
|
|
e9311989ab
|
||
|
|
7b63c01033
|
||
|
|
5972b2bb39 | ||
|
|
f182978ea5 | ||
|
|
ebb8132808 | ||
|
|
1bd1762258 | ||
|
|
00b0e251f4 | ||
|
|
14e32df8c9 | ||
|
|
aa938f05ca | ||
|
|
4583ab28ed | ||
|
|
9c0cd6eb5e | ||
|
|
32c30cf536 | ||
|
|
a8b7a9e122 | ||
|
|
d07ff5b881 | ||
|
|
66fae598c2 | ||
|
|
589e889822 | ||
|
|
89249f1297 | ||
|
|
2bd56c87e4 | ||
|
|
204688464e | ||
|
|
1d0956abab | ||
|
|
c2013ff47f | ||
|
|
624bf47c8d | ||
|
|
cdd395efa5 | ||
|
|
47f6e2234c | ||
|
|
1648092cd5 | ||
|
|
99fbf6ca27 | ||
|
|
f050fc2316 | ||
|
|
1015baf111 | ||
|
|
04f0a2f808 | ||
|
|
1da240afb9 | ||
|
|
77a00f5989 | ||
|
|
f3d6494ae5 | ||
|
|
8edd0ef07a | ||
|
|
3855ea9fa7 | ||
|
|
a81839fd9c | ||
|
|
03035f038f | ||
|
|
baa870edbd | ||
|
|
c8bc23312b | ||
|
|
d5e6fb7c54 | ||
|
|
6138497fe0 | ||
|
|
05ecac8426 | ||
|
|
222a1c8a1f | ||
|
|
04164ff967 | ||
|
|
9f64692ede | ||
|
|
8b9ad5d079 | ||
|
|
bff435db9a | ||
|
|
e09a93bd72 | ||
|
|
e378fcfe3b | ||
|
|
a7a338f28e | ||
|
|
a19158cb62 | ||
|
|
778ed01a55 | ||
|
|
217f42b7c6 | ||
|
|
a34db6505d | ||
|
|
7dc117da5e | ||
|
|
b1441366f4 | ||
|
|
c730b85629 | ||
|
|
d3a440fa0a | ||
|
|
5f77ce619e | ||
|
|
5dd34c802e | ||
|
|
3609d94c09 | ||
|
|
5dc00e95e7 | ||
|
|
e88615226b | ||
|
|
ca1a854fd1 | ||
|
|
ceb5336ca1 | ||
|
|
f651df6e1f | ||
|
|
6266eac729 | ||
|
|
de972de948 | ||
|
|
55f48e4f3a | ||
|
|
39ab07508f | ||
|
|
968660e8ca | ||
|
|
4b46ba1fe3 | ||
|
|
a164e6e21e | ||
|
|
82281b4363 | ||
|
|
9d8d35b64f | ||
|
|
33f6a9a213 | ||
|
|
e5ed1d6ae8 | ||
|
|
9e6a5b2d37 | ||
|
|
c85a724fec | ||
|
|
2e8f4d1a26 | ||
|
|
522b57ade4 | ||
|
|
d4da6aa518 | ||
|
|
979ef907fe | ||
|
|
b2d92b85a0 | ||
|
|
8d6d0ddbf8 | ||
|
|
8da76134ce | ||
|
|
179daf743e | ||
|
|
bcb009b606 | ||
|
|
327c215e5d | ||
|
|
b484071818 | ||
|
|
31e826d893 | ||
|
|
e29f912358 | ||
|
|
26226de865 | ||
|
|
56d87c4410 | ||
|
|
ebfa5f7405 | ||
|
|
ba16cf41fe | ||
|
|
01c10bad0e | ||
|
|
7d1fb3c04e | ||
|
|
9e222f5b80 | ||
|
|
3b5658ff8f | ||
|
|
5e89c4004a | ||
|
|
9602c28d96 | ||
|
|
0fd680b496 | ||
|
|
37d3a44b24 | ||
|
|
da2dec447b | ||
|
|
c6c50a5d23 | ||
|
|
98c1e8daad | ||
|
|
f99191aa6f | ||
|
|
df04075f1c | ||
|
|
3d2a635e34 | ||
|
|
aad5db9a6a | ||
|
|
43ebbdaa33 | ||
|
|
92c7f90b95 | ||
|
|
aae93d018b | ||
|
|
7a115a3970 | ||
|
|
64e5114947 | ||
|
|
4f8b5e649a | ||
|
|
e0d9989d74 | ||
|
|
0fe680ef4a | ||
|
|
e182c0a21b | ||
|
|
c8edd241d5 | ||
|
|
a544ccd1a7 | ||
|
|
7df2205b40 | ||
|
|
265e843d02 | ||
|
|
22a8a97389 | ||
|
|
bb74f2a423 | ||
|
|
2033168db2 | ||
|
|
e377f144fd | ||
|
|
234ebf8ce8 | ||
|
|
09cf3c9fa9 | ||
|
|
df32899581 | ||
|
|
33e8df11c5 | ||
|
|
75daf37bbd | ||
|
|
d0d2cfb22c | ||
|
|
f7b5ac0dc8 | ||
|
|
227dd923d6 | ||
|
|
f6cb9a8aed | ||
|
|
b615dc7e6e | ||
|
|
944560dd2b | ||
|
|
1d6d29e24d | ||
|
|
ff8e9e6b32 | ||
|
|
557555c4b3 | ||
|
|
f8e1037476 | ||
|
|
35cb54324f | ||
|
|
119497bb01 | ||
|
|
dfd6475a81 | ||
|
|
d6d5236a03 | ||
|
|
a327a26bd5 | ||
|
|
d5ebb7ca12 | ||
|
|
3e46c5674c | ||
|
|
c4b5565995 | ||
|
|
3f5eabeaa1 | ||
|
|
9b8e48e7b2 | ||
|
|
c3122fb82f | ||
|
|
1741597d52 | ||
|
|
9c5c74ba84 | ||
|
|
26ed7b80be | ||
|
|
55ac9a61ed | ||
|
|
7673264fe1 | ||
|
|
42dc43b036 | ||
|
|
ef22d951a0 | ||
|
|
e95dc834a3 | ||
|
|
b424988d1b | ||
|
|
22134b6cc0 | ||
|
|
f861c0761e | ||
|
|
1899d5ee17 | ||
|
|
17bd48ece3 | ||
|
|
c5c02d7f44 | ||
|
|
ba6159964b | ||
|
|
b834971f5e | ||
|
|
9dc15d536c | ||
|
|
2e45cb6ac9 | ||
|
|
2dcfeaa688 | ||
|
|
9d65d931d0 | ||
|
|
746aa41111 | ||
|
|
175dd17416 | ||
|
|
619936c12e | ||
|
|
732144df01 | ||
|
|
df3f04a951 | ||
|
|
0f78968579 | ||
|
|
66173c7a31 | ||
|
|
3f934d9aec | ||
|
|
df0cc131fe | ||
|
|
ba60f9da8a | ||
|
|
4569198b9d | ||
|
|
ccbbb59af7 | ||
|
|
3a5af25eaf | ||
|
|
1d18b7fa12 | ||
|
|
472490c239 | ||
|
|
b6340a30d2 | ||
|
|
bf1f0954b9 | ||
|
|
2f1cdcf379 | ||
|
|
443c2023d9 | ||
|
|
2c5062ba22 | ||
|
|
99df807095 | ||
|
|
8ab07d11b1 | ||
|
|
a1c0f6f7f0 | ||
|
|
672737a0d8 | ||
|
|
ade96bf6d3 | ||
|
|
801fc062ef | ||
|
|
f35840e7de | ||
|
|
79eda7abb0 | ||
|
|
e7c7324058 | ||
|
|
d8c1a81bcb | ||
|
|
94f96c11cb | ||
|
|
ec94dff7d7 | ||
|
|
ebd791a256 | ||
|
|
4db421d6c3 | ||
|
|
ab89ffe096 | ||
|
|
53fe5c35b9 | ||
|
|
f2f2c851df | ||
|
|
6dddc5e948 | ||
|
|
9688b1a26a | ||
|
|
81df52f6ca | ||
|
|
6e4f8f5191 | ||
|
|
22de3322ae | ||
|
|
e6fae4598c | ||
|
|
ba331dea4a | ||
|
|
1292a56d1b | ||
|
|
6a452ffed0 | ||
|
|
fc24570062 | ||
|
|
aa71abd725 | ||
|
|
fb64f5e456 | ||
|
|
61fe6ea219 | ||
|
|
d30c7254eb | ||
|
|
06be33ba5f | ||
|
|
b2cffa39e1 | ||
|
|
86ef2529b1 | ||
|
|
f1b9d1b870 | ||
|
|
fe67b5d72a | ||
|
|
27720afaf2 | ||
|
|
8bb585d97d | ||
|
|
8c523ce8b9 | ||
|
|
e48a28a5c8 | ||
|
|
d66a36cf21 | ||
|
|
a94e09f0aa | ||
|
|
4df10de6b7 | ||
|
|
6d07535dad | ||
|
|
ee354d2ded | ||
|
|
e64bd1fba8 | ||
|
|
031e673c51 | ||
|
|
801c9a2cda | ||
|
|
685b3ca5ee | ||
|
|
f1af7e2eeb | ||
|
|
85f9fda984 | ||
|
|
bb513b0187 | ||
|
|
4277f90bad | ||
|
|
ccda2bc2fd | ||
|
|
4b71530f4c | ||
|
|
a8a9db53be | ||
|
|
634cf07d44 | ||
|
|
0e0c006d5a | ||
|
|
486067a4b2 | ||
|
|
35e10ed469 | ||
|
|
00b980e74b | ||
|
|
efdc0e7c97 | ||
|
|
8b64d2066f | ||
|
|
8d87d9a875 | ||
|
|
8fc1848ecc | ||
|
|
bbc0a67153 | ||
|
|
e8ba2a7bd1 | ||
|
|
23f1c112a4 | ||
|
|
4d76e53554 | ||
|
|
73352e680e | ||
|
|
57aad8b454 | ||
|
|
ab5c44a2cb | ||
|
|
3e84eb9dbf | ||
|
|
afbe82e9f4 | ||
|
|
51b1aed483 | ||
|
|
32e93a04c5 | ||
|
|
3d7ece15f8 | ||
|
|
541597f355 | ||
|
|
5fe843d76b | ||
|
|
3191369ece | ||
|
|
a4de11d69c | ||
|
|
4832c7db4b | ||
|
|
be83d62f96 | ||
|
|
3fd2ef1da4 | ||
|
|
d861384889 | ||
|
|
cfd8e88e57 | ||
|
|
8169cb5a7e | ||
|
|
8c85cd7346 | ||
|
|
4e202833b2 | ||
|
|
4a163bd170 | ||
|
|
85fbc1b882 | ||
|
|
61810ff6f9 | ||
|
|
3a4a29f56d | ||
|
|
1fb7ece1b3 | ||
|
|
f3879dd3a4 | ||
|
|
561014886f | ||
|
|
a2b19547a3 | ||
|
|
93477091d1 | ||
|
|
64d3c62945 | ||
|
|
134e27f70a | ||
|
|
5205aa089b | ||
|
|
b5b9655c1e | ||
|
|
173d0894fa | ||
|
|
de6b050fb5 | ||
|
|
37da5e81c5 | ||
|
|
ae8637d455 | ||
|
|
22a45697fa | ||
|
|
55462fca9f | ||
|
|
2799a66c16 | ||
|
|
9832b17fc2 | ||
|
|
8146f42492 | ||
|
|
9df146af3b | ||
|
|
a7629f638f | ||
|
|
e75918f5ed | ||
|
|
9698c25bc4 | ||
|
|
bbe2bd48d8 | ||
|
|
0cc565ae80 | ||
|
|
aa74d96fed | ||
|
|
ac6ede6aef | ||
|
|
10e291bb39 | ||
|
|
7a25e333db | ||
|
|
a9b9d0badf | ||
|
|
a69e160f85 | ||
|
|
56d53a455d | ||
|
|
572afd360a | ||
|
|
ec6f946b97 | ||
|
|
acfd87e548 | ||
|
|
aa228732e3 | ||
|
|
840c222190 | ||
|
|
4408957770 | ||
|
|
89814cbc2e | ||
|
|
fdcefae264 | ||
|
|
0139919d14 | ||
|
|
9476bcc7b6 | ||
|
|
4625451c85 | ||
|
|
1e345f5010 | ||
|
|
31befcba44 | ||
|
|
f6077da614 | ||
|
|
499db7e3eb | ||
|
|
50da49a3ed | ||
|
|
6afd5c637e | ||
|
|
31a6aac9d3 | ||
|
|
3c3660914f | ||
|
|
cd0ae231dc | ||
|
|
a8bc741883 | ||
|
|
05b3525863 | ||
|
|
337f563bd4 | ||
|
|
c9fe09ebe3 | ||
|
|
db1c63a350 | ||
|
|
7cc2dcd1fc | ||
|
|
bcde392ce3 | ||
|
|
8d046f6280 | ||
|
|
9a6696699f | ||
|
|
56f2eec597 | ||
|
|
d29b33532d | ||
|
|
a16e82bf54 | ||
|
|
46c17cc441 | ||
|
|
2099092e16 | ||
|
|
88b7517337 | ||
|
|
619236329c | ||
|
|
76160a5ba6 | ||
|
|
e95f32231a | ||
|
|
be81307faa | ||
|
|
177e58da4e | ||
|
|
4c2efc08fd | ||
|
|
ae03922491 | ||
|
|
ab005118ba | ||
|
|
eec8635af4 | ||
|
|
5060997d2a | ||
|
|
0ac5a21a14 |
+252
@@ -0,0 +1,252 @@
|
||||
---
|
||||
Language: Cpp
|
||||
AccessModifierOffset: -4
|
||||
AlignAfterOpenBracket: DontAlign
|
||||
AlignArrayOfStructures: Left
|
||||
AlignConsecutiveAssignments:
|
||||
Enabled: true
|
||||
AcrossEmptyLines: false
|
||||
AcrossComments: false
|
||||
AlignCompound: false
|
||||
PadOperators: false
|
||||
AlignConsecutiveBitFields:
|
||||
Enabled: false
|
||||
AcrossEmptyLines: false
|
||||
AcrossComments: false
|
||||
AlignCompound: false
|
||||
PadOperators: false
|
||||
AlignConsecutiveDeclarations:
|
||||
Enabled: false
|
||||
AcrossEmptyLines: false
|
||||
AcrossComments: false
|
||||
AlignCompound: false
|
||||
AlignFunctionPointers: false
|
||||
PadOperators: false
|
||||
AlignConsecutiveMacros:
|
||||
Enabled: false
|
||||
AcrossEmptyLines: false
|
||||
AcrossComments: false
|
||||
AlignCompound: false
|
||||
PadOperators: false
|
||||
AlignEscapedNewlines: DontAlign
|
||||
AlignOperands: DontAlign
|
||||
AlignTrailingComments: true
|
||||
AllowAllArgumentsOnNextLine: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: true
|
||||
AllowShortBlocksOnASingleLine: Never
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortEnumsOnASingleLine: true
|
||||
AllowShortFunctionsOnASingleLine: None
|
||||
AllowShortIfStatementsOnASingleLine: Never
|
||||
AllowShortLambdasOnASingleLine: All
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AlwaysBreakAfterDefinitionReturnType: None
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: false
|
||||
AlwaysBreakTemplateDeclarations: Yes
|
||||
AttributeMacros:
|
||||
- __capability
|
||||
BinPackArguments: true
|
||||
BinPackParameters: true
|
||||
BitFieldColonSpacing: Both
|
||||
BraceWrapping:
|
||||
AfterCaseLabel: true
|
||||
AfterClass: true
|
||||
AfterControlStatement: Always
|
||||
AfterEnum: true
|
||||
AfterFunction: true
|
||||
AfterNamespace: true
|
||||
AfterObjCDeclaration: true
|
||||
AfterStruct: true
|
||||
AfterUnion: true
|
||||
AfterExternBlock: true
|
||||
BeforeCatch: true
|
||||
BeforeElse: true
|
||||
BeforeLambdaBody: true
|
||||
BeforeWhile: true
|
||||
IndentBraces: false
|
||||
SplitEmptyFunction: true
|
||||
SplitEmptyRecord: true
|
||||
SplitEmptyNamespace: true
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeConceptDeclarations: Always
|
||||
BreakBeforeBraces: Custom
|
||||
BreakBeforeInheritanceComma: false
|
||||
BreakInheritanceList: AfterComma
|
||||
BreakBeforeTernaryOperators: false
|
||||
BreakConstructorInitializersBeforeComma: false
|
||||
BreakConstructorInitializers: AfterColon
|
||||
BreakAfterJavaFieldAnnotations: false
|
||||
BreakStringLiterals: true
|
||||
ColumnLimit: 150
|
||||
CommentPragmas: '^ IWYU pragma:'
|
||||
QualifierAlignment: Left
|
||||
CompactNamespaces: false
|
||||
ConstructorInitializerIndentWidth: 4
|
||||
ContinuationIndentWidth: 4
|
||||
Cpp11BracedListStyle: false
|
||||
DeriveLineEnding: false
|
||||
DerivePointerAlignment: false
|
||||
DisableFormat: false
|
||||
EmptyLineAfterAccessModifier: Leave
|
||||
EmptyLineBeforeAccessModifier: Leave
|
||||
ExperimentalAutoDetectBinPacking: false
|
||||
PackConstructorInitializers: CurrentLine
|
||||
BasedOnStyle: ''
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
||||
AllowAllConstructorInitializersOnNextLine: true
|
||||
FixNamespaceComments: true
|
||||
ForEachMacros:
|
||||
- forever
|
||||
- foreach
|
||||
- Q_FOREACH
|
||||
- BOOST_FOREACH
|
||||
IfMacros:
|
||||
- KJ_IF_MAYBE
|
||||
IncludeBlocks: Preserve
|
||||
IncludeCategories:
|
||||
- Regex: '^<Q.*'
|
||||
Priority: 200
|
||||
SortPriority: 200
|
||||
CaseSensitive: true
|
||||
IncludeIsMainRegex: '(Test)?$'
|
||||
IncludeIsMainSourceRegex: ''
|
||||
IndentAccessModifiers: false
|
||||
IndentCaseLabels: false
|
||||
IndentCaseBlocks: false
|
||||
IndentGotoLabels: true
|
||||
IndentPPDirectives: None
|
||||
IndentExternBlock: Indent
|
||||
IndentRequiresClause: true
|
||||
IndentWidth: 4
|
||||
IndentWrappedFunctionNames: false
|
||||
InsertBraces: false
|
||||
InsertTrailingCommas: None
|
||||
JavaScriptQuotes: Leave
|
||||
JavaScriptWrapImports: true
|
||||
KeepEmptyLinesAtTheStartOfBlocks: true
|
||||
LambdaBodyIndentation: Signature
|
||||
MacroBlockBegin: ''
|
||||
MacroBlockEnd: ''
|
||||
MaxEmptyLinesToKeep: 3
|
||||
NamespaceIndentation: None
|
||||
ObjCBinPackProtocolList: Auto
|
||||
ObjCBlockIndentWidth: 4
|
||||
ObjCBreakBeforeNestedBlockParam: true
|
||||
ObjCSpaceAfterProperty: false
|
||||
ObjCSpaceBeforeProtocolList: true
|
||||
PenaltyBreakAssignment: 150
|
||||
PenaltyBreakBeforeFirstCallParameter: 300
|
||||
PenaltyBreakComment: 500
|
||||
PenaltyBreakFirstLessLess: 400
|
||||
PenaltyBreakOpenParenthesis: 0
|
||||
PenaltyBreakString: 600
|
||||
PenaltyBreakTemplateDeclaration: 10
|
||||
PenaltyExcessCharacter: 50
|
||||
PenaltyReturnTypeOnItsOwnLine: 300
|
||||
PenaltyIndentedWhitespace: 0
|
||||
PointerAlignment: Middle
|
||||
PPIndentWidth: 1
|
||||
ReferenceAlignment: Middle
|
||||
ReflowComments: false
|
||||
RemoveBracesLLVM: false
|
||||
RequiresClausePosition: OwnLine
|
||||
SeparateDefinitionBlocks: Leave
|
||||
ShortNamespaceLines: 1
|
||||
SortIncludes: CaseSensitive
|
||||
SortJavaStaticImport: Before
|
||||
SortUsingDeclarations: true
|
||||
SpaceAfterCStyleCast: false
|
||||
SpaceAfterLogicalNot: false
|
||||
SpaceAfterTemplateKeyword: false
|
||||
SpaceAroundPointerQualifiers: Default
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeCaseColon: false
|
||||
SpaceBeforeCpp11BracedList: true
|
||||
SpaceBeforeCtorInitializerColon: true
|
||||
SpaceBeforeInheritanceColon: true
|
||||
SpaceBeforeParens: Custom
|
||||
SpaceBeforeParensOptions:
|
||||
AfterControlStatements: false
|
||||
AfterForeachMacros: false
|
||||
AfterFunctionDefinitionName: false
|
||||
AfterFunctionDeclarationName: false
|
||||
AfterIfMacros: false
|
||||
AfterOverloadedOperator: false
|
||||
AfterRequiresInClause: false
|
||||
AfterRequiresInExpression: false
|
||||
BeforeNonEmptyParentheses: false
|
||||
SpaceBeforeRangeBasedForLoopColon: false
|
||||
SpaceBeforeSquareBrackets: false
|
||||
SpaceInEmptyBlock: false
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesBeforeTrailingComments: 1
|
||||
SpacesInAngles: Never
|
||||
SpacesInConditionalStatement: false
|
||||
SpacesInContainerLiterals: false
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInLineCommentPrefix:
|
||||
Minimum: 1
|
||||
Maximum: -1
|
||||
SpacesInParens: Custom
|
||||
SpacesInParensOptions:
|
||||
ExceptDoubleParentheses: false
|
||||
InConditionalStatements: true
|
||||
InCStyleCasts: false
|
||||
InEmptyParentheses: false
|
||||
Other: false
|
||||
SpacesInParentheses: true
|
||||
SpacesInSquareBrackets: false
|
||||
Standard: c++20
|
||||
StatementAttributeLikeMacros:
|
||||
- Q_EMIT
|
||||
StatementMacros:
|
||||
- Q_UNUSED
|
||||
- QT_REQUIRE_VERSION
|
||||
- Q_CLASSINFO
|
||||
- Q_ENUM
|
||||
- Q_ENUM_NS
|
||||
- Q_FLAG
|
||||
- Q_FLAG_NS
|
||||
- Q_GADGET
|
||||
- Q_GADGET_EXPORT
|
||||
- Q_INTERFACES
|
||||
- Q_MOC_INCLUDE
|
||||
- Q_NAMESPACE
|
||||
- Q_NAMESPACE_EXPORT
|
||||
- Q_OBJECT
|
||||
- Q_PROPERTY
|
||||
- Q_REVISION
|
||||
- Q_DISABLE_COPY
|
||||
- Q_SET_OBJECT_NAME
|
||||
- QT_BEGIN_NAMESPACE
|
||||
- QT_END_NAMESPACE
|
||||
- QML_ADDED_IN_MINOR_VERSION
|
||||
- QML_ANONYMOUS
|
||||
- QML_ATTACHED
|
||||
- QML_DECLARE_TYPE
|
||||
- QML_DECLARE_TYPEINFO
|
||||
- QML_ELEMENT
|
||||
- QML_EXTENDED
|
||||
- QML_EXTENDED_NAMESPACE
|
||||
- QML_EXTRA_VERSION
|
||||
- QML_FOREIGN
|
||||
- QML_FOREIGN_NAMESPACE
|
||||
- QML_IMPLEMENTS_INTERFACES
|
||||
- QML_INTERFACE
|
||||
- QML_NAMED_ELEMENT
|
||||
- QML_REMOVED_IN_MINOR_VERSION
|
||||
- QML_SINGLETON
|
||||
- QML_UNAVAILABLE
|
||||
- QML_UNCREATABLE
|
||||
- QML_VALUE_TYPE
|
||||
TabWidth: 4
|
||||
UseCRLF: false
|
||||
UseTab: Always
|
||||
WhitespaceSensitiveMacros:
|
||||
- STRINGIZE
|
||||
- PP_STRINGIZE
|
||||
- BOOST_PP_STRINGIZE
|
||||
- NS_SWIFT_NAME
|
||||
- CF_SWIFT_NAME
|
||||
...
|
||||
@@ -0,0 +1,21 @@
|
||||
# EditorConfig
|
||||
# https://editorconfig.org/
|
||||
# https://editorconfig-specification.readthedocs.io/
|
||||
|
||||
# top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
# Unix-style newlines with a newline ending every file
|
||||
[*]
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
|
||||
# 4 space indentation
|
||||
[*.{h,cpp,html,css,js,conf,txt}]
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
|
||||
# Tab indentation (no size specified)
|
||||
[Makefile]
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
.cproject
|
||||
.project
|
||||
.settings/
|
||||
*.o
|
||||
*.so
|
||||
/winixd/winix
|
||||
/winixcli/src/winix
|
||||
/winixcli/m
|
||||
/.clangd
|
||||
/.qtcreator/
|
||||
/.qtc_clangd/
|
||||
@@ -0,0 +1,2 @@
|
||||
CompileFlags:
|
||||
Add: [-pthread, -std=c++23, -I%%%CURRENT_DIR%%%/winixd, -I%%%GLOBAL_WORKING_DIR%%%/pikotools/src, -I%%%GLOBAL_WORKING_DIR%%%/ezc/src, -I%%%GLOBAL_WORKING_DIR%%%/morm/src, -I%%%GLOBAL_WORKING_DIR%%%/tito/src, -I/usr/include, -I/usr/local/include, -I/usr/local/include/postgresql, -DPT_HAS_MORM_LIBRARY, -DEZC_HAS_MORM_LIBRARY, -DMORM_HAS_EZC_LIBRARY]
|
||||
@@ -0,0 +1 @@
|
||||
-std=c23
|
||||
@@ -0,0 +1,4 @@
|
||||
#define PT_HAS_MORM_LIBRARY 1
|
||||
#define EZC_HAS_MORM_LIBRARY 1
|
||||
#define MORM_HAS_EZC_LIBRARY 1
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
[General]
|
||||
@@ -0,0 +1,184 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 14.0.1, 2024-09-20T16:21:10. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
<value type="QByteArray">%%%QT_ENVIRONMENT_ID%%%</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||
<value type="qlonglong">0</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.EditorSettings</variable>
|
||||
<valuemap type="QVariantMap">
|
||||
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
|
||||
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
|
||||
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
|
||||
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
|
||||
<value type="QString" key="language">Cpp</value>
|
||||
<valuemap type="QVariantMap" key="value">
|
||||
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
|
||||
</valuemap>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
|
||||
<value type="QString" key="language">QmlJS</value>
|
||||
<valuemap type="QVariantMap" key="value">
|
||||
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
|
||||
</valuemap>
|
||||
</valuemap>
|
||||
<value type="qlonglong" key="EditorConfiguration.CodeStyle.Count">2</value>
|
||||
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
|
||||
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
|
||||
<value type="int" key="EditorConfiguration.IndentSize">4</value>
|
||||
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
|
||||
<value type="int" key="EditorConfiguration.MarginColumn">80</value>
|
||||
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
|
||||
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
|
||||
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
|
||||
<value type="int" key="EditorConfiguration.PreferAfterWhitespaceComments">0</value>
|
||||
<value type="bool" key="EditorConfiguration.PreferSingleLineComments">false</value>
|
||||
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
|
||||
<value type="bool" key="EditorConfiguration.ShowMargin">false</value>
|
||||
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
|
||||
<value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value>
|
||||
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
|
||||
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
|
||||
<value type="int" key="EditorConfiguration.TabSize">8</value>
|
||||
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
|
||||
<value type="bool" key="EditorConfiguration.UseIndenter">false</value>
|
||||
<value type="int" key="EditorConfiguration.Utf8BomBehavior">2</value>
|
||||
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
|
||||
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
|
||||
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
|
||||
<value type="QString" key="EditorConfiguration.ignoreFileTypes">*.md, *.MD, Makefile</value>
|
||||
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
|
||||
<value type="bool" key="EditorConfiguration.skipTrailingWhitespace">true</value>
|
||||
<value type="bool" key="EditorConfiguration.tintMarginArea">true</value>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.PluginSettings</variable>
|
||||
<valuemap type="QVariantMap">
|
||||
<valuemap type="QVariantMap" key="AutoTest.ActiveFrameworks">
|
||||
<value type="bool" key="AutoTest.Framework.Boost">true</value>
|
||||
<value type="bool" key="AutoTest.Framework.CTest">false</value>
|
||||
<value type="bool" key="AutoTest.Framework.Catch">true</value>
|
||||
<value type="bool" key="AutoTest.Framework.GTest">true</value>
|
||||
<value type="bool" key="AutoTest.Framework.QtQuickTest">true</value>
|
||||
<value type="bool" key="AutoTest.Framework.QtTest">true</value>
|
||||
</valuemap>
|
||||
<value type="bool" key="AutoTest.ApplyFilter">false</value>
|
||||
<valuemap type="QVariantMap" key="AutoTest.CheckStates"/>
|
||||
<valuelist type="QVariantList" key="AutoTest.PathFilters"/>
|
||||
<value type="int" key="AutoTest.RunAfterBuild">0</value>
|
||||
<value type="bool" key="AutoTest.UseGlobal">true</value>
|
||||
<valuemap type="QVariantMap" key="ClangTools">
|
||||
<value type="bool" key="ClangTools.AnalyzeOpenFiles">true</value>
|
||||
<value type="bool" key="ClangTools.BuildBeforeAnalysis">true</value>
|
||||
<value type="QString" key="ClangTools.DiagnosticConfig">Builtin.DefaultTidyAndClazy</value>
|
||||
<value type="int" key="ClangTools.ParallelJobs">3</value>
|
||||
<value type="bool" key="ClangTools.PreferConfigFile">true</value>
|
||||
<valuelist type="QVariantList" key="ClangTools.SelectedDirs"/>
|
||||
<valuelist type="QVariantList" key="ClangTools.SelectedFiles"/>
|
||||
<valuelist type="QVariantList" key="ClangTools.SuppressedDiagnostics"/>
|
||||
<value type="bool" key="ClangTools.UseGlobalSettings">true</value>
|
||||
</valuemap>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.Target.0</variable>
|
||||
<valuemap type="QVariantMap">
|
||||
<value type="QString" key="DeviceType">Desktop</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">%%%QT_DEFAULT_PROFILE_ID%%%</value>
|
||||
<value type="qlonglong" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
|
||||
<value type="qlonglong" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
||||
<value type="qlonglong" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">%%%CURRENT_DIR%%%</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<valuelist type="QVariantList" key="GenericProjectManager.GenericMakeStep.BuildTargets">
|
||||
<value type="QString">all</value>
|
||||
</valuelist>
|
||||
<value type="QString" key="GenericProjectManager.GenericMakeStep.MakeCommand">/usr/local/bin/gmake</value>
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">GenericProjectManager.GenericMakeStep</value>
|
||||
</valuemap>
|
||||
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<valuelist type="QVariantList" key="GenericProjectManager.GenericMakeStep.BuildTargets">
|
||||
<value type="QString">clean</value>
|
||||
</valuelist>
|
||||
<value type="QString" key="GenericProjectManager.GenericMakeStep.MakeCommand">/usr/local/bin/gmake</value>
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">GenericProjectManager.GenericMakeStep</value>
|
||||
</valuemap>
|
||||
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
|
||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
|
||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Default</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">GenericProjectManager.GenericBuildConfiguration</value>
|
||||
</valuemap>
|
||||
<value type="qlonglong" key="ProjectExplorer.Target.BuildConfigurationCount">1</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Deploy</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.DeployConfiguration.CustomData"/>
|
||||
<value type="bool" key="ProjectExplorer.DeployConfiguration.CustomDataEnabled">false</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
|
||||
</valuemap>
|
||||
<value type="qlonglong" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
|
||||
<value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value>
|
||||
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
|
||||
<value type="int" key="Analyzer.Valgrind.Callgrind.CostFormat">0</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
|
||||
<valuelist type="QVariantList" key="CustomOutputParsers"/>
|
||||
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
|
||||
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
||||
<value type="bool" key="PE.EnvironmentAspect.PrintOnRun">false</value>
|
||||
<value type="QString" key="PerfRecordArgsId">-e cpu-cycles --call-graph dwarf,4096 -F 250</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
|
||||
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey"></value>
|
||||
<value type="bool" key="ProjectExplorer.RunConfiguration.Customized">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
||||
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
|
||||
</valuemap>
|
||||
<value type="qlonglong" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.TargetCount</variable>
|
||||
<value type="qlonglong">1</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
|
||||
<value type="int">22</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>Version</variable>
|
||||
<value type="int">22</value>
|
||||
</data>
|
||||
</qtcreator>
|
||||
@@ -0,0 +1 @@
|
||||
-std=c++23
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
Executable
+38
@@ -0,0 +1,38 @@
|
||||
#!/bin/sh
|
||||
|
||||
CURRENT_DIR=$(pwd)
|
||||
GLOBAL_WORKING_DIR=$(realpath ${CURRENT_DIR}/..)
|
||||
|
||||
# ----------
|
||||
|
||||
has_force_arg=0
|
||||
|
||||
if [ $# -eq 1 ] ; then
|
||||
if [ $1 == 'force' ] ; then
|
||||
has_force_arg=1
|
||||
fi
|
||||
fi
|
||||
|
||||
# make sure the current directory is correct
|
||||
if [ ! -d ${CURRENT_DIR}/.templates ] ; then
|
||||
echo "this script should be called by make: make clangd (one level up)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# change / to \/ in paths
|
||||
CURRENT_DIR_FOR_SED=$(echo ${CURRENT_DIR} | sed 's/\//\\\//g')
|
||||
GLOBAL_WORKING_DIR_FOR_SED=$(echo ${GLOBAL_WORKING_DIR} | sed 's/\//\\\//g')
|
||||
|
||||
|
||||
if [ -f "${CURRENT_DIR}/.templates/.clangd" ] ; then
|
||||
if [ $has_force_arg -eq 1 -o ! -f "${CURRENT_DIR}/.clangd" ] ; then
|
||||
cat "${CURRENT_DIR}/.templates/.clangd" | \
|
||||
sed -e "s/%%%CURRENT_DIR%%%/${CURRENT_DIR_FOR_SED}/g" \
|
||||
-e "s/%%%GLOBAL_WORKING_DIR%%%/${GLOBAL_WORKING_DIR_FOR_SED}/g" > \
|
||||
${CURRENT_DIR}/.clangd
|
||||
|
||||
echo "added a ${CURRENT_DIR}/.clangd file"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
Executable
+117
@@ -0,0 +1,117 @@
|
||||
#!/bin/sh
|
||||
|
||||
CURRENT_DIR=$(pwd)
|
||||
GLOBAL_WORKING_DIR=$(realpath ${CURRENT_DIR}/..)
|
||||
QTCREATOR_DIR=${CURRENT_DIR}/.qtcreator
|
||||
|
||||
# ----------
|
||||
|
||||
has_force_arg=0
|
||||
|
||||
if [ $# -eq 1 ] ; then
|
||||
if [ $1 == 'force' ] ; then
|
||||
has_force_arg=1
|
||||
fi
|
||||
fi
|
||||
|
||||
# make sure the current directory is correct
|
||||
if [ ! -d ${CURRENT_DIR}/.templates ] ; then
|
||||
echo "this script should be called by make: make qtcreator (one level up)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
qtcreatorini=~/.config/QtProject/QtCreator.ini
|
||||
qtprofiles=~/.config/QtProject/qtcreator/profiles.xml
|
||||
|
||||
if [ ! -f "$qtcreatorini" ] ; then
|
||||
echo "I cannot find a $qtcreatorini file"
|
||||
echo "this file is needed to take an EnvironmentId parameter"
|
||||
echo "if QTCreator was recently installed make sure you have opened it at least once"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
if [ ! -f "$qtprofiles" ] ; then
|
||||
echo "I cannot find a $qtprofiles file"
|
||||
echo "this file is needed to take a default profile id parameter"
|
||||
echo "if QTCreator was recently installed make sure you have opened it at least once"
|
||||
exit 3
|
||||
fi
|
||||
|
||||
qtenvironmentid=`grep -F 'Settings\EnvironmentId' "$qtcreatorini" | grep -Eo '\{[a-zA-Z0-9-]+\}'`
|
||||
qtdefaultprofileid=`grep -A 1 -F '<variable>Profile.Default</variable>' "$qtprofiles" | tail -n 1 | grep -Eo '\{[a-zA-Z0-9-]+\}'`
|
||||
|
||||
if [ -z "$qtenvironmentid" ] ; then
|
||||
echo "I cannot read a Settings\EnvironmentId parameter from $qtcreatorini file"
|
||||
exit 4
|
||||
fi
|
||||
|
||||
if [ -z "$qtdefaultprofileid" ] ; then
|
||||
echo "I cannot read a Profile.Default parameter from $qtprofiles file"
|
||||
exit 5
|
||||
fi
|
||||
|
||||
# change / to \/ in paths
|
||||
CURRENT_DIR_FOR_SED=$(echo ${CURRENT_DIR} | sed 's/\//\\\//g')
|
||||
GLOBAL_WORKING_DIR_FOR_SED=$(echo ${GLOBAL_WORKING_DIR} | sed 's/\//\\\//g')
|
||||
|
||||
was_qtcreator_dir=0
|
||||
|
||||
if [ $has_force_arg -eq 1 ] ; then
|
||||
rm -rf "${QTCREATOR_DIR}"
|
||||
fi
|
||||
|
||||
if [ -d "${QTCREATOR_DIR}" ] ; then
|
||||
was_qtcreator_dir=1
|
||||
else
|
||||
echo "Your QTCreator EnvironmentId is: $qtenvironmentid"
|
||||
echo "Your QTCreator default profile id is: $qtdefaultprofileid"
|
||||
mkdir -p "${QTCREATOR_DIR}"
|
||||
fi
|
||||
|
||||
if [ -d "${QTCREATOR_DIR}" ] ; then
|
||||
|
||||
if [ -d ${CURRENT_DIR}/.templates/.qtcreator ] ; then
|
||||
cd ${CURRENT_DIR}/.templates/.qtcreator
|
||||
|
||||
if [ $? -eq 0 ] ; then
|
||||
|
||||
for i in * ; do
|
||||
if [ ! -f "${QTCREATOR_DIR}/$i" ] ; then
|
||||
cat "$i" | \
|
||||
sed -e "s/%%%CURRENT_DIR%%%/${CURRENT_DIR_FOR_SED}/g" \
|
||||
-e "s/%%%GLOBAL_WORKING_DIR%%%/${GLOBAL_WORKING_DIR_FOR_SED}/g" \
|
||||
-e "s/%%%QT_ENVIRONMENT_ID%%%/${qtenvironmentid}/g" \
|
||||
-e "s/%%%QT_DEFAULT_PROFILE_ID%%%/${qtdefaultprofileid}/g" > \
|
||||
"${QTCREATOR_DIR}/$i"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $was_qtcreator_dir -eq 0 ] ; then
|
||||
echo "QTCreator files generated to ${QTCREATOR_DIR} directory"
|
||||
echo "In QTCreator select an 'open project...' option and find a ${QTCREATOR_DIR}/*.creator file"
|
||||
fi
|
||||
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
find ${QTCREATOR_DIR} -name "*.files" | while read projectfiles ; do
|
||||
|
||||
cd ${CURRENT_DIR}/winixd
|
||||
|
||||
if [ $? -eq 0 ] ; then
|
||||
find ../winixd -type f \( -iname "*.cpp" -o -iname "*.h" \) | sort > ${projectfiles}
|
||||
echo "file ${projectfiles} has been updated"
|
||||
fi
|
||||
|
||||
cd ${CURRENT_DIR}/winixcli
|
||||
|
||||
if [ $? -eq 0 ] ; then
|
||||
find ../winixcli -type f \( -iname "*.cpp" -o -iname "*.h" \) | sort >> ${projectfiles}
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
fi
|
||||
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
Copyright (c) 2012-2026, Tomasz Sowa
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -0,0 +1,84 @@
|
||||
|
||||
|
||||
export CXX
|
||||
export CXXFLAGS
|
||||
export LDFLAGS
|
||||
|
||||
|
||||
all: winixd winixcli
|
||||
|
||||
|
||||
winixd: FORCE
|
||||
$(MAKE) -C winixd
|
||||
|
||||
|
||||
winixcli: FORCE
|
||||
$(MAKE) -C winixcli
|
||||
|
||||
|
||||
clean: FORCE
|
||||
$(MAKE) -C winixd clean
|
||||
$(MAKE) -C winixcli clean
|
||||
|
||||
|
||||
cleanall: FORCE
|
||||
$(MAKE) -C winixd cleanall
|
||||
$(MAKE) -C winixcli clean
|
||||
|
||||
|
||||
depend: FORCE
|
||||
$(MAKE) -C winixd depend
|
||||
$(MAKE) -C winixcli depend
|
||||
|
||||
|
||||
install: FORCE
|
||||
$(MAKE) -C winixd install
|
||||
#$(MAKE) -C winixcli depend
|
||||
|
||||
|
||||
clangd: FORCE
|
||||
@.templates/install_clangd.sh
|
||||
|
||||
|
||||
forceclangd: FORCE
|
||||
@.templates/install_clangd.sh force
|
||||
|
||||
|
||||
clangdall: clangd
|
||||
@$(MAKE) -C ../pikotools clangd
|
||||
@$(MAKE) -C ../morm clangd
|
||||
@$(MAKE) -C ../ezc clangd
|
||||
@$(MAKE) -C ../tito clangd
|
||||
|
||||
|
||||
forceclangdall: forceclangd
|
||||
@$(MAKE) -C ../pikotools forceclangd
|
||||
@$(MAKE) -C ../morm forceclangd
|
||||
@$(MAKE) -C ../ezc forceclangd
|
||||
@$(MAKE) -C ../tito forceclangd
|
||||
|
||||
|
||||
qtcreator: clangd
|
||||
@.templates/install_qtcreator.sh
|
||||
|
||||
|
||||
forceqtcreator: forceclangd
|
||||
@.templates/install_qtcreator.sh force
|
||||
|
||||
|
||||
qtcreatorall: qtcreator
|
||||
@$(MAKE) -C ../pikotools qtcreator
|
||||
@$(MAKE) -C ../morm qtcreator
|
||||
@$(MAKE) -C ../ezc qtcreator
|
||||
@$(MAKE) -C ../tito qtcreator
|
||||
|
||||
|
||||
forceqtcreatorall: forceqtcreator
|
||||
@$(MAKE) -C ../pikotools forceqtcreator
|
||||
@$(MAKE) -C ../morm forceqtcreator
|
||||
@$(MAKE) -C ../ezc forceqtcreator
|
||||
@$(MAKE) -C ../tito forceqtcreator
|
||||
|
||||
|
||||
FORCE:
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
|
||||
|
||||
export CXX
|
||||
export CXXFLAGS
|
||||
export LDFLAGS
|
||||
|
||||
|
||||
all: src
|
||||
|
||||
|
||||
src: FORCE
|
||||
$(MAKE) -C src
|
||||
|
||||
|
||||
clean: FORCE
|
||||
$(MAKE) -C src clean
|
||||
|
||||
|
||||
depend: FORCE
|
||||
$(MAKE) -C src depend
|
||||
|
||||
|
||||
|
||||
FORCE:
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
sourcefiles:=$(shell find . -name "*.cpp")
|
||||
objfiles:=$(patsubst %.cpp,%.o,$(sourcefiles))
|
||||
GLOBAL_WORKING_DIR := $(shell pwd)/../../..
|
||||
|
||||
|
||||
WINIX_NEEDED_MACROS = -DPT_HAS_MORM_LIBRARY \
|
||||
-DEZC_HAS_MORM_LIBRARY \
|
||||
-DMORM_HAS_EZC_LIBRARY
|
||||
|
||||
|
||||
ifndef CXX
|
||||
CXX = g++
|
||||
endif
|
||||
|
||||
ifndef ADDITIONAL_CXXFLAGS
|
||||
ADDITIONAL_CXXFLAGS=-O2
|
||||
endif
|
||||
|
||||
ifndef ADDITIONAL_LDFLAGS
|
||||
ADDITIONAL_LDFLAGS=-s
|
||||
endif
|
||||
|
||||
ifndef CXXFLAGS
|
||||
# /usr/include/postgresql is in Linux distros (Alpine)
|
||||
CXXFLAGS = -Wall -pedantic -std=c++20 $(ADDITIONAL_CXXFLAGS) \
|
||||
-I/usr/local/include \
|
||||
-I/usr/include/postgresql \
|
||||
-I$(GLOBAL_WORKING_DIR)/winix/winixcli \
|
||||
-I$(GLOBAL_WORKING_DIR)/pikotools/src \
|
||||
-I$(GLOBAL_WORKING_DIR)/morm/src \
|
||||
-I$(GLOBAL_WORKING_DIR)/ezc/src \
|
||||
-I$(GLOBAL_WORKING_DIR)/tito/src \
|
||||
$(WINIX_NEEDED_MACROS)
|
||||
endif
|
||||
|
||||
LDFLAGS = -L/usr/local/lib $(ADDITIONAL_LDFLAGS)
|
||||
|
||||
|
||||
export CXX
|
||||
export CXXFLAGS
|
||||
export LDFLAGS
|
||||
export GLOBAL_WORKING_DIR
|
||||
export WINIX_NEEDED_MACROS
|
||||
|
||||
|
||||
|
||||
progname = winix
|
||||
|
||||
|
||||
all: $(progname)
|
||||
|
||||
|
||||
$(progname): $(objfiles) pikotools morm ezc
|
||||
$(CXX) -o $(progname) $(CXXFLAGS) $(LDFLAGS) $(objfiles) $(GLOBAL_WORKING_DIR)/ezc/src/ezc.a $(GLOBAL_WORKING_DIR)/morm/src/morm.a $(GLOBAL_WORKING_DIR)/pikotools/src/pikotools.a
|
||||
|
||||
|
||||
%.o: %.cpp
|
||||
$(CXX) -c $(CXXFLAGS) -o $@ $<
|
||||
|
||||
|
||||
.PHONY: pikotools
|
||||
.PHONY: morm
|
||||
.PHONY: ezc
|
||||
|
||||
|
||||
pikotools:
|
||||
$(MAKE) -C ../../../pikotools
|
||||
|
||||
|
||||
morm:
|
||||
$(MAKE) -C ../../../morm/src
|
||||
|
||||
|
||||
ezc:
|
||||
$(MAKE) -C ../../../ezc/src
|
||||
|
||||
|
||||
clean: FORCE
|
||||
rm -f $(objfiles)
|
||||
rm -f $(progname)
|
||||
|
||||
|
||||
depend:
|
||||
makedepend -w 10 -Y. -I../../../pikotools/src -I../../../morm/src -I../../../ezc/src -I../../../tito/src $(WINIX_NEEDED_MACROS) -f- $(sourcefiles) | sort -u > Makefile.dep
|
||||
|
||||
|
||||
FORCE:
|
||||
|
||||
|
||||
-include Makefile.dep
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
|
||||
./main.o: ../../../ezc/src/blocks.h
|
||||
./main.o: ../../../ezc/src/cache.h
|
||||
./main.o: ../../../ezc/src/expressionparser.h
|
||||
./main.o: ../../../ezc/src/ezc.h
|
||||
./main.o: ../../../ezc/src/functions.h
|
||||
./main.o: ../../../ezc/src/funinfo.h
|
||||
./main.o: ../../../ezc/src/generator.h
|
||||
./main.o: ../../../ezc/src/item.h
|
||||
./main.o: ../../../ezc/src/models.h
|
||||
./main.o: ../../../ezc/src/objects.h
|
||||
./main.o: ../../../ezc/src/outstreams.h
|
||||
./main.o: ../../../ezc/src/pattern.h
|
||||
./main.o: ../../../ezc/src/patternparser.h
|
||||
./main.o: ../../../ezc/src/version.h
|
||||
./main.o: ../../../morm/src/baseexpression.h
|
||||
./main.o: ../../../morm/src/baseobjectwrapper.h
|
||||
./main.o: ../../../morm/src/clearer.h
|
||||
./main.o: ../../../morm/src/cursorhelper.h
|
||||
./main.o: ../../../morm/src/dbconnector.h
|
||||
./main.o: ../../../morm/src/dbexpression.h
|
||||
./main.o: ../../../morm/src/export.h
|
||||
./main.o: ../../../morm/src/fieldvaluehelper.h
|
||||
./main.o: ../../../morm/src/finderhelper.h
|
||||
./main.o: ../../../morm/src/flatconnector.h
|
||||
./main.o: ../../../morm/src/flatexpression.h
|
||||
./main.o: ../../../morm/src/ft.h
|
||||
./main.o: ../../../morm/src/model.h
|
||||
./main.o: ../../../morm/src/modelconnector.h
|
||||
./main.o: ../../../morm/src/modelcontainerwrapper.h
|
||||
./main.o: ../../../morm/src/modeldata.h
|
||||
./main.o: ../../../morm/src/modelenv.h
|
||||
./main.o: ../../../morm/src/morm_types.h
|
||||
./main.o: ../../../morm/src/queryresult.h
|
||||
./main.o: ../../../morm/src/select.h
|
||||
./main.o: ../../../morm/src/spacewrapper.h
|
||||
./main.o: ../../../morm/src/wrapper.h
|
||||
./main.o: ../../../pikotools/src/convert/inttostr.h
|
||||
./main.o: ../../../pikotools/src/convert/misc.h
|
||||
./main.o: ../../../pikotools/src/convert/strtoint.h
|
||||
./main.o: ../../../pikotools/src/convert/text.h
|
||||
./main.o: ../../../pikotools/src/date/date.h
|
||||
./main.o: ../../../pikotools/src/log/filelog.h
|
||||
./main.o: ../../../pikotools/src/log/log.h
|
||||
./main.o: ../../../pikotools/src/mainoptions/mainoptionsparser.h
|
||||
./main.o: ../../../pikotools/src/membuffer/membuffer.h
|
||||
./main.o: ../../../pikotools/src/space/space.h
|
||||
./main.o: ../../../pikotools/src/textstream/stream_private.h
|
||||
./main.o: ../../../pikotools/src/textstream/stream.h
|
||||
./main.o: ../../../pikotools/src/textstream/textstream.h
|
||||
./main.o: ../../../pikotools/src/textstream/types.h
|
||||
./main.o: ../../../pikotools/src/utf8/utf8.h
|
||||
./main.o: misc.h
|
||||
./main.o: pgmodeler.h
|
||||
./misc.o: ../../../pikotools/src/convert/inttostr.h
|
||||
./misc.o: ../../../pikotools/src/convert/misc.h
|
||||
./misc.o: ../../../pikotools/src/space/space.h
|
||||
./misc.o: ../../../pikotools/src/textstream/stream.h
|
||||
./misc.o: ../../../pikotools/src/utf8/utf8.h
|
||||
./misc.o: misc.h
|
||||
./pgmodeler.o: ../../../pikotools/src/convert/baseparser.h
|
||||
./pgmodeler.o: ../../../pikotools/src/convert/inttostr.h
|
||||
./pgmodeler.o: ../../../pikotools/src/convert/misc.h
|
||||
./pgmodeler.o: ../../../pikotools/src/date/date.h
|
||||
./pgmodeler.o: ../../../pikotools/src/html/htmlparser.h
|
||||
./pgmodeler.o: ../../../pikotools/src/membuffer/membuffer.h
|
||||
./pgmodeler.o: ../../../pikotools/src/space/space.h
|
||||
./pgmodeler.o: ../../../pikotools/src/textstream/stream_private.h
|
||||
./pgmodeler.o: ../../../pikotools/src/textstream/stream.h
|
||||
./pgmodeler.o: ../../../pikotools/src/textstream/textstream.h
|
||||
./pgmodeler.o: ../../../pikotools/src/textstream/types.h
|
||||
./pgmodeler.o: ../../../pikotools/src/utf8/utf8.h
|
||||
./pgmodeler.o: misc.h
|
||||
./pgmodeler.o: pgmodeler.h
|
||||
# DO NOT DELETE
|
||||
@@ -0,0 +1,295 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is distributed under the 2-Clause BSD licence.
|
||||
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2022-2023, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include "convert/strtoint.h"
|
||||
#include "mainoptions/mainoptionsparser.h"
|
||||
#include "pgmodeler.h"
|
||||
#include "misc.h"
|
||||
#include "ezc.h"
|
||||
|
||||
|
||||
namespace Winix
|
||||
{
|
||||
|
||||
|
||||
// make a static method in MainOptionsParser?
|
||||
std::wstring get_param(const pt::Space::TableType * input_mode)
|
||||
{
|
||||
if( input_mode && input_mode->size() > 0 )
|
||||
{
|
||||
pt::Space * first_par = (*input_mode)[0];
|
||||
|
||||
if( first_par->is_table() && first_par->table_size() > 0 )
|
||||
{
|
||||
return first_par->value.value_table.front()->to_wstr();
|
||||
}
|
||||
}
|
||||
|
||||
return std::wstring();
|
||||
}
|
||||
|
||||
|
||||
bool use_pgmodeler(const std::wstring & input_file, const pt::Space & input_options, pt::Space & schema, bool sort_tables)
|
||||
{
|
||||
PGModeler pgmodeler;
|
||||
return pgmodeler.parse(input_file, schema, sort_tables);
|
||||
}
|
||||
|
||||
|
||||
|
||||
typedef pt::WTextStream MyStream;
|
||||
|
||||
|
||||
|
||||
|
||||
// move me to a better place
|
||||
void esc_tex(wchar_t c, pt::WTextStream & str)
|
||||
{
|
||||
if( c == '$' )
|
||||
str << L"\\$";
|
||||
else
|
||||
if( c == '#' )
|
||||
str << L"\\#";
|
||||
else
|
||||
if( c == '%' )
|
||||
str << L"\\%";
|
||||
else
|
||||
if( c == '&' )
|
||||
str << L"\\&";
|
||||
else
|
||||
if( c == '\\' )
|
||||
str << L"$\\backslash$";
|
||||
else
|
||||
if( c == '{' )
|
||||
str << L"$\\{$";
|
||||
else
|
||||
if( c == '}' )
|
||||
str << L"$\\}$";
|
||||
else
|
||||
if( c == '^' )
|
||||
str << L""; // !! IMPROVE ME add \char with specific code
|
||||
else
|
||||
if( c == '_' )
|
||||
str << L"\\_";
|
||||
else
|
||||
if( c == '~' )
|
||||
str << L""; // !! IMPROVE ME add \char with specific code
|
||||
else
|
||||
if( c == '-' )
|
||||
str << L"{-}";
|
||||
else
|
||||
if( c != 0 )
|
||||
str << c;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void fil_tex(Ezc::FunInfo<MyStream> & env)
|
||||
{
|
||||
auto i = env.in.begin();
|
||||
|
||||
for( ; i != env.in.end() ; ++i)
|
||||
{
|
||||
esc_tex(*i, env.out);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void fil_max_size(Ezc::FunInfo<MyStream> & env)
|
||||
{
|
||||
auto i = env.in.begin();
|
||||
size_t max_len = pt::to_ul(env.par);
|
||||
size_t len = 0;
|
||||
|
||||
for( ; i != env.in.end() ; ++i)
|
||||
{
|
||||
if( len >= max_len )
|
||||
{
|
||||
env.out << ' ';
|
||||
len = 0;
|
||||
}
|
||||
|
||||
if( pt::is_white(*i) )
|
||||
{
|
||||
len = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
len += 1;
|
||||
}
|
||||
|
||||
env.out << *i;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void cmp(Ezc::FunInfo<MyStream> & env)
|
||||
{
|
||||
if( env.params.size() >= 2 )
|
||||
{
|
||||
env.res = true;
|
||||
|
||||
for(size_t a=0 ; a < env.params.size() - 1 ; ++a)
|
||||
{
|
||||
if( env.params[a].str != env.params[a+1].str )
|
||||
{
|
||||
env.res = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool generate(const pt::Space & input_options, pt::Space & schema)
|
||||
{
|
||||
pt::WTextStream log_buffer;
|
||||
pt::FileLog file_log;
|
||||
pt::Log log;
|
||||
|
||||
file_log.init(L"log.txt", true, 4, true);
|
||||
log.set_file_log(&file_log);
|
||||
log.set_log_buffer(&log_buffer);
|
||||
|
||||
Ezc::Pattern pattern;
|
||||
Ezc::PatternParser parser;
|
||||
Ezc::Functions<MyStream> functions;
|
||||
Ezc::Blocks blocks;
|
||||
Ezc::Models models;
|
||||
|
||||
std::wstring dir = get_param(input_options.get_table(L"templates-dir"));
|
||||
std::wstring template_file = get_param(input_options.get_table(L"template"));
|
||||
|
||||
if( dir.empty() )
|
||||
{
|
||||
std::cerr << "you have to set the templates directory with --templates-dir parameter" << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
if( template_file.empty() )
|
||||
{
|
||||
std::cerr << "you have to set the template file name with --template_file parameter" << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
functions.Insert("fil_tex", fil_tex);
|
||||
functions.Insert("cmp", cmp);
|
||||
functions.Insert("fil_max_size", fil_max_size);
|
||||
|
||||
parser.Directory(dir);
|
||||
parser.SetBlocks(blocks);
|
||||
parser.SetLogger(&log);
|
||||
parser.ParseFile(template_file, pattern);
|
||||
|
||||
models.Add(L"schema", schema);
|
||||
|
||||
Ezc::Generator<MyStream, true, false> generator;
|
||||
|
||||
generator.SetPattern(pattern);
|
||||
generator.SetFunctions(functions);
|
||||
generator.SetModels(models);
|
||||
|
||||
MyStream str;
|
||||
generator.SetLogger(log);
|
||||
generator.Generate(str);
|
||||
|
||||
std::string tmp;
|
||||
str.to_str(tmp);
|
||||
std::cout << tmp << std::endl;
|
||||
|
||||
log << pt::Log::logsave;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} // namespace Winix
|
||||
|
||||
|
||||
|
||||
|
||||
int main(int argc, const char ** argv)
|
||||
{
|
||||
using namespace Winix;
|
||||
|
||||
pt::MainOptionsParser parser;
|
||||
pt::Space input_options, args, schema;
|
||||
|
||||
args.add(L"input-mode", 1);
|
||||
args.add(L"input-file", 1);
|
||||
args.add(L"templates-dir", 1);
|
||||
args.add(L"template", 1);
|
||||
|
||||
pt::MainOptionsParser::Status status = parser.parse(argc, argv, input_options, args);
|
||||
|
||||
std::wstring input_mode = get_param(input_options.get_table(L"input-mode"));
|
||||
std::wstring input_file = get_param(input_options.get_table(L"input-file"));
|
||||
|
||||
if( input_mode.empty() )
|
||||
{
|
||||
std::cout << "you have to use --input-mode parameter" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
print("input-mode", input_mode);
|
||||
print("input-file", input_file);
|
||||
|
||||
bool sort_tables = input_options.has_key(L"sort-tables");
|
||||
|
||||
if( input_mode == L"pgmodeler" )
|
||||
{
|
||||
if( !use_pgmodeler(input_file, input_options, schema, sort_tables) )
|
||||
return 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "unknown --input-mode parameter, available are: pgmodeler" << std::endl;
|
||||
return 2;
|
||||
}
|
||||
|
||||
generate(input_options, schema);
|
||||
|
||||
|
||||
// for debug purposes
|
||||
// std::string tmp;
|
||||
// tmp = input_options.serialize_to_json_str(true);
|
||||
// std::cout << tmp << std::endl;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is distributed under the 2-Clause BSD licence.
|
||||
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2022, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include "misc.h"
|
||||
|
||||
namespace Winix
|
||||
{
|
||||
|
||||
|
||||
void print_nonl(const char * msg, const std::wstring & str)
|
||||
{
|
||||
std::string str_utf8;
|
||||
pt::wide_to_utf8(str, str_utf8);
|
||||
std::cerr << msg << ": " << str_utf8;
|
||||
}
|
||||
|
||||
|
||||
void print(const char * msg, const std::wstring & str)
|
||||
{
|
||||
print_nonl(msg, str);
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
|
||||
|
||||
void print(const char * msg, const std::wstring & str, int val)
|
||||
{
|
||||
print_nonl(msg, str);
|
||||
std::cerr << ":" << val << std::endl;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is distributed under the 2-Clause BSD licence.
|
||||
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2022, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef headerfile_winixcli_src_misc
|
||||
#define headerfile_winixcli_src_misc
|
||||
|
||||
#include "space/space.h"
|
||||
|
||||
|
||||
namespace Winix
|
||||
{
|
||||
|
||||
void print_nonl(const char * msg, const std::wstring & str);
|
||||
void print(const char * msg, const std::wstring & str);
|
||||
void print(const char * msg, const std::wstring & str, int val);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,150 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is distributed under the 2-Clause BSD licence.
|
||||
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2022-2023, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "pgmodeler.h"
|
||||
#include "html/htmlparser.h"
|
||||
#include "misc.h"
|
||||
|
||||
|
||||
|
||||
namespace Winix
|
||||
{
|
||||
|
||||
|
||||
PGModeler::PGModeler()
|
||||
{
|
||||
}
|
||||
|
||||
PGModeler::~PGModeler()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
bool PGModeler::parse(const std::wstring & input_file, pt::Space & schema, bool sort_tables)
|
||||
{
|
||||
schema.clear();
|
||||
pt::HTMLParser parser;
|
||||
|
||||
pt::HTMLParser::Status status = parser.parse_xml_file(input_file, schema, true, true);
|
||||
|
||||
if( status == pt::HTMLParser::Status::cant_open_file )
|
||||
{
|
||||
print("cannot open the input file", input_file);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
if( status == pt::HTMLParser::Status::syntax_error )
|
||||
{
|
||||
print("syntax error", input_file, parser.get_last_parsed_line());
|
||||
schema.clear();
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( sort_tables )
|
||||
make_sort_tables(schema);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
std::pair<const std::wstring*, const std::wstring*> PGModeler::get_schema_table_names(const pt::Space & table)
|
||||
{
|
||||
const pt::Space * schema = table.get_space(L"schema");
|
||||
const std::wstring * schema_name = nullptr;
|
||||
const std::wstring * table_name = nullptr;
|
||||
|
||||
if( schema )
|
||||
{
|
||||
const pt::Space * attr = schema->get_space(L"attr");
|
||||
|
||||
if( attr )
|
||||
{
|
||||
schema_name = attr->get_wstr(L"name");
|
||||
}
|
||||
}
|
||||
|
||||
const pt::Space * attr = table.get_space(L"attr");
|
||||
|
||||
if( attr )
|
||||
{
|
||||
table_name = attr->get_wstr(L"name");
|
||||
}
|
||||
|
||||
return std::make_pair(schema_name, table_name);
|
||||
}
|
||||
|
||||
|
||||
void PGModeler::make_sort_tables(pt::Space & schema)
|
||||
{
|
||||
pt::Space * dbmodel = schema.get_space(L"dbmodel");
|
||||
|
||||
if( dbmodel )
|
||||
{
|
||||
pt::Space::TableType * table = dbmodel->get_table(L"table");
|
||||
|
||||
if( table )
|
||||
{
|
||||
std::sort(table->begin(), table->end(), [](const pt::Space * t1, const pt::Space * t2) -> bool {
|
||||
auto t1_names = get_schema_table_names(*t1);
|
||||
auto t2_names = get_schema_table_names(*t2);
|
||||
|
||||
if( t1_names.first && t2_names.second && t2_names.first && t2_names.second )
|
||||
{
|
||||
if( *t1_names.first != *t2_names.first )
|
||||
{
|
||||
return *t1_names.first < *t2_names.first;
|
||||
}
|
||||
else
|
||||
{
|
||||
return *t1_names.second < *t2_names.second;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is distributed under the 2-Clause BSD licence.
|
||||
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2022-2023, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef headerfile_winixcli_src_pgmodeler
|
||||
#define headerfile_winixcli_src_pgmodeler
|
||||
|
||||
#include "space/space.h"
|
||||
|
||||
|
||||
namespace Winix
|
||||
{
|
||||
|
||||
|
||||
class PGModeler
|
||||
{
|
||||
public:
|
||||
|
||||
PGModeler();
|
||||
~PGModeler();
|
||||
|
||||
bool parse(const std::wstring & input_file, pt::Space & schema, bool sort_tables);
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
void make_sort_tables(pt::Space & schema);
|
||||
static std::pair<const std::wstring *, const std::wstring *> get_schema_table_names(const pt::Space & table);
|
||||
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
+110
-109
@@ -1,81 +1,86 @@
|
||||
# Makefile for GNU make
|
||||
# GNU Makefile
|
||||
|
||||
include Makefile.dep
|
||||
# sourcefiles: all *.cpp files except ./plugins subdirectory
|
||||
# objfiles: corresponding *.o files
|
||||
sourcefiles:=$(shell find . -name "*.cpp" -not \( -path ./plugins/\* \))
|
||||
objfiles:=$(patsubst %.cpp,%.o,$(sourcefiles))
|
||||
|
||||
# sourcefiles_no_main: all *.cpp files except ./plugins and ./main subdirectories
|
||||
sourcefiles_no_main:=$(shell find . -name "*.cpp" -not \( -path ./plugins/\* \) -not \( -path ./main/\* \))
|
||||
objfiles_no_main:=$(patsubst %.cpp,%.o,$(sourcefiles_no_main))
|
||||
|
||||
# https://www.gnu.org/software/make/manual/html_node/Flavors.html#Flavors
|
||||
GLOBAL_WORKING_DIR := $(shell pwd)/../..
|
||||
|
||||
|
||||
current_path := $(shell pwd)
|
||||
global_relative_working_dir := $(shell relative_path $(current_path) $(GLOBAL_WORKING_DIR))
|
||||
# sourcefiles_main: all *.cpp files from ./main subdirectory
|
||||
sourcefiles_main:=$(shell find main -name "*.cpp")
|
||||
objfiles_main:=$(patsubst %.cpp,%.o,$(sourcefiles_main))
|
||||
|
||||
|
||||
|
||||
ifeq ($(CXX), g++)
|
||||
CXX = g++6
|
||||
endif
|
||||
WINIX_PLUGINS_MAKEDEPEND_INCLUDES = -I../../../../winix/winixd \
|
||||
-I../../../../pikotools/src \
|
||||
-I../../../../morm/src \
|
||||
-I../../../../ezc/src \
|
||||
-I../../../../tito/src
|
||||
|
||||
WINIX_NEEDED_MACROS = -DPT_HAS_MORM_LIBRARY \
|
||||
-DEZC_HAS_MORM_LIBRARY \
|
||||
-DMORM_HAS_EZC_LIBRARY
|
||||
|
||||
|
||||
|
||||
ifndef CXX
|
||||
ifeq ($(OSTYPE), FreeBSD)
|
||||
CXX = clang++
|
||||
else
|
||||
CXX = g++6
|
||||
CXX = g++
|
||||
endif
|
||||
endif
|
||||
|
||||
# CXX = g++-4.8
|
||||
|
||||
ifndef CXXFLAGS
|
||||
CXXFLAGS = -Wall -O0 -g -fPIC -pthread -std=c++17 -I/usr/local/include -I/usr/include/postgresql -DEZC_HAS_SPECIAL_STREAM
|
||||
# /usr/include/postgresql is in Linux distros (Alpine)
|
||||
CXXFLAGS = -Wall -pedantic -O2 -std=c++20 -fPIC -pthread \
|
||||
-I/usr/local/include \
|
||||
-I/usr/include/postgresql \
|
||||
-I../../winix/winixd \
|
||||
-I../../pikotools/src \
|
||||
-I../../morm/src \
|
||||
-I../../ezc/src \
|
||||
-I../../tito/src \
|
||||
$(WINIX_PLUGINS_MAKEDEPEND_INCLUDES) \
|
||||
$(WINIX_NEEDED_MACROS)
|
||||
endif
|
||||
|
||||
ifndef AR
|
||||
AR = ar
|
||||
endif
|
||||
|
||||
winix_include_paths = -I$(global_relative_working_dir)/winix/winixd -I$(global_relative_working_dir)/ezc/src -I$(global_relative_working_dir)/tito/src -I$(global_relative_working_dir)/morm/src -I$(global_relative_working_dir)/pikotools
|
||||
|
||||
ifndef LDFLAGS
|
||||
LDFLAGS = -L/usr/local/lib
|
||||
LDFLAGS = -L/usr/local/lib -s
|
||||
endif
|
||||
|
||||
|
||||
|
||||
# for make install
|
||||
winix_install_dir = /usr/local/winix
|
||||
ifndef WINIX_INSTALL_DIR
|
||||
WINIX_INSTALL_DIR=/usr/local/winix
|
||||
endif
|
||||
|
||||
ifeq ($(WINIX_INSTALL_DIR),)
|
||||
$(error WINIX_INSTALL_DIR env variable cannot be empty)
|
||||
endif
|
||||
|
||||
|
||||
export CXX
|
||||
export CXXFLAGS
|
||||
export LDFLAGS
|
||||
export GLOBAL_WORKING_DIR
|
||||
export WINIX_PLUGINS_MAKEDEPEND_INCLUDES
|
||||
export WINIX_NEEDED_MACROS
|
||||
|
||||
|
||||
|
||||
all: winix winix.so plugins
|
||||
|
||||
|
||||
all: winix.so plugins winix
|
||||
winix: $(objfiles_main) winix.so
|
||||
$(CXX) -o winix $(CXXFLAGS) $(LDFLAGS) $(objfiles_main) winix.so -lcurl
|
||||
|
||||
|
||||
|
||||
winix.so: $(winix.src.files)
|
||||
@cd core ; $(MAKE) -e
|
||||
@cd db ; $(MAKE) -e
|
||||
@cd functions ; $(MAKE) -e
|
||||
@cd notify ; $(MAKE) -e
|
||||
@cd templates ; $(MAKE) -e
|
||||
@cd $(GLOBAL_WORKING_DIR)/ezc/src ; $(MAKE) -e
|
||||
@cd $(GLOBAL_WORKING_DIR)/tito/src ; $(MAKE) -e
|
||||
@cd $(GLOBAL_WORKING_DIR)/pikotools ; $(MAKE) -e
|
||||
@cd $(GLOBAL_WORKING_DIR)/morm/src ; $(MAKE) -e
|
||||
$(CXX) -shared -rdynamic -Wl,-whole-archive -o winix.so $(CXXFLAGS) $(winix_include_paths) core/*.o db/*.o functions/*.o templates/*.o notify/*.o $(GLOBAL_WORKING_DIR)/ezc/src/ezc.a $(GLOBAL_WORKING_DIR)/tito/src/tito.a $(GLOBAL_WORKING_DIR)/pikotools/convert/convert.a $(GLOBAL_WORKING_DIR)/pikotools/utf8/utf8.a $(GLOBAL_WORKING_DIR)/pikotools/space/space.a $(GLOBAL_WORKING_DIR)/pikotools/mainparser/mainparser.a $(GLOBAL_WORKING_DIR)/pikotools/date/date.a $(GLOBAL_WORKING_DIR)/pikotools/log/log.a $(GLOBAL_WORKING_DIR)/morm/src/morm.a $(LDFLAGS) -lfcgi -lpq -lz -lpthread -lcurl -Wl,-no-whole-archive
|
||||
|
||||
|
||||
winix: winix.so $(winix.src.files)
|
||||
@cd main ; $(MAKE) -e
|
||||
$(CXX) -o winix $(CXXFLAGS) $(LDFLAGS) main/*.o winix.so -lfcgi
|
||||
|
||||
winix.so: $(objfiles_no_main)
|
||||
@cd ../../pikotools ; $(MAKE) -e
|
||||
@cd ../../morm ; $(MAKE) -e
|
||||
@cd ../../ezc ; $(MAKE) -e
|
||||
@cd ../../tito ; $(MAKE) -e
|
||||
$(CXX) -shared -rdynamic -Wl,-whole-archive -o winix.so $(CXXFLAGS) $(objfiles_no_main) ../../pikotools/src/pikotools.a ../../morm/src/morm.a ../../ezc/src/ezc.a ../../tito/src/tito.a $(LDFLAGS) -lfcgi -lpq -lz -lpthread -lmagic -Wl,-no-whole-archive
|
||||
|
||||
|
||||
plugins: FORCE
|
||||
@@ -87,17 +92,20 @@ plugins: FORCE
|
||||
@cd plugins/menu ; $(MAKE) -e
|
||||
@cd plugins/export ; $(MAKE) -e
|
||||
@cd plugins/mailregister ; $(MAKE) -e
|
||||
@cd plugins/seo ; $(MAKE) -e
|
||||
|
||||
|
||||
%.o: %.cpp
|
||||
$(CXX) -c $(CXXFLAGS) -o $@ $<
|
||||
|
||||
|
||||
FORCE:
|
||||
|
||||
|
||||
clean:
|
||||
@cd core ; $(MAKE) -e clean
|
||||
@cd db ; $(MAKE) -e clean
|
||||
@cd functions ; $(MAKE) -e clean
|
||||
@cd templates ; $(MAKE) -e clean
|
||||
@cd notify ; $(MAKE) -e clean
|
||||
clean: FORCE
|
||||
rm -f $(objfiles)
|
||||
rm -f winix.so
|
||||
rm -f winix
|
||||
@cd plugins/stats ; $(MAKE) -e clean
|
||||
@cd plugins/thread ; $(MAKE) -e clean
|
||||
@cd plugins/ticket ; $(MAKE) -e clean
|
||||
@@ -106,74 +114,67 @@ clean:
|
||||
@cd plugins/menu ; $(MAKE) -e clean
|
||||
@cd plugins/export ; $(MAKE) -e clean
|
||||
@cd plugins/mailregister ; $(MAKE) -e clean
|
||||
@cd $(GLOBAL_WORKING_DIR)/ezc/src ; $(MAKE) -e clean
|
||||
@cd $(GLOBAL_WORKING_DIR)/tito/src ; $(MAKE) -e clean
|
||||
@cd $(GLOBAL_WORKING_DIR)/pikotools ; $(MAKE) -e clean
|
||||
@cd $(GLOBAL_WORKING_DIR)/morm/src ; $(MAKE) -e clean
|
||||
@cd main ; $(MAKE) -e clean
|
||||
rm -f winix.so
|
||||
rm -f winix
|
||||
|
||||
@cd plugins/seo ; $(MAKE) -e clean
|
||||
|
||||
|
||||
cleanall: clean
|
||||
@cd ../../pikotools ; $(MAKE) -e clean
|
||||
@cd ../../morm ; $(MAKE) -e clean
|
||||
@cd ../../ezc ; $(MAKE) -e clean
|
||||
@cd ../../tito ; $(MAKE) -e clean
|
||||
|
||||
|
||||
depend:
|
||||
@cd core ; $(MAKE) -e depend
|
||||
@cd db ; $(MAKE) -e depend
|
||||
@cd functions ; $(MAKE) -e depend
|
||||
@cd templates ; $(MAKE) -e depend
|
||||
@cd notify ; $(MAKE) -e depend
|
||||
@cd plugins/stats ; $(MAKE) -e depend
|
||||
@cd plugins/thread ; $(MAKE) -e depend
|
||||
@cd plugins/ticket ; $(MAKE) -e depend
|
||||
@cd plugins/gallery ; $(MAKE) -e depend
|
||||
@cd plugins/group ; $(MAKE) -e depend
|
||||
@cd plugins/menu ; $(MAKE) -e depend
|
||||
@cd plugins/export ; $(MAKE) -e depend
|
||||
@cd plugins/mailregister ; $(MAKE) -e depend
|
||||
@cd $(GLOBAL_WORKING_DIR)/ezc/src ; $(MAKE) -e depend
|
||||
@cd $(GLOBAL_WORKING_DIR)/tito/src ; $(MAKE) -e depend
|
||||
@cd $(GLOBAL_WORKING_DIR)/pikotools ; $(MAKE) -e depend
|
||||
@cd main ; $(MAKE) -e depend
|
||||
echo -n "winix.src.files = " > Makefile.dep
|
||||
find -E . -type f -regex ".*\.h|.*\.cpp" | xargs -I foo echo -n foo " " >> Makefile.dep
|
||||
# use $(global_relative_working_dir) here to put relative paths to Makefile.dep
|
||||
find -E $(global_relative_working_dir)/ezc/src -type f -regex ".*\.h|.*\.cpp" | xargs -I foo echo -n foo " " >> Makefile.dep
|
||||
find -E $(global_relative_working_dir)/tito/src -type f -regex ".*\.h|.*\.cpp" | xargs -I foo echo -n foo " " >> Makefile.dep
|
||||
find -E $(global_relative_working_dir)/pikotools -type f -regex ".*\.h|.*\.cpp" | xargs -I foo echo -n foo " " >> Makefile.dep
|
||||
find -E $(global_relative_working_dir)/morm/src -type f -regex ".*\.h|.*\.cpp" | xargs -I foo echo -n foo " " >> Makefile.dep
|
||||
makedepend -w 10 -Y. -I../../pikotools/src -I../../morm/src -I../../ezc/src -I../../tito/src $(WINIX_NEEDED_MACROS) -f- $(sourcefiles) | sort -u > Makefile.dep
|
||||
@cd plugins/stats ; $(MAKE) -e depend
|
||||
@cd plugins/thread ; $(MAKE) -e depend
|
||||
@cd plugins/ticket ; $(MAKE) -e depend
|
||||
@cd plugins/gallery ; $(MAKE) -e depend
|
||||
@cd plugins/group ; $(MAKE) -e depend
|
||||
@cd plugins/menu ; $(MAKE) -e depend
|
||||
@cd plugins/export ; $(MAKE) -e depend
|
||||
@cd plugins/mailregister ; $(MAKE) -e depend
|
||||
@cd plugins/seo ; $(MAKE) -e depend
|
||||
@cd ../../pikotools ; $(MAKE) -e depend
|
||||
@cd ../../morm ; $(MAKE) -e depend
|
||||
@cd ../../ezc ; $(MAKE) -e depend
|
||||
@cd ../../tito ; $(MAKE) -e depend
|
||||
|
||||
|
||||
|
||||
install: all
|
||||
# installing binaries
|
||||
rm -Rf $(winix_install_dir)/bin
|
||||
mkdir -p $(winix_install_dir)/bin
|
||||
cp winix $(winix_install_dir)/bin
|
||||
cp winix.so $(winix_install_dir)/bin
|
||||
# installing the main binary
|
||||
rm -Rf $(WINIX_INSTALL_DIR)/bin
|
||||
mkdir -p $(WINIX_INSTALL_DIR)/bin
|
||||
cp winix $(WINIX_INSTALL_DIR)/bin
|
||||
# installing the winix.so library
|
||||
rm -Rf $(WINIX_INSTALL_DIR)/lib
|
||||
mkdir -p $(WINIX_INSTALL_DIR)/lib
|
||||
cp winix.so $(WINIX_INSTALL_DIR)/lib
|
||||
# etc configs
|
||||
rm -Rf $(winix_install_dir)/etc
|
||||
mkdir -p $(winix_install_dir)/etc
|
||||
cp -rf etc/* $(winix_install_dir)/etc/
|
||||
rm -Rf $(WINIX_INSTALL_DIR)/etc
|
||||
mkdir -p $(WINIX_INSTALL_DIR)/etc
|
||||
cp -rf etc/* $(WINIX_INSTALL_DIR)/etc/
|
||||
# html templates
|
||||
rm -Rf $(winix_install_dir)/html
|
||||
mkdir -p $(winix_install_dir)/html
|
||||
cp -rf html/* $(winix_install_dir)/html/
|
||||
rm -Rf $(WINIX_INSTALL_DIR)/html
|
||||
mkdir -p $(WINIX_INSTALL_DIR)/html
|
||||
cp -rf html/* $(WINIX_INSTALL_DIR)/html/
|
||||
# txt templates
|
||||
rm -Rf $(winix_install_dir)/txt
|
||||
mkdir -p $(winix_install_dir)/txt
|
||||
cp -rf txt/* $(winix_install_dir)/txt/
|
||||
rm -Rf $(WINIX_INSTALL_DIR)/txt
|
||||
mkdir -p $(WINIX_INSTALL_DIR)/txt
|
||||
cp -rf txt/* $(WINIX_INSTALL_DIR)/txt/
|
||||
# locales
|
||||
rm -Rf $(winix_install_dir)/locale
|
||||
mkdir -p $(winix_install_dir)/locale
|
||||
cp -rf locale/* $(winix_install_dir)/locale/
|
||||
rm -Rf $(WINIX_INSTALL_DIR)/locale
|
||||
mkdir -p $(WINIX_INSTALL_DIR)/locale
|
||||
cp -rf locale/* $(WINIX_INSTALL_DIR)/locale/
|
||||
# plugins
|
||||
rm -Rf $(winix_install_dir)/plugins
|
||||
mkdir -p $(winix_install_dir)/plugins
|
||||
find plugins/ -name "*.so" | xargs -I foo cp foo $(winix_install_dir)/plugins/
|
||||
# deleting subversion directories
|
||||
find $(winix_install_dir) -type d -name ".svn" | xargs -I foo rm -fr foo
|
||||
rm -Rf $(WINIX_INSTALL_DIR)/plugins
|
||||
mkdir -p $(WINIX_INSTALL_DIR)/plugins
|
||||
find plugins/ -name "*.so" | xargs -I foo cp foo $(WINIX_INSTALL_DIR)/plugins/
|
||||
# removing privileges for others
|
||||
find $(winix_install_dir) -exec chmod o-r,o-x,o-w "{}" "+"
|
||||
find $(WINIX_INSTALL_DIR) -exec chmod o-r,o-x,o-w "{}" "+"
|
||||
|
||||
|
||||
-include Makefile.dep
|
||||
|
||||
|
||||
|
||||
+18028
-1
File diff suppressed because one or more lines are too long
@@ -1,24 +0,0 @@
|
||||
include Makefile.o.dep
|
||||
|
||||
current_path := $(shell pwd)
|
||||
global_relative_working_dir := $(shell relative_path $(current_path) $(GLOBAL_WORKING_DIR))
|
||||
|
||||
winix_include_paths = -I$(global_relative_working_dir)/winix/winixd -I$(global_relative_working_dir)/ezc/src -I$(global_relative_working_dir)/tito/src -I$(global_relative_working_dir)/morm/src -I$(global_relative_working_dir)/pikotools
|
||||
|
||||
|
||||
all: $(o)
|
||||
|
||||
|
||||
%.o: %.cpp
|
||||
$(CXX) -c $(CXXFLAGS) $(winix_include_paths) $<
|
||||
|
||||
|
||||
depend:
|
||||
makedepend -Y. $(winix_include_paths) -f- *.cpp > Makefile.dep
|
||||
echo -n "o = " > Makefile.o.dep
|
||||
ls -1 *.cpp | xargs -I foo echo -n foo " " | sed -E "s/([^\.]*)\.cpp[ ]/\1\.o/g" >> Makefile.o.dep
|
||||
|
||||
clean:
|
||||
rm -f *.o
|
||||
|
||||
include Makefile.dep
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1 +0,0 @@
|
||||
o = acceptbaseparser.o app.o basethread.o bbcodeparser.o compress.o config.o crypt.o dircontainer.o dirs.o filelog.o groups.o htmlfilter.o httpsimpleparser.o image.o ipbancontainer.o item.o job.o lastcontainer.o loadavg.o lock.o log.o misc.o mount.o mountparser.o mounts.o plugin.o plugindata.o postmultiparser.o rebus.o request.o run.o session.o sessioncontainer.o sessionidmanager.o sessionmanager.o sessionparser.o slog.o synchro.o system.o threadmanager.o timezone.o timezones.o user.o users.o winixbase.o winixmodel.o winixrequest.o winixsystem.o
|
||||
+742
-1177
File diff suppressed because it is too large
Load Diff
+43
-91
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2010-2018, Tomasz Sowa
|
||||
* Copyright (c) 2010-2024, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -46,27 +46,23 @@
|
||||
#include <fcgiapp.h>
|
||||
|
||||
#include "sessionmanager.h"
|
||||
#include "db/db.h"
|
||||
#include "functions/functions.h"
|
||||
#include "templates/templates.h"
|
||||
#include "compress.h"
|
||||
#include "postparser.h"
|
||||
#include "cookieparser.h"
|
||||
#include "postmultiparser.h"
|
||||
#include "acceptencodingparser.h"
|
||||
#include "space/jsontospaceparser.h"
|
||||
|
||||
#include "utils/acceptencodingparser.h"
|
||||
#include "winixrequest.h"
|
||||
#include "log/log.h"
|
||||
#include "filelog.h"
|
||||
#include "models/winixmodelconnector.h"
|
||||
|
||||
|
||||
namespace Winix
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
class App
|
||||
{
|
||||
public:
|
||||
@@ -77,16 +73,19 @@ public:
|
||||
bool DropPrivileges();
|
||||
void InitLoggers();
|
||||
Log & GetMainLog();
|
||||
void InitPlugins();
|
||||
bool InitializePlugins();
|
||||
bool Init();
|
||||
bool InitializeRequestForFastCGI(Request & request);
|
||||
void SetRequestDependency(Request & request);
|
||||
void InitializeNewRequest(Request & request);
|
||||
void PutRequestToJob();
|
||||
void Start();
|
||||
void Close();
|
||||
void LogUserGroups();
|
||||
bool Demonize();
|
||||
void SetStopSignal();
|
||||
bool WasStopSignal();
|
||||
bool Lock();
|
||||
void Unlock();
|
||||
Synchro * GetSynchro();
|
||||
void StartThreads();
|
||||
void WaitForThreads();
|
||||
|
||||
@@ -96,22 +95,11 @@ public:
|
||||
// pointers to the current request and a session
|
||||
Cur cur;
|
||||
|
||||
// temporary one request object
|
||||
// current request
|
||||
Request req;
|
||||
|
||||
// users sessions
|
||||
SessionManager session_manager;
|
||||
|
||||
// database (DEPRACATED)
|
||||
Db db;
|
||||
DbConn db_conn;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
model
|
||||
*/
|
||||
// an unique id for each request
|
||||
size_t request_id;
|
||||
|
||||
// ...
|
||||
System system;
|
||||
@@ -124,9 +112,6 @@ public:
|
||||
bool stdout_is_closed;
|
||||
|
||||
|
||||
/*
|
||||
view
|
||||
*/
|
||||
|
||||
Templates templates;
|
||||
|
||||
@@ -135,44 +120,32 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
enum Header
|
||||
{
|
||||
h_200,
|
||||
h_404,
|
||||
h_403
|
||||
};
|
||||
|
||||
PostParser post_parser;
|
||||
PostMultiParser post_multi_parser;
|
||||
PT::JSONToSpaceParser post_json_parser;
|
||||
std::string post_buffer;
|
||||
pt::SpaceParser space_parser;
|
||||
|
||||
CookieParser cookie_parser;
|
||||
AcceptBaseParser accept_base_parser;
|
||||
AcceptEncodingParser accept_encoding_parser;
|
||||
Compress compress;
|
||||
FCGX_Request fcgi_request;
|
||||
int fcgi_socket;
|
||||
Synchro synchro;
|
||||
pthread_t signal_thread;
|
||||
std::string socket_to_send_on_exit;
|
||||
std::string send_data_buf;
|
||||
PT::SpaceToJSON json_generic_serializer;
|
||||
TextStream<std::wstring> json_out_stream;
|
||||
std::string aheader_name, aheader_value;
|
||||
std::wstring html_filtered;
|
||||
std::string output_8bit;
|
||||
BinaryPage compressed_output;
|
||||
std::wstring cookie_id_string;
|
||||
std::wstring http_header;
|
||||
std::string http_header_8bit;
|
||||
pt::WTextStream post_log_tmp_buffer;
|
||||
|
||||
morm::ModelConnector model_connector; // main thread model connector, each thread has its own connector
|
||||
std::wstring http_header_name;
|
||||
std::wstring http_header_value;
|
||||
pt::WTextStream empty_response;
|
||||
|
||||
WinixModelConnector model_connector; // main thread model connector, each thread has its own connector
|
||||
morm::JSONConnector json_connector;
|
||||
morm::XMLConnector xml_connector;
|
||||
morm::PostgreSQLConnector postgresql_connector;
|
||||
|
||||
// objects for main thread
|
||||
WinixBase winix_base;
|
||||
WinixModel winix_model;
|
||||
WinixModelDeprecated winix_model;
|
||||
WinixSystem winix_system;
|
||||
WinixRequest winix_request;
|
||||
// ///////////////////////
|
||||
@@ -182,19 +155,22 @@ private:
|
||||
//////////////////////////
|
||||
|
||||
// log_buffer for the main thread
|
||||
PT::WTextStream log_buffer;
|
||||
pt::WTextStream log_buffer;
|
||||
|
||||
// logger only for App object
|
||||
// logger only for the main thread
|
||||
Log log;
|
||||
|
||||
// file logger, one object for every Log objects
|
||||
// file logger, one object for all Log objects
|
||||
FileLog file_log;
|
||||
|
||||
bool InitFCGI(char * sock, char * sock_user, char * sock_group);
|
||||
bool InitFCGIChmodChownSocket(char * sock, char * sock_user, char * sock_group);
|
||||
bool AddSystemThreads();
|
||||
|
||||
bool InitFCGIChmodChownSocket(const char * sock);
|
||||
bool DropPrivileges(char * user, char * group);
|
||||
bool DropPrivileges(const char * user, uid_t uid, gid_t gid, bool additional_groups);
|
||||
bool CheckAccessFromPlugins();
|
||||
void MakeRenameMeToABetterName();
|
||||
bool AddRootDir();
|
||||
void ProcessRequestThrow();
|
||||
void ProcessRequest();
|
||||
void BaseUrlRedirect(int code, bool add_subdomain);
|
||||
@@ -202,59 +178,31 @@ private:
|
||||
void CheckIfNeedSSLredirect();
|
||||
void SetLocale();
|
||||
void CheckPostRedirect();
|
||||
void MakePage();
|
||||
void Make();
|
||||
void AddDefaultModels();
|
||||
void SaveSessionsIfNeeded(); // !! IMPROVE ME wywalic do menagera sesji??
|
||||
void LogAccess();
|
||||
void SendData(const BinaryPage & page, FCGX_Stream * out);
|
||||
void CreateJSONAnswer();
|
||||
|
||||
void ReadRequest();
|
||||
void SendTextAnswer();
|
||||
void SendBinaryAnswer();
|
||||
void SendAnswer();
|
||||
|
||||
void LogEnvironmentVariables();
|
||||
void LogEnvironmentHTTPVariables();
|
||||
|
||||
void ParseAcceptHeader(const wchar_t * header_name, const std::wstring & env, std::vector<HeaderValue> & container, size_t max_len);
|
||||
void ParseAcceptHeader();
|
||||
void ParseAcceptLanguageHeader();
|
||||
void SetEnv(const char * name, std::wstring & env);
|
||||
void ReadEnvVariables();
|
||||
void ReadEnvHTTPVariables();
|
||||
bool SaveEnvHTTPVariable(const char * env);
|
||||
void ReadEnvRemoteIP();
|
||||
void ReadPostJson();
|
||||
void ReadInputPostToBuffer();
|
||||
void ParsePostJson();
|
||||
void ReadPostJson(bool copy_raw_post);
|
||||
void ReadPostVars();
|
||||
|
||||
void CheckIE();
|
||||
void CheckKonqueror();
|
||||
void CheckRequestMethod();
|
||||
void CheckSSL();
|
||||
void SetSubdomain();
|
||||
|
||||
|
||||
Header GetHTTPStatusCode();
|
||||
void PrepareSessionCookie();
|
||||
void FilterContent();
|
||||
void CheckHtmx();
|
||||
bool IsRequestedFrame();
|
||||
void SendHeaders();
|
||||
void SendCookies();
|
||||
bool AddHeader(const wchar_t * name, const wchar_t * value);
|
||||
bool AddHeader(const std::wstring & name, const std::wstring & value);
|
||||
bool AddHeader(const wchar_t * name, const PT::WTextStream & value);
|
||||
bool AddHeader(const std::wstring & name, const PT::WTextStream & value);
|
||||
bool PrepareHeadersStaticCreateResource(PT::WTextStream & out_path);
|
||||
void PrepareHeadersStatic();
|
||||
void PrepareHeaderContentType();
|
||||
void PrepareHeadersForbidden();
|
||||
void PrepareHeadersRedirect();
|
||||
void PrepareHeadersSendFile();
|
||||
void PrepareHeadersCompression(int compress_encoding);
|
||||
void PrepareHeadersNormal(Header header, size_t output_size);
|
||||
void PrepareHeaders(bool compressing, int compress_encoding, Header header, size_t output_size);
|
||||
void PrepareStandardJSONFields();
|
||||
int SelectDeflateVersion();
|
||||
void SelectCompression(size_t source_len, bool & compression_allowed, int & compression_encoding);
|
||||
bool CanSendContent();
|
||||
void ClearAfterRequest();
|
||||
void IncrementRequestId();
|
||||
|
||||
void LogUser(const char * msg, uid_t id);
|
||||
void LogGroup(const char * msg, gid_t id, bool put_logend = true);
|
||||
@@ -267,6 +215,10 @@ private:
|
||||
|
||||
void CreateStaticTree();
|
||||
|
||||
bool DoDatabaseMigration();
|
||||
bool TryToMakeDatabaseMigration();
|
||||
|
||||
|
||||
// !! IMPROVE ME
|
||||
// !! move to the session manager?
|
||||
time_t last_sessions_save;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2010-2018, Tomasz Sowa
|
||||
* Copyright (c) 2010-2022, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -42,10 +42,11 @@ namespace Winix
|
||||
|
||||
BaseThread::BaseThread() : thread_signal(PTHREAD_COND_INITIALIZER)
|
||||
{
|
||||
synchro = 0;
|
||||
thread_id = 0;
|
||||
work_mode = 0;
|
||||
wake_up_was_called = false;
|
||||
synchro = nullptr;
|
||||
thread_id = 0;
|
||||
work_mode = 0;
|
||||
wake_up_was_called = false;
|
||||
main_model_connector = nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -54,13 +55,23 @@ BaseThread::~BaseThread()
|
||||
}
|
||||
|
||||
|
||||
|
||||
void BaseThread::SetSynchro(Synchro * psynchro)
|
||||
void BaseThread::set_main_log_buffer(pt::WTextStream * log_buffer)
|
||||
{
|
||||
synchro = psynchro;
|
||||
main_log.set_log_buffer(log_buffer);
|
||||
}
|
||||
|
||||
|
||||
void BaseThread::set_main_file_log(pt::FileLog * file_log)
|
||||
{
|
||||
main_log.set_file_log(file_log);
|
||||
}
|
||||
|
||||
|
||||
void BaseThread::set_main_model_connector(morm::ModelConnector * main_model_connector)
|
||||
{
|
||||
this->main_model_connector = main_model_connector;
|
||||
}
|
||||
|
||||
|
||||
void BaseThread::Mode(int mode)
|
||||
{
|
||||
@@ -250,6 +261,7 @@ void * BaseThread::StartRoutine(void * this_object)
|
||||
}
|
||||
}
|
||||
|
||||
base->save_log();
|
||||
pthread_exit(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
+23
-13
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2010-2018, Tomasz Sowa
|
||||
* Copyright (c) 2010-2022, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
#include <pthread.h>
|
||||
#include "synchro.h"
|
||||
#include "winixmodel.h"
|
||||
#include "winixmodeldeprecated.h"
|
||||
|
||||
|
||||
|
||||
@@ -47,15 +47,17 @@ namespace Winix
|
||||
|
||||
|
||||
|
||||
class BaseThread : public WinixModel
|
||||
class BaseThread : public WinixModelDeprecated
|
||||
{
|
||||
public:
|
||||
|
||||
BaseThread();
|
||||
virtual ~BaseThread();
|
||||
|
||||
// synchro object (must be set)
|
||||
void SetSynchro(Synchro * psynchro);
|
||||
void set_main_log_buffer(pt::WTextStream * log_buffer);
|
||||
void set_main_file_log(pt::FileLog * file_log);
|
||||
|
||||
void set_main_model_connector(morm::ModelConnector * main_model_connector);
|
||||
|
||||
// work mode
|
||||
// we have two modes:
|
||||
@@ -100,9 +102,18 @@ public:
|
||||
pthread_t ThreadId();
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// logger for the main thread
|
||||
Log main_log;
|
||||
// log from WinixBase is meant to be used by the second thread
|
||||
|
||||
// model connector for the main thread
|
||||
// model_connector from the based class WinixModelDeprecated is meant to be used by the second thread
|
||||
morm::ModelConnector * main_model_connector;
|
||||
|
||||
|
||||
|
||||
|
||||
// signal came (work mode = 0 - default)
|
||||
// signal comes when an other thread calls WakeUpThread() method
|
||||
@@ -126,7 +137,6 @@ protected:
|
||||
|
||||
protected:
|
||||
|
||||
Synchro * synchro;
|
||||
pthread_t thread_id; // thread id - set by StartThread()
|
||||
pthread_cond_t thread_signal;
|
||||
int work_mode;
|
||||
@@ -134,12 +144,12 @@ protected:
|
||||
|
||||
void SignalLoop();
|
||||
static void * StartRoutine(void *);
|
||||
bool BaseInit();
|
||||
void BaseUninit();
|
||||
bool BaseSignalReceived();
|
||||
void BaseDo();
|
||||
bool WaitForSignal();
|
||||
bool WaitForSignalSleep(time_t second);
|
||||
virtual bool BaseInit();
|
||||
virtual void BaseUninit();
|
||||
virtual bool BaseSignalReceived();
|
||||
virtual void BaseDo();
|
||||
virtual bool WaitForSignal();
|
||||
virtual bool WaitForSignalSleep(time_t second);
|
||||
|
||||
bool Lock();
|
||||
void Unlock();
|
||||
|
||||
@@ -1,636 +0,0 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is distributed under the 2-Clause BSD licence.
|
||||
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008-2018, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "bbcodeparser.h"
|
||||
|
||||
|
||||
namespace Winix
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
bool BBCODEParser::Equal(const wchar_t * str1, const wchar_t * str2)
|
||||
{
|
||||
while( *str1 == *str2 && *str1 != 0 )
|
||||
{
|
||||
str1 += 1;
|
||||
str2 += 1;
|
||||
}
|
||||
|
||||
return *str1 == *str2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
bool BBCODEParser::IsValidCharForName(int c)
|
||||
{
|
||||
if( (c>='a' && c<='z') ||
|
||||
(c>='A' && c<='Z') ||
|
||||
c=='*' || c=='_')
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool BBCODEParser::IsOpeningTagMark(wchar_t c)
|
||||
{
|
||||
return (c == '[');
|
||||
}
|
||||
|
||||
|
||||
bool BBCODEParser::IsClosingTagMark(wchar_t c)
|
||||
{
|
||||
return (c == ']');
|
||||
}
|
||||
|
||||
bool BBCODEParser::IsClosingXmlSimpleTagMark(wchar_t c)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// there are no commentaries in bbcode
|
||||
bool BBCODEParser::IsOpeningCommentaryTagMark(const wchar_t *)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
size_t BBCODEParser::OpeningCommentaryTagMarkSize()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool BBCODEParser::SkipCommentaryTagIfExists()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// one enter will generate one <br>
|
||||
// two enters or more will generate only two br (<br><br>)
|
||||
void BBCODEParser::PutNormalText(const wchar_t * str, const wchar_t * end)
|
||||
{
|
||||
int br_len;
|
||||
|
||||
if( *pchar == 0 )
|
||||
{
|
||||
// trimming last white characters at end of the user text
|
||||
while( str<end && (IsWhite(*(end-1)) || *(end-1)==10) )
|
||||
--end;
|
||||
}
|
||||
|
||||
|
||||
while( str < end )
|
||||
{
|
||||
if( *str == 10 )
|
||||
{
|
||||
++str;
|
||||
br_len = 1;
|
||||
|
||||
// skipping white characters without a new line character
|
||||
while( str < end && IsWhite(*str) )
|
||||
++str;
|
||||
|
||||
if( str < end && *str == 10 )
|
||||
{
|
||||
br_len = 2;
|
||||
|
||||
// skipping white characters with new line characters
|
||||
while( str < end && (IsWhite(*str) || *str==10) )
|
||||
++str;
|
||||
}
|
||||
|
||||
if( !has_open_ol_tag && !has_open_ul_tag && !has_open_li_tag )
|
||||
{
|
||||
for(int i=0 ; i < br_len ; ++i)
|
||||
(*out_string) += L"<br>\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
PrintEscape(*str);
|
||||
++str;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void BBCODEParser::ReadNormalTextSkipWhite(const wchar_t * & start, const wchar_t * & last_non_white)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void BBCODEParser::CheckExceptions()
|
||||
{
|
||||
if( stack_len >= 2 )
|
||||
{
|
||||
if( pstack[stack_len-1].type == Item::opening &&
|
||||
pstack[stack_len-2].type == Item::opening &&
|
||||
IsNameEqual(L"*", pstack[stack_len-1].name) &&
|
||||
IsNameEqual(L"*", pstack[stack_len-2].name) )
|
||||
{
|
||||
// removing the last [*] from the stack
|
||||
// </li> was put automatically
|
||||
PopStack();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
bbcode format:
|
||||
[bbcodetag=value]some text[/bbcodetag]
|
||||
the value can be quoted, e.g.
|
||||
[bbcodetag="value"]some text[/bbcodetag], or
|
||||
[bbcodetag='value']some text[/bbcodetag]
|
||||
|
||||
the third string below (in tags table) is 'html_argument' from Tags,
|
||||
it can contain a special character % followed by a string which means:
|
||||
%1 - "value" escaped as for html
|
||||
%2 - "some text" escaped as for html
|
||||
%u1 - "value" trimmed and escaped as for url-es
|
||||
%u2 - "some text" trimmed and escaped as for url-es
|
||||
%% - one %
|
||||
|
||||
if you are using %2 or %u2 then "some text" is not treated as bbcode, e.g.
|
||||
[bbcodetag=value]some [b]text[/b][/bbcodetag] will produce:
|
||||
<htmltag arg="value">some [b]text[/b]</htmltag> (the inner tags [b][/b] were not parsed)
|
||||
|
||||
also when using %2 or %u2 the closing bbcode tag is skipped
|
||||
(if you want this tag then you can put it in 'html_argument')
|
||||
|
||||
and when using u (%u1 or %u2) the argument is trimmed from whitespaces and new lines
|
||||
at the beginning and at the end
|
||||
(because otherwise a space would be changed to %20 and this were probably not what you really wanted)
|
||||
*/
|
||||
const BBCODEParser::Tags * BBCODEParser::FindTag(const wchar_t * tag)
|
||||
{
|
||||
static Tags tags[] = {
|
||||
{L"*", L"li", L">", false},
|
||||
{L"b", L"em", L">", true},
|
||||
{L"i", L"span", L" class=\"bbitalic\">", true},
|
||||
{L"u", L"span", L" class=\"bbunderline\">", true},
|
||||
{L"s", L"span", L" class=\"bbstrike\">", true},
|
||||
{L"code", L"code", L" class=\"bbcode\">", false},
|
||||
{L"list", L"ul", L" class=\"bblist\">", false},
|
||||
{L"color", L"span", L" class=\"bbcol%1\">", true},
|
||||
{L"url", L"a", L" href=\"%u1\">", true},
|
||||
{L"img", L"img", L" alt=\"%1\" src=\"%u2\">", true},
|
||||
{L"quote", L"div", L" class=\"bbquote\">\n<span class=\"bbquotewho\">%1</span><br>\n", false},
|
||||
};
|
||||
|
||||
size_t i;
|
||||
size_t len = sizeof(tags) / sizeof(Tags);
|
||||
|
||||
for(i=0 ; i<len ; ++i)
|
||||
{
|
||||
if( Equal(tag, tags[i].bbcode) )
|
||||
return &tags[i];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
const BBCODEParser::Tags * BBCODEParser::FindTag(const std::wstring & tag)
|
||||
{
|
||||
return FindTag(tag.c_str());
|
||||
}
|
||||
|
||||
|
||||
|
||||
void BBCODEParser::PrintArgumentCheckQuotes(const wchar_t * & start, const wchar_t * & end)
|
||||
{
|
||||
// skipping white characters from the argument
|
||||
while( start<end && IsWhite(*start) )
|
||||
++start;
|
||||
|
||||
// skipping first '=' character if exists
|
||||
if( start<end && *start == '=' )
|
||||
++start;
|
||||
|
||||
// skipping white characters from the argument
|
||||
// at the beginning
|
||||
while( start<end && IsWhite(*start) )
|
||||
++start;
|
||||
|
||||
// and at the end
|
||||
while( start<end && IsWhite(*(end-1)) )
|
||||
--end;
|
||||
|
||||
|
||||
if( start<end && (*start=='\'' || *start=='\"') )
|
||||
{
|
||||
++start;
|
||||
|
||||
if( start<end && *(start-1) == *(end-1) )
|
||||
--end;
|
||||
|
||||
// skipping white characters after a first quote char [url = " ww...."]
|
||||
while( start<end && IsWhite(*start) )
|
||||
++start;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void BBCODEParser::PrintEncode(int c)
|
||||
{
|
||||
if( c == '&' )
|
||||
{
|
||||
(*out_string) += L"&";
|
||||
}
|
||||
else
|
||||
if( (c>='a' && c<='z') ||
|
||||
(c>='A' && c<='Z') ||
|
||||
(c>='0' && c<='9') ||
|
||||
(c=='_' || c=='?' || c=='.' || c==',' || c=='/' || c=='-' ||
|
||||
c=='+' || c=='*' || c=='(' || c==')' || c=='=' || c==':')
|
||||
)
|
||||
{
|
||||
(*out_string) += c;
|
||||
}
|
||||
else
|
||||
{
|
||||
wchar_t buffer[20];
|
||||
swprintf(buffer, 20, L"%02X", c);
|
||||
|
||||
(*out_string) += '%';
|
||||
(*out_string) += buffer;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BBCODEParser::PrintEscape(int c, bool change_quote)
|
||||
{
|
||||
if( c == '<' )
|
||||
{
|
||||
(*out_string) += L"<";
|
||||
}
|
||||
else
|
||||
if( c == '>' )
|
||||
{
|
||||
(*out_string) += L">";
|
||||
}
|
||||
else
|
||||
if( c == '&' )
|
||||
{
|
||||
(*out_string) += L"&";
|
||||
}
|
||||
else
|
||||
if( c == '\"' && change_quote )
|
||||
{
|
||||
(*out_string) += L""";
|
||||
}
|
||||
else
|
||||
{
|
||||
(*out_string) += c;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BBCODEParser::PrintArgumentEncode(const wchar_t * start, const wchar_t * end)
|
||||
{
|
||||
PrintArgumentCheckQuotes(start, end);
|
||||
TrimWhiteWithNewLines(start, end);
|
||||
|
||||
for( ; start<end ; ++start )
|
||||
PrintEncode(*start);
|
||||
}
|
||||
|
||||
|
||||
void BBCODEParser::PrintArgumentEscape(const wchar_t * start, const wchar_t * end)
|
||||
{
|
||||
PrintArgumentCheckQuotes(start, end);
|
||||
|
||||
for( ; start<end ; ++start )
|
||||
PrintEscape(*start, true); // quotes are escaped as well here
|
||||
}
|
||||
|
||||
|
||||
void BBCODEParser::CheckOpeningTag(const Tags * tag, const wchar_t * tag_name, bool & condition)
|
||||
{
|
||||
if( Equal(tag->html_tag, tag_name) )
|
||||
{
|
||||
if( condition )
|
||||
{
|
||||
PutClosingTag(tag);
|
||||
(*out_string) += '\n';
|
||||
}
|
||||
|
||||
condition = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BBCODEParser::CheckOpeningTag(const Tags * tag)
|
||||
{
|
||||
bool has_list_tag = has_open_ul_tag || has_open_ol_tag;
|
||||
|
||||
CheckOpeningTag(tag, L"li", has_open_li_tag);
|
||||
CheckOpeningTag(tag, L"ul", has_open_ul_tag);
|
||||
CheckOpeningTag(tag, L"ol", has_open_ol_tag);
|
||||
|
||||
if( has_open_li_tag && !has_list_tag )
|
||||
{
|
||||
(*out_string) += L"<ul>\n";
|
||||
has_open_ul_tag = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void BBCODEParser::PrintEscape(const wchar_t * start, const wchar_t * end, bool change_quote)
|
||||
{
|
||||
for( ; start < end ; ++start)
|
||||
PrintEscape(*start, change_quote);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void BBCODEParser::PrintEncode(const wchar_t * start, const wchar_t * end)
|
||||
{
|
||||
for( ; start < end ; ++start)
|
||||
PrintEncode(*start);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void BBCODEParser::PutOpeningTagFromEzc()
|
||||
{
|
||||
// this can be a tag from Ezc templates system
|
||||
(*out_string) += '[';
|
||||
(*out_string) += LastItem().name;
|
||||
|
||||
const wchar_t * start = pchar;
|
||||
|
||||
while( *pchar && *pchar!=']' )
|
||||
++pchar;
|
||||
|
||||
if( *pchar == ']' )
|
||||
++pchar;
|
||||
|
||||
Put(start, pchar);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void BBCODEParser::PutHtmlArgument1(const wchar_t * arg_start, const wchar_t * arg_end, bool has_u)
|
||||
{
|
||||
if( has_u )
|
||||
PrintArgumentEncode(arg_start, arg_end);
|
||||
else
|
||||
PrintArgumentEscape(arg_start, arg_end);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void BBCODEParser::TrimWhiteWithNewLines(const wchar_t * & start, const wchar_t * & end)
|
||||
{
|
||||
while( start < end && (IsWhite(*start) || *start==10) )
|
||||
++start;
|
||||
|
||||
while( start < end && (IsWhite(*(end-1)) || *(end-1)==10) )
|
||||
--end;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void BBCODEParser::PutHtmlArgument2(const Tags * tag, bool has_u)
|
||||
{
|
||||
const wchar_t * start = pchar;
|
||||
const wchar_t * end = pchar;
|
||||
bool first_tag_removed = false;
|
||||
|
||||
while( *pchar != 0 )
|
||||
{
|
||||
if( IsOpeningTagMark(*pchar) )
|
||||
{
|
||||
if( IsClosingTagForLastItem() )
|
||||
{
|
||||
// the last tag is skipped when using patterns with %2 or %u2
|
||||
|
||||
PopStack(); // removing opening tag from the stack
|
||||
first_tag_removed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pchar += 1;
|
||||
end = pchar;
|
||||
}
|
||||
}
|
||||
|
||||
if( !first_tag_removed )
|
||||
PopStack(); // user has forgotten to close the tag
|
||||
|
||||
if( has_u )
|
||||
{
|
||||
TrimWhiteWithNewLines(start, end);
|
||||
PrintEncode(start, end);
|
||||
}
|
||||
else
|
||||
{
|
||||
PrintEscape(start, end);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void BBCODEParser::PutHtmlArgument(const Tags * tag, const wchar_t * arg_start, const wchar_t * arg_end)
|
||||
{
|
||||
const wchar_t * pattern = tag->html_argument;
|
||||
bool has_u;
|
||||
|
||||
while( *pattern )
|
||||
{
|
||||
if( *pattern == '%' )
|
||||
{
|
||||
++pattern;
|
||||
has_u = false;
|
||||
|
||||
if( *pattern == 'u' )
|
||||
{
|
||||
++pattern;
|
||||
has_u = true;
|
||||
}
|
||||
|
||||
if( *pattern == '1' )
|
||||
{
|
||||
++pattern;
|
||||
PutHtmlArgument1(arg_start, arg_end, has_u);
|
||||
}
|
||||
else
|
||||
if( *pattern == '2' )
|
||||
{
|
||||
++pattern;
|
||||
PutHtmlArgument2(tag, has_u);
|
||||
}
|
||||
else
|
||||
if( *pattern == '%' )
|
||||
{
|
||||
(*out_string) += '%';
|
||||
++pattern;
|
||||
}
|
||||
// else unrecognized, will be printed next time as a normal character
|
||||
}
|
||||
else
|
||||
{
|
||||
(*out_string) += *pattern;
|
||||
++pattern;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BBCODEParser::PutOpeningTagFromBBCode(const Tags * tag)
|
||||
{
|
||||
CheckOpeningTag(tag);
|
||||
PutOpeningTagMark();
|
||||
Put(tag->html_tag);
|
||||
|
||||
const wchar_t * start = pchar;
|
||||
|
||||
while( *pchar && *pchar != ']' )
|
||||
++pchar;
|
||||
|
||||
PutHtmlArgument(tag, start, pchar);
|
||||
|
||||
if( *pchar == ']' )
|
||||
++pchar;
|
||||
|
||||
if( !tag->inline_tag )
|
||||
{
|
||||
Put(10);
|
||||
SkipWhiteLines();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool BBCODEParser::PutOpeningTag()
|
||||
{
|
||||
const Tags * tag = FindTag(LastItem().name);
|
||||
|
||||
if( !tag )
|
||||
PutOpeningTagFromEzc();
|
||||
else
|
||||
PutOpeningTagFromBBCode(tag);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void BBCODEParser::PutClosingTag(const Tags * tag)
|
||||
{
|
||||
if( !tag )
|
||||
return; // skipping the tag
|
||||
|
||||
PutOpeningTagMark();
|
||||
(*out_string) += '/';
|
||||
(*out_string) += tag->html_tag;
|
||||
PutClosingTagMark();
|
||||
|
||||
if( !tag->inline_tag )
|
||||
{
|
||||
(*out_string) += L"\n";
|
||||
SkipWhiteLines();
|
||||
}
|
||||
|
||||
if( Equal(tag->html_tag, L"li") )
|
||||
has_open_li_tag = false;
|
||||
|
||||
if( Equal(tag->html_tag, L"ol") )
|
||||
has_open_ol_tag = false;
|
||||
|
||||
if( Equal(tag->html_tag, L"ul") )
|
||||
has_open_ul_tag = false;
|
||||
}
|
||||
|
||||
|
||||
void BBCODEParser::PutClosingTag(const wchar_t * tag_name)
|
||||
{
|
||||
const Tags * tag = FindTag(tag_name);
|
||||
PutClosingTag(tag);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void BBCODEParser::Init()
|
||||
{
|
||||
has_open_li_tag = false;
|
||||
has_open_ol_tag = false;
|
||||
has_open_ul_tag = false;
|
||||
|
||||
SkipWhiteLines();
|
||||
}
|
||||
|
||||
|
||||
void BBCODEParser::Uninit()
|
||||
{
|
||||
if( has_open_li_tag )
|
||||
(*out_string) += L"</li>\n";
|
||||
|
||||
if( has_open_ol_tag )
|
||||
(*out_string) += L"</ol>\n";
|
||||
|
||||
if( has_open_ul_tag )
|
||||
(*out_string) += L"</ul>\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // namespace Winix
|
||||
|
||||
@@ -1,127 +0,0 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is distributed under the 2-Clause BSD licence.
|
||||
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008-2018, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef headerfile_winix_core_bbcodeparser
|
||||
#define headerfile_winix_core_bbcodeparser
|
||||
|
||||
#include "htmlfilter.h"
|
||||
|
||||
|
||||
namespace Winix
|
||||
{
|
||||
|
||||
|
||||
|
||||
class BBCODEParser : public HTMLFilter
|
||||
{
|
||||
|
||||
struct Tags
|
||||
{
|
||||
const wchar_t * bbcode;
|
||||
const wchar_t * html_tag;
|
||||
const wchar_t * html_argument; // with closing '>'
|
||||
bool inline_tag;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
virtual methods
|
||||
(from HTMLFilter class)
|
||||
*/
|
||||
virtual void Init();
|
||||
virtual void Uninit();
|
||||
|
||||
virtual bool IsOpeningTagMark(wchar_t c);
|
||||
virtual bool IsClosingTagMark(wchar_t c);
|
||||
virtual bool IsClosingXmlSimpleTagMark(wchar_t c);
|
||||
|
||||
virtual bool IsOpeningCommentaryTagMark(const wchar_t *);
|
||||
virtual size_t OpeningCommentaryTagMarkSize();
|
||||
|
||||
virtual bool IsValidCharForName(int c);
|
||||
virtual void CheckExceptions();
|
||||
virtual bool SkipCommentaryTagIfExists();
|
||||
|
||||
virtual bool PutOpeningTag();
|
||||
virtual void PutClosingTag(const wchar_t * tag);
|
||||
|
||||
virtual void PutNormalText(const wchar_t * str, const wchar_t * end);
|
||||
virtual void ReadNormalTextSkipWhite(const wchar_t * & start, const wchar_t * & last_non_white);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
others
|
||||
*/
|
||||
bool Equal(const wchar_t * str1, const wchar_t * str2);
|
||||
|
||||
void PutHtmlArgument1(const wchar_t * arg_start, const wchar_t * arg_end, bool has_u);
|
||||
void PutHtmlArgument2(const Tags * tag, bool has_u);
|
||||
void PutHtmlArgument(const Tags * tag, const wchar_t * arg_start, const wchar_t * arg_end);
|
||||
|
||||
void PutOpeningTagFromEzc();
|
||||
void PutOpeningTagFromBBCode(const Tags * tag);
|
||||
|
||||
const Tags * FindTag(const wchar_t * tag);
|
||||
const Tags * FindTag(const std::wstring & tag);
|
||||
void PrintArgumentCheckQuotes(const wchar_t * & start, const wchar_t * & end);
|
||||
|
||||
void PrintEscape(int c, bool change_quote = false);
|
||||
void PrintEncode(int c);
|
||||
|
||||
void PrintEscape(const wchar_t * start, const wchar_t * end, bool change_quote = false);
|
||||
void PrintEncode(const wchar_t * start, const wchar_t * end);
|
||||
|
||||
void PrintArgumentEncode(const wchar_t * start, const wchar_t * end);
|
||||
void PrintArgumentEscape(const wchar_t * start, const wchar_t * end);
|
||||
|
||||
void PutClosingTag(const Tags * tag);
|
||||
|
||||
void CheckOpeningTag(const Tags * tag, const wchar_t * tag_name, bool & condition);
|
||||
void CheckOpeningTag(const Tags * tag);
|
||||
|
||||
void TrimWhiteWithNewLines(const wchar_t * & start, const wchar_t * & end);
|
||||
|
||||
|
||||
|
||||
bool has_open_ol_tag; // has open html <ol> tag
|
||||
bool has_open_ul_tag; // has open html <ul> tag
|
||||
bool has_open_li_tag; // has open html <li> tag
|
||||
};
|
||||
|
||||
|
||||
} // namespace Winix
|
||||
|
||||
|
||||
#endif
|
||||
@@ -258,6 +258,8 @@ BinaryPage::const_iterator i = page.begin();
|
||||
source_len -= strm.avail_in;
|
||||
flush = (source_len == 0) ? Z_FINISH : Z_NO_FLUSH;
|
||||
strm.next_in = (Bytef*)buffer_in;
|
||||
|
||||
// IMPROVE ME we can add an interface to pt::TextStreamBase<> and get all chunks of memory
|
||||
CopyToInputBuffer(i, strm.avail_in);
|
||||
|
||||
do
|
||||
|
||||
+118
-102
@@ -4,8 +4,8 @@
|
||||
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008-2018, Tomasz Sowa
|
||||
/*
|
||||
* Copyright (c) 2008-2026, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -45,47 +45,39 @@ namespace Winix
|
||||
|
||||
Config::Config()
|
||||
{
|
||||
errors_to_stdout = true;
|
||||
}
|
||||
|
||||
|
||||
void Config::SetFileLog(FileLog * file_log)
|
||||
{
|
||||
log.SetFileLog(file_log);
|
||||
log.set_file_log(file_log);
|
||||
}
|
||||
|
||||
|
||||
void Config::SetLogBuffer(PT::WTextStream * log_buffer)
|
||||
void Config::SetLogBuffer(pt::WTextStream * log_buffer)
|
||||
{
|
||||
log.SetLogBuffer(log_buffer);
|
||||
log.set_log_buffer(log_buffer);
|
||||
}
|
||||
|
||||
|
||||
void Config::ShowError()
|
||||
void Config::ShowError(const std::wstring & config_file)
|
||||
{
|
||||
|
||||
switch( parser.status )
|
||||
{
|
||||
case PT::SpaceParser::no_space:
|
||||
log << log2 << "Config: space not set" << logend;
|
||||
case pt::SpaceParser::ok:
|
||||
break;
|
||||
|
||||
case PT::SpaceParser::ok:
|
||||
log << log2 << "Config: syntax ok" << logend;
|
||||
break;
|
||||
|
||||
case PT::SpaceParser::cant_open_file:
|
||||
if( errors_to_stdout )
|
||||
std::wcout << L"Config: I cannot open a config file: " << config_file << std::endl;
|
||||
|
||||
log << log1 << "Config: cant open a config file: " << config_file << logend;
|
||||
case pt::SpaceParser::cant_open_file:
|
||||
log << log1 << "Config: I cannot open a config file: " << config_file << logend;
|
||||
break;
|
||||
|
||||
case PT::SpaceParser::syntax_error:
|
||||
if( errors_to_stdout )
|
||||
std::wcout << "Config: syntax error, line: " << parser.line << std::endl;
|
||||
|
||||
log << log1 << "Config: syntax error, line: " << parser.line << logend;
|
||||
case pt::SpaceParser::syntax_error:
|
||||
log << log1 << "Config: syntax error in file: " << config_file << ", line: "
|
||||
<< parser.get_last_parsed_line() << ":" << parser.get_last_parsed_column() << logend;
|
||||
break;
|
||||
|
||||
default:
|
||||
// there are no limits sets when parsing the config file
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -95,38 +87,38 @@ void Config::ShowError()
|
||||
|
||||
|
||||
|
||||
bool Config::ReadConfig(bool errors_to_stdout_, bool stdout_is_closed)
|
||||
bool Config::ReadConfig(const std::wstring & config_file)
|
||||
{
|
||||
errors_to_stdout = errors_to_stdout_;
|
||||
|
||||
if( config_file.empty() )
|
||||
{
|
||||
log << log2 << "Config: name of the config file is empty" << logend;
|
||||
return false;
|
||||
}
|
||||
|
||||
log << log2 << "Config: reading a config file" << logend;
|
||||
log << log2 << "Config: reading a config file: " << config_file << logend;
|
||||
pt::SpaceParser::Status status = parser.parse_space_file(config_file, space, false);
|
||||
|
||||
parser.SetSpace(space);
|
||||
PT::SpaceParser::Status status = parser.Parse(config_file);
|
||||
|
||||
if( status == PT::SpaceParser::ok )
|
||||
if( status == pt::SpaceParser::ok )
|
||||
{
|
||||
AssignValues(stdout_is_closed);
|
||||
SetAdditionalVariables();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowError();
|
||||
ShowError(config_file);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Config::AssignValuesFromSpace()
|
||||
{
|
||||
AssignValues();
|
||||
SetAdditionalVariables();
|
||||
}
|
||||
|
||||
|
||||
void Config::AssignValues(bool stdout_is_closed)
|
||||
|
||||
void Config::AssignValues()
|
||||
{
|
||||
server_mode = Text(L"server_mode");
|
||||
demonize = Bool(L"demonize", true);
|
||||
@@ -138,10 +130,13 @@ void Config::AssignValues(bool stdout_is_closed)
|
||||
log_file = Text(L"log_file");
|
||||
log_delimiter = Text(L"log_delimiter", L"---------------------------------------------------------------------------------");
|
||||
fcgi_socket = Text(L"fcgi_socket");
|
||||
fcgi_set_socket_chmod = Bool(L"fcgi_set_socket_chmod", true);
|
||||
fcgi_set_socket_owner = Bool(L"fcgi_set_socket_owner", true);
|
||||
fcgi_socket_chmod = Int(L"fcgi_socket_chmod", 0770);
|
||||
fcgi_socket_user = Text(L"fcgi_socket_user");
|
||||
fcgi_socket_group = Text(L"fcgi_socket_group");
|
||||
fcgi_socket_listen = Int(L"fcgi_socket_listen", 100);
|
||||
fcgi_socket_listen = Int(L"fcgi_socket_listen", 1024);
|
||||
fcgi_cannot_create_request_delay = Size(L"fcgi_cannot_create_request_delay", 3);
|
||||
log_level = Int(L"log_level", 1);
|
||||
log_request = Int(L"log_request", 1);
|
||||
log_save_each_line = Bool(L"log_save_each_line", false);
|
||||
@@ -153,9 +148,15 @@ void Config::AssignValues(bool stdout_is_closed)
|
||||
log_post_value_size = Size(L"log_post_value_size", 80);
|
||||
log_env_variables = Bool(L"log_env_variables", false);
|
||||
log_env_http_variables = Bool(L"log_env_http_variables", false);
|
||||
log_whole_http_post = Bool(L"log_whole_http_post", false);
|
||||
log_http_answer_headers = Bool(L"log_http_answer_headers", false);
|
||||
|
||||
post_file_max = Size(L"post_file_max", 8388608); // 8 MB
|
||||
post_json_max = Size(L"post_json_max", 8388608); // 8 MB
|
||||
post_max_object_items = Size(L"post_max_object_items", 1024);
|
||||
post_max_table_items = Size(L"post_max_table_items", 4096);
|
||||
post_max_all_items = Size(L"post_max_all_items", 8192);
|
||||
post_max_nested_objects = Size(L"post_max_nested_objects", 32);
|
||||
|
||||
upload_dir = Text(L"upload_dir");
|
||||
common_dir = Text(L"common_dir");
|
||||
@@ -179,21 +180,39 @@ void Config::AssignValues(bool stdout_is_closed)
|
||||
image_quality = Int(L"image_quality", 92);
|
||||
convert_cmd = Text(L"convert_cmd", L"/usr/local/bin/convert");
|
||||
|
||||
templates_dir = Text(L"templates_dir");
|
||||
templates_dir_default = Text(L"templates_dir_default");
|
||||
txt_templates_dir = Text(L"txt_templates_dir");
|
||||
txt_templates_dir_default = Text(L"txt_templates_dir_default");
|
||||
ListText(L"html_templates_dirs", html_templates_dirs);
|
||||
ListText(L"txt_templates_dirs", txt_templates_dirs);
|
||||
|
||||
templates_fun_prefix = Text(L"templates_fun_prefix", L"fun_");
|
||||
templates_fun_postfix = Text(L"templates_fun_postfix", L".html");
|
||||
templates_index = Text(L"templates_index", L"index.html");
|
||||
templates_index_generic = Text(L"templates_index_generic", L"index_generic.html");
|
||||
templates_index_raw = Text(L"templates_index_raw", L"index_raw.html");
|
||||
templates_request_status = Text(L"templates_request_status", L"request_status.html");
|
||||
template_only_root_use_template_fun = Bool(L"template_only_root_use_template_fun", false);
|
||||
|
||||
http_session_id_name = Text(L"http_session_id_name", L"session_id");
|
||||
use_internal_session_mechanism = Bool(L"use_internal_session_mechanism", true);
|
||||
use_internal_loggin_mechanism = Bool(L"use_internal_loggin_mechanism", true);
|
||||
|
||||
session_cookie_name = Text(L"session_cookie_name", L"session_id");
|
||||
session_cookie_path = Text(L"session_cookie_path", L"/");
|
||||
session_cookie_domain = Text(L"session_cookie_domain", L"");
|
||||
session_cookie_same_site = Int(L"session_cookie_same_site", 0);
|
||||
session_cookie_http_only = Bool(L"session_cookie_http_only", false);
|
||||
session_cookie_secure = Bool(L"session_cookie_secure", false);
|
||||
|
||||
db_conn_string = Text(L"db_conn_string");
|
||||
db_host = Text(L"db_host");
|
||||
db_hostaddr = Text(L"db_hostaddr");
|
||||
db_port = Text(L"db_port");
|
||||
db_database = Text(L"db_database");
|
||||
db_user = Text(L"db_user");
|
||||
db_pass = Text(L"db_pass");
|
||||
db_postgresql_smaller_than_10 = Bool(L"db_postgresql_smaller_than_10", false);
|
||||
db_startup_connection_max_attempts = Size(L"db_startup_connection_max_attempts", 0);
|
||||
db_startup_connection_attempt_delay = Size(L"db_startup_connection_attempt_delay", 5);
|
||||
db_make_migration_if_needed = Bool(L"db_make_migration_if_needed", true);
|
||||
db_stop_if_migration_fails = Bool(L"db_stop_if_migration_fails", true);
|
||||
|
||||
|
||||
item_url_empty = Text(L"item_url_empty");
|
||||
|
||||
@@ -239,24 +258,24 @@ void Config::AssignValues(bool stdout_is_closed)
|
||||
compression_page_min_size = Size(L"compression_page_min_size", 512);
|
||||
compression_encoding = Int(L"compression_encoding", 20);
|
||||
|
||||
html_filter = Bool(L"html_filter", true);
|
||||
html_filter_trim_white = Bool(L"html_filter_trim_white", true);
|
||||
html_filter_break_word = Int(L"html_filter_break_word", 60);
|
||||
html_filter = Bool(L"html_filter", false);
|
||||
html_filter_white_char_mode = Int(L"html_filter_white_char_mode", 2);
|
||||
html_filter_wrap_line = Int(L"html_filter_wrap_line", 110);
|
||||
html_filter_tabs = Size(L"html_filter_tabs", 2);
|
||||
html_filter_orphans = Bool(L"html_filter_orphans", true);
|
||||
html_filter_orphans_mode_str = Text(L"html_filter_orphans_mode_str", L"nbsp");
|
||||
html_filter_nofilter_tag = Text(L"html_filter_nofilter_tag", L"nofilter");
|
||||
|
||||
locale_dir = Text(L"locale_dir");
|
||||
locale_dir_default = Text(L"locale_dir_default");
|
||||
ListText(L"locale_dirs", locale_dirs);
|
||||
locale_max_id = Size(L"locale_max_id", 100);
|
||||
locale_default_id = Size(L"locale_default_id", 0);
|
||||
ListText(L"locale_files", locale_files);
|
||||
|
||||
title_separator = Text(L"title_separator", L" / ");
|
||||
|
||||
http_header_send_file = Text(L"http_header_send_file", L"X-LIGHTTPD-send-file");
|
||||
send_file_mode = Int(L"send_file_mode", 0);
|
||||
send_file_header = Text(L"send_file_header", L"X-SENDFILE");
|
||||
send_file_relative_prefix = Text(L"send_file_relative_prefix", L"upload-files-internal");
|
||||
|
||||
editors_html_safe_mode = Bool(L"editors_html_safe_mode", true);
|
||||
editors_html_safe_mode_skip_root = Bool(L"editors_html_safe_mode_skip_root", true);
|
||||
@@ -287,8 +306,20 @@ void Config::AssignValues(bool stdout_is_closed)
|
||||
ezc_max_elements = Size(L"ezc_max_elements", 50000);
|
||||
ezc_max_loop_elements = Size(L"ezc_max_loop_elements", 5000);
|
||||
ezc_out_streams_size = Size(L"ezc_out_streams_size", 128);
|
||||
ezc_error_prefix = Text(L"ezc_error_prefix", L"<!-- ");
|
||||
ezc_error_postfix = Text(L"ezc_error_postfix", L" -->");
|
||||
request_frame_parameter = Text(L"request_frame_parameter", L"frame");
|
||||
request_all_frames_parameter = Text(L"request_all_frames_parameter", L"all_frames");
|
||||
request_main_stream_parameter = Text(L"request_main_stream_parameter", L"main_stream");
|
||||
|
||||
request_frame_parameter_max_length = Size(L"request_frame_parameter_max_length", 128);
|
||||
request_frame_parameter_max_frames = Size(L"request_frame_parameter_max_frames", 16);
|
||||
|
||||
xml_root = Text(L"xml_root", L"winix");
|
||||
bin_stream_field = Text(L"bin_stream_field", L"bin_stream");
|
||||
main_stream_field = Text(L"main_stream_field", L"main_stream");
|
||||
ezc_frames_field = Text(L"ezc_frames_field", L"ezc_frames");
|
||||
request_max_accept_fields = Size(L"request_max_accept_fields", 8);
|
||||
request_max_accept_language_fields = Size(L"request_max_accept_language_fields", 8);
|
||||
|
||||
|
||||
account_need_email_verification = Bool(L"account_need_email_verification", true);
|
||||
reset_password_code_expiration_time = Long(L"reset_password_code_expiration_time", 86400);
|
||||
@@ -313,12 +344,22 @@ void Config::AssignValues(bool stdout_is_closed)
|
||||
incorrect_login_cannot_login_delay = Size(L"incorrect_login_cannot_login_delay", 1800);
|
||||
|
||||
pid_file = Text(L"pid_file", L"");
|
||||
allow_ezc_out_in_executable_items = Bool(L"allow_ezc_out_in_executable_items", false);
|
||||
allow_ezc_frames_in_executable_items = Bool(L"allow_ezc_frames_in_executable_items", false);
|
||||
|
||||
check_proxy_ip_header = Bool(L"check_proxy_ip_header", false);
|
||||
proxy_ip_header = Text(L"proxy_ip_header", L"X_Real_IP");
|
||||
|
||||
use_antispam_mechanism_for_not_logged_users = Bool(L"use_antispam_mechanism_for_not_logged_users", true);
|
||||
antispam_list_max_size = Size(L"antispam_list_max_size", 10);
|
||||
add_header_cache_no_store_in_htmx_request = Bool(L"add_header_cache_no_store_in_htmx_request", true);
|
||||
|
||||
request_queue_job_limit = Size(L"request_queue_job_limit", 1024);
|
||||
|
||||
ListText(L"allowed_origins", allowed_origins);
|
||||
allow_all_origins = Bool(L"allow_all_origins", true);
|
||||
are_cors_preflight_requests_available = Bool(L"are_cors_preflight_requests_available", false);
|
||||
ListText(L"access_control_expose_headers", access_control_expose_headers);
|
||||
access_control_allow_credentials = Bool(L"access_control_allow_credentials", false);
|
||||
}
|
||||
|
||||
|
||||
@@ -381,150 +422,125 @@ void Config::CheckPasswd()
|
||||
|
||||
std::wstring Config::Text(const wchar_t * name)
|
||||
{
|
||||
return space.Text(name);
|
||||
return space.to_wstr(name);
|
||||
}
|
||||
|
||||
|
||||
std::wstring Config::Text(const wchar_t * name, const wchar_t * def)
|
||||
{
|
||||
return space.Text(name, def);
|
||||
return space.to_wstr(name, def);
|
||||
}
|
||||
|
||||
|
||||
std::wstring Config::Text(const std::wstring & name, const wchar_t * def)
|
||||
{
|
||||
return space.Text(name, def);
|
||||
}
|
||||
|
||||
|
||||
std::wstring & Config::TextRef(const wchar_t * name)
|
||||
{
|
||||
return space.TextRef(name);
|
||||
}
|
||||
|
||||
|
||||
std::wstring & Config::TextRef(const wchar_t * name, const wchar_t * def)
|
||||
{
|
||||
return space.TextRef(name, def);
|
||||
}
|
||||
|
||||
|
||||
std::wstring & Config::TextRef(const std::wstring & name, const wchar_t * def)
|
||||
{
|
||||
return space.TextRef(name, def);
|
||||
return space.to_wstr(name, def);
|
||||
}
|
||||
|
||||
|
||||
int Config::Int(const wchar_t * name)
|
||||
{
|
||||
return space.Int(name);
|
||||
return space.to_int(name);
|
||||
}
|
||||
|
||||
|
||||
int Config::Int(const wchar_t * name, int def)
|
||||
{
|
||||
return space.Int(name, def);
|
||||
return space.to_int(name, def);
|
||||
}
|
||||
|
||||
|
||||
int Config::Int(const std::wstring & name, int def)
|
||||
{
|
||||
return space.Int(name, def);
|
||||
return space.to_int(name, def);
|
||||
}
|
||||
|
||||
|
||||
long Config::Long(const wchar_t * name)
|
||||
{
|
||||
return space.Long(name);
|
||||
return space.to_long(name);
|
||||
}
|
||||
|
||||
long Config::Long(const wchar_t * name, long def)
|
||||
{
|
||||
return space.Long(name, def);
|
||||
return space.to_long(name, def);
|
||||
}
|
||||
|
||||
long Config::Long(const std::wstring & name, long def)
|
||||
{
|
||||
return space.Long(name, def);
|
||||
return space.to_long(name, def);
|
||||
}
|
||||
|
||||
|
||||
|
||||
size_t Config::Size(const wchar_t * name)
|
||||
{
|
||||
return space.Size(name);
|
||||
return space.to_ulong(name);
|
||||
}
|
||||
|
||||
|
||||
size_t Config::Size(const wchar_t * name, size_t def)
|
||||
{
|
||||
return space.Size(name, def);
|
||||
return space.to_ulong(name, def);
|
||||
}
|
||||
|
||||
|
||||
size_t Config::Size(const std::wstring & name, size_t def)
|
||||
{
|
||||
return space.Size(name, def);
|
||||
return space.to_ulong(name, def);
|
||||
}
|
||||
|
||||
|
||||
bool Config::Bool(const wchar_t * name)
|
||||
{
|
||||
return space.Bool(name);
|
||||
return space.to_bool(name);
|
||||
}
|
||||
|
||||
|
||||
bool Config::Bool(const wchar_t * name, bool def)
|
||||
{
|
||||
return space.Bool(name, def);
|
||||
return space.to_bool(name, def);
|
||||
}
|
||||
|
||||
|
||||
bool Config::Bool(const std::wstring & name, bool def)
|
||||
{
|
||||
return space.Bool(name, def);
|
||||
return space.to_bool(name, def);
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool Config::ListText(const wchar_t * name, std::vector<std::wstring> & list)
|
||||
{
|
||||
return space.ListText(name, list);
|
||||
return space.to_list(name, list);
|
||||
}
|
||||
|
||||
|
||||
bool Config::ListText(const std::wstring & name, std::vector<std::wstring> & list)
|
||||
{
|
||||
return space.ListText(name, list);
|
||||
return space.to_list(name, list);
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool Config::HasValue(const wchar_t * name, const wchar_t * value)
|
||||
{
|
||||
return space.HasValue(name, value);
|
||||
return space.has_value(name, value);
|
||||
}
|
||||
|
||||
bool Config::HasValue(const wchar_t * name, const std::wstring & value)
|
||||
{
|
||||
return space.HasValue(name, value);
|
||||
}
|
||||
|
||||
bool Config::HasValue(const std::wstring & name, const wchar_t * value)
|
||||
{
|
||||
return space.HasValue(name, value);
|
||||
}
|
||||
|
||||
bool Config::HasValue(const std::wstring & name, const std::wstring & value)
|
||||
{
|
||||
return space.HasValue(name, value);
|
||||
return space.has_value(name.c_str(), value.c_str());
|
||||
}
|
||||
|
||||
|
||||
void Config::Print(std::wostream & out)
|
||||
{
|
||||
space.Serialize(out);
|
||||
}
|
||||
|
||||
|
||||
//void Config::Print(std::wostream & out)
|
||||
//{
|
||||
// space.serialize_to_space_stream(out);
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
||||
+313
-59
@@ -4,8 +4,8 @@
|
||||
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008-2018, Tomasz Sowa
|
||||
/*
|
||||
* Copyright (c) 2008-2026, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -53,10 +53,6 @@ class Config
|
||||
{
|
||||
public:
|
||||
|
||||
// name of the config file
|
||||
// this is the parameter passed to winix programm
|
||||
std::wstring config_file;
|
||||
|
||||
// server mode
|
||||
// you can assign any string to it such as "production" "dev"
|
||||
// this value is not used by winix itself
|
||||
@@ -88,7 +84,8 @@ public:
|
||||
// the log level (how much info should be inserted to logs)
|
||||
// 1 - minimum
|
||||
// 2 - (default)
|
||||
// 3 - maximum - all logs
|
||||
// 3 - more logs
|
||||
// 4 - maximum - all logs
|
||||
int log_level;
|
||||
|
||||
// logging to stdout too
|
||||
@@ -97,7 +94,7 @@ public:
|
||||
bool log_stdout;
|
||||
|
||||
// how many requests should be saved in the same time
|
||||
// if you have a very busy server you can incrase this value
|
||||
// if you have a very busy server you can increase this value
|
||||
// default: 1
|
||||
int log_request;
|
||||
|
||||
@@ -134,11 +131,17 @@ public:
|
||||
std::wstring log_delimiter;
|
||||
|
||||
// log environment variables (fastcgi environment)
|
||||
// default: false;
|
||||
bool log_env_variables;
|
||||
|
||||
// log environment http variables (only HTTP_* variables from fastcgi environment)
|
||||
// default: false;
|
||||
bool log_env_http_variables;
|
||||
|
||||
// log the whole http post structure (in json format) after parsing the post input
|
||||
// default: false;
|
||||
bool log_whole_http_post;
|
||||
|
||||
// log headers (+cookies) which are returned to the client
|
||||
// this is what winix has generated -- the web server can change or add other headers
|
||||
// default: false
|
||||
@@ -147,16 +150,29 @@ public:
|
||||
// fast cgi: socket (unix domain)
|
||||
std::wstring fcgi_socket;
|
||||
|
||||
// fast cgi: whether to change chmod of the socket
|
||||
// default: true
|
||||
// if true then you should set fcgi_socket_chmod as well
|
||||
bool fcgi_set_socket_chmod;
|
||||
|
||||
// fast cgi: whether to change owner/group of the socket
|
||||
// default: true
|
||||
// if true then you should set fcgi_socket_user and fcgi_socket_group as well
|
||||
bool fcgi_set_socket_owner;
|
||||
|
||||
// fast cgi: socket permissions
|
||||
// taken into account if fcgi_set_socket_chmod is true
|
||||
// chmod and chown of the socket are set before winix drops privileges
|
||||
int fcgi_socket_chmod;
|
||||
|
||||
// fast cgi: owner of the socket
|
||||
// chmod and chown of the socket are set before winix drops privileges
|
||||
// taken into account if fcgi_set_socket_owner is true
|
||||
std::wstring fcgi_socket_user;
|
||||
|
||||
// fast cgi: group of the socket
|
||||
// chmod and chown of the socket are set before winix drops privileges
|
||||
// taken into account if fcgi_set_socket_owner is true
|
||||
std::wstring fcgi_socket_group;
|
||||
|
||||
// fcgi_socket_listen is the listen queue depth used in the listen() call
|
||||
@@ -164,11 +180,19 @@ public:
|
||||
// default: 100
|
||||
int fcgi_socket_listen;
|
||||
|
||||
std::wstring templates_dir;
|
||||
std::wstring templates_dir_default; // html templates from winix
|
||||
// in order to read a request we need to properly initialize a FastCGI structure by
|
||||
// using FCGX_InitRequest function, if FCGX_InitRequest fails then we wait fcgi_cannot_create_request_delay
|
||||
// seconds and trying again
|
||||
// default: 3
|
||||
size_t fcgi_cannot_create_request_delay;
|
||||
|
||||
std::wstring txt_templates_dir;
|
||||
std::wstring txt_templates_dir_default; // txt (notifications) templates from winix
|
||||
// html templates directories
|
||||
// by default a file from the last directory is chosen
|
||||
std::vector<std::wstring> html_templates_dirs;
|
||||
|
||||
// txt (notifications) templates directories
|
||||
// by default a file from the last directory is chosen
|
||||
std::vector<std::wstring> txt_templates_dirs;
|
||||
|
||||
// prefix and postfix for functions templates
|
||||
// default:
|
||||
@@ -181,26 +205,117 @@ public:
|
||||
// default: index.html
|
||||
std::wstring templates_index;
|
||||
|
||||
// html template used to send generic content - without site-css styles and markup (only uikit)
|
||||
// default: index_generic.html
|
||||
std::wstring templates_index_generic;
|
||||
|
||||
// html template used to send raw content
|
||||
// default: index_raw.html
|
||||
std::wstring templates_index_raw;
|
||||
|
||||
// html template used to show a http status such as Forbidden or Not Found
|
||||
// default: request_status.html
|
||||
std::wstring templates_request_status;
|
||||
|
||||
// if true then only root can use 'template' winix function
|
||||
// default: false
|
||||
bool template_only_root_use_template_fun;
|
||||
|
||||
// the database connection string
|
||||
// https://www.postgresql.org/docs/14/libpq-connect.html#LIBPQ-CONNSTRING
|
||||
// default: empty
|
||||
// if empty then winix uses db_host and db_hostaddr
|
||||
std::wstring db_conn_string;
|
||||
|
||||
// the database host name used if db_conn_string is empty
|
||||
// default: empty
|
||||
std::wstring db_host;
|
||||
|
||||
// the database host ip address used if db_conn_string is empty
|
||||
// default: empty
|
||||
// if db_host is empty and db_hostaddr is empty then winix connects to a Unix-domain socket
|
||||
// meaning of db_host and db_hostaddr parameters is the same as described in
|
||||
// https://www.postgresql.org/docs/14/libpq-connect.html#LIBPQ-CONNSTRING
|
||||
//
|
||||
// from above documentation:
|
||||
// Using hostaddr allows the application to avoid a host name look-up, which might be important
|
||||
// in applications with time constraints. However, a host name is required for GSSAPI or SSPI
|
||||
// authentication methods, as well as for verify-full SSL certificate verification.
|
||||
// The following rules are used:
|
||||
//
|
||||
// - If host is specified without hostaddr, a host name lookup occurs.
|
||||
//
|
||||
// - If hostaddr is specified without host, the value for hostaddr gives the server network address.
|
||||
// The connection attempt will fail if the authentication method requires a host name.
|
||||
//
|
||||
// - If both host and hostaddr are specified, the value for hostaddr gives the server network address.
|
||||
// The value for host is ignored unless the authentication method requires it, in which case it will
|
||||
// be used as the host name.
|
||||
std::wstring db_hostaddr;
|
||||
|
||||
// the database port number
|
||||
std::wstring db_port;
|
||||
|
||||
// the database name, user name and a password for the PostgreSQL database
|
||||
std::wstring db_database;
|
||||
std::wstring db_user;
|
||||
std::wstring db_pass;
|
||||
|
||||
// is the PostgreSQL later than 10
|
||||
// default false
|
||||
// if true then we are not using ROW() statements in sql query
|
||||
bool db_postgresql_smaller_than_10;
|
||||
// specify how many times we can try to connect to the database at startup
|
||||
// default 0 (infinite)
|
||||
size_t db_startup_connection_max_attempts;
|
||||
|
||||
// delay between each connection attempt at startup
|
||||
// default 5 (seconds)
|
||||
size_t db_startup_connection_attempt_delay;
|
||||
|
||||
// make database migration if needed
|
||||
bool db_make_migration_if_needed;
|
||||
|
||||
// if a migration fails then stop winix
|
||||
bool db_stop_if_migration_fails;
|
||||
|
||||
// use internal session mechanism
|
||||
// default: true
|
||||
// if false then we do not load/save and create internal sessions
|
||||
// but there always be the temporary session object for a request
|
||||
// also we do not load 'who' winix function
|
||||
bool use_internal_session_mechanism;
|
||||
|
||||
// use internal loggin mechanism
|
||||
// default: true
|
||||
// if false then we do not load 'login' and 'logout' winix functions
|
||||
// and the system will not allow to login through its api
|
||||
bool use_internal_loggin_mechanism;
|
||||
|
||||
// the name of the cookie which has the session identifier
|
||||
std::wstring http_session_id_name;
|
||||
std::wstring session_cookie_name;
|
||||
|
||||
// session cookie path
|
||||
// default: /
|
||||
std::wstring session_cookie_path;
|
||||
|
||||
// session cookie domain
|
||||
// if empty then the domain will be equal base_url
|
||||
// default: empty
|
||||
std::wstring session_cookie_domain;
|
||||
|
||||
// session cookie samesite attribute
|
||||
// 0 - dont set the attribute
|
||||
// 1 - Strict
|
||||
// 2 - Lax
|
||||
// 3 - None
|
||||
// (values the same as values from CookieSameSite enum)
|
||||
// default: 0
|
||||
int session_cookie_same_site;
|
||||
|
||||
// whether or not set HttpOnly attribute on the session cookie
|
||||
// default: false
|
||||
bool session_cookie_http_only;
|
||||
|
||||
// whether or not set Secure attribute on the session cookie
|
||||
// default: false
|
||||
bool session_cookie_secure;
|
||||
|
||||
// string used in a place where is a user (or group) selected
|
||||
// !! IMPROVE ME should be moved to locales
|
||||
@@ -303,15 +418,15 @@ public:
|
||||
std::vector<std::wstring> plugin_file;
|
||||
|
||||
// should the html code be cleaned by the html filter
|
||||
// default: false
|
||||
bool html_filter;
|
||||
|
||||
// should white characters be trimmed
|
||||
bool html_filter_trim_white;
|
||||
|
||||
// when long words should be broken (a space will be inserted)
|
||||
// default: after 60 non white characters there will be put a space
|
||||
// set zero to turn off
|
||||
size_t html_filter_break_word;
|
||||
// how white characters between html tags are treated
|
||||
// 0 - WHITE_MODE_ORIGIN - they are copied from input to output
|
||||
// 1 - WHITE_MODE_SINGLE_LINE - new line characters are removed
|
||||
// 2 - WHITE_MODE_TREE - try to create a tree (some kind of pretty printing)
|
||||
// default: 2
|
||||
int html_filter_white_char_mode;
|
||||
|
||||
// when long lines should be broken (a new line character will be inserted)
|
||||
// default: 110
|
||||
@@ -346,6 +461,35 @@ public:
|
||||
// 0 - not used
|
||||
size_t post_file_max;
|
||||
|
||||
// maximum length of the input stream when parsing it as json
|
||||
// default: 8388608 - 8MB
|
||||
// set zero to disable checking
|
||||
size_t post_json_max;
|
||||
|
||||
// maximum key/value pairs in one object when parsing post json structure
|
||||
// default: 1024
|
||||
// set zero to disable checking
|
||||
// each winix function can set its own limits
|
||||
size_t post_max_object_items;
|
||||
|
||||
// maximum items in one table when parsing post json structure
|
||||
// default: 4096
|
||||
// set zero to disable checking
|
||||
// each winix function can set its own limits
|
||||
size_t post_max_table_items;
|
||||
|
||||
// maximum items (key/values pairs of objects or table items) througout the whole post input json structure
|
||||
// default: 8192
|
||||
// set zero to disable checking
|
||||
// each winix function can set its own limits
|
||||
size_t post_max_all_items;
|
||||
|
||||
// maximum nested objects/tables when parsing post json structure
|
||||
// default: 32
|
||||
// set zero to disable checking
|
||||
// each winix function can set its own limits
|
||||
size_t post_max_nested_objects;
|
||||
|
||||
// directory for static files
|
||||
std::wstring upload_dir;
|
||||
|
||||
@@ -448,14 +592,15 @@ public:
|
||||
// default: /usr/local/bin/convert
|
||||
std::wstring convert_cmd;
|
||||
|
||||
// directory with locale files
|
||||
std::wstring locale_dir;
|
||||
|
||||
// directory with default locale files (those from winix)
|
||||
std::wstring locale_dir_default;
|
||||
// directories with locale files
|
||||
// we start reading locale from the first directory
|
||||
// and files with the same name in each directory are concatenated
|
||||
std::vector<std::wstring> locale_dirs;
|
||||
|
||||
// locale files (e.g. "en", "pl")
|
||||
// default: only one item: en
|
||||
// default: "en"
|
||||
// a locale file should define winix_locale_id integer parameter
|
||||
// and it should be smaller or equal to locale_max_id
|
||||
std::vector<std::wstring> locale_files;
|
||||
|
||||
// a maximum value of a locale identifier
|
||||
@@ -538,9 +683,39 @@ public:
|
||||
// separator used in <title> html tag
|
||||
std::wstring title_separator;
|
||||
|
||||
// http header recognized by www server as a file to send back
|
||||
// default: X-LIGHTTPD-send-file
|
||||
std::wstring http_header_send_file;
|
||||
// how to send static files (uploaded by users) to the webserver
|
||||
// 0 - winix will read the content of the file and send it back to the webserver
|
||||
// 1 - winix will use send_file_header header with a full path to the file
|
||||
// 2 - winix will use send_file_header header with a relative path to the file
|
||||
// default: 0
|
||||
// 0 can be be used with all webservers but it requires to copy the whole file content
|
||||
// you can omit copying the content with values 1 or 2:
|
||||
// for Apache set: 1
|
||||
// for Lighttpd set: 1
|
||||
// for Nginx set: 2
|
||||
int send_file_mode;
|
||||
|
||||
// http header recognized by www server as a file to send back, used if send_file_mode is 1 or 2
|
||||
// default: X-SENDFILE
|
||||
// for Apache set: X-SENDFILE (Apache needs an external module: https://tn123.org/mod_xsendfile/)
|
||||
// for Lighttpd set: X-LIGHTTPD-send-file (https://redmine.lighttpd.net/projects/1/wiki/X-LIGHTTPD-send-file)
|
||||
// for Nginx set: X-Accel-Redirect (https://nginx.org/en/docs/http/ngx_http_core_module.html#internal)
|
||||
std::wstring send_file_header;
|
||||
|
||||
// relative prefix used for sending static files if send_file_mode is 2
|
||||
// default: "upload-files-internal"
|
||||
// this prefix is added at the beginning of a relative file path e.g.
|
||||
// /upload-files-internal/simplefs/normal/some_directories/file.jpg
|
||||
//
|
||||
// in Nginx config file use 'location' with the prefix, e.g:
|
||||
// server {
|
||||
// .....
|
||||
// location /upload-files-internal/ {
|
||||
// alias /path/to/winix/upload/; # trailing slash at the end
|
||||
// internal;
|
||||
// }
|
||||
// }
|
||||
std::wstring send_file_relative_prefix;
|
||||
|
||||
// in editors (emacs, ckeditor,...) the html will be filtered and unsafe tags
|
||||
// will be dropped (script, frame, etc.)
|
||||
@@ -615,6 +790,7 @@ public:
|
||||
// 2 - application/xml - for XHTML 1.0 or for XHTML 1.1
|
||||
// default: 0
|
||||
// if utf8 is true then "; charset=UTF-8" will also be appended
|
||||
// may it would be better to set just the string here instead of integers?
|
||||
int content_type_header;
|
||||
|
||||
// global umask
|
||||
@@ -632,18 +808,56 @@ public:
|
||||
|
||||
// how many output streams do we have in Request class
|
||||
// those streams used in ajax responses
|
||||
// you can use no more [ezc out] statements than this limit
|
||||
// you can use no more [ezc frames] statements than this limit
|
||||
// default: 128
|
||||
size_t ezc_out_streams_size;
|
||||
|
||||
// prefix and postfix used when there is an error in Ezc patterns
|
||||
// default:
|
||||
// prefix: "<!-- "
|
||||
// postfix: " -->"
|
||||
std::wstring ezc_error_prefix;
|
||||
std::wstring ezc_error_postfix;
|
||||
// the name of the url parameter for returning a frame, e.g. https://domain.tld/mydir/myfunction/frame:foo
|
||||
// default: frame
|
||||
std::wstring request_frame_parameter;
|
||||
|
||||
// when true then when a user want to create a new account
|
||||
// the name of the url parameter for returning all frames, e.g. https://domain.tld/mydir/myfunction/all_frames
|
||||
// default: all_frames
|
||||
std::wstring request_all_frames_parameter;
|
||||
|
||||
// the name of the url parameter for returning the main ezc stream, e.g. https://domain.tld/mydir/myfunction/main_stream
|
||||
// default: main_stream
|
||||
std::wstring request_main_stream_parameter;
|
||||
|
||||
// max lenght of the url frame parameter
|
||||
// default: 128
|
||||
size_t request_frame_parameter_max_length;
|
||||
|
||||
// max number of frames in the frame url parameter (they are separated by a comma)
|
||||
// default: 16
|
||||
// if you need more frames you can use all_frames url parameter to return all frames
|
||||
size_t request_frame_parameter_max_frames;
|
||||
|
||||
// the name of the root element when serializing request answer to xml
|
||||
// default: winix
|
||||
std::wstring xml_root;
|
||||
|
||||
// the name of the field of the binary stream when serializing a request
|
||||
// default: bin_stream
|
||||
std::wstring bin_stream_field;
|
||||
|
||||
// the name of the field of the main ezc stream when serializing a request
|
||||
// default: main_stream
|
||||
std::wstring main_stream_field;
|
||||
|
||||
// the name of the field (object) of the ezc frames when serializing a request
|
||||
// default: ezc_frames
|
||||
std::wstring ezc_frames_field;
|
||||
|
||||
// max Accept header mime types to be parsed in a request
|
||||
// default: 8
|
||||
size_t request_max_accept_fields;
|
||||
|
||||
// max Accept-Language languages to be parsed in a request
|
||||
// default: 8
|
||||
size_t request_max_accept_language_fields;
|
||||
|
||||
// when true then when a user want to create a new account
|
||||
// he has to provide his email and a message will be sent back to him
|
||||
// with a link to activate the account
|
||||
// default: true
|
||||
@@ -752,10 +966,10 @@ public:
|
||||
// pid file is saved after winix has dropped privileges
|
||||
std::wstring pid_file;
|
||||
|
||||
// allow to use [ezc out] statement in executable items (used in 'run' winix function)
|
||||
// allow to use [ezc frame] statements in executable items (used in 'run' winix function)
|
||||
// default false
|
||||
// warning: if you enable this options a user can override a different output stream when using ajax
|
||||
bool allow_ezc_out_in_executable_items;
|
||||
bool allow_ezc_frames_in_executable_items;
|
||||
|
||||
|
||||
// check whether there is a 'log_proxy_ip_header' header
|
||||
@@ -767,7 +981,12 @@ public:
|
||||
// default: X_Real_IP
|
||||
std::wstring proxy_ip_header;
|
||||
|
||||
// antispam mechanizm
|
||||
// use an antispam mechanism for not logged users
|
||||
// when they try to add a new item
|
||||
// default: true
|
||||
bool use_antispam_mechanism_for_not_logged_users;
|
||||
|
||||
// antispam mechanism
|
||||
// size of an list for map: form_id to counter_id for anonymous users (each session has such an map)
|
||||
// this value allowes you to open the same or different html form in the browser more than once
|
||||
// and each form has its own form_id and counter_id
|
||||
@@ -775,8 +994,50 @@ public:
|
||||
size_t antispam_list_max_size;
|
||||
|
||||
|
||||
// send "Cache-Control: no-store, max-age=0" http header if a request is made by htmx library (ajax)
|
||||
// if a webbrowser get a page from the cache then it will render just the last request without the whole html page (css, js, etc)
|
||||
// https://github.com/bigskysoftware/htmx/issues/497
|
||||
bool add_header_cache_no_store_in_htmx_request;
|
||||
|
||||
// a limit for the queue for requests
|
||||
// when a request is scheduled to a job
|
||||
// default: 1024
|
||||
// if the limit is reached then the http status 503 Service Unavailable is returned
|
||||
size_t request_queue_job_limit;
|
||||
|
||||
// list of allowed origins in cors requests
|
||||
// can be set per controller in a method: virtual bool FunctionBase::IsOriginAvailable(const std::wstring & origin_url)
|
||||
// default: empty
|
||||
std::vector<std::wstring> allowed_origins;
|
||||
|
||||
// whether or not all origins are allowed if allowed_origins is empty
|
||||
// default: true
|
||||
// this is true by default because Origin header is sent not only in cors requests
|
||||
// (you can still allow it in your function/controller by overriding IsOriginAvailable(...) method)
|
||||
bool allow_all_origins;
|
||||
|
||||
// whether or not cors preflight requests are available
|
||||
// https://developer.mozilla.org/en-US/docs/Glossary/Preflight_request
|
||||
// default: false
|
||||
bool are_cors_preflight_requests_available;
|
||||
|
||||
// list of additional headers sent in Access-Control-Expose-Headers header
|
||||
// can be set per controller in a method: virtual void FunctionBase::AddAccessControlExposeHeadersHeader()
|
||||
// default: empty
|
||||
std::vector<std::wstring> access_control_expose_headers;
|
||||
|
||||
// if true return Access-Control-Allow-Credentials header equal "true"
|
||||
// whethert credentials (e.g. cookies, authorization headers) are available in cors requests
|
||||
// can be set per controller in a method: virtual bool FunctionBase::AreCorsCredentialsAvailable()
|
||||
// default: false
|
||||
bool access_control_allow_credentials;
|
||||
|
||||
|
||||
|
||||
Config();
|
||||
bool ReadConfig(bool errors_to_stdout_, bool stdout_is_closed = true);
|
||||
bool ReadConfig(const std::wstring & config_file);
|
||||
void AssignValuesFromSpace();
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
@@ -789,10 +1050,6 @@ public:
|
||||
std::wstring Text(const wchar_t * name, const wchar_t * def);
|
||||
std::wstring Text(const std::wstring & name, const wchar_t * def);
|
||||
|
||||
std::wstring & TextRef(const wchar_t * name);
|
||||
std::wstring & TextRef(const wchar_t * name, const wchar_t * def);
|
||||
std::wstring & TextRef(const std::wstring & name, const wchar_t * def);
|
||||
|
||||
int Int(const wchar_t *);
|
||||
int Int(const wchar_t * name, int def);
|
||||
int Int(const std::wstring & name, int def);
|
||||
@@ -808,30 +1065,27 @@ public:
|
||||
bool ListText(const wchar_t * name, std::vector<std::wstring> & list);
|
||||
bool ListText(const std::wstring & name, std::vector<std::wstring> & list);
|
||||
|
||||
bool HasValue(const wchar_t * name, const wchar_t * value);
|
||||
bool HasValue(const wchar_t * name, const std::wstring & value);
|
||||
bool HasValue(const std::wstring & name, const wchar_t * value);
|
||||
bool HasValue(const wchar_t * name, const wchar_t * value);
|
||||
bool HasValue(const std::wstring & name, const std::wstring & value);
|
||||
|
||||
// for debug
|
||||
void Print(std::wostream & out);
|
||||
//void Print(std::wostream & out);
|
||||
|
||||
// raw access to the config
|
||||
PT::Space space;
|
||||
pt::Space space;
|
||||
|
||||
|
||||
void SetFileLog(FileLog * file_log);
|
||||
void SetLogBuffer(PT::WTextStream * log_buffer);
|
||||
void SetLogBuffer(pt::WTextStream * log_buffer);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
PT::SpaceParser parser;
|
||||
bool errors_to_stdout;
|
||||
pt::SpaceParser parser;
|
||||
Log log;
|
||||
|
||||
void ShowError();
|
||||
void AssignValues(bool stdout_is_closed);
|
||||
void ShowError(const std::wstring & config_file);
|
||||
void AssignValues();
|
||||
void SetAdditionalVariables();
|
||||
void CheckPasswd();
|
||||
|
||||
|
||||
+32
-28
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2011-2018, Tomasz Sowa
|
||||
* Copyright (c) 2011-2021, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -78,7 +78,7 @@ bool Crypt::HashBin(int hash, const char * in, size_t inlen, std::string & out)
|
||||
|
||||
run.Clear();
|
||||
run.set_dependency(this);
|
||||
PT::WideToUTF8(config->opensll_path, command);
|
||||
pt::wide_to_utf8(config->opensll_path, command);
|
||||
run.Cmd(command);
|
||||
run.Par("dgst");
|
||||
run.Par("-binary");
|
||||
@@ -119,7 +119,7 @@ bool Crypt::HashBin(int hash, const std::string & in, std::string & out)
|
||||
|
||||
bool Crypt::HashBin(int hash, const wchar_t * in, size_t inlen, std::string & out)
|
||||
{
|
||||
PT::WideToUTF8(in, inlen, bufina);
|
||||
pt::wide_to_utf8(in, inlen, bufina);
|
||||
int res = HashBin(hash, bufina.c_str(), bufina.size(), out);
|
||||
bufina.clear();
|
||||
|
||||
@@ -211,7 +211,7 @@ bool Crypt::RSA(bool encrypt, const char * keypath, const char * in, size_t inle
|
||||
return false;
|
||||
|
||||
run.Clear();
|
||||
PT::WideToUTF8(config->opensll_path, command);
|
||||
pt::wide_to_utf8(config->opensll_path, command);
|
||||
run.Cmd(command);
|
||||
|
||||
run.Par("rsautl");
|
||||
@@ -243,7 +243,7 @@ bool Crypt::RSA(bool encrypt, const std::string & keypath, const std::string & i
|
||||
|
||||
bool Crypt::RSA(bool encrypt, const wchar_t * keypath, const char * in, size_t inlen, std::string & out)
|
||||
{
|
||||
PT::WideToUTF8(keypath, keypatha);
|
||||
pt::wide_to_utf8(keypath, keypatha);
|
||||
return RSA(encrypt, keypatha.c_str(), in, inlen, out);
|
||||
}
|
||||
|
||||
@@ -267,28 +267,28 @@ bool Crypt::RSA(bool encrypt, const std::wstring & keypath, const std::string &
|
||||
|
||||
|
||||
|
||||
bool Crypt::PassHash(const std::wstring & salt, UserPass & up)
|
||||
bool Crypt::PassHash(const std::wstring & salt, User & user)
|
||||
{
|
||||
bool result = true;
|
||||
up.pass_hash_salted = false;
|
||||
user.is_pass_hash_salted = false;
|
||||
|
||||
if( up.pass_type != WINIX_CRYPT_HASH_NONE )
|
||||
if( user.pass_type != WINIX_CRYPT_HASH_NONE )
|
||||
{
|
||||
pass_org = up.pass;
|
||||
pass_salted = up.pass;
|
||||
pass_org = user.password;
|
||||
pass_salted = user.password;
|
||||
pass_salted += salt;
|
||||
|
||||
if( HashHex(up.pass_type, pass_salted, up.pass) )
|
||||
if( HashHex(user.pass_type, pass_salted, user.password) )
|
||||
{
|
||||
if( !salt.empty() )
|
||||
up.pass_hash_salted = true;
|
||||
user.is_pass_hash_salted = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
log << log1 << "Crypt: problem with generating a hash, the password will not be hashed" << logend;
|
||||
|
||||
up.pass = pass_org;
|
||||
up.pass_type = WINIX_CRYPT_HASH_NONE;
|
||||
user.password = pass_org;
|
||||
user.pass_type = WINIX_CRYPT_HASH_NONE;
|
||||
result = false;
|
||||
}
|
||||
|
||||
@@ -301,22 +301,23 @@ return result;
|
||||
|
||||
|
||||
|
||||
bool Crypt::PassCrypt(const std::wstring & path_to_rsa_private_key, UserPass & up)
|
||||
bool Crypt::PassCrypt(const std::wstring & path_to_rsa_private_key, User & user)
|
||||
{
|
||||
bool result = false;
|
||||
ClearString(up.pass_encrypted);
|
||||
ClearString(user.pass_encrypted);
|
||||
|
||||
if( !path_to_rsa_private_key.empty() )
|
||||
{
|
||||
PT::WideToUTF8(up.pass, passa);
|
||||
pt::wide_to_utf8(user.password, passa);
|
||||
|
||||
if( RSA(true, path_to_rsa_private_key, passa, up.pass_encrypted) )
|
||||
if( RSA(true, path_to_rsa_private_key, passa, user.pass_encrypted) )
|
||||
{
|
||||
ClearString(user.password);
|
||||
result = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ClearString(up.pass_encrypted);
|
||||
ClearString(user.pass_encrypted);
|
||||
log << log1 << "AddUser: problem with encrypting, the password will not be encrypted!" << logend;
|
||||
}
|
||||
|
||||
@@ -327,27 +328,30 @@ return result;
|
||||
}
|
||||
|
||||
|
||||
void Crypt::PassHashCrypt(const std::wstring & salt, const std::wstring & path_to_rsa_private_key, UserPass & up)
|
||||
void Crypt::PassHashCrypt(const std::wstring & salt, const std::wstring & path_to_rsa_private_key, User & user)
|
||||
{
|
||||
PassHash(salt, up);
|
||||
PassCrypt(path_to_rsa_private_key, up);
|
||||
PassHash(salt, user);
|
||||
PassCrypt(path_to_rsa_private_key, user);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Crypt::PassHashCrypt(UserPass & up)
|
||||
/*
|
||||
* we hashing user.password, may it would be better to get the password as a seperate argument?
|
||||
*/
|
||||
void Crypt::PassHashCrypt(User & user)
|
||||
{
|
||||
up.pass_type = config->pass_type;
|
||||
user.pass_type = config->pass_type;
|
||||
ClearString(user.pass_encrypted);
|
||||
empty.clear();
|
||||
|
||||
if( config->pass_hash_use_salt && !config->pass_hash_salt.empty() )
|
||||
PassHash(config->pass_hash_salt, up);
|
||||
PassHash(config->pass_hash_salt, user);
|
||||
else
|
||||
PassHash(empty, up);
|
||||
PassHash(empty, user);
|
||||
|
||||
|
||||
if( config->pass_use_rsa && !config->pass_rsa_private_key.empty() )
|
||||
PassCrypt(config->pass_rsa_private_key, up);
|
||||
PassCrypt(config->pass_rsa_private_key, user);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+6
-6
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2011-2014, Tomasz Sowa
|
||||
* Copyright (c) 2011-2021, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -38,7 +38,7 @@
|
||||
#include <string>
|
||||
#include "run.h"
|
||||
#include "config.h"
|
||||
#include "user.h"
|
||||
#include "models/user.h"
|
||||
#include "winixbase.h"
|
||||
|
||||
|
||||
@@ -177,7 +177,7 @@ public:
|
||||
if there is a problem with generating a hash the method stores a plain text password
|
||||
and changes up.pass_type to zero (plain text passwords are not salted)
|
||||
*/
|
||||
bool PassHash(const std::wstring & salt, UserPass & up);
|
||||
bool PassHash(const std::wstring & salt, User & user);
|
||||
|
||||
|
||||
/*
|
||||
@@ -195,7 +195,7 @@ public:
|
||||
if there is a problem (or the path to the key is empty) then up.pass_encrypted will be empty
|
||||
and the method returns false
|
||||
*/
|
||||
bool PassCrypt(const std::wstring & path_to_rsa_private_key, UserPass & up);
|
||||
bool PassCrypt(const std::wstring & path_to_rsa_private_key, User & user);
|
||||
|
||||
|
||||
/*
|
||||
@@ -217,7 +217,7 @@ public:
|
||||
up.pass_encrypted - encrypted password (if not empty)
|
||||
|
||||
*/
|
||||
void PassHashCrypt(const std::wstring & salt, const std::wstring & path_to_rsa_private_key, UserPass & up);
|
||||
void PassHashCrypt(const std::wstring & salt, const std::wstring & path_to_rsa_private_key, User & user);
|
||||
|
||||
|
||||
/*
|
||||
@@ -232,7 +232,7 @@ public:
|
||||
up.pass_hash_salted - true if the hash is salted (plain text are never salted)
|
||||
up.pass_encrypted - encrypted password (if not empty)
|
||||
*/
|
||||
void PassHashCrypt(UserPass & up);
|
||||
void PassHashCrypt(User & user);
|
||||
|
||||
|
||||
/*
|
||||
|
||||
+9
-1
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2010-2014, Tomasz Sowa
|
||||
* Copyright (c) 2010-2022, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -56,6 +56,14 @@ struct Cur
|
||||
|
||||
// those pointers are never null, if there is no a session for the user
|
||||
// the 'session' pointer pointers at a special temporary session
|
||||
|
||||
Cur()
|
||||
{
|
||||
request = nullptr;
|
||||
session = nullptr;
|
||||
mount = nullptr;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -81,13 +81,13 @@ return var_iter;
|
||||
}
|
||||
|
||||
|
||||
DirContainer::Iterator DirContainer::Begin()
|
||||
DirContainer::ConstIterator DirContainer::Begin() const
|
||||
{
|
||||
return table.begin();
|
||||
}
|
||||
|
||||
|
||||
DirContainer::Iterator DirContainer::End()
|
||||
DirContainer::ConstIterator DirContainer::End() const
|
||||
{
|
||||
return table.end();
|
||||
}
|
||||
@@ -255,6 +255,17 @@ return i->second;
|
||||
}
|
||||
|
||||
|
||||
DirContainer::ConstIterator DirContainer::FindId(long id) const
|
||||
{
|
||||
TableId::const_iterator i = table_id.find(id);
|
||||
|
||||
if( i == table_id.end() )
|
||||
return table.end();
|
||||
|
||||
return i->second;
|
||||
}
|
||||
|
||||
|
||||
|
||||
DirContainer::ParentIterator DirContainer::ParentBegin()
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008-2014, Tomasz Sowa
|
||||
* Copyright (c) 2008-2021, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -37,8 +37,8 @@
|
||||
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include "item.h"
|
||||
#include "winixbase.h"
|
||||
#include "models/item.h"
|
||||
|
||||
|
||||
namespace Winix
|
||||
@@ -52,6 +52,7 @@ class DirContainer : public WinixBase
|
||||
public:
|
||||
typedef std::list<Item> Table;
|
||||
typedef Table::iterator Iterator;
|
||||
typedef Table::const_iterator ConstIterator;
|
||||
typedef Table::size_type SizeType;
|
||||
|
||||
typedef std::map<long, Iterator> TableId;
|
||||
@@ -66,8 +67,8 @@ public:
|
||||
Iterator GetEtc();
|
||||
Iterator GetVar();
|
||||
|
||||
Iterator Begin();
|
||||
Iterator End();
|
||||
ConstIterator Begin() const;
|
||||
ConstIterator End() const;
|
||||
SizeType Size();
|
||||
bool Empty();
|
||||
Iterator PushBack(const Item & item);
|
||||
@@ -75,6 +76,7 @@ public:
|
||||
void Clear();
|
||||
|
||||
Iterator FindId(long id);
|
||||
ConstIterator FindId(long id) const;
|
||||
|
||||
bool DelById(long id);
|
||||
|
||||
|
||||
+52
-32
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008-2018, Tomasz Sowa
|
||||
* Copyright (c) 2008-2024, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -31,7 +31,8 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <ctime>
|
||||
#include "dirs.h"
|
||||
#include "error.h"
|
||||
#include "notify/notify.h"
|
||||
@@ -41,13 +42,6 @@ namespace Winix
|
||||
{
|
||||
|
||||
|
||||
|
||||
void Dirs::SetDb(Db * pdb)
|
||||
{
|
||||
db = pdb;
|
||||
}
|
||||
|
||||
|
||||
void Dirs::SetCur(Cur * pcur)
|
||||
{
|
||||
cur = pcur;
|
||||
@@ -60,9 +54,9 @@ void Dirs::SetNotify(Notify * pnotify)
|
||||
}
|
||||
|
||||
|
||||
void Dirs::set_dependency(WinixModel * winix_model)
|
||||
void Dirs::set_dependency(WinixModelDeprecated * winix_model)
|
||||
{
|
||||
WinixModel::set_dependency(winix_model);
|
||||
WinixModelDeprecated::set_dependency(winix_model);
|
||||
dir_tab.set_dependency(winix_model);
|
||||
}
|
||||
|
||||
@@ -76,7 +70,7 @@ void Dirs::Clear()
|
||||
bool Dirs::HasReadExecAccessForRoot(const Item & item)
|
||||
{
|
||||
// there must be at least one 'x' (for the root)
|
||||
return (item.privileges & 01111) != 0;
|
||||
return (item.item_content.privileges & 01111) != 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -88,28 +82,32 @@ void Dirs::CheckRootDir()
|
||||
{
|
||||
if( !HasReadExecAccessForRoot(*i) )
|
||||
{
|
||||
i->privileges = 07555;
|
||||
i->item_content.privileges = 07555;
|
||||
log << log1 << "Dirs: there is no access for a root (admin) to the root dir, setting 07555 for the root directory" << logend;
|
||||
db->EditPrivById(*i, i->id);
|
||||
i->item_content.set_connector(model_connector);
|
||||
i->item_content.date_modification = std::time(nullptr);
|
||||
i->item_content.save(false);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
log << log1 << "Dirs: there is no a root directory in the database (creating one)" << logend;
|
||||
|
||||
Item root;
|
||||
ItemModelData item_data;
|
||||
item_data.prepare_unique_url = false;
|
||||
|
||||
Item root;
|
||||
root.set_connector(model_connector);
|
||||
root.type = Item::dir;
|
||||
root.parent_id = -1;
|
||||
root.user_id = -1;
|
||||
root.group_id = -1;
|
||||
root.privileges = 07555;
|
||||
root.item_content.user_id = -1;
|
||||
root.item_content.group_id = -1;
|
||||
root.item_content.privileges = 07555;
|
||||
root.item_content.date_creation = std::time(nullptr);
|
||||
root.item_content.date_modification = root.item_content.date_creation;
|
||||
|
||||
// !! upewnic sie ze baza nie zmieni url (gdyby wczesniej juz byl w bazie pusty url)
|
||||
// !! zrobic jakis wyjatek do wprowadzania roota?
|
||||
if( db->AddItem(root) == WINIX_ERR_OK )
|
||||
if( root.insert(item_data) )
|
||||
{
|
||||
dir_tab.PushBack(root);
|
||||
}
|
||||
@@ -122,7 +120,15 @@ void Dirs::ReadDirs()
|
||||
{
|
||||
Clear();
|
||||
|
||||
db->GetDirs(dir_tab);
|
||||
//db->GetDirs(dir_tab);
|
||||
morm::Finder<Item> finder(model_connector);
|
||||
std::list<Item> all_dirs = finder.select().where().eq(L"type", static_cast<int>(Item::Type::dir)).get_list();
|
||||
|
||||
for(Item & item : all_dirs)
|
||||
{
|
||||
dir_tab.PushBack(item);
|
||||
}
|
||||
|
||||
CheckRootDir();
|
||||
dir_tab.FindSpecialFolders();
|
||||
}
|
||||
@@ -443,9 +449,20 @@ Item * Dirs::GetDir(long id)
|
||||
DirContainer::Iterator i = dir_tab.FindId(id);
|
||||
|
||||
if( i == dir_tab.End() )
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
return &(*i);
|
||||
return &(*i);
|
||||
}
|
||||
|
||||
|
||||
const Item * Dirs::GetDir(long id) const
|
||||
{
|
||||
DirContainer::ConstIterator i = dir_tab.FindId(id);
|
||||
|
||||
if( i == dir_tab.End() )
|
||||
return nullptr;
|
||||
|
||||
return &(*i);
|
||||
}
|
||||
|
||||
|
||||
@@ -723,17 +740,19 @@ bool Dirs::DelDir(long dir_id)
|
||||
}
|
||||
|
||||
|
||||
Error Dirs::AddDirectory(Item & item, bool add_to_dir_tab, Item ** pdir, int notify_code)
|
||||
bool Dirs::AddDirectory(Item & item, bool add_to_dir_tab, Item ** pdir, int notify_code)
|
||||
{
|
||||
if( pdir )
|
||||
*pdir = 0;
|
||||
|
||||
if( item.type != Item::dir )
|
||||
return WINIX_ERR_DIR_EXPECTED;
|
||||
return false;
|
||||
|
||||
Error status = db->AddItem(item);
|
||||
//Error status = db->AddItem(item);
|
||||
//item.set_connector(model_connector);
|
||||
bool status = item.insert();
|
||||
|
||||
if( status == WINIX_ERR_OK )
|
||||
if( status )
|
||||
{
|
||||
Item * d = AddDir(item);
|
||||
|
||||
@@ -764,10 +783,11 @@ Item * Dirs::CreateVarDir()
|
||||
|
||||
if( root )
|
||||
{
|
||||
v.set_connector(root->get_connector());
|
||||
v.parent_id = root->id;
|
||||
v.user_id = root->user_id;
|
||||
v.group_id = root->group_id;
|
||||
v.privileges = root->privileges;
|
||||
v.item_content.user_id = root->item_content.user_id;
|
||||
v.item_content.group_id = root->item_content.group_id;
|
||||
v.item_content.privileges = root->item_content.privileges;
|
||||
v.subject = L"var";
|
||||
v.url = L"var";
|
||||
v.type = Item::dir;
|
||||
|
||||
+8
-10
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008-2018, Tomasz Sowa
|
||||
* Copyright (c) 2008-2024, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -39,12 +39,10 @@
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
#include "item.h"
|
||||
#include "dircontainer.h"
|
||||
#include "db/db.h"
|
||||
#include "request.h"
|
||||
#include "winixmodel.h"
|
||||
#include "models/item.h"
|
||||
#include "winixmodeldeprecated.h"
|
||||
|
||||
|
||||
|
||||
@@ -58,7 +56,7 @@ class Notify;
|
||||
// (we will support '..' in the future)
|
||||
|
||||
|
||||
class Dirs : public WinixModel
|
||||
class Dirs : public WinixModelDeprecated
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -66,10 +64,9 @@ public:
|
||||
void ReadDirs();
|
||||
|
||||
void SetCur(Cur * pcur);
|
||||
void SetDb(Db * pdb);
|
||||
void SetNotify(Notify * pnotify);
|
||||
|
||||
void set_dependency(WinixModel * winix_model);
|
||||
void set_dependency(WinixModelDeprecated * winix_model);
|
||||
|
||||
// these methods return false if there is no such a dir
|
||||
bool IsDir(long dir_id);
|
||||
@@ -110,12 +107,14 @@ public:
|
||||
Item * GetDir(long id);
|
||||
Item * AddDir(const Item & item);
|
||||
|
||||
const Item * GetDir(long id) const;
|
||||
|
||||
void CheckRootDir();
|
||||
|
||||
Item * CreateVarDir();
|
||||
|
||||
// !! jak juz wczesniejsze nazwy beda zmienione to tutaj damy AddDir() /AddDir() juz istnieje przeciez?/
|
||||
Error AddDirectory(Item & item, bool add_to_dir_tab = false, Item ** pdir = 0, int notify_code = 0);
|
||||
bool AddDirectory(Item & item, bool add_to_dir_tab = false, Item ** pdir = 0, int notify_code = 0);
|
||||
|
||||
// returns how many levels of directories there are
|
||||
// "/" -> 0 (root dir)
|
||||
@@ -129,7 +128,6 @@ public:
|
||||
private:
|
||||
|
||||
Cur * cur;
|
||||
Db * db;
|
||||
Notify * notify;
|
||||
|
||||
DirContainer dir_tab;
|
||||
|
||||
+26
-14
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2018, Tomasz Sowa
|
||||
* Copyright (c) 2018-2022, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -37,7 +37,7 @@
|
||||
#include <string.h>
|
||||
#include "utf8/utf8.h"
|
||||
#include "timezones.h"
|
||||
|
||||
#include "plugin.h"
|
||||
|
||||
|
||||
namespace Winix
|
||||
@@ -49,6 +49,7 @@ FileLog::FileLog()
|
||||
{
|
||||
time_zones = nullptr;
|
||||
synchro = nullptr;
|
||||
plugin = nullptr;
|
||||
log_time_zone_id = 0;
|
||||
}
|
||||
|
||||
@@ -64,9 +65,15 @@ void FileLog::set_synchro(Synchro * synchro)
|
||||
}
|
||||
|
||||
|
||||
void FileLog::set_plugin(Plugin * plugin)
|
||||
{
|
||||
this->plugin = plugin;
|
||||
}
|
||||
|
||||
|
||||
void FileLog::init(const std::wstring & log_file, bool log_stdout, int log_level, bool save_each_line, size_t log_time_zone_id)
|
||||
{
|
||||
PT::FileLog::init(log_file, log_stdout, log_level, save_each_line);
|
||||
pt::FileLog::init(log_file, log_stdout, log_level, save_each_line);
|
||||
this->log_time_zone_id = log_time_zone_id;
|
||||
}
|
||||
|
||||
@@ -91,15 +98,16 @@ bool FileLog::should_save_each_line()
|
||||
|
||||
|
||||
|
||||
PT::Date FileLog::get_local_date(const PT::Date & date)
|
||||
pt::Date FileLog::get_local_date(const pt::Date & date)
|
||||
{
|
||||
if( time_zones )
|
||||
{
|
||||
Lock lock(synchro);
|
||||
TimeZone * tz = time_zones->GetZone(log_time_zone_id);
|
||||
|
||||
if( tz )
|
||||