Compare commits
725 commits
Author | SHA1 | Date | |
---|---|---|---|
|
1dc3266fff | ||
|
cb217f5a85 | ||
|
e11e0c965f | ||
|
b6b747244e | ||
|
8be081fbbe | ||
|
a0e0643363 | ||
|
3bd1f452b5 | ||
|
c5b288d91a | ||
|
0ef3da1e6e | ||
|
76dcd89427 | ||
|
43ef7e25d9 | ||
|
ab8af53059 | ||
|
86c9105154 | ||
|
444963e269 | ||
|
0cb4f02579 | ||
|
c342266fae | ||
|
39e169285c | ||
|
1905284494 | ||
|
d359402311 | ||
|
09e7cc9b1c | ||
|
f327371219 | ||
|
bcf483c3b7 | ||
|
173a263490 | ||
|
521b2cd854 | ||
|
27bc68ab45 | ||
|
f7de324855 | ||
|
3b5c1fb022 | ||
|
ab8453c572 | ||
|
2639dfd053 | ||
|
0401559dde | ||
|
832a4f4914 | ||
|
33a75c734b | ||
|
ec851bb18d | ||
|
6fbf32140b | ||
|
effc46f0ed | ||
|
363ebdde91 | ||
|
c60ca94cdd | ||
|
dd50fa5b45 | ||
|
2fa9158b4f | ||
|
fad2d5e4ef | ||
|
f388c465dd | ||
|
314baf6605 | ||
|
eb918f2078 | ||
|
25c4fb74a8 | ||
|
c9e219c17b | ||
|
9ba92a7fa7 | ||
|
6ce48ec379 | ||
|
428606b3c1 | ||
|
64de196ba9 | ||
|
bd90579718 | ||
|
16a4f382ac | ||
|
bc2448afbb | ||
|
9e382f9807 | ||
|
f1fbd707f1 | ||
|
a5991972ba | ||
|
c624c7a8bd | ||
|
8bd209fb8b | ||
|
657619962f | ||
|
81274bb026 | ||
|
37eddaa0b2 | ||
|
e7eae035ff | ||
|
52a7981b85 | ||
|
92ac6ac1d9 | ||
|
50b103f127 | ||
|
1cd65c7eb8 | ||
|
f1946432ee | ||
|
e2ba4f4014 | ||
|
5f49f2c657 | ||
|
986b7ffd01 | ||
|
06a516c73c | ||
|
a6a63a1b50 | ||
|
5cff00e5ea | ||
|
0de580155d | ||
|
e7b545b288 | ||
|
3097a2c711 | ||
|
8bd9a19a7e | ||
|
0b793a3126 | ||
|
7da44ddc5b | ||
|
7b1b7ee16d | ||
|
fc7928a4b7 | ||
|
0f1e75a902 | ||
|
91fde92fc2 | ||
|
5c4225b5c9 | ||
|
8cece4b9fe | ||
|
56c9afa7c8 | ||
|
791971ee59 | ||
|
e672b1c9f0 | ||
|
5df537f348 | ||
|
c167259e60 | ||
|
5d58e94b6d | ||
|
ef257796db | ||
|
08b3433180 | ||
|
06868c8f57 | ||
|
0e3f1699ff | ||
|
e2bc4f4af2 | ||
|
907955280f | ||
|
4feab60bb7 | ||
|
5a0fd5d85f | ||
|
68a92aa972 | ||
|
d1d415e666 | ||
|
5063e87499 | ||
|
7a9da11d8b | ||
|
a3ae05cc9f | ||
|
fe4bc946b2 | ||
|
632c042a35 | ||
|
70bd6a6b0a | ||
|
8afc1239a3 | ||
|
5f97d5d66f | ||
|
28aebf2b22 | ||
|
df42668e18 | ||
|
30761e48df | ||
|
24e454066d | ||
|
c4bae8d818 | ||
|
8e5b8e0f46 | ||
|
a3fad540a7 | ||
|
20aef1cd4b | ||
|
c7090e6c33 | ||
|
1f84db837b | ||
|
c258fba6f1 | ||
|
22401bafaf | ||
|
8b074b171f | ||
|
d58115e581 | ||
|
45271c9c9c | ||
|
f08768d9bf | ||
|
5fdc78b66b | ||
|
23ca940487 | ||
|
a196b9b7e9 | ||
|
c2d90c49f9 | ||
|
f49d7acdfb | ||
|
285776354d | ||
|
d272f11073 | ||
|
ef9cafa9ce | ||
|
184e6ed916 | ||
|
8c74d8b198 | ||
|
ab86960e48 | ||
|
5e64076af9 | ||
|
76c3914484 | ||
|
6fbe927575 | ||
|
2c24e90c23 | ||
|
546cafefa3 | ||
|
85a39b955d | ||
|
41b6ff21c4 | ||
|
aa2e0909ac | ||
|
53a30c6571 | ||
|
2e8631d2eb | ||
|
cda8623468 | ||
|
51d177e938 | ||
|
78e98c446d | ||
|
fe5460c6dc | ||
|
99ad261611 | ||
|
40be014e48 | ||
|
6949232bbd | ||
|
fdd618f13a | ||
|
3df5036344 | ||
|
ad93a373ab | ||
|
8a0aac18ea | ||
|
1c5a0bb325 | ||
|
195dfe1d8d | ||
|
b9b2aeecaf | ||
|
6934b123d4 | ||
|
6fb765ca9d | ||
|
6202519ca6 | ||
|
fd7326fb91 | ||
|
ccb63a9186 | ||
|
5329ba03b5 | ||
|
3c59df555b | ||
|
c6607740a0 | ||
|
946de603b1 | ||
|
44e4d7e40b | ||
|
84e322738b | ||
|
fdf0295753 | ||
|
a556845555 | ||
|
4f6e7454fd | ||
|
c5752917c7 | ||
|
5a867cb1e3 | ||
|
fcb7c8d3e5 | ||
|
86e0fe1980 | ||
|
1312a46d91 | ||
|
7247a823b7 | ||
|
cdd5d92f26 | ||
|
29f3177d10 | ||
|
434c4a4d41 | ||
|
8bf806c035 | ||
|
b01569918a | ||
|
b9a0d7ff23 | ||
|
138976fd95 | ||
|
66e1b4e03e | ||
|
36e274d949 | ||
|
12e8b699ce | ||
|
c55ea3bc1e | ||
|
930a701f1f | ||
|
93c7bacb29 | ||
|
d902709da2 | ||
|
1d59e4d9d8 | ||
|
160c1c23d9 | ||
|
b67ef29c08 | ||
|
9fcae40bb5 | ||
|
b3db08ffcc | ||
|
ba84465d2e | ||
|
2da1524977 | ||
|
7d0d8ee79f | ||
|
4b57d09882 | ||
|
7664bbf9af | ||
|
1a9c3f66db | ||
|
f9a2a7d19e | ||
|
aac75cd299 | ||
|
7d2436ec2f | ||
|
fa686f004a | ||
|
d3dd79d54d | ||
|
d9fadc7464 | ||
|
273fa0ab26 | ||
|
81c82588bd | ||
|
e3b5e9ce3c | ||
|
1a96777b11 | ||
|
cb4a74d5e5 | ||
|
c51214f21e | ||
|
6b9c07e6ed | ||
|
514478d1f8 | ||
|
f3139f4c04 | ||
|
699143c5d4 | ||
|
c12889f7cc | ||
|
12139f587b | ||
|
e584ea337e | ||
|
51322cffa1 | ||
|
c53fdab93a | ||
|
43b0a6a0a3 | ||
|
24a7064e57 | ||
|
e6dde9cf69 | ||
|
4c791586ee | ||
|
552773269e | ||
|
61f2180d0f | ||
|
daeb8013b2 | ||
|
341cea5a32 | ||
|
8436f2a69b | ||
|
474a4a3f73 | ||
|
5f4afe3bd2 | ||
|
62728d9c2e | ||
|
be260a09c1 | ||
|
0c74e117b8 | ||
|
a32585286a | ||
|
cff1933ec9 | ||
|
4f9af79850 | ||
|
cb0e8937da | ||
|
951f1ed4ed | ||
|
cec32da2b5 | ||
|
fe7b837868 | ||
|
e50672cf37 | ||
|
9540016f6d | ||
|
15fdb838c7 | ||
|
951c8f15d2 | ||
|
655bc825a1 | ||
|
9187e6500c | ||
|
8284dbf61d | ||
|
41219a5a20 | ||
|
b8d1d07ad8 | ||
|
b127cfb18e | ||
|
2ec3579f29 | ||
|
9bb468b3a9 | ||
|
7fcfb72dcd | ||
|
0df7adb680 | ||
|
195494186e | ||
|
3f28a5d97a | ||
|
f360842d48 | ||
|
c2266d7a60 | ||
|
a55f575a03 | ||
|
cb7b78b039 | ||
|
257fbb4e1b | ||
|
344c74a74c | ||
|
7c6d0010b3 | ||
|
3860b5076f | ||
|
58611c8702 | ||
|
4bd8771c2f | ||
|
91a3c28862 | ||
|
6016e2180e | ||
|
492ebc22bc | ||
|
6fe31d1477 | ||
|
ba9504325e | ||
|
0504fa4e90 | ||
|
3af93a39d7 | ||
|
b0fc587a7f | ||
|
50bc0d5a69 | ||
|
26ead385a7 | ||
|
402b967fa9 | ||
|
faba4786c0 | ||
|
febf25d1af | ||
|
6eb7519dba | ||
|
a567f12d76 | ||
|
a569e6a737 | ||
|
900a1cc943 | ||
|
4f2ad720c8 | ||
|
50952c0a5e | ||
|
f423cec11b | ||
|
77d7e60379 | ||
|
ed86ef32b3 | ||
|
cfa64676be | ||
|
f3e0f4249c | ||
|
4564d31c76 | ||
|
20a8eced3b | ||
|
3870217381 | ||
|
5867aff943 | ||
|
4b371e10ee | ||
|
853333cd70 | ||
|
2252927c04 | ||
|
94ef7b3a03 | ||
|
88d43a7ebc | ||
|
fbc7085c14 | ||
|
d2b0328198 | ||
|
7d651ac3b6 | ||
|
a7c4070df7 | ||
|
208e2cf043 | ||
|
867bd2583b | ||
|
9357837d2e | ||
|
7418bd0d79 | ||
|
ade869ea58 | ||
|
0027b6ac79 | ||
|
08f102f14c | ||
|
86593c0999 | ||
|
3aa2b40354 | ||
|
b6995f06b9 | ||
|
bd23216420 | ||
|
a3664ea971 | ||
|
d2892be902 | ||
|
95f013ba80 | ||
|
207bc788e9 | ||
|
cd2804d3ee | ||
|
0698810abb | ||
|
927d321d90 | ||
|
b3b44841f0 | ||
|
c40fd364ce | ||
|
b66ca4f326 | ||
|
4dc1054104 | ||
|
e944623780 | ||
|
042eae4c83 | ||
|
d8f9148d36 | ||
|
3a8073cca2 | ||
|
c7131b01f9 | ||
|
0fbc043183 | ||
|
52da6f71d0 | ||
|
0d8022eced | ||
|
810f1f600d | ||
|
b5e9d933ad | ||
|
38edf255ae | ||
|
24d1a4562b | ||
|
0eb1ddb975 | ||
|
101f32884f | ||
|
956be4ca4b | ||
|
acfe47ba52 | ||
|
c29940ca72 | ||
|
db98a7e28b | ||
|
640c94f90d | ||
|
87fc170cdf | ||
|
8ce4592e15 | ||
|
03e4b8de92 | ||
|
ec984370fb | ||
|
ea544eb48b | ||
|
8c62fa9121 | ||
|
8b15ae8015 | ||
|
00ef791078 | ||
|
e748f435e5 | ||
|
4bab082a27 | ||
|
ba39838ab5 | ||
|
d4c456bdef | ||
|
02c599f52b | ||
|
b98c914053 | ||
|
1688f44185 | ||
|
0991c1d283 | ||
|
2162a0d80c | ||
|
774d5fe9df | ||
|
8cc3144e7b | ||
|
00e39c581a | ||
|
a9fe2bb62e | ||
|
10676b6b85 | ||
|
bcc7ed57a2 | ||
|
33159924b1 | ||
|
faadd460c4 | ||
|
c28ff128d8 | ||
|
f9f1c86716 | ||
|
0e3ccc7396 | ||
|
e56686f1e5 | ||
|
1a3e92a7cc | ||
|
094a0c8ebe | ||
|
41fb880bf0 | ||
|
ef64bef5c3 | ||
|
6ffd2ffc41 | ||
|
9c7897b8d2 | ||
|
a1bc15c8d5 | ||
|
f500435cb4 | ||
|
9e40c58532 | ||
|
60d5688a87 | ||
|
c370d1190d | ||
|
1a2e4b88ee | ||
|
ac150d504e | ||
|
02cee98492 | ||
|
cac1d8ad9f | ||
|
1b3e8614e7 | ||
|
1ed6d2102b | ||
|
bc1e444694 | ||
|
298996df11 | ||
|
635fe02801 | ||
|
8aa8e11ba6 | ||
|
6abf1d7c1a | ||
|
34b8c5908b | ||
|
4fa2241d7b | ||
|
bd8e2d782e | ||
|
293fccf3b0 | ||
|
7bb433b141 | ||
|
d72c0763f9 | ||
|
60e580c2a8 | ||
|
f11c4d6847 | ||
|
d3b9e4e1e8 | ||
|
198900eff4 | ||
|
05edb250ee | ||
|
e3524c90de | ||
|
86ed1cf3b9 | ||
|
d2deb420bc | ||
|
91bf70231a | ||
|
5115db7409 | ||
|
8df9f97cda | ||
|
9366f25136 | ||
|
2af2524db5 | ||
|
6c2cd5210c | ||
|
80adb4ca5c | ||
|
1e23402eb2 | ||
|
5ca7e7cffc | ||
|
c5223be434 | ||
|
2d47cde5d6 | ||
|
c225b722cf | ||
|
1649b2e6b8 | ||
|
cd7e0b04f6 | ||
|
c75e3c45e5 | ||
|
57ef4ad459 | ||
|
17a215523c | ||
|
e4c43a0aa2 | ||
|
9bc497267b | ||
|
2f98c62172 | ||
|
70f57fab6d | ||
|
0d015e9a2c | ||
|
aa117cce42 | ||
|
b3fc28d177 | ||
|
a832e8a5ef | ||
|
d0b0cc75ad | ||
|
c7c7349cb7 | ||
|
3b58103157 | ||
|
f53bddd7d5 | ||
|
ddc8c1a795 | ||
|
2933a03d09 | ||
|
fd896d2476 | ||
|
0918dd2b99 | ||
|
6d69483bbc | ||
|
dfe9360cdf | ||
|
4451ab0b22 | ||
|
24ba24a465 | ||
|
b9d8f22789 | ||
|
55cea93e6c | ||
|
ae984fbd54 | ||
|
97a6f65200 | ||
|
afe73da928 | ||
|
4d6556100f | ||
|
bda8b72f81 | ||
|
666a01d335 | ||
|
5b102d108d | ||
|
525b2fe5c3 | ||
|
70d7c7904e | ||
|
1d3befeaf8 | ||
|
4dbb564619 | ||
|
eec353c443 | ||
|
7699499f25 | ||
|
53bc83cae7 | ||
|
937ac8116e | ||
|
6439e0c1a1 | ||
|
2d5980b406 | ||
|
2e0ed8284b | ||
|
c6539ccef0 | ||
|
54f87d3b59 | ||
|
dba7932000 | ||
|
0564d55e19 | ||
|
4469a32970 | ||
|
806c75652a | ||
|
8b60bbdce4 | ||
|
4bbf6255dd | ||
|
44c251fbc3 | ||
|
b709f15d18 | ||
|
4215a0a159 | ||
|
607e46f209 | ||
|
ac4a84df4d | ||
|
d2e72ee05a | ||
|
f441c63ea4 | ||
|
c712dd84ba | ||
|
c3d27daf8e | ||
|
e017a22fe0 | ||
|
6bbbdb7d7e | ||
|
fb647f69a2 | ||
|
fc9073289f | ||
|
e133764f33 | ||
|
f7aa65db8a | ||
|
7f91301946 | ||
|
7aef75f43d | ||
|
c388dbeba4 | ||
|
4f3be76167 | ||
|
85238132d3 | ||
|
71d3a797f4 | ||
|
fc6c8633dd | ||
|
bcddf36559 | ||
|
df2a0ad28b | ||
|
85d8b225f2 | ||
|
8b01f8923c | ||
|
2874f6f21d | ||
|
ad3b492c1a | ||
|
5f58e9bd0c | ||
|
af7177e77d | ||
|
03b1b6a5c3 | ||
|
6a22a28730 | ||
|
1bcf12402e | ||
|
3dadebf10e | ||
|
0d111976e1 | ||
|
2cf599b310 | ||
|
94c08f27c6 | ||
|
fe58041a61 | ||
|
39149fd5bd | ||
|
0fe295aa9c | ||
|
a3a9d53860 | ||
|
7d2842e670 | ||
|
5b2f014fc7 | ||
|
0c8024920f | ||
|
471f2260d0 | ||
|
af3cd2e7b6 | ||
|
d27a64338e | ||
|
e7f1e3d9dd | ||
|
e45c173f73 | ||
|
18483b024c | ||
|
00d9f98ccc | ||
|
75a811a4f7 | ||
|
cd4eadcc2b | ||
|
3ac9555d8d | ||
|
65df1ef955 | ||
|
cf8cfb30ce | ||
|
fd605bc9a7 | ||
|
1298c8db79 | ||
|
809f992f83 | ||
|
0e09571f21 | ||
|
e8e54ea5de | ||
|
122157eb0e | ||
|
4230292830 | ||
|
67702277e6 | ||
|
384db6ba29 | ||
|
9aa28f1d05 | ||
|
2ebd15b5d7 | ||
|
6b26a9a7f6 | ||
|
f010cabb44 | ||
|
537aea56c6 | ||
|
540424bd76 | ||
|
6fa0b39390 | ||
|
285fec31fc | ||
|
0cfdba262e | ||
|
99599f73e4 | ||
|
3147190f3d | ||
|
c356bb071f | ||
|
3e9cf53ea7 | ||
|
bfc0f346b4 | ||
|
ea190c8bd2 | ||
|
8ebab20fa5 | ||
|
e51a1a38e8 | ||
|
9f0a57a8f4 | ||
|
1402820ed0 | ||
|
48beabdb3f | ||
|
b112341a64 | ||
|
6e5163ba3e | ||
|
299e0b07c9 | ||
|
dd2166ee27 | ||
|
2cda053345 | ||
|
3229e67712 | ||
|
b0b84277fa | ||
|
d2252c5634 | ||
|
2ae191fe6f | ||
|
1b2c1914b2 | ||
|
5b86a8f612 | ||
|
ec0c9c5561 | ||
|
bda55c818c | ||
|
25cce38f50 | ||
|
9c539f92ab | ||
|
5750b7cc19 | ||
|
131c1a159c | ||
|
234c2f3657 | ||
|
d62b2541d7 | ||
|
abdba2235d | ||
|
c7acc6d1f4 | ||
|
9865f042ed | ||
|
ff85f2106c | ||
|
440116a75b | ||
|
1d854cd420 | ||
|
ce4ac17780 | ||
|
c55e551235 | ||
|
fd0467c568 | ||
|
f738675f1d | ||
|
bd7a8fa4bf | ||
|
e8fdd1303c | ||
|
66f242a4a9 | ||
|
a562bf6d3c | ||
|
4460da54a1 | ||
|
d4fedd6775 | ||
|
238b786bfe | ||
|
d04df2a48b | ||
|
97afc16ef2 | ||
|
2a1aa9663b | ||
|
fc1dcab79d | ||
|
677e95010e | ||
|
243839012a | ||
|
e2358e5e3b | ||
|
f828eae3ea | ||
|
01f627a4d7 | ||
|
107239c927 | ||
|
59ce480f96 | ||
|
7342c5ed8c | ||
|
9f7994ed71 | ||
|
708952d84e | ||
|
51faffa238 | ||
|
272c80f67c | ||
|
86548e14bd | ||
|
cff35dfa31 | ||
|
873c8e5011 | ||
|
9597265a12 | ||
|
b1965061af | ||
|
f67e761970 | ||
|
20e2041f14 | ||
|
f8915c8eab | ||
|
fa8663c066 | ||
|
613301ce51 | ||
|
19d43d39fc | ||
|
b1578e32a5 | ||
|
dec4267fb1 | ||
|
e4c539a869 | ||
|
3915f7b144 | ||
|
bc5eb22b71 | ||
|
dede617d9f | ||
|
b2399f5ab5 | ||
|
44e4f17348 | ||
|
3643b505a6 | ||
|
4223b4a3f0 | ||
|
e4e2259646 | ||
|
12744fd1fa | ||
|
b87160013b | ||
|
4649914447 | ||
|
33b2efe318 | ||
|
52bcb4ecd6 | ||
|
f9983ea2ed | ||
|
a6cc636a6b | ||
|
250d020e9b | ||
|
8d4544f2e1 | ||
|
4eadece45f | ||
|
83b894b8f1 | ||
|
a414c5c52d | ||
|
cbf3807ad4 | ||
|
70a78b2fa5 | ||
|
bb3aee447b | ||
|
8c8940430a | ||
|
5158ee903b | ||
|
2badcbb674 | ||
|
e977f04fe2 | ||
|
2a3435274f | ||
|
950693be7f | ||
|
f241318f9c | ||
|
cb786665d4 | ||
|
ed2c822643 | ||
|
1c4098a7d9 | ||
|
baacd81907 | ||
|
218ddd0376 | ||
|
05032b4c06 | ||
|
5d66ae9fb9 | ||
|
6766f35338 | ||
|
054b0b447e | ||
|
9539c488c2 | ||
|
f04b56e178 | ||
|
5edeaf6765 | ||
|
6c11a0c693 | ||
|
a19da1c246 | ||
|
a0d065cd22 | ||
|
c5d07e2c28 | ||
|
2537cccad3 | ||
|
d6f7766172 | ||
|
99afee1832 | ||
|
3da7d68617 | ||
|
4e004176ba | ||
|
37467c13bf | ||
|
e2e5bc906a | ||
|
814443b147 | ||
|
03ea04c32a | ||
|
29fef9aca2 | ||
|
e90d2ac8ba | ||
|
405fefc877 | ||
|
6457f09412 | ||
|
50822aa2ac | ||
|
f81d7cc018 | ||
|
e5ecbd63ce | ||
|
93c3ab4649 | ||
|
4b8da65be9 | ||
|
db8df4a566 | ||
|
cca23e6363 | ||
|
c74dc33604 | ||
|
5cad3652d9 | ||
|
50bfdb1856 | ||
|
393cc28481 | ||
|
56349939e4 | ||
|
224b9b7ba7 | ||
|
f39a73f6e1 | ||
|
b2a0ae13b6 | ||
|
650c67a663 | ||
|
a49f932b61 | ||
|
21695288ec | ||
|
a55dfd3afa | ||
|
457522a836 | ||
|
d7ac5e2e0c | ||
|
fcd1876a21 | ||
|
52371bf5fe | ||
|
97451b2eee | ||
|
7795f00fba | ||
|
e6dd761ca3 | ||
|
fbaab4dcad | ||
|
89575f352a | ||
|
224e702d1f | ||
|
58282fd36f | ||
|
80d6f5a7d0 | ||
|
43622107d7 | ||
|
edb57c96a8 | ||
|
5d7ec0a178 | ||
|
45a1b74335 |
111 changed files with 14176 additions and 7393 deletions
7
.codecov.yml
Normal file
7
.codecov.yml
Normal file
|
@ -0,0 +1,7 @@
|
|||
comment: false
|
||||
coverage:
|
||||
status:
|
||||
project:
|
||||
default:
|
||||
informational: true
|
||||
patch: off
|
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
tests/data/* -text
|
8
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
8
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
name: Bug report
|
||||
about: Create a report if you believe you've found a bug in this project; please use GitHub Discussions instead if you think the bug may be in your code.
|
||||
title: ''
|
||||
labels: bug
|
||||
assignees: ''
|
||||
|
||||
---
|
5
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
5
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: Help and support
|
||||
url: https://github.com/zeux/pugixml/discussions
|
||||
about: Please use GitHub Discussions if you have questions or need help.
|
8
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
8
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: ''
|
||||
labels: enhancement
|
||||
assignees: ''
|
||||
|
||||
---
|
52
.github/workflows/build.yml
vendored
Normal file
52
.github/workflows/build.yml
vendored
Normal file
|
@ -0,0 +1,52 @@
|
|||
name: build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'master'
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
unix:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu, macos]
|
||||
compiler: [g++, clang++]
|
||||
defines: [standard, PUGIXML_WCHAR_MODE, PUGIXML_COMPACT, PUGIXML_NO_EXCEPTIONS]
|
||||
exclude:
|
||||
- os: macos
|
||||
compiler: g++
|
||||
name: ${{matrix.os}} (${{matrix.compiler}}, ${{matrix.defines}})
|
||||
runs-on: ${{matrix.os}}-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: make test
|
||||
run: |
|
||||
export CXX=${{matrix.compiler}}
|
||||
make test cxxstd=c++11 defines=${{matrix.defines}} config=release -j2
|
||||
make test cxxstd=c++98 defines=${{matrix.defines}} config=debug -j2
|
||||
make test defines=${{matrix.defines}} config=sanitize -j2
|
||||
- name: make coverage
|
||||
if: ${{!(matrix.os == 'ubuntu' && matrix.compiler == 'clang++')}} # linux/clang produces coverage info gcov can't parse
|
||||
run: |
|
||||
export CXX=${{matrix.compiler}}
|
||||
make test defines=${{matrix.defines}} config=coverage -j2
|
||||
bash <(curl -s https://codecov.io/bash) -f pugixml.cpp.gcov -X search -t ${{secrets.CODECOV_TOKEN}} -B ${{github.ref}}
|
||||
|
||||
windows:
|
||||
runs-on: windows-latest
|
||||
strategy:
|
||||
matrix:
|
||||
arch: [Win32, x64]
|
||||
defines: [standard, PUGIXML_WCHAR_MODE, PUGIXML_COMPACT, PUGIXML_NO_EXCEPTIONS]
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: cmake configure
|
||||
run: cmake . -DPUGIXML_BUILD_TESTS=ON -D${{matrix.defines}}=ON -A ${{matrix.arch}}
|
||||
- name: cmake test
|
||||
shell: bash # necessary for fail-fast
|
||||
run: |
|
||||
cmake --build . -- -property:Configuration=Debug -verbosity:minimal
|
||||
Debug/pugixml-check.exe
|
||||
cmake --build . -- -property:Configuration=Release -verbosity:minimal
|
||||
Release/pugixml-check.exe
|
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
/build/
|
||||
/.vscode/
|
|
@ -1,8 +0,0 @@
|
|||
language: cpp
|
||||
compiler:
|
||||
- clang
|
||||
- gcc
|
||||
env:
|
||||
- DEFINES=standard
|
||||
- DEFINES=PUGIXML_WCHAR_MODE
|
||||
script: make test defines=$DEFINES -j2
|
263
CMakeLists.txt
Normal file
263
CMakeLists.txt
Normal file
|
@ -0,0 +1,263 @@
|
|||
cmake_minimum_required(VERSION 3.4)
|
||||
project(pugixml VERSION 1.13 LANGUAGES CXX)
|
||||
|
||||
include(CMakePackageConfigHelpers)
|
||||
include(CMakeDependentOption)
|
||||
include(GNUInstallDirs)
|
||||
include(CTest)
|
||||
|
||||
cmake_dependent_option(PUGIXML_USE_VERSIONED_LIBDIR
|
||||
"Use a private subdirectory to install the headers and libraries" OFF
|
||||
"CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR" OFF)
|
||||
|
||||
cmake_dependent_option(PUGIXML_USE_POSTFIX
|
||||
"Use separate postfix for each configuration to make sure you can install multiple build outputs" OFF
|
||||
"CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR" OFF)
|
||||
|
||||
cmake_dependent_option(PUGIXML_STATIC_CRT
|
||||
"Use static MSVC RT libraries" OFF
|
||||
"MSVC" OFF)
|
||||
|
||||
cmake_dependent_option(PUGIXML_BUILD_TESTS
|
||||
"Build pugixml tests" OFF
|
||||
"BUILD_TESTING;CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR" OFF)
|
||||
|
||||
# Custom build defines
|
||||
set(PUGIXML_BUILD_DEFINES CACHE STRING "Build defines for custom options")
|
||||
separate_arguments(PUGIXML_BUILD_DEFINES)
|
||||
|
||||
# Technically not needed for this file. This is builtin CMAKE global variable.
|
||||
option(BUILD_SHARED_LIBS "Build shared instead of static library" OFF)
|
||||
|
||||
# Expose option to build PUGIXML as static as well when the global BUILD_SHARED_LIBS variable is set
|
||||
cmake_dependent_option(PUGIXML_BUILD_SHARED_AND_STATIC_LIBS
|
||||
"Build both shared and static libraries" OFF
|
||||
"BUILD_SHARED_LIBS" OFF)
|
||||
|
||||
# Expose options from the pugiconfig.hpp
|
||||
option(PUGIXML_WCHAR_MODE "Enable wchar_t mode" OFF)
|
||||
option(PUGIXML_COMPACT "Enable compact mode" OFF)
|
||||
|
||||
# Advanced options from pugiconfig.hpp
|
||||
option(PUGIXML_NO_XPATH "Disable XPath" OFF)
|
||||
option(PUGIXML_NO_STL "Disable STL" OFF)
|
||||
option(PUGIXML_NO_EXCEPTIONS "Disable Exceptions" OFF)
|
||||
mark_as_advanced(PUGIXML_NO_XPATH PUGIXML_NO_STL PUGIXML_NO_EXCEPTIONS)
|
||||
|
||||
# Policy configuration
|
||||
if(POLICY CMP0091)
|
||||
cmake_policy(SET CMP0091 NEW) # Enables use of MSVC_RUNTIME_LIBRARY
|
||||
endif()
|
||||
|
||||
set(PUGIXML_PUBLIC_DEFINITIONS
|
||||
$<$<BOOL:${PUGIXML_WCHAR_MODE}>:PUGIXML_WCHAR_MODE>
|
||||
$<$<BOOL:${PUGIXML_COMPACT}>:PUGIXML_COMPACT>
|
||||
$<$<BOOL:${PUGIXML_NO_XPATH}>:PUGIXML_NO_XPATH>
|
||||
$<$<BOOL:${PUGIXML_NO_STL}>:PUGIXML_NO_STL>
|
||||
$<$<BOOL:${PUGIXML_NO_EXCEPTIONS}>:PUGIXML_NO_EXCEPTIONS>)
|
||||
|
||||
# This is used to backport a CMake 3.15 feature, but is also forwards compatible
|
||||
if (NOT DEFINED CMAKE_MSVC_RUNTIME_LIBRARY)
|
||||
set(CMAKE_MSVC_RUNTIME_LIBRARY
|
||||
MultiThreaded$<$<CONFIG:Debug>:Debug>$<$<NOT:$<BOOL:${PUGIXML_STATIC_CRT}>>:DLL>)
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED CMAKE_CXX_STANDARD_REQUIRED)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED CMAKE_CXX_STANDARD)
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
endif()
|
||||
|
||||
if (PUGIXML_USE_POSTFIX)
|
||||
set(CMAKE_RELWITHDEBINFO_POSTFIX _r)
|
||||
set(CMAKE_MINSIZEREL_POSTFIX _m)
|
||||
set(CMAKE_DEBUG_POSTFIX _d)
|
||||
endif()
|
||||
|
||||
if (CMAKE_VERSION VERSION_LESS 3.15)
|
||||
set(msvc-rt $<TARGET_PROPERTY:MSVC_RUNTIME_LIBRARY>)
|
||||
|
||||
set(msvc-rt-mtd-shared $<STREQUAL:${msvc-rt},MultiThreadedDebugDLL>)
|
||||
set(msvc-rt-mtd-static $<STREQUAL:${msvc-rt},MultiThreadedDebug>)
|
||||
set(msvc-rt-mt-shared $<STREQUAL:${msvc-rt},MultiThreadedDLL>)
|
||||
set(msvc-rt-mt-static $<STREQUAL:${msvc-rt},MultiThreaded>)
|
||||
unset(msvc-rt)
|
||||
|
||||
set(msvc-rt-mtd-shared $<${msvc-rt-mtd-shared}:-MDd>)
|
||||
set(msvc-rt-mtd-static $<${msvc-rt-mtd-static}:-MTd>)
|
||||
set(msvc-rt-mt-shared $<${msvc-rt-mt-shared}:-MD>)
|
||||
set(msvc-rt-mt-static $<${msvc-rt-mt-static}:-MT>)
|
||||
endif()
|
||||
|
||||
set(versioned-dir $<$<BOOL:${PUGIXML_USE_VERSIONED_LIBDIR}>:/pugixml-${PROJECT_VERSION}>)
|
||||
|
||||
set(libs)
|
||||
|
||||
if (BUILD_SHARED_LIBS)
|
||||
add_library(pugixml-shared SHARED
|
||||
${PROJECT_SOURCE_DIR}/scripts/pugixml_dll.rc
|
||||
${PROJECT_SOURCE_DIR}/src/pugixml.cpp)
|
||||
add_library(pugixml::shared ALIAS pugixml-shared)
|
||||
list(APPEND libs pugixml-shared)
|
||||
string(CONCAT pugixml.msvc $<OR:
|
||||
$<STREQUAL:${CMAKE_CXX_COMPILER_FRONTEND_VARIANT},MSVC>,
|
||||
$<CXX_COMPILER_ID:MSVC>
|
||||
>)
|
||||
|
||||
set_property(TARGET pugixml-shared PROPERTY EXPORT_NAME shared)
|
||||
target_include_directories(pugixml-shared
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src>)
|
||||
target_compile_definitions(pugixml-shared
|
||||
PUBLIC
|
||||
${PUGIXML_BUILD_DEFINES}
|
||||
${PUGIXML_PUBLIC_DEFINITIONS}
|
||||
PRIVATE
|
||||
PUGIXML_API=$<IF:${pugixml.msvc},__declspec\(dllexport\),__attribute__\(\(visibility\("default"\)\)\)>
|
||||
)
|
||||
target_compile_options(pugixml-shared
|
||||
PRIVATE
|
||||
${msvc-rt-mtd-shared}
|
||||
${msvc-rt-mtd-static}
|
||||
${msvc-rt-mt-shared}
|
||||
${msvc-rt-mt-static})
|
||||
endif()
|
||||
|
||||
if (NOT BUILD_SHARED_LIBS OR PUGIXML_BUILD_SHARED_AND_STATIC_LIBS)
|
||||
add_library(pugixml-static STATIC
|
||||
${PROJECT_SOURCE_DIR}/src/pugixml.cpp)
|
||||
add_library(pugixml::static ALIAS pugixml-static)
|
||||
list(APPEND libs pugixml-static)
|
||||
|
||||
set_property(TARGET pugixml-static PROPERTY EXPORT_NAME static)
|
||||
target_include_directories(pugixml-static
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src>)
|
||||
target_compile_definitions(pugixml-static
|
||||
PUBLIC
|
||||
${PUGIXML_BUILD_DEFINES}
|
||||
${PUGIXML_PUBLIC_DEFINITIONS})
|
||||
target_compile_options(pugixml-static
|
||||
PRIVATE
|
||||
${msvc-rt-mtd-shared}
|
||||
${msvc-rt-mtd-static}
|
||||
${msvc-rt-mt-shared}
|
||||
${msvc-rt-mt-static})
|
||||
endif()
|
||||
|
||||
if (BUILD_SHARED_LIBS)
|
||||
set(pugixml-alias pugixml-shared)
|
||||
else()
|
||||
set(pugixml-alias pugixml-static)
|
||||
endif()
|
||||
add_library(pugixml INTERFACE)
|
||||
target_link_libraries(pugixml INTERFACE ${pugixml-alias})
|
||||
add_library(pugixml::pugixml ALIAS pugixml)
|
||||
|
||||
set_target_properties(${libs}
|
||||
PROPERTIES
|
||||
MSVC_RUNTIME_LIBRARY ${CMAKE_MSVC_RUNTIME_LIBRARY}
|
||||
EXCLUDE_FROM_ALL ON
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
SOVERSION ${PROJECT_VERSION_MAJOR}
|
||||
VERSION ${PROJECT_VERSION}
|
||||
OUTPUT_NAME pugixml)
|
||||
|
||||
set_target_properties(${libs}
|
||||
PROPERTIES
|
||||
EXCLUDE_FROM_ALL OFF)
|
||||
set(install-targets pugixml ${libs})
|
||||
|
||||
configure_package_config_file(
|
||||
"${PROJECT_SOURCE_DIR}/scripts/pugixml-config.cmake.in"
|
||||
"${PROJECT_BINARY_DIR}/pugixml-config.cmake"
|
||||
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
NO_CHECK_REQUIRED_COMPONENTS_MACRO
|
||||
NO_SET_AND_CHECK_MACRO)
|
||||
|
||||
write_basic_package_version_file(
|
||||
"${PROJECT_BINARY_DIR}/pugixml-config-version.cmake"
|
||||
COMPATIBILITY SameMajorVersion)
|
||||
|
||||
if (PUGIXML_USE_POSTFIX)
|
||||
if(CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)
|
||||
set(LIB_POSTFIX ${CMAKE_RELWITHDEBINFO_POSTFIX})
|
||||
elseif(CMAKE_BUILD_TYPE MATCHES MinSizeRel)
|
||||
set(LIB_POSTFIX ${CMAKE_MINSIZEREL_POSTFIX})
|
||||
elseif(CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
set(LIB_POSTFIX ${CMAKE_DEBUG_POSTFIX})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
configure_file(scripts/pugixml.pc.in pugixml.pc @ONLY)
|
||||
|
||||
if (NOT DEFINED PUGIXML_RUNTIME_COMPONENT)
|
||||
set(PUGIXML_RUNTIME_COMPONENT Runtime)
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED PUGIXML_LIBRARY_COMPONENT)
|
||||
set(PUGIXML_LIBRARY_COMPONENT Library)
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED PUGIXML_DEVELOPMENT_COMPONENT)
|
||||
set(PUGIXML_DEVELOPMENT_COMPONENT Development)
|
||||
endif()
|
||||
|
||||
set(namelink-component)
|
||||
if (NOT CMAKE_VERSION VERSION_LESS 3.12)
|
||||
set(namelink-component NAMELINK_COMPONENT ${PUGIXML_DEVELOPMENT_COMPONENT})
|
||||
endif()
|
||||
install(TARGETS ${install-targets}
|
||||
EXPORT pugixml-targets
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT ${PUGIXML_RUNTIME_COMPONENT}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT ${PUGIXML_LIBRARY_COMPONENT} ${namelink-component}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT ${PUGIXML_DEVELOPMENT_COMPONENT}
|
||||
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}${versioned-dir})
|
||||
|
||||
install(EXPORT pugixml-targets
|
||||
NAMESPACE pugixml::
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/pugixml COMPONENT ${PUGIXML_DEVELOPMENT_COMPONENT})
|
||||
|
||||
export(EXPORT pugixml-targets
|
||||
NAMESPACE pugixml::)
|
||||
|
||||
install(FILES
|
||||
"${PROJECT_BINARY_DIR}/pugixml-config-version.cmake"
|
||||
"${PROJECT_BINARY_DIR}/pugixml-config.cmake"
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/pugixml COMPONENT ${PUGIXML_DEVELOPMENT_COMPONENT})
|
||||
|
||||
install(FILES ${PROJECT_BINARY_DIR}/pugixml.pc
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig COMPONENT ${PUGIXML_DEVELOPMENT_COMPONENT})
|
||||
|
||||
install(
|
||||
FILES
|
||||
"${PROJECT_SOURCE_DIR}/src/pugiconfig.hpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/pugixml.hpp"
|
||||
DESTINATION
|
||||
${CMAKE_INSTALL_INCLUDEDIR}${versioned-dir} COMPONENT ${PUGIXML_DEVELOPMENT_COMPONENT})
|
||||
|
||||
if (PUGIXML_BUILD_TESTS)
|
||||
set(fuzz-pattern "tests/fuzz_*.cpp")
|
||||
set(test-pattern "tests/*.cpp")
|
||||
if (CMAKE_VERSION VERSION_GREATER 3.11)
|
||||
list(INSERT fuzz-pattern 0 CONFIGURE_DEPENDS)
|
||||
list(INSERT test-pattern 0 CONFIGURE_DEPENDS)
|
||||
endif()
|
||||
file(GLOB test-sources ${test-pattern})
|
||||
file(GLOB fuzz-sources ${fuzz-pattern})
|
||||
list(REMOVE_ITEM test-sources ${fuzz-sources})
|
||||
|
||||
add_custom_target(check
|
||||
COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure)
|
||||
|
||||
add_executable(pugixml-check ${test-sources})
|
||||
add_test(NAME pugixml::test
|
||||
COMMAND pugixml-check
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
|
||||
add_dependencies(check pugixml-check)
|
||||
target_link_libraries(pugixml-check
|
||||
PRIVATE
|
||||
pugixml::pugixml)
|
||||
endif()
|
169
Jamfile.jam
169
Jamfile.jam
|
@ -1,169 +0,0 @@
|
|||
# Latest jamplus is needed to use this
|
||||
|
||||
# Targets:
|
||||
# pugixml - build pugixml library
|
||||
# tests - build pugixml test suite
|
||||
# run_tests - run pugixml test suite
|
||||
# coverage - get test suite coverage
|
||||
|
||||
# Options:
|
||||
# toolset=name - select toolset
|
||||
# supported toolsets: mingw*, msvc*
|
||||
|
||||
# default toolset/configuration
|
||||
if ( ! $(toolset) )
|
||||
{
|
||||
if ( $(OS) = SOLARIS )
|
||||
{
|
||||
toolset = suncc ;
|
||||
}
|
||||
else if ( $(UNIX) )
|
||||
{
|
||||
local GCCVERSION = [ Subst [ Shell "gcc -dumpversion" ] : $(NEWLINE) ] ;
|
||||
toolset = "gcc"$(GCCVERSION) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
toolset = msvc ;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! $(configuration) )
|
||||
{
|
||||
configuration = "debug" ;
|
||||
}
|
||||
|
||||
if ( ! $(defines) )
|
||||
{
|
||||
defines = "PUGIXML_STANDARD" ;
|
||||
}
|
||||
|
||||
# coverage options
|
||||
if ( $(toolset:I=^mingw) || $(toolset:I=^gcc) )
|
||||
{
|
||||
CCFLAGS = -fprofile-arcs -ftest-coverage ;
|
||||
LDFLAGS = -fprofile-arcs ;
|
||||
|
||||
if $(fullcoverage)
|
||||
{
|
||||
GCOVFLAGS = --branch-probabilities --function-summaries ;
|
||||
}
|
||||
else
|
||||
{
|
||||
GCOVFLAGS = --no-output ;
|
||||
}
|
||||
}
|
||||
|
||||
# build folder
|
||||
BUILD = build ;
|
||||
|
||||
# enable dependency cache
|
||||
DEPCACHE.standard = $(BUILD)/.depcache ;
|
||||
|
||||
# rules
|
||||
include "Jamrules.jam" ;
|
||||
|
||||
# split define sets into list
|
||||
local DEFINESETS = [ Split $(defines) : ':' ] ;
|
||||
|
||||
# split configurations into list
|
||||
local CONFIGURATIONS = [ Split $(configuration) : ',' ] ;
|
||||
|
||||
for CONFIG in $(CONFIGURATIONS)
|
||||
{
|
||||
for DEFINESET in $(DEFINESETS)
|
||||
{
|
||||
local DEFINES = [ Split $(DEFINESET) : ',' ] ;
|
||||
|
||||
# build folder
|
||||
local CFGBUILD = $(BUILD)/$(toolset)/$(DEFINES:J=_)/$(CONFIG) ;
|
||||
|
||||
# compilation options
|
||||
local CFGFLAGS = $(CCFLAGS) [ GetCFlags $(CONFIG) : $(DEFINES) ] ;
|
||||
|
||||
# build library
|
||||
local PUGIXML = $(CFGBUILD)/pugixml.lib ;
|
||||
Library $(PUGIXML) : src/pugixml.cpp : $(CFGFLAGS) ;
|
||||
Alias pugixml : $(PUGIXML) ;
|
||||
|
||||
# build tests
|
||||
local TESTS = $(CFGBUILD)/tests.exe ;
|
||||
local TEST_SOURCES = [ Glob tests : *.cpp ] ;
|
||||
TEST_SOURCES -= [ Glob tests : fuzz_*.cpp ] ;
|
||||
Application $(TESTS) : $(TEST_SOURCES) : $(CFGFLAGS) : $(PUGIXML) ;
|
||||
Alias tests : $(TESTS) ;
|
||||
|
||||
# run tests
|
||||
Test $(TESTS)_run : $(TESTS) ;
|
||||
Alias run_tests : $(TESTS)_run ;
|
||||
|
||||
# gather coverage
|
||||
Coverage $(TESTS)_coverage : $(PUGIXML) ;
|
||||
Alias coverage : $(TESTS)_coverage ;
|
||||
|
||||
GCOVFLAGS on $(TESTS)_coverage = $(GCOVFLAGS) -o $(CFGBUILD)/src ; # because stupid gcov can't find files via relative paths
|
||||
|
||||
# add special autotest markers to build log
|
||||
if $(autotest)
|
||||
{
|
||||
COVPREFIX on $(TESTS)_coverage = "... autotest $(CONFIG) [$(DEFINESET)]" ;
|
||||
}
|
||||
|
||||
# gather coverage after tests run
|
||||
Depends $(TESTS)_coverage : $(TESTS)_run ;
|
||||
}
|
||||
}
|
||||
|
||||
# documentation
|
||||
Documentation docs/manual.html : docs/manual.qbk : docs/manual.xsl ;
|
||||
Documentation docs/quickstart.html : docs/quickstart.qbk : docs/quickstart.xsl ;
|
||||
|
||||
Alias docs : docs/manual.html docs/quickstart.html ;
|
||||
|
||||
# samples
|
||||
for SAMPLE in [ Glob docs/samples : *.cpp ]
|
||||
{
|
||||
local CONFIG = "debug" ;
|
||||
local DEFINES = "PUGIXML_STANDARD" ;
|
||||
|
||||
# build folder
|
||||
local CFGBUILD = $(BUILD)/$(toolset)/$(DEFINES:J=_)/$(CONFIG) ;
|
||||
|
||||
# compilation options
|
||||
local CFGFLAGS = $(CCFLAGS) [ GetCFlags $(CONFIG) : $(DEFINES) ] ;
|
||||
CFGFLAGS += -I src ;
|
||||
|
||||
# build and run sample
|
||||
local EXECUTABLE = $(CFGBUILD)/samples/$(SAMPLE:B).exe ;
|
||||
local PUGIXML = $(CFGBUILD)/pugixml.lib ;
|
||||
|
||||
Application $(EXECUTABLE) : $(SAMPLE) : $(CFGFLAGS) : $(PUGIXML) ;
|
||||
|
||||
RunSampleAction $(EXECUTABLE)_run : $(EXECUTABLE) ;
|
||||
Depends $(EXECUTABLE)_run : $(EXECUTABLE) ;
|
||||
|
||||
Depends samples : $(EXECUTABLE)_run ;
|
||||
}
|
||||
|
||||
# release
|
||||
VERSION = 1.6 ;
|
||||
RELEASE_FILES =
|
||||
[ Glob contrib : *.cpp *.hpp ]
|
||||
[ Glob src : *.cpp *.hpp ]
|
||||
[ Glob docs : *.html *.css ]
|
||||
[ Glob docs/samples : *.cpp *.hpp *.xml ]
|
||||
[ Glob docs/images : *.png ]
|
||||
[ Glob docs/manual : *.html ]
|
||||
@("scripts/**":W=:X=svn)
|
||||
readme.txt
|
||||
;
|
||||
|
||||
actions ArchiveAction
|
||||
{
|
||||
perl tests/archive.pl $(<) $(>)
|
||||
}
|
||||
|
||||
ArchiveAction pugixml-$(VERSION).zip : $(RELEASE_FILES) ;
|
||||
ArchiveAction pugixml-$(VERSION).tar.gz : $(RELEASE_FILES) ;
|
||||
Depends release : pugixml-$(VERSION).zip pugixml-$(VERSION).tar.gz : $(RELEASE_FILES) ;
|
||||
NotFile release ;
|
1032
Jamrules.jam
1032
Jamrules.jam
File diff suppressed because it is too large
Load diff
24
LICENSE.md
Normal file
24
LICENSE.md
Normal file
|
@ -0,0 +1,24 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2006-2022 Arseny Kapoulkine
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
51
Makefile
51
Makefile
|
@ -3,16 +3,18 @@ MAKEFLAGS+=-r
|
|||
|
||||
config=debug
|
||||
defines=standard
|
||||
cxxstd=c++11
|
||||
# set cxxstd=any to disable use of -std=...
|
||||
|
||||
BUILD=build/make-$(CXX)-$(config)-$(defines)
|
||||
BUILD=build/make-$(CXX)-$(config)-$(defines)-$(cxxstd)
|
||||
|
||||
SOURCES=src/pugixml.cpp $(filter-out tests/fuzz_%,$(wildcard tests/*.cpp))
|
||||
EXECUTABLE=$(BUILD)/test
|
||||
|
||||
VERSION=$(shell sed -n 's/.*version \(.*\).*/\1/p' src/pugiconfig.hpp)
|
||||
RELEASE=$(shell git ls-files src docs/*.html docs/*.css docs/samples docs/images scripts contrib readme.txt)
|
||||
RELEASE=$(filter-out scripts/archive.py docs/%.adoc,$(shell git ls-files docs scripts src CMakeLists.txt LICENSE.md readme.txt))
|
||||
|
||||
CXXFLAGS=-g -Wall -Wextra -Werror -pedantic
|
||||
CXXFLAGS=-g -Wall -Wextra -Werror -pedantic -Wundef -Wshadow -Wcast-align -Wcast-qual -Wold-style-cast -Wdouble-promotion
|
||||
LDFLAGS=
|
||||
|
||||
ifeq ($(config),release)
|
||||
|
@ -20,9 +22,17 @@ ifeq ($(config),release)
|
|||
endif
|
||||
|
||||
ifeq ($(config),coverage)
|
||||
CXXFLAGS+=-DNDEBUG
|
||||
CXXFLAGS+=-fprofile-arcs -ftest-coverage
|
||||
LDFLAGS+=-fprofile-arcs
|
||||
CXXFLAGS+=-coverage
|
||||
LDFLAGS+=-coverage
|
||||
endif
|
||||
|
||||
ifeq ($(config),sanitize)
|
||||
CXXFLAGS+=-fsanitize=address,undefined -fno-sanitize=float-divide-by-zero,float-cast-overflow -fno-sanitize-recover=all
|
||||
LDFLAGS+=-fsanitize=address,undefined
|
||||
endif
|
||||
|
||||
ifeq ($(config),analyze)
|
||||
CXXFLAGS+=--analyze
|
||||
endif
|
||||
|
||||
ifneq ($(defines),standard)
|
||||
|
@ -30,25 +40,33 @@ ifneq ($(defines),standard)
|
|||
CXXFLAGS+=-D $(subst $(COMMA), -D ,$(defines))
|
||||
endif
|
||||
|
||||
ifneq ($(findstring PUGIXML_NO_EXCEPTIONS,$(defines)),)
|
||||
CXXFLAGS+=-fno-exceptions
|
||||
endif
|
||||
|
||||
ifneq ($(cxxstd),any)
|
||||
CXXFLAGS+=-std=$(cxxstd)
|
||||
endif
|
||||
|
||||
OBJECTS=$(SOURCES:%=$(BUILD)/%.o)
|
||||
|
||||
all: $(EXECUTABLE)
|
||||
|
||||
ifeq ($(config),coverage)
|
||||
test: $(EXECUTABLE)
|
||||
-@find $(BUILD) -name '*.gcda' | xargs rm
|
||||
-@find $(BUILD) -name '*.gcda' -exec rm {} +
|
||||
./$(EXECUTABLE)
|
||||
@gcov -b -c $(BUILD)/src/pugixml.cpp.gcda | sed -e '/./{H;$!d;}' -e 'x;/pugixml.cpp/!d;'
|
||||
@ls *.gcov | grep -v pugixml.cpp.gcov | xargs rm
|
||||
@gcov -b -o $(BUILD)/src/ pugixml.cpp.gcda | sed -e '/./{H;$!d;}' -e 'x;/pugixml.cpp/!d;'
|
||||
@find . -name '*.gcov' -and -not -name 'pugixml.cpp.gcov' -exec rm {} +
|
||||
@sed -i -e "s/#####\(.*\)\(\/\/ unreachable.*\)/ 1\1\2/" pugixml.cpp.gcov
|
||||
else
|
||||
test: $(EXECUTABLE)
|
||||
./$(EXECUTABLE)
|
||||
endif
|
||||
|
||||
fuzz:
|
||||
@mkdir -p $(BUILD)
|
||||
$(AFL)/afl-clang++ tests/fuzz_parse.cpp tests/allocator.cpp src/pugixml.cpp $(CXXFLAGS) -o $(BUILD)/fuzz_parse
|
||||
$(AFL)/afl-fuzz -i tests/data_fuzz_parse -o $(BUILD)/fuzz_parse_out -x $(AFL)/testcases/_extras/xml/ -- $(BUILD)/fuzz_parse @@
|
||||
fuzz_%: $(BUILD)/fuzz_%
|
||||
@mkdir -p build/$@
|
||||
$< build/$@ tests/data_fuzz_$* -max_len=1024 -dict=tests/fuzz_$*.dict
|
||||
|
||||
clean:
|
||||
rm -rf $(BUILD)
|
||||
|
@ -58,11 +76,16 @@ release: build/pugixml-$(VERSION).tar.gz build/pugixml-$(VERSION).zip
|
|||
docs: docs/quickstart.html docs/manual.html
|
||||
|
||||
build/pugixml-%: .FORCE | $(RELEASE)
|
||||
perl tests/archive.pl $@ $|
|
||||
@mkdir -p $(BUILD)
|
||||
TIMESTAMP=`git show v$(VERSION) -s --format=%ct` && python3 scripts/archive.py $@ pugixml-$(VERSION) $$TIMESTAMP $|
|
||||
|
||||
$(EXECUTABLE): $(OBJECTS)
|
||||
$(CXX) $(OBJECTS) $(LDFLAGS) -o $@
|
||||
|
||||
$(BUILD)/fuzz_%: tests/fuzz_%.cpp src/pugixml.cpp
|
||||
@mkdir -p $(BUILD)
|
||||
$(CXX) $(CXXFLAGS) -fsanitize=address,fuzzer $^ -o $@
|
||||
|
||||
$(BUILD)/%.o: %
|
||||
@mkdir -p $(dir $@)
|
||||
$(CXX) $< $(CXXFLAGS) -c -MMD -MP -o $@
|
||||
|
|
80
README.md
80
README.md
|
@ -1,4 +1,4 @@
|
|||
pugixml [](https://travis-ci.org/zeux/pugixml)
|
||||
pugixml [](https://github.com/zeux/pugixml/actions) [](https://ci.appveyor.com/project/zeux/pugixml) [](https://codecov.io/github/zeux/pugixml?branch=master) 
|
||||
=======
|
||||
|
||||
pugixml is a C++ XML processing library, which consists of a DOM-like interface with rich traversal/modification
|
||||
|
@ -12,33 +12,61 @@ pugixml is used by a lot of projects, both open-source and proprietary, for perf
|
|||
|
||||
Documentation for the current release of pugixml is available on-line as two separate documents:
|
||||
|
||||
* [Quick-start guide](http://cdn.rawgit.com/zeux/pugixml/v1.5/docs/quickstart.html), that aims to provide enough information to start using the library;
|
||||
* [Complete reference manual](http://cdn.rawgit.com/zeux/pugixml/v1.5/docs/manual.html), that describes all features of the library in detail.
|
||||
* [Quick-start guide](https://pugixml.org/docs/quickstart.html), that aims to provide enough information to start using the library;
|
||||
* [Complete reference manual](https://pugixml.org/docs/manual.html), that describes all features of the library in detail.
|
||||
|
||||
You’re advised to start with the quick-start guide; however, many important library features are either not described in it at all or only mentioned briefly; if you require more information you should read the complete manual.
|
||||
|
||||
## Example
|
||||
|
||||
Here's an example of how code using pugixml looks; it opens an XML file, goes over all Tool nodes and prints tools that have a Timeout attribute greater than 0:
|
||||
|
||||
```c++
|
||||
#include "pugixml.hpp"
|
||||
#include <iostream>
|
||||
|
||||
int main()
|
||||
{
|
||||
pugi::xml_document doc;
|
||||
pugi::xml_parse_result result = doc.load_file("xgconsole.xml");
|
||||
if (!result)
|
||||
return -1;
|
||||
|
||||
for (pugi::xml_node tool: doc.child("Profile").child("Tools").children("Tool"))
|
||||
{
|
||||
int timeout = tool.attribute("Timeout").as_int();
|
||||
|
||||
if (timeout > 0)
|
||||
std::cout << "Tool " << tool.attribute("Filename").value() << " has timeout " << timeout << "\n";
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
And the same example using XPath:
|
||||
|
||||
```c++
|
||||
#include "pugixml.hpp"
|
||||
#include <iostream>
|
||||
|
||||
int main()
|
||||
{
|
||||
pugi::xml_document doc;
|
||||
pugi::xml_parse_result result = doc.load_file("xgconsole.xml");
|
||||
if (!result)
|
||||
return -1;
|
||||
|
||||
pugi::xpath_node_set tools_with_timeout = doc.select_nodes("/Profile/Tools/Tool[@Timeout > 0]");
|
||||
|
||||
for (pugi::xpath_node node: tools_with_timeout)
|
||||
{
|
||||
pugi::xml_node tool = node.node();
|
||||
std::cout << "Tool " << tool.attribute("Filename").value() <<
|
||||
" has timeout " << tool.attribute("Timeout").as_int() << "\n";
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## License
|
||||
This library is available to anybody free of charge, under the terms of MIT License:
|
||||
|
||||
Copyright (c) 2006-2015 Arseny Kapoulkine
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
This library is available to anybody free of charge, under the terms of MIT License (see LICENSE.md).
|
||||
|
|
9
SECURITY.md
Normal file
9
SECURITY.md
Normal file
|
@ -0,0 +1,9 @@
|
|||
# Security Policy
|
||||
|
||||
## Supported Versions
|
||||
|
||||
Please verify that the vulnerabilities reported can be reproduced on the [latest released version](https://github.com/zeux/pugixml/releases).
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
Vulnerabilities can be reported via e-mail to the [project maintainer](https://github.com/zeux).
|
25
appveyor.yml
Normal file
25
appveyor.yml
Normal file
|
@ -0,0 +1,25 @@
|
|||
image:
|
||||
- Visual Studio 2022
|
||||
- Visual Studio 2019
|
||||
- Visual Studio 2017
|
||||
- Visual Studio 2015
|
||||
|
||||
version: "{branch}-{build}"
|
||||
|
||||
build_script:
|
||||
- ps: if ($env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2013") { .\scripts\nuget_build.ps1 2013}
|
||||
- ps: if ($env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2015") { .\scripts\nuget_build.ps1 2015}
|
||||
- ps: if ($env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2017") { .\scripts\nuget_build.ps1 2017}
|
||||
- ps: if ($env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2019") { .\scripts\nuget_build.ps1 2019}
|
||||
- ps: if ($env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2022") { .\scripts\nuget_build.ps1 2022}
|
||||
|
||||
test_script:
|
||||
- ps: if ($env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2015") { .\tests\autotest-appveyor.ps1 9 10 11 12 14 }
|
||||
- ps: if ($env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2017") { .\tests\autotest-appveyor.ps1 15 }
|
||||
- ps: if ($env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2019") { .\tests\autotest-appveyor.ps1 19 }
|
||||
- ps: if ($env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2022") { .\tests\autotest-appveyor.ps1 22 }
|
||||
- ps: if ($env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2015") { & C:\cygwin\bin\bash.exe -c "PATH=/usr/bin:/usr/local/bin:$PATH; make config=coverage test && bash <(curl -s https://codecov.io/bash) -f pugixml.cpp.gcov 2>&1" }
|
||||
- ps: if ($env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2015") { & C:\cygwin\bin\bash.exe -c "PATH=/usr/bin:/usr/local/bin:$PATH; make config=coverage defines=PUGIXML_WCHAR_MODE test && bash <(curl -s https://codecov.io/bash) -f pugixml.cpp.gcov 2>&1" }
|
||||
|
||||
artifacts:
|
||||
- path: .\scripts\*.nupkg
|
|
@ -1,63 +0,0 @@
|
|||
/*
|
||||
* Boost.Foreach support for pugixml classes.
|
||||
* This file is provided to the public domain.
|
||||
* Written by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
|
||||
*/
|
||||
|
||||
#ifndef HEADER_PUGIXML_FOREACH_HPP
|
||||
#define HEADER_PUGIXML_FOREACH_HPP
|
||||
|
||||
#include <boost/range/iterator.hpp>
|
||||
|
||||
#include "pugixml.hpp"
|
||||
|
||||
/*
|
||||
* These types add support for BOOST_FOREACH macro to xml_node and xml_document classes (child iteration only).
|
||||
* Example usage:
|
||||
* BOOST_FOREACH(xml_node n, doc) {}
|
||||
*/
|
||||
|
||||
namespace boost
|
||||
{
|
||||
template<> struct range_mutable_iterator<pugi::xml_node>
|
||||
{
|
||||
typedef pugi::xml_node::iterator type;
|
||||
};
|
||||
|
||||
template<> struct range_const_iterator<pugi::xml_node>
|
||||
{
|
||||
typedef pugi::xml_node::iterator type;
|
||||
};
|
||||
|
||||
template<> struct range_mutable_iterator<pugi::xml_document>
|
||||
{
|
||||
typedef pugi::xml_document::iterator type;
|
||||
};
|
||||
|
||||
template<> struct range_const_iterator<pugi::xml_document>
|
||||
{
|
||||
typedef pugi::xml_document::iterator type;
|
||||
};
|
||||
}
|
||||
|
||||
/*
|
||||
* These types add support for BOOST_FOREACH macro to xml_node and xml_document classes (child/attribute iteration).
|
||||
* Example usage:
|
||||
* BOOST_FOREACH(xml_node n, children(doc)) {}
|
||||
* BOOST_FOREACH(xml_node n, attributes(doc)) {}
|
||||
*/
|
||||
|
||||
namespace pugi
|
||||
{
|
||||
inline xml_object_range<xml_node_iterator> children(const pugi::xml_node& node)
|
||||
{
|
||||
return node.children();
|
||||
}
|
||||
|
||||
inline xml_object_range<xml_attribute_iterator> attributes(const pugi::xml_node& node)
|
||||
{
|
||||
return node.attributes();
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,7 +1,7 @@
|
|||
website <http://pugixml.org>; repository <http://github.com/zeux/pugixml>
|
||||
website <https://pugixml.org>; repository <https://github.com/zeux/pugixml>
|
||||
:toc: right
|
||||
:source-highlighter: pygments
|
||||
:source-language: c++
|
||||
:sectanchors:
|
||||
:sectlinks:
|
||||
:imagesdir: images
|
||||
:imagesdir: images
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 8 KiB After Width: | Height: | Size: 24 KiB |
504
docs/manual.adoc
504
docs/manual.adoc
File diff suppressed because it is too large
Load diff
3474
docs/manual.html
3474
docs/manual.html
File diff suppressed because it is too large
Load diff
|
@ -4,7 +4,7 @@ include::config.adoc[]
|
|||
[[introduction]]
|
||||
== Introduction
|
||||
|
||||
http://pugixml.org/[pugixml] is a light-weight C{plus}{plus} XML processing library. It consists of a DOM-like interface with rich traversal/modification capabilities, an extremely fast XML parser which constructs the DOM tree from an XML file/buffer, and an XPath 1.0 implementation for complex data-driven tree queries. Full Unicode support is also available, with two Unicode interface variants and conversions between different Unicode encodings (which happen automatically during parsing/saving). The library is extremely portable and easy to integrate and use. pugixml is developed and maintained since 2006 and has many users. All code is distributed under the <<license,MIT license>>, making it completely free to use in both open-source and proprietary applications.
|
||||
https://pugixml.org/[pugixml] is a light-weight C{plus}{plus} XML processing library. It consists of a DOM-like interface with rich traversal/modification capabilities, an extremely fast XML parser which constructs the DOM tree from an XML file/buffer, and an XPath 1.0 implementation for complex data-driven tree queries. Full Unicode support is also available, with two Unicode interface variants and conversions between different Unicode encodings (which happen automatically during parsing/saving). The library is extremely portable and easy to integrate and use. pugixml is developed and maintained since 2006 and has many users. All code is distributed under the <<license,MIT license>>, making it completely free to use in both open-source and proprietary applications.
|
||||
|
||||
pugixml enables very fast, convenient and memory-efficient XML document processing. However, since pugixml has a DOM parser, it can't process XML documents that do not fit in memory; also the parser is a non-validating one, so if you need DTD/Schema validation, the library is not for you.
|
||||
|
||||
|
@ -24,8 +24,8 @@ https://github.com/zeux/pugixml/releases/download/v{version}/pugixml-{version}.t
|
|||
The distribution contains library source, documentation (the guide you're reading now and the manual) and some code examples. After downloading the distribution, install pugixml by extracting all files from the compressed archive.
|
||||
|
||||
The complete pugixml source consists of three files - one source file, `pugixml.cpp`, and two header files, `pugixml.hpp` and `pugiconfig.hpp`. `pugixml.hpp` is the primary header which you need to include in order to use pugixml classes/functions. The rest of this guide assumes that `pugixml.hpp` is either in the current directory or in one of include directories of your projects, so that `#include "pugixml.hpp"` can find the header; however you can also use relative path (i.e. `#include "../libs/pugixml/src/pugixml.hpp"`) or include directory-relative path (i.e. `#include <xml/thirdparty/pugixml/src/pugixml.hpp>`).
|
||||
|
||||
The easiest way to build pugixml is to compile the source file, `pugixml.cpp`, along with the existing library/executable. This process depends on the method of building your application; for example, if you're using Microsoft Visual Studio footnote:[All trademarks used are properties of their respective owners.], Apple Xcode, Code::Blocks or any other IDE, just add `pugixml.cpp` to one of your projects. There are other building methods available, including building pugixml as a standalone static/shared library; link:manual/install.html#install.building[read the manual] for further information.
|
||||
|
||||
The easiest way to build pugixml is to compile the source file, `pugixml.cpp`, along with the existing library/executable. This process depends on the method of building your application; for example, if you're using Microsoft Visual Studio footnote:[All trademarks used are properties of their respective owners.], Apple Xcode, Code::Blocks or any other IDE, just *add `pugixml.cpp` to one of your projects*. There are other building methods available, including building pugixml as a standalone static/shared library; link:manual.html#install.building[read the manual] for further information.
|
||||
|
||||
[[dom]]
|
||||
== Document object model
|
||||
|
@ -54,7 +54,7 @@ There is a special value of `xml_node` type, known as null node or empty node. I
|
|||
|
||||
`xml_attribute` is the handle to an XML attribute; it has the same semantics as `xml_node`, i.e. there can be several `xml_attribute` handles pointing to the same underlying object and there is a special null attribute value, which propagates to function results.
|
||||
|
||||
There are two choices of interface and internal representation when configuring pugixml: you can either choose the UTF-8 (also called char) interface or UTF-16/32 (also called wchar_t) one. The choice is controlled via `PUGIXML_WCHAR_MODE` define; you can set it via `pugiconfig.hpp` or via preprocessor options. All tree functions that work with strings work with either C-style null terminated strings or STL strings of the selected character type. link:manual/dom.html#dom.unicode[Read the manual] for additional information on Unicode interface.
|
||||
There are two choices of interface and internal representation when configuring pugixml: you can either choose the UTF-8 (also called char) interface or UTF-16/32 (also called wchar_t) one. The choice is controlled via `PUGIXML_WCHAR_MODE` define; you can set it via `pugiconfig.hpp` or via preprocessor options. All tree functions that work with strings work with either C-style null terminated strings or STL strings of the selected character type. link:manual.html#dom.unicode[Read the manual] for additional information on Unicode interface.
|
||||
|
||||
[[loading]]
|
||||
== Loading document
|
||||
|
@ -67,7 +67,7 @@ This is an example of loading XML document from file (link:samples/load_file.cpp
|
|||
|
||||
[source,indent=0]
|
||||
----
|
||||
include::samples/load_file.cpp[tags=code]
|
||||
include::samples/load_file.cpp[tags=code]
|
||||
----
|
||||
|
||||
`load_file`, as well as other loading functions, destroys the existing document tree and then tries to load the new tree from the specified file. The result of the operation is returned in an `xml_parse_result` object; this object contains the operation status, and the related information (i.e. last successfully parsed position in the input file, if parsing fails).
|
||||
|
@ -78,7 +78,7 @@ This is an example of handling loading errors (link:samples/load_error_handling.
|
|||
|
||||
[source,indent=0]
|
||||
----
|
||||
include::samples/load_error_handling.cpp[tags=code]
|
||||
include::samples/load_error_handling.cpp[tags=code]
|
||||
----
|
||||
|
||||
Sometimes XML data should be loaded from some other source than file, i.e. HTTP URL; also you may want to load XML data from file using non-standard functions, i.e. to use your virtual file system facilities or to load XML from gzip-compressed files. These scenarios either require loading document from memory, in which case you should prepare a contiguous memory block with all XML data and to pass it to one of buffer loading functions, or loading document from C{plus}{plus} IOstream, in which case you should provide an object which implements `std::istream` or `std::wistream` interface.
|
||||
|
@ -240,7 +240,7 @@ This is a simple example of custom writer for saving document data to STL string
|
|||
include::samples/save_custom_writer.cpp[tags=code]
|
||||
----
|
||||
|
||||
While the previously described functions save the whole document to the destination, it is easy to save a single subtree. Instead of calling `xml_document::save`, just call `xml_node::print` function on the target node. You can save node contents to C{plus}{plus} IOstream object or custom writer in this way. Saving a subtree slightly differs from saving the whole document; link:manual/saving.html#saving.subtree[read the manual] for more information.
|
||||
While the previously described functions save the whole document to the destination, it is easy to save a single subtree. Instead of calling `xml_document::save`, just call `xml_node::print` function on the target node. You can save node contents to C{plus}{plus} IOstream object or custom writer in this way. Saving a subtree slightly differs from saving the whole document; link:manual.html#saving.subtree[read the manual] for more information.
|
||||
|
||||
[[feedback]]
|
||||
== Feedback
|
||||
|
@ -255,7 +255,7 @@ If filing an issue is not possible due to privacy or other concerns, you can con
|
|||
The pugixml library is distributed under the MIT license:
|
||||
|
||||
....
|
||||
Copyright (c) 2006-2015 Arseny Kapoulkine
|
||||
Copyright (c) 2006-2022 Arseny Kapoulkine
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
|
@ -280,8 +280,8 @@ OTHER DEALINGS IN THE SOFTWARE.
|
|||
....
|
||||
|
||||
This means that you can freely use pugixml in your applications, both open-source and proprietary. If you use pugixml in a product, it is sufficient to add an acknowledgment like this to the product distribution:
|
||||
|
||||
|
||||
....
|
||||
This software is based on pugixml library (https://pugixml.org).
|
||||
pugixml is Copyright (C) 2006-2022 Arseny Kapoulkine.
|
||||
....
|
||||
This software is based on pugixml library (http://pugixml.org).
|
||||
pugixml is Copyright (C) 2006-2015 Arseny Kapoulkine.
|
||||
....
|
File diff suppressed because it is too large
Load diff
|
@ -48,7 +48,7 @@ bool preprocess(pugi::xml_node node)
|
|||
bool load_preprocess(pugi::xml_document& doc, const char* path)
|
||||
{
|
||||
pugi::xml_parse_result result = doc.load_file(path, pugi::parse_default | pugi::parse_pi); // for <?include?>
|
||||
|
||||
|
||||
return result ? preprocess(doc) : false;
|
||||
}
|
||||
// end::code[]
|
||||
|
|
|
@ -15,7 +15,7 @@ int main()
|
|||
decl.append_attribute("encoding") = "UTF-8";
|
||||
decl.append_attribute("standalone") = "no";
|
||||
|
||||
// <?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
// <?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
// <foo bar="baz">
|
||||
// <call>hey</call>
|
||||
// </foo>
|
||||
|
|
10
readme.txt
10
readme.txt
|
@ -1,7 +1,7 @@
|
|||
pugixml 1.6 - an XML processing library
|
||||
pugixml 1.13 - an XML processing library
|
||||
|
||||
Copyright (C) 2006-2015, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
|
||||
Report bugs and download new versions at http://pugixml.org/
|
||||
Copyright (C) 2006-2022, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
|
||||
Report bugs and download new versions at https://pugixml.org/
|
||||
|
||||
This is the distribution of pugixml, which is a C++ XML processing library,
|
||||
which consists of a DOM-like interface with rich traversal/modification
|
||||
|
@ -13,8 +13,6 @@ automatically during parsing/saving).
|
|||
|
||||
The distribution contains the following folders:
|
||||
|
||||
contrib/ - various contributions to pugixml
|
||||
|
||||
docs/ - documentation
|
||||
docs/samples - pugixml usage examples
|
||||
docs/quickstart.html - quick start guide
|
||||
|
@ -28,7 +26,7 @@ The distribution contains the following folders:
|
|||
|
||||
This library is distributed under the MIT License:
|
||||
|
||||
Copyright (c) 2006-2015 Arseny Kapoulkine
|
||||
Copyright (c) 2006-2022 Arseny Kapoulkine
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
project(pugixml)
|
||||
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
|
||||
option(BUILD_SHARED_LIBS "Build shared instead of static library" OFF)
|
||||
set(BUILD_DEFINES "" CACHE STRING "Build defines")
|
||||
|
||||
# Pre-defines standard install locations on *nix systems.
|
||||
include(GNUInstallDirs)
|
||||
mark_as_advanced(CLEAR CMAKE_INSTALL_LIBDIR CMAKE_INSTALL_INCLUDEDIR)
|
||||
|
||||
set(HEADERS ../src/pugixml.hpp ../src/pugiconfig.hpp)
|
||||
set(SOURCES ${HEADERS} ../src/pugixml.cpp)
|
||||
|
||||
if(DEFINED BUILD_DEFINES)
|
||||
add_definitions(${BUILD_DEFINES})
|
||||
endif()
|
||||
|
||||
if(BUILD_SHARED_LIBS)
|
||||
add_library(pugixml SHARED ${SOURCES})
|
||||
else()
|
||||
add_library(pugixml STATIC ${SOURCES})
|
||||
endif()
|
||||
|
||||
set_target_properties(pugixml PROPERTIES VERSION 1.6 SOVERSION 1)
|
||||
|
||||
install(TARGETS pugixml EXPORT pugixml-config
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
)
|
||||
|
||||
install(FILES ${HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
install(EXPORT pugixml-config DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/pugixml)
|
54
scripts/archive.py
Normal file
54
scripts/archive.py
Normal file
|
@ -0,0 +1,54 @@
|
|||
import io
|
||||
import os.path
|
||||
import sys
|
||||
import tarfile
|
||||
import time
|
||||
import zipfile
|
||||
|
||||
def read_file(path, use_crlf):
|
||||
with open(path, 'rb') as file:
|
||||
data = file.read()
|
||||
|
||||
if b'\0' not in data:
|
||||
data = data.replace(b'\r', b'')
|
||||
if use_crlf:
|
||||
data = data.replace(b'\n', b'\r\n')
|
||||
|
||||
return data
|
||||
|
||||
def write_zip(target, arcprefix, timestamp, sources):
|
||||
with zipfile.ZipFile(target, 'w') as archive:
|
||||
for source in sorted(sources):
|
||||
data = read_file(source, use_crlf = True)
|
||||
path = os.path.join(arcprefix, source)
|
||||
info = zipfile.ZipInfo(path)
|
||||
info.date_time = time.localtime(timestamp)
|
||||
info.compress_type = zipfile.ZIP_DEFLATED
|
||||
info.external_attr = 0o644 << 16
|
||||
archive.writestr(info, data)
|
||||
|
||||
def write_tar(target, arcprefix, timestamp, sources, compression):
|
||||
with tarfile.open(target, 'w:' + compression) as archive:
|
||||
for source in sorted(sources):
|
||||
data = read_file(source, use_crlf = False)
|
||||
path = os.path.join(arcprefix, source)
|
||||
info = tarfile.TarInfo(path)
|
||||
info.size = len(data)
|
||||
info.mtime = timestamp
|
||||
archive.addfile(info, io.BytesIO(data))
|
||||
|
||||
if len(sys.argv) < 5:
|
||||
raise RuntimeError('Usage: python archive.py <target> <archive prefix> <timestamp> <source files>')
|
||||
|
||||
target, arcprefix, timestamp = sys.argv[1:4]
|
||||
sources = sys.argv[4:]
|
||||
|
||||
# tarfile._Stream._init_write_gz always writes current time to gzip header
|
||||
time.time = lambda: timestamp
|
||||
|
||||
if target.endswith('.zip'):
|
||||
write_zip(target, arcprefix, int(timestamp), sources)
|
||||
elif target.endswith('.tar.gz') or target.endswith('.tar.bz2'):
|
||||
write_tar(target, arcprefix, int(timestamp), sources, compression = os.path.splitext(target)[1][1:])
|
||||
else:
|
||||
raise NotImplementedError('File type not supported: ' + target)
|
4
scripts/cocoapods_push.sh
Executable file
4
scripts/cocoapods_push.sh
Executable file
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash
|
||||
|
||||
#Push to igagis repo for now
|
||||
pod repo push igagis pugixml.podspec --use-libraries --verbose
|
77
scripts/natvis/pugixml.natvis
Normal file
77
scripts/natvis/pugixml.natvis
Normal file
|
@ -0,0 +1,77 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
|
||||
<Type Name="pugi::xml_node">
|
||||
<DisplayString Condition="_root">{_root}</DisplayString>
|
||||
<DisplayString Condition="!_root">none</DisplayString>
|
||||
<Expand>
|
||||
<ExpandedItem Condition="_root">_root</ExpandedItem>
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
<Type Name="pugi::xml_node_struct">
|
||||
<DisplayString Condition="name && value">{(pugi::xml_node_type)(header & 0xf),en} name={name,na} value={value,na}</DisplayString>
|
||||
<DisplayString Condition="name">{(pugi::xml_node_type)(header & 0xf),en} name={name,na}</DisplayString>
|
||||
<DisplayString Condition="value">{(pugi::xml_node_type)(header & 0xf),en} value={value,na}</DisplayString>
|
||||
<DisplayString>{(pugi::xml_node_type)(header & 0xf),en}</DisplayString>
|
||||
<Expand>
|
||||
<Item Name="value" Condition="value">value,na</Item>
|
||||
<Synthetic Name="attributes" Condition="first_attribute">
|
||||
<Expand>
|
||||
<CustomListItems>
|
||||
<Variable Name="curr" InitialValue="first_attribute" />
|
||||
|
||||
<Loop Condition="curr">
|
||||
<Item Name="{curr->name,na}">curr,view(child)na</Item>
|
||||
<Exec>curr = curr->next_attribute</Exec>
|
||||
</Loop>
|
||||
</CustomListItems>
|
||||
</Expand>
|
||||
</Synthetic>
|
||||
<LinkedListItems>
|
||||
<HeadPointer>first_child</HeadPointer>
|
||||
<NextPointer>next_sibling</NextPointer>
|
||||
<ValueNode>this,na</ValueNode>
|
||||
</LinkedListItems>
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
<Type Name="pugi::xml_attribute">
|
||||
<DisplayString Condition="_attr">{_attr}</DisplayString>
|
||||
<DisplayString Condition="!_attr">none</DisplayString>
|
||||
<Expand>
|
||||
<ExpandedItem Condition="_attr">_attr</ExpandedItem>
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
<Type Name="pugi::xml_attribute_struct">
|
||||
<DisplayString ExcludeView="child">{name,na} = {value,na}</DisplayString>
|
||||
<DisplayString>{value,na}</DisplayString>
|
||||
<Expand>
|
||||
<Item Name="name">name,na</Item>
|
||||
<Item Name="value">value,na</Item>
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
<Type Name="pugi::xpath_node">
|
||||
<DisplayString Condition="_node._root && _attribute._attr">{_node,na} "{_attribute._attr->name,na}"="{_attribute._attr->value,na}"</DisplayString>
|
||||
<DisplayString Condition="_node._root">{_node,na}</DisplayString>
|
||||
<DisplayString Condition="_attribute._attr">{_attribute}</DisplayString>
|
||||
<DisplayString>empty</DisplayString>
|
||||
<Expand HideRawView="1">
|
||||
<ExpandedItem Condition="_node._root && !_attribute._attr">_node</ExpandedItem>
|
||||
<ExpandedItem Condition="!_node._root && _attribute._attr">_attribute</ExpandedItem>
|
||||
<Item Name="node" Condition="_node._root && _attribute._attr">_node,na</Item>
|
||||
<Item Name="attribute" Condition="_node._root && _attribute._attr">_attribute,na</Item>
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
<Type Name="pugi::xpath_node_set">
|
||||
<Expand>
|
||||
<Item Name="type">_type</Item>
|
||||
<ArrayItems>
|
||||
<Size>_end - _begin</Size>
|
||||
<ValuePointer>_begin</ValuePointer>
|
||||
</ArrayItems>
|
||||
</Expand>
|
||||
</Type>
|
||||
</AutoVisualizer>
|
506
scripts/natvis/pugixml_compact.natvis
Normal file
506
scripts/natvis/pugixml_compact.natvis
Normal file
|
@ -0,0 +1,506 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
|
||||
<Type Name="pugi::xml_node">
|
||||
<DisplayString Condition="_root">{_root}</DisplayString>
|
||||
<DisplayString Condition="!_root">none</DisplayString>
|
||||
<Expand>
|
||||
<ExpandedItem Condition="_root">_root</ExpandedItem>
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
<Type Name="pugi::xml_attribute">
|
||||
<DisplayString Condition="_attr">{_attr}</DisplayString>
|
||||
<DisplayString Condition="!_attr">none</DisplayString>
|
||||
<Expand>
|
||||
<ExpandedItem Condition="_attr">_attr</ExpandedItem>
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
<Type Name="pugi::xml_node_struct">
|
||||
<Expand>
|
||||
<Item Name="type">(pugi::xml_node_type)(header._flags & 15)</Item>
|
||||
<Item Name="name" Condition="name._data">name,na</Item>
|
||||
<Item Name="value" Condition="value._data">value,na</Item>
|
||||
|
||||
<Synthetic Name="attributes" Condition="first_attribute._data">
|
||||
<DisplayString>...</DisplayString>
|
||||
<Expand>
|
||||
<CustomListItems>
|
||||
<Variable Name="attribute_this" InitialValue="(size_t)&first_attribute" />
|
||||
<Variable Name="attribute_data" InitialValue="first_attribute._data" />
|
||||
<Variable Name="attribute_data_copy" InitialValue="attribute_data" />
|
||||
|
||||
<!-- first_attribute struct template arguments -->
|
||||
<Variable Name="attribute_T1" InitialValue="11" />
|
||||
<Variable Name="attribute_T2" InitialValue="0" />
|
||||
|
||||
<Variable Name="compact_alignment_log2" InitialValue="2" />
|
||||
<Variable Name="compact_alignment" InitialValue="1 << compact_alignment_log2" />
|
||||
|
||||
<!-- compact_get_page() -->
|
||||
<Variable Name="_page" InitialValue="*(char*)(attribute_this - attribute_T1)" />
|
||||
<Variable Name="page" InitialValue="((attribute_this - attribute_T1 - (_page << compact_alignment_log2)) - *(unsigned*)(attribute_this - attribute_T1 - (_page << compact_alignment_log2)))" />
|
||||
|
||||
<!-- page->allocator->_hash -->
|
||||
<Variable Name="allocator" InitialValue="*(size_t*)page" />
|
||||
<Variable Name="_hash" InitialValue="*(size_t*)(allocator + 2 * sizeof(size_t))" /><!--2 pointer offsetof(allocator, _hash)-->
|
||||
<Variable Name="_items" InitialValue="*(size_t*)_hash" />
|
||||
<Variable Name="_capacity" InitialValue="*((size_t*)_hash + 1)" /><!--1 pointer offsetof(_hash, _capacity)-->
|
||||
<Variable Name="_count" InitialValue="*((size_t*)_hash + 2)" /><!--2 pointer offsetof(_hash, _count)-->
|
||||
|
||||
<!-- find() prolog -->
|
||||
<Variable Name="hashmod" InitialValue="_capacity - 1" />
|
||||
|
||||
<Variable Name="h" InitialValue="(unsigned)attribute_this" />
|
||||
<Variable Name="bucket" InitialValue="0" />
|
||||
|
||||
<Variable Name="probe" InitialValue="0" />
|
||||
<Variable Name="probe_item" InitialValue="(size_t*)0" />
|
||||
|
||||
<Variable Name="attribute_real" InitialValue="(pugi::xml_attribute_struct*)0" />
|
||||
|
||||
<!-- if _data < 255 -->
|
||||
<Variable Name="attribute_short" InitialValue="(pugi::xml_attribute_struct*)(((size_t)attribute_this & ~(compact_alignment - 1)) + (attribute_data - 1 + attribute_T2) * compact_alignment)" />
|
||||
|
||||
<Variable Name="number" InitialValue="0" />
|
||||
|
||||
<!-- Loop over all attributes -->
|
||||
<Loop Condition="attribute_this && attribute_data">
|
||||
<!-- find() hash -->
|
||||
<Exec>h = h ^ (h >> 16)</Exec>
|
||||
<Exec>h = h * (0x85ebca6bu)</Exec>
|
||||
<Exec>h = h ^ (h >> 13)</Exec>
|
||||
<Exec>h = h * (0xc2b2ae35u)</Exec>
|
||||
<Exec>h = h ^ (h >> 16)</Exec>
|
||||
|
||||
<Exec>bucket = h & hashmod</Exec>
|
||||
|
||||
<!-- find() loop -->
|
||||
<Loop Condition="probe <= hashmod &&_capacity">
|
||||
<Exec>probe_item = (size_t*)_items + bucket * 2</Exec><!--2 pointer sizeof(item_t)-->
|
||||
|
||||
<If Condition="*probe_item == attribute_this || *probe_item == 0">
|
||||
<Exec>attribute_real = *(pugi::xml_attribute_struct**)(probe_item + 1)</Exec><!--1 pointer offsetof(item_t, value)-->
|
||||
<Break/>
|
||||
</If>
|
||||
|
||||
<Exec>bucket = (bucket + probe + 1) & hashmod</Exec>
|
||||
<Exec>probe++</Exec>
|
||||
</Loop>
|
||||
|
||||
<Exec>attribute_data_copy = attribute_data</Exec>
|
||||
|
||||
<If Condition="attribute_data_copy >= 255 && attribute_real">
|
||||
<Item Name="[{number}]">*attribute_real,view(child)</Item>
|
||||
<Exec>attribute_this = (size_t)&(*attribute_real).next_attribute</Exec>
|
||||
<Exec>attribute_data = (*attribute_real).next_attribute._data</Exec>
|
||||
</If>
|
||||
<If Condition="attribute_data_copy < 255 && attribute_short">
|
||||
<Item Name="[{number}]">*attribute_short,view(child)</Item>
|
||||
<Exec>attribute_this = (size_t)&(*attribute_short).next_attribute</Exec>
|
||||
<Exec>attribute_data = (*attribute_short).next_attribute._data</Exec>
|
||||
</If>
|
||||
|
||||
<!-- next_attribute struct template arguments -->
|
||||
<Exec>attribute_T1 = 7</Exec>
|
||||
<Exec>attribute_T2 = 0</Exec>
|
||||
|
||||
<!-- find() prolog again -->
|
||||
<Exec>h = (unsigned)attribute_this</Exec>
|
||||
<Exec>bucket = 0</Exec>
|
||||
|
||||
<Exec>probe = 0</Exec>
|
||||
<Exec>probe_item = (size_t*)0</Exec>
|
||||
|
||||
<Exec>attribute_real = (pugi::xml_attribute_struct*)0</Exec>
|
||||
<Exec>attribute_short = (pugi::xml_attribute_struct*)(((size_t)attribute_this & ~(compact_alignment - 1)) + (attribute_data - 1 + attribute_T2) * compact_alignment)</Exec>
|
||||
|
||||
<Exec>number++</Exec>
|
||||
</Loop>
|
||||
</CustomListItems>
|
||||
</Expand>
|
||||
</Synthetic>
|
||||
|
||||
<CustomListItems>
|
||||
<Variable Name="child_this" InitialValue="&first_child" />
|
||||
<Variable Name="child_data" InitialValue="first_child._data" />
|
||||
<Variable Name="child_data_copy" InitialValue="child_data" />
|
||||
|
||||
<!-- first_child struct template arguments -->
|
||||
<Variable Name="child_T1" InitialValue="8" />
|
||||
<Variable Name="child_T2" InitialValue="0" />
|
||||
|
||||
<Variable Name="compact_alignment_log2" InitialValue="2" />
|
||||
<Variable Name="compact_alignment" InitialValue="1 << compact_alignment_log2" />
|
||||
|
||||
<!-- compact_get_page() -->
|
||||
<Variable Name="_page" InitialValue="*(char*)(child_this - child_T1)" />
|
||||
<Variable Name="page" InitialValue="((child_this - child_T1 - (_page << compact_alignment_log2)) - *(unsigned*)(child_this - child_T1 - (_page << compact_alignment_log2)))" />
|
||||
|
||||
<!-- page->allocator->_hash -->
|
||||
<Variable Name="allocator" InitialValue="*(size_t*)page" />
|
||||
<Variable Name="_hash" InitialValue="*(size_t*)(allocator + 2 * sizeof(size_t))" /><!--2 pointer offsetof(allocator, _hash)-->
|
||||
<Variable Name="_items" InitialValue="*(size_t*)_hash" />
|
||||
<Variable Name="_capacity" InitialValue="*((size_t*)_hash + 1)" /><!--1 pointer offsetof(_hash, _capacity)-->
|
||||
<Variable Name="_count" InitialValue="*((size_t*)_hash + 2)" /><!--2 pointer offsetof(_hash, _count)-->
|
||||
|
||||
<!-- find() prolog -->
|
||||
<Variable Name="hashmod" InitialValue="_capacity - 1" />
|
||||
|
||||
<Variable Name="h" InitialValue="(unsigned)child_this" />
|
||||
<Variable Name="bucket" InitialValue="0" />
|
||||
|
||||
<Variable Name="probe" InitialValue="0" />
|
||||
<Variable Name="probe_item" InitialValue="(size_t*)0" />
|
||||
|
||||
<Variable Name="child_real" InitialValue="(pugi::xml_node_struct*)0" />
|
||||
|
||||
<!-- if _data < 255 -->
|
||||
<Variable Name="child_short" InitialValue="(pugi::xml_node_struct*)(((size_t)child_this & ~(compact_alignment - 1)) + (child_data - 1 + child_T2) * compact_alignment)" />
|
||||
|
||||
<Variable Name="number" InitialValue="0" />
|
||||
|
||||
<Loop Condition="child_this && child_data">
|
||||
<!-- find() hash -->
|
||||
<Exec>h = h ^ (h >> 16)</Exec>
|
||||
<Exec>h = h * (0x85ebca6bu)</Exec>
|
||||
<Exec>h = h ^ (h >> 13)</Exec>
|
||||
<Exec>h = h * (0xc2b2ae35u)</Exec>
|
||||
<Exec>h = h ^ (h >> 16)</Exec>
|
||||
|
||||
<Exec>bucket = h & hashmod</Exec>
|
||||
|
||||
<!-- find() loop -->
|
||||
<Loop Condition="probe <= hashmod &&_capacity">
|
||||
<Exec>probe_item = (size_t*)_items + bucket * 2</Exec><!--2 pointer sizeof(item_t)-->
|
||||
|
||||
<If Condition="*probe_item == child_this || *probe_item == 0">
|
||||
<Exec>child_real = *(pugi::xml_node_struct**)(probe_item + 1)</Exec><!--1 pointer offsetof(item_t, value)-->
|
||||
<Break/>
|
||||
</If>
|
||||
|
||||
<Exec>bucket = (bucket + probe + 1) & hashmod</Exec>
|
||||
<Exec>probe++</Exec>
|
||||
</Loop>
|
||||
|
||||
<Exec>child_data_copy = child_data</Exec>
|
||||
|
||||
<If Condition="child_data_copy >= 255 && child_real">
|
||||
<Item Name="[{number}]">*child_real,view(child)</Item>
|
||||
<Exec>child_this = (size_t)&(*child_real).next_sibling</Exec>
|
||||
<Exec>child_data = (*child_real).next_sibling._data</Exec>
|
||||
</If>
|
||||
<If Condition="child_data_copy < 255 && child_short">
|
||||
<Item Name="[{number}]">*child_short,view(child)</Item>
|
||||
<Exec>child_this = (size_t)&(*child_short).next_sibling</Exec>
|
||||
<Exec>child_data = (*child_short).next_sibling._data</Exec>
|
||||
</If>
|
||||
|
||||
<!-- next_sibling struct template arguments -->
|
||||
<Exec>child_T1 = 10</Exec>
|
||||
<Exec>child_T2 = 0</Exec>
|
||||
|
||||
<!-- find() prolog again -->
|
||||
<Exec>h = (unsigned)child_this</Exec>
|
||||
<Exec>bucket = 0</Exec>
|
||||
|
||||
<Exec>probe = 0</Exec>
|
||||
<Exec>probe_item = (size_t*)0</Exec>
|
||||
|
||||
<Exec>child_real = (pugi::xml_node_struct*)0</Exec>
|
||||
<Exec>child_short = (pugi::xml_node_struct*)(((size_t)child_this & ~(compact_alignment - 1)) + (child_data - 1 + child_T2) * compact_alignment)</Exec>
|
||||
|
||||
<Exec>number++</Exec>
|
||||
</Loop>
|
||||
</CustomListItems>
|
||||
|
||||
<Item Name="next_sibling" ExcludeView="child">next_sibling</Item>
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
<Type Name="pugi::xml_attribute_struct">
|
||||
<Expand>
|
||||
<Item Name="name">name,na</Item>
|
||||
<Item Name="value">value,na</Item>
|
||||
|
||||
<CustomListItems ExcludeView="child">
|
||||
<Variable Name="attribute_this" InitialValue="&next_attribute" />
|
||||
<Variable Name="attribute_data" InitialValue="next_attribute._data" />
|
||||
|
||||
<!-- next_attribute struct template arguments -->
|
||||
<Variable Name="attribute_T1" InitialValue="7" />
|
||||
<Variable Name="attribute_T2" InitialValue="0" />
|
||||
|
||||
<Variable Name="compact_alignment_log2" InitialValue="2" />
|
||||
<Variable Name="compact_alignment" InitialValue="1 << compact_alignment_log2" />
|
||||
|
||||
<!-- compact_get_page() -->
|
||||
<Variable Name="_page" InitialValue="*(char*)(attribute_this - attribute_T1)" />
|
||||
<Variable Name="page" InitialValue="((attribute_this - attribute_T1 - (_page << compact_alignment_log2)) - *(unsigned*)(attribute_this - attribute_T1 - (_page << compact_alignment_log2)))" />
|
||||
|
||||
<!-- page->allocator->_hash -->
|
||||
<Variable Name="allocator" InitialValue="*(size_t*)page" />
|
||||
<Variable Name="_hash" InitialValue="*(size_t*)(allocator + 2 * sizeof(size_t))" /><!--2 pointer offsetof(allocator, _hash)-->
|
||||
<Variable Name="_items" InitialValue="*(size_t*)_hash" />
|
||||
<Variable Name="_capacity" InitialValue="*((size_t*)_hash + 1)" /><!--1 pointer offsetof(_hash, _capacity)-->
|
||||
<Variable Name="_count" InitialValue="*((size_t*)_hash + 2)" /><!--2 pointer offsetof(_hash, _count)-->
|
||||
|
||||
<!-- find() prolog -->
|
||||
<Variable Name="hashmod" InitialValue="_capacity - 1" />
|
||||
|
||||
<Variable Name="h" InitialValue="(unsigned)attribute_this" />
|
||||
<Variable Name="bucket" InitialValue="0" />
|
||||
|
||||
<Variable Name="probe" InitialValue="0" />
|
||||
<Variable Name="probe_item" InitialValue="(size_t*)0" />
|
||||
|
||||
<Variable Name="attribute_real" InitialValue="(pugi::xml_attribute_struct*)0" />
|
||||
|
||||
<!-- if _data < 255 -->
|
||||
<Variable Name="attribute_short" InitialValue="(pugi::xml_attribute_struct*)(((size_t)attribute_this & ~(compact_alignment - 1)) + (attribute_data - 1 + attribute_T2) * compact_alignment)" />
|
||||
|
||||
<!-- find() hash -->
|
||||
<Exec>h = h ^ (h >> 16)</Exec>
|
||||
<Exec>h = h * (0x85ebca6bu)</Exec>
|
||||
<Exec>h = h ^ (h >> 13)</Exec>
|
||||
<Exec>h = h * (0xc2b2ae35u)</Exec>
|
||||
<Exec>h = h ^ (h >> 16)</Exec>
|
||||
|
||||
<Exec>bucket = h & hashmod</Exec>
|
||||
|
||||
<!-- find() loop -->
|
||||
<Loop Condition="probe <= hashmod &&_capacity">
|
||||
<Exec>probe_item = (size_t*)_items + bucket * 2</Exec><!--2 pointer sizeof(item_t)-->
|
||||
|
||||
<If Condition="*probe_item == attribute_this || *probe_item == 0">
|
||||
<Exec>attribute_real = *(pugi::xml_attribute_struct**)(probe_item + 1)</Exec><!--1 pointer offsetof(item_t, value)-->
|
||||
<Break/>
|
||||
</If>
|
||||
|
||||
<Exec>bucket = (bucket + probe + 1) & hashmod</Exec>
|
||||
<Exec>probe++</Exec>
|
||||
</Loop>
|
||||
|
||||
<If Condition="attribute_data >= 255 && attribute_real">
|
||||
<Item Name="next_attribute">*attribute_real</Item>
|
||||
</If>
|
||||
<If Condition="attribute_data != 0 && attribute_data < 255 && attribute_short">
|
||||
<Item Name="next_attribute">*attribute_short</Item>
|
||||
</If>
|
||||
</CustomListItems>
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
<Type Name="pugi::impl::`anonymous-namespace'::compact_string<*,*>">
|
||||
<Expand HideRawView="1">
|
||||
<CustomListItems Condition="_data && _data < 255">
|
||||
<Variable Name="compact_alignment_log2" InitialValue="2" />
|
||||
<Variable Name="compact_alignment" InitialValue="1 << compact_alignment_log2" />
|
||||
|
||||
<!-- compact_get_page() -->
|
||||
<Variable Name="_page" InitialValue="*(char*)(this - $T1)" />
|
||||
<Variable Name="page" InitialValue="((this - $T1 - (_page << compact_alignment_log2)) - *(unsigned*)(this - $T1 - (_page << compact_alignment_log2)))" />
|
||||
|
||||
<Variable Name="compact_string_base" InitialValue="*(size_t*)(page + 5 * sizeof(void*))" /><!-- 5 pointer offsetof(page, compact_string_base)-->
|
||||
<Variable Name="base" InitialValue="this - $T2" />
|
||||
<Variable Name="offset" InitialValue="((*(short*)base - 1) << 7) + (_data - 1)" />
|
||||
|
||||
<Item Name="value">(pugi::char_t*)(compact_string_base + offset * sizeof(pugi::char_t)),na</Item>
|
||||
</CustomListItems>
|
||||
|
||||
<CustomListItems Condition="_data && _data >= 255">
|
||||
<Variable Name="compact_alignment_log2" InitialValue="2" />
|
||||
<Variable Name="compact_alignment" InitialValue="1 << compact_alignment_log2" />
|
||||
|
||||
<!-- compact_get_page() -->
|
||||
<Variable Name="_page" InitialValue="*(char*)(this - $T1)" />
|
||||
<Variable Name="page" InitialValue="((this - $T1 - (_page << compact_alignment_log2)) - *(unsigned*)(this - $T1 - (_page << compact_alignment_log2)))" />
|
||||
|
||||
<!-- page->allocator->_hash -->
|
||||
<Variable Name="allocator" InitialValue="*(size_t*)page" />
|
||||
<Variable Name="_hash" InitialValue="*(size_t*)(allocator + 2 * sizeof(size_t))" /><!--2 pointer offsetof(allocator, _hash)-->
|
||||
<Variable Name="_items" InitialValue="*(size_t*)_hash" />
|
||||
<Variable Name="_capacity" InitialValue="*((size_t*)_hash + 1)" /><!--1 pointer offsetof(_hash, _capacity)-->
|
||||
<Variable Name="_count" InitialValue="*((size_t*)_hash + 2)" /><!--2 pointer offsetof(_hash, _count)-->
|
||||
|
||||
<!-- find() prolog -->
|
||||
<Variable Name="hashmod" InitialValue="_capacity - 1" />
|
||||
|
||||
<Variable Name="h" InitialValue="(unsigned)this" />
|
||||
<Variable Name="bucket" InitialValue="0" />
|
||||
|
||||
<Variable Name="probe" InitialValue="0" />
|
||||
<Variable Name="probe_item" InitialValue="(size_t*)0" />
|
||||
|
||||
<!-- find() hash -->
|
||||
<Exec>h = h ^ (h >> 16)</Exec>
|
||||
<Exec>h = h * (0x85ebca6bu)</Exec>
|
||||
<Exec>h = h ^ (h >> 13)</Exec>
|
||||
<Exec>h = h * (0xc2b2ae35u)</Exec>
|
||||
<Exec>h = h ^ (h >> 16)</Exec>
|
||||
|
||||
<Exec>bucket = h & hashmod</Exec>
|
||||
|
||||
<!-- find() loop -->
|
||||
<Loop Condition="probe <= hashmod &&_capacity">
|
||||
<Exec>probe_item = (size_t*)_items + bucket * 2</Exec><!--2 pointer sizeof(item_t)-->
|
||||
|
||||
<If Condition="*probe_item == this || *probe_item == 0">
|
||||
<Item Name="value">*(pugi::char_t**)(probe_item + 1)</Item><!--1 pointer offsetof(item_t, value)-->
|
||||
<Break/>
|
||||
</If>
|
||||
|
||||
<Exec>bucket = (bucket + probe + 1) & hashmod</Exec>
|
||||
<Exec>probe++</Exec>
|
||||
</Loop>
|
||||
</CustomListItems>
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
<Type Name="pugi::impl::`anonymous-namespace'::compact_pointer<pugi::xml_node_struct,*,*>">
|
||||
<DisplayString Condition="!_data">nullptr</DisplayString>
|
||||
<DisplayString Condition="_data">...</DisplayString>
|
||||
|
||||
<Expand HideRawView="1">
|
||||
<CustomListItems Condition="_data && _data < 255">
|
||||
<Variable Name="compact_alignment_log2" InitialValue="2" />
|
||||
<Variable Name="compact_alignment" InitialValue="1 << compact_alignment_log2" />
|
||||
|
||||
<Item Name="value">*(pugi::xml_node_struct*)(((size_t)this & ~(compact_alignment - 1)) + (_data - 1 + $T2) * compact_alignment)</Item>
|
||||
</CustomListItems>
|
||||
|
||||
<CustomListItems Condition="_data && _data >= 255">
|
||||
<Variable Name="compact_alignment_log2" InitialValue="2" />
|
||||
<Variable Name="compact_alignment" InitialValue="1 << compact_alignment_log2" />
|
||||
|
||||
<!-- compact_get_page() -->
|
||||
<Variable Name="_page" InitialValue="*(char*)(this - $T1)" />
|
||||
<Variable Name="page" InitialValue="((this - $T1 - (_page << compact_alignment_log2)) - *(unsigned*)(this - $T1 - (_page << compact_alignment_log2)))" />
|
||||
|
||||
<!-- page->allocator->_hash -->
|
||||
<Variable Name="allocator" InitialValue="*(size_t*)page" />
|
||||
<Variable Name="_hash" InitialValue="*(size_t*)(allocator + 2 * sizeof(size_t))" /><!--2 pointer offsetof(allocator, _hash)-->
|
||||
<Variable Name="_items" InitialValue="*(size_t*)_hash" />
|
||||
<Variable Name="_capacity" InitialValue="*((size_t*)_hash + 1)" /><!--1 pointer offsetof(_hash, _capacity)-->
|
||||
<Variable Name="_count" InitialValue="*((size_t*)_hash + 2)" /><!--2 pointer offsetof(_hash, _count)-->
|
||||
|
||||
<!-- find() prolog -->
|
||||
<Variable Name="hashmod" InitialValue="_capacity - 1" />
|
||||
|
||||
<Variable Name="h" InitialValue="(unsigned)this" />
|
||||
<Variable Name="bucket" InitialValue="0" />
|
||||
|
||||
<Variable Name="probe" InitialValue="0" />
|
||||
<Variable Name="probe_item" InitialValue="(size_t*)0" />
|
||||
|
||||
<!-- find() hash -->
|
||||
<Exec>h = h ^ (h >> 16)</Exec>
|
||||
<Exec>h = h * (0x85ebca6bu)</Exec>
|
||||
<Exec>h = h ^ (h >> 13)</Exec>
|
||||
<Exec>h = h * (0xc2b2ae35u)</Exec>
|
||||
<Exec>h = h ^ (h >> 16)</Exec>
|
||||
|
||||
<Exec>bucket = h & hashmod</Exec>
|
||||
|
||||
<!-- find() loop -->
|
||||
<Loop Condition="probe <= hashmod &&_capacity">
|
||||
<Exec>probe_item = (size_t*)_items + bucket * 2</Exec><!--2 pointer sizeof(item_t)-->
|
||||
|
||||
<If Condition="*probe_item == this || *probe_item == 0">
|
||||
<Item Name="value">**(pugi::xml_node_struct**)(probe_item + 1)</Item><!--1 pointer offsetof(item_t, value)-->
|
||||
<Break/>
|
||||
</If>
|
||||
|
||||
<Exec>bucket = (bucket + probe + 1) & hashmod</Exec>
|
||||
<Exec>probe++</Exec>
|
||||
</Loop>
|
||||
</CustomListItems>
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
<Type Name="pugi::impl::`anonymous-namespace'::compact_pointer<pugi::xml_attribute_struct,*,*>">
|
||||
<DisplayString Condition="!_data">nullptr</DisplayString>
|
||||
<DisplayString Condition="_data">...</DisplayString>
|
||||
|
||||
<Expand HideRawView="1">
|
||||
<CustomListItems Condition="_data && _data < 255">
|
||||
<Variable Name="compact_alignment_log2" InitialValue="2" />
|
||||
<Variable Name="compact_alignment" InitialValue="1 << compact_alignment_log2" />
|
||||
|
||||
<Item Name="value">*(pugi::xml_attribute_struct*)(((size_t)this & ~(compact_alignment - 1)) + (_data - 1 + $T2) * compact_alignment)</Item>
|
||||
</CustomListItems>
|
||||
|
||||
<CustomListItems Condition="_data && _data >= 255">
|
||||
<Variable Name="compact_alignment_log2" InitialValue="2" />
|
||||
<Variable Name="compact_alignment" InitialValue="1 << compact_alignment_log2" />
|
||||
|
||||
<!-- compact_get_page() -->
|
||||
<Variable Name="_page" InitialValue="*(char*)(this - $T1)" />
|
||||
<Variable Name="page" InitialValue="((this - $T1 - (_page << compact_alignment_log2)) - *(unsigned*)(this - $T1 - (_page << compact_alignment_log2)))" />
|
||||
|
||||
<!-- page->allocator->_hash -->
|
||||
<Variable Name="allocator" InitialValue="*(size_t*)page" />
|
||||
<Variable Name="_hash" InitialValue="*(size_t*)(allocator + 2 * sizeof(size_t))" /><!--2 pointer offsetof(allocator, _hash)-->
|
||||
<Variable Name="_items" InitialValue="*(size_t*)_hash" />
|
||||
<Variable Name="_capacity" InitialValue="*((size_t*)_hash + 1)" /><!--1 pointer offsetof(_hash, _capacity)-->
|
||||
<Variable Name="_count" InitialValue="*((size_t*)_hash + 2)" /><!--2 pointer offsetof(_hash, _count)-->
|
||||
|
||||
<!-- find() prolog -->
|
||||
<Variable Name="hashmod" InitialValue="_capacity - 1" />
|
||||
|
||||
<Variable Name="h" InitialValue="(unsigned)this" />
|
||||
<Variable Name="bucket" InitialValue="0" />
|
||||
|
||||
<Variable Name="probe" InitialValue="0" />
|
||||
<Variable Name="probe_item" InitialValue="(size_t*)0" />
|
||||
|
||||
<!-- find() hash -->
|
||||
<Exec>h = h ^ (h >> 16)</Exec>
|
||||
<Exec>h = h * (0x85ebca6bu)</Exec>
|
||||
<Exec>h = h ^ (h >> 13)</Exec>
|
||||
<Exec>h = h * (0xc2b2ae35u)</Exec>
|
||||
<Exec>h = h ^ (h >> 16)</Exec>
|
||||
|
||||
<Exec>bucket = h & hashmod</Exec>
|
||||
|
||||
<!-- find() loop -->
|
||||
<Loop Condition="probe <= hashmod &&_capacity">
|
||||
<Exec>probe_item = (size_t*)_items + bucket * 2</Exec><!--2 pointer sizeof(item_t)-->
|
||||
|
||||
<If Condition="*probe_item == this || *probe_item == 0">
|
||||
<Item Name="value">**(pugi::xml_attribute_struct**)(probe_item + 1)</Item><!--1 pointer offsetof(item_t, value)-->
|
||||
<Break/>
|
||||
</If>
|
||||
|
||||
<Exec>bucket = (bucket + probe + 1) & hashmod</Exec>
|
||||
<Exec>probe++</Exec>
|
||||
</Loop>
|
||||
</CustomListItems>
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
<Type Name="pugi::xpath_node">
|
||||
<DisplayString Condition="_node._root && _attribute._attr">{_node,na} {_attribute,na}</DisplayString>
|
||||
<DisplayString Condition="_node._root">{_node,na}</DisplayString>
|
||||
<DisplayString Condition="_attribute._attr">{_attribute}</DisplayString>
|
||||
<DisplayString>empty</DisplayString>
|
||||
|
||||
<Expand HideRawView="1">
|
||||
<ExpandedItem Condition="_node._root && !_attribute._attr">_node</ExpandedItem>
|
||||
<ExpandedItem Condition="!_node._root && _attribute._attr">_attribute</ExpandedItem>
|
||||
|
||||
<Item Name="node" Condition="_node._root && _attribute._attr">_node,na</Item>
|
||||
<Item Name="attribute" Condition="_node._root && _attribute._attr">_attribute,na</Item>
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
<Type Name="pugi::xpath_node_set">
|
||||
<Expand>
|
||||
<Item Name="type">_type</Item>
|
||||
<ArrayItems>
|
||||
<Size>_end - _begin</Size>
|
||||
<ValuePointer>_begin</ValuePointer>
|
||||
</ArrayItems>
|
||||
</Expand>
|
||||
</Type>
|
||||
</AutoVisualizer>
|
17
scripts/nuget/build/native/pugixml-propertiesui.xml
Normal file
17
scripts/nuget/build/native/pugixml-propertiesui.xml
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ProjectSchemaDefinitions xmlns="clr-namespace:Microsoft.Build.Framework.XamlTypes;assembly=Microsoft.Build.Framework">
|
||||
<Rule Name="ReferencedPackages05032e35-86af-4ab2-a3dc-d3e348583165" PageTemplate="tool" DisplayName="Referenced Packages" SwitchPrefix="/" Order="1">
|
||||
<Rule.Categories>
|
||||
<Category Name="pugixml" DisplayName="pugixml" />
|
||||
</Rule.Categories>
|
||||
<Rule.DataSource>
|
||||
<DataSource Persistence="ProjectFile" ItemType="" />
|
||||
</Rule.DataSource>
|
||||
<EnumProperty Name="Linkage-pugixml" DisplayName="Linkage" Description="Which version of the runtime library to use for this library" Category="pugixml">
|
||||
<EnumValue Name="dynamic" DisplayName="Dynamic CRT (/MD, /MDd)" />
|
||||
<EnumValue Name="static" DisplayName="Static CRT (/MT, /MTd)" />
|
||||
<EnumValue Name="source" DisplayName="Include pugixml.cpp" />
|
||||
<EnumValue Name="header" DisplayName="Header Only" />
|
||||
</EnumProperty>
|
||||
</Rule>
|
||||
</ProjectSchemaDefinitions>
|
28
scripts/nuget/build/native/pugixml.targets
Normal file
28
scripts/nuget/build/native/pugixml.targets
Normal file
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="Default initializers for properties">
|
||||
<Linkage-pugixml Condition="'$(Linkage-pugixml)' == ''">dynamic</Linkage-pugixml>
|
||||
<Configuration-pugixml Condition="$(Configuration.ToLower().IndexOf('debug')) != -1">Debug</Configuration-pugixml>
|
||||
<Configuration-pugixml Condition="$(Configuration.ToLower().IndexOf('debug')) == -1">Release</Configuration-pugixml>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PropertyPageSchema Include="$(MSBuildThisFileDirectory)\pugixml-propertiesui.xml" />
|
||||
</ItemGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions Condition="'$(Linkage-pugixml)' == 'header'">PUGIXML_HEADER_ONLY;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup Condition="'$(Linkage-pugixml)' == 'source'">
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)include\pugixml.cpp"/>
|
||||
</ItemGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Linkage-pugixml)' != 'header' AND '$(Linkage-pugixml)' != 'source'">
|
||||
<Link>
|
||||
<AdditionalDependencies>$(MSBuildThisFileDirectory)lib/$(Platform)\$(PlatformToolset.Split('_')[0])\$(Linkage-pugixml)\$(Configuration-pugixml)\pugixml.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
</Project>
|
20
scripts/nuget/pugixml.nuspec
Normal file
20
scripts/nuget/pugixml.nuspec
Normal file
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<package xmlns="http://schemas.microsoft.com/packaging/2011/10/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>pugixml</id>
|
||||
<version>1.13.0-appveyor</version>
|
||||
<title>pugixml</title>
|
||||
<authors>Arseny Kapoulkine</authors>
|
||||
<owners>Arseny Kapoulkine</owners>
|
||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||
<license type="expression">MIT</license>
|
||||
<projectUrl>https://pugixml.org/</projectUrl>
|
||||
<description>pugixml is a C++ XML processing library, which consists of a DOM-like interface with rich traversal/modification capabilities, an extremely fast XML parser which constructs the DOM tree from an XML file/buffer, and an XPath 1.0 implementation for complex data-driven tree queries. Full Unicode support is also available, with Unicode interface variants and conversions between different Unicode encodings (which happen automatically during parsing/saving).
|
||||
pugixml is used by a lot of projects, both open-source and proprietary, for performance and easy-to-use interface.
|
||||
This package contains builds for VS2013, VS2015, VS2017, VS2019 and VS2022, for both statically linked and DLL CRT; you can switch the CRT linkage in Project -> Properties -> Referenced Packages -> pugixml.</description>
|
||||
<summary>Light-weight, simple and fast XML parser for C++ with XPath support</summary>
|
||||
<releaseNotes>https://pugixml.org/docs/manual.html#changes</releaseNotes>
|
||||
<copyright>Copyright (c) 2006-2022 Arseny Kapoulkine</copyright>
|
||||
<tags>native nativepackage</tags>
|
||||
</metadata>
|
||||
</package>
|
70
scripts/nuget_build.ps1
Normal file
70
scripts/nuget_build.ps1
Normal file
|
@ -0,0 +1,70 @@
|
|||
function Run-Command([string]$cmd)
|
||||
{
|
||||
Invoke-Expression $cmd
|
||||
if ($LastExitCode) { exit $LastExitCode }
|
||||
}
|
||||
|
||||
function Force-Copy([string]$from, [string]$to)
|
||||
{
|
||||
Write-Host $from "->" $to
|
||||
New-Item -Force $to | Out-Null
|
||||
Copy-Item -Force $from $to
|
||||
if (! $?) { exit 1 }
|
||||
}
|
||||
|
||||
function Build-Version([string]$vs, [string]$toolset, [string]$linkage)
|
||||
{
|
||||
$prjsuffix = if ($linkage -eq "static") { "_static" } else { "" }
|
||||
$cfgsuffix = if ($linkage -eq "static") { "Static" } else { "" }
|
||||
|
||||
foreach ($configuration in "Debug","Release")
|
||||
{
|
||||
Run-Command "msbuild pugixml_$vs$prjsuffix.vcxproj /t:Rebuild /p:Configuration=$configuration /p:Platform=x86 /v:minimal /nologo"
|
||||
Run-Command "msbuild pugixml_$vs$prjsuffix.vcxproj /t:Rebuild /p:Configuration=$configuration /p:Platform=x64 /v:minimal /nologo"
|
||||
|
||||
Force-Copy "$vs/Win32_$configuration$cfgsuffix/pugixml.lib" "nuget/build/native/lib/Win32/$toolset/$linkage/$configuration/pugixml.lib"
|
||||
Force-Copy "$vs/x64_$configuration$cfgsuffix/pugixml.lib" "nuget/build/native/lib/x64/$toolset/$linkage/$configuration/pugixml.lib"
|
||||
}
|
||||
}
|
||||
|
||||
Push-Location
|
||||
$scriptdir = Split-Path $MyInvocation.MyCommand.Path
|
||||
cd $scriptdir
|
||||
|
||||
Force-Copy "../src/pugiconfig.hpp" "nuget/build/native/include/pugiconfig.hpp"
|
||||
Force-Copy "../src/pugixml.hpp" "nuget/build/native/include/pugixml.hpp"
|
||||
Force-Copy "../src/pugixml.cpp" "nuget/build/native/include/pugixml.cpp"
|
||||
|
||||
if ($args[0] -eq 2022){
|
||||
Build-Version "vs2022" "v143" "dynamic"
|
||||
Build-Version "vs2022" "v143" "static"
|
||||
|
||||
} elseif ($args[0] -eq 2019){
|
||||
Build-Version "vs2019" "v142" "dynamic"
|
||||
Build-Version "vs2019" "v142" "static"
|
||||
|
||||
} elseif ($args[0] -eq 2017){
|
||||
Build-Version "vs2017" "v141" "dynamic"
|
||||
Build-Version "vs2017" "v141" "static"
|
||||
|
||||
Build-Version "vs2015" "v140" "dynamic"
|
||||
Build-Version "vs2015" "v140" "static"
|
||||
|
||||
Build-Version "vs2013" "v120" "dynamic"
|
||||
Build-Version "vs2013" "v120" "static"
|
||||
|
||||
} elseif($args[0] -eq 2015){
|
||||
Build-Version "vs2015" "v140" "dynamic"
|
||||
Build-Version "vs2015" "v140" "static"
|
||||
|
||||
Build-Version "vs2013" "v120" "dynamic"
|
||||
Build-Version "vs2013" "v120" "static"
|
||||
|
||||
} elseif($args[0] -eq 2013){
|
||||
Build-Version "vs2013" "v120" "dynamic"
|
||||
Build-Version "vs2013" "v120" "static"
|
||||
}
|
||||
|
||||
Run-Command "nuget pack nuget"
|
||||
|
||||
Pop-Location
|
12
scripts/pugixml-config.cmake.in
Normal file
12
scripts/pugixml-config.cmake.in
Normal file
|
@ -0,0 +1,12 @@
|
|||
@PACKAGE_INIT@
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/pugixml-targets.cmake")
|
||||
|
||||
# If the user is not requiring 1.11 (either by explicitly requesting an older
|
||||
# version or not requesting one at all), provide the old imported target name
|
||||
# for compatibility.
|
||||
if (NOT TARGET pugixml AND (NOT DEFINED PACKAGE_FIND_VERSION OR PACKAGE_FIND_VERSION VERSION_LESS "1.11"))
|
||||
add_library(pugixml INTERFACE IMPORTED)
|
||||
# Equivalent to target_link_libraries INTERFACE, but compatible with CMake 3.10
|
||||
set_target_properties(pugixml PROPERTIES INTERFACE_LINK_LIBRARIES pugixml::pugixml)
|
||||
endif ()
|
11
scripts/pugixml.pc.in
Normal file
11
scripts/pugixml.pc.in
Normal file
|
@ -0,0 +1,11 @@
|
|||
prefix=@CMAKE_INSTALL_PREFIX@
|
||||
exec_prefix=${prefix}
|
||||
includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@@INSTALL_SUFFIX@
|
||||
libdir=@CMAKE_INSTALL_FULL_LIBDIR@@INSTALL_SUFFIX@
|
||||
|
||||
Name: pugixml
|
||||
Description: Light-weight, simple and fast XML parser for C++ with XPath support.
|
||||
URL: https://pugixml.org/
|
||||
Version: @pugixml_VERSION@
|
||||
Cflags: -I${includedir}
|
||||
Libs: -L${libdir} -lpugixml@LIB_POSTFIX@
|
14
scripts/pugixml.podspec
Normal file
14
scripts/pugixml.podspec
Normal file
|
@ -0,0 +1,14 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = "pugixml"
|
||||
s.version = "1.13"
|
||||
s.summary = "C++ XML parser library."
|
||||
s.homepage = "https://pugixml.org"
|
||||
s.license = "MIT"
|
||||
s.author = { "Arseny Kapoulkine" => "arseny.kapoulkine@gmail.com" }
|
||||
s.platform = :ios, "7.0"
|
||||
|
||||
s.source = { :git => "https://github.com/zeux/pugixml.git", :tag => "v" + s.version.to_s }
|
||||
|
||||
s.source_files = "src/**/*.{hpp,cpp}"
|
||||
s.header_mappings_dir = "src"
|
||||
end
|
45
scripts/pugixml_dll.rc
Normal file
45
scripts/pugixml_dll.rc
Normal file
|
@ -0,0 +1,45 @@
|
|||
#include <winver.h>
|
||||
|
||||
#define PUGIXML_VERSION_MAJOR 1
|
||||
#define PUGIXML_VERSION_MINOR 13
|
||||
#define PUGIXML_VERSION_PATCH 0
|
||||
#define PUGIXML_VERSION_NUMBER "1.13.0\0"
|
||||
|
||||
#if defined(GCC_WINDRES) || defined(__MINGW32__) || defined(__CYGWIN__)
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
#else
|
||||
VS_VERSION_INFO VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE
|
||||
#endif
|
||||
FILEVERSION PUGIXML_VERSION_MAJOR,PUGIXML_VERSION_MINOR,PUGIXML_VERSION_PATCH,0
|
||||
PRODUCTVERSION PUGIXML_VERSION_MAJOR,PUGIXML_VERSION_MINOR,PUGIXML_VERSION_PATCH,0
|
||||
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 1
|
||||
#else
|
||||
FILEFLAGS 0
|
||||
#endif
|
||||
FILEOS VOS__WINDOWS32
|
||||
FILETYPE VFT_DLL
|
||||
FILESUBTYPE 0 // not used
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904E4"
|
||||
//language ID = U.S. English, char set = Windows, Multilingual
|
||||
BEGIN
|
||||
VALUE "CompanyName", "zeux/pugixml\0"
|
||||
VALUE "FileDescription", "pugixml library\0"
|
||||
VALUE "FileVersion", PUGIXML_VERSION_NUMBER
|
||||
VALUE "InternalName", "pugixml.dll\0"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2006-2022, by Arseny Kapoulkine\0"
|
||||
VALUE "OriginalFilename", "pugixml.dll\0"
|
||||
VALUE "ProductName", "pugixml\0"
|
||||
VALUE "ProductVersion", PUGIXML_VERSION_NUMBER
|
||||
VALUE "Comments", "For more information visit https://github.com/zeux/pugixml/\0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x0409, 1252
|
||||
END
|
||||
END
|
|
@ -64,17 +64,17 @@
|
|||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">vs2010\x32\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">vs2010\x32\Debug\</IntDir>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">pugixmld</TargetName>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">vs2010\x64\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">vs2010\x64\Debug\</IntDir>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">pugixmld</TargetName>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">vs2010\x32\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">vs2010\x32\Release\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">vs2010\Win32_Debug\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">vs2010\Win32_Debug\</IntDir>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">pugixml</TargetName>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">vs2010\x64_Debug\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">vs2010\x64_Debug\</IntDir>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">pugixml</TargetName>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">vs2010\Win32_Release\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">vs2010\Win32_Release\</IntDir>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">pugixml</TargetName>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">vs2010\x64\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">vs2010\x64\Release\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">vs2010\x64_Release\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">vs2010\x64_Release\</IntDir>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">pugixml</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
|
@ -93,12 +93,12 @@
|
|||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Lib>
|
||||
<OutputFile>$(OutDir)pugixmld.lib</OutputFile>
|
||||
<OutputFile>$(OutDir)pugixml.lib</OutputFile>
|
||||
</Lib>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ProgramDataBaseFileName>$(OutDir)pugixmld.pdb</ProgramDataBaseFileName>
|
||||
<ProgramDataBaseFileName>$(OutDir)pugixml.pdb</ProgramDataBaseFileName>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
|
@ -117,12 +117,12 @@
|
|||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Lib>
|
||||
<OutputFile>$(OutDir)pugixmld.lib</OutputFile>
|
||||
<OutputFile>$(OutDir)pugixml.lib</OutputFile>
|
||||
</Lib>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ProgramDataBaseFileName>$(OutDir)pugixmld.pdb</ProgramDataBaseFileName>
|
||||
<ProgramDataBaseFileName>$(OutDir)pugixml.pdb</ProgramDataBaseFileName>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
|
|
|
@ -64,18 +64,18 @@
|
|||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">vs2010\x32\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">vs2010\x32\DebugStatic\</IntDir>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">pugixmlsd</TargetName>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">vs2010\x64\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">vs2010\x64\DebugStatic\</IntDir>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">pugixmlsd</TargetName>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">vs2010\x32\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">vs2010\x32\ReleaseStatic\</IntDir>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">pugixmls</TargetName>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">vs2010\x64\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">vs2010\x64\ReleaseStatic\</IntDir>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">pugixmls</TargetName>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">vs2010\Win32_DebugStatic\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">vs2010\Win32_DebugStatic\</IntDir>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">pugixml</TargetName>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">vs2010\x64_DebugStatic\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">vs2010\x64_DebugStatic\</IntDir>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">pugixml</TargetName>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">vs2010\Win32_ReleaseStatic\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">vs2010\Win32_ReleaseStatic\</IntDir>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">pugixml</TargetName>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">vs2010\x64_ReleaseStatic\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">vs2010\x64_ReleaseStatic\</IntDir>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">pugixml</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
|
@ -93,12 +93,12 @@
|
|||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Lib>
|
||||
<OutputFile>$(OutDir)pugixmlsd.lib</OutputFile>
|
||||
<OutputFile>$(OutDir)pugixml.lib</OutputFile>
|
||||
</Lib>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ProgramDataBaseFileName>$(OutDir)pugixmlsd.pdb</ProgramDataBaseFileName>
|
||||
<ProgramDataBaseFileName>$(OutDir)pugixml.pdb</ProgramDataBaseFileName>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
|
@ -117,12 +117,12 @@
|
|||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Lib>
|
||||
<OutputFile>$(OutDir)pugixmlsd.lib</OutputFile>
|
||||
<OutputFile>$(OutDir)pugixml.lib</OutputFile>
|
||||
</Lib>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ProgramDataBaseFileName>$(OutDir)pugixmlsd.pdb</ProgramDataBaseFileName>
|
||||
<ProgramDataBaseFileName>$(OutDir)pugixml.pdb</ProgramDataBaseFileName>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
|
@ -141,14 +141,14 @@
|
|||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Lib>
|
||||
<OutputFile>$(OutDir)pugixmls.lib</OutputFile>
|
||||
<OutputFile>$(OutDir)pugixml.lib</OutputFile>
|
||||
</Lib>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<ProgramDataBaseFileName>$(OutDir)pugixmls.pdb</ProgramDataBaseFileName>
|
||||
<ProgramDataBaseFileName>$(OutDir)pugixml.pdb</ProgramDataBaseFileName>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
|
@ -167,14 +167,14 @@
|
|||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Lib>
|
||||
<OutputFile>$(OutDir)pugixmls.lib</OutputFile>
|
||||
<OutputFile>$(OutDir)pugixml.lib</OutputFile>
|
||||
</Lib>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<ProgramDataBaseFileName>$(OutDir)pugixmls.pdb</ProgramDataBaseFileName>
|
||||
<ProgramDataBaseFileName>$(OutDir)pugixml.pdb</ProgramDataBaseFileName>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
|
|
199
scripts/pugixml_vs2013.vcxproj
Normal file
199
scripts/pugixml_vs2013.vcxproj
Normal file
|
@ -0,0 +1,199 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{89A1E353-E2DC-495C-B403-742BE206ACED}</ProjectGuid>
|
||||
<RootNamespace>pugixml</RootNamespace>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">vs2013\Win32_Debug\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">vs2013\Win32_Debug\</IntDir>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">pugixml</TargetName>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">vs2013\x64_Debug\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">vs2013\x64_Debug\</IntDir>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">pugixml</TargetName>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">vs2013\Win32_Release\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">vs2013\Win32_Release\</IntDir>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">pugixml</TargetName>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">vs2013\x64_Release\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">vs2013\x64_Release\</IntDir>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">pugixml</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Lib>
|
||||
<OutputFile>$(OutDir)pugixml.lib</OutputFile>
|
||||
</Lib>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ProgramDataBaseFileName>$(OutDir)pugixml.pdb</ProgramDataBaseFileName>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Lib>
|
||||
<OutputFile>$(OutDir)pugixml.lib</OutputFile>
|
||||
</Lib>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ProgramDataBaseFileName>$(OutDir)pugixml.pdb</ProgramDataBaseFileName>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Full</Optimization>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Lib>
|
||||
<OutputFile>$(OutDir)pugixml.lib</OutputFile>
|
||||
</Lib>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<ProgramDataBaseFileName>$(OutDir)pugixml.pdb</ProgramDataBaseFileName>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<Optimization>Full</Optimization>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Lib>
|
||||
<OutputFile>$(OutDir)pugixml.lib</OutputFile>
|
||||
</Lib>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<ProgramDataBaseFileName>$(OutDir)pugixml.pdb</ProgramDataBaseFileName>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\src\pugixml.hpp" />
|
||||
<ClInclude Include="..\src\pugiconfig.hpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\src\pugixml.cpp">
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
199
scripts/pugixml_vs2013_static.vcxproj
Normal file
199
scripts/pugixml_vs2013_static.vcxproj
Normal file
|
@ -0,0 +1,199 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{89A1E353-E2DC-495C-B403-742BE206ACED}</ProjectGuid>
|
||||
<RootNamespace>pugixml</RootNamespace>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">vs2013\Win32_DebugStatic\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">vs2013\Win32_DebugStatic\</IntDir>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">pugixml</TargetName>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">vs2013\x64_DebugStatic\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">vs2013\x64_DebugStatic\</IntDir>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">pugixml</TargetName>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">vs2013\Win32_ReleaseStatic\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">vs2013\Win32_ReleaseStatic\</IntDir>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">pugixml</TargetName>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">vs2013\x64_ReleaseStatic\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">vs2013\x64_ReleaseStatic\</IntDir>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">pugixml</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Lib>
|
||||
<OutputFile>$(OutDir)pugixml.lib</OutputFile>
|
||||
</Lib>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ProgramDataBaseFileName>$(OutDir)pugixml.pdb</ProgramDataBaseFileName>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Lib>
|
||||
<OutputFile>$(OutDir)pugixml.lib</OutputFile>
|
||||
</Lib>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ProgramDataBaseFileName>$(OutDir)pugixml.pdb</ProgramDataBaseFileName>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Full</Optimization>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Lib>
|
||||
<OutputFile>$(OutDir)pugixml.lib</OutputFile>
|
||||
</Lib>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<ProgramDataBaseFileName>$(OutDir)pugixml.pdb</ProgramDataBaseFileName>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<Optimization>Full</Optimization>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Lib>
|
||||
<OutputFile>$(OutDir)pugixml.lib</OutputFile>
|
||||
</Lib>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<ProgramDataBaseFileName>$(OutDir)pugixml.pdb</ProgramDataBaseFileName>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\src\pugixml.hpp" />
|
||||
<ClInclude Include="..\src\pugiconfig.hpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\src\pugixml.cpp">
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
172
scripts/pugixml_vs2015.vcxproj
Normal file
172
scripts/pugixml_vs2015.vcxproj
Normal file
|
@ -0,0 +1,172 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{07CF01C0-B887-499D-AD9C-799CB6A9FE64}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>pugixml</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<OutDir>vs2015\$(Platform)_$(Configuration)\</OutDir>
|
||||
<IntDir>vs2015\$(Platform)_$(Configuration)\</IntDir>
|
||||
<TargetName>pugixml</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>vs2015\$(Platform)_$(Configuration)\</OutDir>
|
||||
<IntDir>vs2015\$(Platform)_$(Configuration)\</IntDir>
|
||||
<TargetName>pugixml</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<OutDir>vs2015\$(Platform)_$(Configuration)\</OutDir>
|
||||
<IntDir>vs2015\$(Platform)_$(Configuration)\</IntDir>
|
||||
<TargetName>pugixml</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<OutDir>vs2015\$(Platform)_$(Configuration)\</OutDir>
|
||||
<IntDir>vs2015\$(Platform)_$(Configuration)\</IntDir>
|
||||
<TargetName>pugixml</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\src\pugiconfig.hpp" />
|
||||
<ClInclude Include="..\src\pugixml.hpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\src\pugixml.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
176
scripts/pugixml_vs2015_static.vcxproj
Normal file
176
scripts/pugixml_vs2015_static.vcxproj
Normal file
|
@ -0,0 +1,176 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{07CF01C0-B887-499D-AD9C-799CB6A9FE64}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>pugixml</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<OutDir>vs2015\$(Platform)_$(Configuration)Static\</OutDir>
|
||||
<IntDir>vs2015\$(Platform)_$(Configuration)Static\</IntDir>
|
||||
<TargetName>pugixml</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>vs2015\$(Platform)_$(Configuration)Static\</OutDir>
|
||||
<IntDir>vs2015\$(Platform)_$(Configuration)Static\</IntDir>
|
||||
<TargetName>pugixml</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<OutDir>vs2015\$(Platform)_$(Configuration)Static\</OutDir>
|
||||
<IntDir>vs2015\$(Platform)_$(Configuration)Static\</IntDir>
|
||||
<TargetName>pugixml</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<OutDir>vs2015\$(Platform)_$(Configuration)Static\</OutDir>
|
||||
<IntDir>vs2015\$(Platform)_$(Configuration)Static\</IntDir>
|
||||
<TargetName>pugixml</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\src\pugiconfig.hpp" />
|
||||
<ClInclude Include="..\src\pugixml.hpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\src\pugixml.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
172
scripts/pugixml_vs2017.vcxproj
Normal file
172
scripts/pugixml_vs2017.vcxproj
Normal file
|
@ -0,0 +1,172 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{07CF01C0-B887-499D-AD9C-799CB6A9FE64}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>pugixml</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<OutDir>vs2017\$(Platform)_$(Configuration)\</OutDir>
|
||||
<IntDir>vs2017\$(Platform)_$(Configuration)\</IntDir>
|
||||
<TargetName>pugixml</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>vs2017\$(Platform)_$(Configuration)\</OutDir>
|
||||
<IntDir>vs2017\$(Platform)_$(Configuration)\</IntDir>
|
||||
<TargetName>pugixml</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<OutDir>vs2017\$(Platform)_$(Configuration)\</OutDir>
|
||||
<IntDir>vs2017\$(Platform)_$(Configuration)\</IntDir>
|
||||
<TargetName>pugixml</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<OutDir>vs2017\$(Platform)_$(Configuration)\</OutDir>
|
||||
<IntDir>vs2017\$(Platform)_$(Configuration)\</IntDir>
|
||||
<TargetName>pugixml</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\src\pugiconfig.hpp" />
|
||||
<ClInclude Include="..\src\pugixml.hpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\src\pugixml.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
176
scripts/pugixml_vs2017_static.vcxproj
Normal file
176
scripts/pugixml_vs2017_static.vcxproj
Normal file
|
@ -0,0 +1,176 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{07CF01C0-B887-499D-AD9C-799CB6A9FE64}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>pugixml</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<OutDir>vs2017\$(Platform)_$(Configuration)Static\</OutDir>
|
||||
<IntDir>vs2017\$(Platform)_$(Configuration)Static\</IntDir>
|
||||
<TargetName>pugixml</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>vs2017\$(Platform)_$(Configuration)Static\</OutDir>
|
||||
<IntDir>vs2017\$(Platform)_$(Configuration)Static\</IntDir>
|
||||
<TargetName>pugixml</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<OutDir>vs2017\$(Platform)_$(Configuration)Static\</OutDir>
|
||||
<IntDir>vs2017\$(Platform)_$(Configuration)Static\</IntDir>
|
||||
<TargetName>pugixml</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<OutDir>vs2017\$(Platform)_$(Configuration)Static\</OutDir>
|
||||
<IntDir>vs2017\$(Platform)_$(Configuration)Static\</IntDir>
|
||||
<TargetName>pugixml</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\src\pugiconfig.hpp" />
|
||||
<ClInclude Include="..\src\pugixml.hpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\src\pugixml.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
172
scripts/pugixml_vs2019.vcxproj
Normal file
172
scripts/pugixml_vs2019.vcxproj
Normal file
|
@ -0,0 +1,172 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{07CF01C0-B887-499D-AD9C-799CB6A9FE64}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>pugixml</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<OutDir>vs2019\$(Platform)_$(Configuration)\</OutDir>
|
||||
<IntDir>vs2019\$(Platform)_$(Configuration)\</IntDir>
|
||||
<TargetName>pugixml</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>vs2019\$(Platform)_$(Configuration)\</OutDir>
|
||||
<IntDir>vs2019\$(Platform)_$(Configuration)\</IntDir>
|
||||
<TargetName>pugixml</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<OutDir>vs2019\$(Platform)_$(Configuration)\</OutDir>
|
||||
<IntDir>vs2019\$(Platform)_$(Configuration)\</IntDir>
|
||||
<TargetName>pugixml</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<OutDir>vs2019\$(Platform)_$(Configuration)\</OutDir>
|
||||
<IntDir>vs2019\$(Platform)_$(Configuration)\</IntDir>
|
||||
<TargetName>pugixml</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\src\pugiconfig.hpp" />
|
||||
<ClInclude Include="..\src\pugixml.hpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\src\pugixml.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
176
scripts/pugixml_vs2019_static.vcxproj
Normal file
176
scripts/pugixml_vs2019_static.vcxproj
Normal file
|
@ -0,0 +1,176 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{07CF01C0-B887-499D-AD9C-799CB6A9FE64}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>pugixml</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<OutDir>vs2019\$(Platform)_$(Configuration)Static\</OutDir>
|
||||
<IntDir>vs2019\$(Platform)_$(Configuration)Static\</IntDir>
|
||||
<TargetName>pugixml</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>vs2019\$(Platform)_$(Configuration)Static\</OutDir>
|
||||
<IntDir>vs2019\$(Platform)_$(Configuration)Static\</IntDir>
|
||||
<TargetName>pugixml</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<OutDir>vs2019\$(Platform)_$(Configuration)Static\</OutDir>
|
||||
<IntDir>vs2019\$(Platform)_$(Configuration)Static\</IntDir>
|
||||
<TargetName>pugixml</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<OutDir>vs2019\$(Platform)_$(Configuration)Static\</OutDir>
|
||||
<IntDir>vs2019\$(Platform)_$(Configuration)Static\</IntDir>
|
||||
<TargetName>pugixml</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\src\pugiconfig.hpp" />
|
||||
<ClInclude Include="..\src\pugixml.hpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\src\pugixml.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
172
scripts/pugixml_vs2022.vcxproj
Normal file
172
scripts/pugixml_vs2022.vcxproj
Normal file
|
@ -0,0 +1,172 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{07CF01C0-B887-499D-AD9C-799CB6A9FE64}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>pugixml</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<OutDir>vs2022\$(Platform)_$(Configuration)\</OutDir>
|
||||
<IntDir>vs2022\$(Platform)_$(Configuration)\</IntDir>
|
||||
<TargetName>pugixml</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>vs2022\$(Platform)_$(Configuration)\</OutDir>
|
||||
<IntDir>vs2022\$(Platform)_$(Configuration)\</IntDir>
|
||||
<TargetName>pugixml</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<OutDir>vs2022\$(Platform)_$(Configuration)\</OutDir>
|
||||
<IntDir>vs2022\$(Platform)_$(Configuration)\</IntDir>
|
||||
<TargetName>pugixml</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<OutDir>vs2022\$(Platform)_$(Configuration)\</OutDir>
|
||||
<IntDir>vs2022\$(Platform)_$(Configuration)\</IntDir>
|
||||
<TargetName>pugixml</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\src\pugiconfig.hpp" />
|
||||
<ClInclude Include="..\src\pugixml.hpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\src\pugixml.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
176
scripts/pugixml_vs2022_static.vcxproj
Normal file
176
scripts/pugixml_vs2022_static.vcxproj
Normal file
|
@ -0,0 +1,176 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{07CF01C0-B887-499D-AD9C-799CB6A9FE64}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>pugixml</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<OutDir>vs2022\$(Platform)_$(Configuration)Static\</OutDir>
|
||||
<IntDir>vs2022\$(Platform)_$(Configuration)Static\</IntDir>
|
||||
<TargetName>pugixml</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>vs2022\$(Platform)_$(Configuration)Static\</OutDir>
|
||||
<IntDir>vs2022\$(Platform)_$(Configuration)Static\</IntDir>
|
||||
<TargetName>pugixml</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<OutDir>vs2022\$(Platform)_$(Configuration)Static\</OutDir>
|
||||
<IntDir>vs2022\$(Platform)_$(Configuration)Static\</IntDir>
|
||||
<TargetName>pugixml</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<OutDir>vs2022\$(Platform)_$(Configuration)Static\</OutDir>
|
||||
<IntDir>vs2022\$(Platform)_$(Configuration)Static\</IntDir>
|
||||
<TargetName>pugixml</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\src\pugiconfig.hpp" />
|
||||
<ClInclude Include="..\src\pugixml.hpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\src\pugixml.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
|
@ -1,8 +1,8 @@
|
|||
/**
|
||||
* pugixml parser - version 1.6
|
||||
* pugixml parser - version 1.13
|
||||
* --------------------------------------------------------
|
||||
* Copyright (C) 2006-2015, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
|
||||
* Report bugs and download new versions at http://pugixml.org/
|
||||
* Copyright (C) 2006-2022, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
|
||||
* Report bugs and download new versions at https://pugixml.org/
|
||||
*
|
||||
* This library is distributed under the MIT License. See notice at the end
|
||||
* of this file.
|
||||
|
@ -17,6 +17,9 @@
|
|||
// Uncomment this to enable wchar_t mode
|
||||
// #define PUGIXML_WCHAR_MODE
|
||||
|
||||
// Uncomment this to enable compact mode
|
||||
// #define PUGIXML_COMPACT
|
||||
|
||||
// Uncomment this to disable XPath
|
||||
// #define PUGIXML_NO_XPATH
|
||||
|
||||
|
@ -37,6 +40,9 @@
|
|||
// #define PUGIXML_MEMORY_OUTPUT_STACK 10240
|
||||
// #define PUGIXML_MEMORY_XPATH_PAGE_SIZE 4096
|
||||
|
||||
// Tune this constant to adjust max nesting for XPath queries
|
||||
// #define PUGIXML_XPATH_DEPTH_LIMIT 1024
|
||||
|
||||
// Uncomment this to switch to header-only version
|
||||
// #define PUGIXML_HEADER_ONLY
|
||||
|
||||
|
@ -46,7 +52,7 @@
|
|||
#endif
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006-2015 Arseny Kapoulkine
|
||||
* Copyright (c) 2006-2022 Arseny Kapoulkine
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
|
@ -59,7 +65,7 @@
|
|||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
|
|
5262
src/pugixml.cpp
5262
src/pugixml.cpp
File diff suppressed because it is too large
Load diff
300
src/pugixml.hpp
300
src/pugixml.hpp
|
@ -1,8 +1,8 @@
|
|||
/**
|
||||
* pugixml parser - version 1.6
|
||||
* pugixml parser - version 1.13
|
||||
* --------------------------------------------------------
|
||||
* Copyright (C) 2006-2015, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
|
||||
* Report bugs and download new versions at http://pugixml.org/
|
||||
* Copyright (C) 2006-2022, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
|
||||
* Report bugs and download new versions at https://pugixml.org/
|
||||
*
|
||||
* This library is distributed under the MIT License. See notice at the end
|
||||
* of this file.
|
||||
|
@ -11,9 +11,10 @@
|
|||
* Copyright (C) 2003, by Kristen Wegner (kristen@tima.net)
|
||||
*/
|
||||
|
||||
// Define version macro; evaluates to major * 1000 + minor * 10 + patch so that it's safe to use in less-than comparisons
|
||||
// Note: pugixml used major * 100 + minor * 10 + patch format up until 1.9 (which had version identifier 190); starting from pugixml 1.10, the minor version number is two digits
|
||||
#ifndef PUGIXML_VERSION
|
||||
// Define version macro; evaluates to major * 100 + minor so that it's safe to use in less-than comparisons
|
||||
# define PUGIXML_VERSION 160
|
||||
# define PUGIXML_VERSION 1130 // 1.13
|
||||
#endif
|
||||
|
||||
// Include user configuration file (this can define various configuration macros)
|
||||
|
@ -65,13 +66,62 @@
|
|||
|
||||
// If the platform is known to have long long support, enable long long functions
|
||||
#ifndef PUGIXML_HAS_LONG_LONG
|
||||
# if defined(__cplusplus) && __cplusplus >= 201103
|
||||
# if __cplusplus >= 201103
|
||||
# define PUGIXML_HAS_LONG_LONG
|
||||
# elif defined(_MSC_VER) && _MSC_VER >= 1400
|
||||
# define PUGIXML_HAS_LONG_LONG
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// If the platform is known to have move semantics support, compile move ctor/operator implementation
|
||||
#ifndef PUGIXML_HAS_MOVE
|
||||
# if __cplusplus >= 201103
|
||||
# define PUGIXML_HAS_MOVE
|
||||
# elif defined(_MSC_VER) && _MSC_VER >= 1600
|
||||
# define PUGIXML_HAS_MOVE
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// If C++ is 2011 or higher, add 'noexcept' specifiers
|
||||
#ifndef PUGIXML_NOEXCEPT
|
||||
# if __cplusplus >= 201103
|
||||
# define PUGIXML_NOEXCEPT noexcept
|
||||
# elif defined(_MSC_VER) && _MSC_VER >= 1900
|
||||
# define PUGIXML_NOEXCEPT noexcept
|
||||
# else
|
||||
# define PUGIXML_NOEXCEPT
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// Some functions can not be noexcept in compact mode
|
||||
#ifdef PUGIXML_COMPACT
|
||||
# define PUGIXML_NOEXCEPT_IF_NOT_COMPACT
|
||||
#else
|
||||
# define PUGIXML_NOEXCEPT_IF_NOT_COMPACT PUGIXML_NOEXCEPT
|
||||
#endif
|
||||
|
||||
// If C++ is 2011 or higher, add 'override' qualifiers
|
||||
#ifndef PUGIXML_OVERRIDE
|
||||
# if __cplusplus >= 201103
|
||||
# define PUGIXML_OVERRIDE override
|
||||
# elif defined(_MSC_VER) && _MSC_VER >= 1700
|
||||
# define PUGIXML_OVERRIDE override
|
||||
# else
|
||||
# define PUGIXML_OVERRIDE
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// If C++ is 2011 or higher, use 'nullptr'
|
||||
#ifndef PUGIXML_NULL
|
||||
# if __cplusplus >= 201103
|
||||
# define PUGIXML_NULL nullptr
|
||||
# elif defined(_MSC_VER) && _MSC_VER >= 1600
|
||||
# define PUGIXML_NULL nullptr
|
||||
# else
|
||||
# define PUGIXML_NULL 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// Character interface macros
|
||||
#ifdef PUGIXML_WCHAR_MODE
|
||||
# define PUGIXML_TEXT(t) L ## t
|
||||
|
@ -133,13 +183,13 @@ namespace pugi
|
|||
|
||||
// This flag determines if EOL characters are normalized (converted to #xA) during parsing. This flag is on by default.
|
||||
const unsigned int parse_eol = 0x0020;
|
||||
|
||||
|
||||
// This flag determines if attribute values are normalized using CDATA normalization rules during parsing. This flag is on by default.
|
||||
const unsigned int parse_wconv_attribute = 0x0040;
|
||||
|
||||
// This flag determines if attribute values are normalized using NMTOKENS normalization rules during parsing. This flag is off by default.
|
||||
const unsigned int parse_wnorm_attribute = 0x0080;
|
||||
|
||||
|
||||
// This flag determines if document declaration (node_declaration) is added to the DOM tree. This flag is off by default.
|
||||
const unsigned int parse_declaration = 0x0100;
|
||||
|
||||
|
@ -158,6 +208,11 @@ namespace pugi
|
|||
// is a valid document. This flag is off by default.
|
||||
const unsigned int parse_fragment = 0x1000;
|
||||
|
||||
// This flag determines if plain character data is be stored in the parent element's value. This significantly changes the structure of
|
||||
// the document; this flag is only recommended for parsing documents with many PCDATA nodes in memory-constrained environments.
|
||||
// This flag is off by default.
|
||||
const unsigned int parse_embed_pcdata = 0x2000;
|
||||
|
||||
// The default parsing mode.
|
||||
// Elements, PCDATA and CDATA sections are added to the DOM tree, character/reference entities are expanded,
|
||||
// End-of-Line characters are normalized, attribute values are normalized using CDATA normalization rules.
|
||||
|
@ -184,16 +239,16 @@ namespace pugi
|
|||
};
|
||||
|
||||
// Formatting flags
|
||||
|
||||
|
||||
// Indent the nodes that are written to output stream with as many indentation strings as deep the node is in DOM tree. This flag is on by default.
|
||||
const unsigned int format_indent = 0x01;
|
||||
|
||||
|
||||
// Write encoding-specific BOM to the output stream. This flag is off by default.
|
||||
const unsigned int format_write_bom = 0x02;
|
||||
|
||||
// Use raw output mode (no indentation and no line breaks are written). This flag is off by default.
|
||||
const unsigned int format_raw = 0x04;
|
||||
|
||||
|
||||
// Omit default XML declaration even if there is no declaration in the document. This flag is off by default.
|
||||
const unsigned int format_no_declaration = 0x08;
|
||||
|
||||
|
@ -203,10 +258,25 @@ namespace pugi
|
|||
// Open file using text mode in xml_document::save_file. This enables special character (i.e. new-line) conversions on some systems. This flag is off by default.
|
||||
const unsigned int format_save_file_text = 0x20;
|
||||
|
||||
// Write every attribute on a new line with appropriate indentation. This flag is off by default.
|
||||
const unsigned int format_indent_attributes = 0x40;
|
||||
|
||||
// Don't output empty element tags, instead writing an explicit start and end tag even if there are no children. This flag is off by default.
|
||||
const unsigned int format_no_empty_element_tags = 0x80;
|
||||
|
||||
// Skip characters belonging to range [0; 32) instead of "&#xNN;" encoding. This flag is off by default.
|
||||
const unsigned int format_skip_control_chars = 0x100;
|
||||
|
||||
// Use single quotes ' instead of double quotes " for enclosing attribute values. This flag is off by default.
|
||||
const unsigned int format_attribute_single_quote = 0x200;
|
||||
|
||||
// The default set of formatting flags.
|
||||
// Nodes are indented depending on their depth in DOM tree, a default declaration is output if document has none.
|
||||
const unsigned int format_default = format_indent;
|
||||
|
||||
|
||||
const int default_double_precision = 17;
|
||||
const int default_float_precision = 9;
|
||||
|
||||
// Forward declarations
|
||||
struct xml_attribute_struct;
|
||||
struct xml_node_struct;
|
||||
|
@ -222,7 +292,7 @@ namespace pugi
|
|||
class xml_node;
|
||||
|
||||
class xml_text;
|
||||
|
||||
|
||||
#ifndef PUGIXML_NO_XPATH
|
||||
class xpath_node;
|
||||
class xpath_node_set;
|
||||
|
@ -244,6 +314,8 @@ namespace pugi
|
|||
It begin() const { return _begin; }
|
||||
It end() const { return _end; }
|
||||
|
||||
bool empty() const { return _begin == _end; }
|
||||
|
||||
private:
|
||||
It _begin, _end;
|
||||
};
|
||||
|
@ -265,7 +337,7 @@ namespace pugi
|
|||
// Construct writer from a FILE* object; void* is used to avoid header dependencies on stdio
|
||||
xml_writer_file(void* file);
|
||||
|
||||
virtual void write(const void* data, size_t size);
|
||||
virtual void write(const void* data, size_t size) PUGIXML_OVERRIDE;
|
||||
|
||||
private:
|
||||
void* file;
|
||||
|
@ -280,7 +352,7 @@ namespace pugi
|
|||
xml_writer_stream(std::basic_ostream<char, std::char_traits<char> >& stream);
|
||||
xml_writer_stream(std::basic_ostream<wchar_t, std::char_traits<wchar_t> >& stream);
|
||||
|
||||
virtual void write(const void* data, size_t size);
|
||||
virtual void write(const void* data, size_t size) PUGIXML_OVERRIDE;
|
||||
|
||||
private:
|
||||
std::basic_ostream<char, std::char_traits<char> >* narrow_stream;
|
||||
|
@ -296,13 +368,13 @@ namespace pugi
|
|||
|
||||
private:
|
||||
xml_attribute_struct* _attr;
|
||||
|
||||
|
||||
typedef void (*unspecified_bool_type)(xml_attribute***);
|
||||
|
||||
public:
|
||||
// Default constructor. Constructs an empty attribute.
|
||||
xml_attribute();
|
||||
|
||||
|
||||
// Constructs attribute from internal pointer
|
||||
explicit xml_attribute(xml_attribute_struct* attr);
|
||||
|
||||
|
@ -346,13 +418,18 @@ namespace pugi
|
|||
|
||||
// Set attribute name/value (returns false if attribute is empty or there is not enough memory)
|
||||
bool set_name(const char_t* rhs);
|
||||
bool set_value(const char_t* rhs, size_t sz);
|
||||
bool set_value(const char_t* rhs);
|
||||
|
||||
// Set attribute value with type conversion (numbers are converted to strings, boolean is converted to "true"/"false")
|
||||
bool set_value(int rhs);
|
||||
bool set_value(unsigned int rhs);
|
||||
bool set_value(long rhs);
|
||||
bool set_value(unsigned long rhs);
|
||||
bool set_value(double rhs);
|
||||
bool set_value(double rhs, int precision);
|
||||
bool set_value(float rhs);
|
||||
bool set_value(float rhs, int precision);
|
||||
bool set_value(bool rhs);
|
||||
|
||||
#ifdef PUGIXML_HAS_LONG_LONG
|
||||
|
@ -364,6 +441,8 @@ namespace pugi
|
|||
xml_attribute& operator=(const char_t* rhs);
|
||||
xml_attribute& operator=(int rhs);
|
||||
xml_attribute& operator=(unsigned int rhs);
|
||||
xml_attribute& operator=(long rhs);
|
||||
xml_attribute& operator=(unsigned long rhs);
|
||||
xml_attribute& operator=(double rhs);
|
||||
xml_attribute& operator=(float rhs);
|
||||
xml_attribute& operator=(bool rhs);
|
||||
|
@ -414,7 +493,7 @@ namespace pugi
|
|||
|
||||
// Borland C++ workaround
|
||||
bool operator!() const;
|
||||
|
||||
|
||||
// Comparison operators (compares wrapped node pointers)
|
||||
bool operator==(const xml_node& r) const;
|
||||
bool operator!=(const xml_node& r) const;
|
||||
|
@ -435,7 +514,7 @@ namespace pugi
|
|||
// Get node value, or "" if node is empty or it has no value
|
||||
// Note: For <node>text</node> node.value() does not return "text"! Use child_value() or text() methods to access text inside nodes.
|
||||
const char_t* value() const;
|
||||
|
||||
|
||||
// Get attribute list
|
||||
xml_attribute first_attribute() const;
|
||||
xml_attribute last_attribute() const;
|
||||
|
@ -447,7 +526,7 @@ namespace pugi
|
|||
// Get next/previous sibling in the children list of the parent node
|
||||
xml_node next_sibling() const;
|
||||
xml_node previous_sibling() const;
|
||||
|
||||
|
||||
// Get parent node
|
||||
xml_node parent() const;
|
||||
|
||||
|
@ -463,6 +542,9 @@ namespace pugi
|
|||
xml_node next_sibling(const char_t* name) const;
|
||||
xml_node previous_sibling(const char_t* name) const;
|
||||
|
||||
// Get attribute, starting the search from a hint (and updating hint so that searching for a sequence of attributes is fast)
|
||||
xml_attribute attribute(const char_t* name, xml_attribute& hint) const;
|
||||
|
||||
// Get child value of current node; that is, value of the first child node of type PCDATA/CDATA
|
||||
const char_t* child_value() const;
|
||||
|
||||
|
@ -471,8 +553,9 @@ namespace pugi
|
|||
|
||||
// Set node name/value (returns false if node is empty, there is not enough memory, or node can not have name/value)
|
||||
bool set_name(const char_t* rhs);
|
||||
bool set_value(const char_t* rhs, size_t sz);
|
||||
bool set_value(const char_t* rhs);
|
||||
|
||||
|
||||
// Add attribute with specified name. Returns added attribute, or empty attribute on errors.
|
||||
xml_attribute append_attribute(const char_t* name);
|
||||
xml_attribute prepend_attribute(const char_t* name);
|
||||
|
@ -513,10 +596,16 @@ namespace pugi
|
|||
bool remove_attribute(const xml_attribute& a);
|
||||
bool remove_attribute(const char_t* name);
|
||||
|
||||
// Remove all attributes
|
||||
bool remove_attributes();
|
||||
|
||||
// Remove specified child
|
||||
bool remove_child(const xml_node& n);
|
||||
bool remove_child(const char_t* name);
|
||||
|
||||
// Remove all children
|
||||
bool remove_children();
|
||||
|
||||
// Parses buffer as an XML document fragment and appends all nodes as children of the current node.
|
||||
// Copies/converts the buffer, so it may be deleted or changed after the function returns.
|
||||
// Note: append_buffer allocates memory that has the lifetime of the owning document; removing the appended nodes does not immediately reclaim that memory.
|
||||
|
@ -526,11 +615,11 @@ namespace pugi
|
|||
template <typename Predicate> xml_attribute find_attribute(Predicate pred) const
|
||||
{
|
||||
if (!_root) return xml_attribute();
|
||||
|
||||
|
||||
for (xml_attribute attrib = first_attribute(); attrib; attrib = attrib.next_attribute())
|
||||
if (pred(attrib))
|
||||
return attrib;
|
||||
|
||||
|
||||
return xml_attribute();
|
||||
}
|
||||
|
||||
|
@ -538,11 +627,11 @@ namespace pugi
|
|||
template <typename Predicate> xml_node find_child(Predicate pred) const
|
||||
{
|
||||
if (!_root) return xml_node();
|
||||
|
||||
|
||||
for (xml_node node = first_child(); node; node = node.next_sibling())
|
||||
if (pred(node))
|
||||
return node;
|
||||
|
||||
|
||||
return xml_node();
|
||||
}
|
||||
|
||||
|
@ -552,7 +641,7 @@ namespace pugi
|
|||
if (!_root) return xml_node();
|
||||
|
||||
xml_node cur = first_child();
|
||||
|
||||
|
||||
while (cur._root && cur._root != _root)
|
||||
{
|
||||
if (pred(cur)) return cur;
|
||||
|
@ -584,22 +673,22 @@ namespace pugi
|
|||
|
||||
// Recursively traverse subtree with xml_tree_walker
|
||||
bool traverse(xml_tree_walker& walker);
|
||||
|
||||
|
||||
#ifndef PUGIXML_NO_XPATH
|
||||
// Select single node by evaluating XPath query. Returns first node from the resulting node set.
|
||||
xpath_node select_node(const char_t* query, xpath_variable_set* variables = 0) const;
|
||||
xpath_node select_node(const char_t* query, xpath_variable_set* variables = PUGIXML_NULL) const;
|
||||
xpath_node select_node(const xpath_query& query) const;
|
||||
|
||||
// Select node set by evaluating XPath query
|
||||
xpath_node_set select_nodes(const char_t* query, xpath_variable_set* variables = 0) const;
|
||||
xpath_node_set select_nodes(const char_t* query, xpath_variable_set* variables = PUGIXML_NULL) const;
|
||||
xpath_node_set select_nodes(const xpath_query& query) const;
|
||||
|
||||
// (deprecated: use select_node instead) Select single node by evaluating XPath query.
|
||||
xpath_node select_single_node(const char_t* query, xpath_variable_set* variables = 0) const;
|
||||
xpath_node select_single_node(const xpath_query& query) const;
|
||||
PUGIXML_DEPRECATED xpath_node select_single_node(const char_t* query, xpath_variable_set* variables = PUGIXML_NULL) const;
|
||||
PUGIXML_DEPRECATED xpath_node select_single_node(const xpath_query& query) const;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
// Print subtree using a writer object
|
||||
void print(xml_writer& writer, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto, unsigned int depth = 0) const;
|
||||
|
||||
|
@ -690,13 +779,18 @@ namespace pugi
|
|||
bool as_bool(bool def = false) const;
|
||||
|
||||
// Set text (returns false if object is empty or there is not enough memory)
|
||||
bool set(const char_t* rhs, size_t sz);
|
||||
bool set(const char_t* rhs);
|
||||
|
||||
// Set text with type conversion (numbers are converted to strings, boolean is converted to "true"/"false")
|
||||
bool set(int rhs);
|
||||
bool set(unsigned int rhs);
|
||||
bool set(long rhs);
|
||||
bool set(unsigned long rhs);
|
||||
bool set(double rhs);
|
||||
bool set(double rhs, int precision);
|
||||
bool set(float rhs);
|
||||
bool set(float rhs, int precision);
|
||||
bool set(bool rhs);
|
||||
|
||||
#ifdef PUGIXML_HAS_LONG_LONG
|
||||
|
@ -708,6 +802,8 @@ namespace pugi
|
|||
xml_text& operator=(const char_t* rhs);
|
||||
xml_text& operator=(int rhs);
|
||||
xml_text& operator=(unsigned int rhs);
|
||||
xml_text& operator=(long rhs);
|
||||
xml_text& operator=(unsigned long rhs);
|
||||
xml_text& operator=(double rhs);
|
||||
xml_text& operator=(float rhs);
|
||||
xml_text& operator=(bool rhs);
|
||||
|
@ -762,10 +858,10 @@ namespace pugi
|
|||
xml_node& operator*() const;
|
||||
xml_node* operator->() const;
|
||||
|
||||
const xml_node_iterator& operator++();
|
||||
xml_node_iterator& operator++();
|
||||
xml_node_iterator operator++(int);
|
||||
|
||||
const xml_node_iterator& operator--();
|
||||
xml_node_iterator& operator--();
|
||||
xml_node_iterator operator--(int);
|
||||
};
|
||||
|
||||
|
@ -804,10 +900,10 @@ namespace pugi
|
|||
xml_attribute& operator*() const;
|
||||
xml_attribute* operator->() const;
|
||||
|
||||
const xml_attribute_iterator& operator++();
|
||||
xml_attribute_iterator& operator++();
|
||||
xml_attribute_iterator operator++(int);
|
||||
|
||||
const xml_attribute_iterator& operator--();
|
||||
xml_attribute_iterator& operator--();
|
||||
xml_attribute_iterator operator--(int);
|
||||
};
|
||||
|
||||
|
@ -840,10 +936,10 @@ namespace pugi
|
|||
xml_node& operator*() const;
|
||||
xml_node* operator->() const;
|
||||
|
||||
const xml_named_node_iterator& operator++();
|
||||
xml_named_node_iterator& operator++();
|
||||
xml_named_node_iterator operator++(int);
|
||||
|
||||
const xml_named_node_iterator& operator--();
|
||||
xml_named_node_iterator& operator--();
|
||||
xml_named_node_iterator operator--(int);
|
||||
|
||||
private:
|
||||
|
@ -861,11 +957,11 @@ namespace pugi
|
|||
|
||||
private:
|
||||
int _depth;
|
||||
|
||||
|
||||
protected:
|
||||
// Get current traversal depth
|
||||
int depth() const;
|
||||
|
||||
|
||||
public:
|
||||
xml_tree_walker();
|
||||
virtual ~xml_tree_walker();
|
||||
|
@ -936,13 +1032,14 @@ namespace pugi
|
|||
char_t* _buffer;
|
||||
|
||||
char _memory[192];
|
||||
|
||||
|
||||
// Non-copyable semantics
|
||||
xml_document(const xml_document&);
|
||||
const xml_document& operator=(const xml_document&);
|
||||
xml_document& operator=(const xml_document&);
|
||||
|
||||
void create();
|
||||
void destroy();
|
||||
void _create();
|
||||
void _destroy();
|
||||
void _move(xml_document& rhs) PUGIXML_NOEXCEPT_IF_NOT_COMPACT;
|
||||
|
||||
public:
|
||||
// Default constructor, makes empty document
|
||||
|
@ -951,6 +1048,12 @@ namespace pugi
|
|||
// Destructor, invalidates all node/attribute handles to this document
|
||||
~xml_document();
|
||||
|
||||
#ifdef PUGIXML_HAS_MOVE
|
||||
// Move semantics support
|
||||
xml_document(xml_document&& rhs) PUGIXML_NOEXCEPT_IF_NOT_COMPACT;
|
||||
xml_document& operator=(xml_document&& rhs) PUGIXML_NOEXCEPT_IF_NOT_COMPACT;
|
||||
#endif
|
||||
|
||||
// Removes all nodes, leaving the empty document
|
||||
void reset();
|
||||
|
||||
|
@ -964,7 +1067,7 @@ namespace pugi
|
|||
#endif
|
||||
|
||||
// (deprecated: use load_string instead) Load document from zero-terminated string. No encoding conversions are applied.
|
||||
xml_parse_result load(const char_t* contents, unsigned int options = parse_default);
|
||||
PUGIXML_DEPRECATED xml_parse_result load(const char_t* contents, unsigned int options = parse_default);
|
||||
|
||||
// Load document from zero-terminated string. No encoding conversions are applied.
|
||||
xml_parse_result load_string(const char_t* contents, unsigned int options = parse_default);
|
||||
|
@ -1040,12 +1143,12 @@ namespace pugi
|
|||
xpath_value_type _type;
|
||||
xpath_variable* _next;
|
||||
|
||||
xpath_variable();
|
||||
xpath_variable(xpath_value_type type);
|
||||
|
||||
// Non-copyable semantics
|
||||
xpath_variable(const xpath_variable&);
|
||||
xpath_variable& operator=(const xpath_variable&);
|
||||
|
||||
|
||||
public:
|
||||
// Get variable name
|
||||
const char_t* name() const;
|
||||
|
@ -1072,17 +1175,29 @@ namespace pugi
|
|||
private:
|
||||
xpath_variable* _data[64];
|
||||
|
||||
// Non-copyable semantics
|
||||
xpath_variable_set(const xpath_variable_set&);
|
||||
xpath_variable_set& operator=(const xpath_variable_set&);
|
||||
void _assign(const xpath_variable_set& rhs);
|
||||
void _swap(xpath_variable_set& rhs);
|
||||
|
||||
xpath_variable* find(const char_t* name) const;
|
||||
xpath_variable* _find(const char_t* name) const;
|
||||
|
||||
static bool _clone(xpath_variable* var, xpath_variable** out_result);
|
||||
static void _destroy(xpath_variable* var);
|
||||
|
||||
public:
|
||||
// Default constructor/destructor
|
||||
xpath_variable_set();
|
||||
~xpath_variable_set();
|
||||
|
||||
// Copy constructor/assignment operator
|
||||
xpath_variable_set(const xpath_variable_set& rhs);
|
||||
xpath_variable_set& operator=(const xpath_variable_set& rhs);
|
||||
|
||||
#ifdef PUGIXML_HAS_MOVE
|
||||
// Move semantics support
|
||||
xpath_variable_set(xpath_variable_set&& rhs) PUGIXML_NOEXCEPT;
|
||||
xpath_variable_set& operator=(xpath_variable_set&& rhs) PUGIXML_NOEXCEPT;
|
||||
#endif
|
||||
|
||||
// Add a new variable or get the existing one, if the types match
|
||||
xpath_variable* add(const char_t* name, xpath_value_type type);
|
||||
|
||||
|
@ -1113,28 +1228,37 @@ namespace pugi
|
|||
public:
|
||||
// Construct a compiled object from XPath expression.
|
||||
// If PUGIXML_NO_EXCEPTIONS is not defined, throws xpath_exception on compilation errors.
|
||||
explicit xpath_query(const char_t* query, xpath_variable_set* variables = 0);
|
||||
explicit xpath_query(const char_t* query, xpath_variable_set* variables = PUGIXML_NULL);
|
||||
|
||||
// Constructor
|
||||
xpath_query();
|
||||
|
||||
// Destructor
|
||||
~xpath_query();
|
||||
|
||||
#ifdef PUGIXML_HAS_MOVE
|
||||
// Move semantics support
|
||||
xpath_query(xpath_query&& rhs) PUGIXML_NOEXCEPT;
|
||||
xpath_query& operator=(xpath_query&& rhs) PUGIXML_NOEXCEPT;
|
||||
#endif
|
||||
|
||||
// Get query expression return type
|
||||
xpath_value_type return_type() const;
|
||||
|
||||
|
||||
// Evaluate expression as boolean value in the specified context; performs type conversion if necessary.
|
||||
// If PUGIXML_NO_EXCEPTIONS is not defined, throws std::bad_alloc on out of memory errors.
|
||||
bool evaluate_boolean(const xpath_node& n) const;
|
||||
|
||||
|
||||
// Evaluate expression as double value in the specified context; performs type conversion if necessary.
|
||||
// If PUGIXML_NO_EXCEPTIONS is not defined, throws std::bad_alloc on out of memory errors.
|
||||
double evaluate_number(const xpath_node& n) const;
|
||||
|
||||
|
||||
#ifndef PUGIXML_NO_STL
|
||||
// Evaluate expression as string value in the specified context; performs type conversion if necessary.
|
||||
// If PUGIXML_NO_EXCEPTIONS is not defined, throws std::bad_alloc on out of memory errors.
|
||||
string_t evaluate_string(const xpath_node& n) const;
|
||||
#endif
|
||||
|
||||
|
||||
// Evaluate expression as string value in the specified context; performs type conversion if necessary.
|
||||
// At most capacity characters are written to the destination buffer, full result size is returned (includes terminating zero).
|
||||
// If PUGIXML_NO_EXCEPTIONS is not defined, throws std::bad_alloc on out of memory errors.
|
||||
|
@ -1161,8 +1285,14 @@ namespace pugi
|
|||
// Borland C++ workaround
|
||||
bool operator!() const;
|
||||
};
|
||||
|
||||
|
||||
#ifndef PUGIXML_NO_EXCEPTIONS
|
||||
#if defined(_MSC_VER)
|
||||
// C4275 can be ignored in Visual C++ if you are deriving
|
||||
// from a type in the Standard C++ Library
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4275)
|
||||
#endif
|
||||
// XPath exception class
|
||||
class PUGIXML_CLASS xpath_exception: public std::exception
|
||||
{
|
||||
|
@ -1174,26 +1304,29 @@ namespace pugi
|
|||
explicit xpath_exception(const xpath_parse_result& result);
|
||||
|
||||
// Get error message
|
||||
virtual const char* what() const throw();
|
||||
virtual const char* what() const throw() PUGIXML_OVERRIDE;
|
||||
|
||||
// Get parse result
|
||||
const xpath_parse_result& result() const;
|
||||
};
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
// XPath node class (either xml_node or xml_attribute)
|
||||
class PUGIXML_CLASS xpath_node
|
||||
{
|
||||
private:
|
||||
xml_node _node;
|
||||
xml_attribute _attribute;
|
||||
|
||||
|
||||
typedef void (*unspecified_bool_type)(xpath_node***);
|
||||
|
||||
public:
|
||||
// Default constructor; constructs empty XPath node
|
||||
xpath_node();
|
||||
|
||||
|
||||
// Construct XPath node from XML node/attribute
|
||||
xpath_node(const xml_node& node);
|
||||
xpath_node(const xml_attribute& attribute, const xml_node& parent);
|
||||
|
@ -1201,13 +1334,13 @@ namespace pugi
|
|||
// Get node/attribute, if any
|
||||
xml_node node() const;
|
||||
xml_attribute attribute() const;
|
||||
|
||||
|
||||
// Get parent of contained node/attribute
|
||||
xml_node parent() const;
|
||||
|
||||
// Safe bool conversion operator
|
||||
operator unspecified_bool_type() const;
|
||||
|
||||
|
||||
// Borland C++ workaround
|
||||
bool operator!() const;
|
||||
|
||||
|
@ -1233,13 +1366,13 @@ namespace pugi
|
|||
type_sorted, // Sorted by document order (ascending)
|
||||
type_sorted_reverse // Sorted by document order (descending)
|
||||
};
|
||||
|
||||
|
||||
// Constant iterator type
|
||||
typedef const xpath_node* const_iterator;
|
||||
|
||||
// We define non-constant iterator to be the same as constant iterator so that various generic algorithms (i.e. boost foreach) work
|
||||
typedef const xpath_node* iterator;
|
||||
|
||||
|
||||
// Default constructor. Constructs empty set.
|
||||
xpath_node_set();
|
||||
|
||||
|
@ -1248,42 +1381,49 @@ namespace pugi
|
|||
|
||||
// Destructor
|
||||
~xpath_node_set();
|
||||
|
||||
|
||||
// Copy constructor/assignment operator
|
||||
xpath_node_set(const xpath_node_set& ns);
|
||||
xpath_node_set& operator=(const xpath_node_set& ns);
|
||||
|
||||
#ifdef PUGIXML_HAS_MOVE
|
||||
// Move semantics support
|
||||
xpath_node_set(xpath_node_set&& rhs) PUGIXML_NOEXCEPT;
|
||||
xpath_node_set& operator=(xpath_node_set&& rhs) PUGIXML_NOEXCEPT;
|
||||
#endif
|
||||
|
||||
// Get collection type
|
||||
type_t type() const;
|
||||
|
||||
|
||||
// Get collection size
|
||||
size_t size() const;
|
||||
|
||||
// Indexing operator
|
||||
const xpath_node& operator[](size_t index) const;
|
||||
|
||||
|
||||
// Collection iterators
|
||||
const_iterator begin() const;
|
||||
const_iterator end() const;
|
||||
|
||||
// Sort the collection in ascending/descending order by document order
|
||||
void sort(bool reverse = false);
|
||||
|
||||
|
||||
// Get first node in the collection by document order
|
||||
xpath_node first() const;
|
||||
|
||||
|
||||
// Check if collection is empty
|
||||
bool empty() const;
|
||||
|
||||
|
||||
private:
|
||||
type_t _type;
|
||||
|
||||
xpath_node _storage;
|
||||
|
||||
|
||||
xpath_node _storage[1];
|
||||
|
||||
xpath_node* _begin;
|
||||
xpath_node* _end;
|
||||
|
||||
void _assign(const_iterator begin, const_iterator end);
|
||||
void _assign(const_iterator begin, const_iterator end, type_t type);
|
||||
void _move(xpath_node_set& rhs) PUGIXML_NOEXCEPT;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -1291,7 +1431,7 @@ namespace pugi
|
|||
// Convert wide string to UTF8
|
||||
std::basic_string<char, std::char_traits<char>, std::allocator<char> > PUGIXML_FUNCTION as_utf8(const wchar_t* str);
|
||||
std::basic_string<char, std::char_traits<char>, std::allocator<char> > PUGIXML_FUNCTION as_utf8(const std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >& str);
|
||||
|
||||
|
||||
// Convert UTF8 to wide string
|
||||
std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > PUGIXML_FUNCTION as_wide(const char* str);
|
||||
std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > PUGIXML_FUNCTION as_wide(const std::basic_string<char, std::char_traits<char>, std::allocator<char> >& str);
|
||||
|
@ -1299,13 +1439,13 @@ namespace pugi
|
|||
|
||||
// Memory allocation function interface; returns pointer to allocated memory or NULL on failure
|
||||
typedef void* (*allocation_function)(size_t size);
|
||||
|
||||
|
||||
// Memory deallocation function interface
|
||||
typedef void (*deallocation_function)(void* ptr);
|
||||
|
||||
// Override default memory management functions. All subsequent allocations/deallocations will be performed via supplied functions.
|
||||
void PUGIXML_FUNCTION set_memory_management_functions(allocation_function allocate, deallocation_function deallocate);
|
||||
|
||||
|
||||
// Get current memory management functions
|
||||
allocation_function PUGIXML_FUNCTION get_memory_allocation_function();
|
||||
deallocation_function PUGIXML_FUNCTION get_memory_deallocation_function();
|
||||
|
@ -1341,7 +1481,7 @@ namespace std
|
|||
#endif
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006-2015 Arseny Kapoulkine
|
||||
* Copyright (c) 2006-2022 Arseny Kapoulkine
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
|
@ -1354,7 +1494,7 @@ namespace std
|
|||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
|
|
|
@ -2,6 +2,18 @@
|
|||
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
// Address sanitizer
|
||||
#if defined(__has_feature)
|
||||
# define ADDRESS_SANITIZER __has_feature(address_sanitizer)
|
||||
#else
|
||||
# if defined(__SANITIZE_ADDRESS__)
|
||||
# define ADDRESS_SANITIZER 1
|
||||
# else
|
||||
# define ADDRESS_SANITIZER 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// Low-level allocation functions
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
|
@ -66,7 +78,7 @@ namespace
|
|||
VirtualProtect(rptr, aligned_size + page_size, PAGE_NOACCESS, &old_flags);
|
||||
}
|
||||
}
|
||||
#elif defined(__APPLE__) || defined(__linux__)
|
||||
#elif (defined(__APPLE__) || defined(__linux__)) && (defined(__i386) || defined(__x86_64)) && !ADDRESS_SANITIZER
|
||||
# include <sys/mman.h>
|
||||
|
||||
namespace
|
||||
|
@ -80,7 +92,9 @@ namespace
|
|||
|
||||
void* allocate_page_aligned(size_t size)
|
||||
{
|
||||
return mmap(0, size + page_size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);
|
||||
void* result = malloc(size + page_size);
|
||||
|
||||
return reinterpret_cast<void*>(align_to_page(reinterpret_cast<size_t>(result)));
|
||||
}
|
||||
|
||||
void* allocate(size_t size)
|
||||
|
@ -111,8 +125,6 @@ namespace
|
|||
}
|
||||
}
|
||||
#else
|
||||
# include <stdlib.h>
|
||||
|
||||
namespace
|
||||
{
|
||||
void* allocate(size_t size)
|
||||
|
@ -130,14 +142,16 @@ namespace
|
|||
#endif
|
||||
|
||||
// High-level allocation functions
|
||||
const size_t memory_alignment = sizeof(double) > sizeof(void*) ? sizeof(double) : sizeof(void*);
|
||||
|
||||
void* memory_allocate(size_t size)
|
||||
{
|
||||
void* result = allocate(size + sizeof(size_t));
|
||||
void* result = allocate(size + memory_alignment);
|
||||
if (!result) return 0;
|
||||
|
||||
memcpy(result, &size, sizeof(size_t));
|
||||
|
||||
return static_cast<size_t*>(result) + 1;
|
||||
return static_cast<char*>(result) + memory_alignment;
|
||||
}
|
||||
|
||||
size_t memory_size(void* ptr)
|
||||
|
@ -145,7 +159,7 @@ size_t memory_size(void* ptr)
|
|||
assert(ptr);
|
||||
|
||||
size_t result;
|
||||
memcpy(&result, static_cast<size_t*>(ptr) - 1, sizeof(size_t));
|
||||
memcpy(&result, static_cast<char*>(ptr) - memory_alignment, sizeof(size_t));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -156,6 +170,6 @@ void memory_deallocate(void* ptr)
|
|||
|
||||
size_t size = memory_size(ptr);
|
||||
|
||||
deallocate(static_cast<size_t*>(ptr) - 1, size + sizeof(size_t));
|
||||
deallocate(static_cast<char*>(ptr) - memory_alignment, size + memory_alignment);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,72 +0,0 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
use Archive::Tar;
|
||||
use Archive::Zip;
|
||||
use File::Basename;
|
||||
|
||||
my $target = shift @ARGV;
|
||||
my @sources = @ARGV;
|
||||
|
||||
my $basedir = basename($target, ('.zip', '.tar.gz', '.tgz')) . '/';
|
||||
|
||||
my $zip = $target =~ /\.zip$/;
|
||||
my $arch = $zip ? Archive::Zip->new : Archive::Tar->new;
|
||||
|
||||
for $source (sort {$a cmp $b} @sources)
|
||||
{
|
||||
my $contents = &readfile_contents($source);
|
||||
my $meta = &readfile_meta($source);
|
||||
my $file = $basedir . $source;
|
||||
|
||||
if (-T $source)
|
||||
{
|
||||
# convert all newlines to Unix format
|
||||
$contents =~ s/\r//g;
|
||||
|
||||
if ($zip)
|
||||
{
|
||||
# convert all newlines to Windows format for .zip distribution
|
||||
$contents =~ s/\n/\r\n/g;
|
||||
}
|
||||
}
|
||||
|
||||
if ($zip)
|
||||
{
|
||||
my $path = $file;
|
||||
$arch->addDirectory($path) if $path =~ s/\/[^\/]+$/\// && !defined($arch->memberNamed($path));
|
||||
|
||||
my $member = $arch->addString($contents, $file);
|
||||
|
||||
$member->desiredCompressionMethod(COMPRESSION_DEFLATED);
|
||||
$member->desiredCompressionLevel(9);
|
||||
|
||||
$member->setLastModFileDateTimeFromUnix($$meta{mtime});
|
||||
}
|
||||
else
|
||||
{
|
||||
$arch->add_data($file, $contents, $meta);
|
||||
}
|
||||
}
|
||||
|
||||
$zip ? $arch->overwriteAs($target) : $arch->write($target, 9);
|
||||
|
||||
sub readfile_contents
|
||||
{
|
||||
my $file = shift;
|
||||
|
||||
open FILE, $file or die "Can't open $file: $!";
|
||||
binmode FILE;
|
||||
my @contents = <FILE>;
|
||||
close FILE;
|
||||
|
||||
return join('', @contents);
|
||||
}
|
||||
|
||||
sub readfile_meta
|
||||
{
|
||||
my $file = shift;
|
||||
|
||||
my ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $atime, $mtime, $ctime, $blksize, $blocks) = stat($file);
|
||||
|
||||
return {mtime => $mtime};
|
||||
}
|
87
tests/autotest-appveyor.ps1
Normal file
87
tests/autotest-appveyor.ps1
Normal file
|
@ -0,0 +1,87 @@
|
|||
function Invoke-CmdScript($scriptName)
|
||||
{
|
||||
$cmdLine = """$scriptName"" $args & set"
|
||||
& $Env:SystemRoot\system32\cmd.exe /c $cmdLine |
|
||||
select-string '^([^=]*)=(.*)$' | foreach-object {
|
||||
$varName = $_.Matches[0].Groups[1].Value
|
||||
$varValue = $_.Matches[0].Groups[2].Value
|
||||
set-item Env:$varName $varValue
|
||||
}
|
||||
}
|
||||
|
||||
$sources = @("src/pugixml.cpp") + (Get-ChildItem -Path "tests/*.cpp" -Exclude "fuzz_*.cpp")
|
||||
$failed = $FALSE
|
||||
|
||||
foreach ($vs in $args)
|
||||
{
|
||||
foreach ($arch in "x86","x64")
|
||||
{
|
||||
Write-Output "# Setting up VS$vs $arch"
|
||||
|
||||
if ($vs -eq 15) {
|
||||
$vsdevcmdarch = if ($arch -eq "x64") { "amd64" } else { "x86" }
|
||||
Invoke-CmdScript "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat" "-arch=$vsdevcmdarch"
|
||||
}
|
||||
elseif ($vs -eq 19) {
|
||||
$vsdevcmdarch = if ($arch -eq "x64") { "amd64" } else { "x86" }
|
||||
Invoke-CmdScript "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\VsDevCmd.bat" "-arch=$vsdevcmdarch"
|
||||
}
|
||||
elseif ($vs -eq 22) {
|
||||
$vsdevcmdarch = if ($arch -eq "x64") { "amd64" } else { "x86" }
|
||||
Invoke-CmdScript "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\VsDevCmd.bat" "-arch=$vsdevcmdarch"
|
||||
}
|
||||
else
|
||||
{
|
||||
Invoke-CmdScript "C:\Program Files (x86)\Microsoft Visual Studio $vs.0\VC\vcvarsall.bat" $arch
|
||||
}
|
||||
|
||||
if (! $?) { throw "Error setting up VS$vs $arch" }
|
||||
|
||||
foreach ($defines in "standard", "PUGIXML_WCHAR_MODE", "PUGIXML_COMPACT")
|
||||
{
|
||||
$target = "tests_vs${vs}_${arch}_${defines}"
|
||||
$deflist = if ($defines -eq "standard") { "" } else { "/D$defines" }
|
||||
|
||||
Add-AppveyorTest $target -Outcome Running
|
||||
|
||||
Write-Output "# Building $target.exe"
|
||||
& cmd /c "cl.exe /Fe$target.exe /EHsc /W4 /WX $deflist $sources 2>&1" | Tee-Object -Variable buildOutput
|
||||
|
||||
if ($?)
|
||||
{
|
||||
Write-Output "# Running $target.exe"
|
||||
|
||||
$sw = [Diagnostics.Stopwatch]::StartNew()
|
||||
|
||||
& .\$target | Tee-Object -Variable testOutput
|
||||
|
||||
if ($?)
|
||||
{
|
||||
Write-Output "# Passed"
|
||||
|
||||
Update-AppveyorTest $target -Outcome Passed -StdOut ($testOutput | out-string) -Duration $sw.ElapsedMilliseconds
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Output "# Failed"
|
||||
|
||||
Update-AppveyorTest $target -Outcome Failed -StdOut ($testOutput | out-string) -ErrorMessage "Running failed"
|
||||
|
||||
$failed = $TRUE
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Output "# Failed to build"
|
||||
|
||||
Update-AppveyorTest $target -Outcome Failed -StdOut ($buildOutput | out-string) -ErrorMessage "Compilation failed"
|
||||
|
||||
$failed = $TRUE
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($failed) { throw "One or more build steps failed" }
|
||||
|
||||
Write-Output "# End"
|
|
@ -1,10 +0,0 @@
|
|||
#!/bin/sh
|
||||
# put this to /etc/rc.d/pugixml-autotest
|
||||
# don't forget to chmod +x pugixml-autotest and to replace /home/USERNAME with actual path
|
||||
|
||||
if [ "$1" = "start" -o "$1" = "faststart" ]
|
||||
then
|
||||
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin
|
||||
cd /home/USERNAME/pugixml
|
||||
perl tests/autotest-remote-host.pl "shutdown -p now" &
|
||||
fi
|
|
@ -1,14 +0,0 @@
|
|||
#!/bin/sh
|
||||
# chkconfig: 2345 20 80
|
||||
# description: pugixml autotest script
|
||||
# put this to /etc/init.d/pugixml-autotest.sh, then launch
|
||||
# Debian/Ubuntu: sudo update-rc.d pugixml-autotest.sh defaults 80
|
||||
# Fedora/RedHat: sudo chkconfig --add pugixml-autotest.sh
|
||||
# don't forget to chmod +x pugixml-autotest.sh and to replace /home/USERNAME with actual path
|
||||
|
||||
if [ "$1" = "start" ]
|
||||
then
|
||||
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin
|
||||
cd /home/USERNAME/pugixml
|
||||
perl tests/autotest-remote-host.pl "shutdown -P now" &
|
||||
fi
|
|
@ -1,150 +0,0 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
use Config;
|
||||
|
||||
sub permute
|
||||
{
|
||||
my @defines = @_;
|
||||
my @result = ('');
|
||||
|
||||
foreach $define (@defines)
|
||||
{
|
||||
push @result, map { length($_) == 0 ? $define : "$_,$define" } @result;
|
||||
}
|
||||
|
||||
@result;
|
||||
}
|
||||
|
||||
sub gcctoolset
|
||||
{
|
||||
my $gccversion = `gcc -dumpversion`;
|
||||
chomp($gccversion);
|
||||
|
||||
my $gcc = "gcc$gccversion";
|
||||
|
||||
return ($^O =~ /darwin/) ? ($gcc, "${gcc}_x64", "${gcc}_ppc") : (`uname -m` =~ /64/) ? ("${gcc}_x64") : ($gcc);
|
||||
}
|
||||
|
||||
sub getcpucount
|
||||
{
|
||||
return $1 if ($^O =~ /linux/ && `cat /proc/cpuinfo` =~ /cpu cores\s*:\s*(\d+)/);
|
||||
return $1 if ($^O =~ /freebsd|darwin/ && `sysctl -a` =~ /hw\.ncpu\s*:\s*(\d+)/);
|
||||
return $1 - 1 if ($^O =~ /solaris/ && `mpstat | wc -l` =~ /(\d+)/);
|
||||
|
||||
undef;
|
||||
}
|
||||
|
||||
@alltoolsets = ($^O =~ /MSWin/)
|
||||
? (bcc, cw, dmc,
|
||||
ic8, ic9, ic9_x64, ic10, ic10_x64, ic11, ic11_x64,
|
||||
mingw34, mingw44, mingw45, mingw45_0x, mingw46_x64,
|
||||
msvc6, msvc7, msvc71, msvc8, msvc8_x64, msvc9, msvc9_x64,
|
||||
msvc10, msvc10_x64, msvc10_clr, msvc10_clr_x64,
|
||||
msvc11, msvc11_x64, msvc11_clr, msvc11_clr_x64, msvc11_arm,
|
||||
msvc12, msvc12_x64, msvc12_clr, msvc12_clr_x64, msvc12_arm,
|
||||
xbox360, ps3_gcc, ps3_snc, msvc8_wince, bada, blackberry, android, android_stlport)
|
||||
: ($^O =~ /solaris/)
|
||||
? (suncc, suncc_x64)
|
||||
: &gcctoolset();
|
||||
|
||||
$fast = scalar grep(/^fast$/, @ARGV);
|
||||
@toolsets = map { /^fast$/ ? () : ($_) } @ARGV;
|
||||
@toolsets = @toolsets ? @toolsets : @alltoolsets;
|
||||
|
||||
@configurations = (debug, release);
|
||||
@defines = (PUGIXML_NO_XPATH, PUGIXML_NO_EXCEPTIONS, PUGIXML_NO_STL, PUGIXML_WCHAR_MODE);
|
||||
$stddefine = 'PUGIXML_STANDARD';
|
||||
|
||||
if ($fast)
|
||||
{
|
||||
@defines = (PUGIXML_WCHAR_MODE);
|
||||
@configurations = (debug);
|
||||
}
|
||||
|
||||
@definesets = permute(@defines);
|
||||
|
||||
print "### autotest begin " . scalar localtime() . "\n";
|
||||
|
||||
# print Git revision info
|
||||
print "### autotest revision $1\n" if (`git rev-parse HEAD` =~ /(.+)/);
|
||||
|
||||
# get CPU info
|
||||
$cpucount = &getcpucount();
|
||||
|
||||
# build all configurations
|
||||
%results = ();
|
||||
|
||||
foreach $toolset (@toolsets)
|
||||
{
|
||||
my $cmdline = "jam";
|
||||
|
||||
# parallel build on non-windows platforms (since jam can't detect processor count)
|
||||
$cmdline .= " -j$cpucount" if (defined $cpucount);
|
||||
|
||||
# add toolset
|
||||
$cmdline .= " toolset=$toolset";
|
||||
|
||||
# add configurations
|
||||
$cmdline .= " configuration=" . join(',', @configurations);
|
||||
|
||||
# add definesets
|
||||
$cmdline .= " defines=$stddefine";
|
||||
|
||||
foreach $defineset (@definesets)
|
||||
{
|
||||
# STLport lacks bad_alloc on Android so skip configurations without PUGIXML_NO_EXCEPTIONS
|
||||
next if ($toolset eq 'android_stlport' && $defineset !~ /PUGIXML_NO_EXCEPTIONS/);
|
||||
|
||||
$cmdline .= ":$defineset" if ($defineset ne '');
|
||||
|
||||
# any configuration with prepare but without result is treated as failed
|
||||
foreach $configuration (@configurations)
|
||||
{
|
||||
print "### autotest $Config{archname} $toolset $configuration [$defineset] prepare\n";
|
||||
}
|
||||
}
|
||||
|
||||
print STDERR "*** testing $toolset... ***\n";
|
||||
|
||||
# launch command
|
||||
print "### autotest launch $cmdline\n";
|
||||
|
||||
open PIPE, "$cmdline autotest=on coverage |" || die "$cmdline failed: $!\n";
|
||||
|
||||
# parse build output
|
||||
while (<PIPE>)
|
||||
{
|
||||
# ... autotest release [wchar] success
|
||||
if (/^\.\.\. autotest (\S+) \[(.*?)\] (success|skiprun)/)
|
||||
{
|
||||
my $configuration = $1;
|
||||
my $defineset = ($2 eq $stddefine) ? '' : $2;
|
||||
my $result = $3;
|
||||
|
||||
print "### autotest $Config{archname} $toolset $configuration [$defineset] $result\n";
|
||||
}
|
||||
# ... autotest release [wchar] gcov
|
||||
elsif (/^\.\.\. autotest (\S+) \[(.*?)\] gcov/)
|
||||
{
|
||||
my $configuration = $1;
|
||||
my $defineset = ($2 eq $stddefine) ? '' : $2;
|
||||
|
||||
if (/pugixml\.cpp' executed:([^%]+)%/)
|
||||
{
|
||||
print "### autotest $Config{archname} $toolset $configuration [$defineset] coverage $1\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print;
|
||||
}
|
||||
}
|
||||
|
||||
close PIPE;
|
||||
}
|
||||
|
||||
print "### autotest end " . scalar localtime() . "\n";
|
|
@ -1,12 +0,0 @@
|
|||
#!/bin/sh
|
||||
# put this to /Library/StartupItems/pugixml-autotest/pugixml-autotest, then create
|
||||
# file StartupParameters.plist in the same folder with the following contents:
|
||||
# <plist><dict><key>Provides</key><array><string>pugixml-autotest</string></array></dict></plist>
|
||||
# don't forget to chmod +x pugixml-autotest and to replace /Users/USERNAME with actual path
|
||||
|
||||
if [ "$1" = "start" ]
|
||||
then
|
||||
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin
|
||||
cd /Users/USERNAME/pugixml
|
||||
perl tests/autotest-remote-host.pl "shutdown -h now" &
|
||||
fi
|
|
@ -1,37 +0,0 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
sub execprint
|
||||
{
|
||||
my $cmd = shift;
|
||||
|
||||
open PIPE, "$cmd |" || die "$cmd failed: $!\n";
|
||||
print while (<PIPE>);
|
||||
close PIPE;
|
||||
|
||||
return $?;
|
||||
}
|
||||
|
||||
use IO::Socket;
|
||||
use Net::Ping;
|
||||
|
||||
$exitcmd = shift;
|
||||
$host = "10.0.2.2";
|
||||
|
||||
# wait while network is up
|
||||
$ping = Net::Ping->new("icmp");
|
||||
|
||||
while (!$ping->ping($host))
|
||||
{
|
||||
print "### autotest $host is down, retrying...\n";
|
||||
}
|
||||
|
||||
print "### autotest $host is up, connecting...\n";
|
||||
|
||||
my $client = new IO::Socket::INET(PeerAddr => "$host:7183");
|
||||
exit unless $client;
|
||||
|
||||
select $client;
|
||||
|
||||
&execprint('git pull') == 0 || die "error updating from repo\n";
|
||||
&execprint('perl tests/autotest-local.pl') == 0 || die "error launching tests\n";
|
||||
system($exitcmd);
|
|
@ -1,33 +0,0 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
use IO::Socket;
|
||||
|
||||
$vm = shift;
|
||||
$log = shift;
|
||||
|
||||
# start virtualbox gui in minimized mode - this should be the first thing we do since this process
|
||||
# inherits all handles and we want our sockets/log file closed
|
||||
system("start /min virtualbox --startvm $vm");
|
||||
|
||||
# start a server; vm will connect to the server via autotest-remote-host.pl
|
||||
my $server = new IO::Socket::INET(LocalPort => 7183, Listen => 1);
|
||||
die "Could not create socket: $!\n" unless $server;
|
||||
|
||||
open LOG, ">> $log" || die "Could not open log file: $!\n";
|
||||
|
||||
print LOG "Listening for connection...\n";
|
||||
|
||||
my $client = $server->accept();
|
||||
|
||||
# echo all input to log file
|
||||
print LOG $_ while (<$client>);
|
||||
close LOG;
|
||||
|
||||
$client->close();
|
||||
$server->close();
|
||||
|
||||
# wait for vm shutdown to decrease peak memory consumption
|
||||
while (`vboxmanage showvminfo $vm` !~ /State:\s+powered off/)
|
||||
{
|
||||
sleep(1);
|
||||
}
|
|
@ -1,229 +0,0 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
# pretty-printing
|
||||
sub prettysuffix
|
||||
{
|
||||
my $suffix = shift;
|
||||
|
||||
return " C++0x" if ($suffix eq '_0x');
|
||||
return " x64" if ($suffix eq '_x64');
|
||||
return " CLR" if ($suffix eq '_clr');
|
||||
return " CLR x64" if ($suffix eq '_clr_x64');
|
||||
return " PPC" if ($suffix eq '_ppc');
|
||||
return " WinCE" if ($suffix eq '_wince');
|
||||
return " ARM" if ($suffix eq '_arm');
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
sub prettytoolset
|
||||
{
|
||||
my $toolset = shift;
|
||||
|
||||
return "Borland C++ 5.82" if ($toolset eq 'bcc');
|
||||
return "Metrowerks CodeWarrior 8" if ($toolset eq 'cw');
|
||||
return "Digital Mars C++ 8.51" if ($toolset eq 'dmc');
|
||||
return "Sun C++ 5.10" . prettysuffix($1) if ($toolset =~ /^suncc(.*)$/);
|
||||
|
||||
return "Intel C++ Compiler $1.0" . prettysuffix($2) if ($toolset =~ /^ic(\d+)(.*)$/);
|
||||
return "MinGW (GCC $1.$2)" . prettysuffix($3) if ($toolset =~ /^mingw(\d)(\d)(.*)$/);
|
||||
return "Microsoft Visual C++ 7.1" if ($toolset eq 'msvc71');
|
||||
return "Microsoft Visual C++ $1.0" . prettysuffix($2) if ($toolset =~ /^msvc(\d+)(.*)$/);
|
||||
return "GNU C++ Compiler $1" . prettysuffix($2) if ($toolset =~ /^gcc([\d.]*)(.*)$/);
|
||||
|
||||
return "Microsoft Xbox360 Compiler" if ($toolset =~ /^xbox360/);
|
||||
return "Sony PlayStation3 GCC" if ($toolset =~ /^ps3_gcc/);
|
||||
return "Sony PlayStation3 SNC" if ($toolset =~ /^ps3_snc/);
|
||||
|
||||
return "Android NDK (GCC)" . ($1 eq '_stlport' ? " STLport" : "") if ($toolset =~ /^android(.*)$/);
|
||||
return "bada SDK (GCC)" if ($toolset =~ /^bada$/);
|
||||
return "BlackBerry NDK (GCC)" if ($toolset =~ /^blackberry$/);
|
||||
|
||||
$toolset;
|
||||
}
|
||||
|
||||
sub prettyplatform
|
||||
{
|
||||
my ($platform, $toolset) = @_;
|
||||
|
||||
return "solaris" if ($platform =~ /solaris/);
|
||||
|
||||
return "macos" if ($platform =~ /darwin/);
|
||||
|
||||
return "linux64" if ($platform =~ /64-linux/);
|
||||
return "linux32" if ($platform =~ /86-linux/);
|
||||
|
||||
return "fbsd64" if ($platform =~ /64-freebsd/);
|
||||
return "fbsd32" if ($platform =~ /86-freebsd/);
|
||||
|
||||
return "x360" if ($toolset =~ /^xbox360/);
|
||||
return "ps3" if ($toolset =~ /^ps3/);
|
||||
|
||||
return "arm" if ($toolset =~ /_arm$/);
|
||||
return "arm" if ($toolset =~ /_wince$/);
|
||||
return "arm" if ($toolset =~ /^android/);
|
||||
return "arm" if ($toolset =~ /^bada/);
|
||||
return "arm" if ($toolset =~ /^blackberry/);
|
||||
|
||||
return "win64" if ($platform =~ /MSWin32-x64/);
|
||||
return "win32" if ($platform =~ /MSWin32/);
|
||||
|
||||
$platform;
|
||||
}
|
||||
|
||||
sub prettybox
|
||||
{
|
||||
my $enabled = shift;
|
||||
my $color = $enabled ? "#cccccc" : "#ffffff";
|
||||
|
||||
"<td bgcolor='$color' align='center'>" . ($enabled ? "+" : " ") . "</td>";
|
||||
}
|
||||
|
||||
# parse build log
|
||||
%results = ();
|
||||
%toolsets = ();
|
||||
%defines = ();
|
||||
%configurations = ();
|
||||
|
||||
sub insertindex
|
||||
{
|
||||
my ($hash, $key) = @_;
|
||||
|
||||
$$hash{$key} = scalar(keys %$hash) unless defined $$hash{$key};
|
||||
}
|
||||
|
||||
while (<>)
|
||||
{
|
||||
### autotest i386-freebsd-64int gcc release [wchar] result 0 97.78 98.85
|
||||
if (/^### autotest (\S+) (\S+) (\S+) \[(.*?)\] (.*)/)
|
||||
{
|
||||
my ($platform, $toolset, $configuration, $defineset, $info) = ($1, $2, $3, $4, $5);
|
||||
|
||||
my $fulltool = &prettyplatform($platform, $toolset) . ' ' . &prettytoolset($toolset);
|
||||
my $fullconf = "$configuration $defineset";
|
||||
|
||||
if ($info =~ /^prepare/)
|
||||
{
|
||||
$results{$fulltool}{$fullconf}{result} = "";
|
||||
}
|
||||
elsif ($info =~ /^success/)
|
||||
{
|
||||
$results{$fulltool}{$fullconf}{result} = "success";
|
||||
}
|
||||
elsif ($info =~ /^skiprun/)
|
||||
{
|
||||
$results{$fulltool}{$fullconf}{result} = "skiprun";
|
||||
}
|
||||
elsif ($info =~ /^coverage (\S+)/)
|
||||
{
|
||||
$results{$fulltool}{$fullconf}{coverage} = $1;
|
||||
}
|
||||
else
|
||||
{
|
||||
print STDERR "Unrecognized autotest infoline $_";
|
||||
}
|
||||
|
||||
&insertindex(\%toolsets, $fulltool);
|
||||
|
||||
$defines{$_} = 1 foreach (split /,/, $defineset);
|
||||
&insertindex(\%configurations, $fullconf);
|
||||
}
|
||||
elsif (/^### autotest revision (.+)/)
|
||||
{
|
||||
if (defined $revision && $revision != $1)
|
||||
{
|
||||
print STDERR "Autotest build report contains several revisions: $revision, $1\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$revision = $1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# make arrays of toolsets and configurations
|
||||
@toolsetarray = ();
|
||||
@configurationarray = ();
|
||||
|
||||
$toolsetarray[$toolsets{$_}] = $_ foreach (keys %toolsets);
|
||||
$configurationarray[$configurations{$_}] = $_ foreach (keys %configurations);
|
||||
|
||||
# print header
|
||||
$stylesheet = <<END;
|
||||
table.autotest { border: 1px solid black; border-left: none; border-top: none; }
|
||||
table.autotest td { border: 1px solid black; border-right: none; border-bottom: none; }
|
||||
END
|
||||
|
||||
print <<END;
|
||||
<html><head><title>pugixml autotest report</title><style type="text/css"><!-- $stylesheet --></style></head><body>
|
||||
<h3>pugixml autotest report</h3>
|
||||
<table border=1 cellspacing=0 cellpadding=4 class="autotest">
|
||||
END
|
||||
|
||||
# print configuration header (release/debug)
|
||||
print "<tr><td align='right' colspan=2>optimization</td>";
|
||||
print &prettybox((split /\s+/)[0] eq 'release') foreach (@configurationarray);
|
||||
print "</tr>\n";
|
||||
|
||||
# print defines header (one row for each define)
|
||||
foreach $define (sort {$a cmp $b} keys %defines)
|
||||
{
|
||||
print "<tr><td align='right' colspan=2><small>$define</small></td>";
|
||||
|
||||
foreach (@configurationarray)
|
||||
{
|
||||
my $present = ($_ =~ /\b$define\b/);
|
||||
|
||||
print &prettybox($present);
|
||||
}
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
# print data (one row for each toolset)
|
||||
foreach $tool (@toolsetarray)
|
||||
{
|
||||
my ($platform, $toolset) = split(/\s+/, $tool, 2);
|
||||
print "<tr><td style='border-right: none' align='center'><small>$platform</small></td><td style='border-left: none'><nobr>$toolset</nobr></td>";
|
||||
|
||||
foreach (@configurationarray)
|
||||
{
|
||||
my $info = $results{$tool}{$_};
|
||||
|
||||
if (!defined $$info{result})
|
||||
{
|
||||
print "<td bgcolor='#cccccc'> </td>";
|
||||
}
|
||||
elsif ($$info{result} eq "success")
|
||||
{
|
||||
my $coverage = $$info{coverage};
|
||||
|
||||
print "<td bgcolor='#00ff00' align='center'>pass";
|
||||
|
||||
if ($coverage > 0)
|
||||
{
|
||||
print "<br><font size='-2'>" . ($coverage + 0) . "%</font>";
|
||||
}
|
||||
|
||||
print "</td>";
|
||||
}
|
||||
elsif ($$info{result} eq "skiprun")
|
||||
{
|
||||
print "<td bgcolor='#ffff80' align='center'>pass</td>"
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<td bgcolor='#ff0000' align='center'>fail</td>"
|
||||
}
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
# print footer
|
||||
$date = localtime;
|
||||
|
||||
print <<END;
|
||||
</table><br>
|
||||
Generated on $date from Git $revision
|
||||
</body></html>
|
||||
END
|
|
@ -1,10 +0,0 @@
|
|||
#!/bin/sh
|
||||
# put this to /etc/init.d/pugixml-autotest.sh, then launch
|
||||
# ln -s /etc/init.d/pugixml-autotest.sh /etc/rc3.d/S80pugixml-autotest
|
||||
# don't forget to chmod +x pugixml-autotest.sh and to replace /export/home/USERNAME with actual path
|
||||
|
||||
if [ "$1" = "start" ]
|
||||
then
|
||||
cd /export/home/USERNAME/pugixml
|
||||
perl tests/autotest-remote-host.pl "shutdown -g 0 -i 5 -y" &
|
||||
fi
|
|
@ -1,8 +0,0 @@
|
|||
#ifndef HEADER_TEST_COMMON_HPP
|
||||
#define HEADER_TEST_COMMON_HPP
|
||||
|
||||
#include "test.hpp"
|
||||
|
||||
using namespace pugi;
|
||||
|
||||
#endif
|
1
tests/data_fuzz_xpath/basic.xpath
Normal file
1
tests/data_fuzz_xpath/basic.xpath
Normal file
|
@ -0,0 +1 @@
|
|||
a/b/c
|
1
tests/data_fuzz_xpath/functions.xpath
Normal file
1
tests/data_fuzz_xpath/functions.xpath
Normal file
|
@ -0,0 +1 @@
|
|||
sum(nodes) + round(concat(//a[translate(@id, 'abc', '012')]))
|
1
tests/data_fuzz_xpath/math.xpath
Normal file
1
tests/data_fuzz_xpath/math.xpath
Normal file
|
@ -0,0 +1 @@
|
|||
1+2*3 div 4 mod 5-6
|
1
tests/data_fuzz_xpath/path.xpath
Normal file
1
tests/data_fuzz_xpath/path.xpath
Normal file
|
@ -0,0 +1 @@
|
|||
@*/ancestor::*/near-north/*[4]/@*/preceding::text()
|
1
tests/data_fuzz_xpath/predicate.xpath
Normal file
1
tests/data_fuzz_xpath/predicate.xpath
Normal file
|
@ -0,0 +1 @@
|
|||
library/nodes[@id=12]/element[@type='translate'][1]
|
|
@ -1,16 +1,14 @@
|
|||
#include "../src/pugixml.hpp"
|
||||
#include "allocator.hpp"
|
||||
|
||||
int main(int argc, const char** argv)
|
||||
#include <stdint.h>
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size)
|
||||
{
|
||||
pugi::set_memory_management_functions(memory_allocate, memory_deallocate);
|
||||
|
||||
pugi::xml_document doc;
|
||||
|
||||
for (int i = 1; i < argc; ++i)
|
||||
{
|
||||
doc.load_file(argv[i]);
|
||||
doc.load_file(argv[i], pugi::parse_minimal);
|
||||
doc.load_file(argv[i], pugi::parse_full);
|
||||
}
|
||||
doc.load_buffer(Data, Size);
|
||||
doc.load_buffer(Data, Size, pugi::parse_minimal);
|
||||
doc.load_buffer(Data, Size, pugi::parse_full);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
72
tests/fuzz_parse.dict
Normal file
72
tests/fuzz_parse.dict
Normal file
|
@ -0,0 +1,72 @@
|
|||
#
|
||||
# AFL dictionary for XML
|
||||
# ----------------------
|
||||
#
|
||||
# Several basic syntax elements and attributes, modeled on libxml2.
|
||||
#
|
||||
# Created by Michal Zalewski <lcamtuf@google.com>
|
||||
#
|
||||
|
||||
attr_encoding=" encoding=\"1\""
|
||||
attr_generic=" a=\"1\""
|
||||
attr_href=" href=\"1\""
|
||||
attr_standalone=" standalone=\"no\""
|
||||
attr_version=" version=\"1\""
|
||||
attr_xml_base=" xml:base=\"1\""
|
||||
attr_xml_id=" xml:id=\"1\""
|
||||
attr_xml_lang=" xml:lang=\"1\""
|
||||
attr_xml_space=" xml:space=\"1\""
|
||||
attr_xmlns=" xmlns=\"1\""
|
||||
|
||||
entity_builtin="<"
|
||||
entity_decimal=""
|
||||
entity_external="&a;"
|
||||
entity_hex=""
|
||||
|
||||
string_any="ANY"
|
||||
string_brackets="[]"
|
||||
string_cdata="CDATA"
|
||||
string_col_fallback=":fallback"
|
||||
string_col_generic=":a"
|
||||
string_col_include=":include"
|
||||
string_dashes="--"
|
||||
string_empty="EMPTY"
|
||||
string_empty_dblquotes="\"\""
|
||||
string_empty_quotes="''"
|
||||
string_entities="ENTITIES"
|
||||
string_entity="ENTITY"
|
||||
string_fixed="#FIXED"
|
||||
string_id="ID"
|
||||
string_idref="IDREF"
|
||||
string_idrefs="IDREFS"
|
||||
string_implied="#IMPLIED"
|
||||
string_nmtoken="NMTOKEN"
|
||||
string_nmtokens="NMTOKENS"
|
||||
string_notation="NOTATION"
|
||||
string_parentheses="()"
|
||||
string_pcdata="#PCDATA"
|
||||
string_percent="%a"
|
||||
string_public="PUBLIC"
|
||||
string_required="#REQUIRED"
|
||||
string_schema=":schema"
|
||||
string_system="SYSTEM"
|
||||
string_ucs4="UCS-4"
|
||||
string_utf16="UTF-16"
|
||||
string_utf8="UTF-8"
|
||||
string_xmlns="xmlns:"
|
||||
|
||||
tag_attlist="<!ATTLIST"
|
||||
tag_cdata="<![CDATA["
|
||||
tag_close="</a>"
|
||||
tag_doctype="<!DOCTYPE"
|
||||
tag_element="<!ELEMENT"
|
||||
tag_entity="<!ENTITY"
|
||||
tag_ignore="<![IGNORE["
|
||||
tag_include="<![INCLUDE["
|
||||
tag_notation="<!NOTATION"
|
||||
tag_open="<a>"
|
||||
tag_open_close="<a />"
|
||||
tag_open_exclamation="<!"
|
||||
tag_open_q="<?"
|
||||
tag_sq2_close="]]>"
|
||||
tag_xml_q="<?xml?>"
|
11
tests/fuzz_setup.sh
Executable file
11
tests/fuzz_setup.sh
Executable file
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
|
||||
sudo apt-get --yes install subversion screen gcc g++ cmake ninja-build golang autoconf libtool apache2 python-dev pkg-config zlib1g-dev libgcrypt11-dev
|
||||
|
||||
mkdir -p clang
|
||||
cd clang
|
||||
git clone https://chromium.googlesource.com/chromium/src/tools/clang
|
||||
cd ..
|
||||
clang/clang/scripts/update.py
|
||||
sudo cp -rf third_party/llvm-build/Release+Asserts/lib/* /usr/local/lib/
|
||||
sudo cp -rf third_party/llvm-build/Release+Asserts/bin/* /usr/local/bin
|
26
tests/fuzz_xpath.cpp
Normal file
26
tests/fuzz_xpath.cpp
Normal file
|
@ -0,0 +1,26 @@
|
|||
#include "../src/pugixml.hpp"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size)
|
||||
{
|
||||
char* text = new char[Size + 1];
|
||||
memcpy(text, Data, Size);
|
||||
text[Size] = 0;
|
||||
|
||||
#ifdef PUGIXML_NO_EXCEPTIONS
|
||||
pugi::xpath_query q(text);
|
||||
#else
|
||||
try
|
||||
{
|
||||
pugi::xpath_query q(text);
|
||||
}
|
||||
catch (pugi::xpath_exception&)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
delete[] text;
|
||||
return 0;
|
||||
}
|
72
tests/fuzz_xpath.dict
Normal file
72
tests/fuzz_xpath.dict
Normal file
|
@ -0,0 +1,72 @@
|
|||
"boolean"
|
||||
"count"
|
||||
"contains"
|
||||
"concat"
|
||||
"ceiling"
|
||||
"false"
|
||||
"floor"
|
||||
"id"
|
||||
"last"
|
||||
"lang"
|
||||
"local-name"
|
||||
"name"
|
||||
"namespace-uri"
|
||||
"normalize-space"
|
||||
"not"
|
||||
"number"
|
||||
"position"
|
||||
"round"
|
||||
"string"
|
||||
"string-length"
|
||||
"starts-with"
|
||||
"substring-before"
|
||||
"substring-after"
|
||||
"substring"
|
||||
"sum"
|
||||
"translate"
|
||||
"true"
|
||||
"ancestor"
|
||||
"ancestor-or-self"
|
||||
"attribute"
|
||||
"child"
|
||||
"descendant"
|
||||
"descendant-or-self"
|
||||
"following"
|
||||
"following-sibling"
|
||||
"namespace"
|
||||
"parent"
|
||||
"preceding"
|
||||
"preceding-sibling"
|
||||
"self"
|
||||
"comment"
|
||||
"node"
|
||||
"processing-instruction"
|
||||
"text"
|
||||
"or"
|
||||
"and"
|
||||
"div"
|
||||
"mod"
|
||||
">"
|
||||
">="
|
||||
"<"
|
||||
"<="
|
||||
"!"
|
||||
"!="
|
||||
"="
|
||||
"+"
|
||||
"-"
|
||||
"*"
|
||||
"|"
|
||||
"$"
|
||||
"("
|
||||
")"
|
||||
"["
|
||||
"]"
|
||||
","
|
||||
"//"
|
||||
"/"
|
||||
".."
|
||||
"."
|
||||
"@"
|
||||
"::"
|
||||
":"
|
|
@ -1,36 +0,0 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
sub funcinfo
|
||||
{
|
||||
my ($name, $info) = @_;
|
||||
|
||||
return if ($info =~ /No executable lines/);
|
||||
|
||||
my $lines = ($info =~ /Lines executed:([^%]+)%/) ? $1 : 100;
|
||||
my $calls = ($info =~ /Calls executed:([^%]+)%/) ? $1 : 100;
|
||||
my $branches = ($info =~ /Branches executed:([^%]+)%/) ? $1 : 100;
|
||||
my $taken = ($info =~ /Taken at least once:([^%]+)%/) ? $1 : 100;
|
||||
|
||||
return if ($lines == 100 && $calls == 100 && $branches == 100 && $taken == 100);
|
||||
|
||||
return "Function $name: L $lines, C $calls, B $branches, BT $taken\n";
|
||||
}
|
||||
|
||||
$prefix = join(' ', @ARGV);
|
||||
$prefix .= ' ' if ($prefix ne '');
|
||||
|
||||
$lines = join('', <STDIN>);
|
||||
|
||||
# merge file information
|
||||
$lines =~ s/File (.+)\nLines (.+)\n(.+\n)*\n/$1 $2\n/g;
|
||||
|
||||
# merge function information
|
||||
$lines =~ s/Function (.+)\n((.+\n)*)\n/funcinfo($1, $2)/eg;
|
||||
|
||||
# remove include information
|
||||
$lines =~ s/.+include\/c\+\+.+\n//g;
|
||||
|
||||
foreach $line (split /\n/, $lines)
|
||||
{
|
||||
print "$prefix$line\n";
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef HEADER_TEST_HELPERS_HPP
|
||||
#define HEADER_TEST_HELPERS_HPP
|
||||
|
||||
#include "common.hpp"
|
||||
#include "test.hpp"
|
||||
|
||||
#include <utility>
|
||||
|
||||
|
|
|
@ -27,11 +27,13 @@ const char* test_runner::_temp_path;
|
|||
|
||||
static size_t g_memory_total_size = 0;
|
||||
static size_t g_memory_total_count = 0;
|
||||
static size_t g_memory_fail_triggered = false;
|
||||
|
||||
static void* custom_allocate(size_t size)
|
||||
{
|
||||
if (test_runner::_memory_fail_threshold > 0 && test_runner::_memory_fail_threshold < g_memory_total_size + size)
|
||||
{
|
||||
g_memory_fail_triggered = true;
|
||||
test_runner::_memory_fail_triggered = true;
|
||||
|
||||
return 0;
|
||||
|
@ -39,22 +41,34 @@ static void* custom_allocate(size_t size)
|
|||
else
|
||||
{
|
||||
void* ptr = memory_allocate(size);
|
||||
assert(ptr);
|
||||
if (!ptr) return 0;
|
||||
|
||||
g_memory_total_size += memory_size(ptr);
|
||||
g_memory_total_count++;
|
||||
|
||||
|
||||
return ptr;
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef PUGIXML_NO_EXCEPTIONS
|
||||
static void* custom_allocate_throw(size_t size)
|
||||
{
|
||||
void* result = custom_allocate(size);
|
||||
|
||||
if (!result)
|
||||
throw std::bad_alloc();
|
||||
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void custom_deallocate(void* ptr)
|
||||
{
|
||||
assert(ptr);
|
||||
|
||||
g_memory_total_size -= memory_size(ptr);
|
||||
g_memory_total_count--;
|
||||
|
||||
|
||||
memory_deallocate(ptr);
|
||||
}
|
||||
|
||||
|
@ -80,7 +94,7 @@ namespace std
|
|||
}
|
||||
#endif
|
||||
|
||||
static bool run_test(test_runner* test)
|
||||
static bool run_test(test_runner* test, const char* test_name, pugi::allocation_function allocate)
|
||||
{
|
||||
#ifndef PUGIXML_NO_EXCEPTIONS
|
||||
try
|
||||
|
@ -88,11 +102,12 @@ static bool run_test(test_runner* test)
|
|||
#endif
|
||||
g_memory_total_size = 0;
|
||||
g_memory_total_count = 0;
|
||||
g_memory_fail_triggered = false;
|
||||
test_runner::_memory_fail_threshold = 0;
|
||||
test_runner::_memory_fail_triggered = false;
|
||||
|
||||
pugi::set_memory_management_functions(custom_allocate, custom_deallocate);
|
||||
|
||||
|
||||
pugi::set_memory_management_functions(allocate, custom_deallocate);
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable: 4611) // interaction between _setjmp and C++ object destruction is non-portable
|
||||
|
@ -100,22 +115,28 @@ static bool run_test(test_runner* test)
|
|||
#endif
|
||||
|
||||
volatile int result = setjmp(test_runner::_failure_buffer);
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
|
||||
if (result)
|
||||
{
|
||||
printf("Test %s failed: %s\n", test->_name, test_runner::_failure_message);
|
||||
printf("Test %s failed: %s\n", test_name, test_runner::_failure_message);
|
||||
return false;
|
||||
}
|
||||
|
||||
test->run();
|
||||
|
||||
if (test_runner::_memory_fail_triggered)
|
||||
{
|
||||
printf("Test %s failed: unguarded memory fail triggered\n", test_name);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (g_memory_total_size != 0 || g_memory_total_count != 0)
|
||||
{
|
||||
printf("Test %s failed: memory leaks found (%u bytes in %u allocations)\n", test->_name, static_cast<unsigned int>(g_memory_total_size), static_cast<unsigned int>(g_memory_total_count));
|
||||
printf("Test %s failed: memory leaks found (%u bytes in %u allocations)\n", test_name, static_cast<unsigned int>(g_memory_total_size), static_cast<unsigned int>(g_memory_total_count));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -124,12 +145,12 @@ static bool run_test(test_runner* test)
|
|||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
printf("Test %s failed: exception %s\n", test->_name, e.what());
|
||||
printf("Test %s failed: exception %s\n", test_name, e.what());
|
||||
return false;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
printf("Test %s failed for unknown reason\n", test->_name);
|
||||
printf("Test %s failed for unknown reason\n", test_name);
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
@ -156,7 +177,7 @@ int main(int, char** argv)
|
|||
temp.erase((slash != std::string::npos) ? slash + 1 : 0);
|
||||
|
||||
test_runner::_temp_path = temp.c_str();
|
||||
|
||||
|
||||
replace_memory_management();
|
||||
|
||||
unsigned int total = 0;
|
||||
|
@ -167,7 +188,16 @@ int main(int, char** argv)
|
|||
for (test = test_runner::_tests; test; test = test->_next)
|
||||
{
|
||||
total++;
|
||||
passed += run_test(test);
|
||||
passed += run_test(test, test->_name, custom_allocate);
|
||||
|
||||
if (g_memory_fail_triggered)
|
||||
{
|
||||
// run tests that trigger memory failures twice - with an allocator that returns NULL and with an allocator that throws
|
||||
#ifndef PUGIXML_NO_EXCEPTIONS
|
||||
total++;
|
||||
passed += run_test(test, (test->_name + std::string(" (throw)")).c_str(), custom_allocate_throw);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int failed = total - passed;
|
||||
|
|
|
@ -117,7 +117,7 @@ bool test_xpath_number(const pugi::xpath_node& node, const pugi::char_t* query,
|
|||
double value = q.evaluate_number(node);
|
||||
double absolute_error = fabs(value - expected);
|
||||
|
||||
const double tolerance = 1e-15f;
|
||||
const double tolerance = 1e-15;
|
||||
return absolute_error < tolerance || absolute_error < fabs(expected) * tolerance;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,10 @@
|
|||
|
||||
#include <setjmp.h>
|
||||
|
||||
#ifndef PUGIXML_NO_EXCEPTIONS
|
||||
#include <new>
|
||||
#endif
|
||||
|
||||
struct test_runner
|
||||
{
|
||||
test_runner(const char* name)
|
||||
|
@ -78,7 +82,7 @@ struct dummy_fixture {};
|
|||
{ \
|
||||
test_runner_##name(): test_runner(#name) {} \
|
||||
\
|
||||
virtual void run() \
|
||||
virtual void run() PUGIXML_OVERRIDE \
|
||||
{ \
|
||||
test_runner_helper_##name helper; \
|
||||
helper.run(); \
|
||||
|
@ -112,8 +116,8 @@ struct dummy_fixture {};
|
|||
#define CHECK_TEXT(condition, text) if (condition) ; else test_runner::_failure_message = CHECK_JOIN2(text, __FILE__, __LINE__), longjmp(test_runner::_failure_buffer, 1)
|
||||
#define CHECK_FORCE_FAIL(text) test_runner::_failure_message = CHECK_JOIN2(text, __FILE__, __LINE__), longjmp(test_runner::_failure_buffer, 1)
|
||||
|
||||
#if (defined(_MSC_VER) && _MSC_VER == 1200) || defined(__MWERKS__)
|
||||
# define STRINGIZE(value) "??" // MSVC 6.0 and CodeWarrior have troubles stringizing stuff with strings w/escaping inside
|
||||
#if (defined(_MSC_VER) && _MSC_VER == 1200) || defined(__MWERKS__) || (defined(__BORLANDC__) && __BORLANDC__ <= 0x540)
|
||||
# define STRINGIZE(value) "??" // Some compilers have issues with stringizing expressions that contain strings w/escaping inside
|
||||
#else
|
||||
# define STRINGIZE(value) #value
|
||||
#endif
|
||||
|
@ -142,16 +146,22 @@ struct dummy_fixture {};
|
|||
#define CHECK_XPATH_FAIL(query) CHECK_XPATH_FAIL_VAR(query, 0)
|
||||
#endif
|
||||
|
||||
#ifdef PUGIXML_NO_EXCEPTIONS
|
||||
#define CHECK_ALLOC_FAIL(code) do { CHECK(!test_runner::_memory_fail_triggered); code; CHECK(test_runner::_memory_fail_triggered); test_runner::_memory_fail_triggered = false; } while (test_runner::_memory_fail_triggered)
|
||||
#else
|
||||
#define CHECK_ALLOC_FAIL(code) do { CHECK(!test_runner::_memory_fail_triggered); try { code; } catch (std::bad_alloc&) {} CHECK(test_runner::_memory_fail_triggered); test_runner::_memory_fail_triggered = false; } while (test_runner::_memory_fail_triggered)
|
||||
#endif
|
||||
|
||||
#define STR(text) PUGIXML_TEXT(text)
|
||||
|
||||
#ifdef __DMC__
|
||||
#if defined(__DMC__) || defined(__BORLANDC__)
|
||||
#define U_LITERALS // DMC does not understand \x01234 (it parses first three digits), but understands \u01234
|
||||
#endif
|
||||
|
||||
#if (defined(_MSC_VER) && _MSC_VER == 1200) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER == 800) || defined(__BORLANDC__)
|
||||
// NaN comparison on MSVC6 is incorrect, see http://www.nabble.com/assertDoubleEquals,-NaN---Microsoft-Visual-Studio-6-td9137859.html
|
||||
// IC8 and BCC are also affected by the same bug
|
||||
# define MSVC6_NAN_BUG
|
||||
# define MSVC6_NAN_BUG
|
||||
#endif
|
||||
|
||||
inline wchar_t wchar_cast(unsigned int value)
|
||||
|
|
150
tests/test_compact.cpp
Normal file
150
tests/test_compact.cpp
Normal file
|
@ -0,0 +1,150 @@
|
|||
#ifdef PUGIXML_COMPACT
|
||||
#include "test.hpp"
|
||||
|
||||
using namespace pugi;
|
||||
|
||||
static void overflow_hash_table(xml_document& doc)
|
||||
{
|
||||
xml_node n = doc.child(STR("n"));
|
||||
|
||||
// compact encoding assumes next_sibling is a forward-only pointer so we can allocate hash entries by reordering nodes
|
||||
// we allocate enough hash entries to be exactly on the edge of rehash threshold
|
||||
for (int i = 0; i < 8; ++i)
|
||||
CHECK(n.prepend_child(node_element));
|
||||
}
|
||||
|
||||
TEST_XML_FLAGS(compact_out_of_memory_string, "<n a='v'/><?n v?>", parse_pi)
|
||||
{
|
||||
test_runner::_memory_fail_threshold = 1;
|
||||
|
||||
overflow_hash_table(doc);
|
||||
|
||||
xml_attribute a = doc.child(STR("n")).attribute(STR("a"));
|
||||
xml_node pi = doc.last_child();
|
||||
|
||||
CHECK_ALLOC_FAIL(CHECK(!pi.set_name(STR("name"))));
|
||||
CHECK_ALLOC_FAIL(CHECK(!pi.set_value(STR("value"))));
|
||||
CHECK_ALLOC_FAIL(CHECK(!a.set_name(STR("name"))));
|
||||
CHECK_ALLOC_FAIL(CHECK(!a.set_value(STR("value"))));
|
||||
}
|
||||
|
||||
TEST_XML(compact_out_of_memory_attribute, "<n a='v'/>")
|
||||
{
|
||||
test_runner::_memory_fail_threshold = 1;
|
||||
|
||||
overflow_hash_table(doc);
|
||||
|
||||
xml_node n = doc.child(STR("n"));
|
||||
xml_attribute a = n.attribute(STR("a"));
|
||||
|
||||
CHECK_ALLOC_FAIL(CHECK(!n.append_attribute(STR(""))));
|
||||
CHECK_ALLOC_FAIL(CHECK(!n.prepend_attribute(STR(""))));
|
||||
CHECK_ALLOC_FAIL(CHECK(!n.insert_attribute_after(STR(""), a)));
|
||||
CHECK_ALLOC_FAIL(CHECK(!n.insert_attribute_before(STR(""), a)));
|
||||
}
|
||||
|
||||
TEST_XML(compact_out_of_memory_attribute_copy, "<n a='v'/>")
|
||||
{
|
||||
test_runner::_memory_fail_threshold = 1;
|
||||
|
||||
overflow_hash_table(doc);
|
||||
|
||||
xml_node n = doc.child(STR("n"));
|
||||
xml_attribute a = n.attribute(STR("a"));
|
||||
|
||||
CHECK_ALLOC_FAIL(CHECK(!n.append_copy(a)));
|
||||
CHECK_ALLOC_FAIL(CHECK(!n.prepend_copy(a)));
|
||||
CHECK_ALLOC_FAIL(CHECK(!n.insert_copy_after(a, a)));
|
||||
CHECK_ALLOC_FAIL(CHECK(!n.insert_copy_before(a, a)));
|
||||
}
|
||||
|
||||
TEST_XML(compact_out_of_memory_node, "<n/>")
|
||||
{
|
||||
test_runner::_memory_fail_threshold = 1;
|
||||
|
||||
overflow_hash_table(doc);
|
||||
|
||||
xml_node n = doc.child(STR("n"));
|
||||
|
||||
CHECK_ALLOC_FAIL(CHECK(!doc.append_child(node_element)));
|
||||
CHECK_ALLOC_FAIL(CHECK(!doc.prepend_child(node_element)));
|
||||
CHECK_ALLOC_FAIL(CHECK(!doc.insert_child_after(node_element, n)));
|
||||
CHECK_ALLOC_FAIL(CHECK(!doc.insert_child_before(node_element, n)));
|
||||
}
|
||||
|
||||
TEST_XML(compact_out_of_memory_node_copy, "<n/>")
|
||||
{
|
||||
test_runner::_memory_fail_threshold = 1;
|
||||
|
||||
overflow_hash_table(doc);
|
||||
|
||||
xml_node n = doc.child(STR("n"));
|
||||
|
||||
CHECK_ALLOC_FAIL(CHECK(!doc.append_copy(n)));
|
||||
CHECK_ALLOC_FAIL(CHECK(!doc.prepend_copy(n)));
|
||||
CHECK_ALLOC_FAIL(CHECK(!doc.insert_copy_after(n, n)));
|
||||
CHECK_ALLOC_FAIL(CHECK(!doc.insert_copy_before(n, n)));
|
||||
}
|
||||
|
||||
TEST_XML(compact_out_of_memory_node_move, "<n/><ne/>")
|
||||
{
|
||||
test_runner::_memory_fail_threshold = 1;
|
||||
|
||||
overflow_hash_table(doc);
|
||||
|
||||
xml_node n = doc.child(STR("n"));
|
||||
xml_node ne = doc.child(STR("ne"));
|
||||
|
||||
CHECK_ALLOC_FAIL(CHECK(!doc.append_move(n)));
|
||||
CHECK_ALLOC_FAIL(CHECK(!doc.prepend_move(n)));
|
||||
CHECK_ALLOC_FAIL(CHECK(!doc.insert_move_after(n, ne)));
|
||||
CHECK_ALLOC_FAIL(CHECK(!doc.insert_move_before(n, ne)));
|
||||
}
|
||||
|
||||
TEST_XML(compact_out_of_memory_remove, "<n a='v'/>")
|
||||
{
|
||||
test_runner::_memory_fail_threshold = 1;
|
||||
|
||||
overflow_hash_table(doc);
|
||||
|
||||
xml_node n = doc.child(STR("n"));
|
||||
xml_attribute a = n.attribute(STR("a"));
|
||||
|
||||
CHECK_ALLOC_FAIL(CHECK(!n.remove_attribute(a)));
|
||||
CHECK_ALLOC_FAIL(CHECK(!doc.remove_child(n)));
|
||||
}
|
||||
|
||||
TEST_XML(compact_pointer_attribute_list, "<n a='v'/>")
|
||||
{
|
||||
xml_node n = doc.child(STR("n"));
|
||||
xml_attribute a = n.attribute(STR("a"));
|
||||
|
||||
// make sure we fill the page with node x
|
||||
for (int i = 0; i < 1000; ++i)
|
||||
doc.append_child(STR("x"));
|
||||
|
||||
// this requires extended encoding for prev_attribute_c/next_attribute
|
||||
n.append_attribute(STR("b"));
|
||||
|
||||
// this requires extended encoding for first_attribute
|
||||
n.remove_attribute(a);
|
||||
|
||||
CHECK(!n.attribute(STR("a")));
|
||||
CHECK(n.attribute(STR("b")));
|
||||
}
|
||||
|
||||
TEST_XML(compact_pointer_node_list, "<n/>")
|
||||
{
|
||||
xml_node n = doc.child(STR("n"));
|
||||
|
||||
// make sure we fill the page with node x
|
||||
// this requires extended encoding for prev_sibling_c/next_sibling
|
||||
for (int i = 0; i < 1000; ++i)
|
||||
doc.append_child(STR("x"));
|
||||
|
||||
// this requires extended encoding for first_child
|
||||
n.append_child(STR("child"));
|
||||
|
||||
CHECK(n.child(STR("child")));
|
||||
}
|
||||
#endif
|
25
tests/test_deprecated.cpp
Normal file
25
tests/test_deprecated.cpp
Normal file
|
@ -0,0 +1,25 @@
|
|||
#define PUGIXML_DEPRECATED // Suppress deprecated declarations to avoid warnings
|
||||
|
||||
#include "test.hpp"
|
||||
|
||||
using namespace pugi;
|
||||
|
||||
TEST(document_deprecated_load)
|
||||
{
|
||||
xml_document doc;
|
||||
CHECK(doc.load(STR("<node/>")));
|
||||
CHECK_NODE(doc, STR("<node/>"));
|
||||
}
|
||||
|
||||
#ifndef PUGIXML_NO_XPATH
|
||||
TEST_XML(xpath_api_deprecated_select_single_node, "<node><head/><foo id='1'/><foo/><tail/></node>")
|
||||
{
|
||||
xpath_node n1 = doc.select_single_node(STR("node/foo"));
|
||||
|
||||
xpath_query q(STR("node/foo"));
|
||||
xpath_node n2 = doc.select_single_node(q);
|
||||
|
||||
CHECK(n1.node().attribute(STR("id")).as_int() == 1);
|
||||
CHECK(n2.node().attribute(STR("id")).as_int() == 1);
|
||||
}
|
||||
#endif
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,381 +1,487 @@
|
|||
#include "common.hpp"
|
||||
|
||||
#include "helpers.hpp"
|
||||
|
||||
TEST_XML_FLAGS(dom_text_empty, "<node><a>foo</a><b><![CDATA[bar]]></b><c><?pi value?></c><d/></node>", parse_default | parse_pi)
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
CHECK(node.child(STR("a")).text());
|
||||
CHECK(node.child(STR("b")).text());
|
||||
CHECK(!node.child(STR("c")).text());
|
||||
CHECK(!node.child(STR("d")).text());
|
||||
CHECK(!xml_node().text());
|
||||
CHECK(!xml_text());
|
||||
|
||||
generic_empty_test(node.child(STR("a")).text());
|
||||
}
|
||||
|
||||
TEST_XML(dom_text_bool_ops, "<node>foo</node>")
|
||||
{
|
||||
generic_bool_ops_test(doc.child(STR("node")).text());
|
||||
}
|
||||
|
||||
TEST_XML_FLAGS(dom_text_get, "<node><a>foo</a><b><node/><![CDATA[bar]]></b><c><?pi value?></c><d/></node>", parse_default | parse_pi)
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
CHECK_STRING(node.child(STR("a")).text().get(), STR("foo"));
|
||||
CHECK_STRING(node.child(STR("a")).first_child().text().get(), STR("foo"));
|
||||
|
||||
CHECK_STRING(node.child(STR("b")).text().get(), STR("bar"));
|
||||
CHECK_STRING(node.child(STR("b")).last_child().text().get(), STR("bar"));
|
||||
|
||||
CHECK_STRING(node.child(STR("c")).text().get(), STR(""));
|
||||
CHECK_STRING(node.child(STR("c")).first_child().text().get(), STR(""));
|
||||
|
||||
CHECK_STRING(node.child(STR("d")).text().get(), STR(""));
|
||||
|
||||
CHECK_STRING(xml_node().text().get(), STR(""));
|
||||
}
|
||||
|
||||
TEST_XML_FLAGS(dom_text_as_string, "<node><a>foo</a><b><node/><![CDATA[bar]]></b><c><?pi value?></c><d/></node>", parse_default | parse_pi)
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
CHECK_STRING(node.child(STR("a")).text().as_string(), STR("foo"));
|
||||
CHECK_STRING(node.child(STR("a")).first_child().text().as_string(), STR("foo"));
|
||||
|
||||
CHECK_STRING(node.child(STR("b")).text().as_string(), STR("bar"));
|
||||
CHECK_STRING(node.child(STR("b")).last_child().text().as_string(), STR("bar"));
|
||||
|
||||
CHECK_STRING(node.child(STR("c")).text().as_string(), STR(""));
|
||||
CHECK_STRING(node.child(STR("c")).first_child().text().as_string(), STR(""));
|
||||
|
||||
CHECK_STRING(node.child(STR("d")).text().as_string(), STR(""));
|
||||
|
||||
CHECK_STRING(xml_node().text().as_string(), STR(""));
|
||||
}
|
||||
|
||||
TEST_XML(dom_text_as_int, "<node><text1>1</text1><text2>-1</text2><text3>-2147483648</text3><text4>2147483647</text4><text5>0</text5></node>")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
CHECK(xml_text().as_int() == 0);
|
||||
CHECK(node.child(STR("text1")).text().as_int() == 1);
|
||||
CHECK(node.child(STR("text2")).text().as_int() == -1);
|
||||
CHECK(node.child(STR("text3")).text().as_int() == -2147483647 - 1);
|
||||
CHECK(node.child(STR("text4")).text().as_int() == 2147483647);
|
||||
CHECK(node.child(STR("text5")).text().as_int() == 0);
|
||||
}
|
||||
|
||||
TEST_XML(dom_text_as_int_hex, "<node><text1>0777</text1><text2>0x5ab</text2><text3>0XFf</text3><text4>-0x20</text4><text5>-0x80000000</text5><text6>0x</text6></node>")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
CHECK(node.child(STR("text1")).text().as_int() == 777); // no octal support! intentional
|
||||
CHECK(node.child(STR("text2")).text().as_int() == 1451);
|
||||
CHECK(node.child(STR("text3")).text().as_int() == 255);
|
||||
CHECK(node.child(STR("text4")).text().as_int() == -32);
|
||||
CHECK(node.child(STR("text5")).text().as_int() == -2147483647 - 1);
|
||||
CHECK(node.child(STR("text6")).text().as_int() == 0);
|
||||
}
|
||||
|
||||
TEST_XML(dom_text_as_uint, "<node><text1>0</text1><text2>1</text2><text3>2147483647</text3><text4>4294967295</text4><text5>0</text5></node>")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
CHECK(xml_text().as_uint() == 0);
|
||||
CHECK(node.child(STR("text1")).text().as_uint() == 0);
|
||||
CHECK(node.child(STR("text2")).text().as_uint() == 1);
|
||||
CHECK(node.child(STR("text3")).text().as_uint() == 2147483647);
|
||||
CHECK(node.child(STR("text4")).text().as_uint() == 4294967295u);
|
||||
CHECK(node.child(STR("text5")).text().as_uint() == 0);
|
||||
}
|
||||
|
||||
TEST_XML(dom_text_as_uint_hex, "<node><text1>0777</text1><text2>0x5ab</text2><text3>0XFf</text3><text4>0x20</text4><text5>0xFFFFFFFF</text5><text6>0x</text6></node>")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
CHECK(node.child(STR("text1")).text().as_uint() == 777); // no octal support! intentional
|
||||
CHECK(node.child(STR("text2")).text().as_uint() == 1451);
|
||||
CHECK(node.child(STR("text3")).text().as_uint() == 255);
|
||||
CHECK(node.child(STR("text4")).text().as_uint() == 32);
|
||||
CHECK(node.child(STR("text5")).text().as_uint() == 4294967295u);
|
||||
CHECK(node.child(STR("text6")).text().as_uint() == 0);
|
||||
}
|
||||
|
||||
TEST_XML(dom_text_as_integer_space, "<node><text1> \t\n1234</text1><text2>\n\t 0x123</text2><text3>- 16</text3><text4>- 0x10</text4></node>")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
CHECK(node.child(STR("text1")).text().as_int() == 1234);
|
||||
CHECK(node.child(STR("text2")).text().as_int() == 291);
|
||||
CHECK(node.child(STR("text3")).text().as_int() == 0);
|
||||
CHECK(node.child(STR("text4")).text().as_int() == 0);
|
||||
}
|
||||
|
||||
TEST_XML(dom_text_as_float, "<node><text1>0</text1><text2>1</text2><text3>0.12</text3><text4>-5.1</text4><text5>3e-4</text5><text6>3.14159265358979323846</text6></node>")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
CHECK(xml_text().as_float() == 0);
|
||||
CHECK_DOUBLE(node.child(STR("text1")).text().as_float(), 0);
|
||||
CHECK_DOUBLE(node.child(STR("text2")).text().as_float(), 1);
|
||||
CHECK_DOUBLE(node.child(STR("text3")).text().as_float(), 0.12);
|
||||
CHECK_DOUBLE(node.child(STR("text4")).text().as_float(), -5.1);
|
||||
CHECK_DOUBLE(node.child(STR("text5")).text().as_float(), 3e-4);
|
||||
CHECK_DOUBLE(node.child(STR("text6")).text().as_float(), 3.14159265358979323846);
|
||||
}
|
||||
|
||||
TEST_XML(dom_text_as_double, "<node><text1>0</text1><text2>1</text2><text3>0.12</text3><text4>-5.1</text4><text5>3e-4</text5><text6>3.14159265358979323846</text6></node>")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
CHECK(xml_text().as_double() == 0);
|
||||
CHECK_DOUBLE(node.child(STR("text1")).text().as_double(), 0);
|
||||
CHECK_DOUBLE(node.child(STR("text2")).text().as_double(), 1);
|
||||
CHECK_DOUBLE(node.child(STR("text3")).text().as_double(), 0.12);
|
||||
CHECK_DOUBLE(node.child(STR("text4")).text().as_double(), -5.1);
|
||||
CHECK_DOUBLE(node.child(STR("text5")).text().as_double(), 3e-4);
|
||||
CHECK_DOUBLE(node.child(STR("text6")).text().as_double(), 3.14159265358979323846);
|
||||
}
|
||||
|
||||
TEST_XML(dom_text_as_bool, "<node><text1>0</text1><text2>1</text2><text3>true</text3><text4>True</text4><text5>Yes</text5><text6>yes</text6><text7>false</text7></node>")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
CHECK(!xml_text().as_bool());
|
||||
CHECK(!node.child(STR("text1")).text().as_bool());
|
||||
CHECK(node.child(STR("text2")).text().as_bool());
|
||||
CHECK(node.child(STR("text3")).text().as_bool());
|
||||
CHECK(node.child(STR("text4")).text().as_bool());
|
||||
CHECK(node.child(STR("text5")).text().as_bool());
|
||||
CHECK(node.child(STR("text6")).text().as_bool());
|
||||
CHECK(!node.child(STR("text7")).text().as_bool());
|
||||
}
|
||||
|
||||
#ifdef PUGIXML_HAS_LONG_LONG
|
||||
TEST_XML(dom_text_as_llong, "<node><text1>1</text1><text2>-1</text2><text3>-9223372036854775808</text3><text4>9223372036854775807</text4><text5>0</text5></node>")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
CHECK(xml_text().as_llong() == 0);
|
||||
CHECK(node.child(STR("text1")).text().as_llong() == 1);
|
||||
CHECK(node.child(STR("text2")).text().as_llong() == -1);
|
||||
CHECK(node.child(STR("text3")).text().as_llong() == -9223372036854775807ll - 1);
|
||||
CHECK(node.child(STR("text4")).text().as_llong() == 9223372036854775807ll);
|
||||
CHECK(node.child(STR("text5")).text().as_llong() == 0);
|
||||
}
|
||||
|
||||
TEST_XML(dom_text_as_llong_hex, "<node><text1>0777</text1><text2>0x5ab</text2><text3>0XFf</text3><text4>-0x20</text4><text5>-0x8000000000000000</text5><text6>0x</text6></node>")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
CHECK(node.child(STR("text1")).text().as_llong() == 777); // no octal support! intentional
|
||||
CHECK(node.child(STR("text2")).text().as_llong() == 1451);
|
||||
CHECK(node.child(STR("text3")).text().as_llong() == 255);
|
||||
CHECK(node.child(STR("text4")).text().as_llong() == -32);
|
||||
CHECK(node.child(STR("text5")).text().as_llong() == -9223372036854775807ll - 1);
|
||||
CHECK(node.child(STR("text6")).text().as_llong() == 0);
|
||||
}
|
||||
|
||||
TEST_XML(dom_text_as_ullong, "<node><text1>0</text1><text2>1</text2><text3>9223372036854775807</text3><text4>18446744073709551615</text4><text5>0</text5></node>")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
CHECK(xml_text().as_ullong() == 0);
|
||||
CHECK(node.child(STR("text1")).text().as_ullong() == 0);
|
||||
CHECK(node.child(STR("text2")).text().as_ullong() == 1);
|
||||
CHECK(node.child(STR("text3")).text().as_ullong() == 9223372036854775807ll);
|
||||
CHECK(node.child(STR("text4")).text().as_ullong() == 18446744073709551615ull);
|
||||
CHECK(node.child(STR("text5")).text().as_ullong() == 0);
|
||||
}
|
||||
|
||||
TEST_XML(dom_text_as_ullong_hex, "<node><text1>0777</text1><text2>0x5ab</text2><text3>0XFf</text3><text4>0x20</text4><text5>0xFFFFFFFFFFFFFFFF</text5><text6>0x</text6></node>")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
CHECK(node.child(STR("text1")).text().as_ullong() == 777); // no octal support! intentional
|
||||
CHECK(node.child(STR("text2")).text().as_ullong() == 1451);
|
||||
CHECK(node.child(STR("text3")).text().as_ullong() == 255);
|
||||
CHECK(node.child(STR("text4")).text().as_ullong() == 32);
|
||||
CHECK(node.child(STR("text5")).text().as_ullong() == 18446744073709551615ull);
|
||||
CHECK(node.child(STR("text6")).text().as_ullong() == 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST_XML(dom_text_get_no_state, "<node/>")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
xml_text t = node.text();
|
||||
|
||||
CHECK(!t);
|
||||
CHECK(t.get() && *t.get() == 0);
|
||||
CHECK(!node.first_child());
|
||||
|
||||
node.append_child(node_pcdata);
|
||||
|
||||
CHECK(t);
|
||||
CHECK_STRING(t.get(), STR(""));
|
||||
|
||||
node.first_child().set_value(STR("test"));
|
||||
|
||||
CHECK(t);
|
||||
CHECK_STRING(t.get(), STR("test"));
|
||||
}
|
||||
|
||||
TEST_XML(dom_text_set, "<node/>")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
xml_text t = node.text();
|
||||
|
||||
t.set(STR(""));
|
||||
CHECK(node.first_child().type() == node_pcdata);
|
||||
CHECK_NODE(node, STR("<node></node>"));
|
||||
|
||||
t.set(STR("boo"));
|
||||
CHECK(node.first_child().type() == node_pcdata);
|
||||
CHECK(node.first_child() == node.last_child());
|
||||
CHECK_NODE(node, STR("<node>boo</node>"));
|
||||
|
||||
t.set(STR("foobarfoobar"));
|
||||
CHECK(node.first_child().type() == node_pcdata);
|
||||
CHECK(node.first_child() == node.last_child());
|
||||
CHECK_NODE(node, STR("<node>foobarfoobar</node>"));
|
||||
}
|
||||
|
||||
TEST_XML(dom_text_assign, "<node/>")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
node.append_child(STR("text1")).text() = STR("v1");
|
||||
xml_text() = STR("v1");
|
||||
|
||||
node.append_child(STR("text2")).text() = -2147483647;
|
||||
node.append_child(STR("text3")).text() = -2147483647 - 1;
|
||||
xml_text() = -2147483647 - 1;
|
||||
|
||||
node.append_child(STR("text4")).text() = 4294967295u;
|
||||
node.append_child(STR("text5")).text() = 4294967294u;
|
||||
xml_text() = 4294967295u;
|
||||
|
||||
node.append_child(STR("text6")).text() = 0.5;
|
||||
xml_text() = 0.5;
|
||||
|
||||
node.append_child(STR("text7")).text() = 0.25f;
|
||||
xml_text() = 0.25f;
|
||||
|
||||
node.append_child(STR("text8")).text() = true;
|
||||
xml_text() = true;
|
||||
|
||||
CHECK_NODE(node, STR("<node><text1>v1</text1><text2>-2147483647</text2><text3>-2147483648</text3><text4>4294967295</text4><text5>4294967294</text5><text6>0.5</text6><text7>0.25</text7><text8>true</text8></node>"));
|
||||
}
|
||||
|
||||
TEST_XML(dom_text_set_value, "<node/>")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
CHECK(node.append_child(STR("text1")).text().set(STR("v1")));
|
||||
CHECK(!xml_text().set(STR("v1")));
|
||||
|
||||
CHECK(node.append_child(STR("text2")).text().set(-2147483647));
|
||||
CHECK(node.append_child(STR("text3")).text().set(-2147483647 - 1));
|
||||
CHECK(!xml_text().set(-2147483647 - 1));
|
||||
|
||||
CHECK(node.append_child(STR("text4")).text().set(4294967295u));
|
||||
CHECK(node.append_child(STR("text5")).text().set(4294967294u));
|
||||
CHECK(!xml_text().set(4294967295u));
|
||||
|
||||
CHECK(node.append_child(STR("text6")).text().set(0.5));
|
||||
CHECK(!xml_text().set(0.5));
|
||||
|
||||
CHECK(node.append_child(STR("text7")).text().set(0.25f));
|
||||
CHECK(!xml_text().set(0.25f));
|
||||
|
||||
CHECK(node.append_child(STR("text8")).text().set(true));
|
||||
CHECK(!xml_text().set(true));
|
||||
|
||||
CHECK_NODE(node, STR("<node><text1>v1</text1><text2>-2147483647</text2><text3>-2147483648</text3><text4>4294967295</text4><text5>4294967294</text5><text6>0.5</text6><text7>0.25</text7><text8>true</text8></node>"));
|
||||
}
|
||||
|
||||
#ifdef PUGIXML_HAS_LONG_LONG
|
||||
TEST_XML(dom_text_assign_llong, "<node/>")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
node.append_child(STR("text1")).text() = -9223372036854775807ll;
|
||||
node.append_child(STR("text2")).text() = -9223372036854775807ll - 1;
|
||||
xml_text() = -9223372036854775807ll - 1;
|
||||
|
||||
node.append_child(STR("text3")).text() = 18446744073709551615ull;
|
||||
node.append_child(STR("text4")).text() = 18446744073709551614ull;
|
||||
xml_text() = 18446744073709551615ull;
|
||||
|
||||
CHECK_NODE(node, STR("<node><text1>-9223372036854775807</text1><text2>-9223372036854775808</text2><text3>18446744073709551615</text3><text4>18446744073709551614</text4></node>"));
|
||||
}
|
||||
|
||||
TEST_XML(dom_text_set_value_llong, "<node/>")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
CHECK(node.append_child(STR("text1")).text().set(-9223372036854775807ll));
|
||||
CHECK(node.append_child(STR("text2")).text().set(-9223372036854775807ll - 1));
|
||||
CHECK(!xml_text().set(-9223372036854775807ll - 1));
|
||||
|
||||
CHECK(node.append_child(STR("text3")).text().set(18446744073709551615ull));
|
||||
CHECK(node.append_child(STR("text4")).text().set(18446744073709551614ull));
|
||||
CHECK(!xml_text().set(18446744073709551615ull));
|
||||
|
||||
CHECK_NODE(node, STR("<node><text1>-9223372036854775807</text1><text2>-9223372036854775808</text2><text3>18446744073709551615</text3><text4>18446744073709551614</text4></node>"));
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST_XML(dom_text_middle, "<node><c1>notthisone</c1>text<c2/></node>")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
xml_text t = node.text();
|
||||
|
||||
CHECK_STRING(t.get(), STR("text"));
|
||||
t.set(STR("notext"));
|
||||
|
||||
CHECK_NODE(node, STR("<node><c1>notthisone</c1>notext<c2 /></node>"));
|
||||
CHECK(node.remove_child(t.data()));
|
||||
|
||||
CHECK(!t);
|
||||
CHECK_NODE(node, STR("<node><c1>notthisone</c1><c2 /></node>"));
|
||||
|
||||
t.set(STR("yestext"));
|
||||
|
||||
CHECK(t);
|
||||
CHECK_NODE(node, STR("<node><c1>notthisone</c1><c2 />yestext</node>"));
|
||||
CHECK(t.data() == node.last_child());
|
||||
}
|
||||
|
||||
TEST_XML_FLAGS(dom_text_data, "<node><a>foo</a><b><![CDATA[bar]]></b><c><?pi value?></c><d/></node>", parse_default | parse_pi)
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
CHECK(node.child(STR("a")).text().data() == node.child(STR("a")).first_child());
|
||||
CHECK(node.child(STR("b")).text().data() == node.child(STR("b")).first_child());
|
||||
CHECK(!node.child(STR("c")).text().data());
|
||||
CHECK(!node.child(STR("d")).text().data());
|
||||
CHECK(!xml_text().data());
|
||||
}
|
||||
|
||||
TEST(dom_text_defaults)
|
||||
{
|
||||
xml_text text;
|
||||
|
||||
CHECK_STRING(text.as_string(STR("foo")), STR("foo"));
|
||||
CHECK(text.as_int(42) == 42);
|
||||
CHECK(text.as_uint(42) == 42);
|
||||
CHECK(text.as_double(42) == 42);
|
||||
CHECK(text.as_float(42) == 42);
|
||||
CHECK(text.as_bool(true) == true);
|
||||
|
||||
#ifdef PUGIXML_HAS_LONG_LONG
|
||||
CHECK(text.as_llong(42) == 42);
|
||||
CHECK(text.as_ullong(42) == 42);
|
||||
#endif
|
||||
}
|
||||
#include "test.hpp"
|
||||
|
||||
#include "helpers.hpp"
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
using namespace pugi;
|
||||
|
||||
TEST_XML_FLAGS(dom_text_empty, "<node><a>foo</a><b><![CDATA[bar]]></b><c><?pi value?></c><d/></node>", parse_default | parse_pi)
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
CHECK(node.child(STR("a")).text());
|
||||
CHECK(node.child(STR("b")).text());
|
||||
CHECK(!node.child(STR("c")).text());
|
||||
CHECK(!node.child(STR("d")).text());
|
||||
CHECK(!xml_node().text());
|
||||
CHECK(!xml_text());
|
||||
|
||||
generic_empty_test(node.child(STR("a")).text());
|
||||
}
|
||||
|
||||
TEST_XML(dom_text_bool_ops, "<node>foo</node>")
|
||||
{
|
||||
generic_bool_ops_test(doc.child(STR("node")).text());
|
||||
}
|
||||
|
||||
TEST_XML_FLAGS(dom_text_get, "<node><a>foo</a><b><node/><![CDATA[bar]]></b><c><?pi value?></c><d/></node>", parse_default | parse_pi)
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
CHECK_STRING(node.child(STR("a")).text().get(), STR("foo"));
|
||||
CHECK_STRING(node.child(STR("a")).first_child().text().get(), STR("foo"));
|
||||
|
||||
CHECK_STRING(node.child(STR("b")).text().get(), STR("bar"));
|
||||
CHECK_STRING(node.child(STR("b")).last_child().text().get(), STR("bar"));
|
||||
|
||||
CHECK_STRING(node.child(STR("c")).text().get(), STR(""));
|
||||
CHECK_STRING(node.child(STR("c")).first_child().text().get(), STR(""));
|
||||
|
||||
CHECK_STRING(node.child(STR("d")).text().get(), STR(""));
|
||||
|
||||
CHECK_STRING(xml_node().text().get(), STR(""));
|
||||
}
|
||||
|
||||
TEST_XML_FLAGS(dom_text_as_string, "<node><a>foo</a><b><node/><![CDATA[bar]]></b><c><?pi value?></c><d/></node>", parse_default | parse_pi)
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
CHECK_STRING(node.child(STR("a")).text().as_string(), STR("foo"));
|
||||
CHECK_STRING(node.child(STR("a")).first_child().text().as_string(), STR("foo"));
|
||||
|
||||
CHECK_STRING(node.child(STR("b")).text().as_string(), STR("bar"));
|
||||
CHECK_STRING(node.child(STR("b")).last_child().text().as_string(), STR("bar"));
|
||||
|
||||
CHECK_STRING(node.child(STR("c")).text().as_string(), STR(""));
|
||||
CHECK_STRING(node.child(STR("c")).first_child().text().as_string(), STR(""));
|
||||
|
||||
CHECK_STRING(node.child(STR("d")).text().as_string(), STR(""));
|
||||
|
||||
CHECK_STRING(xml_node().text().as_string(), STR(""));
|
||||
}
|
||||
|
||||
TEST_XML(dom_text_as_int, "<node><text1>1</text1><text2>-1</text2><text3>-2147483648</text3><text4>2147483647</text4><text5>0</text5></node>")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
CHECK(xml_text().as_int() == 0);
|
||||
CHECK(node.child(STR("text1")).text().as_int() == 1);
|
||||
CHECK(node.child(STR("text2")).text().as_int() == -1);
|
||||
CHECK(node.child(STR("text3")).text().as_int() == -2147483647 - 1);
|
||||
CHECK(node.child(STR("text4")).text().as_int() == 2147483647);
|
||||
CHECK(node.child(STR("text5")).text().as_int() == 0);
|
||||
}
|
||||
|
||||
TEST_XML(dom_text_as_int_hex, "<node><text1>0777</text1><text2>0x5ab</text2><text3>0XFf</text3><text4>-0x20</text4><text5>-0x80000000</text5><text6>0x</text6></node>")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
CHECK(node.child(STR("text1")).text().as_int() == 777); // no octal support! intentional
|
||||
CHECK(node.child(STR("text2")).text().as_int() == 1451);
|
||||
CHECK(node.child(STR("text3")).text().as_int() == 255);
|
||||
CHECK(node.child(STR("text4")).text().as_int() == -32);
|
||||
CHECK(node.child(STR("text5")).text().as_int() == -2147483647 - 1);
|
||||
CHECK(node.child(STR("text6")).text().as_int() == 0);
|
||||
}
|
||||
|
||||
TEST_XML(dom_text_as_uint, "<node><text1>0</text1><text2>1</text2><text3>2147483647</text3><text4>4294967295</text4><text5>0</text5></node>")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
CHECK(xml_text().as_uint() == 0);
|
||||
CHECK(node.child(STR("text1")).text().as_uint() == 0);
|
||||
CHECK(node.child(STR("text2")).text().as_uint() == 1);
|
||||
CHECK(node.child(STR("text3")).text().as_uint() == 2147483647);
|
||||
CHECK(node.child(STR("text4")).text().as_uint() == 4294967295u);
|
||||
CHECK(node.child(STR("text5")).text().as_uint() == 0);
|
||||
}
|
||||
|
||||
TEST_XML(dom_text_as_uint_hex, "<node><text1>0777</text1><text2>0x5ab</text2><text3>0XFf</text3><text4>0x20</text4><text5>0xFFFFFFFF</text5><text6>0x</text6></node>")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
CHECK(node.child(STR("text1")).text().as_uint() == 777); // no octal support! intentional
|
||||
CHECK(node.child(STR("text2")).text().as_uint() == 1451);
|
||||
CHECK(node.child(STR("text3")).text().as_uint() == 255);
|
||||
CHECK(node.child(STR("text4")).text().as_uint() == 32);
|
||||
CHECK(node.child(STR("text5")).text().as_uint() == 4294967295u);
|
||||
CHECK(node.child(STR("text6")).text().as_uint() == 0);
|
||||
}
|
||||
|
||||
TEST_XML(dom_text_as_integer_space, "<node><text1> \t\n1234</text1><text2>\n\t 0x123</text2><text3>- 16</text3><text4>- 0x10</text4></node>")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
CHECK(node.child(STR("text1")).text().as_int() == 1234);
|
||||
CHECK(node.child(STR("text2")).text().as_int() == 291);
|
||||
CHECK(node.child(STR("text3")).text().as_int() == 0);
|
||||
CHECK(node.child(STR("text4")).text().as_int() == 0);
|
||||
}
|
||||
|
||||
TEST_XML(dom_text_as_float, "<node><text1>0</text1><text2>1</text2><text3>0.12</text3><text4>-5.1</text4><text5>3e-4</text5><text6>3.14159265358979323846</text6></node>")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
CHECK(xml_text().as_float() == 0);
|
||||
CHECK_DOUBLE(double(node.child(STR("text1")).text().as_float()), 0);
|
||||
CHECK_DOUBLE(double(node.child(STR("text2")).text().as_float()), 1);
|
||||
CHECK_DOUBLE(double(node.child(STR("text3")).text().as_float()), 0.12);
|
||||
CHECK_DOUBLE(double(node.child(STR("text4")).text().as_float()), -5.1);
|
||||
CHECK_DOUBLE(double(node.child(STR("text5")).text().as_float()), 3e-4);
|
||||
CHECK_DOUBLE(double(node.child(STR("text6")).text().as_float()), 3.14159265358979323846);
|
||||
}
|
||||
|
||||
TEST_XML(dom_text_as_double, "<node><text1>0</text1><text2>1</text2><text3>0.12</text3><text4>-5.1</text4><text5>3e-4</text5><text6>3.14159265358979323846</text6></node>")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
CHECK(xml_text().as_double() == 0);
|
||||
CHECK_DOUBLE(node.child(STR("text1")).text().as_double(), 0);
|
||||
CHECK_DOUBLE(node.child(STR("text2")).text().as_double(), 1);
|
||||
CHECK_DOUBLE(node.child(STR("text3")).text().as_double(), 0.12);
|
||||
CHECK_DOUBLE(node.child(STR("text4")).text().as_double(), -5.1);
|
||||
CHECK_DOUBLE(node.child(STR("text5")).text().as_double(), 3e-4);
|
||||
CHECK_DOUBLE(node.child(STR("text6")).text().as_double(), 3.14159265358979323846);
|
||||
}
|
||||
|
||||
TEST_XML(dom_text_as_bool, "<node><text1>0</text1><text2>1</text2><text3>true</text3><text4>True</text4><text5>Yes</text5><text6>yes</text6><text7>false</text7></node>")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
CHECK(!xml_text().as_bool());
|
||||
CHECK(!node.child(STR("text1")).text().as_bool());
|
||||
CHECK(node.child(STR("text2")).text().as_bool());
|
||||
CHECK(node.child(STR("text3")).text().as_bool());
|
||||
CHECK(node.child(STR("text4")).text().as_bool());
|
||||
CHECK(node.child(STR("text5")).text().as_bool());
|
||||
CHECK(node.child(STR("text6")).text().as_bool());
|
||||
CHECK(!node.child(STR("text7")).text().as_bool());
|
||||
}
|
||||
|
||||
#ifdef PUGIXML_HAS_LONG_LONG
|
||||
TEST_XML(dom_text_as_llong, "<node><text1>1</text1><text2>-1</text2><text3>-9223372036854775808</text3><text4>9223372036854775807</text4><text5>0</text5></node>")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
CHECK(xml_text().as_llong() == 0);
|
||||
CHECK(node.child(STR("text1")).text().as_llong() == 1);
|
||||
CHECK(node.child(STR("text2")).text().as_llong() == -1);
|
||||
CHECK(node.child(STR("text3")).text().as_llong() == -9223372036854775807ll - 1);
|
||||
CHECK(node.child(STR("text4")).text().as_llong() == 9223372036854775807ll);
|
||||
CHECK(node.child(STR("text5")).text().as_llong() == 0);
|
||||
}
|
||||
|
||||
TEST_XML(dom_text_as_llong_hex, "<node><text1>0777</text1><text2>0x5ab</text2><text3>0XFf</text3><text4>-0x20</text4><text5>-0x8000000000000000</text5><text6>0x</text6></node>")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
CHECK(node.child(STR("text1")).text().as_llong() == 777); // no octal support! intentional
|
||||
CHECK(node.child(STR("text2")).text().as_llong() == 1451);
|
||||
CHECK(node.child(STR("text3")).text().as_llong() == 255);
|
||||
CHECK(node.child(STR("text4")).text().as_llong() == -32);
|
||||
CHECK(node.child(STR("text5")).text().as_llong() == -9223372036854775807ll - 1);
|
||||
CHECK(node.child(STR("text6")).text().as_llong() == 0);
|
||||
}
|
||||
|
||||
TEST_XML(dom_text_as_ullong, "<node><text1>0</text1><text2>1</text2><text3>9223372036854775807</text3><text4>18446744073709551615</text4><text5>0</text5></node>")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
CHECK(xml_text().as_ullong() == 0);
|
||||
CHECK(node.child(STR("text1")).text().as_ullong() == 0);
|
||||
CHECK(node.child(STR("text2")).text().as_ullong() == 1);
|
||||
CHECK(node.child(STR("text3")).text().as_ullong() == 9223372036854775807ll);
|
||||
CHECK(node.child(STR("text4")).text().as_ullong() == 18446744073709551615ull);
|
||||
CHECK(node.child(STR("text5")).text().as_ullong() == 0);
|
||||
}
|
||||
|
||||
TEST_XML(dom_text_as_ullong_hex, "<node><text1>0777</text1><text2>0x5ab</text2><text3>0XFf</text3><text4>0x20</text4><text5>0xFFFFFFFFFFFFFFFF</text5><text6>0x</text6></node>")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
CHECK(node.child(STR("text1")).text().as_ullong() == 777); // no octal support! intentional
|
||||
CHECK(node.child(STR("text2")).text().as_ullong() == 1451);
|
||||
CHECK(node.child(STR("text3")).text().as_ullong() == 255);
|
||||
CHECK(node.child(STR("text4")).text().as_ullong() == 32);
|
||||
CHECK(node.child(STR("text5")).text().as_ullong() == 18446744073709551615ull);
|
||||
CHECK(node.child(STR("text6")).text().as_ullong() == 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST_XML(dom_text_get_no_state, "<node/>")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
xml_text t = node.text();
|
||||
|
||||
CHECK(!t);
|
||||
CHECK(t.get() && *t.get() == 0);
|
||||
CHECK(!node.first_child());
|
||||
|
||||
node.append_child(node_pcdata);
|
||||
|
||||
CHECK(t);
|
||||
CHECK_STRING(t.get(), STR(""));
|
||||
|
||||
node.first_child().set_value(STR("test"));
|
||||
|
||||
CHECK(t);
|
||||
CHECK_STRING(t.get(), STR("test"));
|
||||
}
|
||||
|
||||
TEST_XML(dom_text_set, "<node/>")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
xml_text t = node.text();
|
||||
|
||||
t.set(STR(""));
|
||||
CHECK(node.first_child().type() == node_pcdata);
|
||||
CHECK_NODE(node, STR("<node></node>"));
|
||||
|
||||
t.set(STR("boo"));
|
||||
CHECK(node.first_child().type() == node_pcdata);
|
||||
CHECK(node.first_child() == node.last_child());
|
||||
CHECK_NODE(node, STR("<node>boo</node>"));
|
||||
|
||||
t.set(STR("foobarfoobar"));
|
||||
CHECK(node.first_child().type() == node_pcdata);
|
||||
CHECK(node.first_child() == node.last_child());
|
||||
CHECK_NODE(node, STR("<node>foobarfoobar</node>"));
|
||||
}
|
||||
|
||||
TEST_XML(dom_text_set_with_size, "<node/>")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
xml_text t = node.text();
|
||||
|
||||
t.set(STR(""), 0);
|
||||
CHECK(node.first_child().type() == node_pcdata);
|
||||
CHECK_NODE(node, STR("<node></node>"));
|
||||
|
||||
t.set(STR("boo"), 3);
|
||||
CHECK(node.first_child().type() == node_pcdata);
|
||||
CHECK(node.first_child() == node.last_child());
|
||||
CHECK_NODE(node, STR("<node>boo</node>"));
|
||||
|
||||
t.set(STR("foobarfoobar"), 12);
|
||||
CHECK(node.first_child().type() == node_pcdata);
|
||||
CHECK(node.first_child() == node.last_child());
|
||||
CHECK_NODE(node, STR("<node>foobarfoobar</node>"));
|
||||
}
|
||||
|
||||
TEST_XML(dom_text_set_partially_with_size, "<node/>")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
xml_text t = node.text();
|
||||
|
||||
t.set(STR("foo"), 0);
|
||||
CHECK(node.first_child().type() == node_pcdata);
|
||||
CHECK_NODE(node, STR("<node></node>"));
|
||||
|
||||
t.set(STR("boofoo"), 3);
|
||||
CHECK(node.first_child().type() == node_pcdata);
|
||||
CHECK(node.first_child() == node.last_child());
|
||||
CHECK_NODE(node, STR("<node>boo</node>"));
|
||||
|
||||
t.set(STR("foobarfoobar"), 3);
|
||||
CHECK(node.first_child().type() == node_pcdata);
|
||||
CHECK(node.first_child() == node.last_child());
|
||||
CHECK_NODE(node, STR("<node>foo</node>"));
|
||||
}
|
||||
|
||||
TEST_XML(dom_text_assign, "<node/>")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
node.append_child(STR("text1")).text() = STR("v1");
|
||||
xml_text() = STR("v1");
|
||||
|
||||
node.append_child(STR("text2")).text() = -2147483647;
|
||||
node.append_child(STR("text3")).text() = -2147483647 - 1;
|
||||
xml_text() = -2147483647 - 1;
|
||||
|
||||
node.append_child(STR("text4")).text() = 4294967295u;
|
||||
node.append_child(STR("text5")).text() = 4294967294u;
|
||||
xml_text() = 4294967295u;
|
||||
|
||||
node.append_child(STR("text6")).text() = 0.5;
|
||||
xml_text() = 0.5;
|
||||
|
||||
node.append_child(STR("text7")).text() = 0.25f;
|
||||
xml_text() = 0.25f;
|
||||
|
||||
node.append_child(STR("text8")).text() = true;
|
||||
xml_text() = true;
|
||||
|
||||
CHECK_NODE(node, STR("<node><text1>v1</text1><text2>-2147483647</text2><text3>-2147483648</text3><text4>4294967295</text4><text5>4294967294</text5><text6>0.5</text6><text7>0.25</text7><text8>true</text8></node>"));
|
||||
}
|
||||
|
||||
TEST_XML(dom_text_set_value, "<node/>")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
CHECK(node.append_child(STR("text1")).text().set(STR("v1")));
|
||||
CHECK(!xml_text().set(STR("v1")));
|
||||
|
||||
CHECK(node.append_child(STR("text2")).text().set(-2147483647));
|
||||
CHECK(node.append_child(STR("text3")).text().set(-2147483647 - 1));
|
||||
CHECK(!xml_text().set(-2147483647 - 1));
|
||||
|
||||
CHECK(node.append_child(STR("text4")).text().set(4294967295u));
|
||||
CHECK(node.append_child(STR("text5")).text().set(4294967294u));
|
||||
CHECK(!xml_text().set(4294967295u));
|
||||
|
||||
CHECK(node.append_child(STR("text6")).text().set(0.5));
|
||||
CHECK(!xml_text().set(0.5));
|
||||
|
||||
CHECK(node.append_child(STR("text7")).text().set(0.25f));
|
||||
CHECK(!xml_text().set(0.25f));
|
||||
|
||||
CHECK(node.append_child(STR("text8")).text().set(true));
|
||||
CHECK(!xml_text().set(true));
|
||||
|
||||
CHECK_NODE(node, STR("<node><text1>v1</text1><text2>-2147483647</text2><text3>-2147483648</text3><text4>4294967295</text4><text5>4294967294</text5><text6>0.5</text6><text7>0.25</text7><text8>true</text8></node>"));
|
||||
}
|
||||
|
||||
#if LONG_MAX > 2147483647
|
||||
TEST_XML(dom_text_assign_long, "<node/>")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
node.append_child(STR("text1")).text() = -9223372036854775807l;
|
||||
node.append_child(STR("text2")).text() = -9223372036854775807l - 1;
|
||||
xml_text() = -9223372036854775807l - 1;
|
||||
|
||||
node.append_child(STR("text3")).text() = 18446744073709551615ul;
|
||||
node.append_child(STR("text4")).text() = 18446744073709551614ul;
|
||||
xml_text() = 18446744073709551615ul;
|
||||
|
||||
CHECK_NODE(node, STR("<node><text1>-9223372036854775807</text1><text2>-9223372036854775808</text2><text3>18446744073709551615</text3><text4>18446744073709551614</text4></node>"));
|
||||
}
|
||||
|
||||
TEST_XML(dom_text_set_value_long, "<node/>")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
CHECK(node.append_child(STR("text1")).text().set(-9223372036854775807l));
|
||||
CHECK(node.append_child(STR("text2")).text().set(-9223372036854775807l - 1));
|
||||
CHECK(!xml_text().set(-9223372036854775807l - 1));
|
||||
|
||||
CHECK(node.append_child(STR("text3")).text().set(18446744073709551615ul));
|
||||
CHECK(node.append_child(STR("text4")).text().set(18446744073709551614ul));
|
||||
CHECK(!xml_text().set(18446744073709551615ul));
|
||||
|
||||
CHECK_NODE(node, STR("<node><text1>-9223372036854775807</text1><text2>-9223372036854775808</text2><text3>18446744073709551615</text3><text4>18446744073709551614</text4></node>"));
|
||||
}
|
||||
#else
|
||||
TEST_XML(dom_text_assign_long, "<node/>")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
node.append_child(STR("text1")).text() = -2147483647l;
|
||||
node.append_child(STR("text2")).text() = -2147483647l - 1;
|
||||
xml_text() = -2147483647l - 1;
|
||||
|
||||
node.append_child(STR("text3")).text() = 4294967295ul;
|
||||
node.append_child(STR("text4")).text() = 4294967294ul;
|
||||
xml_text() = 4294967295ul;
|
||||
|
||||
CHECK_NODE(node, STR("<node><text1>-2147483647</text1><text2>-2147483648</text2><text3>4294967295</text3><text4>4294967294</text4></node>"));
|
||||
}
|
||||
|
||||
TEST_XML(dom_text_set_value_long, "<node/>")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
CHECK(node.append_child(STR("text1")).text().set(-2147483647l));
|
||||
CHECK(node.append_child(STR("text2")).text().set(-2147483647l - 1));
|
||||
CHECK(!xml_text().set(-2147483647l - 1));
|
||||
|
||||
CHECK(node.append_child(STR("text3")).text().set(4294967295ul));
|
||||
CHECK(node.append_child(STR("text4")).text().set(4294967294ul));
|
||||
CHECK(!xml_text().set(4294967295ul));
|
||||
|
||||
CHECK_NODE(node, STR("<node><text1>-2147483647</text1><text2>-2147483648</text2><text3>4294967295</text3><text4>4294967294</text4></node>"));
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PUGIXML_HAS_LONG_LONG
|
||||
TEST_XML(dom_text_assign_llong, "<node/>")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
node.append_child(STR("text1")).text() = -9223372036854775807ll;
|
||||
node.append_child(STR("text2")).text() = -9223372036854775807ll - 1;
|
||||
xml_text() = -9223372036854775807ll - 1;
|
||||
|
||||
node.append_child(STR("text3")).text() = 18446744073709551615ull;
|
||||
node.append_child(STR("text4")).text() = 18446744073709551614ull;
|
||||
xml_text() = 18446744073709551615ull;
|
||||
|
||||
CHECK_NODE(node, STR("<node><text1>-9223372036854775807</text1><text2>-9223372036854775808</text2><text3>18446744073709551615</text3><text4>18446744073709551614</text4></node>"));
|
||||
}
|
||||
|
||||
TEST_XML(dom_text_set_value_llong, "<node/>")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
CHECK(node.append_child(STR("text1")).text().set(-9223372036854775807ll));
|
||||
CHECK(node.append_child(STR("text2")).text().set(-9223372036854775807ll - 1));
|
||||
CHECK(!xml_text().set(-9223372036854775807ll - 1));
|
||||
|
||||
CHECK(node.append_child(STR("text3")).text().set(18446744073709551615ull));
|
||||
CHECK(node.append_child(STR("text4")).text().set(18446744073709551614ull));
|
||||
CHECK(!xml_text().set(18446744073709551615ull));
|
||||
|
||||
CHECK_NODE(node, STR("<node><text1>-9223372036854775807</text1><text2>-9223372036854775808</text2><text3>18446744073709551615</text3><text4>18446744073709551614</text4></node>"));
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST_XML(dom_text_middle, "<node><c1>notthisone</c1>text<c2/></node>")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
xml_text t = node.text();
|
||||
|
||||
CHECK_STRING(t.get(), STR("text"));
|
||||
t.set(STR("notext"));
|
||||
|
||||
CHECK_NODE(node, STR("<node><c1>notthisone</c1>notext<c2/></node>"));
|
||||
CHECK(node.remove_child(t.data()));
|
||||
|
||||
CHECK(!t);
|
||||
CHECK_NODE(node, STR("<node><c1>notthisone</c1><c2/></node>"));
|
||||
|
||||
t.set(STR("yestext"));
|
||||
|
||||
CHECK(t);
|
||||
CHECK_NODE(node, STR("<node><c1>notthisone</c1><c2/>yestext</node>"));
|
||||
CHECK(t.data() == node.last_child());
|
||||
}
|
||||
|
||||
TEST_XML_FLAGS(dom_text_data, "<node><a>foo</a><b><![CDATA[bar]]></b><c><?pi value?></c><d/></node>", parse_default | parse_pi)
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
CHECK(node.child(STR("a")).text().data() == node.child(STR("a")).first_child());
|
||||
CHECK(node.child(STR("b")).text().data() == node.child(STR("b")).first_child());
|
||||
CHECK(!node.child(STR("c")).text().data());
|
||||
CHECK(!node.child(STR("d")).text().data());
|
||||
CHECK(!xml_text().data());
|
||||
}
|
||||
|
||||
TEST(dom_text_defaults)
|
||||
{
|
||||
xml_text text;
|
||||
|
||||
CHECK_STRING(text.as_string(STR("foo")), STR("foo"));
|
||||
CHECK(text.as_int(42) == 42);
|
||||
CHECK(text.as_uint(42) == 42);
|
||||
CHECK(text.as_double(42) == 42);
|
||||
CHECK(text.as_float(42) == 42);
|
||||
CHECK(text.as_bool(true) == true);
|
||||
|
||||
#ifdef PUGIXML_HAS_LONG_LONG
|
||||
CHECK(text.as_llong(42) == 42);
|
||||
CHECK(text.as_ullong(42) == 42);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#define _SCL_SECURE_NO_WARNINGS
|
||||
#define _SCL_SECURE_NO_DEPRECATE
|
||||
|
||||
#include "common.hpp"
|
||||
#include "test.hpp"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
@ -15,6 +15,8 @@
|
|||
|
||||
#include "helpers.hpp"
|
||||
|
||||
using namespace pugi;
|
||||
|
||||
#ifdef PUGIXML_NO_STL
|
||||
template <typename I> static I move_iter(I base, int n)
|
||||
{
|
||||
|
@ -57,10 +59,10 @@ TEST_XML(dom_attr_next_previous_attribute, "<node attr1='1' attr2='2' />")
|
|||
|
||||
CHECK(attr1.next_attribute() == attr2);
|
||||
CHECK(attr2.next_attribute() == xml_attribute());
|
||||
|
||||
|
||||
CHECK(attr1.previous_attribute() == xml_attribute());
|
||||
CHECK(attr2.previous_attribute() == attr1);
|
||||
|
||||
|
||||
CHECK(xml_attribute().next_attribute() == xml_attribute());
|
||||
CHECK(xml_attribute().previous_attribute() == xml_attribute());
|
||||
}
|
||||
|
@ -137,6 +139,10 @@ TEST_XML(dom_attr_as_integer_space, "<node attr1=' \t1234' attr2='\t 0x123' attr
|
|||
CHECK(node.attribute(STR("attr2")).as_int() == 291);
|
||||
CHECK(node.attribute(STR("attr3")).as_int() == 0);
|
||||
CHECK(node.attribute(STR("attr4")).as_int() == 0);
|
||||
|
||||
#ifdef PUGIXML_HAS_LONG_LONG
|
||||
CHECK(node.attribute(STR("attr1")).as_llong() == 1234);
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST_XML(dom_attr_as_float, "<node attr1='0' attr2='1' attr3='0.12' attr4='-5.1' attr5='3e-4' attr6='3.14159265358979323846'/>")
|
||||
|
@ -144,12 +150,12 @@ TEST_XML(dom_attr_as_float, "<node attr1='0' attr2='1' attr3='0.12' attr4='-5.1'
|
|||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
CHECK(xml_attribute().as_float() == 0);
|
||||
CHECK_DOUBLE(node.attribute(STR("attr1")).as_float(), 0);
|
||||
CHECK_DOUBLE(node.attribute(STR("attr2")).as_float(), 1);
|
||||
CHECK_DOUBLE(node.attribute(STR("attr3")).as_float(), 0.12);
|
||||
CHECK_DOUBLE(node.attribute(STR("attr4")).as_float(), -5.1);
|
||||
CHECK_DOUBLE(node.attribute(STR("attr5")).as_float(), 3e-4);
|
||||
CHECK_DOUBLE(node.attribute(STR("attr6")).as_float(), 3.14159265358979323846);
|
||||
CHECK_DOUBLE(double(node.attribute(STR("attr1")).as_float()), 0);
|
||||
CHECK_DOUBLE(double(node.attribute(STR("attr2")).as_float()), 1);
|
||||
CHECK_DOUBLE(double(node.attribute(STR("attr3")).as_float()), 0.12);
|
||||
CHECK_DOUBLE(double(node.attribute(STR("attr4")).as_float()), -5.1);
|
||||
CHECK_DOUBLE(double(node.attribute(STR("attr5")).as_float()), 3e-4);
|
||||
CHECK_DOUBLE(double(node.attribute(STR("attr6")).as_float()), 3.14159265358979323846);
|
||||
}
|
||||
|
||||
TEST_XML(dom_attr_as_double, "<node attr1='0' attr2='1' attr3='0.12' attr4='-5.1' attr5='3e-4' attr6='3.14159265358979323846'/>")
|
||||
|
@ -333,11 +339,11 @@ TEST_XML(dom_attr_iterator_invalidate, "<node><node1 attr1='0'/><node2 attr1='0'
|
|||
|
||||
TEST_XML(dom_attr_iterator_const, "<node attr1='0' attr2='1'/>")
|
||||
{
|
||||
pugi::xml_node node = doc.child(STR("node"));
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
const pugi::xml_attribute_iterator i1 = node.attributes_begin();
|
||||
const pugi::xml_attribute_iterator i2 = ++xml_attribute_iterator(i1);
|
||||
const pugi::xml_attribute_iterator i3 = ++xml_attribute_iterator(i2);
|
||||
const xml_attribute_iterator i1 = node.attributes_begin();
|
||||
const xml_attribute_iterator i2 = ++xml_attribute_iterator(i1);
|
||||
const xml_attribute_iterator i3 = ++xml_attribute_iterator(i2);
|
||||
|
||||
CHECK(*i1 == node.attribute(STR("attr1")));
|
||||
CHECK(*i2 == node.attribute(STR("attr2")));
|
||||
|
@ -455,11 +461,11 @@ TEST_XML(dom_node_iterator_invalidate, "<node><node1><child1/></node1><node2><ch
|
|||
|
||||
TEST_XML(dom_node_iterator_const, "<node><child1/><child2/></node>")
|
||||
{
|
||||
pugi::xml_node node = doc.child(STR("node"));
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
const pugi::xml_node_iterator i1 = node.begin();
|
||||
const pugi::xml_node_iterator i2 = ++xml_node_iterator(i1);
|
||||
const pugi::xml_node_iterator i3 = ++xml_node_iterator(i2);
|
||||
const xml_node_iterator i1 = node.begin();
|
||||
const xml_node_iterator i2 = ++xml_node_iterator(i1);
|
||||
const xml_node_iterator i3 = ++xml_node_iterator(i2);
|
||||
|
||||
CHECK(*i1 == node.child(STR("child1")));
|
||||
CHECK(*i2 == node.child(STR("child2")));
|
||||
|
@ -497,7 +503,7 @@ TEST_XML_FLAGS(dom_node_type, "<?xml?><!DOCTYPE><?pi?><!--comment--><node>pcdata
|
|||
CHECK((it++)->type() == node_element);
|
||||
|
||||
xml_node_iterator cit = doc.child(STR("node")).begin();
|
||||
|
||||
|
||||
CHECK((cit++)->type() == node_pcdata);
|
||||
CHECK((cit++)->type() == node_cdata);
|
||||
}
|
||||
|
@ -516,7 +522,7 @@ TEST_XML_FLAGS(dom_node_name_value, "<?xml?><!DOCTYPE id><?pi?><!--comment--><no
|
|||
CHECK_NAME_VALUE(*it++, STR("node"), STR(""));
|
||||
|
||||
xml_node_iterator cit = doc.child(STR("node")).begin();
|
||||
|
||||
|
||||
CHECK_NAME_VALUE(*cit++, STR(""), STR("pcdata"));
|
||||
CHECK_NAME_VALUE(*cit++, STR(""), STR("cdata"));
|
||||
}
|
||||
|
@ -555,10 +561,10 @@ TEST_XML(dom_node_next_previous_sibling, "<node><child1/><child2/><child3/></nod
|
|||
|
||||
CHECK(child1.next_sibling() == child2);
|
||||
CHECK(child3.next_sibling() == xml_node());
|
||||
|
||||
|
||||
CHECK(child1.previous_sibling() == xml_node());
|
||||
CHECK(child3.previous_sibling() == child2);
|
||||
|
||||
|
||||
CHECK(child1.next_sibling(STR("child3")) == child3);
|
||||
CHECK(child1.next_sibling(STR("child")) == xml_node());
|
||||
|
||||
|
@ -665,9 +671,9 @@ struct find_predicate_const
|
|||
|
||||
struct find_predicate_prefix
|
||||
{
|
||||
const pugi::char_t* prefix;
|
||||
const char_t* prefix;
|
||||
|
||||
find_predicate_prefix(const pugi::char_t* prefix_): prefix(prefix_)
|
||||
find_predicate_prefix(const char_t* prefix_): prefix(prefix_)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -675,7 +681,7 @@ struct find_predicate_prefix
|
|||
{
|
||||
#ifdef PUGIXML_WCHAR_MODE
|
||||
// can't use wcsncmp here because of a bug in DMC
|
||||
return std::basic_string<pugi::char_t>(obj.name()).compare(0, wcslen(prefix), prefix) == 0;
|
||||
return std::basic_string<char_t>(obj.name()).compare(0, wcslen(prefix), prefix) == 0;
|
||||
#else
|
||||
return strncmp(obj.name(), prefix, strlen(prefix)) == 0;
|
||||
#endif
|
||||
|
@ -728,14 +734,17 @@ TEST_XML(dom_node_find_node, "<node><child1/><child2/></node>")
|
|||
TEST_XML(dom_node_path, "<node><child1>text<child2/></child1></node>")
|
||||
{
|
||||
CHECK(xml_node().path() == STR(""));
|
||||
|
||||
|
||||
CHECK(doc.path() == STR(""));
|
||||
CHECK(doc.child(STR("node")).path() == STR("/node"));
|
||||
CHECK(doc.child(STR("node")).child(STR("child1")).path() == STR("/node/child1"));
|
||||
CHECK(doc.child(STR("node")).child(STR("child1")).child(STR("child2")).path() == STR("/node/child1/child2"));
|
||||
CHECK(doc.child(STR("node")).child(STR("child1")).first_child().path() == STR("/node/child1/"));
|
||||
|
||||
|
||||
CHECK(doc.child(STR("node")).child(STR("child1")).path('\\') == STR("\\node\\child1"));
|
||||
|
||||
doc.append_child(node_element);
|
||||
CHECK(doc.last_child().path() == STR("/"));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -743,7 +752,7 @@ TEST_XML(dom_node_first_element_by_path, "<node><child1>text<child2/></child1></
|
|||
{
|
||||
CHECK(xml_node().first_element_by_path(STR("/")) == xml_node());
|
||||
CHECK(xml_node().first_element_by_path(STR("a")) == xml_node());
|
||||
|
||||
|
||||
CHECK(doc.first_element_by_path(STR("")) == doc);
|
||||
CHECK(doc.first_element_by_path(STR("/")) == doc);
|
||||
|
||||
|
@ -757,7 +766,7 @@ TEST_XML(dom_node_first_element_by_path, "<node><child1>text<child2/></child1></
|
|||
#endif
|
||||
|
||||
CHECK(doc.first_element_by_path(STR("/node/child2")) == xml_node());
|
||||
|
||||
|
||||
CHECK(doc.first_element_by_path(STR("\\node\\child1"), '\\') == doc.child(STR("node")).child(STR("child1")));
|
||||
|
||||
CHECK(doc.child(STR("node")).first_element_by_path(STR("..")) == doc);
|
||||
|
@ -775,7 +784,7 @@ TEST_XML(dom_node_first_element_by_path, "<node><child1>text<child2/></child1></
|
|||
|
||||
struct test_walker: xml_tree_walker
|
||||
{
|
||||
std::basic_string<pugi::char_t> log;
|
||||
std::basic_string<char_t> log;
|
||||
unsigned int call_count;
|
||||
unsigned int stop_count;
|
||||
|
||||
|
@ -783,22 +792,27 @@ struct test_walker: xml_tree_walker
|
|||
{
|
||||
}
|
||||
|
||||
std::basic_string<pugi::char_t> depthstr() const
|
||||
std::basic_string<char_t> depthstr() const
|
||||
{
|
||||
char buf[32];
|
||||
|
||||
#if __cplusplus >= 201103 || defined(__APPLE__) // Xcode 14 warns about use of sprintf in C++98 builds
|
||||
snprintf(buf, sizeof(buf), "%d", depth());
|
||||
#else
|
||||
sprintf(buf, "%d", depth());
|
||||
#endif
|
||||
|
||||
#ifdef PUGIXML_WCHAR_MODE
|
||||
wchar_t wbuf[32];
|
||||
std::copy(buf, buf + strlen(buf) + 1, &wbuf[0]);
|
||||
|
||||
return std::basic_string<pugi::char_t>(wbuf);
|
||||
return std::basic_string<char_t>(wbuf);
|
||||
#else
|
||||
return std::basic_string<pugi::char_t>(buf);
|
||||
return std::basic_string<char_t>(buf);
|
||||
#endif
|
||||
}
|
||||
|
||||
virtual bool begin(xml_node& node)
|
||||
virtual bool begin(xml_node& node) PUGIXML_OVERRIDE
|
||||
{
|
||||
log += STR("|");
|
||||
log += depthstr();
|
||||
|
@ -810,7 +824,7 @@ struct test_walker: xml_tree_walker
|
|||
return ++call_count != stop_count && xml_tree_walker::begin(node);
|
||||
}
|
||||
|
||||
virtual bool for_each(xml_node& node)
|
||||
virtual bool for_each(xml_node& node) PUGIXML_OVERRIDE
|
||||
{
|
||||
log += STR("|");
|
||||
log += depthstr();
|
||||
|
@ -822,7 +836,7 @@ struct test_walker: xml_tree_walker
|
|||
return ++call_count != stop_count && xml_tree_walker::end(node);
|
||||
}
|
||||
|
||||
virtual bool end(xml_node& node)
|
||||
virtual bool end(xml_node& node) PUGIXML_OVERRIDE
|
||||
{
|
||||
log += STR("|");
|
||||
log += depthstr();
|
||||
|
@ -919,7 +933,7 @@ TEST_XML_FLAGS(dom_offset_debug, "<?xml?><!DOCTYPE><?pi?><!--comment--><node>pcd
|
|||
CHECK((it++)->offset_debug() == 38);
|
||||
|
||||
xml_node_iterator cit = doc.child(STR("node")).begin();
|
||||
|
||||
|
||||
CHECK((cit++)->offset_debug() == 43);
|
||||
CHECK((cit++)->offset_debug() == 58);
|
||||
}
|
||||
|
@ -966,7 +980,7 @@ TEST_XML(dom_internal_object, "<node attr='value'>value</node>")
|
|||
xml_node node = doc.child(STR("node"));
|
||||
xml_attribute attr = node.first_attribute();
|
||||
xml_node value = node.first_child();
|
||||
|
||||
|
||||
CHECK(xml_node().internal_object() == 0);
|
||||
CHECK(xml_attribute().internal_object() == 0);
|
||||
|
||||
|
@ -988,7 +1002,7 @@ TEST_XML(dom_hash_value, "<node attr='value'>value</node>")
|
|||
xml_node node = doc.child(STR("node"));
|
||||
xml_attribute attr = node.first_attribute();
|
||||
xml_node value = node.first_child();
|
||||
|
||||
|
||||
CHECK(xml_node().hash_value() == 0);
|
||||
CHECK(xml_attribute().hash_value() == 0);
|
||||
|
||||
|
@ -1085,14 +1099,206 @@ TEST_XML(dom_unspecified_bool_coverage, "<node attr='value'>text</node>")
|
|||
{
|
||||
xml_node node = doc.first_child();
|
||||
|
||||
CHECK(node);
|
||||
static_cast<void (*)(xml_node***)>(node)(0);
|
||||
|
||||
CHECK(node.first_attribute());
|
||||
static_cast<void (*)(xml_attribute***)>(node.first_attribute())(0);
|
||||
|
||||
CHECK(node.text());
|
||||
static_cast<void (*)(xml_text***)>(node.text())(0);
|
||||
|
||||
#ifndef PUGIXML_NO_XPATH
|
||||
xpath_query q(STR("/node"));
|
||||
|
||||
CHECK(q);
|
||||
static_cast<void (*)(xpath_query***)>(q)(0);
|
||||
static_cast<void (*)(xpath_node***)>(q.evaluate_node(doc))(0);
|
||||
|
||||
xpath_node qn = q.evaluate_node(doc);
|
||||
|
||||
CHECK(qn);
|
||||
static_cast<void (*)(xpath_node***)>(qn)(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if __cplusplus >= 201103
|
||||
TEST_XML(dom_ranged_for, "<node attr1='1' attr2='2'><test>3</test><fake>5</fake><test>4</test></node>")
|
||||
{
|
||||
int index = 1;
|
||||
|
||||
for (xml_node n: doc.children())
|
||||
{
|
||||
for (xml_attribute a: n.attributes())
|
||||
{
|
||||
CHECK(a.as_int() == index);
|
||||
index++;
|
||||
}
|
||||
|
||||
for (xml_node c: n.children(STR("test")))
|
||||
{
|
||||
CHECK(c.text().as_int() == index);
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
CHECK(index == 5);
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST_XML(dom_node_attribute_hinted, "<node attr1='1' attr2='2' attr3='3' />")
|
||||
{
|
||||
xml_node node = doc.first_child();
|
||||
xml_attribute attr1 = node.attribute(STR("attr1"));
|
||||
xml_attribute attr2 = node.attribute(STR("attr2"));
|
||||
xml_attribute attr3 = node.attribute(STR("attr3"));
|
||||
|
||||
xml_attribute hint;
|
||||
CHECK(!xml_node().attribute(STR("test"), hint) && !hint);
|
||||
|
||||
CHECK(node.attribute(STR("attr2"), hint) == attr2 && hint == attr3);
|
||||
CHECK(node.attribute(STR("attr3"), hint) == attr3 && !hint);
|
||||
|
||||
CHECK(node.attribute(STR("attr1"), hint) == attr1 && hint == attr2);
|
||||
CHECK(node.attribute(STR("attr2"), hint) == attr2 && hint == attr3);
|
||||
CHECK(node.attribute(STR("attr1"), hint) == attr1 && hint == attr2);
|
||||
CHECK(node.attribute(STR("attr1"), hint) == attr1 && hint == attr2);
|
||||
|
||||
CHECK(!node.attribute(STR("attr"), hint) && hint == attr2);
|
||||
}
|
||||
|
||||
TEST_XML(dom_as_int_overflow, "<node attr1='-2147483649' attr2='2147483648' attr3='-4294967296' />")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
CHECK(node.attribute(STR("attr1")).as_int() == -2147483647 - 1);
|
||||
CHECK(node.attribute(STR("attr2")).as_int() == 2147483647);
|
||||
CHECK(node.attribute(STR("attr3")).as_int() == -2147483647 - 1);
|
||||
}
|
||||
|
||||
TEST_XML(dom_as_uint_overflow, "<node attr1='-1' attr2='4294967296' attr3='5294967295' attr4='21474836479' />")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
CHECK(node.attribute(STR("attr1")).as_uint() == 0);
|
||||
CHECK(node.attribute(STR("attr2")).as_uint() == 4294967295u);
|
||||
CHECK(node.attribute(STR("attr3")).as_uint() == 4294967295u);
|
||||
CHECK(node.attribute(STR("attr4")).as_uint() == 4294967295u);
|
||||
}
|
||||
|
||||
TEST_XML(dom_as_int_hex_overflow, "<node attr1='-0x80000001' attr2='0x80000000' />")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
CHECK(node.attribute(STR("attr1")).as_int() == -2147483647 - 1);
|
||||
CHECK(node.attribute(STR("attr2")).as_int() == 2147483647);
|
||||
}
|
||||
|
||||
TEST_XML(dom_as_uint_hex_overflow, "<node attr1='-0x1' attr2='0x100000000' attr3='0x123456789' />")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
CHECK(node.attribute(STR("attr1")).as_uint() == 0);
|
||||
CHECK(node.attribute(STR("attr2")).as_uint() == 4294967295u);
|
||||
CHECK(node.attribute(STR("attr3")).as_uint() == 4294967295u);
|
||||
}
|
||||
|
||||
TEST_XML(dom_as_int_many_digits, "<node attr1='0000000000000000000000000000000000000000000000001' />")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
CHECK(node.attribute(STR("attr1")).as_int() == 1);
|
||||
CHECK(node.attribute(STR("attr1")).as_uint() == 1);
|
||||
}
|
||||
|
||||
TEST_XML(dom_as_int_hex_many_digits, "<node attr1='0x0000000000000000000000000000000000000000000000001' />")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
CHECK(node.attribute(STR("attr1")).as_int() == 1);
|
||||
CHECK(node.attribute(STR("attr1")).as_uint() == 1);
|
||||
}
|
||||
|
||||
#ifdef PUGIXML_HAS_LONG_LONG
|
||||
TEST_XML(dom_as_llong_overflow, "<node attr1='-9223372036854775809' attr2='9223372036854775808' attr3='-18446744073709551616' />")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
CHECK(node.attribute(STR("attr1")).as_llong() == -9223372036854775807ll - 1);
|
||||
CHECK(node.attribute(STR("attr2")).as_llong() == 9223372036854775807ll);
|
||||
CHECK(node.attribute(STR("attr3")).as_llong() == -9223372036854775807ll - 1);
|
||||
}
|
||||
|
||||
TEST_XML(dom_as_ullong_overflow, "<node attr1='-1' attr2='18446744073709551616' attr3='28446744073709551615' attr4='166020696663385964543' />")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
CHECK(node.attribute(STR("attr1")).as_ullong() == 0);
|
||||
CHECK(node.attribute(STR("attr2")).as_ullong() == 18446744073709551615ull);
|
||||
CHECK(node.attribute(STR("attr3")).as_ullong() == 18446744073709551615ull);
|
||||
CHECK(node.attribute(STR("attr4")).as_ullong() == 18446744073709551615ull);
|
||||
}
|
||||
|
||||
TEST_XML(dom_as_llong_hex_overflow, "<node attr1='-0x8000000000000001' attr2='0x8000000000000000' />")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
CHECK(node.attribute(STR("attr1")).as_llong() == -9223372036854775807ll - 1);
|
||||
CHECK(node.attribute(STR("attr2")).as_llong() == 9223372036854775807ll);
|
||||
}
|
||||
|
||||
TEST_XML(dom_as_ullong_hex_overflow, "<node attr1='-0x1' attr2='0x10000000000000000' attr3='0x12345678923456789' />")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
CHECK(node.attribute(STR("attr1")).as_ullong() == 0);
|
||||
CHECK(node.attribute(STR("attr2")).as_ullong() == 18446744073709551615ull);
|
||||
CHECK(node.attribute(STR("attr3")).as_ullong() == 18446744073709551615ull);
|
||||
}
|
||||
|
||||
TEST_XML(dom_as_llong_many_digits, "<node attr1='0000000000000000000000000000000000000000000000001' />")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
CHECK(node.attribute(STR("attr1")).as_llong() == 1);
|
||||
CHECK(node.attribute(STR("attr1")).as_ullong() == 1);
|
||||
}
|
||||
|
||||
TEST_XML(dom_as_llong_hex_many_digits, "<node attr1='0x0000000000000000000000000000000000000000000000001' />")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
CHECK(node.attribute(STR("attr1")).as_llong() == 1);
|
||||
CHECK(node.attribute(STR("attr1")).as_ullong() == 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST_XML(dom_as_int_plus, "<node attr1='+1' attr2='+0xa' />")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
CHECK(node.attribute(STR("attr1")).as_int() == 1);
|
||||
CHECK(node.attribute(STR("attr1")).as_uint() == 1);
|
||||
CHECK(node.attribute(STR("attr2")).as_int() == 10);
|
||||
CHECK(node.attribute(STR("attr2")).as_uint() == 10);
|
||||
|
||||
#ifdef PUGIXML_HAS_LONG_LONG
|
||||
CHECK(node.attribute(STR("attr1")).as_llong() == 1);
|
||||
CHECK(node.attribute(STR("attr1")).as_ullong() == 1);
|
||||
CHECK(node.attribute(STR("attr2")).as_llong() == 10);
|
||||
CHECK(node.attribute(STR("attr2")).as_ullong() == 10);
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST(dom_node_anonymous)
|
||||
{
|
||||
xml_document doc;
|
||||
doc.append_child(node_element);
|
||||
doc.append_child(node_element);
|
||||
doc.append_child(node_pcdata);
|
||||
|
||||
CHECK(doc.child(STR("node")) == xml_node());
|
||||
CHECK(doc.first_child().next_sibling(STR("node")) == xml_node());
|
||||
CHECK(doc.last_child().previous_sibling(STR("node")) == xml_node());
|
||||
CHECK_STRING(doc.child_value(), STR(""));
|
||||
CHECK_STRING(doc.last_child().child_value(), STR(""));
|
||||
}
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
#define PUGIXML_HEADER_ONLY
|
||||
#define pugi pugih
|
||||
|
||||
#include "common.hpp"
|
||||
#include "test.hpp"
|
||||
|
||||
// Check header guards
|
||||
#include "../src/pugixml.hpp"
|
||||
#include "../src/pugixml.hpp"
|
||||
|
||||
TEST(header_only)
|
||||
using namespace pugi;
|
||||
|
||||
TEST(header_only_1)
|
||||
{
|
||||
xml_document doc;
|
||||
CHECK(doc.load_string(STR("<node/>")));
|
21
tests/test_header_only_2.cpp
Normal file
21
tests/test_header_only_2.cpp
Normal file
|
@ -0,0 +1,21 @@
|
|||
#define PUGIXML_HEADER_ONLY
|
||||
#define pugi pugih
|
||||
|
||||
#include "test.hpp"
|
||||
|
||||
// Check header guards
|
||||
#include "../src/pugixml.hpp"
|
||||
#include "../src/pugixml.hpp"
|
||||
|
||||
using namespace pugi;
|
||||
|
||||
TEST(header_only_2)
|
||||
{
|
||||
xml_document doc;
|
||||
CHECK(doc.load_string(STR("<node/>")));
|
||||
CHECK_STRING(doc.first_child().name(), STR("node"));
|
||||
|
||||
#ifndef PUGIXML_NO_XPATH
|
||||
CHECK(doc.first_child() == doc.select_node(STR("//*")).node());
|
||||
#endif
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
// Tests compatibility with string/iostream
|
||||
#include <string>
|
||||
#include "../src/pugixml.hpp"
|
||||
#include <istream>
|
||||
#include <ostream>
|
||||
// Tests compatibility with string/iostream
|
||||
#include <string>
|
||||
#include "../src/pugixml.hpp"
|
||||
#include <istream>
|
||||
#include <ostream>
|
||||
|
|
|
@ -1,30 +1,40 @@
|
|||
#include "common.hpp"
|
||||
#include "test.hpp"
|
||||
|
||||
#include "writer_string.hpp"
|
||||
#include "allocator.hpp"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
using namespace pugi;
|
||||
|
||||
namespace
|
||||
{
|
||||
int allocate_count = 0;
|
||||
int deallocate_count = 0;
|
||||
int page_allocs = 0;
|
||||
int page_deallocs = 0;
|
||||
|
||||
bool is_page(size_t size)
|
||||
{
|
||||
return size >= 16384;
|
||||
}
|
||||
|
||||
void* allocate(size_t size)
|
||||
{
|
||||
++allocate_count;
|
||||
return new char[size];
|
||||
void* ptr = memory_allocate(size);
|
||||
page_allocs += is_page(memory_size(ptr));
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void deallocate(void* ptr)
|
||||
{
|
||||
++deallocate_count;
|
||||
delete[] reinterpret_cast<char*>(ptr);
|
||||
page_deallocs += is_page(memory_size(ptr));
|
||||
memory_deallocate(ptr);
|
||||
}
|
||||
}
|
||||
|
||||
TEST(memory_custom_memory_management)
|
||||
{
|
||||
allocate_count = deallocate_count = 0;
|
||||
page_allocs = page_deallocs = 0;
|
||||
|
||||
// remember old functions
|
||||
allocation_function old_allocate = get_memory_allocation_function();
|
||||
|
@ -37,30 +47,30 @@ TEST(memory_custom_memory_management)
|
|||
// parse document
|
||||
xml_document doc;
|
||||
|
||||
CHECK(allocate_count == 0 && deallocate_count == 0);
|
||||
CHECK(page_allocs == 0 && page_deallocs == 0);
|
||||
|
||||
CHECK(doc.load_string(STR("<node />")));
|
||||
|
||||
CHECK(allocate_count == 2 && deallocate_count == 0);
|
||||
|
||||
CHECK(page_allocs == 1 && page_deallocs == 0);
|
||||
|
||||
// modify document (no new page)
|
||||
CHECK(doc.first_child().set_name(STR("foobars")));
|
||||
CHECK(allocate_count == 2 && deallocate_count == 0);
|
||||
CHECK(page_allocs == 1 && page_deallocs == 0);
|
||||
|
||||
// modify document (new page)
|
||||
std::basic_string<pugi::char_t> s(65536, 'x');
|
||||
std::basic_string<char_t> s(65536, 'x');
|
||||
|
||||
CHECK(doc.first_child().set_name(s.c_str()));
|
||||
CHECK(allocate_count == 3 && deallocate_count == 0);
|
||||
CHECK(page_allocs == 2 && page_deallocs == 0);
|
||||
|
||||
// modify document (new page, old one should die)
|
||||
s += s;
|
||||
|
||||
CHECK(doc.first_child().set_name(s.c_str()));
|
||||
CHECK(allocate_count == 4 && deallocate_count == 1);
|
||||
CHECK(page_allocs == 3 && page_deallocs == 1);
|
||||
}
|
||||
|
||||
CHECK(allocate_count == 4 && deallocate_count == 4);
|
||||
CHECK(page_allocs == 3 && page_deallocs == 3);
|
||||
|
||||
// restore old functions
|
||||
set_memory_management_functions(old_allocate, old_deallocate);
|
||||
|
@ -68,7 +78,7 @@ TEST(memory_custom_memory_management)
|
|||
|
||||
TEST(memory_large_allocations)
|
||||
{
|
||||
allocate_count = deallocate_count = 0;
|
||||
page_allocs = page_deallocs = 0;
|
||||
|
||||
// remember old functions
|
||||
allocation_function old_allocate = get_memory_allocation_function();
|
||||
|
@ -80,27 +90,27 @@ TEST(memory_large_allocations)
|
|||
{
|
||||
xml_document doc;
|
||||
|
||||
CHECK(allocate_count == 0 && deallocate_count == 0);
|
||||
CHECK(page_allocs == 0 && page_deallocs == 0);
|
||||
|
||||
// initial fill
|
||||
for (size_t i = 0; i < 128; ++i)
|
||||
{
|
||||
std::basic_string<pugi::char_t> s(i * 128, 'x');
|
||||
std::basic_string<char_t> s(i * 128, 'x');
|
||||
|
||||
CHECK(doc.append_child(node_pcdata).set_value(s.c_str()));
|
||||
}
|
||||
|
||||
CHECK(allocate_count > 0 && deallocate_count == 0);
|
||||
CHECK(page_allocs > 0 && page_deallocs == 0);
|
||||
|
||||
// grow-prune loop
|
||||
while (doc.first_child())
|
||||
{
|
||||
pugi::xml_node node;
|
||||
xml_node node;
|
||||
|
||||
// grow
|
||||
for (node = doc.first_child(); node; node = node.next_sibling())
|
||||
{
|
||||
std::basic_string<pugi::char_t> s = node.value();
|
||||
std::basic_string<char_t> s = node.value();
|
||||
|
||||
CHECK(node.set_value((s + s).c_str()));
|
||||
}
|
||||
|
@ -108,7 +118,7 @@ TEST(memory_large_allocations)
|
|||
// prune
|
||||
for (node = doc.first_child(); node; )
|
||||
{
|
||||
pugi::xml_node next = node.next_sibling().next_sibling();
|
||||
xml_node next = node.next_sibling().next_sibling();
|
||||
|
||||
node.parent().remove_child(node);
|
||||
|
||||
|
@ -116,15 +126,72 @@ TEST(memory_large_allocations)
|
|||
}
|
||||
}
|
||||
|
||||
CHECK(allocate_count == deallocate_count + 1); // only one live page left (it waits for new allocations)
|
||||
CHECK(page_allocs == page_deallocs + 1); // only one live page left (it waits for new allocations)
|
||||
|
||||
char buffer;
|
||||
CHECK(doc.load_buffer_inplace(&buffer, 0, parse_fragment, get_native_encoding()));
|
||||
|
||||
CHECK(allocate_count == deallocate_count); // no live pages left
|
||||
CHECK(page_allocs == page_deallocs); // no live pages left
|
||||
}
|
||||
|
||||
CHECK(allocate_count == deallocate_count); // everything is freed
|
||||
CHECK(page_allocs == page_deallocs); // everything is freed
|
||||
|
||||
// restore old functions
|
||||
set_memory_management_functions(old_allocate, old_deallocate);
|
||||
}
|
||||
|
||||
TEST(memory_page_management)
|
||||
{
|
||||
page_allocs = page_deallocs = 0;
|
||||
|
||||
// remember old functions
|
||||
allocation_function old_allocate = get_memory_allocation_function();
|
||||
deallocation_function old_deallocate = get_memory_deallocation_function();
|
||||
|
||||
// replace functions
|
||||
set_memory_management_functions(allocate, deallocate);
|
||||
|
||||
{
|
||||
xml_document doc;
|
||||
|
||||
CHECK(page_allocs == 0 && page_deallocs == 0);
|
||||
|
||||
// initial fill
|
||||
std::vector<xml_node> nodes;
|
||||
|
||||
for (size_t i = 0; i < 4000; ++i)
|
||||
{
|
||||
xml_node node = doc.append_child(STR("n"));
|
||||
CHECK(node);
|
||||
|
||||
nodes.push_back(node);
|
||||
}
|
||||
|
||||
CHECK(page_allocs > 0 && page_deallocs == 0);
|
||||
|
||||
// grow-prune loop
|
||||
size_t offset = 0;
|
||||
size_t prime = 15485863;
|
||||
|
||||
while (nodes.size() > 0)
|
||||
{
|
||||
offset = (offset + prime) % nodes.size();
|
||||
|
||||
doc.remove_child(nodes[offset]);
|
||||
|
||||
nodes[offset] = nodes.back();
|
||||
nodes.pop_back();
|
||||
}
|
||||
|
||||
CHECK(page_allocs == page_deallocs + 1); // only one live page left (it waits for new allocations)
|
||||
|
||||
char buffer;
|
||||
CHECK(doc.load_buffer_inplace(&buffer, 0, parse_fragment, get_native_encoding()));
|
||||
|
||||
CHECK(page_allocs == page_deallocs); // no live pages left
|
||||
}
|
||||
|
||||
CHECK(page_allocs == page_deallocs); // everything is freed
|
||||
|
||||
// restore old functions
|
||||
set_memory_management_functions(old_allocate, old_deallocate);
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
#include "common.hpp"
|
||||
#include "test.hpp"
|
||||
|
||||
#include "writer_string.hpp"
|
||||
|
||||
using namespace pugi;
|
||||
|
||||
TEST(parse_pi_skip)
|
||||
{
|
||||
xml_document doc;
|
||||
|
@ -82,12 +84,22 @@ TEST(parse_pi_error)
|
|||
CHECK(doc.load_string(STR("<?name&"), flags).status == status_bad_pi);
|
||||
CHECK(doc.load_string(STR("<?name&?"), flags).status == status_bad_pi);
|
||||
}
|
||||
|
||||
|
||||
CHECK(doc.load_string(STR("<?xx#?>"), parse_fragment | parse_pi).status == status_bad_pi);
|
||||
CHECK(doc.load_string(STR("<?name&?>"), parse_fragment | parse_pi).status == status_bad_pi);
|
||||
CHECK(doc.load_string(STR("<?name& x?>"), parse_fragment | parse_pi).status == status_bad_pi);
|
||||
}
|
||||
|
||||
TEST(parse_pi_error_buffer_boundary)
|
||||
{
|
||||
char buf1[] = "<?name?>";
|
||||
char buf2[] = "<?name?x";
|
||||
|
||||
xml_document doc;
|
||||
CHECK(doc.load_buffer_inplace(buf1, 8, parse_fragment | parse_pi));
|
||||
CHECK(doc.load_buffer_inplace(buf2, 8, parse_fragment | parse_pi).status == status_bad_pi);
|
||||
}
|
||||
|
||||
TEST(parse_comments_skip)
|
||||
{
|
||||
xml_document doc;
|
||||
|
@ -235,9 +247,9 @@ TEST(parse_ws_pcdata_skip)
|
|||
CHECK(!doc.first_child());
|
||||
|
||||
CHECK(doc.load_string(STR("<root> <node> </node> </root>"), parse_minimal));
|
||||
|
||||
|
||||
xml_node root = doc.child(STR("root"));
|
||||
|
||||
|
||||
CHECK(root.first_child() == root.last_child());
|
||||
CHECK(!root.first_child().first_child());
|
||||
}
|
||||
|
@ -280,46 +292,46 @@ TEST(parse_ws_pcdata_permutations)
|
|||
struct test_data_t
|
||||
{
|
||||
unsigned int mask; // 1 = default flags, 2 = parse_ws_pcdata, 4 = parse_ws_pcdata_single
|
||||
const pugi::char_t* source;
|
||||
const pugi::char_t* result;
|
||||
const char_t* source;
|
||||
const char_t* result;
|
||||
int nodes; // negative if parsing should fail
|
||||
};
|
||||
|
||||
test_data_t test_data[] =
|
||||
{
|
||||
// external pcdata should be discarded (whitespace or not)
|
||||
{7, STR("ext1<node/>"), STR("<node />"), 2},
|
||||
{7, STR("ext1<node/>ext2"), STR("<node />"), 2},
|
||||
{7, STR(" <node/>"), STR("<node />"), 2},
|
||||
{7, STR("<node/> "), STR("<node />"), 2},
|
||||
{7, STR(" <node/> "), STR("<node />"), 2},
|
||||
{7, STR("ext1<node/>"), STR("<node/>"), 2},
|
||||
{7, STR("ext1<node/>ext2"), STR("<node/>"), 2},
|
||||
{7, STR(" <node/>"), STR("<node/>"), 2},
|
||||
{7, STR("<node/> "), STR("<node/>"), 2},
|
||||
{7, STR(" <node/> "), STR("<node/>"), 2},
|
||||
// inner pcdata should be preserved
|
||||
{7, STR("<node>inner</node>"), STR("<node>inner</node>"), 3},
|
||||
{7, STR("<node>inner1<child/>inner2</node>"), STR("<node>inner1<child />inner2</node>"), 5},
|
||||
{7, STR("<node>inner1<child/>inner2</node>"), STR("<node>inner1<child/>inner2</node>"), 5},
|
||||
{7, STR("<node>inner1<child>deep</child>inner2</node>"), STR("<node>inner1<child>deep</child>inner2</node>"), 6},
|
||||
// empty pcdata nodes should never be created
|
||||
{7, STR("<node>inner1<child></child>inner2</node>"), STR("<node>inner1<child />inner2</node>"), 5},
|
||||
{7, STR("<node><child></child>inner2</node>"), STR("<node><child />inner2</node>"), 4},
|
||||
{7, STR("<node>inner1<child></child></node>"), STR("<node>inner1<child /></node>"), 4},
|
||||
{7, STR("<node><child></child></node>"), STR("<node><child /></node>"), 3},
|
||||
{7, STR("<node>inner1<child></child>inner2</node>"), STR("<node>inner1<child/>inner2</node>"), 5},
|
||||
{7, STR("<node><child></child>inner2</node>"), STR("<node><child/>inner2</node>"), 4},
|
||||
{7, STR("<node>inner1<child></child></node>"), STR("<node>inner1<child/></node>"), 4},
|
||||
{7, STR("<node><child></child></node>"), STR("<node><child/></node>"), 3},
|
||||
// comments, pi or other nodes should not cause pcdata creation either
|
||||
{7, STR("<node><!----><child><?pi?></child><![CDATA[x]]></node>"), STR("<node><child /><![CDATA[x]]></node>"), 4},
|
||||
{7, STR("<node><!----><child><?pi?></child><![CDATA[x]]></node>"), STR("<node><child/><![CDATA[x]]></node>"), 4},
|
||||
// leading/trailing pcdata whitespace should be preserved (note: this will change if parse_ws_pcdata_trim is introduced)
|
||||
{7, STR("<node>\t \tinner1<child> deep </child>\t\ninner2\n\t</node>"), STR("<node>\t \tinner1<child> deep </child>\t\ninner2\n\t</node>"), 6},
|
||||
// whitespace-only pcdata preservation depends on the parsing mode
|
||||
{1, STR("<node>\n\t<child> </child>\n\t<child> <deep> </deep> </child>\n\t<!---->\n\t</node>"), STR("<node><child /><child><deep /></child></node>"), 5},
|
||||
{1, STR("<node>\n\t<child> </child>\n\t<child> <deep> </deep> </child>\n\t<!---->\n\t</node>"), STR("<node><child/><child><deep/></child></node>"), 5},
|
||||
{2, STR("<node>\n\t<child> </child>\n\t<child> <deep> </deep> </child>\n\t<!---->\n\t</node>"), STR("<node>\n\t<child> </child>\n\t<child> <deep> </deep> </child>\n\t\n\t</node>"), 13},
|
||||
{4, STR("<node>\n\t<child> </child>\n\t<child> <deep> </deep> </child>\n\t<!---->\n\t</node>"), STR("<node><child> </child><child><deep> </deep></child></node>"), 7},
|
||||
// current implementation of parse_ws_pcdata_single has an unfortunate bug; reproduce it here
|
||||
{4, STR("<node>\t\t<!---->\n\n</node>"), STR("<node>\n\n</node>"), 3},
|
||||
// error case: terminate PCDATA in the middle
|
||||
{7, STR("<node>abcdef"), STR("<node>abcdef</node>"), -3},
|
||||
{5, STR("<node> "), STR("<node />"), -2},
|
||||
{5, STR("<node> "), STR("<node/>"), -2},
|
||||
{2, STR("<node> "), STR("<node> </node>"), -3},
|
||||
// error case: terminate PCDATA as early as possible
|
||||
{7, STR("<node>"), STR("<node />"), -2},
|
||||
{7, STR("<node>"), STR("<node/>"), -2},
|
||||
{7, STR("<node>a"), STR("<node>a</node>"), -3},
|
||||
{5, STR("<node> "), STR("<node />"), -2},
|
||||
{5, STR("<node> "), STR("<node/>"), -2},
|
||||
{2, STR("<node> "), STR("<node> </node>"), -3},
|
||||
};
|
||||
|
||||
|
@ -349,8 +361,8 @@ TEST(parse_ws_pcdata_fragment_permutations)
|
|||
struct test_data_t
|
||||
{
|
||||
unsigned int mask; // 1 = default flags, 2 = parse_ws_pcdata, 4 = parse_ws_pcdata_single
|
||||
const pugi::char_t* source;
|
||||
const pugi::char_t* result;
|
||||
const char_t* source;
|
||||
const char_t* result;
|
||||
int nodes; // negative if parsing should fail
|
||||
};
|
||||
|
||||
|
@ -360,18 +372,18 @@ TEST(parse_ws_pcdata_fragment_permutations)
|
|||
{7, STR("ext1"), STR("ext1"), 2},
|
||||
{5, STR(" "), STR(""), 1},
|
||||
{2, STR(" "), STR(" "), 2},
|
||||
{7, STR("ext1<node/>"), STR("ext1<node />"), 3},
|
||||
{7, STR("<node/>ext2"), STR("<node />ext2"), 3},
|
||||
{7, STR("ext1<node/>ext2"), STR("ext1<node />ext2"), 4},
|
||||
{7, STR("ext1<node1/>ext2<node2/>ext3"), STR("ext1<node1 />ext2<node2 />ext3"), 6},
|
||||
{5, STR(" <node/>"), STR("<node />"), 2},
|
||||
{2, STR(" <node/>"), STR(" <node />"), 3},
|
||||
{5, STR("<node/> "), STR("<node />"), 2},
|
||||
{2, STR("<node/> "), STR("<node /> "), 3},
|
||||
{5, STR(" <node/> "), STR("<node />"), 2},
|
||||
{2, STR(" <node/> "), STR(" <node /> "), 4},
|
||||
{5, STR(" <node1/> <node2/> "), STR("<node1 /><node2 />"), 3},
|
||||
{2, STR(" <node1/> <node2/> "), STR(" <node1 /> <node2 /> "), 6},
|
||||
{7, STR("ext1<node/>"), STR("ext1<node/>"), 3},
|
||||
{7, STR("<node/>ext2"), STR("<node/>ext2"), 3},
|
||||
{7, STR("ext1<node/>ext2"), STR("ext1<node/>ext2"), 4},
|
||||
{7, STR("ext1<node1/>ext2<node2/>ext3"), STR("ext1<node1/>ext2<node2/>ext3"), 6},
|
||||
{5, STR(" <node/>"), STR("<node/>"), 2},
|
||||
{2, STR(" <node/>"), STR(" <node/>"), 3},
|
||||
{5, STR("<node/> "), STR("<node/>"), 2},
|
||||
{2, STR("<node/> "), STR("<node/> "), 3},
|
||||
{5, STR(" <node/> "), STR("<node/>"), 2},
|
||||
{2, STR(" <node/> "), STR(" <node/> "), 4},
|
||||
{5, STR(" <node1/> <node2/> "), STR("<node1/><node2/>"), 3},
|
||||
{2, STR(" <node1/> <node2/> "), STR(" <node1/> <node2/> "), 6},
|
||||
};
|
||||
|
||||
for (size_t i = 0; i < sizeof(test_data) / sizeof(test_data[0]); ++i)
|
||||
|
@ -429,8 +441,8 @@ TEST(parse_pcdata_trim)
|
|||
{
|
||||
struct test_data_t
|
||||
{
|
||||
const pugi::char_t* source;
|
||||
const pugi::char_t* result;
|
||||
const char_t* source;
|
||||
const char_t* result;
|
||||
unsigned int flags;
|
||||
};
|
||||
|
||||
|
@ -462,7 +474,7 @@ TEST(parse_pcdata_trim)
|
|||
xml_document doc;
|
||||
CHECK(doc.load_string(td.source, td.flags | parse_trim_pcdata));
|
||||
|
||||
const pugi::char_t* value = doc.child(STR("node")) ? doc.child_value(STR("node")) : doc.text().get();
|
||||
const char_t* value = doc.child(STR("node")) ? doc.child_value(STR("node")) : doc.text().get();
|
||||
CHECK_STRING(value, td.result);
|
||||
}
|
||||
}
|
||||
|
@ -551,7 +563,7 @@ TEST(parse_escapes_unicode)
|
|||
CHECK(doc.load_string(STR("<node>γγ𤭢</node>"), parse_minimal | parse_escapes));
|
||||
|
||||
#ifdef PUGIXML_WCHAR_MODE
|
||||
const pugi::char_t* v = doc.child_value(STR("node"));
|
||||
const char_t* v = doc.child_value(STR("node"));
|
||||
|
||||
size_t wcharsize = sizeof(wchar_t);
|
||||
|
||||
|
@ -746,18 +758,48 @@ TEST(parse_attribute_quot_inside)
|
|||
}
|
||||
}
|
||||
|
||||
TEST(parse_attribute_wnorm_coverage)
|
||||
{
|
||||
xml_document doc;
|
||||
CHECK(doc.load_string(STR("<n a1='v' a2=' ' a3='x y' a4='x y' a5='x y' />"), parse_wnorm_attribute));
|
||||
CHECK_NODE(doc, STR("<n a1=\"v\" a2=\"\" a3=\"x y\" a4=\"x y\" a5=\"x y\"/>"));
|
||||
|
||||
CHECK(doc.load_string(STR("<n a1='v' a2=' ' a3='x y' a4='x y' a5='x y' />"), parse_wnorm_attribute | parse_escapes));
|
||||
CHECK_NODE(doc, STR("<n a1=\"v\" a2=\"\" a3=\"x y\" a4=\"x y\" a5=\"x y\"/>"));
|
||||
}
|
||||
|
||||
TEST(parse_attribute_wconv_coverage)
|
||||
{
|
||||
xml_document doc;
|
||||
CHECK(doc.load_string(STR("<n a1='v' a2='\r' a3='\r\n\n' a4='\n' />"), parse_wconv_attribute));
|
||||
CHECK_NODE(doc, STR("<n a1=\"v\" a2=\" \" a3=\" \" a4=\" \"/>"));
|
||||
|
||||
CHECK(doc.load_string(STR("<n a1='v' a2='\r' a3='\r\n\n' a4='\n' />"), parse_wconv_attribute | parse_escapes));
|
||||
CHECK_NODE(doc, STR("<n a1=\"v\" a2=\" \" a3=\" \" a4=\" \"/>"));
|
||||
}
|
||||
|
||||
TEST(parse_attribute_eol_coverage)
|
||||
{
|
||||
xml_document doc;
|
||||
CHECK(doc.load_string(STR("<n a1='v' a2='\r' a3='\r\n\n' a4='\n' />"), parse_eol));
|
||||
CHECK_NODE(doc, STR("<n a1=\"v\" a2=\" \" a3=\" \" a4=\" \"/>"));
|
||||
|
||||
CHECK(doc.load_string(STR("<n a1='v' a2='\r' a3='\r\n\n' a4='\n' />"), parse_eol | parse_escapes));
|
||||
CHECK_NODE(doc, STR("<n a1=\"v\" a2=\" \" a3=\" \" a4=\" \"/>"));
|
||||
}
|
||||
|
||||
TEST(parse_tag_single)
|
||||
{
|
||||
xml_document doc;
|
||||
CHECK(doc.load_string(STR("<node/><node /><node\n/>"), parse_minimal));
|
||||
CHECK_NODE(doc, STR("<node /><node /><node />"));
|
||||
CHECK_NODE(doc, STR("<node/><node/><node/>"));
|
||||
}
|
||||
|
||||
TEST(parse_tag_hierarchy)
|
||||
{
|
||||
xml_document doc;
|
||||
CHECK(doc.load_string(STR("<node><n1><n2/></n1><n3><n4><n5></n5></n4></n3 \r\n></node>"), parse_minimal));
|
||||
CHECK_NODE(doc, STR("<node><n1><n2 /></n1><n3><n4><n5 /></n4></n3></node>"));
|
||||
CHECK_NODE(doc, STR("<node><n1><n2/></n1><n3><n4><n5/></n4></n3></node>"));
|
||||
}
|
||||
|
||||
TEST(parse_tag_error)
|
||||
|
@ -855,7 +897,7 @@ TEST(parse_declaration_error)
|
|||
CHECK(doc.load_string(STR("<?xml>"), flags).status == status_bad_pi);
|
||||
CHECK(doc.load_string(STR("<?xml version='1>"), flags).status == status_bad_pi);
|
||||
}
|
||||
|
||||
|
||||
CHECK(doc.load_string(STR("<?xml version='1?>"), parse_fragment | parse_declaration).status == status_bad_attribute);
|
||||
CHECK(doc.load_string(STR("<foo><?xml version='1'?></foo>"), parse_fragment | parse_declaration).status == status_bad_pi);
|
||||
}
|
||||
|
@ -873,7 +915,7 @@ TEST(parse_out_of_memory)
|
|||
test_runner::_memory_fail_threshold = 256;
|
||||
|
||||
xml_document doc;
|
||||
CHECK(doc.load_string(STR("<foo a='1'/>")).status == status_out_of_memory);
|
||||
CHECK_ALLOC_FAIL(CHECK(doc.load_string(STR("<foo a='1'/>")).status == status_out_of_memory));
|
||||
CHECK(!doc.first_child());
|
||||
}
|
||||
|
||||
|
@ -893,8 +935,8 @@ TEST(parse_out_of_memory_halfway_node)
|
|||
test_runner::_memory_fail_threshold = 65536;
|
||||
|
||||
xml_document doc;
|
||||
CHECK(doc.load_buffer_inplace(text, count * 4).status == status_out_of_memory);
|
||||
CHECK_NODE(doc.first_child(), STR("<n />"));
|
||||
CHECK_ALLOC_FAIL(CHECK(doc.load_buffer_inplace(text, sizeof(text)).status == status_out_of_memory));
|
||||
CHECK_NODE(doc.first_child(), STR("<n/>"));
|
||||
}
|
||||
|
||||
TEST(parse_out_of_memory_halfway_attr)
|
||||
|
@ -920,13 +962,47 @@ TEST(parse_out_of_memory_halfway_attr)
|
|||
test_runner::_memory_fail_threshold = 65536;
|
||||
|
||||
xml_document doc;
|
||||
CHECK(doc.load_buffer_inplace(text, count * 5 + 4).status == status_out_of_memory);
|
||||
CHECK_ALLOC_FAIL(CHECK(doc.load_buffer_inplace(text, sizeof(text)).status == status_out_of_memory));
|
||||
CHECK_STRING(doc.first_child().name(), STR("n"));
|
||||
CHECK_STRING(doc.first_child().first_attribute().name(), STR("a"));
|
||||
CHECK_STRING(doc.first_child().last_attribute().name(), STR("a"));
|
||||
}
|
||||
|
||||
static bool test_offset(const char_t* contents, unsigned int options, pugi::xml_parse_status status, ptrdiff_t offset)
|
||||
TEST(parse_out_of_memory_conversion)
|
||||
{
|
||||
test_runner::_memory_fail_threshold = 1;
|
||||
|
||||
xml_document doc;
|
||||
CHECK_ALLOC_FAIL(CHECK(doc.load_buffer("<foo\x90/>", 7, parse_default, encoding_latin1).status == status_out_of_memory));
|
||||
CHECK(!doc.first_child());
|
||||
}
|
||||
|
||||
TEST(parse_out_of_memory_allocator_state_sync)
|
||||
{
|
||||
const unsigned int count = 10000;
|
||||
static char_t text[count * 4];
|
||||
|
||||
for (unsigned int i = 0; i < count; ++i)
|
||||
{
|
||||
text[4*i + 0] = '<';
|
||||
text[4*i + 1] = 'n';
|
||||
text[4*i + 2] = '/';
|
||||
text[4*i + 3] = '>';
|
||||
}
|
||||
|
||||
test_runner::_memory_fail_threshold = 65536;
|
||||
|
||||
xml_document doc;
|
||||
CHECK_ALLOC_FAIL(CHECK(doc.load_buffer_inplace(text, sizeof(text)).status == status_out_of_memory));
|
||||
CHECK_NODE(doc.first_child(), STR("<n/>"));
|
||||
|
||||
test_runner::_memory_fail_threshold = 0;
|
||||
|
||||
for (unsigned int j = 0; j < count; ++j)
|
||||
CHECK(doc.append_child(STR("n")));
|
||||
}
|
||||
|
||||
static bool test_offset(const char_t* contents, unsigned int options, xml_parse_status status, ptrdiff_t offset)
|
||||
{
|
||||
xml_document doc;
|
||||
xml_parse_result res = doc.load_string(contents, options);
|
||||
|
@ -941,7 +1017,7 @@ TEST(parse_error_offset)
|
|||
CHECK_OFFSET("<node/>", parse_default, status_ok, 0);
|
||||
|
||||
test_runner::_memory_fail_threshold = 1;
|
||||
CHECK_OFFSET("<node/>", parse_default, status_out_of_memory, 0);
|
||||
CHECK_ALLOC_FAIL(CHECK_OFFSET("<node/>", parse_default, status_out_of_memory, 0));
|
||||
test_runner::_memory_fail_threshold = 0;
|
||||
|
||||
CHECK_OFFSET("<3d/>", parse_default, status_unrecognized_tag, 1);
|
||||
|
@ -971,8 +1047,8 @@ TEST(parse_error_offset)
|
|||
CHECK_OFFSET("<n></n $>", parse_default, status_bad_end_element, 7);
|
||||
CHECK_OFFSET("<n></n", parse_default, status_bad_end_element, 5);
|
||||
|
||||
CHECK_OFFSET("<no></na>", parse_default, status_end_element_mismatch, 8);
|
||||
CHECK_OFFSET("<no></nod>", parse_default, status_end_element_mismatch, 9);
|
||||
CHECK_OFFSET("<no></na>", parse_default, status_end_element_mismatch, 6);
|
||||
CHECK_OFFSET("<no></nod>", parse_default, status_end_element_mismatch, 6);
|
||||
}
|
||||
|
||||
TEST(parse_result_default)
|
||||
|
@ -1105,3 +1181,177 @@ TEST(parse_fuzz_doctype)
|
|||
xml_document doc;
|
||||
CHECK(doc.load_buffer(data, sizeof(data)).status == status_bad_doctype);
|
||||
}
|
||||
|
||||
TEST(parse_embed_pcdata)
|
||||
{
|
||||
// parse twice - once with default and once with embed_pcdata flags
|
||||
for (int i = 0; i < 2; ++i)
|
||||
{
|
||||
unsigned int flags = (i == 0) ? parse_default : parse_default | parse_embed_pcdata;
|
||||
|
||||
xml_document doc;
|
||||
xml_parse_result res = doc.load_string(STR("<node><key>value</key><child><inner1>value1</inner1><inner2>value2</inner2>outer</child><two>text<data /></two></node>"), flags);
|
||||
CHECK(res);
|
||||
|
||||
xml_node child = doc.child(STR("node")).child(STR("child"));
|
||||
|
||||
// parse_embed_pcdata omits PCDATA nodes so DOM is different
|
||||
if (flags & parse_embed_pcdata)
|
||||
{
|
||||
CHECK_STRING(doc.child(STR("node")).child(STR("key")).value(), STR("value"));
|
||||
CHECK(!doc.child(STR("node")).child(STR("key")).first_child());
|
||||
}
|
||||
else
|
||||
{
|
||||
CHECK_STRING(doc.child(STR("node")).child(STR("key")).value(), STR(""));
|
||||
CHECK(doc.child(STR("node")).child(STR("key")).first_child());
|
||||
CHECK_STRING(doc.child(STR("node")).child(STR("key")).first_child().value(), STR("value"));
|
||||
}
|
||||
|
||||
// higher-level APIs work the same though
|
||||
CHECK_STRING(child.text().get(), STR("outer"));
|
||||
CHECK_STRING(child.child(STR("inner1")).text().get(), STR("value1"));
|
||||
|
||||
CHECK_STRING(child.child_value(), STR("outer"));
|
||||
CHECK_STRING(child.child_value(STR("inner2")), STR("value2"));
|
||||
|
||||
#ifndef PUGIXML_NO_XPATH
|
||||
CHECK_XPATH_NUMBER(doc, STR("count(node/child/*[starts-with(., 'value')])"), 2);
|
||||
#endif
|
||||
|
||||
CHECK_NODE(doc, STR("<node><key>value</key><child><inner1>value1</inner1><inner2>value2</inner2>outer</child><two>text<data/></two></node>"));
|
||||
CHECK_NODE_EX(doc, STR("<node>\n<key>value</key>\n<child>\n<inner1>value1</inner1>\n<inner2>value2</inner2>outer</child>\n<two>text<data />\n</two>\n</node>\n"), STR("\t"), 0);
|
||||
CHECK_NODE_EX(doc, STR("<node>\n\t<key>value</key>\n\t<child>\n\t\t<inner1>value1</inner1>\n\t\t<inner2>value2</inner2>outer</child>\n\t<two>text<data />\n\t</two>\n</node>\n"), STR("\t"), format_indent);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_XML_FLAGS(parse_embed_pcdata_fragment, "text", parse_fragment | parse_embed_pcdata)
|
||||
{
|
||||
CHECK_NODE(doc, STR("text"));
|
||||
CHECK(doc.first_child().type() == node_pcdata);
|
||||
CHECK_STRING(doc.first_child().value(), STR("text"));
|
||||
}
|
||||
|
||||
TEST_XML_FLAGS(parse_embed_pcdata_child, "<n><child/>text</n>", parse_embed_pcdata)
|
||||
{
|
||||
xml_node n = doc.child(STR("n"));
|
||||
|
||||
CHECK_NODE(doc, STR("<n><child/>text</n>"));
|
||||
CHECK(n.last_child().type() == node_pcdata);
|
||||
CHECK_STRING(n.last_child().value(), STR("text"));
|
||||
}
|
||||
|
||||
TEST_XML_FLAGS(parse_embed_pcdata_comment, "<n>text1<!---->text2</n>", parse_embed_pcdata)
|
||||
{
|
||||
xml_node n = doc.child(STR("n"));
|
||||
|
||||
CHECK_NODE(doc, STR("<n>text1text2</n>"));
|
||||
CHECK_STRING(n.value(), STR("text1"));
|
||||
CHECK(n.first_child() == n.last_child());
|
||||
CHECK(n.last_child().type() == node_pcdata);
|
||||
CHECK_STRING(n.last_child().value(), STR("text2"));
|
||||
}
|
||||
|
||||
TEST(parse_encoding_detect)
|
||||
{
|
||||
char test[] = "<?xml version='1.0' encoding='utf-8'?><n/>";
|
||||
|
||||
xml_document doc;
|
||||
CHECK(doc.load_buffer(test, sizeof(test)));
|
||||
}
|
||||
|
||||
TEST(parse_encoding_detect_latin1)
|
||||
{
|
||||
char test0[] = "<?xml version='1.0' encoding='utf-8'?><n/>";
|
||||
char test1[] = "<?xml version='1.0' encoding='iso-8859-1'?><n/>";
|
||||
char test2[] = "<?xml version='1.0' encoding = \"latin1\"?><n/>";
|
||||
char test3[] = "<?xml version='1.0' encoding='ISO-8859-1'?><n/>";
|
||||
char test4[] = "<?xml version='1.0' encoding = \"LATIN1\"?><n/>";
|
||||
|
||||
xml_document doc;
|
||||
CHECK(doc.load_buffer(test0, sizeof(test0)).encoding == encoding_utf8);
|
||||
CHECK(doc.load_buffer(test1, sizeof(test1)).encoding == encoding_latin1);
|
||||
CHECK(doc.load_buffer(test2, sizeof(test2)).encoding == encoding_latin1);
|
||||
CHECK(doc.load_buffer(test3, sizeof(test3)).encoding == encoding_latin1);
|
||||
CHECK(doc.load_buffer(test4, sizeof(test4)).encoding == encoding_latin1);
|
||||
}
|
||||
|
||||
TEST(parse_encoding_detect_auto)
|
||||
{
|
||||
struct data_t
|
||||
{
|
||||
const char* contents;
|
||||
size_t size;
|
||||
xml_encoding encoding;
|
||||
};
|
||||
|
||||
const data_t data[] =
|
||||
{
|
||||
// BOM
|
||||
{ "\x00\x00\xfe\xff", 4, encoding_utf32_be },
|
||||
{ "\xff\xfe\x00\x00", 4, encoding_utf32_le },
|
||||
{ "\xfe\xff ", 4, encoding_utf16_be },
|
||||
{ "\xff\xfe ", 4, encoding_utf16_le },
|
||||
{ "\xef\xbb\xbf ", 4, encoding_utf8 },
|
||||
// automatic tag detection for < or <?
|
||||
{ "\x00\x00\x00<\x00\x00\x00n\x00\x00\x00/\x00\x00\x00>", 16, encoding_utf32_be },
|
||||
{ "<\x00\x00\x00n\x00\x00\x00/\x00\x00\x00>\x00\x00\x00", 16, encoding_utf32_le },
|
||||
{ "\x00<\x00?\x00n\x00?\x00>", 10, encoding_utf16_be },
|
||||
{ "<\x00?\x00n\x00?\x00>\x00", 10, encoding_utf16_le },
|
||||
{ "\x00<\x00n\x00/\x00>", 8, encoding_utf16_be },
|
||||
{ "<\x00n\x00/\x00>\x00", 8, encoding_utf16_le },
|
||||
// <?xml encoding
|
||||
{ "<?xml encoding='latin1'?>", 25, encoding_latin1 },
|
||||
};
|
||||
|
||||
for (size_t i = 0; i < sizeof(data) / sizeof(data[0]); ++i)
|
||||
{
|
||||
xml_document doc;
|
||||
xml_parse_result result = doc.load_buffer(data[i].contents, data[i].size, parse_fragment);
|
||||
|
||||
CHECK(result);
|
||||
CHECK(result.encoding == data[i].encoding);
|
||||
}
|
||||
}
|
||||
|
||||
TEST(parse_encoding_detect_auto_incomplete)
|
||||
{
|
||||
struct data_t
|
||||
{
|
||||
const char* contents;
|
||||
size_t size;
|
||||
xml_encoding encoding;
|
||||
};
|
||||
|
||||
const data_t data[] =
|
||||
{
|
||||
// BOM
|
||||
{ "\x00\x00\xfe ", 4, encoding_utf8 },
|
||||
{ "\x00\x00 ", 4, encoding_utf8 },
|
||||
{ "\xff\xfe\x00 ", 4, encoding_utf16_le },
|
||||
{ "\xfe ", 4, encoding_utf8 },
|
||||
{ "\xff ", 4, encoding_utf8 },
|
||||
{ "\xef\xbb ", 4, encoding_utf8 },
|
||||
{ "\xef ", 4, encoding_utf8 },
|
||||
// automatic tag detection for < or <?
|
||||
{ "\x00\x00\x00 ", 4, encoding_utf8 },
|
||||
{ "<\x00\x00n/\x00>\x00", 8, encoding_utf16_le },
|
||||
{ "\x00<n\x00\x00/\x00>", 8, encoding_utf16_be },
|
||||
{ "<\x00?n/\x00>\x00", 8, encoding_utf16_le },
|
||||
{ "\x00 ", 2, encoding_utf8 },
|
||||
// <?xml encoding
|
||||
{ "<?xmC encoding='latin1'?>", 25, encoding_utf8 },
|
||||
{ "<?xBC encoding='latin1'?>", 25, encoding_utf8 },
|
||||
{ "<?ABC encoding='latin1'?>", 25, encoding_utf8 },
|
||||
{ "<_ABC encoding='latin1'/>", 25, encoding_utf8 },
|
||||
};
|
||||
|
||||
for (size_t i = 0; i < sizeof(data) / sizeof(data[0]); ++i)
|
||||
{
|
||||
xml_document doc;
|
||||
xml_parse_result result = doc.load_buffer(data[i].contents, data[i].size, parse_fragment);
|
||||
|
||||
CHECK(result);
|
||||
CHECK(result.encoding == data[i].encoding);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
#define _CRT_SECURE_NO_WARNINGS
|
||||
|
||||
#include "common.hpp"
|
||||
#include "test.hpp"
|
||||
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
#include <string>
|
||||
|
||||
using namespace pugi;
|
||||
|
||||
static xml_parse_result load_concat(xml_document& doc, const char_t* a, const char_t* b = STR(""), const char_t* c = STR(""))
|
||||
{
|
||||
char_t buffer[768];
|
||||
|
@ -36,9 +38,9 @@ static bool test_doctype_wf(const char_t* decl)
|
|||
if (!load_concat(doc, STR("a"), decl, STR("b")) || !test_node(doc, STR("ab"), STR(""), format_raw)) return false;
|
||||
|
||||
// node pre/postfix
|
||||
if (!load_concat(doc, STR("<nodea/>"), decl) || !test_node(doc, STR("<nodea />"), STR(""), format_raw)) return false;
|
||||
if (!load_concat(doc, decl, STR("<nodeb/>")) || !test_node(doc, STR("<nodeb />"), STR(""), format_raw)) return false;
|
||||
if (!load_concat(doc, STR("<nodea/>"), decl, STR("<nodeb/>")) || !test_node(doc, STR("<nodea /><nodeb />"), STR(""), format_raw)) return false;
|
||||
if (!load_concat(doc, STR("<nodea/>"), decl) || !test_node(doc, STR("<nodea/>"), STR(""), format_raw)) return false;
|
||||
if (!load_concat(doc, decl, STR("<nodeb/>")) || !test_node(doc, STR("<nodeb/>"), STR(""), format_raw)) return false;
|
||||
if (!load_concat(doc, STR("<nodea/>"), decl, STR("<nodeb/>")) || !test_node(doc, STR("<nodea/><nodeb/>"), STR(""), format_raw)) return false;
|
||||
|
||||
// check load-store contents preservation
|
||||
CHECK(doc.load_string(decl, parse_doctype | parse_fragment));
|
||||
|
@ -219,7 +221,7 @@ TEST(parse_doctype_xmlconf_ibm_2)
|
|||
TEST_DOCTYPE_NWF("<!DOCTYPE animal [ <!ELEMENT animal ANY> <!ENTITY % parameterE \"A music file ?>\"> <?music %parameterE; ]>");
|
||||
TEST_DOCTYPE_NWF("<!DOCTYPE animal [ <!ELEMENT animal ANY> <!ENTITY % parameterE \"leopard EMPTY>\"> <!ELEMENT %parameterE; ]>");
|
||||
TEST_DOCTYPE_WF("<!DOCTYPE root [ <!ELEMENT root ANY> <!ATTLIST root attr1 CDATA #IMPLIED> <!ATTLIST root attr2 CDATA #IMPLIED> <!ENTITY withlt \"have <lessthan> inside\"> <!ENTITY aIndirect \"&withlt;\"> ]>");
|
||||
TEST_DOCTYPE_WF("<!DOCTYPE root [ <!ELEMENT root (#PCDATA)> <!--* Mising Name S contentspec in elementdecl *--> <!ELEMENT > ]>");
|
||||
TEST_DOCTYPE_WF("<!DOCTYPE root [ <!ELEMENT root (#PCDATA)> <!--* Missing Name S contentspec in elementdecl *--> <!ELEMENT > ]>");
|
||||
TEST_DOCTYPE_WF("<!DOCTYPE root [ <!ELEMENT root (#PCDATA)> <!ELEMENT a ANY> <!ELEMENT b ANY> <!--* extra separator in seq *--> <!ELEMENT aElement ((a|b),,a)? > ]>");
|
||||
TEST_DOCTYPE_WF("<!DOCTYPE root [ <!ELEMENT root (#PCDATA)> <!ELEMENT a ANY> <!--* Missing white space before Name in AttDef *--> <!ATTLIST a attr1 CDATA \"default\"attr2 ID #required> ]>");
|
||||
TEST_DOCTYPE_WF("<!DOCTYPE test [ <!ELEMENT test ANY> <!ELEMENT one EMPTY> <!ELEMENT two EMPTY> <!NOTATION this SYSTEM \"alpha\"> <!ATTLIST three attr NOTATION (\"this\") #IMPLIED> ]>");
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
#ifndef PUGIXML_NO_STL
|
||||
|
||||
#include "common.hpp"
|
||||
#include "test.hpp"
|
||||
|
||||
#include <string>
|
||||
|
||||
using namespace pugi;
|
||||
|
||||
// letters taken from http://www.utf8-chartable.de/
|
||||
|
||||
TEST(as_wide_empty)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "../src/pugixml.hpp"
|
||||
|
||||
#if PUGIXML_VERSION != 160
|
||||
#error Unexpected pugixml version
|
||||
#endif
|
||||
#include "../src/pugixml.hpp"
|
||||
|
||||
#if PUGIXML_VERSION != 1130
|
||||
#error Unexpected pugixml version
|
||||
#endif
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
#include "common.hpp"
|
||||
#include "test.hpp"
|
||||
|
||||
#include "writer_string.hpp"
|
||||
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
|
||||
using namespace pugi;
|
||||
|
||||
TEST_XML(write_simple, "<node attr='1'><child>text</child></node>")
|
||||
{
|
||||
|
@ -20,6 +23,31 @@ TEST_XML(write_indent, "<node attr='1'><child><sub>text</sub></child></node>")
|
|||
CHECK_NODE_EX(doc, STR("<node attr=\"1\">\n\t<child>\n\t\t<sub>text</sub>\n\t</child>\n</node>\n"), STR("\t"), format_indent);
|
||||
}
|
||||
|
||||
TEST_XML(write_indent_attributes, "<node attr='1' other='2'><child><sub>text</sub></child></node>")
|
||||
{
|
||||
CHECK_NODE_EX(doc, STR("<node\n\tattr=\"1\"\n\tother=\"2\">\n\t<child>\n\t\t<sub>text</sub>\n\t</child>\n</node>\n"), STR("\t"), format_indent_attributes);
|
||||
}
|
||||
|
||||
TEST_XML(write_indent_attributes_empty_element, "<node attr='1' other='2' />")
|
||||
{
|
||||
CHECK_NODE_EX(doc, STR("<node\n\tattr=\"1\"\n\tother=\"2\" />\n"), STR("\t"), format_indent_attributes);
|
||||
}
|
||||
|
||||
TEST_XML_FLAGS(write_indent_attributes_declaration, "<?xml version=\"1.0\" encoding=\"UTF-8\"?><node attr='1' other='2' />", parse_full)
|
||||
{
|
||||
CHECK_NODE_EX(doc, STR("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<node\n\tattr=\"1\"\n\tother=\"2\" />\n"), STR("\t"), format_indent_attributes);
|
||||
}
|
||||
|
||||
TEST_XML(write_indent_attributes_raw, "<node attr='1' other='2'><child><sub>text</sub></child></node>")
|
||||
{
|
||||
CHECK_NODE_EX(doc, STR("<node attr=\"1\" other=\"2\"><child><sub>text</sub></child></node>"), STR("\t"), format_indent_attributes | format_raw);
|
||||
}
|
||||
|
||||
TEST_XML(write_indent_attributes_empty_indent, "<node attr='1' other='2'><child><sub>text</sub></child></node>")
|
||||
{
|
||||
CHECK_NODE_EX(doc, STR("<node\nattr=\"1\"\nother=\"2\">\n<child>\n<sub>text</sub>\n</child>\n</node>\n"), STR(""), format_indent_attributes);
|
||||
}
|
||||
|
||||
TEST_XML(write_pcdata, "<node attr='1'><child><sub/>text</child></node>")
|
||||
{
|
||||
CHECK_NODE_EX(doc, STR("<node attr=\"1\">\n\t<child>\n\t\t<sub />text</child>\n</node>\n"), STR("\t"), format_indent);
|
||||
|
@ -43,6 +71,12 @@ TEST_XML_FLAGS(write_cdata_escape, "<![CDATA[value]]>", parse_cdata | parse_frag
|
|||
|
||||
doc.first_child().set_value(STR("1]]>2]]>3"));
|
||||
CHECK_NODE(doc, STR("<![CDATA[1]]]]><![CDATA[>2]]]]><![CDATA[>3]]>"));
|
||||
|
||||
doc.first_child().set_value(STR("1]"));
|
||||
CHECK_NODE(doc, STR("<![CDATA[1]]]>"));
|
||||
|
||||
doc.first_child().set_value(STR("1]]"));
|
||||
CHECK_NODE(doc, STR("<![CDATA[1]]]]>"));
|
||||
}
|
||||
|
||||
TEST_XML(write_cdata_inner, "<node><![CDATA[value]]></node>")
|
||||
|
@ -159,19 +193,35 @@ TEST_XML(write_escape, "<node attr=''>text</node>")
|
|||
doc.child(STR("node")).attribute(STR("attr")) = STR("<>'\"&\x04\r\n\t");
|
||||
doc.child(STR("node")).first_child().set_value(STR("<>'\"&\x04\r\n\t"));
|
||||
|
||||
CHECK_NODE(doc, STR("<node attr=\"<>'"& \t\"><>'\"&\r\n\t</node>"));
|
||||
CHECK_NODE(doc, STR("<node attr=\"<>'"& 	\"><>'\"&\r\n\t</node>"));
|
||||
CHECK_NODE_EX(doc, STR("<node attr='<>'\"& 	'><>'\"&\r\n\t</node>"), STR(""), format_raw | format_attribute_single_quote);
|
||||
}
|
||||
|
||||
TEST_XML(write_escape_roundtrip, "<node attr=''>text</node>")
|
||||
{
|
||||
doc.child(STR("node")).attribute(STR("attr")) = STR("<>'\"&\x04\r\n\t");
|
||||
doc.child(STR("node")).first_child().set_value(STR("<>'\"&\x04\r\n\t"));
|
||||
|
||||
std::string contents = write_narrow(doc, format_raw, encoding_utf8);
|
||||
|
||||
CHECK(doc.load_buffer(contents.c_str(), contents.size()));
|
||||
|
||||
// Note: this string is almost identical to the string from write_escape with the exception of \r
|
||||
// \r in PCDATA doesn't roundtrip because it has to go through newline conversion (which could be disabled, but is active by default)
|
||||
CHECK_NODE(doc, STR("<node attr=\"<>'"& 	\"><>'\"&\n\t</node>"));
|
||||
CHECK_NODE_EX(doc, STR("<node attr='<>'\"& 	'><>'\"&\n\t</node>"), STR(""), format_raw | format_attribute_single_quote);
|
||||
}
|
||||
|
||||
TEST_XML(write_escape_unicode, "<node attr='㰀'/>")
|
||||
{
|
||||
#ifdef PUGIXML_WCHAR_MODE
|
||||
#ifdef U_LITERALS
|
||||
CHECK_NODE(doc, STR("<node attr=\"\u3c00\" />"));
|
||||
CHECK_NODE(doc, STR("<node attr=\"\u3c00\"/>"));
|
||||
#else
|
||||
CHECK_NODE(doc, STR("<node attr=\"\x3c00\" />"));
|
||||
CHECK_NODE(doc, STR("<node attr=\"\x3c00\"/>"));
|
||||
#endif
|
||||
#else
|
||||
CHECK_NODE(doc, STR("<node attr=\"\xe3\xb0\x80\" />"));
|
||||
CHECK_NODE(doc, STR("<node attr=\"\xe3\xb0\x80\"/>"));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -185,12 +235,12 @@ TEST_XML(write_no_escapes, "<node attr=''>text</node>")
|
|||
|
||||
struct test_writer: xml_writer
|
||||
{
|
||||
std::basic_string<pugi::char_t> contents;
|
||||
std::basic_string<char_t> contents;
|
||||
|
||||
virtual void write(const void* data, size_t size)
|
||||
virtual void write(const void* data, size_t size) PUGIXML_OVERRIDE
|
||||
{
|
||||
CHECK(size % sizeof(pugi::char_t) == 0);
|
||||
contents.append(static_cast<const pugi::char_t*>(data), size / sizeof(pugi::char_t));
|
||||
CHECK(size % sizeof(char_t) == 0);
|
||||
contents.append(static_cast<const char_t*>(data), size / sizeof(char_t));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -230,7 +280,7 @@ TEST_XML(write_print_stream_wide, "<node/>")
|
|||
|
||||
TEST_XML(write_huge_chunk, "<node/>")
|
||||
{
|
||||
std::basic_string<pugi::char_t> name(10000, STR('n'));
|
||||
std::basic_string<char_t> name(10000, STR('n'));
|
||||
doc.child(STR("node")).set_name(name.c_str());
|
||||
|
||||
test_writer writer;
|
||||
|
@ -359,7 +409,7 @@ TEST(write_encoding_huge_invalid)
|
|||
TEST(write_unicode_escape)
|
||||
{
|
||||
char s_utf8[] = "<\xE2\x82\xAC \xC2\xA2='\"\xF0\xA4\xAD\xA2
\"'>&\x14\xF0\xA4\xAD\xA2<</\xE2\x82\xAC>";
|
||||
|
||||
|
||||
xml_document doc;
|
||||
CHECK(doc.load_buffer(s_utf8, sizeof(s_utf8), parse_default, encoding_utf8));
|
||||
|
||||
|
@ -447,7 +497,7 @@ TEST(write_no_name_element)
|
|||
root.append_child();
|
||||
root.append_child().append_child(node_pcdata).set_value(STR("text"));
|
||||
|
||||
CHECK_NODE(doc, STR("<:anonymous><:anonymous /><:anonymous>text</:anonymous></:anonymous>"));
|
||||
CHECK_NODE(doc, STR("<:anonymous><:anonymous/><:anonymous>text</:anonymous></:anonymous>"));
|
||||
CHECK_NODE_EX(doc, STR("<:anonymous>\n\t<:anonymous />\n\t<:anonymous>text</:anonymous>\n</:anonymous>\n"), STR("\t"), format_default);
|
||||
}
|
||||
|
||||
|
@ -465,7 +515,7 @@ TEST(write_no_name_attribute)
|
|||
doc.append_child().set_name(STR("root"));
|
||||
doc.child(STR("root")).append_attribute(STR(""));
|
||||
|
||||
CHECK_NODE(doc, STR("<root :anonymous=\"\" />"));
|
||||
CHECK_NODE(doc, STR("<root :anonymous=\"\"/>"));
|
||||
}
|
||||
|
||||
TEST(write_print_empty)
|
||||
|
@ -491,7 +541,7 @@ TEST(write_print_stream_empty_wide)
|
|||
TEST(write_stackless)
|
||||
{
|
||||
unsigned int count = 20000;
|
||||
std::basic_string<pugi::char_t> data;
|
||||
std::basic_string<char_t> data;
|
||||
|
||||
for (unsigned int i = 0; i < count; ++i)
|
||||
data += STR("<a>");
|
||||
|
@ -570,7 +620,114 @@ TEST(write_pcdata_whitespace_fixedpoint)
|
|||
|
||||
TEST_XML_FLAGS(write_mixed, "<node><child1/><child2>pre<![CDATA[data]]>mid<!--comment--><test/>post<?pi value?>fin</child2><child3/></node>", parse_full)
|
||||
{
|
||||
CHECK_NODE(doc, STR("<node><child1 /><child2>pre<![CDATA[data]]>mid<!--comment--><test />post<?pi value?>fin</child2><child3 /></node>"));
|
||||
CHECK_NODE(doc, STR("<node><child1/><child2>pre<![CDATA[data]]>mid<!--comment--><test/>post<?pi value?>fin</child2><child3/></node>"));
|
||||
CHECK_NODE_EX(doc, STR("<node>\n<child1 />\n<child2>pre<![CDATA[data]]>mid<!--comment-->\n<test />post<?pi value?>fin</child2>\n<child3 />\n</node>\n"), STR("\t"), 0);
|
||||
CHECK_NODE_EX(doc, STR("<node>\n\t<child1 />\n\t<child2>pre<![CDATA[data]]>mid<!--comment-->\n\t\t<test />post<?pi value?>fin</child2>\n\t<child3 />\n</node>\n"), STR("\t"), format_indent);
|
||||
}
|
||||
|
||||
TEST_XML(write_no_empty_element_tags, "<node><child1/><child2>text</child2><child3></child3></node>")
|
||||
{
|
||||
CHECK_NODE(doc, STR("<node><child1/><child2>text</child2><child3/></node>"));
|
||||
CHECK_NODE_EX(doc, STR("<node><child1></child1><child2>text</child2><child3></child3></node>"), STR("\t"), format_raw | format_no_empty_element_tags);
|
||||
CHECK_NODE_EX(doc, STR("<node>\n\t<child1></child1>\n\t<child2>text</child2>\n\t<child3></child3>\n</node>\n"), STR("\t"), format_indent | format_no_empty_element_tags);
|
||||
}
|
||||
|
||||
TEST_XML_FLAGS(write_roundtrip, "<node><child1 attr1='value1' attr2='value2'/><child2 attr='value'>pre<![CDATA[data]]>mid<text&escape<!--comment--><test/>post<?pi value?>fin</child2><child3/></node>", parse_full)
|
||||
{
|
||||
const unsigned int flagset[] = { format_indent, format_raw, format_no_declaration, format_indent_attributes, format_no_empty_element_tags, format_attribute_single_quote };
|
||||
size_t flagcount = sizeof(flagset) / sizeof(flagset[0]);
|
||||
|
||||
for (size_t i = 0; i < (size_t(1) << flagcount); ++i)
|
||||
{
|
||||
unsigned int flags = 0;
|
||||
|
||||
for (size_t j = 0; j < flagcount; ++j)
|
||||
if (i & (size_t(1) << j))
|
||||
flags |= flagset[j];
|
||||
|
||||
std::string contents = write_narrow(doc, flags, encoding_utf8);
|
||||
|
||||
xml_document verify;
|
||||
CHECK(verify.load_buffer(contents.c_str(), contents.size(), parse_full));
|
||||
CHECK(test_write_narrow(verify, flags, encoding_utf8, contents.c_str(), contents.size()));
|
||||
|
||||
xml_document verifyws;
|
||||
CHECK(verifyws.load_buffer(contents.c_str(), contents.size(), parse_full | parse_ws_pcdata));
|
||||
CHECK(test_write_narrow(verifyws, flags, encoding_utf8, contents.c_str(), contents.size()));
|
||||
}
|
||||
}
|
||||
|
||||
TEST(write_flush_coverage)
|
||||
{
|
||||
xml_document doc;
|
||||
|
||||
// this creates a node that uses short sequences of lengths 1-6 for output
|
||||
xml_node n = doc.append_child(STR("n"));
|
||||
|
||||
xml_attribute a = n.append_attribute(STR("a"));
|
||||
|
||||
xml_attribute b = n.append_attribute(STR("b"));
|
||||
b.set_value(STR("<&\""));
|
||||
|
||||
n.append_child(node_comment);
|
||||
|
||||
size_t basel = save_narrow(doc, format_raw, encoding_auto).size();
|
||||
size_t bufl = 2048;
|
||||
|
||||
for (size_t l = 0; l <= basel; ++l)
|
||||
{
|
||||
std::basic_string<char_t> pad(bufl - l, STR('v'));
|
||||
a.set_value(pad.c_str());
|
||||
|
||||
std::string s = save_narrow(doc, format_raw, encoding_auto);
|
||||
CHECK(s.size() == basel + bufl - l);
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef PUGIXML_NO_EXCEPTIONS
|
||||
struct throwing_writer: xml_writer
|
||||
{
|
||||
virtual void write(const void*, size_t) PUGIXML_OVERRIDE
|
||||
{
|
||||
throw std::runtime_error("write failed");
|
||||
}
|
||||
};
|
||||
|
||||
TEST_XML(write_throw_simple, "<node><child/></node>")
|
||||
{
|
||||
try
|
||||
{
|
||||
throwing_writer w;
|
||||
doc.print(w);
|
||||
|
||||
CHECK_FORCE_FAIL("Expected exception");
|
||||
}
|
||||
catch (std::runtime_error&)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
TEST_XML(write_throw_encoding, "<node><child/></node>")
|
||||
{
|
||||
try
|
||||
{
|
||||
throwing_writer w;
|
||||
doc.print(w, STR("\t"), format_default, encoding_utf32_be);
|
||||
|
||||
CHECK_FORCE_FAIL("Expected exception");
|
||||
}
|
||||
catch (std::runtime_error&)
|
||||
{
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST_XML(write_skip_control_chars, "<a>\f\t\n\x0F\x19</a>")
|
||||
{
|
||||
CHECK_NODE_EX(doc.first_child(), STR("<a>\t\n</a>\n"), STR(""), pugi::format_default | pugi::format_skip_control_chars);
|
||||
}
|
||||
|
||||
TEST_XML(write_keep_control_chars, "<a>\f\t\n\x0F\x19</a>")
|
||||
{
|
||||
CHECK_NODE_EX(doc.first_child(), STR("<a>\t\n</a>\n"), STR(""), pugi::format_default);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#ifndef PUGIXML_NO_XPATH
|
||||
|
||||
#include "common.hpp"
|
||||
#include "test.hpp"
|
||||
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
|
@ -10,6 +10,8 @@
|
|||
#include <algorithm>
|
||||
#include <limits>
|
||||
|
||||
using namespace pugi;
|
||||
|
||||
static void load_document_copy(xml_document& doc, const char_t* text)
|
||||
{
|
||||
xml_document source;
|
||||
|
@ -18,6 +20,22 @@ static void load_document_copy(xml_document& doc, const char_t* text)
|
|||
doc.append_copy(source.first_child());
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static void random_shuffle(std::vector<T>& v)
|
||||
{
|
||||
size_t rng = 2147483647;
|
||||
|
||||
for (size_t i = v.size() - 1; i > 0; --i)
|
||||
{
|
||||
// Fisher-Yates shuffle
|
||||
size_t j = rng % (i + 1);
|
||||
std::swap(v[j], v[i]);
|
||||
|
||||
// LCG RNG, constants from Numerical Recipes
|
||||
rng = rng * 1664525 + 1013904223;
|
||||
}
|
||||
}
|
||||
|
||||
TEST(xpath_allocator_many_pages)
|
||||
{
|
||||
std::basic_string<char_t> query = STR("0");
|
||||
|
@ -153,7 +171,7 @@ TEST(xpath_sort_random_medium)
|
|||
xpath_node_set ns = doc.select_nodes(STR("//node() | //@*"));
|
||||
|
||||
std::vector<xpath_node> nsv(ns.begin(), ns.end());
|
||||
std::random_shuffle(nsv.begin(), nsv.end());
|
||||
random_shuffle(nsv);
|
||||
|
||||
xpath_node_set copy(&nsv[0], &nsv[0] + nsv.size());
|
||||
copy.sort();
|
||||
|
@ -182,7 +200,7 @@ TEST(xpath_sort_random_large)
|
|||
xpath_node_set ns = doc.select_nodes(STR("//node() | //@*"));
|
||||
|
||||
std::vector<xpath_node> nsv(ns.begin(), ns.end());
|
||||
std::random_shuffle(nsv.begin(), nsv.end());
|
||||
random_shuffle(nsv);
|
||||
|
||||
xpath_node_set copy(&nsv[0], &nsv[0] + nsv.size());
|
||||
copy.sort();
|
||||
|
@ -194,40 +212,40 @@ TEST(xpath_sort_random_large)
|
|||
|
||||
TEST(xpath_long_numbers_parse)
|
||||
{
|
||||
const pugi::char_t* str_flt_max = STR("340282346638528860000000000000000000000");
|
||||
const pugi::char_t* str_flt_max_dec = STR("340282346638528860000000000000000000000.000000");
|
||||
|
||||
const pugi::char_t* str_dbl_max = STR("179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000");
|
||||
const pugi::char_t* str_dbl_max_dec = STR("179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.000000");
|
||||
const char_t* str_flt_max = STR("340282346638528860000000000000000000000");
|
||||
const char_t* str_flt_max_dec = STR("340282346638528860000000000000000000000.000000");
|
||||
|
||||
const char_t* str_dbl_max = STR("179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000");
|
||||
const char_t* str_dbl_max_dec = STR("179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.000000");
|
||||
|
||||
xml_node c;
|
||||
|
||||
// check parsing
|
||||
CHECK_XPATH_NUMBER(c, str_flt_max, std::numeric_limits<float>::max());
|
||||
CHECK_XPATH_NUMBER(c, str_flt_max_dec, std::numeric_limits<float>::max());
|
||||
CHECK_XPATH_NUMBER(c, str_flt_max, double(std::numeric_limits<float>::max()));
|
||||
CHECK_XPATH_NUMBER(c, str_flt_max_dec, double(std::numeric_limits<float>::max()));
|
||||
CHECK_XPATH_NUMBER(c, str_dbl_max, std::numeric_limits<double>::max());
|
||||
CHECK_XPATH_NUMBER(c, str_dbl_max_dec, std::numeric_limits<double>::max());
|
||||
}
|
||||
|
||||
static bool test_xpath_string_prefix(const pugi::xml_node& node, const pugi::char_t* query, const pugi::char_t* expected, size_t match_length)
|
||||
static bool test_xpath_string_prefix(const xml_node& node, const char_t* query, const char_t* expected, size_t match_length)
|
||||
{
|
||||
pugi::xpath_query q(query);
|
||||
xpath_query q(query);
|
||||
|
||||
pugi::char_t result[32];
|
||||
char_t result[32];
|
||||
size_t size = q.evaluate_string(result, sizeof(result) / sizeof(result[0]), node);
|
||||
|
||||
size_t expected_length = std::char_traits<pugi::char_t>::length(expected);
|
||||
size_t expected_length = std::char_traits<char_t>::length(expected);
|
||||
|
||||
return size == expected_length + 1 && std::char_traits<pugi::char_t>::compare(result, expected, match_length) == 0;
|
||||
return size == expected_length + 1 && std::char_traits<char_t>::compare(result, expected, match_length) == 0;
|
||||
}
|
||||
|
||||
TEST(xpath_long_numbers_stringize)
|
||||
{
|
||||
const pugi::char_t* str_flt_max = STR("340282346638528860000000000000000000000");
|
||||
const pugi::char_t* str_flt_max_dec = STR("340282346638528860000000000000000000000.000000");
|
||||
|
||||
const pugi::char_t* str_dbl_max = STR("179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000");
|
||||
const pugi::char_t* str_dbl_max_dec = STR("179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.000000");
|
||||
const char_t* str_flt_max = STR("340282346638528860000000000000000000000");
|
||||
const char_t* str_flt_max_dec = STR("340282346638528860000000000000000000000.000000");
|
||||
|
||||
const char_t* str_dbl_max = STR("179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000");
|
||||
const char_t* str_dbl_max_dec = STR("179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.000000");
|
||||
|
||||
xml_node c;
|
||||
|
||||
|
@ -240,7 +258,7 @@ TEST(xpath_long_numbers_stringize)
|
|||
|
||||
TEST(xpath_denorm_numbers)
|
||||
{
|
||||
std::basic_string<pugi::char_t> query;
|
||||
std::basic_string<char_t> query;
|
||||
|
||||
// 10^-318 - double denormal
|
||||
for (int i = 0; i < 106; ++i)
|
||||
|
@ -249,7 +267,13 @@ TEST(xpath_denorm_numbers)
|
|||
query += STR("0.001");
|
||||
}
|
||||
|
||||
CHECK_XPATH_STRING(xml_node(), query.c_str(), STR("0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009999987484955998"));
|
||||
// check if current fpu setup supports denormals
|
||||
double denorm = xpath_query(query.c_str()).evaluate_number(xml_node());
|
||||
|
||||
if (denorm != 0.0)
|
||||
{
|
||||
CHECK_XPATH_STRING(xml_node(), query.c_str(), STR("0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009999987484955998"));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_XML(xpath_rexml_1, "<a><b><c id='a'/></b><c id='b'/></a>")
|
||||
|
@ -367,6 +391,36 @@ TEST(xpath_large_node_set)
|
|||
CHECK(ns.size() == 10001);
|
||||
}
|
||||
|
||||
TEST(xpath_out_of_memory_query)
|
||||
{
|
||||
test_runner::_memory_fail_threshold = 1;
|
||||
|
||||
CHECK_ALLOC_FAIL(xpath_query q(STR("node")));
|
||||
}
|
||||
|
||||
TEST_XML(xpath_out_of_memory_evaluate, "<n/>")
|
||||
{
|
||||
test_runner::_memory_fail_threshold = 4196 * sizeof(char_t) + 4096 * 2 + 32768;
|
||||
|
||||
std::basic_string<char_t> query = STR("*[concat(\"a\", \"");
|
||||
|
||||
query.resize(4196, 'a');
|
||||
query += STR("\")]");
|
||||
|
||||
xpath_query q(query.c_str());
|
||||
|
||||
CHECK_ALLOC_FAIL(CHECK(q.evaluate_boolean(doc) == false));
|
||||
CHECK_ALLOC_FAIL(CHECK_DOUBLE_NAN(q.evaluate_number(doc)));
|
||||
|
||||
#ifndef PUGIXML_NO_STL
|
||||
CHECK_ALLOC_FAIL(CHECK(q.evaluate_string(doc).empty()));
|
||||
#endif
|
||||
|
||||
CHECK_ALLOC_FAIL(CHECK(q.evaluate_string(0, 0, doc) == 1));
|
||||
CHECK_ALLOC_FAIL(CHECK(q.evaluate_node(doc) == xpath_node()));
|
||||
CHECK_ALLOC_FAIL(CHECK(q.evaluate_node_set(doc).empty()));
|
||||
}
|
||||
|
||||
TEST(xpath_out_of_memory_evaluate_concat)
|
||||
{
|
||||
test_runner::_memory_fail_threshold = 4196 * sizeof(char_t) + 4096 * 2;
|
||||
|
@ -376,21 +430,25 @@ TEST(xpath_out_of_memory_evaluate_concat)
|
|||
query.resize(4196, 'a');
|
||||
query += STR("\")");
|
||||
|
||||
pugi::xpath_query q(query.c_str());
|
||||
xpath_query q(query.c_str());
|
||||
|
||||
#ifdef PUGIXML_NO_EXCEPTIONS
|
||||
CHECK(q.evaluate_string(0, 0, xml_node()) == 1);
|
||||
#else
|
||||
try
|
||||
{
|
||||
q.evaluate_string(0, 0, xml_node());
|
||||
CHECK_ALLOC_FAIL(CHECK(q.evaluate_string(0, 0, xml_node()) == 1));
|
||||
}
|
||||
|
||||
CHECK_FORCE_FAIL("Expected out of memory exception");
|
||||
}
|
||||
catch (const std::bad_alloc&)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
TEST(xpath_out_of_memory_evaluate_concat_list)
|
||||
{
|
||||
std::basic_string<char_t> query = STR("concat(");
|
||||
|
||||
for (size_t i = 0; i < 500; ++i)
|
||||
query += STR("\"\",");
|
||||
|
||||
query += STR("\"\")");
|
||||
|
||||
xpath_query q(query.c_str());
|
||||
|
||||
test_runner::_memory_fail_threshold = 1;
|
||||
|
||||
CHECK_ALLOC_FAIL(CHECK(q.evaluate_string(0, 0, xml_node()) == 1));
|
||||
}
|
||||
|
||||
TEST(xpath_out_of_memory_evaluate_substring)
|
||||
|
@ -402,79 +460,151 @@ TEST(xpath_out_of_memory_evaluate_substring)
|
|||
query.resize(4196, 'a');
|
||||
query += STR("\", 1, 4097)");
|
||||
|
||||
pugi::xpath_query q(query.c_str());
|
||||
xpath_query q(query.c_str());
|
||||
|
||||
#ifdef PUGIXML_NO_EXCEPTIONS
|
||||
CHECK(q.evaluate_string(0, 0, xml_node()) == 1);
|
||||
#else
|
||||
try
|
||||
{
|
||||
q.evaluate_string(0, 0, xml_node());
|
||||
|
||||
CHECK_FORCE_FAIL("Expected out of memory exception");
|
||||
}
|
||||
catch (const std::bad_alloc&)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
CHECK_ALLOC_FAIL(CHECK(q.evaluate_string(0, 0, xml_node()) == 1));
|
||||
}
|
||||
|
||||
TEST_XML(xpath_out_of_memory_evaluate_union, "<node><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/></node>")
|
||||
TEST_XML(xpath_out_of_memory_evaluate_union, "<node />")
|
||||
{
|
||||
// left hand side: size * sizeof(xpath_node) (8 on 32-bit, 16 on 64-bit)
|
||||
// right hand side: same
|
||||
// to make sure that when we append right hand side to left hand side, we run out of an XPath stack page (4K), we need slightly more than 2K/8 = 256 nodes on 32-bit, 128 nodes on 64-bit
|
||||
size_t count = sizeof(void*) == 4 ? 300 : 150;
|
||||
|
||||
for (size_t i = 0; i < count; ++i)
|
||||
doc.first_child().append_child(STR("a"));
|
||||
|
||||
xpath_query q(STR("a|a"));
|
||||
|
||||
test_runner::_memory_fail_threshold = 1;
|
||||
|
||||
CHECK_ALLOC_FAIL(CHECK(q.evaluate_node_set(doc.child(STR("node"))).empty()));
|
||||
}
|
||||
|
||||
TEST_XML(xpath_out_of_memory_evaluate_union_hash, "<node />")
|
||||
{
|
||||
// left hand side: size * sizeof(xpath_node) (8 on 32-bit, 16 on 64-bit)
|
||||
// right hand side: same
|
||||
// hash table: size * 1.5 * sizeof(void*)
|
||||
// to make sure that when we append right hand side to left hand side, we do *not* run out of an XPath stack page (4K), we need slightly less than 2K/8 = 256 nodes on 32-bit, 128 nodes on 64-bit
|
||||
size_t count = sizeof(void*) == 4 ? 200 : 100;
|
||||
|
||||
for (size_t i = 0; i < count; ++i)
|
||||
doc.first_child().append_child(STR("a"));
|
||||
|
||||
xpath_query q(STR("a|a"));
|
||||
|
||||
test_runner::_memory_fail_threshold = 1;
|
||||
|
||||
CHECK_ALLOC_FAIL(CHECK(q.evaluate_node_set(doc.child(STR("node"))).empty()));
|
||||
}
|
||||
|
||||
|
||||
TEST_XML(xpath_out_of_memory_evaluate_predicate, "<node><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/></node>")
|
||||
{
|
||||
test_runner::_memory_fail_threshold = 32768 + 4096 * 2;
|
||||
|
||||
pugi::xpath_query q(STR("a|(a|(a|(a|(a|(a|(a|(a|(a|(a|(a|(a|(a|(a|(a|(a|(a|(a|(a|(a|a)))))))))))))))))))"));
|
||||
xpath_query q(STR("//a[//a[//a[//a[true()]]]]"));
|
||||
|
||||
#ifdef PUGIXML_NO_EXCEPTIONS
|
||||
CHECK(q.evaluate_node_set(doc.child(STR("node"))).empty());
|
||||
#else
|
||||
try
|
||||
{
|
||||
q.evaluate_node_set(doc.child(STR("node")));
|
||||
|
||||
CHECK_FORCE_FAIL("Expected out of memory exception");
|
||||
}
|
||||
catch (const std::bad_alloc&)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
CHECK_ALLOC_FAIL(CHECK(q.evaluate_node_set(doc).empty()));
|
||||
}
|
||||
|
||||
TEST_XML(xpath_out_of_memory_evaluate_predicate, "<node><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/></node>")
|
||||
TEST_XML(xpath_out_of_memory_evaluate_normalize_space_0, "<node> a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z </node>")
|
||||
{
|
||||
test_runner::_memory_fail_threshold = 32768 + 4096 * 2;
|
||||
|
||||
pugi::xpath_query q(STR("//a[//a[//a[//a[//a[//a[//a[//a[//a[//a[//a[//a[//a[//a[true()]]]]]]]]]]]]]]"));
|
||||
xpath_query q(STR("concat(normalize-space(), normalize-space(), normalize-space(), normalize-space(), normalize-space(), normalize-space(), normalize-space(), normalize-space())"));
|
||||
|
||||
#ifdef PUGIXML_NO_EXCEPTIONS
|
||||
CHECK(q.evaluate_node_set(doc).empty());
|
||||
#else
|
||||
try
|
||||
{
|
||||
q.evaluate_node_set(doc);
|
||||
CHECK_ALLOC_FAIL(CHECK(q.evaluate_string(0, 0, doc.first_child()) == 1));
|
||||
}
|
||||
|
||||
CHECK_FORCE_FAIL("Expected out of memory exception");
|
||||
}
|
||||
catch (const std::bad_alloc&)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
TEST_XML(xpath_out_of_memory_evaluate_normalize_space_1, "<node> a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z </node>")
|
||||
{
|
||||
test_runner::_memory_fail_threshold = 32768 + 4096 * 2;
|
||||
|
||||
xpath_query q(STR("concat(normalize-space(node), normalize-space(node), normalize-space(node), normalize-space(node), normalize-space(node), normalize-space(node), normalize-space(node), normalize-space(node))"));
|
||||
|
||||
CHECK_ALLOC_FAIL(CHECK(q.evaluate_string(0, 0, doc) == 1));
|
||||
}
|
||||
|
||||
TEST_XML(xpath_out_of_memory_evaluate_translate, "<node> a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z </node>")
|
||||
{
|
||||
test_runner::_memory_fail_threshold = 32768 + 4096 * 2;
|
||||
|
||||
xpath_query q(STR("concat(translate(node, 'a', '\xe9'), translate(node, 'a', '\xe9'), translate(node, 'a', '\xe9'), translate(node, 'a', '\xe9'), translate(node, 'a', '\xe9'), translate(node, 'a', '\xe9'), translate(node, 'a', '\xe9'), translate(node, 'a', '\xe9'))"));
|
||||
|
||||
CHECK_ALLOC_FAIL(CHECK(q.evaluate_string(0, 0, doc) == 1));
|
||||
}
|
||||
|
||||
TEST_XML(xpath_out_of_memory_evaluate_translate_table, "<node> a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z </node>")
|
||||
{
|
||||
test_runner::_memory_fail_threshold = 32768 + 4096 * 2;
|
||||
|
||||
xpath_query q(STR("concat(translate(node, 'a', 'A'), translate(node, 'a', 'A'), translate(node, 'a', 'A'), translate(node, 'a', 'A'), translate(node, 'a', 'A'), translate(node, 'a', 'A'), translate(node, 'a', 'A'), translate(node, 'a', 'A'))"));
|
||||
|
||||
CHECK_ALLOC_FAIL(CHECK(q.evaluate_string(0, 0, doc) == 1));
|
||||
}
|
||||
|
||||
TEST(xpath_out_of_memory_evaluate_string_append)
|
||||
{
|
||||
test_runner::_memory_fail_threshold = 32768 + 4096 * 2;
|
||||
|
||||
std::basic_string<char_t> literal(5000, 'a');
|
||||
|
||||
std::basic_string<char_t> buf;
|
||||
buf += STR("<n><c>text</c><c>");
|
||||
buf += literal;
|
||||
buf += STR("</c></n>");
|
||||
|
||||
xml_document doc;
|
||||
CHECK(doc.load_buffer_inplace(&buf[0], buf.size() * sizeof(char_t)));
|
||||
|
||||
xpath_query q(STR("string(n)"));
|
||||
CHECK(q);
|
||||
|
||||
CHECK_ALLOC_FAIL(CHECK(q.evaluate_string(0, 0, doc) == 1));
|
||||
}
|
||||
|
||||
TEST(xpath_out_of_memory_evaluate_number_to_string)
|
||||
{
|
||||
test_runner::_memory_fail_threshold = 4096 + 128;
|
||||
|
||||
xpath_variable_set vars;
|
||||
vars.set(STR("x"), 1e+308);
|
||||
|
||||
xpath_query q(STR("concat($x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x)"), &vars);
|
||||
|
||||
CHECK_ALLOC_FAIL(CHECK(q.evaluate_string(0, 0, xml_node()) == 1));
|
||||
}
|
||||
|
||||
TEST(xpath_memory_concat_massive)
|
||||
{
|
||||
pugi::xml_document doc;
|
||||
pugi::xml_node node = doc.append_child(STR("node"));
|
||||
xml_document doc;
|
||||
xml_node node = doc.append_child(STR("node"));
|
||||
|
||||
for (int i = 0; i < 5000; ++i)
|
||||
node.append_child(STR("c")).text().set(i % 10);
|
||||
|
||||
pugi::xpath_query q(STR("/"));
|
||||
xpath_query q(STR("/"));
|
||||
size_t size = q.evaluate_string(0, 0, node);
|
||||
|
||||
CHECK(size == 5001);
|
||||
}
|
||||
|
||||
TEST_XML(xpath_memory_translate_table, "<node>a</node>")
|
||||
{
|
||||
test_runner::_memory_fail_threshold = 32768 + 4096 + 128;
|
||||
|
||||
// 128b per table => we need 32+ translate calls to exhaust a page
|
||||
std::basic_string<char_t> query = STR("concat(");
|
||||
for (int i = 0; i < 64; ++i)
|
||||
query += STR("translate(.,'a','A'),");
|
||||
query += STR("'')");
|
||||
|
||||
CHECK_ALLOC_FAIL(CHECK(!xpath_query(query.c_str())));
|
||||
}
|
||||
|
||||
TEST_XML(xpath_sort_copy_share, "<node><child1 attr1='value1' attr2='value2'/><child2 attr1='value1'>test</child2></node>")
|
||||
{
|
||||
// copy sharing shares the name/value data for nodes that can potentially make document order optimization invalid (silently)
|
||||
|
@ -626,6 +756,17 @@ TEST(xpath_sort_crossdoc_different_depth)
|
|||
CHECK((ns[0] == ns1[0] && ns[1] == ns2[0]) || (ns[0] == ns2[0] && ns[1] == ns1[0]));
|
||||
}
|
||||
|
||||
TEST_XML(xpath_sort_empty_node, "<node><child1/><child2/></node>")
|
||||
{
|
||||
xml_node n = doc.child(STR("node"));
|
||||
xpath_node nodes[] = { n.child(STR("child2")), xml_node(), n.child(STR("child1")), xml_node() };
|
||||
xpath_node_set ns(nodes, nodes + sizeof(nodes) / sizeof(nodes[0]));
|
||||
|
||||
ns.sort();
|
||||
|
||||
CHECK(!ns[0] && !ns[1] && ns[2] == nodes[2] && ns[3] == nodes[0]);
|
||||
}
|
||||
|
||||
TEST(xpath_allocate_string_out_of_memory)
|
||||
{
|
||||
std::basic_string<char_t> query;
|
||||
|
@ -634,20 +775,8 @@ TEST(xpath_allocate_string_out_of_memory)
|
|||
|
||||
test_runner::_memory_fail_threshold = 8*1024;
|
||||
|
||||
#ifdef PUGIXML_NO_EXCEPTIONS
|
||||
CHECK(!xpath_query(query.c_str()));
|
||||
#else
|
||||
try
|
||||
{
|
||||
#ifndef __DMC__ // DigitalMars exception handling crashes instead of catching the exception...
|
||||
xpath_query q(query.c_str());
|
||||
|
||||
CHECK_FORCE_FAIL("Expected out of memory exception");
|
||||
#endif
|
||||
}
|
||||
catch (const std::bad_alloc&)
|
||||
{
|
||||
}
|
||||
#ifndef __DMC__ // DigitalMars exception handling crashes instead of catching the exception...
|
||||
CHECK_ALLOC_FAIL(CHECK(!xpath_query(query.c_str())));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -672,4 +801,15 @@ TEST(xpath_remove_duplicates)
|
|||
tester % (2 + i);
|
||||
}
|
||||
}
|
||||
|
||||
TEST(xpath_anonymous_nodes)
|
||||
{
|
||||
xml_document doc;
|
||||
doc.append_child(node_element);
|
||||
doc.append_child(node_pi);
|
||||
|
||||
CHECK_XPATH_NODESET(doc, STR("/name"));
|
||||
CHECK_XPATH_NODESET(doc, STR("/processing-instruction('a')"));
|
||||
CHECK_XPATH_NODESET(doc, STR("/ns:*"));
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -2,11 +2,14 @@
|
|||
|
||||
#include <string.h> // because Borland's STL is braindead, we have to include <string.h> _before_ <string> in order to get memcmp
|
||||
|
||||
#include "common.hpp"
|
||||
#include "test.hpp"
|
||||
|
||||
#include "helpers.hpp"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
using namespace pugi;
|
||||
|
||||
TEST_XML(xpath_api_select_nodes, "<node><head/><foo/><foo/><tail/></node>")
|
||||
{
|
||||
|
@ -30,12 +33,12 @@ TEST_XML(xpath_api_select_node, "<node><head/><foo id='1'/><foo/><tail/></node>"
|
|||
CHECK(n2.node().attribute(STR("id")).as_int() == 1);
|
||||
|
||||
xpath_node n3 = doc.select_node(STR("node/bar"));
|
||||
|
||||
|
||||
CHECK(!n3);
|
||||
|
||||
xpath_node n4 = doc.select_node(STR("node/head/following-sibling::foo"));
|
||||
xpath_node n5 = doc.select_node(STR("node/tail/preceding-sibling::foo"));
|
||||
|
||||
|
||||
CHECK(n4.node().attribute(STR("id")).as_int() == 1);
|
||||
CHECK(n5.node().attribute(STR("id")).as_int() == 1);
|
||||
}
|
||||
|
@ -106,6 +109,7 @@ TEST_XML(xpath_api_nodeset_accessors, "<node><foo/><foo/></node>")
|
|||
|
||||
TEST_XML(xpath_api_nodeset_copy, "<node><foo/><foo/></node>")
|
||||
{
|
||||
xpath_node_set empty;
|
||||
xpath_node_set set = doc.select_nodes(STR("node/foo"));
|
||||
|
||||
xpath_node_set copy1 = set;
|
||||
|
@ -119,7 +123,7 @@ TEST_XML(xpath_api_nodeset_copy, "<node><foo/><foo/></node>")
|
|||
|
||||
xpath_node_set copy3;
|
||||
copy3 = set;
|
||||
copy3 = copy3;
|
||||
copy3 = xpath_node_set(copy3);
|
||||
CHECK(copy3.size() == 2);
|
||||
CHECK_STRING(copy3[0].node().name(), STR("foo"));
|
||||
|
||||
|
@ -131,7 +135,7 @@ TEST_XML(xpath_api_nodeset_copy, "<node><foo/><foo/></node>")
|
|||
|
||||
xpath_node_set copy5;
|
||||
copy5 = set;
|
||||
copy5 = xpath_node_set();
|
||||
copy5 = empty;
|
||||
CHECK(copy5.size() == 0);
|
||||
}
|
||||
|
||||
|
@ -257,7 +261,7 @@ TEST(xpath_api_evaluate_string)
|
|||
// test for just enough space
|
||||
std::basic_string<char_t> s1 = base;
|
||||
CHECK(q.evaluate_string(&s1[0], 11, xml_node()) == 11 && memcmp(&s1[0], STR("0123456789\0xxxxx"), 16 * sizeof(char_t)) == 0);
|
||||
|
||||
|
||||
// test for just not enough space
|
||||
std::basic_string<char_t> s2 = base;
|
||||
CHECK(q.evaluate_string(&s2[0], 10, xml_node()) == 11 && memcmp(&s2[0], STR("012345678\0xxxxxx"), 16 * sizeof(char_t)) == 0);
|
||||
|
@ -291,7 +295,7 @@ TEST(xpath_api_return_type)
|
|||
TEST(xpath_api_query_bool)
|
||||
{
|
||||
xpath_query q(STR("node"));
|
||||
|
||||
|
||||
CHECK(q);
|
||||
CHECK((!q) == false);
|
||||
}
|
||||
|
@ -300,7 +304,7 @@ TEST(xpath_api_query_bool)
|
|||
TEST(xpath_api_query_bool_fail)
|
||||
{
|
||||
xpath_query q(STR(""));
|
||||
|
||||
|
||||
CHECK((q ? true : false) == false);
|
||||
CHECK((!q) == true);
|
||||
}
|
||||
|
@ -356,6 +360,7 @@ TEST(xpath_api_exception_what)
|
|||
CHECK(e.what()[0] != 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST(xpath_api_node_set_ctor_out_of_memory)
|
||||
{
|
||||
|
@ -363,15 +368,7 @@ TEST(xpath_api_node_set_ctor_out_of_memory)
|
|||
|
||||
xpath_node data[2];
|
||||
|
||||
try
|
||||
{
|
||||
xpath_node_set ns(data, data + 2);
|
||||
|
||||
CHECK_FORCE_FAIL("Expected out of memory exception");
|
||||
}
|
||||
catch (const std::bad_alloc&)
|
||||
{
|
||||
}
|
||||
CHECK_ALLOC_FAIL(xpath_node_set ns(data, data + 2));
|
||||
}
|
||||
|
||||
TEST(xpath_api_node_set_copy_ctor_out_of_memory)
|
||||
|
@ -381,49 +378,267 @@ TEST(xpath_api_node_set_copy_ctor_out_of_memory)
|
|||
|
||||
test_runner::_memory_fail_threshold = 1;
|
||||
|
||||
try
|
||||
{
|
||||
xpath_node_set copy = ns;
|
||||
|
||||
CHECK_FORCE_FAIL("Expected out of memory exception");
|
||||
}
|
||||
catch (const std::bad_alloc&)
|
||||
{
|
||||
}
|
||||
CHECK_ALLOC_FAIL(xpath_node_set copy = ns);
|
||||
}
|
||||
|
||||
TEST_XML(xpath_api_node_set_assign_out_of_memory_preserve, "<node><a/><b/></node>")
|
||||
{
|
||||
xpath_node_set ns = doc.select_nodes(STR("node/*"));
|
||||
CHECK(ns.size() == 2);
|
||||
CHECK(ns.type() == xpath_node_set::type_sorted);
|
||||
|
||||
xpath_node_set nsall = doc.select_nodes(STR("//*"));
|
||||
nsall.sort(true);
|
||||
CHECK(nsall.size() == 3);
|
||||
CHECK(nsall.type() == xpath_node_set::type_sorted_reverse);
|
||||
|
||||
test_runner::_memory_fail_threshold = 1;
|
||||
|
||||
try
|
||||
{
|
||||
ns = nsall;
|
||||
CHECK_ALLOC_FAIL(ns = nsall);
|
||||
|
||||
CHECK_FORCE_FAIL("Expected out of memory exception");
|
||||
}
|
||||
catch (const std::bad_alloc&)
|
||||
{
|
||||
}
|
||||
|
||||
CHECK(ns.size() == 2 && ns[0] == doc.child(STR("node")).child(STR("a")) && ns[1] == doc.child(STR("node")).child(STR("b")));
|
||||
CHECK(ns.size() == 2);
|
||||
CHECK(ns.type() == xpath_node_set::type_sorted);
|
||||
CHECK(ns[0] == doc.child(STR("node")).child(STR("a")) && ns[1] == doc.child(STR("node")).child(STR("b")));
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST_XML(xpath_api_deprecated_select_single_node, "<node><head/><foo id='1'/><foo/><tail/></node>")
|
||||
TEST(xpath_api_empty)
|
||||
{
|
||||
xpath_node n1 = doc.select_single_node(STR("node/foo"));
|
||||
xml_node c;
|
||||
|
||||
xpath_query q(STR("node/foo"));
|
||||
xpath_node n2 = doc.select_single_node(q);
|
||||
xpath_query q;
|
||||
CHECK(!q);
|
||||
CHECK(!q.evaluate_boolean(c));
|
||||
}
|
||||
|
||||
CHECK(n1.node().attribute(STR("id")).as_int() == 1);
|
||||
CHECK(n2.node().attribute(STR("id")).as_int() == 1);
|
||||
#ifdef PUGIXML_HAS_MOVE
|
||||
TEST_XML(xpath_api_nodeset_move_ctor, "<node><foo/><foo/><bar/></node>")
|
||||
{
|
||||
xpath_node_set set = doc.select_nodes(STR("node/bar/preceding::*"));
|
||||
|
||||
CHECK(set.size() == 2);
|
||||
CHECK(set.type() == xpath_node_set::type_sorted_reverse);
|
||||
|
||||
test_runner::_memory_fail_threshold = 1;
|
||||
|
||||
xpath_node_set move = std::move(set);
|
||||
|
||||
CHECK(set.size() == 0);
|
||||
CHECK(set.type() == xpath_node_set::type_unsorted);
|
||||
|
||||
CHECK(move.size() == 2);
|
||||
CHECK(move.type() == xpath_node_set::type_sorted_reverse);
|
||||
CHECK(move[1] == doc.first_child().first_child());
|
||||
}
|
||||
|
||||
|
||||
TEST_XML(xpath_api_nodeset_move_ctor_single, "<node><foo/><foo/><bar/></node>")
|
||||
{
|
||||
xpath_node_set set = doc.select_nodes(STR("node/bar"));
|
||||
|
||||
CHECK(set.size() == 1);
|
||||
CHECK(set.type() == xpath_node_set::type_sorted);
|
||||
|
||||
test_runner::_memory_fail_threshold = 1;
|
||||
|
||||
xpath_node_set move = std::move(set);
|
||||
|
||||
CHECK(set.size() == 0);
|
||||
CHECK(set.type() == xpath_node_set::type_unsorted);
|
||||
|
||||
CHECK(move.size() == 1);
|
||||
CHECK(move.type() == xpath_node_set::type_sorted);
|
||||
CHECK(move[0] == doc.first_child().last_child());
|
||||
}
|
||||
|
||||
TEST(xpath_api_nodeset_move_ctor_empty)
|
||||
{
|
||||
xpath_node_set set;
|
||||
set.sort();
|
||||
|
||||
CHECK(set.size() == 0);
|
||||
CHECK(set.type() == xpath_node_set::type_sorted);
|
||||
|
||||
test_runner::_memory_fail_threshold = 1;
|
||||
|
||||
xpath_node_set move = std::move(set);
|
||||
|
||||
CHECK(set.size() == 0);
|
||||
CHECK(set.type() == xpath_node_set::type_unsorted);
|
||||
|
||||
CHECK(move.size() == 0);
|
||||
CHECK(move.type() == xpath_node_set::type_sorted);
|
||||
}
|
||||
|
||||
TEST_XML(xpath_api_nodeset_move_assign, "<node><foo/><foo/><bar/></node>")
|
||||
{
|
||||
xpath_node_set set = doc.select_nodes(STR("node/bar/preceding::*"));
|
||||
|
||||
CHECK(set.size() == 2);
|
||||
CHECK(set.type() == xpath_node_set::type_sorted_reverse);
|
||||
|
||||
test_runner::_memory_fail_threshold = 1;
|
||||
|
||||
xpath_node_set move;
|
||||
|
||||
CHECK(move.size() == 0);
|
||||
CHECK(move.type() == xpath_node_set::type_unsorted);
|
||||
|
||||
move = std::move(set);
|
||||
|
||||
CHECK(set.size() == 0);
|
||||
CHECK(set.type() == xpath_node_set::type_unsorted);
|
||||
|
||||
CHECK(move.size() == 2);
|
||||
CHECK(move.type() == xpath_node_set::type_sorted_reverse);
|
||||
CHECK(move[1] == doc.first_child().first_child());
|
||||
}
|
||||
|
||||
TEST_XML(xpath_api_nodeset_move_assign_destroy, "<node><foo/><foo/><bar/></node>")
|
||||
{
|
||||
xpath_node_set set = doc.select_nodes(STR("node/bar/preceding::*"));
|
||||
|
||||
CHECK(set.size() == 2);
|
||||
CHECK(set.type() == xpath_node_set::type_sorted_reverse);
|
||||
|
||||
xpath_node_set all = doc.select_nodes(STR("//*"));
|
||||
|
||||
CHECK(all.size() == 4);
|
||||
|
||||
test_runner::_memory_fail_threshold = 1;
|
||||
|
||||
all = std::move(set);
|
||||
|
||||
CHECK(set.size() == 0);
|
||||
CHECK(set.type() == xpath_node_set::type_unsorted);
|
||||
|
||||
CHECK(all.size() == 2);
|
||||
CHECK(all.type() == xpath_node_set::type_sorted_reverse);
|
||||
CHECK(all[1] == doc.first_child().first_child());
|
||||
}
|
||||
|
||||
TEST_XML(xpath_api_nodeset_move_assign_single, "<node><foo/><foo/><bar/></node>")
|
||||
{
|
||||
xpath_node_set set = doc.select_nodes(STR("node/bar"));
|
||||
|
||||
CHECK(set.size() == 1);
|
||||
CHECK(set.type() == xpath_node_set::type_sorted);
|
||||
|
||||
test_runner::_memory_fail_threshold = 1;
|
||||
|
||||
xpath_node_set move;
|
||||
|
||||
CHECK(move.size() == 0);
|
||||
CHECK(move.type() == xpath_node_set::type_unsorted);
|
||||
|
||||
move = std::move(set);
|
||||
|
||||
CHECK(set.size() == 0);
|
||||
CHECK(set.type() == xpath_node_set::type_unsorted);
|
||||
|
||||
CHECK(move.size() == 1);
|
||||
CHECK(move.type() == xpath_node_set::type_sorted);
|
||||
CHECK(move[0] == doc.first_child().last_child());
|
||||
}
|
||||
|
||||
TEST(xpath_api_nodeset_move_assign_empty)
|
||||
{
|
||||
xpath_node_set set;
|
||||
set.sort();
|
||||
|
||||
CHECK(set.size() == 0);
|
||||
CHECK(set.type() == xpath_node_set::type_sorted);
|
||||
|
||||
test_runner::_memory_fail_threshold = 1;
|
||||
|
||||
xpath_node_set move;
|
||||
|
||||
CHECK(move.size() == 0);
|
||||
CHECK(move.type() == xpath_node_set::type_unsorted);
|
||||
|
||||
move = std::move(set);
|
||||
|
||||
CHECK(set.size() == 0);
|
||||
CHECK(set.type() == xpath_node_set::type_unsorted);
|
||||
|
||||
CHECK(move.size() == 0);
|
||||
CHECK(move.type() == xpath_node_set::type_sorted);
|
||||
}
|
||||
|
||||
TEST_XML(xpath_api_nodeset_move_assign_self, "<node><foo/><foo/><bar/></node>")
|
||||
{
|
||||
xpath_node_set set = doc.select_nodes(STR("node/bar"));
|
||||
|
||||
CHECK(set.size() == 1);
|
||||
CHECK(set.type() == xpath_node_set::type_sorted);
|
||||
|
||||
test_runner::_memory_fail_threshold = 1;
|
||||
|
||||
set = std::move(*&set);
|
||||
}
|
||||
|
||||
TEST(xpath_api_query_move)
|
||||
{
|
||||
xml_node c;
|
||||
|
||||
xpath_query q1(STR("true()"));
|
||||
xpath_query q4(STR("true() and false()"));
|
||||
|
||||
test_runner::_memory_fail_threshold = 1;
|
||||
|
||||
CHECK(q1);
|
||||
CHECK(q1.evaluate_boolean(c));
|
||||
|
||||
xpath_query q2 = std::move(q1);
|
||||
CHECK(!q1);
|
||||
CHECK(!q1.evaluate_boolean(c));
|
||||
CHECK(q2);
|
||||
CHECK(q2.evaluate_boolean(c));
|
||||
|
||||
xpath_query q3;
|
||||
CHECK(!q3);
|
||||
CHECK(!q3.evaluate_boolean(c));
|
||||
|
||||
q3 = std::move(q2);
|
||||
CHECK(!q2);
|
||||
CHECK(!q2.evaluate_boolean(c));
|
||||
CHECK(q3);
|
||||
CHECK(q3.evaluate_boolean(c));
|
||||
|
||||
CHECK(q4);
|
||||
CHECK(!q4.evaluate_boolean(c));
|
||||
|
||||
q4 = std::move(q3);
|
||||
|
||||
CHECK(!q3);
|
||||
CHECK(!q3.evaluate_boolean(c));
|
||||
CHECK(q4);
|
||||
CHECK(q4.evaluate_boolean(c));
|
||||
|
||||
q4 = std::move(*&q4);
|
||||
|
||||
CHECK(q4);
|
||||
CHECK(q4.evaluate_boolean(c));
|
||||
}
|
||||
|
||||
TEST(xpath_api_query_vector)
|
||||
{
|
||||
std::vector<xpath_query> qv;
|
||||
|
||||
for (int i = 0; i < 10; ++i)
|
||||
{
|
||||
char_t expr[2];
|
||||
expr[0] = char_t('0' + i);
|
||||
expr[1] = 0;
|
||||
|
||||
qv.push_back(xpath_query(expr));
|
||||
}
|
||||
|
||||
double result = 0;
|
||||
|
||||
for (size_t i = 0; i < qv.size(); ++i)
|
||||
result += qv[i].evaluate_number(xml_node());
|
||||
|
||||
CHECK(result == 45);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -1,12 +1,16 @@
|
|||
#ifndef PUGIXML_NO_XPATH
|
||||
|
||||
#include "common.hpp"
|
||||
#include "test.hpp"
|
||||
|
||||
#include <string>
|
||||
|
||||
using namespace pugi;
|
||||
|
||||
TEST_XML(xpath_number_number, "<node>123</node>")
|
||||
{
|
||||
xml_node c;
|
||||
xml_node n = doc.child(STR("node")).first_child();
|
||||
|
||||
|
||||
// number with 0 arguments
|
||||
CHECK_XPATH_NUMBER_NAN(c, STR("number()"));
|
||||
CHECK_XPATH_NUMBER(n, STR("number()"), 123);
|
||||
|
@ -35,7 +39,7 @@ TEST_XML(xpath_number_number, "<node>123</node>")
|
|||
|
||||
// number with 1 number argument
|
||||
CHECK_XPATH_NUMBER(c, STR("number(1)"), 1);
|
||||
|
||||
|
||||
// number with 2 arguments
|
||||
CHECK_XPATH_FAIL(STR("number(1, 2)"));
|
||||
}
|
||||
|
@ -44,21 +48,21 @@ TEST_XML(xpath_number_sum, "<node>123<child>789</child></node><node/>")
|
|||
{
|
||||
xml_node c;
|
||||
xml_node n = doc.child(STR("node"));
|
||||
|
||||
|
||||
// sum with 0 arguments
|
||||
CHECK_XPATH_FAIL(STR("sum()"));
|
||||
|
||||
// sum with 1 argument
|
||||
CHECK_XPATH_NUMBER(c, STR("sum(.)"), 0);
|
||||
CHECK_XPATH_NUMBER(n, STR("sum(.)"), 123789); // 123 .. 789
|
||||
|
||||
|
||||
CHECK_XPATH_NUMBER(n, STR("sum(./descendant-or-self::node())"), 125490); // node + 123 + child + 789 = 123789 + 123 + 789 + 789 = 125490
|
||||
CHECK_XPATH_NUMBER(n, STR("sum(.//node())"), 1701); // 123 + child + 789 = 123 + 789 + 789
|
||||
CHECK_XPATH_NUMBER_NAN(doc.last_child(), STR("sum(.)"));
|
||||
|
||||
// sum with 2 arguments
|
||||
CHECK_XPATH_FAIL(STR("sum(1, 2)"));
|
||||
|
||||
|
||||
// sum with 1 non-node-set argument
|
||||
CHECK_XPATH_FAIL(STR("sum(1)"));
|
||||
}
|
||||
|
@ -155,7 +159,7 @@ TEST(xpath_number_round)
|
|||
TEST_XML(xpath_boolean_boolean, "<node />")
|
||||
{
|
||||
xml_node c;
|
||||
|
||||
|
||||
// boolean with 0 arguments
|
||||
CHECK_XPATH_FAIL(STR("boolean()"));
|
||||
|
||||
|
@ -182,14 +186,14 @@ TEST_XML(xpath_boolean_boolean, "<node />")
|
|||
TEST(xpath_boolean_not)
|
||||
{
|
||||
xml_node c;
|
||||
|
||||
|
||||
// not with 0 arguments
|
||||
CHECK_XPATH_FAIL(STR("not()"));
|
||||
|
||||
// not with 1 argument
|
||||
CHECK_XPATH_BOOLEAN(c, STR("not(true())"), false);
|
||||
CHECK_XPATH_BOOLEAN(c, STR("not(false())"), true);
|
||||
|
||||
|
||||
// boolean with 2 arguments
|
||||
CHECK_XPATH_FAIL(STR("not(1, 2)"));
|
||||
}
|
||||
|
@ -197,7 +201,7 @@ TEST(xpath_boolean_not)
|
|||
TEST(xpath_boolean_true)
|
||||
{
|
||||
xml_node c;
|
||||
|
||||
|
||||
// true with 0 arguments
|
||||
CHECK_XPATH_BOOLEAN(c, STR("true()"), true);
|
||||
|
||||
|
@ -208,7 +212,7 @@ TEST(xpath_boolean_true)
|
|||
TEST(xpath_boolean_false)
|
||||
{
|
||||
xml_node c;
|
||||
|
||||
|
||||
// false with 0 arguments
|
||||
CHECK_XPATH_BOOLEAN(c, STR("false()"), false);
|
||||
|
||||
|
@ -219,7 +223,7 @@ TEST(xpath_boolean_false)
|
|||
TEST_XML(xpath_boolean_lang, "<node xml:lang='en'><child xml:lang='zh-UK'><subchild attr=''/></child></node><foo><bar/></foo>")
|
||||
{
|
||||
xml_node c;
|
||||
|
||||
|
||||
// lang with 0 arguments
|
||||
CHECK_XPATH_FAIL(STR("lang()"));
|
||||
|
||||
|
@ -228,7 +232,7 @@ TEST_XML(xpath_boolean_lang, "<node xml:lang='en'><child xml:lang='zh-UK'><subch
|
|||
CHECK_XPATH_BOOLEAN(doc.child(STR("foo")), STR("lang('en')"), false);
|
||||
CHECK_XPATH_BOOLEAN(doc.child(STR("foo")), STR("lang('')"), false);
|
||||
CHECK_XPATH_BOOLEAN(doc.child(STR("foo")).child(STR("bar")), STR("lang('en')"), false);
|
||||
|
||||
|
||||
// lang with 1 argument, same language/prefix
|
||||
CHECK_XPATH_BOOLEAN(doc.child(STR("node")), STR("lang('en')"), true);
|
||||
CHECK_XPATH_BOOLEAN(doc.child(STR("node")).child(STR("child")), STR("lang('zh-uk')"), true);
|
||||
|
@ -373,7 +377,7 @@ TEST(xpath_string_substring_before)
|
|||
|
||||
// substring-before with 1 argument
|
||||
CHECK_XPATH_FAIL(STR("substring-before('a')"));
|
||||
|
||||
|
||||
// substring-before with 2 arguments
|
||||
CHECK_XPATH_STRING(c, STR("substring-before('abc', 'abc')"), STR(""));
|
||||
CHECK_XPATH_STRING(c, STR("substring-before('abc', 'a')"), STR(""));
|
||||
|
@ -382,7 +386,7 @@ TEST(xpath_string_substring_before)
|
|||
CHECK_XPATH_STRING(c, STR("substring-before('abc', 'c')"), STR("ab"));
|
||||
CHECK_XPATH_STRING(c, STR("substring-before('abc', '')"), STR(""));
|
||||
CHECK_XPATH_STRING(c, STR("substring-before('', '')"), STR(""));
|
||||
|
||||
|
||||
// substring-before with 2 arguments, from W3C standard
|
||||
CHECK_XPATH_STRING(c, STR("substring-before(\"1999/04/01\",\"/\")"), STR("1999"));
|
||||
|
||||
|
@ -399,7 +403,7 @@ TEST(xpath_string_substring_after)
|
|||
|
||||
// substring-after with 1 argument
|
||||
CHECK_XPATH_FAIL(STR("substring-after('a')"));
|
||||
|
||||
|
||||
// substring-after with 2 arguments
|
||||
CHECK_XPATH_STRING(c, STR("substring-after('abc', 'abc')"), STR(""));
|
||||
CHECK_XPATH_STRING(c, STR("substring-after('abc', 'a')"), STR("bc"));
|
||||
|
@ -430,10 +434,10 @@ TEST(xpath_string_substring)
|
|||
|
||||
// substring with 0 arguments
|
||||
CHECK_XPATH_FAIL(STR("substring()"));
|
||||
|
||||
|
||||
// substring with 1 argument
|
||||
CHECK_XPATH_FAIL(STR("substring('')"));
|
||||
|
||||
|
||||
// substring with 2 arguments
|
||||
CHECK_XPATH_STRING(c, STR("substring('abcd', 2)"), STR("bcd"));
|
||||
CHECK_XPATH_STRING(c, STR("substring('abcd', 1)"), STR("abcd"));
|
||||
|
@ -517,7 +521,7 @@ TEST_XML_FLAGS(xpath_string_normalize_space, "<node> \t\r\rval1 \rval2\r\nval3\
|
|||
// normalize-space with 0 arguments
|
||||
CHECK_XPATH_STRING(c, STR("normalize-space()"), STR(""));
|
||||
CHECK_XPATH_STRING(n, STR("normalize-space()"), STR("val1 val2 val3 val4"));
|
||||
|
||||
|
||||
// normalize-space with 1 argument
|
||||
CHECK_XPATH_STRING(c, STR("normalize-space('')"), STR(""));
|
||||
CHECK_XPATH_STRING(c, STR("normalize-space('abcd')"), STR("abcd"));
|
||||
|
@ -526,7 +530,7 @@ TEST_XML_FLAGS(xpath_string_normalize_space, "<node> \t\r\rval1 \rval2\r\nval3\
|
|||
CHECK_XPATH_STRING(c, STR("normalize-space('ab\r\n\tcd')"), STR("ab cd"));
|
||||
CHECK_XPATH_STRING(c, STR("normalize-space('ab cd')"), STR("ab cd"));
|
||||
CHECK_XPATH_STRING(c, STR("normalize-space('\07')"), STR("\07"));
|
||||
|
||||
|
||||
// normalize-space with 2 arguments
|
||||
CHECK_XPATH_FAIL(STR("normalize-space(1, 2)"));
|
||||
}
|
||||
|
@ -537,13 +541,13 @@ TEST(xpath_string_translate)
|
|||
|
||||
// translate with 0 arguments
|
||||
CHECK_XPATH_FAIL(STR("translate()"));
|
||||
|
||||
|
||||
// translate with 1 argument
|
||||
CHECK_XPATH_FAIL(STR("translate('a')"));
|
||||
|
||||
// translate with 2 arguments
|
||||
CHECK_XPATH_FAIL(STR("translate('a', 'b')"));
|
||||
|
||||
|
||||
// translate with 3 arguments
|
||||
CHECK_XPATH_STRING(c, STR("translate('abc', '', '')"), STR("abc"));
|
||||
CHECK_XPATH_STRING(c, STR("translate('abc', '', 'foo')"), STR("abc"));
|
||||
|
@ -566,6 +570,7 @@ TEST(xpath_string_translate_table)
|
|||
|
||||
CHECK_XPATH_STRING(c, STR("translate('abcd\xe9 ', 'abc', 'ABC')"), STR("ABCd\xe9 "));
|
||||
CHECK_XPATH_STRING(c, STR("translate('abcd\xe9 ', 'abc\xe9', 'ABC!')"), STR("ABCd! "));
|
||||
CHECK_XPATH_STRING(c, STR("translate('abcd! ', 'abc!', 'ABC\xe9')"), STR("ABCd\xe9 "));
|
||||
CHECK_XPATH_STRING(c, STR("translate('abcde', concat('abc', 'd'), 'ABCD')"), STR("ABCDe"));
|
||||
CHECK_XPATH_STRING(c, STR("translate('abcde', 'abcd', concat('ABC', 'D'))"), STR("ABCDe"));
|
||||
}
|
||||
|
@ -604,7 +609,7 @@ TEST_XML(xpath_nodeset_position, "<node><c1/><c1/><c2/><c3/><c3/><c3/><c3/></nod
|
|||
CHECK_XPATH_NODESET(n, STR("c1[position() = 3]"));
|
||||
CHECK_XPATH_NODESET(n, STR("c2/preceding-sibling::node()[position() = 1]")) % 4;
|
||||
CHECK_XPATH_NODESET(n, STR("c2/preceding-sibling::node()[position() = 2]")) % 3;
|
||||
|
||||
|
||||
// position with 1 argument
|
||||
CHECK_XPATH_FAIL(STR("position(c)"));
|
||||
}
|
||||
|
@ -640,7 +645,7 @@ TEST_XML(xpath_nodeset_id, "<node id='foo'/>")
|
|||
|
||||
// id with 0 arguments
|
||||
CHECK_XPATH_FAIL(STR("id()"));
|
||||
|
||||
|
||||
// id with 1 argument - no DTD => no id
|
||||
CHECK_XPATH_NODESET(n, STR("id('foo')"));
|
||||
|
||||
|
@ -656,7 +661,7 @@ TEST_XML_FLAGS(xpath_nodeset_local_name, "<node xmlns:foo='http://foo'><c1>text<
|
|||
// local-name with 0 arguments
|
||||
CHECK_XPATH_STRING(c, STR("local-name()"), STR(""));
|
||||
CHECK_XPATH_STRING(n, STR("local-name()"), STR("node"));
|
||||
|
||||
|
||||
// local-name with 1 non-node-set argument
|
||||
CHECK_XPATH_FAIL(STR("local-name(1)"));
|
||||
|
||||
|
@ -681,7 +686,7 @@ TEST_XML_FLAGS(xpath_nodeset_namespace_uri, "<node xmlns:foo='http://foo'><c1>te
|
|||
// namespace-uri with 0 arguments
|
||||
CHECK_XPATH_STRING(c, STR("namespace-uri()"), STR(""));
|
||||
CHECK_XPATH_STRING(n.child(STR("c2")).child(STR("foo:child")), STR("namespace-uri()"), STR("http://foo2"));
|
||||
|
||||
|
||||
// namespace-uri with 1 non-node-set argument
|
||||
CHECK_XPATH_FAIL(STR("namespace-uri(1)"));
|
||||
|
||||
|
@ -710,7 +715,7 @@ TEST_XML_FLAGS(xpath_nodeset_name, "<node xmlns:foo='http://foo'><c1>text</c1><c
|
|||
// name with 0 arguments
|
||||
CHECK_XPATH_STRING(c, STR("name()"), STR(""));
|
||||
CHECK_XPATH_STRING(n, STR("name()"), STR("node"));
|
||||
|
||||
|
||||
// name with 1 non-node-set argument
|
||||
CHECK_XPATH_FAIL(STR("name(1)"));
|
||||
|
||||
|
@ -733,7 +738,7 @@ TEST(xpath_function_arguments)
|
|||
|
||||
// conversion to string
|
||||
CHECK_XPATH_NUMBER(c, STR("string-length(12)"), 2);
|
||||
|
||||
|
||||
// conversion to number
|
||||
CHECK_XPATH_NUMBER(c, STR("round('1.2')"), 1);
|
||||
CHECK_XPATH_NUMBER(c, STR("round('1.7')"), 2);
|
||||
|
@ -741,13 +746,13 @@ TEST(xpath_function_arguments)
|
|||
// conversion to boolean
|
||||
CHECK_XPATH_BOOLEAN(c, STR("not('1')"), false);
|
||||
CHECK_XPATH_BOOLEAN(c, STR("not('')"), true);
|
||||
|
||||
|
||||
// conversion to node set
|
||||
CHECK_XPATH_FAIL(STR("sum(1)"));
|
||||
|
||||
// expression evaluation
|
||||
CHECK_XPATH_NUMBER(c, STR("round((2 + 2 * 2) div 4)"), 2);
|
||||
|
||||
|
||||
// empty expressions
|
||||
CHECK_XPATH_FAIL(STR("round(,)"));
|
||||
CHECK_XPATH_FAIL(STR("substring(,)"));
|
||||
|
@ -799,4 +804,41 @@ TEST_XML(xpath_string_concat_translate, "<node>foobar</node>")
|
|||
CHECK_XPATH_STRING(doc, STR("concat('a', 'b', 'c', translate(node, 'o', 'a'), 'd')"), STR("abcfaabard"));
|
||||
}
|
||||
|
||||
TEST(xpath_unknown_functions)
|
||||
{
|
||||
char_t query[] = STR("a()");
|
||||
|
||||
for (char ch = 'a'; ch <= 'z'; ++ch)
|
||||
{
|
||||
query[0] = ch;
|
||||
CHECK_XPATH_FAIL(query);
|
||||
|
||||
query[0] = char_t(ch - 32);
|
||||
CHECK_XPATH_FAIL(query);
|
||||
}
|
||||
}
|
||||
|
||||
TEST(xpath_string_translate_table_out_of_memory)
|
||||
{
|
||||
xml_node c;
|
||||
|
||||
// our goal is to generate translate table OOM without generating query OOM
|
||||
std::basic_string<char_t> query = STR("concat(");
|
||||
|
||||
size_t count = 20;
|
||||
|
||||
for (size_t i = 0; i < count; ++i)
|
||||
{
|
||||
if (i != 0) query += STR(",");
|
||||
query += STR("translate('a','a','A')");
|
||||
}
|
||||
|
||||
query += STR(")");
|
||||
|
||||
std::basic_string<char_t> result(count, 'A');
|
||||
|
||||
test_runner::_memory_fail_threshold = 5000;
|
||||
|
||||
CHECK_ALLOC_FAIL(CHECK_XPATH_STRING(c, query.c_str(), result.c_str()));
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#ifndef PUGIXML_NO_XPATH
|
||||
|
||||
#include "common.hpp"
|
||||
#include "test.hpp"
|
||||
|
||||
using namespace pugi;
|
||||
|
||||
TEST(xpath_operators_arithmetic)
|
||||
{
|
||||
|
@ -63,7 +65,7 @@ TEST(xpath_operators_arithmetic_specials)
|
|||
CHECK_XPATH_STRING(c, STR("1 div 0 + 100"), STR("Infinity"));
|
||||
CHECK_XPATH_STRING(c, STR("-1 div 0 + 100"), STR("-Infinity"));
|
||||
CHECK_XPATH_STRING(c, STR("0 div 0 + 100"), STR("NaN"));
|
||||
|
||||
|
||||
// unary - and multiplication clarifications from recommendations errata
|
||||
CHECK_XPATH_STRING(c, STR("1 div -0"), STR("-Infinity"));
|
||||
CHECK_XPATH_STRING(c, STR("-1 div -0"), STR("Infinity"));
|
||||
|
@ -99,7 +101,7 @@ TEST(xpath_operators_logical)
|
|||
CHECK_XPATH_BOOLEAN(c, STR("true() and false()"), false);
|
||||
CHECK_XPATH_BOOLEAN(c, STR("false() and false()"), false);
|
||||
CHECK_XPATH_BOOLEAN(c, STR("false() and true()"), false);
|
||||
|
||||
|
||||
// boolean conversion
|
||||
CHECK_XPATH_BOOLEAN(c, STR("1 or ''"), true);
|
||||
CHECK_XPATH_BOOLEAN(c, STR("1 and ''"), false);
|
||||
|
@ -192,7 +194,7 @@ TEST_XML(xpath_operators_equality_node_set_node_set, "<node><c1><v>a</v><v>b</v>
|
|||
CHECK_XPATH_BOOLEAN(n, STR("c1/v != c3/v"), true);
|
||||
CHECK_XPATH_BOOLEAN(n, STR("c2/v != c3/v"), true);
|
||||
CHECK_XPATH_BOOLEAN(n, STR("c1/v != c4/v"), true);
|
||||
CHECK_XPATH_BOOLEAN(n, STR("c1/v != c5/v"), true); // (a, b) != (a, b), since a != b, as per XPath spec (comparison operators are so not intutive)
|
||||
CHECK_XPATH_BOOLEAN(n, STR("c1/v != c5/v"), true); // (a, b) != (a, b), since a != b, as per XPath spec (comparison operators are so not intuitive)
|
||||
CHECK_XPATH_BOOLEAN(n, STR("c3/v != c6/v"), false);
|
||||
CHECK_XPATH_BOOLEAN(n, STR("c1/v != x"), false);
|
||||
CHECK_XPATH_BOOLEAN(n, STR("x != c1/v"), false);
|
||||
|
@ -225,7 +227,7 @@ TEST_XML(xpath_operators_equality_node_set_primitive, "<node><c1><v>1</v><v>-1</
|
|||
CHECK_XPATH_BOOLEAN(n, STR("c2/v != 1"), true);
|
||||
CHECK_XPATH_BOOLEAN(n, STR("1 != c2/v"), true);
|
||||
#endif
|
||||
|
||||
|
||||
// node set vs string
|
||||
CHECK_XPATH_BOOLEAN(c, STR("x = '1'"), false);
|
||||
CHECK_XPATH_BOOLEAN(c, STR("x != '1'"), false);
|
||||
|
@ -332,11 +334,21 @@ TEST_XML(xpath_operators_inequality_node_set_node_set, "<node><c1><v>1</v><v>-1<
|
|||
CHECK_XPATH_BOOLEAN(n, STR("c1/v < c3/v"), true);
|
||||
CHECK_XPATH_BOOLEAN(n, STR("c1/v <= c3/v"), true);
|
||||
|
||||
CHECK_XPATH_BOOLEAN(n, STR("c1/v[1] > c1/v[1]"), false);
|
||||
CHECK_XPATH_BOOLEAN(n, STR("c1/v[1] < c1/v[1]"), false);
|
||||
CHECK_XPATH_BOOLEAN(n, STR("c1/v[1] >= c1/v[1]"), true);
|
||||
CHECK_XPATH_BOOLEAN(n, STR("c1/v[1] <= c1/v[1]"), true);
|
||||
|
||||
#ifndef MSVC6_NAN_BUG
|
||||
CHECK_XPATH_BOOLEAN(n, STR("c1/v > c2/v"), false);
|
||||
CHECK_XPATH_BOOLEAN(n, STR("c1/v >= c2/v"), true);
|
||||
CHECK_XPATH_BOOLEAN(n, STR("c1/v < c2/v"), true);
|
||||
CHECK_XPATH_BOOLEAN(n, STR("c1/v <= c2/v"), true);
|
||||
|
||||
CHECK_XPATH_BOOLEAN(n, STR("c2/v[2] < c2/v[2]"), false);
|
||||
CHECK_XPATH_BOOLEAN(n, STR("c2/v[2] > c2/v[2]"), false);
|
||||
CHECK_XPATH_BOOLEAN(n, STR("c2/v[2] <= c2/v[2]"), false);
|
||||
CHECK_XPATH_BOOLEAN(n, STR("c2/v[2] >= c2/v[2]"), false);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -423,6 +435,24 @@ TEST_XML(xpath_operators_union, "<node><employee/><employee secretary=''/><emplo
|
|||
CHECK_XPATH_NODESET(n, STR(". | tail/preceding-sibling::employee | .")) % 2 % 3 % 4 % 6 % 8 % 11;
|
||||
}
|
||||
|
||||
TEST_XML(xpath_operators_union_order, "<node />")
|
||||
{
|
||||
xml_node n = doc.child(STR("node"));
|
||||
|
||||
n.append_child(STR("c"));
|
||||
n.prepend_child(STR("b"));
|
||||
n.append_child(STR("d"));
|
||||
n.prepend_child(STR("a"));
|
||||
|
||||
xpath_node_set ns = n.select_nodes(STR("d | d | b | c | b | a | c | d | b"));
|
||||
|
||||
CHECK(ns.size() == 4);
|
||||
CHECK_STRING(ns[0].node().name(), STR("d"));
|
||||
CHECK_STRING(ns[1].node().name(), STR("b"));
|
||||
CHECK_STRING(ns[2].node().name(), STR("c"));
|
||||
CHECK_STRING(ns[3].node().name(), STR("a"));
|
||||
}
|
||||
|
||||
TEST(xpath_operators_union_error)
|
||||
{
|
||||
CHECK_XPATH_FAIL(STR(". | true()"));
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue