Compare commits
981 Commits
refactor/a
...
feat/githu
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
02961e60e9 | ||
|
|
312e0296bd | ||
|
|
0a6e7c794b | ||
|
|
c60d5544e9 | ||
|
|
d52b1e13ec | ||
|
|
05668443fc | ||
|
|
b495a16a0a | ||
|
|
c6fa1a7258 | ||
|
|
c3bb7c8d17 | ||
|
|
530e32f1a1 | ||
|
|
d8f364aa58 | ||
|
|
40f33fd2f2 | ||
|
|
c632054716 | ||
|
|
38c1f77326 | ||
|
|
f74004d954 | ||
|
|
7eaf4f2de3 | ||
|
|
73458d38ca | ||
|
|
e6eef5a03d | ||
|
|
e20f429ae4 | ||
|
|
434d05bcd9 | ||
|
|
1ea5104aee | ||
|
|
e18a46acfa | ||
|
|
fcf25b2a2a | ||
|
|
624cef1e8c | ||
|
|
9b7f1e36e0 | ||
|
|
6963037ba0 | ||
|
|
2642053096 | ||
|
|
1da98683f3 | ||
|
|
ed4c7c0a04 | ||
|
|
05870cc6c7 | ||
|
|
7a66c5315d | ||
|
|
68e56325b6 | ||
|
|
140db8e274 | ||
|
|
8c3643b691 | ||
|
|
cef5797419 | ||
|
|
8535c53289 | ||
|
|
aa032b5790 | ||
|
|
b49a495f78 | ||
|
|
970e45209a | ||
|
|
edbf4aefda | ||
|
|
87ea4fe357 | ||
|
|
694572694d | ||
|
|
8b90bd7968 | ||
|
|
22221cce21 | ||
|
|
f93f7979e1 | ||
|
|
b3d991070e | ||
|
|
df9791e5d9 | ||
|
|
4921fb7558 | ||
|
|
dadbfd92d0 | ||
|
|
25e9e0d745 | ||
|
|
44a0b20c49 | ||
|
|
7d8cb51689 | ||
|
|
f10eb36229 | ||
|
|
5a303d9c34 | ||
|
|
4473a45e63 | ||
|
|
48f9188fb4 | ||
|
|
f761605bfc | ||
|
|
2ba2db3c5a | ||
|
|
ff8ba97918 | ||
|
|
17f01726b4 | ||
|
|
1b8911f550 | ||
|
|
9f5e502d42 | ||
|
|
1f49d6363d | ||
|
|
1e55c956b7 | ||
|
|
e97b54173b | ||
|
|
496af0800f | ||
|
|
34d0a637cf | ||
|
|
43c5306ba4 | ||
|
|
718de46ac7 | ||
|
|
b8df114b73 | ||
|
|
fb560915d5 | ||
|
|
994be62578 | ||
|
|
41a87e3806 | ||
|
|
78545b8dfe | ||
|
|
e7bff44fe1 | ||
|
|
a530b93b5f | ||
|
|
fd9c0d3f6e | ||
|
|
e4e22d3c51 | ||
|
|
a50c00ea8f | ||
|
|
a0608eb314 | ||
|
|
a340d515ad | ||
|
|
7891ba2c8d | ||
|
|
6c61e42d9b | ||
|
|
11cc3b04b9 | ||
|
|
6b63576798 | ||
|
|
c2f71bd49b | ||
|
|
7071432e6c | ||
|
|
c6a9378dbf | ||
|
|
57fbe81be1 | ||
|
|
b6ba67b2b8 | ||
|
|
20b6cea436 | ||
|
|
e3d1359626 | ||
|
|
4b7cc9dc1e | ||
|
|
b2d06dd24d | ||
|
|
002bf0ab02 | ||
|
|
2baf567120 | ||
|
|
44aa11eccc | ||
|
|
3c50d37ddd | ||
|
|
860bd8f155 | ||
|
|
89213dfbff | ||
|
|
265c1b4ffe | ||
|
|
112db812fb | ||
|
|
aec6c0c070 | ||
|
|
ad6ba8f81c | ||
|
|
f20c839af5 | ||
|
|
0aae618a29 | ||
|
|
2bc9796c0c | ||
|
|
37aff29443 | ||
|
|
bc14fcb0dd | ||
|
|
3f858de1f3 | ||
|
|
a624ffc461 | ||
|
|
a0c90d4d8d | ||
|
|
b4c8112322 | ||
|
|
b59fdc8db8 | ||
|
|
f6f458a660 | ||
|
|
9ad82247db | ||
|
|
ef09a3ef12 | ||
|
|
fa7f04c55b | ||
|
|
5252f67faf | ||
|
|
01ffe4886e | ||
|
|
5bce745838 | ||
|
|
6b0e1ef9ac | ||
|
|
4ff0343916 | ||
|
|
ec7720e3d0 | ||
|
|
37a8e5b0d9 | ||
|
|
8bfb223dac | ||
|
|
adf18f00af | ||
|
|
6d72bb6e24 | ||
|
|
07669bc806 | ||
|
|
a586c526a0 | ||
|
|
5e66b9bfc8 | ||
|
|
c587b11904 | ||
|
|
550353f9f9 | ||
|
|
ce00d41141 | ||
|
|
973582a52e | ||
|
|
a36c8f7644 | ||
|
|
b7561c5b17 | ||
|
|
b5cf46ddd0 | ||
|
|
e295c1a830 | ||
|
|
5003df7cf8 | ||
|
|
35e1af29cd | ||
|
|
357353e23c | ||
|
|
fbd42db377 | ||
|
|
80c1b50254 | ||
|
|
3e3aad1569 | ||
|
|
3a18ab2970 | ||
|
|
0d8c150c21 | ||
|
|
55a6c41216 | ||
|
|
a4a8bf644d | ||
|
|
f4cc72a44b | ||
|
|
114bd8d2d0 | ||
|
|
d04838b846 | ||
|
|
063c8d54ef | ||
|
|
f815d850e6 | ||
|
|
b5eb2a004f | ||
|
|
fa51662273 | ||
|
|
ab484ffdc4 | ||
|
|
3efe3cc698 | ||
|
|
9f242800e8 | ||
|
|
c170147162 | ||
|
|
9eaa4a4afa | ||
|
|
14e546b4c3 | ||
|
|
4ae002e1bb | ||
|
|
8cc725f3e8 | ||
|
|
718d2d07fa | ||
|
|
f5dea882d0 | ||
|
|
98ecb301b4 | ||
|
|
54dcd2736a | ||
|
|
d2e5001e7e | ||
|
|
d6572b2c7e | ||
|
|
3e5b6dd4fb | ||
|
|
ccfcbd830d | ||
|
|
895a22fcfe | ||
|
|
ff41a13170 | ||
|
|
c9744cb5f0 | ||
|
|
d1a60aa1bb | ||
|
|
d1b581a3f5 | ||
|
|
3d862ec61b | ||
|
|
198043b865 | ||
|
|
2dbd8fc83a | ||
|
|
fd53a3e516 | ||
|
|
1a40aa3fae | ||
|
|
268cfebd13 | ||
|
|
f4572f9f94 | ||
|
|
90d3c140fe | ||
|
|
f2ca2e48aa | ||
|
|
4f1ef65a9c | ||
|
|
1b2cc439f2 | ||
|
|
33bca2e82a | ||
|
|
6d9b12eff6 | ||
|
|
d6a65ec5db | ||
|
|
825f3afe3f | ||
|
|
229d280724 | ||
|
|
7f9c5c0b8c | ||
|
|
ed407de99c | ||
|
|
34d8a26c0a | ||
|
|
7ef398bd54 | ||
|
|
60d58bf93e | ||
|
|
47aa717a4d | ||
|
|
ea5ae36654 | ||
|
|
7c58f1d493 | ||
|
|
ba9c282d96 | ||
|
|
b704c9a941 | ||
|
|
0e2e1222a9 | ||
|
|
b1ecfd8304 | ||
|
|
327115b003 | ||
|
|
4fff19a738 | ||
|
|
624b9834b0 | ||
|
|
c0b3ea28ea | ||
|
|
6ec82116b7 | ||
|
|
1fc47ab475 | ||
|
|
3286bf6164 | ||
|
|
f72d36c67b | ||
|
|
d03a5cfc2c | ||
|
|
77ccb26512 | ||
|
|
f078e19ce1 | ||
|
|
0d8103777c | ||
|
|
1640f99668 | ||
|
|
83412902fb | ||
|
|
742898c624 | ||
|
|
9e8009299c | ||
|
|
bed66f2c7b | ||
|
|
ce4e8692a7 | ||
|
|
67cb180ba8 | ||
|
|
09baaf2c20 | ||
|
|
1102d933c8 | ||
|
|
b3f7af41ef | ||
|
|
b70e1ef492 | ||
|
|
3532b4483e | ||
|
|
ac43a1d5c9 | ||
|
|
325ca10c70 | ||
|
|
8cc7fe3e33 | ||
|
|
39f09a4142 | ||
|
|
9e3fd79b89 | ||
|
|
11b64cae3a | ||
|
|
0f14c11e3d | ||
|
|
e1c9705ff2 | ||
|
|
8c45959ea6 | ||
|
|
655e03f815 | ||
|
|
47f912e998 | ||
|
|
6c19c1ccbd | ||
|
|
ef458b41fd | ||
|
|
f9a216ed2f | ||
|
|
063e44a8b8 | ||
|
|
065c09b9d6 | ||
|
|
e8eda19c02 | ||
|
|
66cde22297 | ||
|
|
f89d71d5c1 | ||
|
|
41e6c76d56 | ||
|
|
33cb6ef8eb | ||
|
|
2e05ebb696 | ||
|
|
f62162317e | ||
|
|
442c4218d4 | ||
|
|
42e4e0223d | ||
|
|
3fa6e72604 | ||
|
|
10dd024bcf | ||
|
|
8c245946a6 | ||
|
|
c8b32ba265 | ||
|
|
ca557d7000 | ||
|
|
23e60d386c | ||
|
|
cc15014b9c | ||
|
|
d4d392819e | ||
|
|
1bf5a67c87 | ||
|
|
53df9b4e4d | ||
|
|
c6d332d625 | ||
|
|
3b08454352 | ||
|
|
6240ca54ed | ||
|
|
6c4d5951ae | ||
|
|
1652647f17 | ||
|
|
7c57454c1b | ||
|
|
78f6ca6fa8 | ||
|
|
d44a5f8257 | ||
|
|
f76a8627cc | ||
|
|
84bee958ce | ||
|
|
d4d809dd45 | ||
|
|
5b7029ca76 | ||
|
|
9855f565ab | ||
|
|
4d0304b804 | ||
|
|
ccd6fbef29 | ||
|
|
de61d407f6 | ||
|
|
106bba6679 | ||
|
|
303e0dd036 | ||
|
|
fff1e5d7ff | ||
|
|
33823e1c81 | ||
|
|
321347fa6b | ||
|
|
fa355d48bc | ||
|
|
c413b14df3 | ||
|
|
fc69d98d22 | ||
|
|
43dd9b5250 | ||
|
|
62bac0c6b9 | ||
|
|
92ffafb769 | ||
|
|
8c9cec989a | ||
|
|
b727e1d152 | ||
|
|
c69b810619 | ||
|
|
295743e448 | ||
|
|
297f1612fe | ||
|
|
49c5b3dff5 | ||
|
|
4629705d17 | ||
|
|
2dec6372e0 | ||
|
|
37fe1c97ea | ||
|
|
f3b02fbc98 | ||
|
|
8254c5b0fd | ||
|
|
b6f2df28b3 | ||
|
|
f7d30de263 | ||
|
|
e2c43fc437 | ||
|
|
22ff69e89a | ||
|
|
993ddae3bd | ||
|
|
e5813e6430 | ||
|
|
cda4a9b498 | ||
|
|
3e4ad00c20 | ||
|
|
86fc8a87fd | ||
|
|
fed45e98b1 | ||
|
|
3edd84f137 | ||
|
|
b79e3e7516 | ||
|
|
b05332fd04 | ||
|
|
15cde5284b | ||
|
|
b5ae4f9fbc | ||
|
|
8904bc1eab | ||
|
|
e0e49b5542 | ||
|
|
1e7e5b6d9f | ||
|
|
e5fb933b98 | ||
|
|
c343756e30 | ||
|
|
ce4c9cd87c | ||
|
|
748a602327 | ||
|
|
8df651bb82 | ||
|
|
b4fc3528de | ||
|
|
fb638a9c08 | ||
|
|
8bc3558cb5 | ||
|
|
28333e3f75 | ||
|
|
c5cfd44a21 | ||
|
|
072057beff | ||
|
|
e35b09b19d | ||
|
|
f52dbd116e | ||
|
|
031ff11bd8 | ||
|
|
976f813ad2 | ||
|
|
2f8a5481f7 | ||
|
|
750aa2ac67 | ||
|
|
41e488d2e7 | ||
|
|
a01c5756a1 | ||
|
|
0dc3ad50d3 | ||
|
|
a429b634f5 | ||
|
|
75bb86b573 | ||
|
|
a57d719ed5 | ||
|
|
cf98c29553 | ||
|
|
e27ff5502a | ||
|
|
b396f37221 | ||
|
|
a6f533afc6 | ||
|
|
02decce31e | ||
|
|
ecab6b1ad2 | ||
|
|
6d7d595354 | ||
|
|
17fca4e1ea | ||
|
|
58b18c3782 | ||
|
|
7ab466a17b | ||
|
|
56c939d0e5 | ||
|
|
73a3ba7f48 | ||
|
|
c4b94ace10 | ||
|
|
94efd15f91 | ||
|
|
47b38d5416 | ||
|
|
1f9aa4c7a7 | ||
|
|
15eb4f87d8 | ||
|
|
b42f010e9d | ||
|
|
63f3b90f1c | ||
|
|
32d06df501 | ||
|
|
175c396053 | ||
|
|
de5dd23b36 | ||
|
|
16036b1b56 | ||
|
|
64af0f5202 | ||
|
|
465c389c07 | ||
|
|
9ec3c9f158 | ||
|
|
3a18e5799a | ||
|
|
051c22ebdb | ||
|
|
5cc8f751f2 | ||
|
|
f8da676839 | ||
|
|
a722071115 | ||
|
|
45e8ce93b5 | ||
|
|
ae41b5fc5c | ||
|
|
d0e3cba92e | ||
|
|
9606274a28 | ||
|
|
4dd3f0cba3 | ||
|
|
752b2d7066 | ||
|
|
cbcfeac0de | ||
|
|
4fd6030779 | ||
|
|
41f2b72a9f | ||
|
|
222b82f3f5 | ||
|
|
b3cf1a5b01 | ||
|
|
4bc1e22058 | ||
|
|
7251099996 | ||
|
|
cbf4bbcf6a | ||
|
|
1ddf8f0236 | ||
|
|
5e2f206d95 | ||
|
|
cdd7e6cb12 | ||
|
|
6eb85ff640 | ||
|
|
6c62a8462d | ||
|
|
fa98339687 | ||
|
|
e9b485ac5b | ||
|
|
ad63509588 | ||
|
|
212836c466 | ||
|
|
4601501939 | ||
|
|
d109106dcb | ||
|
|
6896df67d4 | ||
|
|
6b0f7ea6ef | ||
|
|
cdec1e1925 | ||
|
|
d03571fb2a | ||
|
|
214744aa69 | ||
|
|
f6bf20f7e3 | ||
|
|
c5d6bfa506 | ||
|
|
67456c0cb2 | ||
|
|
da78caa4f2 | ||
|
|
40c736ea46 | ||
|
|
b5f9b7601e | ||
|
|
d70ce66cb4 | ||
|
|
f0b8774d35 | ||
|
|
62dbe304ca | ||
|
|
d7034ab3f4 | ||
|
|
76b03fdda9 | ||
|
|
9a81ebe8df | ||
|
|
79cc49c512 | ||
|
|
e00c98ed11 | ||
|
|
928e2994a2 | ||
|
|
43cd479aa7 | ||
|
|
4a59b32911 | ||
|
|
7677fac783 | ||
|
|
8fffaa2eb0 | ||
|
|
978f35967e | ||
|
|
6bed31fe28 | ||
|
|
49f24e42f1 | ||
|
|
c70cd85a04 | ||
|
|
2b8f320ee1 | ||
|
|
e16ec680b2 | ||
|
|
afbe5e2e03 | ||
|
|
e36b185505 | ||
|
|
5f31cd9ab0 | ||
|
|
a7d7a65a97 | ||
|
|
ae93554f58 | ||
|
|
23945022e0 | ||
|
|
605dcda98a | ||
|
|
0165469ad0 | ||
|
|
949618ca3c | ||
|
|
0d1f415172 | ||
|
|
362a872b00 | ||
|
|
b3d9f6b64c | ||
|
|
7f4854c47d | ||
|
|
60af8c0f14 | ||
|
|
8673a36de4 | ||
|
|
82c6425c77 | ||
|
|
0fe64b28e0 | ||
|
|
60446de766 | ||
|
|
36b7c4191c | ||
|
|
8dcfcc06a8 | ||
|
|
34dd31fbbd | ||
|
|
704145a3d9 | ||
|
|
4129033c3f | ||
|
|
a20f4097e4 | ||
|
|
9dbf4e85ad | ||
|
|
265ba6d2a6 | ||
|
|
85d508a76f | ||
|
|
6f6dccf02e | ||
|
|
084fbb6f11 | ||
|
|
9c3663c5d9 | ||
|
|
0b08f525b2 | ||
|
|
adcfb3dcf4 | ||
|
|
1f8bb96cc4 | ||
|
|
35e399c29d | ||
|
|
e675b4bd21 | ||
|
|
9c843a9dc5 | ||
|
|
0caf181bca | ||
|
|
58a64c05a9 | ||
|
|
414c7201eb | ||
|
|
711b0ea043 | ||
|
|
cc970f60f2 | ||
|
|
c12362a34b | ||
|
|
7d91810871 | ||
|
|
7d847eaf0a | ||
|
|
78258ccc6f | ||
|
|
682b1458ee | ||
|
|
42154a24d7 | ||
|
|
fa08675fc5 | ||
|
|
a90792d17a | ||
|
|
772b3b010e | ||
|
|
167014fcef | ||
|
|
ce012da241 | ||
|
|
2ed9e994a4 | ||
|
|
3c151f8422 | ||
|
|
8a02c9d75a | ||
|
|
fe742acb1c | ||
|
|
72baf23452 | ||
|
|
5e9055d5d8 | ||
|
|
da8b1b669f | ||
|
|
c6949bb76a | ||
|
|
ff7136447a | ||
|
|
1bd8dce63a | ||
|
|
e94cbb1b7c | ||
|
|
646d1e2172 | ||
|
|
ff1164776b | ||
|
|
bc7de558e9 | ||
|
|
5e03372d56 | ||
|
|
c668ebc4a9 | ||
|
|
e1526c939a | ||
|
|
fd5d523460 | ||
|
|
bc01f3bf25 | ||
|
|
a2fcfadba2 | ||
|
|
c2bd0133ba | ||
|
|
cf2455770d | ||
|
|
0c4e9958fd | ||
|
|
01c96431ce | ||
|
|
1e856c9a28 | ||
|
|
4c031484af | ||
|
|
d01d7b1368 | ||
|
|
03be3e77d6 | ||
|
|
a162f20f73 | ||
|
|
a469b1d4ca | ||
|
|
c084ad2593 | ||
|
|
9960c5b7cd | ||
|
|
ec27c41840 | ||
|
|
11bc14592e | ||
|
|
c102233a54 | ||
|
|
eba917d38a | ||
|
|
037991a66b | ||
|
|
b532155b42 | ||
|
|
c2d014a74d | ||
|
|
827594cc29 | ||
|
|
fb2f88e71b | ||
|
|
27bd5054fa | ||
|
|
1ddd7023bc | ||
|
|
09c04eec27 | ||
|
|
21cf20fea8 | ||
|
|
070662c513 | ||
|
|
0368f6e31a | ||
|
|
eb9fc59e0a | ||
|
|
b0a76fea8d | ||
|
|
5a65afbb49 | ||
|
|
a22212c558 | ||
|
|
936db94023 | ||
|
|
c0aee71d7b | ||
|
|
fd13d970c1 | ||
|
|
08ecc3913c | ||
|
|
e0dbd0a7a5 | ||
|
|
489403f832 | ||
|
|
b79de46f7f | ||
|
|
f5b6bf1ced | ||
|
|
28d66894b8 | ||
|
|
8b8ab2664f | ||
|
|
bfc4f25756 | ||
|
|
7346ab4d6c | ||
|
|
dc2f99b32f | ||
|
|
951634fbef | ||
|
|
b4b753c357 | ||
|
|
ad723c9d3b | ||
|
|
4c505faa86 | ||
|
|
cc2082e214 | ||
|
|
7635e124f9 | ||
|
|
f0b07b7819 | ||
|
|
4de621c182 | ||
|
|
0c5a79f5a7 | ||
|
|
8795288e76 | ||
|
|
470cefa834 | ||
|
|
56122a6af2 | ||
|
|
d0121ba22e | ||
|
|
b2eeaaa33e | ||
|
|
04044b4f7e | ||
|
|
8391b601fc | ||
|
|
0e3da9cf85 | ||
|
|
390165b661 | ||
|
|
ea1446ea5b | ||
|
|
63d21f1ccb | ||
|
|
a1b9a36b23 | ||
|
|
20d8151895 | ||
|
|
0be47d1cb8 | ||
|
|
73ad1c62e9 | ||
|
|
dcf331fabc | ||
|
|
03343070d0 | ||
|
|
bca181c365 | ||
|
|
e1228e26fb | ||
|
|
74342c0a25 | ||
|
|
b4c180f275 | ||
|
|
b3350ac23b | ||
|
|
1c94820755 | ||
|
|
41506ffa6f | ||
|
|
f9717be116 | ||
|
|
f896ab1f84 | ||
|
|
8e00c54833 | ||
|
|
c351323605 | ||
|
|
9a1b8e8cc8 | ||
|
|
70376024fa | ||
|
|
44319974c5 | ||
|
|
dc080cca33 | ||
|
|
a529d83758 | ||
|
|
c5cf3900d4 | ||
|
|
774b74575b | ||
|
|
4165234f9c | ||
|
|
be08f05be4 | ||
|
|
bf49151640 | ||
|
|
9c887176d5 | ||
|
|
a48a24932e | ||
|
|
2111a401b2 | ||
|
|
246a628acf | ||
|
|
ef7e64a180 | ||
|
|
b954513444 | ||
|
|
57243d944d | ||
|
|
4cc4ec9c64 | ||
|
|
33818281c1 | ||
|
|
9f05c01c5d | ||
|
|
b8e69f62db | ||
|
|
2000bc3597 | ||
|
|
a0ce5e1acf | ||
|
|
b3b09a966d | ||
|
|
17a3718853 | ||
|
|
f56643a1c0 | ||
|
|
cd347b73e7 | ||
|
|
8c2d73d76e | ||
|
|
724c3d0623 | ||
|
|
2f4dc75540 | ||
|
|
02ec5be3a2 | ||
|
|
5c40b54bd2 | ||
|
|
42338942f5 | ||
|
|
437a6958e4 | ||
|
|
df90caba1b | ||
|
|
38f7c32018 | ||
|
|
fe11b359f4 | ||
|
|
f3a86a94ac | ||
|
|
d945ef1d1b | ||
|
|
21098fbeb8 | ||
|
|
36d54df766 | ||
|
|
c19302755d | ||
|
|
5a20a85dfe | ||
|
|
379349d71a | ||
|
|
6b289e9c9b | ||
|
|
979f2e91da | ||
|
|
02b1f0db62 | ||
|
|
dbb550f71a | ||
|
|
c4c1cbc7f5 | ||
|
|
030b3f718e | ||
|
|
cf05d0d4bb | ||
|
|
6f450c18a2 | ||
|
|
006201d12f | ||
|
|
3b01249c11 | ||
|
|
35c639326e | ||
|
|
f4ea366bf3 | ||
|
|
303162ed8b | ||
|
|
558f35e39b | ||
|
|
6eee1d85bc | ||
|
|
3d3d8c1036 | ||
|
|
c00d1673f5 | ||
|
|
634117c687 | ||
|
|
2cd3781f00 | ||
|
|
b4ee62714b | ||
|
|
93f34fa002 | ||
|
|
99e53443c3 | ||
|
|
9e814827df | ||
|
|
55e9ec4e1f | ||
|
|
acf01e5698 | ||
|
|
015ad7863f | ||
|
|
f57bc040d5 | ||
|
|
de43c04f68 | ||
|
|
aabd8a199b | ||
|
|
366e700c10 | ||
|
|
80f30d4c8b | ||
|
|
6796a2dcd1 | ||
|
|
9f808db912 | ||
|
|
48003b344d | ||
|
|
9e1b44491c | ||
|
|
22900fdd71 | ||
|
|
b2a604e7da | ||
|
|
73bbf5fb68 | ||
|
|
fd762415e5 | ||
|
|
9d2a4720e7 | ||
|
|
05127b1f56 | ||
|
|
f958383e3a | ||
|
|
c3dbf2b129 | ||
|
|
4b11f96141 | ||
|
|
05a1233c13 | ||
|
|
0bde2ae92d | ||
|
|
1cc8381d4d | ||
|
|
f6b81886fa | ||
|
|
155e45ea5c | ||
|
|
3594217fb0 | ||
|
|
98772abb3e | ||
|
|
9a7369f9be | ||
|
|
393cf1b373 | ||
|
|
81a5227005 | ||
|
|
c3e18d3eef | ||
|
|
5856ad2afe | ||
|
|
58bac2c1d0 | ||
|
|
2efe941daf | ||
|
|
767edee59c | ||
|
|
e0d332e3fa | ||
|
|
302a82eb68 | ||
|
|
e2f15fbb16 | ||
|
|
430f656a95 | ||
|
|
dcd6011141 | ||
|
|
531e169a1e | ||
|
|
8ff37f3f73 | ||
|
|
cf6cb8ab14 | ||
|
|
217e3d40dd | ||
|
|
c686f8e187 | ||
|
|
af8ff14e18 | ||
|
|
897f8066fc | ||
|
|
5f8c3e0e02 | ||
|
|
871f611141 | ||
|
|
b250d7ac26 | ||
|
|
6c1f95637c | ||
|
|
37ae5d611e | ||
|
|
a6be1dc4d5 | ||
|
|
a7db686116 | ||
|
|
6c06e49168 | ||
|
|
4d2214e413 | ||
|
|
478765a2df | ||
|
|
c2aa103a49 | ||
|
|
aa7f98b836 | ||
|
|
2915678e90 | ||
|
|
3af7dd863a | ||
|
|
2ac2ec7f79 | ||
|
|
7cc1e7b551 | ||
|
|
a4e5c595d3 | ||
|
|
54be213527 | ||
|
|
d160fc6572 | ||
|
|
1858055b49 | ||
|
|
81f934647f | ||
|
|
ab76804767 | ||
|
|
9759890b68 | ||
|
|
a017f5a546 | ||
|
|
6e35bb6379 | ||
|
|
811c38e6a8 | ||
|
|
e3fb8e608b | ||
|
|
0ad2df9813 | ||
|
|
d1a1010e53 | ||
|
|
a5fa75543b | ||
|
|
f9599282f9 | ||
|
|
ba449e89f2 | ||
|
|
b57a27fe2e | ||
|
|
19fb2b0583 | ||
|
|
2bd4bd58bc | ||
|
|
becd5e1a69 | ||
|
|
b46a6e5f82 | ||
|
|
374861e561 | ||
|
|
50c804c7e0 | ||
|
|
e4ce8009ad | ||
|
|
60482d7dea | ||
|
|
36b7cc180e | ||
|
|
d79a9b92ed | ||
|
|
f90fc74916 | ||
|
|
ce37e751de | ||
|
|
c6ee063189 | ||
|
|
529e053edd | ||
|
|
714015bb8e | ||
|
|
bda25e549f | ||
|
|
b5b30f9539 | ||
|
|
58a2dc831c | ||
|
|
5c0f903f43 | ||
|
|
30cd2fc487 | ||
|
|
fc2449feeb | ||
|
|
2725b30841 | ||
|
|
8274997c45 | ||
|
|
f89eca7794 | ||
|
|
2dee06a0f0 | ||
|
|
5153082de5 | ||
|
|
177f72fd01 | ||
|
|
dd2e09f7ed | ||
|
|
47f93548fc | ||
|
|
b318c4a878 | ||
|
|
9f3ff3c07a | ||
|
|
482bfb7f39 | ||
|
|
e26e1f7f38 | ||
|
|
11f0aa4e2e | ||
|
|
4915ef3276 | ||
|
|
60440f262b | ||
|
|
2992a1a02e | ||
|
|
84b722ab23 | ||
|
|
b2c532e7aa | ||
|
|
cdc15ee101 | ||
|
|
56e545de3a | ||
|
|
51e656ae8e | ||
|
|
1c3d9be1b2 | ||
|
|
3e3c2450c8 | ||
|
|
dbb9e1c554 | ||
|
|
1fd26107b9 | ||
|
|
8054460c1a | ||
|
|
01ea6c00a9 | ||
|
|
4361cb5ee3 | ||
|
|
fa55db7e1e | ||
|
|
94a69d74c1 | ||
|
|
581b95db0d | ||
|
|
18355621b9 | ||
|
|
bf73e14937 | ||
|
|
04b230cc8c | ||
|
|
1ee4dd9f58 | ||
|
|
6b5f836e22 | ||
|
|
f12323deeb | ||
|
|
97aa809072 | ||
|
|
d9ca21913b | ||
|
|
11c5419871 | ||
|
|
b4438d7a9f | ||
|
|
486efee545 | ||
|
|
8a28f57ac0 | ||
|
|
fba373469d | ||
|
|
e997986102 | ||
|
|
979e3af778 | ||
|
|
33c6f06773 | ||
|
|
9da3312a22 | ||
|
|
3d4923b78d | ||
|
|
9c6ae6cd06 | ||
|
|
dfbc147ffb | ||
|
|
127803b3b5 | ||
|
|
1f1f94b2cb | ||
|
|
3412d57f2c | ||
|
|
14d8bc0f5d | ||
|
|
26b0589e0b | ||
|
|
8b4c73e01a | ||
|
|
1246f2f582 | ||
|
|
90be17900d | ||
|
|
51d637659c | ||
|
|
c217eaefc0 | ||
|
|
d3245dcb86 | ||
|
|
589d5962b9 | ||
|
|
2e1d34e43c | ||
|
|
0e9151266a | ||
|
|
0dfba56443 | ||
|
|
f49427e1dc | ||
|
|
9160d6d912 | ||
|
|
5abe552d56 | ||
|
|
d3ff599ab4 | ||
|
|
3bbd61aedf | ||
|
|
ea77fcce91 | ||
|
|
37d92becca | ||
|
|
1f0b06b165 | ||
|
|
845a9995aa | ||
|
|
ad87ab956b | ||
|
|
aef7a82007 | ||
|
|
a3d7745954 | ||
|
|
d4dc518774 | ||
|
|
9203b3d9c3 | ||
|
|
925bdf2a81 | ||
|
|
0db0149b01 | ||
|
|
0dd832526c | ||
|
|
d393a227ea | ||
|
|
a9b580da1e | ||
|
|
543964929b | ||
|
|
55d10017a1 | ||
|
|
87d3993226 | ||
|
|
c44d9132ad | ||
|
|
dcbca0c672 | ||
|
|
c555bd5021 | ||
|
|
dbddb55595 | ||
|
|
9aa361cb6e | ||
|
|
94a8b7dcb1 | ||
|
|
3aa1261a34 | ||
|
|
32632402d3 | ||
|
|
26a1734e7a | ||
|
|
31c23c44e7 | ||
|
|
6c65842a9c | ||
|
|
c5370d1f1c | ||
|
|
2c72213108 | ||
|
|
12d1cf2ea6 | ||
|
|
f7270a349e | ||
|
|
e61783dfec | ||
|
|
88c9054a91 | ||
|
|
e8b1a4a65a | ||
|
|
035ff6c926 | ||
|
|
8b5fb20957 | ||
|
|
e6367fd2a7 | ||
|
|
f725860acf | ||
|
|
4319a0f4ef | ||
|
|
858de4ef40 | ||
|
|
6bcb238f9a | ||
|
|
690c99c4e3 | ||
|
|
7df2060c3c | ||
|
|
8157dedc22 | ||
|
|
8f4e63d633 | ||
|
|
531c65ed7c | ||
|
|
f3d6358dd7 | ||
|
|
9b2da02bdd | ||
|
|
999f9087b5 | ||
|
|
400dc9f42f | ||
|
|
5397727f95 | ||
|
|
437ae363ae | ||
|
|
129cff1ac2 | ||
|
|
637b8be32c | ||
|
|
3c7f0d8e00 | ||
|
|
eca4f95612 | ||
|
|
d0392b70c7 | ||
|
|
5581776313 | ||
|
|
8a7cf9ee56 | ||
|
|
1ec93236f6 | ||
|
|
55f5c5508e | ||
|
|
af71f497ec | ||
|
|
436eabcb76 | ||
|
|
4ec8c32a9d | ||
|
|
55345e6efa | ||
|
|
61fbb12099 | ||
|
|
1079844c22 | ||
|
|
931b11339c | ||
|
|
6f29561f57 | ||
|
|
172dfa62a4 | ||
|
|
cf15e7d65b | ||
|
|
0ee6079edc | ||
|
|
0478eb3be8 | ||
|
|
3fdc1d2011 | ||
|
|
3ee30f23ff | ||
|
|
50f6813de8 | ||
|
|
c8cc39515a | ||
|
|
bc4313e9e2 | ||
|
|
33dac71960 | ||
|
|
9de91e8709 | ||
|
|
84f34ebdb2 | ||
|
|
1ba2c557d5 | ||
|
|
647cf6d656 | ||
|
|
501003b108 | ||
|
|
9c94dfea97 | ||
|
|
53b644b688 | ||
|
|
1f2a6ca7eb | ||
|
|
762e433036 | ||
|
|
3d85b7a351 | ||
|
|
b40a5ec180 | ||
|
|
f92f2f729f | ||
|
|
b1d62d4d29 | ||
|
|
4067c9d369 | ||
|
|
ac3dcd9175 | ||
|
|
7fe35dfa24 | ||
|
|
9867a46106 | ||
|
|
3001fc30ba | ||
|
|
4e02c82efd | ||
|
|
573a16e143 | ||
|
|
7e97aadb5f | ||
|
|
d6a4c9df20 | ||
|
|
6f00c2db39 | ||
|
|
078feead6f | ||
|
|
396460fe7e | ||
|
|
d5cac654cb | ||
|
|
d3686d4262 | ||
|
|
18f572e0e3 | ||
|
|
15b537b0e2 | ||
|
|
58e1788072 | ||
|
|
ed7da40e60 | ||
|
|
dd5e9519a9 | ||
|
|
7dce5b6c25 | ||
|
|
1a65cd840b | ||
|
|
e6bf3c4605 | ||
|
|
39693497ea | ||
|
|
65e96f7313 | ||
|
|
88aa5cc9e9 | ||
|
|
4f55990e8f | ||
|
|
d9486f2432 | ||
|
|
e8e9937c43 | ||
|
|
4a464c14ec | ||
|
|
f4df22907a | ||
|
|
4fb9aa2c8b | ||
|
|
6c79ff49ee | ||
|
|
6d8ca0f3ae | ||
|
|
8e69781d5e | ||
|
|
627fd12893 | ||
|
|
c704e2aa70 | ||
|
|
f3eef61341 | ||
|
|
e346b24d33 | ||
|
|
95b3bea4be | ||
|
|
294cfee63f | ||
|
|
05625c3f5e | ||
|
|
7686c29a10 | ||
|
|
d42722b127 | ||
|
|
04c921c873 | ||
|
|
55a9db2218 | ||
|
|
3ac0a1d1d4 | ||
|
|
60ad3e1f7c | ||
|
|
7a88dbb780 | ||
|
|
5dc39561e3 | ||
|
|
3d11713555 | ||
|
|
a4024f19c5 | ||
|
|
be34b07274 | ||
|
|
6365c70196 | ||
|
|
1a99d4d95d | ||
|
|
b71168e601 | ||
|
|
a72dfbee70 | ||
|
|
6bf3619d66 | ||
|
|
b725c3aa72 | ||
|
|
ac4d249b35 | ||
|
|
167991fae4 | ||
|
|
8e8378583a | ||
|
|
808c10446d | ||
|
|
6cc215e552 | ||
|
|
e876017275 | ||
|
|
6e5aed1317 | ||
|
|
eb0838a485 |
240
.clang-format
@@ -1,35 +1,45 @@
|
||||
# https://clang.llvm.org/docs/ClangFormatStyleOptions.html
|
||||
# for clang-format 17.0.1
|
||||
Language: Json
|
||||
ColumnLimit: 1000
|
||||
IndentWidth: 4
|
||||
---
|
||||
Language: Cpp
|
||||
AccessModifierOffset: -4
|
||||
AlignAfterOpenBracket: Align
|
||||
BasedOnStyle: 'WebKit'
|
||||
# AccessModifierOffset: 2
|
||||
AlignAfterOpenBracket: 'AlwaysBreak'
|
||||
AlignArrayOfStructures: None
|
||||
AlignConsecutiveMacros: None
|
||||
AlignConsecutiveAssignments: None
|
||||
AlignConsecutiveBitFields: None
|
||||
AlignConsecutiveDeclarations: None
|
||||
AlignConsecutiveMacros: None
|
||||
# AlignConsecutiveShortCaseStatements: None
|
||||
AlignEscapedNewlines: Left
|
||||
AlignOperands: Align
|
||||
AlignTrailingComments: true
|
||||
AllowAllArgumentsOnNextLine: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: true
|
||||
AllowShortEnumsOnASingleLine: false
|
||||
AllowShortBlocksOnASingleLine: Empty
|
||||
AlignTrailingComments:
|
||||
Kind: Always
|
||||
OverEmptyLines: 1
|
||||
AllowAllArgumentsOnNextLine: false
|
||||
AllowAllParametersOfDeclarationOnNextLine: false
|
||||
AllowShortBlocksOnASingleLine: Never
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: Inline
|
||||
AllowShortLambdasOnASingleLine: All
|
||||
AllowShortIfStatementsOnASingleLine: WithoutElse
|
||||
# AllowShortCompoundRequirementOnASingleLine: true
|
||||
AllowShortEnumsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: InlineOnly
|
||||
AllowShortIfStatementsOnASingleLine: Never
|
||||
AllowShortLambdasOnASingleLine: Inline
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AlwaysBreakAfterDefinitionReturnType: None
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: false
|
||||
AlwaysBreakTemplateDeclarations: true
|
||||
AttributeMacros:
|
||||
- __capability
|
||||
BinPackArguments: true
|
||||
BinPackParameters: true
|
||||
AlwaysBreakBeforeMultilineStrings: true
|
||||
AlwaysBreakTemplateDeclarations: Yes
|
||||
# AttributeMacros:
|
||||
# - __pragma
|
||||
# - _Pragma
|
||||
# - __attribute__
|
||||
# - __declspec
|
||||
BinPackArguments: false
|
||||
BinPackParameters: false
|
||||
BitFieldColonSpacing: After
|
||||
BraceWrapping:
|
||||
AfterCaseLabel: false
|
||||
AfterClass: true
|
||||
@@ -37,159 +47,147 @@ BraceWrapping:
|
||||
AfterEnum: true
|
||||
AfterFunction: true
|
||||
AfterNamespace: true
|
||||
AfterObjCDeclaration: true
|
||||
# AfterObjCDeclaration: true
|
||||
AfterStruct: true
|
||||
AfterUnion: false
|
||||
AfterUnion: true
|
||||
AfterExternBlock: true
|
||||
BeforeCatch: true
|
||||
BeforeElse: true
|
||||
BeforeLambdaBody: false
|
||||
BeforeWhile: false
|
||||
IndentBraces: false
|
||||
SplitEmptyFunction: false
|
||||
SplitEmptyRecord: false
|
||||
SplitEmptyNamespace: false
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeConceptDeclarations: true
|
||||
SplitEmptyFunction: true
|
||||
SplitEmptyRecord: true
|
||||
SplitEmptyNamespace: true
|
||||
# BracedInitializerIndentWidth: 4
|
||||
BreakAfterAttributes: Never
|
||||
BreakAfterJavaFieldAnnotations: true
|
||||
BreakArrays: true
|
||||
BreakBeforeBinaryOperators: NonAssignment
|
||||
BreakBeforeBraces: Custom
|
||||
BreakBeforeInheritanceComma: false
|
||||
BreakInheritanceList: BeforeColon
|
||||
BreakBeforeConceptDeclarations: Always
|
||||
BreakBeforeInlineASMColon: OnlyMultiline
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializersBeforeComma: false
|
||||
BreakConstructorInitializers: BeforeColon
|
||||
BreakAfterJavaFieldAnnotations: false
|
||||
BreakConstructorInitializers: BeforeComma
|
||||
BreakInheritanceList: BeforeComma
|
||||
BreakStringLiterals: true
|
||||
ColumnLimit: 120
|
||||
CommentPragmas: '^ IWYU pragma:'
|
||||
QualifierAlignment: Leave
|
||||
ColumnLimit: 100
|
||||
# CommentPragmas: '^ MEO pragma:'
|
||||
CompactNamespaces: false
|
||||
ConstructorInitializerIndentWidth: 4
|
||||
ContinuationIndentWidth: 4
|
||||
Cpp11BracedListStyle: false
|
||||
DeriveLineEnding: true
|
||||
DerivePointerAlignment: false
|
||||
DisableFormat: false
|
||||
EmptyLineAfterAccessModifier: Never
|
||||
EmptyLineBeforeAccessModifier: LogicalBlock
|
||||
ExperimentalAutoDetectBinPacking: false
|
||||
PackConstructorInitializers: BinPack
|
||||
BasedOnStyle: ''
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
||||
AllowAllConstructorInitializersOnNextLine: true
|
||||
# ExperimentalAutoDetectBinPacking: true
|
||||
FixNamespaceComments: true
|
||||
ForEachMacros:
|
||||
- foreach
|
||||
- Q_FOREACH
|
||||
- BOOST_FOREACH
|
||||
IfMacros:
|
||||
- KJ_IF_MAYBE
|
||||
# ForEachMacros:
|
||||
# - foreach
|
||||
# - Q_FOREACH
|
||||
# - BOOST_FOREACH
|
||||
# IfMacros:
|
||||
# - 'KJ_IF_MAYBE'
|
||||
IncludeBlocks: Preserve
|
||||
IncludeCategories:
|
||||
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
|
||||
Priority: 2
|
||||
SortPriority: 0
|
||||
CaseSensitive: false
|
||||
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
|
||||
Priority: 3
|
||||
SortPriority: 0
|
||||
CaseSensitive: false
|
||||
- Regex: '.*'
|
||||
Priority: 1
|
||||
SortPriority: 0
|
||||
CaseSensitive: false
|
||||
IncludeIsMainRegex: '(Test)?$'
|
||||
IncludeIsMainSourceRegex: ''
|
||||
# IncludeCategories:
|
||||
# IncludeIsMainRegex:
|
||||
# IncludeIsMainSourceRegex:
|
||||
IndentAccessModifiers: false
|
||||
IndentCaseLabels: false
|
||||
IndentCaseBlocks: false
|
||||
IndentGotoLabels: true
|
||||
IndentPPDirectives: None
|
||||
IndentCaseLabels: false
|
||||
IndentExternBlock: AfterExternBlock
|
||||
IndentGotoLabels: false
|
||||
IndentPPDirectives: None
|
||||
IndentRequiresClause: false
|
||||
IndentWidth: 4
|
||||
IndentWrappedFunctionNames: false
|
||||
InsertTrailingCommas: None
|
||||
JavaScriptQuotes: Leave
|
||||
JavaScriptWrapImports: true
|
||||
KeepEmptyLinesAtTheStartOfBlocks: true
|
||||
IndentWrappedFunctionNames: true
|
||||
InsertBraces: true
|
||||
InsertNewlineAtEOF: true
|
||||
InsertTrailingCommas: Wrapped
|
||||
IntegerLiteralSeparator:
|
||||
Binary: 4
|
||||
BinaryMinDigits: 9
|
||||
Decimal: 3
|
||||
DecimalMinDigits: 7
|
||||
Hex: -1
|
||||
# JavaImportGroups:
|
||||
# JavaScriptQuotes:
|
||||
# JavaScriptWrapImports:
|
||||
KeepEmptyLinesAtEOF: true
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
LambdaBodyIndentation: Signature
|
||||
MacroBlockBegin: ''
|
||||
MacroBlockEnd: ''
|
||||
# LineEnding: LF
|
||||
# MacroBlockBegin: "MAA.*_NS_BEGIN$"
|
||||
# MacroBlockEnd: "MAA.*_NS_END$"
|
||||
# Macros:
|
||||
MaxEmptyLinesToKeep: 1
|
||||
NamespaceIndentation: All
|
||||
ObjCBinPackProtocolList: Auto
|
||||
ObjCBlockIndentWidth: 2
|
||||
ObjCBreakBeforeNestedBlockParam: true
|
||||
ObjCSpaceAfterProperty: false
|
||||
ObjCSpaceBeforeProtocolList: true
|
||||
PenaltyBreakAssignment: 2
|
||||
PenaltyBreakBeforeFirstCallParameter: 19
|
||||
PenaltyBreakComment: 300
|
||||
PenaltyBreakFirstLessLess: 120
|
||||
PenaltyBreakOpenParenthesis: 0
|
||||
PenaltyBreakString: 1000
|
||||
PenaltyBreakTemplateDeclaration: 10
|
||||
PenaltyExcessCharacter: 1000000
|
||||
PenaltyReturnTypeOnItsOwnLine: 1000
|
||||
PenaltyIndentedWhitespace: 0
|
||||
NamespaceIndentation: None
|
||||
# NamespaceMacros:
|
||||
# ObjCBinPackProtocolList:
|
||||
# ObjCBlockIndentWidth:
|
||||
# ObjCBreakBeforeNestedBlockParam:
|
||||
# ObjCSpaceAfterProperty:
|
||||
# ObjCSpaceBeforeProtocolList:
|
||||
PackConstructorInitializers: Never
|
||||
# PenaltyBreakAssignment:
|
||||
# PenaltyBreakBeforeFirstCallParameter:
|
||||
# PenaltyBreakComment:
|
||||
# PenaltyBreakFirstLessLess:
|
||||
# PenaltyBreakOpenParenthesis:
|
||||
# PenaltyBreakTemplateDeclaration:
|
||||
# PenaltyExcessCharacter:
|
||||
# PenaltyIndentedWhitespace:
|
||||
# PenaltyReturnTypeOnItsOwnLine:
|
||||
PointerAlignment: Left
|
||||
PPIndentWidth: -1
|
||||
ReferenceAlignment: Pointer
|
||||
# QualifierAlignment: Custom
|
||||
# QualifierOrder:
|
||||
# - inline
|
||||
# - static
|
||||
# - const
|
||||
# - constexpr
|
||||
# - type
|
||||
ReferenceAlignment: Left
|
||||
ReflowComments: true
|
||||
RemoveBracesLLVM: false
|
||||
RemoveParentheses: Leave
|
||||
RemoveSemicolon: false
|
||||
RequiresClausePosition: OwnLine
|
||||
SeparateDefinitionBlocks: Leave
|
||||
ShortNamespaceLines: 50
|
||||
RequiresExpressionIndentation: OuterScope
|
||||
SeparateDefinitionBlocks: Always
|
||||
ShortNamespaceLines: 1000
|
||||
SortIncludes: CaseSensitive
|
||||
SortJavaStaticImport: Before
|
||||
SortUsingDeclarations: true
|
||||
# SortJavaStaticImport:
|
||||
SortUsingDeclarations: Lexicographic
|
||||
SpaceAfterCStyleCast: false
|
||||
SpaceAfterLogicalNot: false
|
||||
SpaceAfterTemplateKeyword: true
|
||||
SpaceAroundPointerQualifiers: Default
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeCaseColon: false
|
||||
SpaceBeforeCpp11BracedList: true
|
||||
SpaceBeforeCtorInitializerColon: true
|
||||
SpaceBeforeInheritanceColon: true
|
||||
SpaceBeforeJsonColon: false
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceBeforeParensOptions:
|
||||
AfterControlStatements: true
|
||||
AfterForeachMacros: true
|
||||
AfterFunctionDefinitionName: false
|
||||
AfterFunctionDeclarationName: false
|
||||
AfterIfMacros: true
|
||||
AfterOverloadedOperator: false
|
||||
AfterRequiresInClause: true
|
||||
AfterRequiresInExpression: true
|
||||
BeforeNonEmptyParentheses: false
|
||||
SpaceAroundPointerQualifiers: Default
|
||||
# SpaceBeforeParensOptions:
|
||||
SpaceBeforeRangeBasedForLoopColon: true
|
||||
SpaceBeforeSquareBrackets: false
|
||||
SpaceInEmptyBlock: false
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesBeforeTrailingComments: 1
|
||||
SpacesInAngles: Never
|
||||
SpacesInConditionalStatement: false
|
||||
SpacesInContainerLiterals: true
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInLineCommentPrefix:
|
||||
Minimum: 1
|
||||
Maximum: -1
|
||||
SpacesInParentheses: false
|
||||
SpacesInParens: Never
|
||||
SpacesInSquareBrackets: false
|
||||
SpaceBeforeSquareBrackets: false
|
||||
BitFieldColonSpacing: Both
|
||||
Standard: c++20
|
||||
StatementAttributeLikeMacros:
|
||||
- Q_EMIT
|
||||
StatementMacros:
|
||||
- Q_UNUSED
|
||||
- QT_REQUIRE_VERSION
|
||||
# StatementAttributeLikeMacros:
|
||||
# StatementMacros:
|
||||
TabWidth: 4
|
||||
UseCRLF: false
|
||||
# TypeNames:
|
||||
# TypenameMacros:
|
||||
UseTab: Never
|
||||
WhitespaceSensitiveMacros:
|
||||
- STRINGIZE
|
||||
- PP_STRINGIZE
|
||||
- BOOST_PP_STRINGIZE
|
||||
- NS_SWIFT_NAME
|
||||
- CF_SWIFT_NAME
|
||||
# VerilogBreakBetweenInstancePorts:
|
||||
# WhitespaceSensitiveMacros:
|
||||
|
||||
@@ -10,72 +10,3 @@ end_of_line = lf
|
||||
[*.json]
|
||||
|
||||
indent_size = 4
|
||||
|
||||
[*.{c++,cc,cpp,cppm,cxx,h,h++,hh,hpp,hxx,inl,ipp,ixx,tlh,tli}]
|
||||
|
||||
indent_size = 4
|
||||
|
||||
# Visual C++ Code Style settings
|
||||
|
||||
cpp_generate_documentation_comments = xml
|
||||
|
||||
# Visual C++ Formatting settings
|
||||
|
||||
cpp_indent_braces = false
|
||||
cpp_indent_multi_line_relative_to = innermost_parenthesis
|
||||
cpp_indent_within_parentheses = indent
|
||||
cpp_indent_preserve_within_parentheses = true
|
||||
cpp_indent_case_contents = true
|
||||
cpp_indent_case_labels = false
|
||||
cpp_indent_case_contents_when_block = false
|
||||
cpp_indent_lambda_braces_when_parameter = true
|
||||
cpp_indent_goto_labels = one_left
|
||||
cpp_indent_preprocessor = leftmost_column
|
||||
cpp_indent_access_specifiers = false
|
||||
cpp_indent_namespace_contents = true
|
||||
cpp_indent_preserve_comments = false
|
||||
cpp_new_line_before_open_brace_namespace = new_line
|
||||
cpp_new_line_before_open_brace_type = new_line
|
||||
cpp_new_line_before_open_brace_function = new_line
|
||||
cpp_new_line_before_open_brace_block = same_line
|
||||
cpp_new_line_before_open_brace_lambda = same_line
|
||||
cpp_new_line_scope_braces_on_separate_lines = false
|
||||
cpp_new_line_close_brace_same_line_empty_type = false
|
||||
cpp_new_line_close_brace_same_line_empty_function = false
|
||||
cpp_new_line_before_catch = true
|
||||
cpp_new_line_before_else = true
|
||||
cpp_new_line_before_while_in_do_while = false
|
||||
cpp_space_before_function_open_parenthesis = remove
|
||||
cpp_space_within_parameter_list_parentheses = false
|
||||
cpp_space_between_empty_parameter_list_parentheses = false
|
||||
cpp_space_after_keywords_in_control_flow_statements = true
|
||||
cpp_space_within_control_flow_statement_parentheses = false
|
||||
cpp_space_before_lambda_open_parenthesis = false
|
||||
cpp_space_within_cast_parentheses = false
|
||||
cpp_space_after_cast_close_parenthesis = false
|
||||
cpp_space_within_expression_parentheses = false
|
||||
cpp_space_before_block_open_brace = true
|
||||
cpp_space_between_empty_braces = false
|
||||
cpp_space_before_initializer_list_open_brace = false
|
||||
cpp_space_within_initializer_list_braces = true
|
||||
cpp_space_preserve_in_initializer_list = true
|
||||
cpp_space_before_open_square_bracket = false
|
||||
cpp_space_within_square_brackets = false
|
||||
cpp_space_before_empty_square_brackets = false
|
||||
cpp_space_between_empty_square_brackets = false
|
||||
cpp_space_group_square_brackets = true
|
||||
cpp_space_within_lambda_brackets = false
|
||||
cpp_space_between_empty_lambda_brackets = false
|
||||
cpp_space_before_comma = false
|
||||
cpp_space_after_comma = true
|
||||
cpp_space_remove_around_member_operators = true
|
||||
cpp_space_before_inheritance_colon = true
|
||||
cpp_space_before_constructor_colon = true
|
||||
cpp_space_remove_before_semicolon = true
|
||||
cpp_space_after_semicolon = false
|
||||
cpp_space_remove_around_unary_operator = true
|
||||
cpp_space_around_binary_operator = insert
|
||||
cpp_space_around_assignment_operator = insert
|
||||
cpp_space_pointer_reference_alignment = left
|
||||
cpp_space_around_ternary_operator = insert
|
||||
cpp_wrap_preserve_blocks = one_liners
|
||||
|
||||
8
.github/ISSUE_TEMPLATE/cn-bug-report.yaml
vendored
@@ -9,9 +9,9 @@ body:
|
||||
options:
|
||||
- label: 我理解 Issue 是用于反馈和解决问题的,而非吐槽评论区,将尽可能提供更多信息帮助问题解决
|
||||
required: true
|
||||
- label: 我填写了简短且清晰明确的标题,以便开发者在翻阅 issue 列表时能快速确定大致问题。而不是“一个建议”、“卡住了”等
|
||||
- label: 我填写了简短且清晰明确的标题,以便开发者在翻阅 Issue 列表时能快速确定大致问题。而不是“一个建议”、“卡住了”等
|
||||
required: true
|
||||
- label: 我已查看最新测试版本的更新内容,并未提及该 bug 已被修复的情况
|
||||
- label: 我已查看最新测试版本的更新内容,并未提及该 Bug 已被修复的情况
|
||||
required: true
|
||||
- label: 我已检查了置顶议题(pinned issue),确认我的问题未被提及
|
||||
required: true
|
||||
@@ -27,7 +27,7 @@ body:
|
||||
attributes:
|
||||
label: Version
|
||||
description: >-
|
||||
请提供 MAA 版本。可在 MAA -> 设置 -> 软件更新中找到。(点击图标可复制)
|
||||
请提供 MAA 版本。可在 MAA -> 设置 -> 软件更新中找到(点击图标可复制)。
|
||||
placeholder: |
|
||||
Resource Version:
|
||||
UI Version:
|
||||
@@ -39,7 +39,7 @@ body:
|
||||
attributes:
|
||||
label: 日志文件
|
||||
description: |
|
||||
**上传 `debug` 文件夹中的 `asst.log` 和 `gui.log` 日志文件,并说明问题出现的大致时间点**
|
||||
**请在关闭MAA后,上传 `debug` 文件夹中的 `asst.log` 和 `gui.log` 日志文件,并说明问题出现的大致时间点**
|
||||
**请直接将完整的文件拖拽进来,而非自己裁切或复制的片段;若文件体积过大可压缩后再上传**
|
||||
validations:
|
||||
required: true
|
||||
|
||||
@@ -7,9 +7,9 @@ body:
|
||||
attributes:
|
||||
label: 在提问之前...
|
||||
options:
|
||||
- label: 我填写了简短且清晰明确的标题,以便开发者在翻阅 issue 列表时能快速确定大致问题。而不是“一个建议”、“卡住了”等
|
||||
- label: 我填写了简短且清晰明确的标题,以便开发者在翻阅 Issue 列表时能快速确定大致问题。而不是“一个建议”、“卡住了”等
|
||||
required: true
|
||||
- label: 我基本确定这是一个新功能/建议,而不是遇到了 bug(不确定的话请附上日志)
|
||||
- label: 我基本确定这是一个新功能/建议,而不是遇到了 Bug(不确定的话请附上日志)
|
||||
required: true
|
||||
- type: textarea
|
||||
id: describe
|
||||
|
||||
81
.github/ISSUE_TEMPLATE/cn-mumu-report.yaml
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
name: MuMu 截图增强反馈(使用中文)
|
||||
description: 有关 MuMu 截图增强功能的集中反馈
|
||||
labels: ['mumu api']
|
||||
body:
|
||||
- type: checkboxes
|
||||
id: checks
|
||||
attributes:
|
||||
label: 在提问之前...
|
||||
options:
|
||||
- label: 我理解 Issue 是用于反馈和解决问题的,而非吐槽评论区,将尽可能提供更多信息帮助问题解决
|
||||
required: true
|
||||
- label: 我填写了简短且清晰明确的标题,以便开发者在翻阅 Issue 列表时能快速确定大致问题。而不是“一个建议”、“卡住了”等
|
||||
required: true
|
||||
- label: 我已检查了置顶议题(Pinned Issue),确认我的问题未被提及
|
||||
required: true
|
||||
- label: 我正在使用最新的 MAA 内测版本和最新的**官版** MuMu 模拟器
|
||||
required: true
|
||||
- label: 我已参考文档确定安装路径、实例编号、屏幕编号填写正确,并确认在关闭截图增强模式后问题消失
|
||||
required: true
|
||||
- label: 我未开启高帧率模式,且显存使用策略为“画面表现更好”
|
||||
required: false
|
||||
- label: 我正在使用后台保活功能,并确定该问题仅在开启后台保活时出现
|
||||
required: false
|
||||
- type: textarea
|
||||
id: describe
|
||||
attributes:
|
||||
label: 问题描述
|
||||
description: 描述问题时请尽可能详细
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: version
|
||||
attributes:
|
||||
label: Version
|
||||
description: >-
|
||||
请提供 MAA 版本和 MuMu 版本。MAA 版本可在 MAA -> 设置 -> 软件更新中找到(点击图标可复制)。MuMu 版本可在右上角菜单按钮 -> 关于 MuMu 中找到。
|
||||
placeholder: |
|
||||
Resource Version:
|
||||
UI Version:
|
||||
Core Version:
|
||||
MuMu 版本号:
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: logs
|
||||
attributes:
|
||||
label: MAA 日志文件
|
||||
description: |
|
||||
**上传 `debug` 文件夹中的 `asst.log` 和 `gui.log` 日志文件,并说明问题出现的大致时间点**
|
||||
**请直接将完整的文件拖拽进来,而非自己裁切或复制的片段;若文件体积过大可压缩后再上传**
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: mumulogs
|
||||
attributes:
|
||||
label: MuMu 问题诊断
|
||||
description: |
|
||||
**在 MuMu 右上角菜单按钮 -> 问题诊断 中点击 复制配置信息,并将全部内容粘贴进来。**
|
||||
**注意隐去 电脑出口IP地址 等以保护个人隐私**
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: screenshots
|
||||
attributes:
|
||||
label: 截图
|
||||
description: |
|
||||
如果有,添加屏幕截图以帮助解释你的问题,包括但不限于 MAA 软件截图、游戏画面截图
|
||||
若是**识别相关问题**,请尽可能提供模拟器自带的截图工具截取的无遮挡的**原图**(或通过 adb 截取原图)
|
||||
用其他的工具(如QQ)截取的图片包含窗口边框,不利于我们排除bug
|
||||
`debug` 文件夹下有一些自动截图的错误图片,若有相关的,请一并打包上传
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
id: others
|
||||
attributes:
|
||||
label: 还有别的吗?
|
||||
description: |
|
||||
操作系统?相关的配置?链接?参考资料?
|
||||
任何能让我们对你所遇到的问题有更多了解的东西
|
||||
validations:
|
||||
required: false
|
||||
2
.github/ISSUE_TEMPLATE/cn-others.yaml
vendored
@@ -1,5 +1,5 @@
|
||||
name: 其他议题(使用中文)
|
||||
description: 提出问题,而不是 bug 反馈或需求建议
|
||||
description: 提出问题,而不是 Bug 反馈或需求建议
|
||||
labels: ['question']
|
||||
body:
|
||||
- type: textarea
|
||||
|
||||
2
.github/ISSUE_TEMPLATE/en-bug-report.yaml
vendored
@@ -52,7 +52,7 @@ body:
|
||||
attributes:
|
||||
label: Log files
|
||||
description: >-
|
||||
**Upload the `asst.log` and `gui.log` log file in the `debug` folder and**
|
||||
**After closing the MAA, upload the `asst.log` and `gui.log` log file in the `debug` folder and**
|
||||
**indicate the approximate point in time when the problem occurred.**
|
||||
|
||||
**Please drag and drop the full file in, not your own cuttings or copies;**
|
||||
|
||||
15
.github/issue-checker.yml
vendored
@@ -67,6 +67,12 @@ labels:
|
||||
- name: remove roguelike
|
||||
content:
|
||||
regexes: '[Rr]emove (?:[Ll]abels? |)(?:`|)(?:[Mm]odule: |)roguelike(?:`|)'
|
||||
- name: skip reclamation
|
||||
content:
|
||||
regexes: '[Ss]kip (?:[Ll]abels? |)(?:`|)(?:[Mm]odule: |)reclamation(?:`|)'
|
||||
- name: remove reclamation
|
||||
content:
|
||||
regexes: '[Rr]emove (?:[Ll]abels? |)(?:`|)(?:[Mm]odule: |)reclamation(?:`|)'
|
||||
|
||||
- name: skip client
|
||||
content:
|
||||
@@ -167,7 +173,7 @@ labels:
|
||||
- name: roguelike
|
||||
content: "module: roguelike"
|
||||
regexes:
|
||||
"肉[鸽鴿]|集成战略|[Rr]ogue|[Ii]ntegrated [Ss]tategy|I.S.|ローグ"
|
||||
"肉[鸽鴿]|集成战略|[Rr]ogue|[Ii]ntegrated [Ss]tategy|I\\.S\\.|ローグ"
|
||||
skip-if:
|
||||
- skip all
|
||||
- skip module
|
||||
@@ -185,11 +191,11 @@ labels:
|
||||
skip-if:
|
||||
- skip all
|
||||
- skip module
|
||||
- skip roguelike
|
||||
- skip reclamation
|
||||
remove-if:
|
||||
- remove all
|
||||
- remove module
|
||||
- remove roguelike
|
||||
- remove reclamation
|
||||
|
||||
# `module: copilot`
|
||||
- name: copilot1
|
||||
@@ -375,7 +381,7 @@ labels:
|
||||
- name: pr-ambiguous
|
||||
# 不符合 commitizen 的 PR
|
||||
content: ambiguous
|
||||
regexes: '^(?!(?:build|chore|ci|docs?|feat|fix|i18n|perf|refactor|rft|style|test)[\:\.\(\,]|[Rr]evert|[Rr]elease)'
|
||||
regexes: '^(?!(?:build|chore|ci|docs?|feat!?|fix|i18n|perf|refactor|rft|style|test)[\:\.\(\,]|[Rr]evert|[Rr]elease)'
|
||||
mode:
|
||||
pull_request_target:
|
||||
skip-if:
|
||||
@@ -408,6 +414,7 @@ labels:
|
||||
- others
|
||||
- recruit
|
||||
- roguelike
|
||||
- reclamation
|
||||
|
||||
# `release`
|
||||
- name: release
|
||||
|
||||
158095
.github/qodana.sarif.json
vendored
16
.github/workflows/ci.yml
vendored
@@ -106,6 +106,7 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
show-progress: false
|
||||
submodules: recursive
|
||||
|
||||
- name: Cache .nuke/temp, ~/.nuget/packages
|
||||
id: cache-nuget
|
||||
@@ -224,19 +225,18 @@ jobs:
|
||||
CC: ${{ matrix.arch == 'x86_64' && 'ccache gcc-12' || 'ccache aarch64-linux-gnu-gcc-12' }}
|
||||
CXX: ${{ matrix.arch == 'x86_64' && 'ccache g++-12' || 'ccache aarch64-linux-gnu-g++-12' }}
|
||||
|
||||
- name: Setup Rust
|
||||
- name: Setup Cross Compile Toolchains for CLI
|
||||
uses: ./src/maa-cli/.github/actions/setup
|
||||
with:
|
||||
os: ubuntu-latest
|
||||
arch: ${{ matrix.arch }}
|
||||
target_arch: ${{ matrix.arch }}
|
||||
|
||||
- name: Build CLI
|
||||
run: |
|
||||
cargo build --release --locked --package maa-cli \
|
||||
${{ matrix.arch != 'x86_64' && '--features vendored-openssl' || '' }}
|
||||
cargo build --release --locked --package maa-cli --features vendored-openssl
|
||||
cp -v target/$CARGO_BUILD_TARGET/release/maa $GITHUB_WORKSPACE/install/maa
|
||||
cargo build --release --locked --package maa-cli --no-default-features \
|
||||
--features ${{ matrix.arch != 'x86_64' && 'git2,vendored-openssl' || 'git2' }}
|
||||
--features git2,vendored-openssl
|
||||
cp -v target/$CARGO_BUILD_TARGET/release/maa $GITHUB_WORKSPACE/appimage-maa
|
||||
working-directory: src/maa-cli
|
||||
|
||||
@@ -292,7 +292,7 @@ jobs:
|
||||
|
||||
macOS-Core:
|
||||
needs: meta
|
||||
runs-on: macos-13
|
||||
runs-on: macos-14
|
||||
strategy:
|
||||
matrix:
|
||||
arch: [arm64, x86_64]
|
||||
@@ -330,7 +330,7 @@ jobs:
|
||||
|
||||
macOS-GUI:
|
||||
needs: [meta, macOS-Core]
|
||||
runs-on: macos-13
|
||||
runs-on: macos-14
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
@@ -367,7 +367,7 @@ jobs:
|
||||
- name: Build XCFramework
|
||||
run: |
|
||||
xcodebuild -create-xcframework -library libMaaCore.dylib -headers ../include -output MaaCore.xcframework
|
||||
xcodebuild -create-xcframework -library libMaaDerpLearning.dylib -output MaaDerpLearning.xcframework
|
||||
xcodebuild -create-xcframework -library libfastdeploy_ppocr.dylib -output fastdeploy_ppocr.xcframework
|
||||
xcodebuild -create-xcframework -library libonnxruntime.*.dylib -output ONNXRuntime.xcframework
|
||||
xcodebuild -create-xcframework -library libopencv*.dylib -output OpenCV.xcframework
|
||||
working-directory: build
|
||||
|
||||
48
.github/workflows/docs-build-test.yml
vendored
@@ -1,48 +0,0 @@
|
||||
name: Build Test for docs
|
||||
|
||||
on:
|
||||
push:
|
||||
branches-ignore:
|
||||
- "master"
|
||||
paths:
|
||||
- "docs/**"
|
||||
pull_request:
|
||||
branches:
|
||||
- "dev"
|
||||
paths:
|
||||
- "docs/**"
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build-test:
|
||||
timeout-minutes: 20
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 1
|
||||
show-progress: false
|
||||
|
||||
- name: Setup Node.js environment
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm i
|
||||
working-directory: "./docs"
|
||||
|
||||
- name: Cleanup files
|
||||
run: rm tsconfig.json
|
||||
working-directory: "./docs"
|
||||
|
||||
- name: Build
|
||||
run: npm run build
|
||||
working-directory: "./docs"
|
||||
|
||||
- name: Upload artifact to GitHub
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: docs
|
||||
path: "./docs/.vuepress/dist"
|
||||
36
.github/workflows/gen-changelog.yml
vendored
@@ -2,12 +2,16 @@ name: gen-changelog
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, reopened, ready_for_review]
|
||||
types:
|
||||
- opened
|
||||
- reopened
|
||||
- ready_for_review
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
gen:
|
||||
if: github.event.pull_request.draft == false && startsWith(github.event.pull_request.title, 'Release v') # startsWith 表达式不区分大小写
|
||||
# startsWith 表达式不区分大小写
|
||||
if: github.event.pull_request.draft == false && startsWith(github.event.pull_request.title, 'Release v')
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
@@ -18,6 +22,8 @@ jobs:
|
||||
|
||||
- name: Extract tag name
|
||||
id: extract_tag
|
||||
env:
|
||||
PR_BODY: ${{ format('{0}/{1}', runner.temp, 'output' ) }}
|
||||
run: |
|
||||
tag_name=$(echo "${{ github.event.pull_request.title }}" | sed -E 's/(Release|release)//' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
|
||||
echo "tag_name=$tag_name" >> $GITHUB_OUTPUT
|
||||
@@ -27,19 +33,33 @@ jobs:
|
||||
|
||||
latest_stable_tag=$(git tag -l 'v*' | grep -v '-' | sort -V | tail -n 1) # 上一个 stable 版本
|
||||
newest_tag=$(git describe --tags --match "v*" --abbrev=0) # 最新版本
|
||||
echo "latest_stable_tag: $latest_stable_tag"
|
||||
echo "newest_tag: $newest_tag"
|
||||
echo "latest_stable_tag=$latest_stable_tag" >> $GITHUB_OUTPUT
|
||||
echo "newest_tag=$newest_tag" >> $GITHUB_OUTPUT
|
||||
|
||||
if [[ $tag_name == *-* ]]; then # 判断新版本是否为 beta 版本
|
||||
latest=$newest_tag # 若是,则将 latest 参数设置为最新版本
|
||||
if [[ $tag_name == *-* ]]; then # 判断新版本是否为 beta 版本
|
||||
latest=$newest_tag # 若是,则将 latest 参数设置为最新版本
|
||||
else
|
||||
latest=$latest_stable_tag # 若否,则设置为上一个 stable 版本
|
||||
latest=$latest_stable_tag # 若否,则设置为上一个 stable 版本
|
||||
fi
|
||||
|
||||
echo "latest=$latest" >> $GITHUB_OUTPUT
|
||||
|
||||
cat $GITHUB_OUTPUT
|
||||
|
||||
echo '======='
|
||||
|
||||
echo 'Target RP: ${{ github.event.pull_request.html_url }}' >> $PR_BODY
|
||||
echo '' >> $PR_BODY
|
||||
echo '<details><summary>Debug info</summary>' >> $PR_BODY
|
||||
echo '' >> $PR_BODY
|
||||
echo '```' >> $PR_BODY
|
||||
sed 's/=/: /1' $GITHUB_OUTPUT >> $PR_BODY
|
||||
echo '```' >> $PR_BODY
|
||||
echo '' >> $PR_BODY
|
||||
echo '</details>' >> $PR_BODY
|
||||
|
||||
cat $PR_BODY
|
||||
|
||||
- name: Generate Changelog
|
||||
run: |
|
||||
git switch dev
|
||||
@@ -63,7 +83,7 @@ jobs:
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
title: ${{ steps.extract_tag.outputs.pr_title }}
|
||||
body: ${{ github.event.pull_request.html_url }}
|
||||
body-path: ${{ format('{0}/{1}', runner.temp, 'output' ) }}
|
||||
base: "dev"
|
||||
branch: "changelog"
|
||||
delete-branch: true
|
||||
|
||||
2
.github/workflows/issue-checker.yml
vendored
@@ -16,7 +16,7 @@ jobs:
|
||||
triage:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: zzyyyl/issue-checker@v1.7
|
||||
- uses: zzyyyl/issue-checker@v1.8
|
||||
with:
|
||||
repo-token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
configuration-path: .github/issue-checker.yml
|
||||
|
||||
49
.github/workflows/markdown-checker.yml
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
name: Lint Markdown files
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- "**/*.md"
|
||||
- ".github/workflows/lint-markdown.yml"
|
||||
pull_request:
|
||||
paths:
|
||||
- "**/*.md"
|
||||
- ".github/workflows/lint-markdown.yml"
|
||||
schedule:
|
||||
- cron: "44 7 * * 2"
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: Lint Markdown
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
show-progress: false
|
||||
|
||||
- name: Lint Markdown
|
||||
uses: DavidAnson/markdownlint-cli2-action@v16
|
||||
with:
|
||||
config: docs/.markdownlint.yaml
|
||||
globs: |
|
||||
README.md
|
||||
docs/**/*.md
|
||||
|
||||
# check-links:
|
||||
# name: Check Dead Links
|
||||
# runs-on: ubuntu-latest
|
||||
# steps:
|
||||
# - name: Check out code
|
||||
# uses: actions/checkout@v4
|
||||
# with:
|
||||
# show-progress: false
|
||||
#
|
||||
# - name: Check Dead Link
|
||||
# uses: umbrelladocs/action-linkspector@v1
|
||||
# with:
|
||||
# # Use github-pr-review when triggered by a pull request; otherwise, use github-check
|
||||
# reporter: ${{ github.event_name == 'pull_request' && 'github-pr-review' || 'github-check' }}
|
||||
# filter_mode: nofilter
|
||||
# fail_on_error: true
|
||||
12
.github/workflows/pr-checker.yml
vendored
@@ -1,12 +1,9 @@
|
||||
name: PR Checker
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
pull_request_target:
|
||||
types: [opened, edited, ready_for_review, reopened, synchronize]
|
||||
|
||||
permissions:
|
||||
issues: write
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
check_commit_name_in_pr:
|
||||
@@ -16,7 +13,6 @@ jobs:
|
||||
- name: Cleanup Previous Comment
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
script: |
|
||||
const { data: comments } = await github.rest.issues.listComments({
|
||||
owner: context.repo.owner,
|
||||
@@ -32,11 +28,9 @@ jobs:
|
||||
comment_id: previousComment.id
|
||||
});
|
||||
}
|
||||
|
||||
- name: Check Commits
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
script: |
|
||||
const { data: commits } = await github.rest.pulls.listCommits({
|
||||
owner: context.repo.owner,
|
||||
@@ -45,7 +39,7 @@ jobs:
|
||||
per_page: 100
|
||||
});
|
||||
|
||||
const regex = /^((build|chore|ci|docs?|feat|fix|perf|refactor|rft|style|test|i18n|typo)[\:\.\(\,]|[Rr]evert|[Rr]elease)/;
|
||||
const regex = /^((build|chore|ci|docs?|feat!?|fix|perf|refactor|rft|style|test|i18n|typo)[\:\.\(\,]|[Rr]evert|[Rr]elease)/;
|
||||
const invalidCommits = commits.filter(commit => !regex.test(commit.commit.message) || commit.parents.length > 1);
|
||||
|
||||
console.log(`Checked ${commits.length} commit(s)`);
|
||||
@@ -62,4 +56,4 @@ jobs:
|
||||
});
|
||||
|
||||
core.setFailed(`Found ${invalidCommits.length} invalid commit(s):\n${invalidCommitNames.join("\n-------------------\n")}`);
|
||||
}
|
||||
}
|
||||
45
.github/workflows/qodana.yml
vendored
@@ -1,45 +0,0 @@
|
||||
name: Qodana static analysis
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
pull_request: # 在 PR 更新的场合进行扫描
|
||||
paths:
|
||||
- ".github/workflows/qodana.yml"
|
||||
- "src/MaaWpfGui/*"
|
||||
- "qodana.yaml"
|
||||
- "src/MaaWpfGui/**"
|
||||
- "MAA.sln"
|
||||
push: # 在主分支推送代码的场合进行扫描
|
||||
branches:
|
||||
- master
|
||||
- "releases/*"
|
||||
- dev
|
||||
paths:
|
||||
- ".github/workflows/qodana.yml"
|
||||
- "src/MaaWpfGui/**"
|
||||
- "qodana.yaml"
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
checks: write
|
||||
|
||||
jobs:
|
||||
qodana:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha }} # to check out the actual pull request commit, not the merge commit
|
||||
fetch-depth: 0 # a full history is required for pull request analysis
|
||||
show-progress: false
|
||||
|
||||
- name: Qodana Scan
|
||||
uses: JetBrains/qodana-action@main
|
||||
with:
|
||||
pr-mode: false
|
||||
post-pr-comment: true
|
||||
args: --baseline,.github/qodana.sarif.json
|
||||
env:
|
||||
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}
|
||||
19
.github/workflows/release-nightly-ota.yml
vendored
@@ -37,6 +37,7 @@ jobs:
|
||||
tag: ${{ steps.set_tag.outputs.tag }}
|
||||
pre_version: ${{ steps.set_tag.outputs.pre_version }}
|
||||
main_tag_name: ${{ steps.push_main_tag.outputs.main_tag_name }}
|
||||
changelog: ${{ steps.generate_changelog.outputs.changelog }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
@@ -59,6 +60,9 @@ jobs:
|
||||
- name: Set tag
|
||||
id: set_tag
|
||||
run: |
|
||||
# pre_version是上一个公版,这里需要拉上一个tag,避免堆积过多commit
|
||||
$latest_tag=$(git describe --tags --abbrev=0)
|
||||
echo "latest_tag=$latest_tag" >> $env:GITHUB_OUTPUT
|
||||
$described = $(git describe --tags --long --match 'v*')
|
||||
$ids = $($described -split "-")
|
||||
if ($ids.length -eq 3) {
|
||||
@@ -89,6 +93,17 @@ jobs:
|
||||
git push --tags origin HEAD:refs/tags/$main_tag_name -f
|
||||
echo "main_tag_name=$main_tag_name" >> $env:GITHUB_OUTPUT
|
||||
|
||||
- name: Generate Changelog
|
||||
id: generate_changelog
|
||||
run: |
|
||||
python3 tools/ChangelogGenerator/changelog_generator.py --latest "${{ steps.set_tag.outputs.latest_tag }}" --tag "${{ steps.set_tag.outputs.tag }}"
|
||||
$content=$(((Get-Content .\changelog.md) | Select-Object -Skip 2) -join "\n\n")
|
||||
echo "changelog=$content" >> $env:GITHUB_OUTPUT
|
||||
echo $content
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
PYTHONIOENCODING: "utf-8"
|
||||
|
||||
- name: Cache .nuke/temp, ~/.nuget/packages
|
||||
id: cache-nuget
|
||||
uses: actions/cache@v4
|
||||
@@ -97,7 +112,7 @@ jobs:
|
||||
.nuke/temp
|
||||
~/.nuget/packages
|
||||
key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj') }}
|
||||
|
||||
|
||||
- name: Restore dependencies
|
||||
if: steps.cache-nuget.outputs.cache-hit != 'true'
|
||||
run: dotnet restore
|
||||
@@ -233,7 +248,7 @@ jobs:
|
||||
run: |
|
||||
pre_version=${{ needs.build-win-nightly.outputs.pre_version }}
|
||||
cur_version=${{ needs.build-win-nightly.outputs.main_tag_name }}
|
||||
echo -e "${{ inputs.release_body || '' }}\n\n**Full Changelog**: [$pre_version -> $cur_version](https://github.com/$GITHUB_REPOSITORY/compare/$pre_version...$cur_version)" > alpha_changelog.md
|
||||
echo -e "${{ inputs.release_body || '' }}\n\n${{ needs.build-win-nightly.outputs.changelog }}\n\n**Full Changelog**: [$pre_version -> $cur_version](https://github.com/$GITHUB_REPOSITORY/compare/$pre_version...$cur_version)" > alpha_changelog.md
|
||||
export r=$(cat alpha_changelog.md)
|
||||
|
||||
# https://github.com/svenstaro/upload-release-action
|
||||
|
||||
42
.github/workflows/release-ota.yml
vendored
@@ -9,12 +9,12 @@ on:
|
||||
limit:
|
||||
description: Number of releases to fetch from MaaAssistantArknights, 2 at least
|
||||
required: false
|
||||
default: 31
|
||||
default: '31'
|
||||
type: number
|
||||
limit_2:
|
||||
description: Number of releases to fetch from MaaRelease
|
||||
required: false
|
||||
default: 30
|
||||
default: '30'
|
||||
type: number
|
||||
|
||||
env:
|
||||
@@ -25,8 +25,9 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Fetch MaaRelease
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
show-progress: false
|
||||
repository: ${{ format('{0}/{1}', github.repository_owner, 'MaaRelease') }}
|
||||
path: MaaRelease
|
||||
fetch-depth: 0
|
||||
@@ -86,16 +87,18 @@ jobs:
|
||||
uses: actions/download-artifact@v4
|
||||
|
||||
- name: Fetch MaaRelease
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
show-progress: false
|
||||
repository: ${{ format('{0}/{1}', github.repository_owner, 'MaaRelease') }}
|
||||
path: MaaRelease
|
||||
fetch-depth: 0
|
||||
token: ${{ secrets.MAARELEASE_RELEASE }}
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
show-progress: false
|
||||
path: MaaAssistantArknights
|
||||
|
||||
- name: Download latest version for server
|
||||
@@ -123,7 +126,7 @@ jobs:
|
||||
|
||||
make-ota-mac:
|
||||
needs: create-tag
|
||||
runs-on: macos-13
|
||||
runs-on: macos-14
|
||||
steps:
|
||||
- name: Fetch release info
|
||||
run: gh release list --repo 'MaaAssistantArknights/MaaAssistantArknights' --limit ${{ inputs.limit || 31 }} | tee ./release_maa.txt
|
||||
@@ -200,30 +203,3 @@ jobs:
|
||||
- name: Setup release mirror
|
||||
run: |
|
||||
gh workflow --repo MaaAssistantArknights/MaaRelease run release-mirrors.yml
|
||||
|
||||
- name: Deploy docs
|
||||
run: |
|
||||
mkdir -p ${{ runner.temp }}/new
|
||||
mkdir -p ${{ runner.temp }}/old
|
||||
gh api /repos/MaaAssistantArknights/MaaAssistantArknights/tags --jq '.[].name' > ${{ runner.temp }}/release_maa.txt
|
||||
export NEW_VERSION=$(sed -n '1p' ${{ runner.temp }}/release_maa.txt)
|
||||
echo "NEW_VERSION: $NEW_VERSION"
|
||||
export OLD_VERSION=$(sed -n '2p' ${{ runner.temp }}/release_maa.txt)
|
||||
echo "OLD_VERSION: $OLD_VERSION"
|
||||
gh api "/repos/MaaAssistantArknights/MaaAssistantArknights/tarball/$NEW_VERSION" > ${{ runner.temp }}/new.tar.gz
|
||||
gh api "/repos/MaaAssistantArknights/MaaAssistantArknights/tarball/$OLD_VERSION" > ${{ runner.temp }}/old.tar.gz
|
||||
tar -xzf ${{ runner.temp }}/new.tar.gz -C ${{ runner.temp }}/new
|
||||
tar -xzf ${{ runner.temp }}/old.tar.gz -C ${{ runner.temp }}/old
|
||||
export NEW_PATH="${{ runner.temp }}/new/$(ls ${{ runner.temp }}/new)/docs"
|
||||
echo "NEW_PATH: $NEW_PATH"
|
||||
export OLD_PATH="${{ runner.temp }}/old/$(ls ${{ runner.temp }}/old)/docs"
|
||||
echo "OLD_PATH: $OLD_PATH"
|
||||
export DOCS_DIFF=$(diff -aqr $NEW_PATH $OLD_PATH)
|
||||
if [ -n "$DOCS_DIFF" ]; then
|
||||
echo "Found changes, start to deploy the docs:"
|
||||
echo "$DOCS_DIFF"
|
||||
gh workflow --repo MaaAssistantArknights/maa-website run build-and-deploy.yaml
|
||||
echo "Deploying the docs."
|
||||
else
|
||||
echo "Nothing changed, exit."
|
||||
fi
|
||||
|
||||
13
.github/workflows/res-update-game.yml
vendored
@@ -60,7 +60,7 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
show-progress: false
|
||||
repository: Kengxxiao/ArknightsGameData_YoStar
|
||||
repository: Kengxxiao/ArknightsGameData_Yostar
|
||||
ref: main
|
||||
path: .\tools\ResourceUpdater\x64\Release\Overseas
|
||||
sparse-checkout: |
|
||||
@@ -121,23 +121,23 @@ jobs:
|
||||
echo "numbers: "$numbers
|
||||
|
||||
$length = $numbers.Length
|
||||
$isAllEqual = $true
|
||||
$noDiff = $true
|
||||
for ($i = 0; $i -lt $length; $i += 2) {
|
||||
$firstNumber = $numbers[$i]
|
||||
$secondNumber = $numbers[$i+1]
|
||||
|
||||
if ($firstNumber -gt 1) {
|
||||
$isAllEqual = $false
|
||||
$noDiff = $false
|
||||
break
|
||||
}
|
||||
|
||||
if ($firstNumber -ne $secondNumber) {
|
||||
$isAllEqual = $false
|
||||
$noDiff = $false
|
||||
break
|
||||
}
|
||||
}
|
||||
echo "isAllEqual: "$isAllEqual
|
||||
echo "only_sorted=$isAllEqual" >> $env:GITHUB_OUTPUT
|
||||
echo "noDiff: "$noDiff
|
||||
echo "only_sorted=$noDiff" >> $env:GITHUB_OUTPUT
|
||||
|
||||
- name: Cancelling
|
||||
if: steps.check_only_sorted.outputs.only_sorted == 'True'
|
||||
@@ -177,6 +177,7 @@ jobs:
|
||||
github_token: ${{ secrets.MISTEOWORKFLOW }}
|
||||
|
||||
- name: Update OTA resource
|
||||
if: steps.add_files.outputs.have_commits == 'True'
|
||||
run: |
|
||||
gh workflow --repo MaaAssistantArknights/MaaRelease run update-resource.yml
|
||||
|
||||
|
||||
13
.github/workflows/smoke-testing.yml
vendored
@@ -33,6 +33,7 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
show-progress: false
|
||||
submodules: recursive
|
||||
|
||||
- name: Restore dependencies
|
||||
run: dotnet restore
|
||||
@@ -53,17 +54,17 @@ jobs:
|
||||
run: |
|
||||
.\x64\Debug\Sample.exe
|
||||
|
||||
- name: Run tests - YoStarJP
|
||||
- name: Run tests - YostarJP
|
||||
run: |
|
||||
.\x64\Debug\Sample.exe YoStarJP
|
||||
.\x64\Debug\Sample.exe YostarJP
|
||||
|
||||
- name: Run tests - YoStarEN
|
||||
- name: Run tests - YostarEN
|
||||
run: |
|
||||
.\x64\Debug\Sample.exe YoStarEN
|
||||
.\x64\Debug\Sample.exe YostarEN
|
||||
|
||||
- name: Run tests - YoStarKR
|
||||
- name: Run tests - YostarKR
|
||||
run: |
|
||||
.\x64\Debug\Sample.exe YoStarKR
|
||||
.\x64\Debug\Sample.exe YostarKR
|
||||
|
||||
- name: Run tests - txwy
|
||||
run: |
|
||||
|
||||
109
.github/workflows/website-workflow.yml
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
name: MaaWebsite Workflow
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "master"
|
||||
- "dev"
|
||||
paths:
|
||||
- ".github/workflows/website-workflow.yml"
|
||||
- "docs/**"
|
||||
- "website/**"
|
||||
pull_request:
|
||||
paths:
|
||||
- ".github/workflows/website-workflow.yml"
|
||||
- "docs/**"
|
||||
- "website/**"
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
deploy-to-prod-env:
|
||||
description: "Deploy to production environment"
|
||||
default: false
|
||||
required: true
|
||||
type: boolean
|
||||
|
||||
jobs:
|
||||
build:
|
||||
timeout-minutes: 20
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
show-progress: false
|
||||
|
||||
- name: Install pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 9
|
||||
run_install: false
|
||||
|
||||
- name: Setup Node.js environment
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
cache: pnpm
|
||||
cache-dependency-path: './website/pnpm-lock.yaml'
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install --frozen-lockfile
|
||||
working-directory: "./website"
|
||||
|
||||
- name: Build
|
||||
run: pnpm run build
|
||||
working-directory: "./website"
|
||||
|
||||
- name: Upload artifact to GitHub
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: dist
|
||||
path: "./website/dist"
|
||||
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: github.event_name != 'pull_request'
|
||||
steps:
|
||||
- name: Download website artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: dist
|
||||
|
||||
- name: Set deployment environment
|
||||
id: set-deployment-env
|
||||
run: |
|
||||
if [[ "${{ github.event_name }}" != "workflow_dispatch" && "${{ github.ref }}" == "refs/heads/master" ]] || [[ "${{ github.event.inputs.deploy-to-prod-env }}" == "true" ]]; then
|
||||
echo "AZURE_TARGET_ENV=prod" >> $GITHUB_ENV
|
||||
else
|
||||
echo "AZURE_TARGET_ENV=dev" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- name: Show environment
|
||||
run: echo ${{ env.AZURE_TARGET_ENV }}
|
||||
|
||||
- name: Deploy to Azure (prod)
|
||||
id: deploy-prod
|
||||
uses: Azure/static-web-apps-deploy@v1
|
||||
if: env.AZURE_TARGET_ENV == 'prod'
|
||||
with:
|
||||
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_MAA_WEBSITE }}
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
action: "upload"
|
||||
app_location: "."
|
||||
api_location: ""
|
||||
skip_app_build: true
|
||||
skip_api_build: true
|
||||
|
||||
- name: Deploy to Azure (dev)
|
||||
id: deploy-dev
|
||||
uses: Azure/static-web-apps-deploy@v1
|
||||
if: env.AZURE_TARGET_ENV == 'dev'
|
||||
with:
|
||||
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_MAA_WEBSITE }}
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
action: "upload"
|
||||
deployment_environment: dev
|
||||
app_location: "."
|
||||
api_location: ""
|
||||
skip_app_build: true
|
||||
skip_api_build: true
|
||||
3
.gitmodules
vendored
@@ -12,3 +12,6 @@
|
||||
[submodule "src/maa-cli"]
|
||||
path = src/maa-cli
|
||||
url = https://github.com/MaaAssistantArknights/maa-cli.git
|
||||
[submodule "3rdparty/EmulatorExtras"]
|
||||
path = 3rdparty/EmulatorExtras
|
||||
url = https://github.com/MaaXYZ/EmulatorExtras.git
|
||||
|
||||
5
.linkspector.yml
Normal file
@@ -0,0 +1,5 @@
|
||||
dirs:
|
||||
- .
|
||||
useGitIgnore: true
|
||||
ignorePatterns:
|
||||
- pattern: "^https?://127.0.0.1(:\\d+)?/"
|
||||
1
3rdparty/EmulatorExtras
vendored
Submodule
172
3rdparty/include/Arknights-Tile-Pos/TileCalc.hpp
vendored
@@ -1,172 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <cmath>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <meojson/json.hpp>
|
||||
#include <opencv2/core.hpp>
|
||||
|
||||
#include "TileDef.hpp"
|
||||
|
||||
namespace Map
|
||||
{
|
||||
struct Tile
|
||||
{
|
||||
int heightType = 0;
|
||||
int buildableType = 0;
|
||||
std::string tileKey;
|
||||
};
|
||||
|
||||
class Level
|
||||
{
|
||||
public:
|
||||
Level(const json::value& data);
|
||||
int get_width() const { return width; }
|
||||
int get_height() const { return height; }
|
||||
Tile get_item(int y, int x) const { return tiles[y][x]; }
|
||||
std::vector<cv::Point3d> view;
|
||||
LevelKey key;
|
||||
|
||||
private:
|
||||
int height = 0;
|
||||
int width = 0;
|
||||
std::vector<std::vector<Tile>> tiles;
|
||||
};
|
||||
|
||||
class TileCalc
|
||||
{
|
||||
public:
|
||||
TileCalc(int width, int height);
|
||||
|
||||
bool run(const Level& level, bool side, std::vector<std::vector<cv::Point2d>>& out_pos,
|
||||
std::vector<std::vector<Tile>>& out_tiles, double shift_x = 0, double shift_y = 0) const;
|
||||
|
||||
private:
|
||||
bool adapter(double& x, double& y) const;
|
||||
|
||||
int width = 0;
|
||||
int height = 0;
|
||||
const double degree = atan(1.0) * 4 / 180;
|
||||
std::vector<Level> levels;
|
||||
cv::Mat MatrixP = cv::Mat(4, 4, CV_64F);
|
||||
cv::Mat MatrixX = cv::Mat(4, 4, CV_64F);
|
||||
cv::Mat MatrixY = cv::Mat(4, 4, CV_64F);
|
||||
};
|
||||
|
||||
inline void InitMat4x4(cv::Mat& m, double (*num)[4])
|
||||
{
|
||||
for (int i = 0; i < m.rows; i++)
|
||||
for (int j = 0; j < m.cols; j++)
|
||||
m.at<double>(i, j) = num[i][j];
|
||||
}
|
||||
|
||||
inline Level::Level(const json::value& data)
|
||||
{
|
||||
key.stageId = data.at("stageId").as_string();
|
||||
key.code = data.at("code").as_string();
|
||||
key.levelId = data.at("levelId").as_string();
|
||||
key.name = data.get("name", "null");
|
||||
this->height = data.at("height").as_integer();
|
||||
this->width = data.at("width").as_integer();
|
||||
for (const json::value& point_data : data.at("view").as_array()) {
|
||||
cv::Point3d tmp;
|
||||
auto point_array = point_data.as_array();
|
||||
tmp.x = point_array[0].as_double();
|
||||
tmp.y = point_array[1].as_double();
|
||||
tmp.z = point_array[2].as_double();
|
||||
this->view.emplace_back(std::move(tmp));
|
||||
}
|
||||
for (const json::value& row : data.at("tiles").as_array()) {
|
||||
std::vector<Tile> tmp;
|
||||
tmp.reserve(this->width);
|
||||
for (const json::value& tile : row.as_array()) {
|
||||
tmp.emplace_back(Tile { tile.at("heightType").as_integer(), tile.at("buildableType").as_integer(),
|
||||
tile.get("tileKey", std::string()) });
|
||||
}
|
||||
tiles.emplace_back(std::move(tmp));
|
||||
}
|
||||
}
|
||||
|
||||
inline TileCalc::TileCalc(int width, int height)
|
||||
{
|
||||
this->width = width;
|
||||
this->height = height;
|
||||
double ratio = static_cast<double>(height) / width;
|
||||
double matrixP[4][4] { { ratio / tan(20 * degree), 0, 0, 0 },
|
||||
{ 0, 1 / tan(20 * degree), 0, 0 },
|
||||
{ 0, 0, -(1000 + 0.3) / (1000 - 0.3), -(1000 * 0.3 * 2) / (1000 - 0.3) },
|
||||
{ 0, 0, -1, 0 } };
|
||||
InitMat4x4(this->MatrixP, matrixP);
|
||||
double matrixX[4][4] { { 1, 0, 0, 0 },
|
||||
{ 0, cos(30 * degree), -sin(30 * degree), 0 },
|
||||
{ 0, -sin(30 * degree), -cos(30 * degree), 0 },
|
||||
{ 0, 0, 0, 1 } };
|
||||
InitMat4x4(this->MatrixX, matrixX);
|
||||
double matrixY[4][4] { { cos(10 * degree), 0, sin(10 * degree), 0 },
|
||||
{ 0, 1, 0, 0 },
|
||||
{ -sin(10 * degree), 0, cos(10 * degree), 0 },
|
||||
{ 0, 0, 0, 1 } };
|
||||
InitMat4x4(this->MatrixY, matrixY);
|
||||
}
|
||||
|
||||
inline bool TileCalc::run(const Level& level, bool side, std::vector<std::vector<cv::Point2d>>& out_pos,
|
||||
std::vector<std::vector<Tile>>& out_tiles, double shift_x, double shift_y) const
|
||||
{
|
||||
auto [x, y, z] = level.view[side ? 1 : 0];
|
||||
double adapter_y = 0, adapter_z = 0;
|
||||
this->adapter(adapter_y, adapter_z);
|
||||
double matrix[4][4] {
|
||||
{ 1, 0, 0, -x }, { 0, 1, 0, -y - adapter_y }, { 0, 0, 1, -z - adapter_z }, { 0, 0, 0, 1 }
|
||||
};
|
||||
auto raw = cv::Mat(cv::Size(4, 4), CV_64F);
|
||||
auto Finall_Matrix = cv::Mat(cv::Size(4, 4), CV_64F);
|
||||
InitMat4x4(raw, matrix);
|
||||
if (side) {
|
||||
Finall_Matrix = this->MatrixP * this->MatrixX * this->MatrixY * raw;
|
||||
}
|
||||
else {
|
||||
Finall_Matrix = this->MatrixP * this->MatrixX * raw;
|
||||
}
|
||||
int h = level.get_height();
|
||||
int w = level.get_width();
|
||||
auto map_point = cv::Mat(cv::Size(1, 4), CV_64F);
|
||||
map_point.at<double>(3, 0) = 1;
|
||||
auto tmp_pos = std::vector<cv::Point2d>(w);
|
||||
auto tmp_tiles = std::vector<Tile>(w);
|
||||
for (int i = 0; i < h; i++) {
|
||||
for (int j = 0; j < w; j++) {
|
||||
tmp_tiles[j] = level.get_item(i, j);
|
||||
map_point.at<double>(0, 0) = j - (w - 1) / 2.0 + shift_x;
|
||||
map_point.at<double>(1, 0) = (h - 1) / 2.0 - i + shift_y;
|
||||
map_point.at<double>(2, 0) = tmp_tiles[j].heightType * -0.4;
|
||||
cv::Mat view_point = Finall_Matrix * map_point;
|
||||
view_point = view_point / view_point.at<double>(3, 0);
|
||||
view_point = (view_point + 1) / 2;
|
||||
tmp_pos[j] = cv::Point2d(view_point.at<double>(0, 0) * this->width,
|
||||
(1 - view_point.at<double>(1, 0)) * this->height);
|
||||
}
|
||||
out_pos.emplace_back(tmp_pos);
|
||||
out_tiles.emplace_back(tmp_tiles);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
inline bool TileCalc::adapter(double& x, double& y) const
|
||||
{
|
||||
const double fromRatio = 9.0 / 16;
|
||||
const double toRatio = 3.0 / 4;
|
||||
double ratio = static_cast<double>(height) / width;
|
||||
if (ratio < fromRatio - 0.00001) {
|
||||
x = 0;
|
||||
y = 0;
|
||||
return false;
|
||||
}
|
||||
double t = (ratio - fromRatio) / (toRatio - fromRatio);
|
||||
x = -1.4 * t;
|
||||
y = -2.8 * t;
|
||||
return true;
|
||||
}
|
||||
} // namespace Map
|
||||
137
3rdparty/include/Arknights-Tile-Pos/TileCalc2.hpp
vendored
Normal file
@@ -0,0 +1,137 @@
|
||||
#pragma once
|
||||
|
||||
#include <meojson/json.hpp>
|
||||
#include <numbers>
|
||||
#include <opencv2/core/matx.hpp>
|
||||
#include <opencv2/core/types.hpp>
|
||||
|
||||
#include "TileDef.hpp"
|
||||
|
||||
namespace Map::TileCalc2
|
||||
{
|
||||
using vec3d = cv::Vec3d;
|
||||
using matrix4x4 = cv::Matx44d;
|
||||
static constexpr double degree = std::numbers::pi / 180;
|
||||
|
||||
inline vec3d camera_pos(const Level& level, bool side = false, int width = 1280, int height = 720)
|
||||
{
|
||||
const auto [x, y, z] = level.view[side ? 1 : 0];
|
||||
|
||||
static constexpr double fromRatio = 9. / 16;
|
||||
static constexpr double toRatio = 3. / 4;
|
||||
const double ratio = static_cast<double>(height) / width;
|
||||
const double t = (fromRatio - ratio) / (fromRatio - toRatio);
|
||||
const vec3d pos_adj = { -1.4 * t, -2.8 * t, 0 };
|
||||
return { x + pos_adj[0], y + pos_adj[1], z + pos_adj[2] };
|
||||
}
|
||||
|
||||
inline vec3d camera_euler_angles_yxz(const Level& /*level*/, bool side = false)
|
||||
{
|
||||
if (side) {
|
||||
return { 10 * degree, 30 * degree, 0 };
|
||||
}
|
||||
|
||||
return { 0, 30 * degree, 0 };
|
||||
}
|
||||
|
||||
inline matrix4x4 camera_matrix_from_trans(
|
||||
const vec3d& pos,
|
||||
const vec3d& euler,
|
||||
double ratio,
|
||||
double fov_2_y = 20 * degree,
|
||||
double far = 1000,
|
||||
double near = 0.3)
|
||||
{
|
||||
const double cos_y = std::cos(euler[0]);
|
||||
const double sin_y = std::sin(euler[0]);
|
||||
const double cos_x = std::cos(euler[1]);
|
||||
const double sin_x = std::sin(euler[1]);
|
||||
const double tan_f = std::tan(fov_2_y);
|
||||
|
||||
const matrix4x4 translate = {
|
||||
1, 0, 0, -pos[0], //
|
||||
0, 1, 0, -pos[1], //
|
||||
0, 0, 1, -pos[2], //
|
||||
0, 0, 0, 1,
|
||||
};
|
||||
const matrix4x4 matrixY = {
|
||||
cos_y, 0, sin_y, 0, //
|
||||
0, 1, 0, 0, //
|
||||
-sin_y, 0, cos_y, 0, //
|
||||
0, 0, 0, 1,
|
||||
};
|
||||
const matrix4x4 matrixX = {
|
||||
1, 0, 0, 0, //
|
||||
0, cos_x, -sin_x, 0, //
|
||||
0, -sin_x, -cos_x, 0, //
|
||||
0, 0, 0, 1,
|
||||
};
|
||||
const matrix4x4 proj = {
|
||||
// clang-format off
|
||||
ratio / tan_f, 0, 0, 0,
|
||||
0, 1 / tan_f, 0, 0,
|
||||
0, 0, -(far + near) / (far - near), -(far * near * 2) / (far - near),
|
||||
0, 0, -1, 0,
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
return proj * matrixX * matrixY * translate;
|
||||
}
|
||||
|
||||
inline cv::Point
|
||||
world_to_screen(const Level& level, const vec3d& world_pos, bool side, const vec3d& offset = {})
|
||||
{
|
||||
static constexpr double width = 1280;
|
||||
static constexpr double height = 720;
|
||||
const vec3d pos_cam = camera_pos(level, side, width, height) + offset;
|
||||
const vec3d euler = camera_euler_angles_yxz(level, side);
|
||||
const matrix4x4 matrix = camera_matrix_from_trans(pos_cam, euler, height / width);
|
||||
auto result = matrix * cv::Point3d(world_pos);
|
||||
result = result / result(3);
|
||||
result = (result + cv::Vec4d::ones()) / 2.;
|
||||
return {
|
||||
static_cast<int>(std::round(result(0) * width)),
|
||||
static_cast<int>(std::round((1 - result(1)) * height)),
|
||||
};
|
||||
}
|
||||
|
||||
inline vec3d get_tile_world_pos(const Level& level, int tile_y, int tile_x)
|
||||
{
|
||||
const int h = level.get_height();
|
||||
const int w = level.get_width();
|
||||
const auto& tile = level.get_item(tile_y, tile_x);
|
||||
return {
|
||||
tile_x - (w - 1) / 2.,
|
||||
(h - 1) / 2. - tile_y,
|
||||
tile.heightType * -0.4,
|
||||
};
|
||||
}
|
||||
|
||||
inline auto get_tile_screen_pos(
|
||||
const Level& level,
|
||||
int tile_y,
|
||||
int tile_x,
|
||||
bool side = false,
|
||||
const vec3d& offset = {})
|
||||
{
|
||||
return world_to_screen(level, get_tile_world_pos(level, tile_y, tile_x), side, offset);
|
||||
}
|
||||
|
||||
static constexpr double rel_pos_x = 1.3143386840820312;
|
||||
static constexpr double rel_pos_y = 1.314337134361267;
|
||||
static constexpr double rel_pos_z = -0.3967874050140381;
|
||||
|
||||
inline auto get_retreat_screen_pos(const Level& level)
|
||||
{
|
||||
const vec3d relative_pos = { -rel_pos_x, +rel_pos_y, rel_pos_z };
|
||||
return world_to_screen(level, relative_pos, true);
|
||||
}
|
||||
|
||||
inline auto get_skill_screen_pos(const Level& level)
|
||||
{
|
||||
const vec3d relative_pos = { +rel_pos_x, -rel_pos_y, rel_pos_z };
|
||||
return world_to_screen(level, relative_pos, true);
|
||||
}
|
||||
|
||||
} // namespace Map::TileCalc2
|
||||
|
||||
106
3rdparty/include/Arknights-Tile-Pos/TileDef.hpp
vendored
@@ -1,32 +1,94 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <meojson/json.hpp>
|
||||
#include <opencv2/core.hpp>
|
||||
|
||||
namespace Map
|
||||
{
|
||||
struct LevelKey
|
||||
{
|
||||
std::string stageId;
|
||||
std::string code;
|
||||
std::string levelId;
|
||||
std::string name;
|
||||
struct LevelKey
|
||||
{
|
||||
std::string stageId;
|
||||
std::string code;
|
||||
std::string levelId;
|
||||
std::string name;
|
||||
|
||||
bool empty_or_equal(const std::string& lhs, const std::string& rhs) const noexcept
|
||||
{
|
||||
return (lhs.empty() || rhs.empty()) ? true : lhs == rhs;
|
||||
bool empty_or_equal(const std::string& lhs, const std::string& rhs) const noexcept
|
||||
{
|
||||
return (lhs.empty() || rhs.empty()) ? true : lhs == rhs;
|
||||
}
|
||||
|
||||
bool operator==(const LevelKey& other) const noexcept
|
||||
{
|
||||
return empty_or_equal(stageId, other.stageId) && empty_or_equal(code, other.code)
|
||||
&& empty_or_equal(levelId, other.levelId) && empty_or_equal(name, other.name);
|
||||
}
|
||||
|
||||
bool operator==(const std::string& any_key) const noexcept
|
||||
{
|
||||
if (any_key.empty()) {
|
||||
return false;
|
||||
}
|
||||
bool operator==(const LevelKey& other) const noexcept
|
||||
{
|
||||
return empty_or_equal(stageId, other.stageId) && empty_or_equal(code, other.code) &&
|
||||
empty_or_equal(levelId, other.levelId) && empty_or_equal(name, other.name);
|
||||
return empty_or_equal(stageId, any_key) || empty_or_equal(code, any_key)
|
||||
|| empty_or_equal(levelId, any_key) || empty_or_equal(name, any_key);
|
||||
}
|
||||
};
|
||||
|
||||
struct Tile
|
||||
{
|
||||
int heightType = 0;
|
||||
int buildableType = 0;
|
||||
std::string tileKey;
|
||||
};
|
||||
|
||||
class Level
|
||||
{
|
||||
public:
|
||||
explicit Level(const json::value& data);
|
||||
Level() = default;
|
||||
|
||||
int get_width() const { return width; }
|
||||
|
||||
int get_height() const { return height; }
|
||||
|
||||
Tile get_item(int y, int x) const { return tiles[y][x]; }
|
||||
|
||||
std::vector<cv::Point3d> view {};
|
||||
LevelKey key {};
|
||||
|
||||
private:
|
||||
int height = 0;
|
||||
int width = 0;
|
||||
std::vector<std::vector<Tile>> tiles;
|
||||
};
|
||||
|
||||
inline Level::Level(const json::value& data)
|
||||
{
|
||||
key.stageId = data.at("stageId").as_string();
|
||||
key.code = data.at("code").as_string();
|
||||
key.levelId = data.at("levelId").as_string();
|
||||
key.name = data.get("name", "null");
|
||||
this->height = data.at("height").as_integer();
|
||||
this->width = data.at("width").as_integer();
|
||||
for (const json::value& point_data : data.at("view").as_array()) {
|
||||
cv::Point3d tmp;
|
||||
auto point_array = point_data.as_array();
|
||||
tmp.x = point_array[0].as_double();
|
||||
tmp.y = point_array[1].as_double();
|
||||
tmp.z = point_array[2].as_double();
|
||||
this->view.emplace_back(tmp);
|
||||
}
|
||||
for (const json::value& row : data.at("tiles").as_array()) {
|
||||
std::vector<Tile> tmp;
|
||||
tmp.reserve(this->width);
|
||||
for (const json::value& tile : row.as_array()) {
|
||||
tmp.emplace_back(Tile { tile.at("heightType").as_integer(),
|
||||
tile.at("buildableType").as_integer(),
|
||||
tile.get("tileKey", std::string()) });
|
||||
}
|
||||
bool operator==(const std::string& any_key) const noexcept
|
||||
{
|
||||
if (any_key.empty()) {
|
||||
return false;
|
||||
}
|
||||
return empty_or_equal(stageId, any_key) || empty_or_equal(code, any_key) ||
|
||||
empty_or_equal(levelId, any_key) || empty_or_equal(name, any_key);
|
||||
}
|
||||
};
|
||||
tiles.emplace_back(std::move(tmp));
|
||||
}
|
||||
}
|
||||
} // namespace Map
|
||||
|
||||
195
3rdparty/include/meojson/.clang-format
vendored
@@ -1,195 +0,0 @@
|
||||
Language: Json
|
||||
ColumnLimit: 1000
|
||||
IndentWidth: 4
|
||||
---
|
||||
Language: Cpp
|
||||
AccessModifierOffset: -4
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignArrayOfStructures: None
|
||||
AlignConsecutiveMacros: None
|
||||
AlignConsecutiveAssignments: None
|
||||
AlignConsecutiveBitFields: None
|
||||
AlignConsecutiveDeclarations: None
|
||||
AlignEscapedNewlines: Left
|
||||
AlignOperands: Align
|
||||
AlignTrailingComments: true
|
||||
AllowAllArgumentsOnNextLine: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: true
|
||||
AllowShortEnumsOnASingleLine: false
|
||||
AllowShortBlocksOnASingleLine: Empty
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: Inline
|
||||
AllowShortLambdasOnASingleLine: All
|
||||
AllowShortIfStatementsOnASingleLine: WithoutElse
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AlwaysBreakAfterDefinitionReturnType: None
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: false
|
||||
AlwaysBreakTemplateDeclarations: true
|
||||
AttributeMacros:
|
||||
- __capability
|
||||
BinPackArguments: true
|
||||
BinPackParameters: true
|
||||
BraceWrapping:
|
||||
AfterCaseLabel: false
|
||||
AfterClass: true
|
||||
AfterControlStatement: Never
|
||||
AfterEnum: true
|
||||
AfterFunction: true
|
||||
AfterNamespace: true
|
||||
AfterObjCDeclaration: true
|
||||
AfterStruct: true
|
||||
AfterUnion: false
|
||||
AfterExternBlock: true
|
||||
BeforeCatch: true
|
||||
BeforeElse: true
|
||||
BeforeLambdaBody: false
|
||||
BeforeWhile: false
|
||||
IndentBraces: false
|
||||
SplitEmptyFunction: false
|
||||
SplitEmptyRecord: false
|
||||
SplitEmptyNamespace: false
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeConceptDeclarations: true
|
||||
BreakBeforeBraces: Custom
|
||||
BreakBeforeInheritanceComma: false
|
||||
BreakInheritanceList: BeforeColon
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializersBeforeComma: false
|
||||
BreakConstructorInitializers: BeforeColon
|
||||
BreakAfterJavaFieldAnnotations: false
|
||||
BreakStringLiterals: true
|
||||
ColumnLimit: 120
|
||||
CommentPragmas: '^ IWYU pragma:'
|
||||
QualifierAlignment: Leave
|
||||
CompactNamespaces: false
|
||||
ConstructorInitializerIndentWidth: 4
|
||||
ContinuationIndentWidth: 4
|
||||
Cpp11BracedListStyle: false
|
||||
DeriveLineEnding: true
|
||||
DerivePointerAlignment: false
|
||||
DisableFormat: false
|
||||
EmptyLineAfterAccessModifier: Never
|
||||
EmptyLineBeforeAccessModifier: LogicalBlock
|
||||
ExperimentalAutoDetectBinPacking: false
|
||||
PackConstructorInitializers: BinPack
|
||||
BasedOnStyle: ''
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
||||
AllowAllConstructorInitializersOnNextLine: true
|
||||
FixNamespaceComments: true
|
||||
ForEachMacros:
|
||||
- foreach
|
||||
- Q_FOREACH
|
||||
- BOOST_FOREACH
|
||||
IfMacros:
|
||||
- KJ_IF_MAYBE
|
||||
IncludeBlocks: Preserve
|
||||
IncludeCategories:
|
||||
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
|
||||
Priority: 2
|
||||
SortPriority: 0
|
||||
CaseSensitive: false
|
||||
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
|
||||
Priority: 3
|
||||
SortPriority: 0
|
||||
CaseSensitive: false
|
||||
- Regex: '.*'
|
||||
Priority: 1
|
||||
SortPriority: 0
|
||||
CaseSensitive: false
|
||||
IncludeIsMainRegex: '(Test)?$'
|
||||
IncludeIsMainSourceRegex: ''
|
||||
IndentAccessModifiers: false
|
||||
IndentCaseLabels: false
|
||||
IndentCaseBlocks: false
|
||||
IndentGotoLabels: true
|
||||
IndentPPDirectives: None
|
||||
IndentExternBlock: AfterExternBlock
|
||||
IndentRequiresClause: false
|
||||
IndentWidth: 4
|
||||
IndentWrappedFunctionNames: false
|
||||
InsertTrailingCommas: None
|
||||
JavaScriptQuotes: Leave
|
||||
JavaScriptWrapImports: true
|
||||
KeepEmptyLinesAtTheStartOfBlocks: true
|
||||
LambdaBodyIndentation: Signature
|
||||
MacroBlockBegin: ''
|
||||
MacroBlockEnd: ''
|
||||
MaxEmptyLinesToKeep: 1
|
||||
NamespaceIndentation: Inner
|
||||
ObjCBinPackProtocolList: Auto
|
||||
ObjCBlockIndentWidth: 2
|
||||
ObjCBreakBeforeNestedBlockParam: true
|
||||
ObjCSpaceAfterProperty: false
|
||||
ObjCSpaceBeforeProtocolList: true
|
||||
PenaltyBreakAssignment: 2
|
||||
PenaltyBreakBeforeFirstCallParameter: 19
|
||||
PenaltyBreakComment: 300
|
||||
PenaltyBreakFirstLessLess: 120
|
||||
PenaltyBreakOpenParenthesis: 0
|
||||
PenaltyBreakString: 1000
|
||||
PenaltyBreakTemplateDeclaration: 10
|
||||
PenaltyExcessCharacter: 1000000
|
||||
PenaltyReturnTypeOnItsOwnLine: 1000
|
||||
PenaltyIndentedWhitespace: 0
|
||||
PointerAlignment: Left
|
||||
PPIndentWidth: -1
|
||||
ReferenceAlignment: Pointer
|
||||
ReflowComments: true
|
||||
RemoveBracesLLVM: false
|
||||
RequiresClausePosition: OwnLine
|
||||
SeparateDefinitionBlocks: Leave
|
||||
ShortNamespaceLines: 50
|
||||
SortIncludes: CaseSensitive
|
||||
SortJavaStaticImport: Before
|
||||
SortUsingDeclarations: true
|
||||
SpaceAfterCStyleCast: false
|
||||
SpaceAfterLogicalNot: false
|
||||
SpaceAfterTemplateKeyword: true
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeCaseColon: false
|
||||
SpaceBeforeCpp11BracedList: true
|
||||
SpaceBeforeCtorInitializerColon: true
|
||||
SpaceBeforeInheritanceColon: true
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceBeforeParensOptions:
|
||||
AfterControlStatements: true
|
||||
AfterForeachMacros: true
|
||||
AfterFunctionDefinitionName: false
|
||||
AfterFunctionDeclarationName: false
|
||||
AfterIfMacros: true
|
||||
AfterOverloadedOperator: false
|
||||
AfterRequiresInClause: true
|
||||
AfterRequiresInExpression: true
|
||||
BeforeNonEmptyParentheses: false
|
||||
SpaceAroundPointerQualifiers: Default
|
||||
SpaceBeforeRangeBasedForLoopColon: true
|
||||
SpaceInEmptyBlock: false
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesBeforeTrailingComments: 1
|
||||
SpacesInAngles: Never
|
||||
SpacesInConditionalStatement: false
|
||||
SpacesInContainerLiterals: true
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInLineCommentPrefix:
|
||||
Minimum: 1
|
||||
Maximum: -1
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
SpaceBeforeSquareBrackets: false
|
||||
BitFieldColonSpacing: Both
|
||||
Standard: c++20
|
||||
StatementAttributeLikeMacros:
|
||||
- Q_EMIT
|
||||
StatementMacros:
|
||||
- Q_UNUSED
|
||||
- QT_REQUIRE_VERSION
|
||||
TabWidth: 4
|
||||
UseCRLF: false
|
||||
UseTab: Never
|
||||
WhitespaceSensitiveMacros:
|
||||
- STRINGIZE
|
||||
- PP_STRINGIZE
|
||||
- BOOST_PP_STRINGIZE
|
||||
- NS_SWIFT_NAME
|
||||
- CF_SWIFT_NAME
|
||||
533
3rdparty/include/meojson/common/array.hpp
vendored
Normal file
@@ -0,0 +1,533 @@
|
||||
#pragma once
|
||||
|
||||
#include <initializer_list>
|
||||
#include <optional>
|
||||
#include <ostream>
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
#include <vector>
|
||||
|
||||
#include "exception.hpp"
|
||||
#include "utils.hpp"
|
||||
|
||||
namespace json
|
||||
{
|
||||
template <typename string_t>
|
||||
class basic_array
|
||||
{
|
||||
friend class basic_value<string_t>;
|
||||
friend class basic_object<string_t>;
|
||||
|
||||
public:
|
||||
using raw_array = std::vector<basic_value<string_t>>;
|
||||
using value_type = typename raw_array::value_type;
|
||||
using iterator = typename raw_array::iterator;
|
||||
using const_iterator = typename raw_array::const_iterator;
|
||||
using reverse_iterator = typename raw_array::reverse_iterator;
|
||||
using const_reverse_iterator = typename raw_array::const_reverse_iterator;
|
||||
using char_t = typename string_t::value_type;
|
||||
|
||||
public:
|
||||
basic_array() = default;
|
||||
basic_array(const basic_array<string_t>& rhs) = default;
|
||||
basic_array(basic_array<string_t>&& rhs) noexcept = default;
|
||||
basic_array(std::initializer_list<value_type> init_list);
|
||||
basic_array(typename raw_array::size_type size);
|
||||
|
||||
// explicit basic_array(const basic_value<string_t>& val);
|
||||
// explicit basic_array(basic_value<string_t>&& val);
|
||||
|
||||
template <typename collection_t,
|
||||
std::enable_if_t<_utils::is_collection<collection_t> &&
|
||||
std::is_constructible_v<value_type, _utils::range_value_t<collection_t>>,
|
||||
bool> = true>
|
||||
basic_array(collection_t arr)
|
||||
: _array_data(std::make_move_iterator(arr.begin()), std::make_move_iterator(arr.end()))
|
||||
{}
|
||||
template <typename jsonization_t,
|
||||
std::enable_if_t<_utils::has_to_json_in_member<jsonization_t>::value, bool> = true>
|
||||
basic_array(const jsonization_t& value) : basic_array(value.to_json())
|
||||
{}
|
||||
template <typename jsonization_t,
|
||||
std::enable_if_t<_utils::has_to_json_in_templ_spec<jsonization_t>::value, bool> = true>
|
||||
basic_array(const jsonization_t& value) : basic_array(ext::jsonization<jsonization_t>().to_json(value))
|
||||
{}
|
||||
|
||||
~basic_array() noexcept = default;
|
||||
|
||||
bool empty() const noexcept { return _array_data.empty(); }
|
||||
size_t size() const noexcept { return _array_data.size(); }
|
||||
bool contains(size_t pos) const { return pos < _array_data.size(); }
|
||||
bool exists(size_t pos) const { return contains(pos); }
|
||||
const basic_value<string_t>& at(size_t pos) const;
|
||||
|
||||
string_t dumps(std::optional<size_t> indent = std::nullopt) const { return indent ? format(*indent) : to_string(); }
|
||||
string_t to_string() const;
|
||||
string_t format(size_t indent = 4) const { return format(indent, 0); }
|
||||
template <typename value_t>
|
||||
bool all() const;
|
||||
template <typename value_t, template <typename...> typename collection_t = std::vector>
|
||||
collection_t<value_t> as_collection() const;
|
||||
|
||||
// Usage: get(key_1, key_2, ..., default_value);
|
||||
template <typename... key_then_default_value_t>
|
||||
auto get(key_then_default_value_t&&... keys_then_default_value) const;
|
||||
|
||||
template <typename value_t = basic_value<string_t>>
|
||||
std::optional<value_t> find(size_t pos) const;
|
||||
|
||||
template <typename... args_t>
|
||||
decltype(auto) emplace_back(args_t&&... args);
|
||||
template <typename... args_t>
|
||||
decltype(auto) push_back(args_t&&... args);
|
||||
|
||||
void clear() noexcept;
|
||||
bool erase(size_t pos);
|
||||
bool erase(iterator iter);
|
||||
|
||||
iterator begin() noexcept;
|
||||
iterator end() noexcept;
|
||||
const_iterator begin() const noexcept;
|
||||
const_iterator end() const noexcept;
|
||||
const_iterator cbegin() const noexcept;
|
||||
const_iterator cend() const noexcept;
|
||||
|
||||
reverse_iterator rbegin() noexcept;
|
||||
reverse_iterator rend() noexcept;
|
||||
const_reverse_iterator rbegin() const noexcept;
|
||||
const_reverse_iterator rend() const noexcept;
|
||||
const_reverse_iterator crbegin() const noexcept;
|
||||
const_reverse_iterator crend() const noexcept;
|
||||
|
||||
const basic_value<string_t>& operator[](size_t pos) const;
|
||||
basic_value<string_t>& operator[](size_t pos);
|
||||
|
||||
basic_array<string_t> operator+(const basic_array<string_t>& rhs) const&;
|
||||
basic_array<string_t> operator+(basic_array<string_t>&& rhs) const&;
|
||||
basic_array<string_t> operator+(const basic_array<string_t>& rhs) &&;
|
||||
basic_array<string_t> operator+(basic_array<string_t>&& rhs) &&;
|
||||
|
||||
basic_array<string_t>& operator+=(const basic_array<string_t>& rhs);
|
||||
basic_array<string_t>& operator+=(basic_array<string_t>&& rhs);
|
||||
|
||||
basic_array<string_t>& operator=(const basic_array<string_t>&) = default;
|
||||
basic_array<string_t>& operator=(basic_array<string_t>&&) noexcept = default;
|
||||
template <typename value_t, std::enable_if_t<std::is_convertible_v<value_t, basic_array<string_t>>, bool> = true>
|
||||
basic_array<string_t>& operator=(value_t rhs)
|
||||
{
|
||||
return *this = basic_array<string_t>(std::move(rhs));
|
||||
}
|
||||
|
||||
bool operator==(const basic_array<string_t>& rhs) const;
|
||||
bool operator!=(const basic_array<string_t>& rhs) const { return !(*this == rhs); }
|
||||
|
||||
template <typename value_t, template <typename...> typename collection_t = std::vector,
|
||||
std::enable_if_t<_utils::is_collection<collection_t<value_t>>, bool> = true>
|
||||
explicit operator collection_t<value_t>() const
|
||||
{
|
||||
return as_collection<value_t, collection_t>();
|
||||
}
|
||||
template <typename jsonization_t,
|
||||
std::enable_if_t<_utils::has_from_json_in_member<jsonization_t, string_t>::value, bool> = true>
|
||||
explicit operator jsonization_t() const
|
||||
{
|
||||
jsonization_t dst {};
|
||||
if (!dst.from_json(*this)) {
|
||||
throw exception("Wrong JSON");
|
||||
}
|
||||
return dst;
|
||||
}
|
||||
template <typename jsonization_t,
|
||||
std::enable_if_t<_utils::has_from_json_in_templ_spec<jsonization_t, string_t>::value, bool> = true>
|
||||
explicit operator jsonization_t() const
|
||||
{
|
||||
jsonization_t dst {};
|
||||
if (!ext::jsonization<jsonization_t>().from_json(*this, dst)) {
|
||||
throw exception("Wrong JSON");
|
||||
}
|
||||
return dst;
|
||||
}
|
||||
|
||||
private:
|
||||
template <typename... key_then_default_value_t, size_t... keys_indexes_t>
|
||||
auto get(std::tuple<key_then_default_value_t...> keys_then_default_value,
|
||||
std::index_sequence<keys_indexes_t...>) const;
|
||||
template <typename value_t, typename... rest_keys_t>
|
||||
auto get_helper(const value_t& default_value, size_t pos, rest_keys_t&&... rest) const;
|
||||
template <typename value_t>
|
||||
auto get_helper(const value_t& default_value, size_t pos) const;
|
||||
|
||||
string_t format(size_t indent, size_t indent_times) const;
|
||||
|
||||
private:
|
||||
raw_array _array_data;
|
||||
};
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_array<string_t>::basic_array(std::initializer_list<value_type> init_list) : _array_data(init_list)
|
||||
{}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_array<string_t>::basic_array(typename raw_array::size_type size) : _array_data(size)
|
||||
{}
|
||||
|
||||
// template <typename string_t>
|
||||
// inline basic_array<string_t>::basic_array(const basic_value<string_t>& val) : basic_array<string_t>(val.as_array())
|
||||
//{}
|
||||
//
|
||||
// template <typename string_t>
|
||||
// inline basic_array<string_t>::basic_array(basic_value<string_t>&& val)
|
||||
// : basic_array<string_t>(std::move(val.as_array()))
|
||||
//{}
|
||||
|
||||
template <typename string_t>
|
||||
inline void basic_array<string_t>::clear() noexcept
|
||||
{
|
||||
_array_data.clear();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline bool basic_array<string_t>::erase(size_t pos)
|
||||
{
|
||||
return erase(_array_data.begin() + pos);
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline bool basic_array<string_t>::erase(iterator iter)
|
||||
{
|
||||
return _array_data.erase(iter) != _array_data.end();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename... args_t>
|
||||
inline decltype(auto) basic_array<string_t>::emplace_back(args_t&&... args)
|
||||
{
|
||||
static_assert(std::is_constructible_v<value_type, args_t...>,
|
||||
"Parameter can't be used to construct a raw_array::value_type");
|
||||
return _array_data.emplace_back(std::forward<args_t>(args)...);
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename... args_t>
|
||||
inline decltype(auto) basic_array<string_t>::push_back(args_t&&... args)
|
||||
{
|
||||
return emplace_back(std::forward<args_t>(args)...);
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline const basic_value<string_t>& basic_array<string_t>::at(size_t pos) const
|
||||
{
|
||||
return _array_data.at(pos);
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline string_t basic_array<string_t>::to_string() const
|
||||
{
|
||||
string_t str { '[' };
|
||||
for (auto iter = _array_data.cbegin(); iter != _array_data.cend();) {
|
||||
str += iter->to_string();
|
||||
if (++iter != _array_data.cend()) {
|
||||
str += ',';
|
||||
}
|
||||
}
|
||||
str += char_t(']');
|
||||
return str;
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline string_t basic_array<string_t>::format(size_t indent, size_t indent_times) const
|
||||
{
|
||||
const string_t tail_indent(indent * indent_times, ' ');
|
||||
const string_t body_indent(indent * (indent_times + 1), ' ');
|
||||
|
||||
string_t str { '[', '\n' };
|
||||
for (auto iter = _array_data.cbegin(); iter != _array_data.cend();) {
|
||||
str += body_indent + iter->format(indent, indent_times + 1);
|
||||
if (++iter != _array_data.cend()) {
|
||||
str += ',';
|
||||
}
|
||||
str += '\n';
|
||||
}
|
||||
str += tail_indent + char_t(']');
|
||||
return str;
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename value_t>
|
||||
inline bool basic_array<string_t>::all() const
|
||||
{
|
||||
for (const auto& elem : _array_data) {
|
||||
if (!elem.template is<value_t>()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
namespace _as_collection_helper
|
||||
{
|
||||
template <typename T>
|
||||
class has_emplace_back
|
||||
{
|
||||
template <typename U>
|
||||
static auto test(int) -> decltype(std::declval<U>().emplace_back(), std::true_type());
|
||||
|
||||
template <typename U>
|
||||
static std::false_type test(...);
|
||||
|
||||
public:
|
||||
static constexpr bool value = decltype(test<T>(0))::value;
|
||||
};
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename value_t, template <typename...> typename collection_t>
|
||||
inline collection_t<value_t> basic_array<string_t>::as_collection() const
|
||||
{
|
||||
collection_t<value_t> result;
|
||||
if constexpr (_as_collection_helper::has_emplace_back<collection_t<value_t>>::value) {
|
||||
for (const auto& elem : _array_data) {
|
||||
result.emplace_back(elem.template as<value_t>());
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (const auto& elem : _array_data) {
|
||||
result.emplace(elem.template as<value_t>());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename... key_then_default_value_t>
|
||||
inline auto basic_array<string_t>::get(key_then_default_value_t&&... keys_then_default_value) const
|
||||
{
|
||||
return get(std::forward_as_tuple(keys_then_default_value...),
|
||||
std::make_index_sequence<sizeof...(keys_then_default_value) - 1> {});
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename... key_then_default_value_t, size_t... keys_indexes_t>
|
||||
inline auto basic_array<string_t>::get(std::tuple<key_then_default_value_t...> keys_then_default_value,
|
||||
std::index_sequence<keys_indexes_t...>) const
|
||||
{
|
||||
constexpr unsigned long default_value_index = sizeof...(key_then_default_value_t) - 1;
|
||||
return get_helper(std::get<default_value_index>(keys_then_default_value),
|
||||
std::get<keys_indexes_t>(keys_then_default_value)...);
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename value_t, typename... rest_keys_t>
|
||||
inline auto basic_array<string_t>::get_helper(const value_t& default_value, size_t pos, rest_keys_t&&... rest) const
|
||||
{
|
||||
constexpr bool is_json = std::is_same_v<basic_value<string_t>, value_t> ||
|
||||
std::is_same_v<basic_array<string_t>, value_t> ||
|
||||
std::is_same_v<basic_object<string_t>, value_t>;
|
||||
constexpr bool is_string = std::is_constructible_v<string_t, value_t> && !is_json;
|
||||
|
||||
if (!contains(pos)) {
|
||||
if constexpr (is_string) {
|
||||
return string_t(default_value);
|
||||
}
|
||||
else {
|
||||
return value_t(default_value);
|
||||
}
|
||||
}
|
||||
|
||||
return at(pos).get_helper(default_value, std::forward<rest_keys_t>(rest)...);
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename value_t>
|
||||
inline auto basic_array<string_t>::get_helper(const value_t& default_value, size_t pos) const
|
||||
{
|
||||
constexpr bool is_json = std::is_same_v<basic_value<string_t>, value_t> ||
|
||||
std::is_same_v<basic_array<string_t>, value_t> ||
|
||||
std::is_same_v<basic_object<string_t>, value_t>;
|
||||
constexpr bool is_string = std::is_constructible_v<string_t, value_t> && !is_json;
|
||||
|
||||
if (!contains(pos)) {
|
||||
if constexpr (is_string) {
|
||||
return string_t(default_value);
|
||||
}
|
||||
else {
|
||||
return value_t(default_value);
|
||||
}
|
||||
}
|
||||
|
||||
auto val = _array_data.at(pos);
|
||||
if (val.template is<value_t>()) {
|
||||
if constexpr (is_string) {
|
||||
return val.template as<string_t>();
|
||||
}
|
||||
else {
|
||||
return val.template as<value_t>();
|
||||
}
|
||||
}
|
||||
else {
|
||||
if constexpr (is_string) {
|
||||
return string_t(default_value);
|
||||
}
|
||||
else {
|
||||
return value_t(default_value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename value_t>
|
||||
inline std::optional<value_t> basic_array<string_t>::find(size_t pos) const
|
||||
{
|
||||
if (!contains(pos)) {
|
||||
return std::nullopt;
|
||||
}
|
||||
const auto& val = _array_data.at(pos);
|
||||
return val.template is<value_t>() ? std::optional<value_t>(val.template as<value_t>()) : std::nullopt;
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline typename basic_array<string_t>::iterator basic_array<string_t>::begin() noexcept
|
||||
{
|
||||
return _array_data.begin();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline typename basic_array<string_t>::iterator basic_array<string_t>::end() noexcept
|
||||
{
|
||||
return _array_data.end();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline typename basic_array<string_t>::const_iterator basic_array<string_t>::begin() const noexcept
|
||||
{
|
||||
return _array_data.begin();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline typename basic_array<string_t>::const_iterator basic_array<string_t>::end() const noexcept
|
||||
{
|
||||
return _array_data.end();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline typename basic_array<string_t>::const_iterator basic_array<string_t>::cbegin() const noexcept
|
||||
{
|
||||
return _array_data.cbegin();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline typename basic_array<string_t>::const_iterator basic_array<string_t>::cend() const noexcept
|
||||
{
|
||||
return _array_data.cend();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline typename basic_array<string_t>::reverse_iterator basic_array<string_t>::rbegin() noexcept
|
||||
{
|
||||
return _array_data.rbegin();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline typename basic_array<string_t>::reverse_iterator basic_array<string_t>::rend() noexcept
|
||||
{
|
||||
return _array_data.rend();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline typename basic_array<string_t>::const_reverse_iterator basic_array<string_t>::rbegin() const noexcept
|
||||
{
|
||||
return _array_data.rbegin();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline typename basic_array<string_t>::const_reverse_iterator basic_array<string_t>::rend() const noexcept
|
||||
{
|
||||
return _array_data.rend();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline typename basic_array<string_t>::const_reverse_iterator basic_array<string_t>::crbegin() const noexcept
|
||||
{
|
||||
return _array_data.crbegin();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline typename basic_array<string_t>::const_reverse_iterator basic_array<string_t>::crend() const noexcept
|
||||
{
|
||||
return _array_data.crend();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t>& basic_array<string_t>::operator[](size_t pos)
|
||||
{
|
||||
return _array_data[pos];
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline const basic_value<string_t>& basic_array<string_t>::operator[](size_t pos) const
|
||||
{
|
||||
return _array_data[pos];
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_array<string_t> basic_array<string_t>::operator+(const basic_array<string_t>& rhs) const&
|
||||
{
|
||||
basic_array<string_t> temp = *this;
|
||||
temp._array_data.insert(_array_data.end(), rhs.begin(), rhs.end());
|
||||
return temp;
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_array<string_t> basic_array<string_t>::operator+(basic_array<string_t>&& rhs) const&
|
||||
{
|
||||
basic_array<string_t> temp = *this;
|
||||
temp._array_data.insert(_array_data.end(), std::make_move_iterator(rhs.begin()),
|
||||
std::make_move_iterator(rhs.end()));
|
||||
return temp;
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_array<string_t> basic_array<string_t>::operator+(const basic_array<string_t>& rhs) &&
|
||||
{
|
||||
_array_data.insert(_array_data.end(), rhs.begin(), rhs.end());
|
||||
return std::move(*this);
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_array<string_t> basic_array<string_t>::operator+(basic_array<string_t>&& rhs) &&
|
||||
{
|
||||
_array_data.insert(_array_data.end(), std::make_move_iterator(rhs.begin()), std::make_move_iterator(rhs.end()));
|
||||
return std::move(*this);
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_array<string_t>& basic_array<string_t>::operator+=(const basic_array<string_t>& rhs)
|
||||
{
|
||||
_array_data.insert(_array_data.end(), rhs.begin(), rhs.end());
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_array<string_t>& basic_array<string_t>::operator+=(basic_array<string_t>&& rhs)
|
||||
{
|
||||
_array_data.insert(_array_data.end(), std::make_move_iterator(rhs.begin()), std::make_move_iterator(rhs.end()));
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline bool basic_array<string_t>::operator==(const basic_array<string_t>& rhs) const
|
||||
{
|
||||
return _array_data == rhs._array_data;
|
||||
}
|
||||
|
||||
template <typename ostream_t, typename string_t,
|
||||
typename std_ostream_t =
|
||||
std::basic_ostream<typename string_t::value_type, std::char_traits<typename string_t::value_type>>,
|
||||
typename enable_t =
|
||||
std::enable_if_t<std::is_same_v<std_ostream_t, ostream_t> || std::is_base_of_v<std_ostream_t, ostream_t>>>
|
||||
ostream_t& operator<<(ostream_t& out, const basic_array<string_t>& arr)
|
||||
{
|
||||
out << arr.format();
|
||||
return out;
|
||||
}
|
||||
} // namespace json
|
||||
26
3rdparty/include/meojson/common/exception.hpp
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
|
||||
#include <exception>
|
||||
#include <string>
|
||||
|
||||
namespace json
|
||||
{
|
||||
class exception : public std::exception
|
||||
{
|
||||
public:
|
||||
exception() = default;
|
||||
exception(const std::string& msg) : _what(msg) {}
|
||||
|
||||
exception(const exception&) = default;
|
||||
exception& operator=(const exception&) = default;
|
||||
exception(exception&&) = default;
|
||||
exception& operator=(exception&&) = default;
|
||||
|
||||
virtual ~exception() noexcept override = default;
|
||||
|
||||
virtual const char* what() const noexcept override { return _what.empty() ? "Unknown exception" : _what.c_str(); }
|
||||
|
||||
protected:
|
||||
std::string _what;
|
||||
};
|
||||
}
|
||||
474
3rdparty/include/meojson/common/object.hpp
vendored
Normal file
@@ -0,0 +1,474 @@
|
||||
#pragma once
|
||||
|
||||
#include <initializer_list>
|
||||
#include <map>
|
||||
#include <optional>
|
||||
#include <ostream>
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
|
||||
#include "exception.hpp"
|
||||
#include "utils.hpp"
|
||||
|
||||
namespace json
|
||||
{
|
||||
template <typename string_t>
|
||||
class basic_object
|
||||
{
|
||||
friend class basic_value<string_t>;
|
||||
friend class basic_array<string_t>;
|
||||
|
||||
public:
|
||||
using raw_object = std::map<string_t, basic_value<string_t>>;
|
||||
using key_type = typename raw_object::key_type;
|
||||
using mapped_type = typename raw_object::mapped_type;
|
||||
using value_type = typename raw_object::value_type;
|
||||
using iterator = typename raw_object::iterator;
|
||||
using const_iterator = typename raw_object::const_iterator;
|
||||
using char_t = typename string_t::value_type;
|
||||
|
||||
public:
|
||||
basic_object() = default;
|
||||
basic_object(const basic_object<string_t>& rhs) = default;
|
||||
basic_object(basic_object<string_t>&& rhs) noexcept = default;
|
||||
basic_object(std::initializer_list<value_type> init_list);
|
||||
|
||||
// explicit basic_object(const basic_value<string_t>& val);
|
||||
// explicit basic_object(basic_value<string_t>&& val);
|
||||
|
||||
template <typename map_t, std::enable_if_t<_utils::is_map<map_t> &&
|
||||
std::is_constructible_v<value_type, _utils::range_value_t<map_t>>,
|
||||
bool> = true>
|
||||
basic_object(map_t map) : _object_data(std::make_move_iterator(map.begin()), std::make_move_iterator(map.end()))
|
||||
{}
|
||||
template <typename jsonization_t,
|
||||
std::enable_if_t<_utils::has_to_json_in_member<jsonization_t>::value, bool> = true>
|
||||
basic_object(const jsonization_t& value) : basic_object(value.to_json())
|
||||
{}
|
||||
template <typename jsonization_t,
|
||||
std::enable_if_t<_utils::has_to_json_in_templ_spec<jsonization_t>::value, bool> = true>
|
||||
basic_object(const jsonization_t& value) : basic_object(ext::jsonization<jsonization_t>().to_json(value))
|
||||
{}
|
||||
|
||||
~basic_object() = default;
|
||||
|
||||
bool empty() const noexcept { return _object_data.empty(); }
|
||||
size_t size() const noexcept { return _object_data.size(); }
|
||||
bool contains(const string_t& key) const;
|
||||
bool exists(const string_t& key) const { return contains(key); }
|
||||
const basic_value<string_t>& at(const string_t& key) const;
|
||||
|
||||
string_t dumps(std::optional<size_t> indent = std::nullopt) const { return indent ? format(*indent) : to_string(); }
|
||||
string_t to_string() const;
|
||||
string_t format(size_t indent = 4) const { return format(indent, 0); }
|
||||
template <typename value_t>
|
||||
bool all() const;
|
||||
template <typename value_t, template <typename...> typename map_t = std::map>
|
||||
map_t<string_t, value_t> as_map() const;
|
||||
|
||||
// Usage: get(key_1, key_2, ..., default_value);
|
||||
template <typename... key_then_default_value_t>
|
||||
auto get(key_then_default_value_t&&... keys_then_default_value) const;
|
||||
|
||||
template <typename value_t = basic_value<string_t>>
|
||||
std::optional<value_t> find(const string_t& key) const;
|
||||
|
||||
template <typename... args_t>
|
||||
decltype(auto) emplace(args_t&&... args);
|
||||
template <typename... args_t>
|
||||
decltype(auto) insert(args_t&&... args);
|
||||
|
||||
void clear() noexcept;
|
||||
bool erase(const string_t& key);
|
||||
bool erase(iterator iter);
|
||||
|
||||
iterator begin() noexcept;
|
||||
iterator end() noexcept;
|
||||
const_iterator begin() const noexcept;
|
||||
const_iterator end() const noexcept;
|
||||
const_iterator cbegin() const noexcept;
|
||||
const_iterator cend() const noexcept;
|
||||
|
||||
basic_value<string_t>& operator[](const string_t& key);
|
||||
basic_value<string_t>& operator[](string_t&& key);
|
||||
|
||||
basic_object<string_t> operator|(const basic_object<string_t>& rhs) const&;
|
||||
basic_object<string_t> operator|(basic_object<string_t>&& rhs) const&;
|
||||
basic_object<string_t> operator|(const basic_object<string_t>& rhs) &&;
|
||||
basic_object<string_t> operator|(basic_object<string_t>&& rhs) &&;
|
||||
|
||||
basic_object<string_t>& operator|=(const basic_object<string_t>& rhs);
|
||||
basic_object<string_t>& operator|=(basic_object<string_t>&& rhs);
|
||||
|
||||
basic_object<string_t>& operator=(const basic_object<string_t>&) = default;
|
||||
basic_object<string_t>& operator=(basic_object<string_t>&&) = default;
|
||||
template <typename value_t, std::enable_if_t<std::is_convertible_v<value_t, basic_object<string_t>>, bool> = true>
|
||||
basic_object<string_t>& operator=(value_t rhs)
|
||||
{
|
||||
return *this = basic_object<string_t>(std::move(rhs));
|
||||
}
|
||||
|
||||
bool operator==(const basic_object<string_t>& rhs) const;
|
||||
bool operator!=(const basic_object<string_t>& rhs) const { return !(*this == rhs); }
|
||||
|
||||
template <typename value_t, template <typename...> typename map_t = std::map,
|
||||
std::enable_if_t<_utils::is_map<map_t<string_t, value_t>>, bool> = true>
|
||||
explicit operator map_t<string_t, value_t>() const
|
||||
{
|
||||
return as_map<value_t, map_t>();
|
||||
}
|
||||
template <typename jsonization_t,
|
||||
std::enable_if_t<_utils::has_from_json_in_member<jsonization_t, string_t>::value, bool> = true>
|
||||
explicit operator jsonization_t() const
|
||||
{
|
||||
jsonization_t dst {};
|
||||
if (!dst.from_json(*this)) {
|
||||
throw exception("Wrong JSON");
|
||||
}
|
||||
return dst;
|
||||
}
|
||||
template <typename jsonization_t,
|
||||
std::enable_if_t<_utils::has_from_json_in_templ_spec<jsonization_t, string_t>::value, bool> = true>
|
||||
explicit operator jsonization_t() const
|
||||
{
|
||||
jsonization_t dst {};
|
||||
if (!ext::jsonization<jsonization_t>().from_json(*this, dst)) {
|
||||
throw exception("Wrong JSON");
|
||||
}
|
||||
return dst;
|
||||
}
|
||||
|
||||
private:
|
||||
template <typename... key_then_default_value_t, size_t... keys_indexes_t>
|
||||
auto get(std::tuple<key_then_default_value_t...> keys_then_default_value,
|
||||
std::index_sequence<keys_indexes_t...>) const;
|
||||
template <typename value_t, typename... rest_keys_t>
|
||||
auto get_helper(const value_t& default_value, const string_t& key, rest_keys_t&&... rest) const;
|
||||
template <typename value_t>
|
||||
auto get_helper(const value_t& default_value, const string_t& key) const;
|
||||
|
||||
string_t format(size_t indent, size_t indent_times) const;
|
||||
|
||||
private:
|
||||
raw_object _object_data;
|
||||
};
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_object<string_t>::basic_object(std::initializer_list<value_type> init_list)
|
||||
: _object_data(std::make_move_iterator(init_list.begin()), std::make_move_iterator(init_list.end()))
|
||||
{}
|
||||
|
||||
// template <typename string_t>
|
||||
// inline basic_object<string_t>::basic_object(const basic_value<string_t>& val) :
|
||||
// basic_object<string_t>(val.as_object())
|
||||
//{}
|
||||
//
|
||||
// template <typename string_t>
|
||||
// inline basic_object<string_t>::basic_object(basic_value<string_t>&& val)
|
||||
// : basic_object<string_t>(std::move(val.as_object()))
|
||||
//{}
|
||||
|
||||
template <typename string_t>
|
||||
inline bool basic_object<string_t>::contains(const string_t& key) const
|
||||
{
|
||||
return _object_data.find(key) != _object_data.cend();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline const basic_value<string_t>& basic_object<string_t>::at(const string_t& key) const
|
||||
{
|
||||
return _object_data.at(key);
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline void basic_object<string_t>::clear() noexcept
|
||||
{
|
||||
_object_data.clear();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline bool basic_object<string_t>::erase(const string_t& key)
|
||||
{
|
||||
return _object_data.erase(key) > 0 ? true : false;
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline bool basic_object<string_t>::erase(iterator iter)
|
||||
{
|
||||
return _object_data.erase(iter) != _object_data.end();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename... args_t>
|
||||
inline decltype(auto) basic_object<string_t>::emplace(args_t&&... args)
|
||||
{
|
||||
static_assert(std::is_constructible_v<value_type, args_t...>,
|
||||
"Parameter can't be used to construct a raw_object::value_type");
|
||||
return _object_data.emplace(std::forward<args_t>(args)...);
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename... args_t>
|
||||
inline decltype(auto) basic_object<string_t>::insert(args_t&&... args)
|
||||
{
|
||||
return emplace(std::forward<args_t>(args)...);
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline string_t basic_object<string_t>::to_string() const
|
||||
{
|
||||
string_t str { '{' };
|
||||
for (auto iter = _object_data.cbegin(); iter != _object_data.cend();) {
|
||||
const auto& [key, val] = *iter;
|
||||
str += char_t('"') + _utils::unescape_string(key) + string_t { '\"', ':' } + val.to_string();
|
||||
if (++iter != _object_data.cend()) {
|
||||
str += ',';
|
||||
}
|
||||
}
|
||||
str += char_t('}');
|
||||
return str;
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline string_t basic_object<string_t>::format(size_t indent, size_t indent_times) const
|
||||
{
|
||||
const string_t tail_indent(indent * indent_times, ' ');
|
||||
const string_t body_indent(indent * (indent_times + 1), ' ');
|
||||
|
||||
string_t str { '{', '\n' };
|
||||
for (auto iter = _object_data.cbegin(); iter != _object_data.cend();) {
|
||||
const auto& [key, val] = *iter;
|
||||
str += body_indent + char_t('"') + _utils::unescape_string(key) + string_t { '\"', ':', ' ' } +
|
||||
val.format(indent, indent_times + 1);
|
||||
if (++iter != _object_data.cend()) {
|
||||
str += ',';
|
||||
}
|
||||
str += '\n';
|
||||
}
|
||||
str += tail_indent + char_t('}');
|
||||
return str;
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename value_t>
|
||||
inline bool basic_object<string_t>::all() const
|
||||
{
|
||||
for (const auto& [_, val] : _object_data) {
|
||||
if (!val.template is<value_t>()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename value_t, template <typename...> typename map_t>
|
||||
inline map_t<string_t, value_t> basic_object<string_t>::as_map() const
|
||||
{
|
||||
map_t<string_t, value_t> result;
|
||||
for (const auto& [key, val] : _object_data) {
|
||||
result.emplace(key, val.template as<value_t>());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename... key_then_default_value_t>
|
||||
inline auto basic_object<string_t>::get(key_then_default_value_t&&... keys_then_default_value) const
|
||||
{
|
||||
return get(std::forward_as_tuple(keys_then_default_value...),
|
||||
std::make_index_sequence<sizeof...(keys_then_default_value) - 1> {});
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename... key_then_default_value_t, size_t... keys_indexes_t>
|
||||
inline auto basic_object<string_t>::get(std::tuple<key_then_default_value_t...> keys_then_default_value,
|
||||
std::index_sequence<keys_indexes_t...>) const
|
||||
{
|
||||
constexpr unsigned long default_value_index = sizeof...(key_then_default_value_t) - 1;
|
||||
return get_helper(std::get<default_value_index>(keys_then_default_value),
|
||||
std::get<keys_indexes_t>(keys_then_default_value)...);
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename value_t, typename... rest_keys_t>
|
||||
inline auto basic_object<string_t>::get_helper(const value_t& default_value, const string_t& key,
|
||||
rest_keys_t&&... rest) const
|
||||
{
|
||||
constexpr bool is_json = std::is_same_v<basic_value<string_t>, value_t> ||
|
||||
std::is_same_v<basic_array<string_t>, value_t> ||
|
||||
std::is_same_v<basic_object<string_t>, value_t>;
|
||||
constexpr bool is_string = std::is_constructible_v<string_t, value_t> && !is_json;
|
||||
|
||||
if (!contains(key)) {
|
||||
if constexpr (is_string) {
|
||||
return string_t(default_value);
|
||||
}
|
||||
else {
|
||||
return value_t(default_value);
|
||||
}
|
||||
}
|
||||
|
||||
return at(key).get_helper(default_value, std::forward<rest_keys_t>(rest)...);
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename value_t>
|
||||
inline auto basic_object<string_t>::get_helper(const value_t& default_value, const string_t& key) const
|
||||
{
|
||||
constexpr bool is_json = std::is_same_v<basic_value<string_t>, value_t> ||
|
||||
std::is_same_v<basic_array<string_t>, value_t> ||
|
||||
std::is_same_v<basic_object<string_t>, value_t>;
|
||||
constexpr bool is_string = std::is_constructible_v<string_t, value_t> && !is_json;
|
||||
|
||||
if (!contains(key)) {
|
||||
if constexpr (is_string) {
|
||||
return string_t(default_value);
|
||||
}
|
||||
else {
|
||||
return value_t(default_value);
|
||||
}
|
||||
}
|
||||
|
||||
auto val = _object_data.at(key);
|
||||
if (val.template is<value_t>()) {
|
||||
if constexpr (is_string) {
|
||||
return val.template as<string_t>();
|
||||
}
|
||||
else {
|
||||
return val.template as<value_t>();
|
||||
}
|
||||
}
|
||||
else {
|
||||
if constexpr (is_string) {
|
||||
return string_t(default_value);
|
||||
}
|
||||
else {
|
||||
return value_t(default_value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename value_t>
|
||||
inline std::optional<value_t> basic_object<string_t>::find(const string_t& key) const
|
||||
{
|
||||
auto iter = _object_data.find(key);
|
||||
if (iter == _object_data.end()) {
|
||||
return std::nullopt;
|
||||
}
|
||||
const auto& val = iter->second;
|
||||
return val.template is<value_t>() ? std::optional<value_t>(val.template as<value_t>()) : std::nullopt;
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline typename basic_object<string_t>::iterator basic_object<string_t>::begin() noexcept
|
||||
{
|
||||
return _object_data.begin();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline typename basic_object<string_t>::iterator basic_object<string_t>::end() noexcept
|
||||
{
|
||||
return _object_data.end();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline typename basic_object<string_t>::const_iterator basic_object<string_t>::begin() const noexcept
|
||||
{
|
||||
return _object_data.begin();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline typename basic_object<string_t>::const_iterator basic_object<string_t>::end() const noexcept
|
||||
{
|
||||
return _object_data.end();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline typename basic_object<string_t>::const_iterator basic_object<string_t>::cbegin() const noexcept
|
||||
{
|
||||
return _object_data.cbegin();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline typename basic_object<string_t>::const_iterator basic_object<string_t>::cend() const noexcept
|
||||
{
|
||||
return _object_data.cend();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t>& basic_object<string_t>::operator[](const string_t& key)
|
||||
{
|
||||
return _object_data[key];
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t>& basic_object<string_t>::operator[](string_t&& key)
|
||||
{
|
||||
return _object_data[std::move(key)];
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_object<string_t> basic_object<string_t>::operator|(const basic_object<string_t>& rhs) const&
|
||||
{
|
||||
basic_object<string_t> temp = *this;
|
||||
temp._object_data.insert(rhs.begin(), rhs.end());
|
||||
return temp;
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_object<string_t> basic_object<string_t>::operator|(basic_object<string_t>&& rhs) const&
|
||||
{
|
||||
basic_object<string_t> temp = *this;
|
||||
// temp._object_data.merge(std::move(rhs._object_data));
|
||||
temp._object_data.insert(std::make_move_iterator(rhs.begin()), std::make_move_iterator(rhs.end()));
|
||||
return temp;
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_object<string_t> basic_object<string_t>::operator|(const basic_object<string_t>& rhs) &&
|
||||
{
|
||||
_object_data.insert(rhs.begin(), rhs.end());
|
||||
return std::move(*this);
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_object<string_t> basic_object<string_t>::operator|(basic_object<string_t>&& rhs) &&
|
||||
{
|
||||
//_object_data.merge(std::move(rhs._object_data));
|
||||
_object_data.insert(std::make_move_iterator(rhs.begin()), std::make_move_iterator(rhs.end()));
|
||||
return std::move(*this);
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_object<string_t>& basic_object<string_t>::operator|=(const basic_object<string_t>& rhs)
|
||||
{
|
||||
_object_data.insert(rhs.begin(), rhs.end());
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_object<string_t>& basic_object<string_t>::operator|=(basic_object<string_t>&& rhs)
|
||||
{
|
||||
_object_data.insert(std::make_move_iterator(rhs.begin()), std::make_move_iterator(rhs.end()));
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline bool basic_object<string_t>::operator==(const basic_object<string_t>& rhs) const
|
||||
{
|
||||
return _object_data == rhs._object_data;
|
||||
}
|
||||
|
||||
template <typename ostream_t, typename string_t,
|
||||
typename std_ostream_t =
|
||||
std::basic_ostream<typename string_t::value_type, std::char_traits<typename string_t::value_type>>,
|
||||
typename enable_t =
|
||||
std::enable_if_t<std::is_same_v<std_ostream_t, ostream_t> || std::is_base_of_v<std_ostream_t, ostream_t>>>
|
||||
ostream_t& operator<<(ostream_t& out, const basic_object<string_t>& obj)
|
||||
{
|
||||
out << obj.format();
|
||||
return out;
|
||||
}
|
||||
} // namespace json
|
||||
170
3rdparty/include/meojson/common/serialization.hpp
vendored
Normal file
@@ -0,0 +1,170 @@
|
||||
#pragma once
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
#include "types.hpp"
|
||||
#include "utils.hpp"
|
||||
|
||||
namespace json
|
||||
{
|
||||
namespace _serialization_helper
|
||||
{
|
||||
template <typename in_t, typename serializer_t>
|
||||
class is_serializable
|
||||
{
|
||||
template <typename U>
|
||||
static auto test(int) -> decltype(std::declval<serializer_t>()(std::declval<U>()), std::true_type());
|
||||
|
||||
template <typename U>
|
||||
static std::false_type test(...);
|
||||
|
||||
public:
|
||||
static constexpr bool value = decltype(test<in_t>(0))::value;
|
||||
};
|
||||
|
||||
struct empty_serializer
|
||||
{
|
||||
// sample:
|
||||
// json::value operator()(const type_1&) const { return ...; }
|
||||
// json::value operator()(const type_2&) const { return ...; }
|
||||
// json::value operator()(const type_3&) const { return ...; }
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
void unable_to_serialize()
|
||||
{
|
||||
static_assert(!sizeof(T), "Unable to serialize T. "
|
||||
#ifdef _MSC_VER
|
||||
"See T below: " __FUNCSIG__
|
||||
#else
|
||||
// "See T below: " __PRETTY_FUNCTION__
|
||||
|
||||
#endif
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
namespace _serialization_helper
|
||||
{
|
||||
template <typename out_t, typename deserializer_t, typename string_t = default_string_t>
|
||||
class is_deserializable
|
||||
{
|
||||
template <typename U>
|
||||
static auto test(int)
|
||||
-> decltype(std::declval<deserializer_t>()(std::declval<basic_value<string_t>>(), std::declval<U&>()),
|
||||
std::true_type());
|
||||
|
||||
template <typename U>
|
||||
static std::false_type test(...);
|
||||
|
||||
public:
|
||||
static constexpr bool value = decltype(test<out_t>(0))::value;
|
||||
};
|
||||
|
||||
struct empty_deserializer
|
||||
{
|
||||
// sample:
|
||||
// bool operator()(const json::value&, type_1&) const { return ...; }
|
||||
// bool operator()(const json::value&, type_2&) const { return ...; }
|
||||
// bool operator()(const json::value&, type_3&) const { return ...; }
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
void unable_to_deserialize()
|
||||
{
|
||||
static_assert(!sizeof(T), "Unable to deserialize T. "
|
||||
#ifdef _MSC_VER
|
||||
"See T below: " __FUNCSIG__
|
||||
#else
|
||||
// "See T below: " __PRETTY_FUNCTION__
|
||||
|
||||
#endif
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename in_t, typename serializer_t = _serialization_helper::empty_serializer,
|
||||
typename string_t = default_string_t>
|
||||
basic_value<string_t> serialize(in_t&& in, const serializer_t& serializer = {})
|
||||
{
|
||||
if constexpr (_serialization_helper::is_serializable<in_t, serializer_t>::value) {
|
||||
return serializer(std::forward<in_t>(in));
|
||||
}
|
||||
else if constexpr (std::is_constructible_v<basic_value<string_t>, in_t>) {
|
||||
return basic_value<string_t>(std::forward<in_t>(in));
|
||||
}
|
||||
else if constexpr (_utils::is_collection<std::decay_t<in_t>>) {
|
||||
basic_array<string_t> arr;
|
||||
for (auto&& elem : in) {
|
||||
using elem_t = decltype(elem);
|
||||
|
||||
auto j_elem = serialize<elem_t, serializer_t, string_t>(std::forward<elem_t>(elem), serializer);
|
||||
arr.emplace_back(std::move(j_elem));
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
else if constexpr (_utils::is_map<std::decay_t<in_t>>) {
|
||||
basic_object<string_t> obj;
|
||||
for (auto&& [key, elem] : in) {
|
||||
using key_t = decltype(key);
|
||||
using elem_t = decltype(elem);
|
||||
|
||||
auto j_elem = serialize<elem_t, serializer_t, string_t>(std::forward<elem_t>(elem), serializer);
|
||||
obj.emplace(std::forward<key_t>(key), std::move(j_elem));
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
else {
|
||||
_serialization_helper::unable_to_serialize<in_t>();
|
||||
}
|
||||
}
|
||||
|
||||
template <typename out_t, typename deserializer_t = _serialization_helper::empty_deserializer,
|
||||
typename string_t = default_string_t>
|
||||
bool deserialize(const basic_value<string_t>& in, out_t& out, const deserializer_t& deserializer = {})
|
||||
{
|
||||
if constexpr (_serialization_helper::is_deserializable<out_t, deserializer_t>::value) {
|
||||
return deserializer(in, out);
|
||||
}
|
||||
else if constexpr (std::is_constructible_v<out_t, basic_value<string_t>>) {
|
||||
out = out_t(in);
|
||||
return true;
|
||||
}
|
||||
else if constexpr (_utils::is_collection<std::decay_t<out_t>>) {
|
||||
if (!in.is_array()) {
|
||||
return false;
|
||||
}
|
||||
for (auto&& j_elem : in.as_array()) {
|
||||
using elem_t = typename out_t::value_type;
|
||||
elem_t elem {};
|
||||
if (!deserialize<elem_t, deserializer_t, string_t>(j_elem, elem, deserializer)) {
|
||||
return false;
|
||||
}
|
||||
if constexpr (_as_collection_helper::has_emplace_back<out_t>::value) {
|
||||
out.emplace_back(std::move(elem));
|
||||
}
|
||||
else {
|
||||
out.emplace(std::move(elem));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else if constexpr (_utils::is_map<std::decay_t<out_t>>) {
|
||||
if (!in.is_object()) {
|
||||
return false;
|
||||
}
|
||||
for (auto&& [key, j_elem] : in.as_object()) {
|
||||
using elem_t = typename out_t::value_type;
|
||||
elem_t elem {};
|
||||
if (!deserialize<elem_t, deserializer_t, string_t>(j_elem, elem, deserializer)) {
|
||||
return false;
|
||||
}
|
||||
out.emplace(std::move(elem));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
_serialization_helper::unable_to_deserialize<out_t>();
|
||||
}
|
||||
}
|
||||
} // namespace json
|
||||
5
3rdparty/include/meojson/common/types.hpp
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include "array.hpp"
|
||||
#include "object.hpp"
|
||||
#include "value.hpp"
|
||||
235
3rdparty/include/meojson/common/utils.hpp
vendored
Normal file
@@ -0,0 +1,235 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
|
||||
namespace json
|
||||
{
|
||||
template <typename string_t>
|
||||
class basic_value;
|
||||
template <typename string_t>
|
||||
class basic_array;
|
||||
template <typename string_t>
|
||||
class basic_object;
|
||||
|
||||
using default_string_t = std::string;
|
||||
|
||||
using value = basic_value<default_string_t>;
|
||||
using array = basic_array<default_string_t>;
|
||||
using object = basic_object<default_string_t>;
|
||||
|
||||
using wvalue = basic_value<std::wstring>;
|
||||
using warray = basic_array<std::wstring>;
|
||||
using wobject = basic_object<std::wstring>;
|
||||
}
|
||||
|
||||
namespace json::ext
|
||||
{
|
||||
template <typename T>
|
||||
class jsonization
|
||||
{
|
||||
public:
|
||||
// json::value to_json(const T&) const;
|
||||
// bool check_json(const json::value&) const;
|
||||
// bool from_json(const json::value&, T&) const;
|
||||
};
|
||||
}
|
||||
|
||||
namespace json::_utils
|
||||
{
|
||||
template <typename T>
|
||||
using iterator_t = decltype(std::declval<T&>().begin());
|
||||
template <typename T>
|
||||
using remove_cvref_t = std::remove_cv_t<std::remove_reference_t<T>>;
|
||||
template <typename T>
|
||||
using iter_value_t = typename std::iterator_traits<remove_cvref_t<T>>::value_type;
|
||||
template <typename R>
|
||||
using range_value_t = iter_value_t<iterator_t<R>>;
|
||||
|
||||
template <typename T, typename = void>
|
||||
constexpr bool is_string = false;
|
||||
template <typename T>
|
||||
constexpr bool is_string<T, std::void_t<typename T::traits_type>> =
|
||||
std::is_same_v<typename T::traits_type, std::char_traits<typename T::value_type>>;
|
||||
|
||||
template <typename T, typename = void>
|
||||
constexpr bool is_container = false;
|
||||
template <typename T>
|
||||
constexpr bool is_container<T, std::void_t<typename T::value_type, range_value_t<T>>> =
|
||||
std::is_same_v<typename T::value_type, range_value_t<T>> && !is_string<T>;
|
||||
|
||||
template <typename T, typename = void>
|
||||
constexpr bool is_map = false;
|
||||
template <typename T>
|
||||
constexpr bool is_map<T, std::void_t<typename T::key_type, typename T::mapped_type>> = is_container<T>;
|
||||
|
||||
template <typename T, typename = void>
|
||||
constexpr bool is_collection = false;
|
||||
template <typename T>
|
||||
constexpr bool is_collection<T> = is_container<T> && !is_map<T>;
|
||||
|
||||
template <typename T>
|
||||
class has_to_json_in_member
|
||||
{
|
||||
template <typename U>
|
||||
static auto test(int) -> decltype(std::declval<U>().to_json(), std::true_type());
|
||||
|
||||
template <typename U>
|
||||
static std::false_type test(...);
|
||||
|
||||
public:
|
||||
static constexpr bool value = decltype(test<T>(0))::value;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
class has_to_json_in_templ_spec
|
||||
{
|
||||
template <typename U>
|
||||
static auto test(int) -> decltype(std::declval<ext::jsonization<U>>().to_json(std::declval<U>()), std::true_type());
|
||||
|
||||
template <typename U>
|
||||
static std::false_type test(...);
|
||||
|
||||
public:
|
||||
static constexpr bool value = decltype(test<T>(0))::value;
|
||||
};
|
||||
|
||||
template <typename T, typename string_t>
|
||||
class has_check_json_in_member
|
||||
{
|
||||
template <typename U>
|
||||
static auto test(int)
|
||||
-> decltype(std::declval<U>().check_json(std::declval<json::basic_value<string_t>>()), std::true_type());
|
||||
|
||||
template <typename U>
|
||||
static std::false_type test(...);
|
||||
|
||||
public:
|
||||
static constexpr bool value = decltype(test<T>(0))::value;
|
||||
};
|
||||
|
||||
template <typename T, typename string_t>
|
||||
class has_check_json_in_templ_spec
|
||||
{
|
||||
template <typename U>
|
||||
static auto test(int)
|
||||
-> decltype(std::declval<ext::jsonization<U>>().check_json(std::declval<json::basic_value<string_t>>()),
|
||||
std::true_type());
|
||||
|
||||
template <typename U>
|
||||
static std::false_type test(...);
|
||||
|
||||
public:
|
||||
static constexpr bool value = decltype(test<T>(0))::value;
|
||||
};
|
||||
|
||||
template <typename T, typename string_t>
|
||||
class has_from_json_in_member
|
||||
{
|
||||
template <typename U>
|
||||
static auto test(int)
|
||||
-> decltype(std::declval<U>().from_json(std::declval<json::basic_value<string_t>>()), std::true_type());
|
||||
|
||||
template <typename U>
|
||||
static std::false_type test(...);
|
||||
|
||||
public:
|
||||
static constexpr bool value = decltype(test<T>(0))::value;
|
||||
};
|
||||
|
||||
template <typename T, typename string_t>
|
||||
class has_from_json_in_templ_spec
|
||||
{
|
||||
template <typename U>
|
||||
static auto test(int)
|
||||
-> decltype(std::declval<ext::jsonization<U>>().from_json(std::declval<json::basic_value<string_t>>(),
|
||||
std::declval<U&>()),
|
||||
std::true_type());
|
||||
|
||||
template <typename U>
|
||||
static std::false_type test(...);
|
||||
|
||||
public:
|
||||
static constexpr bool value = decltype(test<T>(0))::value;
|
||||
};
|
||||
|
||||
template <typename string_t>
|
||||
static constexpr string_t unescape_string(const string_t& str)
|
||||
{
|
||||
using char_t = typename string_t::value_type;
|
||||
|
||||
string_t result {};
|
||||
auto cur = str.cbegin();
|
||||
auto end = str.cend();
|
||||
auto no_escape_beg = cur;
|
||||
char_t escape = 0;
|
||||
|
||||
for (; cur != end; ++cur) {
|
||||
switch (*cur) {
|
||||
case '"':
|
||||
escape = '"';
|
||||
break;
|
||||
case '\\':
|
||||
escape = '\\';
|
||||
break;
|
||||
case '\b':
|
||||
escape = 'b';
|
||||
break;
|
||||
case '\f':
|
||||
escape = 'f';
|
||||
break;
|
||||
case '\n':
|
||||
escape = 'n';
|
||||
break;
|
||||
case '\r':
|
||||
escape = 'r';
|
||||
break;
|
||||
case '\t':
|
||||
escape = 't';
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (escape) {
|
||||
result += string_t(no_escape_beg, cur) + char_t('\\') + escape;
|
||||
no_escape_beg = cur + 1;
|
||||
escape = 0;
|
||||
}
|
||||
}
|
||||
result += string_t(no_escape_beg, cur);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
static constexpr string_t true_string()
|
||||
{
|
||||
return { 't', 'r', 'u', 'e' };
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
static constexpr string_t false_string()
|
||||
{
|
||||
return { 'f', 'a', 'l', 's', 'e' };
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
static constexpr string_t null_string()
|
||||
{
|
||||
return { 'n', 'u', 'l', 'l' };
|
||||
}
|
||||
|
||||
template <typename string_t, typename any_t>
|
||||
string_t to_basic_string(any_t&& arg)
|
||||
{
|
||||
if constexpr (std::is_same_v<string_t, std::string>) {
|
||||
return std::to_string(std::forward<any_t>(arg));
|
||||
}
|
||||
else if constexpr (std::is_same_v<string_t, std::wstring>) {
|
||||
return std::to_wstring(std::forward<any_t>(arg));
|
||||
}
|
||||
else {
|
||||
static_assert(!sizeof(any_t), "Unsupported type");
|
||||
}
|
||||
}
|
||||
} // namespace json::_utils
|
||||
994
3rdparty/include/meojson/common/value.hpp
vendored
Normal file
@@ -0,0 +1,994 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstddef>
|
||||
#include <initializer_list>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <ostream>
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
#include <variant>
|
||||
|
||||
#include "exception.hpp"
|
||||
#include "utils.hpp"
|
||||
|
||||
namespace json
|
||||
{
|
||||
template <typename string_t>
|
||||
class basic_value
|
||||
{
|
||||
using array_ptr = std::unique_ptr<basic_array<string_t>>;
|
||||
using object_ptr = std::unique_ptr<basic_object<string_t>>;
|
||||
|
||||
public:
|
||||
enum class value_type : char
|
||||
{
|
||||
invalid,
|
||||
null,
|
||||
boolean,
|
||||
string,
|
||||
number,
|
||||
array,
|
||||
object
|
||||
};
|
||||
|
||||
using var_t = std::variant<string_t, array_ptr, object_ptr>;
|
||||
using char_t = typename string_t::value_type;
|
||||
|
||||
public:
|
||||
basic_value();
|
||||
basic_value(const basic_value<string_t>& rhs);
|
||||
basic_value(basic_value<string_t>&& rhs) noexcept;
|
||||
|
||||
basic_value(bool b);
|
||||
|
||||
basic_value(int num);
|
||||
basic_value(unsigned num);
|
||||
basic_value(long num);
|
||||
basic_value(unsigned long num);
|
||||
basic_value(long long num);
|
||||
basic_value(unsigned long long num);
|
||||
basic_value(float num);
|
||||
basic_value(double num);
|
||||
basic_value(long double num);
|
||||
|
||||
basic_value(const char_t* str);
|
||||
basic_value(string_t str);
|
||||
basic_value(std::nullptr_t);
|
||||
|
||||
basic_value(basic_array<string_t> arr);
|
||||
basic_value(basic_object<string_t> obj);
|
||||
basic_value(std::initializer_list<typename basic_object<string_t>::value_type> init_list);
|
||||
|
||||
// Constructed from raw data
|
||||
template <typename... args_t>
|
||||
basic_value(value_type type, args_t&&... args);
|
||||
|
||||
template <typename collection_t,
|
||||
std::enable_if_t<_utils::is_collection<collection_t> &&
|
||||
std::is_constructible_v<typename basic_array<string_t>::value_type,
|
||||
_utils::range_value_t<collection_t>>,
|
||||
bool> = true>
|
||||
basic_value(collection_t&& collection) : basic_value(basic_array<string_t>(std::forward<collection_t>(collection)))
|
||||
{}
|
||||
template <typename map_t, std::enable_if_t<_utils::is_map<map_t> &&
|
||||
std::is_constructible_v<typename basic_object<string_t>::value_type,
|
||||
_utils::range_value_t<map_t>>,
|
||||
bool> = true>
|
||||
basic_value(map_t&& map) : basic_value(basic_object<string_t>(std::forward<map_t>(map)))
|
||||
{}
|
||||
|
||||
template <typename jsonization_t,
|
||||
std::enable_if_t<_utils::has_to_json_in_member<jsonization_t>::value, bool> = true>
|
||||
basic_value(const jsonization_t& value) : basic_value(value.to_json())
|
||||
{}
|
||||
template <typename jsonization_t,
|
||||
std::enable_if_t<_utils::has_to_json_in_templ_spec<jsonization_t>::value, bool> = true>
|
||||
basic_value(const jsonization_t& value) : basic_value(ext::jsonization<jsonization_t>().to_json(value))
|
||||
{}
|
||||
|
||||
template <typename value_t, std::enable_if_t<!std::is_convertible_v<value_t, basic_value<string_t>>, bool> = true>
|
||||
basic_value(value_t) = delete;
|
||||
|
||||
// I don't know if you want to convert char to string or number, so I delete these constructors.
|
||||
basic_value(char) = delete;
|
||||
basic_value(wchar_t) = delete;
|
||||
basic_value(char16_t) = delete;
|
||||
basic_value(char32_t) = delete;
|
||||
|
||||
~basic_value();
|
||||
|
||||
bool valid() const noexcept { return _type != value_type::invalid; }
|
||||
bool empty() const noexcept { return is_null(); }
|
||||
bool is_null() const noexcept { return _type == value_type::null; }
|
||||
bool is_number() const noexcept { return _type == value_type::number; }
|
||||
bool is_boolean() const noexcept { return _type == value_type::boolean; }
|
||||
bool is_string() const noexcept { return _type == value_type::string; }
|
||||
bool is_array() const noexcept { return _type == value_type::array; }
|
||||
bool is_object() const noexcept { return _type == value_type::object; }
|
||||
template <typename value_t>
|
||||
bool is() const noexcept;
|
||||
|
||||
template <typename value_t>
|
||||
bool all() const;
|
||||
|
||||
bool contains(const string_t& key) const;
|
||||
bool contains(size_t pos) const;
|
||||
bool exists(const string_t& key) const { return contains(key); }
|
||||
bool exists(size_t pos) const { return contains(pos); }
|
||||
value_type type() const noexcept { return _type; }
|
||||
const basic_value<string_t>& at(size_t pos) const;
|
||||
const basic_value<string_t>& at(const string_t& key) const;
|
||||
|
||||
bool erase(size_t pos);
|
||||
bool erase(const string_t& key);
|
||||
|
||||
// Usage: get(key_1, key_2, ..., default_value);
|
||||
template <typename... key_then_default_value_t>
|
||||
auto get(key_then_default_value_t&&... keys_then_default_value) const;
|
||||
|
||||
template <typename value_t = basic_value<string_t>>
|
||||
std::optional<value_t> find(size_t pos) const;
|
||||
template <typename value_t = basic_value<string_t>>
|
||||
std::optional<value_t> find(const string_t& key) const;
|
||||
|
||||
bool as_boolean() const;
|
||||
int as_integer() const;
|
||||
unsigned as_unsigned() const;
|
||||
long as_long() const;
|
||||
unsigned long as_unsigned_long() const;
|
||||
long long as_long_long() const;
|
||||
unsigned long long as_unsigned_long_long() const;
|
||||
float as_float() const;
|
||||
double as_double() const;
|
||||
long double as_long_double() const;
|
||||
string_t as_string() const;
|
||||
const basic_array<string_t>& as_array() const;
|
||||
const basic_object<string_t>& as_object() const;
|
||||
|
||||
template <typename value_t, template <typename...> typename collection_t = std::vector>
|
||||
collection_t<value_t> as_collection() const;
|
||||
template <typename value_t, template <typename...> typename map_t = std::map>
|
||||
map_t<string_t, value_t> as_map() const;
|
||||
|
||||
template <typename value_t>
|
||||
value_t as() const;
|
||||
|
||||
basic_array<string_t>& as_array();
|
||||
basic_object<string_t>& as_object();
|
||||
|
||||
template <typename... args_t>
|
||||
decltype(auto) emplace(args_t&&... args);
|
||||
|
||||
void clear() noexcept;
|
||||
|
||||
string_t dumps(std::optional<size_t> indent = std::nullopt) const { return indent ? format(*indent) : to_string(); }
|
||||
// return raw string
|
||||
string_t to_string() const;
|
||||
string_t format(size_t indent = 4) const { return format(indent, 0); }
|
||||
|
||||
basic_value<string_t>& operator=(const basic_value<string_t>& rhs);
|
||||
basic_value<string_t>& operator=(basic_value<string_t>&&) noexcept;
|
||||
template <typename value_t, std::enable_if_t<std::is_convertible_v<value_t, basic_value<string_t>>, bool> = true>
|
||||
basic_value<string_t>& operator=(value_t rhs)
|
||||
{
|
||||
return *this = basic_value<string_t>(std::move(rhs));
|
||||
}
|
||||
|
||||
bool operator==(const basic_value<string_t>& rhs) const;
|
||||
bool operator!=(const basic_value<string_t>& rhs) const { return !(*this == rhs); }
|
||||
|
||||
const basic_value<string_t>& operator[](size_t pos) const;
|
||||
basic_value<string_t>& operator[](size_t pos);
|
||||
basic_value<string_t>& operator[](const string_t& key);
|
||||
basic_value<string_t>& operator[](string_t&& key);
|
||||
|
||||
basic_value<string_t> operator|(const basic_object<string_t>& rhs) const&;
|
||||
basic_value<string_t> operator|(basic_object<string_t>&& rhs) const&;
|
||||
basic_value<string_t> operator|(const basic_object<string_t>& rhs) &&;
|
||||
basic_value<string_t> operator|(basic_object<string_t>&& rhs) &&;
|
||||
|
||||
basic_value<string_t>& operator|=(const basic_object<string_t>& rhs);
|
||||
basic_value<string_t>& operator|=(basic_object<string_t>&& rhs);
|
||||
|
||||
basic_value<string_t> operator+(const basic_array<string_t>& rhs) const&;
|
||||
basic_value<string_t> operator+(basic_array<string_t>&& rhs) const&;
|
||||
basic_value<string_t> operator+(const basic_array<string_t>& rhs) &&;
|
||||
basic_value<string_t> operator+(basic_array<string_t>&& rhs) &&;
|
||||
|
||||
basic_value<string_t>& operator+=(const basic_array<string_t>& rhs);
|
||||
basic_value<string_t>& operator+=(basic_array<string_t>&& rhs);
|
||||
|
||||
explicit operator bool() const { return as_boolean(); }
|
||||
explicit operator int() const { return as_integer(); }
|
||||
explicit operator unsigned() const { return as_unsigned(); }
|
||||
explicit operator long() const { return as_long(); }
|
||||
explicit operator unsigned long() const { return as_unsigned_long(); }
|
||||
explicit operator long long() const { return as_long_long(); }
|
||||
explicit operator unsigned long long() const { return as_unsigned_long_long(); }
|
||||
explicit operator float() const { return as_float(); }
|
||||
explicit operator double() const { return as_double(); }
|
||||
explicit operator long double() const { return as_long_double(); }
|
||||
explicit operator string_t() const { return as_string(); }
|
||||
|
||||
explicit operator basic_array<string_t>() const { return as_array(); }
|
||||
explicit operator basic_object<string_t>() const { return as_object(); }
|
||||
|
||||
template <typename value_t, template <typename...> typename collection_t = std::vector,
|
||||
std::enable_if_t<_utils::is_collection<collection_t<value_t>>, bool> = true>
|
||||
explicit operator collection_t<value_t>() const
|
||||
{
|
||||
return as_collection<value_t, collection_t>();
|
||||
}
|
||||
template <typename value_t, template <typename...> typename map_t = std::map,
|
||||
std::enable_if_t<_utils::is_map<map_t<string_t, value_t>>, bool> = true>
|
||||
explicit operator map_t<string_t, value_t>() const
|
||||
{
|
||||
return as_map<value_t, map_t>();
|
||||
}
|
||||
template <typename jsonization_t,
|
||||
std::enable_if_t<_utils::has_from_json_in_member<jsonization_t, string_t>::value, bool> = true>
|
||||
explicit operator jsonization_t() const
|
||||
{
|
||||
jsonization_t dst {};
|
||||
if (!dst.from_json(*this)) {
|
||||
throw exception("Wrong JSON");
|
||||
}
|
||||
return dst;
|
||||
}
|
||||
template <typename jsonization_t,
|
||||
std::enable_if_t<_utils::has_from_json_in_templ_spec<jsonization_t, string_t>::value, bool> = true>
|
||||
explicit operator jsonization_t() const
|
||||
{
|
||||
jsonization_t dst {};
|
||||
if (!ext::jsonization<jsonization_t>().from_json(*this, dst)) {
|
||||
throw exception("Wrong JSON");
|
||||
}
|
||||
return dst;
|
||||
}
|
||||
|
||||
private:
|
||||
friend class basic_array<string_t>;
|
||||
friend class basic_object<string_t>;
|
||||
|
||||
string_t format(size_t indent, size_t indent_times) const;
|
||||
|
||||
static var_t deep_copy(const var_t& src);
|
||||
|
||||
template <typename... key_then_default_value_t, size_t... keys_indexes_t>
|
||||
auto get(std::tuple<key_then_default_value_t...> keys_then_default_value,
|
||||
std::index_sequence<keys_indexes_t...>) const;
|
||||
|
||||
template <typename value_t, typename first_key_t, typename... rest_keys_t>
|
||||
auto get_helper(const value_t& default_value, first_key_t&& first, rest_keys_t&&... rest) const;
|
||||
template <typename value_t, typename unique_key_t>
|
||||
auto get_helper(const value_t& default_value, unique_key_t&& first) const;
|
||||
|
||||
const string_t& as_basic_type_str() const;
|
||||
string_t& as_basic_type_str();
|
||||
|
||||
value_type _type = value_type::null;
|
||||
var_t _raw_data;
|
||||
};
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t>::basic_value() = default;
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t>::basic_value(const basic_value<string_t>& rhs)
|
||||
: _type(rhs._type), _raw_data(deep_copy(rhs._raw_data))
|
||||
{}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t>::basic_value(basic_value<string_t>&& rhs) noexcept = default;
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t>::basic_value(bool b)
|
||||
: _type(value_type::boolean),
|
||||
_raw_data(string_t(b ? _utils::true_string<string_t>() : _utils::false_string<string_t>()))
|
||||
{}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t>::basic_value(int num)
|
||||
: _type(value_type::number), _raw_data(_utils::to_basic_string<string_t>(num))
|
||||
{}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t>::basic_value(unsigned num)
|
||||
: _type(value_type::number), _raw_data(_utils::to_basic_string<string_t>(num))
|
||||
{}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t>::basic_value(long num)
|
||||
: _type(value_type::number), _raw_data(_utils::to_basic_string<string_t>(num))
|
||||
{}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t>::basic_value(unsigned long num)
|
||||
: _type(value_type::number), _raw_data(_utils::to_basic_string<string_t>(num))
|
||||
{}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t>::basic_value(long long num)
|
||||
: _type(value_type::number), _raw_data(_utils::to_basic_string<string_t>(num))
|
||||
{}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t>::basic_value(unsigned long long num)
|
||||
: _type(value_type::number), _raw_data(_utils::to_basic_string<string_t>(num))
|
||||
{}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t>::basic_value(float num)
|
||||
: _type(value_type::number), _raw_data(_utils::to_basic_string<string_t>(num))
|
||||
{}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t>::basic_value(double num)
|
||||
: _type(value_type::number), _raw_data(_utils::to_basic_string<string_t>(num))
|
||||
{}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t>::basic_value(long double num)
|
||||
: _type(value_type::number), _raw_data(_utils::to_basic_string<string_t>(num))
|
||||
{}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t>::basic_value(const char_t* str) : _type(value_type::string), _raw_data(string_t(str))
|
||||
{}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t>::basic_value(string_t str) : _type(value_type::string), _raw_data(std::move(str))
|
||||
{}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t>::basic_value(std::nullptr_t) : _type(value_type::null)
|
||||
{}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t>::basic_value(basic_array<string_t> arr)
|
||||
: _type(value_type::array), _raw_data(std::make_unique<basic_array<string_t>>(std::move(arr)))
|
||||
{}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t>::basic_value(basic_object<string_t> obj)
|
||||
: _type(value_type::object), _raw_data(std::make_unique<basic_object<string_t>>(std::move(obj)))
|
||||
{}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t>::basic_value(std::initializer_list<typename basic_object<string_t>::value_type> init_list)
|
||||
: _type(value_type::object), _raw_data(std::make_unique<basic_object<string_t>>(init_list))
|
||||
{}
|
||||
|
||||
// for Pimpl
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t>::~basic_value() = default;
|
||||
|
||||
template <typename string_t>
|
||||
template <typename value_t>
|
||||
inline bool basic_value<string_t>::is() const noexcept
|
||||
{
|
||||
if constexpr (std::is_same_v<basic_value<string_t>, value_t>) {
|
||||
return true;
|
||||
}
|
||||
else if constexpr (_utils::has_check_json_in_member<value_t, string_t>::value) {
|
||||
return value_t().check_json(*this);
|
||||
}
|
||||
else if constexpr (_utils::has_check_json_in_templ_spec<value_t, string_t>::value) {
|
||||
return ext::jsonization<value_t>().check_json(*this);
|
||||
}
|
||||
else if constexpr (std::is_same_v<bool, value_t>) {
|
||||
return is_boolean();
|
||||
}
|
||||
else if constexpr (std::is_arithmetic_v<value_t>) {
|
||||
return is_number();
|
||||
}
|
||||
else if constexpr (std::is_constructible_v<string_t, value_t>) {
|
||||
return is_string();
|
||||
}
|
||||
else if constexpr (std::is_same_v<basic_array<string_t>, value_t>) {
|
||||
return is_array();
|
||||
}
|
||||
else if constexpr (_utils::is_collection<value_t>) {
|
||||
return is_array() && all<typename value_t::value_type>();
|
||||
}
|
||||
else if constexpr (std::is_same_v<basic_object<string_t>, value_t>) {
|
||||
return is_object();
|
||||
}
|
||||
else if constexpr (_utils::is_map<value_t>) {
|
||||
return is_object() && std::is_constructible_v<string_t, typename value_t::key_type> &&
|
||||
all<typename value_t::mapped_type>();
|
||||
}
|
||||
else {
|
||||
static_assert(!sizeof(value_t), "Unsupported type");
|
||||
}
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline bool basic_value<string_t>::contains(const string_t& key) const
|
||||
{
|
||||
return is_object() && as_object().contains(key);
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline bool basic_value<string_t>::contains(size_t pos) const
|
||||
{
|
||||
return is_array() && as_array().contains(pos);
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline const basic_value<string_t>& basic_value<string_t>::at(size_t pos) const
|
||||
{
|
||||
return as_array().at(pos);
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline const basic_value<string_t>& basic_value<string_t>::at(const string_t& key) const
|
||||
{
|
||||
return as_object().at(key);
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline bool basic_value<string_t>::erase(size_t pos)
|
||||
{
|
||||
return as_array().erase(pos);
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline bool basic_value<string_t>::erase(const string_t& key)
|
||||
{
|
||||
return as_object().erase(key);
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename... key_then_default_value_t>
|
||||
inline auto basic_value<string_t>::get(key_then_default_value_t&&... keys_then_default_value) const
|
||||
{
|
||||
return get(std::forward_as_tuple(keys_then_default_value...),
|
||||
std::make_index_sequence<sizeof...(keys_then_default_value) - 1> {});
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename... key_then_default_value_t, size_t... keys_indexes_t>
|
||||
inline auto basic_value<string_t>::get(std::tuple<key_then_default_value_t...> keys_then_default_value,
|
||||
std::index_sequence<keys_indexes_t...>) const
|
||||
{
|
||||
constexpr unsigned long default_value_index = sizeof...(key_then_default_value_t) - 1;
|
||||
return get_helper(std::get<default_value_index>(keys_then_default_value),
|
||||
std::get<keys_indexes_t>(keys_then_default_value)...);
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename value_t, typename first_key_t, typename... rest_keys_t>
|
||||
inline auto basic_value<string_t>::get_helper(const value_t& default_value, first_key_t&& first,
|
||||
rest_keys_t&&... rest) const
|
||||
{
|
||||
if constexpr (std::is_constructible_v<string_t, first_key_t>) {
|
||||
return is_object() ? as_object().get_helper(default_value, std::forward<first_key_t>(first),
|
||||
std::forward<rest_keys_t>(rest)...)
|
||||
: default_value;
|
||||
}
|
||||
else if constexpr (std::is_integral_v<std::decay_t<first_key_t>>) {
|
||||
return is_array() ? as_array().get_helper(default_value, std::forward<first_key_t>(first),
|
||||
std::forward<rest_keys_t>(rest)...)
|
||||
: default_value;
|
||||
}
|
||||
else {
|
||||
static_assert(!sizeof(first_key_t), "Parameter must be integral or string_t constructible");
|
||||
}
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename value_t, typename unique_key_t>
|
||||
inline auto basic_value<string_t>::get_helper(const value_t& default_value, unique_key_t&& first) const
|
||||
{
|
||||
if constexpr (std::is_constructible_v<string_t, unique_key_t>) {
|
||||
return is_object() ? as_object().get_helper(default_value, std::forward<unique_key_t>(first)) : default_value;
|
||||
}
|
||||
else if constexpr (std::is_integral_v<std::decay_t<unique_key_t>>) {
|
||||
return is_array() ? as_array().get_helper(default_value, std::forward<unique_key_t>(first)) : default_value;
|
||||
}
|
||||
else {
|
||||
static_assert(!sizeof(unique_key_t), "Parameter must be integral or string_t constructible");
|
||||
}
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename value_t>
|
||||
inline std::optional<value_t> basic_value<string_t>::find(size_t pos) const
|
||||
{
|
||||
return is_array() ? as_array().template find<value_t>(pos) : std::nullopt;
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename value_t>
|
||||
inline std::optional<value_t> basic_value<string_t>::find(const string_t& key) const
|
||||
{
|
||||
return is_object() ? as_object().template find<value_t>(key) : std::nullopt;
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline bool basic_value<string_t>::as_boolean() const
|
||||
{
|
||||
if (is_boolean()) {
|
||||
if (const string_t& b_str = as_basic_type_str(); b_str == _utils::true_string<string_t>()) {
|
||||
return true;
|
||||
}
|
||||
else if (b_str == _utils::false_string<string_t>()) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
throw exception("Unknown Parse Error");
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw exception("Wrong Type");
|
||||
}
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline int basic_value<string_t>::as_integer() const
|
||||
{
|
||||
if (is_number()) {
|
||||
return std::stoi(as_basic_type_str());
|
||||
}
|
||||
else {
|
||||
throw exception("Wrong Type");
|
||||
}
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline unsigned basic_value<string_t>::as_unsigned() const
|
||||
{
|
||||
// I don't know why there is no std::stou.
|
||||
return static_cast<unsigned>(as_unsigned_long());
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline long basic_value<string_t>::as_long() const
|
||||
{
|
||||
if (is_number()) {
|
||||
return std::stol(as_basic_type_str());
|
||||
}
|
||||
else {
|
||||
throw exception("Wrong Type");
|
||||
}
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline unsigned long basic_value<string_t>::as_unsigned_long() const
|
||||
{
|
||||
if (is_number()) {
|
||||
return std::stoul(as_basic_type_str());
|
||||
}
|
||||
else {
|
||||
throw exception("Wrong Type");
|
||||
}
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline long long basic_value<string_t>::as_long_long() const
|
||||
{
|
||||
if (is_number()) {
|
||||
return std::stoll(as_basic_type_str());
|
||||
}
|
||||
else {
|
||||
throw exception("Wrong Type");
|
||||
}
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline unsigned long long basic_value<string_t>::as_unsigned_long_long() const
|
||||
{
|
||||
if (is_number()) {
|
||||
return std::stoull(as_basic_type_str());
|
||||
}
|
||||
else {
|
||||
throw exception("Wrong Type");
|
||||
}
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline float basic_value<string_t>::as_float() const
|
||||
{
|
||||
if (is_number()) {
|
||||
return std::stof(as_basic_type_str());
|
||||
}
|
||||
else {
|
||||
throw exception("Wrong Type");
|
||||
}
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline double basic_value<string_t>::as_double() const
|
||||
{
|
||||
if (is_number()) {
|
||||
return std::stod(as_basic_type_str());
|
||||
}
|
||||
else {
|
||||
throw exception("Wrong Type");
|
||||
}
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline long double basic_value<string_t>::as_long_double() const
|
||||
{
|
||||
if (is_number()) {
|
||||
return std::stold(as_basic_type_str());
|
||||
}
|
||||
else {
|
||||
throw exception("Wrong Type");
|
||||
}
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline string_t basic_value<string_t>::as_string() const
|
||||
{
|
||||
if (is_string()) {
|
||||
return as_basic_type_str();
|
||||
}
|
||||
else {
|
||||
throw exception("Wrong Type");
|
||||
}
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline const basic_array<string_t>& basic_value<string_t>::as_array() const
|
||||
{
|
||||
if (is_array()) {
|
||||
return *std::get<array_ptr>(_raw_data);
|
||||
}
|
||||
|
||||
throw exception("Wrong Type");
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline const basic_object<string_t>& basic_value<string_t>::as_object() const
|
||||
{
|
||||
if (is_object()) {
|
||||
return *std::get<object_ptr>(_raw_data);
|
||||
}
|
||||
|
||||
throw exception("Wrong Type or data empty");
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_array<string_t>& basic_value<string_t>::as_array()
|
||||
{
|
||||
if (empty()) {
|
||||
*this = basic_array<string_t>();
|
||||
}
|
||||
|
||||
if (is_array()) {
|
||||
return *std::get<array_ptr>(_raw_data);
|
||||
}
|
||||
|
||||
throw exception("Wrong Type");
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_object<string_t>& basic_value<string_t>::as_object()
|
||||
{
|
||||
if (empty()) {
|
||||
*this = basic_object<string_t>();
|
||||
}
|
||||
|
||||
if (is_object()) {
|
||||
return *std::get<object_ptr>(_raw_data);
|
||||
}
|
||||
|
||||
throw exception("Wrong Type or data empty");
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename value_t>
|
||||
inline value_t basic_value<string_t>::as() const
|
||||
{
|
||||
if constexpr (std::is_same_v<basic_value<string_t>, value_t>) {
|
||||
return *this;
|
||||
}
|
||||
else if constexpr (_utils::has_from_json_in_member<value_t, string_t>::value) {
|
||||
value_t dst {};
|
||||
if (!dst.from_json(*this)) {
|
||||
throw exception("Wrong JSON");
|
||||
}
|
||||
return dst;
|
||||
}
|
||||
else if constexpr (_utils::has_from_json_in_templ_spec<value_t, string_t>::value) {
|
||||
value_t dst {};
|
||||
if (!ext::jsonization<value_t>().from_json(*this, dst)) {
|
||||
throw exception("Wrong JSON");
|
||||
}
|
||||
return dst;
|
||||
}
|
||||
else {
|
||||
return static_cast<value_t>(*this);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline const string_t& basic_value<string_t>::as_basic_type_str() const
|
||||
{
|
||||
return std::get<string_t>(_raw_data);
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline string_t& basic_value<string_t>::as_basic_type_str()
|
||||
{
|
||||
return std::get<string_t>(_raw_data);
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename... args_t>
|
||||
inline decltype(auto) basic_value<string_t>::emplace(args_t&&... args)
|
||||
{
|
||||
constexpr bool is_array_args = std::is_constructible_v<typename basic_array<string_t>::value_type, args_t...>;
|
||||
constexpr bool is_object_args = std::is_constructible_v<typename basic_object<string_t>::value_type, args_t...>;
|
||||
|
||||
static_assert(is_array_args || is_object_args, "Args can not constructure a array or object value");
|
||||
|
||||
if constexpr (is_array_args) {
|
||||
return as_array().emplace_back(std::forward<args_t>(args)...);
|
||||
}
|
||||
else if constexpr (is_object_args) {
|
||||
return as_object().emplace(std::forward<args_t>(args)...);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline void basic_value<string_t>::clear() noexcept
|
||||
{
|
||||
*this = basic_value<string_t>();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline string_t basic_value<string_t>::to_string() const
|
||||
{
|
||||
switch (_type) {
|
||||
case value_type::null:
|
||||
return _utils::null_string<string_t>();
|
||||
case value_type::boolean:
|
||||
case value_type::number:
|
||||
return as_basic_type_str();
|
||||
case value_type::string:
|
||||
return char_t('"') + _utils::unescape_string(as_basic_type_str()) + char_t('"');
|
||||
case value_type::array:
|
||||
return as_array().to_string();
|
||||
case value_type::object:
|
||||
return as_object().to_string();
|
||||
default:
|
||||
throw exception("Unknown basic_value Type");
|
||||
}
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline string_t basic_value<string_t>::format(size_t indent, size_t indent_times) const
|
||||
{
|
||||
switch (_type) {
|
||||
case value_type::null:
|
||||
case value_type::boolean:
|
||||
case value_type::number:
|
||||
case value_type::string:
|
||||
return to_string();
|
||||
case value_type::array:
|
||||
return as_array().format(indent, indent_times);
|
||||
case value_type::object:
|
||||
return as_object().format(indent, indent_times);
|
||||
default:
|
||||
throw exception("Unknown basic_value Type");
|
||||
}
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename value_t>
|
||||
inline bool basic_value<string_t>::all() const
|
||||
{
|
||||
if (is_array()) {
|
||||
return as_array().template all<value_t>();
|
||||
}
|
||||
else if (is_object()) {
|
||||
return as_object().template all<value_t>();
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename value_t, template <typename...> typename collection_t>
|
||||
inline collection_t<value_t> basic_value<string_t>::as_collection() const
|
||||
{
|
||||
return as_array().template as_collection<value_t, collection_t>();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename value_t, template <typename...> typename map_t>
|
||||
inline map_t<string_t, value_t> basic_value<string_t>::as_map() const
|
||||
{
|
||||
return as_object().template as_map<value_t, map_t>();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t>& basic_value<string_t>::operator=(const basic_value<string_t>& rhs)
|
||||
{
|
||||
_type = rhs._type;
|
||||
_raw_data = deep_copy(rhs._raw_data);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t>& basic_value<string_t>::operator=(basic_value<string_t>&& rhs) noexcept = default;
|
||||
|
||||
template <typename string_t>
|
||||
inline bool basic_value<string_t>::operator==(const basic_value<string_t>& rhs) const
|
||||
{
|
||||
if (_type != rhs._type) return false;
|
||||
|
||||
switch (_type) {
|
||||
case value_type::null:
|
||||
return rhs.is_null();
|
||||
case value_type::boolean:
|
||||
case value_type::number:
|
||||
case value_type::string:
|
||||
return _raw_data == rhs._raw_data;
|
||||
case value_type::array:
|
||||
return as_array() == rhs.as_array();
|
||||
case value_type::object:
|
||||
return as_object() == rhs.as_object();
|
||||
default:
|
||||
throw exception("Unknown basic_value Type");
|
||||
}
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline const basic_value<string_t>& basic_value<string_t>::operator[](size_t pos) const
|
||||
{
|
||||
// basic_array not support to create by operator[]
|
||||
|
||||
return as_array()[pos];
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t>& basic_value<string_t>::operator[](size_t pos)
|
||||
{
|
||||
// basic_array not support to create by operator[]
|
||||
|
||||
return as_array()[pos];
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t>& basic_value<string_t>::operator[](const string_t& key)
|
||||
{
|
||||
if (empty()) {
|
||||
*this = basic_object<string_t>();
|
||||
}
|
||||
|
||||
return as_object()[key];
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t>& basic_value<string_t>::operator[](string_t&& key)
|
||||
{
|
||||
if (empty()) {
|
||||
*this = basic_object<string_t>();
|
||||
}
|
||||
|
||||
return as_object()[std::move(key)];
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t> basic_value<string_t>::operator|(const basic_object<string_t>& rhs) const&
|
||||
{
|
||||
return as_object() | rhs;
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t> basic_value<string_t>::operator|(basic_object<string_t>&& rhs) const&
|
||||
{
|
||||
return as_object() | std::move(rhs);
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t> basic_value<string_t>::operator|(const basic_object<string_t>& rhs) &&
|
||||
{
|
||||
return std::move(as_object()) | rhs;
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t> basic_value<string_t>::operator|(basic_object<string_t>&& rhs) &&
|
||||
{
|
||||
return std::move(as_object()) | std::move(rhs);
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t>& basic_value<string_t>::operator|=(const basic_object<string_t>& rhs)
|
||||
{
|
||||
as_object() |= rhs;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t>& basic_value<string_t>::operator|=(basic_object<string_t>&& rhs)
|
||||
{
|
||||
as_object() |= std::move(rhs);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t> basic_value<string_t>::operator+(const basic_array<string_t>& rhs) const&
|
||||
{
|
||||
return as_array() + rhs;
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t> basic_value<string_t>::operator+(basic_array<string_t>&& rhs) const&
|
||||
{
|
||||
return as_array() + std::move(rhs);
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t> basic_value<string_t>::operator+(const basic_array<string_t>& rhs) &&
|
||||
{
|
||||
return std::move(as_array()) + rhs;
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t> basic_value<string_t>::operator+(basic_array<string_t>&& rhs) &&
|
||||
{
|
||||
return std::move(as_array()) + std::move(rhs);
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t>& basic_value<string_t>::operator+=(const basic_array<string_t>& rhs)
|
||||
{
|
||||
as_array() += rhs;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t>& basic_value<string_t>::operator+=(basic_array<string_t>&& rhs)
|
||||
{
|
||||
as_array() += std::move(rhs);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename... args_t>
|
||||
inline basic_value<string_t>::basic_value(value_type type, args_t&&... args)
|
||||
: _type(type), _raw_data(std::forward<args_t>(args)...)
|
||||
{
|
||||
static_assert(std::is_constructible_v<var_t, args_t...>, "Parameter can't be used to construct a var_t");
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline typename basic_value<string_t>::var_t basic_value<string_t>::deep_copy(const var_t& src)
|
||||
{
|
||||
var_t dst;
|
||||
if (const auto string_ptr = std::get_if<string_t>(&src)) {
|
||||
dst = *string_ptr;
|
||||
}
|
||||
else if (const auto arr_ptr = std::get_if<array_ptr>(&src)) {
|
||||
dst = std::make_unique<basic_array<string_t>>(**arr_ptr);
|
||||
}
|
||||
else if (const auto obj_ptr = std::get_if<object_ptr>(&src)) {
|
||||
dst = std::make_unique<basic_object<string_t>>(**obj_ptr);
|
||||
}
|
||||
else {
|
||||
// maybe invalid_value
|
||||
}
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
template <typename ostream_t, typename string_t,
|
||||
typename std_ostream_t =
|
||||
std::basic_ostream<typename string_t::value_type, std::char_traits<typename string_t::value_type>>,
|
||||
typename =
|
||||
std::enable_if_t<std::is_same_v<std_ostream_t, ostream_t> || std::is_base_of_v<std_ostream_t, ostream_t>>>
|
||||
ostream_t& operator<<(ostream_t& out, const basic_value<string_t>& val)
|
||||
{
|
||||
out << val.format();
|
||||
return out;
|
||||
}
|
||||
} // namespace json
|
||||
2743
3rdparty/include/meojson/json.hpp
vendored
4
3rdparty/include/meojson/json5.hpp
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
#pragma once
|
||||
|
||||
#include "common/types.hpp"
|
||||
#include "parser5/parser5.hpp"
|
||||
@@ -138,5 +138,4 @@ using packed_bytes_trait_max =
|
||||
std::conditional_t<packed_bytes_trait<16>::available, packed_bytes_trait<16>,
|
||||
std::conditional_t<packed_bytes_trait<8>::available, packed_bytes_trait<8>,
|
||||
packed_bytes_trait<4>>>>;
|
||||
|
||||
} // namespace json::_packed_bytes
|
||||
627
3rdparty/include/meojson/parser/parser.hpp
vendored
Normal file
@@ -0,0 +1,627 @@
|
||||
#pragma once
|
||||
|
||||
#include <fstream>
|
||||
#include <optional>
|
||||
#include <ostream>
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
|
||||
#include "../common/types.hpp"
|
||||
#include "packed_bytes.hpp"
|
||||
|
||||
namespace json
|
||||
{
|
||||
// ****************************
|
||||
// * parser declare *
|
||||
// ****************************
|
||||
|
||||
template <typename string_t = default_string_t, typename parsing_t = void,
|
||||
typename accel_traits = _packed_bytes::packed_bytes_trait_max>
|
||||
class parser
|
||||
{
|
||||
public:
|
||||
using parsing_iter_t = typename parsing_t::const_iterator;
|
||||
|
||||
public:
|
||||
~parser() noexcept = default;
|
||||
|
||||
static std::optional<basic_value<string_t>> parse(const parsing_t& content);
|
||||
|
||||
private:
|
||||
parser(parsing_iter_t cbegin, parsing_iter_t cend) noexcept : _cur(cbegin), _end(cend) { ; }
|
||||
|
||||
std::optional<basic_value<string_t>> parse();
|
||||
basic_value<string_t> parse_value();
|
||||
|
||||
basic_value<string_t> parse_null();
|
||||
basic_value<string_t> parse_boolean();
|
||||
basic_value<string_t> parse_number();
|
||||
// parse and return a basic_value<string_t> whose type is value_type::string
|
||||
basic_value<string_t> parse_string();
|
||||
basic_value<string_t> parse_array();
|
||||
basic_value<string_t> parse_object();
|
||||
|
||||
// parse and return a string_t
|
||||
std::optional<string_t> parse_stdstring();
|
||||
|
||||
bool skip_string_literal_with_accel();
|
||||
bool skip_whitespace() noexcept;
|
||||
bool skip_digit();
|
||||
|
||||
private:
|
||||
parsing_iter_t _cur;
|
||||
parsing_iter_t _end;
|
||||
};
|
||||
|
||||
// ***************************
|
||||
// * utils declare *
|
||||
// ***************************
|
||||
|
||||
template <typename parsing_t>
|
||||
auto parse(const parsing_t& content);
|
||||
|
||||
template <typename char_t>
|
||||
auto parse(char_t* content);
|
||||
|
||||
template <typename istream_t,
|
||||
typename = std::enable_if_t<std::is_base_of_v<std::basic_istream<typename istream_t::char_type>, istream_t>>>
|
||||
auto parse(istream_t& istream, bool check_bom);
|
||||
|
||||
template <typename ifstream_t = std::ifstream, typename path_t = void>
|
||||
auto open(const path_t& path, bool check_bom = false);
|
||||
|
||||
namespace literals
|
||||
{
|
||||
value operator""_json(const char* str, size_t len);
|
||||
wvalue operator""_json(const wchar_t* str, size_t len);
|
||||
|
||||
value operator""_jvalue(const char* str, size_t len);
|
||||
wvalue operator""_jvalue(const wchar_t* str, size_t len);
|
||||
|
||||
array operator""_jarray(const char* str, size_t len);
|
||||
warray operator""_jarray(const wchar_t* str, size_t len);
|
||||
|
||||
object operator""_jobject(const char* str, size_t len);
|
||||
wobject operator""_jobject(const wchar_t* str, size_t len);
|
||||
}
|
||||
|
||||
template <typename string_t = default_string_t>
|
||||
const basic_value<string_t> invalid_value();
|
||||
|
||||
// *************************
|
||||
// * parser impl *
|
||||
// *************************
|
||||
|
||||
template <typename string_t, typename parsing_t, typename accel_traits>
|
||||
inline std::optional<basic_value<string_t>> parser<string_t, parsing_t, accel_traits>::parse(const parsing_t& content)
|
||||
{
|
||||
return parser<string_t, parsing_t, accel_traits>(content.cbegin(), content.cend()).parse();
|
||||
}
|
||||
|
||||
template <typename string_t, typename parsing_t, typename accel_traits>
|
||||
inline std::optional<basic_value<string_t>> parser<string_t, parsing_t, accel_traits>::parse()
|
||||
{
|
||||
if (!skip_whitespace()) {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
basic_value<string_t> result_value;
|
||||
switch (*_cur) {
|
||||
case '[':
|
||||
result_value = parse_array();
|
||||
break;
|
||||
case '{':
|
||||
result_value = parse_object();
|
||||
break;
|
||||
default: // A JSON payload should be an basic_object or basic_array
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
if (!result_value.valid()) {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
// After the parsing is complete, there should be no more content other than
|
||||
// spaces behind
|
||||
if (skip_whitespace()) {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
return result_value;
|
||||
}
|
||||
|
||||
template <typename string_t, typename parsing_t, typename accel_traits>
|
||||
inline basic_value<string_t> parser<string_t, parsing_t, accel_traits>::parse_value()
|
||||
{
|
||||
switch (*_cur) {
|
||||
case 'n':
|
||||
return parse_null();
|
||||
case 't':
|
||||
case 'f':
|
||||
return parse_boolean();
|
||||
case '-':
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
case '8':
|
||||
case '9':
|
||||
return parse_number();
|
||||
case '"':
|
||||
return parse_string();
|
||||
case '[':
|
||||
return parse_array();
|
||||
case '{':
|
||||
return parse_object();
|
||||
default:
|
||||
return invalid_value<string_t>();
|
||||
}
|
||||
}
|
||||
|
||||
template <typename string_t, typename parsing_t, typename accel_traits>
|
||||
inline basic_value<string_t> parser<string_t, parsing_t, accel_traits>::parse_null()
|
||||
{
|
||||
for (const auto& ch : _utils::null_string<string_t>()) {
|
||||
if (_cur != _end && *_cur == ch) {
|
||||
++_cur;
|
||||
}
|
||||
else {
|
||||
return invalid_value<string_t>();
|
||||
}
|
||||
}
|
||||
|
||||
return basic_value<string_t>();
|
||||
}
|
||||
|
||||
template <typename string_t, typename parsing_t, typename accel_traits>
|
||||
inline basic_value<string_t> parser<string_t, parsing_t, accel_traits>::parse_boolean()
|
||||
{
|
||||
switch (*_cur) {
|
||||
case 't':
|
||||
for (const auto& ch : _utils::true_string<string_t>()) {
|
||||
if (_cur != _end && *_cur == ch) {
|
||||
++_cur;
|
||||
}
|
||||
else {
|
||||
return invalid_value<string_t>();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
case 'f':
|
||||
for (const auto& ch : _utils::false_string<string_t>()) {
|
||||
if (_cur != _end && *_cur == ch) {
|
||||
++_cur;
|
||||
}
|
||||
else {
|
||||
return invalid_value<string_t>();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
default:
|
||||
return invalid_value<string_t>();
|
||||
}
|
||||
}
|
||||
|
||||
template <typename string_t, typename parsing_t, typename accel_traits>
|
||||
inline basic_value<string_t> parser<string_t, parsing_t, accel_traits>::parse_number()
|
||||
{
|
||||
const auto first = _cur;
|
||||
if (*_cur == '-') {
|
||||
++_cur;
|
||||
}
|
||||
|
||||
// numbers cannot have leading zeroes
|
||||
if (_cur != _end && *_cur == '0' && _cur + 1 != _end && std::isdigit(*(_cur + 1))) {
|
||||
return invalid_value<string_t>();
|
||||
}
|
||||
|
||||
if (!skip_digit()) {
|
||||
return invalid_value<string_t>();
|
||||
}
|
||||
|
||||
if (*_cur == '.') {
|
||||
++_cur;
|
||||
if (!skip_digit()) {
|
||||
return invalid_value<string_t>();
|
||||
}
|
||||
}
|
||||
|
||||
if (*_cur == 'e' || *_cur == 'E') {
|
||||
if (++_cur == _end) {
|
||||
return invalid_value<string_t>();
|
||||
}
|
||||
if (*_cur == '+' || *_cur == '-') {
|
||||
++_cur;
|
||||
}
|
||||
if (!skip_digit()) {
|
||||
return invalid_value<string_t>();
|
||||
}
|
||||
}
|
||||
|
||||
return basic_value<string_t>(basic_value<string_t>::value_type::number, string_t(first, _cur));
|
||||
}
|
||||
|
||||
template <typename string_t, typename parsing_t, typename accel_traits>
|
||||
inline basic_value<string_t> parser<string_t, parsing_t, accel_traits>::parse_string()
|
||||
{
|
||||
auto string_opt = parse_stdstring();
|
||||
if (!string_opt) {
|
||||
return invalid_value<string_t>();
|
||||
}
|
||||
return basic_value<string_t>(basic_value<string_t>::value_type::string, std::move(string_opt).value());
|
||||
}
|
||||
|
||||
template <typename string_t, typename parsing_t, typename accel_traits>
|
||||
inline basic_value<string_t> parser<string_t, parsing_t, accel_traits>::parse_array()
|
||||
{
|
||||
if (*_cur == '[') {
|
||||
++_cur;
|
||||
}
|
||||
else {
|
||||
return invalid_value<string_t>();
|
||||
}
|
||||
|
||||
if (!skip_whitespace()) {
|
||||
return invalid_value<string_t>();
|
||||
}
|
||||
else if (*_cur == ']') {
|
||||
++_cur;
|
||||
// empty basic_array
|
||||
return basic_array<string_t>();
|
||||
}
|
||||
|
||||
typename basic_array<string_t>::raw_array result;
|
||||
while (true) {
|
||||
if (!skip_whitespace()) {
|
||||
return invalid_value<string_t>();
|
||||
}
|
||||
|
||||
basic_value<string_t> val = parse_value();
|
||||
|
||||
if (!val.valid() || !skip_whitespace()) {
|
||||
return invalid_value<string_t>();
|
||||
}
|
||||
|
||||
result.emplace_back(std::move(val));
|
||||
|
||||
if (*_cur == ',') {
|
||||
++_cur;
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (skip_whitespace() && *_cur == ']') {
|
||||
++_cur;
|
||||
}
|
||||
else {
|
||||
return invalid_value<string_t>();
|
||||
}
|
||||
|
||||
return basic_array<string_t>(std::move(result));
|
||||
}
|
||||
|
||||
template <typename string_t, typename parsing_t, typename accel_traits>
|
||||
inline basic_value<string_t> parser<string_t, parsing_t, accel_traits>::parse_object()
|
||||
{
|
||||
if (*_cur == '{') {
|
||||
++_cur;
|
||||
}
|
||||
else {
|
||||
return invalid_value<string_t>();
|
||||
}
|
||||
|
||||
if (!skip_whitespace()) {
|
||||
return invalid_value<string_t>();
|
||||
}
|
||||
else if (*_cur == '}') {
|
||||
++_cur;
|
||||
// empty basic_object
|
||||
return basic_object<string_t>();
|
||||
}
|
||||
|
||||
typename basic_object<string_t>::raw_object result;
|
||||
while (true) {
|
||||
if (!skip_whitespace()) {
|
||||
return invalid_value<string_t>();
|
||||
}
|
||||
|
||||
auto key_opt = parse_stdstring();
|
||||
|
||||
if (key_opt && skip_whitespace() && *_cur == ':') {
|
||||
++_cur;
|
||||
}
|
||||
else {
|
||||
return invalid_value<string_t>();
|
||||
}
|
||||
|
||||
if (!skip_whitespace()) {
|
||||
return invalid_value<string_t>();
|
||||
}
|
||||
|
||||
basic_value<string_t> val = parse_value();
|
||||
|
||||
if (!val.valid() || !skip_whitespace()) {
|
||||
return invalid_value<string_t>();
|
||||
}
|
||||
|
||||
result.emplace(std::move(*key_opt), std::move(val));
|
||||
|
||||
if (*_cur == ',') {
|
||||
++_cur;
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (skip_whitespace() && *_cur == '}') {
|
||||
++_cur;
|
||||
}
|
||||
else {
|
||||
return invalid_value<string_t>();
|
||||
}
|
||||
|
||||
return basic_object<string_t>(std::move(result));
|
||||
}
|
||||
|
||||
template <typename string_t, typename parsing_t, typename accel_traits>
|
||||
inline std::optional<string_t> parser<string_t, parsing_t, accel_traits>::parse_stdstring()
|
||||
{
|
||||
if (*_cur == '"') {
|
||||
++_cur;
|
||||
}
|
||||
else {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
string_t result;
|
||||
auto no_escape_beg = _cur;
|
||||
|
||||
while (_cur != _end) {
|
||||
if constexpr (sizeof(*_cur) == 1 && accel_traits::available) {
|
||||
if (!skip_string_literal_with_accel()) {
|
||||
return std::nullopt;
|
||||
}
|
||||
}
|
||||
switch (*_cur) {
|
||||
case '\t':
|
||||
case '\r':
|
||||
case '\n':
|
||||
return std::nullopt;
|
||||
case '\\': {
|
||||
result += string_t(no_escape_beg, _cur++);
|
||||
if (_cur == _end) {
|
||||
return std::nullopt;
|
||||
}
|
||||
switch (*_cur) {
|
||||
case '"':
|
||||
result.push_back('"');
|
||||
break;
|
||||
case '\\':
|
||||
result.push_back('\\');
|
||||
break;
|
||||
case '/':
|
||||
result.push_back('/');
|
||||
break;
|
||||
case 'b':
|
||||
result.push_back('\b');
|
||||
break;
|
||||
case 'f':
|
||||
result.push_back('\f');
|
||||
break;
|
||||
case 'n':
|
||||
result.push_back('\n');
|
||||
break;
|
||||
case 'r':
|
||||
result.push_back('\r');
|
||||
break;
|
||||
case 't':
|
||||
result.push_back('\t');
|
||||
break;
|
||||
// case 'u':
|
||||
// result.push_back('\u');
|
||||
// break;
|
||||
default:
|
||||
// Illegal backslash escape
|
||||
return std::nullopt;
|
||||
}
|
||||
no_escape_beg = ++_cur;
|
||||
break;
|
||||
}
|
||||
case '"': {
|
||||
result += string_t(no_escape_beg, _cur++);
|
||||
return result;
|
||||
}
|
||||
default:
|
||||
++_cur;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
template <typename string_t, typename parsing_t, typename accel_traits>
|
||||
inline bool parser<string_t, parsing_t, accel_traits>::skip_string_literal_with_accel()
|
||||
{
|
||||
if constexpr (sizeof(*_cur) != 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
while (_end - _cur >= accel_traits::step) {
|
||||
auto pack = accel_traits::load_unaligned(&(*_cur));
|
||||
auto result = accel_traits::less(pack, 32);
|
||||
result = accel_traits::bitwise_or(result, accel_traits::equal(pack, static_cast<uint8_t>('"')));
|
||||
result = accel_traits::bitwise_or(result, accel_traits::equal(pack, static_cast<uint8_t>('\\')));
|
||||
|
||||
if (accel_traits::is_all_zero(result)) {
|
||||
_cur += accel_traits::step;
|
||||
}
|
||||
else {
|
||||
auto index = accel_traits::first_nonzero_byte(result);
|
||||
_cur += index;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return _cur != _end;
|
||||
}
|
||||
|
||||
template <typename string_t, typename parsing_t, typename accel_traits>
|
||||
inline bool parser<string_t, parsing_t, accel_traits>::skip_whitespace() noexcept
|
||||
{
|
||||
while (_cur != _end) {
|
||||
switch (*_cur) {
|
||||
case ' ':
|
||||
case '\t':
|
||||
case '\r':
|
||||
case '\n':
|
||||
++_cur;
|
||||
break;
|
||||
case '\0':
|
||||
return false;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename string_t, typename parsing_t, typename accel_traits>
|
||||
inline bool parser<string_t, parsing_t, accel_traits>::skip_digit()
|
||||
{
|
||||
// At least one digit
|
||||
if (_cur != _end && std::isdigit(*_cur)) {
|
||||
++_cur;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
|
||||
while (_cur != _end && std::isdigit(*_cur)) {
|
||||
++_cur;
|
||||
}
|
||||
|
||||
if (_cur != _end) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// *************************
|
||||
// * utils impl *
|
||||
// *************************
|
||||
|
||||
template <typename parsing_t>
|
||||
auto parse(const parsing_t& content)
|
||||
{
|
||||
using string_t = std::basic_string<typename parsing_t::value_type>;
|
||||
return parser<string_t, parsing_t>::parse(content);
|
||||
}
|
||||
|
||||
template <typename char_t>
|
||||
auto parse(char_t* content)
|
||||
{
|
||||
return parse(std::basic_string_view<std::decay_t<char_t>> { content });
|
||||
}
|
||||
|
||||
template <typename istream_t, typename _>
|
||||
auto parse(istream_t& ifs, bool check_bom)
|
||||
{
|
||||
using string_t = std::basic_string<typename istream_t::char_type>;
|
||||
|
||||
ifs.seekg(0, std::ios::end);
|
||||
auto file_size = ifs.tellg();
|
||||
|
||||
ifs.seekg(0, std::ios::beg);
|
||||
string_t str(file_size, '\0');
|
||||
|
||||
ifs.read(str.data(), file_size);
|
||||
|
||||
if (check_bom) {
|
||||
using uchar = unsigned char;
|
||||
static constexpr uchar Bom_0 = 0xEF;
|
||||
static constexpr uchar Bom_1 = 0xBB;
|
||||
static constexpr uchar Bom_2 = 0xBF;
|
||||
|
||||
if (str.size() >= 3 && static_cast<uchar>(str.at(0)) == Bom_0 && static_cast<uchar>(str.at(1)) == Bom_1 &&
|
||||
static_cast<uchar>(str.at(2)) == Bom_2) {
|
||||
str.assign(str.begin() + 3, str.end());
|
||||
}
|
||||
}
|
||||
return parse(str);
|
||||
}
|
||||
|
||||
template <typename ifstream_t, typename path_t>
|
||||
auto open(const path_t& filepath, bool check_bom)
|
||||
{
|
||||
using char_t = typename ifstream_t::char_type;
|
||||
using string_t = std::basic_string<char_t>;
|
||||
using json_t = json::basic_value<string_t>;
|
||||
using return_t = std::optional<json_t>;
|
||||
|
||||
ifstream_t ifs(filepath, std::ios::in);
|
||||
if (!ifs.is_open()) {
|
||||
return return_t(std::nullopt);
|
||||
}
|
||||
auto opt = parse(ifs, check_bom);
|
||||
ifs.close();
|
||||
return opt;
|
||||
}
|
||||
|
||||
namespace literals
|
||||
{
|
||||
inline value operator""_json(const char* str, size_t len)
|
||||
{
|
||||
return operator""_jvalue(str, len);
|
||||
}
|
||||
inline wvalue operator""_json(const wchar_t* str, size_t len)
|
||||
{
|
||||
return operator""_jvalue(str, len);
|
||||
}
|
||||
|
||||
inline value operator""_jvalue(const char* str, size_t len)
|
||||
{
|
||||
return parse(std::string_view(str, len)).value_or(value());
|
||||
}
|
||||
inline wvalue operator""_jvalue(const wchar_t* str, size_t len)
|
||||
{
|
||||
return parse(std::wstring_view(str, len)).value_or(wvalue());
|
||||
}
|
||||
|
||||
inline array operator""_jarray(const char* str, size_t len)
|
||||
{
|
||||
auto val = parse(std::string_view(str, len)).value_or(value());
|
||||
return val.is_array() ? val.as_array() : array();
|
||||
}
|
||||
inline warray operator""_jarray(const wchar_t* str, size_t len)
|
||||
{
|
||||
auto val = parse(std::wstring_view(str, len)).value_or(wvalue());
|
||||
return val.is_array() ? val.as_array() : warray();
|
||||
}
|
||||
|
||||
inline object operator""_jobject(const char* str, size_t len)
|
||||
{
|
||||
auto val = parse(std::string_view(str, len)).value_or(value());
|
||||
return val.is_object() ? val.as_object() : object();
|
||||
}
|
||||
inline wobject operator""_jobject(const wchar_t* str, size_t len)
|
||||
{
|
||||
auto val = parse(std::wstring_view(str, len)).value_or(wvalue());
|
||||
return val.is_object() ? val.as_object() : wobject();
|
||||
}
|
||||
} // namespace literals
|
||||
|
||||
template <typename string_t>
|
||||
const basic_value<string_t> invalid_value()
|
||||
{
|
||||
return basic_value<string_t>(basic_value<string_t>::value_type::invalid, typename basic_value<string_t>::var_t());
|
||||
}
|
||||
} // namespace json
|
||||
1502
3rdparty/include/meojson/parser5/parser5.hpp
vendored
Normal file
16
3rdparty/include/meojson/parser5/unicode.h
vendored
Normal file
241
3rdparty/include/meojson/reflection/jsonization.hpp
vendored
Normal file
@@ -0,0 +1,241 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
|
||||
#include "../common/types.hpp"
|
||||
|
||||
namespace json::_jsonization_helper
|
||||
{
|
||||
struct next_is_optional_t
|
||||
{};
|
||||
struct va_arg_end
|
||||
{};
|
||||
|
||||
struct dumper
|
||||
{
|
||||
template <typename var_t, typename... rest_t>
|
||||
json::value _to_json(const char* key, const var_t& var, rest_t&&... rest) const
|
||||
{
|
||||
json::value result = _to_json(std::forward<rest_t>(rest)...);
|
||||
result.emplace(key, var);
|
||||
return result;
|
||||
}
|
||||
template <typename... rest_t>
|
||||
json::value _to_json(const char*, next_is_optional_t, rest_t&&... rest) const
|
||||
{
|
||||
return _to_json(std::forward<rest_t>(rest)...);
|
||||
}
|
||||
json::value _to_json(va_arg_end) const { return {}; }
|
||||
};
|
||||
|
||||
struct checker
|
||||
{
|
||||
template <typename var_t, typename... rest_t>
|
||||
bool _check_json(const json::value& in, std::string& error_key, const char* key, const var_t&,
|
||||
rest_t&&... rest) const
|
||||
{
|
||||
auto opt = in.find(key);
|
||||
if (!opt || !opt->is<var_t>()) {
|
||||
error_key = key;
|
||||
return false;
|
||||
}
|
||||
return _check_json(in, error_key, std::forward<rest_t>(rest)...);
|
||||
}
|
||||
template <typename var_t, typename... rest_t>
|
||||
bool _check_json(const json::value& in, std::string& error_key, const char*, next_is_optional_t, const char* key,
|
||||
const var_t&, rest_t&&... rest) const
|
||||
{
|
||||
auto opt = in.find(key);
|
||||
if (opt) {
|
||||
if (!opt->is<var_t>()) {
|
||||
error_key = key;
|
||||
return false;
|
||||
}
|
||||
} // next_is_optional_t, ignore key not found
|
||||
|
||||
return _check_json(in, error_key, std::forward<rest_t>(rest)...);
|
||||
}
|
||||
bool _check_json(const json::value&, std::string&, va_arg_end) const { return true; }
|
||||
};
|
||||
|
||||
struct loader
|
||||
{
|
||||
template <typename var_t, typename... rest_t>
|
||||
bool _from_json(const json::value& in, std::string& error_key, const char* key, var_t& var, rest_t&&... rest) const
|
||||
{
|
||||
auto opt = in.find(key);
|
||||
if (!opt || !opt->is<var_t>()) {
|
||||
error_key = key;
|
||||
return false;
|
||||
}
|
||||
var = std::move(opt)->as<var_t>();
|
||||
|
||||
return _from_json(in, error_key, std::forward<rest_t>(rest)...);
|
||||
}
|
||||
template <typename var_t, typename... rest_t>
|
||||
bool _from_json(const json::value& in, std::string& error_key, const char*, next_is_optional_t, const char* key,
|
||||
var_t& var, rest_t&&... rest) const
|
||||
{
|
||||
auto opt = in.find(key);
|
||||
if (opt) {
|
||||
if (!opt->is<var_t>()) {
|
||||
error_key = key;
|
||||
return false;
|
||||
}
|
||||
var = std::move(opt)->as<var_t>();
|
||||
} // next_is_optional_t, ignore key not found
|
||||
|
||||
return _from_json(in, error_key, std::forward<rest_t>(rest)...);
|
||||
}
|
||||
bool _from_json(const json::value&, std::string&, va_arg_end) const { return true; }
|
||||
};
|
||||
} // namespace json::_jsonization_helper
|
||||
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
|
||||
#endif
|
||||
|
||||
namespace json::_private_macro
|
||||
{
|
||||
#define _MEOJSON_STRINGIZE(arg) _MEOJSON_STRINGIZE1(arg)
|
||||
#define _MEOJSON_STRINGIZE1(arg) _MEOJSON_STRINGIZE2(arg)
|
||||
#define _MEOJSON_STRINGIZE2(arg) #arg
|
||||
|
||||
#define _MEOJSON_CONCATENATE(arg1, arg2) _MEOJSON_CONCATENATE1(arg1, arg2)
|
||||
#define _MEOJSON_CONCATENATE1(arg1, arg2) _MEOJSON_CONCATENATE2(arg1, arg2)
|
||||
#define _MEOJSON_CONCATENATE2(arg1, arg2) arg1##arg2
|
||||
|
||||
#define _MEOJSON_EXPAND(x) x
|
||||
|
||||
#define _MEOJSON_FOR_EACH_0(pred, ...)
|
||||
#define _MEOJSON_FOR_EACH_1(pred, x, ...) pred(x)
|
||||
#define _MEOJSON_FOR_EACH_2(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_1(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_3(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_2(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_4(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_3(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_5(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_4(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_6(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_5(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_7(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_6(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_8(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_7(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_9(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_8(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_10(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_9(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_11(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_10(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_12(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_11(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_13(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_12(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_14(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_13(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_15(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_14(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_16(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_15(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_17(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_16(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_18(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_17(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_19(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_18(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_20(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_19(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_21(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_20(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_22(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_21(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_23(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_22(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_24(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_23(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_25(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_24(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_26(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_25(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_27(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_26(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_28(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_27(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_29(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_28(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_30(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_29(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_31(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_30(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_32(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_31(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_33(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_32(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_34(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_33(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_35(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_34(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_36(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_35(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_37(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_36(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_38(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_37(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_39(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_38(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_40(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_39(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_41(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_40(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_42(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_41(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_43(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_42(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_44(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_43(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_45(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_44(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_46(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_45(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_47(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_46(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_48(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_47(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_49(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_48(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_50(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_49(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_51(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_50(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_52(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_51(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_53(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_52(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_54(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_53(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_55(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_54(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_56(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_55(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_57(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_56(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_58(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_57(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_59(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_58(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_60(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_59(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_61(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_60(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_62(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_61(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_63(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_62(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_64(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_63(pred, __VA_ARGS__))
|
||||
|
||||
#define _MEOJSON_ARG_COUNT(...) \
|
||||
_MEOJSON_EXPAND(_MEOJSON_ARG_COUNT1(0, ##__VA_ARGS__, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, \
|
||||
49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, \
|
||||
30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, \
|
||||
11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0))
|
||||
#define _MEOJSON_ARG_COUNT1(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, \
|
||||
_20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, \
|
||||
_38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, \
|
||||
_56, _57, _58, _59, _60, _61, _62, _63, _64, N, ...) \
|
||||
N
|
||||
|
||||
#define _MEOJSON_FOR_EACH_(N, pred, ...) _MEOJSON_EXPAND(_MEOJSON_CONCATENATE(_MEOJSON_FOR_EACH_, N)(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH(pred, ...) \
|
||||
_MEOJSON_EXPAND(_MEOJSON_FOR_EACH_(_MEOJSON_EXPAND(_MEOJSON_ARG_COUNT(__VA_ARGS__)), pred, __VA_ARGS__))
|
||||
|
||||
#define _MEOJSON_VARNAME(x) _MEOJSON_CONCATENATE(_meojson_jsonization_, x)
|
||||
#define _MEOJSON_KEY_VALUE(x) _MEOJSON_STRINGIZE(x), x,
|
||||
} // namespace json::_private_macro
|
||||
|
||||
#define MEO_TOJSON(...) \
|
||||
json::value to_json() const \
|
||||
{ \
|
||||
return json::_jsonization_helper::dumper()._to_json(_MEOJSON_EXPAND( \
|
||||
_MEOJSON_FOR_EACH(_MEOJSON_KEY_VALUE, __VA_ARGS__)) json::_jsonization_helper::va_arg_end {}); \
|
||||
}
|
||||
|
||||
#define MEO_CHECKJSON(...) \
|
||||
bool check_json(const json::value& _MEOJSON_VARNAME(in)) const \
|
||||
{ \
|
||||
std::string _MEOJSON_VARNAME(error_key); \
|
||||
return check_json(_MEOJSON_VARNAME(in), _MEOJSON_VARNAME(error_key)); \
|
||||
} \
|
||||
bool check_json(const json::value& _MEOJSON_VARNAME(in), std::string& _MEOJSON_VARNAME(error_key)) const \
|
||||
{ \
|
||||
return json::_jsonization_helper::checker()._check_json( \
|
||||
_MEOJSON_VARNAME(in), _MEOJSON_VARNAME(error_key), \
|
||||
_MEOJSON_EXPAND(_MEOJSON_FOR_EACH(_MEOJSON_KEY_VALUE, __VA_ARGS__)) \
|
||||
json::_jsonization_helper::va_arg_end {}); \
|
||||
}
|
||||
|
||||
#define MEO_FROMJSON(...) \
|
||||
bool from_json(const json::value& _MEOJSON_VARNAME(in)) \
|
||||
{ \
|
||||
std::string _MEOJSON_VARNAME(error_key); \
|
||||
return from_json(_MEOJSON_VARNAME(in), _MEOJSON_VARNAME(error_key)); \
|
||||
} \
|
||||
bool from_json(const json::value& _MEOJSON_VARNAME(in), std::string& _MEOJSON_VARNAME(error_key)) \
|
||||
{ \
|
||||
return json::_jsonization_helper::loader()._from_json( \
|
||||
_MEOJSON_VARNAME(in), _MEOJSON_VARNAME(error_key), \
|
||||
_MEOJSON_EXPAND(_MEOJSON_FOR_EACH(_MEOJSON_KEY_VALUE, __VA_ARGS__)) \
|
||||
json::_jsonization_helper::va_arg_end {}); \
|
||||
}
|
||||
|
||||
#define MEO_JSONIZATION(...) \
|
||||
_MEOJSON_EXPAND(MEO_TOJSON(__VA_ARGS__)) \
|
||||
_MEOJSON_EXPAND(MEO_CHECKJSON(__VA_ARGS__)) \
|
||||
_MEOJSON_EXPAND(MEO_FROMJSON(__VA_ARGS__))
|
||||
|
||||
#define MEO_OPT json::_jsonization_helper::next_is_optional_t {},
|
||||
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop // -Wgnu-zero-variadic-macro-arguments
|
||||
#endif
|
||||
99
CHANGELOG.md
@@ -1,96 +1,15 @@
|
||||
## v5.1.0
|
||||
## v5.4.1
|
||||
|
||||
### 新增 | New
|
||||
### 文档 | Docs
|
||||
|
||||
- 生息演算2 (#8190) (Mac 版本需点加号手动添加) @SherkeyXD @hguandl @ABA2396
|
||||
- 开放每日免费单抽功能 (#8185) @SherkeyXD
|
||||
- 新增只购买折扣信用商品(白名单商品除外)和少于300信用点停止购物的选项 (#7659) @lpowo @status102
|
||||
- 基建领取专精功能 (#7754) @broken-paint @Constrat
|
||||
- 合成玉签到task (#8223) @Sherkey @status102
|
||||
- 抽卡提示不许勾下次不再提示 @ABA2396
|
||||
- 运行 ReclamationAlgorithm 时默认运行 Reclamation2 而不是旧演算 (#8229) @horror-proton @ABA2396
|
||||
- 强制定时启动添加提示对话框并可选是否显示窗口 (#8062) @moomiji
|
||||
- 在自动编队过程中缺少干员时停止并记录 (#8051) @KevinT3Hu
|
||||
|
||||
### 改进 | Improved
|
||||
|
||||
- 更新文档到.net8 @ABA2396
|
||||
- 移除CopilotTask不必要的传参 @status102
|
||||
- 更新部分step的版本 @SherkeyXD
|
||||
- 增加账号切换时登录键点击重试 @status102
|
||||
- 远程控制对非 https 连接仅提出警告 (#8061) @Sherkey
|
||||
- 肉鸽适配新干员用法 (#8273) @Lancarus
|
||||
- 肉鸽投资后结束本次战斗 (#8268) @status102
|
||||
- 优化肉鸽投资速度及输出 (#8177) @status102
|
||||
- 调整生息演算任务 @status102
|
||||
- 增加生稀盐酸跳过等待 @status102
|
||||
- 全反选排除生息演算 @ABA2396
|
||||
- Mac 全部启用任务时排除生息演算 @Hao Guan
|
||||
- 优化可变位置文字识别 @ABA2396
|
||||
- 部分需重启生效的选项添加重启确认弹窗 @ABA2396
|
||||
- 缓存待部署区识别,减少CPU占用 (#8275) @status102
|
||||
- ScreenCost截图失败次数为0时,不返回fault_times字段 @status102
|
||||
- 优化基建领取专精 (#8207) @broken-paint
|
||||
|
||||
### 修复 | Fix
|
||||
|
||||
- 未开启吐司通知时仍弹出通知 @ABA2396
|
||||
- 生息演算开局教程对话有概率卡住 @status102
|
||||
- 修复无限提示远控地址为空的问题 @Sherkey
|
||||
- 连续截图出错30次 / 启动时连续截图出错10次 导致MAA崩溃 (#8280) @status102
|
||||
- 写剪贴板时应该用Unicode而不是ANSI (#8204) @Immueggpain
|
||||
- 修复肉鸽存款余额ocr错误 @status102
|
||||
- 修复干员小满概率性识别为`小/满` @status102
|
||||
- 延长进图等待时间 @ABA2396
|
||||
- 生息演算卡在主界面 @ABA2396
|
||||
- 修复没有赠送次数时单抽任务报错的问题 (#8233) @SherkeyXD
|
||||
- 修复生息演算部分情况下无法跳过开局对话 @status102
|
||||
- 尝试修复剩余理智连战次数无法选择 @status102
|
||||
- 干员识别修正: 红集 -> 红隼 @aur3l14no
|
||||
- 修复更新后弹窗错误 @ABA2396
|
||||
- 修复生息演算在卡顿情况下无法正常退出关卡 @ABA2396
|
||||
- 限制连续战斗次数调整失败重试次数 @status102
|
||||
- 生息演算卡在进入第四日 @ABA2396
|
||||
- screencap failure with amdgpu on some emulators (even with GeneralWithoutScreencapErr) (#8225) @aur3l14no
|
||||
- 修复部分分辨率下无法识别删除存档 @ABA2396
|
||||
- 内测版 wpf tag 错误 @ABA2396
|
||||
- 内测版修改ui版本号 @ABA2396
|
||||
- 修复模拟器自动检测失败时可能导致WpfGui崩溃 (#8288) @status102
|
||||
- gui.log 无法显示完整版本号 @ABA2396
|
||||
|
||||
### 其他 | Other
|
||||
|
||||
- 修复Mac生息演算任务名 @Hao Guan
|
||||
- ScreencapCost输出失败次数 @status102
|
||||
- fix typo and undefined behavior of minmax @Horror Proton
|
||||
- 生息演算高级设置文本框增加换行 @status102
|
||||
- EasterEggs 前两次点击不生效 @ABA2396
|
||||
- 抽卡风险提示 @ABA2396
|
||||
- 生息演算提示文本调整 @status102
|
||||
- 移除肉鸽结算输出多余空格 @status102
|
||||
- Update release-nightly-ota.yml @ABA2396
|
||||
- 更新界面文字 (#8206、#8214、#8218) @AnnAngela
|
||||
- fix appimage cross build issue @Horror Proton
|
||||
- 更新文档 (#8283) @Rbqwow
|
||||
- 添加等宽字体的备用字体 @SherkeyXD
|
||||
- added regex for module-reclamation (#8302) @Constrat
|
||||
- 升级依赖,移除package-lock.json @SherkeyXD
|
||||
- 更新连战文档 (#8308) @Rbqwow
|
||||
* website docs (#9287) @ABA2396 @Rbqwow @Constrat @wangl-cc @HX3N @SherkeyXD
|
||||
* 修改win7相关问题描述&更新运行库 @Rbqwow
|
||||
* fix a bad link @Rbqwow
|
||||
* make i18n warnings show only once @Rbqwow
|
||||
* 修复字体和评论区分类 @Rbqwow
|
||||
|
||||
### For Overseas
|
||||
|
||||
##### YoStarJP
|
||||
#### YostarEN
|
||||
|
||||
- YoStarJP ocr fix shamare, ansel, nien (#8194) @Manicsteiner
|
||||
- YoStarJP ocr fix #8180 (#8184) @Manicsteiner
|
||||
- YoStarJP 理想都市 navigation (#8263) @Manicsteiner
|
||||
- YoStarJP ocr fix (#8260) @Manicsteiner
|
||||
|
||||
##### YoStarKR
|
||||
|
||||
- YoStarKR 理想都市 navigation (#8265) @HX3N
|
||||
- YoStarKR ocr fix (假日威龙陈/苍苔/青枳/淬羽赫默 etc) (#8246) @HX3N
|
||||
- YoStarKR update StageAnnihilation.png (#8239) @HX3N
|
||||
- YoStarKR ocr fix (#8236) @HX3N
|
||||
- modified ko-kr.xaml (#8235) @HX3N
|
||||
- YoStarKR add training template image and text (#8295) @HX3N
|
||||
* YoStarEN resolution warning on client switch (#9539) @Constrat @ABA2396
|
||||
|
||||
17
CITATION.cff
Normal file
@@ -0,0 +1,17 @@
|
||||
# This CITATION.cff file was generated with cffinit.
|
||||
# Visit https://bit.ly/cffinit to generate yours today!
|
||||
|
||||
cff-version: 1.2.0
|
||||
title: MaaAssistantArknights
|
||||
message: >-
|
||||
If you use this software, please cite it using the
|
||||
metadata from this file.
|
||||
type: software
|
||||
authors:
|
||||
- name: Maa Team
|
||||
website: 'https://maa.plus/'
|
||||
date-start: '2021-07-10'
|
||||
repository-code: >-
|
||||
https://github.com/MaaAssistantArknights/MaaAssistantArknights/
|
||||
url: 'https://maa.plus/'
|
||||
license: AGPL-3.0-only
|
||||
101
CMakeLists.txt
@@ -13,9 +13,13 @@ option(BUILD_UNIVERSAL "build both arm64 and x86_64 on macOS" OFF)
|
||||
option(INSTALL_PYTHON "install python ffi" OFF)
|
||||
option(INSTALL_RESOURCE "install resource" OFF)
|
||||
option(INSTALL_DEVEL "install development files" OFF)
|
||||
option(INSTALL_FLATTEN "do not use bin lib include directory" ON)
|
||||
option(INSTALL_THIRD_LIBS "install third party libraries" ON)
|
||||
option(USE_MAADEPS "use third-party libraries built by MaaDeps" ON)
|
||||
option(USE_RANGE_V3 "use range-v3" OFF)
|
||||
option(WITH_EMULATOR_EXTRAS "build with emulator extras" ${WIN32})
|
||||
option(WITH_THRIFT "build with thrift" OFF)
|
||||
option(WITH_ASST_DEBUG "build with ASST_DEBUG defined" OFF)
|
||||
|
||||
include(${PROJECT_SOURCE_DIR}/cmake/utils.cmake)
|
||||
include(${PROJECT_SOURCE_DIR}/cmake/thrift-gen.cmake)
|
||||
@@ -24,29 +28,28 @@ if(USE_MAADEPS)
|
||||
include(${PROJECT_SOURCE_DIR}/MaaDeps/maadeps.cmake)
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
add_compile_options("/utf-8")
|
||||
add_compile_options("/MP")
|
||||
add_compile_options("/W4;/WX")
|
||||
add_compile_options("/wd4127") # conditional expression is constant
|
||||
add_compile_options("/Wv:19.35.32217") # disable warning introduced after this version
|
||||
|
||||
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
|
||||
else ()
|
||||
add_compile_options("-Wall;-Werror;-Wextra;-Wpedantic;-Wno-missing-field-initializers")
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13)
|
||||
add_compile_options("-Wno-restrict")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
|
||||
add_library(header_only_libraries INTERFACE)
|
||||
target_include_directories(header_only_libraries INTERFACE 3rdparty/include)
|
||||
target_include_directories(header_only_libraries INTERFACE 3rdparty/include 3rdparty/EmulatorExtras)
|
||||
|
||||
file(GLOB_RECURSE maa_src src/MaaCore/*.cpp)
|
||||
|
||||
add_library(MaaCore SHARED ${maa_src})
|
||||
|
||||
if (MSVC)
|
||||
target_compile_options(MaaCore PRIVATE "/utf-8")
|
||||
target_compile_options(MaaCore PRIVATE "/MP")
|
||||
target_compile_options(MaaCore PRIVATE "/W4;/WX")
|
||||
target_compile_options(MaaCore PRIVATE "/wd4127") # conditional expression is constant
|
||||
target_compile_options(MaaCore PRIVATE "/Wv:19.35.32217") # disable warning introduced after this version
|
||||
|
||||
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
|
||||
else ()
|
||||
target_compile_options(MaaCore PRIVATE "-Wall;-Werror;-Wextra;-Wpedantic;-Wno-missing-field-initializers")
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13)
|
||||
target_compile_options(MaaCore PRIVATE "-Wno-restrict")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
if (WIN32)
|
||||
#注意:相比VS版本缺少了 -D_CONSOLE -D_WINDLL 两项
|
||||
target_compile_definitions(MaaCore PRIVATE ASST_DLL_EXPORTS _UNICODE UNICODE)
|
||||
@@ -77,26 +80,61 @@ endif (BUILD_TEST)
|
||||
|
||||
find_package(OpenCV REQUIRED COMPONENTS core imgproc imgcodecs videoio)
|
||||
find_package(ZLIB REQUIRED)
|
||||
find_package(MaaDerpLearning REQUIRED)
|
||||
find_package(asio REQUIRED)
|
||||
find_package(ONNXRuntime)
|
||||
find_package(cpr CONFIG REQUIRED)
|
||||
|
||||
list(APPEND maa_libs ${OpenCV_LIBS} ZLIB::ZLIB cpr::cpr header_only_libraries)
|
||||
|
||||
if(USE_MAADEPS)
|
||||
find_package(asio REQUIRED)
|
||||
list(APPEND maa_libs asio::asio)
|
||||
endif()
|
||||
|
||||
find_package(onnxruntime CONFIG REQUIRED) # provided by onnxruntime>=1.16
|
||||
list(APPEND maa_libs onnxruntime::onnxruntime)
|
||||
if(DEFINED fastdeploy_SOURCE_DIR)
|
||||
# TODO: FetchContent github.com/MaaAssistantArknights/FastDeploy
|
||||
if(NOT DEFINED fastdeploy_BINARY_DIR)
|
||||
set(fastdeploy_BINARY_DIR ${CMAKE_BINARY_DIR}/fastdeploy)
|
||||
endif()
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
add_subdirectory(${fastdeploy_SOURCE_DIR} ${fastdeploy_BINARY_DIR} EXCLUDE_FROM_ALL SYSTEM)
|
||||
if(NOT DEFINED fastdeploy_INCLUDE_DIRS)
|
||||
set(fastdeploy_INCLUDE_DIRS ${fastdeploy_SOURCE_DIR})
|
||||
endif()
|
||||
target_include_directories(MaaCore SYSTEM PRIVATE ${fastdeploy_INCLUDE_DIRS})
|
||||
get_target_property(fastdeploy_type fastdeploy_ppocr TYPE)
|
||||
if(fastdeploy_type STREQUAL "SHARED_LIBRARY")
|
||||
install(TARGETS fastdeploy_ppocr)
|
||||
endif()
|
||||
else()
|
||||
find_package(fastdeploy_ppocr REQUIRED)
|
||||
endif()
|
||||
list(APPEND maa_libs fastdeploy_ppocr)
|
||||
|
||||
target_link_libraries(MaaCore ${maa_libs})
|
||||
|
||||
if(WITH_EMULATOR_EXTRAS AND NOT EXISTS ${PROJECT_SOURCE_DIR}/3rdparty/EmulatorExtras/Mumu)
|
||||
message(WARNING "EmulatorExtras not found, please run `git submodule update --init 3rdparty/EmulatorExtras`")
|
||||
set(WITH_EMULATOR_EXTRAS OFF)
|
||||
endif()
|
||||
target_compile_definitions(MaaCore PRIVATE ASST_WITH_EMULATOR_EXTRAS=$<BOOL:${WITH_EMULATOR_EXTRAS}>)
|
||||
|
||||
if(WITH_THRIFT)
|
||||
find_package(Thrift CONFIG REQUIRED)
|
||||
endif(WITH_THRIFT)
|
||||
|
||||
target_link_libraries(MaaCore ${OpenCV_LIBS} MaaDerpLearning asio::asio ZLIB::ZLIB ONNXRuntime::ONNXRuntime cpr::cpr header_only_libraries)
|
||||
|
||||
if(WITH_THRIFT)
|
||||
add_subdirectory(src/MaaThriftController)
|
||||
target_link_libraries(MaaCore MaaThriftController)
|
||||
endif(WITH_THRIFT)
|
||||
|
||||
if (WITH_ASST_DEBUG)
|
||||
target_compile_definitions(MaaCore PRIVATE ASST_DEBUG)
|
||||
endif ()
|
||||
|
||||
if(WIN32)
|
||||
target_link_libraries(MaaCore ws2_32)
|
||||
endif()
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES ".*Clang")
|
||||
if (USE_RANGE_V3)
|
||||
target_compile_definitions(MaaCore PRIVATE ASST_USE_RANGES_RANGE_V3)
|
||||
find_package(range-v3 REQUIRED)
|
||||
target_link_libraries(MaaCore range-v3::range-v3)
|
||||
endif ()
|
||||
@@ -105,12 +143,11 @@ if(INSTALL_DEVEL)
|
||||
set(MaaCore_install_extra_args PUBLIC_HEADER DESTINATION devel/include ARCHIVE DESTINATION devel/lib)
|
||||
endif()
|
||||
|
||||
install(TARGETS MaaCore
|
||||
RUNTIME DESTINATION .
|
||||
LIBRARY DESTINATION .
|
||||
PUBLIC_HEADER DESTINATION .
|
||||
${MaaCore_install_extra_args}
|
||||
)
|
||||
if(INSTALL_FLATTEN)
|
||||
set(MaaCore_install_flatten_args RUNTIME DESTINATION . LIBRARY DESTINATION . PUBLIC_HEADER DESTINATION .)
|
||||
endif()
|
||||
|
||||
install(TARGETS MaaCore ${MaaCore_install_flatten_args} ${MaaCore_install_extra_args})
|
||||
|
||||
if(INSTALL_THIRD_LIBS AND USE_MAADEPS)
|
||||
maadeps_install()
|
||||
|
||||
6
LICENSE.spdx
Normal file
@@ -0,0 +1,6 @@
|
||||
SPDXVersion: SPDX-2.3
|
||||
DataLicense: CC0-1.0
|
||||
PackageName: MaaAssistantArknights
|
||||
PackageOriginator: Maa Team and all contributors
|
||||
PackageHomePage: https://github.com/MaaAssistantArknights/MaaAssistantArknights
|
||||
PackageLicenseDeclared: AGPL-3.0-only
|
||||
@@ -41,6 +41,7 @@
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Bilibili/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Bluestacks/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=bsconsole/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=ctrler/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=desp/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=dnplayer/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Ehem/@EntryIndexedValue">True</s:Boolean>
|
||||
@@ -50,6 +51,8 @@
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=FLASHW/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=FLASHWINFO/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=foldartal/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Foldartals/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=framerate/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=furni/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Gacha/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Gavial/@EntryIndexedValue">True</s:Boolean>
|
||||
@@ -67,7 +70,9 @@
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=memuc/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Minitouch/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Mizuki/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Mumu/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Nemu/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Netease/@EntryIndexedValue">True</s:Boolean>
|
||||
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=netstat/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Nonfriend/@EntryIndexedValue">True</s:Boolean>
|
||||
@@ -86,7 +91,6 @@
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=ppidl/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Prts/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=pwfi/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=qodana/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=rcast/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=rdfend/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=rguard/@EntryIndexedValue">True</s:Boolean>
|
||||
@@ -99,6 +103,7 @@
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=serilog/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Showminimized/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Shownormal/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=specialaccess/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=SSS/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=STGM/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=strlen/@EntryIndexedValue">True</s:Boolean>
|
||||
|
||||
2
MaaDeps
162
README.md
@@ -1,3 +1,5 @@
|
||||
<!-- markdownlint-disable -->
|
||||
|
||||
<div align="center">
|
||||
|
||||
<img alt="LOGO" src="https://cdn.jsdelivr.net/gh/MaaAssistantArknights/design@main/logo/maa-logo_512x512.png" width="256" height="256" />
|
||||
@@ -21,7 +23,9 @@
|
||||
</div>
|
||||
<br>
|
||||
|
||||
[简体中文](https://maa.plus/docs/) | [繁體中文](https://maa.plus/docs/zh-tw/) | [English](https://maa.plus/docs/en-us/) | [日本語](https://maa.plus/docs/ja-jp/) | [한국어](https://maa.plus/docs/ko-kr/)
|
||||
<!-- markdownlint-restore -->
|
||||
|
||||
[简体中文](https://maa.plus/docs/zh-cn/) | [繁體中文](https://maa.plus/docs/zh-tw/) | [English](https://maa.plus/docs/en-us/) | [日本語](https://maa.plus/docs/ja-jp/) | [한국어](https://maa.plus/docs/ko-kr/)
|
||||
|
||||
MAA 的意思是 MAA Assistant Arknights
|
||||
|
||||
@@ -29,33 +33,52 @@ MAA 的意思是 MAA Assistant Arknights
|
||||
|
||||
基于图像识别技术,一键完成全部日常任务!
|
||||
|
||||
绝赞更新中 ✿✿ヽ(°▽°)ノ✿<br>
|
||||
绝赞更新中 ✿✿ヽ(°▽°)ノ✿
|
||||
|
||||
</div>
|
||||
|
||||
## 亮点功能
|
||||
|
||||
- 刷理智,掉落识别及上传 [企鹅物流](https://penguin-stats.cn/);
|
||||
- 智能基建换班,自动计算干员效率,单设施内最优解;同时也支持 [自定义排班](https://maa.plus/docs/协议文档/基建排班协议.html);
|
||||
- 自动公招,可选使用加急许可,一次全部刷完!公招数据上传 [企鹅物流](https://penguin-stats.cn/result/stage/recruit/recruit),[一图流](https://yituliu.site/maarecruitdata);
|
||||
- 支持手动识别公招界面,方便对高星公招做出选择; ~~(你的这个高姿回费出的是推王呢还是推王呢)~~
|
||||
- 支持识别干员列表,统计已有和未有干员(还能为手动识别公招界面提供已有潜能数据提示);
|
||||
- 支持识别养成材料,并可导出至 [企鹅物流刷图规划](https://penguin-stats.cn/planner) 和 [明日方舟工具箱](https://arkn.lolicon.app/#/material) 计算缺少的养成材料;
|
||||
- 访问好友、收取信用及购物、领取日常奖励等,一键全日常自动长草;
|
||||
- 肉鸽全自动刷源石锭和蜡烛,自动识别干员及练度;
|
||||
- 选择作业 JSON 文件,自动抄作业, [视频演示](https://www.bilibili.com/video/BV1H841177Fk/);
|
||||
- 仓库识别并支持导出至 [企鹅物流刷图规划器](https://penguin-stats.cn/planner), [明日方舟工具箱](https://arkn.lolicon.app/#/material), [ARK-NIGHTS 干员培养表](https://ark-nights.com/settings);
|
||||
- 刷理智,掉落识别及上传 [企鹅物流](https://penguin-stats.cn/),[一图流](https://ark.yituliu.cn/)
|
||||
- 智能基建换班,自动计算干员效率,单设施内最优解;同时也支持 [自定义排班](https://maa.plus/docs/zh-cn/protocol/base-scheduling-schema.html)
|
||||
- 自动公招,可选使用加急许可,一次全部刷完!公招数据自动上传 [企鹅物流](https://penguin-stats.cn/result/stage/recruit/recruit),[一图流](https://ark.yituliu.cn/survey/maarecruitdata)
|
||||
- 支持手动识别公招界面,方便对高星公招做出选择 ~~(你的这个高姿回费出的是推王呢还是推王呢)~~
|
||||
- 支持识别干员列表,统计已有和未有干员及潜能,并在公招识别显示
|
||||
- 支持识别养成材料,并导出至 [企鹅物流刷图规划](https://penguin-stats.cn/planner)、[明日方舟工具箱](https://arkntools.app/#/material)、[ARK-NIGHTS 干员培养表](https://ark-nights.com/settings)
|
||||
- 访问好友、收取信用及购物、领取日常奖励等,一键全日常自动长草
|
||||
- 肉鸽全自动刷源石锭和等级,自动烧水和凹直升,智能识别干员及练度
|
||||
- 选择作业 JSON 文件,自动抄作业, [视频演示](https://www.bilibili.com/video/BV1H841177Fk/)
|
||||
- 支持 C, Python, Java, Rust, Golang, Java HTTP, Rust HTTP 等多种接口,方便集成调用,自定义你的 MAA!
|
||||
|
||||
话不多说,看图!<br>
|
||||
<!-- markdownlint-disable -->
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||
<details><summary>话不多说,看图!</summary>
|
||||
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="./docs/.vuepress/public/image/zh-cn/readme/1-dark.png">
|
||||
<img alt="zh1" src="./docs/.vuepress/public/image/zh-cn/readme/1-light.png">
|
||||
</picture>
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="./docs/.vuepress/public/image/zh-cn/readme/2-dark.png">
|
||||
<img alt="zh2" src="./docs/.vuepress/public/image/zh-cn/readme/2-light.png">
|
||||
</picture>
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="./docs/.vuepress/public/image/zh-cn/readme/3-dark.png">
|
||||
<img alt="zh3" src="./docs/.vuepress/public/image/zh-cn/readme/3-light.png">
|
||||
</picture>
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="./docs/.vuepress/public/image/zh-cn/readme/4-dark.png">
|
||||
<img alt="zh4" src="./docs/.vuepress/public/image/zh-cn/readme/4-light.png">
|
||||
</picture>
|
||||
|
||||
</details>
|
||||
|
||||
<!-- markdownlint-restore -->
|
||||
|
||||
## 下载地址
|
||||
|
||||
前往[官网](https://maa.plus)自动匹配镜像源并下载稳定版,或:
|
||||
|
||||
- [稳定版/公测版](https://github.com/MaaAssistantArknights/MaaAssistantArknights/releases)
|
||||
- [内测版](https://github.com/MaaAssistantArknights/MaaRelease/releases)
|
||||
|
||||
@@ -63,33 +86,28 @@ MAA 的意思是 MAA Assistant Arknights
|
||||
|
||||
### 基本说明
|
||||
|
||||
1. 请根据 [模拟器和设备支持情况](https://maa.plus/docs/用户手册/模拟器和设备支持),进行对应的操作;
|
||||
2. 修改模拟器分辨率为 `16:9` 比例,最低 `1280 * 720`,最高 `2K`;<br>
|
||||
对于国际服(美服)玩家,由于界面布局、字号等问题,我们则建议您将分辨率修改为 `1920 * 1080`;
|
||||
3. 开始使用吧!
|
||||
|
||||
更多使用说明请参考 [详细介绍](https://maa.plus/docs/用户手册/详细介绍.html)
|
||||
请参阅 [新手上路](https://maa.plus/docs/zh-cn/manual/newbie.html) 与 [功能介绍](https://maa.plus/docs/zh-cn/manual/introduction/)。
|
||||
|
||||
### 常见问题
|
||||
|
||||
- 软件一打开就闪退;
|
||||
- 连接错误、不知道 adb 路径怎么填写;
|
||||
- 连接错误、不知道 ADB 路径怎么填写;
|
||||
- 连接成功了,但没反应;
|
||||
- 如何连接自定义端口;
|
||||
- 下载速度慢,且镜像站无法打开网页;
|
||||
- 下载到一半提示“登陆”/“鉴权”;
|
||||
- 连接正常,任务开始了,但是没反应。
|
||||
|
||||
请参考 [常见问题](https://maa.plus/docs/用户手册/常见问题.html)
|
||||
请参阅 [常见问题](https://maa.plus/docs/zh-cn/manual/faq.html)
|
||||
|
||||
### 外服支持
|
||||
|
||||
目前国际服(美服)、日服、韩服、繁中服的绝大部分功能均已支持。但由于外服用户较少及项目人手不足,很多功能并没有进行全面的测试,所以请自行体验。<br>
|
||||
若您遇到了 Bug,或对某个功能有强需求,欢迎在 [Issues](https://github.com/MaaAssistantArknights/MaaAssistantArknights/issues) 和 [讨论区](https://github.com/MaaAssistantArknights/MaaAssistantArknights/discussions) 催更;或加入我们一起建设 MAA!请参考 [外服适配教程](#外服适配)
|
||||
目前国际服(美服)、日服、韩服、繁中服的绝大部分功能均已支持。但由于外服用户较少及项目人手不足,很多功能并没有进行全面的测试,所以请自行体验。
|
||||
若您遇到了 Bug,或对某个功能有强需求,欢迎在 [Issues](https://github.com/MaaAssistantArknights/MaaAssistantArknights/issues) 和 [讨论区](https://github.com/MaaAssistantArknights/MaaAssistantArknights/discussions) 催更;或加入我们一起建设 MAA!请参阅 [外服适配教程](https://maa.plus/docs/zh-cn/develop/overseas-client-adaptation.html)
|
||||
|
||||
### CLI支持
|
||||
### CLI 支持
|
||||
|
||||
MAA 支持命令行界面(CLI)操作,支持 Linux,macOS 和 Windows,可用于自动化脚本或在无图形界面的服务器上使用。请参考 [CLI 使用指南](https://maa.plus/docs/用户手册/CLI使用指南.html)
|
||||
MAA 支持命令行界面(CLI)操作,支持 Linux,macOS 和 Windows,可用于自动化脚本或在无图形界面的服务器上使用。请参阅 [CLI 使用指南](https://maa.plus/docs/zh-cn/manual/cli/intro.html)
|
||||
|
||||
## 加入我们
|
||||
|
||||
@@ -97,7 +115,7 @@ MAA 支持命令行界面(CLI)操作,支持 Linux,macOS 和 Windows,
|
||||
|
||||
**目前项目组非常缺前端大佬,若您有相关经验,欢迎加入我们!**
|
||||
|
||||
- 全新框架:[MaaFramework](https://github.com/MaaAssistantArknights/MaaFramework)
|
||||
- 全新框架:[MaaFramework](https://github.com/MaaXYZ/MaaFramework)
|
||||
- 全新 GUI:[MaaX](https://github.com/MaaAssistantArknights/MaaX)
|
||||
- [作业站](https://prts.plus) 前端:[maa-copilot-frontend](https://github.com/MaaAssistantArknights/maa-copilot-frontend)
|
||||
- [作业站](https://prts.plus) 后端:[MaaBackendCenter](https://github.com/MaaAssistantArknights/MaaBackendCenter)
|
||||
@@ -110,52 +128,45 @@ MAA 支持多国语言,并使用 Weblate 进行本地化管理。如果您通
|
||||
|
||||
MAA 以中文(简体)为第一语言,翻译词条均以中文(简体)为准。
|
||||
|
||||
[](https://weblate.maa-org.net/engage/maa-assistant-arknights/zh_Hans/)
|
||||
[](https://weblate.maa-org.net/engage/maa/)
|
||||
|
||||
### Windows
|
||||
### 参与开发
|
||||
|
||||
1. 下载预构建的第三方库
|
||||
#### Windows
|
||||
|
||||
```cmd
|
||||
python maadeps-download.py
|
||||
```
|
||||
请参阅 [开始开发](https://maa.plus/docs/zh-cn/develop/development.html)。
|
||||
|
||||
2. 使用 Visual Studio 2022 打开 `MAA.sln`,右键 `MaaWpfGui`,设为启动项目
|
||||
3. VS 上方配置选择 `RelWithDebInfo` `x64` (如果编译 Release 包 或 ARM 平台,请忽略这步)
|
||||
4. 右键 `MaaWpfGui` - 属性 - 调试 - 启用本地调试(这样就能把断点挂到 C++ Core 那边了)
|
||||
5. (可选)若准备提交 PR,建议启用 [clang-format 支持](https://maa.plus/docs/开发文档/开始开发.html#在-visual-studio-中启用-clang-format)
|
||||
#### Linux | macOS
|
||||
|
||||
### Linux | macOS
|
||||
请参阅 [Linux 编译教程](https://maa.plus/docs/zh-cn/develop/linux-tutorial.html)。
|
||||
|
||||
请参考 [Linux 编译教程](https://maa.plus/docs/开发文档/Linux编译教程.html)
|
||||
|
||||
### API
|
||||
#### API
|
||||
|
||||
- [C 接口](include/AsstCaller.h):[集成示例](src/Cpp/main.cpp)
|
||||
- [Python 接口](src/Python/asst/asst.py):[集成示例](src/Python/sample.py)
|
||||
- [Golang 接口](src/Golang/):[集成示例](src/Golang/maa/maa.go)
|
||||
- [Dart 接口](src/Dart/)
|
||||
- [Golang 接口](src/Golang):[集成示例](src/Golang/maa/maa.go)
|
||||
- [Dart 接口](src/Dart)
|
||||
- [Java 接口](src/Java/src/main/java/com/iguigui/maaj/easySample/MaaCore.java):[集成示例](src/Java/src/main/java/com/iguigui/maaj/easySample/MaaJavaSample.java)
|
||||
- [Java HTTP 接口](src/Java/Readme.md)
|
||||
- [Rust 接口](src/Rust/src/maa_sys/):[HTTP 接口](src/Rust)
|
||||
- [TypeScript 接口](https://github.com/MaaAssistantArknights/MaaAsstElectronUI/tree/main/packages/main/coreLoader)
|
||||
- [Woolang 接口](src/Woolang/maa.wo):[集成示例](src/Woolang/main.wo)
|
||||
- [集成文档](https://maa.plus/docs/协议文档/集成文档.html)
|
||||
- [回调消息协议](https://maa.plus/docs/协议文档/回调消息协议.html)
|
||||
- [任务流程协议](https://maa.plus/docs/协议文档/任务流程协议.html)
|
||||
- [自动抄作业协议](https://maa.plus/docs/协议文档/战斗流程协议.html)
|
||||
- [Rust 接口](src/Rust/src/maa_sys):[HTTP 接口](src/Rust)
|
||||
- [TypeScript 接口](https://github.com/MaaAssistantArknights/MaaX/tree/main/packages/main/coreLoader)
|
||||
- [Woolang 接口](src/Woolang/maa.wo):[集成示例](src/Woolang/demo.wo)
|
||||
- [集成文档](https://maa.plus/docs/zh-cn/protocol/integration.html)
|
||||
- [回调消息协议](https://maa.plus/docs/zh-cn/protocol/callback-schema.html)
|
||||
- [任务流程协议](https://maa.plus/docs/zh-cn/protocol/task-schema.html)
|
||||
- [自动抄作业协议](https://maa.plus/docs/zh-cn/protocol/copilot-schema.html)
|
||||
|
||||
### 外服适配
|
||||
#### 外服适配
|
||||
|
||||
请参考 [外服适配教程](https://maa.plus/docs/开发文档/外服适配教程.html),对于国服已支持的功能,绝大部分的外服适配工作仅需要截图 + 简单的 JSON 修改即可。
|
||||
请参阅 [外服适配教程](https://maa.plus/docs/zh-cn/develop/overseas-client-adaptation.html),对于国服已支持的功能,绝大部分的外服适配工作仅需要截图 + 简单的 JSON 修改即可。
|
||||
|
||||
### 想参与开发,但不太会用 GitHub?
|
||||
#### 想参与开发,但不太会用 GitHub?
|
||||
|
||||
[GitHub Pull Request 流程简述](https://maa.plus/docs/开发文档/开始开发.html#github-pull-request-流程简述)
|
||||
[GitHub Pull Request 流程简述](https://maa.plus/docs/zh-cn/develop/development.html#github-pull-request-流程简述)
|
||||
|
||||
### Issue bot
|
||||
#### Issue bot
|
||||
|
||||
请参考 [Issue bot 使用方法](https://maa.plus/docs/开发文档/IssueBot使用方法.html)
|
||||
请参阅 [Issue Bot 使用方法](https://maa.plus/docs/zh-cn/develop/issue-bot-usage.html)
|
||||
|
||||
## 致谢
|
||||
|
||||
@@ -168,23 +179,23 @@ MAA 以中文(简体)为第一语言,翻译词条均以中文(简体)
|
||||
- 机器学习加速器:[onnxruntime](https://github.com/microsoft/onnxruntime)
|
||||
- ~~关卡掉落识别:[企鹅物流识别](https://github.com/penguin-statistics/recognizer)~~
|
||||
- 地图格子识别:[Arknights-Tile-Pos](https://github.com/yuanyan3060/Arknights-Tile-Pos)
|
||||
- C++ JSON库:[meojson](https://github.com/MistEO/meojson.git)
|
||||
- C++ JSON 库:[meojson](https://github.com/MistEO/meojson.git)
|
||||
- C++ 运算符解析器:[calculator](https://github.com/kimwalisch/calculator)
|
||||
- ~~C++ base64编解码:[cpp-base64](https://github.com/ReneNyffenegger/cpp-base64)~~
|
||||
- ~~C++ base64 编解码:[cpp-base64](https://github.com/ReneNyffenegger/cpp-base64)~~
|
||||
- C++ 解压压缩库:[zlib](https://github.com/madler/zlib)
|
||||
- C++ Gzip封装:[gzip-hpp](https://github.com/mapbox/gzip-hpp)
|
||||
- 安卓触控事件器:[minitouch](https://github.com/openstf/minitouch)
|
||||
- C++ Gzip 封装:[gzip-hpp](https://github.com/mapbox/gzip-hpp)
|
||||
- 安卓触控事件器:[Minitouch](https://github.com/DeviceFarmer/minitouch)
|
||||
- 安卓触控事件器:[MaaTouch](https://github.com/MaaAssistantArknights/MaaTouch)
|
||||
- WPF MVVM框架:[Stylet](https://github.com/canton7/Stylet)
|
||||
- WPF控件库:[HandyControl](https://github.com/HandyOrg/HandyControl) -> [HandyControls](https://github.com/ghost1372/HandyControls)
|
||||
- WPF MVVM 框架:[Stylet](https://github.com/canton7/Stylet)
|
||||
- WPF 控件库:[HandyControl](https://github.com/HandyOrg/HandyControl) -> [HandyControls](https://github.com/ghost1372/HandyControls)
|
||||
- C# 日志:[Serilog](https://github.com/serilog/serilog)
|
||||
- C# JSON库:[Newtonsoft.Json](https://github.com/JamesNK/Newtonsoft.Json) & [System.Text.Json](https://github.com/dotnet/runtime)
|
||||
- C# JSON 库:[Newtonsoft.Json](https://github.com/JamesNK/Newtonsoft.Json) & [System.Text.Json](https://github.com/dotnet/runtime)
|
||||
- ~~下载器:[aria2](https://github.com/aria2/aria2)~~
|
||||
|
||||
### 数据源
|
||||
|
||||
- ~~公开招募数据:[明日方舟工具箱](https://www.bigfun.cn/tools/aktools/hr)~~
|
||||
- ~~干员及基建数据:[PRTS明日方舟中文WIKI](http://prts.wiki/)~~
|
||||
- ~~干员及基建数据:[PRTS Wiki](http://prts.wiki/)~~
|
||||
- 关卡数据:[企鹅物流数据统计](https://penguin-stats.cn/)
|
||||
- 游戏数据及资源:[明日方舟客户端素材](https://github.com/yuanyan3060/ArknightsGameResource)
|
||||
- ~~游戏数据:[《明日方舟》游戏数据](https://github.com/Kengxxiao/ArknightsGameData)~~
|
||||
@@ -197,17 +208,18 @@ MAA 以中文(简体)为第一语言,翻译词条均以中文(简体)
|
||||
|
||||
## 声明
|
||||
|
||||
- 本软件 logo 并非使用 AGPL 3.0 协议开源,[耗毛](https://weibo.com/u/3251357314)、vie 两位画师及软件全体开发者保留所有权利。不得以 AGPL 3.0 协议已授权为由在未经授权的情况下使用本软件 logo,不得在未经授权的情况下将本软件 logo 用于任何商业用途。
|
||||
- 本软件开源、免费,仅供学习交流使用。若您遇到商家使用本软件进行代练并收费,可能是设备与时间等费用,产生的问题及后果与本软件无关。
|
||||
- 本软件使用 [GNU Affero General Public License v3.0 only](https://spdx.org/licenses/AGPL-3.0-only.html) 开源。
|
||||
- 本软件 logo 并非使用 AGPL 3.0 协议开源,[耗毛](https://weibo.com/u/3251357314)、vie 两位画师及软件全体开发者保留所有权利。不得以 AGPL 3.0 协议已授权为由在未经授权的情况下使用本软件 logo,不得在未经授权的情况下将本软件 logo 用于任何用途。
|
||||
- 本软件开源、免费,仅供学习交流使用。若您遇到商家使用本软件进行代练并收费,可能由于设备或时间等原因,产生的任何问题及后果与本软件无关。
|
||||
|
||||
## 广告
|
||||
|
||||
用户交流 QQ 群:[MAA 使用 & 粥游交流 QQ 群](https://ota.maa.plus/MaaAssistantArknights/api/qqgroup/index.html)<br>
|
||||
用户交流 TG 群:[Telegram 群](https://t.me/+Mgc2Zngr-hs3ZjU1)<br>
|
||||
自动战斗 JSON 作业分享:[prts.plus](https://prts.plus) 或 [抄作业.com](http://抄作业.com)<br>
|
||||
Bilibili 直播间:[直播间](https://live.bilibili.com/2808861) 每晚直播敲代码,近期很长一段时间应该都是在写本软件~<br>
|
||||
用户交流 QQ 群:[MAA 使用 & 粥游交流 QQ 群](https://ota.maa.plus/MaaAssistantArknights/api/qqgroup/index.html)
|
||||
用户交流 TG 群:[Telegram 群](https://t.me/+Mgc2Zngr-hs3ZjU1)
|
||||
自动战斗 JSON 作业分享:[prts.plus](https://prts.plus) 或 [抄作业.com](http://抄作业.com)
|
||||
Bilibili 直播间:[直播间](https://live.bilibili.com/2808861) 每晚直播敲代码,近期很长一段时间应该都是在写本软件~
|
||||
|
||||
技术群(舟无关、禁水):[内卷地狱!(QQ 群)](https://jq.qq.com/?_wv=1027&k=ypbzXcA2)<br>
|
||||
开发者群:[QQ 群](https://jq.qq.com/?_wv=1027&k=JM9oCk3C)<br>
|
||||
技术群(舟无关、禁水):[内卷地狱!(QQ 群)](https://jq.qq.com/?_wv=1027&k=ypbzXcA2)
|
||||
开发者群:[QQ 群](https://jq.qq.com/?_wv=1027&k=JM9oCk3C)
|
||||
|
||||
如果觉得软件对你有帮助,帮忙点个 Star 吧!~(网页最上方右上角的小星星),这就是对我们最大的支持了!
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
# TODO: replace with cmake-generated interface file
|
||||
|
||||
find_path(FastDeploy_INCLUDE_DIR NAMES fastdeploy/fastdeploy_model.h)
|
||||
|
||||
find_library(FastDeploy_LIBRARY NAMES fastdeploy)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(
|
||||
FastDeploy
|
||||
REQUIRED_VARS FastDeploy_LIBRARY FastDeploy_INCLUDE_DIR
|
||||
)
|
||||
|
||||
if(FastDeploy_FOUND)
|
||||
set(FastDeploy_INCLUDE_DIRS ${FastDeploy_INCLUDE_DIR})
|
||||
if(NOT TARGET FastDeploy::FastDeploy)
|
||||
add_library(FastDeploy::FastDeploy UNKNOWN IMPORTED)
|
||||
set_target_properties(FastDeploy::FastDeploy PROPERTIES
|
||||
IMPORTED_LOCATION "${FastDeploy_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${FastDeploy_INCLUDE_DIR}"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
@@ -1,20 +0,0 @@
|
||||
find_path(ONNXRuntime_INCLUDE_DIR NAMES onnxruntime/core/session/onnxruntime_c_api.h)
|
||||
|
||||
find_library(ONNXRuntime_LIBRARY NAMES onnxruntime)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(
|
||||
ONNXRuntime
|
||||
REQUIRED_VARS ONNXRuntime_LIBRARY ONNXRuntime_INCLUDE_DIR
|
||||
)
|
||||
|
||||
if(ONNXRuntime_FOUND)
|
||||
set(ONNXRuntime_INCLUDE_DIRS ${ONNXRuntime_INCLUDE_DIR})
|
||||
if(NOT TARGET ONNXRuntime::ONNXRuntime)
|
||||
add_library(ONNXRuntime::ONNXRuntime UNKNOWN IMPORTED)
|
||||
set_target_properties(ONNXRuntime::ONNXRuntime PROPERTIES
|
||||
IMPORTED_LOCATION "${ONNXRuntime_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${ONNXRuntime_INCLUDE_DIR}"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
@@ -1,50 +0,0 @@
|
||||
|
||||
|
||||
set(FASTDEPLOY_URL_PREFIX "https://github.com/MaaAssistantArknights/build-fastdeploy/releases/download")
|
||||
|
||||
set(FASTDEPLOY_TAG "gac255b8a")
|
||||
|
||||
set(COMPRESSED_SUFFIX ".tar.gz")
|
||||
|
||||
if(WIN32)
|
||||
set(FASTDEPLOY_FILENAME "FastDeploy-Windows")
|
||||
set(FASTDEPLOY_CHECKSUM "0a0700d4e8923bcd4c387a658e5e9a689ed9e0d114c260b11d082a2176c233d4")
|
||||
elseif(APPLE)
|
||||
if (CURRENT_OSX_ARCH STREQUAL "arm64")
|
||||
set(FASTDEPLOY_FILENAME "FastDeploy-macOS-arm64")
|
||||
set(FASTDEPLOY_CHECKSUM "28a771814d197ba8056f1fcb7cc0671facec90a8733a0dac2cf0b68a8cc36d24")
|
||||
else()
|
||||
set(FASTDEPLOY_FILENAME "FastDeploy-macOS-x86_64")
|
||||
set(FASTDEPLOY_CHECKSUM "76e97c7e944a18eb160646fa32ac0a7e24c87751b2b127dc33454f993f6d4b97")
|
||||
endif()
|
||||
else()
|
||||
set(FASTDEPLOY_FILENAME "FastDeploy-Linux")
|
||||
set(FASTDEPLOY_CHECKSUM "4d106e5499e9b5b29426667617215ac7e4e70d2353af10caccdfdf6c1f1534a7")
|
||||
endif(WIN32)
|
||||
|
||||
set(FASTDEPLOY_URL ${FASTDEPLOY_URL_PREFIX}/${FASTDEPLOY_TAG}/${FASTDEPLOY_FILENAME}${COMPRESSED_SUFFIX})
|
||||
|
||||
if (FASTDEPLOY_DIRECTORY)
|
||||
set(FastDeploy_DIR ${FASTDEPLOY_DIRECTORY})
|
||||
find_package(FastDeploy REQUIRED PATHS ${FastDeploy_DIR})
|
||||
include_directories(${FastDeploy_INCLUDE_DIRS})
|
||||
list(APPEND DEPEND_LIBS ${FastDeploy_LIBS})
|
||||
else ()
|
||||
download_and_decompress(${FASTDEPLOY_URL}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${FASTDEPLOY_FILENAME}${COMPRESSED_SUFFIX}
|
||||
${FASTDEPLOY_CHECKSUM}
|
||||
${THIRD_PARTY_PATH}/install/)
|
||||
set(FASTDEPLOY_FILENAME fastdeploy)
|
||||
set(FastDeploy_DIR ${THIRD_PARTY_PATH}/install/${FASTDEPLOY_FILENAME})
|
||||
|
||||
find_package(FastDeploy REQUIRED PATHS ${FastDeploy_DIR} NO_DEFAULT_PATH)
|
||||
include_directories(${FastDeploy_INCLUDE_DIRS})
|
||||
list(APPEND DEPEND_LIBS ${FastDeploy_LIBS})
|
||||
endif (FASTDEPLOY_DIRECTORY)
|
||||
|
||||
if (INSTALL_THIRD_LIBS)
|
||||
install(DIRECTORY ${FastDeploy_DIR}/lib/ DESTINATION . USE_SOURCE_PERMISSIONS)
|
||||
install(DIRECTORY ${ORT_LIB_PATH}/ DESTINATION . USE_SOURCE_PERMISSIONS)
|
||||
install(DIRECTORY ${FastDeploy_DIR}/third_libs/install/paddle2onnx/lib/
|
||||
DESTINATION . USE_SOURCE_PERMISSIONS)
|
||||
endif (INSTALL_THIRD_LIBS)
|
||||
@@ -15,13 +15,13 @@ if (BUILD_XCFRAMEWORK)
|
||||
COMMAND xcodebuild -create-xcframework -library "${PROJECT_SOURCE_DIR}/MaaDeps/runtime/${MAADEPS_TRIPLET}/libonnxruntime.1.14.1.dylib" -output ONNXRuntime.xcframework
|
||||
)
|
||||
|
||||
add_custom_command(OUTPUT MaaDerpLearning.xcframework
|
||||
COMMAND rm -rf MaaDerpLearning.xcframework
|
||||
COMMAND xcodebuild -create-xcframework -library "${PROJECT_SOURCE_DIR}/MaaDeps/runtime/${MAADEPS_TRIPLET}/libMaaDerpLearning.dylib" -output MaaDerpLearning.xcframework
|
||||
add_custom_command(OUTPUT fastdeploy_ppocr.xcframework
|
||||
COMMAND rm -rf fastdeploy_ppocr.xcframework
|
||||
COMMAND xcodebuild -create-xcframework -library "${PROJECT_SOURCE_DIR}/MaaDeps/runtime/${MAADEPS_TRIPLET}/libfastdeploy_ppocr.dylib" -output fastdeploy_ppocr.xcframework
|
||||
)
|
||||
|
||||
add_custom_target(MaaXCFramework ALL
|
||||
DEPENDS MaaCore MaaCore.xcframework OpenCV.xcframework ONNXRuntime.xcframework MaaDerpLearning.xcframework
|
||||
DEPENDS MaaCore MaaCore.xcframework OpenCV.xcframework ONNXRuntime.xcframework fastdeploy_ppocr.xcframework
|
||||
)
|
||||
endif (BUILD_XCFRAMEWORK)
|
||||
|
||||
|
||||
8
docs/.vuepress/client.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { defineClientConfig } from "vuepress/client";
|
||||
import ImageGrid from "../components/ImageGrid.vue";
|
||||
|
||||
export default defineClientConfig({
|
||||
enhance: ({ app }) => {
|
||||
app.component("ImageGrid", ImageGrid);
|
||||
},
|
||||
});
|
||||
@@ -1,5 +1,6 @@
|
||||
import { defineUserConfig } from "vuepress";
|
||||
import { viteBundler } from "@vuepress/bundler-vite";
|
||||
import { googleAnalyticsPlugin } from "@vuepress/plugin-google-analytics";
|
||||
import Theme from "./theme";
|
||||
|
||||
export default defineUserConfig({
|
||||
@@ -10,25 +11,25 @@ export default defineUserConfig({
|
||||
port: 3001,
|
||||
|
||||
locales: {
|
||||
"/": {
|
||||
"/zh-cn/": {
|
||||
lang: "zh-CN",
|
||||
description: "开发者文档",
|
||||
description: "文档",
|
||||
},
|
||||
"/zh-tw/": {
|
||||
lang: "zh-TW",
|
||||
description: "開發者文件",
|
||||
description: "文件",
|
||||
},
|
||||
"/en-us/": {
|
||||
lang: "en-US",
|
||||
title: "Documents",
|
||||
description: "Documentation",
|
||||
},
|
||||
"/ja-jp/": {
|
||||
lang: "ja-JP",
|
||||
description: "ドキュメント",
|
||||
description: "ドキュメンテーション",
|
||||
},
|
||||
"/ko-kr/": {
|
||||
lang: "ko-KR",
|
||||
description: "문서",
|
||||
description: "선적 서류 비치",
|
||||
},
|
||||
},
|
||||
|
||||
@@ -40,7 +41,11 @@ export default defineUserConfig({
|
||||
|
||||
theme: Theme,
|
||||
|
||||
plugins: [],
|
||||
plugins: [
|
||||
googleAnalyticsPlugin({
|
||||
id: "G-FJQDKG394Z",
|
||||
}),
|
||||
],
|
||||
|
||||
head: [
|
||||
["link", { rel: "preconnect", href: "https://fonts.googleapis.com" }],
|
||||
@@ -51,21 +56,21 @@ export default defineUserConfig({
|
||||
[
|
||||
"link",
|
||||
{
|
||||
href: "https://fonts.googleapis.com/css?family=Noto+Sans+SC:300,400,500,700,900&display=swap",
|
||||
href: "https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@100..900&display=swap",
|
||||
rel: "stylesheet",
|
||||
},
|
||||
],
|
||||
[
|
||||
"link",
|
||||
{
|
||||
href: "https://fonts.googleapis.com/css2?family=Noto+Serif+SC:400;500;700&display=swap",
|
||||
href: "https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@200..900&display=swap",
|
||||
rel: "stylesheet",
|
||||
},
|
||||
],
|
||||
[
|
||||
"link",
|
||||
{
|
||||
href: "https://fonts.googleapis.com/css2?family=Jetbrains+Mono:wght@300,400,500,700;700&display=swap",
|
||||
href: "https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,100..800;1,100..800&display=swap",
|
||||
rel: "stylesheet",
|
||||
},
|
||||
],
|
||||
|
||||
@@ -9,17 +9,17 @@ export const enusNavbar = navbar([
|
||||
{
|
||||
text: "User Manual",
|
||||
icon: "mdi:user",
|
||||
link: "/en-us/1.1-USER_MANUAL",
|
||||
link: "/en-us/manual/",
|
||||
},
|
||||
{
|
||||
text: "Development Docs",
|
||||
icon: "ph:code-bold",
|
||||
link: "/en-us/2.1-LINUX_TUTORIAL",
|
||||
link: "/en-us/develop/",
|
||||
},
|
||||
{
|
||||
text: "Protocol Docs",
|
||||
icon: "basil:document-solid",
|
||||
link: "/en-us/3.1-INTEGRATION",
|
||||
link: "/en-us/protocol/",
|
||||
},
|
||||
{
|
||||
text: "MAA Website",
|
||||
|
||||
@@ -2,24 +2,24 @@ import { navbar } from "vuepress-theme-hope";
|
||||
|
||||
export const jajpNavbar = navbar([
|
||||
{
|
||||
text: "主页",
|
||||
text: "ホームページ",
|
||||
icon: "ic:round-home",
|
||||
link: "/ja-jp/",
|
||||
},
|
||||
{
|
||||
text: "使用説明",
|
||||
icon: "mdi:user",
|
||||
link: "/ja-jp/1.1-詳細説明",
|
||||
link: "/ja-jp/manual/",
|
||||
},
|
||||
{
|
||||
text: "開発関連",
|
||||
icon: "ph:code-bold",
|
||||
link: "/ja-jp/2.1-Linuxチュートリアル",
|
||||
link: "/ja-jp/develop/",
|
||||
},
|
||||
{
|
||||
text: "プロトコルドキュメント",
|
||||
icon: "basil:document-solid",
|
||||
link: "/ja-jp/3.1-統合ドキュメント",
|
||||
link: "/ja-jp/protocol/",
|
||||
},
|
||||
{
|
||||
text: "MAA 公式サイト",
|
||||
|
||||
@@ -2,24 +2,24 @@ import { navbar } from "vuepress-theme-hope";
|
||||
|
||||
export const kokrNavbar = navbar([
|
||||
{
|
||||
text: "主页",
|
||||
text: "홈페이지",
|
||||
icon: "ic:round-home",
|
||||
link: "/ko-kr/",
|
||||
},
|
||||
{
|
||||
text: "사용자 설명서",
|
||||
icon: "mdi:user",
|
||||
link: "/ko-kr/1.1-사용자_설명서",
|
||||
link: "/ko-kr/manual/",
|
||||
},
|
||||
{
|
||||
text: "개발 관련",
|
||||
text: "개발 문서",
|
||||
icon: "ph:code-bold",
|
||||
link: "/ko-kr/2.1-LINUX_튜토리얼",
|
||||
link: "/ko-kr/develop/",
|
||||
},
|
||||
{
|
||||
text: "프로토콜 문서",
|
||||
icon: "basil:document-solid",
|
||||
link: "/ko-kr/3.1-연동",
|
||||
link: "/ko-kr/protocol/",
|
||||
},
|
||||
{
|
||||
text: "MAA 공식 홈페이지",
|
||||
|
||||
@@ -4,22 +4,22 @@ export const zhcnNavbar = navbar([
|
||||
{
|
||||
text: "主页",
|
||||
icon: "ic:round-home",
|
||||
link: "/",
|
||||
link: "/zh-cn/",
|
||||
},
|
||||
{
|
||||
text: "用户手册",
|
||||
icon: "mdi:user",
|
||||
link: "/用户手册",
|
||||
link: "/zh-cn/manual/",
|
||||
},
|
||||
{
|
||||
text: "开发文档",
|
||||
icon: "ph:code-bold",
|
||||
link: "/开发文档",
|
||||
link: "/zh-cn/develop/",
|
||||
},
|
||||
{
|
||||
text: "协议文档",
|
||||
icon: "basil:document-solid",
|
||||
link: "/协议文档",
|
||||
link: "/zh-cn/protocol/",
|
||||
},
|
||||
{
|
||||
text: "MAA 官网",
|
||||
|
||||
@@ -9,17 +9,17 @@ export const zhtwNavbar = navbar([
|
||||
{
|
||||
text: "用戶說明書",
|
||||
icon: "mdi:user",
|
||||
link: "/zh-tw/1.1-詳細介紹",
|
||||
link: "/zh-tw/manual/",
|
||||
},
|
||||
{
|
||||
text: "開發文件",
|
||||
icon: "ph:code-bold",
|
||||
link: "/zh-tw/2.1-Linux編譯教學",
|
||||
link: "/zh-tw/develop/",
|
||||
},
|
||||
{
|
||||
text: "協議文件",
|
||||
icon: "basil:document-solid",
|
||||
link: "/zh-tw/3.1-集成文件",
|
||||
link: "/zh-tw/protocol/",
|
||||
},
|
||||
{
|
||||
text: "MAA 官網",
|
||||
|
||||
@@ -41,43 +41,6 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
'/zh-tw/': {
|
||||
placeholder: '搜尋',
|
||||
translations: {
|
||||
button: {
|
||||
buttonText: '搜尋',
|
||||
},
|
||||
modal: {
|
||||
searchBox: {
|
||||
resetButtonTitle: '清除查詢條件',
|
||||
cancelButtonText: '取消',
|
||||
},
|
||||
startScreen: {
|
||||
recentSearchesTitle: '搜尋歷史',
|
||||
noRecentSearchesText: '沒有搜尋歷史',
|
||||
saveRecentSearchButtonTitle: '保存至搜尋歷史',
|
||||
removeRecentSearchButtonTitle: '從搜尋歷史中移除',
|
||||
favoriteSearchesTitle: '收藏',
|
||||
removeFavoriteSearchButtonTitle: '從收藏中移除',
|
||||
},
|
||||
errorScreen: {
|
||||
titleText: '無法獲取結果',
|
||||
helpText: '你可能需要檢查你的網路連接',
|
||||
},
|
||||
footer: {
|
||||
selectText: '選擇',
|
||||
navigateText: '切換',
|
||||
closeText: '關閉',
|
||||
searchByText: '搜尋提供者',
|
||||
},
|
||||
noResultsScreen: {
|
||||
noResultsText: '無法找到相關結果',
|
||||
suggestedQueryText: '你可以嘗試查詢',
|
||||
reportMissingResultsText: '你認為該查詢應該有結果?',
|
||||
reportMissingResultsLinkText: '點擊反饋',
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
'/en-us/': {
|
||||
placeholder: 'Search',
|
||||
@@ -117,8 +80,4 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
'/ja-jp/': {
|
||||
placeholder: '検索する',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BIN
docs/.vuepress/public/image/en-us/readme/1-dark.png
Normal file
|
After Width: | Height: | Size: 74 KiB |
BIN
docs/.vuepress/public/image/en-us/readme/1-light.png
Normal file
|
After Width: | Height: | Size: 73 KiB |
BIN
docs/.vuepress/public/image/en-us/readme/2-dark.png
Normal file
|
After Width: | Height: | Size: 68 KiB |
BIN
docs/.vuepress/public/image/en-us/readme/2-light.png
Normal file
|
After Width: | Height: | Size: 68 KiB |
BIN
docs/.vuepress/public/image/en-us/readme/3-dark.png
Normal file
|
After Width: | Height: | Size: 64 KiB |
BIN
docs/.vuepress/public/image/en-us/readme/3-light.png
Normal file
|
After Width: | Height: | Size: 64 KiB |
BIN
docs/.vuepress/public/image/en-us/readme/4-dark.png
Normal file
|
After Width: | Height: | Size: 89 KiB |
BIN
docs/.vuepress/public/image/en-us/readme/4-light.png
Normal file
|
After Width: | Height: | Size: 88 KiB |
BIN
docs/.vuepress/public/image/ja-jp/readme/1-light.png
Normal file
|
After Width: | Height: | Size: 67 KiB |
BIN
docs/.vuepress/public/image/ja-jp/readme/2-light.png
Normal file
|
After Width: | Height: | Size: 40 KiB |
BIN
docs/.vuepress/public/image/ko-kr/readme/1-light.png
Normal file
|
After Width: | Height: | Size: 64 KiB |
BIN
docs/.vuepress/public/image/ko-kr/readme/2-light.png
Normal file
|
After Width: | Height: | Size: 71 KiB |
BIN
docs/.vuepress/public/image/zh-cn/readme/1-dark.png
Normal file
|
After Width: | Height: | Size: 63 KiB |
BIN
docs/.vuepress/public/image/zh-cn/readme/1-light.png
Normal file
|
After Width: | Height: | Size: 62 KiB |
BIN
docs/.vuepress/public/image/zh-cn/readme/2-dark.png
Normal file
|
After Width: | Height: | Size: 52 KiB |
BIN
docs/.vuepress/public/image/zh-cn/readme/2-light.png
Normal file
|
After Width: | Height: | Size: 51 KiB |
BIN
docs/.vuepress/public/image/zh-cn/readme/3-dark.png
Normal file
|
After Width: | Height: | Size: 28 KiB |
BIN
docs/.vuepress/public/image/zh-cn/readme/3-light.png
Normal file
|
After Width: | Height: | Size: 28 KiB |
BIN
docs/.vuepress/public/image/zh-cn/readme/4-dark.png
Normal file
|
After Width: | Height: | Size: 71 KiB |
BIN
docs/.vuepress/public/image/zh-cn/readme/4-light.png
Normal file
|
After Width: | Height: | Size: 70 KiB |
0
docs/.vuepress/public/image/zh-tw/readme/TODO
Normal file
@@ -10,115 +10,23 @@ export const enusSidebar = sidebar({
|
||||
{
|
||||
text: "User Manual",
|
||||
icon: "mdi:user",
|
||||
prefix: "manual/",
|
||||
collapsible: true,
|
||||
children: [
|
||||
{
|
||||
text: "Introduction",
|
||||
icon: "mdi:information-outline",
|
||||
link: "/en-us/1.1-USER_MANUAL",
|
||||
},
|
||||
{
|
||||
text: "FAQs",
|
||||
icon: "ph:question-fill",
|
||||
link: "/en-us/1.2-FAQ",
|
||||
},
|
||||
{
|
||||
text: "Emulator Supports",
|
||||
icon: "mingcute:laptop-fill",
|
||||
collapsible: true,
|
||||
children: [
|
||||
{
|
||||
text: "Windows",
|
||||
icon: "ri:windows-fill",
|
||||
link: "/en-us/1.3-EMULATOR_SUPPORTS",
|
||||
},
|
||||
{
|
||||
text: "Mac",
|
||||
icon: "basil:apple-solid",
|
||||
link: "/en-us/1.4-EMULATOR_SUPPORTS_FOR_MAC",
|
||||
},
|
||||
{
|
||||
text: "Linux",
|
||||
icon: "teenyicons:linux-alt-solid",
|
||||
link: "/en-us/1.5-EMULATOR_SUPPORTS_FOR_LINUX",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
children: "structure",
|
||||
},
|
||||
{
|
||||
text: "Development Docs",
|
||||
icon: "ph:code-bold",
|
||||
prefix: "develop/",
|
||||
collapsible: true,
|
||||
children: [
|
||||
{
|
||||
text: "Linux Compilation Tutorial",
|
||||
icon: "teenyicons:linux-alt-solid",
|
||||
link: "/en-us/2.1-LINUX_TUTORIAL",
|
||||
},
|
||||
{
|
||||
text: "Development",
|
||||
icon: "iconoir:developer",
|
||||
link: "/en-us/2.2-DEVELOPMENT",
|
||||
},
|
||||
{
|
||||
text: "IssueBot Usage",
|
||||
icon: "bxs:bot",
|
||||
link: "/en-us/2.3-ISSUE_BOT_USAGE",
|
||||
},
|
||||
{
|
||||
text: "Web PR Tutorial",
|
||||
icon: "mingcute:git-pull-request-fill",
|
||||
link: "/en-us/2.4-PURE_WEB_PR_TUTORIAL",
|
||||
},
|
||||
{
|
||||
text: "Overseas Clients Adaptation",
|
||||
icon: "ri:earth-fill",
|
||||
link: "/en-us/2.5-OVERSEAS_CLIENTS_ADAPTATION",
|
||||
},
|
||||
],
|
||||
children: "structure",
|
||||
},
|
||||
{
|
||||
text: "Protocol Docs",
|
||||
icon: "basil:document-solid",
|
||||
prefix: "protocol/",
|
||||
collapsible: true,
|
||||
children: [
|
||||
{
|
||||
text: "Integration",
|
||||
icon: "bxs:book",
|
||||
link: "/en-us/3.1-INTEGRATION",
|
||||
},
|
||||
{
|
||||
text: "Callback Schema",
|
||||
icon: "material-symbols:u-turn-left",
|
||||
link: "/en-us/3.2-CALLBACK_SCHEMA",
|
||||
},
|
||||
{
|
||||
text: "Copilot Schema",
|
||||
icon: "ph:sword-bold",
|
||||
link: "/en-us/3.3-COPILOT_SCHEMA",
|
||||
},
|
||||
{
|
||||
text: "Task Schema",
|
||||
icon: "material-symbols:task",
|
||||
link: "/en-us/3.4-TASK_SCHEMA",
|
||||
},
|
||||
{
|
||||
text: "Integrated Strategy Schema",
|
||||
icon: "ri:game-fill",
|
||||
link: "/en-us/3.5-INTEGRATED_STRATEGY_SCHEMA",
|
||||
},
|
||||
{
|
||||
text: "Infrastructure Scheduling Schema",
|
||||
icon: "material-symbols:view-quilt-rounded",
|
||||
link: "/en-us/3.6-INFRASTRUCTURE_SCHEDULING_SCHEMA",
|
||||
},
|
||||
{
|
||||
text: "Security Presence Schema",
|
||||
icon: "game-icons:prisoner",
|
||||
link: "/en-us/3.7-SECURITY_PRESENCE_SCHEMA",
|
||||
},
|
||||
],
|
||||
children: "structure",
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
@@ -10,98 +10,23 @@ export const jajpSidebar = sidebar({
|
||||
{
|
||||
text: "使用説明",
|
||||
icon: "mdi:user",
|
||||
prefix: "manual/",
|
||||
collapsible: true,
|
||||
children: [
|
||||
{
|
||||
text: "詳細説明",
|
||||
icon: "mdi:information-outline",
|
||||
link: "/ja-jp/1.1-詳細説明",
|
||||
},
|
||||
{
|
||||
text: "よくある質問",
|
||||
icon: "ph:question-fill",
|
||||
link: "/ja-jp/1.2-よくある質問",
|
||||
},
|
||||
{
|
||||
text: "エミュレータのサポート",
|
||||
icon: "mingcute:laptop-fill",
|
||||
link: "/ja-jp/1.3-エミュレータのサポート",
|
||||
},
|
||||
],
|
||||
children: "structure",
|
||||
},
|
||||
{
|
||||
text: "開発関連",
|
||||
icon: "ph:code-bold",
|
||||
prefix: "develop/",
|
||||
collapsible: true,
|
||||
children: [
|
||||
{
|
||||
text: "Linuxコンパイルチュートリアル",
|
||||
icon: "teenyicons:linux-alt-solid",
|
||||
link: "/ja-jp/2.1-Linuxチュートリアル",
|
||||
},
|
||||
{
|
||||
text: "開発関連",
|
||||
icon: "iconoir:developer",
|
||||
link: "/ja-jp/2.2-プルリクエスト",
|
||||
},
|
||||
{
|
||||
text: "IssueBotの使用方法",
|
||||
icon: "bxs:bot",
|
||||
link: "/ja-jp/2.3-IssueBotの使用方法",
|
||||
},
|
||||
{
|
||||
text: "純WebサイトのPRチュートリアル",
|
||||
icon: "mingcute:git-pull-request-fill",
|
||||
link: "/ja-jp/2.4-純WebサイトのPRチュートリアル",
|
||||
},
|
||||
{
|
||||
text: "グローバル版を含む海外クライアントの対応について",
|
||||
icon: "ri:earth-fill",
|
||||
link: "/ja-jp/2.5-OVERSEAS_CLIENTS_ADAPTATION",
|
||||
},
|
||||
],
|
||||
children: "structure",
|
||||
},
|
||||
{
|
||||
text: "プロトコルドキュメント",
|
||||
icon: "basil:document-solid",
|
||||
prefix: "protocol/",
|
||||
collapsible: true,
|
||||
children: [
|
||||
{
|
||||
text: "インテグレーション",
|
||||
icon: "bxs:book",
|
||||
link: "/ja-jp/3.1-統合ドキュメント",
|
||||
},
|
||||
{
|
||||
text: "コールバック図解",
|
||||
icon: "material-symbols:u-turn-left",
|
||||
link: "/ja-jp/3.2-コールバックAPI",
|
||||
},
|
||||
{
|
||||
text: "自動作戦図解",
|
||||
icon: "ph:sword-bold",
|
||||
link: "/ja-jp/3.3-自動作戦API",
|
||||
},
|
||||
{
|
||||
text: "タスク図解",
|
||||
icon: "material-symbols:task",
|
||||
link: "/ja-jp/3.4-タスクAPI",
|
||||
},
|
||||
{
|
||||
text: "統合戦略図解",
|
||||
icon: "ri:game-fill",
|
||||
link: "/ja-jp/3.5-統合戦略API",
|
||||
},
|
||||
{
|
||||
text: "インフラスケジュール図解",
|
||||
icon: "material-symbols:view-quilt-rounded",
|
||||
link: "/ja-jp/3.6-インフラスケジュール設定",
|
||||
},
|
||||
{
|
||||
text: "セキュリティプレゼンス図解",
|
||||
icon: "game-icons:prisoner",
|
||||
link: "/ja-jp/3.7-SECURITY_PRESENCE_SCHEMA",
|
||||
},
|
||||
],
|
||||
children: "structure",
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
@@ -10,115 +10,23 @@ export const kokrSidebar = sidebar({
|
||||
{
|
||||
text: "사용자 설명서",
|
||||
icon: "mdi:user",
|
||||
prefix: "manual/",
|
||||
collapsible: true,
|
||||
children: [
|
||||
{
|
||||
text: "기능",
|
||||
icon: "mdi:information-outline",
|
||||
link: "/ko-kr/1.1-사용자_설명서",
|
||||
},
|
||||
{
|
||||
text: "자주 묻는 질문",
|
||||
icon: "ph:question-fill",
|
||||
link: "/ko-kr/1.2-FAQ",
|
||||
},
|
||||
{
|
||||
text: "에뮬레이터 지원",
|
||||
icon: "mingcute:laptop-fill",
|
||||
collapsible: true,
|
||||
children: [
|
||||
{
|
||||
text: "Windows",
|
||||
icon: "ri:windows-fill",
|
||||
link: "/ko-kr/1.3-에뮬레이터_지원",
|
||||
},
|
||||
{
|
||||
text: "Mac",
|
||||
icon: "basil:apple-solid",
|
||||
link: "/ko-kr/1.4-Mac에뮬레이터_지원",
|
||||
},
|
||||
{
|
||||
text: "Linux",
|
||||
icon: "teenyicons:linux-alt-solid",
|
||||
link: "/ko-kr/1.5-LINUX용_에뮬레이터 지원",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
children: "structure",
|
||||
},
|
||||
{
|
||||
text: "개발 관련",
|
||||
icon: "ph:code-bold",
|
||||
prefix: "develop/",
|
||||
collapsible: true,
|
||||
children: [
|
||||
{
|
||||
text: "리눅스 컴파일 튜토리얼",
|
||||
icon: "teenyicons:linux-alt-solid",
|
||||
link: "/ko-kr/2.1-LINUX_튜토리얼",
|
||||
},
|
||||
{
|
||||
text: "개발 환경 구축하기",
|
||||
icon: "iconoir:developer",
|
||||
link: "/ko-kr/2.2-개발_환경_구축하기",
|
||||
},
|
||||
{
|
||||
text: "Issue Bot 사용 방법",
|
||||
icon: "bxs:bot",
|
||||
link: "/ko-kr/2.3-Issue_Bot_사용방법",
|
||||
},
|
||||
{
|
||||
text: "GitHub Pull Request 사용 가이드",
|
||||
icon: "mingcute:git-pull-request-fill",
|
||||
link: "/ko-kr/2.4-웹을_통한_풀리퀘스트_튜토리얼",
|
||||
},
|
||||
{
|
||||
text: "해외 클라이언트 현지화",
|
||||
icon: "ri:earth-fill",
|
||||
link: "/ko-kr/2.5-해외_클라이언트_현지화",
|
||||
},
|
||||
],
|
||||
children: "structure",
|
||||
},
|
||||
{
|
||||
text: "프로토콜 문서",
|
||||
icon: "basil:document-solid",
|
||||
prefix: "protocol/",
|
||||
collapsible: true,
|
||||
children: [
|
||||
{
|
||||
text: "연동",
|
||||
icon: "bxs:book",
|
||||
link: "/ko-kr/3.1-연동",
|
||||
},
|
||||
{
|
||||
text: "콜백 스키마",
|
||||
icon: "material-symbols:u-turn-left",
|
||||
link: "/ko-kr/3.2-콜백_스키마",
|
||||
},
|
||||
{
|
||||
text: "전투 스키마",
|
||||
icon: "ph:sword-bold",
|
||||
link: "/ko-kr/3.3-전투_스키마",
|
||||
},
|
||||
{
|
||||
text: "작업 스키마",
|
||||
icon: "material-symbols:task",
|
||||
link: "/ko-kr/3.4-작업_스키마",
|
||||
},
|
||||
{
|
||||
text: "통합전략 스키마",
|
||||
icon: "ri:game-fill",
|
||||
link: "/ko-kr/3.5-통합전략_스키마",
|
||||
},
|
||||
{
|
||||
text: "기반시설 예약 스키마",
|
||||
icon: "material-symbols:view-quilt-rounded",
|
||||
link: "/ko-kr/3.6-기반시설_예약_스키마",
|
||||
},
|
||||
{
|
||||
text: "보안파견 스키마",
|
||||
icon: "game-icons:prisoner",
|
||||
link: "/ko-kr/3.7-보안파견_스키마",
|
||||
},
|
||||
],
|
||||
children: "structure",
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
@@ -1,53 +1,30 @@
|
||||
import { sidebar } from "vuepress-theme-hope";
|
||||
|
||||
export const zhcnSidebar = sidebar({
|
||||
"/": [
|
||||
"/zh-cn/": [
|
||||
{
|
||||
text: "MAA",
|
||||
icon: "ic:round-home",
|
||||
link: "/",
|
||||
link: "/zh-cn/",
|
||||
},
|
||||
{
|
||||
text: "用户手册",
|
||||
icon: "mdi:user",
|
||||
prefix: "用户手册/",
|
||||
prefix: "manual/",
|
||||
collapsible: true,
|
||||
children: [
|
||||
{
|
||||
text: "功能介绍",
|
||||
icon: "mdi:information-outline",
|
||||
link: "详细介绍",
|
||||
},
|
||||
{
|
||||
text: "常见问题",
|
||||
icon: "ph:question-fill",
|
||||
link: "常见问题",
|
||||
},
|
||||
{
|
||||
text: "模拟器和设备支持",
|
||||
icon: "mingcute:laptop-fill",
|
||||
prefix: "模拟器和设备支持/",
|
||||
collapsible: true,
|
||||
children: "structure",
|
||||
},
|
||||
{
|
||||
text: "CLI使用指南",
|
||||
icon: "material-symbols:terminal",
|
||||
link: "CLI使用指南",
|
||||
},
|
||||
],
|
||||
children: "structure",
|
||||
},
|
||||
{
|
||||
text: "开发文档",
|
||||
icon: "ph:code-bold",
|
||||
prefix: "开发文档/",
|
||||
prefix: "develop/",
|
||||
collapsible: true,
|
||||
children: "structure",
|
||||
},
|
||||
{
|
||||
text: "协议文档",
|
||||
icon: "basil:document-solid",
|
||||
prefix: "协议文档/",
|
||||
prefix: "protocol/",
|
||||
collapsible: true,
|
||||
children: "structure",
|
||||
},
|
||||
|
||||
@@ -10,120 +10,23 @@ export const zhtwSidebar = sidebar({
|
||||
{
|
||||
text: "用戶說明書",
|
||||
icon: "mdi:user",
|
||||
prefix: "manual/",
|
||||
collapsible: true,
|
||||
children: [
|
||||
{
|
||||
text: "功能介绍",
|
||||
icon: "mdi:information-outline",
|
||||
link: "/zh-tw/1.1-詳細介紹",
|
||||
},
|
||||
{
|
||||
text: "常見問題",
|
||||
icon: "ph:question-fill",
|
||||
link: "/zh-tw/1.2-常見問題",
|
||||
},
|
||||
{
|
||||
text: "模擬器支援",
|
||||
icon: "mingcute:laptop-fill",
|
||||
collapsible: true,
|
||||
children: [
|
||||
{
|
||||
text: "Windows",
|
||||
icon: "ri:windows-fill",
|
||||
link: "/zh-tw/1.3-模擬器支援",
|
||||
},
|
||||
{
|
||||
text: "Mac",
|
||||
icon: "basil:apple-solid",
|
||||
link: "/zh-tw/1.4-Mac模擬器支援",
|
||||
},
|
||||
{
|
||||
text: "Linux",
|
||||
icon: "teenyicons:linux-alt-solid",
|
||||
link: "/zh-tw/1.5-Linux模擬器支援",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
text: "CLI使用說明",
|
||||
icon: "material-symbols:terminal",
|
||||
link: "/zh-tw/1.6-CLI使用說明",
|
||||
},
|
||||
],
|
||||
children: "structure",
|
||||
},
|
||||
{
|
||||
text: "開發文件",
|
||||
icon: "ph:code-bold",
|
||||
prefix: "develop/",
|
||||
collapsible: true,
|
||||
children: [
|
||||
{
|
||||
text: "Linux編譯教學",
|
||||
icon: "teenyicons:linux-alt-solid",
|
||||
link: "/zh-tw/2.1-Linux編譯教學",
|
||||
},
|
||||
{
|
||||
text: "開發相關",
|
||||
icon: "iconoir:developer",
|
||||
link: "/zh-tw/2.2-開發相關",
|
||||
},
|
||||
{
|
||||
text: "IssueBot使用方法",
|
||||
icon: "bxs:bot",
|
||||
link: "/zh-tw/2.3-IssueBot使用方法",
|
||||
},
|
||||
{
|
||||
text: "純網頁端PR教學",
|
||||
icon: "mingcute:git-pull-request-fill",
|
||||
link: "/zh-tw/2.4-純網頁端PR教學",
|
||||
},
|
||||
{
|
||||
text: "外服適配教學",
|
||||
icon: "ri:earth-fill",
|
||||
link: "/zh-tw/2.5-外服適配教學",
|
||||
},
|
||||
],
|
||||
children: "structure",
|
||||
},
|
||||
{
|
||||
text: "協議文件",
|
||||
icon: "basil:document-solid",
|
||||
prefix: "protocol/",
|
||||
collapsible: true,
|
||||
children: [
|
||||
{
|
||||
text: "集成文件",
|
||||
icon: "bxs:book",
|
||||
link: "/zh-tw/3.1-集成文件",
|
||||
},
|
||||
{
|
||||
text: "回呼訊息協議",
|
||||
icon: "material-symbols:u-turn-left",
|
||||
link: "/zh-tw/3.2-回呼訊息協議",
|
||||
},
|
||||
{
|
||||
text: "戰鬥流程協議",
|
||||
icon: "ph:sword-bold",
|
||||
link: "/zh-tw/3.3-戰鬥流程協議",
|
||||
},
|
||||
{
|
||||
text: "任務流程協議",
|
||||
icon: "material-symbols:task",
|
||||
link: "/zh-tw/3.4-任務流程協議",
|
||||
},
|
||||
{
|
||||
text: "肉鴿輔助協議",
|
||||
icon: "ri:game-fill",
|
||||
link: "/zh-tw/3.5-肉鴿輔助協議",
|
||||
},
|
||||
{
|
||||
text: "基建排班協議",
|
||||
icon: "material-symbols:view-quilt-rounded",
|
||||
link: "/zh-tw/3.6-基建排班協議",
|
||||
},
|
||||
{
|
||||
text: "保全派駐協議",
|
||||
icon: "game-icons:prisoner",
|
||||
link: "/zh-tw/3.7-保全派駐協議",
|
||||
},
|
||||
],
|
||||
children: "structure",
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
.home {
|
||||
.vp-hero-info-wrapper {
|
||||
min-height: 600px;
|
||||
}
|
||||
}
|
||||
|
||||
.catalog-display-container {
|
||||
overflow-x: visible;
|
||||
overflow-y: auto;
|
||||
|
||||
max-height: 75vh;
|
||||
margin: 0.5rem;
|
||||
border-radius: 0.5rem;
|
||||
|
||||
overflow-wrap: break-word;
|
||||
}
|
||||
@@ -11,12 +11,12 @@ export default hopeTheme({
|
||||
docsDir: "/docs",
|
||||
|
||||
locales: {
|
||||
"/": {
|
||||
"/zh-cn/": {
|
||||
navbar: zhcnNavbar,
|
||||
sidebar: zhcnSidebar,
|
||||
displayFooter: false,
|
||||
metaLocales: {
|
||||
editLink: "在Github上编辑此页面",
|
||||
editLink: "在 Github 上编辑此页面",
|
||||
},
|
||||
},
|
||||
"/zh-tw/": {
|
||||
@@ -24,7 +24,7 @@ export default hopeTheme({
|
||||
sidebar: zhtwSidebar,
|
||||
displayFooter: false,
|
||||
metaLocales: {
|
||||
editLink: "在Github上編輯此頁面",
|
||||
editLink: "在 Github 上編輯此頁面",
|
||||
},
|
||||
},
|
||||
"/en-us/": {
|
||||
@@ -40,7 +40,7 @@ export default hopeTheme({
|
||||
sidebar: jajpSidebar,
|
||||
displayFooter: false,
|
||||
metaLocales: {
|
||||
editLink: "このページをGithubで編集する",
|
||||
editLink: "このページを Github で編集する",
|
||||
},
|
||||
},
|
||||
"/ko-kr/": {
|
||||
@@ -48,13 +48,11 @@ export default hopeTheme({
|
||||
sidebar: kokrSidebar,
|
||||
displayFooter: false,
|
||||
metaLocales: {
|
||||
editLink: "Github에서 이 페이지를 편집",
|
||||
editLink: "Github 에서 이 페이지를 편집",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
sidebarIcon: true,
|
||||
|
||||
plugins: {
|
||||
activeHeaderLinks: false,
|
||||
|
||||
@@ -62,10 +60,10 @@ export default hopeTheme({
|
||||
provider: "Giscus",
|
||||
repo: "MaaAssistantArknights/maa-website",
|
||||
repoId: "R_kgDOHY7Gyg",
|
||||
category: "General",
|
||||
categoryId: "DIC_kwDOHY7Gys4CYefe",
|
||||
mapping: "title",
|
||||
strict: false,
|
||||
category: "Comments",
|
||||
categoryId: "DIC_kwDOHY7Gys4CgoVH",
|
||||
mapping: "pathname",
|
||||
strict: true,
|
||||
},
|
||||
|
||||
copyright: {
|
||||
@@ -90,15 +88,89 @@ export default hopeTheme({
|
||||
tabs: true,
|
||||
tasklist: true,
|
||||
vPre: true,
|
||||
component: true,
|
||||
},
|
||||
|
||||
prismjs: {
|
||||
light: "one-dark",
|
||||
dark: "nord",
|
||||
shiki: {
|
||||
themes: {
|
||||
light: "light-plus",
|
||||
dark: "nord",
|
||||
}
|
||||
},
|
||||
|
||||
sitemap: true,
|
||||
|
||||
notice: [
|
||||
{
|
||||
path: "/zh-tw/",
|
||||
title: "翻译警告",
|
||||
content: "MAA 的文檔以簡體中文為主,其他語言的文檔可能品質低或尚未翻譯,請諒解。",
|
||||
fullscreen: true,
|
||||
confirm: true,
|
||||
showOnce: true,
|
||||
actions: [
|
||||
{
|
||||
text: "我知道了",
|
||||
type: "primary",
|
||||
},
|
||||
{ text: "前往簡體中文",
|
||||
link: "/zh-cn/",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: "/en-us/",
|
||||
title: "Translation Warning",
|
||||
content: "MAA's documents are mainly in Simplified Chinese. Documents in other languages may be of low quality or not yet translated. Please understand.",
|
||||
fullscreen: true,
|
||||
confirm: true,
|
||||
showOnce: true,
|
||||
actions: [
|
||||
{
|
||||
text: "Okay",
|
||||
type: "primary",
|
||||
},
|
||||
{ text: "Take me to zh-CN",
|
||||
link: "/zh-cn/",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: "/ja-jp/",
|
||||
title: "翻訳に関する警告",
|
||||
content: "MAA のドキュメントは主に簡体字中国語で書かれており、他の言語のドキュメントは低品質であるか、翻訳されていない可能性がありますので、ご了承ください。",
|
||||
fullscreen: true,
|
||||
confirm: true,
|
||||
showOnce: true,
|
||||
actions: [
|
||||
{
|
||||
text: "OK",
|
||||
type: "primary",
|
||||
},
|
||||
{ text: "中国語サイトへ行く",
|
||||
link: "/zh-cn/",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: "/ko-kr/",
|
||||
title: "번역 경고",
|
||||
content: "MAA의 문서는 주로 중국어 간체로 되어 있습니다. 다른 언어로 된 문서는 번역이 이상하거나, 번역이 되어있지 않을 수 있습니다.",
|
||||
fullscreen: true,
|
||||
confirm: true,
|
||||
showOnce: true,
|
||||
actions: [
|
||||
{
|
||||
text: "OK",
|
||||
type: "primary",
|
||||
},
|
||||
{ text: "중국어 간체로 이동",
|
||||
link: "/zh-cn/",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
@@ -58,3 +58,5 @@
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- markdownlint-disable-file -->
|
||||
|
||||
52
docs/components/ImageGrid.vue
Normal file
@@ -0,0 +1,52 @@
|
||||
<template>
|
||||
<div>
|
||||
<img v-for="src of displayImageList" class="image" :src="src" alt="" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { PropType, defineComponent } from "vue";
|
||||
import { withBase } from "vuepress/client";
|
||||
|
||||
export default defineComponent({
|
||||
props: {
|
||||
imageList: Array as PropType<
|
||||
Array<{ light: string; dark: string } | string>
|
||||
>,
|
||||
},
|
||||
computed: {
|
||||
displayImageList() {
|
||||
return this.imageList.map((item) => {
|
||||
const src =
|
||||
typeof item === "string"
|
||||
? item
|
||||
: this.$isDarkmode
|
||||
? item.dark
|
||||
: item.light;
|
||||
return withBase(src);
|
||||
});
|
||||
},
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.image {
|
||||
box-sizing: border-box;
|
||||
width: 25%;
|
||||
padding: 9px;
|
||||
border-radius: 16px;
|
||||
}
|
||||
|
||||
@media (max-width: 719px) {
|
||||
.image {
|
||||
width: 50%;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 419px) {
|
||||
.image {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,253 +0,0 @@
|
||||
# MAA User Manual
|
||||
|
||||
## Features
|
||||
|
||||
### Operations
|
||||
|
||||
- If the stage you need is not available in the selection, please choose "Current/Previous" in MAA and manually locate the stage in the game, making sure the screen stays on the stage detail page with the **Start** and **Delegate** buttons available.
|
||||
- If you are not on this page, `Current/Previous` will automatically navigate to the last stage played according to the record in the lower right corner of the terminal homepage.
|
||||
- You can also enable `Manually input stage name` in `Task Settings` - `Combat` - `Advanced` and enter the stage number manually. Currently supported stages include:
|
||||
- All main theme stages, where `-NORMAL` or `-HARD` can be added at the end to switch between standard and challenge modes.
|
||||
- LMD stages and Battle Record stages 5/6. The input should be `CE-6` or `LS-6` even if you have not unlocked it yet. In that case, the program will automatically switch to corresponding stage 5.
|
||||
- Skill Summary, Shop Voucher, and Carbon Stages 5. The input also should be `CA-5`, `AP-5`, and `SK-5` respectively.
|
||||
- Chip stages. The input should be complete with stage number, such as `PR-A-1`.
|
||||
- Annihilation. The input should be `Annihilation`.
|
||||
- Certain side story stages. This includes `OF-1`, `OF-F3` and `GT-5`.
|
||||
- The last three stages of the current SS event. This is available after downloading updates automatically from the [API](https://ota.maa.plus/MaaAssistantArknights/api/gui/StageActivity.json) when the event is on. Prompt will be shown in the main page when this is available.
|
||||
<!--For the re-engraved SS event, you can enter `SSReopen-XX` to clear XX-1 ~ XX-9 levels at one time. Such as `SSReopen-IC`.-->
|
||||
|
||||
- Fight options include `Use Sanity Potion`, `Use Originium`, `Perform Battles` and `Material`, you can specific any of them. The fight tasks stops once one of the specifications is met.
|
||||
- `Use Sanity Potion` specifies the number of sanity potions to use at most. Multiple medicines may be used at a time.
|
||||
- `Use Originium` specifies the number of Originium to use at most. It is used one at a time.
|
||||
- `Perform Battles` specifies the number of battles to perform at most.
|
||||
- `Material` specifies the number of materials to collect.
|
||||
|
||||
| Example | Use Sanity Potion | Use Originium | Perform Battles | Material | Result |
|
||||
|:-------:|:-----------------:|:-------------:|:---------------:|:--------:|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| A | 999 | 10 | 1 | x | The AI will attempt to use sanity potions and/or originium until **one** full run is completed, satisfying the condition `Perform Battles: 1`. If there are not enough sanity potions, originium, or initial sanity to start, the AI will stop without starting the run. |
|
||||
| B | x | x | 100 | x | The AI will attempt to complete 100 runs, but if all available sanity is used up (which may be less than 100 runs), and the conditions `Use Sanity Potion: No` and `Use Originium: No` are met, the AI will stop without completing the full 100 runs. |
|
||||
| C | 1 | x | 100 | x | The AI will attempt to complete 100 runs, using at most one sanity potion. If the AI uses a sanity potion and runs out of sanity during the process, and the conditions `Use Sanity Potion: 1` and `Use Originium: No` are met, the AI will stop without completing the full 100 runs. |
|
||||
| D | 999 | x | 100 | 3 Orirock| The AI will attempt to complete 100 runs, using up to 999 sanity potions. If during the process, the AI accumulates 3 Orirock cubes, satisfying the condition `Material: 3 Orirock`, the AI will stop without completing the full 100 runs. |
|
||||
|
||||
- Note that `Material` and `Stage` are independent options which means the program is not going to automatically navigate the the stage for the specified material. You still to mannually configure the stage option.
|
||||
- `Delegate` will be automatically selected if not already in case you forget to do so.
|
||||
- Material drops are automatically recognized and printed to the program log. The data also gets uploaded to [Penguin Stats](https://penguin-stats.io/). You can also manually set your Penguin Stats user ID in the settings.
|
||||
- After disconnection or flashing at 4 am, it will automatically reconnect and continue to play the last stage selected in the game. If you need to cross the day, please check the last stage selection.
|
||||
- A level up situation can be automatically handled as well as a failed delegation in which case this time of the operation will be given up.
|
||||
|
||||
### Infrastructure
|
||||
|
||||
#### Shifting Strategy
|
||||
|
||||
- Automatically calculate and choose the **optimal solution within a single facility**. Supports all general and special skill combinations. Supports recognition of Battle Record, Pure Gold, Originium Shard, Chip, etc. for different operators.
|
||||
|
||||
#### Morale Threshold for Working in Infrastructure
|
||||
|
||||
- Recognizes the percentage of the Morale bar. When Morale is below some threshold, the operator will be moved to the dormitory.
|
||||
|
||||
#### Note
|
||||
|
||||
- The shifting strategy is based on the optimal solution within a single facility instead of multiple facilities. Combination such as: `Shamare-Tequila`, `Vermeil-Scene` within a single facility can be recognized correctly; while combination like `Rosmontis`, `Pinus Sylvestris` among facilities is not supported yet.
|
||||
- If `Usage of Drone` is selected with the option `Trading Post-LMD`, it will recognize `Shamare` and reserve it for her.
|
||||
- Operators of corresponding fraction will be selected when only one Clue is needed Reception Room; otherwise general operators will be chosen.
|
||||
- Reception Room will send out Clues only when your Clues are full. Three Clues will be send out at most. You can edit `SelectClue` - `maxTimes` field in `resource/tasks.json` to edit number of Clues sent if you want.
|
||||
- If you do not want operators like `Irene` or someone else to be put into the dormitory when the training room is not in use, you can switch off `Working operator shall not be put into the dormitory` in the settings. Note that this may cause the operators with non-full fatigue not entering the dormitory as well.
|
||||
- Due to the complexity of Control Center, only `Amiya`, `Swire`, `Kal'tsit`, `Team Rainbow` and other Morale+0.05 operators will be considered. To be improved in future.
|
||||
- Some alternate operators may have conflicts in Infrastructure. Please notice if there is "Operator conflict" warnings on the UI, and double check the Infrastructure to shift manually (e.g. some facilities may not have any operator).
|
||||
|
||||
#### Custom infrastructure shift change (test function)
|
||||
|
||||
- The experts of Yituliu with a one-picture flow have helped to create a shift generator, which can be referenced in the documentation.
|
||||
- Several sets of extremely efficient tasks are built-in under the MAA folder `/resource/custom_infrast/`, which can be used as a reference. (Fully upgraded operators at elite 2 level can try to use them directly.)
|
||||
|
||||
### Credit Store
|
||||
|
||||
- Automatically visit friends to obtain credit points.
|
||||
- With the help of Warfarin's credit:
|
||||
- Use a support operator to clear the `OF-1` stage in Heart of Surging Flame. If the stage is not unlocked, please do not select this option.
|
||||
- You can modify the automatic combat flow of OF-1 by editing `resource\copilot\OF-1_credit_fight.json` (it is generally not recommended to modify).
|
||||
- It does not take effect when the stage selection is set to `current/last`.
|
||||
|
||||
### Integrated Strategy (I.S.) Support
|
||||
|
||||
- Please select the theme you want to explore in the MAA `Task Settings` - `Auto I.S.`, otherwise there may be problems due to the default selection of the latest theme.
|
||||
- Please pin the corresponding I.S. theme to the terminal in the game.
|
||||
- If there is exploration of non-target themes (such as if you plan to use MAA to brush Mizuki, but there is still an unfinished exploration of Phantom), please end it manually.
|
||||
- If MAA gets stuck/repeatedly enters and exits on the difficulty selection interface, please manually select the difficulty before starting this function.
|
||||
- In the settings, you can choose the team, starting operator (only one operator name), etc.
|
||||
- It supports automatic recognition of operators and proficiency, and automatically selects better operators and skills.
|
||||
- It supports identifying store items and prioritizes purchasing more powerful collectibles.
|
||||
- It supports reconnection after disconnection and supports continuing to return to brush after 4 a.m. update.
|
||||
- If the scraping cannot be completed during the battle, all ground units will be automatically withdrawn after more than 5 minutes; if it exceeds 6 minutes, the current battle will be automatically abandoned without getting stuck.
|
||||
- If the task gets stuck, it will automatically abandon the exploration and retry. However, if it often gets stuck in a certain place and then gives up, seriously affecting efficiency, please feel free to submit an issue for feedback~
|
||||
|
||||
### Share Your Tasks
|
||||
|
||||
- Welcome to share your tasks with [www.抄作业.com](https://www.抄作业.com), or [www.prts.plus](https://www.prts.plus)!
|
||||
|
||||
#### Load Tasks
|
||||
|
||||
- Please run it on the screen with `Start Operation` button.
|
||||
- If you need to make your own build manually, turn off `auto build` to do so.
|
||||
- Remember to like the tasks that you think helpful!
|
||||
|
||||

|
||||
|
||||
#### Create Tasks
|
||||
|
||||
- A tool for creating tasks is provided in the directory of MAA. See also: [Copilot Schema](3.3-COPILOT_SCHEMA.md) for help.
|
||||
- How to get map coordinates: start an operation after filling in `stage_name`. A file named `map.png` will be generated for your reference. Or you can refer to [PRTS.map](https://map.ark-nights.com/), with the `coordinates` set to `MAA` mode.
|
||||
- Drill plan is recommended for testing.
|
||||
- Welcome to share your tasks with [www.抄作业.com](https://www.抄作业.com), or [www.prts.plus](https://www.prts.plus)!
|
||||
- It is recommended to write your own name, video walkthrough URL, or other things that you think helpful in the description.
|
||||
|
||||
### Task Video Recognition
|
||||
|
||||
- Drag and drop the video file to the `Copilot` section and click `Start` to initialize the video recognition.
|
||||
- Only 16:9 aspect ratio videos with a resolution of 720p or higher are supported. The video content must not contain any black borders, distortion correction, emulator borders or other elements.
|
||||
|
||||
### Recruitment Recognition
|
||||
|
||||
- Auto-recruitment and recruitment recognition are two different features!
|
||||
- Auto-recruitment supports using `Expedited Plan` to make it fully automated! Please enable `Auto use Expedited` in `Task Settings` - `Recruit` , and modify `Recruit max times`.
|
||||
- Pop-up notification when 5★, 6★ operators are recruited.
|
||||
- Auto-uploading recruitment data to [Penguin Stats](https://penguin-stats.io/) and [Yituliu](https://yituliu.site/) while auto-recruitment.
|
||||
|
||||
### Depot Recognition (test function)
|
||||
|
||||
- Please start with the `Upgrade materials` screen. Currently, exporting is only supported to [penguin-stats](https://penguin-stats.io/), [Arknights Toolbox](https://arkn.lolicon.app/#/material), and [Arknights | Planner](https://ark-nights.com/table). More useful features may be added in the future.
|
||||
- Please feel free to contact us if you hope to integrate with our JSON schema.
|
||||
|
||||
## Setting Introduction
|
||||
|
||||
In addition to the `Settings` tab, there are also `Task Settings` in Windows MAA. Click the `gear` on the right side of the task list of `Farming` to switch between different task settings in the farming interface.
|
||||
|
||||
Note that clicking `General` `Advanced` will also switch `Task Settings`.
|
||||
|
||||
### Custom Connection
|
||||
|
||||
#### Obtain adb path
|
||||
|
||||
- Method 1: Download adb and set up connection manually
|
||||
- (Only for Windows users) Download [adb](https://dl.google.com/android/repository/platform-tools-latest-windows.zip) and unzip it. It is recommended to unzip to the MAA directory.
|
||||
- Go to the "Settings" - "Connection Settings" of the software, select the file path of `adb.exe`, fill in the adb address (IP + port need to be filled in, such as `127.0.0.1:5555`), and select the emulator type.
|
||||
|
||||
- Method 2: Find the adb execution port of the emulator and connect
|
||||
- For emulators that come with adb, you can find the location of the adb executable file according to the [Confirm adb address section](1.2-FAQ.md#Method-1-Confirm-that-the-adb-and-connection-address-are-correct).
|
||||
- Mac Android emulators are generally installed in the `/Application/` directory. Right-click on `[emulator name].app` and select "Show Package Contents". Find the adb executable file in the directory.
|
||||
|
||||
#### Get the port number
|
||||
|
||||
- Method 1: Use the adb command to view the running port directly
|
||||
|
||||
**Replace adb in the command below with the name of the found adb executable file**, and then execute:
|
||||
|
||||
```sh
|
||||
# mac/linux/windows cmd
|
||||
adb devices
|
||||
# windows PowerShell
|
||||
.\adb devices
|
||||
```
|
||||
|
||||
After most emulator adb execution commands are run, they will be output in the following form, where `[ADBPORT]` is a specific number:
|
||||
|
||||
```sh
|
||||
List of devices attached
|
||||
127.0.0.1:[ADBPORT] device
|
||||
# may be more output like the above one
|
||||
```
|
||||
|
||||
Use `127.0.0.1:[ADBPORT]` as the connection address (replace `[ADBPORT]` with the actual number).
|
||||
|
||||
- Method 2: Use system command to check emulator debugging port
|
||||
|
||||
If the output of the adb command does not display the port information in the form of `127.0.0.1:[port]`, you can use the following method to check:
|
||||
1. First, run the adb executable program once (need to start the adb daemon process), and run the Arknights emulator application.
|
||||
2. Then use the system command to check the port information of the adb process.
|
||||
|
||||
Windows Command
|
||||
|
||||
You can use `win` + `R` to open the command line by entering `cmd`, and use the following command to check:
|
||||
|
||||
```sh
|
||||
for /F "tokens=1,2" %A in ('"tasklist | findstr "adb""') do ( ^
|
||||
netstat -ano | findstr "%B" |)
|
||||
```
|
||||
|
||||
Mac / Linux Command
|
||||
|
||||
Enter the following command in the terminal after starting the emulator:
|
||||
|
||||
```sh
|
||||
tmp=$(sudo ps aux | grep "[a]db" | awk '{print $2}') && \
|
||||
sudo netstat -vanp tcp | grep -e "\b$tmp"
|
||||
```
|
||||
|
||||
The output will be in the following format, where `[PID]` is the actual process number of the adb, `[ADBPORT]` is the remote connection port of the target emulator adb, and `[localport]` is the local address of the process, which does not need to be concerned (there will also be other irrelevant indicators in the Mac operation result):
|
||||
|
||||
```sh
|
||||
> ( netstat -ano | findstr "[PID]" )
|
||||
TCP 127.0.0.1:[localport] 127.0.0.1:0.0.0.0 LISTENING [PID]
|
||||
TCP 127.0.0.1:[localport] 127.0.0.1:[ADBPORT] ESTABLISHED [PID]
|
||||
# ...
|
||||
# maybe more output like the above line
|
||||
```
|
||||
|
||||
Use `127.0.0.1:[ADBPORT]` (replace `[ADBPORT]` with the actual number) in the results as the actual connection address of the emulator adb and fill it in `Settings` - `Connection Settings` - `Connection Address`.
|
||||
|
||||
### Automatically Start Multiple Emulators
|
||||
|
||||
- If you need to operate multiple emulators simultaneously, you can copy the MAA folder multiple times, and use **different MAAs**, **the same adb.exe**, and **different connection addresses** to connect.
|
||||
- Taking `BlueStacks International Version` as an example, two ways to start multiple emulators are introduced.
|
||||
|
||||
- Perform multiple operations by attaching commands to `HD-Player.exe`.
|
||||
|
||||
1. Start the corresponding emulator separately.
|
||||
2. Open the Task Manager, find the corresponding emulator process, go to the Details tab, right-click the column above, click `Select Columns`, and check `Command Line`.
|
||||
3. In the newly added `Command Line` column, find the content after `"...\Bluestacks_nxt\HD-Player.exe"`.
|
||||
4. Fill in the found content, similar to `--instance Nougat32`, in `Startup Settings` - `Additional Commands`.
|
||||
|
||||
Note: After the operation is completed, it is recommended to hide the `Command Line` column opened in `Step 2` to prevent freezing.
|
||||
- Example:
|
||||
|
||||
```bash
|
||||
Multi-instance 1:
|
||||
Emulator Path: C:\Program Files\BlueStacks_nxt\HD-Player.exe
|
||||
Additional Commands: --instance Nougat32 --cmd launchApp --package "com.hypergryph.arknights"
|
||||
Multi-instance 2:
|
||||
Emulator Path: C:\Program Files\BlueStacks_nxt\HD-Player.exe
|
||||
Additional Commands: --instance Nougat32_1 --cmd launchApp --package "com.hypergryph.arknights.bilibili"
|
||||
```
|
||||
|
||||
The `--cmd launchApp --package` part starts and automatically runs the specified package name application after startup, which can be changed as needed.
|
||||
|
||||
- Perform multi-instance operation by using the shortcut of emulators or apps.
|
||||
|
||||
1. Open the multi-instance manager and add the corresponding emulator's shortcut.
|
||||
2. Fill in the path of the emulator shortcut in `Startup Settings` - `Emulator Path`.
|
||||
|
||||
Note: Some emulators support creating app shortcuts, which can directly launch the emulator and open Arknights with the app shortcut.
|
||||
- Example:
|
||||
|
||||
```bash
|
||||
Multi-instance 1:
|
||||
Emulator Path: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\BlueStacks\Multi-instance 1.lnk
|
||||
Multi-instance 2:
|
||||
Emulator Path: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\BlueStacks\Multi-instance 2 - Arknights.lnk
|
||||
```
|
||||
|
||||
If using `Emulator Path` for multi-instance operation, it is recommended to leave `Additional Commands` in `Startup Settings` empty.
|
||||
|
||||
### Pre/Post-Script
|
||||
|
||||
- Starting from v4.13.0, it is possible to set pre/post-script that automatically executes batch files before and after the task.
|
||||
- You need to provide the path to the batch file, which should have a `.bat` extension.
|
||||
|
||||
## Miscellaneous
|
||||
|
||||
- Tasks order can be changed on the UI. So can the shifting order in the infrastructure.
|
||||
- Almost all configuration changes will be saved automatically, except for options containing an *.
|
||||
- All clicking event is randomized within a region, following Poisson distribution (higher probability at the center, lower probability around).
|
||||
- Developed in C++, the core algorithm supports multi-level cache, in order to reduce CPU and memory usage as much as possible.
|
||||
- Our software supports auto-update ✿✿ヽ(°▽°)ノ✿ Beta-testers can try beta versions, which updates faster and less buggy (maybe).
|
||||
- If auto-update fails, you can download manually and put the ZIP file under the same directory. The update will start automatically.
|
||||
@@ -1,189 +0,0 @@
|
||||
# Emulator Supports
|
||||
|
||||
## ✅ [Bluestacks-CN 5](https://www.bluestacks.cn/)
|
||||
|
||||
Fully compatible. Need to turn on `Settings` - `Engine Settings` - `Allow ADB connection`.
|
||||
|
||||
## ✅ [Bluestacks 5](https://www.bluestacks.com/) (Recommended👍)
|
||||
|
||||
Fully compatible. Need to turn on `Settings` - `Advanced` - `Android Debug Bridge`.
|
||||
|
||||
## ✅ [Bluestacks 5 Hyper-V Version](https://support.bluestacks.com/hc/en-us/articles/4415238471053-System-requirements-for-BlueStacks-5-on-Hyper-V-enabled-Windows-10-and-11-)
|
||||
|
||||
Compatible.
|
||||
|
||||
- Turn on `Settings` - `Advanced` - `Android Debug Bridge`.
|
||||
- Bluestack Hyper-V port changes frequently. Here is a simple hack:
|
||||
|
||||
1. Find `bluestacks.conf` in the data location of the emulator. (Default is `C:\ProgramData\BlueStacks_nxt\bluestacks.conf`)
|
||||
2. If you are using MAA for the first time, Launch it, which generates `gui.json`.
|
||||
3. **Exit** MAA, **then** open the `gui.json`, and add a new field `Bluestacks.Config.Path`, with the value of the full path of `bluestacks.conf` (backslashes should be escaped like `\\`).
|
||||
For example: (suppose the file is at `C:\ProgramData\BlueStacks_nxt\bluestacks.conf`)
|
||||
|
||||
```json
|
||||
{
|
||||
"Configurations": {
|
||||
"Default": {
|
||||
"Bluestacks.Config.Path":"C:\\ProgramData\\BlueStacks_nxt\\bluestacks.conf",
|
||||
// ...
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
4. LinkStart!
|
||||
|
||||
- If you need to run multiple emulators (ignore this step if you do not need to do so), you can change the keywords for MAA to detect configuration files.
|
||||
Add field `Bluestacks.Config.Keyword` following the steps above
|
||||
Example:
|
||||
|
||||
```json
|
||||
"Bluestacks.Config.Keyword":"bst.instance.Nougat64.status.adb_port",
|
||||
```
|
||||
|
||||
## ✅ [Nox](https://en.bignox.com/)
|
||||
|
||||
Fully compatible.
|
||||
|
||||
## ✅ [Nox Android 9](https://en.bignox.com/)
|
||||
|
||||
Fully compatible.
|
||||
|
||||
## ⚠️ [MuMu](https://www.mumuglobal.com/)
|
||||
|
||||
Compatible but:
|
||||
|
||||
- Requires MAA to "Run as Administrator" to get ADB path and address (since MuMu runs as admin).
|
||||
- You can also fill in the ADB path and address if you do not wish to run as admin.
|
||||
- It is not recommended to use the default odd resolutions of MuMu, it is better to change to mainstream resolutions such as 1280x720, 1920x1080, 2560x1440, etc.
|
||||
- MuMu uses the same adb port for multi-instance, so multi-instance is not supported.
|
||||
|
||||
## 🚫 MuMu Mobile Game Assistant
|
||||
|
||||
Incompatible. The ADB port is unavailable.
|
||||
|
||||
## ⚠️ [MuMu emulator X (Android 12)](https://www.mumuglobal.com/) (most smooth👍)
|
||||
|
||||
Compatible but:
|
||||
|
||||
- This emulator is still in the testing phase and it is uncertain whether unknown issues will occur.
|
||||
- Requires MAA to "Run as Administrator" to get ADB path and address (since MuMu runs as admin).
|
||||
- You can also fill in the ADB path and address if you do not wish to run as admin.
|
||||
- It is not recommended to use the default odd resolutions of MuMu, it is better to change to mainstream resolutions such as 1280x720, 1920x1080, 2560x1440, etc.
|
||||
- MuMu uses the same adb port for multi-instance, so multi-instance is not supported.
|
||||
|
||||
## ⚠️ [LDPlayer](https://www.ldplayer.net/)
|
||||
|
||||
The recent official update has fixed some issues and provided corresponding support. After some time of testing, we have basically confirmed that it can be used normally.
|
||||
While using it, please still pay attention to the following points, but overall, the user experience has been greatly improved.
|
||||
|
||||
- **For LDPlayer 9, it is recommended to use version 9.0.37 or above; for LDPlayer 5, it is recommended to use version 5.0.44 or above.**
|
||||
- We cannot guarantee that the LDPlayer emulator can run perfectly on all computers, but we are working hard to optimize the adaptation.
|
||||
- If you encounter any problems when using the LDPlayer emulator, please update to the latest version of the emulator and try to solve the problem by yourself first. If you encounter difficulties, please feel free to provide feedback, and we will try our best to provide support.
|
||||
- Note: We welcome feedback on issues related to the LDPlayer emulator, and will try to solve them. We would be very grateful if you could provide relevant code or contributions.
|
||||
|
||||
## ✅ [Memu](https://www.memuplay.com)
|
||||
|
||||
Compatible, but there are fewer tests and there may be unknown issues
|
||||
|
||||
## 🚫 Tencent Mobile Game Assistant
|
||||
|
||||
Incompatible. The ADB port is unavailable.
|
||||
|
||||
## 🚫 [Google Play Games Beta](https://developer.android.com/games/playgames/pg-emulator?hl=zh-cn#installing-game-consumer)
|
||||
|
||||
Incompatible. The ADB port of [the consumer client](https://developer.android.com/games/playgames/pg-emulator?hl=zh-cn#installing-game-consumer)is unavailable.
|
||||
|
||||
## ⚠️ [Win11 WSA](https://docs.microsoft.com/en-us/windows/android/wsa/)
|
||||
|
||||
Partially compatible.
|
||||
|
||||
- Need to connect with [Custom Connection](#%EF%B8%8F-custom-connection).
|
||||
- For WSA 2204 or higher (version is in the `About` window of system settings), try `General Configuration` to connect.
|
||||
- For WSA 2203 or older (version is in the top of the system settings window), try `Legacy WSA` to connect.
|
||||
- Since WSA does not support changing resolution, please resize the window manually because this program supports 720p or higher `16:9` resolution better. (Or you can simply maximize the window with `F11` if your monitor is 16:9.)
|
||||
- Please ensure that your emulator is at the top of other windows in most of the time and there are no other android applications running. Otherwise the game may pause or the recognition may fail.
|
||||
- Sometimes the screenshot of WSA may be blank, causing recognition failure. So it is not recommended to use WSA.
|
||||
|
||||
## ✅ [AVD](https://developer.android.com/studio/run/managing-avds)
|
||||
|
||||
Compatible.
|
||||
|
||||
### ⚙️ Non-`16:9` devices like smartphones or tablets
|
||||
|
||||
You may need to change the resolution manually since MAA supports only `16:9` resolution.
|
||||
|
||||
1. Turn on USB debugging mode and connect your device to the computer with a cable, or debug with ADB remotely.
|
||||
2. Run `Command Prompt (CMD)`, check the device address and connect.
|
||||
|
||||
- Use the following command to check device ID if you are using USB cable to connect:
|
||||
|
||||
```bash
|
||||
adb devices # Checks the connection status of the current device, with the first column to be the device ID
|
||||
```
|
||||
|
||||
After successful connection, you will see the following messages:
|
||||
|
||||
```bash
|
||||
C:\Users\username>adb devices
|
||||
List of devices attached
|
||||
VFNDU1682100xxxx device # The data before "device" is the device ID
|
||||
```
|
||||
|
||||
- If you are using remote ADB connection: go to `Settings -> WLAN -> View` to find the corresponding IP address, and the port will usually be 5555 or 5037.
|
||||
|
||||
```bash
|
||||
adb connect <IP Address + Port> # E.g. 192.168.0.10:5555
|
||||
```
|
||||
|
||||
- If it prompts `'adb' is not recognized as an internal or external command`, it is because the environment variable is not configured correctly. You need to give the full path of ADB to run it. For example:
|
||||
|
||||
```bash
|
||||
D:\adb_unzip_path\adb.exe devices # Or you can simply drag the adb.exe to CMD window and type [SPACE] devices
|
||||
```
|
||||
|
||||
It is suggested that you configure the environment variable for ADB if you need to run it frequently. Please refer to the articles on the Internet about how to configure it for help.
|
||||
|
||||
3. Enter the command prompt to proceed
|
||||
|
||||
```bash
|
||||
adb -s <Device ID or IP + Port> shell # Enters the command prompt of the device
|
||||
wm size # Checks the resolution of the current device
|
||||
wm size 720x1280 # Changes the resolution to 720p
|
||||
```
|
||||
|
||||
4. Fill in the ADB path and the address of your smartphone (device ID or IP + port) in MAA
|
||||
5. Set the `Special-shaped screen adaptation` to 0 (off) in the game settings.
|
||||
Otherwise, your phone UI and click response may be dislocated if you change the resolution with ADB later.
|
||||
6. Use MAA (≧∇≦)ノ
|
||||
7. Before exiting MAA, reset the resolution of your phone.
|
||||
|
||||
```bash
|
||||
wm size reset # Resets resolution
|
||||
```
|
||||
#### Using `Starts/End with Script` Options
|
||||
|
||||
After MAA version 4.13.0, you're able to utilize `Starts/End with Script` options to apply resolution changes on startup and revert the changes on finishing.
|
||||
|
||||
Create two script files: `startup.bat` & `finish.bat` in appropriate path and edit them using your favored text editor.
|
||||
|
||||
In `startup.bat`:
|
||||
|
||||
```bash
|
||||
adb shell wm size 1080x1920
|
||||
::If long-time operation is required, add the following line to save the power and protect your screen.
|
||||
adb shell settings put system screen_brightness 1
|
||||
```
|
||||
|
||||
In `finish.bat`:
|
||||
|
||||
```bash
|
||||
adb shell wm size reset
|
||||
::Add the following line to brighten your screen
|
||||
adb shell settings put system screen_brightness 20
|
||||
::Add the following line to lock (Command may differ in different device, test it first)
|
||||
adb shell input keyevent 26
|
||||
```
|
||||
|
||||
Then go to `Settings` - `Connection Settings` and add the paths of files above to `Starts with Script` & `End with Script` options, the script will be executed at corresponding timing.
|
||||
|
||||
@@ -1,343 +0,0 @@
|
||||
---
|
||||
icon: material-symbols:terminal
|
||||
---
|
||||
# User Guide for CLI
|
||||
|
||||
## Feature
|
||||
|
||||
- Define tasks by TOML, YAML or JSON file, then run it by `maa run <task>`;
|
||||
- Install and update `MaaCore` and resources with `maa install` and `maa update`;
|
||||
- Update self with `maa self update`;
|
||||
|
||||
## Installation
|
||||
|
||||
### Appimage
|
||||
|
||||
The CLI is the default interface of MAA on Linux. You can use the CLI directly by download the latest Appimage.
|
||||
|
||||
### Package manager
|
||||
|
||||
#### macOS
|
||||
|
||||
Install with [Homebrew](https://brew.sh/):
|
||||
|
||||
```bash
|
||||
brew install MaaAssistantArknights/tap/maa-cli
|
||||
```
|
||||
|
||||
#### Linux
|
||||
|
||||
ArchLinux user can install [AUR package](https://aur.archlinux.org/packages/maa-cli/):
|
||||
|
||||
```bash
|
||||
yay -S maa-cli
|
||||
```
|
||||
|
||||
For LinuxBrew user, you can install with [LinuxBrew](https://docs.brew.sh/Homebrew-on-Linux):
|
||||
|
||||
```bash
|
||||
brew install MaaAssistantArknights/tap/maa-cli
|
||||
```
|
||||
|
||||
### Prebuilt binary
|
||||
|
||||
You can install CLI by download prebuilt binary from
|
||||
[`maa-cli` release page](https://github.com/MaaAssistantArknights/maa-cli/releases/latest) and extract it to your favorite location. The filename for different platform is:
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Operation System</th>
|
||||
<th>Architecture</th>
|
||||
<th>Filename</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td rowspan=2>Linux</td>
|
||||
<td>x86_64</td>
|
||||
<td>maa_cli-x86_64-unknown-linux-gnu.tar.gz</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>aarch64</td>
|
||||
<td>maa_cli-aarch64-unknown-linux-gnu.tar.gz</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td rowspan=2>macOS</td>
|
||||
<td>x86_64</td>
|
||||
<td rowspan=2>
|
||||
maa_cli-universal-apple-darwin.zip
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>aaarch64</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td rowspan=2>Windows</td>
|
||||
<td>x86_64</td>
|
||||
<td>maa_cli-x86_64-pc-windows-msvc.zip</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
### Build from source
|
||||
|
||||
You can also build from source by yourself with `cargo`:
|
||||
|
||||
```bash
|
||||
cargo install --git https://github.com/MaaAssistantArknights/maa-cli.git --bin maa --locked
|
||||
```
|
||||
|
||||
### Dependencies
|
||||
|
||||
#### MaaCore
|
||||
|
||||
`maa-cli` only provides a interface for MaaCore, it needs `MaaCore` and resources to run tasks, which can be installed by `maa install`:
|
||||
|
||||
```bash
|
||||
maa install
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Commands
|
||||
|
||||
The main feature of `maa-cli` is to run tasks, you can run a task by `maa run <task>`. Here `<task>` is the name of a task, you can list all available tasks by `maa list`.
|
||||
|
||||
More details can be found by `maa help`.
|
||||
|
||||
## Configurations
|
||||
|
||||
### Configuration directory
|
||||
|
||||
All configurations of `maa-cli` is located in a specific configuration directory, which can be get by `maa dir config`.
|
||||
The configuration directory can be changed by environment variable `MAA_CONFIG_DIR`. In below examples, we will use `$MAA_CONFIG_DIR` to represent the configuration directory.
|
||||
|
||||
All configuration files can be written in TOML, YAML or JSON format. In below examples, we will use TOML format and `.toml` as file extension. But you can mix these three formats as long as the file extension is correct.
|
||||
|
||||
### Define tasks
|
||||
|
||||
A `maa-cli` task should be defined in a single file, which should be located in `$MAA_CONFIG_DIR/tasks` directory.
|
||||
|
||||
#### Basic structure
|
||||
|
||||
A `maa-cli` task is a sequence of `MAA` tasks, each `MAA` task is defined by `type` and `params` fields:
|
||||
|
||||
```toml
|
||||
[[tasks]]
|
||||
type = "StartUp" # the type of maa task
|
||||
params = { client_type = "Official", start_game_enabled = true } # the params of given task
|
||||
```
|
||||
|
||||
See documentation of [MAA](https://maa.plus/docs/en-us/3.1-INTEGRATION.html#asstappendtask) for all available task types and params.
|
||||
|
||||
#### Task variants and conditions
|
||||
|
||||
In some case, you may want to run a task with different params in different conditions. You can define multiple variants for a task, and use `condition` field to determine whether the variant should be used. For example, you may want to use different infrast plan in different time period of a day:
|
||||
|
||||
```toml
|
||||
[[tasks]]
|
||||
type = "Infrast"
|
||||
|
||||
[tasks.params]
|
||||
mode = 10000
|
||||
facility = ["Trade", "Reception", "Mfg", "Control", "Power", "Office", "Dorm"]
|
||||
dorm_trust_enabled = true
|
||||
filename = "normal.json" # the filename of custom infrast plan
|
||||
|
||||
# use plan 1 before 12:00:00, use plan 2 between 12:00:00 and 18:00:00, use plan 0 after 18:00:00
|
||||
[[tasks.variants]]
|
||||
condition = { type = "Time", end = "12:00:00" } # if start is not defined, it will be 00:00:00
|
||||
params = { plan_index = 1 }
|
||||
|
||||
[[tasks.variants]]
|
||||
condition = { type = "Time", start = "12:00:00", end = "18:00:00" }
|
||||
params = { plan_index = 2 }
|
||||
|
||||
[[tasks.variants]]
|
||||
condition = { type = "Time", start = "18:00:00" } # if end is not defined, it will be 23:59:59
|
||||
params = { plan_index = 0 }
|
||||
```
|
||||
|
||||
The `condition` field is used to determine whether the variant should be used,
|
||||
and the `params` field of matched variant will be merged into the params of the task.
|
||||
|
||||
**Note**: If the `filename` field is a relative path, it will be relative to `$MAA_CONFIG_DIR/infrast`. Besides, the custom infrast plan file will not be read by `maa-cli` but `MaaCore`. So the format of the file must be `JSON` and time period defined in the file will not be used to select the corresponding sub-plan. So you must specify the `plan_index` field in the params of the task to use the correct infrast plan in the corresponding time period. This will ensure that the correct infrast plan is used in the appropriate time period.
|
||||
|
||||
Besides of `Time` condition, there are also `DateTime`, `Weakday`, and `Combined` conditions. `DateTime` condition is used to specify a specific datetime period, `Weekday` condition is used to specify some days in a week, `Combined` condition is used to specify a combination of multiple conditions.
|
||||
|
||||
```toml
|
||||
[[tasks]]
|
||||
type = "Fight"
|
||||
|
||||
# fight SL-8 on summer event
|
||||
[[tasks.variants]]
|
||||
params = { stage = "SL-8" }
|
||||
condition = { type = "DateTime", start = "2023-08-01T16:00:00", end = "2023-08-21T03:59:59" }
|
||||
# fight CE-6 on Tue, Thu, Sat if not on summer event
|
||||
[[tasks.variants]]
|
||||
condition = { type = "Weekday", weekdays = ["Tue", "Thu", "Sat"] }
|
||||
params = { stage = "CE-6" }
|
||||
# fight 1-7 otherwise
|
||||
[[tasks.variants]]
|
||||
params = { stage = "1-7" }
|
||||
```
|
||||
|
||||
With default strategy, if multiple variants are matched, only the first one will be used. And if the condition is not given, the variant will always be matched. So you can put a variant without condition at the end of variants.
|
||||
|
||||
The strategy of matching variants can be changed by `strategy` field:
|
||||
|
||||
```toml
|
||||
[[tasks]]
|
||||
type = "Fight"
|
||||
strategy = "merge" # or "first" (default)
|
||||
|
||||
# use all expiring medicine on Sunday night
|
||||
[[tasks.variants]]
|
||||
params = { expiring_medicine = 1000 }
|
||||
[tasks.variants.condition]
|
||||
type = "Combined"
|
||||
conditions = [
|
||||
{ type = "Time", start = "18:00:00" },
|
||||
{ type = "Weekday", weekdays = ["Sun"] },
|
||||
]
|
||||
|
||||
# fight 1-7 by default
|
||||
[[tasks.variants]]
|
||||
params = { stage = "1-7" }
|
||||
|
||||
# fight CE-6 on Tue, Thu, Sat if not on summer event
|
||||
[[tasks.variants]]
|
||||
condition = { type = "Weekday", weekdays = ["Tue", "Thu", "Sat"] }
|
||||
params = { stage = "CE-6" }
|
||||
|
||||
# fight SL-8 on summer event
|
||||
[[tasks.variants]]
|
||||
params = { stage = "SL-8" }
|
||||
condition = { type = "DateTime", start = "2023-08-01T16:00:00", end = "2023-08-21T03:59:59" }
|
||||
```
|
||||
|
||||
The outcome stage of this example should be identical to the previous one, but expiring medicine will be used on Sunday night additionally.
|
||||
With the `merge` strategy, if multiple variants are matched, the params of all matched variants will be merged. If multiple variants have the same param, the last one will be used.
|
||||
|
||||
If no variant is matched, the task will not be executed, which is useful when you want to only run a task in some conditions:
|
||||
|
||||
```toml
|
||||
# Mall after 18:00
|
||||
[[tasks]]
|
||||
type = "Mall"
|
||||
|
||||
[[tasks.variants]]
|
||||
condition = { type = "Time", start = "18:00:00" }
|
||||
```
|
||||
|
||||
#### User input
|
||||
|
||||
In some case, you may want to input some value at runtime, instead of hard code it in the task file. Such as the stage to fight, the item to buy, etc. You can specify the value as `Input` or `Select` type:
|
||||
|
||||
```toml
|
||||
[[tasks]]
|
||||
type = "Fight"
|
||||
|
||||
# Select a stage to fight
|
||||
[[tasks.variants]]
|
||||
condition = { type = "DateTime", start = "2023-08-01T16:00:00", end = "2023-08-21T03:59:59" }
|
||||
|
||||
# Set the stage to a `Select` type with alternatives and description
|
||||
[tasks.variants.params.stage]
|
||||
alternatives = ["SL-6", "SL-7", "SL-8"] # the alternatives of stage, at least one alternative should be given
|
||||
description = "a stage to fight in summer event" # description of the input, optional
|
||||
|
||||
# Task without input
|
||||
[[tasks.variants]]
|
||||
condition = { type = "Weekday", weekdays = ["Tue", "Thu", "Sat"] }
|
||||
params = { stage = "CE-6" }
|
||||
|
||||
# Input a stage to fight
|
||||
[[tasks.variants]]
|
||||
|
||||
# Set the stage to a `Input` type with default value and description
|
||||
[tasks.variants.params.stage]
|
||||
default = "1-7" # default value of stage, optional (if not given, user can input empty value to re-prompt)
|
||||
description = "a stage to fight" # description of the input, optional
|
||||
```
|
||||
|
||||
For `Input` type, a prompt will be shown to ask user to input a value. If the default value is given, it will be used if user input empty value, otherwise it will re-prompt. For `Select` type, a prompt will be shown to ask user to select a value from alternatives (by index). If user input is not a valid index, it will re-prompt. The promote and input can be disabled by `--batch` option, which is useful for running tasks in Schedule.
|
||||
|
||||
### `MaaCore` related configurations
|
||||
|
||||
The related configurations of `MaaCore` is located in `$MAA_CONFIG_DIR/asst.toml`. The current available configurations are:
|
||||
|
||||
```toml
|
||||
user_resource = true
|
||||
resources = ["platform_diff/iOS"]
|
||||
|
||||
[connection]
|
||||
type = "ADB"
|
||||
adb_path = "adb"
|
||||
device = "emulator-5554"
|
||||
config = "CompatMac"
|
||||
|
||||
[static_options]
|
||||
cpu_ocr = false
|
||||
gpu_ocr = 1
|
||||
|
||||
[instance_options]
|
||||
touch_mode = "MAATouch"
|
||||
deployment_with_pause = false
|
||||
adb_lite_enabled = false
|
||||
kill_adb_on_exit = false
|
||||
```
|
||||
|
||||
The feild `user_resource` is used to specify whether load user resource, which is a boolean value. If it is `true`, additional resources in `$MAA_CONFIG_DIR/resource` directory will be loaded at last (after all other resources). This is identical to the `--user-resource` command line option. See `maa help run` for more information.
|
||||
|
||||
The `resources` field is used to specify additional resources, which is a list of resource directories (if relative path is given, it will be relative to `$(maa dir resource)/resource` directory):
|
||||
|
||||
The `connection` section is used to specify how to connect to the game. Currently, there are two types of connection: `ADB` and `PlayTools`.
|
||||
|
||||
If you use `ADB`, you should set `adb_path` and `device` fields:
|
||||
|
||||
```toml
|
||||
[connection]
|
||||
type = "ADB"
|
||||
adb_path = "adb" # the path of adb executable
|
||||
device = "emulator-5554" # the serial of your android device
|
||||
config = "General" # the config of maa
|
||||
```
|
||||
|
||||
If you use `PlayTools`, you should set `address` which is the address of MaaTools set in PlayCover, more details can be found at
|
||||
[here](https://maa.plus/docs/en-us/1.4-EMULATOR_SUPPORTS_FOR_MAC.html#✅-playcover-the-software-runs-most-fluently-for-its-nativity-🚀):
|
||||
|
||||
```toml
|
||||
[connection]
|
||||
type = "PlayTools"
|
||||
address = "localhost:1717" # the address of MaaTools
|
||||
config = "CompatMac" # the same as above
|
||||
```
|
||||
|
||||
Both `ADB` and `PlayTools` share the `config` field, which is a parameter of `connect` function of maa.It's default value is `CompatMac` on macOS, `CompatPOSIXShell` on Linux and `General` on other platforms. More optional configs can be found in `config.json` in resource directory.
|
||||
|
||||
The `instance_options` section is used to configure maa [instance options](https://maa.plus/docs/en-us/3.1-INTEGRATION.html#asstsetinstanceoption):
|
||||
|
||||
```toml
|
||||
[instance_options]
|
||||
touch_mode = "ADB" # touch mode to use, can be "ADB", "MiniTouch", "MAATouch" or "MacPlayTools" (only for PlayCover)
|
||||
deployment_with_pause = false # whether pause the game when deployment
|
||||
adb_lite_enabled = false # whether use adb-lite
|
||||
kill_adb_on_exit = false # whether kill adb when exit
|
||||
```
|
||||
|
||||
Note: If you connect to the game with `PlayCover`, the `touch_mode` will be ignored and `MacPlayTools` will be used.
|
||||
|
||||
### `maa-cli` related configurations
|
||||
|
||||
The `maa-cli` related configurations should be located in `$MAA_CONFIG_DIR/cli.toml`. Currently, it only contains one section: `core`:
|
||||
|
||||
```toml
|
||||
[core]
|
||||
channel = "beta"
|
||||
[core.components]
|
||||
resource = false
|
||||
```
|
||||
|
||||
The `channel` field is used to specify the channel of `MaaCore` to install, which can be `stable`, `beta` or `alpha`. The components of `MaaCore` to install can be specified by `components` field, which is a table of boolean values. Currently, only `resource` component is supported.
|
||||
@@ -1,291 +0,0 @@
|
||||
# Task Schema
|
||||
|
||||
Usage of `resource/tasks.json` and description of each field
|
||||
|
||||
## Overview
|
||||
|
||||
```json
|
||||
{
|
||||
"TaskName" : { // Task name
|
||||
|
||||
"baseTask": "xxx", // use xxx task as a template to generate tasks, see Base Task in the special task type below for details
|
||||
|
||||
"algorithm": "MatchTemplate", // Optional, indicating the type of recognition algorithm
|
||||
// defaults to MatchTemplate when not filled in
|
||||
// - JustReturn: Execute the action directly without recognition
|
||||
// - MatchTemplate: match the image
|
||||
// - OcrDetect: text recognition
|
||||
// - Hash: Hash calculation
|
||||
|
||||
"action": "ClickSelf", // Optional, indicates the action after recognition
|
||||
// defaults to DoNothing if not filled in
|
||||
// - ClickSelf: Click on the recognized location (a random point within the recognized target range)
|
||||
// - ClickRand: Click on a random position in the whole screen
|
||||
// - ClickRect: Click on the specified area, corresponds to the specificRect field, not recommended to use this option
|
||||
// - DoNothing: Do nothing
|
||||
// - Stop: Stop the current task
|
||||
// - Swipe: slide, corresponds to the specificRect and rectMove fields
|
||||
|
||||
"sub": [ "SubTaskName1", "SubTaskName2" ],
|
||||
// Optional, subtasks. Will execute each subtask in turn after the current task is executed
|
||||
// Optional, sub-tasks and then sub-tasks. But be careful not to write a dead loop
|
||||
|
||||
"subErrorIgnored": true, // Optional, if or not to ignore subtask errors.
|
||||
// default false if not filled
|
||||
// If false, if a subtask has an error, it will not continue to execute subsequent tasks (equivalent to this task having an error)
|
||||
// When true, it has no effect on whether a subtask has an error or not
|
||||
|
||||
"next": [ "OtherTaskName1", "OtherTaskName2" ],
|
||||
// Optional, indicating the next task to be executed after the current task and the sub task are executed
|
||||
// will be identified from front to back, and the first matching one will be executed
|
||||
// default stop after the current task is executed
|
||||
// For the same task, the second time will not be recognized after the first recognition.
|
||||
// "next": [ "A", "B", "A", "A" ] -> "next": [ "A", "B" ]
|
||||
// Do not allow JustReturn type tasks to be located in a non-last item
|
||||
|
||||
"maxTimes": 10, // Optional, indicates the maximum number of times the task can be executed
|
||||
// default infinite if not filled
|
||||
// When the maximum number of times is reached, if the exceededNext field exists, the task will be executed as exceededNext; otherwise, the task will be stopped.
|
||||
|
||||
"exceededNext": [ "OtherTaskName1", "OtherTaskName2" ],
|
||||
// Optional, indicates the task to be executed when the maximum number of executions is reached
|
||||
// If not filled in, it will stop when the maximum number of executions is reached; if filled in, it will be executed here, not in next
|
||||
"onErrorNext": [ "OtherTaskName1", "OtherTaskName2" ],
|
||||
// Optional, indicating the subsequent tasks to be performed in case of execution errors
|
||||
|
||||
"preDelay": 1000, // Optional, indicates how long the action will be executed after it is recognized, in milliseconds; default 0 if not filled in
|
||||
"postDelay": 1000, // Optional, indicates how long the action is delayed after execution before it is recognized next, in milliseconds; default 0 if not filled in
|
||||
|
||||
"roi": [ 0, 0, 1280, 720 ], // Optional, indicating the range of recognition, in the format [ x, y, width, height ]
|
||||
// Auto-scaling to 1280 * 720; default when not filled [ 0, 0, 1280, 720 ]
|
||||
// Fill in as much as possible, reducing the recognition range can reduce performance consumption and speed up recognition
|
||||
|
||||
"cache": true, // Optional, indicates whether the task uses caching or not, default is true;
|
||||
// After the first recognition, only the first recognized position will be recognized forever, enable to save performance significantly
|
||||
// but only for tasks where the location of the target to be recognized will not change at all, set to false if the location of the target to be recognized will change
|
||||
|
||||
"rectMove": [ 0, 0, 0, 0 ], // Optional, target movement after recognition, not recommended Auto-scaling with 1280 * 720 as base
|
||||
// For example, if A is recognized, but the actual location to be clicked is somewhere in the 10 pixel 5 * 2 area below A.
|
||||
// then you can fill in [ 0, 10, 5, 2 ], try to recognize the position to be clicked directly if you can, this option is not recommended
|
||||
// Additional, valid and mandatory when action is Swipe, indicates the end of the slide.
|
||||
|
||||
"reduceOtherTimes": [ "OtherTaskName1", "OtherTaskName2" ],
|
||||
// Optional, executes to reduce the execution count of other tasks.
|
||||
// For example, if you take a sanity pill, it means that the last click on the blue start action button did not take effect, so the blue start action is -1
|
||||
|
||||
"specificRect": [ 100, 100, 50, 50 ],
|
||||
// Valid and mandatory when action is ClickRect, indicates the specified click position (a random point in the range).
|
||||
// Valid and mandatory when action is Swipe, it means the starting point of swipe.
|
||||
// Auto-scaling with 1280 * 720 as base
|
||||
|
||||
"specialParams": [ int, ... ], // Parameters needed for some special recognizers
|
||||
// extra, optional when action is Swipe, [0] for duration, [1] for whether to enable extra sliding
|
||||
|
||||
/* The following fields are only valid if algorithm is MatchTemplate */
|
||||
|
||||
"template": "xxx.png", // Optional, the name of the image file to be matched
|
||||
// default "TaskName.png"
|
||||
|
||||
"templThreshold": 0.8, // Optional, threshold value for image template matching score, above which the image is considered recognized.
|
||||
// default 0.8, you can check the actual score according to the log
|
||||
|
||||
"maskRange": [ 1, 255 ], // Optional, the grayscale mask range. For example, the part of the image that does not need to be recognized will be painted black (grayscale value of 0)
|
||||
// Then set "maskRange" to [ 1, 255 ], to instantly ignore the blacked out parts when matching
|
||||
|
||||
/* The following fields are only valid if algorithm is OcrDetect */
|
||||
|
||||
"text": [ "接管作战", "代理指挥" ], // Required, the text content to be recognized, as long as any match is considered to be recognized
|
||||
|
||||
"ocrReplace": [ // Optional, replacement for commonly misidentified text (regular support)
|
||||
[ "千员", "干员" ],
|
||||
[ ".+击干员", "狙击干员" ]
|
||||
],
|
||||
|
||||
"fullMatch": false, // optional, whether the text recognition needs to match all words (not multiple words), default is false
|
||||
// false, as long as it is a substring: for example, text: [ "start" ], the actual recognition to "start action", also considered successful.
|
||||
// if true, "start" must be recognized, not one more word
|
||||
|
||||
"isAscii": false, // optional, whether the text content to be recognized is ASCII characters
|
||||
// default false if not filled
|
||||
|
||||
"withoutDet": false // Optional, whether to not use the detection model
|
||||
// default false if not filled
|
||||
|
||||
/* The following fields are only valid when the algorithm is Hash */
|
||||
// The algorithm is not mature, and is only used in some special cases, so it is not recommended for now
|
||||
// Todo
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Special Task Type
|
||||
|
||||
### Template Task(`@` Type Task)
|
||||
|
||||
Template task and base task are collectively called **Template task**.
|
||||
|
||||
Allows a task "A" to be used as a template, and then "B@A" to represent the task generated by "A".
|
||||
|
||||
- If task "B@A" is not explicitly defined in `tasks.json`, then add `B@` prefix to the `sub`, `next`, `onErrorNext`, `exceededNext`, `reduceOtherTimes` fields (or `B` if the task name starts with `#`) and the rest of the parameters are the same as for task "A". That is, if task "A" has the following parameters.
|
||||
|
||||
```json
|
||||
"A": {
|
||||
"template": "A.png",
|
||||
...,
|
||||
"next": [ "N1", "N2" ]
|
||||
}
|
||||
```
|
||||
|
||||
is equivalent to defining both
|
||||
|
||||
```json
|
||||
"B@A": {
|
||||
"template": "A.png",
|
||||
...,
|
||||
"next": [ "B@N1", "B@N2" ]
|
||||
}
|
||||
```
|
||||
|
||||
- If task "B@A" is defined in `tasks.json`, then
|
||||
1. if the `algorithm` field of `B@A` is different from that of `A`, the derived class parameters are not inherited (only the parameters defined by `TaskInfo` are inherited)
|
||||
2. for image matching task, `template` is `B@A.png` if not explicitly defined (instead of inheriting the `template` name of "A"), otherwise any derived class parameters are inherited directly from "A" task if not explicitly defined
|
||||
3. for the parameters defined in the `TaskInfo` base class (any type of task parameters, such as `algorithm`, `roi`, `next`, etc.), if not explicitly defined in "B@A", all parameters are inherited directly from the "A" task parameters, except for the five fields mentioned above, such as `sub`, which will be prefixed with "B@" when inherited
|
||||
|
||||
### Base Task
|
||||
|
||||
Base task and template task are collectively called **template task**.
|
||||
|
||||
A task with the field `baseTask` is a base task.
|
||||
|
||||
Base task takes precedence over template task. This means that `"B@A": { "baseTask": "C", ... }` has no relevance to task A.
|
||||
|
||||
Any parameter that is not explicitly defined uses the value of the `baseTask` parameter for the corresponding task without a prefix, except for `template` which remains `"taskName.png"` if it is not explicitly defined.
|
||||
|
||||
#### Multi-File Task
|
||||
|
||||
If a task defined in a later loaded task file (e.g. `tasks.json` for foreign services; hereinafter called File 2) also has a task of the same name defined in a earlier loaded task file (e.g. `tasks.json` for official services; hereinafter called File 1), then.
|
||||
- if the task in File 2 does not have a `baseTask` field, then it inherits the fields of the task with the same name in File 1 directly.
|
||||
- If the task in File 2 has a `baseTask` field, then it does not inherit the fields of the task with the same name in File 1, but overwrites them.
|
||||
|
||||
### Virtual Task
|
||||
|
||||
Virtual task is also called sharp task (`#` type task).
|
||||
|
||||
A task with `#` in its name is a virtual task. `#` can be followed by `next`, `back`, `self`, `sub`, `on_error_next`, `exceeded_next`, `reduce_other_times`。
|
||||
|
||||
| Virtual Task Type | Meaning | Simple example |
|
||||
|:---------:|:---:|:--------:|
|
||||
| self | Parent Task Name | `"A": {"next": "#self"}` in `"#self"` is interpreted as `"A"`<br>`"B": {"next": "A@B@C#self"}` in `"A@B@C#self"` is interpreted as `"B"`.<sup>1</sup> |
|
||||
| back | # Preceding task name | `"A@B#back"` is interpreted as `"A@B"`<br>`"#back"` will be skipped if it appears directly |
|
||||
| next, sub, etc. | # The field corresponding to the previous task name | Take `next` for example:<br>`"A#next"` is interpreted as `Task.get("A")->next`<br>`"#next"` will be skipped if it appears directly |
|
||||
|
||||
_Note<sup>1</sup>: `"XXX#self"` has the same meaning as `"#self"`._
|
||||
|
||||
#### Simple example
|
||||
|
||||
```json
|
||||
{
|
||||
"A": { "next": [ "N1", "N2" ] },
|
||||
"C": { "next": [ "B@A#next" ] },
|
||||
|
||||
"Loading": {
|
||||
"next": [ "#self", "#next", "#back" ]
|
||||
},
|
||||
"B": {
|
||||
"next": [ "Other", "B@Loading" ]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Available.
|
||||
|
||||
```cpp
|
||||
Task.get("C")->next = { "B@N1", "B@N2" };
|
||||
|
||||
Task.get("B@Loading")->next = { "B@Loading", "Other", "B" };
|
||||
Task.get("Loading")->next = { "Loading" };
|
||||
Task.get_raw("B@Loading")->next = { "B#self", "B#next", "B#back" };
|
||||
```
|
||||
|
||||
#### Some uses
|
||||
|
||||
- When several tasks have `"next": [ "#back" ]`, `"Task1@Task2@Task3"` represents the sequential execution of `Task3`, `Task2`, `Task1`。
|
||||
|
||||
#### Other related
|
||||
|
||||
```json
|
||||
{
|
||||
"A": { "next": [ "N0" ] },
|
||||
"B": { "next": [ "A#next" ] },
|
||||
"C@A": { "next": [ "N1" ] }
|
||||
}
|
||||
```
|
||||
|
||||
In this case above, `"C@B" -> next` (i.e. `C@A#next`) is `["N1"]` instead of `["C@N0"]`.
|
||||
|
||||
## Runtime task modification
|
||||
|
||||
- `Task.lazy_parse()` loads the json task configuration file at runtime. The lazy_parse rules are the same as for [multi-file task](#multi-file task).
|
||||
- `Task.set_task_base()` modifies the `baseTask` field of a task.
|
||||
|
||||
### Usage Example
|
||||
|
||||
Suppose you have the following task configuration file:
|
||||
|
||||
```json
|
||||
{
|
||||
"A": {
|
||||
"baseTask": "A_default"
|
||||
},
|
||||
"A_default": {
|
||||
"next": [ "xxx" ]
|
||||
},
|
||||
"A_mode1": {
|
||||
"next": [ "yyy" ]
|
||||
},
|
||||
"A_mode2": {
|
||||
"next": [ "zzz" ]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
The following code enables changing task "A" based on the value of `mode`, and will also change other tasks that depend on task "A", e.g. "B@A":
|
||||
|
||||
```cpp
|
||||
switch (mode) {
|
||||
case 1:
|
||||
Task.set_task_base("A", "A_mode1"); // This is basically the same as replacing A with the contents of A_mode1, as follows
|
||||
break;
|
||||
case 2:
|
||||
Task.set_task_base("A", "A_mode2");
|
||||
break;
|
||||
default:
|
||||
Task.set_task_base("A", "A_default");
|
||||
break;
|
||||
}
|
||||
```
|
||||
|
||||
## Expression Calculation
|
||||
|
||||
| Symbol | Meaning | Example |
|
||||
|:---------:|:---:|:--------:|
|
||||
| `@` | Template task | `Fight@ReturnTo` |
|
||||
| `#` (unary) | Virtual task | `#self` |
|
||||
| `#` (binary) | Virtual task | `StartUpThemes#next` |
|
||||
| `*` | Repeat tasks | `(ClickCornerAfterPRTS+ClickCorner)*5` |
|
||||
| `+` | Task list merge | `A+B` |
|
||||
| `^` | Task list difference (in the former but not in the latter, the order remains the same) | `(A+A+B+C)^(A+B+D)` (= `C`) |
|
||||
|
||||
The operators `@`, `#`, `*`, `+`, `^` have priority: `#` (unary) > `@` = `#` (binary) > `*` > `+` = `^`.
|
||||
|
||||
## Schema Check
|
||||
|
||||
This project configures a json schema check for `tasks.json`, the schema file is `docs/maa_tasks_schema.json`.
|
||||
|
||||
### Visual Studio
|
||||
|
||||
It is configured in `MaaCore.vcxporj` and works right out of the box. The hint effect is more obscure and some information is missing.
|
||||
|
||||
### Visual Studio Code
|
||||
|
||||
It is configured in `.vscode/settings.json`, open that **project folder** with vscode and you are ready to use it. The hint works better.
|
||||
9
docs/en-us/develop/README.md
Normal file
@@ -0,0 +1,9 @@
|
||||
---
|
||||
title: Development Docs
|
||||
icon: ph:code-bold
|
||||
index: false
|
||||
dir:
|
||||
order: 2
|
||||
---
|
||||
|
||||
<Catalog base='/en-us/develop/' />
|
||||
@@ -1,18 +1,31 @@
|
||||
# Development
|
||||
---
|
||||
order: 1
|
||||
icon: iconoir:developer
|
||||
---
|
||||
|
||||
## Introduction to GitHub pull request flow
|
||||
# Getting Started with Development
|
||||
|
||||
1. If you have forked this repository long time ago, please go to `Settings`, scroll down to the bottom, and click `Delete Repository`.
|
||||
## Introduction to GitHub Pull Request flow
|
||||
|
||||
### I don't know programming but just want to modify some JSON files/documents, how can I do it?
|
||||
|
||||
Welcome to the [GitHub Pull Request Tutorial](./pr-tutorial.md) that anyone can understand (purely web-based on Github.com)
|
||||
|
||||
### I can program, but I've never used GitHub/C++/..., what can I do?
|
||||
|
||||
1. If you have forked this repository a long time ago, please go to `Settings`, scroll down to the bottom, and click `Delete Repository`.
|
||||
2. Go to [MAA main repository](https://github.com/MaaAssistantArknights/MaaAssistantArknights) and click `Fork`, then `Create fork`.
|
||||
3. Clone the `dev` branch of the (forked) repository to local:
|
||||
3. Clone the `dev` branch of the (forked) repository to local with submodules:
|
||||
|
||||
```bash
|
||||
git clone <link to your forked repo> -b dev
|
||||
git clone --recurse-submodules <link to your forked repo> -b dev
|
||||
```
|
||||
|
||||
If you are using a Git GUI such as Visual Studio that does not include `--recurse-submodules`, do `git submodule update --init` after cloning to clone the submodules.
|
||||
|
||||
4. Download pre-built third-party libraries
|
||||
|
||||
**Please install Python first if you don't have it.**
|
||||
**A Python environment is required; please search for a Python installation tutorial if needed.**
|
||||
|
||||
```cmd
|
||||
python maadeps-download.py
|
||||
@@ -20,7 +33,7 @@
|
||||
|
||||
5. Configure development environment
|
||||
|
||||
1. Download and install `Visual Studio 2022 Community`. Select `Desktop development with C++` and `.NET Desktop Development`.
|
||||
1. Download and install `Visual Studio 2022 Community`. During installation, select `Desktop development with C++` and `.NET Desktop Development`.
|
||||
|
||||
6. Double-click to open the file `MAA.sln`. Visual Studio will load the project automatically.
|
||||
7. Run a build to test whether the development environment has been configured correctly. Choose `Release` & `x64`, right-click `MaaWpfGui` to set it as the startup project, and run it. If the build is successful, the `MaaWpfGui` window will appear. You can connect to the emulator in order to confirm again that the development environment has been configured correctly.
|
||||
@@ -74,11 +87,17 @@ Note: operations regarding Git can be done by VS2022 instead of command line too
|
||||
|
||||
## Enable clang-format in Visual Studio
|
||||
|
||||
1. Download [clang-format.zip](https://github.com/MaaAssistantArknights/MaaAssistantArknights/files/12775054/clang-format.zip) or compile [zzyyyl/llvm-project](https://github.com/zzyyyl/llvm-project/tree/fix/clang-format). You will get a `clang-format.exe`.
|
||||
2. Search `clang-format` in `Tools`-`Options`.
|
||||
3. Click `Enable ClangFormat` and select `Use custom clang-format.exe file` to use the `clang-format.exe` you have got in Step 1.
|
||||
1. Install clang-format version 17 or higher.
|
||||
|
||||

|
||||
```bash
|
||||
python -m pip install clang-format
|
||||
```
|
||||
|
||||
2. Use tools like 'Everything' to locate the installation location of clang-format.exe. As a reference, if you are using Anaconda, clang-format.exe will be installed in YourAnacondaPath/Scripts/clang-format.exe.
|
||||
3. In Visual Studio, search for 'clang-format' in Tools-Options.
|
||||
4. Click `Enable ClangFormat support` and select `Use custom clang-format.exe file` and choose the `clang-format.exe` located in Step 2.
|
||||
|
||||

|
||||
|
||||
You are all set with the clang-format integrated in Visual Studio supporting c++20 features!
|
||||
|
||||
@@ -88,8 +107,8 @@ You can also format with `tools\ClangFormatter\clang-formatter.py` directly, by
|
||||
|
||||
## Develop in cloud using GitHub codespace
|
||||
|
||||
Create GitHub codespace with pre configured C++ dev envirinments:
|
||||
Create GitHub codespace with pre-configured C++ dev environments:
|
||||
|
||||
[](https://codespaces.new/MaaAssistantArknights/MaaAssistantArknights)
|
||||
|
||||
Then follow the instructions in vscode or [Linux tutorial](./2.1-LINUX_TUTORIAL.md) to configure GCC 12 and the CMake project.
|
||||
Then follow the instructions in vscode or [Linux tutorial](./linux-tutorial.md) to configure GCC 12 and the CMake project.
|
||||