Compare commits
754 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6c51590369 | |||
|
|
c824f707cf | ||
| 47c5b798b3 | |||
| 8651ff6e1e | |||
| 629edea991 | |||
|
|
1e10ce8518 | ||
| 4f8f17ad48 | |||
| 148518984e | |||
| 33150e34d6 | |||
| af60a5719e | |||
| 31557cfc33 | |||
| 78c0cd5b0d | |||
| 412534d0be | |||
|
|
0f6aa8d7ae | ||
|
|
2c745c63d3 | ||
|
|
efd80c1287 | ||
|
|
01f649fd88 | ||
|
|
f23aeb6412 | ||
|
|
1a4596c79b | ||
|
|
b16e4aa570 | ||
|
|
5255b15fa9 | ||
|
|
57048373f4 | ||
|
|
9e06fb2ab8 | ||
|
|
f2405e0ccd | ||
|
|
6e3a7deb6e | ||
|
|
f254b599c0 | ||
| 99a05b95ba | |||
| 54dd43c38a | |||
| 903f925a79 | |||
| 80709578d6 | |||
| c0d5b7c968 | |||
| 7bea163f46 | |||
| 8992dbc515 | |||
| c2d3ea6138 | |||
| 9e336deb49 | |||
| 0160ce05dd | |||
| 7d089a88c2 | |||
| ab0bc7b314 | |||
| 0e3e97a7fd | |||
| b790c7fd21 | |||
| 9424b1e369 | |||
| 64463df552 | |||
|
|
61f90bba38 | ||
|
|
fac3dd3946 | ||
|
|
e1b583a2b3 | ||
|
|
8c8dfdd4a3 | ||
|
|
857397e226 | ||
|
|
94340c1c01 | ||
| 8b60ab08e3 | |||
|
|
28e51cc314 | ||
|
|
a7c8d40b3e | ||
| d4c0ff03b4 | |||
| 7fbfda3a66 | |||
| 9e467689df | |||
| dd5c89e31c | |||
| fffa763d05 | |||
| d015c065f6 | |||
| 8ea443c115 | |||
| 019393fdb1 | |||
| da8028f8b3 | |||
| 20ed000879 | |||
|
|
24620b228c | ||
|
|
9c7e29b836 | ||
|
|
a0e9a41e21 | ||
|
|
dd9aff03d3 | ||
|
|
dc35925eb0 | ||
| a1a620a9c3 | |||
| d8ea9ba63c | |||
| c42af5b2de | |||
| d9cbc72058 | |||
| 7e057b20b1 | |||
| 3165c1e5c6 | |||
| 89e26519e4 | |||
| 9d20e85c03 | |||
| 48cb99498c | |||
| 8246bc1444 | |||
| 9e1083eba8 | |||
| 4907bc3085 | |||
| 7d2ce8a77f | |||
| b4a9c92ffc | |||
| bf0eb9a02d | |||
| ddf73077b3 | |||
| 3da80fce0d | |||
| 0970de5dc6 | |||
| 557b11f4e6 | |||
| 7f27a6c797 | |||
| c778e454cd | |||
| 44757b73eb | |||
| 525978db1d | |||
| 71c90a2f39 | |||
| 8057dca032 | |||
| 91d7b956b9 | |||
| 881625a0f6 | |||
| b7a12eddaf | |||
|
|
44b1ccbc3c | ||
|
|
30261632f6 | ||
|
|
08db0748f4 | ||
|
|
9dc22bee24 | ||
|
|
c4d362ff31 | ||
|
|
4a35ff7b77 | ||
|
|
871e9792a5 | ||
| 5f4ab50bf9 | |||
| f0a49aaf0a | |||
| 1aae58e00b | |||
| f81e5251e8 | |||
| b26504b4a1 | |||
| 4eddad0bcb | |||
| 1b9aa0c598 | |||
| 6e52774507 | |||
| e5403462bc | |||
| 33b555ff27 | |||
| 4c552671c1 | |||
| 25a362d043 | |||
| 023e03bb8f | |||
| 0caad2105f | |||
| f14fdc2a69 | |||
| 440d3f9c91 | |||
| 975ef90bab | |||
| 8c63e74b81 | |||
| 6b9d248542 | |||
| 6d2318ac9b | |||
|
|
0f76518b63 | ||
|
|
bb5faec3c6 | ||
|
|
22301fc15d | ||
|
|
f482ef06d5 | ||
|
|
4f62da8f90 | ||
|
|
eaa3dd435a | ||
|
|
e1d1d52260 | ||
| 0cc0ba047f | |||
| 641e114fed | |||
| 73d45c9817 | |||
| 519b959073 | |||
| 2cc751f326 | |||
| 99588faf40 | |||
|
|
9c6b6b978a | ||
| 0647a74875 | |||
|
|
de9d99e6bc | ||
| ae9f67391c | |||
| 82f832a556 | |||
| 19dbbf89e7 | |||
|
|
5d6e3c69ee | ||
|
|
984d04e972 | ||
|
|
83486ae0cc | ||
|
|
4fe5c5da7e | ||
|
|
ec1d8ca52f | ||
|
|
0404627153 | ||
|
|
de282948e6 | ||
|
|
93f1fed997 | ||
| f6ebd414d6 | |||
| ff19adc6c8 | |||
|
|
41d24c91b4 | ||
| 0427f7a8d3 | |||
| 985a5e5ce7 | |||
| fe4c283336 | |||
|
|
20e704604a | ||
|
|
0db02a8c52 | ||
| 1b4b50ee80 | |||
| 446c692f97 | |||
| 7dfc6ea67a | |||
|
|
a5a257f452 | ||
|
|
bde0e2900b | ||
|
|
361773101e | ||
|
|
052860b62c | ||
|
|
c5e1b1ee69 | ||
| 0b1697f20d | |||
| add71543a4 | |||
| 66a1e0629c | |||
| 425c976032 | |||
|
|
397dcc6128 | ||
| a3c403323d | |||
| 942896aa0c | |||
| 93c92c0e38 | |||
| 394ca46f03 | |||
| 67641da44d | |||
|
|
a826051979 | ||
|
|
ce4c62a989 | ||
| b59966595e | |||
| fcf8b63666 | |||
| cad9322839 | |||
| 31fcd61401 | |||
|
|
0b11663da4 | ||
| 5a179f514c | |||
| f099a70b87 | |||
| 1163b99f39 | |||
| ca6ccc7291 | |||
| bb11c24681 | |||
| d158579bdc | |||
| 02f5a09689 | |||
| cb3de17be9 | |||
| fd66d79ecb | |||
| d6b77e938b | |||
| 3c8dc0a9e1 | |||
| fdfeea508e | |||
| 99d0340e1b | |||
| a74cda2f33 | |||
| 322fd80f40 | |||
| 7168941495 | |||
| 161607cf8a | |||
| d45cd032a7 | |||
|
|
9db9a4957a | ||
|
|
d089921ef5 | ||
|
|
7f3ece2da9 | ||
| 4b497060a0 | |||
| d40131f863 | |||
| 9999b5e400 | |||
| 6e27f66306 | |||
| a4c1263190 | |||
| 46920fb991 | |||
| d50b3cb28c | |||
| 6481d2ec7d | |||
| f94820c824 | |||
| 1d0a2363d8 | |||
|
|
2100b856b0 | ||
|
|
e687affd17 | ||
|
|
195f3b4f68 | ||
| cc7d268610 | |||
|
|
acc8cda04f | ||
|
|
7c5637c063 | ||
|
|
b87392906b | ||
|
|
4e7e1e9c45 | ||
| da92d2d365 | |||
| ae0ba66416 | |||
| 718cebc700 | |||
| a2cbcbbbc6 | |||
|
|
c5363c948c | ||
|
|
4f7086a6de | ||
|
|
3c4e15b386 | ||
|
|
6685b3679b | ||
|
|
d6a27c26aa | ||
|
|
e7c4b949f5 | ||
|
|
f89e0abe69 | ||
|
|
cbcf9550f8 | ||
|
|
d4b877f18e | ||
|
|
605a094910 | ||
|
|
a16a7358d1 | ||
|
|
655c95158f | ||
| 9eca723dc5 | |||
| bbc2bab0eb | |||
|
|
fe913b0072 | ||
|
|
9ec2baf7d3 | ||
| cc6d2f3023 | |||
| 2ac717592d | |||
|
|
7ca62463b7 | ||
| 95971618ca | |||
| cb881877ac | |||
|
|
2cc26f98c6 | ||
|
|
47b4357a72 | ||
|
|
a60bd19e58 | ||
|
|
439e43fad9 | ||
|
|
7abbc96347 | ||
|
|
e9b4a8abd5 | ||
| cb7c20a0b7 | |||
| f5c2f9e017 | |||
|
|
45ddc47b0e | ||
|
|
8f148f2a5e | ||
|
|
5c9edeeae8 | ||
|
|
13349d07a8 | ||
| 991389e9b9 | |||
| d8487e6c12 | |||
|
|
b7750b9d06 | ||
|
|
d82cacc18f | ||
|
|
564248284a | ||
|
|
ee473d8844 | ||
|
|
2fb0d73439 | ||
|
|
5dd8a83081 | ||
|
|
f83a8db25c | ||
|
|
a3e5da052e | ||
|
|
942db6d708 | ||
|
|
48deb869de | ||
|
|
69b67b3b4b | ||
|
|
6acdcb4e6d | ||
|
|
e832478b76 | ||
|
|
c8e9a835f5 | ||
|
|
06c5f068db | ||
|
|
b81207e42e | ||
|
|
b312d69afa | ||
|
|
d1238a441d | ||
|
|
580739d0b4 | ||
|
|
093dec1808 | ||
|
|
2fb521aa42 | ||
|
|
992504a49f | ||
|
|
8696681710 | ||
|
|
73ce700ece | ||
|
|
c766881052 | ||
|
|
8bd14f5f21 | ||
|
|
45cd633e12 | ||
|
|
0744e13132 | ||
|
|
320584a693 | ||
|
|
514a44e022 | ||
|
|
191a00649f | ||
|
|
ecfd5738ce | ||
|
|
25fe7c8725 | ||
|
|
dbcb1def29 | ||
|
|
c4acbf563f | ||
|
|
c9599f449f | ||
|
|
e675e8aad9 | ||
|
|
37aac7053a | ||
|
|
9c9a132329 | ||
|
|
ce305d4e54 | ||
|
|
d3c66cd7fe | ||
|
|
7bf95cd927 | ||
|
|
05d4f24f6f | ||
|
|
d9c837918b | ||
|
|
5adee83350 | ||
|
|
720e26d19d | ||
|
|
29356c0b61 | ||
|
|
b39dd5c40d | ||
|
|
1ae44e74e7 | ||
|
|
7a5d1e378d | ||
| c68f6a30e6 | |||
| 07ec0d001f | |||
| 4f15745647 | |||
| 20367851cc | |||
| 2978ec33b7 | |||
| 3d126b04a9 | |||
| 33fd3c8009 | |||
| ea1c8a23cd | |||
| 1827723ccc | |||
|
|
949d3514b8 | ||
|
|
7818b9dc1c | ||
|
|
d15da0ffd4 | ||
|
|
a0665313ed | ||
|
|
8a7bd30ce0 | ||
| f2da98c387 | |||
|
|
51c4e8ab9e | ||
|
|
f369b26d88 | ||
|
|
40bb88a55f | ||
|
|
72e7493842 | ||
|
|
6213021f45 | ||
|
|
eb3fb7e5f7 | ||
|
|
1ec14ec397 | ||
|
|
38f422896d | ||
|
|
3895cf4399 | ||
|
|
7e69fddac9 | ||
| e6f1a06545 | |||
| e20dd076c3 | |||
|
|
a2cc3d8b29 | ||
|
|
fa4cbd8fa8 | ||
|
|
884b6b1339 | ||
|
|
9576779cce | ||
|
|
0721384b60 | ||
|
|
0d79799a5d | ||
|
|
86339d8163 | ||
|
|
64bde6220c | ||
|
|
3406780f65 | ||
|
|
597e0e82b9 | ||
|
|
137af843af | ||
|
|
8a96ed87b1 | ||
|
|
59b0d0d9fa | ||
|
|
c9102af0aa | ||
|
|
6838089570 | ||
|
|
aba60a473a | ||
|
|
9a392ba292 | ||
|
|
85369d5247 | ||
|
|
7c11de3073 | ||
|
|
4d07a6330d | ||
|
|
dad4191c40 | ||
|
|
b70450cfe9 | ||
|
|
10b950a7e7 | ||
|
|
1b831375ef | ||
|
|
a979bf24d4 | ||
|
|
4b11bbb73d | ||
|
|
f1cefd6173 | ||
|
|
ac31e1c29e | ||
|
|
61f032a819 | ||
| 026f8ae608 | |||
| ab07c2e0ce | |||
| 637303930a | |||
|
|
78ee9872bd | ||
| 4dd1731e60 | |||
|
|
2c2770b4f1 | ||
|
|
8c04a9183f | ||
|
|
373e13208f | ||
|
|
250d41c2d7 | ||
|
|
9329ea946e | ||
| ddd19023b0 | |||
| 9b329c8b8a | |||
| 6f48cf80f2 | |||
| 464cbcae80 | |||
| 8c57856232 | |||
| 4f490aaacc | |||
| 3065637c80 | |||
| cf01756c1c | |||
| 58dc2ec792 | |||
| 88e6837222 | |||
| d376f99832 | |||
| 3072ce7dec | |||
|
|
82fdd53adb | ||
|
|
b97073b14a | ||
|
|
9a10e6f2a3 | ||
|
|
60d77892e5 | ||
|
|
9e11931b44 | ||
|
|
8fe7f4db82 | ||
|
|
26e6a62e6b | ||
|
|
d26c68cd1e | ||
|
|
01327a4b06 | ||
|
|
d3299f8e06 | ||
|
|
1100328fee | ||
|
|
cb1a4825d2 | ||
|
|
aa9f4c4ed8 | ||
|
|
c6d59d3366 | ||
|
|
8353f34c45 | ||
|
|
b6c082e1fe | ||
|
|
48251fb872 | ||
|
|
f14728c1a7 | ||
|
|
295e6e9198 | ||
|
|
e21af4a0e8 | ||
|
|
805ac5dacf | ||
|
|
93f8cd789f | ||
|
|
7b0d264aab | ||
|
|
4d0dc964da | ||
|
|
95fd5f93fc | ||
| 0f7dca0701 | |||
| 843955b7b8 | |||
| 88192335b6 | |||
| b04159fb35 | |||
| 1d0eb14918 | |||
|
|
113df6efe1 | ||
|
|
e7951338c9 | ||
|
|
83329ca4b7 | ||
|
|
f51201eae1 | ||
|
|
c52a513378 | ||
|
|
6908bfe7bf | ||
|
|
a5fa428e98 | ||
|
|
24f760c043 | ||
|
|
3f089d6811 | ||
|
|
7e673b4628 | ||
|
|
ca633d3524 | ||
|
|
7dd726ca42 | ||
|
|
3f6caa76dc | ||
|
|
5a18cb4246 | ||
|
|
b33de9985f | ||
|
|
3a9ede6e8c | ||
|
|
87569ccee9 | ||
|
|
16b79ef193 | ||
|
|
f360e8a867 | ||
|
|
57dd4ce259 | ||
|
|
252b5ff758 | ||
|
|
b19598d902 | ||
|
|
b5ef1fbbb5 | ||
|
|
bc864bde39 | ||
|
|
0a2883e040 | ||
|
|
24474e6b31 | ||
| dd31970b01 | |||
| f31ed103d0 | |||
|
|
6c0eeebf27 | ||
| 48f5cb78d5 | |||
|
|
20a768749f | ||
|
|
2d964b1137 | ||
|
|
a1245b77fd | ||
|
|
f2ee91764d | ||
| fff08a29e7 | |||
|
|
a6260ed5a2 | ||
| 2f3a462c42 | |||
|
|
37e6d74a34 | ||
| f8a0bbf88b | |||
|
|
cbd7dc8176 | ||
|
|
1da678f726 | ||
|
|
fccb6776b0 | ||
|
|
f2e85aca42 | ||
|
|
2fbffb8c9e | ||
|
|
dd8bddd45c | ||
|
|
358fe04699 | ||
|
|
647beea245 | ||
|
|
251974fd2f | ||
|
|
81952e7898 | ||
|
|
1ba9792547 | ||
|
|
45e3a6d7cc | ||
|
|
be05edac7d | ||
|
|
6761d22fa8 | ||
|
|
9db93cf4c9 | ||
|
|
15dd993b95 | ||
|
|
0f8444a585 | ||
|
|
6230d643c8 | ||
|
|
cfe452543a | ||
|
|
26ec7d94c6 | ||
|
|
95f823e7a1 | ||
|
|
09544ba6d2 | ||
|
|
15676a7c9e | ||
| b5bdf88bf4 | |||
| 74e96d7816 | |||
| 527e877b30 | |||
|
|
efc1550ab9 | ||
|
|
f53974b138 | ||
|
|
6860860161 | ||
|
|
9c65194d91 | ||
|
|
b1cf630443 | ||
|
|
b3e383ea82 | ||
|
|
36368aff0b | ||
|
|
162735b328 | ||
|
|
27023283e7 | ||
|
|
8fc405fef1 | ||
|
|
44d8903a10 | ||
|
|
113c52f6b0 | ||
|
|
e29a4c8c8a | ||
| 9499601daf | |||
|
|
0887f7d22f | ||
|
|
327ecff63a | ||
|
|
55e91bff7f | ||
|
|
8b179fd98d | ||
|
|
e5841f2dad | ||
|
|
d45405f261 | ||
|
|
133ed9a0be | ||
|
|
33220b2b8e | ||
|
|
f542975872 | ||
| ed9fac0545 | |||
|
|
4dd4678b65 | ||
|
|
bbd48d24e4 | ||
| 3b66d77ddc | |||
| fc5ef995bc | |||
| 4c5fa0ed61 | |||
| ea9161b2f2 | |||
| 3c139315e5 | |||
| 15a96a402d | |||
| 5959099c55 | |||
|
|
9f40c6355c | ||
|
|
0fcb80aa29 | ||
|
|
59a12dcac1 | ||
|
|
eb47c101ca | ||
|
|
c67a7f4982 | ||
|
|
aba394502c | ||
|
|
0c265f4f78 | ||
|
|
32518cfb41 | ||
|
|
225f821206 | ||
|
|
f506d9e925 | ||
|
|
edce18fb1f | ||
|
|
ad15ab13c5 | ||
|
|
f52f6512a0 | ||
|
|
7bdafbd21e | ||
|
|
6486c8c472 | ||
|
|
fb345c5f0c | ||
|
|
deaeaa434d | ||
|
|
f9cc0afb9e | ||
|
|
ee0400463f | ||
|
|
fa35c22d2d | ||
|
|
422b73058c | ||
|
|
c50a46206d | ||
|
|
f866c067cb | ||
|
|
811d087d74 | ||
|
|
633243311d | ||
|
|
f5d5381fae | ||
|
|
bbc3249212 | ||
|
|
625b8803df | ||
|
|
0d8090b6f4 | ||
|
|
718c0af085 | ||
|
|
5a94264dc0 | ||
|
|
8269f3ea5b | ||
|
|
d6333362a7 | ||
|
|
3e43fd52ae | ||
|
|
1111333223 | ||
|
|
ae9952a941 | ||
|
|
3b2ad80dc3 | ||
|
|
1c08439c1a | ||
|
|
16c89180d2 | ||
|
|
bc6b4f90c3 | ||
|
|
275cc7aa21 | ||
|
|
e186475a81 | ||
|
|
595d0c501a | ||
|
|
4e09a15454 | ||
|
|
b7ab840d71 | ||
|
|
b72e6871e8 | ||
|
|
f14ea29636 | ||
|
|
cb7f1f0ee3 | ||
|
|
ef34217a6d | ||
|
|
ab7ee8e4c3 | ||
|
|
1a1df35ff1 | ||
|
|
0c0fb5c9c8 | ||
|
|
c29a6ad195 | ||
|
|
6fdffb7418 | ||
|
|
8db642cf3b | ||
|
|
850a05d6bb | ||
|
|
74995101d1 | ||
|
|
fa5d13e19d | ||
|
|
9f7e72f0a4 | ||
|
|
c224bf1bb1 | ||
|
|
b5b71a3db0 | ||
|
|
cc1abfd1f9 | ||
|
|
771c91227e | ||
|
|
1276ea0d1b | ||
|
|
611ce6eb9c | ||
|
|
2870df8478 | ||
|
|
59b2163a62 | ||
|
|
065318749b | ||
|
|
600ee095cc | ||
|
|
ecb49619da | ||
|
|
b73939d0a0 | ||
|
|
6c83639149 | ||
|
|
e77ee9bdf3 | ||
|
|
9449f0d16e | ||
|
|
4ff29e1fb3 | ||
|
|
4de85df5b6 | ||
|
|
294ccb04d3 | ||
|
|
4f0567ad88 | ||
|
|
65c613d0a4 | ||
|
|
a16bca2f29 | ||
| 517720c99c | |||
|
|
86e942ae0a | ||
| 9938cc941d | |||
| 2651171294 | |||
| 07f71dfc4e | |||
| 51730e0877 | |||
| 9958bb27a1 | |||
|
|
37b94bbf0d | ||
|
|
3ae898476f | ||
|
|
eefe547553 | ||
|
|
2903a1d3cd | ||
|
|
0755e2d2bc | ||
|
|
b5957d0f59 | ||
|
|
143608fd85 | ||
|
|
b2d9fe1a4b | ||
|
|
aff7948c65 | ||
|
|
bcdfcdd468 | ||
|
|
5e62d82e9c | ||
|
|
275c26b55b | ||
|
|
123fc8252e | ||
|
|
c93e50a7e2 | ||
|
|
9c8bc59224 | ||
|
|
b074570e99 | ||
|
|
bf5bae803d | ||
|
|
35224b1b17 | ||
|
|
2ed362f5d3 | ||
|
|
fe971d07ec | ||
|
|
f82456f352 | ||
|
|
bbbf958d7d | ||
|
|
4c901c3130 | ||
|
|
eade6d584c | ||
|
|
9c8a034a04 | ||
|
|
2dac1ff6c9 | ||
|
|
e9013e548b | ||
|
|
bc976c37b1 | ||
|
|
3249c377f1 | ||
|
|
2415a57ab0 | ||
|
|
7e4f51a7ce | ||
|
|
10caa4c1df | ||
|
|
a552b8fcfa | ||
|
|
9395e31c53 | ||
|
|
ce04737d46 | ||
|
|
259815467c | ||
|
|
3b517d3c53 | ||
|
|
c261f02c84 | ||
|
|
7815557f84 | ||
|
|
090e294f10 | ||
|
|
33d523e5bf | ||
|
|
7bc09bda8f | ||
|
|
45fd51b4b5 | ||
|
|
f3849679e8 | ||
|
|
bf0a8e8efb | ||
|
|
84c3039806 | ||
|
|
0c4a410ac0 | ||
|
|
b55f363651 | ||
|
|
7dd36014cc | ||
|
|
78ff0134c7 | ||
|
|
69da6c6d06 | ||
|
|
277eb0b4b6 | ||
|
|
8dbd24afd1 | ||
|
|
0a9d208529 | ||
|
|
8ab6dba1c8 | ||
|
|
e0bfdab106 | ||
|
|
fd09b39c1d | ||
| 8e743f3253 | |||
| 8d9dca1a94 | |||
| 5753af3e43 | |||
|
|
63f1976663 | ||
|
|
4b87a00637 | ||
|
|
8d12d1c0bc | ||
|
|
2c3d5b6f59 | ||
|
|
e8c66fa769 | ||
|
|
09f32e7025 | ||
|
|
0fca8daeb1 | ||
|
|
285e295b5a | ||
|
|
e6371c7adc | ||
|
|
ab7ff11cb6 | ||
|
|
ba11e84ed6 | ||
| 2676b16425 | |||
| f7012e5b85 | |||
| a149d8de97 | |||
| eea8894724 | |||
| 5b988ab760 | |||
| 88a38509de | |||
|
|
6dee9e85b5 | ||
|
|
2d795eb3c1 | ||
|
|
717b0f7ba8 | ||
|
|
2d373cab5b | ||
|
|
e20f45b2c3 | ||
|
|
917388b99e | ||
|
|
ed1f899534 | ||
|
|
60a80209dc | ||
|
|
e4f495b282 | ||
|
|
0efcd3cd07 | ||
| c216b96707 | |||
| cb3f983b91 | |||
| dc25723a35 | |||
| 8040dd5826 | |||
|
|
42ba1588c6 | ||
|
|
d0fda6de66 | ||
|
|
cef69039f5 | ||
|
|
cdf3a25f88 | ||
|
|
d1a0229944 | ||
|
|
63beaabfa0 | ||
|
|
caac696465 | ||
|
|
c741e41597 | ||
|
|
60fa076796 | ||
|
|
7dbed3ade1 | ||
|
|
a6cad7e811 | ||
|
|
47da8c17ea | ||
|
|
ad5b52f4e4 | ||
|
|
7679898159 | ||
|
|
d344df6e7e | ||
|
|
e0c3c783fa | ||
|
|
30663dc9fb | ||
|
|
8db7d0daa3 | ||
|
|
48bc71c6e3 | ||
|
|
2d3dadc85e | ||
|
|
e5765d356f | ||
|
|
f8f1773d18 | ||
|
|
15782c7795 | ||
|
|
b777e81ab1 | ||
|
|
e29346dec8 | ||
|
|
8535a8378c | ||
|
|
dcdc700bac | ||
|
|
31c2be768f | ||
|
|
9180667ac4 | ||
|
|
4f79bf2add | ||
|
|
9eaada0bdb | ||
|
|
c7e6fe38fb | ||
|
|
9e8548d65a | ||
|
|
3c41ca0864 | ||
|
|
c344ecceec | ||
|
|
ce2ca051f6 | ||
|
|
c63e307179 | ||
|
|
1daab0598a | ||
|
|
98ad77a57d | ||
|
|
b4ab4875fc | ||
|
|
6ead464a6b | ||
|
|
3d36c353fc | ||
|
|
0eff04c847 | ||
|
|
2b92ba9e62 | ||
|
|
c23bf7a05d | ||
|
|
92cbf48b49 | ||
|
|
1dc6ff6df1 | ||
|
|
e72ffab2ca | ||
|
|
e7a06ebc2e | ||
|
|
e12e0b35ee | ||
|
|
c6dac0384b | ||
|
|
e48cee9b4a | ||
|
|
9229b66091 | ||
|
|
eea428831c | ||
|
|
ad12d3e16d | ||
|
|
b1fcedf501 | ||
|
|
2b00192e87 | ||
|
|
2b82e7f07f | ||
|
|
f820d25a9e | ||
|
|
6e76747772 | ||
|
|
15d12b86aa |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -3,4 +3,5 @@ tests/temp/
|
|||||||
.svn/
|
.svn/
|
||||||
*.swp
|
*.swp
|
||||||
*~
|
*~
|
||||||
|
*.scm
|
||||||
*#
|
*#
|
||||||
|
|||||||
@@ -1,38 +1,7 @@
|
|||||||
History for Eiffel-Web-Framework
|
History for Eiffel-Web-Framework
|
||||||
|
[2015-06-10]
|
||||||
|
* Updated EWF design to better support concurrency, including SCOOP via
|
||||||
|
the new standalone connector.
|
||||||
|
|
||||||
[2011-09-23] Jocelyn
|
|
||||||
* library "ewsgi":
|
|
||||||
- NEW simple autotest cases using Nino web server
|
|
||||||
-fixed issue with RAW_POST_DATA being added in form_data_parameters
|
|
||||||
instead of meta_variables ...
|
|
||||||
- Implemented WGI_VALUE for parameter's type (query_parameter,
|
|
||||||
form_data_parameter, item ...)
|
|
||||||
* Nino connector: added feature to shutdown the server from the WGI application
|
|
||||||
* NEW library "http_client": a new library to perform simple http requests
|
|
||||||
such as get, head, post, put, ... (currently implemented with Eiffel cURL)
|
|
||||||
* NEW library "http_authorization": added simple library to support
|
|
||||||
HTTP_AUTHORIZATION. For now only "Basic" auth type is supported ..
|
|
||||||
|
|
||||||
[2011-09-22] Javier
|
|
||||||
* NEW Example: added partial Restbuck example
|
|
||||||
|
|
||||||
[2011-09-21] Jocelyn
|
|
||||||
* Nino connector: fixed an issue with missing value for Content-Type and Content-Length
|
|
||||||
|
|
||||||
[2011-09-13] Jocelyn
|
|
||||||
* library "router": now using a generic design to allow customization of
|
|
||||||
request handler context class.
|
|
||||||
* NEW library "server/request/rest": first attempt to provide a library to
|
|
||||||
help building RESTful application (the interfaces are likely to change
|
|
||||||
soon) EXPERIMENTAL
|
|
||||||
|
|
||||||
[2011-09-09] Jocelyn
|
|
||||||
* library "uri-template": better support for {/vars} and {?vars}
|
|
||||||
|
|
||||||
[2011-09-07] Jocelyn
|
|
||||||
* library "router": now routing depends on uri (or uri template) and request methods
|
|
||||||
* Nino connector: Fixed issue where HTTP_ prefix were missing for header meta variable.
|
|
||||||
|
|
||||||
[2011-09-07] Jocelyn
|
|
||||||
* changelog: starting to write down changelogs file
|
|
||||||
|
|
||||||
|
[Previous ] Many significant changes in v0
|
||||||
|
|||||||
142
CONTRIBUTING.md
Normal file
142
CONTRIBUTING.md
Normal file
@@ -0,0 +1,142 @@
|
|||||||
|
# Contributing to this project
|
||||||
|
|
||||||
|
Please take a moment to review this document in order to make the contribution
|
||||||
|
process easy and effective for everyone involved.
|
||||||
|
|
||||||
|
Following these guidelines helps to communicate that you respect the time of
|
||||||
|
the developers managing and developing this open source project. In return,
|
||||||
|
they should reciprocate that respect in addressing your issue or assessing
|
||||||
|
patches and features.
|
||||||
|
|
||||||
|
|
||||||
|
## Using the issue tracker
|
||||||
|
|
||||||
|
The issue tracker is the preferred channel for [bug reports](#bugs),
|
||||||
|
[features requests](#features) and [submitting pull
|
||||||
|
requests](#pull-requests), but please respect the following restrictions:
|
||||||
|
|
||||||
|
* Please **do not** use the issue tracker for personal support requests (use
|
||||||
|
[Stack Overflow](http://stackoverflow.com) or IRC).
|
||||||
|
|
||||||
|
* Please **do not** derail or troll issues. Keep the discussion on topic and
|
||||||
|
respect the opinions of others.
|
||||||
|
|
||||||
|
|
||||||
|
<a name="bugs"></a>
|
||||||
|
## Bug reports
|
||||||
|
|
||||||
|
A bug is a _demonstrable problem_ that is caused by the code in the repository.
|
||||||
|
Good bug reports are extremely helpful - thank you!
|
||||||
|
|
||||||
|
Guidelines for bug reports:
|
||||||
|
|
||||||
|
1. **Use the GitHub issue search** — check if the issue has already been
|
||||||
|
reported.
|
||||||
|
|
||||||
|
2. **Check if the issue has been fixed** — try to reproduce it using the
|
||||||
|
latest `master` or development branch in the repository.
|
||||||
|
|
||||||
|
3. **Isolate the problem** — ideally create a [reduced test
|
||||||
|
case](http://css-tricks.com/6263-reduced-test-cases/) and a live example.
|
||||||
|
|
||||||
|
A good bug report shouldn't leave others needing to chase you up for more
|
||||||
|
information. Please try to be as detailed as possible in your report. What is
|
||||||
|
your environment? What steps will reproduce the issue? What browser(s) and OS
|
||||||
|
experience the problem? What would you expect to be the outcome? All these
|
||||||
|
details will help people to fix any potential bugs.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
> Short and descriptive example bug report title
|
||||||
|
>
|
||||||
|
> A summary of the issue and the browser/OS environment in which it occurs. If
|
||||||
|
> suitable, include the steps required to reproduce the bug.
|
||||||
|
>
|
||||||
|
> 1. This is the first step
|
||||||
|
> 2. This is the second step
|
||||||
|
> 3. Further steps, etc.
|
||||||
|
>
|
||||||
|
> `<url>` - a link to the reduced test case
|
||||||
|
>
|
||||||
|
> Any other information you want to share that is relevant to the issue being
|
||||||
|
> reported. This might include the lines of code that you have identified as
|
||||||
|
> causing the bug, and potential solutions (and your opinions on their
|
||||||
|
> merits).
|
||||||
|
|
||||||
|
|
||||||
|
<a name="features"></a>
|
||||||
|
## Feature requests
|
||||||
|
|
||||||
|
Feature requests are welcome. But take a moment to find out whether your idea
|
||||||
|
fits with the scope and aims of the project. It's up to *you* to make a strong
|
||||||
|
case to convince the project's developers of the merits of this feature. Please
|
||||||
|
provide as much detail and context as possible.
|
||||||
|
|
||||||
|
|
||||||
|
<a name="pull-requests"></a>
|
||||||
|
## Pull requests
|
||||||
|
|
||||||
|
Good pull requests - patches, improvements, new features - are a fantastic
|
||||||
|
help. They should remain focused in scope and avoid containing unrelated
|
||||||
|
commits.
|
||||||
|
|
||||||
|
**Please ask first** before embarking on any significant pull request (e.g.
|
||||||
|
implementing features, refactoring code, porting to a different language),
|
||||||
|
otherwise you risk spending a lot of time working on something that the
|
||||||
|
project's developers might not want to merge into the project.
|
||||||
|
|
||||||
|
Please adhere to the coding conventions used throughout a project (indentation,
|
||||||
|
accurate comments, etc.) and any other requirements (such as test coverage).
|
||||||
|
|
||||||
|
Adhering to the following this process is the best way to get your work
|
||||||
|
included in the project:
|
||||||
|
|
||||||
|
1. [Fork](http://help.github.com/fork-a-repo/) the project, clone your fork,
|
||||||
|
and configure the remotes:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Clone your fork of the repo into the current directory
|
||||||
|
git clone https://github.com/<your-username>/<repo-name>
|
||||||
|
# Navigate to the newly cloned directory
|
||||||
|
cd <repo-name>
|
||||||
|
# Assign the original repo to a remote called "upstream"
|
||||||
|
git remote add upstream https://github.com/<upstream-owner>/<repo-name>
|
||||||
|
```
|
||||||
|
|
||||||
|
2. If you cloned a while ago, get the latest changes from upstream:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git checkout <dev-branch>
|
||||||
|
git pull upstream <dev-branch>
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Create a new topic branch (off the main project development branch) to
|
||||||
|
contain your feature, change, or fix:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git checkout -b <topic-branch-name>
|
||||||
|
```
|
||||||
|
|
||||||
|
4. Commit your changes in logical chunks. Please adhere to these [git commit
|
||||||
|
message guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
|
||||||
|
or your code is unlikely be merged into the main project. Use Git's
|
||||||
|
[interactive rebase](https://help.github.com/articles/interactive-rebase)
|
||||||
|
feature to tidy up your commits before making them public.
|
||||||
|
|
||||||
|
5. Locally merge (or rebase) the upstream development branch into your topic branch:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git pull [--rebase] upstream <dev-branch>
|
||||||
|
```
|
||||||
|
|
||||||
|
6. Push your topic branch up to your fork:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git push origin <topic-branch-name>
|
||||||
|
```
|
||||||
|
|
||||||
|
7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/)
|
||||||
|
with a clear title and description.
|
||||||
|
|
||||||
|
**IMPORTANT**: By submitting a patch, you agree to allow the project owner to
|
||||||
|
license your work under the same license as that used by the project.
|
||||||
121
MIGRATION.md
Normal file
121
MIGRATION.md
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
Date: 2015-june
|
||||||
|
|
||||||
|
# Goal:
|
||||||
|
=======
|
||||||
|
- support safe concurrency with EWF
|
||||||
|
- provide a concurrent standalone connector
|
||||||
|
|
||||||
|
# Status:
|
||||||
|
=========
|
||||||
|
- The version v0 of EWF has mainly 3 connectors: CGI, libFCGI, and nino.
|
||||||
|
- CGI and libFCGI connectors does not need any concurrency support.
|
||||||
|
- But the nino connector had a pseudo concurrency support with Thread, however one could do write code that result in hasardeous concurrency execution.
|
||||||
|
|
||||||
|
So, it was decided to provide an improved Eiffel web nino connector, and update EWF design to make it concurrency compliant.
|
||||||
|
|
||||||
|
# Decisions:
|
||||||
|
============
|
||||||
|
- instead of updating current nino library, we now have a new "standalone" connector which is inspired by nino, but have support for the 3 concurrency modes: none, thread and SCOOP.
|
||||||
|
|
||||||
|
|
||||||
|
# Overview
|
||||||
|
==========
|
||||||
|
Adding support for SCOOP concurrency mode add constraints to the design, but also helps ensuring the concurrency design of EWF is correct.
|
||||||
|
|
||||||
|
As a consequence, we had to introduce a new interface WSF_EXECUTION which is instantiated for each incoming request. See its simplified interface :
|
||||||
|
<code lang="eiffel">
|
||||||
|
deferred class WSF_EXECUTION
|
||||||
|
|
||||||
|
feature -- Initialization
|
||||||
|
|
||||||
|
make (req: WGI_REQUEST; res: WGI_RESPONSE)
|
||||||
|
do
|
||||||
|
...
|
||||||
|
īnitialize
|
||||||
|
end
|
||||||
|
|
||||||
|
initialize
|
||||||
|
-- Initialize Current object.
|
||||||
|
--| To be redefined if needed.
|
||||||
|
do
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
feature -- Access
|
||||||
|
|
||||||
|
request: WSF_REQUEST
|
||||||
|
-- Access to request data.
|
||||||
|
-- Header, Query, Post, Input data..
|
||||||
|
|
||||||
|
response: WSF_RESPONSE
|
||||||
|
-- Access to output stream, back to the client.
|
||||||
|
|
||||||
|
feature -- Execution
|
||||||
|
|
||||||
|
execute
|
||||||
|
-- Execute Current `request',
|
||||||
|
-- getting data from `request'
|
||||||
|
-- and response to client via `response'.
|
||||||
|
deferred
|
||||||
|
ensure
|
||||||
|
is_valid_end_of_execution: is_valid_end_of_execution
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
</code>
|
||||||
|
|
||||||
|
And the related request execution routines are extracted from WSF_SERVICE which becomes almost useless. The "service" part is not mostly responsible of launching the expected connector and set optional options, and declare the type of "execution" interface.
|
||||||
|
|
||||||
|
As a result, the well known WSF_DEFAULT_SERVICE has now a formal generic that should conform to WSF_EXECUTION with a `make' creation procedure. See update code:
|
||||||
|
|
||||||
|
<code lang="eiffel">
|
||||||
|
class
|
||||||
|
APPLICATION
|
||||||
|
|
||||||
|
inherit
|
||||||
|
WSF_DEFAULT_SERVICE [APPLICATION_EXECUTION]
|
||||||
|
redefine
|
||||||
|
initialize
|
||||||
|
end
|
||||||
|
|
||||||
|
create
|
||||||
|
make_and_launch
|
||||||
|
|
||||||
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
|
initialize
|
||||||
|
-- Initialize current service.
|
||||||
|
do
|
||||||
|
set_service_option ("port", 9090)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
</code>
|
||||||
|
|
||||||
|
Where APPLICATION_EXECUTION is an implementation of the WSF_EXECUTION interface (with the `make' creation procedure).
|
||||||
|
|
||||||
|
In addition to add better and safer concurrency support, there are other advantages:
|
||||||
|
- we now have a clear separation between the service launcher, and the request execution itself.
|
||||||
|
- the WSF_EXECUTION is created per request, with two main attributes <code>request: WSF_REQUEST</code> and <code>response: WSF_RESPONSE</code>.
|
||||||
|
|
||||||
|
# How to migrate to new design
|
||||||
|
- you can check the various example from the EWF repository, there should all be migrated to new design and comparing previous and new code, this will show you how the migration was done.
|
||||||
|
- a frequent process:
|
||||||
|
- identify the root class of your service, (the class implementing the WSF_SERVICE), let us name it APPLICATION_SERVICE
|
||||||
|
- copy the APPLICATION_SERVICE file to APPLICATION_EXECUTION file.
|
||||||
|
- change the class name to be APPLICATION_EXECUTION, and replace _SERVICE occurences by _EXECUTION (note the new WSF_ROUTED_EXECUTION and so on, which are mainly migration from previous WSF_ROUTED_SERVICE .., and also WSF_FILTERED_ROUTED_EXECUTION which is new.
|
||||||
|
- replace "make_and_launch" by "make", remove the initialize redefinition if any.
|
||||||
|
- in the APPLICATION_SERVICE class, remove most of the ROUTED, FILTERED ... inheritance, and keep WSF_DEFAULT_SERVICE, with a new formal generic i.e WSF_DEFAULT_SERVICE [APPLICATION_EXECUTION].
|
||||||
|
- in the eventual redefined initialize, remove code related to routers, filters, ...
|
||||||
|
- remove all the execution related code.
|
||||||
|
- And you should be done.
|
||||||
|
- To be short, this is mostly creating a new _EXECUTION class, and move the execution related code into this class from the _SERVICE class.
|
||||||
|
- Then, you can replace the usage of nino connector by using the new "Standalone" connector, and switch to SCOOP concurrency mode, to ensure you are not messing up with concurrency. Your own code/libraris may not be SCOOP compliant, we recommend to migrate to SCOOP, but as an intermediate solutioņ, you can use the other concurrency mode (none or thread).
|
||||||
|
|
||||||
|
Note: the new design impacts the _SERVICE classes, connectors, but WSF_REQUEST, WSF_RESPONSE , WSF_ROUTER are compatible, so the migration is really easy.
|
||||||
|
|
||||||
|
We may take the opportunity to update the design deeper according to user feedback, and eventually "wsf" library will be renamed "wsf2".
|
||||||
|
This is work in progress, all comments , feedback, suggestions, bug report are welcome.
|
||||||
|
Hopefully before the final version of the new design is out.
|
||||||
|
|
||||||
|
|
||||||
68
README.md
68
README.md
@@ -3,6 +3,27 @@
|
|||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|
||||||
|
The Eiffel Web Framework (EWF) provides Eiffel users with a layer to build anything on top of the http protocol such as websites, web API/services.
|
||||||
|
|
||||||
|
This layer is multi-platform: it can be set on Windows, Linux operating systems, and in addition it can run on top of any httpd servers such as Apache2, IIS, nginx, lighttpd. EWF includes as well a standalone httpd web server component, written in Eiffel, which enables users to run easily a web server on their machine, or even embed this component in any application written with Eiffel.
|
||||||
|
|
||||||
|
Currently EWF offers a collection of Eiffel libraries designed to be integrated with each others, and among other functionalities, it give simple access to the request data, to handle content negotiation, url dispatcher, integrate with openid system, and so on.
|
||||||
|
|
||||||
|
There is a growing ecosystem around EWF, that provides useful components:
|
||||||
|
* OpenID and OAuth consumer library
|
||||||
|
* Various hypermedia format such as HAL, Collection+json, …
|
||||||
|
* Websocket server and client
|
||||||
|
* Template engine
|
||||||
|
* API Auto-documentation with swagger
|
||||||
|
* A simple experimental CMS.
|
||||||
|
* ...
|
||||||
|
|
||||||
|
So if you want to build a website, a web api, RESTful service, …or even if you want to consume other web api, EWF is a solution.
|
||||||
|
|
||||||
|
EWF brings with it all the advantages of the Eiffel technology and tools with its powerful features such as Design by Contract, debugging, testing tools which enable to build efficient systems expected to be repeatedly refined, extended, and improved in a predictable and controllable way so as to become with time bugfree systems. Enjoy the full power of debugging your web server application from the IDE.
|
||||||
|
|
||||||
|
## Project
|
||||||
|
|
||||||
Official project site for Eiffel Web Framework:
|
Official project site for Eiffel Web Framework:
|
||||||
|
|
||||||
* http://eiffelwebframework.github.com/EWF/
|
* http://eiffelwebframework.github.com/EWF/
|
||||||
@@ -14,26 +35,21 @@ For more information please have a look at the related wiki:
|
|||||||
For download, check
|
For download, check
|
||||||
* https://github.com/EiffelWebFramework/EWF/downloads
|
* https://github.com/EiffelWebFramework/EWF/downloads
|
||||||
|
|
||||||
|
Tasks and issues are managed with github issue system
|
||||||
|
* See https://github.com/EiffelWebFramework/EWF/issues
|
||||||
|
* And visual dashboard: https://waffle.io/eiffelwebframework/ewf
|
||||||
|
* Forum/group post: https://groups.google.com/forum/#!forum/eiffel-web-framework
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
* Compiling from EiffelStudio 7.0
|
* Compiling from EiffelStudio 13.11 to 15.05 and more recent version of the compiler.
|
||||||
* Developped using EiffelStudio 7.1 (on Windows, Linux)
|
* Currently being developped using EiffelStudio 15.01 (on Windows, Linux)
|
||||||
* Tested using EiffelStudio 7.1 with "jenkins" CI server (not anymore compatible with 6.8 due to use of `TABLE_ITERABLE')
|
* Tested using EiffelStudio 15.01 with "jenkins" CI server (not anymore compatible with 6.8 due to use of `TABLE_ITERABLE')
|
||||||
* The code have to allow __void-safe__ compilation and non void-safe system (see [more about void-safety](http://docs.eiffel.com/book/method/void-safe-programming-eiffel) )
|
* The code have to allow __void-safe__ compilation and non void-safe system (see [more about void-safety](http://docs.eiffel.com/book/method/void-safe-programming-eiffel) )
|
||||||
|
|
||||||
## How to get the source code?
|
## How to get the source code?
|
||||||
|
|
||||||
Using git version >= 1.6.5
|
Using git
|
||||||
* git clone --recursive https://github.com/EiffelWebFramework/EWF.git
|
|
||||||
|
|
||||||
Otherwise, try
|
|
||||||
* git clone https://github.com/EiffelWebFramework/EWF.git
|
* git clone https://github.com/EiffelWebFramework/EWF.git
|
||||||
* cd Eiffel-Web-Framework
|
|
||||||
* git submodule update --init
|
|
||||||
* git submodule foreach --recursive git checkout master
|
|
||||||
|
|
||||||
An alternative to the last 2 instructions is to use the script from tools folder:
|
|
||||||
* cd tools
|
|
||||||
* update_git_working_copy
|
|
||||||
|
|
||||||
* And to build the required and related Clibs
|
* And to build the required and related Clibs
|
||||||
* cd contrib/ise_library/cURL
|
* cd contrib/ise_library/cURL
|
||||||
@@ -51,7 +67,7 @@ An alternative to the last 2 instructions is to use the script from tools folder
|
|||||||
### protocol
|
### protocol
|
||||||
* __http__: HTTP related classes, constants for status code, content types, ... [read more](library/protocol/http)
|
* __http__: HTTP related classes, constants for status code, content types, ... [read more](library/protocol/http)
|
||||||
* __uri_template__: URI Template library (parsing and expander) [read more](library/protocol/uri_template)
|
* __uri_template__: URI Template library (parsing and expander) [read more](library/protocol/uri_template)
|
||||||
* __CONNEG__: CONNEG library (Content-type Negociation) [read more](library/protocol/CONNEG)
|
* __CONNEG__: Content negotiation library (Content-type Negociation) [read more](library/protocol/content_negotiation)
|
||||||
|
|
||||||
### client
|
### client
|
||||||
* __http_client__: simple HTTP client based on cURL [read more](library/client/http_client)
|
* __http_client__: simple HTTP client based on cURL [read more](library/client/http_client)
|
||||||
@@ -59,10 +75,6 @@ An alternative to the last 2 instructions is to use the script from tools folder
|
|||||||
### text
|
### text
|
||||||
* __encoder__: Various simpler encoders: base64, url-encoder, xml entities, html entities [read more](library/text/encoder)
|
* __encoder__: Various simpler encoders: base64, url-encoder, xml entities, html entities [read more](library/text/encoder)
|
||||||
|
|
||||||
### crypto
|
|
||||||
* eel
|
|
||||||
* eapml
|
|
||||||
|
|
||||||
### Others
|
### Others
|
||||||
* error: very simple/basic library to handle error
|
* error: very simple/basic library to handle error
|
||||||
|
|
||||||
@@ -75,6 +87,24 @@ An alternative to the last 2 instructions is to use the script from tools folder
|
|||||||
## Examples
|
## Examples
|
||||||
..
|
..
|
||||||
|
|
||||||
|
## Contributing to this project
|
||||||
|
|
||||||
|
Anyone and everyone is welcome to contribute. Please take a moment to
|
||||||
|
review the [guidelines for contributing](CONTRIBUTING.md).
|
||||||
|
|
||||||
|
* [Bug reports](CONTRIBUTING.md#bugs)
|
||||||
|
* [Feature requests](CONTRIBUTING.md#features)
|
||||||
|
* [Pull requests](CONTRIBUTING.md#pull-requests)
|
||||||
|
|
||||||
|
## Community
|
||||||
|
|
||||||
|
Keep track of development and community news.
|
||||||
|
|
||||||
|
* Follow [@EiffelWeb](https://twitter.com/EiffelWeb) on Twitter
|
||||||
|
* [Forum](https://groups.google.com/forum/#!forum/eiffel-web-framework) on Google groups.
|
||||||
|
* Follow our [page](https://plus.google.com/u/0/110650349519032194479) and [community](https://plus.google.com/communities/110457383244374256721) on Google+
|
||||||
|
* Have a question that's not a feature request or bug report? [Ask on the mailing list](http://groups.google.com/group/eiffel-web-framework)
|
||||||
|
|
||||||
|
|
||||||
For more information please have a look at the related wiki:
|
For more information please have a look at the related wiki:
|
||||||
* https://github.com/EiffelWebFramework/EWF/wiki
|
* https://github.com/EiffelWebFramework/EWF/wiki
|
||||||
|
|||||||
@@ -29,7 +29,6 @@
|
|||||||
|
|
||||||
<target name="_build_tpl_" >
|
<target name="_build_tpl_" >
|
||||||
<argument name="_target_name" />
|
<argument name="_target_name" />
|
||||||
<geant target="${_target_name}" dir="cURL" file="build.eant" reuse_variables="true" />
|
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@@ -1,44 +1,44 @@
|
|||||||
note
|
note
|
||||||
description : "nino application root class"
|
description : "nino application root class"
|
||||||
date : "$Date$"
|
date : "$Date$"
|
||||||
revision : "$Revision$"
|
revision : "$Revision$"
|
||||||
|
|
||||||
class
|
class
|
||||||
APPLICATION
|
APPLICATION
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
ARGUMENTS
|
ARGUMENTS
|
||||||
|
|
||||||
HTTP_SERVER_SHARED_CONFIGURATION
|
HTTP_SERVER_SHARED_CONFIGURATION
|
||||||
|
|
||||||
create
|
create
|
||||||
make
|
make
|
||||||
|
|
||||||
feature {NONE} -- Initialization
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
make
|
make
|
||||||
-- Run application.
|
-- Run application.
|
||||||
local
|
local
|
||||||
l_server : HTTP_SERVER
|
l_server : HTTP_SERVER
|
||||||
l_cfg: HTTP_SERVER_CONFIGURATION
|
l_cfg: HTTP_SERVER_CONFIGURATION
|
||||||
l_http_handler : HTTP_HANDLER
|
l_http_handler : HTTP_HANDLER
|
||||||
do
|
do
|
||||||
create l_cfg.make
|
create l_cfg.make
|
||||||
l_cfg.http_server_port := 9_000
|
l_cfg.http_server_port := 9_000
|
||||||
l_cfg.document_root := default_document_root
|
l_cfg.document_root := default_document_root
|
||||||
set_server_configuration (l_cfg)
|
set_server_configuration (l_cfg)
|
||||||
debug ("nino")
|
debug ("nino")
|
||||||
l_cfg.set_is_verbose (True)
|
l_cfg.set_is_verbose (True)
|
||||||
end
|
end
|
||||||
|
|
||||||
create l_server.make (l_cfg)
|
create l_server.make (l_cfg)
|
||||||
create {APPLICATION_CONNECTION_HANDLER} l_http_handler.make (l_server)
|
create {APPLICATION_CONNECTION_HANDLER} l_http_handler.make (l_server)
|
||||||
l_server.setup (l_http_handler)
|
l_server.setup (l_http_handler)
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Access
|
feature -- Access
|
||||||
|
|
||||||
default_document_root: STRING = "webroot"
|
default_document_root: STRING = "webroot"
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,115 +1,115 @@
|
|||||||
note
|
note
|
||||||
description: "Summary description for {HEAD_REQUEST_HANDLER}."
|
description: "Summary description for {HEAD_REQUEST_HANDLER}."
|
||||||
author: ""
|
author: ""
|
||||||
date: "$Date$"
|
date: "$Date$"
|
||||||
revision: "$Revision$"
|
revision: "$Revision$"
|
||||||
|
|
||||||
class
|
class
|
||||||
HEAD_REQUEST_HANDLER
|
HEAD_REQUEST_HANDLER
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
|
|
||||||
SHARED_DOCUMENT_ROOT
|
SHARED_DOCUMENT_ROOT
|
||||||
|
|
||||||
SHARED_URI_CONTENTS_TYPES
|
SHARED_URI_CONTENTS_TYPES
|
||||||
|
|
||||||
HTTP_REQUEST_HANDLER
|
HTTP_REQUEST_HANDLER
|
||||||
|
|
||||||
HTTP_CONSTANTS
|
HTTP_CONSTANTS
|
||||||
|
|
||||||
feature
|
feature
|
||||||
|
|
||||||
|
|
||||||
process
|
process
|
||||||
-- process the request and create an answer
|
-- process the request and create an answer
|
||||||
local
|
local
|
||||||
fname: STRING
|
fname: STRING
|
||||||
f: RAW_FILE
|
f: RAW_FILE
|
||||||
ctype, extension: STRING
|
ctype, extension: STRING
|
||||||
do
|
do
|
||||||
fname := document_root_cell.item.twin
|
fname := document_root_cell.item.twin
|
||||||
fname.append (request_uri)
|
fname.append (request_uri)
|
||||||
debug
|
debug
|
||||||
print ("URI name: " + fname )
|
print ("URI name: " + fname )
|
||||||
end
|
end
|
||||||
create f.make (fname)
|
create f.make (fname)
|
||||||
create answer.make
|
create answer.make
|
||||||
if f.exists then
|
if f.exists then
|
||||||
extension := ct_table.extension (request_uri)
|
extension := ct_table.extension (request_uri)
|
||||||
ctype := ct_table.content_types.item (extension)
|
ctype := ct_table.content_types.item (extension)
|
||||||
-- TODO: This code could be improved to avoid string
|
-- TODO: This code could be improved to avoid string
|
||||||
-- comparisons
|
-- comparisons
|
||||||
if ctype = Void then
|
if ctype = Void then
|
||||||
process_default
|
process_default
|
||||||
answer.set_content_type ("text/html")
|
answer.set_content_type ("text/html")
|
||||||
else
|
else
|
||||||
if ctype.is_equal ("text/html") then
|
if ctype.is_equal ("text/html") then
|
||||||
process_text_file (f)
|
process_text_file (f)
|
||||||
else
|
else
|
||||||
process_raw_file (f)
|
process_raw_file (f)
|
||||||
end
|
end
|
||||||
answer.set_content_type (ctype)
|
answer.set_content_type (ctype)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
answer.set_status_code (not_found)
|
answer.set_status_code (not_found)
|
||||||
answer.set_reason_phrase (not_found_message)
|
answer.set_reason_phrase (not_found_message)
|
||||||
answer.set_reply_text ("Not found on this server%N%R")
|
answer.set_reply_text ("Not found on this server%N%R")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
process_default
|
process_default
|
||||||
--
|
--
|
||||||
local
|
local
|
||||||
html : STRING
|
html : STRING
|
||||||
do
|
do
|
||||||
answer.set_reply_text ("")
|
answer.set_reply_text ("")
|
||||||
html := " <html> <head> <title> Micro HTTPD </title> " +
|
html := " <html> <head> <title> Micro HTTPD </title> " +
|
||||||
" </head> " +
|
" </head> " +
|
||||||
" <body> " +
|
" <body> " +
|
||||||
" <h1> Welcome to Micro HTTPD! </h1> "+
|
" <h1> Welcome to Micro HTTPD! </h1> "+
|
||||||
" <p> Default page " +
|
" <p> Default page " +
|
||||||
|
|
||||||
" </p> " +
|
" </p> " +
|
||||||
" </body> " +
|
" </body> " +
|
||||||
" </html> "
|
" </html> "
|
||||||
answer.append_reply_text (html)
|
answer.append_reply_text (html)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
process_text_file (f: FILE)
|
process_text_file (f: FILE)
|
||||||
-- send a text file reply
|
-- send a text file reply
|
||||||
require
|
require
|
||||||
valid_f: f /= Void
|
valid_f: f /= Void
|
||||||
do
|
do
|
||||||
f.open_read
|
f.open_read
|
||||||
from
|
from
|
||||||
answer.set_reply_text ("")
|
answer.set_reply_text ("")
|
||||||
f.read_line
|
f.read_line
|
||||||
until f.end_of_file
|
until f.end_of_file
|
||||||
loop
|
loop
|
||||||
answer.append_reply_text (f.last_string)
|
answer.append_reply_text (f.last_string)
|
||||||
answer.append_reply_text (crlf)
|
answer.append_reply_text (crlf)
|
||||||
f.read_line
|
f.read_line
|
||||||
end
|
end
|
||||||
f.close
|
f.close
|
||||||
end
|
end
|
||||||
|
|
||||||
process_raw_file (f: FILE)
|
process_raw_file (f: FILE)
|
||||||
-- send a raw file reply
|
-- send a raw file reply
|
||||||
require
|
require
|
||||||
valid_f: f /= Void
|
valid_f: f /= Void
|
||||||
do
|
do
|
||||||
-- this is not quite right....
|
-- this is not quite right....
|
||||||
f.open_read
|
f.open_read
|
||||||
from
|
from
|
||||||
answer.set_reply_text ("")
|
answer.set_reply_text ("")
|
||||||
until f.end_of_file
|
until f.end_of_file
|
||||||
loop
|
loop
|
||||||
f.read_stream (1024)
|
f.read_stream (1024)
|
||||||
answer.append_reply_text (f.last_string)
|
answer.append_reply_text (f.last_string)
|
||||||
end
|
end
|
||||||
f.close
|
f.close
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,53 +1,53 @@
|
|||||||
note
|
note
|
||||||
description: "Summary description for {POST_REQUEST_HANDLER}."
|
description: "Summary description for {POST_REQUEST_HANDLER}."
|
||||||
author: ""
|
author: ""
|
||||||
date: "$Date$"
|
date: "$Date$"
|
||||||
revision: "$Revision$"
|
revision: "$Revision$"
|
||||||
|
|
||||||
class
|
class
|
||||||
POST_REQUEST_HANDLER
|
POST_REQUEST_HANDLER
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
GET_REQUEST_HANDLER
|
GET_REQUEST_HANDLER
|
||||||
redefine
|
redefine
|
||||||
process
|
process
|
||||||
end
|
end
|
||||||
|
|
||||||
create
|
create
|
||||||
make
|
make
|
||||||
|
|
||||||
feature -- Execution
|
feature -- Execution
|
||||||
|
|
||||||
process
|
process
|
||||||
-- process the request and create an answer
|
-- process the request and create an answer
|
||||||
local
|
local
|
||||||
l_data: STRING
|
l_data: STRING
|
||||||
s: detachable STRING
|
s: detachable STRING
|
||||||
n: INTEGER
|
n: INTEGER
|
||||||
sock: like socket
|
sock: like socket
|
||||||
do
|
do
|
||||||
from
|
from
|
||||||
n := 1_024
|
n := 1_024
|
||||||
sock := socket
|
sock := socket
|
||||||
if sock.socket_ok then
|
if sock.socket_ok then
|
||||||
sock.read_stream_thread_aware (n)
|
sock.read_stream_thread_aware (n)
|
||||||
s := sock.last_string
|
s := sock.last_string
|
||||||
else
|
else
|
||||||
s := Void
|
s := Void
|
||||||
end
|
end
|
||||||
create l_data.make_empty
|
create l_data.make_empty
|
||||||
until
|
until
|
||||||
s = Void or else s.count < n
|
s = Void or else s.count < n
|
||||||
loop
|
loop
|
||||||
l_data.append_string (s)
|
l_data.append_string (s)
|
||||||
if sock.socket_ok then
|
if sock.socket_ok then
|
||||||
sock.read_stream_thread_aware (n)
|
sock.read_stream_thread_aware (n)
|
||||||
s := sock.last_string
|
s := sock.last_string
|
||||||
else
|
else
|
||||||
s := Void
|
s := Void
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
Precursor
|
Precursor
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,91 +1,91 @@
|
|||||||
1.4.2
|
1.4.2
|
||||||
[Feature]
|
[Feature]
|
||||||
- The plugin support percentages as target ('50%' or {top:'50%', left:'45%'})
|
- The plugin support percentages as target ('50%' or {top:'50%', left:'45%'})
|
||||||
- Exposed the max() calculation as $.scrollTo.max
|
- Exposed the max() calculation as $.scrollTo.max
|
||||||
[Enhancement]
|
[Enhancement]
|
||||||
- Renamed $.fn.scrollable to $.fn._scrollable to avoid conflicts with other plugins
|
- Renamed $.fn.scrollable to $.fn._scrollable to avoid conflicts with other plugins
|
||||||
[Fix]
|
[Fix]
|
||||||
- Fixing max calculations for regular DOM elements
|
- Fixing max calculations for regular DOM elements
|
||||||
|
|
||||||
1.4.1
|
1.4.1
|
||||||
[Feature]
|
[Feature]
|
||||||
- The target can be 'max' to scroll to the end while keeping it elegant.
|
- The target can be 'max' to scroll to the end while keeping it elegant.
|
||||||
[Enhancement]
|
[Enhancement]
|
||||||
- Default duration is 0 for jquery +1.3. Means sync animation
|
- Default duration is 0 for jquery +1.3. Means sync animation
|
||||||
- The plugin works on all major browsers, on compat & quirks modes, including iframes.
|
- The plugin works on all major browsers, on compat & quirks modes, including iframes.
|
||||||
- In addition to window/document, if html or body are received, the plugin will choose the right one.
|
- In addition to window/document, if html or body are received, the plugin will choose the right one.
|
||||||
[Fix]
|
[Fix]
|
||||||
- The plugin accepts floating numbers, Thanks Ramin
|
- The plugin accepts floating numbers, Thanks Ramin
|
||||||
- Using jQuery.nodeName where neccessary so that this works on xml+xhtml
|
- Using jQuery.nodeName where neccessary so that this works on xml+xhtml
|
||||||
- The max() internal function wasn't completely accurrate, now it is 98% (except for IE on quirks mode and it's not too noticeable).
|
- The max() internal function wasn't completely accurrate, now it is 98% (except for IE on quirks mode and it's not too noticeable).
|
||||||
|
|
||||||
1.4
|
1.4
|
||||||
[Fix]
|
[Fix]
|
||||||
- Fixed the problem when scrolling the window to absolute positioned elements on Safari.
|
- Fixed the problem when scrolling the window to absolute positioned elements on Safari.
|
||||||
- Fixed the problem on Opera 9.5 when scrolling the window. That it always scrolls to 0.
|
- Fixed the problem on Opera 9.5 when scrolling the window. That it always scrolls to 0.
|
||||||
[Feature]
|
[Feature]
|
||||||
- Added the settings object as 2nd argument to the onAfter callback.
|
- Added the settings object as 2nd argument to the onAfter callback.
|
||||||
- The 3rd argument of scrollTo can be just a function and it's used as the onAfter.
|
- The 3rd argument of scrollTo can be just a function and it's used as the onAfter.
|
||||||
- Added full support for iframes (even max scroll calculation).
|
- Added full support for iframes (even max scroll calculation).
|
||||||
- Instead of $.scrollTo, $(window).scrollTo() and $(document).scrollTo() can be used.
|
- Instead of $.scrollTo, $(window).scrollTo() and $(document).scrollTo() can be used.
|
||||||
- Added $().scrollable() that returns the real element to scroll, f.e: $(window).scrollable() == [body|html], works for iframes.
|
- Added $().scrollable() that returns the real element to scroll, f.e: $(window).scrollable() == [body|html], works for iframes.
|
||||||
[Enhancement]
|
[Enhancement]
|
||||||
- Cleaned the code a bit, specially the comments
|
- Cleaned the code a bit, specially the comments
|
||||||
|
|
||||||
1.3.3
|
1.3.3
|
||||||
[Change]
|
[Change]
|
||||||
- Changed the licensing from GPL to GPL+MIT.
|
- Changed the licensing from GPL to GPL+MIT.
|
||||||
|
|
||||||
1.3.2
|
1.3.2
|
||||||
[Enhancement]
|
[Enhancement]
|
||||||
- Small improvements to make the code shorter.
|
- Small improvements to make the code shorter.
|
||||||
[Change]
|
[Change]
|
||||||
- Removed the last argument received by onAfter as it was the same as the 'this' but jqueryfied.
|
- Removed the last argument received by onAfter as it was the same as the 'this' but jqueryfied.
|
||||||
|
|
||||||
1.3.1
|
1.3.1
|
||||||
[Feature]
|
[Feature]
|
||||||
- Exposed $.scrollTo.window() to get the element that needs to be animated, to scroll the window.
|
- Exposed $.scrollTo.window() to get the element that needs to be animated, to scroll the window.
|
||||||
- Added option 'over'.
|
- Added option 'over'.
|
||||||
[Enhancement]
|
[Enhancement]
|
||||||
- Made the code as short as possible.
|
- Made the code as short as possible.
|
||||||
[Change]
|
[Change]
|
||||||
- Changed the arguments received by onAfter
|
- Changed the arguments received by onAfter
|
||||||
|
|
||||||
1.3
|
1.3
|
||||||
[Enhancement]
|
[Enhancement]
|
||||||
- Added semicolon to the start, for safe file concatenation
|
- Added semicolon to the start, for safe file concatenation
|
||||||
- Added a limit check, values below 0 or over the maximum are fixed.
|
- Added a limit check, values below 0 or over the maximum are fixed.
|
||||||
- Now it should work faster, only one of html or body go through all the processing, instead of both for all browsers.
|
- Now it should work faster, only one of html or body go through all the processing, instead of both for all browsers.
|
||||||
[Fix]
|
[Fix]
|
||||||
- Fixed the behavior for Opera, which seemed to react to both changes on <html> and <body>.
|
- Fixed the behavior for Opera, which seemed to react to both changes on <html> and <body>.
|
||||||
- The border is also reduced, when 'margin' is set to true.
|
- The border is also reduced, when 'margin' is set to true.
|
||||||
[Change]
|
[Change]
|
||||||
- The option speed has been renamed to duration.
|
- The option speed has been renamed to duration.
|
||||||
[Feature]
|
[Feature]
|
||||||
- The duration can be specified with a number as 2nd argument, and the rest of the settings as the third ( like $().animate )
|
- The duration can be specified with a number as 2nd argument, and the rest of the settings as the third ( like $().animate )
|
||||||
- Remade the demo
|
- Remade the demo
|
||||||
|
|
||||||
1.2.4
|
1.2.4
|
||||||
[Enhancement]
|
[Enhancement]
|
||||||
- The target can be in the form of { top:x, left:y } allowing different position for each axis.
|
- The target can be in the form of { top:x, left:y } allowing different position for each axis.
|
||||||
[Feature]
|
[Feature]
|
||||||
- The option 'offset' has been added, to scroll behind or past the target. Can be a number(both axes) or { top:x, left:y }.
|
- The option 'offset' has been added, to scroll behind or past the target. Can be a number(both axes) or { top:x, left:y }.
|
||||||
|
|
||||||
1.2.3
|
1.2.3
|
||||||
[Feature]
|
[Feature]
|
||||||
- Exposed the defaults.
|
- Exposed the defaults.
|
||||||
[Enhancement]
|
[Enhancement]
|
||||||
- Made the callback functions receive more parameters.
|
- Made the callback functions receive more parameters.
|
||||||
|
|
||||||
1.2.2
|
1.2.2
|
||||||
[Fix]
|
[Fix]
|
||||||
- Fixed a bug, I didn't have to add the scrolled amount if it was body or html.
|
- Fixed a bug, I didn't have to add the scrolled amount if it was body or html.
|
||||||
|
|
||||||
1.2
|
1.2
|
||||||
[Change]
|
[Change]
|
||||||
- The option 'onafter' is now called 'onAfter'.
|
- The option 'onafter' is now called 'onAfter'.
|
||||||
[Feature]
|
[Feature]
|
||||||
- Two axes can be scrolled together, this is set with the option 'axis'.
|
- Two axes can be scrolled together, this is set with the option 'axis'.
|
||||||
- In case 2 axes are chosen, the scrolling can be queued: one scrolls, and then the other.
|
- In case 2 axes are chosen, the scrolling can be queued: one scrolls, and then the other.
|
||||||
- There's an intermediary event, 'onAfterFirst' called in case the axes are queued, after the first ends.
|
- There's an intermediary event, 'onAfterFirst' called in case the axes are queued, after the first ends.
|
||||||
- If the option 'margin' is set to true, the plugin will take in account, the margin of the target(no use if target is a value).
|
- If the option 'margin' is set to true, the plugin will take in account, the margin of the target(no use if target is a value).
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
/**
|
/**
|
||||||
* jQuery.ScrollTo - Easy element scrolling using jQuery.
|
* jQuery.ScrollTo - Easy element scrolling using jQuery.
|
||||||
* Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
|
* Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
|
||||||
* Dual licensed under MIT and GPL.
|
* Dual licensed under MIT and GPL.
|
||||||
* Date: 5/25/2009
|
* Date: 5/25/2009
|
||||||
* @author Ariel Flesler
|
* @author Ariel Flesler
|
||||||
* @version 1.4.2
|
* @version 1.4.2
|
||||||
*
|
*
|
||||||
* http://flesler.blogspot.com/2007/10/jqueryscrollto.html
|
* http://flesler.blogspot.com/2007/10/jqueryscrollto.html
|
||||||
*/
|
*/
|
||||||
;(function(d){var k=d.scrollTo=function(a,i,e){d(window).scrollTo(a,i,e)};k.defaults={axis:'xy',duration:parseFloat(d.fn.jquery)>=1.3?0:1};k.window=function(a){return d(window)._scrollable()};d.fn._scrollable=function(){return this.map(function(){var a=this,i=!a.nodeName||d.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!i)return a;var e=(a.contentWindow||a).document||a.ownerDocument||a;return d.browser.safari||e.compatMode=='BackCompat'?e.body:e.documentElement})};d.fn.scrollTo=function(n,j,b){if(typeof j=='object'){b=j;j=0}if(typeof b=='function')b={onAfter:b};if(n=='max')n=9e9;b=d.extend({},k.defaults,b);j=j||b.speed||b.duration;b.queue=b.queue&&b.axis.length>1;if(b.queue)j/=2;b.offset=p(b.offset);b.over=p(b.over);return this._scrollable().each(function(){var q=this,r=d(q),f=n,s,g={},u=r.is('html,body');switch(typeof f){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(f)){f=p(f);break}f=d(f,this);case'object':if(f.is||f.style)s=(f=d(f)).offset()}d.each(b.axis.split(''),function(a,i){var e=i=='x'?'Left':'Top',h=e.toLowerCase(),c='scroll'+e,l=q[c],m=k.max(q,i);if(s){g[c]=s[h]+(u?0:l-r.offset()[h]);if(b.margin){g[c]-=parseInt(f.css('margin'+e))||0;g[c]-=parseInt(f.css('border'+e+'Width'))||0}g[c]+=b.offset[h]||0;if(b.over[h])g[c]+=f[i=='x'?'width':'height']()*b.over[h]}else{var o=f[h];g[c]=o.slice&&o.slice(-1)=='%'?parseFloat(o)/100*m:o}if(/^\d+$/.test(g[c]))g[c]=g[c]<=0?0:Math.min(g[c],m);if(!a&&b.queue){if(l!=g[c])t(b.onAfterFirst);delete g[c]}});t(b.onAfter);function t(a){r.animate(g,j,b.easing,a&&function(){a.call(this,n,b)})}}).end()};k.max=function(a,i){var e=i=='x'?'Width':'Height',h='scroll'+e;if(!d(a).is('html,body'))return a[h]-d(a)[e.toLowerCase()]();var c='client'+e,l=a.ownerDocument.documentElement,m=a.ownerDocument.body;return Math.max(l[h],m[h])-Math.min(l[c],m[c])};function p(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);
|
;(function(d){var k=d.scrollTo=function(a,i,e){d(window).scrollTo(a,i,e)};k.defaults={axis:'xy',duration:parseFloat(d.fn.jquery)>=1.3?0:1};k.window=function(a){return d(window)._scrollable()};d.fn._scrollable=function(){return this.map(function(){var a=this,i=!a.nodeName||d.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!i)return a;var e=(a.contentWindow||a).document||a.ownerDocument||a;return d.browser.safari||e.compatMode=='BackCompat'?e.body:e.documentElement})};d.fn.scrollTo=function(n,j,b){if(typeof j=='object'){b=j;j=0}if(typeof b=='function')b={onAfter:b};if(n=='max')n=9e9;b=d.extend({},k.defaults,b);j=j||b.speed||b.duration;b.queue=b.queue&&b.axis.length>1;if(b.queue)j/=2;b.offset=p(b.offset);b.over=p(b.over);return this._scrollable().each(function(){var q=this,r=d(q),f=n,s,g={},u=r.is('html,body');switch(typeof f){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(f)){f=p(f);break}f=d(f,this);case'object':if(f.is||f.style)s=(f=d(f)).offset()}d.each(b.axis.split(''),function(a,i){var e=i=='x'?'Left':'Top',h=e.toLowerCase(),c='scroll'+e,l=q[c],m=k.max(q,i);if(s){g[c]=s[h]+(u?0:l-r.offset()[h]);if(b.margin){g[c]-=parseInt(f.css('margin'+e))||0;g[c]-=parseInt(f.css('border'+e+'Width'))||0}g[c]+=b.offset[h]||0;if(b.over[h])g[c]+=f[i=='x'?'width':'height']()*b.over[h]}else{var o=f[h];g[c]=o.slice&&o.slice(-1)=='%'?parseFloat(o)/100*m:o}if(/^\d+$/.test(g[c]))g[c]=g[c]<=0?0:Math.min(g[c],m);if(!a&&b.queue){if(l!=g[c])t(b.onAfterFirst);delete g[c]}});t(b.onAfter);function t(a){r.animate(g,j,b.easing,a&&function(){a.call(this,n,b)})}}).end()};k.max=function(a,i){var e=i=='x'?'Width':'Height',h='scroll'+e;if(!d(a).is('html,body'))return a[h]-d(a)[e.toLowerCase()]();var c='client'+e,l=a.ownerDocument.documentElement,m=a.ownerDocument.body;return Math.max(l[h],m[h])-Math.min(l[c],m[c])};function p(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);
|
||||||
@@ -1,215 +1,215 @@
|
|||||||
/**
|
/**
|
||||||
* jQuery.ScrollTo
|
* jQuery.ScrollTo
|
||||||
* Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
|
* Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
|
||||||
* Dual licensed under MIT and GPL.
|
* Dual licensed under MIT and GPL.
|
||||||
* Date: 5/25/2009
|
* Date: 5/25/2009
|
||||||
*
|
*
|
||||||
* @projectDescription Easy element scrolling using jQuery.
|
* @projectDescription Easy element scrolling using jQuery.
|
||||||
* http://flesler.blogspot.com/2007/10/jqueryscrollto.html
|
* http://flesler.blogspot.com/2007/10/jqueryscrollto.html
|
||||||
* Works with jQuery +1.2.6. Tested on FF 2/3, IE 6/7/8, Opera 9.5/6, Safari 3, Chrome 1 on WinXP.
|
* Works with jQuery +1.2.6. Tested on FF 2/3, IE 6/7/8, Opera 9.5/6, Safari 3, Chrome 1 on WinXP.
|
||||||
*
|
*
|
||||||
* @author Ariel Flesler
|
* @author Ariel Flesler
|
||||||
* @version 1.4.2
|
* @version 1.4.2
|
||||||
*
|
*
|
||||||
* @id jQuery.scrollTo
|
* @id jQuery.scrollTo
|
||||||
* @id jQuery.fn.scrollTo
|
* @id jQuery.fn.scrollTo
|
||||||
* @param {String, Number, DOMElement, jQuery, Object} target Where to scroll the matched elements.
|
* @param {String, Number, DOMElement, jQuery, Object} target Where to scroll the matched elements.
|
||||||
* The different options for target are:
|
* The different options for target are:
|
||||||
* - A number position (will be applied to all axes).
|
* - A number position (will be applied to all axes).
|
||||||
* - A string position ('44', '100px', '+=90', etc ) will be applied to all axes
|
* - A string position ('44', '100px', '+=90', etc ) will be applied to all axes
|
||||||
* - A jQuery/DOM element ( logically, child of the element to scroll )
|
* - A jQuery/DOM element ( logically, child of the element to scroll )
|
||||||
* - A string selector, that will be relative to the element to scroll ( 'li:eq(2)', etc )
|
* - A string selector, that will be relative to the element to scroll ( 'li:eq(2)', etc )
|
||||||
* - A hash { top:x, left:y }, x and y can be any kind of number/string like above.
|
* - A hash { top:x, left:y }, x and y can be any kind of number/string like above.
|
||||||
* - A percentage of the container's dimension/s, for example: 50% to go to the middle.
|
* - A percentage of the container's dimension/s, for example: 50% to go to the middle.
|
||||||
* - The string 'max' for go-to-end.
|
* - The string 'max' for go-to-end.
|
||||||
* @param {Number} duration The OVERALL length of the animation, this argument can be the settings object instead.
|
* @param {Number} duration The OVERALL length of the animation, this argument can be the settings object instead.
|
||||||
* @param {Object,Function} settings Optional set of settings or the onAfter callback.
|
* @param {Object,Function} settings Optional set of settings or the onAfter callback.
|
||||||
* @option {String} axis Which axis must be scrolled, use 'x', 'y', 'xy' or 'yx'.
|
* @option {String} axis Which axis must be scrolled, use 'x', 'y', 'xy' or 'yx'.
|
||||||
* @option {Number} duration The OVERALL length of the animation.
|
* @option {Number} duration The OVERALL length of the animation.
|
||||||
* @option {String} easing The easing method for the animation.
|
* @option {String} easing The easing method for the animation.
|
||||||
* @option {Boolean} margin If true, the margin of the target element will be deducted from the final position.
|
* @option {Boolean} margin If true, the margin of the target element will be deducted from the final position.
|
||||||
* @option {Object, Number} offset Add/deduct from the end position. One number for both axes or { top:x, left:y }.
|
* @option {Object, Number} offset Add/deduct from the end position. One number for both axes or { top:x, left:y }.
|
||||||
* @option {Object, Number} over Add/deduct the height/width multiplied by 'over', can be { top:x, left:y } when using both axes.
|
* @option {Object, Number} over Add/deduct the height/width multiplied by 'over', can be { top:x, left:y } when using both axes.
|
||||||
* @option {Boolean} queue If true, and both axis are given, the 2nd axis will only be animated after the first one ends.
|
* @option {Boolean} queue If true, and both axis are given, the 2nd axis will only be animated after the first one ends.
|
||||||
* @option {Function} onAfter Function to be called after the scrolling ends.
|
* @option {Function} onAfter Function to be called after the scrolling ends.
|
||||||
* @option {Function} onAfterFirst If queuing is activated, this function will be called after the first scrolling ends.
|
* @option {Function} onAfterFirst If queuing is activated, this function will be called after the first scrolling ends.
|
||||||
* @return {jQuery} Returns the same jQuery object, for chaining.
|
* @return {jQuery} Returns the same jQuery object, for chaining.
|
||||||
*
|
*
|
||||||
* @desc Scroll to a fixed position
|
* @desc Scroll to a fixed position
|
||||||
* @example $('div').scrollTo( 340 );
|
* @example $('div').scrollTo( 340 );
|
||||||
*
|
*
|
||||||
* @desc Scroll relatively to the actual position
|
* @desc Scroll relatively to the actual position
|
||||||
* @example $('div').scrollTo( '+=340px', { axis:'y' } );
|
* @example $('div').scrollTo( '+=340px', { axis:'y' } );
|
||||||
*
|
*
|
||||||
* @dec Scroll using a selector (relative to the scrolled element)
|
* @dec Scroll using a selector (relative to the scrolled element)
|
||||||
* @example $('div').scrollTo( 'p.paragraph:eq(2)', 500, { easing:'swing', queue:true, axis:'xy' } );
|
* @example $('div').scrollTo( 'p.paragraph:eq(2)', 500, { easing:'swing', queue:true, axis:'xy' } );
|
||||||
*
|
*
|
||||||
* @ Scroll to a DOM element (same for jQuery object)
|
* @ Scroll to a DOM element (same for jQuery object)
|
||||||
* @example var second_child = document.getElementById('container').firstChild.nextSibling;
|
* @example var second_child = document.getElementById('container').firstChild.nextSibling;
|
||||||
* $('#container').scrollTo( second_child, { duration:500, axis:'x', onAfter:function(){
|
* $('#container').scrollTo( second_child, { duration:500, axis:'x', onAfter:function(){
|
||||||
* alert('scrolled!!');
|
* alert('scrolled!!');
|
||||||
* }});
|
* }});
|
||||||
*
|
*
|
||||||
* @desc Scroll on both axes, to different values
|
* @desc Scroll on both axes, to different values
|
||||||
* @example $('div').scrollTo( { top: 300, left:'+=200' }, { axis:'xy', offset:-20 } );
|
* @example $('div').scrollTo( { top: 300, left:'+=200' }, { axis:'xy', offset:-20 } );
|
||||||
*/
|
*/
|
||||||
;(function( $ ){
|
;(function( $ ){
|
||||||
|
|
||||||
var $scrollTo = $.scrollTo = function( target, duration, settings ){
|
var $scrollTo = $.scrollTo = function( target, duration, settings ){
|
||||||
$(window).scrollTo( target, duration, settings );
|
$(window).scrollTo( target, duration, settings );
|
||||||
};
|
};
|
||||||
|
|
||||||
$scrollTo.defaults = {
|
$scrollTo.defaults = {
|
||||||
axis:'xy',
|
axis:'xy',
|
||||||
duration: parseFloat($.fn.jquery) >= 1.3 ? 0 : 1
|
duration: parseFloat($.fn.jquery) >= 1.3 ? 0 : 1
|
||||||
};
|
};
|
||||||
|
|
||||||
// Returns the element that needs to be animated to scroll the window.
|
// Returns the element that needs to be animated to scroll the window.
|
||||||
// Kept for backwards compatibility (specially for localScroll & serialScroll)
|
// Kept for backwards compatibility (specially for localScroll & serialScroll)
|
||||||
$scrollTo.window = function( scope ){
|
$scrollTo.window = function( scope ){
|
||||||
return $(window)._scrollable();
|
return $(window)._scrollable();
|
||||||
};
|
};
|
||||||
|
|
||||||
// Hack, hack, hack :)
|
// Hack, hack, hack :)
|
||||||
// Returns the real elements to scroll (supports window/iframes, documents and regular nodes)
|
// Returns the real elements to scroll (supports window/iframes, documents and regular nodes)
|
||||||
$.fn._scrollable = function(){
|
$.fn._scrollable = function(){
|
||||||
return this.map(function(){
|
return this.map(function(){
|
||||||
var elem = this,
|
var elem = this,
|
||||||
isWin = !elem.nodeName || $.inArray( elem.nodeName.toLowerCase(), ['iframe','#document','html','body'] ) != -1;
|
isWin = !elem.nodeName || $.inArray( elem.nodeName.toLowerCase(), ['iframe','#document','html','body'] ) != -1;
|
||||||
|
|
||||||
if( !isWin )
|
if( !isWin )
|
||||||
return elem;
|
return elem;
|
||||||
|
|
||||||
var doc = (elem.contentWindow || elem).document || elem.ownerDocument || elem;
|
var doc = (elem.contentWindow || elem).document || elem.ownerDocument || elem;
|
||||||
|
|
||||||
return $.browser.safari || doc.compatMode == 'BackCompat' ?
|
return $.browser.safari || doc.compatMode == 'BackCompat' ?
|
||||||
doc.body :
|
doc.body :
|
||||||
doc.documentElement;
|
doc.documentElement;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
$.fn.scrollTo = function( target, duration, settings ){
|
$.fn.scrollTo = function( target, duration, settings ){
|
||||||
if( typeof duration == 'object' ){
|
if( typeof duration == 'object' ){
|
||||||
settings = duration;
|
settings = duration;
|
||||||
duration = 0;
|
duration = 0;
|
||||||
}
|
}
|
||||||
if( typeof settings == 'function' )
|
if( typeof settings == 'function' )
|
||||||
settings = { onAfter:settings };
|
settings = { onAfter:settings };
|
||||||
|
|
||||||
if( target == 'max' )
|
if( target == 'max' )
|
||||||
target = 9e9;
|
target = 9e9;
|
||||||
|
|
||||||
settings = $.extend( {}, $scrollTo.defaults, settings );
|
settings = $.extend( {}, $scrollTo.defaults, settings );
|
||||||
// Speed is still recognized for backwards compatibility
|
// Speed is still recognized for backwards compatibility
|
||||||
duration = duration || settings.speed || settings.duration;
|
duration = duration || settings.speed || settings.duration;
|
||||||
// Make sure the settings are given right
|
// Make sure the settings are given right
|
||||||
settings.queue = settings.queue && settings.axis.length > 1;
|
settings.queue = settings.queue && settings.axis.length > 1;
|
||||||
|
|
||||||
if( settings.queue )
|
if( settings.queue )
|
||||||
// Let's keep the overall duration
|
// Let's keep the overall duration
|
||||||
duration /= 2;
|
duration /= 2;
|
||||||
settings.offset = both( settings.offset );
|
settings.offset = both( settings.offset );
|
||||||
settings.over = both( settings.over );
|
settings.over = both( settings.over );
|
||||||
|
|
||||||
return this._scrollable().each(function(){
|
return this._scrollable().each(function(){
|
||||||
var elem = this,
|
var elem = this,
|
||||||
$elem = $(elem),
|
$elem = $(elem),
|
||||||
targ = target, toff, attr = {},
|
targ = target, toff, attr = {},
|
||||||
win = $elem.is('html,body');
|
win = $elem.is('html,body');
|
||||||
|
|
||||||
switch( typeof targ ){
|
switch( typeof targ ){
|
||||||
// A number will pass the regex
|
// A number will pass the regex
|
||||||
case 'number':
|
case 'number':
|
||||||
case 'string':
|
case 'string':
|
||||||
if( /^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(targ) ){
|
if( /^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(targ) ){
|
||||||
targ = both( targ );
|
targ = both( targ );
|
||||||
// We are done
|
// We are done
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// Relative selector, no break!
|
// Relative selector, no break!
|
||||||
targ = $(targ,this);
|
targ = $(targ,this);
|
||||||
case 'object':
|
case 'object':
|
||||||
// DOMElement / jQuery
|
// DOMElement / jQuery
|
||||||
if( targ.is || targ.style )
|
if( targ.is || targ.style )
|
||||||
// Get the real position of the target
|
// Get the real position of the target
|
||||||
toff = (targ = $(targ)).offset();
|
toff = (targ = $(targ)).offset();
|
||||||
}
|
}
|
||||||
$.each( settings.axis.split(''), function( i, axis ){
|
$.each( settings.axis.split(''), function( i, axis ){
|
||||||
var Pos = axis == 'x' ? 'Left' : 'Top',
|
var Pos = axis == 'x' ? 'Left' : 'Top',
|
||||||
pos = Pos.toLowerCase(),
|
pos = Pos.toLowerCase(),
|
||||||
key = 'scroll' + Pos,
|
key = 'scroll' + Pos,
|
||||||
old = elem[key],
|
old = elem[key],
|
||||||
max = $scrollTo.max(elem, axis);
|
max = $scrollTo.max(elem, axis);
|
||||||
|
|
||||||
if( toff ){// jQuery / DOMElement
|
if( toff ){// jQuery / DOMElement
|
||||||
attr[key] = toff[pos] + ( win ? 0 : old - $elem.offset()[pos] );
|
attr[key] = toff[pos] + ( win ? 0 : old - $elem.offset()[pos] );
|
||||||
|
|
||||||
// If it's a dom element, reduce the margin
|
// If it's a dom element, reduce the margin
|
||||||
if( settings.margin ){
|
if( settings.margin ){
|
||||||
attr[key] -= parseInt(targ.css('margin'+Pos)) || 0;
|
attr[key] -= parseInt(targ.css('margin'+Pos)) || 0;
|
||||||
attr[key] -= parseInt(targ.css('border'+Pos+'Width')) || 0;
|
attr[key] -= parseInt(targ.css('border'+Pos+'Width')) || 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
attr[key] += settings.offset[pos] || 0;
|
attr[key] += settings.offset[pos] || 0;
|
||||||
|
|
||||||
if( settings.over[pos] )
|
if( settings.over[pos] )
|
||||||
// Scroll to a fraction of its width/height
|
// Scroll to a fraction of its width/height
|
||||||
attr[key] += targ[axis=='x'?'width':'height']() * settings.over[pos];
|
attr[key] += targ[axis=='x'?'width':'height']() * settings.over[pos];
|
||||||
}else{
|
}else{
|
||||||
var val = targ[pos];
|
var val = targ[pos];
|
||||||
// Handle percentage values
|
// Handle percentage values
|
||||||
attr[key] = val.slice && val.slice(-1) == '%' ?
|
attr[key] = val.slice && val.slice(-1) == '%' ?
|
||||||
parseFloat(val) / 100 * max
|
parseFloat(val) / 100 * max
|
||||||
: val;
|
: val;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Number or 'number'
|
// Number or 'number'
|
||||||
if( /^\d+$/.test(attr[key]) )
|
if( /^\d+$/.test(attr[key]) )
|
||||||
// Check the limits
|
// Check the limits
|
||||||
attr[key] = attr[key] <= 0 ? 0 : Math.min( attr[key], max );
|
attr[key] = attr[key] <= 0 ? 0 : Math.min( attr[key], max );
|
||||||
|
|
||||||
// Queueing axes
|
// Queueing axes
|
||||||
if( !i && settings.queue ){
|
if( !i && settings.queue ){
|
||||||
// Don't waste time animating, if there's no need.
|
// Don't waste time animating, if there's no need.
|
||||||
if( old != attr[key] )
|
if( old != attr[key] )
|
||||||
// Intermediate animation
|
// Intermediate animation
|
||||||
animate( settings.onAfterFirst );
|
animate( settings.onAfterFirst );
|
||||||
// Don't animate this axis again in the next iteration.
|
// Don't animate this axis again in the next iteration.
|
||||||
delete attr[key];
|
delete attr[key];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
animate( settings.onAfter );
|
animate( settings.onAfter );
|
||||||
|
|
||||||
function animate( callback ){
|
function animate( callback ){
|
||||||
$elem.animate( attr, duration, settings.easing, callback && function(){
|
$elem.animate( attr, duration, settings.easing, callback && function(){
|
||||||
callback.call(this, target, settings);
|
callback.call(this, target, settings);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
}).end();
|
}).end();
|
||||||
};
|
};
|
||||||
|
|
||||||
// Max scrolling position, works on quirks mode
|
// Max scrolling position, works on quirks mode
|
||||||
// It only fails (not too badly) on IE, quirks mode.
|
// It only fails (not too badly) on IE, quirks mode.
|
||||||
$scrollTo.max = function( elem, axis ){
|
$scrollTo.max = function( elem, axis ){
|
||||||
var Dim = axis == 'x' ? 'Width' : 'Height',
|
var Dim = axis == 'x' ? 'Width' : 'Height',
|
||||||
scroll = 'scroll'+Dim;
|
scroll = 'scroll'+Dim;
|
||||||
|
|
||||||
if( !$(elem).is('html,body') )
|
if( !$(elem).is('html,body') )
|
||||||
return elem[scroll] - $(elem)[Dim.toLowerCase()]();
|
return elem[scroll] - $(elem)[Dim.toLowerCase()]();
|
||||||
|
|
||||||
var size = 'client' + Dim,
|
var size = 'client' + Dim,
|
||||||
html = elem.ownerDocument.documentElement,
|
html = elem.ownerDocument.documentElement,
|
||||||
body = elem.ownerDocument.body;
|
body = elem.ownerDocument.body;
|
||||||
|
|
||||||
return Math.max( html[scroll], body[scroll] )
|
return Math.max( html[scroll], body[scroll] )
|
||||||
- Math.min( html[size] , body[size] );
|
- Math.min( html[size] , body[size] );
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function both( val ){
|
function both( val ){
|
||||||
return typeof val == 'object' ? val : { top:val, left:val };
|
return typeof val == 'object' ? val : { top:val, left:val };
|
||||||
};
|
};
|
||||||
|
|
||||||
})( jQuery );
|
})( jQuery );
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
/* This code is executed after the DOM has been completely loaded */
|
/* This code is executed after the DOM has been completely loaded */
|
||||||
|
|
||||||
$('nav a,footer a.up').click(function(e){
|
$('nav a,footer a.up').click(function(e){
|
||||||
|
|
||||||
// If a link has been clicked, scroll the page to the link's hash target:
|
// If a link has been clicked, scroll the page to the link's hash target:
|
||||||
|
|
||||||
$.scrollTo( this.hash || 0, 1500);
|
$.scrollTo( this.hash || 0, 1500);
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
@@ -1,219 +1,219 @@
|
|||||||
*{
|
*{
|
||||||
/* Universal reset: */
|
/* Universal reset: */
|
||||||
margin:0;
|
margin:0;
|
||||||
padding:0;
|
padding:0;
|
||||||
}
|
}
|
||||||
|
|
||||||
header,footer,
|
header,footer,
|
||||||
article,section,
|
article,section,
|
||||||
hgroup,nav,
|
hgroup,nav,
|
||||||
figure{
|
figure{
|
||||||
/* Giving a display value to the HTML5 rendered elements: */
|
/* Giving a display value to the HTML5 rendered elements: */
|
||||||
display:block;
|
display:block;
|
||||||
}
|
}
|
||||||
|
|
||||||
body{
|
body{
|
||||||
/* Setting the default text color, size, page background and a font stack: */
|
/* Setting the default text color, size, page background and a font stack: */
|
||||||
font-size:0.825em;
|
font-size:0.825em;
|
||||||
color:#fcfcfc;
|
color:#fcfcfc;
|
||||||
background-color:#355664;
|
background-color:#355664;
|
||||||
font-family:Arial, Helvetica, sans-serif;
|
font-family:Arial, Helvetica, sans-serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Hyperlink Styles: */
|
/* Hyperlink Styles: */
|
||||||
|
|
||||||
a, a:visited {
|
a, a:visited {
|
||||||
color:#0196e3;
|
color:#0196e3;
|
||||||
text-decoration:none;
|
text-decoration:none;
|
||||||
outline:none;
|
outline:none;
|
||||||
}
|
}
|
||||||
|
|
||||||
a:hover{
|
a:hover{
|
||||||
text-decoration:underline;
|
text-decoration:underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
a img{
|
a img{
|
||||||
border:none;
|
border:none;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Headings: */
|
/* Headings: */
|
||||||
|
|
||||||
h1,h2,h3{
|
h1,h2,h3{
|
||||||
font-family:"Myriad Pro","Helvetica Neue",Helvetica,Arial,Sans-Serif;
|
font-family:"Myriad Pro","Helvetica Neue",Helvetica,Arial,Sans-Serif;
|
||||||
text-shadow:0 1px 1px black;
|
text-shadow:0 1px 1px black;
|
||||||
}
|
}
|
||||||
|
|
||||||
h1{
|
h1{
|
||||||
/* The logo text */
|
/* The logo text */
|
||||||
font-size:3.5em;
|
font-size:3.5em;
|
||||||
padding:0.5em 0 0;
|
padding:0.5em 0 0;
|
||||||
text-transform:uppercase;
|
text-transform:uppercase;
|
||||||
}
|
}
|
||||||
|
|
||||||
h3{
|
h3{
|
||||||
/* The slogan text */
|
/* The slogan text */
|
||||||
font-family:forte,"Myriad Pro","Helvetica Neue",Helvetica,Arial,Sans-Serif;
|
font-family:forte,"Myriad Pro","Helvetica Neue",Helvetica,Arial,Sans-Serif;
|
||||||
font-size:2em;
|
font-size:2em;
|
||||||
font-weight:normal;
|
font-weight:normal;
|
||||||
margin:0 0 1em;
|
margin:0 0 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
h2{
|
h2{
|
||||||
font-size:2.2em;
|
font-size:2.2em;
|
||||||
font-weight:normal;
|
font-weight:normal;
|
||||||
letter-spacing:0.01em;
|
letter-spacing:0.01em;
|
||||||
text-transform:uppercase;
|
text-transform:uppercase;
|
||||||
}
|
}
|
||||||
|
|
||||||
p{
|
p{
|
||||||
line-height:1.5em;
|
line-height:1.5em;
|
||||||
padding-bottom:1em;
|
padding-bottom:1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.line{
|
.line{
|
||||||
/* The dividing line: */
|
/* The dividing line: */
|
||||||
height:1px;
|
height:1px;
|
||||||
background-color:#24404c;
|
background-color:#24404c;
|
||||||
border-bottom:1px solid #416371;
|
border-bottom:1px solid #416371;
|
||||||
margin:1em 0;
|
margin:1em 0;
|
||||||
overflow:hidden;
|
overflow:hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
article .line{
|
article .line{
|
||||||
/* The dividing line inside of the article is darker: */
|
/* The dividing line inside of the article is darker: */
|
||||||
background-color:#15242a;
|
background-color:#15242a;
|
||||||
border-bottom-color:#204656;
|
border-bottom-color:#204656;
|
||||||
margin:1.3em 0;
|
margin:1.3em 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
footer .line{
|
footer .line{
|
||||||
margin:2em 0;
|
margin:2em 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
nav{
|
nav{
|
||||||
background:url(img/gradient_light.jpg) repeat-x 50% 50% #f8f8f8;
|
background:url(img/gradient_light.jpg) repeat-x 50% 50% #f8f8f8;
|
||||||
padding:0 5px;
|
padding:0 5px;
|
||||||
position:absolute;
|
position:absolute;
|
||||||
right:0;
|
right:0;
|
||||||
top:4em;
|
top:4em;
|
||||||
|
|
||||||
border:1px solid #FCFCFC;
|
border:1px solid #FCFCFC;
|
||||||
|
|
||||||
-moz-box-shadow:0 1px 1px #333333;
|
-moz-box-shadow:0 1px 1px #333333;
|
||||||
-webkit-box-shadow:0 1px 1px #333333;
|
-webkit-box-shadow:0 1px 1px #333333;
|
||||||
box-shadow:0 1px 1px #333333;
|
box-shadow:0 1px 1px #333333;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The clearfix hack to clear the floats: */
|
/* The clearfix hack to clear the floats: */
|
||||||
|
|
||||||
.clear:after{
|
.clear:after{
|
||||||
content: ".";
|
content: ".";
|
||||||
display: block;
|
display: block;
|
||||||
height: 0;
|
height: 0;
|
||||||
clear: both;
|
clear: both;
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The navigation styling: */
|
/* The navigation styling: */
|
||||||
|
|
||||||
nav ul li{
|
nav ul li{
|
||||||
display:inline;
|
display:inline;
|
||||||
}
|
}
|
||||||
|
|
||||||
nav ul li a,
|
nav ul li a,
|
||||||
nav ul li a:visited{
|
nav ul li a:visited{
|
||||||
color:#565656;
|
color:#565656;
|
||||||
display:block;
|
display:block;
|
||||||
float:left;
|
float:left;
|
||||||
font-size:1.25em;
|
font-size:1.25em;
|
||||||
font-weight:bold;
|
font-weight:bold;
|
||||||
margin:5px 2px;
|
margin:5px 2px;
|
||||||
padding:7px 10px 4px;
|
padding:7px 10px 4px;
|
||||||
text-shadow:0 1px 1px white;
|
text-shadow:0 1px 1px white;
|
||||||
text-transform:uppercase;
|
text-transform:uppercase;
|
||||||
}
|
}
|
||||||
|
|
||||||
nav ul li a:hover{
|
nav ul li a:hover{
|
||||||
text-decoration:none;
|
text-decoration:none;
|
||||||
background-color:#f0f0f0;
|
background-color:#f0f0f0;
|
||||||
}
|
}
|
||||||
|
|
||||||
nav, article, nav ul li a,figure{
|
nav, article, nav ul li a,figure{
|
||||||
/* Applying CSS3 rounded corners: */
|
/* Applying CSS3 rounded corners: */
|
||||||
-moz-border-radius:10px;
|
-moz-border-radius:10px;
|
||||||
-webkit-border-radius:10px;
|
-webkit-border-radius:10px;
|
||||||
border-radius:10px;
|
border-radius:10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Article styles: */
|
/* Article styles: */
|
||||||
|
|
||||||
#page{
|
#page{
|
||||||
width:960px;
|
width:960px;
|
||||||
margin:0 auto;
|
margin:0 auto;
|
||||||
position:relative;
|
position:relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
article{
|
article{
|
||||||
background-color:#213E4A;
|
background-color:#213E4A;
|
||||||
margin:3em 0;
|
margin:3em 0;
|
||||||
padding:20px;
|
padding:20px;
|
||||||
|
|
||||||
text-shadow:0 2px 0 black;
|
text-shadow:0 2px 0 black;
|
||||||
}
|
}
|
||||||
|
|
||||||
figure{
|
figure{
|
||||||
border:3px solid #142830;
|
border:3px solid #142830;
|
||||||
float:right;
|
float:right;
|
||||||
height:300px;
|
height:300px;
|
||||||
margin-left:15px;
|
margin-left:15px;
|
||||||
overflow:hidden;
|
overflow:hidden;
|
||||||
width:500px;
|
width:500px;
|
||||||
}
|
}
|
||||||
|
|
||||||
figure:hover{
|
figure:hover{
|
||||||
-moz-box-shadow:0 0 2px #4D7788;
|
-moz-box-shadow:0 0 2px #4D7788;
|
||||||
-webkit-box-shadow:0 0 2px #4D7788;
|
-webkit-box-shadow:0 0 2px #4D7788;
|
||||||
box-shadow:0 0 2px #4D7788;
|
box-shadow:0 0 2px #4D7788;
|
||||||
}
|
}
|
||||||
|
|
||||||
figure img{
|
figure img{
|
||||||
margin-left:-60px;
|
margin-left:-60px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Footer styling: */
|
/* Footer styling: */
|
||||||
|
|
||||||
footer{
|
footer{
|
||||||
margin-bottom:30px;
|
margin-bottom:30px;
|
||||||
text-align:center;
|
text-align:center;
|
||||||
font-size:0.825em;
|
font-size:0.825em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
footer p{
|
footer p{
|
||||||
margin-bottom:-2.5em;
|
margin-bottom:-2.5em;
|
||||||
position:relative;
|
position:relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
footer a,footer a:visited{
|
footer a,footer a:visited{
|
||||||
color:#cccccc;
|
color:#cccccc;
|
||||||
background-color:#213e4a;
|
background-color:#213e4a;
|
||||||
display:block;
|
display:block;
|
||||||
padding:2px 4px;
|
padding:2px 4px;
|
||||||
z-index:100;
|
z-index:100;
|
||||||
position:relative;
|
position:relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
footer a:hover{
|
footer a:hover{
|
||||||
text-decoration:none;
|
text-decoration:none;
|
||||||
background-color:#142830;
|
background-color:#142830;
|
||||||
}
|
}
|
||||||
|
|
||||||
footer a.by{
|
footer a.by{
|
||||||
float:left;
|
float:left;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
footer a.up{
|
footer a.up{
|
||||||
float:right;
|
float:right;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,139 +1,139 @@
|
|||||||
<!DOCTYPE html> <!-- The new doctype -->
|
<!DOCTYPE html> <!-- The new doctype -->
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
|
||||||
<title>Coding A CSS3 & HTML5 One Page Template | Tutorialzine demo</title>
|
<title>Coding A CSS3 & HTML5 One Page Template | Tutorialzine demo</title>
|
||||||
|
|
||||||
<link rel="stylesheet" type="text/css" href="styles.css" />
|
<link rel="stylesheet" type="text/css" href="styles.css" />
|
||||||
|
|
||||||
<!-- Internet Explorer HTML5 enabling code: -->
|
<!-- Internet Explorer HTML5 enabling code: -->
|
||||||
|
|
||||||
<!--[if IE]>
|
<!--[if IE]>
|
||||||
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||||
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
.clear {
|
.clear {
|
||||||
zoom: 1;
|
zoom: 1;
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
||||||
<![endif]-->
|
<![endif]-->
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<section id="page"> <!-- Defining the #page section with the section tag -->
|
<section id="page"> <!-- Defining the #page section with the section tag -->
|
||||||
|
|
||||||
<header> <!-- Defining the header section of the page with the appropriate tag -->
|
<header> <!-- Defining the header section of the page with the appropriate tag -->
|
||||||
|
|
||||||
<hgroup>
|
<hgroup>
|
||||||
<h1>Your Logo</h1>
|
<h1>Your Logo</h1>
|
||||||
<h3>and a fancy slogan</h3>
|
<h3>and a fancy slogan</h3>
|
||||||
</hgroup>
|
</hgroup>
|
||||||
|
|
||||||
<nav class="clear"> <!-- The nav link semantically marks your main site navigation -->
|
<nav class="clear"> <!-- The nav link semantically marks your main site navigation -->
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="#article1">Photoshoot</a></li>
|
<li><a href="#article1">Photoshoot</a></li>
|
||||||
<li><a href="#article2">Sweet Tabs</a></li>
|
<li><a href="#article2">Sweet Tabs</a></li>
|
||||||
<li><a href="#article3">Navigation Menu</a></li>
|
<li><a href="#article3">Navigation Menu</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<section id="articles"> <!-- A new section with the articles -->
|
<section id="articles"> <!-- A new section with the articles -->
|
||||||
|
|
||||||
<!-- Article 1 start -->
|
<!-- Article 1 start -->
|
||||||
|
|
||||||
<div class="line"></div> <!-- Dividing line -->
|
<div class="line"></div> <!-- Dividing line -->
|
||||||
|
|
||||||
<article id="article1"> <!-- The new article tag. The id is supplied so it can be scrolled into view. -->
|
<article id="article1"> <!-- The new article tag. The id is supplied so it can be scrolled into view. -->
|
||||||
<h2>Photoshoot Effect</h2>
|
<h2>Photoshoot Effect</h2>
|
||||||
|
|
||||||
<div class="line"></div>
|
<div class="line"></div>
|
||||||
|
|
||||||
<div class="articleBody clear">
|
<div class="articleBody clear">
|
||||||
|
|
||||||
<figure> <!-- The figure tag marks data (usually an image) that is part of the article -->
|
<figure> <!-- The figure tag marks data (usually an image) that is part of the article -->
|
||||||
<a href="http://tutorialzine.com/2010/02/photo-shoot-css-jquery/"><img src="http://tutorialzine.com/img/featured/641.jpg" width="620" height="340" /></a>
|
<a href="http://tutorialzine.com/2010/02/photo-shoot-css-jquery/"><img src="http://tutorialzine.com/img/featured/641.jpg" width="620" height="340" /></a>
|
||||||
</figure>
|
</figure>
|
||||||
|
|
||||||
<p>In this tutorial, we are creating a photo shoot effect with our just-released PhotoShoot jQuery plug-in. With it you can convert a regular div on the page into a photo shooting stage simulating a camera-like feel.</p>
|
<p>In this tutorial, we are creating a photo shoot effect with our just-released PhotoShoot jQuery plug-in. With it you can convert a regular div on the page into a photo shooting stage simulating a camera-like feel.</p>
|
||||||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer luctus quam quis nibh fringilla sit amet consectetur lectus malesuada. Sed nec libero erat. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc mi nisi, rhoncus ut vestibulum ac, sollicitudin quis lorem. Duis felis dui, vulputate nec adipiscing nec, interdum vel tortor. Sed gravida, erat nec rutrum tincidunt, metus mauris imperdiet nunc, et elementum tortor nunc at eros. Donec malesuada congue molestie. Suspendisse potenti. Vestibulum cursus congue sem et feugiat. Morbi quis elit odio. </p>
|
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer luctus quam quis nibh fringilla sit amet consectetur lectus malesuada. Sed nec libero erat. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc mi nisi, rhoncus ut vestibulum ac, sollicitudin quis lorem. Duis felis dui, vulputate nec adipiscing nec, interdum vel tortor. Sed gravida, erat nec rutrum tincidunt, metus mauris imperdiet nunc, et elementum tortor nunc at eros. Donec malesuada congue molestie. Suspendisse potenti. Vestibulum cursus congue sem et feugiat. Morbi quis elit odio. </p>
|
||||||
</div>
|
</div>
|
||||||
</article>
|
</article>
|
||||||
|
|
||||||
<!-- Article 1 end -->
|
<!-- Article 1 end -->
|
||||||
|
|
||||||
|
|
||||||
<!-- Article 2 start -->
|
<!-- Article 2 start -->
|
||||||
|
|
||||||
<div class="line"></div>
|
<div class="line"></div>
|
||||||
|
|
||||||
<article id="article2">
|
<article id="article2">
|
||||||
<h2>Sweet AJAX Tabs</h2>
|
<h2>Sweet AJAX Tabs</h2>
|
||||||
|
|
||||||
<div class="line"></div>
|
<div class="line"></div>
|
||||||
|
|
||||||
<div class="articleBody clear">
|
<div class="articleBody clear">
|
||||||
<figure>
|
<figure>
|
||||||
<a href="http://tutorialzine.com/2010/01/sweet-tabs-jquery-ajax-css/"><img src="http://tutorialzine.com/img/featured/633.jpg" width="620" height="340" /></a>
|
<a href="http://tutorialzine.com/2010/01/sweet-tabs-jquery-ajax-css/"><img src="http://tutorialzine.com/img/featured/633.jpg" width="620" height="340" /></a>
|
||||||
</figure>
|
</figure>
|
||||||
|
|
||||||
<p>Here we are making sweet AJAX-powered tabs with CSS3 and the newly released version 1.4 of jQuery.</p>
|
<p>Here we are making sweet AJAX-powered tabs with CSS3 and the newly released version 1.4 of jQuery.</p>
|
||||||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer luctus quam quis nibh fringilla sit amet consectetur lectus malesuada. Sed nec libero erat. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc mi nisi, rhoncus ut vestibulum ac, sollicitudin quis lorem. Duis felis dui, vulputate nec adipiscing nec, interdum vel tortor. Sed gravida, erat nec rutrum tincidunt, metus mauris imperdiet nunc, et elementum tortor nunc at eros. Donec malesuada congue molestie. Suspendisse potenti. Vestibulum cursus congue sem et feugiat. Morbi quis elit odio. </p>
|
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer luctus quam quis nibh fringilla sit amet consectetur lectus malesuada. Sed nec libero erat. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc mi nisi, rhoncus ut vestibulum ac, sollicitudin quis lorem. Duis felis dui, vulputate nec adipiscing nec, interdum vel tortor. Sed gravida, erat nec rutrum tincidunt, metus mauris imperdiet nunc, et elementum tortor nunc at eros. Donec malesuada congue molestie. Suspendisse potenti. Vestibulum cursus congue sem et feugiat. Morbi quis elit odio. </p>
|
||||||
</div>
|
</div>
|
||||||
</article>
|
</article>
|
||||||
|
|
||||||
<!-- Article 2 end -->
|
<!-- Article 2 end -->
|
||||||
|
|
||||||
<!-- Article 3 start -->
|
<!-- Article 3 start -->
|
||||||
|
|
||||||
<div class="line"></div>
|
<div class="line"></div>
|
||||||
|
|
||||||
<article id="article3">
|
<article id="article3">
|
||||||
<h2>Halftone Navigation Menu</h2>
|
<h2>Halftone Navigation Menu</h2>
|
||||||
|
|
||||||
<div class="line"></div>
|
<div class="line"></div>
|
||||||
|
|
||||||
<div class="articleBody clear">
|
<div class="articleBody clear">
|
||||||
<figure>
|
<figure>
|
||||||
<a href="http://tutorialzine.com/2010/01/halftone-navigation-menu-jquery-css/"><img src="http://tutorialzine.com/img/featured/610.jpg" width="620" height="340" /></a>
|
<a href="http://tutorialzine.com/2010/01/halftone-navigation-menu-jquery-css/"><img src="http://tutorialzine.com/img/featured/610.jpg" width="620" height="340" /></a>
|
||||||
</figure>
|
</figure>
|
||||||
|
|
||||||
<p>Today we are making a CSS3 & jQuery halftone-style navigation menu, which will allow you to display animated halftone-style shapes in accordance with the navigation links, and will provide a simple editor for creating additional shapes as well.</p>
|
<p>Today we are making a CSS3 & jQuery halftone-style navigation menu, which will allow you to display animated halftone-style shapes in accordance with the navigation links, and will provide a simple editor for creating additional shapes as well.</p>
|
||||||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer luctus quam quis nibh fringilla sit amet consectetur lectus malesuada. Sed nec libero erat. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc mi nisi, rhoncus ut vestibulum ac, sollicitudin quis lorem. Duis felis dui, vulputate nec adipiscing nec, interdum vel tortor. Sed gravida, erat nec rutrum tincidunt, metus mauris imperdiet nunc, et elementum tortor nunc at eros. Donec malesuada congue molestie. Suspendisse potenti. Vestibulum cursus congue sem et feugiat. Morbi quis elit odio. </p>
|
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer luctus quam quis nibh fringilla sit amet consectetur lectus malesuada. Sed nec libero erat. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc mi nisi, rhoncus ut vestibulum ac, sollicitudin quis lorem. Duis felis dui, vulputate nec adipiscing nec, interdum vel tortor. Sed gravida, erat nec rutrum tincidunt, metus mauris imperdiet nunc, et elementum tortor nunc at eros. Donec malesuada congue molestie. Suspendisse potenti. Vestibulum cursus congue sem et feugiat. Morbi quis elit odio. </p>
|
||||||
</div>
|
</div>
|
||||||
</article>
|
</article>
|
||||||
|
|
||||||
<!-- Article 3 end -->
|
<!-- Article 3 end -->
|
||||||
|
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<footer> <!-- Marking the footer section -->
|
<footer> <!-- Marking the footer section -->
|
||||||
|
|
||||||
<div class="line"></div>
|
<div class="line"></div>
|
||||||
|
|
||||||
<p>Copyright 2010 - YourSite.com</p> <!-- Change the copyright notice -->
|
<p>Copyright 2010 - YourSite.com</p> <!-- Change the copyright notice -->
|
||||||
|
|
||||||
<a href="#" class="up">Go UP</a>
|
<a href="#" class="up">Go UP</a>
|
||||||
<a href="http://tutorialzine.com/2010/02/html5-css3-website-template/" class="by">Template by Tutorialzine</a>
|
<a href="http://tutorialzine.com/2010/02/html5-css3-website-template/" class="by">Template by Tutorialzine</a>
|
||||||
|
|
||||||
|
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
</section> <!-- Closing the #page section -->
|
</section> <!-- Closing the #page section -->
|
||||||
|
|
||||||
<!-- JavaScript Includes -->
|
<!-- JavaScript Includes -->
|
||||||
|
|
||||||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
|
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
|
||||||
<script src="jquery.scrollTo-1.4.2/jquery.scrollTo-min.js"></script>
|
<script src="jquery.scrollTo-1.4.2/jquery.scrollTo-min.js"></script>
|
||||||
<script src="script.js"></script>
|
<script src="script.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -1,43 +1,43 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
<title>Halftone Navigation Menu With jQuery & CSS3 | Tutorialzine demo</title>
|
<title>Halftone Navigation Menu With jQuery & CSS3 | Tutorialzine demo</title>
|
||||||
|
|
||||||
<link rel="stylesheet" type="text/css" href="styles.css" />
|
<link rel="stylesheet" type="text/css" href="styles.css" />
|
||||||
|
|
||||||
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
|
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
|
||||||
|
|
||||||
<script type="text/javascript" src="script.js"></script>
|
<script type="text/javascript" src="script.js"></script>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<h1>Halftone Navigation Menu With jQuery & CSS3</h1>
|
<h1>Halftone Navigation Menu With jQuery & CSS3</h1>
|
||||||
<h2>View the <a href="http://tutorialzine.com/2010/01/halftone-navigation-menu-jquery-css/">original tutorial »</a></h2>
|
<h2>View the <a href="http://tutorialzine.com/2010/01/halftone-navigation-menu-jquery-css/">original tutorial »</a></h2>
|
||||||
|
|
||||||
|
|
||||||
<div id="main">
|
<div id="main">
|
||||||
|
|
||||||
<div id="navigation">
|
<div id="navigation">
|
||||||
<ul class="menuUL">
|
<ul class="menuUL">
|
||||||
<!-- The class names that are assigned to the links correspond to name of the shape that is shown on hover: -->
|
<!-- The class names that are assigned to the links correspond to name of the shape that is shown on hover: -->
|
||||||
<li><a href="#" class="house">Home</a></li>
|
<li><a href="#" class="house">Home</a></li>
|
||||||
<li><a href="#" class="wrench">Services</a></li>
|
<li><a href="#" class="wrench">Services</a></li>
|
||||||
<li><a href="#" class="envelope">Contact</a></li>
|
<li><a href="#" class="envelope">Contact</a></li>
|
||||||
<li><a href="#" class="info">About</a></li>
|
<li><a href="#" class="info">About</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="stage">
|
<div id="stage">
|
||||||
<!-- The dot divs are shown here -->
|
<!-- The dot divs are shown here -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p class="tutInfo">This is a tutorialzine demo. View the <a href="http://tutorialzine.com/2010/01/halftone-navigation-menu-jquery-css/">original tutorial</a>, or download the <a href="demo.zip">source files</a>.</p>
|
<p class="tutInfo">This is a tutorialzine demo. View the <a href="http://tutorialzine.com/2010/01/halftone-navigation-menu-jquery-css/">original tutorial</a>, or download the <a href="demo.zip">source files</a>.</p>
|
||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -1,121 +1,121 @@
|
|||||||
/* Set serviceMode to true to create your own shapes: */
|
/* Set serviceMode to true to create your own shapes: */
|
||||||
var serviceMode = false;
|
var serviceMode = false;
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
/* This code is executed after the DOM has been completely loaded */
|
/* This code is executed after the DOM has been completely loaded */
|
||||||
|
|
||||||
var str=[];
|
var str=[];
|
||||||
var perRow = 16;
|
var perRow = 16;
|
||||||
|
|
||||||
/* Generating the dot divs: */
|
/* Generating the dot divs: */
|
||||||
|
|
||||||
for(var i=0;i<192;i++)
|
for(var i=0;i<192;i++)
|
||||||
{
|
{
|
||||||
str.push('<div class="dot" id="d-'+i+'" />');
|
str.push('<div class="dot" id="d-'+i+'" />');
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Joining the array into a string and adding it to the inner html of the stage div: */
|
/* Joining the array into a string and adding it to the inner html of the stage div: */
|
||||||
|
|
||||||
$('#stage').html(str.join(''));
|
$('#stage').html(str.join(''));
|
||||||
|
|
||||||
/* Using the hover method: */
|
/* Using the hover method: */
|
||||||
|
|
||||||
$('#navigation li a').hover(function(e){
|
$('#navigation li a').hover(function(e){
|
||||||
|
|
||||||
/* serviceDraw is a cut-out version of the draw function, used for shape editing and composing: */
|
/* serviceDraw is a cut-out version of the draw function, used for shape editing and composing: */
|
||||||
|
|
||||||
if(serviceMode)
|
if(serviceMode)
|
||||||
serviceDraw($(this).attr('class'));
|
serviceDraw($(this).attr('class'));
|
||||||
else
|
else
|
||||||
draw($(this).attr('class'));
|
draw($(this).attr('class'));
|
||||||
}, function(e){
|
}, function(e){
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/* Caching the dot divs into a variable for performance: */
|
/* Caching the dot divs into a variable for performance: */
|
||||||
dots = $('.dot');
|
dots = $('.dot');
|
||||||
|
|
||||||
if(serviceMode)
|
if(serviceMode)
|
||||||
{
|
{
|
||||||
/* If we are in service mode, show borders around the dot divs, add the export link, and listen for clicks: */
|
/* If we are in service mode, show borders around the dot divs, add the export link, and listen for clicks: */
|
||||||
|
|
||||||
dots.css({
|
dots.css({
|
||||||
border:'1px solid black',
|
border:'1px solid black',
|
||||||
width:dots.eq(0).width()-2,
|
width:dots.eq(0).width()-2,
|
||||||
height:dots.eq(0).height()-2,
|
height:dots.eq(0).height()-2,
|
||||||
cursor:'pointer'
|
cursor:'pointer'
|
||||||
})
|
})
|
||||||
|
|
||||||
$('<div/>').css({
|
$('<div/>').css({
|
||||||
position:'absolute',
|
position:'absolute',
|
||||||
bottom:-20,
|
bottom:-20,
|
||||||
right:0
|
right:0
|
||||||
}).html('<a href="" onclick="outputString();return false;">[Export Shape]</a>').appendTo('#stage');
|
}).html('<a href="" onclick="outputString();return false;">[Export Shape]</a>').appendTo('#stage');
|
||||||
|
|
||||||
dots.click(function(){
|
dots.click(function(){
|
||||||
$(this).toggleClass('active');
|
$(this).toggleClass('active');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
var shapes={
|
var shapes={
|
||||||
|
|
||||||
/* Each shape is described by an array of points. You can add your own shapes here,
|
/* Each shape is described by an array of points. You can add your own shapes here,
|
||||||
just don't forget to add a coma after each array, except for the last one */
|
just don't forget to add a coma after each array, except for the last one */
|
||||||
|
|
||||||
house:[22,37,38,39,52,53,54,55,56,67,68,69,70,71,72,73,82,83,84,85,86,87,88,89,90,99,100,104,105,115,116,120,121,131,132,136,137,147,148,150,151,152,153,163,164,166,167,168,169],
|
house:[22,37,38,39,52,53,54,55,56,67,68,69,70,71,72,73,82,83,84,85,86,87,88,89,90,99,100,104,105,115,116,120,121,131,132,136,137,147,148,150,151,152,153,163,164,166,167,168,169],
|
||||||
wrench:[22,23,24,25,26,27,38,39,40,41,42,43,54,55,58,59,70,71,86,87,88,89,101,102,103,104,105,116,117,118,131,132,133,146,147,148,163],
|
wrench:[22,23,24,25,26,27,38,39,40,41,42,43,54,55,58,59,70,71,86,87,88,89,101,102,103,104,105,116,117,118,131,132,133,146,147,148,163],
|
||||||
envelope:[34,35,36,37,38,39,40,41,42,43,44,50,51,52,58,59,60,66,68,69,73,74,76,82,85,86,88,89,92,98,102,103,104,108,114,119,124,130,140,146,147,148,149,150,151,152,153,154,155,156],
|
envelope:[34,35,36,37,38,39,40,41,42,43,44,50,51,52,58,59,60,66,68,69,73,74,76,82,85,86,88,89,92,98,102,103,104,108,114,119,124,130,140,146,147,148,149,150,151,152,153,154,155,156],
|
||||||
info:[22,23,38,39,69,70,71,86,87,102,103,118,119,134,135,150,151,166,167,168]
|
info:[22,23,38,39,69,70,71,86,87,102,103,118,119,134,135,150,151,166,167,168]
|
||||||
}
|
}
|
||||||
|
|
||||||
var stopCounter = 0;
|
var stopCounter = 0;
|
||||||
var dots;
|
var dots;
|
||||||
|
|
||||||
function draw(shape)
|
function draw(shape)
|
||||||
{
|
{
|
||||||
/* This function draws a shape from the shapes object */
|
/* This function draws a shape from the shapes object */
|
||||||
|
|
||||||
stopCounter++;
|
stopCounter++;
|
||||||
var currentCounter = stopCounter;
|
var currentCounter = stopCounter;
|
||||||
|
|
||||||
dots.removeClass('active').css('opacity',0);
|
dots.removeClass('active').css('opacity',0);
|
||||||
|
|
||||||
$.each(shapes[shape],function(i,j){
|
$.each(shapes[shape],function(i,j){
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
|
|
||||||
/* If a different shape animaton has been started during the showing of the current one, exit the function */
|
/* If a different shape animaton has been started during the showing of the current one, exit the function */
|
||||||
if(currentCounter!=stopCounter) return false;
|
if(currentCounter!=stopCounter) return false;
|
||||||
|
|
||||||
dots.eq(j).addClass('active').fadeTo('slow',0.4);
|
dots.eq(j).addClass('active').fadeTo('slow',0.4);
|
||||||
|
|
||||||
/* The fade animation is scheduled for 10*i millisecond in the future: */
|
/* The fade animation is scheduled for 10*i millisecond in the future: */
|
||||||
},10*i);
|
},10*i);
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function serviceDraw(shape)
|
function serviceDraw(shape)
|
||||||
{
|
{
|
||||||
/* A cut out version of the draw function, used in service mode */
|
/* A cut out version of the draw function, used in service mode */
|
||||||
|
|
||||||
dots.removeClass('active');
|
dots.removeClass('active');
|
||||||
|
|
||||||
$.each(shapes[shape],function(i,j){
|
$.each(shapes[shape],function(i,j){
|
||||||
dots.eq(j).addClass('active');
|
dots.eq(j).addClass('active');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function outputString()
|
function outputString()
|
||||||
{
|
{
|
||||||
/* Outputs the positions of the active dot divs as a comma-separated string: */
|
/* Outputs the positions of the active dot divs as a comma-separated string: */
|
||||||
|
|
||||||
var str=[];
|
var str=[];
|
||||||
$('.dot.active').each(function(){
|
$('.dot.active').each(function(){
|
||||||
|
|
||||||
str.push(this.id.replace('d-',''));
|
str.push(this.id.replace('d-',''));
|
||||||
})
|
})
|
||||||
|
|
||||||
prompt('Insert this string as an array in the shapes object',str.join(','));
|
prompt('Insert this string as an array in the shapes object',str.join(','));
|
||||||
}
|
}
|
||||||
@@ -1,148 +1,148 @@
|
|||||||
body,h1,h2,h3,p,quote,small,form,input,ul,li,ol,label{
|
body,h1,h2,h3,p,quote,small,form,input,ul,li,ol,label{
|
||||||
/* Simple page reset */
|
/* Simple page reset */
|
||||||
margin:0;
|
margin:0;
|
||||||
padding:0;
|
padding:0;
|
||||||
}
|
}
|
||||||
|
|
||||||
body{
|
body{
|
||||||
/* Setting default text color, background and a font stack */
|
/* Setting default text color, background and a font stack */
|
||||||
color:#cccccc;
|
color:#cccccc;
|
||||||
font-size:0.825em;
|
font-size:0.825em;
|
||||||
background: url(img/background.jpg) no-repeat center top #252525;
|
background: url(img/background.jpg) no-repeat center top #252525;
|
||||||
font-family:Arial, Helvetica, sans-serif;
|
font-family:Arial, Helvetica, sans-serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
.menuUL li{
|
.menuUL li{
|
||||||
/* This will arrange the LI-s next to each other */
|
/* This will arrange the LI-s next to each other */
|
||||||
display:inline;
|
display:inline;
|
||||||
}
|
}
|
||||||
|
|
||||||
.menuUL li a,.menuUL li a:visited{
|
.menuUL li a,.menuUL li a:visited{
|
||||||
/* Styling the hyperlinks of the menu as buttons */
|
/* Styling the hyperlinks of the menu as buttons */
|
||||||
|
|
||||||
float:left;
|
float:left;
|
||||||
font-weight:bold;
|
font-weight:bold;
|
||||||
background:url(img/button_bg.jpg) repeat-x center bottom #666666;
|
background:url(img/button_bg.jpg) repeat-x center bottom #666666;
|
||||||
|
|
||||||
/* display:block allows for additinal CSS rules to take effect, such as paddings: */
|
/* display:block allows for additinal CSS rules to take effect, such as paddings: */
|
||||||
display:block;
|
display:block;
|
||||||
border:1px solid #4D4D4D;
|
border:1px solid #4D4D4D;
|
||||||
color:#CCCCCC;
|
color:#CCCCCC;
|
||||||
border-top-color:#565656;
|
border-top-color:#565656;
|
||||||
|
|
||||||
padding:4px 6px;
|
padding:4px 6px;
|
||||||
margin:4px 5px;
|
margin:4px 5px;
|
||||||
height:16px;
|
height:16px;
|
||||||
|
|
||||||
|
|
||||||
/* Setting a CSS3 box shadow around the button */
|
/* Setting a CSS3 box shadow around the button */
|
||||||
|
|
||||||
-moz-box-shadow:0 0 1px black;
|
-moz-box-shadow:0 0 1px black;
|
||||||
-webkit-box-shadow:0 0 1px black;
|
-webkit-box-shadow:0 0 1px black;
|
||||||
box-shadow:0 0 1px black;
|
box-shadow:0 0 1px black;
|
||||||
|
|
||||||
/* CSS3 text shadow */
|
/* CSS3 text shadow */
|
||||||
text-shadow:0 1px black;
|
text-shadow:0 1px black;
|
||||||
}
|
}
|
||||||
|
|
||||||
.menuUL li a:hover{
|
.menuUL li a:hover{
|
||||||
/* On hover show the top, lighter, part of the background: */
|
/* On hover show the top, lighter, part of the background: */
|
||||||
background-position:center top;
|
background-position:center top;
|
||||||
text-decoration:none;
|
text-decoration:none;
|
||||||
}
|
}
|
||||||
|
|
||||||
#navigation{
|
#navigation{
|
||||||
/* The navigation menu bar: */
|
/* The navigation menu bar: */
|
||||||
background:#222222;
|
background:#222222;
|
||||||
border:1px solid #111111;
|
border:1px solid #111111;
|
||||||
float:left;
|
float:left;
|
||||||
padding:5px 10px;
|
padding:5px 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#navigation,.menuUL li a{
|
#navigation,.menuUL li a{
|
||||||
/* CSS3 rounded corners for both the navigation bar and the buttons: */
|
/* CSS3 rounded corners for both the navigation bar and the buttons: */
|
||||||
-moz-border-radius:4px;
|
-moz-border-radius:4px;
|
||||||
-webkit-border-radius:4px;
|
-webkit-border-radius:4px;
|
||||||
-khtml-border-radius:4px;
|
-khtml-border-radius:4px;
|
||||||
border-radius:4px;
|
border-radius:4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#stage{
|
#stage{
|
||||||
/* The stage contains the individual divs that comprise the halftone icon: */
|
/* The stage contains the individual divs that comprise the halftone icon: */
|
||||||
height:300px;
|
height:300px;
|
||||||
position:absolute;
|
position:absolute;
|
||||||
right:50px;
|
right:50px;
|
||||||
top:20px;
|
top:20px;
|
||||||
width:400px;
|
width:400px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dot{
|
.dot{
|
||||||
/* The stage contains 192 .dot divs: */
|
/* The stage contains 192 .dot divs: */
|
||||||
float:left;
|
float:left;
|
||||||
height:25px;
|
height:25px;
|
||||||
width:25px;
|
width:25px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dot.active{
|
.dot.active{
|
||||||
/* When assigned the active class, the div shows a background image of a dot: */
|
/* When assigned the active class, the div shows a background image of a dot: */
|
||||||
background:url(img/dot.png) no-repeat center center;
|
background:url(img/dot.png) no-repeat center center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.clear{
|
.clear{
|
||||||
/* Old-school clear fix hack to clear the floats: */
|
/* Old-school clear fix hack to clear the floats: */
|
||||||
clear:both;
|
clear:both;
|
||||||
}
|
}
|
||||||
|
|
||||||
#main{
|
#main{
|
||||||
margin:0 auto;
|
margin:0 auto;
|
||||||
position:relative;
|
position:relative;
|
||||||
width:900px;
|
width:900px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The styles below are only necessary for the demo page */
|
/* The styles below are only necessary for the demo page */
|
||||||
|
|
||||||
h1{
|
h1{
|
||||||
background:#222222;
|
background:#222222;
|
||||||
border-bottom:1px solid black;
|
border-bottom:1px solid black;
|
||||||
font-size:1.5em;
|
font-size:1.5em;
|
||||||
font-weight:normal;
|
font-weight:normal;
|
||||||
margin-bottom:15px;
|
margin-bottom:15px;
|
||||||
padding:15px;
|
padding:15px;
|
||||||
text-align:center;
|
text-align:center;
|
||||||
}
|
}
|
||||||
|
|
||||||
h2 {
|
h2 {
|
||||||
font-size:0.9em;
|
font-size:0.9em;
|
||||||
font-weight:normal;
|
font-weight:normal;
|
||||||
padding-right:40px;
|
padding-right:40px;
|
||||||
position:relative;
|
position:relative;
|
||||||
right:0;
|
right:0;
|
||||||
text-align:right;
|
text-align:right;
|
||||||
text-transform:uppercase;
|
text-transform:uppercase;
|
||||||
top:-48px;
|
top:-48px;
|
||||||
}
|
}
|
||||||
|
|
||||||
a, a:visited {
|
a, a:visited {
|
||||||
color:#0196e3;
|
color:#0196e3;
|
||||||
text-decoration:none;
|
text-decoration:none;
|
||||||
outline:none;
|
outline:none;
|
||||||
}
|
}
|
||||||
|
|
||||||
a:hover{
|
a:hover{
|
||||||
text-decoration:underline;
|
text-decoration:underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
p.tutInfo{
|
p.tutInfo{
|
||||||
/* The tutorial info on the bottom of the page */
|
/* The tutorial info on the bottom of the page */
|
||||||
padding:10px 0;
|
padding:10px 0;
|
||||||
text-align:center;
|
text-align:center;
|
||||||
position:absolute;
|
position:absolute;
|
||||||
bottom:0px;
|
bottom:0px;
|
||||||
background:#222222;
|
background:#222222;
|
||||||
border-top:1px solid black;
|
border-top:1px solid black;
|
||||||
width:100%;
|
width:100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
h1,h2,p.tutInfo{
|
h1,h2,p.tutInfo{
|
||||||
font-family:"Myriad Pro",Arial,Helvetica,sans-serif;
|
font-family:"Myriad Pro",Arial,Helvetica,sans-serif;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,153 +1,153 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
<head>
|
<head>
|
||||||
<title>Business Co.</title>
|
<title>Business Co.</title>
|
||||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||||
|
|
||||||
<link href="css/styles.css" rel="stylesheet" type="text/css" />
|
<link href="css/styles.css" rel="stylesheet" type="text/css" />
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
<!--
|
<!--
|
||||||
function MM_preloadImages() { //v3.0
|
function MM_preloadImages() { //v3.0
|
||||||
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
|
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
|
||||||
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
|
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
|
||||||
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
|
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
|
||||||
}
|
}
|
||||||
|
|
||||||
function MM_swapImgRestore() { //v3.0
|
function MM_swapImgRestore() { //v3.0
|
||||||
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
|
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
|
||||||
}
|
}
|
||||||
|
|
||||||
function MM_findObj(n, d) { //v4.01
|
function MM_findObj(n, d) { //v4.01
|
||||||
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
|
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
|
||||||
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
|
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
|
||||||
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
|
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
|
||||||
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
|
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
|
||||||
if(!x && d.getElementById) x=d.getElementById(n); return x;
|
if(!x && d.getElementById) x=d.getElementById(n); return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
function MM_swapImage() { //v3.0
|
function MM_swapImage() { //v3.0
|
||||||
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
|
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
|
||||||
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
|
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
|
||||||
}
|
}
|
||||||
//-->
|
//-->
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body onload="MM_preloadImages('images/btn_1_over.jpg','images/btn_2_over.jpg','images/btn_3_over.jpg','images/btn_4_over.jpg','images/btn_5_over.jpg', 'images/btn_6_over.jpg');">
|
<body onload="MM_preloadImages('images/btn_1_over.jpg','images/btn_2_over.jpg','images/btn_3_over.jpg','images/btn_4_over.jpg','images/btn_5_over.jpg', 'images/btn_6_over.jpg');">
|
||||||
<!-- Save for Web Slices (index.psd) -->
|
<!-- Save for Web Slices (index.psd) -->
|
||||||
<table width="775" height="700" border="0" align="center" cellpadding="0" cellspacing="0" id="table_01">
|
<table width="775" height="700" border="0" align="center" cellpadding="0" cellspacing="0" id="table_01">
|
||||||
<tr>
|
<tr>
|
||||||
<td width="59" height="0" nowrap="nowrap"></td>
|
<td width="59" height="0" nowrap="nowrap"></td>
|
||||||
<td width="19" height="0" nowrap="nowrap"></td>
|
<td width="19" height="0" nowrap="nowrap"></td>
|
||||||
<td width="4" height="0" nowrap="nowrap"></td>
|
<td width="4" height="0" nowrap="nowrap"></td>
|
||||||
<td width="23" height="0" nowrap="nowrap"></td>
|
<td width="23" height="0" nowrap="nowrap"></td>
|
||||||
<td width="83" height="0" nowrap="nowrap"></td>
|
<td width="83" height="0" nowrap="nowrap"></td>
|
||||||
<td width="3" height="0" nowrap="nowrap"></td>
|
<td width="3" height="0" nowrap="nowrap"></td>
|
||||||
<td width="8" height="0" nowrap="nowrap"></td>
|
<td width="8" height="0" nowrap="nowrap"></td>
|
||||||
<td width="10" height="0" nowrap="nowrap"></td>
|
<td width="10" height="0" nowrap="nowrap"></td>
|
||||||
<td width="31" height="0" nowrap="nowrap"></td>
|
<td width="31" height="0" nowrap="nowrap"></td>
|
||||||
<td width="47" height="0" nowrap="nowrap"></td>
|
<td width="47" height="0" nowrap="nowrap"></td>
|
||||||
<td width="4" height="0" nowrap="nowrap"></td>
|
<td width="4" height="0" nowrap="nowrap"></td>
|
||||||
<td width="3" height="0" nowrap="nowrap"></td>
|
<td width="3" height="0" nowrap="nowrap"></td>
|
||||||
<td width="98" height="0" nowrap="nowrap"></td>
|
<td width="98" height="0" nowrap="nowrap"></td>
|
||||||
<td width="3" height="0" nowrap="nowrap"></td>
|
<td width="3" height="0" nowrap="nowrap"></td>
|
||||||
<td width="66" height="0" nowrap="nowrap"></td>
|
<td width="66" height="0" nowrap="nowrap"></td>
|
||||||
<td width="31" height="0" nowrap="nowrap"></td>
|
<td width="31" height="0" nowrap="nowrap"></td>
|
||||||
<td width="10" height="0" nowrap="nowrap"></td>
|
<td width="10" height="0" nowrap="nowrap"></td>
|
||||||
<td width="3" height="0" nowrap="nowrap"></td>
|
<td width="3" height="0" nowrap="nowrap"></td>
|
||||||
<td width="3" height="0" nowrap="nowrap"></td>
|
<td width="3" height="0" nowrap="nowrap"></td>
|
||||||
<td width="5" height="0" nowrap="nowrap"></td>
|
<td width="5" height="0" nowrap="nowrap"></td>
|
||||||
<td width="89" height="0" nowrap="nowrap"></td>
|
<td width="89" height="0" nowrap="nowrap"></td>
|
||||||
<td width="3" height="0" nowrap="nowrap"></td>
|
<td width="3" height="0" nowrap="nowrap"></td>
|
||||||
<td width="15" height="0" nowrap="nowrap"></td>
|
<td width="15" height="0" nowrap="nowrap"></td>
|
||||||
<td width="57" height="0" nowrap="nowrap"></td>
|
<td width="57" height="0" nowrap="nowrap"></td>
|
||||||
<td width="21" height="0" nowrap="nowrap"></td>
|
<td width="21" height="0" nowrap="nowrap"></td>
|
||||||
<td width="17" height="0" nowrap="nowrap"></td>
|
<td width="17" height="0" nowrap="nowrap"></td>
|
||||||
<td width="60" height="0" nowrap="nowrap"></td>
|
<td width="60" height="0" nowrap="nowrap"></td>
|
||||||
<td width="0" height="0"></td>
|
<td width="0" height="0"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="59" height="651" rowspan="15">
|
<td width="59" height="651" rowspan="15">
|
||||||
<img src="images/main.jpg" width="59" height="651" alt="" /></td>
|
<img src="images/main.jpg" width="59" height="651" alt="" /></td>
|
||||||
<td width="561" height="33" colspan="22" align="left" valign="middle" bgcolor="#efefef" class="text3" style="padding-left:20px">SEPTEMBER 29, 2009 </td>
|
<td width="561" height="33" colspan="22" align="left" valign="middle" bgcolor="#efefef" class="text3" style="padding-left:20px">SEPTEMBER 29, 2009 </td>
|
||||||
<td width="95" height="33" colspan="3" align="left" valign="top"><a href="#"><img src="images/client_login.jpg" alt="" width="95" height="33" border="0" /></a></td>
|
<td width="95" height="33" colspan="3" align="left" valign="top"><a href="#"><img src="images/client_login.jpg" alt="" width="95" height="33" border="0" /></a></td>
|
||||||
<td width="60" height="651" rowspan="15">
|
<td width="60" height="651" rowspan="15">
|
||||||
<img src="images/main-03.jpg" width="60" height="651" alt="" /></td>
|
<img src="images/main-03.jpg" width="60" height="651" alt="" /></td>
|
||||||
<td width="0" height="33" nowrap="nowrap"></td>
|
<td width="0" height="33" nowrap="nowrap"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="656" height="21" colspan="25" align="left" valign="top" nowrap="nowrap" bgcolor="#a7a7a7"></td>
|
<td width="656" height="21" colspan="25" align="left" valign="top" nowrap="nowrap" bgcolor="#a7a7a7"></td>
|
||||||
<td width="0" height="21" nowrap="nowrap"></td>
|
<td width="0" height="21" nowrap="nowrap"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="23" height="17" colspan="2" align="left" valign="top" nowrap="nowrap" bgcolor="#a7a7a7"></td>
|
<td width="23" height="17" colspan="2" align="left" valign="top" nowrap="nowrap" bgcolor="#a7a7a7"></td>
|
||||||
<td width="106" height="17" colspan="2" align="left" valign="top" bgcolor="#a7a7a7"><a href="index.html"><img src="images/btn_1.jpg" alt="" name="btn_1" width="106" height="17" border="0" id="btn_1" onmouseover="MM_swapImage('btn_1','','images/btn_1_over.jpg',1)" onmouseout="MM_swapImgRestore()"/></a></td>
|
<td width="106" height="17" colspan="2" align="left" valign="top" bgcolor="#a7a7a7"><a href="index.html"><img src="images/btn_1.jpg" alt="" name="btn_1" width="106" height="17" border="0" id="btn_1" onmouseover="MM_swapImage('btn_1','','images/btn_1_over.jpg',1)" onmouseout="MM_swapImgRestore()"/></a></td>
|
||||||
<td width="3" height="17" align="left" valign="top" bgcolor="#a7a7a7">
|
<td width="3" height="17" align="left" valign="top" bgcolor="#a7a7a7">
|
||||||
<img src="images/lines.jpg" width="3" height="17" alt="" /></td>
|
<img src="images/lines.jpg" width="3" height="17" alt="" /></td>
|
||||||
<td width="100" height="17" colspan="5" align="left" valign="top" bgcolor="#a7a7a7"><a href="contentpage.html"><img src="images/btn_2.jpg" alt="" name="btn_2" width="100" height="17" border="0" id="btn_2" onmouseover="MM_swapImage('btn_2','','images/btn_2_over.jpg',1)" onmouseout="MM_swapImgRestore()"/></a></td>
|
<td width="100" height="17" colspan="5" align="left" valign="top" bgcolor="#a7a7a7"><a href="contentpage.html"><img src="images/btn_2.jpg" alt="" name="btn_2" width="100" height="17" border="0" id="btn_2" onmouseover="MM_swapImage('btn_2','','images/btn_2_over.jpg',1)" onmouseout="MM_swapImgRestore()"/></a></td>
|
||||||
<td width="3" height="17" align="left" valign="top" bgcolor="#a7a7a7">
|
<td width="3" height="17" align="left" valign="top" bgcolor="#a7a7a7">
|
||||||
<img src="images/lines-07.jpg" width="3" height="17" alt="" /></td>
|
<img src="images/lines-07.jpg" width="3" height="17" alt="" /></td>
|
||||||
<td width="98" height="17" align="left" valign="top" bgcolor="#a7a7a7"><a href="contentpage.html"><img src="images/btn_3.jpg" alt="" name="btn_3" width="98" height="17" border="0" id="btn_3" onmouseover="MM_swapImage('btn_3','','images/btn_3_over.jpg',1)" onmouseout="MM_swapImgRestore()"/></a></td>
|
<td width="98" height="17" align="left" valign="top" bgcolor="#a7a7a7"><a href="contentpage.html"><img src="images/btn_3.jpg" alt="" name="btn_3" width="98" height="17" border="0" id="btn_3" onmouseover="MM_swapImage('btn_3','','images/btn_3_over.jpg',1)" onmouseout="MM_swapImgRestore()"/></a></td>
|
||||||
<td width="3" height="17" align="left" valign="top" bgcolor="#a7a7a7">
|
<td width="3" height="17" align="left" valign="top" bgcolor="#a7a7a7">
|
||||||
<img src="images/lines-09.jpg" width="3" height="17" alt="" /></td>
|
<img src="images/lines-09.jpg" width="3" height="17" alt="" /></td>
|
||||||
<td width="107" height="17" colspan="3" align="left" valign="top" bgcolor="#a7a7a7"><a href="contentpage.html"><img src="images/btn_4.jpg" alt="" name="btn_4" width="107" height="17" border="0" id="btn_4" onmouseover="MM_swapImage('btn_4','','images/btn_4_over.jpg',1)" onmouseout="MM_swapImgRestore()"/></a></td>
|
<td width="107" height="17" colspan="3" align="left" valign="top" bgcolor="#a7a7a7"><a href="contentpage.html"><img src="images/btn_4.jpg" alt="" name="btn_4" width="107" height="17" border="0" id="btn_4" onmouseover="MM_swapImage('btn_4','','images/btn_4_over.jpg',1)" onmouseout="MM_swapImgRestore()"/></a></td>
|
||||||
<td width="3" height="17" align="left" valign="top" bgcolor="#a7a7a7">
|
<td width="3" height="17" align="left" valign="top" bgcolor="#a7a7a7">
|
||||||
<img src="images/lines-11.jpg" width="3" height="17" alt="" /></td>
|
<img src="images/lines-11.jpg" width="3" height="17" alt="" /></td>
|
||||||
<td width="97" height="17" colspan="3" align="left" valign="top" bgcolor="#a7a7a7"><a href="contentpage.html"><img src="images/btn_5.jpg" alt="" name="btn_5" width="97" height="17" border="0" id="btn_5" onmouseover="MM_swapImage('btn_5','','images/btn_5_over.jpg',1)" onmouseout="MM_swapImgRestore()"/></a></td>
|
<td width="97" height="17" colspan="3" align="left" valign="top" bgcolor="#a7a7a7"><a href="contentpage.html"><img src="images/btn_5.jpg" alt="" name="btn_5" width="97" height="17" border="0" id="btn_5" onmouseover="MM_swapImage('btn_5','','images/btn_5_over.jpg',1)" onmouseout="MM_swapImgRestore()"/></a></td>
|
||||||
<td width="3" height="17" align="left" valign="top" bgcolor="#a7a7a7">
|
<td width="3" height="17" align="left" valign="top" bgcolor="#a7a7a7">
|
||||||
<img src="images/lines-13.jpg" width="3" height="17" alt="" /></td>
|
<img src="images/lines-13.jpg" width="3" height="17" alt="" /></td>
|
||||||
<td width="93" height="17" colspan="3" align="left" valign="top" bgcolor="#a7a7a7"><a href="contentpage.html"><img src="images/btn_6.jpg" alt="" name="btn_6" width="93" height="17" border="0" id="btn_6" onmouseover="MM_swapImage('btn_6','','images/btn_6_over.jpg',1)" onmouseout="MM_swapImgRestore()"/></a></td>
|
<td width="93" height="17" colspan="3" align="left" valign="top" bgcolor="#a7a7a7"><a href="contentpage.html"><img src="images/btn_6.jpg" alt="" name="btn_6" width="93" height="17" border="0" id="btn_6" onmouseover="MM_swapImage('btn_6','','images/btn_6_over.jpg',1)" onmouseout="MM_swapImgRestore()"/></a></td>
|
||||||
<td width="17" height="17" align="left" valign="top" nowrap="nowrap" bgcolor="#a7a7a7"></td>
|
<td width="17" height="17" align="left" valign="top" nowrap="nowrap" bgcolor="#a7a7a7"></td>
|
||||||
<td width="0" height="17" nowrap="nowrap"></td>
|
<td width="0" height="17" nowrap="nowrap"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="656" height="19" colspan="25" align="left" valign="top" nowrap="nowrap" bgcolor="#a7a7a7"></td>
|
<td width="656" height="19" colspan="25" align="left" valign="top" nowrap="nowrap" bgcolor="#a7a7a7"></td>
|
||||||
<td width="0" height="19" nowrap="nowrap"></td>
|
<td width="0" height="19" nowrap="nowrap"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="656" height="240" colspan="25" align="left" valign="top">
|
<td width="656" height="240" colspan="25" align="left" valign="top">
|
||||||
<img src="images/main-15.jpg" width="656" height="240" alt="" /></td>
|
<img src="images/main-15.jpg" width="656" height="240" alt="" /></td>
|
||||||
<td width="0" height="240" nowrap="nowrap"></td>
|
<td width="0" height="240" nowrap="nowrap"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="656" height="321" colspan="25" rowspan="10" align="center" valign="middle" nowrap="nowrap" bgcolor="#efefef" class="text1">Content Page</td>
|
<td width="656" height="321" colspan="25" rowspan="10" align="center" valign="middle" nowrap="nowrap" bgcolor="#efefef" class="text1">Content Page</td>
|
||||||
<td width="0" height="7" nowrap="nowrap"></td>
|
<td width="0" height="7" nowrap="nowrap"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="0" height="43" nowrap="nowrap"></td>
|
<td width="0" height="43" nowrap="nowrap"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="0" height="56" nowrap="nowrap"></td>
|
<td width="0" height="56" nowrap="nowrap"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="0" height="26" nowrap="nowrap"></td>
|
<td width="0" height="26" nowrap="nowrap"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="0" height="12" nowrap="nowrap"></td>
|
<td width="0" height="12" nowrap="nowrap"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="0" height="17" nowrap="nowrap"></td>
|
<td width="0" height="17" nowrap="nowrap"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="0" height="23" nowrap="nowrap"></td>
|
<td width="0" height="23" nowrap="nowrap"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="0" height="22" nowrap="nowrap"></td>
|
<td width="0" height="22" nowrap="nowrap"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="0" height="58" nowrap="nowrap"></td>
|
<td width="0" height="58" nowrap="nowrap"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="0" height="57" nowrap="nowrap"></td>
|
<td width="0" height="57" nowrap="nowrap"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="775" height="49" colspan="27" align="center" valign="middle" class="text2" style="background:url(images/b_footer.jpg)"><a href="index.html">HOME</a> | <a href="contentpage.html">ABOUT US</a> | <a href="contentpage.html">SERVICES</a> | <a href="contentpage.html">SOLUTIONS</a> | <a href="contentpage.html">SUPPORT</a> | <a href="contentpage.html">CONTACTS</a><br />
|
<td width="775" height="49" colspan="27" align="center" valign="middle" class="text2" style="background:url(images/b_footer.jpg)"><a href="index.html">HOME</a> | <a href="contentpage.html">ABOUT US</a> | <a href="contentpage.html">SERVICES</a> | <a href="contentpage.html">SOLUTIONS</a> | <a href="contentpage.html">SUPPORT</a> | <a href="contentpage.html">CONTACTS</a><br />
|
||||||
<span class="text3">Copyright © Your Company Name</span><br/>
|
<span class="text3">Copyright © Your Company Name</span><br/>
|
||||||
Design by <a href="http://www.templatesbox.com" target="_blank" class="adv">Templates</a> Box. Create a <a href="http://www.wix.com" target="_blank" class="adv">free website</a>.
|
Design by <a href="http://www.templatesbox.com" target="_blank" class="adv">Templates</a> Box. Create a <a href="http://www.wix.com" target="_blank" class="adv">free website</a>.
|
||||||
</td>
|
</td>
|
||||||
<td width="0" height="49" nowrap="nowrap"></td>
|
<td width="0" height="49" nowrap="nowrap"></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<!-- End Save for Web Slices -->
|
<!-- End Save for Web Slices -->
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -1,160 +1,160 @@
|
|||||||
body{
|
body{
|
||||||
padding:0px;
|
padding:0px;
|
||||||
margin:0px;
|
margin:0px;
|
||||||
background:#c7c7c7;
|
background:#c7c7c7;
|
||||||
color:#848484;
|
color:#848484;
|
||||||
font:10px/14px Tahoma, sans-serif;
|
font:10px/14px Tahoma, sans-serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
div, p, ul, h2, h3, h4, img, form{padding:0px; margin:0px;}
|
div, p, ul, h2, h3, h4, img, form{padding:0px; margin:0px;}
|
||||||
ul{list-style-type:none;}
|
ul{list-style-type:none;}
|
||||||
|
|
||||||
.clear{
|
.clear{
|
||||||
clear:both;
|
clear:both;
|
||||||
}
|
}
|
||||||
|
|
||||||
.frame {
|
.frame {
|
||||||
border: 1px solid #D5E6E0;
|
border: 1px solid #D5E6E0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.text1 {
|
.text1 {
|
||||||
font: 11px/14px "Trebuchet MS", Arial, Helvetica, sans-serif;
|
font: 11px/14px "Trebuchet MS", Arial, Helvetica, sans-serif;
|
||||||
color:#000;
|
color:#000;
|
||||||
font-weight:bold;
|
font-weight:bold;
|
||||||
}
|
}
|
||||||
.text2 {
|
.text2 {
|
||||||
font: 11px/14px Tahoma, Geneva, sans-serif;
|
font: 11px/14px Tahoma, Geneva, sans-serif;
|
||||||
color:#000;
|
color:#000;
|
||||||
font-weight:normal;
|
font-weight:normal;
|
||||||
}
|
}
|
||||||
.text3 {
|
.text3 {
|
||||||
font: 10px/14px Tahoma, Geneva, sans-serif;
|
font: 10px/14px Tahoma, Geneva, sans-serif;
|
||||||
color:#000;
|
color:#000;
|
||||||
font-weight:normal;
|
font-weight:normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
.text4 {
|
.text4 {
|
||||||
font: 10px/12px Tahoma, Geneva, sans-serif;
|
font: 10px/12px Tahoma, Geneva, sans-serif;
|
||||||
color:#052578;
|
color:#052578;
|
||||||
font-weight:bold;
|
font-weight:bold;
|
||||||
}
|
}
|
||||||
.text5 {
|
.text5 {
|
||||||
font: 10px/12px Tahoma, Geneva, sans-serif;
|
font: 10px/12px Tahoma, Geneva, sans-serif;
|
||||||
color:#052578;
|
color:#052578;
|
||||||
font-weight:bold;
|
font-weight:bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
a:link {
|
a:link {
|
||||||
font: 11px/14px Tahoma, Geneva, sans-serif;
|
font: 11px/14px Tahoma, Geneva, sans-serif;
|
||||||
color:#000;
|
color:#000;
|
||||||
font-weight:normal;
|
font-weight:normal;
|
||||||
text-decoration:none;
|
text-decoration:none;
|
||||||
}
|
}
|
||||||
|
|
||||||
a:visited{
|
a:visited{
|
||||||
font: 11px/14px Tahoma, Geneva, sans-serif;
|
font: 11px/14px Tahoma, Geneva, sans-serif;
|
||||||
color:#000;
|
color:#000;
|
||||||
font-weight:normal;
|
font-weight:normal;
|
||||||
text-decoration:none;
|
text-decoration:none;
|
||||||
}
|
}
|
||||||
|
|
||||||
a:hover {
|
a:hover {
|
||||||
font: 11px/14px Tahoma, Geneva, sans-serif;
|
font: 11px/14px Tahoma, Geneva, sans-serif;
|
||||||
color:#000;
|
color:#000;
|
||||||
font-weight:normal;
|
font-weight:normal;
|
||||||
text-decoration:underline;
|
text-decoration:underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
a.a:link {
|
a.a:link {
|
||||||
font: 10px/14px Tahoma, Geneva, sans-serif;
|
font: 10px/14px Tahoma, Geneva, sans-serif;
|
||||||
color:#19a1cb;
|
color:#19a1cb;
|
||||||
font-weight:normal;
|
font-weight:normal;
|
||||||
text-decoration:underline;
|
text-decoration:underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
a.a:visited{
|
a.a:visited{
|
||||||
font: 10px/14px Tahoma, Geneva, sans-serif;
|
font: 10px/14px Tahoma, Geneva, sans-serif;
|
||||||
color:#19a1cb;
|
color:#19a1cb;
|
||||||
font-weight:normal;
|
font-weight:normal;
|
||||||
text-decoration:underline;
|
text-decoration:underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
a.a:hover {
|
a.a:hover {
|
||||||
font: 10px/14px Tahoma, Geneva, sans-serif;
|
font: 10px/14px Tahoma, Geneva, sans-serif;
|
||||||
color:#000;
|
color:#000;
|
||||||
font-weight:normal;
|
font-weight:normal;
|
||||||
text-decoration:none;
|
text-decoration:none;
|
||||||
}
|
}
|
||||||
|
|
||||||
a.b:link {
|
a.b:link {
|
||||||
font: 10px/18px Tahoma, Geneva, sans-serif;
|
font: 10px/18px Tahoma, Geneva, sans-serif;
|
||||||
color:#848484;
|
color:#848484;
|
||||||
font-weight:normal;
|
font-weight:normal;
|
||||||
text-decoration:underline;
|
text-decoration:underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
a.b:visited{
|
a.b:visited{
|
||||||
font: 10px/18px Tahoma, Geneva, sans-serif;
|
font: 10px/18px Tahoma, Geneva, sans-serif;
|
||||||
color:#848484;
|
color:#848484;
|
||||||
font-weight:normal;
|
font-weight:normal;
|
||||||
text-decoration:underline;
|
text-decoration:underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
a.b:hover {
|
a.b:hover {
|
||||||
font: 10px/18px Tahoma, Geneva, sans-serif;
|
font: 10px/18px Tahoma, Geneva, sans-serif;
|
||||||
color:#000;
|
color:#000;
|
||||||
font-weight:normal;
|
font-weight:normal;
|
||||||
text-decoration:none;
|
text-decoration:none;
|
||||||
}
|
}
|
||||||
|
|
||||||
a.c:link {
|
a.c:link {
|
||||||
font: 10px/12px Tahoma, Geneva, sans-serif;
|
font: 10px/12px Tahoma, Geneva, sans-serif;
|
||||||
color:#FFF;
|
color:#FFF;
|
||||||
font-weight:normal;
|
font-weight:normal;
|
||||||
text-decoration:none;
|
text-decoration:none;
|
||||||
}
|
}
|
||||||
|
|
||||||
a.c:visited{
|
a.c:visited{
|
||||||
font: 10px/12px Tahoma, Geneva, sans-serif;
|
font: 10px/12px Tahoma, Geneva, sans-serif;
|
||||||
color:#FFF;
|
color:#FFF;
|
||||||
font-weight:normal;
|
font-weight:normal;
|
||||||
text-decoration:none;
|
text-decoration:none;
|
||||||
}
|
}
|
||||||
|
|
||||||
a.c:hover {
|
a.c:hover {
|
||||||
font: 10px/12px Tahoma, Geneva, sans-serif;
|
font: 10px/12px Tahoma, Geneva, sans-serif;
|
||||||
color:#FFF;
|
color:#FFF;
|
||||||
font-weight:normal;
|
font-weight:normal;
|
||||||
text-decoration:underline;
|
text-decoration:underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
a.d:link {
|
a.d:link {
|
||||||
font: 10px/12px Tahoma, Geneva, sans-serif;
|
font: 10px/12px Tahoma, Geneva, sans-serif;
|
||||||
color:#FFF;
|
color:#FFF;
|
||||||
font-weight:normal;
|
font-weight:normal;
|
||||||
text-decoration:none;
|
text-decoration:none;
|
||||||
}
|
}
|
||||||
|
|
||||||
a.d:visited{
|
a.d:visited{
|
||||||
font: 10px/12px Tahoma, Geneva, sans-serif;
|
font: 10px/12px Tahoma, Geneva, sans-serif;
|
||||||
color:#FFF;
|
color:#FFF;
|
||||||
font-weight:normal;
|
font-weight:normal;
|
||||||
text-decoration:none;
|
text-decoration:none;
|
||||||
}
|
}
|
||||||
|
|
||||||
a.d:hover {
|
a.d:hover {
|
||||||
font: 10px/12px Tahoma, Geneva, sans-serif;
|
font: 10px/12px Tahoma, Geneva, sans-serif;
|
||||||
color:#FFF;
|
color:#FFF;
|
||||||
font-weight:normal;
|
font-weight:normal;
|
||||||
text-decoration:underline;
|
text-decoration:underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
input, textarea, select{
|
input, textarea, select{
|
||||||
border:#fff 1px solid;
|
border:#fff 1px solid;
|
||||||
background-color:#d6e6e0;
|
background-color:#d6e6e0;
|
||||||
font:10px/12px Tahoma, sans-serif; color:#000;
|
font:10px/12px Tahoma, sans-serif; color:#000;
|
||||||
}
|
}
|
||||||
a.adv:link {text-decoration: none; font-weight:bold; color:#000;}
|
a.adv:link {text-decoration: none; font-weight:bold; color:#000;}
|
||||||
a.adv:hover {text-decoration: none; font-weight:bold; color:#000;}
|
a.adv:hover {text-decoration: none; font-weight:bold; color:#000;}
|
||||||
a.adv:visited {text-decoration: none; font-weight:bold; color:#000;}
|
a.adv:visited {text-decoration: none; font-weight:bold; color:#000;}
|
||||||
|
|||||||
@@ -1,197 +1,197 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
<head>
|
<head>
|
||||||
<title>Business Co.</title>
|
<title>Business Co.</title>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
|
||||||
<link href="css/styles.css" rel="stylesheet" type="text/css" />
|
<link href="css/styles.css" rel="stylesheet" type="text/css" />
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
<!--
|
<!--
|
||||||
function MM_preloadImages() { //v3.0
|
function MM_preloadImages() { //v3.0
|
||||||
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
|
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
|
||||||
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
|
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
|
||||||
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
|
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
|
||||||
}
|
}
|
||||||
|
|
||||||
function MM_swapImgRestore() { //v3.0
|
function MM_swapImgRestore() { //v3.0
|
||||||
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
|
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
|
||||||
}
|
}
|
||||||
|
|
||||||
function MM_findObj(n, d) { //v4.01
|
function MM_findObj(n, d) { //v4.01
|
||||||
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
|
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
|
||||||
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
|
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
|
||||||
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
|
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
|
||||||
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
|
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
|
||||||
if(!x && d.getElementById) x=d.getElementById(n); return x;
|
if(!x && d.getElementById) x=d.getElementById(n); return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
function MM_swapImage() { //v3.0
|
function MM_swapImage() { //v3.0
|
||||||
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
|
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
|
||||||
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
|
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
|
||||||
}
|
}
|
||||||
//-->
|
//-->
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body onload="MM_preloadImages('images/btn_1_over.jpg','images/btn_2_over.jpg','images/btn_3_over.jpg','images/btn_4_over.jpg','images/btn_5_over.jpg', 'images/btn_6_over.jpg')">
|
<body onload="MM_preloadImages('images/btn_1_over.jpg','images/btn_2_over.jpg','images/btn_3_over.jpg','images/btn_4_over.jpg','images/btn_5_over.jpg', 'images/btn_6_over.jpg')">
|
||||||
<!-- Save for Web Slices (index.psd) -->
|
<!-- Save for Web Slices (index.psd) -->
|
||||||
<table width="775" height="700" border="0" align="center" cellpadding="0" cellspacing="0" id="Table_01">
|
<table width="775" height="700" border="0" align="center" cellpadding="0" cellspacing="0" id="Table_01">
|
||||||
<tr>
|
<tr>
|
||||||
<td width="59" height="0" nowrap></td>
|
<td width="59" height="0" nowrap></td>
|
||||||
<td width="19" height="0" nowrap></td>
|
<td width="19" height="0" nowrap></td>
|
||||||
<td width="4" height="0" nowrap></td>
|
<td width="4" height="0" nowrap></td>
|
||||||
<td width="23" height="0" nowrap></td>
|
<td width="23" height="0" nowrap></td>
|
||||||
<td width="83" height="0" nowrap></td>
|
<td width="83" height="0" nowrap></td>
|
||||||
<td width="3" height="0" nowrap></td>
|
<td width="3" height="0" nowrap></td>
|
||||||
<td width="8" height="0" nowrap></td>
|
<td width="8" height="0" nowrap></td>
|
||||||
<td width="10" height="0" nowrap></td>
|
<td width="10" height="0" nowrap></td>
|
||||||
<td width="31" height="0" nowrap></td>
|
<td width="31" height="0" nowrap></td>
|
||||||
<td width="47" height="0" nowrap></td>
|
<td width="47" height="0" nowrap></td>
|
||||||
<td width="4" height="0" nowrap></td>
|
<td width="4" height="0" nowrap></td>
|
||||||
<td width="3" height="0" nowrap></td>
|
<td width="3" height="0" nowrap></td>
|
||||||
<td width="98" height="0" nowrap></td>
|
<td width="98" height="0" nowrap></td>
|
||||||
<td width="3" height="0" nowrap></td>
|
<td width="3" height="0" nowrap></td>
|
||||||
<td width="66" height="0" nowrap></td>
|
<td width="66" height="0" nowrap></td>
|
||||||
<td width="31" height="0" nowrap></td>
|
<td width="31" height="0" nowrap></td>
|
||||||
<td width="10" height="0" nowrap></td>
|
<td width="10" height="0" nowrap></td>
|
||||||
<td width="3" height="0" nowrap></td>
|
<td width="3" height="0" nowrap></td>
|
||||||
<td width="3" height="0" nowrap></td>
|
<td width="3" height="0" nowrap></td>
|
||||||
<td width="5" height="0" nowrap></td>
|
<td width="5" height="0" nowrap></td>
|
||||||
<td width="89" height="0" nowrap></td>
|
<td width="89" height="0" nowrap></td>
|
||||||
<td width="3" height="0" nowrap></td>
|
<td width="3" height="0" nowrap></td>
|
||||||
<td width="15" height="0" nowrap></td>
|
<td width="15" height="0" nowrap></td>
|
||||||
<td width="57" height="0" nowrap></td>
|
<td width="57" height="0" nowrap></td>
|
||||||
<td width="21" height="0" nowrap></td>
|
<td width="21" height="0" nowrap></td>
|
||||||
<td width="17" height="0" nowrap></td>
|
<td width="17" height="0" nowrap></td>
|
||||||
<td width="60" height="0" nowrap></td>
|
<td width="60" height="0" nowrap></td>
|
||||||
<td width="0" height="0"></td>
|
<td width="0" height="0"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="59" height="651" rowspan="15">
|
<td width="59" height="651" rowspan="15">
|
||||||
<img src="images/main.jpg" width="59" height="651" alt="" /></td>
|
<img src="images/main.jpg" width="59" height="651" alt="" /></td>
|
||||||
<td width="561" height="33" colspan="22" align="left" valign="middle" bgcolor="#EFEFEF" class="text3" style="padding-left:20px">SEPTEMBER 29, 2009 </td>
|
<td width="561" height="33" colspan="22" align="left" valign="middle" bgcolor="#EFEFEF" class="text3" style="padding-left:20px">SEPTEMBER 29, 2009 </td>
|
||||||
<td width="95" height="33" colspan="3" align="left" valign="top"><a href="#"><img src="images/client_login.jpg" alt="" width="95" height="33" border="0" /></a></td>
|
<td width="95" height="33" colspan="3" align="left" valign="top"><a href="#"><img src="images/client_login.jpg" alt="" width="95" height="33" border="0" /></a></td>
|
||||||
<td width="60" height="651" rowspan="15">
|
<td width="60" height="651" rowspan="15">
|
||||||
<img src="images/main-03.jpg" width="60" height="651" alt="" /></td>
|
<img src="images/main-03.jpg" width="60" height="651" alt="" /></td>
|
||||||
<td width="0" height="33" nowrap></td>
|
<td width="0" height="33" nowrap></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="656" height="21" colspan="25" align="left" valign="top" nowrap bgcolor="#A7A7A7"></td>
|
<td width="656" height="21" colspan="25" align="left" valign="top" nowrap bgcolor="#A7A7A7"></td>
|
||||||
<td width="0" height="21" nowrap></td>
|
<td width="0" height="21" nowrap></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="23" height="17" colspan="2" align="left" valign="top" nowrap bgcolor="#A7A7A7"></td>
|
<td width="23" height="17" colspan="2" align="left" valign="top" nowrap bgcolor="#A7A7A7"></td>
|
||||||
<td width="106" height="17" colspan="2" align="left" valign="top" bgcolor="#A7A7A7"><a href="index.html"><img src="images/btn_1.jpg" alt="" name="btn_1" width="106" height="17" border="0" id="btn_1" onmouseover="MM_swapImage('btn_1','','images/btn_1_over.jpg',1)" onmouseout="MM_swapImgRestore()"/></a></td>
|
<td width="106" height="17" colspan="2" align="left" valign="top" bgcolor="#A7A7A7"><a href="index.html"><img src="images/btn_1.jpg" alt="" name="btn_1" width="106" height="17" border="0" id="btn_1" onmouseover="MM_swapImage('btn_1','','images/btn_1_over.jpg',1)" onmouseout="MM_swapImgRestore()"/></a></td>
|
||||||
<td width="3" height="17" align="left" valign="top" bgcolor="#A7A7A7">
|
<td width="3" height="17" align="left" valign="top" bgcolor="#A7A7A7">
|
||||||
<img src="images/lines.jpg" width="3" height="17" alt="" /></td>
|
<img src="images/lines.jpg" width="3" height="17" alt="" /></td>
|
||||||
<td width="100" height="17" colspan="5" align="left" valign="top" bgcolor="#A7A7A7"><a href="contentpage.html"><img src="images/btn_2.jpg" alt="" name="btn_2" width="100" height="17" border="0" id="btn_2" onmouseover="MM_swapImage('btn_2','','images/btn_2_over.jpg',1)" onmouseout="MM_swapImgRestore()"/></a></td>
|
<td width="100" height="17" colspan="5" align="left" valign="top" bgcolor="#A7A7A7"><a href="contentpage.html"><img src="images/btn_2.jpg" alt="" name="btn_2" width="100" height="17" border="0" id="btn_2" onmouseover="MM_swapImage('btn_2','','images/btn_2_over.jpg',1)" onmouseout="MM_swapImgRestore()"/></a></td>
|
||||||
<td width="3" height="17" align="left" valign="top" bgcolor="#A7A7A7">
|
<td width="3" height="17" align="left" valign="top" bgcolor="#A7A7A7">
|
||||||
<img src="images/lines-07.jpg" width="3" height="17" alt="" /></td>
|
<img src="images/lines-07.jpg" width="3" height="17" alt="" /></td>
|
||||||
<td width="98" height="17" align="left" valign="top" bgcolor="#A7A7A7"><a href="contentpage.html"><img src="images/btn_3.jpg" alt="" name="btn_3" width="98" height="17" border="0" id="btn_3" onmouseover="MM_swapImage('btn_3','','images/btn_3_over.jpg',1)" onmouseout="MM_swapImgRestore()"/></a></td>
|
<td width="98" height="17" align="left" valign="top" bgcolor="#A7A7A7"><a href="contentpage.html"><img src="images/btn_3.jpg" alt="" name="btn_3" width="98" height="17" border="0" id="btn_3" onmouseover="MM_swapImage('btn_3','','images/btn_3_over.jpg',1)" onmouseout="MM_swapImgRestore()"/></a></td>
|
||||||
<td width="3" height="17" align="left" valign="top" bgcolor="#A7A7A7">
|
<td width="3" height="17" align="left" valign="top" bgcolor="#A7A7A7">
|
||||||
<img src="images/lines-09.jpg" width="3" height="17" alt="" /></td>
|
<img src="images/lines-09.jpg" width="3" height="17" alt="" /></td>
|
||||||
<td width="107" height="17" colspan="3" align="left" valign="top" bgcolor="#A7A7A7"><a href="contentpage.html"><img src="images/btn_4.jpg" alt="" name="btn_4" width="107" height="17" border="0" id="btn_4" onmouseover="MM_swapImage('btn_4','','images/btn_4_over.jpg',1)" onmouseout="MM_swapImgRestore()"/></a></td>
|
<td width="107" height="17" colspan="3" align="left" valign="top" bgcolor="#A7A7A7"><a href="contentpage.html"><img src="images/btn_4.jpg" alt="" name="btn_4" width="107" height="17" border="0" id="btn_4" onmouseover="MM_swapImage('btn_4','','images/btn_4_over.jpg',1)" onmouseout="MM_swapImgRestore()"/></a></td>
|
||||||
<td width="3" height="17" align="left" valign="top" bgcolor="#A7A7A7">
|
<td width="3" height="17" align="left" valign="top" bgcolor="#A7A7A7">
|
||||||
<img src="images/lines-11.jpg" width="3" height="17" alt="" /></td>
|
<img src="images/lines-11.jpg" width="3" height="17" alt="" /></td>
|
||||||
<td width="97" height="17" colspan="3" align="left" valign="top" bgcolor="#A7A7A7"><a href="contentpage.html"><img src="images/btn_5.jpg" alt="" name="btn_5" width="97" height="17" border="0" id="btn_5" onmouseover="MM_swapImage('btn_5','','images/btn_5_over.jpg',1)" onmouseout="MM_swapImgRestore()"/></a></td>
|
<td width="97" height="17" colspan="3" align="left" valign="top" bgcolor="#A7A7A7"><a href="contentpage.html"><img src="images/btn_5.jpg" alt="" name="btn_5" width="97" height="17" border="0" id="btn_5" onmouseover="MM_swapImage('btn_5','','images/btn_5_over.jpg',1)" onmouseout="MM_swapImgRestore()"/></a></td>
|
||||||
<td width="3" height="17" align="left" valign="top" bgcolor="#A7A7A7">
|
<td width="3" height="17" align="left" valign="top" bgcolor="#A7A7A7">
|
||||||
<img src="images/lines-13.jpg" width="3" height="17" alt="" /></td>
|
<img src="images/lines-13.jpg" width="3" height="17" alt="" /></td>
|
||||||
<td width="93" height="17" colspan="3" align="left" valign="top" bgcolor="#A7A7A7"><a href="contentpage.html"><img src="images/btn_6.jpg" alt="" name="btn_6" width="93" height="17" border="0" id="btn_6" onmouseover="MM_swapImage('btn_6','','images/btn_6_over.jpg',1)" onmouseout="MM_swapImgRestore()"/></a></td>
|
<td width="93" height="17" colspan="3" align="left" valign="top" bgcolor="#A7A7A7"><a href="contentpage.html"><img src="images/btn_6.jpg" alt="" name="btn_6" width="93" height="17" border="0" id="btn_6" onmouseover="MM_swapImage('btn_6','','images/btn_6_over.jpg',1)" onmouseout="MM_swapImgRestore()"/></a></td>
|
||||||
<td width="17" height="17" align="left" valign="top" nowrap bgcolor="#A7A7A7"></td>
|
<td width="17" height="17" align="left" valign="top" nowrap bgcolor="#A7A7A7"></td>
|
||||||
<td width="0" height="17" nowrap></td>
|
<td width="0" height="17" nowrap></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="656" height="19" colspan="25" align="left" valign="top" nowrap bgcolor="#A7A7A7"></td>
|
<td width="656" height="19" colspan="25" align="left" valign="top" nowrap bgcolor="#A7A7A7"></td>
|
||||||
<td width="0" height="19" nowrap></td>
|
<td width="0" height="19" nowrap></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="656" height="240" colspan="25" align="left" valign="top">
|
<td width="656" height="240" colspan="25" align="left" valign="top">
|
||||||
<img src="images/main-15.jpg" width="656" height="240" alt="" /></td>
|
<img src="images/main-15.jpg" width="656" height="240" alt="" /></td>
|
||||||
<td width="0" height="240" nowrap></td>
|
<td width="0" height="240" nowrap></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="656" height="7" colspan="25" align="left" valign="top" nowrap bgcolor="#EFEFEF"></td>
|
<td width="656" height="7" colspan="25" align="left" valign="top" nowrap bgcolor="#EFEFEF"></td>
|
||||||
<td width="0" height="7" nowrap></td>
|
<td width="0" height="7" nowrap></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="19" height="314" rowspan="9" align="left" valign="top" nowrap bgcolor="#EFEFEF"></td>
|
<td width="19" height="314" rowspan="9" align="left" valign="top" nowrap bgcolor="#EFEFEF"></td>
|
||||||
<td width="209" height="43" colspan="8" align="left" valign="top" bgcolor="#EFEFEF">
|
<td width="209" height="43" colspan="8" align="left" valign="top" bgcolor="#EFEFEF">
|
||||||
<img src="images/welcome.jpg" width="209" height="43" alt="" /></td>
|
<img src="images/welcome.jpg" width="209" height="43" alt="" /></td>
|
||||||
<td width="174" height="43" colspan="5" align="left" valign="top" nowrap bgcolor="#EFEFEF"></td>
|
<td width="174" height="43" colspan="5" align="left" valign="top" nowrap bgcolor="#EFEFEF"></td>
|
||||||
<td width="31" height="314" rowspan="9" align="left" valign="top" nowrap bgcolor="#EFEFEF"></td>
|
<td width="31" height="314" rowspan="9" align="left" valign="top" nowrap bgcolor="#EFEFEF"></td>
|
||||||
<td width="185" height="43" colspan="8" align="left" valign="top" bgcolor="#EFEFEF">
|
<td width="185" height="43" colspan="8" align="left" valign="top" bgcolor="#EFEFEF">
|
||||||
<img src="images/news.jpg" width="185" height="43" alt="" /></td>
|
<img src="images/news.jpg" width="185" height="43" alt="" /></td>
|
||||||
<td width="38" height="314" colspan="2" rowspan="9" align="left" valign="top" nowrap bgcolor="#EFEFEF"></td>
|
<td width="38" height="314" colspan="2" rowspan="9" align="left" valign="top" nowrap bgcolor="#EFEFEF"></td>
|
||||||
<td width="0" height="43" nowrap></td>
|
<td width="0" height="43" nowrap></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="121" height="82" colspan="5" rowspan="2" align="left" valign="top" bgcolor="#EFEFEF">
|
<td width="121" height="82" colspan="5" rowspan="2" align="left" valign="top" bgcolor="#EFEFEF">
|
||||||
<img src="images/welcome-18.jpg" width="121" height="82" alt="" /></td>
|
<img src="images/welcome-18.jpg" width="121" height="82" alt="" /></td>
|
||||||
<td width="10" height="94" rowspan="3" align="left" valign="top" nowrap bgcolor="#EFEFEF"></td>
|
<td width="10" height="94" rowspan="3" align="left" valign="top" nowrap bgcolor="#EFEFEF"></td>
|
||||||
<td width="252" height="94" colspan="7" rowspan="3" align="left" valign="top" bgcolor="#EFEFEF"><span class="text1">Lorem ipsum dolor sit amet, consectetuer</span><br />
|
<td width="252" height="94" colspan="7" rowspan="3" align="left" valign="top" bgcolor="#EFEFEF"><span class="text1">Lorem ipsum dolor sit amet, consectetuer</span><br />
|
||||||
Nam eu nulla. Donec lobortis purus vel urna. Nunc laoreet lacinia nunc. In volutpat sodales ipsum. Sed vestibulum. <a href="#" class="a">Integer in ante. Sed posuere ligula</a> rhoncus erat. Fusce urna dui, sollicitudin ac, pulvinar quis</td>
|
Nam eu nulla. Donec lobortis purus vel urna. Nunc laoreet lacinia nunc. In volutpat sodales ipsum. Sed vestibulum. <a href="#" class="a">Integer in ante. Sed posuere ligula</a> rhoncus erat. Fusce urna dui, sollicitudin ac, pulvinar quis</td>
|
||||||
<td width="21" height="56" colspan="4" align="left" valign="top" bgcolor="#EFEFEF">
|
<td width="21" height="56" colspan="4" align="left" valign="top" bgcolor="#EFEFEF">
|
||||||
<img src="images/news-19.jpg" width="21" height="56" alt="" /></td>
|
<img src="images/news-19.jpg" width="21" height="56" alt="" /></td>
|
||||||
<td width="164" height="56" colspan="4" align="left" valign="top" bgcolor="#EFEFEF" style="padding-top:5px"><p class="text1">September 29
|
<td width="164" height="56" colspan="4" align="left" valign="top" bgcolor="#EFEFEF" style="padding-top:5px"><p class="text1">September 29
|
||||||
</p>
|
</p>
|
||||||
<p><a href="#" class="a">Integer in ante. Sed posuere ligula </a>rhoncus erat. Fusce urna dui </p></td>
|
<p><a href="#" class="a">Integer in ante. Sed posuere ligula </a>rhoncus erat. Fusce urna dui </p></td>
|
||||||
<td width="0" height="56" nowrap></td>
|
<td width="0" height="56" nowrap></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="21" height="55" colspan="4" rowspan="3" align="left" valign="top" bgcolor="#EFEFEF"><img src="images/news-20.jpg" width="21" height="55" alt="" /></td>
|
<td width="21" height="55" colspan="4" rowspan="3" align="left" valign="top" bgcolor="#EFEFEF"><img src="images/news-20.jpg" width="21" height="55" alt="" /></td>
|
||||||
<td width="164" height="55" colspan="4" rowspan="3" align="left" valign="top" bgcolor="#EFEFEF" style="padding-top:5px"><span class="text1">September 28
|
<td width="164" height="55" colspan="4" rowspan="3" align="left" valign="top" bgcolor="#EFEFEF" style="padding-top:5px"><span class="text1">September 28
|
||||||
</span><br />
|
</span><br />
|
||||||
<a href="#" class="a">Integer in ante. Sed posuere ligula</a> rhoncus erat. Fusce urna dui</td>
|
<a href="#" class="a">Integer in ante. Sed posuere ligula</a> rhoncus erat. Fusce urna dui</td>
|
||||||
<td width="0" height="26" nowrap></td>
|
<td width="0" height="26" nowrap></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="121" height="12" colspan="5" align="left" valign="top" nowrap bgcolor="#EFEFEF"></td>
|
<td width="121" height="12" colspan="5" align="left" valign="top" nowrap bgcolor="#EFEFEF"></td>
|
||||||
<td width="0" height="12" nowrap></td>
|
<td width="0" height="12" nowrap></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="162" height="40" colspan="7" rowspan="2" align="left" valign="top" bgcolor="#EFEFEF">
|
<td width="162" height="40" colspan="7" rowspan="2" align="left" valign="top" bgcolor="#EFEFEF">
|
||||||
<img src="images/services.jpg" width="162" height="40" alt="" /></td>
|
<img src="images/services.jpg" width="162" height="40" alt="" /></td>
|
||||||
<td width="221" height="40" colspan="6" rowspan="2" align="left" valign="top" nowrap bgcolor="#EFEFEF"></td>
|
<td width="221" height="40" colspan="6" rowspan="2" align="left" valign="top" nowrap bgcolor="#EFEFEF"></td>
|
||||||
<td width="0" height="17" nowrap></td>
|
<td width="0" height="17" nowrap></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="185" height="45" colspan="8" rowspan="2" align="left" valign="top" bgcolor="#EFEFEF">
|
<td width="185" height="45" colspan="8" rowspan="2" align="left" valign="top" bgcolor="#EFEFEF">
|
||||||
<img src="images/spotlight.jpg" width="185" height="45" alt="" /></td>
|
<img src="images/spotlight.jpg" width="185" height="45" alt="" /></td>
|
||||||
<td width="0" height="23" nowrap></td>
|
<td width="0" height="23" nowrap></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="121" height="80" colspan="5" rowspan="2" align="left" valign="top" bgcolor="#EFEFEF">
|
<td width="121" height="80" colspan="5" rowspan="2" align="left" valign="top" bgcolor="#EFEFEF">
|
||||||
<img src="images/services-23.jpg" width="121" height="80" alt="" /></td>
|
<img src="images/services-23.jpg" width="121" height="80" alt="" /></td>
|
||||||
<td width="10" height="80" rowspan="2" align="left" valign="top" nowrap bgcolor="#EFEFEF"></td>
|
<td width="10" height="80" rowspan="2" align="left" valign="top" nowrap bgcolor="#EFEFEF"></td>
|
||||||
<td width="252" height="80" colspan="7" rowspan="2" align="left" valign="top" bgcolor="#EFEFEF"><span class="text1">Lorem ipsum dolor sit amet, consectetuer</span><br />
|
<td width="252" height="80" colspan="7" rowspan="2" align="left" valign="top" bgcolor="#EFEFEF"><span class="text1">Lorem ipsum dolor sit amet, consectetuer</span><br />
|
||||||
<a href="#" class="a">Nam eu nulla. Donec lobortis purus vel urna. Nunc </a>laoreet lacinia nunc. In volutpat sodales ipsum. Sed vestibulum. rhoncus erat. Fusce urna dui, sollicitudin ac, pulvinar quis</td>
|
<a href="#" class="a">Nam eu nulla. Donec lobortis purus vel urna. Nunc </a>laoreet lacinia nunc. In volutpat sodales ipsum. Sed vestibulum. rhoncus erat. Fusce urna dui, sollicitudin ac, pulvinar quis</td>
|
||||||
<td width="0" height="22" nowrap></td>
|
<td width="0" height="22" nowrap></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="16" height="115" colspan="3" rowspan="2" align="left" valign="top" bgcolor="#EFEFEF">
|
<td width="16" height="115" colspan="3" rowspan="2" align="left" valign="top" bgcolor="#EFEFEF">
|
||||||
<img src="images/spotlight-24.jpg" width="16" height="115" alt="" /></td>
|
<img src="images/spotlight-24.jpg" width="16" height="115" alt="" /></td>
|
||||||
<td width="169" height="115" colspan="5" rowspan="2" align="left" valign="top" bgcolor="#EFEFEF" style="line-height:18px; padding-top:3px"><a href="#" class="b">Morbi volutpat leo in ligula. Inter vel</a><br />
|
<td width="169" height="115" colspan="5" rowspan="2" align="left" valign="top" bgcolor="#EFEFEF" style="line-height:18px; padding-top:3px"><a href="#" class="b">Morbi volutpat leo in ligula. Inter vel</a><br />
|
||||||
<a href="#" class="b">magna. sagittis. Fusce elit ligula, </a><br />
|
<a href="#" class="b">magna. sagittis. Fusce elit ligula, </a><br />
|
||||||
<a href="#" class="b">sodales sit amet, tincid unt in, Fusce </a><br />
|
<a href="#" class="b">sodales sit amet, tincid unt in, Fusce </a><br />
|
||||||
<a href="#" class="b">interdum. Sed laoreet. Aenean. Sed </a><br />
|
<a href="#" class="b">interdum. Sed laoreet. Aenean. Sed </a><br />
|
||||||
l<a href="#" class="b">aoreet. magna. sagittis. Fusce elit</a></td>
|
l<a href="#" class="b">aoreet. magna. sagittis. Fusce elit</a></td>
|
||||||
<td width="0" height="58" nowrap></td>
|
<td width="0" height="58" nowrap></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="27" height="57" colspan="2" align="left" valign="top" bgcolor="#EFEFEF">
|
<td width="27" height="57" colspan="2" align="left" valign="top" bgcolor="#EFEFEF">
|
||||||
<img src="images/services-25.jpg" width="27" height="57" alt="" /></td>
|
<img src="images/services-25.jpg" width="27" height="57" alt="" /></td>
|
||||||
<td width="356" height="57" colspan="11" align="left" valign="top" bgcolor="#EFEFEF" style="line-height:18px; padding-top:8px"><a href="#" class="b">Morbi volutpat leo in ligula. Inter vel magna. sagittis. Fusce elit ligula, sodales </a><br />
|
<td width="356" height="57" colspan="11" align="left" valign="top" bgcolor="#EFEFEF" style="line-height:18px; padding-top:8px"><a href="#" class="b">Morbi volutpat leo in ligula. Inter vel magna. sagittis. Fusce elit ligula, sodales </a><br />
|
||||||
<a href="#" class="b">sit amet, tincid unt in, Fusce interdum. Sed laoreet. Aenean. Sed laoreet. </a></td>
|
<a href="#" class="b">sit amet, tincid unt in, Fusce interdum. Sed laoreet. Aenean. Sed laoreet. </a></td>
|
||||||
<td width="0" height="57" nowrap></td>
|
<td width="0" height="57" nowrap></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="775" height="49" colspan="27" align="center" valign="middle" class="text2" style="background:url(images/b_footer.jpg)"><a href="index.html">HOME</a> | <a href="contentpage.html">ABOUT US</a> | <a href="contentpage.html">SERVICES</a> | <a href="contentpage.html">SOLUTIONS</a> | <a href="contentpage.html">SUPPORT</a> | <a href="contentpage.html">CONTACTS</a><br />
|
<td width="775" height="49" colspan="27" align="center" valign="middle" class="text2" style="background:url(images/b_footer.jpg)"><a href="index.html">HOME</a> | <a href="contentpage.html">ABOUT US</a> | <a href="contentpage.html">SERVICES</a> | <a href="contentpage.html">SOLUTIONS</a> | <a href="contentpage.html">SUPPORT</a> | <a href="contentpage.html">CONTACTS</a><br />
|
||||||
<span class="text3">Copyright © Your Company Name</span><br />
|
<span class="text3">Copyright © Your Company Name</span><br />
|
||||||
Design by <a href="http://www.templatesbox.com" target="_blank" class="adv">Templates</a> Box. Create a <a href="http://www.wix.com" target="_blank" class="adv">free website</a>.
|
Design by <a href="http://www.templatesbox.com" target="_blank" class="adv">Templates</a> Box. Create a <a href="http://www.wix.com" target="_blank" class="adv">free website</a>.
|
||||||
</td>
|
</td>
|
||||||
<td width="0" height="49" nowrap></td>
|
<td width="0" height="49" nowrap></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<!-- End Save for Web Slices -->
|
<!-- End Save for Web Slices -->
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -1,86 +1,86 @@
|
|||||||
<!-- saved from url=(0022)http://internet.e-mail -->
|
<!-- saved from url=(0022)http://internet.e-mail -->
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>TemplatesBox.com | Terms of Use</title>
|
<title>TemplatesBox.com | Terms of Use</title>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body bgcolor="#5E717F" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
|
<body bgcolor="#5E717F" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
|
||||||
<table width="700" cellspacing="0" cellpadding="8" align="center" bgcolor="#BED5E2" style="border-collapse:collapse;">
|
<table width="700" cellspacing="0" cellpadding="8" align="center" bgcolor="#BED5E2" style="border-collapse:collapse;">
|
||||||
<tr>
|
<tr>
|
||||||
<td bgcolor="#567280" style="border-top-width:1px; border-right-width:1px; border-left-width:1px; border-top-color:rgb(216,216,216); border-right-color:rgb(216,216,216); border-left-color:rgb(216,216,216); border-top-style:solid; border-right-style:solid; border-left-style:solid;"><font color="#C2DCEB" size="2" face="Verdana,Arial"><b>Templates</b></font><font color="#FF9900" size="2" face="Verdana,Arial"><b>Box</b></font><font color="#FF9B05" size="2" face="Verdana,Arial"><b>
|
<td bgcolor="#567280" style="border-top-width:1px; border-right-width:1px; border-left-width:1px; border-top-color:rgb(216,216,216); border-right-color:rgb(216,216,216); border-left-color:rgb(216,216,216); border-top-style:solid; border-right-style:solid; border-left-style:solid;"><font color="#C2DCEB" size="2" face="Verdana,Arial"><b>Templates</b></font><font color="#FF9900" size="2" face="Verdana,Arial"><b>Box</b></font><font color="#FF9B05" size="2" face="Verdana,Arial"><b>
|
||||||
</b></font><font color="#E3E3E3" size="2" face="Verdana,Arial">|<b> Terms of Use</b></font></td>
|
</b></font><font color="#E3E3E3" size="2" face="Verdana,Arial">|<b> Terms of Use</b></font></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td bgcolor="#A1BBCA" style="border-right-width:1px; border-left-width:1px; border-right-color:rgb(216,216,216); border-left-color:rgb(216,216,216); border-right-style:solid; border-left-style:solid;">
|
<td bgcolor="#A1BBCA" style="border-right-width:1px; border-left-width:1px; border-right-color:rgb(216,216,216); border-left-color:rgb(216,216,216); border-right-style:solid; border-left-style:solid;">
|
||||||
<table align="center" cellpadding="0" cellspacing="0" width="98%">
|
<table align="center" cellpadding="0" cellspacing="0" width="98%">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<p style="line-height:115%; margin-top:0; margin-bottom:0;"><font face="Verdana,Arial" color="#354D59"><span style="font-size:8pt;">By
|
<p style="line-height:115%; margin-top:0; margin-bottom:0;"><font face="Verdana,Arial" color="#354D59"><span style="font-size:8pt;">By
|
||||||
downloading a template from TemplatesBox.com you agree to the following
|
downloading a template from TemplatesBox.com you agree to the following
|
||||||
Terms of Use: </span></font>
|
Terms of Use: </span></font>
|
||||||
<p style="line-height:115%; margin-top:0; margin-bottom:0;"><font face="Verdana,Arial" color="#354D59"><span style="font-size:8pt;">Our
|
<p style="line-height:115%; margin-top:0; margin-bottom:0;"><font face="Verdana,Arial" color="#354D59"><span style="font-size:8pt;">Our
|
||||||
web templates may be used for your own and/or your clients' websites,
|
web templates may be used for your own and/or your clients' websites,
|
||||||
but you may not sell/offer for free our templates in any sort of collection,
|
but you may not sell/offer for free our templates in any sort of collection,
|
||||||
such as distributing to a third party via CD, diskette, or letting others
|
such as distributing to a third party via CD, diskette, or letting others
|
||||||
to download off your websites etc.<br>
|
to download off your websites etc.<br>
|
||||||
<br>
|
<br>
|
||||||
Link back to www.templatesbox.com is required and always appreciated.
|
Link back to www.templatesbox.com is required and always appreciated.
|
||||||
Also, please visit the<br>
|
Also, please visit the<br>
|
||||||
</span></font><a href="http://www.templatesbox.com/linkus.htm" target="_blank"><font face="Verdana,Arial" color="#354D59"><b><span style="font-size:8pt;">Link
|
</span></font><a href="http://www.templatesbox.com/linkus.htm" target="_blank"><font face="Verdana,Arial" color="#354D59"><b><span style="font-size:8pt;">Link
|
||||||
Us</span></b></font></a><font face="Verdana,Arial" color="#354D59"><span style="font-size:8pt;"> section.<br>
|
Us</span></b></font></a><font face="Verdana,Arial" color="#354D59"><span style="font-size:8pt;"> section.<br>
|
||||||
<br>
|
<br>
|
||||||
The templates are offered "as is" without warranty of any kind,
|
The templates are offered "as is" without warranty of any kind,
|
||||||
either expressed or implied. TemplatesBox.com will not be liable for any
|
either expressed or implied. TemplatesBox.com will not be liable for any
|
||||||
damage or loss of data whatsoever due to downloading or using a template.
|
damage or loss of data whatsoever due to downloading or using a template.
|
||||||
In no event shall TemplatesBox.com be liable for any damages including,
|
In no event shall TemplatesBox.com be liable for any damages including,
|
||||||
but not limited to, direct, indirect, special, incidental or consequential
|
but not limited to, direct, indirect, special, incidental or consequential
|
||||||
damages or other losses arising out of the use of or inability to use
|
damages or other losses arising out of the use of or inability to use
|
||||||
the templates and/or information from TemplatesBox.com.<br>
|
the templates and/or information from TemplatesBox.com.<br>
|
||||||
<br>
|
<br>
|
||||||
TemplatesBox.com team reserves the right to change or modify these terms
|
TemplatesBox.com team reserves the right to change or modify these terms
|
||||||
with no prior notice.</span></font></p>
|
with no prior notice.</span></font></p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td bgcolor="#567280" style="border-right-width:1px; border-left-width:1px; border-right-color:rgb(216,216,216); border-left-color:rgb(216,216,216); border-right-style:solid; border-left-style:solid;"><font size="2" face="Verdana,Arial" color="#E3E3E3"><b>Featured
|
<td bgcolor="#567280" style="border-right-width:1px; border-left-width:1px; border-right-color:rgb(216,216,216); border-left-color:rgb(216,216,216); border-right-style:solid; border-left-style:solid;"><font size="2" face="Verdana,Arial" color="#E3E3E3"><b>Featured
|
||||||
Partners</b></font></td>
|
Partners</b></font></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td bgcolor="#A1BBCA" style="border-right-width:1px; border-bottom-width:1px; border-left-width:1px; border-right-color:rgb(216,216,216); border-bottom-color:rgb(216,216,216); border-left-color:rgb(216,216,216); border-right-style:solid; border-bottom-style:solid; border-left-style:solid;" height="235">
|
<td bgcolor="#A1BBCA" style="border-right-width:1px; border-bottom-width:1px; border-left-width:1px; border-right-color:rgb(216,216,216); border-bottom-color:rgb(216,216,216); border-left-color:rgb(216,216,216); border-right-style:solid; border-bottom-style:solid; border-left-style:solid;" height="235">
|
||||||
<table align="center" cellpadding="0" cellspacing="0" width="98%">
|
<table align="center" cellpadding="0" cellspacing="0" width="98%">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<p><a href="http://www.specialtemplates.com" target="_blank"><b><font size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#2D444F">Premium Website
|
<p><a href="http://www.specialtemplates.com" target="_blank"><b><font size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#2D444F">Premium Website
|
||||||
Templates</font></b></a><font size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#2D444F"><br>
|
Templates</font></b></a><font size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#2D444F"><br>
|
||||||
Over 9000 High-end Website templates, Flash intros and Logo templates.<b><a href="http://www.freshtemplates.com" target="_blank"><br>
|
Over 9000 High-end Website templates, Flash intros and Logo templates.<b><a href="http://www.freshtemplates.com" target="_blank"><br>
|
||||||
<br>
|
<br>
|
||||||
</a></b></font><a href="http://www.freephotosbank.com" target="_blank"><b><font size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#2D444F">Free
|
</a></b></font><a href="http://www.freephotosbank.com" target="_blank"><b><font size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#2D444F">Free
|
||||||
Photos, Free Stock Photography</font></b></a><font size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#2D444F"><b><br></b>
|
Photos, Free Stock Photography</font></b></a><font size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#2D444F"><b><br></b>
|
||||||
</font><FONT face=Verdana color=#2d444f size=2><FONT size=2><FONT
|
</font><FONT face=Verdana color=#2d444f size=2><FONT size=2><FONT
|
||||||
face=Verdana><FONT color=#2d444f>1000's of FREE high quality stock
|
face=Verdana><FONT color=#2d444f>1000's of FREE high quality stock
|
||||||
Photos!</FONT></FONT></FONT></FONT><font size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#2D444F"><br>
|
Photos!</FONT></FONT></FONT></FONT><font size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#2D444F"><br>
|
||||||
<br>
|
<br>
|
||||||
</font><A
|
</font><A
|
||||||
href="http://www.webmasterschannel.com" target=_blank><FONT face=Verdana><FONT color=#2d444f><B><FONT size=2>Webmaster Resources &
|
href="http://www.webmasterschannel.com" target=_blank><FONT face=Verdana><FONT color=#2d444f><B><FONT size=2>Webmaster Resources &
|
||||||
Directory</FONT></B></FONT></FONT></A><font size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#2D444F"><br>
|
Directory</FONT></B></FONT></FONT></A><font size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#2D444F"><br>
|
||||||
</font><FONT size=2><FONT face=Verdana><FONT color=#2d444f>A large web directory with webmaster
|
</font><FONT size=2><FONT face=Verdana><FONT color=#2d444f>A large web directory with webmaster
|
||||||
resources.</FONT></FONT></FONT><font size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#2D444F"><br>
|
resources.</FONT></FONT></FONT><font size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#2D444F"><br>
|
||||||
<br>
|
<br>
|
||||||
</font><A href="http://www.photovations.com"
|
</font><A href="http://www.photovations.com"
|
||||||
target=_blank><FONT face=Verdana color=#000000
|
target=_blank><FONT face=Verdana color=#000000
|
||||||
size=2><FONT face=Verdana color=#2d444f size=2><STRONG>Photovations.com</STRONG></FONT></FONT></A><font size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#2D444F"><br>
|
size=2><FONT face=Verdana color=#2d444f size=2><STRONG>Photovations.com</STRONG></FONT></FONT></A><font size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#2D444F"><br>
|
||||||
</font><FONT face=Verdana color=#2d444f size=2><FONT size=2><FONT
|
</font><FONT face=Verdana color=#2d444f size=2><FONT size=2><FONT
|
||||||
face=Verdana><FONT color=#2d444f>Online Photo Sharing. Free Image
|
face=Verdana><FONT color=#2d444f>Online Photo Sharing. Free Image
|
||||||
Hosting</FONT></FONT></FONT></FONT></p>
|
Hosting</FONT></FONT></FONT></FONT></p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
<html>
|
<html>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<h2>Norwegian Mountain Trip</h2>
|
<h2>Norwegian Mountain Trip</h2>
|
||||||
<img border="0" src="images/pulpit.jpg" alt="Pulpit rock" width="304" height="228" />
|
<img border="0" src="images/pulpit.jpg" alt="Pulpit rock" width="304" height="228" />
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
<html>
|
<html>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<h1>My First Heading</h1>
|
<h1>My First Heading</h1>
|
||||||
|
|
||||||
<p>My first paragraph.</p>
|
<p>My first paragraph.</p>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
|||||||
@@ -1,99 +1,99 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset=utf-8 />
|
<meta charset=utf-8 />
|
||||||
<meta name="viewport" content="width=620" />
|
<meta name="viewport" content="width=620" />
|
||||||
<title>HTML5 Demo: data-*</title>
|
<title>HTML5 Demo: data-*</title>
|
||||||
<link rel="stylesheet" href="/css/html5demos.css" type="text/css" />
|
<link rel="stylesheet" href="/css/html5demos.css" type="text/css" />
|
||||||
<script src="/js/h5utils.js"></script></head>
|
<script src="/js/h5utils.js"></script></head>
|
||||||
<body>
|
<body>
|
||||||
<section id="wrapper">
|
<section id="wrapper">
|
||||||
<header>
|
<header>
|
||||||
<h1>data-*</h1>
|
<h1>data-*</h1>
|
||||||
</header><style>
|
</header><style>
|
||||||
#test {
|
#test {
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
border: 1px solid #ccc;
|
border: 1px solid #ccc;
|
||||||
margin: 20px 0;
|
margin: 20px 0;
|
||||||
}
|
}
|
||||||
pre {
|
pre {
|
||||||
overflow-x: auto;
|
overflow-x: auto;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
border: 1px dashed #ccc;
|
border: 1px dashed #ccc;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<article>
|
<article>
|
||||||
<section>
|
<section>
|
||||||
<p>The <code>data-[name]</code> attribute on elements can now be accessed directly via the DOM using <code>element.dataset.[attr]</code>.</p>
|
<p>The <code>data-[name]</code> attribute on elements can now be accessed directly via the DOM using <code>element.dataset.[attr]</code>.</p>
|
||||||
<p>Try openning the Web Console and editing <code>element.dataset</code> directly: <br /><code>element.dataset.foo = 'bar';</code></p>
|
<p>Try openning the Web Console and editing <code>element.dataset</code> directly: <br /><code>element.dataset.foo = 'bar';</code></p>
|
||||||
</section>
|
</section>
|
||||||
<p id="status">Not connected</p>
|
<p id="status">Not connected</p>
|
||||||
<section>
|
<section>
|
||||||
<div id="test" data-name="rem" data-height="short">This element has data</div>
|
<div id="test" data-name="rem" data-height="short">This element has data</div>
|
||||||
<input type="button" value="Show data" id="show" />
|
<input type="button" value="Show data" id="show" />
|
||||||
<input type="button" value="Change data via dataset" id="change1" />
|
<input type="button" value="Change data via dataset" id="change1" />
|
||||||
<input type="button" value="change data via setAttribute" id="change2" />
|
<input type="button" value="change data via setAttribute" id="change2" />
|
||||||
</section>
|
</section>
|
||||||
<pre><code id="element">[click buttons above to show element html]</code></pre>
|
<pre><code id="element">[click buttons above to show element html]</code></pre>
|
||||||
</article>
|
</article>
|
||||||
<script>
|
<script>
|
||||||
(function () {
|
(function () {
|
||||||
|
|
||||||
function show() {
|
function show() {
|
||||||
code.innerHTML = test.outerHTML.replace(/[<>]/g, function (m) {
|
code.innerHTML = test.outerHTML.replace(/[<>]/g, function (m) {
|
||||||
return { '<': '<', '>': '>' }[m];
|
return { '<': '<', '>': '>' }[m];
|
||||||
});
|
});
|
||||||
|
|
||||||
for (var prop in test.dataset) {
|
for (var prop in test.dataset) {
|
||||||
code.innerHTML += '\nel.dataset.' + prop + ' = "' + test.dataset[prop] + '"';
|
code.innerHTML += '\nel.dataset.' + prop + ' = "' + test.dataset[prop] + '"';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var state = document.getElementById('status'),
|
var state = document.getElementById('status'),
|
||||||
code = document.getElementById('element');
|
code = document.getElementById('element');
|
||||||
|
|
||||||
var test = window.element = document.getElementById('test');
|
var test = window.element = document.getElementById('test');
|
||||||
|
|
||||||
if (test.dataset === undefined) {
|
if (test.dataset === undefined) {
|
||||||
state.innerHTML = 'dataset not supported';
|
state.innerHTML = 'dataset not supported';
|
||||||
state.className = 'fail';
|
state.className = 'fail';
|
||||||
} else {
|
} else {
|
||||||
state.className = 'success';
|
state.className = 'success';
|
||||||
state.innerHTML = 'element.dataset supported';
|
state.innerHTML = 'element.dataset supported';
|
||||||
}
|
}
|
||||||
|
|
||||||
addEvent(document.getElementById('show'), 'click', function () {
|
addEvent(document.getElementById('show'), 'click', function () {
|
||||||
show();
|
show();
|
||||||
});
|
});
|
||||||
|
|
||||||
addEvent(document.getElementById('change1'), 'click', function () {
|
addEvent(document.getElementById('change1'), 'click', function () {
|
||||||
test.dataset.name = 'via el.dataset';
|
test.dataset.name = 'via el.dataset';
|
||||||
show();
|
show();
|
||||||
});
|
});
|
||||||
|
|
||||||
addEvent(document.getElementById('change2'), 'click', function () {
|
addEvent(document.getElementById('change2'), 'click', function () {
|
||||||
test.setAttribute('data-name', 'via setAttribute');
|
test.setAttribute('data-name', 'via setAttribute');
|
||||||
show();
|
show();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
<footer><a href="/">HTML5 demos</a>/<a id="built" href="http://twitter.com/rem">@rem built this</a>/<a href="#view-source">view source</a></footer>
|
<footer><a href="/">HTML5 demos</a>/<a id="built" href="http://twitter.com/rem">@rem built this</a>/<a href="#view-source">view source</a></footer>
|
||||||
</section>
|
</section>
|
||||||
<a href="http://github.com/remy/html5demos"><img style="position: absolute; top: 0; left: 0; border: 0;" src="http://s3.amazonaws.com/github/ribbons/forkme_left_darkblue_121621.png" alt="Fork me on GitHub" /></a>
|
<a href="http://github.com/remy/html5demos"><img style="position: absolute; top: 0; left: 0; border: 0;" src="http://s3.amazonaws.com/github/ribbons/forkme_left_darkblue_121621.png" alt="Fork me on GitHub" /></a>
|
||||||
<script src="/js/prettify.packed.js"></script>
|
<script src="/js/prettify.packed.js"></script>
|
||||||
<script>
|
<script>
|
||||||
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
|
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
|
||||||
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
|
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
try {
|
try {
|
||||||
var pageTracker = _gat._getTracker("UA-1656750-18");
|
var pageTracker = _gat._getTracker("UA-1656750-18");
|
||||||
pageTracker._trackPageview();
|
pageTracker._trackPageview();
|
||||||
} catch(err) {}</script>
|
} catch(err) {}</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -1,149 +1,149 @@
|
|||||||
note
|
note
|
||||||
description: "Summary description for {HTTP_CONSTANTS}."
|
description: "Summary description for {HTTP_CONSTANTS}."
|
||||||
author: ""
|
author: ""
|
||||||
date: "$Date$"
|
date: "$Date$"
|
||||||
revision: "$Revision$"
|
revision: "$Revision$"
|
||||||
|
|
||||||
class
|
class
|
||||||
HTTP_CONSTANTS
|
HTTP_CONSTANTS
|
||||||
|
|
||||||
feature
|
feature
|
||||||
|
|
||||||
http_version_1_1: STRING = "HTTP/1.1"
|
http_version_1_1: STRING = "HTTP/1.1"
|
||||||
http_version_1_0: STRING = "HTTP/1.0"
|
http_version_1_0: STRING = "HTTP/1.0"
|
||||||
crlf: STRING = "%/13/%/10/"
|
crlf: STRING = "%/13/%/10/"
|
||||||
|
|
||||||
feature -- Status codes
|
feature -- Status codes
|
||||||
|
|
||||||
-- 1xx Informational -Request received, continuing process
|
-- 1xx Informational -Request received, continuing process
|
||||||
Continue : STRING = "100"
|
Continue : STRING = "100"
|
||||||
Switching_Protocols : STRING = "101"
|
Switching_Protocols : STRING = "101"
|
||||||
|
|
||||||
|
|
||||||
-- 2xx Success - The action was successfully received, understood, and accepted
|
-- 2xx Success - The action was successfully received, understood, and accepted
|
||||||
Ok: STRING = "200"
|
Ok: STRING = "200"
|
||||||
Created : STRING = "201"
|
Created : STRING = "201"
|
||||||
Accepted : STRING = "202"
|
Accepted : STRING = "202"
|
||||||
Non_Authoritative_Information : STRING = "203"
|
Non_Authoritative_Information : STRING = "203"
|
||||||
No_Content : STRING = "204"
|
No_Content : STRING = "204"
|
||||||
Reset_Content : STRING = "205"
|
Reset_Content : STRING = "205"
|
||||||
Parcial_Content : STRING = "206"
|
Parcial_Content : STRING = "206"
|
||||||
|
|
||||||
|
|
||||||
-- 3xx Redirection - Further Action must be taken in order to complete the request
|
-- 3xx Redirection - Further Action must be taken in order to complete the request
|
||||||
Multiple_Choices : STRING = "300"
|
Multiple_Choices : STRING = "300"
|
||||||
Moved_Permanently: STRING = "301"
|
Moved_Permanently: STRING = "301"
|
||||||
Found : STRING = "302"
|
Found : STRING = "302"
|
||||||
See_Other : STRING = "303"
|
See_Other : STRING = "303"
|
||||||
Not_Modified : STRING = "304"
|
Not_Modified : STRING = "304"
|
||||||
Use_Proxy : STRING = "305"
|
Use_Proxy : STRING = "305"
|
||||||
Temporary_Redirect : STRING = "307"
|
Temporary_Redirect : STRING = "307"
|
||||||
|
|
||||||
|
|
||||||
--4xx Client Error - The request contains bad syntax or cannot be fulfilled
|
--4xx Client Error - The request contains bad syntax or cannot be fulfilled
|
||||||
Bad_Request : STRING = "400"
|
Bad_Request : STRING = "400"
|
||||||
Unauthorized : STRING = "401"
|
Unauthorized : STRING = "401"
|
||||||
Payment_Required : STRING = "402"
|
Payment_Required : STRING = "402"
|
||||||
Forbidden : STRING = "403"
|
Forbidden : STRING = "403"
|
||||||
Not_Found : STRING = "404"
|
Not_Found : STRING = "404"
|
||||||
Method_Not_Allowed : STRING = "405"
|
Method_Not_Allowed : STRING = "405"
|
||||||
Not_Acceptable : STRING = "406"
|
Not_Acceptable : STRING = "406"
|
||||||
Proxy_Authentication_Required : STRING = "407"
|
Proxy_Authentication_Required : STRING = "407"
|
||||||
Request_Time_out : STRING = "408"
|
Request_Time_out : STRING = "408"
|
||||||
Conflict : STRING = "409"
|
Conflict : STRING = "409"
|
||||||
Gone : STRING = "410"
|
Gone : STRING = "410"
|
||||||
Length_Required : STRING = "411"
|
Length_Required : STRING = "411"
|
||||||
Precondition_Failed : STRING = "412"
|
Precondition_Failed : STRING = "412"
|
||||||
Request_Entity_Too_Large : STRING = "413"
|
Request_Entity_Too_Large : STRING = "413"
|
||||||
Request_URI_Too_Large : STRING = "414"
|
Request_URI_Too_Large : STRING = "414"
|
||||||
Unsupported_Media_Type : STRING = "415"
|
Unsupported_Media_Type : STRING = "415"
|
||||||
Requested_range_not_satisfiable : STRING = "416"
|
Requested_range_not_satisfiable : STRING = "416"
|
||||||
Expectation_Failed : STRING = "417"
|
Expectation_Failed : STRING = "417"
|
||||||
|
|
||||||
|
|
||||||
--5xx Server Error - The server failed to fulfill an apparently valid request
|
--5xx Server Error - The server failed to fulfill an apparently valid request
|
||||||
server_error: STRING = "500"
|
server_error: STRING = "500"
|
||||||
Internal_Server_Error : STRING = "500"
|
Internal_Server_Error : STRING = "500"
|
||||||
Not_Implemented : STRING = "501"
|
Not_Implemented : STRING = "501"
|
||||||
Bad_Gateway : STRING = "502"
|
Bad_Gateway : STRING = "502"
|
||||||
Service_Unavailable : STRING = "503"
|
Service_Unavailable : STRING = "503"
|
||||||
Gateway_Time_out : STRING = "504"
|
Gateway_Time_out : STRING = "504"
|
||||||
HTTP_Version_not_supported : STRING = "505"
|
HTTP_Version_not_supported : STRING = "505"
|
||||||
|
|
||||||
|
|
||||||
-- messages
|
-- messages
|
||||||
ok_message: STRING = "OK"
|
ok_message: STRING = "OK"
|
||||||
continue_message : STRING = "Continue"
|
continue_message : STRING = "Continue"
|
||||||
not_found_message: STRING = "URI not found"
|
not_found_message: STRING = "URI not found"
|
||||||
not_implemented_message: STRING = "Not Implemented"
|
not_implemented_message: STRING = "Not Implemented"
|
||||||
|
|
||||||
feature -- content types
|
feature -- content types
|
||||||
|
|
||||||
text_html: STRING = "text/html"
|
text_html: STRING = "text/html"
|
||||||
|
|
||||||
feature -- General Header Fields
|
feature -- General Header Fields
|
||||||
|
|
||||||
-- There are a few header fields which have general applicability for both request and response messages,
|
-- There are a few header fields which have general applicability for both request and response messages,
|
||||||
-- but which do not apply to the entity being transferred.
|
-- but which do not apply to the entity being transferred.
|
||||||
-- These header fields apply only to the message being transmitted.
|
-- These header fields apply only to the message being transmitted.
|
||||||
|
|
||||||
Cache_control : STRING = "Cache-Control"
|
Cache_control : STRING = "Cache-Control"
|
||||||
Connection : STRING = "Connection"
|
Connection : STRING = "Connection"
|
||||||
Date : STRING = "Date"
|
Date : STRING = "Date"
|
||||||
Pragma : STRING = "PRAGMA"
|
Pragma : STRING = "PRAGMA"
|
||||||
Trailer : STRING = "Trailer"
|
Trailer : STRING = "Trailer"
|
||||||
Transfer_encoding : STRING = "Transfer-Encoding"
|
Transfer_encoding : STRING = "Transfer-Encoding"
|
||||||
Upgrade : STRING = "Upgrade"
|
Upgrade : STRING = "Upgrade"
|
||||||
Via : STRING = "Via"
|
Via : STRING = "Via"
|
||||||
Warning : STRING = "Warning"
|
Warning : STRING = "Warning"
|
||||||
|
|
||||||
|
|
||||||
feature -- Request Header
|
feature -- Request Header
|
||||||
Accept : STRING = "Accept"
|
Accept : STRING = "Accept"
|
||||||
Accept_charset : STRING = "Accept-Charset"
|
Accept_charset : STRING = "Accept-Charset"
|
||||||
Accept_encoding : STRING = "Accept-Encoding"
|
Accept_encoding : STRING = "Accept-Encoding"
|
||||||
Accept_language : STRING = "Accept-Language"
|
Accept_language : STRING = "Accept-Language"
|
||||||
Authorization : STRING = "Authorization"
|
Authorization : STRING = "Authorization"
|
||||||
Expect : STRING = "Expect"
|
Expect : STRING = "Expect"
|
||||||
From_header : STRING = "From"
|
From_header : STRING = "From"
|
||||||
Host : STRING = "Host"
|
Host : STRING = "Host"
|
||||||
If_match : STRING = "If-Match"
|
If_match : STRING = "If-Match"
|
||||||
If_modified_since : STRING = "If-Modified-Since"
|
If_modified_since : STRING = "If-Modified-Since"
|
||||||
If_none_match : STRING = "If-None-Match"
|
If_none_match : STRING = "If-None-Match"
|
||||||
If_range : STRING = "If-Range"
|
If_range : STRING = "If-Range"
|
||||||
If_unmodified_since : STRING = "If-Unmodified-Since"
|
If_unmodified_since : STRING = "If-Unmodified-Since"
|
||||||
Max_forwards : STRING = "Max-Forwards"
|
Max_forwards : STRING = "Max-Forwards"
|
||||||
Proxy_authorization : STRING = "Proxy-Authorization"
|
Proxy_authorization : STRING = "Proxy-Authorization"
|
||||||
Range : STRING = "Range"
|
Range : STRING = "Range"
|
||||||
Referer : STRING = "Referrer"
|
Referer : STRING = "Referrer"
|
||||||
TE : STRING = "TE"
|
TE : STRING = "TE"
|
||||||
User_agent : STRING = "User-Agent"
|
User_agent : STRING = "User-Agent"
|
||||||
|
|
||||||
|
|
||||||
feature -- Entity Header
|
feature -- Entity Header
|
||||||
|
|
||||||
Allow : STRING = "Allow"
|
Allow : STRING = "Allow"
|
||||||
Content_encoding : STRING = "Content-Encoding"
|
Content_encoding : STRING = "Content-Encoding"
|
||||||
Content_language : STRING = "Content-Language"
|
Content_language : STRING = "Content-Language"
|
||||||
Content_length : STRING = "Content-Length"
|
Content_length : STRING = "Content-Length"
|
||||||
Content_location : STRING = "Content-Location"
|
Content_location : STRING = "Content-Location"
|
||||||
Content_MD5 : STRING = "Content-MD5"
|
Content_MD5 : STRING = "Content-MD5"
|
||||||
Content_range : STRING = "Content-Range"
|
Content_range : STRING = "Content-Range"
|
||||||
Content_type : STRING = "Content-Type"
|
Content_type : STRING = "Content-Type"
|
||||||
Expires : STRING = "Expires"
|
Expires : STRING = "Expires"
|
||||||
Last_modified : STRING = "Last-Modified"
|
Last_modified : STRING = "Last-Modified"
|
||||||
|
|
||||||
|
|
||||||
feature -- Http Method
|
feature -- Http Method
|
||||||
Options : STRING = "OPTIONS"
|
Options : STRING = "OPTIONS"
|
||||||
Get : STRING = "GET"
|
Get : STRING = "GET"
|
||||||
Head : STRING = "HEAD"
|
Head : STRING = "HEAD"
|
||||||
Post : STRING = "POST"
|
Post : STRING = "POST"
|
||||||
Put : STRING = "PUT"
|
Put : STRING = "PUT"
|
||||||
Delete : STRING = "DELETE"
|
Delete : STRING = "DELETE"
|
||||||
Trace : STRING = "TRACE"
|
Trace : STRING = "TRACE"
|
||||||
Connect : STRING = "CONNECT"
|
Connect : STRING = "CONNECT"
|
||||||
note
|
note
|
||||||
copyright: "2011-2011, Javier Velilla and others"
|
copyright: "2011-2011, Javier Velilla and others"
|
||||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,60 +1,60 @@
|
|||||||
note
|
note
|
||||||
description: "[
|
description: "[
|
||||||
Provides features to encode and decode messages
|
Provides features to encode and decode messages
|
||||||
]"
|
]"
|
||||||
legal: "See notice at end of class."
|
legal: "See notice at end of class."
|
||||||
status: "Community Preview 1.0"
|
status: "Community Preview 1.0"
|
||||||
date: "$Date: 2009-09-01 19:15:37 -0300 (mar 01 de sep de 2009) $"
|
date: "$Date: 2009-09-01 19:15:37 -0300 (mar 01 de sep de 2009) $"
|
||||||
revision: "$Revision: 80577 $"
|
revision: "$Revision: 80577 $"
|
||||||
|
|
||||||
class
|
class
|
||||||
HTTP_ENCODING_FACILITIES
|
HTTP_ENCODING_FACILITIES
|
||||||
|
|
||||||
create
|
create
|
||||||
make
|
make
|
||||||
|
|
||||||
feature -- Initialization
|
feature -- Initialization
|
||||||
|
|
||||||
make
|
make
|
||||||
do
|
do
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Conversion
|
feature -- Conversion
|
||||||
|
|
||||||
encode_natural(a_i: NATURAL; a_is_fragmented: BOOLEAN): NATURAL
|
encode_natural(a_i: NATURAL; a_is_fragmented: BOOLEAN): NATURAL
|
||||||
-- Leftshift of the natural (don't use numbers >= 2^31) and subsequent append of the flag bit.
|
-- Leftshift of the natural (don't use numbers >= 2^31) and subsequent append of the flag bit.
|
||||||
-- Use decode_natural and decode_flag for decoding.
|
-- Use decode_natural and decode_flag for decoding.
|
||||||
require
|
require
|
||||||
no_too_big: a_i < 2147483648
|
no_too_big: a_i < 2147483648
|
||||||
do
|
do
|
||||||
Result := (a_i |<< 1) + a_is_fragmented.to_integer.as_natural_32
|
Result := (a_i |<< 1) + a_is_fragmented.to_integer.as_natural_32
|
||||||
end
|
end
|
||||||
|
|
||||||
change_flag(a_i: NATURAL; a_new_flag: BOOLEAN): NATURAL
|
change_flag(a_i: NATURAL; a_new_flag: BOOLEAN): NATURAL
|
||||||
-- Changes the flag to "new_flag" and doesn't change the encoded natural.
|
-- Changes the flag to "new_flag" and doesn't change the encoded natural.
|
||||||
do
|
do
|
||||||
Result := (a_i & 0xFFFFFFFE) + a_new_flag.to_integer.as_natural_32
|
Result := (a_i & 0xFFFFFFFE) + a_new_flag.to_integer.as_natural_32
|
||||||
end
|
end
|
||||||
|
|
||||||
decode_natural_and_flag (a_i: NATURAL): TUPLE [NATURAL, BOOLEAN]
|
decode_natural_and_flag (a_i: NATURAL): TUPLE [NATURAL, BOOLEAN]
|
||||||
-- Convenience feature which combines both decodings (natural and flag)
|
-- Convenience feature which combines both decodings (natural and flag)
|
||||||
do
|
do
|
||||||
Result := [decode_natural (a_i), decode_flag (a_i)]
|
Result := [decode_natural (a_i), decode_flag (a_i)]
|
||||||
end
|
end
|
||||||
|
|
||||||
decode_natural (a_i: NATURAL): NATURAL
|
decode_natural (a_i: NATURAL): NATURAL
|
||||||
-- The natural that was encoded in {ENCODING_FACILITIES}.encode_natural.
|
-- The natural that was encoded in {ENCODING_FACILITIES}.encode_natural.
|
||||||
do
|
do
|
||||||
Result := (a_i |>> 1)
|
Result := (a_i |>> 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
decode_flag (a_i: NATURAL): BOOLEAN
|
decode_flag (a_i: NATURAL): BOOLEAN
|
||||||
--`Result': the flag that was encoded in encode_natural
|
--`Result': the flag that was encoded in encode_natural
|
||||||
do
|
do
|
||||||
Result := (a_i.bit_and (1) = 1)
|
Result := (a_i.bit_and (1) = 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
note
|
note
|
||||||
copyright: "2011-2011, Javier Velilla and others"
|
copyright: "2011-2011, Javier Velilla and others"
|
||||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,56 +1,56 @@
|
|||||||
note
|
note
|
||||||
description: "Summary description for {HTTP_SERVER}."
|
description: "Summary description for {HTTP_SERVER}."
|
||||||
author: ""
|
author: ""
|
||||||
date: "$Date$"
|
date: "$Date$"
|
||||||
revision: "$Revision$"
|
revision: "$Revision$"
|
||||||
|
|
||||||
class
|
class
|
||||||
HTTP_SERVER
|
HTTP_SERVER
|
||||||
|
|
||||||
create
|
create
|
||||||
make
|
make
|
||||||
|
|
||||||
feature -- Initialization
|
feature -- Initialization
|
||||||
|
|
||||||
make (cfg: like configuration)
|
make (cfg: like configuration)
|
||||||
do
|
do
|
||||||
configuration := cfg
|
configuration := cfg
|
||||||
end
|
end
|
||||||
|
|
||||||
setup (a_http_handler: HTTP_HANDLER)
|
setup (a_http_handler: HTTP_HANDLER)
|
||||||
require
|
require
|
||||||
a_http_handler_valid: a_http_handler /= Void
|
a_http_handler_valid: a_http_handler /= Void
|
||||||
do
|
do
|
||||||
if configuration.is_verbose then
|
if configuration.is_verbose then
|
||||||
log ("%N%N%N")
|
log ("%N%N%N")
|
||||||
log ("Starting Web Application Server (port="+ configuration.http_server_port.out +"):%N")
|
log ("Starting Web Application Server (port="+ configuration.http_server_port.out +"):%N")
|
||||||
end
|
end
|
||||||
stop_requested := False
|
stop_requested := False
|
||||||
a_http_handler.execute
|
a_http_handler.execute
|
||||||
end
|
end
|
||||||
|
|
||||||
shutdown_server
|
shutdown_server
|
||||||
do
|
do
|
||||||
stop_requested := True
|
stop_requested := True
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Access
|
feature -- Access
|
||||||
|
|
||||||
configuration: HTTP_SERVER_CONFIGURATION
|
configuration: HTTP_SERVER_CONFIGURATION
|
||||||
-- Configuration of the server
|
-- Configuration of the server
|
||||||
|
|
||||||
stop_requested: BOOLEAN
|
stop_requested: BOOLEAN
|
||||||
-- Stops the server
|
-- Stops the server
|
||||||
|
|
||||||
feature -- Output
|
feature -- Output
|
||||||
|
|
||||||
log (a_message: READABLE_STRING_8)
|
log (a_message: READABLE_STRING_8)
|
||||||
-- Log `a_message'
|
-- Log `a_message'
|
||||||
do
|
do
|
||||||
io.put_string (a_message)
|
io.put_string (a_message)
|
||||||
end
|
end
|
||||||
|
|
||||||
;note
|
;note
|
||||||
copyright: "2011-2011, Javier Velilla and others"
|
copyright: "2011-2011, Javier Velilla and others"
|
||||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,118 +1,118 @@
|
|||||||
deferred class HTTP_REQUEST_HANDLER
|
deferred class HTTP_REQUEST_HANDLER
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
ANY
|
ANY
|
||||||
redefine
|
redefine
|
||||||
default_create
|
default_create
|
||||||
end
|
end
|
||||||
|
|
||||||
feature {NONE} -- Initialization
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
default_create
|
default_create
|
||||||
do
|
do
|
||||||
Precursor
|
Precursor
|
||||||
create request_uri.make_empty
|
create request_uri.make_empty
|
||||||
create script_name.make_empty
|
create script_name.make_empty
|
||||||
create query_string.make_empty
|
create query_string.make_empty
|
||||||
create answer
|
create answer
|
||||||
create headers.make (0)
|
create headers.make (0)
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Access
|
feature -- Access
|
||||||
|
|
||||||
request_uri: STRING
|
request_uri: STRING
|
||||||
-- requested url
|
-- requested url
|
||||||
|
|
||||||
script_name: STRING
|
script_name: STRING
|
||||||
-- Script name
|
-- Script name
|
||||||
|
|
||||||
query_string: STRING
|
query_string: STRING
|
||||||
-- Query string
|
-- Query string
|
||||||
|
|
||||||
data: detachable STRING
|
data: detachable STRING
|
||||||
-- the entire request message
|
-- the entire request message
|
||||||
|
|
||||||
headers : HASH_TABLE [STRING, STRING]
|
headers : HASH_TABLE [STRING, STRING]
|
||||||
-- Provides access to the request's HTTP headers, for example:
|
-- Provides access to the request's HTTP headers, for example:
|
||||||
-- headers["Content-Type"] is "text/plain"
|
-- headers["Content-Type"] is "text/plain"
|
||||||
|
|
||||||
answer: HTTP_RESPONSE
|
answer: HTTP_RESPONSE
|
||||||
-- reply to this request
|
-- reply to this request
|
||||||
|
|
||||||
feature -- Execution
|
feature -- Execution
|
||||||
|
|
||||||
process
|
process
|
||||||
-- process the request and create an answer
|
-- process the request and create an answer
|
||||||
require
|
require
|
||||||
valid_uri: request_uri /= Void
|
valid_uri: request_uri /= Void
|
||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Recycle
|
feature -- Recycle
|
||||||
|
|
||||||
reset
|
reset
|
||||||
-- reinit the fields
|
-- reinit the fields
|
||||||
do
|
do
|
||||||
request_uri.wipe_out
|
request_uri.wipe_out
|
||||||
script_name.wipe_out
|
script_name.wipe_out
|
||||||
query_string.wipe_out
|
query_string.wipe_out
|
||||||
data := Void
|
data := Void
|
||||||
answer.reset
|
answer.reset
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Element change
|
feature -- Element change
|
||||||
|
|
||||||
set_uri (new_uri: STRING)
|
set_uri (new_uri: STRING)
|
||||||
-- set new URI
|
-- set new URI
|
||||||
require
|
require
|
||||||
valid_uri: new_uri /= Void
|
valid_uri: new_uri /= Void
|
||||||
local
|
local
|
||||||
p: INTEGER
|
p: INTEGER
|
||||||
do
|
do
|
||||||
request_uri := new_uri
|
request_uri := new_uri
|
||||||
p := new_uri.index_of ('?', 1)
|
p := new_uri.index_of ('?', 1)
|
||||||
if p > 0 then
|
if p > 0 then
|
||||||
script_name := new_uri.substring (1, p - 1)
|
script_name := new_uri.substring (1, p - 1)
|
||||||
query_string := new_uri.substring (p + 1, new_uri.count)
|
query_string := new_uri.substring (p + 1, new_uri.count)
|
||||||
else
|
else
|
||||||
script_name := new_uri.string
|
script_name := new_uri.string
|
||||||
query_string := ""
|
query_string := ""
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
set_data (new_data: STRING)
|
set_data (new_data: STRING)
|
||||||
-- set new data
|
-- set new data
|
||||||
do
|
do
|
||||||
data := new_data
|
data := new_data
|
||||||
end
|
end
|
||||||
|
|
||||||
set_headers ( a_header : HASH_TABLE [STRING, STRING] )
|
set_headers ( a_header : HASH_TABLE [STRING, STRING] )
|
||||||
do
|
do
|
||||||
headers := a_header
|
headers := a_header
|
||||||
end
|
end
|
||||||
|
|
||||||
feature {NONE} -- Implementation
|
feature {NONE} -- Implementation
|
||||||
|
|
||||||
real_filename (fn: STRING): STRING
|
real_filename (fn: STRING): STRING
|
||||||
-- Real filename from url-path `fn'
|
-- Real filename from url-path `fn'
|
||||||
--| Find a better design for this piece of code
|
--| Find a better design for this piece of code
|
||||||
--| Eventually in a spec/$ISE_PLATFORM/ specific cluster
|
--| Eventually in a spec/$ISE_PLATFORM/ specific cluster
|
||||||
do
|
do
|
||||||
if {PLATFORM}.is_windows then
|
if {PLATFORM}.is_windows then
|
||||||
create Result.make_from_string (fn)
|
create Result.make_from_string (fn)
|
||||||
Result.replace_substring_all ("/", "\")
|
Result.replace_substring_all ("/", "\")
|
||||||
if Result[Result.count] = '\' then
|
if Result[Result.count] = '\' then
|
||||||
Result.remove_tail (1)
|
Result.remove_tail (1)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
Result := fn
|
Result := fn
|
||||||
if Result[Result.count] = '/' then
|
if Result[Result.count] = '/' then
|
||||||
Result := Result.substring (1, Result.count - 1)
|
Result := Result.substring (1, Result.count - 1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
note
|
note
|
||||||
copyright: "2011-2011, Javier Velilla and others"
|
copyright: "2011-2011, Javier Velilla and others"
|
||||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,147 +1,147 @@
|
|||||||
|
|
||||||
class HTTP_RESPONSE
|
class HTTP_RESPONSE
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
HTTP_CONSTANTS
|
HTTP_CONSTANTS
|
||||||
redefine
|
redefine
|
||||||
default_create
|
default_create
|
||||||
end
|
end
|
||||||
|
|
||||||
create
|
create
|
||||||
default_create
|
default_create
|
||||||
|
|
||||||
feature -- creation
|
feature -- creation
|
||||||
|
|
||||||
default_create
|
default_create
|
||||||
do
|
do
|
||||||
Precursor
|
Precursor
|
||||||
set_defaults
|
set_defaults
|
||||||
end
|
end
|
||||||
|
|
||||||
set_defaults
|
set_defaults
|
||||||
-- Set default values for the reply
|
-- Set default values for the reply
|
||||||
do
|
do
|
||||||
status_code := ok
|
status_code := ok
|
||||||
create content_length_data.make_empty
|
create content_length_data.make_empty
|
||||||
reason_phrase := ok_message
|
reason_phrase := ok_message
|
||||||
content_type_data := text_html
|
content_type_data := text_html
|
||||||
set_reply_text (Void)
|
set_reply_text (Void)
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Recycle
|
feature -- Recycle
|
||||||
|
|
||||||
reset
|
reset
|
||||||
do
|
do
|
||||||
set_defaults
|
set_defaults
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- response header fields
|
feature -- response header fields
|
||||||
|
|
||||||
status_code: STRING
|
status_code: STRING
|
||||||
-- status
|
-- status
|
||||||
|
|
||||||
content_length_data : STRING
|
content_length_data : STRING
|
||||||
-- length
|
-- length
|
||||||
|
|
||||||
reason_phrase: STRING
|
reason_phrase: STRING
|
||||||
-- message, if any
|
-- message, if any
|
||||||
|
|
||||||
content_type_data: STRING
|
content_type_data: STRING
|
||||||
-- type of content in this reply (eg. text/html)
|
-- type of content in this reply (eg. text/html)
|
||||||
|
|
||||||
feature -- Element change
|
feature -- Element change
|
||||||
|
|
||||||
set_content_length (new_content_length: INTEGER)
|
set_content_length (new_content_length: INTEGER)
|
||||||
require
|
require
|
||||||
positive_or_zero: new_content_length >= 0
|
positive_or_zero: new_content_length >= 0
|
||||||
do
|
do
|
||||||
content_length_data := new_content_length.out
|
content_length_data := new_content_length.out
|
||||||
end
|
end
|
||||||
|
|
||||||
set_status_code (new_status_code: STRING)
|
set_status_code (new_status_code: STRING)
|
||||||
require
|
require
|
||||||
not_void: new_status_code /= Void
|
not_void: new_status_code /= Void
|
||||||
do
|
do
|
||||||
status_code := new_status_code
|
status_code := new_status_code
|
||||||
end
|
end
|
||||||
|
|
||||||
set_reason_phrase (new_reason_phrase: STRING)
|
set_reason_phrase (new_reason_phrase: STRING)
|
||||||
require
|
require
|
||||||
not_void: new_reason_phrase /= Void
|
not_void: new_reason_phrase /= Void
|
||||||
do
|
do
|
||||||
reason_phrase := new_reason_phrase
|
reason_phrase := new_reason_phrase
|
||||||
end
|
end
|
||||||
|
|
||||||
set_content_type (new_content_type: STRING)
|
set_content_type (new_content_type: STRING)
|
||||||
require
|
require
|
||||||
not_void: new_content_type /= Void
|
not_void: new_content_type /= Void
|
||||||
do
|
do
|
||||||
content_type_data := new_content_type
|
content_type_data := new_content_type
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Access: send reply
|
feature -- Access: send reply
|
||||||
|
|
||||||
reply_header: STRING
|
reply_header: STRING
|
||||||
-- header
|
-- header
|
||||||
do
|
do
|
||||||
Result := http_version_1_1.twin
|
Result := http_version_1_1.twin
|
||||||
Result.extend (' ')
|
Result.extend (' ')
|
||||||
Result.append (status_code)
|
Result.append (status_code)
|
||||||
Result.extend (' ')
|
Result.extend (' ')
|
||||||
Result.append (reason_phrase)
|
Result.append (reason_phrase)
|
||||||
Result.append (crlf)
|
Result.append (crlf)
|
||||||
Result.append ({HTTP_SERVER_CONFIGURATION}.Server_details)
|
Result.append ({HTTP_SERVER_CONFIGURATION}.Server_details)
|
||||||
Result.append (crlf)
|
Result.append (crlf)
|
||||||
Result.append (Content_type + ": ")
|
Result.append (Content_type + ": ")
|
||||||
Result.append (content_type_data)
|
Result.append (content_type_data)
|
||||||
Result.append (crlf)
|
Result.append (crlf)
|
||||||
Result.append (Content_length + ": ")
|
Result.append (Content_length + ": ")
|
||||||
Result.append (content_length_data)
|
Result.append (content_length_data)
|
||||||
Result.append (crlf)
|
Result.append (crlf)
|
||||||
Result.append (crlf)
|
Result.append (crlf)
|
||||||
-- TODO: could add the size of data being sent here and
|
-- TODO: could add the size of data being sent here and
|
||||||
-- then keep the connection alive
|
-- then keep the connection alive
|
||||||
end
|
end
|
||||||
|
|
||||||
reply_header_continue: STRING
|
reply_header_continue: STRING
|
||||||
-- header
|
-- header
|
||||||
do
|
do
|
||||||
Result := http_version_1_1.twin
|
Result := http_version_1_1.twin
|
||||||
Result.extend (' ')
|
Result.extend (' ')
|
||||||
Result.append (status_code)
|
Result.append (status_code)
|
||||||
Result.extend (' ')
|
Result.extend (' ')
|
||||||
Result.append (continue_message)
|
Result.append (continue_message)
|
||||||
Result.append (crlf)
|
Result.append (crlf)
|
||||||
Result.append (crlf)
|
Result.append (crlf)
|
||||||
-- TODO: could add the size of data being sent here and
|
-- TODO: could add the size of data being sent here and
|
||||||
-- then keep the connection alive
|
-- then keep the connection alive
|
||||||
end
|
end
|
||||||
|
|
||||||
reply_text: STRING
|
reply_text: STRING
|
||||||
-- reply text
|
-- reply text
|
||||||
|
|
||||||
feature -- Change element: send reply
|
feature -- Change element: send reply
|
||||||
|
|
||||||
set_reply_text (new_text: detachable STRING)
|
set_reply_text (new_text: detachable STRING)
|
||||||
-- text could be Void
|
-- text could be Void
|
||||||
do
|
do
|
||||||
if new_text = Void then
|
if new_text = Void then
|
||||||
create reply_text.make_empty
|
create reply_text.make_empty
|
||||||
else
|
else
|
||||||
reply_text := new_text
|
reply_text := new_text
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
append_reply_text (more_text: STRING)
|
append_reply_text (more_text: STRING)
|
||||||
-- add more text to the reply
|
-- add more text to the reply
|
||||||
require
|
require
|
||||||
reply_text /= Void
|
reply_text /= Void
|
||||||
more_text /= Void
|
more_text /= Void
|
||||||
do
|
do
|
||||||
reply_text.append (more_text)
|
reply_text.append (more_text)
|
||||||
end
|
end
|
||||||
|
|
||||||
note
|
note
|
||||||
copyright: "2011-2011, Javier Velilla and others"
|
copyright: "2011-2011, Javier Velilla and others"
|
||||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
note
|
note
|
||||||
description: "Summary description for {SHARED_URI_CONTENTS_TYPES}."
|
description: "Summary description for {SHARED_URI_CONTENTS_TYPES}."
|
||||||
author: ""
|
author: ""
|
||||||
date: "$Date$"
|
date: "$Date$"
|
||||||
revision: "$Revision$"
|
revision: "$Revision$"
|
||||||
|
|
||||||
class
|
class
|
||||||
SHARED_URI_CONTENTS_TYPES
|
SHARED_URI_CONTENTS_TYPES
|
||||||
feature
|
feature
|
||||||
|
|
||||||
ct_table: URI_CONTENTS_TYPES
|
ct_table: URI_CONTENTS_TYPES
|
||||||
once
|
once
|
||||||
create Result.make
|
create Result.make
|
||||||
end
|
end
|
||||||
note
|
note
|
||||||
copyright: "2011-2011, Javier Velilla and others"
|
copyright: "2011-2011, Javier Velilla and others"
|
||||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -0,0 +1,82 @@
|
|||||||
|
note
|
||||||
|
description: "Summary description for {TCP_STREAM_SOCKET}."
|
||||||
|
date: "$Date: 2015-02-16 19:53:13 +0100 (lun., 16 févr. 2015) $"
|
||||||
|
revision: "$Revision: 96642 $"
|
||||||
|
|
||||||
|
class
|
||||||
|
TCP_STREAM_SOCKET
|
||||||
|
|
||||||
|
inherit
|
||||||
|
NETWORK_STREAM_SOCKET
|
||||||
|
redefine
|
||||||
|
make
|
||||||
|
end
|
||||||
|
|
||||||
|
create
|
||||||
|
make_server_by_address_and_port,
|
||||||
|
make_server_by_port
|
||||||
|
|
||||||
|
create {NETWORK_STREAM_SOCKET}
|
||||||
|
make_from_descriptor_and_address
|
||||||
|
|
||||||
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
|
make
|
||||||
|
-- Create a network stream socket.
|
||||||
|
do
|
||||||
|
Precursor
|
||||||
|
set_reuse_address
|
||||||
|
end
|
||||||
|
|
||||||
|
make_server_by_address_and_port (an_address: INET_ADDRESS; a_port: INTEGER)
|
||||||
|
-- Create server socket on `an_address' and `a_port'.
|
||||||
|
require
|
||||||
|
valid_port: a_port >= 0
|
||||||
|
do
|
||||||
|
make
|
||||||
|
create address.make_from_address_and_port (an_address, a_port)
|
||||||
|
bind
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Basic operation
|
||||||
|
|
||||||
|
send_message (a_msg: STRING)
|
||||||
|
local
|
||||||
|
a_package : PACKET
|
||||||
|
a_data : MANAGED_POINTER
|
||||||
|
c_string : C_STRING
|
||||||
|
do
|
||||||
|
create c_string.make (a_msg)
|
||||||
|
create a_data.make_from_pointer (c_string.item, a_msg.count + 1)
|
||||||
|
create a_package.make_from_managed_pointer (a_data)
|
||||||
|
send (a_package, 1)
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Output
|
||||||
|
|
||||||
|
put_readable_string_8 (s: READABLE_STRING_8)
|
||||||
|
-- Write readable string `s' to socket.
|
||||||
|
local
|
||||||
|
ext: C_STRING
|
||||||
|
do
|
||||||
|
create ext.make (s)
|
||||||
|
put_managed_pointer (ext.managed_data, 0, s.count)
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Status report
|
||||||
|
|
||||||
|
try_ready_for_reading: BOOLEAN
|
||||||
|
-- Is data available for reading from the socket right now?
|
||||||
|
require
|
||||||
|
socket_exists: exists
|
||||||
|
local
|
||||||
|
retval: INTEGER
|
||||||
|
do
|
||||||
|
retval := c_select_poll_with_timeout (descriptor, True, 0)
|
||||||
|
Result := (retval > 0)
|
||||||
|
end
|
||||||
|
|
||||||
|
note
|
||||||
|
copyright: "2011-2015, Javier Velilla and others"
|
||||||
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
|
end
|
||||||
@@ -1,82 +1,83 @@
|
|||||||
note
|
note
|
||||||
description: "Summary description for {TCP_STREAM_SOCKET}."
|
description: "Summary description for {TCP_STREAM_SOCKET}."
|
||||||
date: "$Date$"
|
date: "$Date$"
|
||||||
revision: "$Revision$"
|
revision: "$Revision$"
|
||||||
|
|
||||||
class
|
class
|
||||||
TCP_STREAM_SOCKET
|
TCP_STREAM_SOCKET
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
NETWORK_STREAM_SOCKET
|
NETWORK_STREAM_SOCKET
|
||||||
redefine
|
redefine
|
||||||
make
|
make
|
||||||
end
|
end
|
||||||
|
|
||||||
create
|
create
|
||||||
make_server_by_address_and_port,
|
make_server_by_address_and_port,
|
||||||
make_server_by_port
|
make_server_by_port
|
||||||
|
|
||||||
create {NETWORK_STREAM_SOCKET}
|
create {NETWORK_STREAM_SOCKET}
|
||||||
make_from_descriptor_and_address
|
make_from_descriptor_and_address,
|
||||||
|
make_empty
|
||||||
feature {NONE} -- Initialization
|
|
||||||
|
feature {NONE} -- Initialization
|
||||||
make
|
|
||||||
-- Create a network stream socket.
|
make
|
||||||
do
|
-- Create a network stream socket.
|
||||||
Precursor
|
do
|
||||||
set_reuse_address
|
Precursor
|
||||||
end
|
set_reuse_address
|
||||||
|
end
|
||||||
make_server_by_address_and_port (an_address: INET_ADDRESS; a_port: INTEGER)
|
|
||||||
-- Create server socket on `an_address' and `a_port'.
|
make_server_by_address_and_port (an_address: INET_ADDRESS; a_port: INTEGER)
|
||||||
require
|
-- Create server socket on `an_address' and `a_port'.
|
||||||
valid_port: a_port >= 0
|
require
|
||||||
do
|
valid_port: a_port >= 0
|
||||||
make
|
do
|
||||||
create address.make_from_address_and_port (an_address, a_port)
|
make
|
||||||
bind
|
create address.make_from_address_and_port (an_address, a_port)
|
||||||
end
|
bind
|
||||||
|
end
|
||||||
feature -- Basic operation
|
|
||||||
|
feature -- Basic operation
|
||||||
send_message (a_msg: STRING)
|
|
||||||
local
|
send_message (a_msg: STRING)
|
||||||
a_package : PACKET
|
local
|
||||||
a_data : MANAGED_POINTER
|
a_package : PACKET
|
||||||
c_string : C_STRING
|
a_data : MANAGED_POINTER
|
||||||
do
|
c_string : C_STRING
|
||||||
create c_string.make (a_msg)
|
do
|
||||||
create a_data.make_from_pointer (c_string.item, a_msg.count + 1)
|
create c_string.make (a_msg)
|
||||||
create a_package.make_from_managed_pointer (a_data)
|
create a_data.make_from_pointer (c_string.item, a_msg.count + 1)
|
||||||
send (a_package, 1)
|
create a_package.make_from_managed_pointer (a_data)
|
||||||
end
|
send (a_package, 1)
|
||||||
|
end
|
||||||
feature -- Output
|
|
||||||
|
feature -- Output
|
||||||
put_readable_string_8 (s: READABLE_STRING_8)
|
|
||||||
-- Write readable string `s' to socket.
|
put_readable_string_8 (s: READABLE_STRING_8)
|
||||||
local
|
-- Write readable string `s' to socket.
|
||||||
ext: C_STRING
|
local
|
||||||
do
|
ext: C_STRING
|
||||||
create ext.make (s)
|
do
|
||||||
put_managed_pointer (ext.managed_data, 0, s.count)
|
create ext.make (s)
|
||||||
end
|
put_managed_pointer (ext.managed_data, 0, s.count)
|
||||||
|
end
|
||||||
feature -- Status report
|
|
||||||
|
feature -- Status report
|
||||||
try_ready_for_reading: BOOLEAN
|
|
||||||
-- Is data available for reading from the socket right now?
|
try_ready_for_reading: BOOLEAN
|
||||||
require
|
-- Is data available for reading from the socket right now?
|
||||||
socket_exists: exists
|
require
|
||||||
local
|
socket_exists: exists
|
||||||
retval: INTEGER
|
local
|
||||||
do
|
retval: INTEGER
|
||||||
retval := c_select_poll_with_timeout (descriptor, True, 0)
|
do
|
||||||
Result := (retval > 0)
|
retval := c_select_poll_with_timeout (descriptor, True, 0)
|
||||||
end
|
Result := (retval > 0)
|
||||||
|
end
|
||||||
note
|
|
||||||
copyright: "2011-2011, Javier Velilla and others"
|
note
|
||||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
copyright: "2011-2015, Javier Velilla and others"
|
||||||
end
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
|
end
|
||||||
|
|||||||
@@ -1,91 +1,91 @@
|
|||||||
class URI_CONTENTS_TYPES
|
class URI_CONTENTS_TYPES
|
||||||
|
|
||||||
create
|
create
|
||||||
|
|
||||||
make
|
make
|
||||||
|
|
||||||
|
|
||||||
feature
|
feature
|
||||||
|
|
||||||
content_types: HASH_TABLE [STRING, STRING]
|
content_types: HASH_TABLE [STRING, STRING]
|
||||||
|
|
||||||
extension (uri: STRING): STRING
|
extension (uri: STRING): STRING
|
||||||
-- extract extendion from a URI
|
-- extract extendion from a URI
|
||||||
local
|
local
|
||||||
i: INTEGER
|
i: INTEGER
|
||||||
do
|
do
|
||||||
-- going from the end find the position of the "."
|
-- going from the end find the position of the "."
|
||||||
from
|
from
|
||||||
i := uri.count
|
i := uri.count
|
||||||
until
|
until
|
||||||
i = 0 or else uri.item (i) = '.'
|
i = 0 or else uri.item (i) = '.'
|
||||||
loop
|
loop
|
||||||
i := i - 1
|
i := i - 1
|
||||||
end
|
end
|
||||||
Result := uri.substring (i+1, uri.count)
|
Result := uri.substring (i+1, uri.count)
|
||||||
end
|
end
|
||||||
|
|
||||||
feature {NONE}
|
feature {NONE}
|
||||||
|
|
||||||
make
|
make
|
||||||
do
|
do
|
||||||
create content_types.make (30)
|
create content_types.make (30)
|
||||||
content_types.put ("text/html", "html")
|
content_types.put ("text/html", "html")
|
||||||
content_types.put ("text/html", "htm")
|
content_types.put ("text/html", "htm")
|
||||||
content_types.put ("image/gif", "gif")
|
content_types.put ("image/gif", "gif")
|
||||||
content_types.put ("image/jpeg", "jpeg")
|
content_types.put ("image/jpeg", "jpeg")
|
||||||
content_types.put ("image/png", "jpg")
|
content_types.put ("image/png", "jpg")
|
||||||
content_types.put ("image/png", "png")
|
content_types.put ("image/png", "png")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
feature -- Access: Encoding
|
feature -- Access: Encoding
|
||||||
|
|
||||||
urlencode (s: STRING): STRING
|
urlencode (s: STRING): STRING
|
||||||
-- URL encode `s'
|
-- URL encode `s'
|
||||||
do
|
do
|
||||||
Result := s.string
|
Result := s.string
|
||||||
Result.replace_substring_all ("#", "%%23")
|
Result.replace_substring_all ("#", "%%23")
|
||||||
Result.replace_substring_all (" ", "%%20")
|
Result.replace_substring_all (" ", "%%20")
|
||||||
Result.replace_substring_all ("%T", "%%09")
|
Result.replace_substring_all ("%T", "%%09")
|
||||||
Result.replace_substring_all ("%N", "%%0A")
|
Result.replace_substring_all ("%N", "%%0A")
|
||||||
Result.replace_substring_all ("/", "%%2F")
|
Result.replace_substring_all ("/", "%%2F")
|
||||||
Result.replace_substring_all ("&", "%%26")
|
Result.replace_substring_all ("&", "%%26")
|
||||||
Result.replace_substring_all ("<", "%%3C")
|
Result.replace_substring_all ("<", "%%3C")
|
||||||
Result.replace_substring_all ("=", "%%3D")
|
Result.replace_substring_all ("=", "%%3D")
|
||||||
Result.replace_substring_all (">", "%%3E")
|
Result.replace_substring_all (">", "%%3E")
|
||||||
Result.replace_substring_all ("%"", "%%22")
|
Result.replace_substring_all ("%"", "%%22")
|
||||||
Result.replace_substring_all ("%'", "%%27")
|
Result.replace_substring_all ("%'", "%%27")
|
||||||
end
|
end
|
||||||
|
|
||||||
urldecode (s: STRING): STRING
|
urldecode (s: STRING): STRING
|
||||||
-- URL decode `s'
|
-- URL decode `s'
|
||||||
do
|
do
|
||||||
Result := s.string
|
Result := s.string
|
||||||
Result.replace_substring_all ("%%23", "#")
|
Result.replace_substring_all ("%%23", "#")
|
||||||
Result.replace_substring_all ("%%20", " ")
|
Result.replace_substring_all ("%%20", " ")
|
||||||
Result.replace_substring_all ("%%09", "%T")
|
Result.replace_substring_all ("%%09", "%T")
|
||||||
Result.replace_substring_all ("%%0A", "%N")
|
Result.replace_substring_all ("%%0A", "%N")
|
||||||
Result.replace_substring_all ("%%2F", "/")
|
Result.replace_substring_all ("%%2F", "/")
|
||||||
Result.replace_substring_all ("%%26", "&")
|
Result.replace_substring_all ("%%26", "&")
|
||||||
Result.replace_substring_all ("%%3C", "<")
|
Result.replace_substring_all ("%%3C", "<")
|
||||||
Result.replace_substring_all ("%%3D", "=")
|
Result.replace_substring_all ("%%3D", "=")
|
||||||
Result.replace_substring_all ("%%3E", ">")
|
Result.replace_substring_all ("%%3E", ">")
|
||||||
Result.replace_substring_all ("%%22", "%"")
|
Result.replace_substring_all ("%%22", "%"")
|
||||||
Result.replace_substring_all ("%%27", "%'")
|
Result.replace_substring_all ("%%27", "%'")
|
||||||
end
|
end
|
||||||
|
|
||||||
stripslashes (s: STRING): STRING
|
stripslashes (s: STRING): STRING
|
||||||
do
|
do
|
||||||
Result := s.string
|
Result := s.string
|
||||||
Result.replace_substring_all ("\%"", "%"")
|
Result.replace_substring_all ("\%"", "%"")
|
||||||
Result.replace_substring_all ("\'", "'")
|
Result.replace_substring_all ("\'", "'")
|
||||||
Result.replace_substring_all ("\/", "/")
|
Result.replace_substring_all ("\/", "/")
|
||||||
Result.replace_substring_all ("\\", "\")
|
Result.replace_substring_all ("\\", "\")
|
||||||
end
|
end
|
||||||
|
|
||||||
note
|
note
|
||||||
copyright: "2011-2011, Javier Velilla and others"
|
copyright: "2011-2011, Javier Velilla and others"
|
||||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-8-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-8-0 http://www.eiffel.com/developers/xml/configuration-1-8-0.xsd" name="nino" uuid="32C1D67D-33DE-4F1E-864B-D45388F2E3E6" library_target="nino">
|
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-12-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-12-0 http://www.eiffel.com/developers/xml/configuration-1-12-0.xsd" name="nino" uuid="32C1D67D-33DE-4F1E-864B-D45388F2E3E6" library_target="nino">
|
||||||
<target name="nino">
|
<target name="nino">
|
||||||
<root all_classes="true"/>
|
<root all_classes="true"/>
|
||||||
<file_rule>
|
<file_rule>
|
||||||
@@ -8,13 +8,28 @@
|
|||||||
<exclude>/CVS$</exclude>
|
<exclude>/CVS$</exclude>
|
||||||
<exclude>/.svn$</exclude>
|
<exclude>/.svn$</exclude>
|
||||||
</file_rule>
|
</file_rule>
|
||||||
<option warning="true" is_attached_by_default="true" void_safety="all">
|
<option warning="true" full_class_checking="false" is_attached_by_default="true" void_safety="all" syntax="transitional">
|
||||||
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
|
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
|
||||||
</option>
|
</option>
|
||||||
<setting name="concurrency" value="thread"/>
|
<setting name="concurrency" value="thread"/>
|
||||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||||
<library name="net" location="$ISE_LIBRARY\library\net\net-safe.ecf"/>
|
<library name="net" location="$ISE_LIBRARY\library\net\net-safe.ecf"/>
|
||||||
<library name="thread" location="$ISE_LIBRARY\library\thread\thread-safe.ecf"/>
|
<library name="thread" location="$ISE_LIBRARY\library\thread\thread-safe.ecf"/>
|
||||||
<cluster name="nino" location=".\library\" recursive="true"/>
|
<cluster name="nino" location=".\library\" recursive="true">
|
||||||
|
<file_rule>
|
||||||
|
<exclude>spec</exclude>
|
||||||
|
</file_rule>
|
||||||
|
<file_rule>
|
||||||
|
<exclude>tcp_stream_socket.e</exclude>
|
||||||
|
<condition>
|
||||||
|
<version type="compiler" max="15.01.9.6506"/>
|
||||||
|
</condition>
|
||||||
|
</file_rule>
|
||||||
|
</cluster>
|
||||||
|
<cluster name="spec_before_15_01" location=".\library\spec\before_15_01\" recursive="true">
|
||||||
|
<condition>
|
||||||
|
<version type="compiler" max="15.01.9.6506"/>
|
||||||
|
</condition>
|
||||||
|
</cluster>
|
||||||
</target>
|
</target>
|
||||||
</system>
|
</system>
|
||||||
|
|||||||
@@ -15,6 +15,21 @@
|
|||||||
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
|
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
|
||||||
<library name="net" location="$ISE_LIBRARY\library\net\net.ecf"/>
|
<library name="net" location="$ISE_LIBRARY\library\net\net.ecf"/>
|
||||||
<library name="thread" location="$ISE_LIBRARY\library\thread\thread.ecf"/>
|
<library name="thread" location="$ISE_LIBRARY\library\thread\thread.ecf"/>
|
||||||
<cluster name="nino" location=".\library\" recursive="true"/>
|
<cluster name="nino" location=".\library\" recursive="true">
|
||||||
|
<file_rule>
|
||||||
|
<exclude>spec</exclude>
|
||||||
|
</file_rule>
|
||||||
|
<file_rule>
|
||||||
|
<exclude>tcp_stream_socket.e</exclude>
|
||||||
|
<condition>
|
||||||
|
<version type="compiler" max="15.01.9.6506"/>
|
||||||
|
</condition>
|
||||||
|
</file_rule>
|
||||||
|
</cluster>
|
||||||
|
<cluster name="spec_before_15_01" location=".\library\spec\before_15_01\" recursive="true">
|
||||||
|
<condition>
|
||||||
|
<version type="compiler" max="15.01.9.6506"/>
|
||||||
|
</condition>
|
||||||
|
</cluster>
|
||||||
</target>
|
</target>
|
||||||
</system>
|
</system>
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
|
|
||||||
14
contrib/library/network/server/nino/package.iron
Normal file
14
contrib/library/network/server/nino/package.iron
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
package nino
|
||||||
|
|
||||||
|
project
|
||||||
|
nino = "nino-safe.ecf"
|
||||||
|
nino = "nino.ecf"
|
||||||
|
|
||||||
|
note
|
||||||
|
title: Eiffel Nino Web Server
|
||||||
|
description: Simple HTTPd server written in Eiffel
|
||||||
|
tags: web, httpd, server
|
||||||
|
license: Eiffel Forum v2
|
||||||
|
copyright: Javier Velilla, Jocelyn Fiat.
|
||||||
|
|
||||||
|
end
|
||||||
@@ -1,38 +1,38 @@
|
|||||||
Eiffel Nino HTTPD
|
Eiffel Nino HTTPD
|
||||||
=================
|
=================
|
||||||
Eiffel Nino is and HTTPD server. It's a work in progress, so maybe it will be refactored.
|
Eiffel Nino is and HTTPD server. It's a work in progress, so maybe it will be refactored.
|
||||||
The goal of is to provide a simple web server for development (like Java, Python and Ruby provide)
|
The goal of is to provide a simple web server for development (like Java, Python and Ruby provide)
|
||||||
The code is based on Xebra and Emu Web Server.
|
The code is based on Xebra and Emu Web Server.
|
||||||
|
|
||||||
|
|
||||||
Goal
|
Goal
|
||||||
========
|
========
|
||||||
HTTPD server for development, support for HTTP 1.1.
|
HTTPD server for development, support for HTTP 1.1.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Testing
|
Testing
|
||||||
=======
|
=======
|
||||||
To test the HTTPD server, you could run the [example https://github.com/jvelilla/EiffelWebNino/tree/master/example/SimpleWebServer]
|
To test the HTTPD server, you could run the [example https://github.com/jvelilla/EiffelWebNino/tree/master/example/SimpleWebServer]
|
||||||
The server work fine in Windows and Linux.
|
The server work fine in Windows and Linux.
|
||||||
|
|
||||||
Run the server and point your browser to one of the following URIs
|
Run the server and point your browser to one of the following URIs
|
||||||
|
|
||||||
1) http://localhost:9000/post/index.html
|
1) http://localhost:9000/post/index.html
|
||||||
2) http://localhost:9000/demo1/template.html
|
2) http://localhost:9000/demo1/template.html
|
||||||
3) http://localhost:9000/demo2/demo.html
|
3) http://localhost:9000/demo2/demo.html
|
||||||
4) http://localhost:9000/example/html/index.html
|
4) http://localhost:9000/example/html/index.html
|
||||||
5) http://localhost:9000/html/simple.html
|
5) http://localhost:9000/html/simple.html
|
||||||
6) http://localhost:9000/html/images.html
|
6) http://localhost:9000/html/images.html
|
||||||
7) http://localhost:9000/html/images.html
|
7) http://localhost:9000/html/images.html
|
||||||
8) http://localhost:9000/html5/dataset.html
|
8) http://localhost:9000/html5/dataset.html
|
||||||
|
|
||||||
Known Issues
|
Known Issues
|
||||||
============
|
============
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
10
contrib/library/text/parser/json/.gitattributes
vendored
Normal file
10
contrib/library/text/parser/json/.gitattributes
vendored
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# Set default behaviour, in case users don't have core.autocrlf set.
|
||||||
|
# * text=auto
|
||||||
|
|
||||||
|
# Explicitly declare text files we want to always be normalized and converted
|
||||||
|
# to native line endings on checkout.
|
||||||
|
*.e text
|
||||||
|
*.ecf text
|
||||||
|
*.bat text
|
||||||
|
*.json text
|
||||||
|
*.txt text
|
||||||
2
contrib/library/text/parser/json/.gitignore
vendored
2
contrib/library/text/parser/json/.gitignore
vendored
@@ -1,2 +1,2 @@
|
|||||||
*.swp
|
*.swp
|
||||||
EIFGENs
|
EIFGENs/
|
||||||
|
|||||||
@@ -1,26 +1,28 @@
|
|||||||
History file for EJSON
|
History file for EJSON
|
||||||
======================
|
======================
|
||||||
|
|
||||||
team: ""
|
team: ""
|
||||||
date: "2011-07-06"
|
date: "2011-07-06"
|
||||||
revision: "0.3.0"
|
revision: "0.3.0"
|
||||||
|
|
||||||
|
WARNING: THIS FILE IS NOT UP TO DATE
|
||||||
+++++++++++++++++++++Important Changes since 0.2.0 version++++++++++++++++++++++++++++++++++++++++++++++
|
|
||||||
|
|
||||||
*Updated skip_white_spaces, now check %U and %T codes
|
+++++++++++++++++++++Important Changes since 0.2.0 version++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
|
||||||
*Undo changes to is_a_valid_number, because it's doesn't follow the
|
*Updated skip_white_spaces, now check %U and %T codes
|
||||||
JSON spec. Tests : fail13.json, fail29.json and fail30.json are valid
|
|
||||||
with this implementation, so we go back to the previous
|
*Undo changes to is_a_valid_number, because it's doesn't follow the
|
||||||
implementation.
|
JSON spec. Tests : fail13.json, fail29.json and fail30.json are valid
|
||||||
|
with this implementation, so we go back to the previous
|
||||||
*Added autotest test suite
|
implementation.
|
||||||
|
|
||||||
*Added getest based test program
|
*Added autotest test suite
|
||||||
|
|
||||||
*Updated Eiffel configuration file, updated to the new clusters
|
*Added getest based test program
|
||||||
|
|
||||||
*Added converters and factory classes
|
*Updated Eiffel configuration file, updated to the new clusters
|
||||||
|
|
||||||
*Added new top level directories; library, test, build and example
|
*Added converters and factory classes
|
||||||
|
|
||||||
|
*Added new top level directories; library, test, build and example
|
||||||
|
|||||||
@@ -1,20 +1,21 @@
|
|||||||
Copyright (c) 2010 Javier Velilla and others, http://ejson.origo.ethz.ch
|
Copyright (c) 2010-2014 Javier Velilla, Jocelyn Fiat and others,
|
||||||
|
https://github.com/eiffelhub/json .
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
in the Software without restriction, including without limitation the rights
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
in the Software without restriction, including without limitation the rights
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
furnished to do so, subject to the following conditions:
|
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 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,
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
THE SOFTWARE.
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
|||||||
@@ -1,97 +1,112 @@
|
|||||||
Readme file for eJSON
|
Readme file for eJSON
|
||||||
=====================
|
=====================
|
||||||
|
|
||||||
team: "Javier Velilla,Jocelyn Fiat, Paul Cohen"
|
team: "Javier Velilla, Jocelyn Fiat"
|
||||||
date: "$Date$"
|
previous contributors: "Paul Cohen"
|
||||||
revision: "$Revision$"
|
date: "2014-nov-17"
|
||||||
|
|
||||||
1. Introduction
|
1. Introduction
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
eJSON stands for Eiffel JSON library and is a small Eiffel library for dealing
|
eJSON stands for Eiffel JSON library and is a small Eiffel library for dealing
|
||||||
with the JSON format. The objective of the library is to provide two basic
|
with the JSON format. This library provides a JSON parser and visitors,
|
||||||
features Eiffel2JSON and JSON2Eiffel.
|
including a pretty printer.
|
||||||
|
|
||||||
2. Legal stuff
|
The converters part is now obsolete and not recommended (remember: the
|
||||||
--------------
|
objective of converters were to provide two basic features Eiffel2JSON and
|
||||||
|
JSON2Eiffel). There will be a new design for converters as a standalone
|
||||||
eJSON is copyrighted by the author Javier Velilla and others. It is licensed
|
library on top of Current json library.
|
||||||
under the MIT License. See the file license.txt in the same directory as this
|
|
||||||
readme file.
|
2. Legal stuff
|
||||||
|
--------------
|
||||||
3. Versioning scheme
|
|
||||||
--------------------
|
eJSON is copyrighted by the author Javier Velilla, Jocelyn Fiat and others. It is licensed
|
||||||
|
under the MIT License. See the file license.txt in the same directory as this
|
||||||
eJSON version numbers has the form:
|
readme file.
|
||||||
|
|
||||||
«major number».«minor number».«patch level»
|
3. Versioning scheme
|
||||||
|
--------------------
|
||||||
eJSON will retain the major number 0 as long as it has beta status. A change in
|
|
||||||
major number indicates that a release is not backward compatible. A change in
|
eJSON version numbers has the form:
|
||||||
minor number indicates that a release is backward compatible (within that major
|
|
||||||
number) but that new useful features may have been added. A change in patch
|
«major number».«minor number».«patch level»
|
||||||
level simply indicates that the release contains bug fixes for the previous
|
|
||||||
release. Note that as long as eJSON is in beta status (0.Y.Z) backward
|
eJSON will retain the major number 0 as long as it has beta status. A change in
|
||||||
compatibility is not guranteed for changes in minor numbers!
|
major number indicates that a release is not backward compatible. A change in
|
||||||
|
minor number indicates that a release is backward compatible (within that major
|
||||||
4. Documentation
|
number) but that new useful features may have been added. A change in patch
|
||||||
---------------
|
level simply indicates that the release contains bug fixes for the previous
|
||||||
|
release. Note that as long as eJSON is in beta status (0.Y.Z) backward
|
||||||
Currently the only documentation on eJSON is available at:
|
compatibility is not guranteed for changes in minor numbers!
|
||||||
|
|
||||||
https://github.com/eiffelhub/json/wiki/User-guide
|
4. Documentation
|
||||||
|
---------------
|
||||||
5. Requirements and installation
|
|
||||||
--------------------------------
|
Currently the only documentation on eJSON is available at:
|
||||||
|
|
||||||
EJSON requires that you have:
|
https://github.com/eiffelhub/json/wiki/User-guide
|
||||||
|
|
||||||
1. Gobo 3.9 installed or later
|
5. Requirements and installation
|
||||||
2. One of the following compiler combinations installed:
|
--------------------------------
|
||||||
* ISE Eiffel 6.5 or later.
|
|
||||||
* gec [try to test]
|
EJSON requires that you have:
|
||||||
* tecomp [try to test]
|
|
||||||
|
1. One of the following compiler combinations installed:
|
||||||
eJSON probably works fine with other versions of the above compilers.
|
* ISE Eiffel 13.11 or later.
|
||||||
There are no known platform dependencies (Windows, Linux).
|
* gec [try to test]
|
||||||
|
|
||||||
To install eJSON simply extract the ejson-X.Y.Z.zip file to some appropriate
|
eJSON probably works fine with other versions of the above compilers.
|
||||||
place on your hard disk. There are no requirements on environment variables or
|
There are no known platform dependencies (Windows, Linux).
|
||||||
registry variables.
|
|
||||||
|
To install eJSON simply extract the ejson-X.Y.Z.zip file to some appropriate
|
||||||
To verify that everything works you should compile the example programs and/or
|
place on your hard disk. There are no requirements on environment variables or
|
||||||
the test program.
|
registry variables.
|
||||||
|
Note eJSON is also delivered within EiffelStudio release, under
|
||||||
6. Contents of eJSON
|
$ISE_LIBRARY/contrib/library/text/parser/json
|
||||||
--------------------
|
|
||||||
|
To verify that everything works you should compile the example programs and/or
|
||||||
All directory names below are relative to the root directory of your ejson
|
the test program.
|
||||||
installation.
|
|
||||||
|
6. Contents of eJSON
|
||||||
Directory Description
|
--------------------
|
||||||
--------- -----------
|
|
||||||
doc Contains the eJSON.pdf documentation file.
|
All directory names below are relative to the root directory of your ejson
|
||||||
examples Contains the two example programs.
|
installation.
|
||||||
ejson Contains the actual eJSON library classes.
|
|
||||||
test Contains a test program for eJSON.
|
Directory Description
|
||||||
|
--------- -----------
|
||||||
7. Contacting the Team
|
doc Contains documentation file.
|
||||||
----------------------
|
examples Contains example codes.
|
||||||
|
library Contains the actual eJSON library classes.
|
||||||
Contact the team:
|
test Contains test suite for eJSON.
|
||||||
|
|
||||||
Javier Velilla «javier.hector@gmail.com»
|
7. Contacting the Team
|
||||||
Paul Cohen «paco@seibostudios.se»
|
----------------------
|
||||||
Jocelyn Fiat «jfiat@eiffel.com»
|
|
||||||
|
Contact the team:
|
||||||
8. Releases
|
|
||||||
-----------
|
https://github.com/eiffelhub/json/issues
|
||||||
|
Javier Velilla «javier.hector@gmail.com»
|
||||||
For more information on what was changed in each release look in the file
|
Jocelyn Fiat «jfiat@eiffel.com»
|
||||||
history.txt.
|
|
||||||
|
8. Releases
|
||||||
Version Date Description
|
-----------
|
||||||
------- ---- -----------
|
|
||||||
0.3.0 2011-07-06 JSON Factory Converters
|
For more information on what was changed in each release look in the file
|
||||||
0.2.0 2010-02-07 Adapted to EiffelStudio 6.4 or later, supports void-safety
|
history.txt.
|
||||||
0.1.0 2010-02-07 First release, Adapted to SmartEiffel 1.2r7 and EiffelStudio 6.2 or previous
|
|
||||||
|
Version Date Description
|
||||||
|
------- ---- -----------
|
||||||
|
0.6.0 2014-11-17 Fixed various issue with parsing string (such as \t and related),
|
||||||
|
Implemented escaping of slash '/' only in case of '</' to avoid
|
||||||
|
potential issue with javascript and </script>
|
||||||
|
Many feature renaming to match Eiffel style and naming convention,
|
||||||
|
kept previous feature as obsolete.
|
||||||
|
Restructured the library to make easy extraction of "converter"
|
||||||
|
classes if needed in the future.
|
||||||
|
Marked converters classes as obsolete.
|
||||||
|
0.5.0 2013-11-dd Added JSON_ITERATOR, simplified JSON_OBJECT
|
||||||
|
0.4.0 2012-12-12 Updated documentation URI
|
||||||
|
0.3.0 2011-07-06 JSON Factory Converters
|
||||||
|
0.2.0 2010-02-07 Adapted to EiffelStudio 6.4 or later, supports void-safety
|
||||||
|
0.1.0 2010-02-07 First release, Adapted to SmartEiffel 1.2r7 and EiffelStudio 6.2 or previous
|
||||||
|
|||||||
295
contrib/library/text/parser/json/doc/user_guide.mediawiki
Normal file
295
contrib/library/text/parser/json/doc/user_guide.mediawiki
Normal file
@@ -0,0 +1,295 @@
|
|||||||
|
== Preface ==
|
||||||
|
|
||||||
|
This document is a living document! As always read and try out the code to understand what's really going on.
|
||||||
|
|
||||||
|
=== About the project ===
|
||||||
|
|
||||||
|
The eJSON project was started by Javier Velilla in 2008. The aim was simply to
|
||||||
|
provide JSON support to Eiffel programmers. A couple of other people have been
|
||||||
|
involved to various extent since the start; Berend de Boer, Jocelyn Fiat and
|
||||||
|
Manu Stapf. In 2009 Paul Cohen joined the project as an active developer and
|
||||||
|
later Jocelyn Fiat.
|
||||||
|
|
||||||
|
The current active maintainers:
|
||||||
|
- Javier Velilla
|
||||||
|
- Jocelyn Fiat
|
||||||
|
|
||||||
|
The formal name of the project is “eJSON”.
|
||||||
|
|
||||||
|
For questions regarding eJSON please contact
|
||||||
|
- <javier.hector at gmail.com>
|
||||||
|
- <jfiat at eiffel.com>
|
||||||
|
- or directly on [https://github.com/eiffelhub/json/issues]
|
||||||
|
|
||||||
|
=== Current version and status ===
|
||||||
|
|
||||||
|
The latest release is 0.6.0. eJSON has been improved and cleaned.
|
||||||
|
The converters are not obsolete.
|
||||||
|
|
||||||
|
|
||||||
|
== Introduction ==
|
||||||
|
|
||||||
|
=== What is JSON? ===
|
||||||
|
|
||||||
|
JSON (JavaScript Object Notation) is a lightweight computer data interchange format. It is a text-based, human-readable format for representing simple data structures and associative arrays (called objects). See the [http://en.wikipedia.org/wiki/JSON Wikipedia article on JSON], [http://www.json.org www.json.org] and [http://www.json.com www.json.com] for more information.
|
||||||
|
|
||||||
|
The JSON format is specified in [http://www.ietf.org/rfc/rfc4627.txt IETF RFC 4627] by Douglas Crockford. The official [http://www.iana.org/assignments/media-types Internet MIME media type] for JSON is "application/json". The recommended file name extension for JSON files is ".json".
|
||||||
|
|
||||||
|
=== Advantages ===
|
||||||
|
|
||||||
|
1. Lightweight data-interchange format.
|
||||||
|
2. Easy for humans to read and write.
|
||||||
|
3. Enables easy integration with AJAX/JavaScript web applications. See the article [http://www.developer.com/lang/jscript/article.php/3596836 Speeding Up AJAX with JSON] for a good short discussion on this subject.
|
||||||
|
4. JSON data structures translate with ease into the native data structures universal to almost all programming languages used today.
|
||||||
|
|
||||||
|
=== Use in Eiffel applications ===
|
||||||
|
|
||||||
|
JSON can be used as a general serialization format for Eiffel objects. As such it could be used as a:
|
||||||
|
|
||||||
|
* Data representation format in REST-based web service applications written in Eiffel.
|
||||||
|
* Serialization format for Eiffel objects in persistence solutions.
|
||||||
|
* File format for configuration files in Eiffel systems.
|
||||||
|
|
||||||
|
=== Prerequisites ===
|
||||||
|
|
||||||
|
eJSON works today with EiffelStudio 13.11
|
||||||
|
There is an optional extension that requires the latest snapshot of the Gobo Eiffel libraries (a working snapshot is distributed with EiffelStudio). The depencencies on Gobo are on Gobo's unicode
|
||||||
|
and regex libraries and for some of the extra features in eJSON, on Gobos structure classes DS_HASH_TABLE and DS_LINKED_LIST.
|
||||||
|
|
||||||
|
eJSON is intended to work with all ECMA compliant Eiffel compilers.
|
||||||
|
|
||||||
|
=== Installation ===
|
||||||
|
|
||||||
|
You can either download a given release and install on your machine or you can get the latest snapshot of the code.
|
||||||
|
To download go to the [http://ejson.origo.ethz.ch/download download page].
|
||||||
|
To get the latest snapshot of the code do:
|
||||||
|
|
||||||
|
: $ git clone https://github.com/eiffelhub/json.git json
|
||||||
|
|
||||||
|
*[https://github.com/eiffelhub/json/releases download page]
|
||||||
|
*[https://github.com/eiffelhub/json github project]
|
||||||
|
|
||||||
|
Note that the latest json release is also delivered with EiffelStudio installation under <code>$ISE_LIBRARY/contrib/library/text/parser/json</code>.
|
||||||
|
|
||||||
|
|
||||||
|
=== Cluster and directory layout ===
|
||||||
|
|
||||||
|
json/
|
||||||
|
library/ (Root directory for eJSON library classes)
|
||||||
|
kernel/ (All classes in this cluster should eventually only depend on ECMA Eiffel and FreeELKS).
|
||||||
|
json_array.e
|
||||||
|
json_boolean.e
|
||||||
|
json_null.e
|
||||||
|
json_number.e
|
||||||
|
json_object.e
|
||||||
|
json_string.e
|
||||||
|
json_value.e
|
||||||
|
parser/
|
||||||
|
json_parser.e
|
||||||
|
json_parser_access.e
|
||||||
|
json_reader.e
|
||||||
|
json_tokens.e
|
||||||
|
utility/
|
||||||
|
file/
|
||||||
|
json_file_reader.e
|
||||||
|
visitor/
|
||||||
|
json_visitor.e
|
||||||
|
json_iterator.e
|
||||||
|
json_pretty_string_visitor.e
|
||||||
|
print_json_visitor.e
|
||||||
|
converters/ (JSON core converter classes !OBSOLETE!)
|
||||||
|
json_converter.e
|
||||||
|
json_hash_table_converter.e
|
||||||
|
json_list_converter.e
|
||||||
|
json_linked_list_converter.e
|
||||||
|
json_arrayed_list_converter.e
|
||||||
|
support/
|
||||||
|
ejson.e
|
||||||
|
shared_ejson.e
|
||||||
|
gobo_converters/ (JSON core converter classes support for GOBO !OBSOLETE!)
|
||||||
|
converters/
|
||||||
|
json_ds_hash_table_converter.e
|
||||||
|
json_ds_linked_list_converter.e
|
||||||
|
shared_gobo_ejson.e
|
||||||
|
test/ (Contains autotest suite)
|
||||||
|
autotest/ (AutoTest based unit test).
|
||||||
|
examples/ (Example code)
|
||||||
|
|
||||||
|
=== Future development ===
|
||||||
|
|
||||||
|
Here is a list of suggestions for future development of eJSON.
|
||||||
|
* Ongoing: Provide a JSON_FACTORY class for easy conversion between arbitrary JSON and Eiffel values.
|
||||||
|
* Ongoing: Provide a mechanism for users to add custom converters between JSON values and user space Eiffel classes.
|
||||||
|
* Ongoing: Implement a full test framework for eJSON.
|
||||||
|
* Suggestion: Investigate performance and improve it if neccessary.
|
||||||
|
* Suggestion: Support JSON references. See [http://www.json.com/2007/10/19/json-referencing-proposal-and-library JSON Referencing Proposal and Library] and [http://www.sitepen.com/blog/2008/06/17/json-referencing-in-dojo JSON referencing in Dojo] for more information.
|
||||||
|
* Suggestion: Support JSON path. See [http://goessner.net/articles/JsonPath JSONPath - XPath for JSON] for more information.
|
||||||
|
* Suggestion: Support JSON schema validation. See [http://json-schema.org JSON Schema Proposal] for more information.
|
||||||
|
* Suggestion: Support RDF JSON serialization. See [http://n2.talis.com/wiki/RDF_JSON_Specification RDF JSON Specification] for more information.
|
||||||
|
* Suggestion: Add support to JSON classes for conversion from Eiffel manifest values. So one can write things like:
|
||||||
|
|
||||||
|
== A simple example ==
|
||||||
|
|
||||||
|
There are two basic approaches to using eJSON; either you use the basic JSON_VALUE classes, converting to and from JSON values to corresponding Eiffel instances or you use the high level eJSON interface class SHARED_EJSON. Of course you can use a mix of both approaches if you find it appropriate!
|
||||||
|
|
||||||
|
Here is an example of how to create a JSON number value from an INTEGER and then obtain the JSON representation for that value.
|
||||||
|
|
||||||
|
simple_example is
|
||||||
|
local
|
||||||
|
i: INTEGER
|
||||||
|
jn: JSON_NUMBER
|
||||||
|
s: STRING
|
||||||
|
do
|
||||||
|
i := 42
|
||||||
|
create jn.make_integer (i)
|
||||||
|
s := jn.representation -- s.is_equal ("42")
|
||||||
|
end
|
||||||
|
|
||||||
|
== Mapping of JSON values to Eiffel values ==
|
||||||
|
|
||||||
|
=== JSON number ===
|
||||||
|
|
||||||
|
JSON numbers are represented by the class JSON_NUMBER. JSON number values can be converted to/from NATURAL_*, INTEGER_* and REAL_64 values. For floating point values REAL_* is used. The complete mapping is as follows:
|
||||||
|
|
||||||
|
JSON number -> Eiffel:
|
||||||
|
* -128 <= n <= +127 -> INTEGER_8
|
||||||
|
* n can't be represented by INTEGER_8 and -32768 <= n <= +32767 -> INTEGER_16
|
||||||
|
* n can't be represented by INTEGER_16 and -2147483648 <= n <= +2147483647 -> INTEGER_32
|
||||||
|
* n can't be represented by INTEGER_32 and -9223372036854775808 <= n <= +9223372036854775807 -> INTEGER_64
|
||||||
|
* n can't be represented by INTEGER_64 and 9223372036854775808 <= n <= 18446744073709551615 -> NATURAL_64
|
||||||
|
* n has fractional dot '.' -> REAL_64.
|
||||||
|
* n -> eJSON exception if number can't be represented by a INTEGER_64, NATURAL_64 or REAL_64.
|
||||||
|
|
||||||
|
Eiffel -> JSON number:
|
||||||
|
* NATURAL_8, NATURAL_16, NATURAL_32, NATURAL_64, NATURAL -> JSON number
|
||||||
|
* INTEGER_8, INTEGER_16, INTEGER_32, INTEGER_64, INTEGER -> JSON number
|
||||||
|
* REAL_32, REAL_64, REAL -> JSON number
|
||||||
|
|
||||||
|
You can use the following creation routines to create JSON_NUMBER instances:
|
||||||
|
|
||||||
|
* JSON_NUMBER.make_integer
|
||||||
|
* JSON_NUMBER.make_real
|
||||||
|
* JSON_NUMBER.make_natural
|
||||||
|
|
||||||
|
eiffel_to_json_number_representation is
|
||||||
|
local
|
||||||
|
i: INTEGER
|
||||||
|
r: REAL
|
||||||
|
jn: JSON_NUMBER
|
||||||
|
do
|
||||||
|
print ("JSON representation of Eiffel INTEGER: '")
|
||||||
|
i := 123
|
||||||
|
create jn.make_integer (i)
|
||||||
|
print (jn.representation)
|
||||||
|
print ("'%N")
|
||||||
|
print ("JSON representation of Eiffel REAL: '")
|
||||||
|
r := 12.3
|
||||||
|
create jn.make_real (r)
|
||||||
|
print (jn.representation)
|
||||||
|
print ("'%N")
|
||||||
|
end
|
||||||
|
|
||||||
|
The output of the above code will be:
|
||||||
|
|
||||||
|
JSON representation of Eiffel INTEGER: '123'
|
||||||
|
JSON representation of Eiffel REAL: '12.300000190734863'
|
||||||
|
|
||||||
|
=== JSON boolean ===
|
||||||
|
|
||||||
|
JSON boolean values are represented by the class JSON_BOOLEAN. The JSON boolean value "true" is converted to/from the BOOLEAN value "True" and the JSON boolean value "false is converted to/from the BOOLEAN value "False".
|
||||||
|
|
||||||
|
eiffel_to_json_boolean_representation is
|
||||||
|
local
|
||||||
|
b: BOOLEAN
|
||||||
|
jb: JSON_BOOLEAN
|
||||||
|
do
|
||||||
|
print ("JSON representation of Eiffel BOOLEAN: '")
|
||||||
|
b := True
|
||||||
|
create jb.make (b)
|
||||||
|
print (jb.representation)
|
||||||
|
print ("'%N")
|
||||||
|
print("JSON representation of Eiffel BOOLEAN: '")
|
||||||
|
b := False
|
||||||
|
create jb.make (b)
|
||||||
|
print (jb.representation)
|
||||||
|
print ("'%N")
|
||||||
|
end
|
||||||
|
|
||||||
|
The output of the above code will be:
|
||||||
|
|
||||||
|
JSON representation of Eiffel BOOLEAN: 'true'
|
||||||
|
JSON representation of Eiffel BOOLEAN: 'false'
|
||||||
|
|
||||||
|
=== JSON string ===
|
||||||
|
|
||||||
|
JSON strings are represented by the class JSON_STRING. JSON string values can be converted to/from STRING_32, STRING and CHARACTER values. The complete mapping is as follows:
|
||||||
|
|
||||||
|
JSON string -> Eiffel:
|
||||||
|
* All JSON strings -> STRING or STRING_32
|
||||||
|
|
||||||
|
Eiffel -> JSON string:
|
||||||
|
* STRING_32 -> JSON string
|
||||||
|
* STRING -> JSON string
|
||||||
|
* CHARACTER -> JSON string
|
||||||
|
|
||||||
|
eiffel_to_json_string_representation is
|
||||||
|
local
|
||||||
|
s: STRING
|
||||||
|
js: JSON_STRING
|
||||||
|
do
|
||||||
|
print ("JSON representation of Eiffel STRING: '")
|
||||||
|
s := "JSON rocks!"
|
||||||
|
create js.make_from_string (s)
|
||||||
|
print (js.representation)
|
||||||
|
print ("'%N")
|
||||||
|
end
|
||||||
|
|
||||||
|
The output of the above code will be:
|
||||||
|
|
||||||
|
JSON representation of Eiffel STRING: '"JSON rocks!"'
|
||||||
|
|
||||||
|
Note: JSON escape unicode characters, as well a other specific characters, to get the unescaped string value, use either 'unescaped_string_8' or 'unescaped_string_32'.
|
||||||
|
|
||||||
|
=== JSON null ===
|
||||||
|
|
||||||
|
The JSON null value is represented by the class JSON_NULL. The JSON null value can be converted to/from Void.
|
||||||
|
|
||||||
|
eiffel_to_json_null_representation is
|
||||||
|
local
|
||||||
|
a: ANY
|
||||||
|
jn: JSON_NULL
|
||||||
|
do
|
||||||
|
create jn
|
||||||
|
print ("JSON representation for JSON null value: '")
|
||||||
|
print (jn.representation)
|
||||||
|
print ("'%N")
|
||||||
|
a := Void
|
||||||
|
if attached {JSON_NULL} json.value (a) as l_jn then -- json from SHARED_EJSON!
|
||||||
|
print ("JSON representation of Eiffel Void reference: '")
|
||||||
|
print (l_jn.representation)
|
||||||
|
print ("'%N")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
The output of the above code will be:
|
||||||
|
|
||||||
|
JSON representation for JSON null value: 'null'
|
||||||
|
JSON representation of Eiffel Void reference: 'null'
|
||||||
|
|
||||||
|
=== JSON array ===
|
||||||
|
|
||||||
|
JSON array is represented by the class JSON_ARRAY.
|
||||||
|
|
||||||
|
=== JSON object ===
|
||||||
|
|
||||||
|
JSON object is represented by the class JSON_OBJECT.
|
||||||
|
|
||||||
|
|
||||||
|
== The eJSON visitor pattern ==
|
||||||
|
|
||||||
|
TBD. See examples.
|
||||||
|
|
||||||
|
== The eJSON file reader class ==
|
||||||
|
|
||||||
|
TBD.
|
||||||
|
|
||||||
83
contrib/library/text/parser/json/examples/basic/basic.e
Normal file
83
contrib/library/text/parser/json/examples/basic/basic.e
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
class
|
||||||
|
BASIC
|
||||||
|
|
||||||
|
create
|
||||||
|
make
|
||||||
|
|
||||||
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
|
make
|
||||||
|
-- Initialize `Current'.
|
||||||
|
local
|
||||||
|
parser: JSON_PARSER
|
||||||
|
printer: JSON_PRETTY_STRING_VISITOR
|
||||||
|
s: STRING_32
|
||||||
|
do
|
||||||
|
-- Create parser for content `json_content'
|
||||||
|
create parser.make_with_string (json_content)
|
||||||
|
-- Parse the content
|
||||||
|
parser.parse_content
|
||||||
|
if
|
||||||
|
parser.is_valid and then
|
||||||
|
attached parser.parsed_json_value as jv
|
||||||
|
then
|
||||||
|
-- Json content is valid, and well parser.
|
||||||
|
-- and the parsed json value is `jv'
|
||||||
|
|
||||||
|
-- Let's access the glossary/title value
|
||||||
|
if
|
||||||
|
attached {JSON_OBJECT} jv as j_object and then
|
||||||
|
attached {JSON_OBJECT} j_object.item ("glossary") as j_glossary and then
|
||||||
|
attached {JSON_STRING} j_glossary.item ("title") as j_title
|
||||||
|
then
|
||||||
|
print ("The glossary title is %"" + j_title.unescaped_string_8 + "%".%N")
|
||||||
|
else
|
||||||
|
print ("The glossary title was not found!%N")
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Pretty print the parsed JSON
|
||||||
|
create s.make_empty
|
||||||
|
create printer.make (s)
|
||||||
|
jv.accept (printer)
|
||||||
|
print ("The JSON formatted using a pretty printer:%N")
|
||||||
|
print (s)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Status
|
||||||
|
|
||||||
|
feature -- Access
|
||||||
|
|
||||||
|
json_content: STRING = "[
|
||||||
|
{
|
||||||
|
"glossary": {
|
||||||
|
"title": "example glossary",
|
||||||
|
"GlossDiv": {
|
||||||
|
"title": "S",
|
||||||
|
"GlossList": {
|
||||||
|
"GlossEntry": {
|
||||||
|
"ID": "SGML",
|
||||||
|
"SortAs": "SGML",
|
||||||
|
"GlossTerm": "Standard Generalized Markup Language",
|
||||||
|
"Acronym": "SGML",
|
||||||
|
"Abbrev": "ISO 8879:1986",
|
||||||
|
"GlossDef": {
|
||||||
|
"para": "A meta-markup language, used to create markup languages such as DocBook.",
|
||||||
|
"GlossSeeAlso": ["GML", "XML"]
|
||||||
|
},
|
||||||
|
"GlossSee": "markup"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]"
|
||||||
|
|
||||||
|
feature -- Change
|
||||||
|
|
||||||
|
feature {NONE} -- Implementation
|
||||||
|
|
||||||
|
invariant
|
||||||
|
-- invariant_clause: True
|
||||||
|
|
||||||
|
end
|
||||||
10
contrib/library/text/parser/json/examples/basic/basic.ecf
Normal file
10
contrib/library/text/parser/json/examples/basic/basic.ecf
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||||
|
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-13-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-13-0 http://www.eiffel.com/developers/xml/configuration-1-13-0.xsd" name="basic" uuid="5156B9EE-0436-42A3-BDA1-74710DF05A35">
|
||||||
|
<target name="basic">
|
||||||
|
<root class="BASIC" feature="make"/>
|
||||||
|
<setting name="console_application" value="true"/>
|
||||||
|
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||||
|
<library name="json" location="..\..\library\json-safe.ecf" readonly="false"/>
|
||||||
|
<cluster name="basic" location=".\"/>
|
||||||
|
</target>
|
||||||
|
</system>
|
||||||
@@ -5,20 +5,25 @@ note
|
|||||||
revision: "$Revision$"
|
revision: "$Revision$"
|
||||||
file: "$HeadURL: $"
|
file: "$HeadURL: $"
|
||||||
|
|
||||||
class JSON_ARRAYED_LIST_CONVERTER
|
class
|
||||||
|
JSON_ARRAYED_LIST_CONVERTER
|
||||||
|
|
||||||
|
obsolete
|
||||||
|
"This JSON converter design has issues [Sept/2014]."
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
JSON_LIST_CONVERTER
|
|
||||||
|
JSON_LIST_CONVERTER
|
||||||
redefine
|
redefine
|
||||||
object
|
object
|
||||||
end
|
end
|
||||||
|
|
||||||
create
|
create
|
||||||
make
|
make
|
||||||
|
|
||||||
feature -- Access
|
feature -- Access
|
||||||
|
|
||||||
object: ARRAYED_LIST [detachable ANY]
|
object: ARRAYED_LIST [detachable ANY]
|
||||||
|
|
||||||
feature {NONE} -- Factory
|
feature {NONE} -- Factory
|
||||||
|
|
||||||
@@ -27,4 +32,7 @@ feature {NONE} -- Factory
|
|||||||
create Result.make (nb)
|
create Result.make (nb)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
note
|
||||||
|
copyright: "2010-2014, Javier Velilla and others https://github.com/eiffelhub/json."
|
||||||
|
license: "https://github.com/eiffelhub/json/blob/master/License.txt"
|
||||||
end -- class JSON_ARRAYED_LIST_CONVERTER
|
end -- class JSON_ARRAYED_LIST_CONVERTER
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
note
|
||||||
|
description: "A JSON converter"
|
||||||
|
author: "Paul Cohen"
|
||||||
|
date: "$Date$"
|
||||||
|
revision: "$Revision$"
|
||||||
|
file: "$HeadURL: $"
|
||||||
|
|
||||||
|
deferred class
|
||||||
|
JSON_CONVERTER
|
||||||
|
|
||||||
|
obsolete
|
||||||
|
"This JSON converter design has issues [Sept/2014]."
|
||||||
|
|
||||||
|
inherit
|
||||||
|
|
||||||
|
SHARED_EJSON
|
||||||
|
|
||||||
|
feature -- Access
|
||||||
|
|
||||||
|
object: ANY
|
||||||
|
-- Eiffel object
|
||||||
|
deferred
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Conversion
|
||||||
|
|
||||||
|
from_json (j: attached like to_json): detachable like object
|
||||||
|
-- Convert from JSON value.
|
||||||
|
-- Returns Void if unable to convert
|
||||||
|
deferred
|
||||||
|
end
|
||||||
|
|
||||||
|
to_json (o: like object): detachable JSON_VALUE
|
||||||
|
-- Convert to JSON value
|
||||||
|
deferred
|
||||||
|
end
|
||||||
|
|
||||||
|
invariant
|
||||||
|
has_eiffel_object: object /= Void -- An empty object must be created at creation time!
|
||||||
|
|
||||||
|
note
|
||||||
|
copyright: "2010-2014, Javier Velilla and others https://github.com/eiffelhub/json."
|
||||||
|
license: "https://github.com/eiffelhub/json/blob/master/License.txt"
|
||||||
|
end
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
note
|
||||||
|
description: "A JSON converter for HASH_TABLE [ANY, HASHABLE]"
|
||||||
|
author: "Paul Cohen"
|
||||||
|
date: "$Date: 2014-01-30 15:27:41 +0100 (jeu., 30 janv. 2014) $"
|
||||||
|
revision: "$Revision: 94128 $"
|
||||||
|
file: "$HeadURL: $"
|
||||||
|
|
||||||
|
class
|
||||||
|
JSON_HASH_TABLE_CONVERTER
|
||||||
|
|
||||||
|
obsolete
|
||||||
|
"This JSON converter design has issues [Sept/2014]."
|
||||||
|
|
||||||
|
inherit
|
||||||
|
|
||||||
|
JSON_CONVERTER
|
||||||
|
|
||||||
|
create
|
||||||
|
make
|
||||||
|
|
||||||
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
|
make
|
||||||
|
do
|
||||||
|
create object.make (0)
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Access
|
||||||
|
|
||||||
|
object: HASH_TABLE [ANY, HASHABLE]
|
||||||
|
|
||||||
|
feature -- Conversion
|
||||||
|
|
||||||
|
from_json (j: attached like to_json): like object
|
||||||
|
do
|
||||||
|
create Result.make (j.count)
|
||||||
|
across
|
||||||
|
j as ic
|
||||||
|
loop
|
||||||
|
if attached json.object (ic.item, Void) as l_object then
|
||||||
|
if attached {HASHABLE} json.object (ic.key, Void) as h then
|
||||||
|
Result.put (l_object, h)
|
||||||
|
else
|
||||||
|
check
|
||||||
|
key_is_hashable: False
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
check
|
||||||
|
object_attached: False
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
to_json (o: like object): detachable JSON_OBJECT
|
||||||
|
local
|
||||||
|
js: JSON_STRING
|
||||||
|
failed: BOOLEAN
|
||||||
|
do
|
||||||
|
create Result.make
|
||||||
|
across
|
||||||
|
o as c
|
||||||
|
loop
|
||||||
|
if attached {JSON_STRING} json.value (c.key) as l_key then
|
||||||
|
js := l_key
|
||||||
|
else
|
||||||
|
if attached {READABLE_STRING_GENERAL} c.key as s_key then
|
||||||
|
create js.make_from_string_general (s_key)
|
||||||
|
else
|
||||||
|
create js.make_from_string (c.key.out)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if attached json.value (c.item) as jv then
|
||||||
|
Result.put (jv, js)
|
||||||
|
else
|
||||||
|
failed := True
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if failed then
|
||||||
|
Result := Void
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
note
|
||||||
|
copyright: "2010-2014, Javier Velilla and others https://github.com/eiffelhub/json."
|
||||||
|
license: "https://github.com/eiffelhub/json/blob/master/License.txt"
|
||||||
|
end -- class JSON_HASH_TABLE_CONVERTER
|
||||||
@@ -5,20 +5,25 @@ note
|
|||||||
revision: "$Revision$"
|
revision: "$Revision$"
|
||||||
file: "$HeadURL: $"
|
file: "$HeadURL: $"
|
||||||
|
|
||||||
class JSON_LINKED_LIST_CONVERTER
|
class
|
||||||
|
JSON_LINKED_LIST_CONVERTER
|
||||||
|
|
||||||
|
obsolete
|
||||||
|
"This JSON converter design has issues [Sept/2014]."
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
JSON_LIST_CONVERTER
|
|
||||||
|
JSON_LIST_CONVERTER
|
||||||
redefine
|
redefine
|
||||||
object
|
object
|
||||||
end
|
end
|
||||||
|
|
||||||
create
|
create
|
||||||
make
|
make
|
||||||
|
|
||||||
feature -- Access
|
feature -- Access
|
||||||
|
|
||||||
object: LINKED_LIST [detachable ANY]
|
object: LINKED_LIST [detachable ANY]
|
||||||
|
|
||||||
feature {NONE} -- Factory
|
feature {NONE} -- Factory
|
||||||
|
|
||||||
@@ -27,4 +32,7 @@ feature {NONE} -- Factory
|
|||||||
create Result.make
|
create Result.make
|
||||||
end
|
end
|
||||||
|
|
||||||
|
note
|
||||||
|
copyright: "2010-2014, Javier Velilla and others https://github.com/eiffelhub/json."
|
||||||
|
license: "https://github.com/eiffelhub/json/blob/master/License.txt"
|
||||||
end -- class JSON_LINKED_LIST_CONVERTER
|
end -- class JSON_LINKED_LIST_CONVERTER
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
note
|
||||||
|
description: "A JSON converter for LIST [ANY]"
|
||||||
|
author: "Paul Cohen"
|
||||||
|
date: "$Date$"
|
||||||
|
revision: "$Revision$"
|
||||||
|
file: "$HeadURL: $"
|
||||||
|
|
||||||
|
deferred class
|
||||||
|
JSON_LIST_CONVERTER
|
||||||
|
|
||||||
|
obsolete
|
||||||
|
"This JSON converter design has issues [Sept/2014]."
|
||||||
|
|
||||||
|
inherit
|
||||||
|
|
||||||
|
JSON_CONVERTER
|
||||||
|
|
||||||
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
|
make
|
||||||
|
do
|
||||||
|
object := new_object (0)
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Access
|
||||||
|
|
||||||
|
object: LIST [detachable ANY]
|
||||||
|
|
||||||
|
feature {NONE} -- Factory
|
||||||
|
|
||||||
|
new_object (nb: INTEGER): like object
|
||||||
|
deferred
|
||||||
|
ensure
|
||||||
|
Result /= Void
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Conversion
|
||||||
|
|
||||||
|
from_json (j: attached like to_json): detachable like object
|
||||||
|
local
|
||||||
|
i: INTEGER
|
||||||
|
do
|
||||||
|
Result := new_object (j.count)
|
||||||
|
from
|
||||||
|
i := 1
|
||||||
|
until
|
||||||
|
i > j.count
|
||||||
|
loop
|
||||||
|
Result.extend (json.object (j [i], Void))
|
||||||
|
i := i + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
to_json (o: like object): detachable JSON_ARRAY
|
||||||
|
local
|
||||||
|
c: ITERATION_CURSOR [detachable ANY]
|
||||||
|
failed: BOOLEAN
|
||||||
|
do
|
||||||
|
create Result.make (o.count)
|
||||||
|
from
|
||||||
|
c := o.new_cursor
|
||||||
|
until
|
||||||
|
c.after
|
||||||
|
loop
|
||||||
|
if attached json.value (c.item) as jv then
|
||||||
|
Result.add (jv)
|
||||||
|
else
|
||||||
|
failed := True
|
||||||
|
end
|
||||||
|
c.forth
|
||||||
|
end
|
||||||
|
if failed then
|
||||||
|
Result := Void
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
note
|
||||||
|
copyright: "2010-2014, Javier Velilla and others https://github.com/eiffelhub/json."
|
||||||
|
license: "https://github.com/eiffelhub/json/blob/master/License.txt"
|
||||||
|
end -- class JSON_ARRAYED_LIST_CONVERTER
|
||||||
@@ -1,268 +1,274 @@
|
|||||||
note
|
note
|
||||||
description: "Core factory class for creating JSON objects and corresponding Eiffel objects."
|
description: "Core factory class for creating JSON objects and corresponding Eiffel objects."
|
||||||
author: "Paul Cohen"
|
author: "Paul Cohen"
|
||||||
date: "$Date$"
|
date: "$Date$"
|
||||||
revision: "$Revision$"
|
revision: "$Revision$"
|
||||||
file: "$HeadURL: $"
|
file: "$HeadURL: $"
|
||||||
|
|
||||||
class EJSON
|
class
|
||||||
|
EJSON
|
||||||
inherit
|
|
||||||
EXCEPTIONS
|
obsolete
|
||||||
|
"This JSON converter design has issues [Sept/2014]."
|
||||||
feature -- Access
|
|
||||||
|
inherit
|
||||||
value (an_object: detachable ANY): detachable JSON_VALUE
|
|
||||||
-- JSON value from Eiffel object. Raises an "eJSON exception" if
|
EXCEPTIONS
|
||||||
-- unable to convert value.
|
|
||||||
local
|
feature -- Access
|
||||||
i: INTEGER
|
|
||||||
ja: JSON_ARRAY
|
value (an_object: detachable ANY): detachable JSON_VALUE
|
||||||
do
|
-- JSON value from Eiffel object. Raises an "eJSON exception" if
|
||||||
-- Try to convert from basic Eiffel types. Note that we check with
|
-- unable to convert value.
|
||||||
-- `conforms_to' since the client may have subclassed the base class
|
local
|
||||||
-- that these basic types are derived from.
|
i: INTEGER
|
||||||
if an_object = Void then
|
ja: JSON_ARRAY
|
||||||
create {JSON_NULL} Result
|
do
|
||||||
elseif attached {BOOLEAN} an_object as b then
|
-- Try to convert from basic Eiffel types. Note that we check with
|
||||||
create {JSON_BOOLEAN} Result.make_boolean (b)
|
-- `conforms_to' since the client may have subclassed the base class
|
||||||
elseif attached {INTEGER_8} an_object as i8 then
|
-- that these basic types are derived from.
|
||||||
create {JSON_NUMBER} Result.make_integer (i8)
|
if an_object = Void then
|
||||||
elseif attached {INTEGER_16} an_object as i16 then
|
create {JSON_NULL} Result
|
||||||
create {JSON_NUMBER} Result.make_integer (i16)
|
elseif attached {BOOLEAN} an_object as b then
|
||||||
elseif attached {INTEGER_32} an_object as i32 then
|
create {JSON_BOOLEAN} Result.make (b)
|
||||||
create {JSON_NUMBER} Result.make_integer (i32)
|
elseif attached {INTEGER_8} an_object as i8 then
|
||||||
elseif attached {INTEGER_64} an_object as i64 then
|
create {JSON_NUMBER} Result.make_integer (i8)
|
||||||
create {JSON_NUMBER} Result.make_integer (i64)
|
elseif attached {INTEGER_16} an_object as i16 then
|
||||||
elseif attached {NATURAL_8} an_object as n8 then
|
create {JSON_NUMBER} Result.make_integer (i16)
|
||||||
create {JSON_NUMBER} Result.make_natural (n8)
|
elseif attached {INTEGER_32} an_object as i32 then
|
||||||
elseif attached {NATURAL_16} an_object as n16 then
|
create {JSON_NUMBER} Result.make_integer (i32)
|
||||||
create {JSON_NUMBER} Result.make_natural (n16)
|
elseif attached {INTEGER_64} an_object as i64 then
|
||||||
elseif attached {NATURAL_32} an_object as n32 then
|
create {JSON_NUMBER} Result.make_integer (i64)
|
||||||
create {JSON_NUMBER} Result.make_natural (n32)
|
elseif attached {NATURAL_8} an_object as n8 then
|
||||||
elseif attached {NATURAL_64} an_object as n64 then
|
create {JSON_NUMBER} Result.make_natural (n8)
|
||||||
create {JSON_NUMBER} Result.make_natural (n64)
|
elseif attached {NATURAL_16} an_object as n16 then
|
||||||
elseif attached {REAL_32} an_object as r32 then
|
create {JSON_NUMBER} Result.make_natural (n16)
|
||||||
create {JSON_NUMBER} Result.make_real (r32)
|
elseif attached {NATURAL_32} an_object as n32 then
|
||||||
elseif attached {REAL_64} an_object as r64 then
|
create {JSON_NUMBER} Result.make_natural (n32)
|
||||||
create {JSON_NUMBER} Result.make_real (r64)
|
elseif attached {NATURAL_64} an_object as n64 then
|
||||||
elseif attached {ARRAY [detachable ANY]} an_object as a then
|
create {JSON_NUMBER} Result.make_natural (n64)
|
||||||
create ja.make_array
|
elseif attached {REAL_32} an_object as r32 then
|
||||||
from
|
create {JSON_NUMBER} Result.make_real (r32)
|
||||||
i := a.lower
|
elseif attached {REAL_64} an_object as r64 then
|
||||||
until
|
create {JSON_NUMBER} Result.make_real (r64)
|
||||||
i > a.upper
|
elseif attached {ARRAY [detachable ANY]} an_object as a then
|
||||||
loop
|
create ja.make (a.count)
|
||||||
if attached value (a @ i) as v then
|
from
|
||||||
ja.add (v)
|
i := a.lower
|
||||||
else
|
until
|
||||||
check value_attached: False end
|
i > a.upper
|
||||||
end
|
loop
|
||||||
i := i + 1
|
if attached value (a @ i) as v then
|
||||||
end
|
ja.add (v)
|
||||||
Result := ja
|
else
|
||||||
elseif attached {CHARACTER_8} an_object as c8 then
|
check
|
||||||
create {JSON_STRING} Result.make_json (c8.out)
|
value_attached: False
|
||||||
elseif attached {CHARACTER_32} an_object as c32 then
|
end
|
||||||
create {JSON_STRING} Result.make_json (c32.out)
|
end
|
||||||
|
i := i + 1
|
||||||
elseif attached {STRING_8} an_object as s8 then
|
end
|
||||||
create {JSON_STRING} Result.make_json (s8)
|
Result := ja
|
||||||
elseif attached {STRING_32} an_object as s32 then
|
elseif attached {CHARACTER_8} an_object as c8 then
|
||||||
create {JSON_STRING} Result.make_json_from_string_32 (s32)
|
create {JSON_STRING} Result.make_from_string (c8.out)
|
||||||
end
|
elseif attached {CHARACTER_32} an_object as c32 then
|
||||||
|
create {JSON_STRING} Result.make_from_string_32 (create {STRING_32}.make_filled (c32, 1))
|
||||||
if Result = Void then
|
elseif attached {STRING_8} an_object as s8 then
|
||||||
-- Now check the converters
|
create {JSON_STRING} Result.make_from_string (s8)
|
||||||
if an_object /= Void and then attached converter_for (an_object) as jc then
|
elseif attached {STRING_32} an_object as s32 then
|
||||||
Result := jc.to_json (an_object)
|
create {JSON_STRING} Result.make_from_string_32 (s32)
|
||||||
else
|
end
|
||||||
raise (exception_failed_to_convert_to_json (an_object))
|
if Result = Void then
|
||||||
end
|
-- Now check the converters
|
||||||
end
|
if an_object /= Void and then attached converter_for (an_object) as jc then
|
||||||
end
|
Result := jc.to_json (an_object)
|
||||||
|
else
|
||||||
object (a_value: detachable JSON_VALUE; base_class: detachable STRING): detachable ANY
|
raise (exception_failed_to_convert_to_json (an_object))
|
||||||
-- Eiffel object from JSON value. If `base_class' /= Void an eiffel
|
end
|
||||||
-- object based on `base_class' will be returned. Raises an "eJSON
|
end
|
||||||
-- exception" if unable to convert value.
|
end
|
||||||
local
|
|
||||||
i: INTEGER
|
object (a_value: detachable JSON_VALUE; base_class: detachable STRING): detachable ANY
|
||||||
ll: LINKED_LIST [detachable ANY]
|
-- Eiffel object from JSON value. If `base_class' /= Void an eiffel
|
||||||
t: HASH_TABLE [detachable ANY, STRING_GENERAL]
|
-- object based on `base_class' will be returned. Raises an "eJSON
|
||||||
keys: ARRAY [JSON_STRING]
|
-- exception" if unable to convert value.
|
||||||
do
|
local
|
||||||
if a_value = Void then
|
i: INTEGER
|
||||||
Result := Void
|
ll: LINKED_LIST [detachable ANY]
|
||||||
else
|
t: HASH_TABLE [detachable ANY, STRING_GENERAL]
|
||||||
if base_class = Void then
|
keys: ARRAY [JSON_STRING]
|
||||||
if a_value = Void then
|
do
|
||||||
Result := Void
|
if a_value = Void then
|
||||||
elseif attached {JSON_NULL} a_value then
|
Result := Void
|
||||||
Result := Void
|
else
|
||||||
elseif attached {JSON_BOOLEAN} a_value as jb then
|
if base_class = Void then
|
||||||
Result := jb.item
|
if a_value = Void then
|
||||||
elseif attached {JSON_NUMBER} a_value as jn then
|
Result := Void
|
||||||
if jn.item.is_integer_8 then
|
elseif attached {JSON_NULL} a_value then
|
||||||
Result := jn.item.to_integer_8
|
Result := Void
|
||||||
elseif jn.item.is_integer_16 then
|
elseif attached {JSON_BOOLEAN} a_value as jb then
|
||||||
Result := jn.item.to_integer_16
|
Result := jb.item
|
||||||
elseif jn.item.is_integer_32 then
|
elseif attached {JSON_NUMBER} a_value as jn then
|
||||||
Result := jn.item.to_integer_32
|
if jn.item.is_integer_8 then
|
||||||
elseif jn.item.is_integer_64 then
|
Result := jn.item.to_integer_8
|
||||||
Result := jn.item.to_integer_64
|
elseif jn.item.is_integer_16 then
|
||||||
elseif jn.item.is_natural_64 then
|
Result := jn.item.to_integer_16
|
||||||
Result := jn.item.to_natural_64
|
elseif jn.item.is_integer_32 then
|
||||||
elseif jn.item.is_double then
|
Result := jn.item.to_integer_32
|
||||||
Result := jn.item.to_double
|
elseif jn.item.is_integer_64 then
|
||||||
end
|
Result := jn.item.to_integer_64
|
||||||
elseif attached {JSON_STRING} a_value as js then
|
elseif jn.item.is_natural_64 then
|
||||||
create {STRING_32} Result.make_from_string (js.unescaped_string_32)
|
Result := jn.item.to_natural_64
|
||||||
elseif attached {JSON_ARRAY} a_value as ja then
|
elseif jn.item.is_double then
|
||||||
from
|
Result := jn.item.to_double
|
||||||
create ll.make
|
end
|
||||||
i := 1
|
elseif attached {JSON_STRING} a_value as js then
|
||||||
until
|
create {STRING_32} Result.make_from_string (js.unescaped_string_32)
|
||||||
i > ja.count
|
elseif attached {JSON_ARRAY} a_value as ja then
|
||||||
loop
|
from
|
||||||
ll.extend (object (ja [i], Void))
|
create ll.make
|
||||||
i := i + 1
|
i := 1
|
||||||
end
|
until
|
||||||
Result := ll
|
i > ja.count
|
||||||
elseif attached {JSON_OBJECT} a_value as jo then
|
loop
|
||||||
keys := jo.current_keys
|
ll.extend (object (ja [i], Void))
|
||||||
create t.make (keys.count)
|
i := i + 1
|
||||||
from
|
end
|
||||||
i := keys.lower
|
Result := ll
|
||||||
until
|
elseif attached {JSON_OBJECT} a_value as jo then
|
||||||
i > keys.upper
|
keys := jo.current_keys
|
||||||
loop
|
create t.make (keys.count)
|
||||||
if attached {STRING_GENERAL} object (keys [i], Void) as s then
|
from
|
||||||
t.put (object (jo.item (keys [i]), Void), s)
|
i := keys.lower
|
||||||
end
|
until
|
||||||
i := i + 1
|
i > keys.upper
|
||||||
end
|
loop
|
||||||
Result := t
|
if attached {STRING_GENERAL} object (keys [i], Void) as s then
|
||||||
end
|
t.put (object (jo.item (keys [i]), Void), s)
|
||||||
else
|
end
|
||||||
if converters.has_key (base_class) and then attached converters.found_item as jc then
|
i := i + 1
|
||||||
Result := jc.from_json (a_value)
|
end
|
||||||
else
|
Result := t
|
||||||
raise (exception_failed_to_convert_to_eiffel (a_value, base_class))
|
end
|
||||||
end
|
else
|
||||||
end
|
if converters.has_key (base_class) and then attached converters.found_item as jc then
|
||||||
end
|
Result := jc.from_json (a_value)
|
||||||
end
|
else
|
||||||
|
raise (exception_failed_to_convert_to_eiffel (a_value, base_class))
|
||||||
object_from_json (json: STRING; base_class: detachable STRING): detachable ANY
|
end
|
||||||
-- Eiffel object from JSON representation. If `base_class' /= Void an
|
end
|
||||||
-- Eiffel object based on `base_class' will be returned. Raises an
|
end
|
||||||
-- "eJSON exception" if unable to convert value.
|
end
|
||||||
require
|
|
||||||
json_not_void: json /= Void
|
object_from_json (json: STRING; base_class: detachable STRING): detachable ANY
|
||||||
local
|
-- Eiffel object from JSON representation. If `base_class' /= Void an
|
||||||
jv: detachable JSON_VALUE
|
-- Eiffel object based on `base_class' will be returned. Raises an
|
||||||
do
|
-- "eJSON exception" if unable to convert value.
|
||||||
json_parser.set_representation (json)
|
require
|
||||||
jv := json_parser.parse
|
json_not_void: json /= Void
|
||||||
if jv /= Void then
|
do
|
||||||
Result := object (jv, base_class)
|
json_parser.set_representation (json)
|
||||||
end
|
json_parser.parse_content
|
||||||
end
|
if json_parser.is_valid and then attached json_parser.parsed_json_value as jv then
|
||||||
|
Result := object (jv, base_class)
|
||||||
converter_for (an_object: ANY): detachable JSON_CONVERTER
|
end
|
||||||
-- Converter for objects. Returns Void if none found.
|
end
|
||||||
require
|
|
||||||
an_object_not_void: an_object /= Void
|
converter_for (an_object: ANY): detachable JSON_CONVERTER
|
||||||
do
|
-- Converter for objects. Returns Void if none found.
|
||||||
if converters.has_key (an_object.generator) then
|
require
|
||||||
Result := converters.found_item
|
an_object_not_void: an_object /= Void
|
||||||
end
|
do
|
||||||
end
|
if converters.has_key (an_object.generator) then
|
||||||
|
Result := converters.found_item
|
||||||
json_reference (s: STRING): JSON_OBJECT
|
end
|
||||||
-- A JSON (Dojo style) reference object using `s' as the
|
end
|
||||||
-- reference value. The caller is responsable for ensuring
|
|
||||||
-- the validity of `s' as a json reference.
|
json_reference (s: STRING): JSON_OBJECT
|
||||||
require
|
-- A JSON (Dojo style) reference object using `s' as the
|
||||||
s_not_void: s /= Void
|
-- reference value. The caller is responsable for ensuring
|
||||||
local
|
-- the validity of `s' as a json reference.
|
||||||
js_key, js_value: JSON_STRING
|
require
|
||||||
do
|
s_not_void: s /= Void
|
||||||
create Result.make
|
local
|
||||||
create js_key.make_json ("$ref")
|
js_key, js_value: JSON_STRING
|
||||||
create js_value.make_json (s)
|
do
|
||||||
Result.put (js_value, js_key)
|
create Result.make
|
||||||
end
|
create js_key.make_from_string ("$ref")
|
||||||
|
create js_value.make_from_string (s)
|
||||||
json_references (l: LIST [STRING]): JSON_ARRAY
|
Result.put (js_value, js_key)
|
||||||
-- A JSON array of JSON (Dojo style) reference objects using the
|
end
|
||||||
-- strings in `l' as reference values. The caller is responsable
|
|
||||||
-- for ensuring the validity of all strings in `l' as json
|
json_references (l: LIST [STRING]): JSON_ARRAY
|
||||||
-- references.
|
-- A JSON array of JSON (Dojo style) reference objects using the
|
||||||
require
|
-- strings in `l' as reference values. The caller is responsable
|
||||||
l_not_void: l /= Void
|
-- for ensuring the validity of all strings in `l' as json
|
||||||
local
|
-- references.
|
||||||
c: ITERATION_CURSOR [STRING]
|
require
|
||||||
do
|
l_not_void: l /= Void
|
||||||
create Result.make_array
|
local
|
||||||
from
|
c: ITERATION_CURSOR [STRING]
|
||||||
c := l.new_cursor
|
do
|
||||||
until
|
create Result.make (l.count)
|
||||||
c.after
|
from
|
||||||
loop
|
c := l.new_cursor
|
||||||
Result.add (json_reference (c.item))
|
until
|
||||||
c.forth
|
c.after
|
||||||
end
|
loop
|
||||||
end
|
Result.add (json_reference (c.item))
|
||||||
|
c.forth
|
||||||
feature -- Change
|
end
|
||||||
|
end
|
||||||
add_converter (jc: JSON_CONVERTER)
|
|
||||||
-- Add the converter `jc'.
|
feature -- Change
|
||||||
require
|
|
||||||
jc_not_void: jc /= Void
|
add_converter (jc: JSON_CONVERTER)
|
||||||
do
|
-- Add the converter `jc'.
|
||||||
converters.force (jc, jc.object.generator)
|
require
|
||||||
ensure
|
jc_not_void: jc /= Void
|
||||||
has_converter: converter_for (jc.object) /= Void
|
do
|
||||||
end
|
converters.force (jc, jc.object.generator)
|
||||||
|
ensure
|
||||||
feature {NONE} -- Implementation
|
has_converter: converter_for (jc.object) /= Void
|
||||||
|
end
|
||||||
converters: HASH_TABLE [JSON_CONVERTER, STRING]
|
|
||||||
-- Converters hashed by generator (base class)
|
feature {NONE} -- Implementation
|
||||||
once
|
|
||||||
create Result.make (10)
|
converters: HASH_TABLE [JSON_CONVERTER, STRING]
|
||||||
end
|
-- Converters hashed by generator (base class)
|
||||||
|
once
|
||||||
feature {NONE} -- Implementation (Exceptions)
|
create Result.make (10)
|
||||||
|
end
|
||||||
exception_prefix: STRING = "eJSON exception: "
|
|
||||||
|
feature {NONE} -- Implementation (Exceptions)
|
||||||
exception_failed_to_convert_to_eiffel (a_value: JSON_VALUE; base_class: detachable STRING): STRING
|
|
||||||
-- Exception message for failing to convert a JSON_VALUE to an instance of `a'.
|
exception_prefix: STRING = "eJSON exception: "
|
||||||
do
|
|
||||||
Result := exception_prefix + "Failed to convert JSON_VALUE to an Eiffel object: " + a_value.generator
|
exception_failed_to_convert_to_eiffel (a_value: JSON_VALUE; base_class: detachable STRING): STRING
|
||||||
if base_class /= Void then
|
-- Exception message for failing to convert a JSON_VALUE to an instance of `a'.
|
||||||
Result.append (" -> {" + base_class + "}")
|
do
|
||||||
end
|
Result := exception_prefix + "Failed to convert JSON_VALUE to an Eiffel object: " + a_value.generator
|
||||||
end
|
if base_class /= Void then
|
||||||
|
Result.append (" -> {" + base_class + "}")
|
||||||
exception_failed_to_convert_to_json (an_object: detachable ANY): STRING
|
end
|
||||||
-- Exception message for failing to convert `a' to a JSON_VALUE.
|
end
|
||||||
do
|
|
||||||
Result := exception_prefix + "Failed to convert Eiffel object to a JSON_VALUE"
|
exception_failed_to_convert_to_json (an_object: detachable ANY): STRING
|
||||||
if an_object /= Void then
|
-- Exception message for failing to convert `a' to a JSON_VALUE.
|
||||||
Result.append (" : {" + an_object.generator + "}")
|
do
|
||||||
end
|
Result := exception_prefix + "Failed to convert Eiffel object to a JSON_VALUE"
|
||||||
end
|
if an_object /= Void then
|
||||||
|
Result.append (" : {" + an_object.generator + "}")
|
||||||
feature {NONE} -- Implementation (JSON parser)
|
end
|
||||||
|
end
|
||||||
json_parser: JSON_PARSER
|
|
||||||
once
|
feature {NONE} -- Implementation (JSON parser)
|
||||||
create Result.make_parser ("")
|
|
||||||
end
|
json_parser: JSON_PARSER
|
||||||
|
once
|
||||||
end -- class EJSON
|
create Result.make_with_string ("{}")
|
||||||
|
end
|
||||||
|
|
||||||
|
note
|
||||||
|
copyright: "2010-2014, Javier Velilla and others https://github.com/eiffelhub/json."
|
||||||
|
license: "https://github.com/eiffelhub/json/blob/master/License.txt"
|
||||||
|
end -- class EJSON
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
note
|
||||||
|
description: "[
|
||||||
|
Shared factory class for creating JSON objects. Maps JSON
|
||||||
|
objects to ELKS HASH_TABLEs and JSON arrays to ELKS
|
||||||
|
LINKED_LISTs. Use non-conforming inheritance from this
|
||||||
|
class to ensure that your classes share the same
|
||||||
|
JSON_FACTORY instance.
|
||||||
|
]"
|
||||||
|
author: "Paul Cohen"
|
||||||
|
date: "$Date$"
|
||||||
|
revision: "$Revision: 89185 $"
|
||||||
|
file: "$HeadURL: $"
|
||||||
|
|
||||||
|
class
|
||||||
|
SHARED_EJSON
|
||||||
|
|
||||||
|
obsolete
|
||||||
|
"This JSON converter design has issues [Sept/2014]."
|
||||||
|
|
||||||
|
feature -- Access
|
||||||
|
|
||||||
|
json: EJSON
|
||||||
|
-- A shared EJSON instance with default converters for
|
||||||
|
--LINKED_LIST [ANY] and HASH_TABLE [ANY, HASHABLE]
|
||||||
|
local
|
||||||
|
jalc: JSON_ARRAYED_LIST_CONVERTER
|
||||||
|
jllc: JSON_LINKED_LIST_CONVERTER
|
||||||
|
jhtc: JSON_HASH_TABLE_CONVERTER
|
||||||
|
once
|
||||||
|
create Result
|
||||||
|
create jalc.make
|
||||||
|
Result.add_converter (jalc)
|
||||||
|
create jllc.make
|
||||||
|
Result.add_converter (jllc)
|
||||||
|
create jhtc.make
|
||||||
|
Result.add_converter (jhtc)
|
||||||
|
end
|
||||||
|
|
||||||
|
note
|
||||||
|
copyright: "2010-2014, Javier Velilla and others https://github.com/eiffelhub/json."
|
||||||
|
license: "https://github.com/eiffelhub/json/blob/master/License.txt"
|
||||||
|
|
||||||
|
end -- class SHARED_EJSON
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
note
|
|
||||||
description: "Objects that ..."
|
|
||||||
author: ""
|
|
||||||
date: "$Date$"
|
|
||||||
revision: "$Revision$"
|
|
||||||
|
|
||||||
class
|
|
||||||
JSON_FILE_READER
|
|
||||||
|
|
||||||
feature -- Access
|
|
||||||
|
|
||||||
read_json_from (a_path: STRING): detachable STRING
|
|
||||||
local
|
|
||||||
l_file: PLAIN_TEXT_FILE
|
|
||||||
template_content: STRING
|
|
||||||
l_last_string: detachable STRING
|
|
||||||
do
|
|
||||||
create l_file.make (a_path)
|
|
||||||
-- We perform several checks until we make a real attempt to open the file.
|
|
||||||
if not l_file.exists then
|
|
||||||
print ("error: '" + a_path + "' does not exist%N")
|
|
||||||
else
|
|
||||||
if not l_file.is_readable then
|
|
||||||
print ("error: '" + a_path + "' is not readable.%N")
|
|
||||||
else
|
|
||||||
l_file.open_read
|
|
||||||
create template_content.make_empty
|
|
||||||
l_file.read_stream (l_file.count)
|
|
||||||
l_last_string := l_file.last_string
|
|
||||||
check l_last_string /= Void end -- implied by postcondition of `l_file.read_stream'
|
|
||||||
template_content.append (l_last_string.string)
|
|
||||||
Result := template_content
|
|
||||||
l_file.close
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
@@ -1,85 +1,85 @@
|
|||||||
note
|
note
|
||||||
description: "A JSON converter for DS_HASH_TABLE [ANY, HASHABLE]"
|
description: "A JSON converter for DS_HASH_TABLE [ANY, HASHABLE]"
|
||||||
author: "Paul Cohen"
|
author: "Paul Cohen"
|
||||||
date: "$Date: $"
|
date: "$Date: $"
|
||||||
revision: "$Revision: $"
|
revision: "$Revision: $"
|
||||||
file: "$HeadURL: $"
|
file: "$HeadURL: $"
|
||||||
|
|
||||||
class JSON_DS_HASH_TABLE_CONVERTER
|
class JSON_DS_HASH_TABLE_CONVERTER
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
JSON_CONVERTER
|
JSON_CONVERTER
|
||||||
|
|
||||||
create
|
create
|
||||||
make
|
make
|
||||||
|
|
||||||
feature {NONE} -- Initialization
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
make
|
make
|
||||||
do
|
do
|
||||||
create object.make (0)
|
create object.make (0)
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Access
|
feature -- Access
|
||||||
|
|
||||||
value: JSON_OBJECT
|
value: JSON_OBJECT
|
||||||
|
|
||||||
object: DS_HASH_TABLE [ANY, HASHABLE]
|
object: DS_HASH_TABLE [ANY, HASHABLE]
|
||||||
|
|
||||||
feature -- Conversion
|
feature -- Conversion
|
||||||
|
|
||||||
from_json (j: like value): detachable like object
|
from_json (j: like value): detachable like object
|
||||||
local
|
local
|
||||||
keys: ARRAY [JSON_STRING]
|
keys: ARRAY [JSON_STRING]
|
||||||
i: INTEGER
|
i: INTEGER
|
||||||
h: HASHABLE
|
h: HASHABLE
|
||||||
a: ANY
|
a: ANY
|
||||||
do
|
do
|
||||||
keys := j.current_keys
|
keys := j.current_keys
|
||||||
create Result.make (keys.count)
|
create Result.make (keys.count)
|
||||||
from
|
from
|
||||||
i := 1
|
i := 1
|
||||||
until
|
until
|
||||||
i > keys.count
|
i > keys.count
|
||||||
loop
|
loop
|
||||||
h ?= json.object (keys [i], void)
|
h ?= json.object (keys [i], void)
|
||||||
check h /= Void end
|
check h /= Void end
|
||||||
a := json.object (j.item (keys [i]), Void)
|
a := json.object (j.item (keys [i]), Void)
|
||||||
Result.put (a, h)
|
Result.put (a, h)
|
||||||
i := i + 1
|
i := i + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
to_json (o: like object): like value
|
to_json (o: like object): like value
|
||||||
local
|
local
|
||||||
c: DS_HASH_TABLE_CURSOR [ANY, HASHABLE]
|
c: DS_HASH_TABLE_CURSOR [ANY, HASHABLE]
|
||||||
js: JSON_STRING
|
js: JSON_STRING
|
||||||
jv: JSON_VALUE
|
jv: JSON_VALUE
|
||||||
failed: BOOLEAN
|
failed: BOOLEAN
|
||||||
do
|
do
|
||||||
create Result.make
|
create Result.make
|
||||||
from
|
from
|
||||||
c := o.new_cursor
|
c := o.new_cursor
|
||||||
c.start
|
c.start
|
||||||
until
|
until
|
||||||
c.after
|
c.after
|
||||||
loop
|
loop
|
||||||
if attached {JSON_STRING} json.value (c.key) as l_key then
|
if attached {JSON_STRING} json.value (c.key) as l_key then
|
||||||
js := l_key
|
js := l_key
|
||||||
else
|
else
|
||||||
create js.make_json (c.key.out)
|
create js.make_json (c.key.out)
|
||||||
end
|
end
|
||||||
jv := json.value (c.item)
|
jv := json.value (c.item)
|
||||||
if jv /= Void then
|
if jv /= Void then
|
||||||
Result.put (jv, js)
|
Result.put (jv, js)
|
||||||
else
|
else
|
||||||
failed := True
|
failed := True
|
||||||
end
|
end
|
||||||
c.forth
|
c.forth
|
||||||
end
|
end
|
||||||
if failed then
|
if failed then
|
||||||
Result := Void
|
Result := Void
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end -- class JSON_DS_HASH_TABLE_CONVERTER
|
end -- class JSON_DS_HASH_TABLE_CONVERTER
|
||||||
@@ -1,62 +1,62 @@
|
|||||||
note
|
note
|
||||||
description: "A JSON converter for DS_LINKED_LIST [ANY]"
|
description: "A JSON converter for DS_LINKED_LIST [ANY]"
|
||||||
author: "Paul Cohen"
|
author: "Paul Cohen"
|
||||||
date: "$Date: $"
|
date: "$Date: $"
|
||||||
revision: "$Revision: $"
|
revision: "$Revision: $"
|
||||||
file: "$HeadURL: $"
|
file: "$HeadURL: $"
|
||||||
|
|
||||||
class JSON_DS_LINKED_LIST_CONVERTER
|
class JSON_DS_LINKED_LIST_CONVERTER
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
JSON_CONVERTER
|
JSON_CONVERTER
|
||||||
|
|
||||||
create
|
create
|
||||||
make
|
make
|
||||||
|
|
||||||
feature {NONE} -- Initialization
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
make
|
make
|
||||||
do
|
do
|
||||||
create object.make
|
create object.make
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Access
|
feature -- Access
|
||||||
|
|
||||||
value: JSON_ARRAY
|
value: JSON_ARRAY
|
||||||
|
|
||||||
object: DS_LINKED_LIST [ANY]
|
object: DS_LINKED_LIST [ANY]
|
||||||
|
|
||||||
feature -- Conversion
|
feature -- Conversion
|
||||||
|
|
||||||
from_json (j: like value): detachable like object
|
from_json (j: like value): detachable like object
|
||||||
local
|
local
|
||||||
i: INTEGER
|
i: INTEGER
|
||||||
do
|
do
|
||||||
create Result.make
|
create Result.make
|
||||||
from
|
from
|
||||||
i := 1
|
i := 1
|
||||||
until
|
until
|
||||||
i > j.count
|
i > j.count
|
||||||
loop
|
loop
|
||||||
Result.put_last (json.object (j [i], Void))
|
Result.put_last (json.object (j [i], Void))
|
||||||
i := i + 1
|
i := i + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
to_json (o: like object): like value
|
to_json (o: like object): like value
|
||||||
local
|
local
|
||||||
c: DS_LIST_CURSOR [ANY]
|
c: DS_LIST_CURSOR [ANY]
|
||||||
do
|
do
|
||||||
create Result.make_array
|
create Result.make_array
|
||||||
from
|
from
|
||||||
c := o.new_cursor
|
c := o.new_cursor
|
||||||
c.start
|
c.start
|
||||||
until
|
until
|
||||||
c.after
|
c.after
|
||||||
loop
|
loop
|
||||||
Result.add (json.value (c.item))
|
Result.add (json.value (c.item))
|
||||||
c.forth
|
c.forth
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end -- class JSON_DS_LINKED_LIST_CONVERTER
|
end -- class JSON_DS_LINKED_LIST_CONVERTER
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-8-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-8-0 http://www.eiffel.com/developers/xml/configuration-1-8-0.xsd" name="json" uuid="4E21C3BD-7951-4C6E-A673-431E762D7414" library_target="json">
|
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-12-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-12-0 http://www.eiffel.com/developers/xml/configuration-1-12-0.xsd" name="json" uuid="4E21C3BD-7951-4C6E-A673-431E762D7414" library_target="json">
|
||||||
<target name="json">
|
<target name="json">
|
||||||
<root all_classes="true"/>
|
<root all_classes="true"/>
|
||||||
<file_rule>
|
<file_rule>
|
||||||
@@ -9,20 +9,13 @@
|
|||||||
</file_rule>
|
</file_rule>
|
||||||
<option trace="false" profile="false" debug="false" warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all" syntax="standard" namespace="EJSON.Library">
|
<option trace="false" profile="false" debug="false" warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all" syntax="standard" namespace="EJSON.Library">
|
||||||
<assertions/>
|
<assertions/>
|
||||||
<warning name="export_class_missing" enabled="false"/>
|
|
||||||
<warning name="old_verbatim_strings" enabled="false"/>
|
|
||||||
<warning name="syntax" enabled="false"/>
|
|
||||||
<warning name="vjrv" enabled="false"/>
|
|
||||||
</option>
|
</option>
|
||||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf" readonly="true"/>
|
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf" readonly="true"/>
|
||||||
<cluster name="json" location=".\" recursive="true">
|
<cluster name="json" location=".\">
|
||||||
<file_rule>
|
<cluster name="json_kernel" location=".\kernel\" recursive="true"/>
|
||||||
<exclude>^/gobo$</exclude>
|
<cluster name="json_parser" location=".\parser\" recursive="true"/>
|
||||||
<exclude>^/kernel$</exclude>
|
<cluster name="json_utility" location=".\utility\" recursive="true"/>
|
||||||
<exclude>^/extras$</exclude>
|
|
||||||
</file_rule>
|
|
||||||
<cluster name="kernel" location=".\kernel\" recursive="true"/>
|
|
||||||
<cluster name="extras" location=".\extras\" recursive="true"/>
|
|
||||||
</cluster>
|
</cluster>
|
||||||
|
<cluster name="json_converter" location=".\converter\" recursive="true"/>
|
||||||
</target>
|
</target>
|
||||||
</system>
|
</system>
|
||||||
|
|||||||
@@ -1,28 +1,21 @@
|
|||||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-8-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-8-0 http://www.eiffel.com/developers/xml/configuration-1-8-0.xsd" name="json" uuid="4E21C3BD-7951-4C6E-A673-431E762D7414" library_target="json">
|
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-8-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-8-0 http://www.eiffel.com/developers/xml/configuration-1-8-0.xsd" name="json" uuid="4E21C3BD-7951-4C6E-A673-431E762D7414" library_target="json">
|
||||||
<target name="json">
|
<target name="json">
|
||||||
<root all_classes="true"/>
|
<root all_classes="true"/>
|
||||||
<file_rule>
|
<file_rule>
|
||||||
<exclude>/EIFGENs$</exclude>
|
<exclude>/EIFGENs$</exclude>
|
||||||
<exclude>/CVS$</exclude>
|
<exclude>/CVS$</exclude>
|
||||||
<exclude>/.svn$</exclude>
|
<exclude>/.svn$</exclude>
|
||||||
</file_rule>
|
</file_rule>
|
||||||
<option trace="false" profile="false" debug="false" warning="true" full_class_checking="true" void_safety="none" syntax="standard" namespace="EJSON.Library">
|
<option trace="false" profile="false" debug="false" warning="true" full_class_checking="true" void_safety="none" syntax="standard" namespace="EJSON.Library">
|
||||||
<assertions/>
|
<assertions/>
|
||||||
<warning name="export_class_missing" enabled="false"/>
|
</option>
|
||||||
<warning name="old_verbatim_strings" enabled="false"/>
|
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf" readonly="true"/>
|
||||||
<warning name="syntax" enabled="false"/>
|
<cluster name="json" location=".\" >
|
||||||
<warning name="vjrv" enabled="false"/>
|
<cluster name="json_kernel" location=".\kernel" recursive="true"/>
|
||||||
</option>
|
<cluster name="json_parser" location=".\parser" recursive="true"/>
|
||||||
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf" readonly="true"/>
|
<cluster name="json_utility" location=".\utility" recursive="true"/>
|
||||||
<cluster name="json" location=".\" recursive="true">
|
</cluster>
|
||||||
<file_rule>
|
<cluster name="json_converter" location=".\converter" recursive="true"/>
|
||||||
<exclude>^/gobo$</exclude>
|
</target>
|
||||||
<exclude>^/kernel$</exclude>
|
</system>
|
||||||
<exclude>^/extras$</exclude>
|
|
||||||
</file_rule>
|
|
||||||
<cluster name="kernel" location=".\kernel\" recursive="true"/>
|
|
||||||
<cluster name="extras" location=".\extras\" recursive="true"/>
|
|
||||||
</cluster>
|
|
||||||
</target>
|
|
||||||
</system>
|
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
|
|
||||||
@@ -12,6 +12,6 @@
|
|||||||
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf" readonly="true"/>
|
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf" readonly="true"/>
|
||||||
<library name="json" location="json.ecf" readonly="true"/>
|
<library name="json" location="json.ecf" readonly="true"/>
|
||||||
<library name="gobo_structure" location="$ISE_LIBRARY\library\gobo\gobo_structure.ecf"/>
|
<library name="gobo_structure" location="$ISE_LIBRARY\library\gobo\gobo_structure.ecf"/>
|
||||||
<cluster name="json_gobo" location=".\gobo" recursive="true" />
|
<cluster name="json_gobo_converter" location=".\gobo_converter" recursive="true" />
|
||||||
</target>
|
</target>
|
||||||
</system>
|
</system>
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
note
|
|
||||||
description: "A JSON converter"
|
|
||||||
author: "Paul Cohen"
|
|
||||||
date: "$Date$"
|
|
||||||
revision: "$Revision$"
|
|
||||||
file: "$HeadURL: $"
|
|
||||||
|
|
||||||
deferred class JSON_CONVERTER
|
|
||||||
|
|
||||||
inherit
|
|
||||||
SHARED_EJSON
|
|
||||||
|
|
||||||
feature -- Access
|
|
||||||
|
|
||||||
object: ANY
|
|
||||||
-- Eiffel object
|
|
||||||
deferred
|
|
||||||
end
|
|
||||||
|
|
||||||
feature -- Conversion
|
|
||||||
|
|
||||||
from_json (j: attached like to_json): detachable like object
|
|
||||||
-- Convert from JSON value.
|
|
||||||
-- Returns Void if unable to convert
|
|
||||||
deferred
|
|
||||||
end
|
|
||||||
|
|
||||||
to_json (o: like object): detachable JSON_VALUE
|
|
||||||
-- Convert to JSON value
|
|
||||||
deferred
|
|
||||||
end
|
|
||||||
|
|
||||||
invariant
|
|
||||||
has_eiffel_object: object /= Void -- An empty object must be created at creation time!
|
|
||||||
|
|
||||||
end
|
|
||||||
@@ -1,92 +0,0 @@
|
|||||||
note
|
|
||||||
description: "A JSON converter for HASH_TABLE [ANY, HASHABLE]"
|
|
||||||
author: "Paul Cohen"
|
|
||||||
date: "$Date$"
|
|
||||||
revision: "$Revision$"
|
|
||||||
file: "$HeadURL: $"
|
|
||||||
|
|
||||||
class JSON_HASH_TABLE_CONVERTER
|
|
||||||
|
|
||||||
inherit
|
|
||||||
JSON_CONVERTER
|
|
||||||
|
|
||||||
create
|
|
||||||
make
|
|
||||||
|
|
||||||
feature {NONE} -- Initialization
|
|
||||||
|
|
||||||
make
|
|
||||||
do
|
|
||||||
create object.make (0)
|
|
||||||
end
|
|
||||||
|
|
||||||
feature -- Access
|
|
||||||
|
|
||||||
object: HASH_TABLE [ANY, HASHABLE]
|
|
||||||
|
|
||||||
feature -- Conversion
|
|
||||||
|
|
||||||
from_json (j: attached like to_json): like object
|
|
||||||
local
|
|
||||||
keys: ARRAY [JSON_STRING]
|
|
||||||
i: INTEGER
|
|
||||||
h: detachable HASHABLE
|
|
||||||
jv: detachable JSON_VALUE
|
|
||||||
a: detachable ANY
|
|
||||||
do
|
|
||||||
keys := j.current_keys
|
|
||||||
create Result.make (keys.count)
|
|
||||||
from
|
|
||||||
i := 1
|
|
||||||
until
|
|
||||||
i > keys.count
|
|
||||||
loop
|
|
||||||
h ?= json.object (keys [i], Void)
|
|
||||||
check h /= Void end
|
|
||||||
jv := j.item (keys [i])
|
|
||||||
if jv /= Void then
|
|
||||||
a := json.object (jv, Void)
|
|
||||||
if a /= Void then
|
|
||||||
Result.put (a, h)
|
|
||||||
else
|
|
||||||
check a_attached: a /= Void end
|
|
||||||
end
|
|
||||||
else
|
|
||||||
check j_has_item: False end
|
|
||||||
end
|
|
||||||
i := i + 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
to_json (o: like object): detachable JSON_OBJECT
|
|
||||||
local
|
|
||||||
c: HASH_TABLE_ITERATION_CURSOR [ANY, HASHABLE]
|
|
||||||
js: JSON_STRING
|
|
||||||
jv: detachable JSON_VALUE
|
|
||||||
failed: BOOLEAN
|
|
||||||
do
|
|
||||||
create Result.make
|
|
||||||
from
|
|
||||||
c := o.new_cursor
|
|
||||||
until
|
|
||||||
c.after
|
|
||||||
loop
|
|
||||||
if attached {JSON_STRING} json.value (c.key) as l_key then
|
|
||||||
js := l_key
|
|
||||||
else
|
|
||||||
create js.make_json (c.key.out)
|
|
||||||
end
|
|
||||||
jv := json.value (c.item)
|
|
||||||
if jv /= Void then
|
|
||||||
Result.put (jv, js)
|
|
||||||
else
|
|
||||||
failed := True
|
|
||||||
end
|
|
||||||
c.forth
|
|
||||||
end
|
|
||||||
if failed then
|
|
||||||
Result := Void
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end -- class JSON_HASH_TABLE_CONVERTER
|
|
||||||
@@ -1,74 +0,0 @@
|
|||||||
note
|
|
||||||
description: "A JSON converter for LIST [ANY]"
|
|
||||||
author: "Paul Cohen"
|
|
||||||
date: "$Date$"
|
|
||||||
revision: "$Revision$"
|
|
||||||
file: "$HeadURL: $"
|
|
||||||
|
|
||||||
deferred class JSON_LIST_CONVERTER
|
|
||||||
|
|
||||||
inherit
|
|
||||||
JSON_CONVERTER
|
|
||||||
|
|
||||||
feature {NONE} -- Initialization
|
|
||||||
|
|
||||||
make
|
|
||||||
do
|
|
||||||
object := new_object (0)
|
|
||||||
end
|
|
||||||
|
|
||||||
feature -- Access
|
|
||||||
|
|
||||||
object: LIST [detachable ANY]
|
|
||||||
|
|
||||||
feature {NONE} -- Factory
|
|
||||||
|
|
||||||
new_object (nb: INTEGER): like object
|
|
||||||
deferred
|
|
||||||
ensure
|
|
||||||
Result /= Void
|
|
||||||
end
|
|
||||||
|
|
||||||
feature -- Conversion
|
|
||||||
|
|
||||||
from_json (j: attached like to_json): detachable like object
|
|
||||||
local
|
|
||||||
i: INTEGER
|
|
||||||
do
|
|
||||||
Result := new_object (j.count)
|
|
||||||
from
|
|
||||||
i := 1
|
|
||||||
until
|
|
||||||
i > j.count
|
|
||||||
loop
|
|
||||||
Result.extend (json.object (j [i], Void))
|
|
||||||
i := i + 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
to_json (o: like object): detachable JSON_ARRAY
|
|
||||||
local
|
|
||||||
c: ITERATION_CURSOR [detachable ANY]
|
|
||||||
jv: detachable JSON_VALUE
|
|
||||||
failed: BOOLEAN
|
|
||||||
do
|
|
||||||
create Result.make_array
|
|
||||||
from
|
|
||||||
c := o.new_cursor
|
|
||||||
until
|
|
||||||
c.after
|
|
||||||
loop
|
|
||||||
jv := json.value (c.item)
|
|
||||||
if jv /= Void then
|
|
||||||
Result.add (jv)
|
|
||||||
else
|
|
||||||
failed := True
|
|
||||||
end
|
|
||||||
c.forth
|
|
||||||
end
|
|
||||||
if failed then
|
|
||||||
Result := Void
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end -- class JSON_ARRAYED_LIST_CONVERTER
|
|
||||||
@@ -1,141 +1,192 @@
|
|||||||
note
|
note
|
||||||
description: "[
|
description: "[
|
||||||
JSON_ARRAY represent an array in JSON.
|
JSON_ARRAY represent an array in JSON.
|
||||||
An array in JSON is an ordered set of names.
|
An array in JSON is an ordered set of names.
|
||||||
Examples
|
Examples
|
||||||
array
|
array
|
||||||
[]
|
[]
|
||||||
[elements]
|
[elements]
|
||||||
]"
|
]"
|
||||||
|
author: "$Author$"
|
||||||
author: "Javier Velilla"
|
date: "$date$"
|
||||||
date: "2008/08/24"
|
revision: "$Revision$"
|
||||||
revision: "Revision 0.1"
|
|
||||||
|
class
|
||||||
class
|
JSON_ARRAY
|
||||||
JSON_ARRAY
|
|
||||||
|
inherit
|
||||||
inherit
|
|
||||||
JSON_VALUE
|
JSON_VALUE
|
||||||
|
|
||||||
DEBUG_OUTPUT
|
ITERABLE [JSON_VALUE]
|
||||||
|
|
||||||
create
|
DEBUG_OUTPUT
|
||||||
make_array
|
|
||||||
|
create
|
||||||
feature {NONE} -- Initialization
|
make, make_empty,
|
||||||
|
make_array
|
||||||
make_array
|
|
||||||
-- Initialize JSON Array
|
feature {NONE} -- Initialization
|
||||||
do
|
|
||||||
create values.make (10)
|
make (nb: INTEGER)
|
||||||
end
|
-- Initialize JSON array with capacity of `nb' items.
|
||||||
|
do
|
||||||
feature -- Access
|
create items.make (nb)
|
||||||
|
end
|
||||||
i_th alias "[]" (i: INTEGER): JSON_VALUE
|
|
||||||
-- Item at `i'-th position
|
make_empty
|
||||||
require
|
-- Initialize empty JSON array.
|
||||||
is_valid_index: valid_index (i)
|
do
|
||||||
do
|
make (0)
|
||||||
Result := values.i_th (i)
|
end
|
||||||
end
|
|
||||||
|
make_array
|
||||||
representation: STRING
|
-- Initialize JSON Array
|
||||||
local
|
obsolete
|
||||||
i: INTEGER
|
"Use `make' Sept/2014"
|
||||||
do
|
do
|
||||||
Result := "["
|
make (10)
|
||||||
from
|
end
|
||||||
i := 1
|
|
||||||
until
|
feature -- Access
|
||||||
i > count
|
|
||||||
loop
|
i_th alias "[]" (i: INTEGER): JSON_VALUE
|
||||||
Result.append (i_th (i).representation)
|
-- Item at `i'-th position
|
||||||
i := i + 1
|
require
|
||||||
if i <= count then
|
is_valid_index: valid_index (i)
|
||||||
Result.append_character (',')
|
do
|
||||||
end
|
Result := items.i_th (i)
|
||||||
end
|
end
|
||||||
Result.append_character (']')
|
|
||||||
end
|
representation: STRING
|
||||||
|
do
|
||||||
feature -- Visitor pattern
|
Result := "["
|
||||||
|
across
|
||||||
accept (a_visitor: JSON_VISITOR)
|
items as ic
|
||||||
-- Accept `a_visitor'.
|
loop
|
||||||
-- (Call `visit_json_array' procedure on `a_visitor'.)
|
if Result.count > 1 then
|
||||||
do
|
Result.append_character (',')
|
||||||
a_visitor.visit_json_array (Current)
|
end
|
||||||
end
|
Result.append (ic.item.representation)
|
||||||
|
end
|
||||||
feature -- Mesurement
|
Result.append_character (']')
|
||||||
|
end
|
||||||
count: INTEGER
|
|
||||||
-- Number of items.
|
feature -- Visitor pattern
|
||||||
do
|
|
||||||
Result := values.count
|
accept (a_visitor: JSON_VISITOR)
|
||||||
end
|
-- Accept `a_visitor'.
|
||||||
|
-- (Call `visit_json_array' procedure on `a_visitor'.)
|
||||||
feature -- Status report
|
do
|
||||||
|
a_visitor.visit_json_array (Current)
|
||||||
valid_index (i: INTEGER): BOOLEAN
|
end
|
||||||
-- Is `i' a valid index?
|
|
||||||
do
|
feature -- Access
|
||||||
Result := (1 <= i) and (i <= count)
|
|
||||||
end
|
new_cursor: ITERATION_CURSOR [JSON_VALUE]
|
||||||
|
-- Fresh cursor associated with current structure
|
||||||
feature -- Change Element
|
do
|
||||||
|
Result := items.new_cursor
|
||||||
add (value: JSON_VALUE)
|
end
|
||||||
require
|
|
||||||
value_not_null: value /= void
|
feature -- Mesurement
|
||||||
do
|
|
||||||
values.extend (value)
|
count: INTEGER
|
||||||
ensure
|
-- Number of items.
|
||||||
has_new_value: old values.count + 1 = values.count and
|
do
|
||||||
values.has (value)
|
Result := items.count
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Report
|
feature -- Status report
|
||||||
|
|
||||||
hash_code: INTEGER
|
valid_index (i: INTEGER): BOOLEAN
|
||||||
-- Hash code value
|
-- Is `i' a valid index?
|
||||||
do
|
do
|
||||||
from
|
Result := (1 <= i) and (i <= count)
|
||||||
values.start
|
end
|
||||||
Result := values.item.hash_code
|
|
||||||
until
|
feature -- Change Element
|
||||||
values.off
|
|
||||||
loop
|
put_front (v: JSON_VALUE)
|
||||||
Result:= ((Result \\ 8388593) |<< 8) + values.item.hash_code
|
require
|
||||||
values.forth
|
v_not_void: v /= Void
|
||||||
end
|
do
|
||||||
Result := Result \\ values.count
|
items.put_front (v)
|
||||||
end
|
ensure
|
||||||
|
has_new_value: old items.count + 1 = items.count and items.first = v
|
||||||
feature -- Conversion
|
end
|
||||||
|
|
||||||
array_representation: ARRAYED_LIST [JSON_VALUE]
|
add, extend (v: JSON_VALUE)
|
||||||
-- Representation as a sequences of values
|
require
|
||||||
do
|
v_not_void: v /= Void
|
||||||
Result := values
|
do
|
||||||
end
|
items.extend (v)
|
||||||
|
ensure
|
||||||
feature -- Status report
|
has_new_value: old items.count + 1 = items.count and items.has (v)
|
||||||
|
end
|
||||||
debug_output: STRING
|
|
||||||
-- String that should be displayed in debugger to represent `Current'.
|
prune_all (v: JSON_VALUE)
|
||||||
do
|
-- Remove all occurrences of `v'.
|
||||||
Result := count.out
|
require
|
||||||
end
|
v_not_void: v /= Void
|
||||||
|
do
|
||||||
feature {NONE} -- Implementation
|
items.prune_all (v)
|
||||||
|
ensure
|
||||||
values: ARRAYED_LIST [JSON_VALUE]
|
not_has_new_value: not items.has (v)
|
||||||
-- Value container
|
end
|
||||||
|
|
||||||
invariant
|
wipe_out
|
||||||
value_not_void: values /= Void
|
-- Remove all items.
|
||||||
|
do
|
||||||
end
|
items.wipe_out
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Report
|
||||||
|
|
||||||
|
hash_code: INTEGER
|
||||||
|
-- Hash code value
|
||||||
|
local
|
||||||
|
l_started: BOOLEAN
|
||||||
|
do
|
||||||
|
across
|
||||||
|
items as ic
|
||||||
|
loop
|
||||||
|
if l_started then
|
||||||
|
Result := ((Result \\ 8388593) |<< 8) + ic.item.hash_code
|
||||||
|
else
|
||||||
|
Result := ic.item.hash_code
|
||||||
|
l_started := True
|
||||||
|
end
|
||||||
|
end
|
||||||
|
Result := Result \\ items.count
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Conversion
|
||||||
|
|
||||||
|
array_representation: ARRAYED_LIST [JSON_VALUE]
|
||||||
|
-- Representation as a sequences of values.
|
||||||
|
-- be careful, modifying the return object may have impact on the original JSON_ARRAY object.
|
||||||
|
do
|
||||||
|
Result := items
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Status report
|
||||||
|
|
||||||
|
debug_output: STRING
|
||||||
|
-- String that should be displayed in debugger to represent `Current'.
|
||||||
|
do
|
||||||
|
Result := count.out + " item(s)"
|
||||||
|
end
|
||||||
|
|
||||||
|
feature {NONE} -- Implementation
|
||||||
|
|
||||||
|
items: ARRAYED_LIST [JSON_VALUE]
|
||||||
|
-- Value container
|
||||||
|
|
||||||
|
invariant
|
||||||
|
items_not_void: items /= Void
|
||||||
|
|
||||||
|
note
|
||||||
|
copyright: "2010-2014, Javier Velilla and others https://github.com/eiffelhub/json."
|
||||||
|
license: "https://github.com/eiffelhub/json/blob/master/License.txt"
|
||||||
|
end
|
||||||
|
|||||||
@@ -1,61 +1,87 @@
|
|||||||
note
|
note
|
||||||
description: "JSON Truth values"
|
description: "JSON Boolean values"
|
||||||
author: "Javier Velilla"
|
author: "$Author$"
|
||||||
date: "2008/08/24"
|
date: "$Date$"
|
||||||
revision: "Revision 0.1"
|
revision: "$Revision$"
|
||||||
|
|
||||||
class
|
class
|
||||||
JSON_BOOLEAN
|
JSON_BOOLEAN
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
JSON_VALUE
|
|
||||||
|
JSON_VALUE
|
||||||
create
|
|
||||||
make_boolean
|
create
|
||||||
|
make,
|
||||||
feature {NONE} -- Initialization
|
make_true, make_false,
|
||||||
|
make_boolean
|
||||||
make_boolean (an_item: BOOLEAN)
|
|
||||||
--Initialize.
|
feature {NONE} -- Initialization
|
||||||
do
|
|
||||||
item := an_item
|
make (a_value: BOOLEAN)
|
||||||
end
|
-- Initialize Current JSON boolean with `a_boolean'.
|
||||||
|
do
|
||||||
feature -- Access
|
item := a_value
|
||||||
|
end
|
||||||
item: BOOLEAN
|
|
||||||
-- Content
|
make_true
|
||||||
|
-- Initialize Current JSON boolean with True.
|
||||||
hash_code: INTEGER
|
do
|
||||||
-- Hash code value
|
make (True)
|
||||||
do
|
end
|
||||||
Result := item.hash_code
|
|
||||||
end
|
make_false
|
||||||
|
-- Initialize Current JSON boolean with False.
|
||||||
representation: STRING
|
do
|
||||||
do
|
make (False)
|
||||||
if item then
|
end
|
||||||
Result := "true"
|
|
||||||
else
|
make_boolean (a_item: BOOLEAN)
|
||||||
Result := "false"
|
-- Initialize.
|
||||||
end
|
obsolete
|
||||||
end
|
"Use `make' Sept/2014"
|
||||||
|
do
|
||||||
feature -- Visitor pattern
|
make (a_item)
|
||||||
|
end
|
||||||
accept (a_visitor: JSON_VISITOR)
|
|
||||||
-- Accept `a_visitor'.
|
feature -- Access
|
||||||
-- (Call `visit_json_boolean' procedure on `a_visitor'.)
|
|
||||||
do
|
item: BOOLEAN
|
||||||
a_visitor.visit_json_boolean (Current)
|
-- Content
|
||||||
end
|
|
||||||
|
hash_code: INTEGER
|
||||||
feature -- Status report
|
-- Hash code value
|
||||||
|
do
|
||||||
debug_output: STRING
|
Result := item.hash_code
|
||||||
-- String that should be displayed in debugger to represent `Current'.
|
end
|
||||||
do
|
|
||||||
Result := item.out
|
representation: STRING
|
||||||
end
|
do
|
||||||
|
if item then
|
||||||
end
|
Result := "true"
|
||||||
|
else
|
||||||
|
Result := "false"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Visitor pattern
|
||||||
|
|
||||||
|
accept (a_visitor: JSON_VISITOR)
|
||||||
|
-- Accept `a_visitor'.
|
||||||
|
-- (Call `visit_json_boolean' procedure on `a_visitor'.)
|
||||||
|
do
|
||||||
|
a_visitor.visit_json_boolean (Current)
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Status report
|
||||||
|
|
||||||
|
debug_output: STRING
|
||||||
|
-- String that should be displayed in debugger to represent `Current'.
|
||||||
|
do
|
||||||
|
Result := item.out
|
||||||
|
end
|
||||||
|
|
||||||
|
note
|
||||||
|
copyright: "2010-2014, Javier Velilla and others https://github.com/eiffelhub/json."
|
||||||
|
license: "https://github.com/eiffelhub/json/blob/master/License.txt"
|
||||||
|
end
|
||||||
|
|||||||
@@ -1,47 +1,51 @@
|
|||||||
note
|
note
|
||||||
description: "JSON Null Values"
|
description: "JSON Null Values"
|
||||||
author: "Javier Velilla"
|
author: "Javier Velilla"
|
||||||
date: "2008/08/24"
|
date: "2008/08/24"
|
||||||
revision: "Revision 0.1"
|
revision: "Revision 0.1"
|
||||||
|
|
||||||
class
|
class
|
||||||
JSON_NULL
|
JSON_NULL
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
JSON_VALUE
|
|
||||||
|
JSON_VALUE
|
||||||
feature --Access
|
|
||||||
|
feature --Access
|
||||||
hash_code: INTEGER
|
|
||||||
-- Hash code value
|
hash_code: INTEGER
|
||||||
do
|
-- Hash code value
|
||||||
Result := null_value.hash_code
|
do
|
||||||
end
|
Result := null_value.hash_code
|
||||||
|
end
|
||||||
representation: STRING
|
|
||||||
do
|
representation: STRING
|
||||||
Result := "null"
|
do
|
||||||
end
|
Result := "null"
|
||||||
|
end
|
||||||
feature -- Visitor pattern
|
|
||||||
|
feature -- Visitor pattern
|
||||||
accept (a_visitor: JSON_VISITOR)
|
|
||||||
-- Accept `a_visitor'.
|
accept (a_visitor: JSON_VISITOR)
|
||||||
-- (Call `visit_element_a' procedure on `a_visitor'.)
|
-- Accept `a_visitor'.
|
||||||
do
|
-- (Call `visit_element_a' procedure on `a_visitor'.)
|
||||||
a_visitor.visit_json_null (Current)
|
do
|
||||||
end
|
a_visitor.visit_json_null (Current)
|
||||||
|
end
|
||||||
feature -- Status report
|
|
||||||
|
feature -- Status report
|
||||||
debug_output: STRING
|
|
||||||
-- String that should be displayed in debugger to represent `Current'.
|
debug_output: STRING
|
||||||
do
|
-- String that should be displayed in debugger to represent `Current'.
|
||||||
Result := null_value
|
do
|
||||||
end
|
Result := null_value
|
||||||
|
end
|
||||||
feature {NONE}-- Implementation
|
|
||||||
|
feature {NONE} -- Implementation
|
||||||
null_value: STRING = "null"
|
|
||||||
|
null_value: STRING = "null"
|
||||||
end
|
|
||||||
|
note
|
||||||
|
copyright: "2010-2014, Javier Velilla and others https://github.com/eiffelhub/json."
|
||||||
|
license: "https://github.com/eiffelhub/json/blob/master/License.txt"
|
||||||
|
end
|
||||||
|
|||||||
@@ -1,99 +1,149 @@
|
|||||||
note
|
note
|
||||||
|
description: "JSON Numbers, octal and hexadecimal formats are not used."
|
||||||
description: "JSON Numbers, octal and hexadecimal formats are not used."
|
author: "$Author$"
|
||||||
author: "Javier Velilla"
|
date: "$Date$"
|
||||||
date: "2008/08/24"
|
revision: "$Revision$"
|
||||||
revision: "Revision 0.1"
|
license: "MIT (see http://www.opensource.org/licenses/mit-license.php)"
|
||||||
license:"MIT (see http://www.opensource.org/licenses/mit-license.php)"
|
|
||||||
|
class
|
||||||
class
|
JSON_NUMBER
|
||||||
JSON_NUMBER
|
|
||||||
|
inherit
|
||||||
inherit
|
|
||||||
JSON_VALUE
|
JSON_VALUE
|
||||||
redefine
|
redefine
|
||||||
is_equal
|
is_equal
|
||||||
end
|
end
|
||||||
|
|
||||||
create
|
create
|
||||||
make_integer,
|
make_integer, make_natural, make_real
|
||||||
make_natural,
|
|
||||||
make_real
|
feature {NONE} -- initialization
|
||||||
|
|
||||||
feature {NONE} -- initialization
|
make_integer (an_argument: INTEGER_64)
|
||||||
|
-- Initialize an instance of JSON_NUMBER from the integer value of `an_argument'.
|
||||||
make_integer (an_argument: INTEGER_64)
|
do
|
||||||
-- Initialize an instance of JSON_NUMBER from the integer value of `an_argument'.
|
item := an_argument.out
|
||||||
do
|
numeric_type := integer_type
|
||||||
item := an_argument.out
|
end
|
||||||
numeric_type := INTEGER_TYPE
|
|
||||||
end
|
make_natural (an_argument: NATURAL_64)
|
||||||
|
-- Initialize an instance of JSON_NUMBER from the unsigned integer value of `an_argument'.
|
||||||
make_natural (an_argument: NATURAL_64)
|
do
|
||||||
-- Initialize an instance of JSON_NUMBER from the unsigned integer value of `an_argument'.
|
item := an_argument.out
|
||||||
do
|
numeric_type := natural_type
|
||||||
item := an_argument.out
|
end
|
||||||
numeric_type := NATURAL_TYPE
|
|
||||||
end
|
make_real (an_argument: REAL_64)
|
||||||
|
-- Initialize an instance of JSON_NUMBER from the floating point value of `an_argument'.
|
||||||
make_real (an_argument: DOUBLE)
|
do
|
||||||
-- Initialize an instance of JSON_NUMBER from the floating point value of `an_argument'.
|
item := an_argument.out
|
||||||
do
|
numeric_type := double_type
|
||||||
item := an_argument.out
|
end
|
||||||
numeric_type := DOUBLE_TYPE
|
|
||||||
end
|
feature -- Access
|
||||||
|
|
||||||
feature -- Access
|
item: STRING
|
||||||
|
-- Content
|
||||||
item: STRING
|
|
||||||
-- Content
|
numeric_type: INTEGER
|
||||||
|
-- Type of number (integer, natural or real).
|
||||||
hash_code: INTEGER
|
|
||||||
--Hash code value
|
hash_code: INTEGER
|
||||||
do
|
--Hash code value
|
||||||
Result := item.hash_code
|
do
|
||||||
end
|
Result := item.hash_code
|
||||||
|
end
|
||||||
representation: STRING
|
|
||||||
do
|
representation: STRING
|
||||||
Result := item
|
do
|
||||||
end
|
Result := item
|
||||||
|
end
|
||||||
feature -- Visitor pattern
|
|
||||||
|
feature -- Conversion
|
||||||
accept (a_visitor: JSON_VISITOR)
|
|
||||||
-- Accept `a_visitor'.
|
integer_64_item: INTEGER_64
|
||||||
-- (Call `visit_json_number' procedure on `a_visitor'.)
|
-- Associated integer value.
|
||||||
do
|
require
|
||||||
a_visitor.visit_json_number (Current)
|
is_integer: is_integer
|
||||||
end
|
do
|
||||||
|
Result := item.to_integer_64
|
||||||
feature -- Status
|
end
|
||||||
|
|
||||||
is_equal (other: like Current): BOOLEAN
|
natural_64_item: NATURAL_64
|
||||||
-- Is `other' attached to an object of the same type
|
-- Associated natural value.
|
||||||
-- as current object and identical to it?
|
require
|
||||||
do
|
is_natural: is_natural
|
||||||
Result := item.is_equal (other.item)
|
do
|
||||||
end
|
Result := item.to_natural_64
|
||||||
|
end
|
||||||
feature -- Status report
|
|
||||||
|
double_item, real_64_item: REAL_64
|
||||||
debug_output: STRING
|
-- Associated real value.
|
||||||
-- String that should be displayed in debugger to represent `Current'.
|
require
|
||||||
do
|
is_real: is_real
|
||||||
Result := item
|
do
|
||||||
end
|
Result := item.to_real_64
|
||||||
|
end
|
||||||
feature -- Implementation
|
|
||||||
|
feature -- Status report
|
||||||
INTEGER_TYPE: INTEGER = 1
|
|
||||||
DOUBLE_TYPE: INTEGER = 2
|
is_integer: BOOLEAN
|
||||||
NATURAL_TYPE: INTEGER = 3
|
-- Is Current an integer number?
|
||||||
|
do
|
||||||
numeric_type: INTEGER
|
Result := numeric_type = integer_type
|
||||||
|
end
|
||||||
invariant
|
|
||||||
item_not_void: item /= Void
|
is_natural: BOOLEAN
|
||||||
|
-- Is Current a natural number?
|
||||||
end
|
do
|
||||||
|
Result := numeric_type = natural_type
|
||||||
|
end
|
||||||
|
|
||||||
|
is_double, is_real: BOOLEAN
|
||||||
|
-- Is Current a real number?
|
||||||
|
do
|
||||||
|
Result := numeric_type = real_type
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Visitor pattern
|
||||||
|
|
||||||
|
accept (a_visitor: JSON_VISITOR)
|
||||||
|
-- Accept `a_visitor'.
|
||||||
|
-- (Call `visit_json_number' procedure on `a_visitor'.)
|
||||||
|
do
|
||||||
|
a_visitor.visit_json_number (Current)
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Status
|
||||||
|
|
||||||
|
is_equal (other: like Current): BOOLEAN
|
||||||
|
-- Is `other' attached to an object of the same type
|
||||||
|
-- as current object and identical to it?
|
||||||
|
do
|
||||||
|
Result := item.is_equal (other.item)
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Status report
|
||||||
|
|
||||||
|
debug_output: STRING
|
||||||
|
-- String that should be displayed in debugger to represent `Current'.
|
||||||
|
do
|
||||||
|
Result := item
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Implementation
|
||||||
|
|
||||||
|
integer_type: INTEGER = 1
|
||||||
|
|
||||||
|
double_type, real_type: INTEGER = 2
|
||||||
|
|
||||||
|
natural_type: INTEGER = 3
|
||||||
|
|
||||||
|
invariant
|
||||||
|
item_not_void: item /= Void
|
||||||
|
|
||||||
|
note
|
||||||
|
copyright: "2010-2014, Javier Velilla and others https://github.com/eiffelhub/json."
|
||||||
|
license: "https://github.com/eiffelhub/json/blob/master/License.txt"
|
||||||
|
end
|
||||||
|
|||||||
@@ -1,124 +1,261 @@
|
|||||||
note
|
note
|
||||||
|
description: "[
|
||||||
description: "[
|
An JSON_OBJECT represent an object in JSON.
|
||||||
An JSON_OBJECT represent an object in JSON.
|
An object is an unordered set of name/value pairs
|
||||||
An object is an unordered set of name/value pairs
|
|
||||||
|
Examples:
|
||||||
Examples:
|
object
|
||||||
|
{}
|
||||||
object
|
{"key": value}
|
||||||
{}
|
{"key": "value"}
|
||||||
{"key","value"}
|
]"
|
||||||
|
author: "$Author$"
|
||||||
]"
|
date: "$Date$"
|
||||||
author: "Javier Velilla"
|
revision: "$Revision$"
|
||||||
date: "2008/08/24"
|
license: "MIT (see http://www.opensource.org/licenses/mit-license.php)"
|
||||||
revision: "Revision 0.1"
|
|
||||||
license:"MIT (see http://www.opensource.org/licenses/mit-license.php)"
|
|
||||||
|
|
||||||
class
|
class
|
||||||
JSON_OBJECT
|
JSON_OBJECT
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
JSON_VALUE
|
|
||||||
|
JSON_VALUE
|
||||||
|
|
||||||
TABLE_ITERABLE [JSON_VALUE, JSON_STRING]
|
TABLE_ITERABLE [JSON_VALUE, JSON_STRING]
|
||||||
|
|
||||||
|
DEBUG_OUTPUT
|
||||||
|
|
||||||
create
|
create
|
||||||
make
|
make_empty, make_with_capacity, make
|
||||||
|
|
||||||
feature {NONE} -- Initialization
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
make
|
make_with_capacity (nb: INTEGER)
|
||||||
-- Initialize
|
-- Initialize with a capacity of `nb' items.
|
||||||
do
|
do
|
||||||
create object.make (10)
|
create items.make (nb)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
make_empty
|
||||||
|
-- Initialize as empty object.
|
||||||
|
do
|
||||||
|
make_with_capacity (0)
|
||||||
|
end
|
||||||
|
|
||||||
|
make
|
||||||
|
-- Initialize with default capacity.
|
||||||
|
do
|
||||||
|
make_with_capacity (3)
|
||||||
|
end
|
||||||
|
|
||||||
feature -- Change Element
|
feature -- Change Element
|
||||||
|
|
||||||
put (value: detachable JSON_VALUE; key: JSON_STRING)
|
put (a_value: detachable JSON_VALUE; a_key: JSON_STRING)
|
||||||
-- Assuming there is no item of key `key',
|
-- Assuming there is no item of key `a_key',
|
||||||
-- insert `value' with `key'.
|
-- insert `a_value' with `a_key'.
|
||||||
require
|
require
|
||||||
key_not_present: not has_key (key)
|
a_key_not_present: not has_key (a_key)
|
||||||
local
|
do
|
||||||
l_value: like value
|
if a_value = Void then
|
||||||
do
|
items.extend (create {JSON_NULL}, a_key)
|
||||||
l_value := value
|
else
|
||||||
if l_value = Void then
|
items.extend (a_value, a_key)
|
||||||
create {JSON_NULL} l_value
|
end
|
||||||
end
|
end
|
||||||
object.extend (l_value, key)
|
|
||||||
end
|
|
||||||
|
|
||||||
replace (value: detachable JSON_VALUE; key: JSON_STRING)
|
put_string (a_value: READABLE_STRING_GENERAL; a_key: JSON_STRING)
|
||||||
-- Assuming there is no item of key `key',
|
-- Assuming there is no item of key `a_key',
|
||||||
-- insert `value' with `key'.
|
-- insert `a_value' with `a_key'.
|
||||||
local
|
require
|
||||||
l_value: like value
|
key_not_present: not has_key (a_key)
|
||||||
do
|
local
|
||||||
l_value := value
|
l_value: JSON_STRING
|
||||||
if l_value = Void then
|
do
|
||||||
create {JSON_NULL} l_value
|
if attached {READABLE_STRING_8} a_value as s then
|
||||||
end
|
create l_value.make_from_string (s)
|
||||||
object.force (l_value, key)
|
else
|
||||||
end
|
create l_value.make_from_string_32 (a_value.as_string_32)
|
||||||
|
end
|
||||||
|
put (l_value, a_key)
|
||||||
|
end
|
||||||
|
|
||||||
|
put_integer (a_value: INTEGER_64; a_key: JSON_STRING)
|
||||||
|
-- Assuming there is no item of key `a_key',
|
||||||
|
-- insert `a_value' with `a_key'.
|
||||||
|
require
|
||||||
|
key_not_present: not has_key (a_key)
|
||||||
|
local
|
||||||
|
l_value: JSON_NUMBER
|
||||||
|
do
|
||||||
|
create l_value.make_integer (a_value)
|
||||||
|
put (l_value, a_key)
|
||||||
|
end
|
||||||
|
|
||||||
|
put_natural (a_value: NATURAL_64; a_key: JSON_STRING)
|
||||||
|
-- Assuming there is no item of key `a_key',
|
||||||
|
-- insert `a_value' with `a_key'.
|
||||||
|
require
|
||||||
|
key_not_present: not has_key (a_key)
|
||||||
|
local
|
||||||
|
l_value: JSON_NUMBER
|
||||||
|
do
|
||||||
|
create l_value.make_natural (a_value)
|
||||||
|
put (l_value, a_key)
|
||||||
|
end
|
||||||
|
|
||||||
|
put_real (a_value: DOUBLE; a_key: JSON_STRING)
|
||||||
|
-- Assuming there is no item of key `a_key',
|
||||||
|
-- insert `a_value' with `a_key'.
|
||||||
|
require
|
||||||
|
key_not_present: not has_key (a_key)
|
||||||
|
local
|
||||||
|
l_value: JSON_NUMBER
|
||||||
|
do
|
||||||
|
create l_value.make_real (a_value)
|
||||||
|
put (l_value, a_key)
|
||||||
|
end
|
||||||
|
|
||||||
|
put_boolean (a_value: BOOLEAN; a_key: JSON_STRING)
|
||||||
|
-- Assuming there is no item of key `a_key',
|
||||||
|
-- insert `a_value' with `a_key'.
|
||||||
|
require
|
||||||
|
key_not_present: not has_key (a_key)
|
||||||
|
local
|
||||||
|
l_value: JSON_BOOLEAN
|
||||||
|
do
|
||||||
|
create l_value.make (a_value)
|
||||||
|
put (l_value, a_key)
|
||||||
|
end
|
||||||
|
|
||||||
|
replace (a_value: detachable JSON_VALUE; a_key: JSON_STRING)
|
||||||
|
-- Assuming there is no item of key `a_key',
|
||||||
|
-- insert `a_value' with `a_key'.
|
||||||
|
do
|
||||||
|
if a_value = Void then
|
||||||
|
items.force (create {JSON_NULL}, a_key)
|
||||||
|
else
|
||||||
|
items.force (a_value, a_key)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
replace_with_string (a_value: READABLE_STRING_GENERAL; a_key: JSON_STRING)
|
||||||
|
-- Assuming there is no item of key `a_key',
|
||||||
|
-- insert `a_value' with `a_key'.
|
||||||
|
local
|
||||||
|
l_value: JSON_STRING
|
||||||
|
do
|
||||||
|
if attached {READABLE_STRING_8} a_value as s then
|
||||||
|
create l_value.make_from_string (s)
|
||||||
|
else
|
||||||
|
create l_value.make_from_string_32 (a_value.as_string_32)
|
||||||
|
end
|
||||||
|
replace (l_value, a_key)
|
||||||
|
end
|
||||||
|
|
||||||
|
replace_with_integer (a_value: INTEGER_64; a_key: JSON_STRING)
|
||||||
|
-- Assuming there is no item of key `a_key',
|
||||||
|
-- insert `a_value' with `a_key'.
|
||||||
|
local
|
||||||
|
l_value: JSON_NUMBER
|
||||||
|
do
|
||||||
|
create l_value.make_integer (a_value)
|
||||||
|
replace (l_value, a_key)
|
||||||
|
end
|
||||||
|
|
||||||
|
replace_with_with_natural (a_value: NATURAL_64; a_key: JSON_STRING)
|
||||||
|
-- Assuming there is no item of key `a_key',
|
||||||
|
-- insert `a_value' with `a_key'.
|
||||||
|
local
|
||||||
|
l_value: JSON_NUMBER
|
||||||
|
do
|
||||||
|
create l_value.make_natural (a_value)
|
||||||
|
replace (l_value, a_key)
|
||||||
|
end
|
||||||
|
|
||||||
|
replace_with_real (a_value: DOUBLE; a_key: JSON_STRING)
|
||||||
|
-- Assuming there is no item of key `a_key',
|
||||||
|
-- insert `a_value' with `a_key'.
|
||||||
|
local
|
||||||
|
l_value: JSON_NUMBER
|
||||||
|
do
|
||||||
|
create l_value.make_real (a_value)
|
||||||
|
replace (l_value, a_key)
|
||||||
|
end
|
||||||
|
|
||||||
|
replace_with_boolean (a_value: BOOLEAN; a_key: JSON_STRING)
|
||||||
|
-- Assuming there is no item of key `a_key',
|
||||||
|
-- insert `a_value' with `a_key'.
|
||||||
|
local
|
||||||
|
l_value: JSON_BOOLEAN
|
||||||
|
do
|
||||||
|
create l_value.make (a_value)
|
||||||
|
replace (l_value, a_key)
|
||||||
|
end
|
||||||
|
|
||||||
|
remove (a_key: JSON_STRING)
|
||||||
|
-- Remove item indexed by `a_key' if any.
|
||||||
|
do
|
||||||
|
items.remove (a_key)
|
||||||
|
end
|
||||||
|
|
||||||
|
wipe_out
|
||||||
|
-- Reset all items to default values; reset status.
|
||||||
|
do
|
||||||
|
items.wipe_out
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Status report
|
||||||
|
|
||||||
|
has_key (a_key: JSON_STRING): BOOLEAN
|
||||||
|
-- has the JSON_OBJECT contains a specific key `a_key'.
|
||||||
|
do
|
||||||
|
Result := items.has (a_key)
|
||||||
|
end
|
||||||
|
|
||||||
|
has_item (a_value: JSON_VALUE): BOOLEAN
|
||||||
|
-- has the JSON_OBJECT contain a specfic item `a_value'
|
||||||
|
do
|
||||||
|
Result := items.has_item (a_value)
|
||||||
|
end
|
||||||
|
|
||||||
feature -- Access
|
feature -- Access
|
||||||
|
|
||||||
has_key (key: JSON_STRING): BOOLEAN
|
item (a_key: JSON_STRING): detachable JSON_VALUE
|
||||||
-- has the JSON_OBJECT contains a specific key 'key'.
|
-- the json_value associated with a key `a_key'.
|
||||||
do
|
do
|
||||||
Result := object.has (key)
|
Result := items.item (a_key)
|
||||||
end
|
end
|
||||||
|
|
||||||
has_item (value: JSON_VALUE): BOOLEAN
|
current_keys: ARRAY [JSON_STRING]
|
||||||
-- has the JSON_OBJECT contain a specfic item 'value'
|
-- Array containing actually used keys.
|
||||||
do
|
do
|
||||||
Result := object.has_item (value)
|
Result := items.current_keys
|
||||||
end
|
end
|
||||||
|
|
||||||
item (key: JSON_STRING): detachable JSON_VALUE
|
representation: STRING
|
||||||
-- the json_value associated with a key.
|
-- <Precursor>
|
||||||
do
|
do
|
||||||
Result := object.item (key)
|
create Result.make (2)
|
||||||
end
|
Result.append_character ('{')
|
||||||
|
across
|
||||||
current_keys: ARRAY [JSON_STRING]
|
items as ic
|
||||||
-- array containing actually used keys
|
loop
|
||||||
do
|
if Result.count > 1 then
|
||||||
Result := object.current_keys
|
Result.append_character (',')
|
||||||
end
|
end
|
||||||
|
Result.append (ic.key.representation)
|
||||||
representation: STRING
|
Result.append_character (':')
|
||||||
local
|
Result.append (ic.item.representation)
|
||||||
t: HASH_TABLE [JSON_VALUE, JSON_STRING]
|
end
|
||||||
do
|
Result.append_character ('}')
|
||||||
Result := "{"
|
end
|
||||||
from
|
|
||||||
t := map_representation
|
|
||||||
t.start
|
|
||||||
until
|
|
||||||
t.after
|
|
||||||
loop
|
|
||||||
Result.append (t.key_for_iteration.representation)
|
|
||||||
Result.append (":")
|
|
||||||
Result.append (t.item_for_iteration.representation)
|
|
||||||
t.forth
|
|
||||||
if not t.after then
|
|
||||||
Result.append_character (',')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
Result.append_character ('}')
|
|
||||||
end
|
|
||||||
|
|
||||||
feature -- Mesurement
|
feature -- Mesurement
|
||||||
|
|
||||||
count: INTEGER
|
count: INTEGER
|
||||||
-- Number of field
|
-- Number of field.
|
||||||
do
|
do
|
||||||
Result := object.count
|
Result := items.count
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Access
|
feature -- Access
|
||||||
@@ -126,7 +263,7 @@ feature -- Access
|
|||||||
new_cursor: TABLE_ITERATION_CURSOR [JSON_VALUE, JSON_STRING]
|
new_cursor: TABLE_ITERATION_CURSOR [JSON_VALUE, JSON_STRING]
|
||||||
-- Fresh cursor associated with current structure
|
-- Fresh cursor associated with current structure
|
||||||
do
|
do
|
||||||
Result := object.new_cursor
|
Result := items.new_cursor
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Status report
|
feature -- Status report
|
||||||
@@ -134,58 +271,61 @@ feature -- Status report
|
|||||||
is_empty: BOOLEAN
|
is_empty: BOOLEAN
|
||||||
-- Is empty object?
|
-- Is empty object?
|
||||||
do
|
do
|
||||||
Result := object.is_empty
|
Result := items.is_empty
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Visitor pattern
|
feature -- Visitor pattern
|
||||||
|
|
||||||
accept (a_visitor: JSON_VISITOR)
|
accept (a_visitor: JSON_VISITOR)
|
||||||
-- Accept `a_visitor'.
|
-- Accept `a_visitor'.
|
||||||
-- (Call `visit_json_object' procedure on `a_visitor'.)
|
-- (Call `visit_json_object' procedure on `a_visitor'.)
|
||||||
do
|
do
|
||||||
a_visitor.visit_json_object (Current)
|
a_visitor.visit_json_object (Current)
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Conversion
|
feature -- Conversion
|
||||||
|
|
||||||
map_representation: HASH_TABLE [JSON_VALUE, JSON_STRING]
|
map_representation: HASH_TABLE [JSON_VALUE, JSON_STRING]
|
||||||
--A representation that maps keys to values
|
-- A representation that maps keys to values
|
||||||
do
|
do
|
||||||
Result := object
|
Result := items
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Report
|
feature -- Report
|
||||||
|
|
||||||
hash_code: INTEGER
|
hash_code: INTEGER
|
||||||
-- Hash code value
|
-- Hash code value
|
||||||
do
|
do
|
||||||
from
|
from
|
||||||
object.start
|
items.start
|
||||||
Result := object.out.hash_code
|
Result := items.out.hash_code
|
||||||
until
|
until
|
||||||
object.off
|
items.off
|
||||||
loop
|
loop
|
||||||
Result := ((Result \\ 8388593) |<< 8) + object.item_for_iteration.hash_code
|
Result := ((Result \\ 8388593) |<< 8) + items.item_for_iteration.hash_code
|
||||||
object.forth
|
items.forth
|
||||||
end
|
end
|
||||||
-- Ensure it is a positive value.
|
-- Ensure it is a positive value.
|
||||||
Result := Result.hash_code
|
Result := Result.hash_code
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Status report
|
feature -- Status report
|
||||||
|
|
||||||
debug_output: STRING
|
debug_output: STRING
|
||||||
-- String that should be displayed in debugger to represent `Current'.
|
-- String that should be displayed in debugger to represent `Current'.
|
||||||
do
|
do
|
||||||
Result := object.count.out
|
Result := count.out + "item(s)"
|
||||||
end
|
end
|
||||||
|
|
||||||
feature {NONE} -- Implementation
|
feature {NONE} -- Implementation
|
||||||
|
|
||||||
object: HASH_TABLE [JSON_VALUE, JSON_STRING]
|
items: HASH_TABLE [JSON_VALUE, JSON_STRING]
|
||||||
-- Value container
|
-- Value container
|
||||||
|
|
||||||
invariant
|
invariant
|
||||||
object_not_null: object /= Void
|
items_not_void: items /= Void
|
||||||
|
|
||||||
|
note
|
||||||
|
copyright: "2010-2014, Javier Velilla and others https://github.com/eiffelhub/json."
|
||||||
|
license: "https://github.com/eiffelhub/json/blob/master/License.txt"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,329 +1,506 @@
|
|||||||
note
|
note
|
||||||
|
description: "[
|
||||||
description: "[
|
A JSON_STRING represent a string in JSON.
|
||||||
A JSON_STRING represent a string in JSON.
|
A string is a collection of zero or more Unicodes characters, wrapped in double
|
||||||
A string is a collection of zero or more Unicodes characters, wrapped in double
|
quotes, using blackslash espaces.
|
||||||
quotes, using blackslash espaces.
|
]"
|
||||||
]"
|
author: "$Author$"
|
||||||
|
date: "$Date$"
|
||||||
author: "Javier Velilla"
|
revision: "$Revision$"
|
||||||
date: "2008/08/24"
|
license: "MIT (see http://www.opensource.org/licenses/mit-license.php)"
|
||||||
revision: "Revision 0.1"
|
|
||||||
license:"MIT (see http://www.opensource.org/licenses/mit-license.php)"
|
class
|
||||||
|
JSON_STRING
|
||||||
|
|
||||||
class
|
inherit
|
||||||
JSON_STRING
|
|
||||||
|
JSON_VALUE
|
||||||
inherit
|
redefine
|
||||||
JSON_VALUE
|
is_equal
|
||||||
redefine
|
end
|
||||||
is_equal
|
|
||||||
end
|
create
|
||||||
|
make_from_string, make_from_string_32, make_from_string_general,
|
||||||
create
|
make_from_escaped_json_string,
|
||||||
make_json,
|
make_with_escaped_json, make_json, make_json_from_string_32
|
||||||
make_json_from_string_32,
|
|
||||||
make_with_escaped_json
|
convert
|
||||||
|
make_from_string ({READABLE_STRING_8, STRING_8, IMMUTABLE_STRING_8}),
|
||||||
convert
|
make_from_string_32 ({READABLE_STRING_32, STRING_32, IMMUTABLE_STRING_32}),
|
||||||
make_json ({READABLE_STRING_8, STRING_8, IMMUTABLE_STRING_8}),
|
make_from_string_general ({READABLE_STRING_GENERAL, STRING_GENERAL, IMMUTABLE_STRING_GENERAL})
|
||||||
make_json_from_string_32 ({READABLE_STRING_32, STRING_32, IMMUTABLE_STRING_32})
|
|
||||||
|
feature {NONE} -- Initialization
|
||||||
feature {NONE} -- Initialization
|
|
||||||
|
make_from_string (s: READABLE_STRING_8)
|
||||||
make_json (s: READABLE_STRING_8)
|
-- Initialize from ascii string `s'.
|
||||||
-- Initialize.
|
require
|
||||||
require
|
s_not_void: s /= Void
|
||||||
item_not_void: s /= Void
|
do
|
||||||
do
|
make_from_escaped_json_string (escaped_json_string (s))
|
||||||
make_with_escaped_json (escaped_json_string (s))
|
end
|
||||||
end
|
|
||||||
|
make_from_string_32 (s: READABLE_STRING_32)
|
||||||
make_json_from_string_32 (s: READABLE_STRING_32)
|
-- Initialize from unicode string `s'.
|
||||||
-- Initialize from STRING_32 `s'.
|
require
|
||||||
require
|
s_not_void: s /= Void
|
||||||
item_not_void: s /= Void
|
do
|
||||||
do
|
make_from_escaped_json_string (escaped_json_string (s))
|
||||||
make_with_escaped_json (escaped_json_string_32 (s))
|
end
|
||||||
end
|
|
||||||
|
make_from_string_general (s: READABLE_STRING_GENERAL)
|
||||||
make_with_escaped_json (s: READABLE_STRING_8)
|
-- Initialize from string `s'.
|
||||||
-- Initialize with an_item already escaped
|
require
|
||||||
require
|
s_not_void: s /= Void
|
||||||
item_not_void: s /= Void
|
do
|
||||||
do
|
if attached {READABLE_STRING_8} s as s8 then
|
||||||
item := s
|
make_from_string (s8)
|
||||||
end
|
else
|
||||||
|
make_from_string_32 (s.as_string_32)
|
||||||
feature -- Access
|
end
|
||||||
|
end
|
||||||
item: STRING
|
|
||||||
-- Contents with escaped entities if any
|
make_from_escaped_json_string (a_escaped_string: READABLE_STRING_8)
|
||||||
|
-- Initialize with `a_escaped_string' already JSON escaped.
|
||||||
unescaped_string_8: STRING_8
|
require
|
||||||
-- Unescaped string from `item'
|
a_escaped_string_not_void: a_escaped_string /= Void
|
||||||
local
|
do
|
||||||
s: like item
|
item := a_escaped_string
|
||||||
i, n: INTEGER
|
end
|
||||||
c: CHARACTER
|
|
||||||
do
|
make_with_escaped_json (a_escaped_string: READABLE_STRING_8)
|
||||||
s := item
|
-- Initialize with `a_escaped_string' already JSON escaped.
|
||||||
n := s.count
|
obsolete
|
||||||
create Result.make (n)
|
"Use `make_from_escaped_json_string' Sept/2014"
|
||||||
from i := 1 until i > n loop
|
require
|
||||||
c := s[i]
|
a_escaped_string_not_void: a_escaped_string /= Void
|
||||||
if c = '\' then
|
do
|
||||||
if i < n then
|
make_from_escaped_json_string (a_escaped_string)
|
||||||
inspect s[i+1]
|
end
|
||||||
when '\' then
|
|
||||||
Result.append_character ('\')
|
make_from_json_string (a_json: JSON_STRING)
|
||||||
i := i + 2
|
-- Initialize with `a_json' string value.
|
||||||
when '%"' then
|
do
|
||||||
Result.append_character ('%"')
|
make_from_escaped_json_string (a_json.item)
|
||||||
i := i + 2
|
end
|
||||||
when 'n' then
|
|
||||||
Result.append_character ('%N')
|
make_json (s: READABLE_STRING_8)
|
||||||
i := i + 2
|
-- Initialize.
|
||||||
when 'r' then
|
obsolete
|
||||||
Result.append_character ('%R')
|
"Use `make_from_string' Sept/2014"
|
||||||
i := i + 2
|
require
|
||||||
when 'u' then
|
item_not_void: s /= Void
|
||||||
--| Leave unicode \uXXXX unescaped
|
do
|
||||||
Result.append_character ('\')
|
make_with_escaped_json (escaped_json_string (s))
|
||||||
i := i + 1
|
end
|
||||||
else
|
|
||||||
Result.append_character ('\')
|
make_json_from_string_32 (s: READABLE_STRING_32)
|
||||||
i := i + 1
|
-- Initialize from STRING_32 `s'.
|
||||||
end
|
obsolete
|
||||||
else
|
"Use `make_from_string_32' Sept/2014"
|
||||||
Result.append_character ('\')
|
require
|
||||||
i := i + 1
|
item_not_void: s /= Void
|
||||||
end
|
do
|
||||||
else
|
make_with_escaped_json (escaped_json_string (s))
|
||||||
Result.append_character (c)
|
end
|
||||||
i := i + 1
|
|
||||||
end
|
feature -- Access
|
||||||
end
|
|
||||||
end
|
item: STRING
|
||||||
|
-- Contents with escaped entities if any
|
||||||
unescaped_string_32: STRING_32
|
|
||||||
-- Unescaped string 32 from `item'
|
feature -- Conversion
|
||||||
local
|
|
||||||
s: like item
|
unescaped_string_8: STRING_8
|
||||||
i, n: INTEGER
|
-- Unescaped ascii string from `item'.
|
||||||
c: CHARACTER
|
--| note: valid only if `item' does not encode any unicode character.
|
||||||
hex: STRING
|
local
|
||||||
do
|
s: like item
|
||||||
s := item
|
do
|
||||||
n := s.count
|
s := item
|
||||||
create Result.make (n)
|
create Result.make (s.count)
|
||||||
from i := 1 until i > n loop
|
unescape_to_string_8 (Result)
|
||||||
c := s[i]
|
end
|
||||||
if c = '\' then
|
|
||||||
if i < n then
|
unescaped_string_32: STRING_32
|
||||||
inspect s[i+1]
|
-- Unescaped uncode string from `item'
|
||||||
when '\' then
|
--| some encoders uses UTF-8 , and not the recommended pure json encoding
|
||||||
Result.append_character ('\')
|
--| thus, let's support the UTF-8 encoding during decoding.
|
||||||
i := i + 2
|
local
|
||||||
when '%"' then
|
s: READABLE_STRING_8
|
||||||
Result.append_character ('%"')
|
do
|
||||||
i := i + 2
|
s := item
|
||||||
when 'n' then
|
create Result.make (s.count)
|
||||||
Result.append_character ('%N')
|
unescape_to_string_32 (Result)
|
||||||
i := i + 2
|
end
|
||||||
when 'r' then
|
|
||||||
Result.append_character ('%R')
|
representation: STRING
|
||||||
i := i + 2
|
-- String representation of `item' with escaped entities if any.
|
||||||
when 'u' then
|
do
|
||||||
hex := s.substring (i+2, i+2+4 - 1)
|
create Result.make (item.count + 2)
|
||||||
if hex.count = 4 then
|
Result.append_character ('%"')
|
||||||
Result.append_code (hexadecimal_to_natural_32 (hex))
|
Result.append (item)
|
||||||
end
|
Result.append_character ('%"')
|
||||||
i := i + 2 + 4
|
end
|
||||||
else
|
|
||||||
Result.append_character ('\')
|
unescape_to_string_8 (a_output: STRING_8)
|
||||||
i := i + 1
|
-- Unescape string `item' into `a_output'.
|
||||||
end
|
--| note: valid only if `item' does not encode any unicode character.
|
||||||
else
|
local
|
||||||
Result.append_character ('\')
|
s: like item
|
||||||
i := i + 1
|
i, n: INTEGER
|
||||||
end
|
c: CHARACTER
|
||||||
else
|
do
|
||||||
Result.append_character (c.to_character_32)
|
s := item
|
||||||
i := i + 1
|
n := s.count
|
||||||
end
|
from
|
||||||
end
|
i := 1
|
||||||
end
|
until
|
||||||
|
i > n
|
||||||
representation: STRING
|
loop
|
||||||
-- String representation of `item' with escaped entities if any
|
c := s [i]
|
||||||
do
|
if c = '\' then
|
||||||
create Result.make (item.count + 2)
|
if i < n then
|
||||||
Result.append_character ('%"')
|
inspect s [i + 1]
|
||||||
Result.append (item)
|
when '%"' then
|
||||||
Result.append_character ('%"')
|
a_output.append_character ('%"')
|
||||||
end
|
i := i + 2
|
||||||
|
when '\' then
|
||||||
feature -- Visitor pattern
|
a_output.append_character ('\')
|
||||||
|
i := i + 2
|
||||||
accept (a_visitor: JSON_VISITOR)
|
when '/' then
|
||||||
-- Accept `a_visitor'.
|
a_output.append_character ('/')
|
||||||
-- (Call `visit_json_string' procedure on `a_visitor'.)
|
i := i + 2
|
||||||
do
|
when 'b' then
|
||||||
a_visitor.visit_json_string (Current)
|
a_output.append_character ('%B')
|
||||||
end
|
i := i + 2
|
||||||
|
when 'f' then
|
||||||
feature -- Comparison
|
a_output.append_character ('%F')
|
||||||
|
i := i + 2
|
||||||
is_equal (other: like Current): BOOLEAN
|
when 'n' then
|
||||||
-- Is JSON_STRING made of same character sequence as `other'
|
a_output.append_character ('%N')
|
||||||
-- (possibly with a different capacity)?
|
i := i + 2
|
||||||
do
|
when 'r' then
|
||||||
Result := item.same_string (other.item)
|
a_output.append_character ('%R')
|
||||||
end
|
i := i + 2
|
||||||
|
when 't' then
|
||||||
feature -- Change Element
|
a_output.append_character ('%T')
|
||||||
|
i := i + 2
|
||||||
append (a_string: STRING)
|
when 'u' then
|
||||||
-- Add a_string
|
--| Leave unicode \uXXXX unescaped
|
||||||
require
|
a_output.append_character (c) -- '\'
|
||||||
a_string_not_void: a_string /= Void
|
i := i + 1
|
||||||
do
|
else
|
||||||
item.append_string (a_string)
|
a_output.append_character (c) -- '\'
|
||||||
end
|
i := i + 1
|
||||||
|
end
|
||||||
feature -- Status report
|
else
|
||||||
|
a_output.append_character (c) -- '\'
|
||||||
hash_code: INTEGER
|
i := i + 1
|
||||||
-- Hash code value
|
end
|
||||||
do
|
else
|
||||||
Result := item.hash_code
|
a_output.append_character (c)
|
||||||
end
|
i := i + 1
|
||||||
|
end
|
||||||
feature -- Status report
|
end
|
||||||
|
end
|
||||||
debug_output: STRING
|
|
||||||
-- String that should be displayed in debugger to represent `Current'.
|
unescape_to_string_32 (a_output: STRING_32)
|
||||||
do
|
-- Unescape string `item' into `a_output' string 32.
|
||||||
Result := item
|
--| some encoders uses UTF-8 , and not the recommended pure json encoding
|
||||||
end
|
--| thus, let's support the UTF-8 encoding during decoding.
|
||||||
|
local
|
||||||
feature {NONE} -- Implementation
|
s: READABLE_STRING_8
|
||||||
|
i, n: INTEGER
|
||||||
is_hexadecimal (s: READABLE_STRING_8): BOOLEAN
|
c: NATURAL_32
|
||||||
-- Is `s' an hexadecimal value?
|
ch: CHARACTER_8
|
||||||
do
|
hex: READABLE_STRING_8
|
||||||
Result := across s as scur all scur.item.is_hexa_digit end
|
do
|
||||||
end
|
s := item
|
||||||
|
n := s.count
|
||||||
hexadecimal_to_natural_32 (s: READABLE_STRING_8): NATURAL_32
|
from
|
||||||
-- Hexadecimal string `s' converted to NATURAL_32 value
|
i := 1
|
||||||
require
|
until
|
||||||
s_not_void: s /= Void
|
i > n
|
||||||
is_hexadecimal: is_hexadecimal (s)
|
loop
|
||||||
local
|
ch := s.item (i)
|
||||||
i, nb: INTEGER
|
if ch = '\' then
|
||||||
char: CHARACTER
|
if i < n then
|
||||||
do
|
inspect s [i + 1]
|
||||||
nb := s.count
|
when '%"' then
|
||||||
|
a_output.append_character ('%"')
|
||||||
if nb >= 2 and then s.item (2) = 'x' then
|
i := i + 2
|
||||||
i := 3
|
when '\' then
|
||||||
else
|
a_output.append_character ('\')
|
||||||
i := 1
|
i := i + 2
|
||||||
end
|
when '/' then
|
||||||
|
a_output.append_character ('/')
|
||||||
from
|
i := i + 2
|
||||||
until
|
when 'b' then
|
||||||
i > nb
|
a_output.append_character ('%B')
|
||||||
loop
|
i := i + 2
|
||||||
Result := Result * 16
|
when 'f' then
|
||||||
char := s.item (i)
|
a_output.append_character ('%F')
|
||||||
if char >= '0' and then char <= '9' then
|
i := i + 2
|
||||||
Result := Result + (char |-| '0').to_natural_32
|
when 'n' then
|
||||||
else
|
a_output.append_character ('%N')
|
||||||
Result := Result + (char.lower |-| 'a' + 10).to_natural_32
|
i := i + 2
|
||||||
end
|
when 'r' then
|
||||||
i := i + 1
|
a_output.append_character ('%R')
|
||||||
end
|
i := i + 2
|
||||||
end
|
when 't' then
|
||||||
|
a_output.append_character ('%T')
|
||||||
escaped_json_string (s: READABLE_STRING_8): STRING_8
|
i := i + 2
|
||||||
-- JSON string with '"' and '\' characters escaped
|
when 'u' then
|
||||||
require
|
hex := s.substring (i + 2, i + 5) -- i+2 , i+2+4-1
|
||||||
s_not_void: s /= Void
|
if hex.count = 4 then
|
||||||
local
|
a_output.append_code (hexadecimal_to_natural_32 (hex))
|
||||||
i, n: INTEGER
|
end
|
||||||
c: CHARACTER_8
|
i := i + 6 -- i+2+4
|
||||||
do
|
else
|
||||||
n := s.count
|
a_output.append_character (ch) -- '\'
|
||||||
create Result.make (n + n // 10)
|
i := i + 1
|
||||||
from i := 1 until i > n loop
|
end
|
||||||
c := s.item (i)
|
else
|
||||||
inspect c
|
a_output.append_character (ch) -- '\'
|
||||||
when '%"' then Result.append_string ("\%"")
|
i := i + 1
|
||||||
when '\' then Result.append_string ("\\")
|
end
|
||||||
when '%R' then Result.append_string ("\r")
|
else
|
||||||
when '%N' then Result.append_string ("\n")
|
c := ch.natural_32_code
|
||||||
else
|
if c <= 0x7F then
|
||||||
Result.extend (c)
|
-- 0xxxxxxx
|
||||||
end
|
check
|
||||||
i := i + 1
|
ch = c.to_character_32
|
||||||
end
|
end
|
||||||
end
|
a_output.append_character (ch)
|
||||||
|
elseif c <= 0xDF then
|
||||||
escaped_json_string_32 (s: READABLE_STRING_32): STRING_8
|
-- 110xxxxx 10xxxxxx
|
||||||
-- JSON string with '"' and '\' characters and unicode escaped
|
i := i + 1
|
||||||
require
|
if i <= n then
|
||||||
s_not_void: s /= Void
|
a_output.append_code (((c & 0x1F) |<< 6) | (s.code (i) & 0x3F))
|
||||||
local
|
end
|
||||||
i, j, n: INTEGER
|
elseif c <= 0xEF then
|
||||||
uc: CHARACTER_32
|
-- 1110xxxx 10xxxxxx 10xxxxxx
|
||||||
c: CHARACTER_8
|
i := i + 2
|
||||||
h: STRING_8
|
if i <= n then
|
||||||
do
|
a_output.append_code (((c & 0xF) |<< 12) | ((s.code (i - 1) & 0x3F) |<< 6) | (s.code (i) & 0x3F))
|
||||||
n := s.count
|
end
|
||||||
create Result.make (n + n // 10)
|
elseif c <= 0xF7 then
|
||||||
from i := 1 until i > n loop
|
-- 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
|
||||||
uc := s.item (i)
|
i := i + 3
|
||||||
if uc.is_character_8 then
|
if i <= n then
|
||||||
c := uc.to_character_8
|
a_output.append_code (((c & 0x7) |<< 18) | ((s.code (i - 2) & 0x3F) |<< 12) | ((s.code (i - 1) & 0x3F) |<< 6) | (s.code (i) & 0x3F))
|
||||||
inspect c
|
end
|
||||||
when '%"' then Result.append_string ("\%"")
|
end
|
||||||
when '\' then Result.append_string ("\\")
|
i := i + 1
|
||||||
when '%R' then Result.append_string ("\r")
|
end
|
||||||
when '%N' then Result.append_string ("\n")
|
end
|
||||||
else
|
end
|
||||||
Result.extend (c)
|
|
||||||
end
|
feature -- Visitor pattern
|
||||||
else
|
|
||||||
Result.append ("\u")
|
accept (a_visitor: JSON_VISITOR)
|
||||||
h := uc.code.to_hex_string
|
-- Accept `a_visitor'.
|
||||||
-- Remove first 0 and keep 4 hexa digit
|
-- (Call `visit_json_string' procedure on `a_visitor'.)
|
||||||
from
|
do
|
||||||
j := 1
|
a_visitor.visit_json_string (Current)
|
||||||
until
|
end
|
||||||
h.count = 4 or (j <= h.count and then h.item (j) /= '0')
|
|
||||||
loop
|
feature -- Comparison
|
||||||
j := j + 1
|
|
||||||
end
|
is_equal (other: like Current): BOOLEAN
|
||||||
h := h.substring (j, h.count)
|
-- Is JSON_STRING made of same character sequence as `other'
|
||||||
|
-- (possibly with a different capacity)?
|
||||||
from
|
do
|
||||||
until
|
Result := item.same_string (other.item)
|
||||||
h.count >= 4
|
end
|
||||||
loop
|
|
||||||
h.prepend_integer (0)
|
feature -- Change Element
|
||||||
end
|
|
||||||
check h.count = 4 end
|
append (a_escaped_string: READABLE_STRING_8)
|
||||||
Result.append (h)
|
-- Add JSON escaped string `a_escaped_string'
|
||||||
end
|
require
|
||||||
i := i + 1
|
a_escaped_string_not_void: a_escaped_string /= Void
|
||||||
end
|
do
|
||||||
end
|
item.append_string (a_escaped_string)
|
||||||
|
end
|
||||||
invariant
|
|
||||||
item_not_void: item /= Void
|
append_json_string (a_json_string: JSON_STRING)
|
||||||
|
-- Add JSON string `a_json_string'
|
||||||
end
|
require
|
||||||
|
a_json_string_not_void: a_json_string /= Void
|
||||||
|
do
|
||||||
|
append (a_json_string.item)
|
||||||
|
end
|
||||||
|
|
||||||
|
append_string (s: READABLE_STRING_8)
|
||||||
|
-- Add ascii string `s'
|
||||||
|
require
|
||||||
|
s_not_void: s /= Void
|
||||||
|
do
|
||||||
|
append (escaped_json_string (s))
|
||||||
|
end
|
||||||
|
|
||||||
|
append_string_32 (s: READABLE_STRING_32)
|
||||||
|
-- Add unicode string `s'
|
||||||
|
require
|
||||||
|
s_not_void: s /= Void
|
||||||
|
do
|
||||||
|
append (escaped_json_string (s))
|
||||||
|
end
|
||||||
|
|
||||||
|
append_string_general (s: READABLE_STRING_GENERAL)
|
||||||
|
-- Add unicode string `s'
|
||||||
|
require
|
||||||
|
s_not_void: s /= Void
|
||||||
|
do
|
||||||
|
if attached {READABLE_STRING_8} s as s8 then
|
||||||
|
append_string (s.as_string_8)
|
||||||
|
else
|
||||||
|
append_string_32 (s.as_string_32)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Status report
|
||||||
|
|
||||||
|
hash_code: INTEGER
|
||||||
|
-- Hash code value
|
||||||
|
do
|
||||||
|
Result := item.hash_code
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Status report
|
||||||
|
|
||||||
|
debug_output: STRING
|
||||||
|
-- String that should be displayed in debugger to represent `Current'.
|
||||||
|
do
|
||||||
|
Result := item
|
||||||
|
end
|
||||||
|
|
||||||
|
feature {NONE} -- Implementation
|
||||||
|
|
||||||
|
is_hexadecimal (s: READABLE_STRING_8): BOOLEAN
|
||||||
|
-- Is `s' an hexadecimal value?
|
||||||
|
local
|
||||||
|
i: INTEGER
|
||||||
|
do
|
||||||
|
from
|
||||||
|
Result := True
|
||||||
|
i := 1
|
||||||
|
until
|
||||||
|
i > s.count or not Result
|
||||||
|
loop
|
||||||
|
Result := s [i].is_hexa_digit
|
||||||
|
i := i + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
hexadecimal_to_natural_32 (s: READABLE_STRING_8): NATURAL_32
|
||||||
|
-- Hexadecimal string `s' converted to NATURAL_32 value
|
||||||
|
require
|
||||||
|
s_not_void: s /= Void
|
||||||
|
is_hexadecimal: is_hexadecimal (s)
|
||||||
|
local
|
||||||
|
i, nb: INTEGER
|
||||||
|
char: CHARACTER
|
||||||
|
do
|
||||||
|
nb := s.count
|
||||||
|
if nb >= 2 and then s.item (2) = 'x' then
|
||||||
|
i := 3
|
||||||
|
else
|
||||||
|
i := 1
|
||||||
|
end
|
||||||
|
from
|
||||||
|
until
|
||||||
|
i > nb
|
||||||
|
loop
|
||||||
|
Result := Result * 16
|
||||||
|
char := s.item (i)
|
||||||
|
if char >= '0' and then char <= '9' then
|
||||||
|
Result := Result + (char |-| '0').to_natural_32
|
||||||
|
else
|
||||||
|
Result := Result + (char.lower |-| 'a' + 10).to_natural_32
|
||||||
|
end
|
||||||
|
i := i + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
escaped_json_string (s: READABLE_STRING_GENERAL): STRING_8
|
||||||
|
-- JSON string with '"' and '\' characters and unicode escaped
|
||||||
|
require
|
||||||
|
s_not_void: s /= Void
|
||||||
|
local
|
||||||
|
i, j, n: INTEGER
|
||||||
|
uc: CHARACTER_32
|
||||||
|
c: CHARACTER_8
|
||||||
|
h: STRING_8
|
||||||
|
do
|
||||||
|
n := s.count
|
||||||
|
create Result.make (n + n // 10)
|
||||||
|
from
|
||||||
|
i := 1
|
||||||
|
until
|
||||||
|
i > n
|
||||||
|
loop
|
||||||
|
uc := s.item (i)
|
||||||
|
if uc.is_character_8 then
|
||||||
|
c := uc.to_character_8
|
||||||
|
inspect c
|
||||||
|
when '%"' then
|
||||||
|
Result.append_string ("\%"")
|
||||||
|
when '\' then
|
||||||
|
Result.append_string ("\\")
|
||||||
|
when '/' then
|
||||||
|
-- To avoid issue with Javascript </script> ...
|
||||||
|
-- escape only </ to <\/
|
||||||
|
if s.valid_index (i - 1) and then s.item (i - 1) = '<' then
|
||||||
|
Result.append_string ("\/")
|
||||||
|
else
|
||||||
|
Result.append_string ("/")
|
||||||
|
end
|
||||||
|
when '%B' then
|
||||||
|
Result.append_string ("\b")
|
||||||
|
when '%F' then
|
||||||
|
Result.append_string ("\f")
|
||||||
|
when '%N' then
|
||||||
|
Result.append_string ("\n")
|
||||||
|
when '%R' then
|
||||||
|
Result.append_string ("\r")
|
||||||
|
when '%T' then
|
||||||
|
Result.append_string ("\t")
|
||||||
|
else
|
||||||
|
Result.extend (c)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result.append ("\u")
|
||||||
|
h := uc.code.to_hex_string
|
||||||
|
-- Remove first 0 and keep 4 hexa digit
|
||||||
|
from
|
||||||
|
j := 1
|
||||||
|
until
|
||||||
|
h.count = 4 or (j <= h.count and then h.item (j) /= '0')
|
||||||
|
loop
|
||||||
|
j := j + 1
|
||||||
|
end
|
||||||
|
h := h.substring (j, h.count)
|
||||||
|
from
|
||||||
|
until
|
||||||
|
h.count >= 4
|
||||||
|
loop
|
||||||
|
h.prepend_integer (0)
|
||||||
|
end
|
||||||
|
check
|
||||||
|
hexastring_has_4_chars: h.count = 4
|
||||||
|
end
|
||||||
|
Result.append (h)
|
||||||
|
end
|
||||||
|
i := i + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
invariant
|
||||||
|
item_not_void: item /= Void
|
||||||
|
|
||||||
|
note
|
||||||
|
copyright: "2010-2014, Javier Velilla and others https://github.com/eiffelhub/json."
|
||||||
|
license: "https://github.com/eiffelhub/json/blob/master/License.txt"
|
||||||
|
end
|
||||||
|
|||||||
@@ -1,43 +1,46 @@
|
|||||||
note
|
note
|
||||||
description:"[
|
description: "[
|
||||||
JSON_VALUE represent a value in JSON.
|
JSON_VALUE represent a value in JSON.
|
||||||
A value can be
|
A value can be
|
||||||
* a string in double quotes
|
* a string in double quotes
|
||||||
* a number
|
* a number
|
||||||
* boolean value(true, false )
|
* boolean value(true, false )
|
||||||
* null
|
* null
|
||||||
* an object
|
* an object
|
||||||
* an array
|
* an array
|
||||||
]"
|
]"
|
||||||
author: "Javier Velilla"
|
author: "Javier Velilla"
|
||||||
date: "2008/05/19"
|
date: "2008/05/19"
|
||||||
revision: "Revision 0.1"
|
revision: "Revision 0.1"
|
||||||
license:"MIT (see http://www.opensource.org/licenses/mit-license.php)"
|
license: "MIT (see http://www.opensource.org/licenses/mit-license.php)"
|
||||||
|
|
||||||
|
|
||||||
deferred class
|
deferred class
|
||||||
JSON_VALUE
|
JSON_VALUE
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
HASHABLE
|
|
||||||
|
|
||||||
DEBUG_OUTPUT
|
HASHABLE
|
||||||
|
|
||||||
|
DEBUG_OUTPUT
|
||||||
|
|
||||||
feature -- Access
|
feature -- Access
|
||||||
|
|
||||||
representation: STRING
|
representation: STRING
|
||||||
-- UTF-8 encoded Unicode string representation of Current
|
-- UTF-8 encoded Unicode string representation of Current
|
||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Visitor pattern
|
feature -- Visitor pattern
|
||||||
|
|
||||||
accept (a_visitor: JSON_VISITOR)
|
accept (a_visitor: JSON_VISITOR)
|
||||||
-- Accept `a_visitor'.
|
-- Accept `a_visitor'.
|
||||||
-- (Call `visit_*' procedure on `a_visitor'.)
|
-- (Call `visit_*' procedure on `a_visitor'.)
|
||||||
require
|
require
|
||||||
a_visitor_not_void: a_visitor /= Void
|
a_visitor_not_void: a_visitor /= Void
|
||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
|
note
|
||||||
|
copyright: "2010-2014, Javier Velilla and others https://github.com/eiffelhub/json."
|
||||||
|
license: "https://github.com/eiffelhub/json/blob/master/License.txt"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,513 +0,0 @@
|
|||||||
note
|
|
||||||
|
|
||||||
description: "Parse serialized JSON data"
|
|
||||||
author: "jvelilla"
|
|
||||||
date: "2008/08/24"
|
|
||||||
revision: "Revision 0.1"
|
|
||||||
|
|
||||||
class
|
|
||||||
JSON_PARSER
|
|
||||||
|
|
||||||
inherit
|
|
||||||
JSON_READER
|
|
||||||
JSON_TOKENS
|
|
||||||
|
|
||||||
create
|
|
||||||
make_parser
|
|
||||||
|
|
||||||
feature {NONE} -- Initialize
|
|
||||||
|
|
||||||
make_parser (a_json: STRING)
|
|
||||||
-- Initialize.
|
|
||||||
require
|
|
||||||
json_not_empty: a_json /= Void and then not a_json.is_empty
|
|
||||||
do
|
|
||||||
make (a_json)
|
|
||||||
is_parsed := True
|
|
||||||
create errors.make
|
|
||||||
end
|
|
||||||
|
|
||||||
feature -- Status report
|
|
||||||
|
|
||||||
is_parsed: BOOLEAN
|
|
||||||
-- Is parsed?
|
|
||||||
|
|
||||||
errors: LINKED_LIST [STRING]
|
|
||||||
-- Current errors
|
|
||||||
|
|
||||||
current_errors: STRING
|
|
||||||
-- Current errors as string
|
|
||||||
do
|
|
||||||
create Result.make_empty
|
|
||||||
from
|
|
||||||
errors.start
|
|
||||||
until
|
|
||||||
errors.after
|
|
||||||
loop
|
|
||||||
Result.append_string (errors.item + "%N")
|
|
||||||
errors.forth
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
feature -- Element change
|
|
||||||
|
|
||||||
report_error (e: STRING)
|
|
||||||
-- Report error `e'
|
|
||||||
require
|
|
||||||
e_not_void: e /= Void
|
|
||||||
do
|
|
||||||
errors.force (e)
|
|
||||||
end
|
|
||||||
|
|
||||||
feature -- Commands
|
|
||||||
|
|
||||||
parse_json: detachable JSON_VALUE
|
|
||||||
-- Parse JSON data `representation'
|
|
||||||
-- start ::= object | array
|
|
||||||
do
|
|
||||||
if is_valid_start_symbol then
|
|
||||||
Result := parse
|
|
||||||
if extra_elements then
|
|
||||||
is_parsed := False
|
|
||||||
end
|
|
||||||
else
|
|
||||||
is_parsed := False
|
|
||||||
report_error ("Syntax error unexpected token, expecting `{' or `['")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
parse: detachable JSON_VALUE
|
|
||||||
-- Parse JSON data `representation'
|
|
||||||
local
|
|
||||||
c: CHARACTER
|
|
||||||
do
|
|
||||||
if is_parsed then
|
|
||||||
skip_white_spaces
|
|
||||||
c := actual
|
|
||||||
inspect c
|
|
||||||
when j_OBJECT_OPEN then
|
|
||||||
Result := parse_object
|
|
||||||
when j_STRING then
|
|
||||||
Result := parse_string
|
|
||||||
when j_ARRAY_OPEN then
|
|
||||||
Result := parse_array
|
|
||||||
else
|
|
||||||
if c.is_digit or c = j_MINUS then
|
|
||||||
Result := parse_number
|
|
||||||
elseif is_null then
|
|
||||||
Result := create {JSON_NULL}
|
|
||||||
next
|
|
||||||
next
|
|
||||||
next
|
|
||||||
elseif is_true then
|
|
||||||
Result := create {JSON_BOOLEAN}.make_boolean (True)
|
|
||||||
next
|
|
||||||
next
|
|
||||||
next
|
|
||||||
elseif is_false then
|
|
||||||
Result := create {JSON_BOOLEAN}.make_boolean (False)
|
|
||||||
next
|
|
||||||
next
|
|
||||||
next
|
|
||||||
next
|
|
||||||
else
|
|
||||||
is_parsed := False
|
|
||||||
report_error ("JSON is not well formed in parse")
|
|
||||||
Result := Void
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
ensure
|
|
||||||
is_parsed_implies_result_not_void: is_parsed implies Result /= Void
|
|
||||||
end
|
|
||||||
|
|
||||||
parse_object: JSON_OBJECT
|
|
||||||
-- object
|
|
||||||
-- {}
|
|
||||||
-- {"key" : "value" [,]}
|
|
||||||
local
|
|
||||||
has_more: BOOLEAN
|
|
||||||
l_json_string: detachable JSON_STRING
|
|
||||||
l_value: detachable JSON_VALUE
|
|
||||||
do
|
|
||||||
create Result.make
|
|
||||||
-- check if is an empty object {}
|
|
||||||
next
|
|
||||||
skip_white_spaces
|
|
||||||
if actual = j_OBJECT_CLOSE then
|
|
||||||
--is an empty object
|
|
||||||
else
|
|
||||||
-- a complex object {"key" : "value"}
|
|
||||||
previous
|
|
||||||
from has_more := True until not has_more loop
|
|
||||||
next
|
|
||||||
skip_white_spaces
|
|
||||||
l_json_string := parse_string
|
|
||||||
next
|
|
||||||
skip_white_spaces
|
|
||||||
if actual = ':' then
|
|
||||||
next
|
|
||||||
skip_white_spaces
|
|
||||||
else
|
|
||||||
is_parsed := False
|
|
||||||
report_error ("%N Input string is a not well formed JSON, expected: : found: " + actual.out)
|
|
||||||
has_more := False
|
|
||||||
end
|
|
||||||
|
|
||||||
l_value := parse
|
|
||||||
if is_parsed and then (l_value /= Void and l_json_string /= Void) then
|
|
||||||
Result.put (l_value, l_json_string)
|
|
||||||
next
|
|
||||||
skip_white_spaces
|
|
||||||
if actual = j_OBJECT_CLOSE then
|
|
||||||
has_more := False
|
|
||||||
elseif actual /= ',' then
|
|
||||||
has_more := False
|
|
||||||
is_parsed := False
|
|
||||||
report_error ("JSON Object syntactically malformed expected , found: [" + actual.out + "]")
|
|
||||||
end
|
|
||||||
else
|
|
||||||
has_more := False
|
|
||||||
-- explain the error
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
parse_string: detachable JSON_STRING
|
|
||||||
-- Parsed string
|
|
||||||
local
|
|
||||||
has_more: BOOLEAN
|
|
||||||
l_json_string: STRING
|
|
||||||
l_unicode: STRING
|
|
||||||
c: like actual
|
|
||||||
do
|
|
||||||
create l_json_string.make_empty
|
|
||||||
if actual = j_STRING then
|
|
||||||
from
|
|
||||||
has_more := True
|
|
||||||
until
|
|
||||||
not has_more
|
|
||||||
loop
|
|
||||||
next
|
|
||||||
c := actual
|
|
||||||
if c = j_STRING then
|
|
||||||
has_more := False
|
|
||||||
elseif c = '%H' then
|
|
||||||
next
|
|
||||||
c := actual
|
|
||||||
if c = 'u' then
|
|
||||||
create l_unicode.make_from_string ("\u")
|
|
||||||
l_unicode.append (read_unicode)
|
|
||||||
c := actual
|
|
||||||
if is_valid_unicode (l_unicode) then
|
|
||||||
l_json_string.append (l_unicode)
|
|
||||||
else
|
|
||||||
has_more := False
|
|
||||||
is_parsed := False
|
|
||||||
report_error ("Input String is not well formed JSON, expected a Unicode value, found [" + c.out + " ]")
|
|
||||||
end
|
|
||||||
elseif (not is_special_character (c) and not is_special_control (c)) or c = '%N' then
|
|
||||||
has_more := False
|
|
||||||
is_parsed := False
|
|
||||||
report_error ("Input String is not well formed JSON, found [" + c.out + " ]")
|
|
||||||
else
|
|
||||||
l_json_string.append_character ('\')
|
|
||||||
l_json_string.append_character (c)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if is_special_character (c) and c /= '/' then
|
|
||||||
has_more := False
|
|
||||||
is_parsed := False
|
|
||||||
report_error ("Input String is not well formed JSON, found [" + c.out + " ]")
|
|
||||||
else
|
|
||||||
l_json_string.append_character (c)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
create Result.make_with_escaped_json (l_json_string)
|
|
||||||
else
|
|
||||||
Result := Void
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
parse_array: JSON_ARRAY
|
|
||||||
-- array
|
|
||||||
-- []
|
|
||||||
-- [elements [,]]
|
|
||||||
local
|
|
||||||
flag: BOOLEAN
|
|
||||||
l_value: detachable JSON_VALUE
|
|
||||||
c: like actual
|
|
||||||
do
|
|
||||||
create Result.make_array
|
|
||||||
--check if is an empty array []
|
|
||||||
next
|
|
||||||
skip_white_spaces
|
|
||||||
if actual = j_array_close then
|
|
||||||
--is an empty array
|
|
||||||
else
|
|
||||||
previous
|
|
||||||
from
|
|
||||||
flag := True
|
|
||||||
until
|
|
||||||
not flag
|
|
||||||
loop
|
|
||||||
next
|
|
||||||
skip_white_spaces
|
|
||||||
l_value := parse
|
|
||||||
if is_parsed and then l_value /= Void then
|
|
||||||
Result.add (l_value)
|
|
||||||
next
|
|
||||||
skip_white_spaces
|
|
||||||
c := actual
|
|
||||||
if c = j_ARRAY_CLOSE then
|
|
||||||
flag := False
|
|
||||||
elseif c /= ',' then
|
|
||||||
flag := False
|
|
||||||
is_parsed := False
|
|
||||||
report_error ("Array is not well formed JSON, found [" + c.out + " ]")
|
|
||||||
end
|
|
||||||
else
|
|
||||||
flag := False
|
|
||||||
report_error ("Array is not well formed JSON, found [" + actual.out + " ]")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
parse_number: detachable JSON_NUMBER
|
|
||||||
-- Parsed number
|
|
||||||
local
|
|
||||||
sb: STRING
|
|
||||||
flag: BOOLEAN
|
|
||||||
is_integer: BOOLEAN
|
|
||||||
c: like actual
|
|
||||||
do
|
|
||||||
create sb.make_empty
|
|
||||||
sb.append_character (actual)
|
|
||||||
|
|
||||||
from
|
|
||||||
flag := True
|
|
||||||
until
|
|
||||||
not flag
|
|
||||||
loop
|
|
||||||
next
|
|
||||||
c := actual
|
|
||||||
if not has_next or is_close_token (c)
|
|
||||||
or c = ',' or c = '%N' or c = '%R'
|
|
||||||
then
|
|
||||||
flag := False
|
|
||||||
previous
|
|
||||||
else
|
|
||||||
sb.append_character (c)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if is_valid_number (sb) then
|
|
||||||
if sb.is_integer then
|
|
||||||
create Result.make_integer (sb.to_integer)
|
|
||||||
is_integer := True
|
|
||||||
elseif sb.is_double and not is_integer then
|
|
||||||
create Result.make_real (sb.to_double)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
is_parsed := False
|
|
||||||
report_error ("Expected a number, found: [ " + sb + " ]")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
is_null: BOOLEAN
|
|
||||||
-- Word at index represents null?
|
|
||||||
local
|
|
||||||
l_null: STRING
|
|
||||||
l_string: STRING
|
|
||||||
do
|
|
||||||
l_null := null_id
|
|
||||||
l_string := json_substring (index,index + l_null.count - 1)
|
|
||||||
if l_string.is_equal (l_null) then
|
|
||||||
Result := True
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
is_false: BOOLEAN
|
|
||||||
-- Word at index represents false?
|
|
||||||
local
|
|
||||||
l_false: STRING
|
|
||||||
l_string: STRING
|
|
||||||
do
|
|
||||||
l_false := false_id
|
|
||||||
l_string := json_substring (index, index + l_false.count - 1)
|
|
||||||
if l_string.is_equal (l_false) then
|
|
||||||
Result := True
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
is_true: BOOLEAN
|
|
||||||
-- Word at index represents true?
|
|
||||||
local
|
|
||||||
l_true: STRING
|
|
||||||
l_string: STRING
|
|
||||||
do
|
|
||||||
l_true := true_id
|
|
||||||
l_string := json_substring (index,index + l_true.count - 1)
|
|
||||||
if l_string.is_equal (l_true) then
|
|
||||||
Result := True
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
read_unicode: STRING
|
|
||||||
-- Read unicode and return value
|
|
||||||
local
|
|
||||||
i: INTEGER
|
|
||||||
do
|
|
||||||
create Result.make_empty
|
|
||||||
from
|
|
||||||
i := 1
|
|
||||||
until
|
|
||||||
i > 4 or not has_next
|
|
||||||
loop
|
|
||||||
next
|
|
||||||
Result.append_character (actual)
|
|
||||||
i := i + 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
feature {NONE} -- Implementation
|
|
||||||
|
|
||||||
is_valid_number (a_number: STRING): BOOLEAN
|
|
||||||
-- is 'a_number' a valid number based on this regular expression
|
|
||||||
-- "-?(?: 0|[1-9]\d+)(?: \.\d+)?(?: [eE][+-]?\d+)?\b"?
|
|
||||||
local
|
|
||||||
s: detachable STRING
|
|
||||||
c: CHARACTER
|
|
||||||
i,n: INTEGER
|
|
||||||
do
|
|
||||||
create s.make_empty
|
|
||||||
n := a_number.count
|
|
||||||
if n = 0 then
|
|
||||||
Result := False
|
|
||||||
else
|
|
||||||
Result := True
|
|
||||||
i := 1
|
|
||||||
--| "-?"
|
|
||||||
c := a_number[i]
|
|
||||||
if c = '-' then
|
|
||||||
s.extend (c); i := i + 1; c := a_number[i]
|
|
||||||
end
|
|
||||||
--| "0|[1-9]\d*
|
|
||||||
if c.is_digit then
|
|
||||||
if c = '0' then
|
|
||||||
--| "0"
|
|
||||||
s.extend (c); i := i + 1; c := a_number[i]
|
|
||||||
else
|
|
||||||
--| "[1-9]"
|
|
||||||
s.extend (c); i := i + 1; c := a_number[i]
|
|
||||||
--| "\d*"
|
|
||||||
from until i > n or not c.is_digit loop
|
|
||||||
s.extend (c); i := i + 1; c := a_number[i]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if Result then
|
|
||||||
--| "(\.\d+)?"
|
|
||||||
if c = '.' then
|
|
||||||
--| "\.\d+" = "\.\d\d*"
|
|
||||||
s.extend (c); i := i + 1; c := a_number[i]
|
|
||||||
if c.is_digit then
|
|
||||||
from until i > n or not c.is_digit loop
|
|
||||||
s.extend (c); i := i + 1; c := a_number[i]
|
|
||||||
end
|
|
||||||
else
|
|
||||||
Result := False --| expecting digit
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if Result then --| "(?:[eE][+-]?\d+)?\b"
|
|
||||||
if c = 'e' or c = 'E' then
|
|
||||||
--| "[eE][+-]?\d+"
|
|
||||||
s.extend (c); i := i + 1; c := a_number[i]
|
|
||||||
if c = '+' or c = '-' then
|
|
||||||
s.extend (c); i := i + 1; c := a_number[i]
|
|
||||||
end
|
|
||||||
if c.is_digit then
|
|
||||||
from until i > n or not c.is_digit loop
|
|
||||||
s.extend (c); i := i + 1; c := a_number[i]
|
|
||||||
end
|
|
||||||
else
|
|
||||||
Result := False --| expecting digit
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if Result then --| "\b"
|
|
||||||
from until i > n or not c.is_space loop
|
|
||||||
s.extend (c); i := i + 1; c := a_number[i]
|
|
||||||
end
|
|
||||||
Result := i > n and then s.same_string (a_number)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
is_valid_unicode (a_unicode: STRING): BOOLEAN
|
|
||||||
-- is 'a_unicode' a valid unicode based on this regular expression
|
|
||||||
-- "\\u[0-9a-fA-F]{4}"
|
|
||||||
local
|
|
||||||
i: INTEGER
|
|
||||||
do
|
|
||||||
if
|
|
||||||
a_unicode.count = 6 and then
|
|
||||||
a_unicode[1] = '\' and then
|
|
||||||
a_unicode[2] = 'u'
|
|
||||||
then
|
|
||||||
from
|
|
||||||
Result := True
|
|
||||||
i := 3
|
|
||||||
until
|
|
||||||
i > 6 or Result = False
|
|
||||||
loop
|
|
||||||
inspect a_unicode[i]
|
|
||||||
when '0'..'9', 'a'..'f', 'A'..'F' then
|
|
||||||
else
|
|
||||||
Result := False
|
|
||||||
end
|
|
||||||
i := i + 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
extra_elements: BOOLEAN
|
|
||||||
-- has more elements?
|
|
||||||
local
|
|
||||||
c: like actual
|
|
||||||
do
|
|
||||||
if has_next then
|
|
||||||
next
|
|
||||||
end
|
|
||||||
from
|
|
||||||
c := actual
|
|
||||||
until
|
|
||||||
c /= ' ' or c /= '%R' or c /= '%U' or c /= '%T' or c /= '%N' or not has_next
|
|
||||||
loop
|
|
||||||
next
|
|
||||||
end
|
|
||||||
Result := has_next
|
|
||||||
end
|
|
||||||
|
|
||||||
is_valid_start_symbol : BOOLEAN
|
|
||||||
-- expecting `{' or `[' as start symbol
|
|
||||||
do
|
|
||||||
if attached representation as s and then s.count > 0 then
|
|
||||||
Result := s[1] = '{' or s[1] = '['
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
feature {NONE} -- Constants
|
|
||||||
|
|
||||||
false_id: STRING = "false"
|
|
||||||
|
|
||||||
true_id: STRING = "true"
|
|
||||||
|
|
||||||
null_id: STRING = "null"
|
|
||||||
|
|
||||||
|
|
||||||
end
|
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
note
|
|
||||||
description: ""
|
|
||||||
author: "jvelilla"
|
|
||||||
date: "2008/08/24"
|
|
||||||
revision: "0.1"
|
|
||||||
|
|
||||||
class
|
|
||||||
JSON_TOKENS
|
|
||||||
|
|
||||||
feature -- Access
|
|
||||||
|
|
||||||
j_OBJECT_OPEN: CHARACTER = '{'
|
|
||||||
j_ARRAY_OPEN: CHARACTER = '['
|
|
||||||
j_OBJECT_CLOSE: CHARACTER = '}'
|
|
||||||
j_ARRAY_CLOSE: CHARACTER = ']'
|
|
||||||
|
|
||||||
j_STRING: CHARACTER = '"'
|
|
||||||
j_PLUS: CHARACTER = '+'
|
|
||||||
j_MINUS: CHARACTER = '-'
|
|
||||||
j_DOT: CHARACTER = '.'
|
|
||||||
|
|
||||||
feature -- Status report
|
|
||||||
|
|
||||||
is_open_token (c: CHARACTER): BOOLEAN
|
|
||||||
-- Characters which open a type
|
|
||||||
do
|
|
||||||
inspect c
|
|
||||||
when j_OBJECT_OPEN, j_ARRAY_OPEN, j_STRING, j_PLUS, j_MINUS, j_DOT then
|
|
||||||
Result := True
|
|
||||||
else
|
|
||||||
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
is_close_token (c: CHARACTER): BOOLEAN
|
|
||||||
-- Characters which close a type
|
|
||||||
do
|
|
||||||
inspect c
|
|
||||||
when j_OBJECT_CLOSE, j_ARRAY_CLOSE, j_STRING then
|
|
||||||
Result := True
|
|
||||||
else
|
|
||||||
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
is_special_character (c: CHARACTER): BOOLEAN
|
|
||||||
-- Control Characters
|
|
||||||
-- %F Form feed
|
|
||||||
-- %H backslasH
|
|
||||||
-- %N Newline
|
|
||||||
-- %R carriage Return
|
|
||||||
-- %T horizontal Tab
|
|
||||||
-- %B Backspace
|
|
||||||
-- / Solidus
|
|
||||||
-- " Quotation
|
|
||||||
do
|
|
||||||
inspect c
|
|
||||||
when '%F', '%H', '%N', '%R', '%T', '%B', '/', '"' then
|
|
||||||
Result := True
|
|
||||||
else
|
|
||||||
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
is_special_control (c: CHARACTER): BOOLEAN
|
|
||||||
--Control Characters
|
|
||||||
-- \b\f\n\r\t
|
|
||||||
do
|
|
||||||
inspect c
|
|
||||||
when 'b', 'f', 'n', 'r', 't' then
|
|
||||||
Result := True
|
|
||||||
else
|
|
||||||
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
note
|
|
||||||
description: "[
|
|
||||||
Shared factory class for creating JSON objects. Maps JSON
|
|
||||||
objects to ELKS HASH_TABLEs and JSON arrays to ELKS
|
|
||||||
LINKED_LISTs. Use non-conforming inheritance from this
|
|
||||||
class to ensure that your classes share the same
|
|
||||||
JSON_FACTORY instance.
|
|
||||||
]"
|
|
||||||
author: "Paul Cohen"
|
|
||||||
date: "$Date$"
|
|
||||||
revision: "$Revision: 89185 $"
|
|
||||||
file: "$HeadURL: $"
|
|
||||||
|
|
||||||
class SHARED_EJSON
|
|
||||||
|
|
||||||
feature
|
|
||||||
|
|
||||||
json: EJSON
|
|
||||||
-- A shared EJSON instance with default converters for
|
|
||||||
--LINKED_LIST [ANY] and HASH_TABLE [ANY, HASHABLE]
|
|
||||||
local
|
|
||||||
jalc: JSON_ARRAYED_LIST_CONVERTER
|
|
||||||
jllc: JSON_LINKED_LIST_CONVERTER
|
|
||||||
jhtc: JSON_HASH_TABLE_CONVERTER
|
|
||||||
once
|
|
||||||
create Result
|
|
||||||
|
|
||||||
create jalc.make
|
|
||||||
Result.add_converter (jalc)
|
|
||||||
|
|
||||||
create jllc.make
|
|
||||||
Result.add_converter (jllc)
|
|
||||||
|
|
||||||
create jhtc.make
|
|
||||||
Result.add_converter (jhtc)
|
|
||||||
end
|
|
||||||
|
|
||||||
end -- class SHARED_EJSON
|
|
||||||
4
contrib/library/text/parser/json/library/license.lic
Normal file
4
contrib/library/text/parser/json/library/license.lic
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
${NOTE_KEYWORD}
|
||||||
|
copyright: "2010-${YEAR}, Javier Velilla and others https://github.com/eiffelhub/json."
|
||||||
|
license: "https://github.com/eiffelhub/json/blob/master/License.txt"
|
||||||
|
|
||||||
679
contrib/library/text/parser/json/library/parser/json_parser.e
Normal file
679
contrib/library/text/parser/json/library/parser/json_parser.e
Normal file
@@ -0,0 +1,679 @@
|
|||||||
|
note
|
||||||
|
description: "Parse serialized JSON data"
|
||||||
|
author: "$Author$"
|
||||||
|
date: "$Date$"
|
||||||
|
revision: "$Revision$"
|
||||||
|
|
||||||
|
class
|
||||||
|
JSON_PARSER
|
||||||
|
|
||||||
|
inherit
|
||||||
|
JSON_READER
|
||||||
|
rename
|
||||||
|
make as make_reader,
|
||||||
|
reset as reset_reader
|
||||||
|
end
|
||||||
|
|
||||||
|
JSON_TOKENS
|
||||||
|
|
||||||
|
create
|
||||||
|
make_with_string,
|
||||||
|
make_parser
|
||||||
|
|
||||||
|
feature {NONE} -- Initialize
|
||||||
|
|
||||||
|
make_with_string (a_content: STRING)
|
||||||
|
-- Initialize parser with JSON content `a_content'.
|
||||||
|
require
|
||||||
|
a_content_not_empty: a_content /= Void and then not a_content.is_empty
|
||||||
|
do
|
||||||
|
create errors.make
|
||||||
|
make_reader (a_content)
|
||||||
|
reset
|
||||||
|
end
|
||||||
|
|
||||||
|
make_parser (a_json: STRING)
|
||||||
|
-- Initialize.
|
||||||
|
obsolete
|
||||||
|
"Use `make_with_string' [sept/2014]."
|
||||||
|
do
|
||||||
|
make_with_string (a_json)
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Status report
|
||||||
|
|
||||||
|
is_parsed: BOOLEAN
|
||||||
|
-- Is parsed ?
|
||||||
|
|
||||||
|
is_valid: BOOLEAN
|
||||||
|
-- Is valid?
|
||||||
|
do
|
||||||
|
Result := not has_error
|
||||||
|
end
|
||||||
|
|
||||||
|
has_error: BOOLEAN
|
||||||
|
-- Has error?
|
||||||
|
|
||||||
|
errors: LINKED_LIST [STRING]
|
||||||
|
-- Current errors
|
||||||
|
|
||||||
|
errors_as_string: STRING
|
||||||
|
-- String representation of `errors'.
|
||||||
|
do
|
||||||
|
create Result.make_empty
|
||||||
|
across
|
||||||
|
errors as ic
|
||||||
|
loop
|
||||||
|
Result.append_string (ic.item)
|
||||||
|
Result.append_character ('%N')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
current_errors: STRING
|
||||||
|
-- Current errors as string
|
||||||
|
obsolete
|
||||||
|
"USe errors_as_string [sept/2014]"
|
||||||
|
do
|
||||||
|
Result := errors_as_string
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Access
|
||||||
|
|
||||||
|
parsed_json_value: detachable JSON_VALUE
|
||||||
|
-- Parsed json value if any.
|
||||||
|
require
|
||||||
|
is_parsed: is_parsed
|
||||||
|
attribute
|
||||||
|
ensure
|
||||||
|
attached_result_if_valid: is_valid implies Result /= Void
|
||||||
|
end
|
||||||
|
|
||||||
|
parsed_json_object: detachable JSON_OBJECT
|
||||||
|
-- parsed json value as a JSON_OBJECT if it is an object.
|
||||||
|
require
|
||||||
|
is_parsed: is_parsed
|
||||||
|
do
|
||||||
|
if attached {JSON_OBJECT} parsed_json_value as j_object then
|
||||||
|
Result := j_object
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
parsed_json_array: detachable JSON_ARRAY
|
||||||
|
-- parsed json value as a JSON_OBJECT if it is an array.
|
||||||
|
require
|
||||||
|
is_parsed: is_parsed
|
||||||
|
do
|
||||||
|
if attached {JSON_ARRAY} parsed_json_value as j_array then
|
||||||
|
Result := j_array
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Commands
|
||||||
|
|
||||||
|
reset
|
||||||
|
-- Reset parsing values.
|
||||||
|
do
|
||||||
|
parsed_json_value := Void
|
||||||
|
errors.wipe_out
|
||||||
|
has_error := False
|
||||||
|
is_parsed := False
|
||||||
|
end
|
||||||
|
|
||||||
|
parse_content
|
||||||
|
-- Parse JSON content `representation'.
|
||||||
|
-- start ::= object | array
|
||||||
|
do
|
||||||
|
reset
|
||||||
|
reset_reader
|
||||||
|
|
||||||
|
if is_valid_start_symbol then
|
||||||
|
parsed_json_value := next_json_value
|
||||||
|
if extra_elements then
|
||||||
|
report_error ("Remaining element outside the main json value!")
|
||||||
|
end
|
||||||
|
else
|
||||||
|
report_error ("Syntax error unexpected token, expecting `{' or `['")
|
||||||
|
end
|
||||||
|
is_parsed := is_valid
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
feature -- Element change
|
||||||
|
|
||||||
|
report_error (e: STRING)
|
||||||
|
-- Report error `e'
|
||||||
|
require
|
||||||
|
e_not_void: e /= Void
|
||||||
|
do
|
||||||
|
has_error := True
|
||||||
|
errors.force (e)
|
||||||
|
ensure
|
||||||
|
has_error: has_error
|
||||||
|
is_not_valid: not is_valid
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Obsolete commands
|
||||||
|
|
||||||
|
parse_json: detachable JSON_VALUE
|
||||||
|
-- Parse JSON data `representation'
|
||||||
|
-- start ::= object | array
|
||||||
|
obsolete
|
||||||
|
"Use `parse_content' and `parsed_json_value' [sept/2014]."
|
||||||
|
do
|
||||||
|
parse_content
|
||||||
|
if is_parsed then
|
||||||
|
Result := parsed_json_value
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
parse_object: detachable JSON_OBJECT
|
||||||
|
-- Parse JSON data `representation'
|
||||||
|
-- start ::= object | array
|
||||||
|
obsolete
|
||||||
|
"Use `parse_content' and `parsed_json_value' [nov/2014]."
|
||||||
|
do
|
||||||
|
parse_content
|
||||||
|
if is_parsed and then attached {JSON_OBJECT} parsed_json_value as jo then
|
||||||
|
Result := jo
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
parse: detachable JSON_VALUE
|
||||||
|
-- Next JSON value from current position on `representation'.
|
||||||
|
obsolete
|
||||||
|
"Use restricted `next_parsed_json_value' [sept/2014]."
|
||||||
|
do
|
||||||
|
Result := next_parsed_json_value
|
||||||
|
is_parsed := is_valid
|
||||||
|
end
|
||||||
|
|
||||||
|
feature {JSON_PARSER_ACCESS} -- Obsolete commands: restricted area
|
||||||
|
|
||||||
|
next_parsed_json_value: detachable JSON_VALUE
|
||||||
|
-- Return next json value from current position.
|
||||||
|
--| this does not call `reset_reader'.
|
||||||
|
do
|
||||||
|
reset
|
||||||
|
Result := next_json_value
|
||||||
|
end
|
||||||
|
|
||||||
|
feature {NONE} -- Implementation: parsing
|
||||||
|
|
||||||
|
next_json_value: detachable JSON_VALUE
|
||||||
|
-- Next JSON value from current position on `representation'.
|
||||||
|
local
|
||||||
|
c: CHARACTER
|
||||||
|
do
|
||||||
|
if not has_error then
|
||||||
|
skip_white_spaces
|
||||||
|
c := actual
|
||||||
|
inspect c
|
||||||
|
when token_object_open then
|
||||||
|
Result := next_json_object
|
||||||
|
when token_double_quote then
|
||||||
|
Result := parse_string
|
||||||
|
when token_array_open then
|
||||||
|
Result := parse_array
|
||||||
|
else
|
||||||
|
if c.is_digit or c = token_minus then
|
||||||
|
Result := parse_number
|
||||||
|
elseif is_null then
|
||||||
|
Result := create {JSON_NULL}
|
||||||
|
next
|
||||||
|
next
|
||||||
|
next
|
||||||
|
elseif is_true then
|
||||||
|
Result := create {JSON_BOOLEAN}.make_true
|
||||||
|
next
|
||||||
|
next
|
||||||
|
next
|
||||||
|
elseif is_false then
|
||||||
|
Result := create {JSON_BOOLEAN}.make_false
|
||||||
|
next
|
||||||
|
next
|
||||||
|
next
|
||||||
|
next
|
||||||
|
else
|
||||||
|
report_error ("JSON is not well formed in parse")
|
||||||
|
Result := Void
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
ensure
|
||||||
|
is_parsed_implies_result_not_void: not has_error implies Result /= Void
|
||||||
|
end
|
||||||
|
|
||||||
|
next_json_object: JSON_OBJECT
|
||||||
|
-- object
|
||||||
|
-- {}
|
||||||
|
-- {"key" : "value" [,]}
|
||||||
|
local
|
||||||
|
has_more: BOOLEAN
|
||||||
|
l_json_string: detachable JSON_STRING
|
||||||
|
l_value: detachable JSON_VALUE
|
||||||
|
do
|
||||||
|
create Result.make
|
||||||
|
--| check if is an empty object {}
|
||||||
|
next
|
||||||
|
skip_white_spaces
|
||||||
|
if actual = token_object_close then
|
||||||
|
--| is an empty object
|
||||||
|
else
|
||||||
|
--| a complex object {"key" : "value"}
|
||||||
|
previous
|
||||||
|
from
|
||||||
|
has_more := True
|
||||||
|
until
|
||||||
|
not has_more
|
||||||
|
loop
|
||||||
|
next
|
||||||
|
skip_white_spaces
|
||||||
|
l_json_string := parse_string
|
||||||
|
next
|
||||||
|
skip_white_spaces
|
||||||
|
if actual = token_colon then --| token_colon = ':'
|
||||||
|
next
|
||||||
|
skip_white_spaces
|
||||||
|
else
|
||||||
|
report_error ("%N Input string is a not well formed JSON, expected: : found: " + actual.out)
|
||||||
|
has_more := False
|
||||||
|
end
|
||||||
|
l_value := next_json_value
|
||||||
|
if not has_error and then (l_value /= Void and l_json_string /= Void) then
|
||||||
|
Result.put (l_value, l_json_string)
|
||||||
|
next
|
||||||
|
skip_white_spaces
|
||||||
|
if actual = token_object_close then
|
||||||
|
has_more := False
|
||||||
|
elseif actual /= token_comma then
|
||||||
|
has_more := False
|
||||||
|
report_error ("JSON Object syntactically malformed expected , found: [" + actual.out + "]")
|
||||||
|
end
|
||||||
|
else
|
||||||
|
has_more := False
|
||||||
|
-- explain the error
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
parse_string: detachable JSON_STRING
|
||||||
|
-- Parsed string
|
||||||
|
local
|
||||||
|
has_more: BOOLEAN
|
||||||
|
l_json_string: STRING
|
||||||
|
l_unicode: STRING
|
||||||
|
c: like actual
|
||||||
|
do
|
||||||
|
create l_json_string.make_empty
|
||||||
|
if actual = token_double_quote then
|
||||||
|
from
|
||||||
|
has_more := True
|
||||||
|
until
|
||||||
|
not has_more
|
||||||
|
loop
|
||||||
|
next
|
||||||
|
c := actual
|
||||||
|
if c = token_double_quote then
|
||||||
|
has_more := False
|
||||||
|
elseif c = '%H' then -- '%H' = '\' = reverse solidus
|
||||||
|
next
|
||||||
|
c := actual
|
||||||
|
if c = 'u' then
|
||||||
|
create l_unicode.make_from_string ("\u")
|
||||||
|
l_unicode.append (read_unicode)
|
||||||
|
c := actual
|
||||||
|
if is_valid_unicode (l_unicode) then
|
||||||
|
l_json_string.append (l_unicode)
|
||||||
|
else
|
||||||
|
has_more := False
|
||||||
|
report_error ("Input String is not well formed JSON, expected a Unicode value, found [" + c.out + " ]")
|
||||||
|
end
|
||||||
|
elseif (not is_special_character (c) and not is_special_control (c)) or c = '%N' then
|
||||||
|
has_more := False
|
||||||
|
report_error ("Input String is not well formed JSON, found [" + c.out + " ]")
|
||||||
|
else
|
||||||
|
l_json_string.append_character ('\')
|
||||||
|
l_json_string.append_character (c)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if is_special_character (c) and c /= '/' then
|
||||||
|
has_more := False
|
||||||
|
report_error ("Input String is not well formed JSON, found [" + c.out + " ]")
|
||||||
|
else
|
||||||
|
l_json_string.append_character (c)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
create Result.make_from_escaped_json_string (l_json_string)
|
||||||
|
else
|
||||||
|
Result := Void
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
parse_array: JSON_ARRAY
|
||||||
|
-- array
|
||||||
|
-- []
|
||||||
|
-- [elements [,]]
|
||||||
|
local
|
||||||
|
flag: BOOLEAN
|
||||||
|
l_value: detachable JSON_VALUE
|
||||||
|
c: like actual
|
||||||
|
do
|
||||||
|
create Result.make_empty
|
||||||
|
-- check if is an empty array []
|
||||||
|
next
|
||||||
|
skip_white_spaces
|
||||||
|
if actual = token_array_close then
|
||||||
|
-- is an empty array
|
||||||
|
else
|
||||||
|
previous
|
||||||
|
from
|
||||||
|
flag := True
|
||||||
|
until
|
||||||
|
not flag
|
||||||
|
loop
|
||||||
|
next
|
||||||
|
skip_white_spaces
|
||||||
|
l_value := next_json_value
|
||||||
|
if not has_error and then l_value /= Void then
|
||||||
|
Result.add (l_value)
|
||||||
|
next
|
||||||
|
skip_white_spaces
|
||||||
|
c := actual
|
||||||
|
if c = token_array_close then
|
||||||
|
flag := False
|
||||||
|
elseif c /= token_comma then
|
||||||
|
flag := False
|
||||||
|
report_error ("Array is not well formed JSON, found [" + c.out + " ]")
|
||||||
|
end
|
||||||
|
else
|
||||||
|
flag := False
|
||||||
|
report_error ("Array is not well formed JSON, found [" + actual.out + " ]")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
parse_number: detachable JSON_NUMBER
|
||||||
|
-- Parsed number
|
||||||
|
local
|
||||||
|
sb: STRING
|
||||||
|
flag: BOOLEAN
|
||||||
|
is_integer: BOOLEAN
|
||||||
|
c: like actual
|
||||||
|
do
|
||||||
|
create sb.make_empty
|
||||||
|
sb.append_character (actual)
|
||||||
|
from
|
||||||
|
flag := True
|
||||||
|
until
|
||||||
|
not flag
|
||||||
|
loop
|
||||||
|
next
|
||||||
|
c := actual
|
||||||
|
if not has_next or is_close_token (c) or c = token_comma or c = '%N' or c = '%R' then
|
||||||
|
flag := False
|
||||||
|
previous
|
||||||
|
else
|
||||||
|
sb.append_character (c)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if is_valid_number (sb) then
|
||||||
|
if sb.is_integer then
|
||||||
|
create Result.make_integer (sb.to_integer)
|
||||||
|
is_integer := True
|
||||||
|
elseif sb.is_double and not is_integer then
|
||||||
|
create Result.make_real (sb.to_double)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
report_error ("Expected a number, found: [ " + sb + " ]")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
is_null: BOOLEAN
|
||||||
|
-- Word at index represents null?
|
||||||
|
local
|
||||||
|
l_null: STRING
|
||||||
|
l_string: STRING
|
||||||
|
do
|
||||||
|
l_null := null_id
|
||||||
|
l_string := json_substring (index, index + l_null.count - 1)
|
||||||
|
if l_string.is_equal (l_null) then
|
||||||
|
Result := True
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
is_false: BOOLEAN
|
||||||
|
-- Word at index represents false?
|
||||||
|
local
|
||||||
|
l_false: STRING
|
||||||
|
l_string: STRING
|
||||||
|
do
|
||||||
|
l_false := false_id
|
||||||
|
l_string := json_substring (index, index + l_false.count - 1)
|
||||||
|
if l_string.is_equal (l_false) then
|
||||||
|
Result := True
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
is_true: BOOLEAN
|
||||||
|
-- Word at index represents true?
|
||||||
|
local
|
||||||
|
l_true: STRING
|
||||||
|
l_string: STRING
|
||||||
|
do
|
||||||
|
l_true := true_id
|
||||||
|
l_string := json_substring (index, index + l_true.count - 1)
|
||||||
|
if l_string.is_equal (l_true) then
|
||||||
|
Result := True
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
read_unicode: STRING
|
||||||
|
-- Read unicode and return value.
|
||||||
|
local
|
||||||
|
i: INTEGER
|
||||||
|
do
|
||||||
|
create Result.make_empty
|
||||||
|
from
|
||||||
|
i := 1
|
||||||
|
until
|
||||||
|
i > 4 or not has_next
|
||||||
|
loop
|
||||||
|
next
|
||||||
|
Result.append_character (actual)
|
||||||
|
i := i + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
feature {NONE} -- Implementation
|
||||||
|
|
||||||
|
is_valid_number (a_number: STRING): BOOLEAN
|
||||||
|
-- is 'a_number' a valid number based on this regular expression
|
||||||
|
-- "-?(?: 0|[1-9]\d+)(?: \.\d+)?(?: [eE][+-]?\d+)?\b"?
|
||||||
|
local
|
||||||
|
s: detachable STRING
|
||||||
|
c: CHARACTER
|
||||||
|
i, n: INTEGER
|
||||||
|
do
|
||||||
|
create s.make_empty
|
||||||
|
n := a_number.count
|
||||||
|
if n = 0 then
|
||||||
|
Result := False
|
||||||
|
else
|
||||||
|
Result := True
|
||||||
|
i := 1
|
||||||
|
--| "-?"
|
||||||
|
c := a_number [i]
|
||||||
|
if c = token_minus then
|
||||||
|
s.extend (c)
|
||||||
|
i := i + 1
|
||||||
|
if i > n then
|
||||||
|
Result := False
|
||||||
|
else
|
||||||
|
c := a_number [i]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
--| "0|[1-9]\d*
|
||||||
|
if Result and c.is_digit then
|
||||||
|
if c = '0' then
|
||||||
|
--| "0"
|
||||||
|
s.extend (c)
|
||||||
|
i := i + 1
|
||||||
|
if i <= n then
|
||||||
|
c := a_number [i]
|
||||||
|
end
|
||||||
|
else
|
||||||
|
--| "[1-9]"
|
||||||
|
s.extend (c)
|
||||||
|
|
||||||
|
--| "\d*"
|
||||||
|
i := i + 1
|
||||||
|
if i <= n then
|
||||||
|
c := a_number [i]
|
||||||
|
from
|
||||||
|
until
|
||||||
|
i > n or not c.is_digit
|
||||||
|
loop
|
||||||
|
s.extend (c)
|
||||||
|
i := i + 1
|
||||||
|
if i <= n then
|
||||||
|
c := a_number [i]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if i > n then
|
||||||
|
-- Exit
|
||||||
|
else
|
||||||
|
if Result then
|
||||||
|
--| "(\.\d+)?"
|
||||||
|
if c = token_dot then
|
||||||
|
--| "\.\d+" = "\.\d\d*"
|
||||||
|
s.extend (c)
|
||||||
|
i := i + 1
|
||||||
|
c := a_number [i]
|
||||||
|
if c.is_digit then
|
||||||
|
from
|
||||||
|
until
|
||||||
|
i > n or not c.is_digit
|
||||||
|
loop
|
||||||
|
s.extend (c)
|
||||||
|
i := i + 1
|
||||||
|
if i <= n then
|
||||||
|
c := a_number [i]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := False --| expecting digit
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if Result then --| "(?:[eE][+-]?\d+)?\b"
|
||||||
|
if is_exp_token (c) then
|
||||||
|
--| "[eE][+-]?\d+"
|
||||||
|
s.extend (c)
|
||||||
|
i := i + 1
|
||||||
|
c := a_number [i]
|
||||||
|
if c = token_plus or c = token_minus then
|
||||||
|
s.extend (c)
|
||||||
|
i := i + 1
|
||||||
|
if i <= n then
|
||||||
|
c := a_number [i]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if c.is_digit then
|
||||||
|
from
|
||||||
|
until
|
||||||
|
i > n or not c.is_digit
|
||||||
|
loop
|
||||||
|
s.extend (c)
|
||||||
|
i := i + 1
|
||||||
|
if i <= n then
|
||||||
|
c := a_number [i]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := False --| expecting digit
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if Result then --| "\b"
|
||||||
|
from
|
||||||
|
until
|
||||||
|
i > n or not c.is_space
|
||||||
|
loop
|
||||||
|
s.extend (c)
|
||||||
|
i := i + 1
|
||||||
|
if i <= n then
|
||||||
|
c := a_number [i]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
Result := i > n and then s.same_string (a_number)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
is_valid_unicode (a_unicode: STRING): BOOLEAN
|
||||||
|
-- is 'a_unicode' a valid unicode based on the regular expression "\\u[0-9a-fA-F]{4}" .
|
||||||
|
local
|
||||||
|
i: INTEGER
|
||||||
|
do
|
||||||
|
if a_unicode.count = 6 and then a_unicode [1] = '\' and then a_unicode [2] = 'u' then
|
||||||
|
from
|
||||||
|
Result := True
|
||||||
|
i := 3
|
||||||
|
until
|
||||||
|
i > 6 or Result = False
|
||||||
|
loop
|
||||||
|
inspect a_unicode [i]
|
||||||
|
when '0'..'9', 'a'..'f', 'A'..'F' then
|
||||||
|
else
|
||||||
|
Result := False
|
||||||
|
end
|
||||||
|
i := i + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
extra_elements: BOOLEAN
|
||||||
|
-- has more elements?
|
||||||
|
local
|
||||||
|
c: like actual
|
||||||
|
do
|
||||||
|
if has_next then
|
||||||
|
next
|
||||||
|
end
|
||||||
|
from
|
||||||
|
c := actual
|
||||||
|
until
|
||||||
|
c /= ' ' or c /= '%R' or c /= '%U' or c /= '%T' or c /= '%N' or not has_next
|
||||||
|
loop
|
||||||
|
next
|
||||||
|
end
|
||||||
|
Result := has_next
|
||||||
|
end
|
||||||
|
|
||||||
|
is_valid_start_symbol: BOOLEAN
|
||||||
|
-- expecting `{' or `[' as start symbol
|
||||||
|
do
|
||||||
|
if attached representation as s and then s.count > 0 then
|
||||||
|
Result := s [1] = token_object_open or s [1] = token_array_open
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
feature {NONE} -- Constants
|
||||||
|
|
||||||
|
false_id: STRING = "false"
|
||||||
|
|
||||||
|
true_id: STRING = "true"
|
||||||
|
|
||||||
|
null_id: STRING = "null"
|
||||||
|
|
||||||
|
note
|
||||||
|
copyright: "2010-2015, Javier Velilla and others https://github.com/eiffelhub/json."
|
||||||
|
license: "https://github.com/eiffelhub/json/blob/master/License.txt"
|
||||||
|
end
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
note
|
||||||
|
description: "Inherit to access restricted feature from {JSON_PARSER}."
|
||||||
|
date: "$Date$"
|
||||||
|
revision: "$Revision$"
|
||||||
|
|
||||||
|
deferred class
|
||||||
|
JSON_PARSER_ACCESS
|
||||||
|
|
||||||
|
note
|
||||||
|
copyright: "2010-2014, Javier Velilla and others https://github.com/eiffelhub/json."
|
||||||
|
license: "https://github.com/eiffelhub/json/blob/master/License.txt"
|
||||||
|
end
|
||||||
@@ -1,118 +1,127 @@
|
|||||||
note
|
note
|
||||||
description: "Objects that ..."
|
description: "Objects that ..."
|
||||||
author: "jvelilla"
|
author: "jvelilla"
|
||||||
date: "2008/08/24"
|
date: "2008/08/24"
|
||||||
revision: "0.1"
|
revision: "0.1"
|
||||||
|
|
||||||
class
|
class
|
||||||
JSON_READER
|
JSON_READER
|
||||||
|
|
||||||
create
|
create
|
||||||
make
|
make
|
||||||
|
|
||||||
feature {NONE} -- Initialization
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
make (a_json: STRING)
|
make (a_json: STRING)
|
||||||
-- Initialize Reader
|
-- Initialize Reader
|
||||||
do
|
do
|
||||||
set_representation (a_json)
|
set_representation (a_json)
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Commands
|
feature -- Commands
|
||||||
|
|
||||||
set_representation (a_json: STRING)
|
reset
|
||||||
-- Set `representation'.
|
-- Reset reader
|
||||||
do
|
do
|
||||||
a_json.left_adjust
|
index := 1
|
||||||
a_json.right_adjust
|
end
|
||||||
representation := a_json
|
|
||||||
index := 1
|
set_representation (a_json: STRING)
|
||||||
end
|
-- Set `representation'.
|
||||||
|
do
|
||||||
read: CHARACTER
|
a_json.left_adjust
|
||||||
-- Read character
|
a_json.right_adjust
|
||||||
do
|
representation := a_json
|
||||||
if not representation.is_empty then
|
reset
|
||||||
Result := representation.item (index)
|
end
|
||||||
end
|
|
||||||
end
|
read: CHARACTER
|
||||||
|
-- Read character
|
||||||
next
|
do
|
||||||
-- Move to next index
|
if not representation.is_empty then
|
||||||
require
|
Result := representation.item (index)
|
||||||
has_more_elements: has_next
|
end
|
||||||
do
|
end
|
||||||
index := index + 1
|
|
||||||
ensure
|
next
|
||||||
incremented: old index + 1 = index
|
-- Move to next index
|
||||||
end
|
require
|
||||||
|
has_more_elements: has_next
|
||||||
previous
|
do
|
||||||
-- Move to previous index
|
index := index + 1
|
||||||
require
|
ensure
|
||||||
not_is_first: has_previous
|
incremented: old index + 1 = index
|
||||||
do
|
end
|
||||||
index := index - 1
|
|
||||||
ensure
|
previous
|
||||||
incremented: old index - 1 = index
|
-- Move to previous index
|
||||||
end
|
require
|
||||||
|
not_is_first: has_previous
|
||||||
skip_white_spaces
|
do
|
||||||
-- Remove white spaces
|
index := index - 1
|
||||||
local
|
ensure
|
||||||
c: like actual
|
incremented: old index - 1 = index
|
||||||
do
|
end
|
||||||
from
|
|
||||||
c := actual
|
skip_white_spaces
|
||||||
until
|
-- Remove white spaces
|
||||||
(c /= ' ' and c /= '%N' and c /= '%R' and c /= '%U' and c /= '%T' ) or not has_next
|
local
|
||||||
loop
|
c: like actual
|
||||||
next
|
do
|
||||||
c := actual
|
from
|
||||||
end
|
c := actual
|
||||||
end
|
until
|
||||||
|
(c /= ' ' and c /= '%N' and c /= '%R' and c /= '%U' and c /= '%T') or not has_next
|
||||||
json_substring (start_index, end_index: INTEGER_32): STRING
|
loop
|
||||||
-- JSON representation between `start_index' and `end_index'
|
next
|
||||||
do
|
c := actual
|
||||||
Result := representation.substring (start_index, end_index)
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Status report
|
json_substring (start_index, end_index: INTEGER_32): STRING
|
||||||
|
-- JSON representation between `start_index' and `end_index'
|
||||||
has_next: BOOLEAN
|
do
|
||||||
-- Has a next character?
|
Result := representation.substring (start_index, end_index)
|
||||||
do
|
end
|
||||||
Result := index <= representation.count
|
|
||||||
end
|
feature -- Status report
|
||||||
|
|
||||||
has_previous: BOOLEAN
|
has_next: BOOLEAN
|
||||||
-- Has a previous character?
|
-- Has a next character?
|
||||||
do
|
do
|
||||||
Result := index >= 1
|
Result := index <= representation.count
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Access
|
has_previous: BOOLEAN
|
||||||
|
-- Has a previous character?
|
||||||
representation: STRING
|
do
|
||||||
-- Serialized representation of the original JSON string
|
Result := index >= 1
|
||||||
|
end
|
||||||
feature {NONE} -- Implementation
|
|
||||||
|
feature -- Access
|
||||||
actual: CHARACTER
|
|
||||||
-- Current character or '%U' if none
|
representation: STRING
|
||||||
do
|
-- Serialized representation of the original JSON string
|
||||||
if index > representation.count then
|
|
||||||
Result := '%U'
|
feature {NONE} -- Implementation
|
||||||
else
|
|
||||||
Result := representation.item (index)
|
actual: CHARACTER
|
||||||
end
|
-- Current character or '%U' if none
|
||||||
end
|
do
|
||||||
|
if index > representation.count then
|
||||||
index: INTEGER
|
Result := '%U'
|
||||||
-- Actual index
|
else
|
||||||
|
Result := representation.item (index)
|
||||||
invariant
|
end
|
||||||
representation_not_void: representation /= Void
|
end
|
||||||
|
|
||||||
end
|
index: INTEGER
|
||||||
|
-- Actual index
|
||||||
|
|
||||||
|
invariant
|
||||||
|
representation_not_void: representation /= Void
|
||||||
|
|
||||||
|
note
|
||||||
|
copyright: "2010-2014, Javier Velilla and others https://github.com/eiffelhub/json."
|
||||||
|
license: "https://github.com/eiffelhub/json/blob/master/License.txt"
|
||||||
|
end
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
note
|
||||||
|
description: "Token used by the JSON_PARSER"
|
||||||
|
author: "$Author$"
|
||||||
|
date: "$Date$"
|
||||||
|
revision: "$Revision$"
|
||||||
|
|
||||||
|
class
|
||||||
|
JSON_TOKENS
|
||||||
|
|
||||||
|
feature -- Access
|
||||||
|
|
||||||
|
token_object_open: CHARACTER = '{'
|
||||||
|
token_object_close: CHARACTER = '}'
|
||||||
|
|
||||||
|
token_array_open: CHARACTER = '['
|
||||||
|
token_array_close: CHARACTER = ']'
|
||||||
|
|
||||||
|
token_double_quote: CHARACTER = '"'
|
||||||
|
token_plus: CHARACTER = '+'
|
||||||
|
token_minus: CHARACTER = '-'
|
||||||
|
token_dot: CHARACTER = '.'
|
||||||
|
token_exp: CHARACTER = 'e'
|
||||||
|
token_comma: CHARACTER = ','
|
||||||
|
token_colon: CHARACTER = ':'
|
||||||
|
|
||||||
|
feature -- Status report
|
||||||
|
|
||||||
|
is_open_token (c: CHARACTER): BOOLEAN
|
||||||
|
-- Characters which open a type
|
||||||
|
do
|
||||||
|
inspect c
|
||||||
|
when token_object_open, token_array_open, token_double_quote, token_plus, token_minus, token_dot then
|
||||||
|
Result := True
|
||||||
|
else
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
is_close_token (c: CHARACTER): BOOLEAN
|
||||||
|
-- Characters which close a type
|
||||||
|
do
|
||||||
|
inspect c
|
||||||
|
when token_object_close, token_array_close, token_double_quote then
|
||||||
|
Result := True
|
||||||
|
else
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
is_special_character (c: CHARACTER): BOOLEAN
|
||||||
|
-- Control Characters
|
||||||
|
-- %F Form feed
|
||||||
|
-- %H backslasH
|
||||||
|
-- %N Newline
|
||||||
|
-- %R carriage Return
|
||||||
|
-- %T horizontal Tab
|
||||||
|
-- %B Backspace
|
||||||
|
-- / Solidus
|
||||||
|
-- " Quotation
|
||||||
|
do
|
||||||
|
inspect c
|
||||||
|
when '"', '%H' , '/', '%B', '%F', '%N', '%R', '%T' then -- '%H' = '\' = reverse solidus
|
||||||
|
Result := True
|
||||||
|
else
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
is_special_control (c: CHARACTER): BOOLEAN
|
||||||
|
-- Control Characters
|
||||||
|
-- \b\f\n\r\t
|
||||||
|
do
|
||||||
|
inspect c
|
||||||
|
when 'b', 'f', 'n', 'r', 't' then
|
||||||
|
Result := True
|
||||||
|
else
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
is_exp_token (c: CHARACTER): BOOLEAN
|
||||||
|
-- Is number exposant token?
|
||||||
|
do
|
||||||
|
Result := c = token_exp or else c.as_lower = token_exp
|
||||||
|
end
|
||||||
|
|
||||||
|
note
|
||||||
|
copyright: "2010-2014, Javier Velilla and others https://github.com/eiffelhub/json."
|
||||||
|
license: "https://github.com/eiffelhub/json/blob/master/License.txt"
|
||||||
|
end
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
note
|
||||||
|
description: "Objects that ..."
|
||||||
|
author: ""
|
||||||
|
date: "$Date$"
|
||||||
|
revision: "$Revision$"
|
||||||
|
|
||||||
|
class
|
||||||
|
JSON_FILE_READER
|
||||||
|
|
||||||
|
feature -- Access
|
||||||
|
|
||||||
|
read_json_from (a_path: READABLE_STRING_GENERAL): detachable STRING
|
||||||
|
local
|
||||||
|
l_file: PLAIN_TEXT_FILE
|
||||||
|
l_last_string: detachable STRING
|
||||||
|
l_file_count: INTEGER
|
||||||
|
l_fetch_done: BOOLEAN
|
||||||
|
do
|
||||||
|
create l_file.make_with_name (a_path)
|
||||||
|
-- We perform several checks until we make a real attempt to open the file.
|
||||||
|
if not l_file.exists then
|
||||||
|
print ("error: '" + a_path.out + "' does not exist%N") -- FIXME: unicode may be truncated
|
||||||
|
else
|
||||||
|
if not l_file.is_readable then
|
||||||
|
print ("error: '" + a_path.out + "' is not readable.%N") -- FIXME: unicode may be truncated
|
||||||
|
else
|
||||||
|
l_file_count := l_file.count
|
||||||
|
l_file.open_read
|
||||||
|
from
|
||||||
|
create Result.make (l_file_count)
|
||||||
|
until
|
||||||
|
l_fetch_done
|
||||||
|
loop
|
||||||
|
l_file.read_stream (1_024)
|
||||||
|
l_last_string := l_file.last_string
|
||||||
|
l_fetch_done := l_file.exhausted or l_file.end_of_file or l_last_string.count < 1_024
|
||||||
|
if not l_last_string.is_empty then
|
||||||
|
Result.append (l_last_string)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
l_file.close
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
note
|
||||||
|
copyright: "2010-2014, Javier Velilla and others https://github.com/eiffelhub/json."
|
||||||
|
license: "https://github.com/eiffelhub/json/blob/master/License.txt"
|
||||||
|
end
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
note
|
||||||
|
description: "JSON Iterator"
|
||||||
|
pattern: "Iterator visitor"
|
||||||
|
author: "Jocelyn Fiat"
|
||||||
|
license: "MIT (see http://www.opensource.org/licenses/mit-license.php)"
|
||||||
|
date: "2013/08/01"
|
||||||
|
revision: "Revision 0.1"
|
||||||
|
|
||||||
|
deferred class
|
||||||
|
JSON_ITERATOR
|
||||||
|
|
||||||
|
inherit
|
||||||
|
|
||||||
|
JSON_VISITOR
|
||||||
|
|
||||||
|
feature -- Visitor Pattern
|
||||||
|
|
||||||
|
visit_json_array (a_json_array: JSON_ARRAY)
|
||||||
|
-- Visit `a_json_array'.
|
||||||
|
do
|
||||||
|
across
|
||||||
|
a_json_array as c
|
||||||
|
loop
|
||||||
|
c.item.accept (Current)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
visit_json_boolean (a_json_boolean: JSON_BOOLEAN)
|
||||||
|
-- Visit `a_json_boolean'.
|
||||||
|
do
|
||||||
|
end
|
||||||
|
|
||||||
|
visit_json_null (a_json_null: JSON_NULL)
|
||||||
|
-- Visit `a_json_null'.
|
||||||
|
do
|
||||||
|
end
|
||||||
|
|
||||||
|
visit_json_number (a_json_number: JSON_NUMBER)
|
||||||
|
-- Visit `a_json_number'.
|
||||||
|
do
|
||||||
|
end
|
||||||
|
|
||||||
|
visit_json_object (a_json_object: JSON_OBJECT)
|
||||||
|
-- Visit `a_json_object'.
|
||||||
|
do
|
||||||
|
across
|
||||||
|
a_json_object as c
|
||||||
|
loop
|
||||||
|
c.item.accept (Current)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
visit_json_string (a_json_string: JSON_STRING)
|
||||||
|
-- Visit `a_json_string'.
|
||||||
|
do
|
||||||
|
end
|
||||||
|
|
||||||
|
note
|
||||||
|
copyright: "2010-2014, Javier Velilla and others https://github.com/eiffelhub/json."
|
||||||
|
license: "https://github.com/eiffelhub/json/blob/master/License.txt"
|
||||||
|
end
|
||||||
@@ -6,6 +6,7 @@ class
|
|||||||
JSON_PRETTY_STRING_VISITOR
|
JSON_PRETTY_STRING_VISITOR
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
|
|
||||||
JSON_VISITOR
|
JSON_VISITOR
|
||||||
|
|
||||||
create
|
create
|
||||||
@@ -26,21 +27,58 @@ feature -- Initialization
|
|||||||
output := a_output
|
output := a_output
|
||||||
create indentation.make_empty
|
create indentation.make_empty
|
||||||
indentation_step := "%T"
|
indentation_step := "%T"
|
||||||
|
|
||||||
object_count_inlining := a_object_count_inlining
|
object_count_inlining := a_object_count_inlining
|
||||||
array_count_inlining := a_array_count_inlining
|
array_count_inlining := a_array_count_inlining
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Access
|
feature -- Access
|
||||||
|
|
||||||
output: STRING_32
|
output: STRING_GENERAL
|
||||||
-- JSON representation
|
-- JSON representation
|
||||||
|
|
||||||
indentation: like output
|
feature -- Settings
|
||||||
|
|
||||||
indentation_step: like indentation
|
indentation_step: STRING
|
||||||
|
-- Text used for indentation.
|
||||||
|
--| by default a tabulation "%T"
|
||||||
|
|
||||||
line_number: INTEGER
|
object_count_inlining: INTEGER
|
||||||
|
-- Inline where object item count is under `object_count_inlining'.
|
||||||
|
--| ex 3:
|
||||||
|
--| { "a", "b", "c" }
|
||||||
|
--| ex 2:
|
||||||
|
--| {
|
||||||
|
--| "a",
|
||||||
|
--| "b",
|
||||||
|
--| "c"
|
||||||
|
--| }
|
||||||
|
|
||||||
|
array_count_inlining: INTEGER
|
||||||
|
-- Inline where array item count is under `object_count_inlining'.
|
||||||
|
|
||||||
|
feature -- Element change
|
||||||
|
|
||||||
|
set_indentation_step (a_step: STRING)
|
||||||
|
-- Set `indentation_step' to `a_step'.
|
||||||
|
do
|
||||||
|
indentation_step := a_step
|
||||||
|
end
|
||||||
|
|
||||||
|
set_object_count_inlining (a_nb: INTEGER)
|
||||||
|
-- Set `object_count_inlining' to `a_nb'.
|
||||||
|
do
|
||||||
|
object_count_inlining := a_nb
|
||||||
|
end
|
||||||
|
|
||||||
|
set_array_count_inlining (a_nb: INTEGER)
|
||||||
|
-- Set `array_count_inlining' to `a_nb'.
|
||||||
|
do
|
||||||
|
array_count_inlining := a_nb
|
||||||
|
end
|
||||||
|
|
||||||
|
feature {NONE} -- Implementation
|
||||||
|
|
||||||
|
indentation: STRING
|
||||||
|
|
||||||
indent
|
indent
|
||||||
do
|
do
|
||||||
@@ -59,8 +97,7 @@ feature -- Access
|
|||||||
line_number := line_number + 1
|
line_number := line_number + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
object_count_inlining: INTEGER
|
line_number: INTEGER
|
||||||
array_count_inlining: INTEGER
|
|
||||||
|
|
||||||
feature -- Visitor Pattern
|
feature -- Visitor Pattern
|
||||||
|
|
||||||
@@ -71,10 +108,14 @@ feature -- Visitor Pattern
|
|||||||
l_json_array: ARRAYED_LIST [JSON_VALUE]
|
l_json_array: ARRAYED_LIST [JSON_VALUE]
|
||||||
l_line: like line_number
|
l_line: like line_number
|
||||||
l_multiple_lines: BOOLEAN
|
l_multiple_lines: BOOLEAN
|
||||||
|
l_output: like output
|
||||||
do
|
do
|
||||||
|
l_output := output
|
||||||
l_json_array := a_json_array.array_representation
|
l_json_array := a_json_array.array_representation
|
||||||
l_multiple_lines := l_json_array.count >= array_count_inlining or across l_json_array as p some attached {JSON_OBJECT} p.item or attached {JSON_ARRAY} p.item end
|
l_multiple_lines := l_json_array.count >= array_count_inlining
|
||||||
output.append ("[")
|
or across l_json_array as p some attached {JSON_OBJECT} p.item or attached {JSON_ARRAY} p.item end
|
||||||
|
l_output.append_code (91) -- '[' : 91
|
||||||
|
|
||||||
l_line := line_number
|
l_line := line_number
|
||||||
indent
|
indent
|
||||||
from
|
from
|
||||||
@@ -82,27 +123,21 @@ feature -- Visitor Pattern
|
|||||||
until
|
until
|
||||||
l_json_array.off
|
l_json_array.off
|
||||||
loop
|
loop
|
||||||
if
|
if line_number > l_line or l_multiple_lines then
|
||||||
line_number > l_line or
|
|
||||||
l_multiple_lines
|
|
||||||
then
|
|
||||||
new_line
|
new_line
|
||||||
end
|
end
|
||||||
value := l_json_array.item
|
value := l_json_array.item
|
||||||
value.accept (Current)
|
value.accept (Current)
|
||||||
l_json_array.forth
|
l_json_array.forth
|
||||||
if not l_json_array.after then
|
if not l_json_array.after then
|
||||||
output.append (", ")
|
l_output.append (", ")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
exdent
|
exdent
|
||||||
if
|
if line_number > l_line or l_json_array.count >= array_count_inlining then
|
||||||
line_number > l_line or
|
|
||||||
l_json_array.count >= array_count_inlining
|
|
||||||
then
|
|
||||||
new_line
|
new_line
|
||||||
end
|
end
|
||||||
output.append ("]")
|
l_output.append_code (93) -- ']' : 93
|
||||||
end
|
end
|
||||||
|
|
||||||
visit_json_boolean (a_json_boolean: JSON_BOOLEAN)
|
visit_json_boolean (a_json_boolean: JSON_BOOLEAN)
|
||||||
@@ -129,10 +164,12 @@ feature -- Visitor Pattern
|
|||||||
l_pairs: HASH_TABLE [JSON_VALUE, JSON_STRING]
|
l_pairs: HASH_TABLE [JSON_VALUE, JSON_STRING]
|
||||||
l_line: like line_number
|
l_line: like line_number
|
||||||
l_multiple_lines: BOOLEAN
|
l_multiple_lines: BOOLEAN
|
||||||
|
l_output: like output
|
||||||
do
|
do
|
||||||
|
l_output := output
|
||||||
l_pairs := a_json_object.map_representation
|
l_pairs := a_json_object.map_representation
|
||||||
l_multiple_lines := l_pairs.count >= object_count_inlining or across l_pairs as p some attached {JSON_OBJECT} p.item or attached {JSON_ARRAY} p.item end
|
l_multiple_lines := l_pairs.count >= object_count_inlining or across l_pairs as p some attached {JSON_OBJECT} p.item or attached {JSON_ARRAY} p.item end
|
||||||
output.append ("{")
|
l_output.append_code (123) -- '{' : 123
|
||||||
l_line := line_number
|
l_line := line_number
|
||||||
indent
|
indent
|
||||||
from
|
from
|
||||||
@@ -140,36 +177,36 @@ feature -- Visitor Pattern
|
|||||||
until
|
until
|
||||||
l_pairs.off
|
l_pairs.off
|
||||||
loop
|
loop
|
||||||
if
|
if line_number > l_line or l_multiple_lines then
|
||||||
line_number > l_line or
|
|
||||||
l_multiple_lines
|
|
||||||
then
|
|
||||||
new_line
|
new_line
|
||||||
end
|
end
|
||||||
l_pairs.key_for_iteration.accept (Current)
|
l_pairs.key_for_iteration.accept (Current)
|
||||||
output.append (": ")
|
l_output.append (": ")
|
||||||
l_pairs.item_for_iteration.accept (Current)
|
l_pairs.item_for_iteration.accept (Current)
|
||||||
l_pairs.forth
|
l_pairs.forth
|
||||||
if not l_pairs.after then
|
if not l_pairs.after then
|
||||||
output.append (", ")
|
l_output.append (", ")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
exdent
|
exdent
|
||||||
if
|
if line_number > l_line or l_pairs.count >= object_count_inlining then
|
||||||
line_number > l_line or
|
|
||||||
l_pairs.count >= object_count_inlining
|
|
||||||
then
|
|
||||||
new_line
|
new_line
|
||||||
end
|
end
|
||||||
output.append ("}")
|
l_output.append_code (125) -- '}' : 125
|
||||||
end
|
end
|
||||||
|
|
||||||
visit_json_string (a_json_string: JSON_STRING)
|
visit_json_string (a_json_string: JSON_STRING)
|
||||||
-- Visit `a_json_string'.
|
-- Visit `a_json_string'.
|
||||||
|
local
|
||||||
|
l_output: like output
|
||||||
do
|
do
|
||||||
output.append ("%"")
|
l_output := output
|
||||||
output.append (a_json_string.item)
|
l_output.append_code (34) -- '%"' : 34
|
||||||
output.append ("%"")
|
l_output.append (a_json_string.item)
|
||||||
|
l_output.append_code (34) -- '%"' : 34
|
||||||
end
|
end
|
||||||
|
|
||||||
|
note
|
||||||
|
copyright: "2010-2014, Javier Velilla and others https://github.com/eiffelhub/json."
|
||||||
|
license: "https://github.com/eiffelhub/json/blob/master/License.txt"
|
||||||
end
|
end
|
||||||
@@ -1,59 +1,59 @@
|
|||||||
note
|
note
|
||||||
description:
|
description: "JSON Visitor"
|
||||||
|
pattern: "Visitor"
|
||||||
"JSON Visitor"
|
author: "Javier Velilla"
|
||||||
|
license: "MIT (see http://www.opensource.org/licenses/mit-license.php)"
|
||||||
pattern: "Visitor"
|
date: "2008/08/24"
|
||||||
author: "Javier Velilla"
|
revision: "Revision 0.1"
|
||||||
license:"MIT (see http://www.opensource.org/licenses/mit-license.php)"
|
|
||||||
date: "2008/08/24"
|
deferred class
|
||||||
revision: "Revision 0.1"
|
JSON_VISITOR
|
||||||
|
|
||||||
deferred class
|
feature -- Visitor Pattern
|
||||||
JSON_VISITOR
|
|
||||||
|
visit_json_array (a_json_array: JSON_ARRAY)
|
||||||
feature -- Visitor Pattern
|
-- Visit `a_json_array'.
|
||||||
|
require
|
||||||
visit_json_array (a_json_array: JSON_ARRAY)
|
a_json_array_not_void: a_json_array /= Void
|
||||||
-- Visit `a_json_array'.
|
deferred
|
||||||
require
|
end
|
||||||
a_json_array_not_void: a_json_array /= Void
|
|
||||||
deferred
|
visit_json_boolean (a_json_boolean: JSON_BOOLEAN)
|
||||||
end
|
-- Visit `a_json_boolean'.
|
||||||
|
require
|
||||||
visit_json_boolean (a_json_boolean: JSON_BOOLEAN)
|
a_json_boolean_not_void: a_json_boolean /= Void
|
||||||
-- Visit `a_json_boolean'.
|
deferred
|
||||||
require
|
end
|
||||||
a_json_boolean_not_void: a_json_boolean /= Void
|
|
||||||
deferred
|
visit_json_null (a_json_null: JSON_NULL)
|
||||||
end
|
-- Visit `a_json_null'.
|
||||||
|
require
|
||||||
visit_json_null (a_json_null: JSON_NULL)
|
a_json_null_not_void: a_json_null /= Void
|
||||||
-- Visit `a_json_null'.
|
deferred
|
||||||
require
|
end
|
||||||
a_json_null_not_void: a_json_null /= Void
|
|
||||||
deferred
|
visit_json_number (a_json_number: JSON_NUMBER)
|
||||||
end
|
-- Visit `a_json_number'.
|
||||||
|
require
|
||||||
visit_json_number (a_json_number: JSON_NUMBER)
|
a_json_number_not_void: a_json_number /= Void
|
||||||
-- Visit `a_json_number'.
|
deferred
|
||||||
require
|
end
|
||||||
a_json_number_not_void: a_json_number /= Void
|
|
||||||
deferred
|
visit_json_object (a_json_object: JSON_OBJECT)
|
||||||
end
|
-- Visit `a_json_object'.
|
||||||
|
require
|
||||||
visit_json_object (a_json_object: JSON_OBJECT)
|
a_json_object_not_void: a_json_object /= Void
|
||||||
-- Visit `a_json_object'.
|
deferred
|
||||||
require
|
end
|
||||||
a_json_object_not_void: a_json_object /= Void
|
|
||||||
deferred
|
visit_json_string (a_json_string: JSON_STRING)
|
||||||
end
|
-- Visit `a_json_string'.
|
||||||
|
require
|
||||||
visit_json_string (a_json_string: JSON_STRING)
|
a_json_string_not_void: a_json_string /= Void
|
||||||
-- Visit `a_json_string'.
|
deferred
|
||||||
require
|
end
|
||||||
a_json_string_not_void: a_json_string /= Void
|
|
||||||
deferred
|
note
|
||||||
end
|
copyright: "2010-2014, Javier Velilla and others https://github.com/eiffelhub/json."
|
||||||
|
license: "https://github.com/eiffelhub/json/blob/master/License.txt"
|
||||||
end
|
end
|
||||||
@@ -1,102 +1,107 @@
|
|||||||
note
|
note
|
||||||
description: "PRINT_JSON_VISITOR Generates the JSON-String for a JSON_VALUE"
|
description: "PRINT_JSON_VISITOR Generates the JSON-String for a JSON_VALUE"
|
||||||
author: "jvelilla"
|
author: "jvelilla"
|
||||||
date: "2008/08/24"
|
date: "2008/08/24"
|
||||||
revision: "0.1"
|
revision: "0.1"
|
||||||
|
|
||||||
class
|
class
|
||||||
PRINT_JSON_VISITOR
|
PRINT_JSON_VISITOR
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
JSON_VISITOR
|
|
||||||
|
JSON_VISITOR
|
||||||
create make
|
|
||||||
|
create
|
||||||
feature -- Initialization
|
make
|
||||||
|
|
||||||
make
|
feature -- Initialization
|
||||||
-- Create a new instance
|
|
||||||
do
|
make
|
||||||
create to_json.make_empty
|
-- Create a new instance
|
||||||
end
|
do
|
||||||
|
create to_json.make_empty
|
||||||
feature -- Access
|
end
|
||||||
|
|
||||||
to_json: STRING
|
feature -- Access
|
||||||
-- JSON representation
|
|
||||||
|
to_json: STRING
|
||||||
feature -- Visitor Pattern
|
-- JSON representation
|
||||||
|
|
||||||
visit_json_array (a_json_array: JSON_ARRAY)
|
feature -- Visitor Pattern
|
||||||
-- Visit `a_json_array'.
|
|
||||||
local
|
visit_json_array (a_json_array: JSON_ARRAY)
|
||||||
value: JSON_VALUE
|
-- Visit `a_json_array'.
|
||||||
l_json_array: ARRAYED_LIST [JSON_VALUE]
|
local
|
||||||
do
|
value: JSON_VALUE
|
||||||
l_json_array:=a_json_array.array_representation
|
l_json_array: ARRAYED_LIST [JSON_VALUE]
|
||||||
to_json.append ("[")
|
do
|
||||||
from
|
l_json_array := a_json_array.array_representation
|
||||||
l_json_array.start
|
to_json.append ("[")
|
||||||
until
|
from
|
||||||
l_json_array.off
|
l_json_array.start
|
||||||
loop
|
until
|
||||||
value := l_json_array.item
|
l_json_array.off
|
||||||
value.accept (Current)
|
loop
|
||||||
l_json_array.forth
|
value := l_json_array.item
|
||||||
if not l_json_array.after then
|
value.accept (Current)
|
||||||
to_json.append(",")
|
l_json_array.forth
|
||||||
end
|
if not l_json_array.after then
|
||||||
end
|
to_json.append (",")
|
||||||
to_json.append ("]")
|
end
|
||||||
end
|
end
|
||||||
|
to_json.append ("]")
|
||||||
visit_json_boolean (a_json_boolean: JSON_BOOLEAN)
|
end
|
||||||
-- Visit `a_json_boolean'.
|
|
||||||
do
|
visit_json_boolean (a_json_boolean: JSON_BOOLEAN)
|
||||||
to_json.append (a_json_boolean.item.out)
|
-- Visit `a_json_boolean'.
|
||||||
end
|
do
|
||||||
|
to_json.append (a_json_boolean.item.out)
|
||||||
visit_json_null (a_json_null: JSON_NULL)
|
end
|
||||||
-- Visit `a_json_null'.
|
|
||||||
do
|
visit_json_null (a_json_null: JSON_NULL)
|
||||||
to_json.append ("null")
|
-- Visit `a_json_null'.
|
||||||
end
|
do
|
||||||
|
to_json.append ("null")
|
||||||
visit_json_number (a_json_number: JSON_NUMBER)
|
end
|
||||||
-- Visit `a_json_number'.
|
|
||||||
do
|
visit_json_number (a_json_number: JSON_NUMBER)
|
||||||
to_json.append (a_json_number.item)
|
-- Visit `a_json_number'.
|
||||||
end
|
do
|
||||||
|
to_json.append (a_json_number.item)
|
||||||
visit_json_object (a_json_object: JSON_OBJECT)
|
end
|
||||||
-- Visit `a_json_object'.
|
|
||||||
local
|
visit_json_object (a_json_object: JSON_OBJECT)
|
||||||
l_pairs: HASH_TABLE[JSON_VALUE,JSON_STRING]
|
-- Visit `a_json_object'.
|
||||||
do
|
local
|
||||||
l_pairs := a_json_object.map_representation
|
l_pairs: HASH_TABLE [JSON_VALUE, JSON_STRING]
|
||||||
to_json.append ("{")
|
do
|
||||||
from
|
l_pairs := a_json_object.map_representation
|
||||||
l_pairs.start
|
to_json.append ("{")
|
||||||
until
|
from
|
||||||
l_pairs.off
|
l_pairs.start
|
||||||
loop
|
until
|
||||||
l_pairs.key_for_iteration.accept (Current)
|
l_pairs.off
|
||||||
to_json.append (":")
|
loop
|
||||||
l_pairs.item_for_iteration.accept (Current)
|
l_pairs.key_for_iteration.accept (Current)
|
||||||
l_pairs.forth
|
to_json.append (":")
|
||||||
if not l_pairs.after then
|
l_pairs.item_for_iteration.accept (Current)
|
||||||
to_json.append (",")
|
l_pairs.forth
|
||||||
end
|
if not l_pairs.after then
|
||||||
end
|
to_json.append (",")
|
||||||
to_json.append ("}")
|
end
|
||||||
end
|
end
|
||||||
|
to_json.append ("}")
|
||||||
visit_json_string (a_json_string: JSON_STRING)
|
end
|
||||||
-- Visit `a_json_string'.
|
|
||||||
do
|
visit_json_string (a_json_string: JSON_STRING)
|
||||||
to_json.append ("%"")
|
-- Visit `a_json_string'.
|
||||||
to_json.append (a_json_string.item)
|
do
|
||||||
to_json.append ("%"")
|
to_json.append ("%"")
|
||||||
end
|
to_json.append (a_json_string.item)
|
||||||
|
to_json.append ("%"")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
note
|
||||||
|
copyright: "2010-2014, Javier Velilla and others https://github.com/eiffelhub/json."
|
||||||
|
license: "https://github.com/eiffelhub/json/blob/master/License.txt"
|
||||||
|
end
|
||||||
16
contrib/library/text/parser/json/package.iron
Normal file
16
contrib/library/text/parser/json/package.iron
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
package json
|
||||||
|
|
||||||
|
project
|
||||||
|
json_safe = "library/json-safe.ecf"
|
||||||
|
json = "library/json.ecf"
|
||||||
|
json_gobo_extension = "library/json_gobo_extension.ecf"
|
||||||
|
|
||||||
|
note
|
||||||
|
title: Eiffel JSON
|
||||||
|
description: Eiffel JSON parser and visitors
|
||||||
|
tags: json,parser,text
|
||||||
|
license: MIT
|
||||||
|
copyright: Copyright (c) 2010-2014 Javier Velilla, Jocelyn Fiat and others,
|
||||||
|
link[github]: "project" https://github.com/eiffelhub/json
|
||||||
|
|
||||||
|
end
|
||||||
@@ -1,12 +1,13 @@
|
|||||||
note
|
note
|
||||||
description : "test_suite application root class"
|
description: "test_suite application root class"
|
||||||
date : "$Date$"
|
date: "$Date$"
|
||||||
revision : "$Revision$"
|
revision: "$Revision$"
|
||||||
|
|
||||||
class
|
class
|
||||||
APPLICATION
|
APPLICATION
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
|
|
||||||
ARGUMENTS
|
ARGUMENTS
|
||||||
|
|
||||||
create
|
create
|
||||||
@@ -17,7 +18,7 @@ feature {NONE} -- Initialization
|
|||||||
make
|
make
|
||||||
-- Run application.
|
-- Run application.
|
||||||
do
|
do
|
||||||
--| Add your code here
|
--| Add your code here
|
||||||
print ("Hello Eiffel World!%N")
|
print ("Hello Eiffel World!%N")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,24 +1,32 @@
|
|||||||
class AUTHOR
|
class
|
||||||
|
AUTHOR
|
||||||
|
|
||||||
create
|
create
|
||||||
make
|
make
|
||||||
|
|
||||||
feature {NONE} -- Initialization
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
make (a_name: STRING_32)
|
make (a_name: STRING_32)
|
||||||
do
|
-- Create an author with `a_name' as `name'.
|
||||||
set_name (a_name)
|
do
|
||||||
end
|
set_name (a_name)
|
||||||
|
ensure
|
||||||
|
name_set: name = a_name
|
||||||
|
end
|
||||||
|
|
||||||
feature -- Access
|
feature -- Access
|
||||||
|
|
||||||
name: STRING_32
|
name: STRING_32
|
||||||
|
-- Author name
|
||||||
|
|
||||||
feature -- Status setting
|
feature -- Change
|
||||||
|
|
||||||
set_name (a_name: STRING_32)
|
set_name (a_name: STRING_32)
|
||||||
do
|
-- Set `name' with `a_name'.
|
||||||
name := a_name
|
do
|
||||||
end
|
name := a_name
|
||||||
|
ensure
|
||||||
|
name_set: name = a_name
|
||||||
|
end
|
||||||
|
|
||||||
end -- class AUTHOR
|
end -- class AUTHOR
|
||||||
|
|||||||
@@ -1,40 +1,59 @@
|
|||||||
class BOOK
|
class
|
||||||
|
BOOK
|
||||||
|
|
||||||
create
|
create
|
||||||
make
|
make
|
||||||
|
|
||||||
feature {NONE} -- Initialization
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
make (a_title: STRING_32; an_author: AUTHOR; an_isbn: STRING_32)
|
make (a_title: STRING_32; a_author: AUTHOR; a_isbn: STRING_32)
|
||||||
do
|
-- Create a book with `a_title' as `title',
|
||||||
set_title (a_title)
|
-- `a_author' as `author', and `a_isbn' as `isbn'.
|
||||||
set_author (an_author)
|
do
|
||||||
set_isbn (an_isbn)
|
set_title (a_title)
|
||||||
end
|
set_author (a_author)
|
||||||
|
set_isbn (a_isbn)
|
||||||
|
ensure
|
||||||
|
title_set: title = a_title
|
||||||
|
author_set: author = a_author
|
||||||
|
isbn_set: isbn = a_isbn
|
||||||
|
end
|
||||||
|
|
||||||
feature -- Access
|
feature -- Access
|
||||||
|
|
||||||
title: STRING_32
|
title: STRING_32
|
||||||
|
-- Main title.
|
||||||
|
|
||||||
isbn: STRING_32
|
isbn: STRING_32
|
||||||
|
-- ISBN.
|
||||||
|
|
||||||
author: AUTHOR
|
author: AUTHOR
|
||||||
|
-- Author.
|
||||||
|
|
||||||
feature -- Status setting
|
feature -- Change
|
||||||
|
|
||||||
set_title (a_title: STRING_32)
|
set_title (a_title: STRING_32)
|
||||||
do
|
-- Set `title' with `a_title'.
|
||||||
title := a_title
|
do
|
||||||
end
|
title := a_title
|
||||||
|
ensure
|
||||||
|
title_set: title = a_title
|
||||||
|
end
|
||||||
|
|
||||||
set_author (an_author: AUTHOR)
|
set_author (a_author: AUTHOR)
|
||||||
do
|
-- Set `author' with `a_author'.
|
||||||
author := an_author
|
do
|
||||||
end
|
author := a_author
|
||||||
|
ensure
|
||||||
|
author_set: author = a_author
|
||||||
|
end
|
||||||
|
|
||||||
set_isbn (an_isbn: STRING_32)
|
set_isbn (a_isbn: STRING_32)
|
||||||
do
|
-- Set `isbn' with `a_isbn'.
|
||||||
isbn := an_isbn
|
do
|
||||||
end
|
isbn := a_isbn
|
||||||
|
ensure
|
||||||
|
isbn_set: isbn = a_isbn
|
||||||
|
end
|
||||||
|
|
||||||
end -- class BOOK
|
end -- class BOOK
|
||||||
|
|||||||
@@ -1,80 +1,82 @@
|
|||||||
class BOOK_COLLECTION
|
class
|
||||||
|
BOOK_COLLECTION
|
||||||
|
|
||||||
create
|
create
|
||||||
make
|
make
|
||||||
|
|
||||||
feature {NONE} -- Initialization
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
make (a_name: STRING_32)
|
make (a_name: STRING_32)
|
||||||
do
|
-- Create a book collection with `a_name' as `name'.
|
||||||
set_name (a_name)
|
do
|
||||||
create book_index.make (10)
|
set_name (a_name)
|
||||||
end
|
create book_index.make (10)
|
||||||
|
ensure
|
||||||
|
name_set: name = a_name
|
||||||
|
end
|
||||||
|
|
||||||
feature -- Access
|
feature -- Access
|
||||||
|
|
||||||
name: STRING_32
|
name: STRING_32
|
||||||
|
-- Name.
|
||||||
|
|
||||||
books: LIST [BOOK]
|
books: LIST [BOOK]
|
||||||
do
|
-- collection of book.
|
||||||
from
|
do
|
||||||
create {LINKED_LIST [BOOK]} Result.make
|
create {LINKED_LIST [BOOK]} Result.make
|
||||||
book_index.start
|
across
|
||||||
until
|
book_index as it
|
||||||
book_index.after
|
loop
|
||||||
loop
|
Result.append (it.item)
|
||||||
Result.append (book_index.item_for_iteration)
|
end
|
||||||
book_index.forth
|
end
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
books_by_author (an_author: STRING_32): detachable LIST [BOOK]
|
books_by_author (a_author: STRING_32): LIST [BOOK]
|
||||||
do
|
-- Books wrote by `a_author' in this collection.
|
||||||
if book_index.has (an_author) then
|
do
|
||||||
Result := book_index @ an_author
|
if attached book_index [a_author] as l_result then
|
||||||
else
|
Result := l_result
|
||||||
create {LINKED_LIST [BOOK]} Result.make
|
else
|
||||||
end
|
create {LINKED_LIST [BOOK]} Result.make
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
feature -- Status setting
|
feature -- Change
|
||||||
|
|
||||||
set_name (a_name: STRING_32)
|
set_name (a_name: STRING_32)
|
||||||
do
|
-- Set `name' with `a_name'.
|
||||||
name := a_name
|
do
|
||||||
end
|
name := a_name
|
||||||
|
ensure
|
||||||
|
name_set: name = a_name
|
||||||
|
end
|
||||||
|
|
||||||
add_book (a_book: BOOK)
|
add_book (a_book: BOOK)
|
||||||
local
|
-- Extend collection with `a_book'.
|
||||||
l: detachable LIST [BOOK]
|
local
|
||||||
do
|
l: detachable LIST [BOOK]
|
||||||
if book_index.has (a_book.author.name) then
|
do
|
||||||
l := book_index.at ( a_book.author.name )
|
l := book_index.at (a_book.author.name)
|
||||||
else
|
if l = Void then
|
||||||
create {LINKED_LIST [BOOK]} l.make
|
create {LINKED_LIST [BOOK]} l.make
|
||||||
book_index.put (l, a_book.author.name)
|
book_index.put (l, a_book.author.name)
|
||||||
end
|
end
|
||||||
if attached l as la then
|
l.force (a_book)
|
||||||
la.force (a_book)
|
end
|
||||||
end
|
|
||||||
|
|
||||||
end
|
add_books (book_list: like books)
|
||||||
|
-- Append collection with `book_list'.
|
||||||
add_books (book_list: like books)
|
do
|
||||||
|
across
|
||||||
do
|
book_list as it
|
||||||
from
|
loop
|
||||||
book_list.start
|
add_book (it.item)
|
||||||
until
|
end
|
||||||
book_list.after
|
end
|
||||||
loop
|
|
||||||
add_book (book_list.item)
|
|
||||||
book_list.forth
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
feature {NONE} -- Implementation
|
feature {NONE} -- Implementation
|
||||||
|
|
||||||
book_index: HASH_TABLE [LIST [BOOK], STRING_32]
|
book_index: HASH_TABLE [LIST [BOOK], STRING_32]
|
||||||
|
-- Association of author name and its books.
|
||||||
|
|
||||||
end -- class BOOK_COLLECTION
|
end -- class BOOK_COLLECTION
|
||||||
|
|||||||
@@ -1,53 +1,54 @@
|
|||||||
note
|
note
|
||||||
description: "A JSON converter for AUTHOR"
|
description: "A JSON converter for AUTHOR"
|
||||||
author: "Paul Cohen"
|
author: "Paul Cohen"
|
||||||
date: "$Date$"
|
date: "$Date$"
|
||||||
revision: "$Revision$"
|
revision: "$Revision$"
|
||||||
|
|
||||||
class JSON_AUTHOR_CONVERTER
|
class
|
||||||
|
JSON_AUTHOR_CONVERTER
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
JSON_CONVERTER
|
|
||||||
|
JSON_CONVERTER
|
||||||
|
|
||||||
create
|
create
|
||||||
make
|
make
|
||||||
|
|
||||||
feature {NONE} -- Initialization
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
make
|
make
|
||||||
local
|
local
|
||||||
ucs: STRING_32
|
ucs: STRING_32
|
||||||
do
|
do
|
||||||
create ucs.make_from_string ("")
|
create ucs.make_from_string ("")
|
||||||
create object.make (ucs)
|
create object.make (ucs)
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Access
|
feature -- Access
|
||||||
|
|
||||||
object: AUTHOR
|
object: AUTHOR
|
||||||
|
|
||||||
feature -- Conversion
|
feature -- Conversion
|
||||||
|
|
||||||
from_json (j: like to_json): detachable like object
|
from_json (j: like to_json): detachable like object
|
||||||
local
|
do
|
||||||
ucs: detachable STRING_32
|
if attached {STRING_32} json.object (j.item (name_key), Void) as l_name then
|
||||||
do
|
create Result.make (l_name)
|
||||||
ucs ?= json.object (j.item (name_key), Void)
|
end
|
||||||
check ucs /= Void end
|
end
|
||||||
create Result.make (ucs)
|
|
||||||
end
|
|
||||||
|
|
||||||
to_json (o: like object): JSON_OBJECT
|
to_json (o: like object): JSON_OBJECT
|
||||||
do
|
do
|
||||||
create Result.make
|
create Result.make
|
||||||
Result.put (json.value (o.name), name_key)
|
Result.put (json.value (o.name), name_key)
|
||||||
end
|
end
|
||||||
|
|
||||||
feature {NONE} -- Implementation
|
feature {NONE} -- Implementation
|
||||||
|
|
||||||
name_key: JSON_STRING
|
name_key: JSON_STRING
|
||||||
once
|
-- Author's name label.
|
||||||
create Result.make_json ("name")
|
once
|
||||||
end
|
create Result.make_from_string ("name")
|
||||||
|
end
|
||||||
|
|
||||||
end -- class JSON_AUTHOR_CONVERTER
|
end -- class JSON_AUTHOR_CONVERTER
|
||||||
|
|||||||
@@ -1,78 +1,82 @@
|
|||||||
note
|
note
|
||||||
description: "A JSON converter for BOOK_COLLECTION"
|
description: "A JSON converter for BOOK_COLLECTION"
|
||||||
author: "Paul Cohen"
|
author: "Paul Cohen"
|
||||||
date: "$Date$"
|
date: "$Date$"
|
||||||
revision: "$Revision$"
|
revision: "$Revision$"
|
||||||
|
|
||||||
class JSON_BOOK_COLLECTION_CONVERTER
|
class
|
||||||
|
JSON_BOOK_COLLECTION_CONVERTER
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
JSON_CONVERTER
|
|
||||||
|
JSON_CONVERTER
|
||||||
|
|
||||||
create
|
create
|
||||||
make
|
make
|
||||||
|
|
||||||
feature {NONE} -- Initialization
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
make
|
make
|
||||||
local
|
local
|
||||||
ucs: STRING_32
|
ucs: STRING_32
|
||||||
do
|
do
|
||||||
create ucs.make_from_string ("")
|
create ucs.make_from_string ("")
|
||||||
create object.make (ucs)
|
create object.make (ucs)
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Access
|
feature -- Access
|
||||||
|
|
||||||
object: BOOK_COLLECTION
|
object: BOOK_COLLECTION
|
||||||
|
|
||||||
feature -- Conversion
|
feature -- Conversion
|
||||||
|
|
||||||
from_json (j: like to_json): detachable like object
|
from_json (j: like to_json): detachable like object
|
||||||
local
|
local
|
||||||
ucs: detachable STRING_32
|
l_books: LINKED_LIST [BOOK]
|
||||||
ll: LINKED_LIST [BOOK]
|
do
|
||||||
b: detachable BOOK
|
if
|
||||||
ja: detachable JSON_ARRAY
|
attached {STRING_32} json.object (j.item (name_key), Void) as l_name and
|
||||||
i: INTEGER
|
attached {JSON_ARRAY} j.item (books_key) as l_json_array
|
||||||
do
|
then
|
||||||
ucs ?= json.object (j.item (name_key), Void)
|
create Result.make (l_name)
|
||||||
check ucs /= Void end
|
create l_books.make
|
||||||
create Result.make (ucs)
|
across
|
||||||
ja ?= j.item (books_key)
|
l_json_array as it
|
||||||
check ja /= Void end
|
until
|
||||||
from
|
Result = Void
|
||||||
i := 1
|
loop
|
||||||
create ll.make
|
if attached {BOOK} json.object (it.item, "BOOK") as l_book then
|
||||||
until
|
l_books.extend (l_book)
|
||||||
i > ja.count
|
else
|
||||||
loop
|
Result := Void
|
||||||
b ?= json.object (ja [i], "BOOK")
|
-- Failed
|
||||||
check b /= Void end
|
end
|
||||||
ll.force (b)
|
end
|
||||||
i := i + 1
|
if Result /= Void then
|
||||||
end
|
Result.add_books (l_books)
|
||||||
check ll /= Void end
|
end
|
||||||
Result.add_books (ll)
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
to_json (o: like object): JSON_OBJECT
|
to_json (o: like object): JSON_OBJECT
|
||||||
do
|
do
|
||||||
create Result.make
|
create Result.make_with_capacity (2)
|
||||||
Result.put (json.value (o.name), name_key)
|
Result.put (json.value (o.name), name_key)
|
||||||
Result.put (json.value (o.books), books_key)
|
Result.put (json.value (o.books), books_key)
|
||||||
end
|
end
|
||||||
|
|
||||||
feature {NONE} -- Implementation
|
feature {NONE} -- Implementation
|
||||||
|
|
||||||
name_key: JSON_STRING
|
name_key: JSON_STRING
|
||||||
once
|
-- Collection's name label.
|
||||||
create Result.make_json ("name")
|
once
|
||||||
end
|
create Result.make_from_string ("name")
|
||||||
|
end
|
||||||
|
|
||||||
books_key: JSON_STRING
|
books_key: JSON_STRING
|
||||||
once
|
-- Book list label.
|
||||||
create Result.make_json ("books")
|
once
|
||||||
end
|
create Result.make_from_string ("books")
|
||||||
|
end
|
||||||
|
|
||||||
end -- class JSON_BOOK_COLLECTION_CONVERTER
|
end -- class JSON_BOOK_COLLECTION_CONVERTER
|
||||||
|
|||||||
@@ -1,72 +1,74 @@
|
|||||||
note
|
note
|
||||||
description: "A JSON converter for BOOK"
|
description: "A JSON converter for BOOK"
|
||||||
author: "Paul Cohen"
|
author: "Paul Cohen"
|
||||||
date: "$Date$"
|
date: "$Date$"
|
||||||
revision: "$Revision$"
|
revision: "$Revision$"
|
||||||
|
|
||||||
class JSON_BOOK_CONVERTER
|
class
|
||||||
|
JSON_BOOK_CONVERTER
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
JSON_CONVERTER
|
|
||||||
|
JSON_CONVERTER
|
||||||
|
|
||||||
create
|
create
|
||||||
make
|
make
|
||||||
|
|
||||||
feature {NONE} -- Initialization
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
make
|
make
|
||||||
local
|
local
|
||||||
ucs: STRING_32
|
ucs: STRING_32
|
||||||
a: AUTHOR
|
a: AUTHOR
|
||||||
do
|
do
|
||||||
create ucs.make_from_string ("")
|
create ucs.make_from_string ("")
|
||||||
create a.make (ucs)
|
create a.make (ucs)
|
||||||
create object.make (ucs, a, ucs)
|
create object.make (ucs, a, ucs)
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Access
|
feature -- Access
|
||||||
|
|
||||||
object: BOOK
|
object: BOOK
|
||||||
|
|
||||||
feature -- Conversion
|
feature -- Conversion
|
||||||
|
|
||||||
from_json (j: like to_json): detachable like object
|
from_json (j: like to_json): detachable like object
|
||||||
local
|
do
|
||||||
ucs1, ucs2: detachable STRING_32
|
if
|
||||||
a: detachable AUTHOR
|
attached {STRING_32} json.object (j.item (title_key), Void) as l_title and
|
||||||
do
|
attached {STRING_32} json.object (j.item (isbn_key), Void) as l_isbn and
|
||||||
ucs1 ?= json.object (j.item (title_key), Void)
|
attached {AUTHOR} json.object (j.item (author_key), "AUTHOR") as l_author
|
||||||
check ucs1 /= Void end
|
then
|
||||||
ucs2 ?= json.object (j.item (isbn_key), Void)
|
create Result.make (l_title, l_author, l_isbn)
|
||||||
check ucs2 /= Void end
|
end
|
||||||
a ?= json.object (j.item (author_key), "AUTHOR")
|
end
|
||||||
check a /= Void end
|
|
||||||
create Result.make (ucs1, a, ucs2)
|
|
||||||
end
|
|
||||||
|
|
||||||
to_json (o: like object): JSON_OBJECT
|
to_json (o: like object): JSON_OBJECT
|
||||||
do
|
do
|
||||||
create Result.make
|
create Result.make_with_capacity (3)
|
||||||
Result.put (json.value (o.title), title_key)
|
Result.put (json.value (o.title), title_key)
|
||||||
Result.put (json.value (o.isbn), isbn_key)
|
Result.put (json.value (o.isbn), isbn_key)
|
||||||
Result.put (json.value (o.author), author_key)
|
Result.put (json.value (o.author), author_key)
|
||||||
end
|
end
|
||||||
|
|
||||||
feature {NONE} -- Implementation
|
feature {NONE} -- Implementation
|
||||||
|
|
||||||
title_key: JSON_STRING
|
title_key: JSON_STRING
|
||||||
once
|
-- Book's title label.
|
||||||
create Result.make_json ("title")
|
once
|
||||||
end
|
create Result.make_from_string ("title")
|
||||||
|
end
|
||||||
|
|
||||||
isbn_key: JSON_STRING
|
isbn_key: JSON_STRING
|
||||||
once
|
-- Book ISBN label.
|
||||||
create Result.make_json ("isbn")
|
once
|
||||||
end
|
create Result.make_from_string ("isbn")
|
||||||
|
end
|
||||||
|
|
||||||
author_key: JSON_STRING
|
author_key: JSON_STRING
|
||||||
once
|
-- Author label.
|
||||||
create Result.make_json ("author")
|
once
|
||||||
end
|
create Result.make_from_string ("author")
|
||||||
|
end
|
||||||
|
|
||||||
end -- class JSON_BOOK_CONVERTER
|
end -- class JSON_BOOK_CONVERTER
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
{"menu": {
|
{ "menu": {
|
||||||
"id": "file",
|
"id": "file",
|
||||||
"value": "File",
|
"value": "File",
|
||||||
"popup": {
|
"popup": {
|
||||||
"menuitem": [
|
"menuitem": [
|
||||||
{"value": "New", "onclick": "CreateNewDoc()"},
|
{"value": "New", "onclick": "CreateNewDoc()"},
|
||||||
{"value": "Open", "onclick": "OpenDoc()"},
|
{"value": "Open", "onclick": "OpenDoc()"},
|
||||||
{"value": "Close", "onclick": "CloseDoc()"}
|
{"value": "Close", "onclick": "CloseDoc()"}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
@@ -1,74 +1,72 @@
|
|||||||
class TEST_DS
|
note
|
||||||
|
description: "Linked list and hash table converters test."
|
||||||
|
date: "$Date$"
|
||||||
|
revision: "$Revision$"
|
||||||
|
|
||||||
|
class
|
||||||
|
TEST_DS
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
SHARED_EJSON
|
|
||||||
rename default_create as shared_default_create end
|
|
||||||
EQA_TEST_SET
|
|
||||||
select default_create end
|
|
||||||
|
|
||||||
|
SHARED_EJSON
|
||||||
|
undefine
|
||||||
|
default_create
|
||||||
|
end
|
||||||
|
|
||||||
|
EQA_TEST_SET
|
||||||
|
|
||||||
feature -- Test
|
feature -- Test
|
||||||
|
|
||||||
test_linked_list_converter
|
test_linked_list_converter
|
||||||
local
|
-- Convert a linked list to a json value and
|
||||||
jc: JSON_LINKED_LIST_CONVERTER
|
-- convert this one to a linked list.
|
||||||
l: LINKED_LIST [STRING]
|
local
|
||||||
l2: detachable LINKED_LIST [detachable ANY]
|
l: LINKED_LIST [STRING]
|
||||||
s: STRING
|
s: STRING
|
||||||
jv: detachable JSON_VALUE
|
do
|
||||||
do
|
create l.make
|
||||||
create jc.make
|
l.force ("foo")
|
||||||
json.add_converter (jc)
|
l.force ("bar")
|
||||||
create l.make
|
if attached json.value (l) as l_value then
|
||||||
s := "foo"
|
s := l_value.representation
|
||||||
l.force (s)
|
assert ("JSON array converted to LINKED_LIST", attached {LINKED_LIST [detachable ANY]} json.object (l_value, "LINKED_LIST"))
|
||||||
s := "bar"
|
else
|
||||||
l.force (s)
|
assert ("LINKED_LIST converted to a JSON value", False)
|
||||||
jv := json.value (l)
|
end
|
||||||
assert ("jv /= Void", jv /= Void)
|
end
|
||||||
if attached jv as l_jv then
|
|
||||||
s := jv.representation
|
|
||||||
l2 ?= json.object (jv, "LINKED_LIST")
|
|
||||||
assert ("l2 /= Void", l2 /= Void)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
test_hash_table_converter
|
test_hash_table_converter
|
||||||
local
|
-- Convert a hash table to a json value and
|
||||||
tc: JSON_HASH_TABLE_CONVERTER
|
-- convert this one to a hash table.
|
||||||
t: HASH_TABLE [STRING, STRING]
|
local
|
||||||
t2: detachable HASH_TABLE [ANY, HASHABLE]
|
t: HASH_TABLE [STRING, STRING]
|
||||||
s: STRING
|
s: STRING
|
||||||
ucs_key, ucs_value: detachable STRING_32
|
l_ucs_key: detachable STRING_32
|
||||||
jv: detachable JSON_VALUE
|
do
|
||||||
do
|
create t.make (2)
|
||||||
create tc.make
|
t.put ("foo", "1")
|
||||||
json.add_converter (tc)
|
t.put ("bar", "2")
|
||||||
create t.make (2)
|
if attached json.value (t) as l_value then
|
||||||
t.put ("foo", "1")
|
s := l_value.representation
|
||||||
t.put ("bar", "2")
|
if attached {HASH_TABLE [ANY, HASHABLE]} json.object (l_value, "HASH_TABLE") as t2 then
|
||||||
jv := json.value (t)
|
create l_ucs_key.make_from_string ("1")
|
||||||
assert ("jv /= Void", jv /= Void)
|
if attached {STRING_32} t2 [l_ucs_key] as l_ucs_value then
|
||||||
if attached jv as l_jv then
|
assert ("ucs_value.string.is_equal (%"foo%")", l_ucs_value.same_string_general ("foo"))
|
||||||
s := l_jv.representation
|
else
|
||||||
t2 ?= json.object (l_jv, "HASH_TABLE")
|
assert ("ucs_value /= Void", False)
|
||||||
assert ("t2 /= Void", t2 /= Void)
|
end
|
||||||
end
|
create l_ucs_key.make_from_string ("2")
|
||||||
create ucs_key.make_from_string ("1")
|
if attached {STRING_32} t2 [l_ucs_key] as l_ucs_value then
|
||||||
if attached t2 as l_t2 then
|
assert ("ucs_value.string.is_equal (%"bar%")", l_ucs_value.same_string_general ("bar"))
|
||||||
ucs_value ?= t2 @ ucs_key
|
else
|
||||||
assert ("ucs_value /= Void", ucs_value /= Void)
|
assert ("ucs_value /= Void", False)
|
||||||
if attached ucs_value as l_ucs_value then
|
end
|
||||||
assert ("ucs_value.string.is_equal (%"foo%")", l_ucs_value.string.is_equal ("foo"))
|
else
|
||||||
end
|
assert ("JSON object converted to HASH_TABLE", False);
|
||||||
create ucs_key.make_from_string ("2")
|
end
|
||||||
ucs_value ?= t2 @ ucs_key
|
else
|
||||||
assert ("ucs_value /= Void", ucs_value /= Void)
|
assert ("HASH_TABLE converted to a JSON value", False)
|
||||||
if attached ucs_value as l_ucs_value then
|
end
|
||||||
assert ("ucs_value.string.is_equal (%"bar%")", l_ucs_value.string.is_equal ("bar"))
|
end
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end -- class TEST_DS
|
end -- class TEST_DS
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,42 +1,52 @@
|
|||||||
class TEST_JSON_CUSTOM_CLASSES
|
note
|
||||||
|
description: "Parsing and converter of book collection test."
|
||||||
|
date: "$Date$"
|
||||||
|
revision: "$Revision$"
|
||||||
|
|
||||||
|
class
|
||||||
|
TEST_JSON_CUSTOM_CLASSES
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
SHARED_EJSON
|
|
||||||
rename default_create as shared_default_create end
|
SHARED_EJSON
|
||||||
|
undefine
|
||||||
|
default_create
|
||||||
|
end
|
||||||
|
|
||||||
EQA_TEST_SET
|
EQA_TEST_SET
|
||||||
select default_create end
|
|
||||||
feature -- Test
|
feature -- Test
|
||||||
|
|
||||||
test_custom_classes
|
test_custom_classes
|
||||||
local
|
-- Parse JSON representation to JSON_OBJECT and test book collection converter.
|
||||||
bc: detachable BOOK_COLLECTION
|
local
|
||||||
jbc: JSON_BOOK_CONVERTER
|
jbc: JSON_BOOK_CONVERTER
|
||||||
jbcc: JSON_BOOK_COLLECTION_CONVERTER
|
jbcc: JSON_BOOK_COLLECTION_CONVERTER
|
||||||
jac: JSON_AUTHOR_CONVERTER
|
jac: JSON_AUTHOR_CONVERTER
|
||||||
jo: detachable JSON_OBJECT
|
parser: JSON_PARSER
|
||||||
parser: JSON_PARSER
|
jrep: STRING
|
||||||
jrep: STRING
|
do
|
||||||
do
|
create jbc.make
|
||||||
create jbc.make
|
json.add_converter (jbc)
|
||||||
json.add_converter (jbc)
|
create jbcc.make
|
||||||
create jbcc.make
|
json.add_converter (jbcc)
|
||||||
json.add_converter (jbcc)
|
create jac.make
|
||||||
create jac.make
|
json.add_converter (jac)
|
||||||
json.add_converter (jac)
|
jrep := "{%"name%":%"Test collection%",%"books%":[{%"title%":%"eJSON: The Definitive Guide%",%"isbn%":%"123123-413243%",%"author%":{%"name%":%"Foo Bar%"}}]}"
|
||||||
jrep := "{%"name%":%"Test collection%",%"books%":[{%"title%":%"eJSON: The Definitive Guide%",%"isbn%":%"123123-413243%",%"author%":{%"name%":%"Foo Bar%"}}]}"
|
create parser.make_parser (jrep)
|
||||||
create parser.make_parser (jrep)
|
if attached {JSON_OBJECT} parser.parse as l_json_object then
|
||||||
jo := Void
|
if attached {BOOK_COLLECTION} json.object (l_json_object, "BOOK_COLLECTION") as l_collection then
|
||||||
jo ?= parser.parse
|
if attached {JSON_OBJECT} json.value (l_collection) as l_json_object_2 then
|
||||||
assert ("jo /= Void", jo /= Void)
|
assert ("JSON representation is correct", l_json_object_2.representation.same_string (jrep))
|
||||||
bc := Void
|
else
|
||||||
bc ?= json.object (jo, "BOOK_COLLECTION")
|
assert ("BOOK_COLLECTION converted to JSON_OBJECT", False)
|
||||||
assert ("bc /= Void", bc /= Void)
|
end
|
||||||
jo ?= json.value (bc)
|
else
|
||||||
assert ("jo /= Void", jo /= Void)
|
assert ("JSON_OBJECT converted to BOOK_COLLECTION", False)
|
||||||
if attached jo as l_jo then
|
end
|
||||||
assert ("JSON representation is correct", l_jo.representation.same_string ("{%"name%":%"Test collection%",%"books%":[{%"title%":%"eJSON: The Definitive Guide%",%"isbn%":%"123123-413243%",%"author%":{%"name%":%"Foo Bar%"}}]}"))
|
else
|
||||||
end
|
assert ("JSON object representation to JSON_OBJECT", False)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end -- class TEST_JSON_CUSTOM_CLASS
|
end -- class TEST_JSON_CUSTOM_CLASS
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,18 +1,18 @@
|
|||||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-8-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-8-0 http://www.eiffel.com/developers/xml/configuration-1-8-0.xsd" name="test_suite" uuid="EA141B17-6A21-4781-8B5F-E9939BAE968A">
|
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-13-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-13-0 http://www.eiffel.com/developers/xml/configuration-1-13-0.xsd" name="test_suite" uuid="EA141B17-6A21-4781-8B5F-E9939BAE968A">
|
||||||
<target name="test_suite">
|
<target name="test_suite">
|
||||||
<root cluster="test_suite" class="APPLICATION" feature="make"/>
|
<root cluster="test_suite" class="APPLICATION" feature="make"/>
|
||||||
<file_rule>
|
<file_rule>
|
||||||
<exclude>/EIFGENs$</exclude>
|
<exclude>/EIFGENs$</exclude>
|
||||||
<exclude>/CVS$</exclude>
|
<exclude>/CVS$</exclude>
|
||||||
<exclude>/.svn$</exclude>
|
<exclude>/.svn$</exclude>
|
||||||
</file_rule>
|
</file_rule>
|
||||||
<option warning="true" is_attached_by_default="true" void_safety="all" syntax="standard">
|
<option warning="true" full_class_checking="false" is_attached_by_default="true" void_safety="transitional" syntax="standard">
|
||||||
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
|
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
|
||||||
</option>
|
</option>
|
||||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||||
<library name="json" location="..\..\..\library\json-safe.ecf"/>
|
<library name="json" location="..\..\..\library\json-safe.ecf" readonly="false"/>
|
||||||
<library name="testing" location="$ISE_LIBRARY\library\testing\testing-safe.ecf"/>
|
<library name="testing" location="$ISE_LIBRARY\library\testing\testing-safe.ecf"/>
|
||||||
<cluster name="test_suite" location=".\" recursive="true"/>
|
<cluster name="test_suite" location=".\" recursive="true"/>
|
||||||
</target>
|
</target>
|
||||||
</system>
|
</system>
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user