Compare commits
420 Commits
master
...
f2a67017c8
Author | SHA1 | Date | |
---|---|---|---|
/* User with id == 0 is a fake user from git author */
|
f2a67017c8 | ||
/* User with id == 0 is a fake user from git author */
|
5a1dba2a38 | ||
/* User with id == 0 is a fake user from git author */
|
0100406f3f | ||
/* User with id == 0 is a fake user from git author */
|
554455133d | ||
/* User with id == 0 is a fake user from git author */
|
0d5e74665b | ||
/* User with id == 0 is a fake user from git author */
|
83e5de35bb | ||
/* User with id == 0 is a fake user from git author */
|
f85f685cdf | ||
/* User with id == 0 is a fake user from git author */
|
76d4a4dbe1 | ||
/* User with id == 0 is a fake user from git author */
|
e2f3a662f3 | ||
/* User with id == 0 is a fake user from git author */
|
6974c13d16 | ||
/* User with id == 0 is a fake user from git author */
|
443ebf4fd1 | ||
/* User with id == 0 is a fake user from git author */
|
1b7c4543c8 | ||
/* User with id == 0 is a fake user from git author */
|
174320c264 | ||
/* User with id == 0 is a fake user from git author */
|
ff8b9667d9 | ||
/* User with id == 0 is a fake user from git author */
|
6a5b24e62c | ||
/* User with id == 0 is a fake user from git author */
|
c2e77c293d | ||
/* User with id == 0 is a fake user from git author */
|
aca56895ac | ||
/* User with id == 0 is a fake user from git author */
|
defcee30a4 | ||
/* User with id == 0 is a fake user from git author */
|
71f2c6fd54 | ||
/* User with id == 0 is a fake user from git author */
|
8d7745ac90 | ||
/* User with id == 0 is a fake user from git author */
|
9459bfa707 | ||
/* User with id == 0 is a fake user from git author */
|
12a482c098 | ||
/* User with id == 0 is a fake user from git author */
|
d738a5fc2c | ||
/* User with id == 0 is a fake user from git author */
|
f35984ba84 | ||
/* User with id == 0 is a fake user from git author */
|
dc84354861 | ||
/* User with id == 0 is a fake user from git author */
|
855dc37af1 | ||
/* User with id == 0 is a fake user from git author */
|
3eec5443ab | ||
/* User with id == 0 is a fake user from git author */
|
34b5db2822 | ||
/* User with id == 0 is a fake user from git author */
|
ec4928d67b | ||
/* User with id == 0 is a fake user from git author */
|
5f707743a4 | ||
/* User with id == 0 is a fake user from git author */
|
3db771e9d9 | ||
/* User with id == 0 is a fake user from git author */
|
cf870b5c9c | ||
/* User with id == 0 is a fake user from git author */
|
0aca9256c3 | ||
/* User with id == 0 is a fake user from git author */
|
59a8cb3708 | ||
/* User with id == 0 is a fake user from git author */
|
27eb6b19a6 | ||
/* User with id == 0 is a fake user from git author */
|
d2e3ed17e6 | ||
/* User with id == 0 is a fake user from git author */
|
ec5b42a3b2 | ||
/* User with id == 0 is a fake user from git author */
|
e37523f671 | ||
/* User with id == 0 is a fake user from git author */
|
19477b3c51 | ||
/* User with id == 0 is a fake user from git author */
|
1d4de6d8a7 | ||
/* User with id == 0 is a fake user from git author */
|
027e8a9191 | ||
/* User with id == 0 is a fake user from git author */
|
7ee84c97aa | ||
/* User with id == 0 is a fake user from git author */
|
83ad9c6bbf | ||
/* User with id == 0 is a fake user from git author */
|
abf5c28c43 | ||
/* User with id == 0 is a fake user from git author */
|
ca5d86f1c6 | ||
/* User with id == 0 is a fake user from git author */
|
4eb0f8b724 | ||
/* User with id == 0 is a fake user from git author */
|
557c18cb3f | ||
/* User with id == 0 is a fake user from git author */
|
138dc8f5ac | ||
/* User with id == 0 is a fake user from git author */
|
38b7b5d085 | ||
/* User with id == 0 is a fake user from git author */
|
e13d8589f6 | ||
/* User with id == 0 is a fake user from git author */
|
586c7aee43 | ||
/* User with id == 0 is a fake user from git author */
|
cd4e81a89a | ||
/* User with id == 0 is a fake user from git author */
|
998dee68b7 | ||
/* User with id == 0 is a fake user from git author */
|
f5cc30d65e | ||
/* User with id == 0 is a fake user from git author */
|
80c7b85ec2 | ||
/* User with id == 0 is a fake user from git author */
|
b5cf36be19 | ||
/* User with id == 0 is a fake user from git author */
|
2272742d8f | ||
/* User with id == 0 is a fake user from git author */
|
afe609c463 | ||
/* User with id == 0 is a fake user from git author */
|
b714f5579c | ||
/* User with id == 0 is a fake user from git author */
|
d7ed80d1b0 | ||
/* User with id == 0 is a fake user from git author */
|
fdd6cdc718 | ||
/* User with id == 0 is a fake user from git author */
|
c1d788a611 | ||
/* User with id == 0 is a fake user from git author */
|
e1519765ba | ||
/* User with id == 0 is a fake user from git author */
|
cd42f26bfd | ||
/* User with id == 0 is a fake user from git author */
|
8890462b1b | ||
/* User with id == 0 is a fake user from git author */
|
1cb7045ad8 | ||
/* User with id == 0 is a fake user from git author */
|
8bfa731e4a | ||
/* User with id == 0 is a fake user from git author */
|
cb73c93360 | ||
/* User with id == 0 is a fake user from git author */
|
bc20d259f5 | ||
/* User with id == 0 is a fake user from git author */
|
4c4ca8645e | ||
/* User with id == 0 is a fake user from git author */
|
62e33805f0 | ||
/* User with id == 0 is a fake user from git author */
|
8b6ea4118f | ||
/* User with id == 0 is a fake user from git author */
|
939d1cc007 | ||
/* User with id == 0 is a fake user from git author */
|
72f23aa514 | ||
/* User with id == 0 is a fake user from git author */
|
8fc49ae8d9 | ||
/* User with id == 0 is a fake user from git author */
|
6bb20fe2e2 | ||
/* User with id == 0 is a fake user from git author */
|
c7d6ecd0c5 | ||
/* User with id == 0 is a fake user from git author */
|
75fa0f9e45 | ||
/* User with id == 0 is a fake user from git author */
|
989273ee18 | ||
/* User with id == 0 is a fake user from git author */
|
a721d4465a | ||
/* User with id == 0 is a fake user from git author */
|
fe956958d2 | ||
/* User with id == 0 is a fake user from git author */
|
0fbd22b7b1 | ||
/* User with id == 0 is a fake user from git author */
|
3bfc5f8355 | ||
/* User with id == 0 is a fake user from git author */
|
4543f13d9f | ||
/* User with id == 0 is a fake user from git author */
|
f24913673b | ||
/* User with id == 0 is a fake user from git author */
|
90bfd26996 | ||
/* User with id == 0 is a fake user from git author */
|
933bed0404 | ||
/* User with id == 0 is a fake user from git author */
|
e4b9bfffee | ||
/* User with id == 0 is a fake user from git author */
|
8bf6f3447f | ||
/* User with id == 0 is a fake user from git author */
|
d04d601a7c | ||
/* User with id == 0 is a fake user from git author */
|
96c89eb68c | ||
/* User with id == 0 is a fake user from git author */
|
66660bfb3c | ||
/* User with id == 0 is a fake user from git author */
|
0b9828c06a | ||
/* User with id == 0 is a fake user from git author */
|
6d623437ff | ||
/* User with id == 0 is a fake user from git author */
|
4273cea392 | ||
/* User with id == 0 is a fake user from git author */
|
3c60af8369 | ||
/* User with id == 0 is a fake user from git author */
|
49dfa7570d | ||
/* User with id == 0 is a fake user from git author */
|
2c713b6ccb | ||
/* User with id == 0 is a fake user from git author */
|
11f79dec3a | ||
/* User with id == 0 is a fake user from git author */
|
fee4f8aee1 | ||
/* User with id == 0 is a fake user from git author */
|
97b1280b15 | ||
/* User with id == 0 is a fake user from git author */
|
c0cc5540b5 | ||
/* User with id == 0 is a fake user from git author */
|
b8ae34461b | ||
/* User with id == 0 is a fake user from git author */
|
e075c1c67c | ||
/* User with id == 0 is a fake user from git author */
|
6e9dffc1f4 | ||
/* User with id == 0 is a fake user from git author */
|
92d2763d40 | ||
/* User with id == 0 is a fake user from git author */
|
091f19d93a | ||
/* User with id == 0 is a fake user from git author */
|
c860938de3 | ||
/* User with id == 0 is a fake user from git author */
|
f8a8c6ce28 | ||
/* User with id == 0 is a fake user from git author */
|
e5ae0cf091 | ||
/* User with id == 0 is a fake user from git author */
|
1f10da8473 | ||
/* User with id == 0 is a fake user from git author */
|
4afd99fce1 | ||
/* User with id == 0 is a fake user from git author */
|
286259df9d | ||
/* User with id == 0 is a fake user from git author */
|
c617e6ea8a | ||
/* User with id == 0 is a fake user from git author */
|
290b72d362 | ||
/* User with id == 0 is a fake user from git author */
|
ed0ab398db | ||
/* User with id == 0 is a fake user from git author */
|
cf415becc0 | ||
/* User with id == 0 is a fake user from git author */
|
6c4c4a86e1 | ||
/* User with id == 0 is a fake user from git author */
|
a8e6127a0f | ||
/* User with id == 0 is a fake user from git author */
|
71cefa21c4 | ||
/* User with id == 0 is a fake user from git author */
|
6e6c59b0cc | ||
/* User with id == 0 is a fake user from git author */
|
a542e66922 | ||
/* User with id == 0 is a fake user from git author */
|
a12c86d471 | ||
/* User with id == 0 is a fake user from git author */
|
2071e21542 | ||
/* User with id == 0 is a fake user from git author */
|
4485241a49 | ||
/* User with id == 0 is a fake user from git author */
|
c613f0df8a | ||
/* User with id == 0 is a fake user from git author */
|
a407d97d70 | ||
/* User with id == 0 is a fake user from git author */
|
2c553a20e0 | ||
/* User with id == 0 is a fake user from git author */
|
9ca7dd3a90 | ||
/* User with id == 0 is a fake user from git author */
|
3cbcc8df6c | ||
/* User with id == 0 is a fake user from git author */
|
59fc4ff1e1 | ||
/* User with id == 0 is a fake user from git author */
|
388e62b7c3 | ||
/* User with id == 0 is a fake user from git author */
|
5e39246c60 | ||
/* User with id == 0 is a fake user from git author */
|
f3b886c8c2 | ||
/* User with id == 0 is a fake user from git author */
|
f58ad91530 | ||
/* User with id == 0 is a fake user from git author */
|
16e11d9cb7 | ||
/* User with id == 0 is a fake user from git author */
|
04e2329262 | ||
/* User with id == 0 is a fake user from git author */
|
6238184f8d | ||
/* User with id == 0 is a fake user from git author */
|
b893f0884e | ||
/* User with id == 0 is a fake user from git author */
|
936581e12d | ||
/* User with id == 0 is a fake user from git author */
|
d812f6c40e | ||
/* User with id == 0 is a fake user from git author */
|
a821ee6cc5 | ||
/* User with id == 0 is a fake user from git author */
|
500c806dbd | ||
/* User with id == 0 is a fake user from git author */
|
0ca2981290 | ||
/* User with id == 0 is a fake user from git author */
|
fb77b5ef89 | ||
/* User with id == 0 is a fake user from git author */
|
c676b9d4f2 | ||
/* User with id == 0 is a fake user from git author */
|
4ca3c9a955 | ||
/* User with id == 0 is a fake user from git author */
|
b213c85b78 | ||
/* User with id == 0 is a fake user from git author */
|
c5a1b1ae94 | ||
/* User with id == 0 is a fake user from git author */
|
8059bfd3a0 | ||
/* User with id == 0 is a fake user from git author */
|
c87ecc13cd | ||
/* User with id == 0 is a fake user from git author */
|
a16a71084b | ||
/* User with id == 0 is a fake user from git author */
|
0bf7d2c290 | ||
/* User with id == 0 is a fake user from git author */
|
63edcfd88e | ||
/* User with id == 0 is a fake user from git author */
|
7b9ce2c1fb | ||
/* User with id == 0 is a fake user from git author */
|
1876bdc2ce | ||
/* User with id == 0 is a fake user from git author */
|
82761030c8 | ||
/* User with id == 0 is a fake user from git author */
|
86e1668591 | ||
/* User with id == 0 is a fake user from git author */
|
f05b82847e | ||
/* User with id == 0 is a fake user from git author */
|
ca20ff4850 | ||
/* User with id == 0 is a fake user from git author */
|
602f35faba | ||
/* User with id == 0 is a fake user from git author */
|
1ae5806738 | ||
/* User with id == 0 is a fake user from git author */
|
ea970195fb | ||
/* User with id == 0 is a fake user from git author */
|
2513842f7f | ||
/* User with id == 0 is a fake user from git author */
|
8a770d21ab | ||
/* User with id == 0 is a fake user from git author */
|
74dbcd6482 | ||
/* User with id == 0 is a fake user from git author */
|
3a41be365a | ||
/* User with id == 0 is a fake user from git author */
|
968063376b | ||
/* User with id == 0 is a fake user from git author */
|
562381e4c2 | ||
/* User with id == 0 is a fake user from git author */
|
4c40e76abd | ||
/* User with id == 0 is a fake user from git author */
|
0c07b0e497 | ||
/* User with id == 0 is a fake user from git author */
|
5ced8624e6 | ||
/* User with id == 0 is a fake user from git author */
|
a9fbdef1d7 | ||
/* User with id == 0 is a fake user from git author */
|
e54bc15c4a | ||
/* User with id == 0 is a fake user from git author */
|
b2956aad58 | ||
/* User with id == 0 is a fake user from git author */
|
707711607d | ||
/* User with id == 0 is a fake user from git author */
|
d4c5014bd8 | ||
/* User with id == 0 is a fake user from git author */
|
5440691151 | ||
/* User with id == 0 is a fake user from git author */
|
bf89d8c83e | ||
/* User with id == 0 is a fake user from git author */
|
004c9a9135 | ||
/* User with id == 0 is a fake user from git author */
|
b994f15dbb | ||
/* User with id == 0 is a fake user from git author */
|
3537c0a37d | ||
/* User with id == 0 is a fake user from git author */
|
9c39536b4f | ||
/* User with id == 0 is a fake user from git author */
|
39996ce5fa | ||
/* User with id == 0 is a fake user from git author */
|
b7ebc664cc | ||
/* User with id == 0 is a fake user from git author */
|
e57424e4e8 | ||
/* User with id == 0 is a fake user from git author */
|
f5f73b0344 | ||
/* User with id == 0 is a fake user from git author */
|
642385f95f | ||
/* User with id == 0 is a fake user from git author */
|
f050af4718 | ||
/* User with id == 0 is a fake user from git author */
|
2e5c90155f | ||
/* User with id == 0 is a fake user from git author */
|
1bb328a4bb | ||
/* User with id == 0 is a fake user from git author */
|
154890d939 | ||
/* User with id == 0 is a fake user from git author */
|
28b6010c51 | ||
/* User with id == 0 is a fake user from git author */
|
68c00e0569 | ||
/* User with id == 0 is a fake user from git author */
|
ba43de8a27 | ||
/* User with id == 0 is a fake user from git author */
|
049521c7c7 | ||
/* User with id == 0 is a fake user from git author */
|
8477d1c3b9 | ||
/* User with id == 0 is a fake user from git author */
|
de92c3295b | ||
/* User with id == 0 is a fake user from git author */
|
8533bb0508 | ||
/* User with id == 0 is a fake user from git author */
|
bf1d0f2222 | ||
/* User with id == 0 is a fake user from git author */
|
41e78aabc1 | ||
/* User with id == 0 is a fake user from git author */
|
b460e66975 | ||
/* User with id == 0 is a fake user from git author */
|
cc25902d85 | ||
/* User with id == 0 is a fake user from git author */
|
c6c879dc45 | ||
/* User with id == 0 is a fake user from git author */
|
108a86df10 | ||
/* User with id == 0 is a fake user from git author */
|
59a9e5fd9c | ||
/* User with id == 0 is a fake user from git author */
|
4cfe8e9d0e | ||
/* User with id == 0 is a fake user from git author */
|
9f792d27c1 | ||
/* User with id == 0 is a fake user from git author */
|
eb09153a87 | ||
/* User with id == 0 is a fake user from git author */
|
c98d863715 | ||
/* User with id == 0 is a fake user from git author */
|
103ea42de7 | ||
/* User with id == 0 is a fake user from git author */
|
7dff03d2bc | ||
/* User with id == 0 is a fake user from git author */
|
37628f49a4 | ||
/* User with id == 0 is a fake user from git author */
|
c9ae7e236f | ||
/* User with id == 0 is a fake user from git author */
|
3e11a125df | ||
/* User with id == 0 is a fake user from git author */
|
7848f3c8bb | ||
/* User with id == 0 is a fake user from git author */
|
dfaf5a587f | ||
/* User with id == 0 is a fake user from git author */
|
d1fa601bb5 | ||
/* User with id == 0 is a fake user from git author */
|
37df093b7a | ||
/* User with id == 0 is a fake user from git author */
|
6a3b673a19 | ||
/* User with id == 0 is a fake user from git author */
|
6aa460f380 | ||
/* User with id == 0 is a fake user from git author */
|
fd611217e3 | ||
/* User with id == 0 is a fake user from git author */
|
3392905ff0 | ||
/* User with id == 0 is a fake user from git author */
|
6a0fa2fa3b | ||
/* User with id == 0 is a fake user from git author */
|
ffbc7b1777 | ||
/* User with id == 0 is a fake user from git author */
|
c9b5fc5cb6 | ||
/* User with id == 0 is a fake user from git author */
|
d42932deb4 | ||
/* User with id == 0 is a fake user from git author */
|
ab68f32074 | ||
/* User with id == 0 is a fake user from git author */
|
7134f0eb67 | ||
/* User with id == 0 is a fake user from git author */
|
2c02d1a70a | ||
/* User with id == 0 is a fake user from git author */
|
08f059d553 | ||
/* User with id == 0 is a fake user from git author */
|
50ec9d656c | ||
/* User with id == 0 is a fake user from git author */
|
f52ff234d7 | ||
/* User with id == 0 is a fake user from git author */
|
832cd98558 | ||
/* User with id == 0 is a fake user from git author */
|
af3cf17663 | ||
/* User with id == 0 is a fake user from git author */
|
660a66c58b | ||
/* User with id == 0 is a fake user from git author */
|
7f32a3298a | ||
/* User with id == 0 is a fake user from git author */
|
5d24118766 | ||
/* User with id == 0 is a fake user from git author */
|
a2e2f8ce7b | ||
/* User with id == 0 is a fake user from git author */
|
50d2fac736 | ||
/* User with id == 0 is a fake user from git author */
|
fa658801cf | ||
/* User with id == 0 is a fake user from git author */
|
6142ecd2e9 | ||
/* User with id == 0 is a fake user from git author */
|
94edff9996 | ||
/* User with id == 0 is a fake user from git author */
|
febe6aafd0 | ||
/* User with id == 0 is a fake user from git author */
|
f689e59b58 | ||
/* User with id == 0 is a fake user from git author */
|
ee9065f37c | ||
/* User with id == 0 is a fake user from git author */
|
c487215065 | ||
/* User with id == 0 is a fake user from git author */
|
b5a6a5c944 | ||
/* User with id == 0 is a fake user from git author */
|
a57179f7bb | ||
/* User with id == 0 is a fake user from git author */
|
16218f91a0 | ||
/* User with id == 0 is a fake user from git author */
|
dcce3e7e31 | ||
/* User with id == 0 is a fake user from git author */
|
50b3ea97b8 | ||
/* User with id == 0 is a fake user from git author */
|
eb8e057f5c | ||
/* User with id == 0 is a fake user from git author */
|
47e6b27b7b | ||
/* User with id == 0 is a fake user from git author */
|
7c1b176706 | ||
/* User with id == 0 is a fake user from git author */
|
178cbca5f5 | ||
/* User with id == 0 is a fake user from git author */
|
1a006ca46c | ||
/* User with id == 0 is a fake user from git author */
|
ca28ee71a4 | ||
/* User with id == 0 is a fake user from git author */
|
ef089d6982 | ||
/* User with id == 0 is a fake user from git author */
|
e1d67b7eb0 | ||
/* User with id == 0 is a fake user from git author */
|
b1eaa036d1 | ||
/* User with id == 0 is a fake user from git author */
|
00a1672400 | ||
/* User with id == 0 is a fake user from git author */
|
9216c4dca8 | ||
/* User with id == 0 is a fake user from git author */
|
23aafc699b | ||
/* User with id == 0 is a fake user from git author */
|
0159e0933f | ||
/* User with id == 0 is a fake user from git author */
|
b6c236a792 | ||
/* User with id == 0 is a fake user from git author */
|
9a8e5b59fd | ||
/* User with id == 0 is a fake user from git author */
|
6cbb30f285 | ||
/* User with id == 0 is a fake user from git author */
|
3384486ecd | ||
/* User with id == 0 is a fake user from git author */
|
37089dfe6a | ||
/* User with id == 0 is a fake user from git author */
|
dfd2294c89 | ||
/* User with id == 0 is a fake user from git author */
|
3951425860 | ||
/* User with id == 0 is a fake user from git author */
|
471fa75bc4 | ||
/* User with id == 0 is a fake user from git author */
|
71ec922958 | ||
/* User with id == 0 is a fake user from git author */
|
1e90010716 | ||
/* User with id == 0 is a fake user from git author */
|
502f0f31ad | ||
/* User with id == 0 is a fake user from git author */
|
5b2b966c0c | ||
/* User with id == 0 is a fake user from git author */
|
0cfe0158e7 | ||
/* User with id == 0 is a fake user from git author */
|
bcf50710a9 | ||
/* User with id == 0 is a fake user from git author */
|
032361a5e1 | ||
/* User with id == 0 is a fake user from git author */
|
3b27b21e34 | ||
/* User with id == 0 is a fake user from git author */
|
3858e49327 | ||
/* User with id == 0 is a fake user from git author */
|
ec82ddea97 | ||
/* User with id == 0 is a fake user from git author */
|
37c7b4ae74 | ||
/* User with id == 0 is a fake user from git author */
|
09245f44ed | ||
/* User with id == 0 is a fake user from git author */
|
a7dd27c31c | ||
/* User with id == 0 is a fake user from git author */
|
490eed99c1 | ||
/* User with id == 0 is a fake user from git author */
|
4015ba2758 | ||
/* User with id == 0 is a fake user from git author */
|
dec8503d94 | ||
/* User with id == 0 is a fake user from git author */
|
f3ce568dc5 | ||
/* User with id == 0 is a fake user from git author */
|
48121102bb | ||
/* User with id == 0 is a fake user from git author */
|
4c0daec76a | ||
/* User with id == 0 is a fake user from git author */
|
3f91ce4980 | ||
/* User with id == 0 is a fake user from git author */
|
3a73a7501c | ||
/* User with id == 0 is a fake user from git author */
|
bfb76457f7 | ||
/* User with id == 0 is a fake user from git author */
|
f8cbc57070 | ||
/* User with id == 0 is a fake user from git author */
|
e932add3c8 | ||
/* User with id == 0 is a fake user from git author */
|
a8b73f68de | ||
/* User with id == 0 is a fake user from git author */
|
949c731b87 | ||
/* User with id == 0 is a fake user from git author */
|
37474d915d | ||
/* User with id == 0 is a fake user from git author */
|
59b9d4869d | ||
/* User with id == 0 is a fake user from git author */
|
de408af478 | ||
/* User with id == 0 is a fake user from git author */
|
dc87b4023a | ||
/* User with id == 0 is a fake user from git author */
|
0c436c267f | ||
/* User with id == 0 is a fake user from git author */
|
ea01f2d0bf | ||
/* User with id == 0 is a fake user from git author */
|
afba553b08 | ||
/* User with id == 0 is a fake user from git author */
|
b18311517a | ||
/* User with id == 0 is a fake user from git author */
|
b44de5ea96 | ||
/* User with id == 0 is a fake user from git author */
|
fc65fa3a33 | ||
/* User with id == 0 is a fake user from git author */
|
8254919e9a | ||
/* User with id == 0 is a fake user from git author */
|
798a45c80d | ||
/* User with id == 0 is a fake user from git author */
|
265b18faa7 | ||
/* User with id == 0 is a fake user from git author */
|
b1702c58d4 | ||
/* User with id == 0 is a fake user from git author */
|
8da631d2f4 | ||
/* User with id == 0 is a fake user from git author */
|
0610328f2f | ||
/* User with id == 0 is a fake user from git author */
|
9d407559ca | ||
/* User with id == 0 is a fake user from git author */
|
4386372bf0 | ||
/* User with id == 0 is a fake user from git author */
|
c41d530053 | ||
/* User with id == 0 is a fake user from git author */
|
6f56e4fcff | ||
/* User with id == 0 is a fake user from git author */
|
16dcc5199a | ||
/* User with id == 0 is a fake user from git author */
|
21f026c1fe | ||
/* User with id == 0 is a fake user from git author */
|
c734e73690 | ||
/* User with id == 0 is a fake user from git author */
|
8c88ac81ac | ||
/* User with id == 0 is a fake user from git author */
|
b20a1083a5 | ||
/* User with id == 0 is a fake user from git author */
|
549aea421d | ||
/* User with id == 0 is a fake user from git author */
|
b83b4120fb | ||
/* User with id == 0 is a fake user from git author */
|
e554fd25f3 | ||
/* User with id == 0 is a fake user from git author */
|
15a37c761e | ||
/* User with id == 0 is a fake user from git author */
|
fbc3bf0093 | ||
/* User with id == 0 is a fake user from git author */
|
af4b3c9e98 | ||
/* User with id == 0 is a fake user from git author */
|
8293789af0 | ||
/* User with id == 0 is a fake user from git author */
|
1a85ff753d | ||
/* User with id == 0 is a fake user from git author */
|
a9032f80a7 | ||
/* User with id == 0 is a fake user from git author */
|
a130866f33 | ||
/* User with id == 0 is a fake user from git author */
|
4a076cb1d8 | ||
/* User with id == 0 is a fake user from git author */
|
e8cf6460cb | ||
/* User with id == 0 is a fake user from git author */
|
7a36c47bae | ||
/* User with id == 0 is a fake user from git author */
|
fd7f0f4989 | ||
/* User with id == 0 is a fake user from git author */
|
15ba79c33c | ||
/* User with id == 0 is a fake user from git author */
|
1a4120ed22 | ||
/* User with id == 0 is a fake user from git author */
|
98712ea047 | ||
/* User with id == 0 is a fake user from git author */
|
279179e999 | ||
/* User with id == 0 is a fake user from git author */
|
e6b7cea027 | ||
/* User with id == 0 is a fake user from git author */
|
89db873862 | ||
/* User with id == 0 is a fake user from git author */
|
c1d647b8e2 | ||
/* User with id == 0 is a fake user from git author */
|
b48034a42f | ||
/* User with id == 0 is a fake user from git author */
|
a4c6342573 | ||
/* User with id == 0 is a fake user from git author */
|
af60e817f3 | ||
/* User with id == 0 is a fake user from git author */
|
a878376507 | ||
/* User with id == 0 is a fake user from git author */
|
b56e7a66c0 | ||
/* User with id == 0 is a fake user from git author */
|
69b2ed8018 | ||
/* User with id == 0 is a fake user from git author */
|
1dd4a87e75 | ||
/* User with id == 0 is a fake user from git author */
|
95527d0544 | ||
/* User with id == 0 is a fake user from git author */
|
d67337476f | ||
/* User with id == 0 is a fake user from git author */
|
56fe854723 | ||
/* User with id == 0 is a fake user from git author */
|
f7636ecc5d | ||
/* User with id == 0 is a fake user from git author */
|
d61bf88525 | ||
/* User with id == 0 is a fake user from git author */
|
e56139cbf1 | ||
/* User with id == 0 is a fake user from git author */
|
2fc5fe33db | ||
/* User with id == 0 is a fake user from git author */
|
a3458a47e9 | ||
/* User with id == 0 is a fake user from git author */
|
c73bcedb1b | ||
/* User with id == 0 is a fake user from git author */
|
2b2e17494f | ||
/* User with id == 0 is a fake user from git author */
|
273a3f0c77 | ||
/* User with id == 0 is a fake user from git author */
|
a2b499a7b4 | ||
/* User with id == 0 is a fake user from git author */
|
f8fbc66cee | ||
/* User with id == 0 is a fake user from git author */
|
f74469a01c | ||
/* User with id == 0 is a fake user from git author */
|
f2b9005d64 | ||
/* User with id == 0 is a fake user from git author */
|
bda29ec4b3 | ||
/* User with id == 0 is a fake user from git author */
|
effb5f0200 | ||
/* User with id == 0 is a fake user from git author */
|
51f46a76da | ||
/* User with id == 0 is a fake user from git author */
|
23ffdebe25 | ||
/* User with id == 0 is a fake user from git author */
|
9ebd015454 | ||
/* User with id == 0 is a fake user from git author */
|
eebfc2db5e | ||
/* User with id == 0 is a fake user from git author */
|
b44c711708 | ||
/* User with id == 0 is a fake user from git author */
|
a6ba64d149 | ||
/* User with id == 0 is a fake user from git author */
|
7bb03e148d | ||
/* User with id == 0 is a fake user from git author */
|
2b4f3b5007 | ||
/* User with id == 0 is a fake user from git author */
|
8b2d370652 | ||
/* User with id == 0 is a fake user from git author */
|
69bcf4846b | ||
/* User with id == 0 is a fake user from git author */
|
b6d69db347 | ||
/* User with id == 0 is a fake user from git author */
|
dc0ab7c173 | ||
/* User with id == 0 is a fake user from git author */
|
8b2a6e6d4e | ||
/* User with id == 0 is a fake user from git author */
|
43e518b16f | ||
/* User with id == 0 is a fake user from git author */
|
a28897a739 | ||
/* User with id == 0 is a fake user from git author */
|
e00d040a9d | ||
/* User with id == 0 is a fake user from git author */
|
943473ef50 | ||
/* User with id == 0 is a fake user from git author */
|
46de31135c | ||
/* User with id == 0 is a fake user from git author */
|
104ce1f866 | ||
/* User with id == 0 is a fake user from git author */
|
c795e5c62e | ||
/* User with id == 0 is a fake user from git author */
|
3ed8a75620 | ||
/* User with id == 0 is a fake user from git author */
|
ff89c6a6ab | ||
/* User with id == 0 is a fake user from git author */
|
3b17e42092 | ||
/* User with id == 0 is a fake user from git author */
|
5f52208a3f | ||
/* User with id == 0 is a fake user from git author */
|
0ef49bbc47 | ||
/* User with id == 0 is a fake user from git author */
|
024c9d35db | ||
/* User with id == 0 is a fake user from git author */
|
11f325e278 | ||
/* User with id == 0 is a fake user from git author */
|
ccb9f7756b | ||
/* User with id == 0 is a fake user from git author */
|
be00a2991e | ||
/* User with id == 0 is a fake user from git author */
|
2facc77480 | ||
/* User with id == 0 is a fake user from git author */
|
8b62a66e9d | ||
/* User with id == 0 is a fake user from git author */
|
7217785e33 | ||
/* User with id == 0 is a fake user from git author */
|
dd0541c5fa | ||
/* User with id == 0 is a fake user from git author */
|
659daadeaf | ||
/* User with id == 0 is a fake user from git author */
|
80adf8aeb7 | ||
/* User with id == 0 is a fake user from git author */
|
7d83d10fed | ||
/* User with id == 0 is a fake user from git author */
|
3f8ecaef67 | ||
/* User with id == 0 is a fake user from git author */
|
8af9880d23 | ||
/* User with id == 0 is a fake user from git author */
|
4c89ca0c06 | ||
/* User with id == 0 is a fake user from git author */
|
75659d8dbe | ||
/* User with id == 0 is a fake user from git author */
|
6dc1a28af4 | ||
/* User with id == 0 is a fake user from git author */
|
5e7d0deffb | ||
/* User with id == 0 is a fake user from git author */
|
8fda9a017b | ||
/* User with id == 0 is a fake user from git author */
|
a433979bd7 | ||
/* User with id == 0 is a fake user from git author */
|
c8afa6d08a | ||
/* User with id == 0 is a fake user from git author */
|
639c5f8347 | ||
/* User with id == 0 is a fake user from git author */
|
822f54cc50 | ||
/* User with id == 0 is a fake user from git author */
|
9a3bff1103 | ||
/* User with id == 0 is a fake user from git author */
|
48678083ab | ||
/* User with id == 0 is a fake user from git author */
|
e067b495dc | ||
/* User with id == 0 is a fake user from git author */
|
bf00a06e24 |
1774
ZCppMain/ZCProcess.H
Normal file
1774
ZCppMain/ZCProcess.H
Normal file
File diff suppressed because it is too large
Load Diff
4695
ZCppMain/ZCProcess_Linux.H
Normal file
4695
ZCppMain/ZCProcess_Linux.H
Normal file
File diff suppressed because it is too large
Load Diff
3160
ZCppMain/ZCProcess_Win.H
Normal file
3160
ZCppMain/ZCProcess_Win.H
Normal file
File diff suppressed because it is too large
Load Diff
360
ZCppMain/ZMainAVL.H
Normal file
360
ZCppMain/ZMainAVL.H
Normal file
@ -0,0 +1,360 @@
|
||||
|
||||
|
||||
#ifndef __ZCPPMAIN_ZMAINAVL_H__
|
||||
#define __ZCPPMAIN_ZMAINAVL_H__
|
||||
|
||||
|
||||
#include "ZCppMain/ZMainHead.H"
|
||||
|
||||
|
||||
namespace ZNsMain
|
||||
{
|
||||
|
||||
namespace ZNsEnum
|
||||
{
|
||||
|
||||
enum ZEAVL_INSERT
|
||||
{
|
||||
ZEAVL_INSERT_RIGHT = +1 ,
|
||||
ZEAVL_INSERT_OK = 0 , /* 삽입 후의 평형계수가 0 이다. */
|
||||
ZEAVL_INSERT_LEFT = -1 ,
|
||||
ZEAVL_INSERT_NONE = -2 /* 삽입 안 됨 */
|
||||
};/*
|
||||
enum ZEAVL_INSERT*/
|
||||
|
||||
}/*
|
||||
namespace ZNsEnum*/
|
||||
|
||||
|
||||
namespace ZNsIFace
|
||||
{
|
||||
|
||||
template<typename TypeArg> class ZtCAVL_BASE
|
||||
{
|
||||
protected:
|
||||
|
||||
template<typename TNode> void OnEqual(TypeArg AR_Data, TNode* AP_Node)
|
||||
{
|
||||
}/*
|
||||
template<typename TNode> void OnEqual(TypeArg AR_Data, TNode* AP_Node) */
|
||||
|
||||
template<typename TKey, typename TNode> void OnEqualKey(TKey AR_Key, TNode* AP_Node)
|
||||
{
|
||||
}/*
|
||||
template<typename TKey, typename TNode> void OnEqualKey(TKey AR_Key, TNode* AP_Node) */
|
||||
|
||||
protected:
|
||||
};/*
|
||||
template<typename TypeArg> class ZtCAVL_BASE*/
|
||||
|
||||
|
||||
/*//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
■ 아래 ZtCAVL_NodeBase<> 의 각 멤버 함수는 ZtCAVL_BASE<> 의 멤버 함수보다
|
||||
인수가 하나 줄어든 것을 볼 수 있다. ZtCAVL_BASE<> 에서 같은 이름의 함수를
|
||||
자연스럽게 호출할 수 있게 한 것이다. 따라서 ZtCAVL_BASE<> 의 멤버 함수에
|
||||
서, AP_Node->OnEqual() 등으로 ZtCAVL_NodeBase<> 의 멤버 함수를 호출해 주
|
||||
지 않으면, ZtCAVL_NodeBase<> 의 멤버는 어디에서도 호출되지 않는다. 왜 최초
|
||||
에 이런 식으로 설계했을까. 한참 생각했는데, 아마 ZtCAVL_Multi_BASE<> 와
|
||||
ZtCAVL_Multi_NodeBase<> 를 사용할려고 그랬을 것이다.
|
||||
|
||||
-- 2012-09-03 19:20:00
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
template<typename TNodeArg> class ZtCAVL_NodeBase
|
||||
{
|
||||
protected:
|
||||
|
||||
void OnEqual(TNodeArg AR_Data)
|
||||
{
|
||||
}/*
|
||||
void OnEqual(TNodeArg AR_Data)*/
|
||||
|
||||
template<typename TKey> void OnEqualKey(TKey AR_Key)
|
||||
{
|
||||
}/*
|
||||
template<typename TKey> void OnEqualKey(TKey AR_Key)*/
|
||||
|
||||
protected:
|
||||
};/*
|
||||
template<typename TNodeArg> class ZtCAVL_NodeBase*/
|
||||
|
||||
|
||||
template<typename TypeArg> class ZtCAVL_Multi_BASE
|
||||
{
|
||||
protected:
|
||||
|
||||
template<typename TNode> void OnEqual(TypeArg AR_Data, TNode* AP_Node)
|
||||
{
|
||||
AP_Node->OnEqual(AR_Data);
|
||||
}/*
|
||||
template<typename TNode> void OnEqual(TypeArg AR_Data, TNode* AP_Node) */
|
||||
|
||||
template<typename TKey, typename TNode> void OnEqualKey(TKey AR_Key, TNode* AP_Node)
|
||||
{
|
||||
AP_Node->OnEqualKey(AR_Key);
|
||||
}/*
|
||||
template<typename TKey, typename TNode> void OnEqualKey(TKey AR_Key, TNode* AP_Node) */
|
||||
|
||||
protected:
|
||||
};/*
|
||||
template<typename TypeArg> class ZtCAVL_Multi_BASE*/
|
||||
|
||||
|
||||
/*//////////////////////////////////////////////////////////////
|
||||
|
||||
■ ZtCAVL_Multi_NodeBase template 로 multi set/map 을 구성하는 경우,
|
||||
ZtCAVL_Multi_NodeBase::TypeEqual 자료형에 접근하는 예.
|
||||
|
||||
class CTypeMy
|
||||
{
|
||||
public:
|
||||
typedef CLargeAVL<some param> CLargeMap;
|
||||
typedef typename CLargeMap::ZCNode::TypeEqual TypeEqual;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////*/
|
||||
|
||||
template< typename TNodeArg, typename TEqualList
|
||||
>
|
||||
class ZtCAVL_Multi_NodeBase ////////////////////
|
||||
{
|
||||
public :
|
||||
typedef TEqualList TypeEqual;
|
||||
protected:
|
||||
TEqualList mo_EqualList;
|
||||
public :
|
||||
|
||||
void OnEqual(TNodeArg AR_Data)
|
||||
{
|
||||
mo_EqualList.push_back(AR_Data);
|
||||
}/*
|
||||
void OnEqual(TNodeArg AR_Data)*/
|
||||
|
||||
template<typename TKey> void OnEqualKey(TKey AR_Key)
|
||||
{
|
||||
mo_EqualList.push_back(AR_Key);
|
||||
}/*
|
||||
template<typename TKey> void OnEqualKey(TKey AR_Key) */
|
||||
|
||||
const TEqualList& GetCEqualList() const
|
||||
{
|
||||
return mo_EqualList;
|
||||
}/*
|
||||
const TEqualList& GetCEqualList() const*/
|
||||
|
||||
public:
|
||||
};/*
|
||||
template< typename TNodeArg, typename TEqualList
|
||||
>
|
||||
class ZtCAVL_Multi_NodeBase //////////////////*/
|
||||
|
||||
|
||||
|
||||
/*/////////////////////////////////////////////////////////////////////
|
||||
|
||||
■ AVL 트리의 데이타 타입이 포인터인 경우, 포인터를 정수처럼 다루어서
|
||||
비교 연산자를 정의하는 클래스 템플릿이다.
|
||||
|
||||
/////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
template<typename TData> class ZtCAVL_PtrLongData
|
||||
{
|
||||
public :
|
||||
typedef TData* TypeData;
|
||||
protected:
|
||||
TData* mp_CData;
|
||||
public :
|
||||
|
||||
ZtCAVL_PtrLongData()
|
||||
{
|
||||
mp_CData=0;
|
||||
}/*
|
||||
ZtCAVL_PtrLongData()*/
|
||||
|
||||
TData* GetDataPtr() const
|
||||
{
|
||||
return mp_CData;
|
||||
}/*
|
||||
TData* GetDataPtr() const*/
|
||||
|
||||
void SetDataPtr(TData* AP_CData)
|
||||
{
|
||||
mp_CData=AP_CData;
|
||||
}/*
|
||||
void SetDataPtr(TData* AP_CData)*/
|
||||
|
||||
operator ZNsMain::ZTypIntPtr() const
|
||||
{
|
||||
return mp_CData;
|
||||
}/*
|
||||
operator ZNsMain::ZTypIntPtr() const*/
|
||||
|
||||
|
||||
ZtCAVL_PtrLongData& operator=(const ZtCAVL_PtrLongData& rhs)
|
||||
{
|
||||
mp_CData=rhs.mp_CData; return *this;
|
||||
}/*
|
||||
ZtCAVL_PtrLongData& operator=(const ZtCAVL_PtrLongData& rhs)*/
|
||||
|
||||
ZtCAVL_PtrLongData& operator=(const TData* AP_CData)
|
||||
{
|
||||
mp_CData=const_cast<TData*>(AP_CData); return *this;
|
||||
}/*
|
||||
ZtCAVL_PtrLongData& operator=(const TData* AP_CData)*/
|
||||
|
||||
bool operator==(const ZtCAVL_PtrLongData& rhs) const{return mp_CData==rhs.mp_CData;}
|
||||
bool operator> (const ZtCAVL_PtrLongData& rhs) const{return (ZNsMain::ZTypIntPtr)mp_CData > (ZNsMain::ZTypIntPtr)rhs.mp_CData;}
|
||||
bool operator< (const ZtCAVL_PtrLongData& rhs) const{return (ZNsMain::ZTypIntPtr)mp_CData < (ZNsMain::ZTypIntPtr)rhs.mp_CData;}
|
||||
|
||||
bool operator==(const TData* AP_CData) const{return mp_CData==AP_CData;}
|
||||
bool operator> (const TData* AP_CData) const{return (ZNsMain::ZTypIntPtr)mp_CData > (ZNsMain::ZTypIntPtr)AP_CData;}
|
||||
bool operator< (const TData* AP_CData) const{return (ZNsMain::ZTypIntPtr)mp_CData < (ZNsMain::ZTypIntPtr)AP_CData;}
|
||||
|
||||
protected:
|
||||
};/*
|
||||
template<typename TData> class ZtCAVL_PtrLongData*/
|
||||
|
||||
|
||||
/* int, long 같이 비교연산이 가능한 primitive 타입이나 object 를
|
||||
key 로 가지고 있는 경우에, 해당 AVL 트리의 노드 데이타로 바로
|
||||
쓸 수 있도록 wrap 한 클래스 템플릿 */
|
||||
|
||||
template< typename TKeyData ,
|
||||
typename TMainData,
|
||||
typename TKeyArg =const TKeyData &,
|
||||
typename TMainArg=const TMainData&
|
||||
>
|
||||
class ZtCAVL_KeyData //////////////////////////
|
||||
{
|
||||
public :
|
||||
typedef TKeyData TypeKey ;
|
||||
typedef TMainData TypeData;
|
||||
protected:
|
||||
TKeyData mo_CKeyData ; mutable
|
||||
TMainData mo_CMainData;
|
||||
public :
|
||||
|
||||
ZtCAVL_KeyData(){}
|
||||
|
||||
ZtCAVL_KeyData(TKeyArg AO_TKeyArg)
|
||||
{
|
||||
mo_CKeyData=AO_TKeyArg;
|
||||
}/*
|
||||
ZtCAVL_KeyData(TKeyArg AO_TKeyArg)*/
|
||||
|
||||
ZtCAVL_KeyData(TKeyArg AO_TKeyArg, TMainArg AO_TMainArg)
|
||||
{
|
||||
mo_CKeyData =AO_TKeyArg ;
|
||||
mo_CMainData=AO_TMainArg;
|
||||
}/*
|
||||
ZtCAVL_KeyData(TKeyArg AO_TKeyArg, TMainArg AO_TMainArg)*/
|
||||
|
||||
TKeyArg GetCKeyData () const{return mo_CKeyData ;}
|
||||
TMainArg GetCMainData () const{return mo_CMainData;}
|
||||
TMainData& GetCMainDataRef() const{return mo_CMainData;}
|
||||
|
||||
void SetCMainData(TMainArg AO_TRealArg) const
|
||||
{
|
||||
mo_CMainData=AO_TRealArg;
|
||||
}/*
|
||||
void SetCMainData(TMainArg AO_TRealArg) const*/
|
||||
|
||||
void SetKeyData(TKeyArg AO_TKeylArg)
|
||||
{
|
||||
mo_CKeyData=AO_TKeylArg;
|
||||
}/*
|
||||
void SetKeyData(TKeyArg AO_TKeylArg)*/
|
||||
|
||||
bool operator==(const ZtCAVL_KeyData& rhs) const{return mo_CKeyData==rhs.mo_CKeyData;}
|
||||
bool operator> (const ZtCAVL_KeyData& rhs) const{return mo_CKeyData> rhs.mo_CKeyData;}
|
||||
bool operator< (const ZtCAVL_KeyData& rhs) const{return mo_CKeyData< rhs.mo_CKeyData;}
|
||||
|
||||
bool operator==(TKeyArg AO_TPrimitive) const{return mo_CKeyData==AO_TPrimitive;}
|
||||
bool operator> (TKeyArg AO_TPrimitive) const{return mo_CKeyData> AO_TPrimitive;}
|
||||
bool operator< (TKeyArg AO_TPrimitive) const{return mo_CKeyData< AO_TPrimitive;}
|
||||
|
||||
ZtCAVL_KeyData& operator=(const ZtCAVL_KeyData& rhs)
|
||||
{
|
||||
if(this==&rhs) return *this;
|
||||
|
||||
mo_CKeyData =rhs.mo_CKeyData ;
|
||||
mo_CMainData=rhs.mo_CMainData; return *this;
|
||||
}/*
|
||||
ZtCAVL_KeyData& operator=(const ZtCAVL_KeyData& rhs)*/
|
||||
|
||||
ZtCAVL_KeyData& operator=(TKeyArg AO_TPrimitive)
|
||||
{
|
||||
mo_CKeyData=AO_TPrimitive; return *this;
|
||||
}/*
|
||||
ZtCAVL_KeyData& operator=(TKeyArg AO_TPrimitive)*/
|
||||
|
||||
public:
|
||||
};/*
|
||||
template< typename TKeyData ,
|
||||
typename TMainData,
|
||||
typename TKeyArg =const TKeyData &,
|
||||
typename TMainArg=const TMainData&
|
||||
>
|
||||
class ZtCAVL_KeyData ////////////////////////*/
|
||||
|
||||
}/*
|
||||
namespace ZNsIFace*/
|
||||
|
||||
|
||||
/*/////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
■ mulit set 으로 활용하는 예제코드
|
||||
|
||||
ZNsMain::CLargeAVL ///////////////////////////////////
|
||||
<
|
||||
int,
|
||||
int,
|
||||
ZNsMain::ZNsIFace::ZtCAVL_Multi_BASE<int>,
|
||||
ZNsMain::ZNsIFace::ZtCAVL_Multi_NodeBase<int, ZNsMain::ZtCDoubleList<int> >
|
||||
>
|
||||
VO_CLargeAvl_Multi; //////////////////////////////////
|
||||
|
||||
VO_CLargeAvl_Multi.AddData(1);
|
||||
VO_CLargeAvl_Multi.AddData(2);
|
||||
VO_CLargeAvl_Multi.AddData(2);
|
||||
VO_CLargeAvl_Multi.AddData(2);
|
||||
VO_CLargeAvl_Multi.AddData(2);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
|
||||
namespace NsType
|
||||
{
|
||||
|
||||
template< typename TStringData, //= ZNsMain::ZtCStringBase<char> ,
|
||||
typename TEnvVar , //= ZNsMain::ZNsCGI::ZNsBase::ZtCEnvVar<TStringData>,
|
||||
typename TEnvVarSet //= ZNsMain::ZtCObjAVL<TEnvVar>
|
||||
>
|
||||
class ZtCTypeEnvVarSet /*############################################################*/
|
||||
{
|
||||
public:
|
||||
typedef TStringData ZCStringData;
|
||||
typedef TEnvVar ZCEnvVar ;
|
||||
typedef TEnvVarSet ZCEnvVarSet ;
|
||||
typedef typename ZCEnvVarSet ::ZCNode ZCEnvVarNode;
|
||||
typedef typename ZCStringData::ZCMainChars ZCMainChars ;
|
||||
typedef typename ZCStringData::TypeChar TypeChar ;
|
||||
typedef typename ZCStringData::TypeLength TypeLength ;
|
||||
public:
|
||||
};/*
|
||||
template< typename TStringData, //= ZNsMain::ZtCStringBase<char> ,
|
||||
typename TEnvVar , //= ZNsMain::ZNsCGI::ZNsBase::ZtCEnvVar<TStringData>,
|
||||
typename TEnvVarSet //= NsCPP::ZtCObjAVL<TEnvVar>
|
||||
>
|
||||
class ZtCTypeEnvVarSet /*############################################################*/
|
||||
|
||||
}/*
|
||||
namespace NsType*/
|
||||
|
||||
}/*
|
||||
namespace ZNsMain */
|
||||
|
||||
|
||||
#endif // __ZCPPMAIN_ZMAINAVL_H__
|
628
ZCppMain/ZMainCGI.H
Normal file
628
ZCppMain/ZMainCGI.H
Normal file
@ -0,0 +1,628 @@
|
||||
|
||||
|
||||
#ifndef __ZNSMAIN__ZMAIN_CGI_H__
|
||||
#define __ZNSMAIN__ZMAIN_CGI_H__
|
||||
|
||||
|
||||
#include "ZCppMain/ZMainHead.H"
|
||||
#include "ZCppMain/ZMainEnc.H"
|
||||
#include "ZCppMain/ZtCStringEx.H"
|
||||
#include "ZCppMain/ZtCObjAVL.H"
|
||||
#include "ZCppMain/ZtCLoadXml.H"
|
||||
#include "ZCppMain/ZtCLoadDataBlock.H"
|
||||
|
||||
|
||||
namespace ZNsMain
|
||||
{
|
||||
|
||||
namespace ZNsCGI
|
||||
{
|
||||
|
||||
namespace NsInterface
|
||||
{
|
||||
}/*
|
||||
namespace NsInterface*/
|
||||
|
||||
namespace NsIFace
|
||||
{
|
||||
using namespace NsInterface;
|
||||
}/*
|
||||
namespace NsIFace*/
|
||||
|
||||
|
||||
namespace ZNsBase
|
||||
{
|
||||
|
||||
template<typename TStringData> class ZtCEnvVar
|
||||
{
|
||||
protected:
|
||||
TStringData mo_CStrEnvName ;
|
||||
TStringData mo_CStrEnvValue;
|
||||
public :
|
||||
|
||||
ZtCEnvVar()
|
||||
{
|
||||
}/*
|
||||
ZtCEnvVar()*/
|
||||
|
||||
ZtCEnvVar(const TStringData& AR_CStrEnvName)
|
||||
{
|
||||
mo_CStrEnvName = AR_CStrEnvName;
|
||||
}/*
|
||||
ZtCEnvVar(const TStringData& AR_CStrEnvName)*/
|
||||
|
||||
ZtCEnvVar(const TStringData& AR_CStrEnvName, const TStringData& AR_CStrEnvValue)
|
||||
{
|
||||
mo_CStrEnvName = AR_CStrEnvName ;
|
||||
mo_CStrEnvValue = AR_CStrEnvValue;
|
||||
}/*
|
||||
ZtCEnvVar(const TStringData& AR_CStrEnvName, const TStringData& AR_CStrEnvValue)*/
|
||||
|
||||
ZtCEnvVar<TStringData>& operator=(const ZtCEnvVar<TStringData>& rhs)
|
||||
{
|
||||
mo_CStrEnvName = rhs.mo_CStrEnvName ;
|
||||
mo_CStrEnvValue = rhs.mo_CStrEnvValue; return *this;
|
||||
}/*
|
||||
ZtCEnvVar<TStringData>& operator=(const ZtCEnvVar<TStringData>& rhs)*/
|
||||
|
||||
ZtCEnvVar<TStringData>& operator=(const TStringData& AR_CStrEnvName)
|
||||
{
|
||||
mo_CStrEnvName = AR_CStrEnvName; return *this;
|
||||
}/*
|
||||
ZtCEnvVar<TStringData>& operator=(const ZtCEnvVar<TStringData>& rhs)*/
|
||||
|
||||
void Set(const TStringData& AR_CStringEnvName, const TStringData& AR_CStringEnvValue)
|
||||
{
|
||||
mo_CStrEnvName = AR_CStringEnvName ;
|
||||
mo_CStrEnvValue = AR_CStringEnvValue;
|
||||
}/*
|
||||
void Set(const TStringData& AR_CStringEnvName, const TStringData& AR_CStringEnvValue)*/
|
||||
|
||||
|
||||
TStringData& GetName () {return mo_CStrEnvName ;}
|
||||
TStringData& GetValue() {return mo_CStrEnvValue;}
|
||||
|
||||
const TStringData& GetName () const {return mo_CStrEnvName ;}
|
||||
const TStringData& GetValue() const {return mo_CStrEnvValue;}
|
||||
|
||||
bool operator==(const ZtCEnvVar<TStringData>& rhs) const{
|
||||
return mo_CStrEnvName ==rhs.mo_CStrEnvName ;}
|
||||
|
||||
bool operator< (const ZtCEnvVar<TStringData>& rhs) const{
|
||||
return mo_CStrEnvName < rhs.mo_CStrEnvName ;}
|
||||
|
||||
bool operator> (const ZtCEnvVar<TStringData>& rhs) const{
|
||||
return mo_CStrEnvName > rhs.mo_CStrEnvName ;}
|
||||
|
||||
bool operator==(const TStringData& AR_CStrEnvName) const{
|
||||
return mo_CStrEnvName ==AR_CStrEnvName ;}
|
||||
|
||||
bool operator> (const TStringData& AR_CStrEnvName) const{
|
||||
return mo_CStrEnvName > AR_CStrEnvName ;}
|
||||
|
||||
bool operator< (const TStringData& AR_CStrEnvName) const{
|
||||
return mo_CStrEnvName < AR_CStrEnvName ;}
|
||||
|
||||
public:
|
||||
};/*
|
||||
template<typename TStringData> class ZtCEnvVar*/
|
||||
|
||||
|
||||
// CGI <20><><EFBFBD>̺귯<CCBA><EAB7AF><EFBFBD><EFBFBD> <20>ƴ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20≯<EFBFBD><CCB8><EFBFBD> Http Ŭ<><C5AC><EFBFBD>̾<EFBFBD>Ʈ
|
||||
// <20><EFBFBD><EEBFA1>, class ZtCFileUp <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>̴<EFBFBD>.
|
||||
|
||||
template< typename TStringData,
|
||||
typename TFileSize=ZNsMain::ZTypLengthF
|
||||
>
|
||||
class ZtCFileUp ///////////////////////////////////
|
||||
{
|
||||
public :
|
||||
typedef TFileSize TypeFileSize;
|
||||
protected:
|
||||
TStringData mo_FileName;
|
||||
TStringData mo_FileType;
|
||||
TStringData mo_EnviName;
|
||||
TFileSize ml_FileSize;
|
||||
public :
|
||||
|
||||
ZtCFileUp()
|
||||
{
|
||||
ml_FileSize = 0;
|
||||
};/*
|
||||
ZtCFileUp()*/
|
||||
|
||||
|
||||
TStringData& GetFileName() {return mo_FileName;}
|
||||
TStringData& GetFileType() {return mo_FileType;}
|
||||
TStringData& GetEnviName() {return mo_EnviName;}
|
||||
|
||||
const TStringData& GetFileName() const{return mo_FileName;}
|
||||
const TStringData& GetFileType() const{return mo_FileType;}
|
||||
const TStringData& GetEnviName() const{return mo_EnviName;}
|
||||
|
||||
TFileSize GetDataSize() const
|
||||
{
|
||||
return ml_FileSize;
|
||||
}/*
|
||||
TFileSize GetDataSize() const*/
|
||||
|
||||
void SetDataSize(TFileSize AL_FileSize)
|
||||
{
|
||||
ml_FileSize = AL_FileSize;
|
||||
}/*
|
||||
void SetDataSize(TFileSize AL_FileSize)*/
|
||||
|
||||
void AddDataSize(TFileSize AL_FileSize)
|
||||
{
|
||||
ml_FileSize += AL_FileSize;
|
||||
}/*
|
||||
void AddDataSize(TFileSize AL_FileSize)*/
|
||||
|
||||
TFileSize& GetDataSizeRef()
|
||||
{
|
||||
return ml_FileSize;
|
||||
}/*
|
||||
TFileSize& GetDataSizeRef()*/
|
||||
|
||||
public:
|
||||
};/*
|
||||
template< typename TStringData,
|
||||
typename TFileSize=ZNsMain::ZTypLengthF
|
||||
>
|
||||
class ZtCFileUp /////////////////////////////////*/
|
||||
|
||||
}/*
|
||||
namespace ZNsBase*/
|
||||
|
||||
|
||||
template<typename TStringData> void ZftEscapeHtml(TStringData& ARR_CString)
|
||||
{
|
||||
ARR_CString.Replace("&", "&" ).
|
||||
Replace("\"",""").
|
||||
Replace("<", "<" ).
|
||||
Replace(">", ">" ).
|
||||
Replace(" ", " ").
|
||||
/*//////*/ Replace("\n","<br />");
|
||||
|
||||
}/*
|
||||
template<typename TStringData> void ZftEscapeHtml(TStringData& ARR_CString) */
|
||||
|
||||
|
||||
template<typename TStringData> void ZftNL2BR(TStringData& ARR_CStringData)
|
||||
{
|
||||
ARR_CStringData.
|
||||
Replace("\r\n", "<br />").Replace("\n" , "<br />");
|
||||
}/*
|
||||
template<typename TStringData> void ZftNL2BR(TStringData& ARR_CStringData) */
|
||||
|
||||
|
||||
namespace ZNsType
|
||||
{
|
||||
|
||||
template< typename TStringData=ZNsMain::ZtCStringBase<char>
|
||||
>
|
||||
class ZtCTypeEnvVarSet /*##################################*/
|
||||
{
|
||||
public:
|
||||
typedef TStringData ZCStringData ;
|
||||
typedef ZNsMain::ZNsCGI::ZNsBase::
|
||||
ZtCEnvVar<ZCStringData> ZCEnvVar ;
|
||||
typedef ZNsMain::ZtCObjAVL<ZCEnvVar> ZCEnvVarSet ;
|
||||
typedef typename ZCEnvVarSet ::ZCNode ZCEnvVarNode ;
|
||||
typedef typename ZCStringData::ZCMainChars ZCMainChars ;
|
||||
typedef typename ZCStringData::TypeChar TypeChar ;
|
||||
typedef typename ZCStringData::TypeLength TypeLength ;
|
||||
public:
|
||||
};/*
|
||||
template< typename TStringData=ZNsMain::ZtCStringBase<char>
|
||||
>
|
||||
class ZtCTypeEnvVarSet ####################################*/
|
||||
|
||||
}/*
|
||||
namespace ZNsType*/
|
||||
|
||||
|
||||
template< typename TStringData, /*############################*/
|
||||
typename TTypeEnvVarSet =
|
||||
ZNsType::ZtCTypeEnvVarSet<TStringData>
|
||||
>
|
||||
class ZtCLoadSimUrlConfig : protected ZNsMain::ZtCLoadDataBlockOne
|
||||
< ZtCLoadSimUrlConfig
|
||||
<
|
||||
TStringData, TTypeEnvVarSet
|
||||
>,
|
||||
TStringData
|
||||
/*###########*/ > /*############################################*/
|
||||
{
|
||||
public :
|
||||
template< typename TTDerive, typename TTStringData
|
||||
>
|
||||
friend class ZNsMain::ZtCLoadDataBlockOne;
|
||||
public :
|
||||
typedef typename TTypeEnvVarSet::ZCStringData ZCStringData;
|
||||
typedef typename TTypeEnvVarSet::ZCEnvVar ZCEnvVar ;
|
||||
typedef typename TTypeEnvVarSet::ZCEnvVarSet ZCEnvVarSet ;
|
||||
typedef typename TTypeEnvVarSet::ZCEnvVarNode ZCEnvVarNode;
|
||||
typedef typename TTypeEnvVarSet::ZCMainChars ZCMainChars ;
|
||||
typedef typename TTypeEnvVarSet::TypeChar TypeChar ;
|
||||
typedef typename TTypeEnvVarSet::TypeLength TypeLength ;
|
||||
public :
|
||||
typedef ZNsMain::ZtCLoadDataBlockOne
|
||||
<ZtCLoadSimUrlConfig, TStringData> TypeBase;
|
||||
private:
|
||||
ZCEnvVarSet mo_CEnvVarSet ;
|
||||
ZCStringData mo_CStringName ;
|
||||
ZCStringData mo_CStringBuff ;
|
||||
ZCEnvVarNode* mp_CStringNode ;
|
||||
bool mb_DoFindEqual ; // '=' <20><> ã<><C3A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD> true
|
||||
public :
|
||||
typedef void (*TypePfOnMeetCEnvVar)
|
||||
(const ZCEnvVar& AR_CEnvVar, ZCStringData& ARR_CStringBuff);
|
||||
private:
|
||||
|
||||
static void OnMeetCEnvVar(const ZCEnvVar& AR_CEnvVar, ZCStringData& ARR_CStringBuff)
|
||||
{
|
||||
ZCStringData VO_CStringEnc(AR_CEnvVar.GetValue());
|
||||
|
||||
ZNsMain::ZNsEnc::ZftGetSimUrlEnc(RR(VO_CStringEnc));
|
||||
|
||||
ARR_CStringBuff
|
||||
("&")(AR_CEnvVar.GetName())("=")(VO_CStringEnc)("&\r\n");
|
||||
}/*
|
||||
static void OnMeetCEnvVar(const ZCEnvVar& AR_CEnvVar, ZCStringData& ARR_CStringBuff)*/
|
||||
|
||||
private:
|
||||
|
||||
static void ShowEnvVar(ZCEnvVar& AR_CEnvVar)
|
||||
{
|
||||
cout<<"# "<<AR_CEnvVar.GetName()<<" : "<<AR_CEnvVar.GetValue()<<endl;
|
||||
}/*
|
||||
static void ShowEnvVar(ZCEnvVar& AR_CEnvVar)*/
|
||||
|
||||
/*private:*/
|
||||
private:
|
||||
|
||||
ZNsMain::ZERun ExecBlockIn(const TypeChar* AP_Data, TypeLength AL_Length)
|
||||
{
|
||||
if(mb_DoFindEqual)
|
||||
{
|
||||
// mp_CStringNode==0 <20≯<EFBFBD> '=' <20><> ã<><C3A3> ã<><C3A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD≯<EFBFBD><CCB8><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ų<EFBFBD>, <20>ߺ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// mo_CEnvVarSet <20><> <20><><EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD> <20>ʾҴٴ<D2B4> <20><><EFBFBD>̴<EFBFBD>. <20>̶<EFBFBD><CCB6><EFBFBD> AP_Data <20><> <20>׳<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. (2011-12-18 15:28:00)
|
||||
|
||||
if(mp_CStringNode!=0)
|
||||
{
|
||||
// mo_CEnvVarSet <20><> <20><> <20>Է<EFBFBD>.
|
||||
|
||||
const_cast<ZCEnvVar&>(mp_CStringNode->GetData()).
|
||||
GetValue()(AP_Data, AL_Length) ;
|
||||
/*+++++++++++++++++++++++++++++++++++++++++++++*/
|
||||
}/*
|
||||
if(mp_CStringNode!=0)*/
|
||||
|
||||
return ZNsMain::ZERun_OK;
|
||||
}/*
|
||||
if(mb_DoFindEqual)*/
|
||||
|
||||
TypeLength VL_FindPos = ZCMainChars::
|
||||
FindPos(AP_Data, "=", AL_Length, 1); // 1 <20><> "=" <20><> <20><><EFBFBD><EFBFBD>
|
||||
|
||||
if(VL_FindPos<0)
|
||||
{
|
||||
mo_CStringName(AP_Data, AL_Length); return ZNsMain::ZERun_OK;
|
||||
}/*
|
||||
if(VL_FindPos<0)*/
|
||||
|
||||
|
||||
mb_DoFindEqual=true; mo_CStringName(AP_Data, VL_FindPos).Trim();
|
||||
|
||||
if(mo_CStringName.size()< 1) return ZNsMain::ZERun_OK;
|
||||
|
||||
mo_CStringName = ZNsMain::
|
||||
ZNsEnc::ZftGetSimUrlDec( RR(mo_CStringName) ) ;
|
||||
|
||||
if(mo_CStringName.size()< 1) return ZNsMain::ZERun_OK;
|
||||
|
||||
mp_CStringNode=mo_CEnvVarSet.AddKey(mo_CStringName);
|
||||
|
||||
if(mp_CStringNode ==0) return ZNsMain::ZERun_OK;
|
||||
|
||||
|
||||
const_cast<ZCEnvVar&>(mp_CStringNode->GetData()).GetValue()
|
||||
(
|
||||
AP_Data +VL_FindPos+1,
|
||||
AL_Length-VL_FindPos-1
|
||||
);
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
return ZNsMain::ZERun_OK;
|
||||
}/*
|
||||
ZNsMain::ZERun ExecBlockIn(const TypeChar* AP_Data, TypeLength AL_Length)*/
|
||||
|
||||
ZNsMain::ZERun ExecBlockMatch(const TypeChar* AP_Data, TypeLength AL_Length)
|
||||
{
|
||||
// <20>и<EFBFBD> <20><><EFBFBD><EFBFBD> "&" <20><> <20>߰ߵ<DFB0> <20><><EFBFBD><EFBFBD>, <20><> <20><><EFBFBD><EFBFBD> <20>ʱ<EFBFBD>ȭ.
|
||||
|
||||
if(mp_CStringNode!=0)
|
||||
{
|
||||
const_cast<ZCEnvVar&>(mp_CStringNode->GetData()).GetValue().Trim();
|
||||
}/*
|
||||
if(mp_CStringNode!=0)*/
|
||||
|
||||
mp_CStringNode = 0 ;
|
||||
mo_CStringName = "" ;
|
||||
mb_DoFindEqual = false;
|
||||
|
||||
return ZNsMain::ZERun_OK;
|
||||
}/*
|
||||
ZNsMain::ZERun ExecBlockMatch(const TypeChar* AP_Data, TypeLength AL_Length)*/
|
||||
|
||||
/*private:*/
|
||||
public :
|
||||
|
||||
ZtCLoadSimUrlConfig()
|
||||
{
|
||||
mp_CStringNode=0 ;
|
||||
mb_DoFindEqual=false;
|
||||
|
||||
this->TypeBase::SetSearchCString(ZCStringData("&"));
|
||||
}/*
|
||||
ZtCLoadSimUrlConfig()*/
|
||||
|
||||
ZCStringData& GetCStringBuff() {return mo_CStringBuff;}
|
||||
ZCEnvVarSet GetCEnvVarSet () {return mo_CEnvVarSet ;}
|
||||
|
||||
const ZCStringData& GetCStringBuff() const{return mo_CStringBuff;}
|
||||
const ZCEnvVarSet GetCEnvVarSet () const{return mo_CEnvVarSet ;}
|
||||
|
||||
void LoadData (const ZCStringData& AR_CStringConf){
|
||||
LoadData (AR_CStringConf.data(), AR_CStringConf.size()); }
|
||||
void LoadDataEx(const ZCStringData& AR_CStringConf){
|
||||
LoadDataEx(AR_CStringConf.data(), AR_CStringConf.size()); }
|
||||
|
||||
void LoadData(const TypeChar* APC_ConfigData, TypeLength AI_ConfigLen)
|
||||
{
|
||||
this->TypeBase::LoadData(APC_ConfigData, AI_ConfigLen);
|
||||
}/*
|
||||
void LoadData(const TypeChar* APC_ConfigData, TypeLength AI_ConfigLen)*/
|
||||
|
||||
void LoadDataEx(const TypeChar* APC_ConfigData, TypeLength AI_ConfigLen)
|
||||
{
|
||||
this->TypeBase::LoadData(APC_ConfigData, AI_ConfigLen);
|
||||
|
||||
mo_CStringName.clear();
|
||||
mp_CStringNode=0 ;
|
||||
mb_DoFindEqual=false ;
|
||||
}/*
|
||||
void LoadDataEx(const TypeChar* APC_ConfigData, TypeLength AI_ConfigLen)*/
|
||||
|
||||
void clear()
|
||||
{
|
||||
mo_CEnvVarSet .clear();
|
||||
mo_CStringName.clear();
|
||||
mp_CStringNode=0 ;
|
||||
mb_DoFindEqual=false ;
|
||||
}/*
|
||||
void clear()*/
|
||||
|
||||
|
||||
long GetLongValue(const ZCStringData& AR_CStringName)
|
||||
{
|
||||
ZCEnvVarNode* VP_CEnvVarNode=mo_CEnvVarSet.FindKey(AR_CStringName);
|
||||
|
||||
if(VP_CEnvVarNode==0) return 0; return VP_CEnvVarNode->GetData().GetValue().GetLong();
|
||||
}/*
|
||||
long GetLongValue(const ZCStringData& AR_CStringName)*/
|
||||
|
||||
long GetLongValue(const ZCStringData& AR_CStringName, long& ARRL_Long)
|
||||
{
|
||||
ZCEnvVarNode* VP_CEnvVarNode=mo_CEnvVarSet.FindKey(AR_CStringName);
|
||||
|
||||
if(VP_CEnvVarNode==0) return ARRL_Long; return ARRL_Long=VP_CEnvVarNode->GetData().GetValue().GetLong();
|
||||
}/*
|
||||
long GetLongValue(const ZCStringData& AR_CStringName, long& ARRL_Long)*/
|
||||
|
||||
|
||||
ZCStringData& GetCStringValue(const ZCStringData& AR_CStringName, ZCStringData& ARR_CStringValue)
|
||||
{
|
||||
ZCEnvVarNode* VP_CEnvVarNode=mo_CEnvVarSet.FindKey(AR_CStringName);
|
||||
|
||||
if(VP_CEnvVarNode==0) return ARR_CStringValue;
|
||||
|
||||
return ARR_CStringValue=VP_CEnvVarNode->GetData().GetValue();
|
||||
}/*
|
||||
ZCStringData& GetCStringValue(const ZCStringData& AR_CStringName, ZCStringData& ARR_CStringValue)*/
|
||||
|
||||
ZCStringData GetCStringValue(const ZCStringData& AR_CStringName)
|
||||
{
|
||||
ZCStringData VO_ValueCStr; return GetCStringValue(AR_CStringName, RR(VO_ValueCStr));
|
||||
}/*
|
||||
ZCStringData GetCStringValue(const ZCStringData& AR_CStringName)*/
|
||||
|
||||
ZCStringData* GetCStringValuePtr(const ZCStringData& AR_CStringName)
|
||||
{
|
||||
ZCEnvVarNode* VP_CEnvVarNode =
|
||||
mo_CEnvVarSet.FindKey(AR_CStringName);
|
||||
|
||||
if(VP_CEnvVarNode==0) return 0;
|
||||
|
||||
return const_cast<ZCStringData*>(
|
||||
&VP_CEnvVarNode->GetData().GetValue());
|
||||
}/*
|
||||
ZCStringData* GetCStringValuePtr(const ZCStringData& AR_CStringName)*/
|
||||
|
||||
const ZCStringData* GetCStringValuePtr(const ZCStringData& AR_CStringName) const
|
||||
{
|
||||
ZCEnvVarNode* VP_CEnvVarNode =
|
||||
mo_CEnvVarSet.FindKey(AR_CStringName);
|
||||
|
||||
if(VP_CEnvVarNode==0) return 0;
|
||||
|
||||
return &VP_CEnvVarNode->GetData().GetValue();
|
||||
}/*
|
||||
const ZCStringData* GetCStringValuePtr(const ZCStringData& AR_CStringName) const*/
|
||||
|
||||
|
||||
bool AddCEnvVar(const ZCEnvVar& AR_CEnvVar)
|
||||
{
|
||||
return mo_CEnvVarSet.AddData(AR_CEnvVar);
|
||||
}/*
|
||||
bool AddCEnvVar(const ZCEnvVar& AR_CEnvVar)*/
|
||||
|
||||
bool AddCEnvVar(const ZCStringData& AR_NameCStr, const ZCStringData& AR_ValueCStr)
|
||||
{
|
||||
return mo_CEnvVarSet.AddData(ZCEnvVar(AR_NameCStr, AR_ValueCStr));
|
||||
}/*
|
||||
bool AddCEnvVar(const ZCStringData& AR_NameCStr, const ZCStringData& AR_ValueCStr)*/
|
||||
|
||||
bool AddCEnvVarLong(const ZCStringData& AR_NameCStr, long AL_LongValue)
|
||||
{
|
||||
return mo_CEnvVarSet.AddData(ZCEnvVar(AR_NameCStr, ZCStringData(AL_LongValue)));
|
||||
}/*
|
||||
bool AddCEnvVarLong(const ZCStringData& AR_NameCStr, long AL_LongValue)*/
|
||||
|
||||
bool CutCEnvVar(const ZCStringData& AR_NameCStr)
|
||||
{
|
||||
return mo_CEnvVarSet.template DeleteKey<const ZCStringData&>(AR_NameCStr);
|
||||
}/*
|
||||
bool CutCEnvVar(const ZCStringData& AR_NameCStr)*/
|
||||
|
||||
bool AddEditCEnvVar(const ZCEnvVar& AR_CEnvVar) // <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>߰<EFBFBD>.
|
||||
{
|
||||
CutCEnvVar(AR_CEnvVar.GetName()); return mo_CEnvVarSet.AddData(AR_CEnvVar);
|
||||
}/*
|
||||
bool AddEditCEnvVar(const ZCEnvVar& AR_CEnvVar)*/
|
||||
|
||||
bool AddEditCEnvVar(const ZCStringData& AR_NameCStr, const ZCStringData& AR_ValueCStr)
|
||||
{
|
||||
CutCEnvVar(AR_NameCStr); return mo_CEnvVarSet.AddData(ZCEnvVar(AR_NameCStr, AR_ValueCStr));
|
||||
}/*
|
||||
bool AddEditCEnvVar(const ZCStringData& AR_NameCStr, const ZCStringData& AR_ValueCStr)*/
|
||||
|
||||
bool EditCEnvVar(const ZCEnvVar& AR_CEnvVar) // <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
{
|
||||
if(CutCEnvVar(AR_CEnvVar.GetName())) return mo_CEnvVarSet.AddData(AR_CEnvVar); return false;
|
||||
}/*
|
||||
bool EditCEnvVar(const ZCEnvVar& AR_CEnvVar)*/
|
||||
|
||||
bool EditCEnvVar(const ZCStringData& AR_NameCStr, const ZCStringData& AR_ValueCStr)
|
||||
{
|
||||
if(CutCEnvVar(AR_NameCStr))
|
||||
return mo_CEnvVarSet.AddData(ZCEnvVar(AR_NameCStr, AR_ValueCStr));
|
||||
return false;
|
||||
}/*
|
||||
bool EditCEnvVar(const ZCStringData& AR_NameCStr, const ZCStringData& AR_ValueCStr)*/
|
||||
|
||||
|
||||
void Serialize(ZCStringData& ARR_SerialCStr, TypePfOnMeetCEnvVar APF_OnMeetCEnvVar)
|
||||
{
|
||||
mo_CEnvVarSet.template IterInOrder<TypePfOnMeetCEnvVar, ZCStringData&>
|
||||
(
|
||||
APF_OnMeetCEnvVar, RR(ARR_SerialCStr)
|
||||
);
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
}/*
|
||||
void Serialize(ZCStringData& ARR_SerialCStr, TypePfOnMeetCEnvVar APF_OnMeetCEnvVar)*/
|
||||
|
||||
void Serialize(ZCStringData& ARR_SerialCStr) /////////////////////////////
|
||||
{
|
||||
mo_CEnvVarSet.template IterInOrder<TypePfOnMeetCEnvVar, ZCStringData&>
|
||||
(
|
||||
OnMeetCEnvVar, RR(ARR_SerialCStr)
|
||||
);
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
}/*
|
||||
void Serialize(ZCStringData& ARR_SerialCStr)*/
|
||||
|
||||
void Serialize()
|
||||
{
|
||||
Serialize( RR(this->mo_CStringBuff="") );
|
||||
}/*
|
||||
void Serialize()*/
|
||||
|
||||
|
||||
template<typename TFunctor> void IterEnvSet(TFunctor AO_Functor)
|
||||
{
|
||||
mo_CEnvVarSet.template IterInOrder<TFunctor>(AO_Functor);
|
||||
}/*
|
||||
template<typename TFunctor> void IterEnvSet(TFunctor AO_Functor)*/
|
||||
|
||||
void IterEnvSet()
|
||||
{
|
||||
IterEnvSet(&ShowEnvVar); // for debug
|
||||
}/*
|
||||
void IterEnvSet()*/
|
||||
|
||||
public:
|
||||
};/*
|
||||
template< typename TStringData, ##########################
|
||||
typename TTypeEnvVarSet =
|
||||
ZNsType::ZtCTypeEnvVarSet<TStringData>
|
||||
>
|
||||
class ZtCLoadSimUrlConfig ################################*/
|
||||
|
||||
|
||||
template< typename TStringData=ZNsMain::ZtCStringBase<char>
|
||||
>
|
||||
class ZtCLoadXmlInfo /*####################################*/
|
||||
{
|
||||
public :
|
||||
|
||||
typedef TStringData ZCStringData;
|
||||
|
||||
typedef typename ZCStringData::TypeLength TypeLength;
|
||||
|
||||
typedef ZNsMain::ZNsType::ZtCTypeXmlInfo< ///////////
|
||||
ZCStringData
|
||||
/*/////////*/ > ZCTypeXmlInfo; //////////////////////
|
||||
|
||||
typedef ZNsMain::ZtCXmlInfo<ZCTypeXmlInfo> ZCXmlInfo;
|
||||
typedef ZNsMain::ZNsView::ZtCViewLoadXmlOfXmlInfo<
|
||||
ZCXmlInfo
|
||||
/*/////////*/ > ZCViewLoadXml; //////////////////////
|
||||
typedef ZNsMain::ZtCLoadXml<ZCStringData> ZCLoadXml;
|
||||
|
||||
/*public :*/
|
||||
private:
|
||||
ZCViewLoadXml m_oCViewLoad;
|
||||
ZCLoadXml m_oCLoadXml ;
|
||||
public :
|
||||
|
||||
ZCLoadXml& GetCLoadXml(){return m_oCLoadXml ;}
|
||||
ZCXmlInfo& GetCXmlInfo(){return m_oCViewLoad.GetCXmlInfo();}
|
||||
|
||||
ZNsMain::ZERunEx Exec(const char* APC_XmlData, TypeLength AI_Length)
|
||||
{
|
||||
m_oCViewLoad.clear();
|
||||
m_oCLoadXml .clear(); return m_oCLoadXml.
|
||||
ExecAll(RR(m_oCViewLoad), APC_XmlData, AI_Length);
|
||||
}/*
|
||||
ZNsMain::ZERunEx Exec(const char* APC_XmlData, TypeLength AI_Length)*/
|
||||
|
||||
ZNsMain::ZERunEx Exec(const ZCStringData& ArgrXmlData)
|
||||
{
|
||||
return Exec(ArgrXmlData.data(), ArgrXmlData.size());
|
||||
}/*
|
||||
ZNsMain::ZERunEx Exec(const ZCStringData& ArgrXmlData)*/
|
||||
|
||||
template<typename TMainChars>
|
||||
ZNsMain::ZERunEx Exec(const TMainChars& AR_CMainChars)
|
||||
{
|
||||
return Exec(AR_CMainChars.data(), AR_CMainChars.size());
|
||||
}/*
|
||||
template<typename TMainChars>
|
||||
ZNsMain::ZERunEx Exec(const TMainChars& AR_CMainChars)*/
|
||||
|
||||
public :
|
||||
};/*
|
||||
template< typename TStringData=ZNsMain::ZtCStringBase<char>
|
||||
>
|
||||
class ZtCLoadXmlInfo ######################################*/
|
||||
|
||||
}/*
|
||||
namespace ZNsCGI*/
|
||||
|
||||
}/*
|
||||
namespace ZNsMain */
|
||||
|
||||
|
||||
#endif //__ZNSMAIN__ZMAIN_CGI_H__
|
1747
ZCppMain/ZMainEnc.H
Normal file
1747
ZCppMain/ZMainEnc.H
Normal file
File diff suppressed because it is too large
Load Diff
8577
ZCppMain/ZMainHead.H
Normal file
8577
ZCppMain/ZMainHead.H
Normal file
File diff suppressed because it is too large
Load Diff
7504
ZCppMain/ZMainHeadEx.H
Normal file
7504
ZCppMain/ZMainHeadEx.H
Normal file
File diff suppressed because it is too large
Load Diff
920
ZCppMain/ZtCArray.H
Normal file
920
ZCppMain/ZtCArray.H
Normal file
@ -0,0 +1,920 @@
|
||||
|
||||
|
||||
#ifndef __ZCPPMAIIN__ZTCARRAY_H__
|
||||
#define __ZCPPMAIIN__ZTCARRAY_H__
|
||||
|
||||
|
||||
#include "ZCppMain/ZMainHead.H"
|
||||
|
||||
|
||||
namespace ZNsMain
|
||||
{
|
||||
|
||||
template< typename TType ,
|
||||
typename TTypArg=const TType&,
|
||||
typename TSize =long
|
||||
>
|
||||
class ZtCArray //////////////////////////
|
||||
{
|
||||
public:
|
||||
typedef TType Type ;
|
||||
typedef TType TypeData;
|
||||
typedef TTypArg TypeArg ;
|
||||
typedef TSize TypeSize;
|
||||
public:
|
||||
class ZCIterator;
|
||||
public:
|
||||
typedef Type* IterEasy;
|
||||
typedef ZCIterator iterator;
|
||||
typedef const ZCIterator const_iterator;
|
||||
public:
|
||||
|
||||
|
||||
class ZCIterator
|
||||
{
|
||||
private: mutable
|
||||
Type* mp_Data ; mutable
|
||||
TSize ml_ElePos; // *mp_Data 가 배열에서 차지하는 위치
|
||||
ZtCArray* mp_CArray;
|
||||
public:
|
||||
|
||||
ZCIterator()
|
||||
{
|
||||
mp_Data =0;
|
||||
mp_CArray=0;
|
||||
ml_ElePos=0;
|
||||
}/*
|
||||
ZCIterator()*/
|
||||
|
||||
ZCIterator(ZtCArray& AR_CArray, Type& AR_CData, TSize AL_ElePos)
|
||||
{
|
||||
mp_Data =&AR_CData ;
|
||||
mp_CArray=&AR_CArray;
|
||||
ml_ElePos=AL_ElePos ;
|
||||
}/*
|
||||
ZCIterator(ZtCArray& AR_CArray, Type& AR_CData, TSize AL_ElePos)*/
|
||||
|
||||
ZCIterator(ZtCArray& AR_CArray)
|
||||
{
|
||||
mp_Data = AR_CArray.mp_TypeArr ;
|
||||
mp_CArray=&AR_CArray ;
|
||||
ml_ElePos=(AR_CArray.size()>0 ? 1 : 0 ) ;
|
||||
}/*
|
||||
ZCIterator(ZtCArray& AR_CArray)*/
|
||||
|
||||
ZCIterator(const ZtCArray& AR_CArray)
|
||||
{
|
||||
mp_Data = AR_CArray.mp_TypeArr ;
|
||||
mp_CArray= const_cast<ZtCArray*>(&AR_CArray);
|
||||
ml_ElePos= (AR_CArray.size()>0 ? 1 : 0 ) ;
|
||||
}/*
|
||||
ZCIterator(const ZtCArray& AR_CArray)*/
|
||||
|
||||
Type& operator*( ){return *mp_Data;}
|
||||
Type* operator->(){return mp_Data;}
|
||||
|
||||
const Type& operator* () const{return *mp_Data;}
|
||||
const Type* operator->() const{return mp_Data;}
|
||||
|
||||
ZCIterator& operator++( ){++mp_Data; ++ml_ElePos; return *this;}
|
||||
ZCIterator operator++(int){++mp_Data; ++ml_ElePos; return *this;}
|
||||
|
||||
const ZCIterator& operator++( ) const{++mp_Data; ++ml_ElePos; return *this;}
|
||||
const ZCIterator operator++(int) const{++mp_Data; ++ml_ElePos; return *this;}
|
||||
|
||||
ZCIterator operator+(TSize AL_AddPos) const
|
||||
{
|
||||
return ZCIterator(*this, mp_Data+AL_AddPos, ml_ElePos+AL_AddPos);
|
||||
}/*
|
||||
ZCIterator operator+(TSize AL_AddPos) const*/
|
||||
|
||||
public:
|
||||
};/*
|
||||
class ZCIterator
|
||||
|
||||
|
||||
public :*/
|
||||
protected:
|
||||
enum{ZEAddSize=20};
|
||||
protected:
|
||||
|
||||
Type* mp_TypeArr ;
|
||||
TypeSize ml_AllSize ;
|
||||
TypeSize ml_UseSize ;
|
||||
TypeSize ml_AddSize ;
|
||||
|
||||
/* TSize ml_AddSize 는 추가 메모리를 지정. 한 개의 원소가 삽입되서
|
||||
재할당해야 할 경우, ml_AddSize 개 만큼을 미리 할당한다.
|
||||
|
||||
protected:*/
|
||||
public :
|
||||
|
||||
|
||||
ZtCArray()
|
||||
{
|
||||
mp_TypeArr =0;
|
||||
ml_AllSize =0;
|
||||
ml_UseSize =0;
|
||||
ml_AddSize =ZEAddSize;
|
||||
}/*
|
||||
ZtCArray()*/
|
||||
|
||||
ZtCArray(const ZtCArray& rhs)
|
||||
{
|
||||
mp_TypeArr =0;
|
||||
ml_AllSize =0;
|
||||
ml_UseSize =0;
|
||||
ml_AddSize =ZEAddSize;
|
||||
|
||||
*this=rhs;
|
||||
}/*
|
||||
ZtCArray(const ZtCArray& rhs)*/
|
||||
|
||||
~ZtCArray()
|
||||
{
|
||||
Delete();
|
||||
}/*
|
||||
~ZtCArray()*/
|
||||
|
||||
ZtCArray& operator=(const ZtCArray& rhs)
|
||||
{
|
||||
if(this==&rhs) return *this ;
|
||||
|
||||
ReAlloc(rhs.ml_UseSize, false);
|
||||
|
||||
ml_UseSize = rhs.ml_UseSize;
|
||||
ml_AllSize = rhs.ml_AllSize;
|
||||
|
||||
for(TypeSize i=0; i<ml_UseSize; ++i)
|
||||
{
|
||||
mp_TypeArr[i] = rhs.mp_TypeArr[i];
|
||||
}/*
|
||||
for(TypeSize i=0; i<ml_UseSize; ++i)*/
|
||||
|
||||
return *this;
|
||||
}/*
|
||||
ZtCArray& operator=(const ZtCArray& rhs)*/
|
||||
|
||||
ZtCArray& operator()(TypeArg AR_TypeArg)
|
||||
{
|
||||
AddTail(AR_TypeArg); return *this;
|
||||
}/*
|
||||
ZtCArray& operator()(TypeArg AR_TypeArg)*/
|
||||
|
||||
|
||||
void Delete()
|
||||
{
|
||||
delete [] mp_TypeArr;
|
||||
|
||||
mp_TypeArr =0;
|
||||
ml_AllSize =0;
|
||||
ml_UseSize =0;
|
||||
}/*
|
||||
void Delete()*/
|
||||
|
||||
void clear()
|
||||
{
|
||||
Delete();
|
||||
}/*
|
||||
void clear()*/
|
||||
|
||||
|
||||
TypeSize GetAllSize() const{return ml_AllSize;}
|
||||
TypeSize GetUseSize() const{return ml_UseSize;}
|
||||
TypeSize GetAddSize() const{return ml_AddSize;}
|
||||
|
||||
TypeSize size () const{return ml_UseSize;}
|
||||
TypeSize capacity () const{return ml_AllSize;}
|
||||
|
||||
|
||||
void SetAddSize(TypeSize AL_NewAddSize)
|
||||
{
|
||||
if(AL_NewAddSize>=1) ml_AddSize=AL_NewAddSize;
|
||||
}/*
|
||||
void SetAddSize(TypeSize AL_NewAddSize)*/
|
||||
|
||||
void SetUseSize(TypeSize AL_NewUseSize)
|
||||
{
|
||||
if(AL_NewUseSize>=0 && AL_NewUseSize<=ml_AllSize)
|
||||
{
|
||||
ml_UseSize = AL_NewUseSize;
|
||||
}/*
|
||||
if(AL_NewUseSize>=0 && AL_NewUseSize<=ml_AllSize)*/
|
||||
}/*
|
||||
void SetUseSize(TypeSize AL_NewUseSize)*/
|
||||
|
||||
|
||||
void ReAlloc(TypeSize AL_AllocSize, bool AB_DoKeep=true)
|
||||
{
|
||||
if(AL_AllocSize<1) return ;
|
||||
|
||||
if(AL_AllocSize<ml_AllSize)
|
||||
{
|
||||
return ;
|
||||
}
|
||||
if(AL_AllocSize-ml_AllSize<ml_AddSize)
|
||||
{
|
||||
AL_AllocSize=ml_AllSize+ml_AddSize ;
|
||||
}/*
|
||||
if(AL_AllocSize-ml_AllSize<ml_AddSize)*/
|
||||
|
||||
if(mp_TypeArr==0)
|
||||
{
|
||||
mp_TypeArr =new Type[AL_AllocSize];
|
||||
ml_AllSize =AL_AllocSize ;
|
||||
|
||||
return ;
|
||||
}/*
|
||||
if(mp_TypeArr==0)*/
|
||||
|
||||
if(AB_DoKeep)
|
||||
{
|
||||
Type* VP_ArrType=new Type[AL_AllocSize] ;
|
||||
|
||||
memcpy(VP_ArrType, mp_TypeArr, ml_AllSize*sizeof(Type));
|
||||
|
||||
delete [] mp_TypeArr; mp_TypeArr=VP_ArrType;
|
||||
}
|
||||
else
|
||||
{
|
||||
delete [] mp_TypeArr; mp_TypeArr=new Type[AL_AllocSize] ;
|
||||
}/*
|
||||
else*/
|
||||
|
||||
ml_AllSize=AL_AllocSize;
|
||||
}/*
|
||||
void ReAlloc(TypeSize AL_AllocSize, bool AB_DoKeep=true)*/
|
||||
|
||||
|
||||
// cf) std::vecter<type>::assign(size_type _Count, const type&);
|
||||
|
||||
void assign(TypeSize AL_AllocSize, bool AB_DoKeep=true)
|
||||
{
|
||||
this->ReAlloc(AL_AllocSize, AB_DoKeep);
|
||||
this->SetUseSize(AL_AllocSize);
|
||||
}/*
|
||||
void assign(TypeSize AL_AllocSize, bool AB_DoKeep=true)*/
|
||||
|
||||
|
||||
Type& operator[](TypeSize AL_Index)
|
||||
{
|
||||
return mp_TypeArr[AL_Index] ;
|
||||
}/*
|
||||
Type& operator[](TypeSize AL_Index)*/
|
||||
|
||||
const Type& operator[](TypeSize AL_Index) const
|
||||
{
|
||||
return mp_TypeArr[AL_Index] ;
|
||||
}/*
|
||||
const Type& operator[](TypeSize AL_Index) const*/
|
||||
|
||||
|
||||
Type& GetData(TypeSize AL_Index)
|
||||
{
|
||||
return mp_TypeArr[AL_Index] ;
|
||||
}/*
|
||||
Type& GetData(TypeSize AL_Index)*/
|
||||
|
||||
const Type& GetData(TypeSize AL_Index) const
|
||||
{
|
||||
return mp_TypeArr[AL_Index];
|
||||
}/*
|
||||
const Type& GetData(TypeSize AL_Index) const*/
|
||||
|
||||
|
||||
void AddHead(TypeArg AR_TypeArg)
|
||||
{
|
||||
ReAlloc((ml_UseSize++)+1);
|
||||
|
||||
for(TypeSize i=ml_UseSize-2; i>=0; --i)
|
||||
{
|
||||
mp_TypeArr[i+1]=mp_TypeArr[i] ;
|
||||
}
|
||||
/*:::::::::::::::::::::::::::::::::::*/
|
||||
|
||||
mp_TypeArr[0]=AR_TypeArg ;
|
||||
}/*
|
||||
void AddHead(TypeArg AR_TypeArg)*/
|
||||
|
||||
Type& AddHead()
|
||||
{
|
||||
// 앞에 빈 원소를 삽입하고 그 원소를 반환한다.
|
||||
|
||||
ReAlloc((ml_UseSize++)+1);
|
||||
|
||||
for(TypeSize i=ml_UseSize-2; i>=0; --i)
|
||||
{
|
||||
mp_TypeArr[i+1]=mp_TypeArr[i] ;
|
||||
}
|
||||
/*:::::::::::::::::::::::::::::::::::*/
|
||||
|
||||
return mp_TypeArr[0] ;
|
||||
}/*
|
||||
Type& AddHead()*/
|
||||
|
||||
void AddTail(TypeArg AR_TypeArg)
|
||||
{
|
||||
ReAlloc((ml_UseSize++)+1); mp_TypeArr[ml_UseSize-1]=AR_TypeArg ;
|
||||
}/*
|
||||
void AddTail(TypeArg AR_TypeArg)*/
|
||||
|
||||
Type& AddTail()
|
||||
{
|
||||
// 끝에 빈 원소를 삽입하고 그 원소를 반환한다.
|
||||
|
||||
ReAlloc((ml_UseSize++)+1); return mp_TypeArr[ml_UseSize-1];
|
||||
}/*
|
||||
Type& AddTail()*/
|
||||
|
||||
operator Type&()
|
||||
{
|
||||
return AddTail();
|
||||
}/*
|
||||
operator Type&()*/
|
||||
|
||||
|
||||
void push_front(TypeArg AR_TypeArg){AddHead(AR_TypeArg);}
|
||||
void push_back (TypeArg AR_TypeArg){AddTail(AR_TypeArg);}
|
||||
|
||||
Type& push_front(){return AddHead();}
|
||||
Type& push_back (){return AddTail();}
|
||||
|
||||
/***/ ZCIterator begin() {return ZCIterator(*this);}
|
||||
const ZCIterator begin() const{return ZCIterator(*this);}
|
||||
|
||||
|
||||
template<typename TFunctor> void IterElement(TFunctor AO_Functor)
|
||||
{
|
||||
Type* VP_TypeArr = mp_TypeArr;
|
||||
|
||||
__for0(TypeSize, i, ml_UseSize)
|
||||
{
|
||||
ZNsMain::ZtCTypeData<TFunctor>::
|
||||
GetObjRef(AO_Functor)( *VP_TypeArr );
|
||||
|
||||
++VP_TypeArr; //////////////////
|
||||
}/*
|
||||
__for0(TypeSize, i, ml_UseSize)*/
|
||||
}/*
|
||||
template<typename TFunctor> void IterElement(TFunctor AO_Functor)*/
|
||||
|
||||
template<typename TFunctor, typename TTypeHelp>
|
||||
void IterElement(TFunctor AO_Functor, TTypeHelp AO_TypeHelp)
|
||||
{
|
||||
typedef ZNsMain::
|
||||
ZtCCheckRef<TTypeHelp> ZCCheckRef;
|
||||
|
||||
Type* VP_TypeArr = mp_TypeArr;
|
||||
|
||||
__for0(TypeSize, i, ml_UseSize)
|
||||
{
|
||||
ZNsMain::ZtCTypeData<TFunctor>::GetObjRef(AO_Functor)
|
||||
(
|
||||
*VP_TypeArr, ZCCheckRef::PassData(AO_TypeHelp)
|
||||
);
|
||||
++VP_TypeArr; ///////////////////////////////////////
|
||||
}/*
|
||||
__for0(TypeSize, i, ml_UseSize)*/
|
||||
}/*
|
||||
template<typename TFunctor, typename TTypeHelp>
|
||||
void IterElement(TFunctor AO_Functor, TTypeHelp AO_TypeHelp)*/
|
||||
|
||||
|
||||
template /*#####################################################*/
|
||||
<
|
||||
typename TFunctor ,
|
||||
typename TTypeHelp1 ,
|
||||
typename TTypeHelp2
|
||||
>
|
||||
void IterElement
|
||||
(
|
||||
TFunctor AO_Functor ,
|
||||
TTypeHelp1 AO_TypeHelp1 ,
|
||||
TTypeHelp2 AO_TypeHelp2
|
||||
)
|
||||
/*##############################################################*/
|
||||
{
|
||||
typedef ZNsMain::ZtCCheckRef<TTypeHelp1> ZCCheckRef1;
|
||||
typedef ZNsMain::ZtCCheckRef<TTypeHelp2> ZCCheckRef2;
|
||||
|
||||
Type* VP_TypeArr = mp_TypeArr;
|
||||
|
||||
__for0(TypeSize, i, ml_UseSize)
|
||||
{
|
||||
ZNsMain::ZtCTypeData<TFunctor>::GetObjRef(AO_Functor)
|
||||
(
|
||||
*VP_TypeArr
|
||||
, ZCCheckRef1::PassData(AO_TypeHelp1)
|
||||
, ZCCheckRef2::PassData(AO_TypeHelp2)
|
||||
);
|
||||
++VP_TypeArr; ///////////////////////////////////////
|
||||
}/*
|
||||
__for0(TypeSize, i, ml_UseSize)*/
|
||||
}/*
|
||||
template #########################################################
|
||||
<
|
||||
typename TFunctor ,
|
||||
typename TTypeHelp1 ,
|
||||
typename TTypeHelp2
|
||||
>
|
||||
void IterElement
|
||||
(
|
||||
TFunctor AO_Functor ,
|
||||
TTypeHelp1 AO_TypeHelp1 ,
|
||||
TTypeHelp2 AO_TypeHelp2
|
||||
)
|
||||
################################################################*/
|
||||
|
||||
|
||||
/*///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
■ IterElement() 예제.
|
||||
|
||||
#include <iostream>
|
||||
#include "ZCppMain/ZtCArray.H"
|
||||
|
||||
|
||||
using namespace std ;
|
||||
using namespace ZNsMain;
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
typedef ZtCArray<int> CArray ;
|
||||
typedef CArray::IterEasy IterEasy;
|
||||
|
||||
|
||||
CArray VO_Array;
|
||||
|
||||
VO_Array.AddTail(10);
|
||||
VO_Array.AddTail(20);
|
||||
VO_Array.AddTail(30);
|
||||
VO_Array.AddTail(40);
|
||||
|
||||
class CHelpObj
|
||||
{
|
||||
public:
|
||||
|
||||
CHelpObj()
|
||||
{
|
||||
}
|
||||
|
||||
CHelpObj(const CHelpObj& rhs)
|
||||
{
|
||||
cout<<"* CHelpObj(const CHelpObj& rhs)"<<endl;
|
||||
}
|
||||
|
||||
public:
|
||||
}; CHelpObj VO_CHelpObj; cout<<"VO_CHelpObj Ptr : "<<&VO_CHelpObj<<endl;
|
||||
|
||||
struct StFunctor
|
||||
{
|
||||
static void ShowElement(int ArgiValue){cout<<"#1 Value="<<ArgiValue<<endl;}
|
||||
};
|
||||
struct StFunctor2
|
||||
{
|
||||
static void ShowElement(int ArgiValue, CHelpObj)
|
||||
{cout<<"#2 Value="<<ArgiValue<<", CHelpObj Addr=None"<<" With CHelpObj"<<endl;}
|
||||
};
|
||||
struct StFunctor3
|
||||
{
|
||||
static void ShowElement(int ArgiValue, CHelpObj& AR_CHelpObj)
|
||||
{cout<<"#3 Value="<<ArgiValue<<", HelpObj Ptr="<<&AR_CHelpObj<<" With CHelpObj Ref"<<endl;}
|
||||
};
|
||||
struct StFunctor4
|
||||
{
|
||||
static void ShowElement(int ArgiValue, CHelpObj& AR_CHelpObj)
|
||||
{cout<<"#4 Value="<<ArgiValue<<", HelpObj Ptr="<<&AR_CHelpObj<<" With CHelpObj in Ptr"<<endl;}
|
||||
};
|
||||
struct StFunctor5
|
||||
{
|
||||
static void ShowElement(int ArgiValue, CHelpObj& AR_CHelpObj, CHelpObj& AR_CHelpObj2)
|
||||
{cout<<"#5 Value="<<ArgiValue<<", HelpObj Ptr="<<&AR_CHelpObj<<" With CHelpObj Ref 2"<<endl;}
|
||||
};
|
||||
struct StFunctor6
|
||||
{
|
||||
static void ShowElement(int ArgiValue, CHelpObj& AR_CHelpObj, CHelpObj AO_CHelpObj2)
|
||||
{cout<<"#6 Value="<<ArgiValue<<", HelpObj Ptr="<<&AR_CHelpObj<<" With CHelpObj Half Ref"<<endl;}
|
||||
};
|
||||
|
||||
VO_Array.IterElement(StFunctor ::ShowElement);
|
||||
VO_Array.IterElement(StFunctor2::ShowElement, VO_CHelpObj );
|
||||
VO_Array.IterElement(StFunctor3::ShowElement, ZftMCR(VO_CHelpObj) );
|
||||
VO_Array.IterElement(StFunctor4::ShowElement, ZftMCP(VO_CHelpObj) );
|
||||
VO_Array.IterElement(StFunctor5::ShowElement, ZftMCP(VO_CHelpObj), ZftMCP(VO_CHelpObj) );
|
||||
VO_Array.IterElement(StFunctor6::ShowElement, ZftMCP(VO_CHelpObj), VO_CHelpObj );
|
||||
|
||||
|
||||
IterEasy VH_Iter = VO_Array.ItHEasy();
|
||||
|
||||
__for1(int, i, VO_Array.size())
|
||||
{
|
||||
cout<<i<<"th value="<<VO_Array.ItD(VH_Iter)<<endl; VO_Array.ItNext(VH_Iter);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
■ -- 2025-08-07 18:03:00
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
|
||||
/*///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
■ 순차적으로 각 원소를 순회할 수 있는 자료 구조, 즉 리스트나 배열 클래스는
|
||||
|
||||
MoveNextIter(), MovePrevIter()
|
||||
|
||||
멤버를 갖는 것으로 정했다. stl 의 반복자는 너무 일반화하다보니, 성능 상의
|
||||
제약이 발생한 것 같다.
|
||||
|
||||
-- 2011-06-07 20:25:00
|
||||
|
||||
GetDataInIter() 를 추가했다.
|
||||
|
||||
-- 2011-06-12 20:42:00
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
Type* GetHeadIterEasy (){return mp_TypeArr ;}
|
||||
Type* GetTailIterEasy (){return mp_TypeArr+ml_UseSize-1 ;}
|
||||
IterEasyID GetHeadIterEasyID(){return (IterEasyID) mp_TypeArr ;}
|
||||
IterEasyID GetTailIterEasyID(){return (IterEasyID)(mp_TypeArr+ml_UseSize-1);}
|
||||
|
||||
const Type* GetHeadIterEasy () const{return mp_TypeArr ;}
|
||||
const Type* GetTailIterEasy () const{return mp_TypeArr+ml_UseSize-1 ;}
|
||||
const IterEasyID GetHeadIterEasyID() const{return (IterEasyID) mp_TypeArr ;}
|
||||
const IterEasyID GetTailIterEasyID() const{return (IterEasyID)(mp_TypeArr+ml_UseSize-1);}
|
||||
|
||||
void MoveNextIter(Type*& APR_CType ) const{++APR_CType ;}
|
||||
void MoveNextIter(iterator& ARR_CIterator) const{++ARR_CIterator;}
|
||||
void MoveNextIter(IterEasyID& AI_IterEasyID) const
|
||||
{ MoveNextIter((Type*&)AI_IterEasyID); }
|
||||
void MoveNextIter(const Type*& APR_CType ) const{++APR_CType ;}
|
||||
void MoveNextIter(const iterator& ARR_CIterator) const{++ARR_CIterator;}
|
||||
void MoveNextIter(const IterEasyID& AI_IterEasyID)
|
||||
const{ MoveNextIter((const Type*&)AI_IterEasyID); }
|
||||
|
||||
void MovePrevIter(Type*& APR_CType ) const{--APR_CType ;}
|
||||
void MovePrevIter(iterator& ARR_CIterator) const{--ARR_CIterator;}
|
||||
void MovePrevIter(IterEasyID& AI_IterEasyID) const
|
||||
{ MovePrevIter((Type*&)AI_IterEasyID); }
|
||||
void MovePrevIter(const Type*& APR_CType ) const{--APR_CType ;}
|
||||
void MovePrevIter(const iterator& ARR_CIterator) const{--ARR_CIterator;}
|
||||
void MovePrevIter(const IterEasyID& AI_IterEasyID)
|
||||
const{ MovePrevIter((const Type*&)AI_IterEasyID); }
|
||||
|
||||
|
||||
Type& GetDataInIter(Type* AP_CType ){return *AP_CType ;}
|
||||
Type& GetDataInIter(iterator& ARR_CIterator){return *ARR_CIterator ;}
|
||||
Type& GetDataInIter(IterEasyID AI_IterEasyID){return *(Type*)AI_IterEasyID;}
|
||||
|
||||
const Type& GetDataInIter(const Type* AP_CType ) const{return *AP_CType;}
|
||||
const Type& GetDataInIter(const iterator& ARR_CIterator) const{return *ARR_CIterator;}
|
||||
const Type& GetDataInIter(const IterEasyID AI_IterEasyID) const
|
||||
{ return *(const Type*)AI_IterEasyID; }
|
||||
|
||||
|
||||
Type& GetDataInIter(Type* AP_Type , TypeSize AI_FarNum)
|
||||
{ return *(AP_Type + AI_FarNum) ; }
|
||||
Type& GetDataInIter(iterator& ARR_CIterator , TypeSize AI_FarNum)
|
||||
{ return *(ARR_CIterator+AI_FarNum) ; }
|
||||
Type& GetDataInIter(IterEasyID ARRI_IterEasyID, TypeSize AI_FarNum)
|
||||
{ return GetDataInIter((Type*)ARRI_IterEasyID, AI_FarNum); }
|
||||
|
||||
const Type& GetDataInIter(const Type* AP_Type , TypeSize AI_FarNum) const
|
||||
{ return *(AP_Type + AI_FarNum); }
|
||||
const Type& GetDataInIter(iterator& ARR_CIterator, TypeSize AI_FarNum) const
|
||||
{ return *(ARR_CIterator+AI_FarNum); }
|
||||
const Type& GetDataInIter(const IterEasyID ARRI_IterEasyID, TypeSize AI_FarNum) const
|
||||
{ return GetDataInIter((const Type*)ARRI_IterEasyID, AI_FarNum); }
|
||||
|
||||
|
||||
Type* ItHEasy(){return mp_TypeArr ;}
|
||||
Type* ItTEasy(){return mp_TypeArr+ml_UseSize-1 ;}
|
||||
IterEasyID ItHID (){return (IterEasyID) mp_TypeArr ;}
|
||||
IterEasyID ItTID (){return (IterEasyID)(mp_TypeArr+ml_UseSize-1);}
|
||||
|
||||
const Type* ItHEasy () const{return mp_TypeArr ;}
|
||||
const Type* ItTEasy () const{return mp_TypeArr+ml_UseSize-1 ;}
|
||||
const IterEasyID ItHID() const{return (IterEasyID) mp_TypeArr ;}
|
||||
const IterEasyID ItTID() const{return (IterEasyID)(mp_TypeArr+ml_UseSize-1);}
|
||||
|
||||
void ItNext(Type*& APR_CType ) const{++APR_CType ;}
|
||||
void ItNext(iterator& ARR_CIterator) const{++ARR_CIterator;}
|
||||
void ItNext(IterEasyID& AI_IterEasyID) const
|
||||
{ ItNext((Type*&)AI_IterEasyID); }
|
||||
void ItNext(const Type*& APR_CType ) const{++APR_CType ;}
|
||||
void ItNext(const iterator& ARR_CIterator) const{++ARR_CIterator;}
|
||||
void ItNext(const IterEasyID& AI_IterEasyID)
|
||||
const{ ItNext((const Type*&)AI_IterEasyID); }
|
||||
|
||||
void ItPrev(Type*& APR_CType ) const{--APR_CType ;}
|
||||
void ItPrev(iterator& ARR_CIterator) const{--ARR_CIterator;}
|
||||
void ItPrev(IterEasyID& AI_IterEasyID) const
|
||||
{ ItPrev((Type*&)AI_IterEasyID); }
|
||||
void ItPrev(const Type*& APR_CType ) const{--APR_CType ;}
|
||||
void ItPrev(const iterator& ARR_CIterator) const{--ARR_CIterator;}
|
||||
void ItPrev(const IterEasyID& AI_IterEasyID)
|
||||
const{ ItPrev((const Type*&)AI_IterEasyID); }
|
||||
|
||||
Type& ItD(Type* AP_Type ){return GetDataInIter(AP_Type );}
|
||||
Type& ItD(iterator& ARR_CIterator ){return GetDataInIter(ARR_CIterator );}
|
||||
Type& ItD(IterEasyID ARRI_IterEasyID ){return GetDataInIter(ARRI_IterEasyID );}
|
||||
Type& ItD(Type* AP_Type , TypeSize AI_FarNum){return GetDataInIter(AP_Type , AI_FarNum );}
|
||||
Type& ItD(iterator& ARR_CIterator , TypeSize AI_FarNum){return GetDataInIter(ARR_CIterator , AI_FarNum);}
|
||||
Type& ItD(IterEasyID ARRI_IterEasyID, TypeSize AI_FarNum){return GetDataInIter(ARRI_IterEasyID, AI_FarNum);}
|
||||
|
||||
const Type& ItD(const Type* AP_Type ) const{return GetDataInIter(AP_Type );}
|
||||
const Type& ItD(const iterator& ARR_CIterator ) const{return GetDataInIter(ARR_CIterator );}
|
||||
const Type& ItD(const IterEasyID ARRI_IterEasyID ) const{return GetDataInIter(ARRI_IterEasyID );}
|
||||
const Type& ItD(const Type* AP_Type , TypeSize AI_FarNum) const{return GetDataInIter(AP_Type );}
|
||||
const Type& ItD(const iterator& ARR_CIterator , TypeSize AI_FarNum) const{return GetDataInIter(ARR_CIterator , AI_FarNum);}
|
||||
const Type& ItD(const IterEasyID ARRI_IterEasyID, TypeSize AI_FarNum) const{return GetDataInIter(ARRI_IterEasyID, AI_FarNum);}
|
||||
|
||||
public:
|
||||
};/*
|
||||
template< typename TType ,
|
||||
typename TTypArg=const TType&,
|
||||
typename TSize =long
|
||||
>
|
||||
class ZtCArray /////////////////////////*/
|
||||
|
||||
|
||||
////////////////////////////////////////////////
|
||||
|
||||
////////////// end class ZtCArray //////////////
|
||||
|
||||
////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
/*////////////////////////////////////////////////////////////////////
|
||||
|
||||
■ class ZtCArrayOut<> 는 배열 메모리를 자체 할당하지 않고,
|
||||
이미 외부에서 new 나 정적으로 선언되어 있는 배열을 사용한다.
|
||||
따라서 ZtCArrayOut<> 내부에서 임의로 배열 크기를 조절할 수 없다.
|
||||
|
||||
-- 2011-08-05 20:40:00
|
||||
|
||||
////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
template< typename TType,
|
||||
typename TSize=long
|
||||
>
|
||||
class ZtCArrayOut /////////////
|
||||
{
|
||||
public:
|
||||
typedef TType Type ;
|
||||
typedef Type TypeData;
|
||||
public:
|
||||
typedef const Type* const_iterator;
|
||||
typedef Type* iterator;
|
||||
private:
|
||||
Type* mp_TypeArr;
|
||||
TSize ml_UseSize;
|
||||
public:
|
||||
|
||||
ZtCArrayOut()
|
||||
{
|
||||
Init(0, 0);
|
||||
}
|
||||
ZtCArrayOut(TypeData* AP_DataArr, TSize AL_ArrSize)
|
||||
{
|
||||
Init(AP_DataArr, AL_ArrSize);
|
||||
}
|
||||
void Init(TypeData* AP_DataArr, TSize AL_ArrSize)
|
||||
{
|
||||
mp_TypeArr=AP_DataArr;
|
||||
ml_UseSize=AL_ArrSize;
|
||||
}/*
|
||||
void Init(TypeData* AP_DataArr,TSize AL_ArrSize)*/
|
||||
|
||||
TSize size() const{return ml_UseSize;}
|
||||
|
||||
|
||||
Type& operator[](TSize AL_Index)
|
||||
{
|
||||
return mp_TypeArr[AL_Index] ;
|
||||
}/*
|
||||
Type& operator[](TSize AL_Index)*/
|
||||
|
||||
const Type& operator[](TSize AL_Index) const
|
||||
{
|
||||
return mp_TypeArr[AL_Index] ;
|
||||
}/*
|
||||
const Type& operator[](TSize AL_Index) const*/
|
||||
|
||||
|
||||
Type& GetData(TSize AL_Index)
|
||||
{
|
||||
return mp_TypeArr[AL_Index] ;
|
||||
}/*
|
||||
Type& GetData(TSize AL_Index)*/
|
||||
|
||||
const Type& GetData(TSize AL_Index) const
|
||||
{
|
||||
return mp_TypeArr[AL_Index];
|
||||
}/*
|
||||
const Type& GetData(TSize AL_Index) const*/
|
||||
|
||||
|
||||
Type* begin() { return mp_TypeArr; }
|
||||
const Type* begin() const { return mp_TypeArr; }
|
||||
|
||||
|
||||
void MoveNextIter(Type*& ARR_CIterator) const
|
||||
{
|
||||
++ARR_CIterator;
|
||||
}/*
|
||||
void MoveNextIter(Type*& ARR_CIterator) const*/
|
||||
|
||||
void MovePrevIter(iterator& ARR_CIterator)
|
||||
{
|
||||
--ARR_CIterator;
|
||||
}/*
|
||||
void MovePrevIter(iterator& ARR_CIterator)*/
|
||||
|
||||
|
||||
void MoveNextIter(const_iterator& ARR_CIterator) const
|
||||
{
|
||||
++ARR_CIterator;
|
||||
}/*
|
||||
void MoveNextIter(const_iterator& ARR_CIterator) const*/
|
||||
|
||||
void MovePrevIter(const_iterator& ARR_CIterator) const
|
||||
{
|
||||
--ARR_CIterator;
|
||||
}/*
|
||||
void MovePrevIter(const_iterator& ARR_CIterator) const*/
|
||||
|
||||
/*////////////////////////////////////////////////////
|
||||
|
||||
위 코드를 아래로 하면 안된다.
|
||||
|
||||
void MoveNextIter(const iterator& ARR_CIterator) const
|
||||
{
|
||||
++ARR_CIterator;
|
||||
}
|
||||
//void MoveNextIter(const iterator& ARR_CIterator) const
|
||||
|
||||
void MovePrevIter(const iterator& ARR_CIterator) const
|
||||
{
|
||||
--ARR_CIterator;
|
||||
}
|
||||
//void MovePrevIter(const iterator& ARR_CIterator) const
|
||||
|
||||
const iterator 는 Type const * const 이지 Type const * 가 아니다.
|
||||
|
||||
-- 2011-08-05 23:49:00
|
||||
|
||||
////////////////////////////////////////////////////*/
|
||||
|
||||
|
||||
Type& GetDataInIter(iterator& ARR_CIterator)
|
||||
{
|
||||
return *ARR_CIterator;
|
||||
}/*
|
||||
Type& GetDataInIter(iterator& ARR_CIterator)*/
|
||||
|
||||
const Type& GetDataInIter(const_iterator& ARR_CIterator) const
|
||||
{
|
||||
return *ARR_CIterator;
|
||||
}/*
|
||||
const Type& GetDataInIter(const_iterator& ARR_CIterator) const*/
|
||||
|
||||
|
||||
public:
|
||||
};/*
|
||||
template< typename TType,
|
||||
typename TSize=long
|
||||
>
|
||||
class ZtCArrayOut ///////////*/
|
||||
|
||||
|
||||
template< typename TTypeOjb, ZTypLong ATI_Length=1
|
||||
>
|
||||
class ZtCArrayStack //////////////////////////////
|
||||
{
|
||||
public :
|
||||
typedef TTypeOjb TypeData ;
|
||||
typedef ZTypLong TypeSize ;
|
||||
public :
|
||||
enum{ EAllSize=ATI_Length } ;
|
||||
private:
|
||||
TypeData moa_Data[ATI_Length] ;
|
||||
TypeSize ml_UseSize ; // moa_Data 의 실제 사용 길이
|
||||
public :
|
||||
|
||||
ZtCArrayStack(TypeSize AL_StackSize)
|
||||
{
|
||||
ml_UseSize = 0;
|
||||
}/*
|
||||
ZtCArrayStack(TypeSize AL_StackSize)*/
|
||||
|
||||
ZtCArrayStack& operator=(const ZtCArrayStack& rhs)
|
||||
{
|
||||
clear(); return (*this)(rhs.data(),rhs.size());
|
||||
}/*
|
||||
ZtCArrayStack& operator=(const ZtCArrayStack& rhs)*/
|
||||
|
||||
ZtCArrayStack& operator()(const TypeData* AP_Data, TypeSize AL_Length)
|
||||
{
|
||||
if(AL_Length<1){ return *this; }
|
||||
|
||||
if(AL_Length+ml_UseSize > EAllSize)
|
||||
{
|
||||
AL_Length = EAllSize - ml_UseSize;
|
||||
|
||||
if(AL_Length<1) return *this;
|
||||
}/*
|
||||
if(AL_Length+ml_UseSize > EAllSize)*/
|
||||
|
||||
TypeData* VP_Dest= moa_Data+ml_UseSize; const
|
||||
TypeData* VP_Src = AP_Data ;
|
||||
|
||||
ml_UseSize += AL_Length ;
|
||||
|
||||
while(--AL_Length>=0)
|
||||
*VP_Dest++ = *VP_Src++ ;
|
||||
|
||||
*VP_Dest=0; return *this;
|
||||
}/*
|
||||
ZtCArrayStack& operator()(const TypeData* AP_Data, TypeSize AL_Length)*/
|
||||
|
||||
|
||||
TypeSize GetSize() const
|
||||
{
|
||||
return ml_UseSize;
|
||||
}/*
|
||||
TypeSize GetSize() const*/
|
||||
|
||||
TypeSize GetEmptySize() const
|
||||
{
|
||||
return EAllSize - ml_UseSize ;
|
||||
}/*
|
||||
TypeSize GetEmptySize() const*/
|
||||
|
||||
TypeData* GetData()
|
||||
{
|
||||
return moa_Data;
|
||||
}/*
|
||||
TypeData* GetData()*/
|
||||
|
||||
const TypeData* GetData() const
|
||||
{
|
||||
return moa_Data;
|
||||
}/*
|
||||
const TypeData* GetData() const*/
|
||||
|
||||
|
||||
void MemCopy(TypeData* AP_Data, TypeSize AL_Length)
|
||||
{
|
||||
if(AL_Length<1 || ml_UseSize<1)
|
||||
return;
|
||||
if(AL_Length>=ml_UseSize )
|
||||
::memcpy(AP_Data, moa_Data, sizeof(TypeData)*ml_UseSize);
|
||||
else
|
||||
::memcpy(AP_Data, moa_Data, sizeof(TypeData)*AL_Length );
|
||||
//else
|
||||
}/*
|
||||
void MemCopy(TypeData* AP_Data, TypeSize AL_Length)*/
|
||||
|
||||
|
||||
TypeSize size() const
|
||||
{
|
||||
return ml_UseSize;
|
||||
}/*
|
||||
TypeSize size() const*/
|
||||
|
||||
TypeData* data()
|
||||
{
|
||||
return moa_Data;
|
||||
}/*
|
||||
TypeData* data()*/
|
||||
|
||||
const TypeData* data() const
|
||||
{
|
||||
return moa_Data;
|
||||
}/*
|
||||
const TypeData* data() const*/
|
||||
|
||||
void clear()
|
||||
{
|
||||
// add codes
|
||||
}/*
|
||||
void clear()*/
|
||||
|
||||
public:
|
||||
};/*
|
||||
template< typename TTypeOjb, typename ZTypLong ATI_Length=1
|
||||
>
|
||||
class ZtCArrayStack /////////////////////////////////////*/
|
||||
|
||||
|
||||
}/*
|
||||
namespace ZNsMain*/
|
||||
|
||||
|
||||
#endif //__ZCPPMAIIN__ZTCARRAY_H__
|
2964
ZCppMain/ZtCLinkList.H
Normal file
2964
ZCppMain/ZtCLinkList.H
Normal file
File diff suppressed because it is too large
Load Diff
1864
ZCppMain/ZtCLoadDataBlock.H
Normal file
1864
ZCppMain/ZtCLoadDataBlock.H
Normal file
File diff suppressed because it is too large
Load Diff
4169
ZCppMain/ZtCLoadXml.H
Normal file
4169
ZCppMain/ZtCLoadXml.H
Normal file
File diff suppressed because it is too large
Load Diff
7297
ZCppMain/ZtCMainChars.H
Normal file
7297
ZCppMain/ZtCMainChars.H
Normal file
File diff suppressed because it is too large
Load Diff
2483
ZCppMain/ZtCObjAVL.H
Normal file
2483
ZCppMain/ZtCObjAVL.H
Normal file
File diff suppressed because it is too large
Load Diff
4511
ZCppMain/ZtCObjList.H
Normal file
4511
ZCppMain/ZtCObjList.H
Normal file
File diff suppressed because it is too large
Load Diff
2218
ZCppMain/ZtCSimList.H
Normal file
2218
ZCppMain/ZtCSimList.H
Normal file
File diff suppressed because it is too large
Load Diff
851
ZCppMain/ZtCSortObjList.H
Normal file
851
ZCppMain/ZtCSortObjList.H
Normal file
@ -0,0 +1,851 @@
|
||||
|
||||
|
||||
#ifndef __ZCPPMAIN__ZCSORT_LIST_H__
|
||||
#define __ZCPPMAIN__ZCSORT_LIST_H__
|
||||
|
||||
|
||||
/*////////////////////////////////////////////////////
|
||||
|
||||
■ CDoublieList.H 와 CObjList.H 가 include 한다.
|
||||
|
||||
-- 2013-04-30 22:57:00
|
||||
|
||||
ZtCArray.H 와 ZtCObjList.H 가 include 한다.
|
||||
|
||||
-- 2025-08-17 14:37:00
|
||||
|
||||
현재는 ZtCArray.H 와 ZtCObjList.H 를 include 한다.
|
||||
|
||||
-- 2025-08-17 15:42:00
|
||||
|
||||
////////////////////////////////////////////////////*/
|
||||
|
||||
|
||||
#include "ZCppMain/ZtCArray.H"
|
||||
#include "ZCppMain/ZtCObjList.H"
|
||||
|
||||
|
||||
namespace ZNsMain
|
||||
{
|
||||
|
||||
// 양방향 연결리스트에 대한 정렬 클래스이다.
|
||||
|
||||
template<typename TTypObjList> class ZtCSortObjList
|
||||
{
|
||||
public :
|
||||
typedef typename TTypObjList::ZCLink ZCLink ;
|
||||
typedef typename TTypObjList::TypeData TypeData;
|
||||
typedef typename TTypObjList::TypeArg TypeArg ;
|
||||
typedef typename TTypObjList::TypeSize TypeSize;
|
||||
private:
|
||||
|
||||
static inline bool IsMore(TypeArg AR_LeftType, TypeArg AR_RightType)
|
||||
{
|
||||
/* IsMore() 함수와 IsLess() 는 QuickSort() 멤버 함수에서 쓰는
|
||||
함수 포인터에 대입하기 위해서 정의하였다. */
|
||||
|
||||
return AR_LeftType > AR_RightType ;
|
||||
}/*
|
||||
static inline bool IsMore(TypeArg AR_LeftType, TypeArg AR_RightType)*/
|
||||
|
||||
static inline bool IsLess(TypeArg AR_LeftType, TypeArg AR_RightType)
|
||||
{
|
||||
return AR_LeftType < AR_RightType ;
|
||||
}/*
|
||||
static inline bool IsLess(TypeArg AR_LeftType, TypeArg AR_RightType)*/
|
||||
|
||||
|
||||
static inline void SwapLinkPtr(ZCLink*& APR_LinkI, ZCLink*& APR_LinkJ)
|
||||
{
|
||||
ZCLink* VP_Temp=APR_LinkI; APR_LinkI=APR_LinkJ; APR_LinkJ=VP_Temp;
|
||||
}/*
|
||||
static inline void SwapLinkPtr( ZCLink*& APR_LinkI, ZCLink*& APR_LinkJ) */
|
||||
|
||||
|
||||
template
|
||||
<typename TTypFuncIsMore, typename TTypFuncIsLess>
|
||||
static void QuickSort
|
||||
(
|
||||
TTypFuncIsMore APF_IsMore ,
|
||||
TTypFuncIsLess APF_IsLess ,
|
||||
ZCLink* APA_LinkPtrArr[],
|
||||
TypeSize AL_HeadIndex ,
|
||||
TypeSize AL_TailIndex
|
||||
)
|
||||
/*##################################################*/
|
||||
{
|
||||
if(AL_HeadIndex<AL_TailIndex)
|
||||
{
|
||||
TypeSize i = AL_HeadIndex ;
|
||||
TypeSize j = AL_TailIndex+1 ;
|
||||
|
||||
ZCLink* VP_PivotLinkPtr = APA_LinkPtrArr[i];
|
||||
|
||||
do //////
|
||||
{
|
||||
while(AL_TailIndex >i && APF_IsLess(APA_LinkPtrArr[++i]->GetData(), VP_PivotLinkPtr->GetData()) );
|
||||
while(AL_HeadIndex <j && APF_IsMore(APA_LinkPtrArr[--j]->GetData(), VP_PivotLinkPtr->GetData()) );
|
||||
|
||||
if(i<j) SwapLinkPtr( APA_LinkPtrArr[i], APA_LinkPtrArr[j] );
|
||||
}
|
||||
while(i<j);
|
||||
|
||||
/* SwapLinkPtr(APA_LinkPtrArr[AL_HeadIndex], APA_LinkPtrArr[j]);
|
||||
|
||||
위 코드 보다 아래처럼 2 줄로 쓰는게 별도의 스택 변수를 사용하지
|
||||
않아서 좋다.
|
||||
*/
|
||||
APA_LinkPtrArr[AL_HeadIndex] = APA_LinkPtrArr[j];
|
||||
APA_LinkPtrArr[j ] = VP_PivotLinkPtr ;
|
||||
|
||||
QuickSort(APF_IsMore, APF_IsLess, APA_LinkPtrArr, AL_HeadIndex, j-1 );
|
||||
QuickSort(APF_IsMore, APF_IsLess, APA_LinkPtrArr, j+1, AL_TailIndex);
|
||||
}/*
|
||||
if(AL_HeadIndex<AL_TailIndex)*/
|
||||
}/*
|
||||
template
|
||||
<typename TTypFuncIsMore, typename TTypFuncIsLess>
|
||||
static void QuickSort
|
||||
(
|
||||
TTypFuncIsMore APF_IsMore ,
|
||||
TTypFuncIsLess APF_IsLess ,
|
||||
ZCLink* APA_LinkPtrArr[],
|
||||
TypeSize AL_HeadIndex ,
|
||||
TypeSize AL_TailIndex
|
||||
)
|
||||
####################################################*/
|
||||
|
||||
|
||||
static void QuickSortAsc
|
||||
(
|
||||
ZCLink* APA_LinkPtrArr[], TypeSize AL_HeadIndex, TypeSize AL_TailIndex
|
||||
)
|
||||
/*####################*/
|
||||
{
|
||||
if(AL_HeadIndex<AL_TailIndex)
|
||||
{
|
||||
TypeSize i=AL_HeadIndex ;
|
||||
TypeSize j=AL_TailIndex+1 ;
|
||||
|
||||
ZCLink* VP_PivotLinkPtr = APA_LinkPtrArr[i];
|
||||
|
||||
do ////
|
||||
{
|
||||
while(AL_TailIndex >i && APA_LinkPtrArr[++i]->GetData() < VP_PivotLinkPtr->GetData());
|
||||
while(AL_HeadIndex <j && APA_LinkPtrArr[--j]->GetData() > VP_PivotLinkPtr->GetData());
|
||||
|
||||
if(i<j) SwapLinkPtr(APA_LinkPtrArr[i], APA_LinkPtrArr[j]);
|
||||
}
|
||||
while(i<j);
|
||||
|
||||
/* SwapLinkPtr(APA_LinkPtrArr[AL_HeadIndex], APA_LinkPtrArr[j]);
|
||||
|
||||
위 코드 보다 아래처럼 2 줄로 쓰는게 별도의 스택 변수를 사용하지 않아서 좋다.
|
||||
*/
|
||||
APA_LinkPtrArr[AL_HeadIndex] = APA_LinkPtrArr[j] ;
|
||||
APA_LinkPtrArr[j ] = VP_PivotLinkPtr ;
|
||||
|
||||
QuickSortAsc(APA_LinkPtrArr, AL_HeadIndex, j-1 );
|
||||
QuickSortAsc(APA_LinkPtrArr, j+1, AL_TailIndex);
|
||||
}/*
|
||||
if(AL_HeadIndex<AL_TailIndex)*/
|
||||
}/*
|
||||
static void QuickSortAsc
|
||||
(
|
||||
ZCLink* APA_LinkPtrArr[], TypeSize AL_HeadIndex, TypeSize AL_TailIndex
|
||||
)
|
||||
/*####################*/
|
||||
|
||||
|
||||
static void QuickSortDesc
|
||||
(
|
||||
ZCLink* APA_LinkPtrArr[], TypeSize AL_HeadIndex, TypeSize AL_TailIndex
|
||||
)
|
||||
/*#####################*/
|
||||
{
|
||||
if(AL_HeadIndex<AL_TailIndex)
|
||||
{
|
||||
TypeSize i= AL_HeadIndex ;
|
||||
TypeSize j= AL_TailIndex+1;
|
||||
|
||||
ZCLink* VP_PivotLinkPtr=APA_LinkPtrArr[i];
|
||||
|
||||
do //////
|
||||
{
|
||||
while(AL_TailIndex >i && APA_LinkPtrArr[++i]->GetData() > VP_PivotLinkPtr->GetData());
|
||||
while(AL_HeadIndex <j && APA_LinkPtrArr[--j]->GetData() < VP_PivotLinkPtr->GetData());
|
||||
|
||||
if(i<j) SwapLinkPtr(APA_LinkPtrArr[i], APA_LinkPtrArr[j]);
|
||||
}
|
||||
while(i<j);
|
||||
|
||||
/* SwapLinkPtr(APA_LinkPtrArr[AL_HeadIndex], APA_LinkPtrArr[j]);
|
||||
|
||||
위 코드 보다 아래처럼 2 줄로 쓰는게 별도의 스택 변수를 사용하지
|
||||
않아서 좋다.
|
||||
*/
|
||||
APA_LinkPtrArr[AL_HeadIndex]=APA_LinkPtrArr[j];
|
||||
APA_LinkPtrArr[j ]=VP_PivotLinkPtr ;
|
||||
|
||||
QuickSortDesc(APA_LinkPtrArr, AL_HeadIndex, j-1 );
|
||||
QuickSortDesc(APA_LinkPtrArr, j+1, AL_TailIndex);
|
||||
}/*
|
||||
if(AL_HeadIndex<AL_TailIndex)*/
|
||||
}/*
|
||||
static void QuickSortDesc
|
||||
(
|
||||
ZCLink* APA_LinkPtrArr[], TypeSize AL_HeadIndex, TypeSize AL_TailIndex
|
||||
)
|
||||
/*#####################*/
|
||||
|
||||
|
||||
/*private:*/
|
||||
public :
|
||||
|
||||
|
||||
static void QuickSort(TTypObjList& ARR_CObjList, bool AB_IsAscending=true)
|
||||
{
|
||||
if(ARR_CObjList.GetSize()<=1) return;
|
||||
|
||||
TypeSize VL_SortSize = ARR_CObjList.GetSize() ;
|
||||
ZCLink** VPP_LinkPtrArr = new ZCLink*[VL_SortSize];
|
||||
|
||||
if(VPP_LinkPtrArr==0)
|
||||
{
|
||||
// Add codes for memory over
|
||||
|
||||
return;
|
||||
}/*
|
||||
if(VPP_LinkPtrArr==0)*/
|
||||
|
||||
ZCLink* VP_TempLink =
|
||||
ARR_CObjList.GetHeadLinkPtr();
|
||||
TypeSize i=0 ;
|
||||
|
||||
for(; i<VL_SortSize; ++i)
|
||||
{
|
||||
VPP_LinkPtrArr[i] =VP_TempLink;
|
||||
VP_TempLink =VP_TempLink->GetNextPtr();
|
||||
}/*
|
||||
for(; i<VL_SortSize; ++i)*/
|
||||
|
||||
if(AB_IsAscending==true)
|
||||
QuickSortAsc (VPP_LinkPtrArr, 0, VL_SortSize-1);
|
||||
else QuickSortDesc(VPP_LinkPtrArr, 0, VL_SortSize-1);
|
||||
|
||||
for(i=1; i<VL_SortSize; ++i) // VL_SortSize-1 번 순환
|
||||
{
|
||||
ZCLink::JoinLink(VPP_LinkPtrArr[i-1], VPP_LinkPtrArr[i]);
|
||||
}/*
|
||||
//////////////////////////*/
|
||||
|
||||
ZCLink::MakeRing
|
||||
(VPP_LinkPtrArr[0], VPP_LinkPtrArr[VL_SortSize-1]);
|
||||
|
||||
ARR_CObjList.mp_HeadLink = VPP_LinkPtrArr[0];
|
||||
|
||||
delete[] VPP_LinkPtrArr; ////////////////////
|
||||
}/*
|
||||
static void QuickSort(TTypObjList& ARR_CObjList, bool AB_IsAscending=true)*/
|
||||
|
||||
|
||||
template
|
||||
<typename TTypFuncIsMore, typename TTypFuncIsLess>
|
||||
static void QuickSort
|
||||
(
|
||||
TTypObjList& ARR_CObjList ,
|
||||
TTypFuncIsMore APF_IsMore ,
|
||||
TTypFuncIsLess APF_IsLess
|
||||
)
|
||||
//////////////////////////////////////////////////////
|
||||
{
|
||||
if(ARR_CObjList.GetSize()<=1) return;
|
||||
|
||||
TypeSize VL_SortSize = ARR_CObjList.GetSize() ;
|
||||
ZCLink** VPP_LinkPtrArr= new ZCLink*[VL_SortSize];
|
||||
|
||||
if(VPP_LinkPtrArr==0)
|
||||
{
|
||||
// Add codes for memory over
|
||||
|
||||
return;
|
||||
}/*
|
||||
if(VPP_LinkPtrArr==0)*/
|
||||
|
||||
ZCLink* VP_TempLink =
|
||||
ARR_CObjList.GetHeadLinkPtr();
|
||||
TypeSize i=0 ;
|
||||
|
||||
for(; i<VL_SortSize; ++i)
|
||||
{
|
||||
VPP_LinkPtrArr[i]= VP_TempLink;
|
||||
VP_TempLink = VP_TempLink->GetNextPtr();
|
||||
}/*
|
||||
///////////////////////*/
|
||||
|
||||
QuickSort
|
||||
(APF_IsMore, APF_IsLess, VPP_LinkPtrArr, 0, VL_SortSize-1);
|
||||
|
||||
for(i=1; i<VL_SortSize; ++i) // VL_SortSize-1 번 순환
|
||||
{
|
||||
ZCLink::JoinLink(VPP_LinkPtrArr[i-1], VPP_LinkPtrArr[i]);
|
||||
}/*
|
||||
for(i=1; i<VL_SortSize; ++i)*/
|
||||
|
||||
ZCLink::MakeRing
|
||||
(VPP_LinkPtrArr[0], VPP_LinkPtrArr[VL_SortSize-1]);
|
||||
|
||||
ARR_CObjList.mp_HeadLink = VPP_LinkPtrArr[0];
|
||||
|
||||
delete[] VPP_LinkPtrArr; ////////////////////
|
||||
}/*
|
||||
template
|
||||
<typename TTypFuncIsMore, typename TTypFuncIsLess>
|
||||
static void QuickSort
|
||||
(
|
||||
TTypObjList& ARR_CObjList ,
|
||||
TTypFuncIsMore APF_IsMore ,
|
||||
TTypFuncIsLess APF_IsLess
|
||||
)
|
||||
////////////////////////////////////////////////////*/
|
||||
|
||||
|
||||
static void QuickSortPart /*########################*/
|
||||
(
|
||||
TTypObjList& ARR_CObjList,
|
||||
ZCLink* AP_HeadLink ,
|
||||
TypeSize AL_HeadPos ,
|
||||
ZCLink* AP_TailLink ,
|
||||
TypeSize AL_TailPos ,
|
||||
bool AB_IsAscending=true
|
||||
)
|
||||
/*##################################################*/
|
||||
{
|
||||
// AP_HeadLink 부터 AP_TailLink 까지만 정렬
|
||||
|
||||
#ifdef _DEBUG
|
||||
|
||||
if(ARR_CObjList.IsEmpty()==true || ARR_CObjList.Find(AP_HeadLink)!=AL_HeadPos || ARR_CObjList.Find(AP_TailLink)!=AL_TailPos || AL_HeadPos>AL_TailPos)
|
||||
{
|
||||
std::fstream fileout("DEBUG.txt",std::ios::out | std::ios::app);
|
||||
fileout<<std::endl<<"File : "<<__FILE__<<std::endl<<"Line : "<<__LINE__<<std::endl;
|
||||
fileout<<"Error !! In static void QuickSortPart("<<endl
|
||||
<<" TTypObjList& ARR_CObjList,"<<endl
|
||||
<<" ZCLink* AP_HeadLink ,"<<endl
|
||||
<<" TypeSize AL_HeadPos ,"<<endl
|
||||
<<" ZCLink* AP_TailLink ,"<<endl
|
||||
<<" TypeSize AL_TailPos ,"<<endl
|
||||
<<" bool AB_IsAscending=true )"<<endl
|
||||
<<"Parameters are not valid"<<endl;
|
||||
fileout.close();
|
||||
exit(1);
|
||||
}/*
|
||||
if(ARR_CObjList.IsEmpty()==true || ARR_CObjList.Find(AP_HeadLink)!=AL_HeadPos || ARR_CObjList.Find(AP_TailLink)!=AL_TailPos || AL_HeadPos>AL_TailPos)*/
|
||||
|
||||
#endif //_DEBUG
|
||||
|
||||
if(AL_HeadPos==1 && AL_TailPos==ARR_CObjList.GetSize())
|
||||
{
|
||||
QuickSort(ARR_CObjList, AB_IsAscending); return;
|
||||
}/*
|
||||
if(AL_HeadPos==1 && AL_TailPos==ARR_CObjList.GetSize())*/
|
||||
|
||||
ZCLink* VP_PrevHead=AP_HeadLink->GetPrevPtr();
|
||||
ZCLink* VP_NextTail=AP_TailLink->GetNextPtr();
|
||||
TypeSize VL_SortSize=AL_TailPos-AL_HeadPos+1 ;
|
||||
|
||||
ZCLink** VPP_LinkPtrArr = new ZCLink*[VL_SortSize];
|
||||
|
||||
if(VPP_LinkPtrArr==0)
|
||||
{
|
||||
// Add codes for memory over
|
||||
|
||||
return;
|
||||
}/*
|
||||
if(VPP_LinkPtrArr==0)*/
|
||||
|
||||
ZCLink* VP_TempLink = AP_HeadLink; TypeSize i=0;
|
||||
|
||||
for(; i<VL_SortSize; ++i)
|
||||
{
|
||||
VPP_LinkPtrArr[i]=VP_TempLink;
|
||||
VP_TempLink =VP_TempLink->GetNextPtr();
|
||||
}/*
|
||||
///////////////////////*/
|
||||
|
||||
if(AB_IsAscending==true)
|
||||
QuickSortAsc (VPP_LinkPtrArr, 0, VL_SortSize-1);
|
||||
else QuickSortDesc(VPP_LinkPtrArr, 0, VL_SortSize-1);
|
||||
|
||||
for(i=1; i<VL_SortSize; ++i) // VL_SortSize-1 번 순환
|
||||
{
|
||||
ZCLink::JoinLink(VPP_LinkPtrArr[i-1], VPP_LinkPtrArr[i]);
|
||||
}/*
|
||||
//////////////////////////*/
|
||||
|
||||
ZCLink::JoinLink(VP_PrevHead /*##########*/ , VPP_LinkPtrArr[0]);
|
||||
ZCLink::JoinLink(VPP_LinkPtrArr[VL_SortSize-1], VP_NextTail );
|
||||
|
||||
if(AL_HeadPos==1)
|
||||
ARR_CObjList.mp_HeadLink=VPP_LinkPtrArr[0];
|
||||
|
||||
delete[] VPP_LinkPtrArr; //////////////////////
|
||||
}/*
|
||||
static void QuickSortPart ############################
|
||||
(
|
||||
TTypObjList& ARR_CObjList,
|
||||
ZCLink* AP_HeadLink ,
|
||||
TypeSize AL_HeadPos ,
|
||||
ZCLink* AP_TailLink ,
|
||||
TypeSize AL_TailPos ,
|
||||
bool AB_IsAscending=true
|
||||
)
|
||||
/*##################################################*/
|
||||
|
||||
|
||||
static void MergeSort
|
||||
(TTypObjList& ARR_AddList, TTypObjList& ARR_CutList, bool AB_IsAscending=true)
|
||||
/*#################*/
|
||||
{
|
||||
/*/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
■ 연결리스트 ARR_AddList 와 ARR_CutList 는 이미 정렬되어 있는 것으로 간주하여
|
||||
병합 정렬을 실시한다. ARR_CutList 의 앞 링크부터 차례로 끊어 ARR_AddList 의
|
||||
적당한 링크에 삽입한다. 이 병합 정렬은 ARR_AddList 가 오름차순으로 정렬되어
|
||||
있다면 ARR_CutList 도 오름차순으로 정렬되어 있어야 하고, AB_IsAscending 도
|
||||
true 여야 원하는 결과를 얻을 수 있다.
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
if( &ARR_AddList==&ARR_CutList ||
|
||||
ARR_AddList.mp_HeadLink==0 ||
|
||||
ARR_CutList.mp_HeadLink==0 ) return ;
|
||||
|
||||
/* 먼저 각 리스크를 삭제하는 신호를 보낸다. 진짜로 삭제하는 것은 아니지만,
|
||||
링크를 이동시키는 과정에서 발생할 수 있는 에러를 막는데는 도움이 된다. */
|
||||
|
||||
ARR_AddList.OnDelete( ARR_AddList.mp_HeadLink, 1,
|
||||
ARR_AddList.mp_HeadLink->mp_PrevLink, ARR_AddList.ml_Size );
|
||||
ARR_CutList.OnDelete( ARR_CutList.mp_HeadLink, 1,
|
||||
ARR_CutList.mp_HeadLink->mp_PrevLink, ARR_CutList.ml_Size );
|
||||
bool (*pf_IsTrueValue)(TypeArg AR_Left,TypeArg rRigh);
|
||||
|
||||
if(AB_IsAscending==true)
|
||||
pf_IsTrueValue=IsMore;
|
||||
else pf_IsTrueValue=IsLess;
|
||||
|
||||
if(pf_IsTrueValue(ARR_AddList.GetTailData(), ARR_CutList.GetHeadData())==false)
|
||||
{
|
||||
ARR_AddList.JoinTail(ARR_CutList); return; // 이때는 더 이상 비교할 필요가 없다.
|
||||
}/*
|
||||
if(pf_IsTrueValue(ARR_AddList.GetTailData(), ARR_CutList.GetHeadData())==false)*/
|
||||
|
||||
ZCLink* VP_LhsTail =ARR_AddList.mp_HeadLink->mp_PrevLink;
|
||||
ZCLink* VP_LhsTemp =ARR_AddList.mp_HeadLink;
|
||||
ZCLink* VP_RhsHead =ARR_CutList.mp_HeadLink;
|
||||
|
||||
TypeSize VL_LhsTempPos=1 ; // VP_LhsTemp 의 위치
|
||||
bool VB_IsMoved =false;
|
||||
ZCLink* VP_TempLink =0 ;
|
||||
|
||||
do //////
|
||||
{
|
||||
if(pf_IsTrueValue(VP_LhsTemp->GetData(), VP_RhsHead->GetData())==true)
|
||||
{
|
||||
VP_TempLink=VP_RhsHead ;
|
||||
VP_RhsHead =VP_RhsHead->mp_NextLink;
|
||||
|
||||
ARR_AddList.JoinBefore ////////////////////
|
||||
(
|
||||
ARR_CutList.CutLink(VP_TempLink, 1)
|
||||
, VP_LhsTemp
|
||||
, VL_LhsTempPos
|
||||
);
|
||||
///////////////////////////////////////////
|
||||
|
||||
/* VP_LhsTemp 앞에 링크가 하나 삽입되었으므로,
|
||||
VP_LhsTemp 의 위치값을 하나 증가시킨다. */
|
||||
|
||||
++VL_LhsTempPos; VB_IsMoved=true;
|
||||
}/*
|
||||
if(pf_IsTrueValue(VP_LhsTemp->GetData(), VP_RhsHead->GetData())==true)*/
|
||||
|
||||
if(ARR_CutList.mp_HeadLink==0) return;
|
||||
|
||||
if(VP_LhsTemp==VP_LhsTail)
|
||||
{
|
||||
ARR_AddList.JoinTail(ARR_CutList); return;
|
||||
}/*
|
||||
if(VP_LhsTemp==VP_LhsTail)*/
|
||||
|
||||
if(VB_IsMoved==false)
|
||||
{
|
||||
VP_LhsTemp=VP_LhsTemp->mp_NextLink; ++VL_LhsTempPos;
|
||||
}
|
||||
else
|
||||
{
|
||||
VB_IsMoved=false;
|
||||
}
|
||||
}
|
||||
while(true);
|
||||
}/*
|
||||
static void MergeSort
|
||||
(TTypObjList& ARR_AddList, TTypObjList& ARR_CutList, bool AB_IsAscending=true)
|
||||
/*#################*/
|
||||
|
||||
|
||||
template<typename TFunctor> void MakeUnique( /*############*/
|
||||
TTypObjList& ARR_CObjList ,
|
||||
TFunctor AR_Functor ,
|
||||
bool AB_IsSorted =false,
|
||||
bool AB_IsAscending=true
|
||||
/*#########*/ ) /*#########################################*/
|
||||
{
|
||||
// ARR_CObjList 의 각 노드를 유일하게 만든다.
|
||||
|
||||
if(AB_IsSorted==false)
|
||||
QuickSort(ARR_CObjList,AB_IsAscending);
|
||||
|
||||
TypeSize VL_LoopSize= ARR_CObjList.GetSize() ;
|
||||
TypeSize VL_Index = 1 ;
|
||||
ZCLink* VP_HeadLink= ARR_CObjList.GetHeadLinkPtr();
|
||||
ZCLink* VP_CutLink = 0 ;
|
||||
|
||||
/* VL_LoopSize-1 번 순환하며 같은 원소가 이웃한다면
|
||||
앞뒤 노드에 대해 어떤 처리를 하고 뒤쪽의 노드를 삭제한다. */
|
||||
|
||||
for(TypeSize i=1; i<VL_LoopSize; ++i)
|
||||
{
|
||||
if(VP_HeadLink->GetData()==VP_HeadLink->GetNextPtr()->GetData())
|
||||
{
|
||||
AR_Functor //////////////////////////
|
||||
(
|
||||
VP_HeadLink->GetData(), VP_HeadLink->GetNextPtr()->GetData()
|
||||
);
|
||||
VP_CutLink=VP_HeadLink->GetNextPtr();
|
||||
|
||||
ARR_CObjList.Delete(VP_CutLink, VL_Index+1);
|
||||
}
|
||||
else
|
||||
{
|
||||
(VP_HeadLink=VP_HeadLink->GetNextPtr(), ++VL_Index);
|
||||
}
|
||||
}/*
|
||||
for(TypeSize i=1; i<VL_LoopSize; ++i)*/
|
||||
}/*
|
||||
template<typename TFunctor> void MakeUnique( ################
|
||||
TFunctor AR_Functor ,
|
||||
bool AB_IsSorted=false ,
|
||||
bool AB_IsAscending=true
|
||||
################# ) #######################################*/
|
||||
|
||||
|
||||
static void MakeUnique( /*#################################*/
|
||||
TTypObjList& ARR_CObjList ,
|
||||
bool AB_IsSorted =false,
|
||||
bool AB_IsAscending=true
|
||||
/*#########*/ ) /*#########################################*/
|
||||
{
|
||||
// ARR_CObjList 의 각 노드를 유일하게 만든다.
|
||||
|
||||
if(AB_IsSorted==false)
|
||||
QuickSort(ARR_CObjList,AB_IsAscending);
|
||||
|
||||
TypeSize VL_LoopSize =ARR_CObjList.GetSize() ;
|
||||
TypeSize VL_Index =1 ;
|
||||
ZCLink* VP_HeadLink =ARR_CObjList.GetHeadLinkPtr();
|
||||
ZCLink* VP_CutLink =0 ;
|
||||
|
||||
/* VL_LoopSize-1 번 순환하며 같은 원소가 이웃한다면
|
||||
뒤쪽의 노드를 삭제한다.
|
||||
*/
|
||||
for(TypeSize i=1; i<VL_LoopSize; ++i)
|
||||
{
|
||||
if(VP_HeadLink->GetData()==VP_HeadLink->GetNextPtr()->GetData())
|
||||
{
|
||||
VP_CutLink = VP_HeadLink->GetNextPtr() ;
|
||||
|
||||
ARR_CObjList.Delete(VP_CutLink, VL_Index+1);
|
||||
}
|
||||
else
|
||||
{
|
||||
(VP_HeadLink=VP_HeadLink->GetNextPtr(), ++VL_Index);
|
||||
}
|
||||
}/*
|
||||
for(TypeSize i=1; i<VL_LoopSize; ++i)*/
|
||||
}/*
|
||||
static void MakeUnique( #####################################
|
||||
TTypObjList& ARR_CObjList ,
|
||||
bool AB_IsSorted =false,
|
||||
bool AB_IsAscending=true
|
||||
############# ) ###########################################*/
|
||||
|
||||
|
||||
template<typename TFunctor> static void SplitGroup( /*#####*/
|
||||
TTypObjList& ARR_CObjList ,
|
||||
TFunctor AR_Functor ,
|
||||
bool AB_IsSorted =false,
|
||||
bool AB_IsAscending=true
|
||||
/*#########*/ ) /*#########################################*/
|
||||
{
|
||||
/* ARR_CObjList 의 각 노드를 같은 것끼리 그룹으로 묵어서
|
||||
묶여진 리스트에 대해 AR_Functor 를 수행한다.
|
||||
*/
|
||||
if(ARR_CObjList.IsEmpty()) return;
|
||||
|
||||
if(AB_IsSorted==false)
|
||||
{
|
||||
QuickSort(ARR_CObjList, AB_IsAscending); // 정렬이 안되었으면 정렬을 하고...
|
||||
}/*
|
||||
if(AB_IsSorted==false)*/
|
||||
|
||||
TypeSize VL_LoopSize=ARR_CObjList.GetSize() ;
|
||||
TypeSize VL_TailPos =1 ;
|
||||
|
||||
ZCLink* VP_CutHead =ARR_CObjList.GetHeadLinkPtr();
|
||||
ZCLink* VP_CutTail =VP_CutHead ;
|
||||
ZCLink* VP_CutTemp =VP_CutTail->GetNextPtr() ;
|
||||
|
||||
// VL_LoopSize-1 번 순환
|
||||
|
||||
for(TypeSize i=2; i<=VL_LoopSize; ++i)
|
||||
{
|
||||
if(VP_CutTail->GetData()==VP_CutTemp->GetData())
|
||||
{
|
||||
VP_CutTail=VP_CutTemp ;
|
||||
VP_CutTemp=VP_CutTemp->GetNextPtr() ;
|
||||
|
||||
++VL_TailPos;
|
||||
}
|
||||
else // VP_CutTail->GetData()!=VP_CutTemp->GetData()
|
||||
{
|
||||
/* 다음 노드와 다르면 이전 노드들은 서로 같다는 것이다.
|
||||
이전 노드들은 functor 로 처리를 넘긴다. functor 는
|
||||
넘겨받은 리스트를 반드시 써야(삭제해야) 한다. CutLink()
|
||||
멤버 함수는 내부에 정적 리스트 개체를 가지고 있는데
|
||||
여기에 쓸데없는 자료가 남겨져서는 안되기 때문이다. */
|
||||
|
||||
AR_Functor //////////////////////////////////////
|
||||
(
|
||||
ARR_CObjList.CutLink
|
||||
(
|
||||
VP_CutHead, 1, VP_CutTail, VL_TailPos
|
||||
)
|
||||
);
|
||||
/////////////////////////////////////////////////
|
||||
|
||||
VP_CutHead =VP_CutTemp;
|
||||
VP_CutTail =VP_CutTemp;
|
||||
VP_CutTemp =VP_CutTemp->GetNextPtr();
|
||||
|
||||
VL_TailPos =1 ;
|
||||
}/*
|
||||
else // VP_CutTail->GetData()!=VP_CutTemp->GetData()*/
|
||||
}/*
|
||||
for(TypeSize i=2; i<=VL_LoopSize; ++i)*/
|
||||
|
||||
if(ARR_CObjList.IsEmpty()==false) AR_Functor(ARR_CObjList);
|
||||
}/*
|
||||
template<typename TFunctor> static void SplitGroup( ##########
|
||||
TTypObjList& ARR_CObjList ,
|
||||
TFunctor AR_Functor ,
|
||||
bool AB_IsSorted=false ,
|
||||
bool AB_IsAscending=true
|
||||
############# ) ############################################*/
|
||||
|
||||
public:
|
||||
};/*
|
||||
template<typename TTypObjList> class ZtCSortObjList */
|
||||
|
||||
|
||||
namespace ZNsExam
|
||||
{
|
||||
|
||||
template<typename TTypeInt=int> class ZtExamSortIntList
|
||||
{
|
||||
public:
|
||||
|
||||
static void ShowElemnet(int AI_Element)
|
||||
{
|
||||
cout<<"* Element : "<<AI_Element<<endl;
|
||||
}
|
||||
///////////////////////////////////////
|
||||
|
||||
static int Main(int AI_ArgCnt=0, const char* APP_ArgVal[]=0)
|
||||
{
|
||||
using namespace std; typedef ZNsMain::
|
||||
ZtCObjList<TTypeInt, TTypeInt> CObjList ;
|
||||
|
||||
CObjList VO_CIntList; ///////////////////////////
|
||||
|
||||
VO_CIntList.AddTail(10); VO_CIntList.AddTail(1 );
|
||||
VO_CIntList.AddTail(6 ); VO_CIntList.AddTail(4 );
|
||||
VO_CIntList.AddTail(7 ); VO_CIntList.AddTail(2 );
|
||||
VO_CIntList.AddTail(8 ); VO_CIntList.AddTail(5 );
|
||||
VO_CIntList.AddTail(9 ); VO_CIntList.AddTail(3 );
|
||||
|
||||
cout<<"# Sort ASC" <<endl; ZtCSortObjList<CObjList>::
|
||||
QuickSort(RR(VO_CIntList), true ); VO_CIntList.IterElement(ShowElemnet);
|
||||
cout<<"# Sort DESC"<<endl; ZtCSortObjList<CObjList>::
|
||||
QuickSort(RR(VO_CIntList), false); VO_CIntList.IterElement(ShowElemnet);
|
||||
|
||||
return 0 ;
|
||||
}/*
|
||||
static int Main(int AI_ArgCnt=0, const char* APP_ArgVal[]=0)*/
|
||||
|
||||
public:
|
||||
};/*
|
||||
template<typename TTypeInt=int> class ZtExamSortIntList*/
|
||||
|
||||
}/*
|
||||
namespace ZNsExam*/
|
||||
|
||||
|
||||
// 단방향 연결리스트에 대한 정렬 클래스이다.
|
||||
|
||||
template<typename TTypObjList> class ZtCSortSimList
|
||||
{
|
||||
public :
|
||||
typedef typename TTypObjList::ZCLink ZCLink ;
|
||||
typedef typename TTypObjList::TypeData TypeData ;
|
||||
typedef typename TTypObjList::TypeArg TypeArg ;
|
||||
typedef typename TTypObjList::TypeSize TypeSize ;
|
||||
private:
|
||||
|
||||
static inline void SwapLinkPtr(ZCLink*& APR_LinkI, ZCLink*& APR_LinkJ)
|
||||
{
|
||||
ZCLink*
|
||||
VP_Temp =APR_LinkI;
|
||||
APR_LinkI=APR_LinkJ;
|
||||
APR_LinkJ=VP_Temp;
|
||||
}/*
|
||||
static inline void SwapLinkPtr( ZCLink*& APR_LinkI, ZCLink*& APR_LinkJ) */
|
||||
|
||||
|
||||
template
|
||||
<typename TTypFuncIsMore, typename TTypFuncIsLess>
|
||||
static void QuickSort
|
||||
(
|
||||
TTypFuncIsMore APF_IsMore ,
|
||||
TTypFuncIsLess APF_IsLess ,
|
||||
ZCLink* APA_LinkPtrArr[],
|
||||
TypeSize AL_HeadIndex ,
|
||||
TypeSize AL_TailIndex
|
||||
)
|
||||
/*##################################################*/
|
||||
{
|
||||
if(AL_HeadIndex<AL_TailIndex)
|
||||
{
|
||||
TypeSize i=AL_HeadIndex ;
|
||||
TypeSize j=AL_TailIndex+1 ;
|
||||
|
||||
ZCLink* VP_PivotLinkPtr=APA_LinkPtrArr[i];
|
||||
|
||||
do //////
|
||||
{
|
||||
while(AL_TailIndex >i && APF_IsLess(APA_LinkPtrArr[++i]->GetData(), VP_PivotLinkPtr->GetData()));
|
||||
while(AL_HeadIndex <j && APF_IsMore(APA_LinkPtrArr[--j]->GetData(), VP_PivotLinkPtr->GetData()));
|
||||
|
||||
if(i<j) SwapLinkPtr(APA_LinkPtrArr[i], APA_LinkPtrArr[j]);
|
||||
}
|
||||
while(i<j);
|
||||
|
||||
/* SwapLinkPtr(APA_LinkPtrArr[AL_HeadIndex],APA_LinkPtrArr[j]);
|
||||
|
||||
위 코드 보다 아래처럼 2 줄로 쓰는게 별도의 스택 변수를 사용하지
|
||||
않아서 좋다.
|
||||
*/
|
||||
APA_LinkPtrArr[AL_HeadIndex]=APA_LinkPtrArr[j];
|
||||
APA_LinkPtrArr[j ]=VP_PivotLinkPtr ;
|
||||
|
||||
QuickSort(APF_IsMore, APF_IsLess, APA_LinkPtrArr, AL_HeadIndex, j-1 );
|
||||
QuickSort(APF_IsMore, APF_IsLess, APA_LinkPtrArr, j+1, AL_TailIndex);
|
||||
}/*
|
||||
if(AL_HeadIndex<AL_TailIndex)*/
|
||||
}/*
|
||||
template
|
||||
<typename TTypFuncIsMore, typename TTypFuncIsLess>
|
||||
static void QuickSort
|
||||
(
|
||||
TTypFuncIsMore APF_IsMore ,
|
||||
TTypFuncIsLess APF_IsLess ,
|
||||
ZCLink* APA_LinkPtrArr[],
|
||||
TypeSize AL_HeadIndex ,
|
||||
TypeSize AL_TailIndex
|
||||
)
|
||||
/*##################################################*/
|
||||
|
||||
/*private:*/
|
||||
public :
|
||||
|
||||
template
|
||||
<typename TTypFuncIsMore, typename TTypFuncIsLess>
|
||||
static void QuickSort
|
||||
(
|
||||
TTypObjList& ARR_CObjList,
|
||||
TTypFuncIsMore APF_IsMore ,
|
||||
TTypFuncIsLess APF_IsLess
|
||||
)
|
||||
/*##################################################*/
|
||||
{
|
||||
if(ARR_CObjList.GetSize()<=1) return;
|
||||
|
||||
TypeSize VL_SortSize = ARR_CObjList.GetSize() ;
|
||||
ZCLink** VPP_LinkPtrArr = new ZCLink*[VL_SortSize];
|
||||
|
||||
if(VPP_LinkPtrArr==0)
|
||||
{
|
||||
// Add codes for memory over
|
||||
|
||||
return;
|
||||
}/*
|
||||
if(VPP_LinkPtrArr==0)*/
|
||||
|
||||
ZCLink* VP_TempLink =
|
||||
ARR_CObjList.GetHeadLinkPtr();
|
||||
TypeSize i=0 ;
|
||||
|
||||
for(; i<VL_SortSize; ++i)
|
||||
{
|
||||
VPP_LinkPtrArr[i]=VP_TempLink ;
|
||||
VP_TempLink =VP_TempLink->GetNextPtr();
|
||||
}
|
||||
/////////////////////////
|
||||
|
||||
QuickSort
|
||||
(APF_IsMore, APF_IsLess, VPP_LinkPtrArr, 0, VL_SortSize-1);
|
||||
|
||||
for(i=1; i<VL_SortSize; ++i) // VL_SortSize-1 번 순환
|
||||
{
|
||||
ZCLink::JoinLink(VPP_LinkPtrArr[i-1], VPP_LinkPtrArr[i]);
|
||||
}
|
||||
/*++++++++++++++++++++++++*/
|
||||
|
||||
#if(_CODE_OLD_) // 아래 코드만 빠진다.
|
||||
ZCLink::MakeRing(VPP_LinkPtrArr[0], VPP_LinkPtrArr[VL_SortSize-1]);
|
||||
#else
|
||||
ARR_CObjList.mp_HeadLink=VPP_LinkPtrArr[0] ;
|
||||
ARR_CObjList.mp_TailLink=VPP_LinkPtrArr[VL_SortSize-1];
|
||||
#endif
|
||||
|
||||
delete[] VPP_LinkPtrArr;
|
||||
}/*
|
||||
template
|
||||
<typename TTypFuncIsMore, typename TTypFuncIsLess>
|
||||
static void QuickSort
|
||||
(
|
||||
TTypObjList& ARR_CObjList,
|
||||
TTypFuncIsMore APF_IsMore ,
|
||||
TTypFuncIsLess APF_IsLess
|
||||
)
|
||||
####################################################*/
|
||||
|
||||
public:
|
||||
};/*
|
||||
template<typename TTypObjList> class ZtCSortSimList */
|
||||
|
||||
}/*
|
||||
namespace ZNsMain*/
|
||||
|
||||
|
||||
#endif //__ZCPPMAIN__ZCSORT_LIST_H__
|
7824
ZCppMain/ZtCStringEx.H
Normal file
7824
ZCppMain/ZtCStringEx.H
Normal file
File diff suppressed because it is too large
Load Diff
487
ZCppMain/ZtCStringStd.H
Normal file
487
ZCppMain/ZtCStringStd.H
Normal file
@ -0,0 +1,487 @@
|
||||
|
||||
|
||||
#ifndef __ZCPPMAIIN_ZTCSTRINGSTD_H__
|
||||
#define __ZCPPMAIIN_ZTCSTRINGSTD_H__
|
||||
|
||||
|
||||
#include<string>
|
||||
#include "ZCppMain/ZtCMainChars.H"
|
||||
|
||||
|
||||
namespace ZNsMain
|
||||
{
|
||||
|
||||
template
|
||||
< typename TTypString = std::string >
|
||||
class ZtCStringStd : public TTypString
|
||||
{
|
||||
public:
|
||||
typedef typename TTypString::traits_type::char_type TypeChar ;
|
||||
typedef typename TTypString::traits_type::int_type TypeCharInt ;
|
||||
public:
|
||||
typedef ZNsChars::ZNsType::
|
||||
ZtCTypeChars <TypeChar > ZCTypeChars ;
|
||||
typedef ZNsChars::
|
||||
ZtCMainChars<ZCTypeChars> ZCMainChars ;
|
||||
public:
|
||||
typedef TypeChar* TypePChar ;
|
||||
typedef const TypeChar* TypeCPChar ;
|
||||
typedef TTypString TypeBase ;
|
||||
typedef TTypString TypeStrStd ;
|
||||
typedef ZTypLength TypeLength ;
|
||||
typedef ZTypLength TypeSize ;
|
||||
public:
|
||||
typedef ZtCChars<TypePChar> ZCChars ;
|
||||
typedef ZtCChars<TypePChar> ZCCharView ;
|
||||
public:
|
||||
|
||||
ZtCStringStd(): TypeStrStd(){}
|
||||
ZtCStringStd(const ZtCStringStd& rhs): TypeStrStd(rhs){}
|
||||
ZtCStringStd(TypeCPChar APC_Origin, TypeLength AL_Length):
|
||||
TypeStrStd(APC_Origin, AL_Length){}
|
||||
|
||||
ZtCStringStd(const ZCCharView& AR_View):
|
||||
TypeStrStd(AR_View.data(), AR_View.size()){}
|
||||
|
||||
explicit ZtCStringStd(TypeCPChar APC_Origin):
|
||||
TypeStrStd(APC_Origin){}
|
||||
|
||||
ZtCStringStd& operator=(const ZtCStringStd& rhs)
|
||||
{
|
||||
if(this==&rhs){ return *this; }
|
||||
|
||||
this->TypeStrStd::operator=(rhs); return *this;
|
||||
}/*
|
||||
ZtCStringStd& operator=(const ZtCStringStd& rhs)*/
|
||||
|
||||
ZtCStringStd& operator=(const TypeBase& rhs)
|
||||
{
|
||||
if(this->data()==rhs.data()){ return *this; }
|
||||
|
||||
this->TypeStrStd::operator=(rhs); return *this;
|
||||
}/*
|
||||
ZtCStringStd& operator=(const TypeBase& rhs)*/
|
||||
|
||||
|
||||
template<typename TPosList> void FindPosToList /////////////
|
||||
(
|
||||
TPosList& ARR_CPosList, TypeCPChar APC_SearchData,
|
||||
TypeLength AL_SearchLen, TypeLength AL_Offset=0
|
||||
)
|
||||
/*########################################################*/
|
||||
{
|
||||
// TPosList : ZNsMain::ZtCBaseList<TypeLength> etc
|
||||
|
||||
if(0 > AL_Offset) AL_Offset=0 ;
|
||||
if(this->size() <= AL_Offset) return ;
|
||||
if(this->size() < 1 ) return ;
|
||||
|
||||
TypeCPChar VPC_OriginStart = this->data();
|
||||
TypeLength VL_OriginLen = this->size();
|
||||
TypeLength VL_FindPos = -1 ;
|
||||
TypeLength VL_OffsetNow = AL_Offset ;
|
||||
|
||||
while /*::::::::::::::::::::::::::::::::::::::::::::::*/
|
||||
(
|
||||
( VL_FindPos = ZCMainChars::FindPos
|
||||
( VPC_OriginStart, APC_SearchData,
|
||||
VL_OriginLen , AL_SearchLen , VL_OffsetNow
|
||||
)
|
||||
) >= 0
|
||||
)
|
||||
/*::::::::::::::::::::::::::::::::::::::::::::::::::::*/
|
||||
{
|
||||
ARR_CPosList.push_back(VL_FindPos);
|
||||
|
||||
VL_OffsetNow = VL_FindPos + AL_SearchLen;
|
||||
}
|
||||
/*::::::::::::::::::::::::::::::::::::::::::::::::::::*/
|
||||
}/*
|
||||
template<typename TPosList> void FindPosToList /////////////
|
||||
(
|
||||
TPosList& ARR_CPosList, TypeCPChar APC_SearchData,
|
||||
TypeLength AL_SearchLen, TypeLength AL_Offset=0
|
||||
)
|
||||
##########################################################*/
|
||||
|
||||
|
||||
public :
|
||||
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
|
||||
private:
|
||||
|
||||
template<typename TPosList> ZtCStringStd& ReplaceByPosList ///////////////////
|
||||
(
|
||||
TPosList& AR_CPosList ,
|
||||
TypeCPChar APC_Replace ,
|
||||
TypeLength AL_Replace ,
|
||||
TypeLength AL_Searched
|
||||
)
|
||||
/*#########################################################################*/
|
||||
{
|
||||
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
|
||||
■ TPosList : ZNsMain::ZtCBaseList<TypeLength> etc
|
||||
AL_Replace : APC_Replace 의 길이
|
||||
AL_Searched : 이전에 찾은 길이
|
||||
|
||||
Replace() 에서 FindPosToList() 다음에 호출한다.
|
||||
|
||||
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
|
||||
|
||||
if(AR_CPosList.size()<1) return *this;
|
||||
|
||||
TypeLength VL_PosListSize= AR_CPosList.size() ;
|
||||
TypeLength VL_ThisSize = this->size() ;
|
||||
TypeLength VL_NeedSize = VL_ThisSize +
|
||||
(AL_Replace-AL_Searched) * VL_PosListSize ;
|
||||
|
||||
TypePChar VPC_ThisStart = const_cast<TypeChar*>(this->data()) ;
|
||||
IterEasyID VH_IterEasyID = AR_CPosList.ItHID();
|
||||
TypeLength VL_SearchedPos= 0 ;
|
||||
TypeLength VL_SearchedPre= 0 ; // VL_SearchedPos 의 이전 값
|
||||
|
||||
TypePChar VPC_MoveStart = 0 ;
|
||||
TypePChar VPC_DestStart = 0 ;
|
||||
TypeLength VL_MoveStart = 0 ;
|
||||
TypeLength VL_DestStart = 0 ;
|
||||
TypeLength VL_MemMoveSize= 0 ;
|
||||
|
||||
if(AL_Replace<=AL_Searched) // 메모리 증가 불필요
|
||||
{
|
||||
TypePChar VPC_MoveStart = 0 ;
|
||||
TypePChar VPC_DestStart = 0 ;
|
||||
TypeLength VL_MoveStart = 0 ;
|
||||
TypeLength VL_DestStart = 0 ;
|
||||
|
||||
TypeLength VL_MemMoveSize= 0 ;
|
||||
TypePChar VPC_RepalcePos= 0 ;
|
||||
|
||||
__for1(TypeLength, i, VL_PosListSize)
|
||||
{
|
||||
VL_SearchedPos = AR_CPosList.ItD(VH_IterEasyID) ;
|
||||
VPC_RepalcePos = VPC_ThisStart + VL_SearchedPos -
|
||||
( AL_Searched-AL_Replace ) * (i-1) ;
|
||||
|
||||
if(VL_MoveStart>VL_DestStart)
|
||||
{
|
||||
VL_MemMoveSize =
|
||||
VL_SearchedPos - VL_SearchedPre - AL_Searched ;
|
||||
VPC_MoveStart = VPC_ThisStart + VL_MoveStart ;
|
||||
VPC_DestStart = VPC_ThisStart + VL_DestStart ;
|
||||
|
||||
::memmove /*:::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
|
||||
(
|
||||
VPC_DestStart, VPC_MoveStart, VL_MemMoveSize*sizeof(TypeChar)
|
||||
);
|
||||
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
|
||||
}/*
|
||||
if(VL_MoveStart>VL_DestStart)*/
|
||||
|
||||
VL_SearchedPre = VL_SearchedPos ;
|
||||
VL_MoveStart = VL_SearchedPos+ AL_Searched ;
|
||||
VL_DestStart = VL_SearchedPos+ AL_Searched -
|
||||
( AL_Searched-AL_Replace ) * i ;
|
||||
|
||||
::memcpy(VPC_RepalcePos, APC_Replace, AL_Replace);
|
||||
|
||||
AR_CPosList.ItNext(VH_IterEasyID);
|
||||
}/*
|
||||
__for1(TypeLength, i, VL_PosListSize)*/
|
||||
|
||||
if(VL_ThisSize > VL_MoveStart)
|
||||
{
|
||||
::memmove /*::::::::::::::::::::::::::::::*/
|
||||
(
|
||||
VPC_ThisStart + VL_DestStart,
|
||||
VPC_ThisStart + VL_MoveStart,
|
||||
(VL_ThisSize - VL_MoveStart)*sizeof(TypeChar)
|
||||
);
|
||||
/*::::::::::::::::::::::::::::::::::::::::*/
|
||||
}/*
|
||||
if(VL_ThisSize > VL_MoveStart)*/
|
||||
|
||||
this->resize(VL_NeedSize); return *this;
|
||||
}/*
|
||||
if(AL_Replace<=AL_Searched) // 메모리 증가 불필요*/
|
||||
|
||||
|
||||
/*======*/ VL_SearchedPre = this->size() ;
|
||||
/*======*/ VH_IterEasyID = AR_CPosList.ItTID() ;
|
||||
TypeLength VL_NowEleNo = VL_PosListSize ;
|
||||
TypeLength VL_DiffLength = AL_Replace-AL_Searched;
|
||||
|
||||
this->resize(VL_NeedSize); VPC_ThisStart = this->data();
|
||||
|
||||
__for1(TypeLength, i, VL_PosListSize)
|
||||
{
|
||||
VL_SearchedPos = AR_CPosList.ItD(VH_IterEasyID) ;
|
||||
VL_MemMoveSize = VL_SearchedPre - (VL_SearchedPos+AL_Searched);
|
||||
|
||||
if(VL_MemMoveSize>0)
|
||||
{
|
||||
VPC_MoveStart = VPC_ThisStart + VL_SearchedPos + AL_Searched ;
|
||||
VPC_DestStart = VPC_ThisStart + VL_SearchedPos + AL_Searched + VL_DiffLength*VL_NowEleNo ;
|
||||
|
||||
::memmove /*:::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
|
||||
(
|
||||
VPC_DestStart, VPC_MoveStart, VL_MemMoveSize*sizeof(TypeChar)
|
||||
);
|
||||
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
|
||||
}/*
|
||||
if(VL_MemMoveSize>0)*/
|
||||
|
||||
VPC_DestStart = VPC_ThisStart + VL_SearchedPos + VL_DiffLength*(VL_PosListSize - i) ;
|
||||
|
||||
::memcpy /*:::::::::::::::::::::::::::::::::::::::::::::::::*/
|
||||
(
|
||||
VPC_DestStart, APC_Replace, AL_Replace*sizeof(TypeChar)
|
||||
);
|
||||
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
|
||||
|
||||
VL_SearchedPre = VL_SearchedPos; --VL_NowEleNo;
|
||||
|
||||
AR_CPosList.ItPrev(VH_IterEasyID);
|
||||
}/*
|
||||
__for1(TypeLength, i, VL_PosListSize)*/
|
||||
|
||||
|
||||
return *this;
|
||||
}/*
|
||||
template<typename TPosList> ZtCStringStd& ReplaceByPosList //////////////////
|
||||
(
|
||||
TPosList& AR_CPosList ,
|
||||
TypeCPChar APC_Replace ,
|
||||
TypeLength AL_Replace ,
|
||||
TypeLength AL_Searched
|
||||
)
|
||||
###########################################################################*/
|
||||
|
||||
|
||||
private:
|
||||
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
|
||||
public :
|
||||
|
||||
|
||||
ZtCStringStd& Replace /*///////////////////////////////////////////////////*/
|
||||
(
|
||||
TypeCPChar APC_Search, TypeCPChar APC_Replace,
|
||||
TypeLength AL_Search , TypeLength AL_Replace , TypeLength AL_Offset=0
|
||||
)
|
||||
/*#########################################################################*/
|
||||
{
|
||||
if(0 > AL_Offset) AL_Offset=0 ;
|
||||
if(this->size() <= AL_Offset) return *this;
|
||||
if(this->size() < 1 ) return *this;
|
||||
|
||||
ZtCBaseList<TypeLength> VO_CPosCList; FindPosToList
|
||||
(
|
||||
RR(VO_CPosCList), APC_Search, AL_Search, AL_Offset
|
||||
);
|
||||
/*////////////////////////////////////////////////*/
|
||||
|
||||
return ReplaceByPosList /*::::::::::::::::::::::::::::*/
|
||||
(
|
||||
VO_CPosCList, APC_Replace, AL_Replace, AL_Search
|
||||
);
|
||||
/*::::::::::::::::::::::::::::::::::::::::::::::::::::*/
|
||||
}/*
|
||||
ZtCStringStd& Replace ///////////////////////////////////////////////////////
|
||||
(
|
||||
TypeCPChar APC_Search, TypeCPChar APC_Replace,
|
||||
TypeLength AL_Search , TypeLength AL_Replace , TypeLength AL_Offset=0
|
||||
)
|
||||
###########################################################################*/
|
||||
|
||||
|
||||
ZtCStringStd& Replace /*///////////////////////////////////////////////////*/
|
||||
(
|
||||
TypeCPChar APC_Search, TypeCPChar APC_Replace, TypeLength AL_Offset=0
|
||||
)
|
||||
/*#########################################################################*/
|
||||
{
|
||||
return Replace(APC_Search, APC_Replace, ZftLength(APC_Search), ZftLength(APC_Replace), AL_Offset);
|
||||
}/*
|
||||
ZtCStringStd& Replace ///////////////////////////////////////////////////////
|
||||
(
|
||||
TypeCPChar APC_Search, TypeCPChar APC_Replace, TypeLength AL_Offset=0
|
||||
)
|
||||
###########################################################################*/
|
||||
|
||||
|
||||
ZtCStringStd& operator()(ZtCStringStd& rhs)
|
||||
{
|
||||
if(this==&rhs) return *this; this->append(rhs); return *this;
|
||||
}/*
|
||||
ZtCStringStd& operator()(ZtCStringStd& rhs)*/
|
||||
|
||||
ZtCStringStd& operator()(TypeCPChar APC_Data, TypeLength AI_Length)
|
||||
{
|
||||
if(this->data()==APC_Data) return *this;
|
||||
|
||||
this->append(APC_Data, AI_Length); return *this;
|
||||
}/*
|
||||
ZtCStringStd& operator()(TypeCPChar APC_Data, TypeLength AI_Length)*/
|
||||
|
||||
ZtCStringStd& operator()(TypeCPChar APC_Data)
|
||||
{
|
||||
if(this->data()==APC_Data) return *this;
|
||||
|
||||
this->append(APC_Data); return *this;
|
||||
}/*
|
||||
ZtCStringStd& operator()(TypeCPChar APC_Data)*/
|
||||
|
||||
ZtCStringStd& operator()(TypeLength AI_Repeat, TypeChar AC_Data)
|
||||
{
|
||||
this->append(AI_Repeat, AC_Data); return *this;
|
||||
}/*
|
||||
ZtCStringStd& operator()(TypeChar AC_Data, TypeLength AI_Repeat)*/
|
||||
|
||||
ZtCStringStd& operator()(TypeChar AC_Data, TypeLength AI_Repeat=1)
|
||||
{
|
||||
this->append(AI_Repeat, AC_Data); return *this;
|
||||
}/*
|
||||
ZtCStringStd& operator()(TypeChar AC_Data, TypeLength AI_Repeat=1)*/
|
||||
|
||||
|
||||
ZtCStringStd& operator()(int AI_IntParam)
|
||||
{
|
||||
const int CI_BuffSize= 21; TypeChar VCA_BuffParam[CI_BuffSize] ;
|
||||
|
||||
int VI_ResultSize = /*::::::::::::::::::::::::::::::::::::::::*/
|
||||
(
|
||||
sizeof(TypeChar)<=1
|
||||
? ::sprintf ((char* )VCA_BuffParam, /*+++++++*/ "%d", AI_IntParam)
|
||||
: ::swprintf((wchar_t*)VCA_BuffParam, CI_BuffSize, L"%d", AI_IntParam)
|
||||
);
|
||||
return (*this)(VCA_BuffParam, VI_ResultSize); /*::::::::::::::*/
|
||||
}/*
|
||||
ZtCStringStd& operator()(int AI_IntParam)*/
|
||||
|
||||
ZtCStringStd& operator()(ZTypUInt AUI_UIntParam)
|
||||
{
|
||||
const int CI_BuffSize= 21; TypeChar VCA_BuffParam[CI_BuffSize] ;
|
||||
|
||||
int VI_ResultSize = /*::::::::::::::::::::::::::::::::::::::::*/
|
||||
(
|
||||
sizeof(TypeChar)<=1
|
||||
? ::sprintf ((char* )VCA_BuffParam, /*++++++++*/ "%u", AUI_UIntParam)
|
||||
: ::swprintf((wchar_t*)VCA_BuffParam, CI_BuffSize, L"%u", AUI_UIntParam)
|
||||
);
|
||||
return (*this)(VCA_BuffParam, VI_ResultSize); /*::::::::::::::*/
|
||||
}/*
|
||||
ZtCStringStd& operator()(ZTypUInt AUI_UIntParam)*/
|
||||
|
||||
ZtCStringStd& operator()(long AL_LongParam)
|
||||
{
|
||||
const int CI_BuffSize= 31; TypeChar VCA_BuffParam[CI_BuffSize] ;
|
||||
|
||||
int VI_ResultSize = /*::::::::::::::::::::::::::::::::::::::::*/
|
||||
(
|
||||
sizeof(TypeChar)<=1
|
||||
? ::sprintf ((char* )VCA_BuffParam, /*++++++++*/ "%ld", AL_LongParam)
|
||||
: ::swprintf((wchar_t*)VCA_BuffParam, CI_BuffSize, L"%ld", AL_LongParam)
|
||||
);
|
||||
return (*this)(VCA_BuffParam, VI_ResultSize); /*::::::::::::::*/
|
||||
}/*
|
||||
ZtCStringStd& operator()(long AL_LongParam)*/
|
||||
|
||||
ZtCStringStd& operator()(ZTypULong AUL_ULongParam)
|
||||
{
|
||||
const int CI_BuffSize= 31; TypeChar VCA_BuffParam[CI_BuffSize] ;
|
||||
|
||||
int VI_ResultSize = /*::::::::::::::::::::::::::::::::::::::::*/
|
||||
(
|
||||
sizeof(TypeChar)<=1
|
||||
? ::sprintf ((char* )VCA_BuffParam, /*++++++++*/ "%lu", AUL_ULongParam)
|
||||
: ::swprintf((wchar_t*)VCA_BuffParam, CI_BuffSize, L"%lu", AUL_ULongParam)
|
||||
);
|
||||
return (*this)(VCA_BuffParam, VI_ResultSize); /*::::::::::::::*/
|
||||
}/*
|
||||
ZtCStringStd& operator()(ZTypULong AUL_ULongParam)*/
|
||||
|
||||
ZtCStringStd& operator()(ZTypLLong ALL_LLongParam)
|
||||
{
|
||||
const int CI_BuffSize= 41; TypeChar VCA_BuffParam[CI_BuffSize] ;
|
||||
#ifdef _WIN
|
||||
int VI_ResultSize = /*::::::::::::::::::::::::::::::::::::::::*/
|
||||
(
|
||||
sizeof(TypeChar)<=1
|
||||
? ::sprintf ((char* )VCA_BuffParam, /*++++++++*/ "%I64d", ALL_LLongParam)
|
||||
: ::swprintf((wchar_t*)VCA_BuffParam, CI_BuffSize, L"%I64d", ALL_LLongParam)
|
||||
);
|
||||
#else
|
||||
int VI_ResultSize =
|
||||
(
|
||||
sizeof(TypeChar)<=1
|
||||
? ::sprintf ((char* )VCA_BuffParam, /*++++++++*/ "%lld" , ALL_LLongParam)
|
||||
: ::swprintf((wchar_t*)VCA_BuffParam, CI_BuffSize, L"%lld" , ALL_LLongParam)
|
||||
);
|
||||
#endif
|
||||
return (*this)(VCA_BuffParam, VI_ResultSize); /*::::::::::::::*/
|
||||
}/*
|
||||
ZtCStringStd& operator()(ZTypLLong ALL_LLongParam)*/
|
||||
|
||||
ZtCStringStd& operator()(ZTypULLong AULL_LLongParam)
|
||||
{
|
||||
const int CI_BuffSize= 41; TypeChar VCA_BuffParam[CI_BuffSize] ;
|
||||
#ifdef _WIN
|
||||
int VI_ResultSize = /*::::::::::::::::::::::::::::::::::::::::*/
|
||||
(
|
||||
sizeof(TypeChar)<=1
|
||||
? ::sprintf ((char* )VCA_BuffParam, /*+++++++*/ "%I64u", AULL_LLongParam)
|
||||
: ::swprintf((wchar_t*)VCA_BuffParam, CI_BuffSize, L"%I64u", AULL_LLongParam)
|
||||
);
|
||||
#else
|
||||
int VI_ResultSize = /*::::::::::::::::::::::::::::::::::::::::*/
|
||||
(
|
||||
sizeof(TypeChar)<=1
|
||||
? ::sprintf ((char* )VCA_BuffParam, /*++++++++*/ "%llu" , AULL_LLongParam)
|
||||
: ::swprintf((wchar_t*)VCA_BuffParam, CI_BuffSize, L"%llu" , AULL_LLongParam)
|
||||
);
|
||||
#endif
|
||||
return (*this)(VCA_BuffParam, VI_ResultSize); /*::::::::::::::*/
|
||||
}/*
|
||||
ZtCStringStd& operator()(ZTypULLong AULL_LLongParam)*/
|
||||
|
||||
ZtCStringStd& operator()(double AD_DoubleParam)
|
||||
{
|
||||
const int CI_BuffSize= 51; TypeChar VCA_BuffParam[CI_BuffSize] ;
|
||||
|
||||
int VI_ResultSize = /*::::::::::::::::::::::::::::::::::::::::*/
|
||||
(
|
||||
sizeof(TypeChar)<=1
|
||||
? ::sprintf ((char* )VCA_BuffParam, /*++++++++*/ "%f", AD_DoubleParam)
|
||||
: ::swprintf((wchar_t*)VCA_BuffParam, CI_BuffSize, L"%f", AD_DoubleParam)
|
||||
);
|
||||
return (*this)(VCA_BuffParam, VI_ResultSize); /*::::::::::::::*/
|
||||
}/*
|
||||
ZtCStringStd& operator()(double AD_DoubleParam)*/
|
||||
|
||||
public:
|
||||
};/*
|
||||
template
|
||||
< typename TTypString = std::string >
|
||||
class ZtCStringStd : public TTypString */
|
||||
|
||||
|
||||
template<typename TTypString> std::ostream& operator<<
|
||||
(std::ostream& AR_COStream, const ZtCStringStd<TTypString>& AR_DataCStr)
|
||||
{
|
||||
typedef typename ZtCStringStd
|
||||
<TTypString>::TypeBase TypeBaseCStr ;
|
||||
|
||||
AR_COStream<< static_cast
|
||||
<const TypeBaseCStr&>(AR_DataCStr);
|
||||
|
||||
return AR_COStream; ///////////////////////////
|
||||
}/*
|
||||
template<typename TTypString> std::ostream& operator<<
|
||||
(std::ostream& AR_COStream, const ZtCStringStd& AR_DataCStr)*/
|
||||
|
||||
|
||||
}/*
|
||||
namespace ZNsMain*/
|
||||
|
||||
|
||||
|
||||
#endif //__ZCPPMAIIN_ZTCSTRINGSTD_H__
|
992
ZCppMain/ZtCTreeData.H
Normal file
992
ZCppMain/ZtCTreeData.H
Normal file
@ -0,0 +1,992 @@
|
||||
|
||||
|
||||
#ifndef __ZCPPMAIN__ZCTREEDATA_H__
|
||||
#define __ZCPPMAIN__ZCTREEDATA_H__
|
||||
|
||||
|
||||
#include "ZCppMain/ZtCObjList.H"
|
||||
|
||||
|
||||
namespace ZNsMain
|
||||
{
|
||||
|
||||
namespace ZNsView
|
||||
{
|
||||
|
||||
template< typename TypeData, typename TypeSize=int
|
||||
>
|
||||
class ZtCViewTreeData ////////////////////////////
|
||||
{
|
||||
private:
|
||||
|
||||
void ShowDepth(TypeSize AI_Depth)
|
||||
{
|
||||
__for1(TypeSize, i, AI_Depth) cout<<" ";
|
||||
}/*
|
||||
void ShowDepth(TypeSize AI_Depth)*/
|
||||
|
||||
public :
|
||||
|
||||
ZNsMain::ZNsEnum::ZERun OnDataStart(TypeSize AI_Depth)
|
||||
{
|
||||
ShowDepth(AI_Depth); cout<<"▷ OnDataStart:"<<endl;
|
||||
return ZNsMain::ZNsEnum::ZERun_OK;
|
||||
}
|
||||
ZNsMain::ZNsEnum::ZERun OnDataBody(TypeData& AR_TypeData, TypeSize AI_Depth, TypeSize AI_Index=0)
|
||||
{
|
||||
ShowDepth(AI_Depth); cout<<" ※ Index="<<AI_Index<<": "<<AR_TypeData<<endl;
|
||||
return ZNsMain::ZNsEnum::ZERun_OK;
|
||||
}
|
||||
ZNsMain::ZNsEnum::ZERun OnDataClose(TypeSize AI_Depth)
|
||||
{
|
||||
ShowDepth(AI_Depth); cout<<"◁ OnDataClose:"<<endl;
|
||||
return ZNsMain::ZNsEnum::ZERun_OK;
|
||||
}
|
||||
ZNsMain::ZNsEnum::ZERun OnSubNodeStart(TypeSize AI_Depth, TypeSize AI_NodeCnt)
|
||||
{
|
||||
if(AI_NodeCnt<1){ return ZNsMain::ZNsEnum::ZERun_OK; }
|
||||
|
||||
ShowDepth(AI_Depth); cout<<"▶ OnSubNodeStart:"<<endl;
|
||||
return ZNsMain::ZNsEnum::ZERun_OK;
|
||||
}
|
||||
ZNsMain::ZNsEnum::ZERun OnSubNodeClose(TypeSize AI_Depth, TypeSize AI_NodeCnt)
|
||||
{
|
||||
if(AI_NodeCnt<1){ return ZNsMain::ZNsEnum::ZERun_OK; }
|
||||
|
||||
ShowDepth(AI_Depth); cout<<"◀ OnSubNodeClose:"<<endl;
|
||||
return ZNsMain::ZNsEnum::ZERun_OK;
|
||||
}/*
|
||||
ZNsMain::ZNsEnum::ZERun OnSubNodeClose(TypeSize AI_Depth, TypeSize AI_NodeCnt)*/
|
||||
|
||||
public:
|
||||
};/*
|
||||
template< typename TypeData, typename TypeSize=int
|
||||
>
|
||||
class ZtCViewTreeData //////////////////////////*/
|
||||
|
||||
}/*
|
||||
namespace ZNsView*/
|
||||
|
||||
|
||||
namespace ZNsType
|
||||
{
|
||||
|
||||
/*/////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
■ class ZtCTypeTreeData 템플릿은 정의에서 또 다른 템플릿(list 등의 컨테이너 템플릿)을
|
||||
포함하고 있음을 눈여겨 보자. 이것을 ZtCTreeData<> 에서 활용하는 부분은 아래처럼
|
||||
|
||||
typedef typename TTypeTreeData::template ZtCTypeClass<ZCNode1>::TypeData ZCNode1List;
|
||||
typedef typename TTypeTreeData::template ZtCTypeClass<ZCNode2>::TypeData ZCNode2List;
|
||||
|
||||
다소 복잡해 보인다.
|
||||
|
||||
-- 2011-11-01 14:39:00
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
template<typename TTypeSize=long> class ZtCTypeTreeData
|
||||
{
|
||||
public:
|
||||
typedef TTypeSize TypeSize;
|
||||
public:
|
||||
|
||||
template< typename TType ,
|
||||
typename TTypeArg =const TType& ,
|
||||
typename TTypeAlloc=ZNsMain::ZCAllocator,
|
||||
typename TTypeInit =ZNsMain::ZtCInit<TType>
|
||||
>
|
||||
class ZtCTypeClass /////////////////////////////////
|
||||
{
|
||||
public:
|
||||
typedef TTypeAlloc TypeAlloc;
|
||||
typedef TTypeInit TypeInit ;
|
||||
public:
|
||||
typedef ZNsMain::ZtCObjList
|
||||
<TType, TTypeArg, TTypeAlloc, TTypeInit, TTypeSize>
|
||||
TypeList; /////////////////
|
||||
public:
|
||||
};/*
|
||||
template< typename TType ,
|
||||
typename TTypeArg =const TType& ,
|
||||
typename TTypeAlloc=ZNsMain::ZCAllocator,
|
||||
typename TTypeInit =ZNsMain::ZtCInit<TType>
|
||||
>
|
||||
class ZtCTypeClass ///////////////////////////////*/
|
||||
|
||||
public:
|
||||
};/*
|
||||
template<typename TTypeSize=long> class ZtCTypeTreeData*/
|
||||
|
||||
}/*
|
||||
namespace ZNsType*/
|
||||
|
||||
|
||||
template< typename TType ,
|
||||
typename TTypeTreeData=ZNsType::ZtCTypeTreeData<long>
|
||||
>
|
||||
class ZtCTreeData /*###########################################*/
|
||||
{
|
||||
public:
|
||||
class ZCNode1; class ZCNode2; class ZCNodeInfo;
|
||||
public:
|
||||
typedef TType TypeData ;
|
||||
typedef TTypeTreeData TypeTreeData;
|
||||
public:
|
||||
typedef typename TTypeTreeData::TypeSize TypeSize ;
|
||||
typedef typename TTypeTreeData::template
|
||||
ZtCTypeClass<ZCNode1>::TypeList ZCNode1List ;
|
||||
typedef typename TTypeTreeData::template
|
||||
ZtCTypeClass<ZCNode2>::TypeList ZCNode2List ;
|
||||
public:
|
||||
typedef ZCNode1 ZCNode ;
|
||||
typedef ZCNode1List ZCNodeList ;
|
||||
public:
|
||||
typedef typename ZCNodeList::ZCLink ZCNodeLink;
|
||||
typedef typename ZCNodeList::iterator IterOfNode;
|
||||
public:
|
||||
|
||||
|
||||
class ZCNode1
|
||||
{
|
||||
public :
|
||||
friend class ZCNodeInfo;
|
||||
private:
|
||||
ZCNode* mp_HighNode ;
|
||||
TypeData mo_TypeData ;
|
||||
ZCNode2List mo_CNodeList;
|
||||
public :
|
||||
|
||||
ZCNode1()
|
||||
{
|
||||
mp_HighNode=0;
|
||||
}/*
|
||||
ZCNode1()*/
|
||||
|
||||
~ZCNode1()
|
||||
{
|
||||
mp_HighNode=0;
|
||||
}/*
|
||||
~ZCNode1()*/
|
||||
|
||||
ZCNode* GetHighNodePtr () {return (ZCNode*)mp_HighNode;}
|
||||
const ZCNode* GetHighNodePtr ()const{return (ZCNode*)mp_HighNode;}
|
||||
|
||||
TypeData& GetData () {return mo_TypeData;}
|
||||
const TypeData& GetData ()const{return mo_TypeData;}
|
||||
const ZCNodeList& GetCNodeList()const{return (ZCNodeList&)mo_CNodeList;}
|
||||
|
||||
TypeSize GetNodeCnt(){return mo_CNodeList.size();}
|
||||
|
||||
void DeleteCNodeList(){mo_CNodeList.DeleteAll();}
|
||||
void clear (){mo_CNodeList.DeleteAll();}
|
||||
|
||||
ZCNode& AddSubNode()
|
||||
{
|
||||
ZCNode* VP_CNode=(ZCNode*)&(*mo_CNodeList.AddTailDef());
|
||||
|
||||
VP_CNode->mp_HighNode=(ZCNode*)this; return *VP_CNode ;
|
||||
}/*
|
||||
ZCNode& AddSubNode()*/
|
||||
|
||||
ZCNodeInfo GetHeadNodeIter()
|
||||
{
|
||||
return ZCNodeInfo((ZCNode*)this, ((ZCNodeList&)mo_CNodeList).GetHeadLinkPtr());
|
||||
}/*
|
||||
ZCNodeInfo GetHeadNodeIter()*/
|
||||
|
||||
|
||||
/*//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
■ TViewClass 의 interface
|
||||
|
||||
ZNsMain::ZNsEnum::ZERun OnDataBody(TypeData, TypeSize AI_Depth, TypeSize AI_Index=0)
|
||||
|
||||
ZNsMain::ZNsEnum::ZERun OnSubNodeStart(int AI_Depth, int AI_NodeCnt)
|
||||
ZNsMain::ZNsEnum::ZERun OnSubNodeClose(int AI_Depth, int AI_NodeCnt)
|
||||
|
||||
-- 2011-10-31 21:53:00
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
template<typename TViewClass> ZNsMain::ZNsEnum::ZERun IterPreOrder
|
||||
( TViewClass& AR_CViewClass, TypeSize AI_StartDepth=0, TypeSize AI_NodeIndex=0 )
|
||||
/*##############################################################*/
|
||||
{
|
||||
const bool CB_DoStop = ///////////////////////////////
|
||||
(
|
||||
AR_CViewClass.OnDataBody
|
||||
(mo_TypeData, AI_StartDepth, AI_NodeIndex)
|
||||
== ZNsMain::ZNsEnum::ZERun_NO
|
||||
);
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
if(CB_DoStop) return ZNsMain::ZNsEnum::ZERun_NO;
|
||||
|
||||
TypeSize VL_NodeCnt= ((ZCNodeList&)mo_CNodeList).size () ;
|
||||
IterOfNode VO_iter_Node(((ZCNodeList&)mo_CNodeList).begin());
|
||||
|
||||
if ( AR_CViewClass. //////////////////////////////////////
|
||||
OnSubNodeStart(AI_StartDepth, VL_NodeCnt)==
|
||||
ZNsMain::ZNsEnum::ZERun_NO
|
||||
)
|
||||
{ return ZNsMain::ZNsEnum::ZERun_NO; } //////////////////////
|
||||
|
||||
|
||||
++AI_StartDepth;
|
||||
{
|
||||
__for1(TypeSize, i, VL_NodeCnt)
|
||||
{
|
||||
const bool CB_DoStop =
|
||||
(
|
||||
((ZCNodeList&)mo_CNodeList).ItD(VO_iter_Node).template
|
||||
IterPreOrder<TViewClass>
|
||||
(AR_CViewClass, AI_StartDepth, i)
|
||||
== ZNsMain::ZNsEnum::ZERun_NO
|
||||
);
|
||||
//////////////////////
|
||||
|
||||
if(CB_DoStop) return ZNsMain::ZNsEnum::ZERun_NO;
|
||||
|
||||
((ZCNodeList&)mo_CNodeList).MoveNextIter(RR(VO_iter_Node));
|
||||
}/*
|
||||
__for1(TypeSize, i, VL_NodeCnt)*/
|
||||
}
|
||||
--AI_StartDepth;
|
||||
|
||||
const ZNsMain::ZNsEnum::ZERun CE_ERun =
|
||||
AR_CViewClass.OnSubNodeClose(AI_StartDepth, VL_NodeCnt);
|
||||
|
||||
if(CE_ERun==ZNsMain::ZNsEnum::ZERun_NO)
|
||||
return ZNsMain::ZNsEnum::ZERun_NO; /////////////////////
|
||||
|
||||
return ZNsMain::ZNsEnum::ZERun_OK;
|
||||
}/*
|
||||
template<typename TViewClass> ZNsMain::ZNsEnum::ZERun IterPreOrder
|
||||
(TViewClass& AR_CViewClass, TypeSize AI_StartDepth=0, TypeSize AI_NodeIndex=0)
|
||||
/*##############################################################*/
|
||||
|
||||
template<typename TViewClass> ZNsMain::ZNsEnum::ZERun IterPostOrder
|
||||
( TViewClass& AR_CViewClass, TypeSize AI_StartDepth=0, TypeSize AI_NodeIndex=0 )
|
||||
/*###############################################################*/
|
||||
{
|
||||
TypeSize VL_NodeCnt = ((ZCNodeList&)mo_CNodeList).size () ;
|
||||
IterOfNode VO_iter_Node(((ZCNodeList&)mo_CNodeList).begin());
|
||||
|
||||
if(AR_CViewClass.OnSubNodeStart
|
||||
(AI_StartDepth, VL_NodeCnt)==ZNsMain::ZNsEnum::ZERun_NO)
|
||||
{ return ZNsMain::ZNsEnum::ZERun_NO; }
|
||||
|
||||
|
||||
++AI_StartDepth; /*####################*/
|
||||
{
|
||||
__for1(TypeSize, i, VL_NodeCnt)
|
||||
{
|
||||
const bool CB_DoStop =
|
||||
(
|
||||
((ZCNodeList&)mo_CNodeList).ItD(VO_iter_Node).template
|
||||
IterPostOrder<TViewClass>(AR_CViewClass, AI_StartDepth, i)
|
||||
== ZNsMain::ZNsEnum::ZERun_NO
|
||||
);
|
||||
//////////////////////
|
||||
|
||||
if(CB_DoStop) return ZNsMain::ZNsEnum::ZERun_NO;
|
||||
|
||||
((ZCNodeList&)mo_CNodeList).MoveNextIter(VO_iter_Node);
|
||||
}/*
|
||||
__for1(TypeSize, i, VL_NodeCnt)*/
|
||||
}
|
||||
--AI_StartDepth; /*####################*/
|
||||
|
||||
if(AR_CViewClass.OnSubNodeClose
|
||||
(AI_StartDepth, VL_NodeCnt)==ZNsMain::ZNsEnum::ZERun_NO)
|
||||
{ return ZNsMain::ZNsEnum::ZERun_NO; }
|
||||
|
||||
|
||||
const bool CB_DoStop = /////////////////////////
|
||||
(
|
||||
AR_CViewClass.OnDataBody
|
||||
( mo_TypeData, AI_StartDepth, AI_NodeIndex )
|
||||
==ZNsMain::ZNsEnum::ZERun_NO
|
||||
) ;
|
||||
////////////////////////////////////////////////
|
||||
|
||||
if(CB_DoStop)
|
||||
{ return ZNsMain::ZNsEnum::ZERun_NO; }
|
||||
|
||||
return ZNsMain::ZNsEnum::ZERun_OK;
|
||||
}/*
|
||||
template<typename TViewClass> ZNsMain::ZNsEnum::ZERun IterPostOrder
|
||||
(TViewClass& AR_CViewClass, TypeSize AI_StartDepth=0, TypeSize AI_NodeIndex=0)
|
||||
/*###############################################################*/
|
||||
|
||||
public:
|
||||
};/*
|
||||
class ZCNode1*/
|
||||
|
||||
|
||||
class ZCNode2
|
||||
{
|
||||
public :
|
||||
friend class ZCNodeInfo;
|
||||
private:
|
||||
ZCNode* mp_HighNode ;
|
||||
TypeData mo_TypeData ;
|
||||
ZCNode1List mo_CNodeList;
|
||||
public :
|
||||
|
||||
ZCNode2()
|
||||
{
|
||||
mp_HighNode=0;
|
||||
}/*
|
||||
ZCNode2()*/
|
||||
~ZCNode2()
|
||||
{
|
||||
mp_HighNode=0;
|
||||
}/*
|
||||
~ZCNode2()*/
|
||||
|
||||
ZCNode* GetHighNodePtr () {return (ZCNode*)mp_HighNode;}
|
||||
const ZCNode* GetHighNodePtr ()const{return (ZCNode*)mp_HighNode;}
|
||||
|
||||
TypeData& GetData () {return mo_TypeData ;}
|
||||
const TypeData& GetData ()const{return mo_TypeData ;}
|
||||
const ZCNodeList& GetCNodeList()const{return (ZCNodeList&)mo_CNodeList;}
|
||||
|
||||
TypeSize GetNodeCnt(){return mo_CNodeList.size();}
|
||||
|
||||
void DeleteCNodeList(){mo_CNodeList.DeleteAll();}
|
||||
void clear (){mo_CNodeList.DeleteAll();}
|
||||
|
||||
ZCNode& AddSubNode()
|
||||
{
|
||||
ZCNode* VP_CNode=(ZCNode*)&(*mo_CNodeList.AddTailDef());
|
||||
|
||||
VP_CNode->mp_HighNode=(ZCNode*)this; return *VP_CNode ;
|
||||
}/*
|
||||
ZCNode& AddSubNode()*/
|
||||
|
||||
ZCNodeInfo GetHeadNodeIter()
|
||||
{
|
||||
return ZCNodeInfo((ZCNode*)this, ((ZCNodeList&)mo_CNodeList).GetHeadLinkPtr());
|
||||
}/*
|
||||
ZCNodeInfo GetHeadNodeIter()*/
|
||||
|
||||
/*//////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
■ ZCNode1 과 ZCNode2 가 동일한 구조이므로, ZCNode2 에서는 IterPreOrder() 와 IterPostOrder() 를
|
||||
정의할 필요없다. ZCNode2 이 ZCNode1 로 형변환되어서 ZCNode1 의 IterPreOrder() 와 IterPostOrder()
|
||||
을 사용할 것이기 때문이다.
|
||||
|
||||
-- 2011-11-01 10:40:00
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
public:
|
||||
};/*
|
||||
class ZCNode2*/
|
||||
|
||||
class ZCNodeInfo
|
||||
{
|
||||
private:
|
||||
ZCNode* mp_NowNodeWrap;
|
||||
ZCNodeLink* mp_NowNodeLink;
|
||||
public :
|
||||
|
||||
ZCNodeInfo(ZCNode* AP_CNode=0, ZCNodeLink* AP_CNodeLink=0)
|
||||
{
|
||||
mp_NowNodeWrap=AP_CNode; mp_NowNodeLink=AP_CNodeLink;
|
||||
}/*
|
||||
ZCNodeInfo(ZCNode* AP_CNode=0, ZCNodeLink* AP_CNodeLink=0)*/
|
||||
|
||||
ZCNode* GetNowNodeWrap(){return mp_NowNodeWrap;}
|
||||
ZCNodeLink* GetNowNodeLink(){return mp_NowNodeLink;}
|
||||
|
||||
bool DeleteNode()
|
||||
{
|
||||
if(mp_NowNodeWrap==0 || mp_NowNodeLink==0) return false;
|
||||
|
||||
((ZCNodeList&)(mp_NowNodeWrap->mo_CNodeList)).
|
||||
DeleteLink(mp_NowNodeLink);
|
||||
mp_NowNodeLink=0; return true; ///////////////
|
||||
}/*
|
||||
bool DeleteNode()*/
|
||||
|
||||
ZCNodeInfo& operator ++ (int)
|
||||
{mp_NowNodeWrap->mo_CNodeList.MoveNextIter(mp_NowNodeLink); return *this;}
|
||||
|
||||
ZCNode& operator*() {return mp_NowNodeWrap->mo_CNodeList.ItD(mp_NowNodeLink);}
|
||||
const ZCNode& operator*()const{return mp_NowNodeWrap->mo_CNodeList.ItD(mp_NowNodeLink);}
|
||||
|
||||
public:
|
||||
};/*
|
||||
class ZCNodeInfo*/
|
||||
|
||||
|
||||
/*public :*/
|
||||
private:
|
||||
ZCNode mo_RootNode;
|
||||
public :
|
||||
ZCNode& GetRootNode() {return mo_RootNode;}
|
||||
const ZCNode& GetRootNode()const{return mo_RootNode;}
|
||||
|
||||
void DeleteAll(){mo_RootNode.clear();}
|
||||
void clear (){mo_RootNode.clear();}
|
||||
|
||||
/*/////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
■ 위 clear() 함수는 mo_RootNode.clear() 를 호출하고 있는데, 만약 mo_RootNode.mo_TypeData
|
||||
가 컨테이너 인 경우, mo_TypeData 를 추가로 초기화하는 코드가 필요할 수 있다. 이에 대해서
|
||||
는 CXmlInfo_T<>::clear() 을 참고한다.
|
||||
|
||||
-- 2012-10-12 13:20:00
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
|
||||
template<typename TViewClass> void IterPreOrder(TViewClass& AR_CViewClass)
|
||||
{
|
||||
mo_RootNode.template IterPreOrder<TViewClass>(AR_CViewClass, 0, 0);
|
||||
}/*
|
||||
template<typename TViewClass> void IterPreOrder(TViewClass& AR_CViewClass) */
|
||||
|
||||
template<typename TViewClass> void IterPostOrder(TViewClass& AR_CViewClass)
|
||||
{
|
||||
mo_RootNode.template IterPostOrder<TViewClass>(AR_CViewClass, 0, 0);
|
||||
}/*
|
||||
template<typename TViewClass> void IterPostOrder(TViewClass& AR_CViewClass) */
|
||||
|
||||
public:
|
||||
};/*
|
||||
template< typename TType ,
|
||||
typename TTypeTreeData=ZNsType::ZtCTypeTreeData<long>
|
||||
>
|
||||
class ZtCTreeData #############################################*/
|
||||
|
||||
|
||||
|
||||
/*///////////////////////////////////////////////////////////////
|
||||
|
||||
■ class ZtCTreeData 예제 -- 2015-08-14 14:00
|
||||
|
||||
#include <iostream>
|
||||
#include "ZCppMain/ZtCTreeData.H"
|
||||
|
||||
using namespace std ;
|
||||
using namespace ZNsMain;
|
||||
|
||||
typedef ZtCStringBase<char> CStringBase ;
|
||||
typedef ZtCTreeData<CStringBase> CStrTreeData ;
|
||||
typedef CStrTreeData::ZCNode CNodeCStr ;
|
||||
typedef ZNsMain::ZNsView::
|
||||
ZtCViewTreeData<CStringBase> CViewTreeData;
|
||||
|
||||
int main()
|
||||
{
|
||||
CStringBase VO_CStringBase ;
|
||||
CStrTreeData VO_CStrTreeData ;
|
||||
CViewTreeData VO_CViewTreeData;
|
||||
|
||||
CNodeCStr& VO_CNodeCStr1 = VO_CStrTreeData.GetRootNode().AddSubNode();
|
||||
CNodeCStr& VO_CNodeCStr2 = VO_CStrTreeData.GetRootNode().AddSubNode();
|
||||
CNodeCStr& VO_CNodeCStr3 = VO_CStrTreeData.GetRootNode().AddSubNode();
|
||||
|
||||
CNodeCStr& VO_CNodeCStr11 = VO_CNodeCStr1 .AddSubNode();
|
||||
CNodeCStr& VO_CNodeCStr12 = VO_CNodeCStr1 .AddSubNode();
|
||||
|
||||
CNodeCStr& VO_CNodeCStr121= VO_CNodeCStr12.AddSubNode();
|
||||
CNodeCStr& VO_CNodeCStr122= VO_CNodeCStr12.AddSubNode();
|
||||
|
||||
CNodeCStr& VO_CNodeCStr21 = VO_CNodeCStr2 .AddSubNode();
|
||||
CNodeCStr& VO_CNodeCStr22 = VO_CNodeCStr2 .AddSubNode();
|
||||
|
||||
VO_CStrTreeData.GetRootNode().GetData()="## Root Node ##";
|
||||
|
||||
VO_CNodeCStr1 . GetData()="Node1" ;
|
||||
VO_CNodeCStr2 . GetData()="Node2" ;
|
||||
VO_CNodeCStr3 . GetData()="Node3" ;
|
||||
|
||||
VO_CNodeCStr11. GetData()="Node11" ;
|
||||
VO_CNodeCStr12. GetData()="Node12" ;
|
||||
|
||||
VO_CNodeCStr21. GetData()="Node21" ;
|
||||
VO_CNodeCStr22. GetData()="Node22" ;
|
||||
|
||||
VO_CNodeCStr121.GetData()="Node121";
|
||||
VO_CNodeCStr122.GetData()="Node122";
|
||||
|
||||
cout<<"# Pre Order"<<endl;
|
||||
VO_CStrTreeData.IterPreOrder (VO_CViewTreeData);
|
||||
cout<<"# Post Order" <<endl;
|
||||
VO_CStrTreeData.IterPostOrder(VO_CViewTreeData);
|
||||
}
|
||||
|
||||
□ 출력
|
||||
|
||||
# Pre Order
|
||||
※ Index=0: ## Root Node ##
|
||||
▶ OnSubNodeStart:
|
||||
※ Index=1: Node1
|
||||
▶ OnSubNodeStart:
|
||||
※ Index=1: Node11
|
||||
※ Index=2: Node12
|
||||
▶ OnSubNodeStart:
|
||||
※ Index=1: Node121
|
||||
※ Index=2: Node122
|
||||
◀ OnSubNodeClose:
|
||||
◀ OnSubNodeClose:
|
||||
※ Index=2: Node2
|
||||
▶ OnSubNodeStart:
|
||||
※ Index=1: Node21
|
||||
※ Index=2: Node22
|
||||
◀ OnSubNodeClose:
|
||||
※ Index=3: Node3
|
||||
◀ OnSubNodeClose:
|
||||
# Post Order
|
||||
▶ OnSubNodeStart:
|
||||
▶ OnSubNodeStart:
|
||||
※ Index=1: Node11
|
||||
▶ OnSubNodeStart:
|
||||
※ Index=1: Node121
|
||||
※ Index=2: Node122
|
||||
◀ OnSubNodeClose:
|
||||
※ Index=2: Node12
|
||||
◀ OnSubNodeClose:
|
||||
※ Index=1: Node1
|
||||
▶ OnSubNodeStart:
|
||||
※ Index=1: Node21
|
||||
※ Index=2: Node22
|
||||
◀ OnSubNodeClose:
|
||||
※ Index=2: Node2
|
||||
※ Index=3: Node3
|
||||
◀ OnSubNodeClose:
|
||||
※ Index=0: ## Root Node ##
|
||||
|
||||
///////////////////////////////////////////////////////////////*/
|
||||
|
||||
|
||||
/*///////////////////////////////////////////////////////////////
|
||||
|
||||
■ class ZtCTreeData <>::ZCNode1 에는 mo_TypeData 이 있다면,
|
||||
class ZtCTreeDataEx<>::ZCNode1 에는 mo_CDataList 이 있다.
|
||||
|
||||
///////////////////////////////////////////////////////////////*/
|
||||
|
||||
|
||||
template< typename TType,
|
||||
typename TTypeTreeData=ZNsType::ZtCTypeTreeData<long>
|
||||
>
|
||||
class ZtCTreeDataEx /*#########################################*/
|
||||
{
|
||||
public:
|
||||
typedef TType TypeData ;
|
||||
typedef TTypeTreeData ZCTypeTreeData;
|
||||
public:
|
||||
class ZCNode1; class ZCNode2; class ZCNodeInfo ;
|
||||
public:
|
||||
typedef typename TTypeTreeData::TypeSize TypeSize;
|
||||
public:
|
||||
typedef typename TTypeTreeData::
|
||||
template ZtCTypeClass<TypeData>::TypeList ZCDataList ;
|
||||
typedef typename TTypeTreeData::
|
||||
template ZtCTypeClass<ZCNode1 >::TypeList ZCNode1List;
|
||||
typedef typename TTypeTreeData::
|
||||
template ZtCTypeClass<ZCNode2 >::TypeList ZCNode2List;
|
||||
public:
|
||||
typedef ZCNode1 ZCNode ;
|
||||
typedef ZCNode1List ZCNodeList;
|
||||
typedef typename ZCNodeList::ZCLink ZCNodeLink;
|
||||
typedef typename ZCDataList::ZCLink ZCDataLink;
|
||||
public:
|
||||
typedef typename ZCDataList::iterator IterOfData;
|
||||
typedef typename ZCNodeList::iterator IterOfNode;
|
||||
public:
|
||||
|
||||
class ZCNode1
|
||||
{
|
||||
public :
|
||||
friend class ZCNodeInfo;
|
||||
private:
|
||||
ZCNode* mp_HighNode ;
|
||||
ZCDataList mo_CDataList;
|
||||
ZCNode2List mo_CNodeList;
|
||||
public :
|
||||
|
||||
ZCNode1()
|
||||
{
|
||||
mp_HighNode=0;
|
||||
}/*
|
||||
ZCNode1()*/
|
||||
|
||||
ZCNode* GetHighNodePtr() {return (ZCNode*)mp_HighNode;}
|
||||
const ZCNode* GetHighNodePtr()const{return (ZCNode*)mp_HighNode;}
|
||||
|
||||
ZCDataList& GetZCDataList() {return mo_CDataList;}
|
||||
const ZCDataList& GetZCDataList()const{return mo_CDataList;}
|
||||
const ZCNodeList& GetCNodeList()const{return (ZCNodeList&)mo_CNodeList;}
|
||||
|
||||
TypeSize GetDataCnt(){return mo_CDataList.size();}
|
||||
TypeSize GetNodeCnt(){return mo_CNodeList.size();}
|
||||
|
||||
void DeleteCDataList(){mo_CDataList.DeleteAll();}
|
||||
void DeleteCNodeList(){mo_CNodeList.DeleteAll();}
|
||||
void DeleteAll (){mo_CDataList.DeleteAll(); mo_CNodeList.DeleteAll();}
|
||||
void clear (){DeleteAll();}
|
||||
|
||||
ZCNode& AddSubNode()
|
||||
{
|
||||
ZCNode* VP_CNode=(ZCNode*)&(*mo_CNodeList.AddTailDef());
|
||||
|
||||
VP_CNode->mp_HighNode=(ZCNode*)this; return *VP_CNode ;
|
||||
}/*
|
||||
ZCNode& AddSubNode()*/
|
||||
|
||||
ZCNodeInfo GetHeadNodeIter()
|
||||
{
|
||||
return ZCNodeInfo((ZCNode*)this, ((ZCNodeList&)mo_CNodeList).GetHeadLinkPtr());
|
||||
}/*
|
||||
ZCNodeInfo GetHeadNodeIter()*/
|
||||
|
||||
|
||||
/*//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
■ TViewClass 의 interface
|
||||
|
||||
ZNsMain::ZNsEnum::ZERun OnDataStart(int AI_Depth)
|
||||
ZNsMain::ZNsEnum::ZERun OnDataBody(TypeData, TypeSize AI_Depth, TypeSize AI_Index)
|
||||
ZNsMain::ZNsEnum::ZERun OnDataClose(int AI_Depth)
|
||||
|
||||
ZNsMain::ZNsEnum::ZERun OnSubNodeStart(int AI_Depth, int AI_NodeCnt)
|
||||
ZNsMain::ZNsEnum::ZERun OnSubNodeClose(int AI_Depth, int AI_NodeCnt)
|
||||
|
||||
-- 2011-10-31 21:53:00
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
template<typename TViewClass> ZNsMain::ZNsEnum::ZERun IterPreOrder
|
||||
(
|
||||
TViewClass& AR_CViewClass ,
|
||||
TypeSize AI_StartDepth=0,
|
||||
TypeSize AI_NodeIndex =0
|
||||
)
|
||||
/*##############################################################*/
|
||||
{
|
||||
TypeSize VL_DataCnt= mo_CDataList .size();
|
||||
TypeSize VL_NodeCnt=((ZCNodeList&)mo_CNodeList).size();
|
||||
|
||||
IterOfData VO_iter_Data( mo_CDataList.begin());
|
||||
IterOfNode VO_iter_Node(((ZCNodeList&)mo_CNodeList).begin());
|
||||
|
||||
if(AR_CViewClass.OnDataStart(AI_StartDepth)==ZNsMain::ZNsEnum::ZERun_NO)
|
||||
{ return ZNsMain::ZNsEnum::ZERun_NO; }
|
||||
/*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
|
||||
{
|
||||
__for1(TypeSize, i, VL_DataCnt)
|
||||
{
|
||||
const bool CB_DoStop =
|
||||
(
|
||||
AR_CViewClass.OnDataBody
|
||||
(
|
||||
mo_CDataList.ItD(VO_iter_Data), AI_StartDepth, AI_NodeIndex
|
||||
)
|
||||
== ZNsMain::ZNsEnum::ZERun_NO
|
||||
);
|
||||
//////////////////////
|
||||
|
||||
if(CB_DoStop) return ZNsMain::ZNsEnum::ZERun_NO;
|
||||
|
||||
mo_CDataList.MoveNextIter(VO_iter_Data); ///////
|
||||
}/*
|
||||
__for1(TypeSize, i, VL_DataCnt)*/
|
||||
}
|
||||
if(AR_CViewClass.OnDataClose(AI_StartDepth)==ZNsMain::ZNsEnum::ZERun_NO)
|
||||
{ return ZNsMain::ZNsEnum::ZERun_NO; }
|
||||
/*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
|
||||
|
||||
if(AR_CViewClass.OnSubNodeStart
|
||||
(AI_StartDepth, VL_NodeCnt)==ZNsMain::ZNsEnum::ZERun_NO)
|
||||
{ return ZNsMain::ZNsEnum::ZERun_NO; }
|
||||
|
||||
++AI_StartDepth; /*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
|
||||
{
|
||||
__for1(TypeSize, i, VL_NodeCnt)
|
||||
{
|
||||
const bool CB_DoStop = ///////////////////////////////
|
||||
(
|
||||
((ZCNodeList&)mo_CNodeList).ItD(VO_iter_Node).
|
||||
template IterPreOrder<TViewClass>
|
||||
(AR_CViewClass, AI_StartDepth. i)
|
||||
== ZNsMain::ZNsEnum::ZERun_NO
|
||||
);
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
if(CB_DoStop) return ZNsMain::ZNsEnum::ZERun_NO;
|
||||
|
||||
((ZCNodeList&)mo_CNodeList).MoveNextIter(VO_iter_Node);
|
||||
}/*
|
||||
__for1(TypeSize, i, VL_NodeCnt)*/
|
||||
}
|
||||
--AI_StartDepth; /*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
|
||||
|
||||
if(AR_CViewClass.OnSubNodeClose
|
||||
(AI_StartDepth, VL_NodeCnt)==ZNsMain::ZNsEnum::ZERun_NO)
|
||||
{ return ZNsMain::ZNsEnum::ZERun_NO; }
|
||||
|
||||
return ZNsMain::ZNsEnum::ZERun_OK; /////////////////////////
|
||||
}/*
|
||||
template<typename TViewClass> ZNsMain::ZNsEnum::ZERun IterPreOrder
|
||||
(
|
||||
TViewClass& AR_CViewClass, TypeSize AI_StartDepth=0
|
||||
TypeSize AI_NodeIndex =0
|
||||
) */
|
||||
/*###############################################################*/
|
||||
|
||||
template<typename TViewClass> ZNsMain::ZNsEnum::ZERun IterPostOrder
|
||||
(
|
||||
TViewClass& AR_CViewClass ,
|
||||
TypeSize AI_StartDepth=0,
|
||||
TypeSize AI_NodeIndex =0
|
||||
)
|
||||
/*###############################################################*/
|
||||
{
|
||||
TypeSize VL_DataCnt= mo_CDataList. size();
|
||||
TypeSize VL_NodeCnt=((ZCNodeList&)mo_CNodeList).size();
|
||||
|
||||
IterOfData VO_iter_Data( mo_CDataList. begin());
|
||||
IterOfNode VO_iter_Node(((ZCNodeList&)mo_CNodeList).begin());
|
||||
|
||||
if(AR_CViewClass.OnSubNodeStart
|
||||
(AI_StartDepth, VL_NodeCnt)==ZNsMain::ZNsEnum::ZERun_NO)
|
||||
{ return ZNsMain::ZNsEnum::ZERun_NO; }
|
||||
|
||||
++AI_StartDepth; /*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
|
||||
{
|
||||
__for1(TypeSize, i, VL_NodeCnt)
|
||||
{
|
||||
const bool CB_DoStop = ////////////////////////////////
|
||||
(
|
||||
((ZCNodeList&)mo_CNodeList).
|
||||
ItD(VO_iter_Node).template IterPostOrder<TViewClass>
|
||||
(AR_CViewClass, AI_StartDepth, i)
|
||||
== ZNsMain::ZNsEnum::ZERun_NO
|
||||
);
|
||||
///////////////////////////////////////////////////////
|
||||
|
||||
if(CB_DoStop) return ZNsMain::ZNsEnum::ZERun_NO;
|
||||
|
||||
((ZCNodeList&)mo_CNodeList).MoveNextIter(VO_iter_Node);
|
||||
}/*
|
||||
__for1(TypeSize, i, VL_NodeCnt)*/
|
||||
}
|
||||
--AI_StartDepth; /*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
|
||||
|
||||
if(AR_CViewClass.OnSubNodeClose
|
||||
(AI_StartDepth, VL_NodeCnt)==ZNsMain::ZNsEnum::ZERun_NO)
|
||||
{ return ZNsMain::ZNsEnum::ZERun_NO; }
|
||||
|
||||
if(AR_CViewClass.OnDataStart(AI_StartDepth)==ZNsMain::ZNsEnum::ZERun_NO)
|
||||
{ return ZNsMain::ZNsEnum::ZERun_NO; }
|
||||
/*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
|
||||
{
|
||||
__for1(TypeSize, i, VL_DataCnt)
|
||||
{
|
||||
const bool CB_DoStop = ////////////////////
|
||||
(
|
||||
AR_CViewClass.OnDataBody
|
||||
(
|
||||
mo_CDataList.ItD(VO_iter_Data), AI_StartDepth, AI_NodeIndex
|
||||
)
|
||||
== ZNsMain::ZNsEnum::ZERun_NO
|
||||
);
|
||||
///////////////////////////////////////////
|
||||
|
||||
if(CB_DoStop) return ZNsMain::ZNsEnum::ZERun_NO;
|
||||
|
||||
mo_CDataList.MoveNextIter(VO_iter_Data); ///////////////
|
||||
}/*
|
||||
__for1(TypeSize, i, VL_DataCnt)*/
|
||||
}
|
||||
if(AR_CViewClass.OnDataClose(AI_StartDepth)==ZNsMain::ZNsEnum::ZERun_NO)
|
||||
{ return ZNsMain::ZNsEnum::ZERun_NO; }
|
||||
/*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
|
||||
|
||||
return ZNsMain::ZNsEnum::ZERun_OK;
|
||||
}/*
|
||||
template<typename TViewClass> ZNsMain::ZNsEnum::ZERun IterPostOrder
|
||||
(
|
||||
TViewClass& AR_CViewClass ,
|
||||
TypeSize AI_StartDepth=0 ,
|
||||
TypeSize AI_NodeIndex =0
|
||||
)
|
||||
#################################################################*/
|
||||
|
||||
public:
|
||||
};/*
|
||||
class ZCNode1*/
|
||||
|
||||
class ZCNode2
|
||||
{
|
||||
public :
|
||||
friend class ZCNodeInfo;
|
||||
private:
|
||||
ZCNode* mp_HighNode ;
|
||||
ZCDataList mo_CDataList;
|
||||
ZCNode1List mo_CNodeList;
|
||||
public :
|
||||
|
||||
ZCNode2()
|
||||
{
|
||||
mp_HighNode=0;
|
||||
}/*
|
||||
ZCNode2()*/
|
||||
|
||||
ZCNode* GetHighNodePtr() {return (ZCNode*)mp_HighNode;}
|
||||
const ZCNode* GetHighNodePtr()const{return (ZCNode*)mp_HighNode;}
|
||||
|
||||
ZCDataList& GetZCDataList() {return mo_CDataList;}
|
||||
const ZCDataList& GetZCDataList()const{return mo_CDataList;}
|
||||
const ZCNodeList& GetCNodeList ()const{return (ZCNodeList&)mo_CNodeList;}
|
||||
|
||||
TypeSize GetDataCnt(){return mo_CDataList.size();}
|
||||
TypeSize GetNodeCnt(){return mo_CNodeList.size();}
|
||||
|
||||
void DeleteCDataList(){mo_CDataList.DeleteAll();}
|
||||
void DeleteCNodeList(){mo_CNodeList.DeleteAll();}
|
||||
void DeleteAll (){mo_CDataList.DeleteAll(); mo_CNodeList.DeleteAll();}
|
||||
void clear (){DeleteAll();}
|
||||
|
||||
ZCNode& AddSubNode()
|
||||
{
|
||||
ZCNode* VP_CNode=(ZCNode*)&
|
||||
( *mo_CNodeList.AddTailDef() );
|
||||
|
||||
VP_CNode->mp_HighNode=(ZCNode*)this; return *VP_CNode;
|
||||
}/*
|
||||
ZCNode& AddSubNode()*/
|
||||
|
||||
ZCNodeInfo GetHeadNodeIter()
|
||||
{
|
||||
return ZCNodeInfo((ZCNode*)this, ((ZCNodeList&)mo_CNodeList).GetHeadLinkPtr());
|
||||
}/*
|
||||
ZCNodeInfo GetHeadNodeIter()*/
|
||||
|
||||
/*//////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
■ ZCNode1 과 ZCNode2 가 동일한 구조이므로, ZCNode2 에서는 IterPreOrder() 와 IterPostOrder() 를
|
||||
정의할 필요없다. ZCNode2 이 ZCNode1 로 형변환되어서 ZCNode1 의 IterPreOrder() 와 IterPostOrder()
|
||||
을 사용할 것이기 때문이다.
|
||||
|
||||
-- 2011-11-01 10:40:00
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
public:
|
||||
};/*
|
||||
class ZCNode2*/
|
||||
|
||||
class ZCNodeInfo
|
||||
{
|
||||
private:
|
||||
ZCNode* mp_NowNodeWrap;
|
||||
ZCNodeLink* mp_NowNodeLink;
|
||||
public :
|
||||
|
||||
ZCNodeInfo(ZCNode* AP_CNode=0,ZCNodeLink* AP_CNodeLink=0)
|
||||
{
|
||||
mp_NowNodeWrap=AP_CNode; mp_NowNodeLink=AP_CNodeLink;
|
||||
}/*
|
||||
ZCNodeInfo(ZCNode* AP_CNode=0,ZCNodeLink* AP_CNodeLink=0)*/
|
||||
|
||||
ZCNode* GetNowNodeWrap(){return mp_NowNodeWrap;}
|
||||
ZCNodeLink* GetNowNodeLink(){return mp_NowNodeLink;}
|
||||
|
||||
bool DeleteNode()
|
||||
{
|
||||
if(mp_NowNodeWrap==0 || mp_NowNodeLink==0) return false;
|
||||
|
||||
((ZCNodeList&)(mp_NowNodeWrap->mo_CNodeList)).
|
||||
DeleteLink(mp_NowNodeLink);
|
||||
mp_NowNodeLink=0; return true; //////////////
|
||||
}/*
|
||||
bool DeleteNode()*/
|
||||
|
||||
ZCNodeInfo& operator++(int)
|
||||
{
|
||||
mp_NowNodeWrap->mo_CNodeList.MoveNextIter(mp_NowNodeLink); return *this;
|
||||
}/*
|
||||
ZCNodeInfo& operator++(int)*/
|
||||
|
||||
ZCNode& operator*() {return mp_NowNodeWrap->mo_CNodeList.ItD(mp_NowNodeLink);}
|
||||
const ZCNode& operator*()const{return mp_NowNodeWrap->mo_CNodeList.ItD(mp_NowNodeLink);}
|
||||
|
||||
public:
|
||||
};/*
|
||||
class ZCNodeInfo
|
||||
|
||||
|
||||
public :*/
|
||||
private:
|
||||
ZCNode mo_RootNode;
|
||||
public:
|
||||
ZCNode& GetRootNode() {return mo_RootNode;}
|
||||
const ZCNode& GetRootNode()const{return mo_RootNode;}
|
||||
|
||||
void DeleteAll(){mo_RootNode.clear();}
|
||||
void clear (){mo_RootNode.clear();}
|
||||
|
||||
template<typename TViewClass> void IterPreOrder (TViewClass AO_CViewClass)
|
||||
{ mo_RootNode.template IterPreOrder<TViewClass>(AO_CViewClass, 0); }
|
||||
template<typename TViewClass> void IterPostOrder(TViewClass AO_CViewClass)
|
||||
{ mo_RootNode.template IterPostOrder<TViewClass>(AO_CViewClass, 0); }
|
||||
|
||||
public:
|
||||
};/*
|
||||
template< typename TType,
|
||||
typename TTypeTreeData=ZNsType::ZtCTypeTreeData<long>
|
||||
>
|
||||
ZtCTreeDataEx #################################################*/
|
||||
|
||||
}/*
|
||||
namespace ZNsMain*/
|
||||
|
||||
|
||||
/*//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
■ 이 파일은 CTreeClass.H 파일을 대체할 것이다. CTreeClass.H 에서는 트리 구조를 표현하는데,
|
||||
아래 형식의
|
||||
|
||||
class CMyNode;
|
||||
{
|
||||
public:
|
||||
TypeData mo_TypeData;
|
||||
ZNsMain::ZtCObjList<CMyNode> mo_NodeList; // 하위 노드 리스트.
|
||||
};
|
||||
|
||||
재귀 용법을 구현할 수가 없어서, void* 를 사용하였다. 그러나 이 파일에서는, 똑같은 구조의
|
||||
두 클래스 ZCNode1, ZCNode2 를 사용함으로써, 멋지게(!!) 재귀를 구현하고 있다.
|
||||
|
||||
클래스 ZCNode1 에서는 ZCNode2 의 컨테이너(리스트)를 가지고 있고,
|
||||
클래스 ZCNode2 에서는 ZCNode1 의 컨테이너(리스트)를 가지고 있다.
|
||||
|
||||
아주 깜찍하고, 기발한 방법이라고 아니할 수 없다.
|
||||
|
||||
2011-10-29 일 토요일, 저녁 7 시 군포시예술문화회관 공연을 보고 오면서, 먼저 선언된 object
|
||||
에서, 나중에 선언된 object 의 instance 를 참조하는 경우, 매끄럽게 해결할 수 있을 지도 모
|
||||
르는 방법이 머릿 속에 그려지면서, 운명은 내편이라는 강한 확신이 들었었다. 그러나 집에 도
|
||||
착 후, 조사 결과, 기대했던 매끄러운 방법은 아니었음이 드러났다. 실망할 수도 있었던 그 순
|
||||
간, 트리를 구현할 때, 똑깥은 구조의, 이름만 다른 2 개의 클래스로 트리의 재귀 구조를 구현
|
||||
할 수 있다는 생각이 번개처럼 떠 오른 것이다. 그 결과물이 이 파일 CTreeData.H 이다.
|
||||
|
||||
그래, 운명은 내편이었어.
|
||||
|
||||
어느덧 해는 저무는데, 이제는 모든 것을 뒤에 두고 떠날 수 있는 날이, 바로 앞에 성큼 다가왔
|
||||
다.
|
||||
|
||||
-- 2011-10-31 23:47:00
|
||||
|
||||
-- 현재 CTreeClass.H 는 제거되었다. -- 2013-05-01 17:22:00
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
|
||||
#endif // __ZCPPMAIN__ZCTREEDATA_H__
|
242
ZCppMain/test.cpp
Normal file
242
ZCppMain/test.cpp
Normal file
@ -0,0 +1,242 @@
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#include "ZCppMain/ZtCArray.H"
|
||||
#include "ZCppMain/ZtCObjList.H"
|
||||
|
||||
|
||||
using namespace std ;
|
||||
using namespace ZNsMain ;
|
||||
|
||||
|
||||
namespace ZNsMain{namespace ZNsHide
|
||||
{
|
||||
|
||||
class ZCFunctor1
|
||||
{
|
||||
private:
|
||||
ZTypInt mi_Index;
|
||||
public :
|
||||
|
||||
ZCFunctor1(){mi_Index=0;}
|
||||
|
||||
void operator()(int ArgiValue)
|
||||
{ cout<<"# index="<<++mi_Index<<", Value="<<ArgiValue<<endl; }
|
||||
public :
|
||||
};/*
|
||||
class ZCFunctor1*/
|
||||
|
||||
}/*
|
||||
namespace ZNsHide*/}/*namespace ZNsMain*/
|
||||
|
||||
|
||||
template<typename T> class ZtCMy
|
||||
{ public: enum{EMyNum=10}; typedef T TypeData; };
|
||||
|
||||
template<typename T> class ZtCMy< ZNsMain::ZtCObjList<T> >
|
||||
{ public: enum{EMyNum=20}; typedef T TypeData; };
|
||||
|
||||
|
||||
int main(int ArgiCnt, char** AppArgu)
|
||||
{
|
||||
cout<<endl<<"!!! C++'s Great Start -- 2021-03-08 11:10:00 !!!"<<endl<<endl;
|
||||
|
||||
|
||||
typedef ZNsMain::ZtCObjList<int> CListByInt;
|
||||
typedef ZNsMain::ZtCArray <int> CArrayInt ;
|
||||
|
||||
typedef ZtCMy<int> CMy1;
|
||||
typedef ZtCMy<CListByInt> CMy2;
|
||||
typedef ZtCMy<CArrayInt > CMy3;
|
||||
|
||||
cout<<"# CMy1::EMyNum="<<CMy1::EMyNum<<endl;
|
||||
cout<<"# CMy2::EMyNum="<<CMy2::EMyNum<<endl;
|
||||
cout<<"# CMy3::EMyNum="<<CMy3::EMyNum<<endl;
|
||||
|
||||
cout<<"# CMy1::TypeData="<<typeid(CMy1::TypeData).name()<<endl;
|
||||
cout<<"# CMy2::TypeData="<<typeid(CMy2::TypeData).name()<<endl;
|
||||
cout<<"# CMy3::TypeData="<<typeid(CMy3::TypeData).name()<<endl;
|
||||
/*
|
||||
# CMy1::EMyNum=10
|
||||
# CMy2::EMyNum=20
|
||||
# CMy3::EMyNum=10
|
||||
# CMy1::TypeData=int
|
||||
# CMy2::TypeData=int
|
||||
# CMy3::TypeData=class ZNsMain::ZtCArray<int,int const &,long>
|
||||
*/
|
||||
|
||||
cout<<"# int ="<<typeid(int).name()<<endl;
|
||||
cout<<"# int*="<<typeid(int*).name()<<endl;
|
||||
cout<<"# int&="<<typeid(int&).name()<<endl;
|
||||
|
||||
int i1= 10;
|
||||
int* i2=&i1;
|
||||
int& i3= i1;
|
||||
|
||||
cout<<"# int ="<<typeid(i1).name()<<endl;
|
||||
cout<<"# int*="<<typeid(i2).name()<<endl;
|
||||
cout<<"# int&="<<typeid(i3).name()<<endl;
|
||||
|
||||
typedef int HereInt1;
|
||||
typedef int* HereInt2;
|
||||
typedef int& HereInt3;
|
||||
|
||||
HereInt1 myi1= 100 ;
|
||||
HereInt2 myi2= &myi1;
|
||||
HereInt3 myi3= myi1 ; myi3=123;
|
||||
|
||||
ZtCRef<int> myref(myi1);
|
||||
ZtCCheckRef< int > myrefcheck1(myi1); myrefcheck1.GetData();
|
||||
ZtCCheckRef< ZtCRef<int> > myrefcheck2(myi1); myrefcheck2.GetData();
|
||||
|
||||
myi1=4321;
|
||||
|
||||
cout<<"# myrefcheck1.GetData()="<<myrefcheck1.GetData()<<endl;
|
||||
cout<<"# myrefcheck2.GetData()="<<myrefcheck2.GetData()<<endl;
|
||||
|
||||
cout<<"# HereInt1 ="<< typeid(myi1).name()<<endl;
|
||||
cout<<"# HereInt2 int* ="<< typeid(myi2).name()<<endl;
|
||||
cout<<"# HereInt3 int& ="<< typeid(myi3).name()<<endl;
|
||||
|
||||
#ifdef __WIN
|
||||
cout<<"# HereInt1 hash="<< typeid(myi1).hash_code()<<endl;
|
||||
cout<<"# HereInt2 hash="<< typeid(myi2).hash_code()<<endl;
|
||||
cout<<"# HereInt3 hash="<< typeid(myi3).hash_code()<<endl;
|
||||
|
||||
cout<<"# HereInt1 raw ="<< typeid(myi1).raw_name()<<endl;
|
||||
cout<<"# HereInt2 raw ="<< typeid(myi2).raw_name()<<endl;
|
||||
cout<<"# HereInt3 raw ="<< typeid(myi3).raw_name()<<endl;
|
||||
#endif
|
||||
|
||||
cout<<"# HereInt1 ="<< myi1<<endl;
|
||||
cout<<"# HereInt2 int* ="<<*myi2<<endl;
|
||||
cout<<"# HereInt3 int& ="<< myi3<<endl;
|
||||
/*
|
||||
# HereInt1 =int
|
||||
# HereInt2 int* =int *
|
||||
# HereInt3 int& =int
|
||||
|
||||
# HereInt1 hash=3440116983
|
||||
# HereInt2 hash=2450196518
|
||||
# HereInt3 hash=3440116983
|
||||
|
||||
# HereInt1 raw =.H
|
||||
# HereInt2 raw =.PAH
|
||||
# HereInt3 raw =.H
|
||||
|
||||
# HereInt1 =123
|
||||
# HereInt2 int* =123
|
||||
# HereInt3 int& =123
|
||||
*/
|
||||
|
||||
CListByInt VO_IntList;
|
||||
CArrayInt VO_IntArr ;
|
||||
|
||||
VO_IntList.AddTail(10);
|
||||
VO_IntList.AddTail(40);
|
||||
VO_IntList.AddTail(20);
|
||||
VO_IntList.AddTail(80);
|
||||
VO_IntList.AddTail(90);
|
||||
|
||||
VO_IntArr.AddTail(123);
|
||||
VO_IntArr.AddTail(153);
|
||||
VO_IntArr.AddTail(543);
|
||||
VO_IntArr.AddTail(553);
|
||||
VO_IntArr.AddTail(983);
|
||||
|
||||
|
||||
|
||||
typedef ZNsMain::ZtStTuple<int, ZNsMain::ZtCRef<int> > ZStTuple2;
|
||||
|
||||
int i=1;
|
||||
int& j=i;
|
||||
|
||||
ZStTuple2 VO_ZStTuple2 = ZNsMain::ZftMakeArguTuple<int, ZNsMain::ZtCRef<int> >
|
||||
(i, ZNsMain::ZtCRef<int>(j).GetData() );
|
||||
|
||||
VO_ZStTuple2._2 = 3;
|
||||
|
||||
|
||||
|
||||
typedef ZtStTuple<int, int> ZCTuple;
|
||||
|
||||
ZCTuple VO_CTuple; VO_CTuple._1 = 1;
|
||||
|
||||
|
||||
_FFS_(ZCShowData1)
|
||||
(ZTypInt AiInt)
|
||||
{
|
||||
cout<<"# Elem1 : "<< AiInt << endl;
|
||||
}/*
|
||||
(ZTypInt AiInt)*/
|
||||
_FFC_(ZCShowData1)
|
||||
|
||||
_FFS_(ZCShowData2)
|
||||
(ZTypInt AiInt, ZCTuple& AR_CTuple)
|
||||
{
|
||||
cout<<"# Elem2 : "<< AiInt << ", nth=" << AR_CTuple._1++ << endl;
|
||||
}/*
|
||||
(ZTypInt AiInt, ZCTuple& AR_CTuple)*/
|
||||
_FFC_(ZCShowData2)
|
||||
|
||||
_FFS_(ZCShowData3)
|
||||
(ZTypInt AiInt, ZCTuple* AP_CTuple)
|
||||
{
|
||||
cout<<"# Elem3 : "<< AiInt << ", nth=" << AP_CTuple->_1++ << endl;
|
||||
}/*
|
||||
(ZTypInt AiInt, ZCTuple* AR_CTuple)*/
|
||||
_FFC_(ZCShowData3)
|
||||
|
||||
_FFS_(ZCShowData4)
|
||||
(ZTypInt AiInt, ZCTuple* AP_CTuple)
|
||||
{
|
||||
cout<<"# Elem4 : "<< AiInt << ", nth=" << AP_CTuple->_1++ << endl;
|
||||
}/*
|
||||
(ZTypInt AiInt, ZCTuple* AP_CTuple)*/
|
||||
_FFC_(ZCShowData4)
|
||||
|
||||
_FFS_(ZCShowData5)
|
||||
(ZTypInt AiInt, int& AiIndex)
|
||||
{
|
||||
cout<<"# Elem5 : "<< AiInt << ", nth=" << AiIndex++ << endl;
|
||||
}/*
|
||||
(ZTypInt AiInt, int& AiIndex)*/
|
||||
_FFC_(ZCShowData5)
|
||||
|
||||
_FFS_(ZCShowData6)
|
||||
(ZTypInt AiInt, int& AiIndex)
|
||||
{
|
||||
cout<<"# Elem6 : "<< AiInt << ", nth=" << AiIndex++ << endl;
|
||||
}/*
|
||||
(ZTypInt AiInt, int& AiIndex)*/
|
||||
_FFC_(ZCShowData6)
|
||||
|
||||
|
||||
ZNsHide::ZCFunctor1 VO_CFunctor1;
|
||||
/* ZCFunctor1 선언이 main() 바깥에 있어야 하는 문제를 해결할 수 없을까. */
|
||||
|
||||
VO_IntList.IterElement(ZCShowData1::Exec);
|
||||
VO_IntList.IterElemRef(ZCShowData2::Exec, VO_CTuple ); VO_CTuple._1=1 ;
|
||||
VO_IntList.IterElement(ZCShowData3::Exec, &VO_CTuple);
|
||||
VO_IntList.IterElement(&VO_CFunctor1 );
|
||||
VO_IntArr .IterElement(&VO_CFunctor1 ); VO_CTuple._1=1 ;
|
||||
VO_IntArr .IterElement(ZCShowData4::Exec, &VO_CTuple); VO_CTuple._1=1 ;
|
||||
VO_IntArr .IterElement(ZCShowData5::Exec, ZNsMain::ZtCRef<int>(VO_CTuple._1));
|
||||
VO_IntList.IterElement(ZCShowData5::Exec, ZNsMain::ZtCRef<int>(VO_CTuple._1));
|
||||
|
||||
cout<< "# Press Any Key to exit" << endl; cin.get();
|
||||
|
||||
return 0;
|
||||
}/*
|
||||
int main(int ArgiCnt, char** AppArgu)*/
|
||||
|
||||
|
||||
/*/////////////////////////////////////
|
||||
|
||||
|
||||
■ 컴파일
|
||||
|
||||
g++ -o test.exe test.cpp -I..
|
||||
|
||||
|
||||
/////////////////////////////////////*/
|
135
ZCppMainTest/ZMainCGI_000_EnvSet.cpp
Normal file
135
ZCppMainTest/ZMainCGI_000_EnvSet.cpp
Normal file
@ -0,0 +1,135 @@
|
||||
|
||||
|
||||
#include "ZCppMain/ZMainCGI.H"
|
||||
|
||||
|
||||
using namespace std ;
|
||||
using namespace ZNsMain;
|
||||
|
||||
|
||||
namespace ZNsMain
|
||||
{
|
||||
|
||||
namespace ZNsExam
|
||||
{
|
||||
|
||||
template<typename TDummy=void*> class ZtCExam_CLoadSimUrlConfig
|
||||
{
|
||||
public:
|
||||
typedef ZtCStringBase<char> ZCStringBase ;
|
||||
typedef ZNsCGI::ZtCLoadSimUrlConfig
|
||||
<ZCStringBase> ZCLoadSimUrlConfig;
|
||||
public:
|
||||
|
||||
static int Main(int AR_ArgCnt, char* APP_ArgVal[])
|
||||
{
|
||||
ZCLoadSimUrlConfig VO_CLoadSimUrlConfig ;
|
||||
ZCStringBase VO_CStringBase
|
||||
("Example : name1 =value1 &name2 = value2 ");
|
||||
|
||||
if(AR_ArgCnt>=2)
|
||||
{ VO_CStringBase = APP_ArgVal[1]; }
|
||||
|
||||
VO_CLoadSimUrlConfig.LoadData(VO_CStringBase);
|
||||
VO_CLoadSimUrlConfig.IterEnvSet();
|
||||
|
||||
return 0; /*::::::::::::::::::::*/
|
||||
}/*
|
||||
static int Main(int AR_ArgCnt, char* APP_ArgVal[])*/
|
||||
|
||||
public:
|
||||
};/*
|
||||
template<typename TDummy=void*> class ZtCExam_CLoadSimUrlConfig*/
|
||||
|
||||
}/*
|
||||
namespace ZNsExam*/
|
||||
|
||||
}/*
|
||||
namespace ZNsMain*/
|
||||
|
||||
|
||||
int main(int AI_ArgCnt, char* APP_ArgVal[])
|
||||
{
|
||||
return ZNsMain::ZNsExam::
|
||||
|
||||
ZtCExam_CLoadSimUrlConfig<>::Main(AI_ArgCnt, APP_ArgVal);
|
||||
}/*
|
||||
int main(int AI_ArgCnt, char* APP_ArgVal[])*/
|
||||
|
||||
|
||||
/*////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
■ cygwin 컴파일
|
||||
|
||||
// g++ -mno-cygwin -o ZMainCGI_000_EnvSet.exe ZMainCGI_000_EnvSet.cpp -I../../my_CPP/CPP_Main/ -I../../my_CPP/CPP_Std/ -D__CYGWIN32__ -D__VISUAL_CPP_VER__=200300
|
||||
// g++ -mno-cygwin -o ZMainCGI_000_EnvSet_D.exe ZMainCGI_000_EnvSet.cpp -I../../my_CPP/CPP_Main/ -I../../my_CPP/CPP_Std/ -D__CYGWIN32__ -D__VISUAL_CPP_VER__=200300 -D_DEBUG
|
||||
|
||||
■ mingw 컴파일
|
||||
|
||||
g++.exe -o ZMainCGI_000_EnvSet_mw.exe ZMainCGI_000_EnvSet.cpp -I../ -lWs2_32
|
||||
g++.exe -o ZMainCGI_000_EnvSet_mw_D.exe ZMainCGI_000_EnvSet.cpp -I../ -lWs2_32 -D_DEBUG
|
||||
|
||||
./ZMainCGI_000_EnvSet_mw.exe
|
||||
./ZMainCGI_000_EnvSet_mw_D.exe
|
||||
|
||||
./ZMainCGI_000_EnvSet_mw.exe "name1=value1 & mid & name2= value2"
|
||||
|
||||
|
||||
Administrator@q381-2673 UCRT64 /e/my_CPP/ZCpp/ZCppMainTest
|
||||
# date
|
||||
Sun Aug 24 10:47:09 KST 2025
|
||||
|
||||
Administrator@q381-2673 UCRT64 /e/my_CPP/ZCpp/ZCppMainTest
|
||||
# g++ --version
|
||||
g++.exe (Rev2, Built by MSYS2 project) 13.2.0
|
||||
Copyright (C) 2023 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
■ Linux 컴파일
|
||||
|
||||
g++ -std=c++98 -o ZMainCGI_000_EnvSet.exe ZMainCGI_000_EnvSet.cpp -I../
|
||||
g++ -std=c++98 -o ZMainCGI_000_EnvSet_D.exe ZMainCGI_000_EnvSet.cpp -I../ -D_DEBUG
|
||||
|
||||
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ gcc --version
|
||||
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ date
|
||||
Sun Aug 24 00:05:51 DST 2025
|
||||
|
||||
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ cat /etc/os-release
|
||||
NAME="Ubuntu"
|
||||
VERSION="20.04.6 LTS (Focal Fossa)"
|
||||
ID=ubuntu
|
||||
ID_LIKE=debian
|
||||
PRETTY_NAME="Ubuntu 20.04.6 LTS"
|
||||
VERSION_ID="20.04"
|
||||
HOME_URL="https://www.ubuntu.com/"
|
||||
SUPPORT_URL="https://help.ubuntu.com/"
|
||||
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
|
||||
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
|
||||
VERSION_CODENAME=focal
|
||||
UBUNTU_CODENAME=focal
|
||||
|
||||
|
||||
[sauron@q381-2657 ZCppMainTest]$ cat /etc/centos-release
|
||||
CentOS Linux release 7.9.2009 (Core)
|
||||
|
||||
[sauron@q381-2657 ZCppMainTest]$ g++ --version
|
||||
g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
|
||||
Copyright (C) 2015 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
■ 실행
|
||||
|
||||
./ZMainCGI_000_EnvSet.exe
|
||||
./ZMainCGI_000_EnvSet_D.exe
|
||||
|
||||
./ZMainCGI_000_EnvSet.exe "name1=value1 & mid & name2= value2"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////*/
|
219
ZCppMainTest/ZftMakeTuple_000.cpp
Normal file
219
ZCppMainTest/ZftMakeTuple_000.cpp
Normal file
@ -0,0 +1,219 @@
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#include "ZCppMain/ZCStringStd.H"
|
||||
|
||||
|
||||
using namespace std ;
|
||||
using namespace ZNsMain;
|
||||
|
||||
|
||||
namespace ZNsMain
|
||||
{
|
||||
|
||||
namespace ZNsExam
|
||||
{
|
||||
|
||||
template<typename TDummy=void*> class ZtCExamTuple_000
|
||||
{
|
||||
public:
|
||||
|
||||
static int Main(int AI_ArgCnt=0, char* APP_ArgVal[]=0)
|
||||
{
|
||||
ZCStringStd VO_BuffCStr("myBuff") ;
|
||||
ZTypInt VI_NowCnt = 0 ;
|
||||
|
||||
cout<<"# __cplusplus : "<<__cplusplus<<endl;
|
||||
|
||||
#if defined(__CPLUSPLUS_VER__) && __CPLUSPLUS_VER__<=199800
|
||||
|
||||
cout<<"# Use C++ 98 Spec"<<endl;
|
||||
|
||||
ZtStTuple<>
|
||||
myt0 = ZftMakeTuple();
|
||||
ZtStTuple<int>
|
||||
myt1 = ZftMakeTuple(1);
|
||||
ZtStTuple<int, int>
|
||||
myt2 = ZftMakeTuple(1, 34);
|
||||
ZtStTuple<int, int, char>
|
||||
myt3 = ZftMakeTuple(1, 34, 'C');
|
||||
ZtStTuple<int, int, char, ZCStringStd&>
|
||||
myt4 = ZftMakeTuple(1, 34, 'C', ZftMCP(VO_BuffCStr));
|
||||
ZtStTuple<int, int, char, ZCStringStd&, bool>
|
||||
myt5 = ZftMakeTuple(1, 34, 'C', ZftMCP(VO_BuffCStr), true);
|
||||
ZtStTuple<int, int, char, ZCStringStd&, bool, const char*>
|
||||
myt6 = ZftMakeTuple(1, 34, 'C', ZftMCP(VO_BuffCStr), true, "AB");
|
||||
ZtStTuple<int, int, char, ZCStringStd&, bool, const char*, double>
|
||||
myt7 = ZftMakeTuple(1, 34, 'C', ZftMCP(VO_BuffCStr), true, "AB", double(0.34));
|
||||
ZtStTuple<int, int, char, ZCStringStd&, bool, const char*, double, float>
|
||||
myt8 = ZftMakeTuple(1, 34, 'C', ZftMCP(VO_BuffCStr), true, "AB", double(0.34), float(24.43));
|
||||
ZtStTuple<int, int, char, ZCStringStd&, bool, const char*, double, float, ZCStringStd&>
|
||||
myt9 = ZftMakeTuple(1, 34, 'C', ZftMCP(VO_BuffCStr), true, "AB", double(0.34), float(24.43), ZftMCP(VO_BuffCStr));
|
||||
ZtStTuple<int, int, char, ZCStringStd&, bool, const char*, double, float, ZCStringStd&, int&>
|
||||
myt10= ZftMakeTuple(1, 34, 'C', ZftMCP(VO_BuffCStr), true, "AB", double(0.34), float(24.43), ZftMCP(VO_BuffCStr), ZftMCP(VI_NowCnt));
|
||||
ZtStTuple<int, int, char, ZCStringStd&, bool, const char*, double, float, ZCStringStd&, int&, long>
|
||||
myt11= ZftMakeTuple(1, 34, 'C', ZftMCP(VO_BuffCStr), true, "AB", double(0.34), float(24.43), ZftMCP(VO_BuffCStr), ZftMCP(VI_NowCnt), (long)20250906);
|
||||
ZtStTuple<int, int, char, ZCStringStd&, bool, const char*, double, float, ZCStringStd&, int&, long, wchar_t>
|
||||
myt12= ZftMakeTuple(1, 34, 'C', ZftMCP(VO_BuffCStr), true, "AB", double(0.34), float(24.43), ZftMCP(VO_BuffCStr), ZftMCP(VI_NowCnt), (long)20250906, wchar_t(0));
|
||||
#else
|
||||
cout<<"# Use auto keyword for ZtStTuple<> variable"<<endl;
|
||||
|
||||
auto myt0 = ZftMakeTuple();
|
||||
auto myt1 = ZftMakeTuple(1);
|
||||
auto myt2 = ZftMakeTuple(1, 34);
|
||||
auto myt3 = ZftMakeTuple(1, 34, 'C');
|
||||
auto myt4 = ZftMakeTuple(1, 34, 'C', ZftMCP(VO_BuffCStr));
|
||||
auto myt5 = ZftMakeTuple(1, 34, 'C', ZftMCP(VO_BuffCStr), true);
|
||||
auto myt6 = ZftMakeTuple(1, 34, 'C', ZftMCP(VO_BuffCStr), true, "AB");
|
||||
auto myt7 = ZftMakeTuple(1, 34, 'C', ZftMCP(VO_BuffCStr), true, "AB", double(0.34));
|
||||
auto myt8 = ZftMakeTuple(1, 34, 'C', ZftMCP(VO_BuffCStr), true, "AB", double(0.34), float(24.43));
|
||||
auto myt9 = ZftMakeTuple(1, 34, 'C', ZftMCP(VO_BuffCStr), true, "AB", double(0.34), float(24.43), ZftMCP(VO_BuffCStr));
|
||||
auto myt10= ZftMakeTuple(1, 34, 'C', ZftMCP(VO_BuffCStr), true, "AB", double(0.34), float(24.43), ZftMCP(VO_BuffCStr), ZftMCP(VI_NowCnt));
|
||||
auto myt11= ZftMakeTuple(1, 34, 'C', ZftMCP(VO_BuffCStr), true, "AB", double(0.34), float(24.43), ZftMCP(VO_BuffCStr), ZftMCP(VI_NowCnt), (long)20250906);
|
||||
auto myt12= ZftMakeTuple(1, 34, 'C', ZftMCP(VO_BuffCStr), true, "AB", double(0.34), float(24.43), ZftMCP(VO_BuffCStr), ZftMCP(VI_NowCnt), (long)20250906, wchar_t(0));
|
||||
#endif
|
||||
|
||||
myt10._10 = 1200;
|
||||
myt11._10 += 1200;
|
||||
|
||||
// 아래 2개 출력이 같아야 한다.
|
||||
cout<<myt10._10<<endl;
|
||||
cout<<VI_NowCnt<<endl;
|
||||
|
||||
cout<<"_1 type : "<<typeid(myt12._1 ).name()<<endl;
|
||||
cout<<" value: "<< myt12._1 <<endl;
|
||||
cout<<"_2 type : "<<typeid(myt12._2 ).name()<<endl;
|
||||
cout<<" value: "<< myt12._2 <<endl;
|
||||
cout<<"_3 type : "<<typeid(myt12._3 ).name()<<endl;
|
||||
cout<<" value: "<< myt12._3 <<endl;
|
||||
cout<<"_4 type : "<<typeid(myt12._4 ).name()<<endl;
|
||||
cout<<" value: "<< myt12._4 <<endl;
|
||||
cout<<"_5 type : "<<typeid(myt12._5 ).name()<<endl;
|
||||
cout<<" value: "<< myt12._5 <<endl;
|
||||
cout<<"_6 type : "<<typeid(myt12._6 ).name()<<endl;
|
||||
cout<<" value: "<< myt12._6 <<endl;
|
||||
cout<<"_7 type : "<<typeid(myt12._7 ).name()<<endl;
|
||||
cout<<" value: "<< myt12._7 <<endl;
|
||||
cout<<"_8 type : "<<typeid(myt12._8 ).name()<<endl;
|
||||
cout<<" value: "<< myt12._8 <<endl;
|
||||
cout<<"_9 type : "<<typeid(myt12._9 ).name()<<endl;
|
||||
cout<<" value: "<< myt12._9 <<endl;
|
||||
cout<<"_10 type : "<<typeid(myt12._10).name()<<endl;
|
||||
cout<<" value: "<< myt12._10 <<endl;
|
||||
cout<<"_11 type : "<<typeid(myt12._11).name()<<endl;
|
||||
cout<<" value: "<< myt12._11 <<endl;
|
||||
cout<<"_12 type : "<<typeid(myt12._12).name()<<endl;
|
||||
cout<<" value: "<< myt12._12 <<endl;
|
||||
|
||||
return 0;
|
||||
}/*
|
||||
static int Main(int AI_ArgCnt=0, char* APP_ArgVal[]=0)*/
|
||||
|
||||
|
||||
public:
|
||||
};/*
|
||||
template<typename TDummy=void*> class ZtCExamTuple_000*/
|
||||
|
||||
}/*
|
||||
namespace ZNsExam*/
|
||||
|
||||
}/*
|
||||
namespace ZNsMain*/
|
||||
|
||||
|
||||
int main(int AI_ArgCnt, char* APP_ArgVal[])
|
||||
{
|
||||
return ZNsMain::ZNsExam::
|
||||
|
||||
ZtCExamTuple_000<>::Main(AI_ArgCnt, APP_ArgVal);
|
||||
}/*
|
||||
int main(int AI_ArgCnt, char* APP_ArgVal[])*/
|
||||
|
||||
|
||||
/*////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
■ cygwin 컴파일
|
||||
|
||||
// g++ -mno-cygwin -o ZftMakeTuple_000.exe ZftMakeTuple_000.cpp -I../../my_CPP/CPP_Main/ -I../../my_CPP/CPP_Std/ -D__CYGWIN32__ -D__VISUAL_CPP_VER__=200300
|
||||
// g++ -mno-cygwin -o ZftMakeTuple_000_D.exe ZftMakeTuple_000.cpp -I../../my_CPP/CPP_Main/ -I../../my_CPP/CPP_Std/ -D__CYGWIN32__ -D__VISUAL_CPP_VER__=200300 -D_DEBUG
|
||||
|
||||
■ mingw 컴파일
|
||||
|
||||
g++.exe -std=c++98 -o ZftMakeTuple_000_mw_98.exe ZftMakeTuple_000.cpp -I../ -D__CPLUSPLUS_VER__=199800
|
||||
g++.exe -std=c++98 -o ZftMakeTuple_000_mw_98_D.exe ZftMakeTuple_000.cpp -I../ -D__CPLUSPLUS_VER__=199800 -D_DEBUG
|
||||
|
||||
g++.exe -o ZftMakeTuple_000_mw.exe ZftMakeTuple_000.cpp -I../
|
||||
g++.exe -o ZftMakeTuple_000_mw_D.exe ZftMakeTuple_000.cpp -I../ -D_DEBUG
|
||||
|
||||
./ZftMakeTuple_000_mw.exe
|
||||
./ZftMakeTuple_000_mw_D.exe
|
||||
|
||||
./ZftMakeTuple_000_mw_98.exe
|
||||
./ZftMakeTuple_000_mw_98_D.exe
|
||||
|
||||
|
||||
Administrator@q381-2673 UCRT64 /e/my_CPP/ZCpp/ZCppMainTest
|
||||
# date
|
||||
Sun Aug 24 10:47:09 KST 2025
|
||||
|
||||
Administrator@q381-2673 UCRT64 /e/my_CPP/ZCpp/ZCppMainTest
|
||||
# g++ --version
|
||||
g++.exe (Rev2, Built by MSYS2 project) 13.2.0
|
||||
Copyright (C) 2023 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
■ Linux 컴파일
|
||||
|
||||
//g++ -std=c++98 -o ZftMakeTuple_000.exe ZftMakeTuple_000.cpp -I../ -lpthread
|
||||
//g++ -std=c++98 -o ZftMakeTuple_000_D.exe ZftMakeTuple_000.cpp -I../ -lpthread -D_DEBUG
|
||||
|
||||
g++ -o ZftMakeTuple_000.exe ZftMakeTuple_000.cpp -I../
|
||||
g++ -o ZftMakeTuple_000_D.exe ZftMakeTuple_000.cpp -I../ -D_DEBUG
|
||||
|
||||
g++ -o ZftMakeTuple_000_98.exe ZftMakeTuple_000.cpp -I../ -D__CPLUSPLUS_VER__=199800
|
||||
g++ -o ZftMakeTuple_000_98_D.exe ZftMakeTuple_000.cpp -I../ -D__CPLUSPLUS_VER__=199800 -D_DEBUG
|
||||
|
||||
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ gcc --version
|
||||
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ date
|
||||
Sun Aug 24 00:05:51 DST 2025
|
||||
|
||||
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ cat /etc/os-release
|
||||
NAME="Ubuntu"
|
||||
VERSION="20.04.6 LTS (Focal Fossa)"
|
||||
ID=ubuntu
|
||||
ID_LIKE=debian
|
||||
PRETTY_NAME="Ubuntu 20.04.6 LTS"
|
||||
VERSION_ID="20.04"
|
||||
HOME_URL="https://www.ubuntu.com/"
|
||||
SUPPORT_URL="https://help.ubuntu.com/"
|
||||
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
|
||||
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
|
||||
VERSION_CODENAME=focal
|
||||
UBUNTU_CODENAME=focal
|
||||
|
||||
|
||||
[sauron@q381-2657 ZCppMainTest]$ cat /etc/centos-release
|
||||
CentOS Linux release 7.9.2009 (Core)
|
||||
|
||||
[sauron@q381-2657 ZCppMainTest]$ g++ --version
|
||||
g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
|
||||
Copyright (C) 2015 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
■ 실행
|
||||
|
||||
./ZftMakeTuple_000.exe
|
||||
./ZftMakeTuple_000_D.exe
|
||||
|
||||
./ZftMakeTuple_000_98.exe
|
||||
./ZftMakeTuple_000_98_D.exe
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////*/
|
262
ZCppMainTest/ZtCArray_000.cpp
Normal file
262
ZCppMainTest/ZtCArray_000.cpp
Normal file
@ -0,0 +1,262 @@
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#include "ZCppMain/ZtCArray.H"
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
namespace ZNsMain
|
||||
{
|
||||
|
||||
namespace ZNsExam
|
||||
{
|
||||
|
||||
template<typename TDummy=void*> class ZtCExamArray
|
||||
{
|
||||
public:
|
||||
|
||||
#ifndef _WIN
|
||||
|
||||
class CHelpObj
|
||||
{
|
||||
public:
|
||||
|
||||
CHelpObj()
|
||||
{
|
||||
}
|
||||
|
||||
CHelpObj(const CHelpObj& rhs)
|
||||
{
|
||||
cout<<"* CHelpObj(const CHelpObj& rhs)"<<endl;
|
||||
}
|
||||
|
||||
public:
|
||||
};
|
||||
|
||||
struct StFunctor
|
||||
{
|
||||
static void ShowElement(int ArgiValue){cout<<"#1 Value="<<ArgiValue<<endl;}
|
||||
};
|
||||
struct StFunctor2
|
||||
{
|
||||
static void ShowElement(int ArgiValue, CHelpObj)
|
||||
{cout<<"#2 Value="<<ArgiValue<<", CHelpObj Addr=None"<<" With CHelpObj"<<endl;}
|
||||
};
|
||||
struct StFunctor3
|
||||
{
|
||||
static void ShowElement(int ArgiValue, CHelpObj& AR_CHelpObj)
|
||||
{cout<<"#3 Value="<<ArgiValue<<", HelpObj Ptr="<<&AR_CHelpObj<<" With CHelpObj Ref"<<endl;}
|
||||
};
|
||||
struct StFunctor4
|
||||
{
|
||||
static void ShowElement(int ArgiValue, CHelpObj& AR_CHelpObj)
|
||||
{cout<<"#4 Value="<<ArgiValue<<", HelpObj Ptr="<<&AR_CHelpObj<<" With CHelpObj in Ptr"<<endl;}
|
||||
};
|
||||
struct StFunctor5
|
||||
{
|
||||
static void ShowElement(int ArgiValue, CHelpObj& AR_CHelpObj, CHelpObj& AR_CHelpObj2)
|
||||
{cout<<"#5 Value="<<ArgiValue<<", HelpObj Ptr="<<&AR_CHelpObj<<" With CHelpObj Ref 2"<<endl;}
|
||||
};
|
||||
struct StFunctor6
|
||||
{
|
||||
static void ShowElement(int ArgiValue, CHelpObj& AR_CHelpObj, CHelpObj AO_CHelpObj2)
|
||||
{cout<<"#6 Value="<<ArgiValue<<", HelpObj Ptr="<<&AR_CHelpObj<<" With CHelpObj Half Ref"<<endl;}
|
||||
};
|
||||
|
||||
#endif //#ifndef _WIN
|
||||
|
||||
|
||||
static int Main(int AI_ArgCnt=0, char* APP_ArgVal[]=0)
|
||||
{
|
||||
using namespace std ;
|
||||
using namespace ZNsMain;
|
||||
|
||||
#if defined(__linux__) && defined(__GNUC__)
|
||||
cout<<"# __GNUC__ : "<<__GNUC__<<endl;
|
||||
#endif
|
||||
#if defined(__cplusplus)
|
||||
cout<<"# __cplusplus : "<<__cplusplus<<endl;
|
||||
#endif
|
||||
|
||||
typedef ZtCArray<int> CArray ;
|
||||
typedef CArray::IterEasy IterEasy;
|
||||
|
||||
|
||||
CArray VO_Array;
|
||||
|
||||
VO_Array.AddTail(10);
|
||||
VO_Array.AddTail(20);
|
||||
VO_Array.AddTail(30);
|
||||
VO_Array.AddTail(40);
|
||||
|
||||
|
||||
#ifdef _WIN
|
||||
|
||||
class CHelpObj
|
||||
{
|
||||
public:
|
||||
|
||||
CHelpObj()
|
||||
{
|
||||
}
|
||||
|
||||
CHelpObj(const CHelpObj& rhs)
|
||||
{
|
||||
cout<<"* CHelpObj(const CHelpObj& rhs)"<<endl;
|
||||
}
|
||||
|
||||
public:
|
||||
}; CHelpObj VO_CHelpObj; cout<<"VO_CHelpObj Ptr : "<<&VO_CHelpObj<<endl;
|
||||
|
||||
struct StFunctor
|
||||
{
|
||||
static void ShowElement(int ArgiValue){cout<<"#1 Value="<<ArgiValue<<endl;}
|
||||
};
|
||||
struct StFunctor2
|
||||
{
|
||||
static void ShowElement(int ArgiValue, CHelpObj)
|
||||
{cout<<"#2 Value="<<ArgiValue<<", CHelpObj Addr=None"<<" With CHelpObj"<<endl;}
|
||||
};
|
||||
struct StFunctor3
|
||||
{
|
||||
static void ShowElement(int ArgiValue, CHelpObj& AR_CHelpObj)
|
||||
{cout<<"#3 Value="<<ArgiValue<<", HelpObj Ptr="<<&AR_CHelpObj<<" With CHelpObj Ref"<<endl;}
|
||||
};
|
||||
struct StFunctor4
|
||||
{
|
||||
static void ShowElement(int ArgiValue, CHelpObj& AR_CHelpObj)
|
||||
{cout<<"#4 Value="<<ArgiValue<<", HelpObj Ptr="<<&AR_CHelpObj<<" With CHelpObj in Ptr"<<endl;}
|
||||
};
|
||||
struct StFunctor5
|
||||
{
|
||||
static void ShowElement(int ArgiValue, CHelpObj& AR_CHelpObj, CHelpObj& AR_CHelpObj2)
|
||||
{cout<<"#5 Value="<<ArgiValue<<", HelpObj Ptr="<<&AR_CHelpObj<<" With CHelpObj Ref 2"<<endl;}
|
||||
};
|
||||
struct StFunctor6
|
||||
{
|
||||
static void ShowElement(int ArgiValue, CHelpObj& AR_CHelpObj, CHelpObj AO_CHelpObj2)
|
||||
{cout<<"#6 Value="<<ArgiValue<<", HelpObj Ptr="<<&AR_CHelpObj<<" With CHelpObj Half Ref"<<endl;}
|
||||
};
|
||||
#else // _WIN
|
||||
CHelpObj VO_CHelpObj;
|
||||
|
||||
cout<<"VO_CHelpObj Ptr : "<<&VO_CHelpObj<<endl;
|
||||
#endif //!_WIN
|
||||
|
||||
VO_Array.IterElement(StFunctor ::ShowElement);
|
||||
VO_Array.IterElement(StFunctor2::ShowElement, VO_CHelpObj );
|
||||
VO_Array.IterElement(StFunctor3::ShowElement, ZftMCR(VO_CHelpObj) );
|
||||
VO_Array.IterElement(StFunctor4::ShowElement, ZftMCP(VO_CHelpObj) );
|
||||
VO_Array.IterElement(StFunctor5::ShowElement, ZftMCP(VO_CHelpObj), ZftMCP(VO_CHelpObj) );
|
||||
VO_Array.IterElement(StFunctor6::ShowElement, ZftMCP(VO_CHelpObj), VO_CHelpObj );
|
||||
|
||||
|
||||
IterEasy VH_Iter = VO_Array.ItHEasy();
|
||||
|
||||
__for1(int, i, VO_Array.size())
|
||||
{
|
||||
cout<<i<<"th value="<<
|
||||
VO_Array.ItD(VH_Iter)<<endl;
|
||||
|
||||
VO_Array.ItNext(VH_Iter);
|
||||
}
|
||||
///////////////////////////////
|
||||
|
||||
return 0;
|
||||
}/*
|
||||
static int Main(int AI_ArgCnt=0, char* APP_ArgVal[]=0)*/
|
||||
|
||||
public:
|
||||
};/*
|
||||
template<typename TDummy=void*> class ZtCExamArray*/
|
||||
|
||||
}/*
|
||||
namespace ZNsExam*/
|
||||
|
||||
}/*
|
||||
namespace ZNsMain*/
|
||||
|
||||
|
||||
int main(int AI_ArgCnt, char* APP_ArgVal[])
|
||||
{
|
||||
return ZNsMain::ZNsExam::
|
||||
|
||||
ZtCExamArray<>::Main(AI_ArgCnt, APP_ArgVal);
|
||||
}/*
|
||||
int main(int AI_ArgCnt, char* APP_ArgVal[])*/
|
||||
|
||||
|
||||
/*////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
■ cygwin 컴파일
|
||||
|
||||
// g++ -mno-cygwin -o ZtCArray_000.exe ZtCArray_000.cpp -I../../my_CPP/CPP_Main/ -I../../my_CPP/CPP_Std/ -D__CYGWIN32__ -D__VISUAL_CPP_VER__=200300
|
||||
// g++ -mno-cygwin -o ZtCArray_000_D.exe ZtCArray_000.cpp -I../../my_CPP/CPP_Main/ -I../../my_CPP/CPP_Std/ -D__CYGWIN32__ -D__VISUAL_CPP_VER__=200300 -D_DEBUG
|
||||
|
||||
■ mingw 컴파일
|
||||
|
||||
g++.exe -o ZtCArray_000_mw.exe ZtCArray_000.cpp -I../
|
||||
g++.exe -o ZtCArray_000_mw_D.exe ZtCArray_000.cpp -I../ -D_DEBUG
|
||||
|
||||
./ZtCArray_000_mw.exe
|
||||
./ZtCArray_000_mw_D.exe
|
||||
|
||||
|
||||
Administrator@q381-2673 UCRT64 /e/my_CPP/ZCpp/ZCppMainTest
|
||||
# date
|
||||
Sun Aug 24 10:47:09 KST 2025
|
||||
|
||||
Administrator@q381-2673 UCRT64 /e/my_CPP/ZCpp/ZCppMainTest
|
||||
# g++ --version
|
||||
g++.exe (Rev2, Built by MSYS2 project) 13.2.0
|
||||
Copyright (C) 2023 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
■ Linux 컴파일
|
||||
|
||||
g++ -std=c++98 -o ZtCArray_000.exe ZtCArray_000.cpp -I../
|
||||
g++ -std=c++98 -o ZtCArray_000_D.exe ZtCArray_000.cpp -I../ -D_DEBUG
|
||||
|
||||
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ gcc --version
|
||||
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ date
|
||||
Sun Aug 24 00:05:51 DST 2025
|
||||
|
||||
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ cat /etc/os-release
|
||||
NAME="Ubuntu"
|
||||
VERSION="20.04.6 LTS (Focal Fossa)"
|
||||
ID=ubuntu
|
||||
ID_LIKE=debian
|
||||
PRETTY_NAME="Ubuntu 20.04.6 LTS"
|
||||
VERSION_ID="20.04"
|
||||
HOME_URL="https://www.ubuntu.com/"
|
||||
SUPPORT_URL="https://help.ubuntu.com/"
|
||||
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
|
||||
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
|
||||
VERSION_CODENAME=focal
|
||||
UBUNTU_CODENAME=focal
|
||||
|
||||
|
||||
[sauron@q381-2657 ZCppMainTest]$ cat /etc/centos-release
|
||||
CentOS Linux release 7.9.2009 (Core)
|
||||
|
||||
[sauron@q381-2657 ZCppMainTest]$ g++ --version
|
||||
g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
|
||||
Copyright (C) 2015 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
■ 실행
|
||||
|
||||
./ZtCArray_000.exe
|
||||
./ZtCArray_000_D.exe
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////*/
|
647
ZCppMainTest/ZtCBaseList_000.cpp
Normal file
647
ZCppMainTest/ZtCBaseList_000.cpp
Normal file
@ -0,0 +1,647 @@
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#include "ZCppMain/ZtCStringEx.H"
|
||||
|
||||
|
||||
using namespace std ;
|
||||
using namespace ZNsMain ;
|
||||
|
||||
|
||||
namespace ZNsMain
|
||||
{
|
||||
|
||||
namespace ZNsExam
|
||||
{
|
||||
|
||||
template<typename TDummy=void*> class ZtCExamCList
|
||||
{
|
||||
public:
|
||||
|
||||
class CHelpObj
|
||||
{
|
||||
public:
|
||||
|
||||
CHelpObj()
|
||||
{
|
||||
cout<<"* CHelpObj()"<<endl;
|
||||
}
|
||||
|
||||
CHelpObj(const CHelpObj& rhs)
|
||||
{
|
||||
cout<<"* CHelpObj(const CHelpObj& rhs)"<<endl;
|
||||
}
|
||||
|
||||
public:
|
||||
};/*
|
||||
class CHelpObj*/
|
||||
|
||||
|
||||
struct StFunctor
|
||||
{
|
||||
static void ShowElement(int ArgiValue){cout<<"#1 Value="<<ArgiValue<<endl;}
|
||||
};
|
||||
struct StFunctor2
|
||||
{
|
||||
static void ShowElement(int ArgiValue, CHelpObj)
|
||||
{cout<<"#2 Value="<<ArgiValue<<", CHelpObj Addr=None"<<" With CHelpObj"<<endl;}
|
||||
};
|
||||
struct StFunctor3
|
||||
{
|
||||
static void ShowElement(int ArgiValue, CHelpObj& AR_CHelpObj)
|
||||
{cout<<"#3 Value="<<ArgiValue<<", HelpObj Ptr="<<&AR_CHelpObj<<" With CHelpObj Ref"<<endl;}
|
||||
};
|
||||
struct StFunctor4
|
||||
{
|
||||
static void ShowElement(int ArgiValue, CHelpObj& AR_CHelpObj)
|
||||
{cout<<"#4 Value="<<ArgiValue<<", HelpObj Ptr="<<&AR_CHelpObj<<" With CHelpObj in Ptr"<<endl;}
|
||||
};
|
||||
struct StFunctor5
|
||||
{
|
||||
static void ShowElement(int ArgiValue, CHelpObj& AR_CHelpObj, CHelpObj& AR_CHelpObj2)
|
||||
{cout<<"#5 Value="<<ArgiValue<<", HelpObj Ptr="<<&AR_CHelpObj<<" With CHelpObj Ref 2"<<endl;}
|
||||
};
|
||||
struct StFunctor6
|
||||
{
|
||||
static void ShowElement(int ArgiValue, CHelpObj& AR_CHelpObj, CHelpObj AO_CHelpObj2)
|
||||
{cout<<"#6 Value="<<ArgiValue<<", HelpObj Ptr="<<&AR_CHelpObj<<" With CHelpObj Half Ref"<<endl;}
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
typedef ZtCStringBase<char> CStringBase ;
|
||||
typedef const CStringBase CStringBaseC;
|
||||
|
||||
/* 아래 자료형에 대해, CStringBase::Fetch() 호출 여부 실험.
|
||||
|
||||
ZtCBaseList<CStringBase&, CStringBase &>
|
||||
ZtCBaseList<CStringBase&, CStringBaseC&>
|
||||
|
||||
*/
|
||||
typedef ZtCBaseList
|
||||
<CStringBase, CStringBase &> CStringList1 ;
|
||||
typedef ZtCBaseList
|
||||
<CStringBase, CStringBaseC&> CStringList2 ;
|
||||
|
||||
public:
|
||||
|
||||
|
||||
class ZCBaseListEx10 : public ZtCBaseList
|
||||
<
|
||||
CStringBase, CStringBase&, ZCAllocator, ZTypLong
|
||||
, ZNsMain::ZtCMoveObj <CStringBase, CStringBase&, true>
|
||||
, ZNsType::ZtCTypeCRTP<ZCBaseListEx10, true>
|
||||
>
|
||||
{
|
||||
public :
|
||||
|
||||
typedef ZtCBaseList ///////////////////////////////////////////////////////
|
||||
<
|
||||
CStringBase, CStringBase&, ZCAllocator, ZTypLong
|
||||
, ZNsMain::ZtCMoveObj <CStringBase, CStringBase&, true>
|
||||
, ZNsType::ZtCTypeCRTP<ZCBaseListEx10, true>
|
||||
>
|
||||
ZCBaseList; ///////////////////////////////////////////////////////////////
|
||||
|
||||
friend class ZtCBaseList //////////////////////////////////////////////////
|
||||
<
|
||||
CStringBase, CStringBase&, ZCAllocator, ZTypLong
|
||||
, ZNsMain::ZtCMoveObj <CStringBase, CStringBase&, true>
|
||||
, ZNsType::ZtCTypeCRTP<ZCBaseListEx10, true>
|
||||
>;
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
typedef typename ZCBaseList::ZCLink ZCLink;
|
||||
|
||||
public :
|
||||
|
||||
_VT_ ZTypLong capacity() const
|
||||
{
|
||||
cout<<"[ZCBaseListEx10 : capacity()]"; return 0;
|
||||
}/*
|
||||
_VT_ ZTypLong capacity() const*/
|
||||
|
||||
_VT_ ZTypLong size_free() const
|
||||
{
|
||||
cout<<"[ZCBaseListEx10 : size_free()]"; return 0;
|
||||
}/*
|
||||
_VT_ ZTypLong size_free() const*/
|
||||
|
||||
private:
|
||||
|
||||
_VT_ ZCLink* SendFreeOut() const
|
||||
{
|
||||
cout<<"** ZCBaseListEx10 : SendFreeOut()"<<endl;
|
||||
|
||||
return this->ZCBaseList::NewLink();
|
||||
}/*
|
||||
_VT_ ZCLink* SendFreeOut() const*/
|
||||
|
||||
_VT_ ZCLink* SendFreeOut(CStringBase& AO_ArgData) const
|
||||
{
|
||||
cout<<"** ZCBaseListEx10 : SendFreeOut(TypeArg)"<<endl;
|
||||
|
||||
return this->ZCBaseList::NewLink(AO_ArgData);
|
||||
}/*
|
||||
_VT_ ZCLink* SendFreeOut(CStringBase& AO_ArgData) const*/
|
||||
|
||||
_VT_ void SendFreeOut
|
||||
(ZTypLong AL_NeedCnt, ZCLink*& APR_HeadLink, ZCLink*& APR_TailLink) const
|
||||
{
|
||||
cout<<"** ZCBaseListEx10 : SendFreeOut("<<AL_NeedCnt<<", ZCLink*&, ZCLink*&)"<<endl;
|
||||
|
||||
this->ZCBaseList::NewLink(AL_NeedCnt, APR_HeadLink, APR_TailLink);
|
||||
}
|
||||
|
||||
_VT_ void SendFreeOutCopy /*///////////////////////*/
|
||||
(
|
||||
ZCLink* AP_LinkOrgin, ZTypLong AL_FarNum ,
|
||||
ZCLink*& APR_HeadCopy, ZCLink*& APR_TailCopy
|
||||
) const
|
||||
/////////////////////////////////////////////////////
|
||||
{
|
||||
cout<<"** ZCBaseListEx10 : SendFreeOut(ZCLink*, "<<AL_FarNum<<", ZCLink*&, ZCLink*&)"<<endl;
|
||||
|
||||
this->ZCBaseList::NewLinkCopy(AP_LinkOrgin, AL_FarNum, APR_HeadCopy, APR_TailCopy);
|
||||
}
|
||||
|
||||
_VT_ void RecvFreeIn(ZCLink* AP_DelLink)
|
||||
{
|
||||
cout<<"** ZCBaseListEx10 : RecvFreeIn(AP_DelLink)"<<endl;
|
||||
|
||||
this->ZCBaseList::DelLink(AP_DelLink);
|
||||
}/*
|
||||
_VT_ void RecvFreeIn(ZCLink* AP_DelLink)*/
|
||||
|
||||
_VT_ void RecvFreeIn //////////////////////////////////
|
||||
(
|
||||
ZTypLong AL_CutCnt ,
|
||||
ZCLink* AP_CutHead,
|
||||
ZCLink* AP_CutTail
|
||||
)
|
||||
///////////////////////////////////////////////////////
|
||||
{
|
||||
cout<<"** ZCBaseListEx10 : RecvFreeIn("<<AL_CutCnt<<", AP_CutHead, AP_CutTail)"<<endl;
|
||||
|
||||
this->ZCBaseList::DelLink(AL_CutCnt, AP_CutHead, AP_CutTail);
|
||||
}
|
||||
|
||||
private:
|
||||
};/*
|
||||
class ZCBaseListEx10 : public ZtCBaseList*/
|
||||
|
||||
|
||||
class ZCBaseListEx11 : public ZtCBaseList
|
||||
<
|
||||
CStringBase, CStringBase&, ZCAllocator, ZTypLong
|
||||
, ZNsMain::ZtCMoveObj <CStringBase, CStringBase&, true>
|
||||
, ZNsType::ZtCTypeCRTP<ZCBaseListEx11, false>
|
||||
>
|
||||
{
|
||||
public :
|
||||
|
||||
typedef ZtCBaseList ///////////////////////////////////////////////////////
|
||||
<
|
||||
CStringBase, CStringBase&, ZCAllocator, ZTypLong
|
||||
, ZNsMain::ZtCMoveObj <CStringBase, CStringBase&, true>
|
||||
, ZNsType::ZtCTypeCRTP<ZCBaseListEx11, false>
|
||||
>
|
||||
ZCBaseList; ///////////////////////////////////////////////////////////////
|
||||
|
||||
friend class ZtCBaseList //////////////////////////////////////////////////
|
||||
<
|
||||
CStringBase, CStringBase&, ZCAllocator, ZTypLong
|
||||
, ZNsMain::ZtCMoveObj <CStringBase, CStringBase&, true>
|
||||
, ZNsType::ZtCTypeCRTP<ZCBaseListEx11, false>
|
||||
>;
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
typedef typename ZCBaseList::ZCLink ZCLink;
|
||||
|
||||
public :
|
||||
|
||||
_VT_ ZTypLong capacity() const
|
||||
{
|
||||
cout<<"[ZCBaseListEx11 : capacity()]"; return 0;
|
||||
}/*
|
||||
_VT_ ZTypLong capacity() const*/
|
||||
|
||||
_VT_ ZTypLong size_free() const
|
||||
{
|
||||
cout<<"[ZCBaseListEx11 : size_free()]"; return 0;
|
||||
}/*
|
||||
_VT_ ZTypLong size_free() const*/
|
||||
|
||||
private:
|
||||
|
||||
_VT_ ZCLink* SendFreeOut()
|
||||
{
|
||||
cout<<"** ZCBaseListEx11 : SendFreeOut()"<<endl;
|
||||
|
||||
return this->ZCBaseList::NewLink();
|
||||
}/*
|
||||
_VT_ ZCLink* SendFreeOut()*/
|
||||
|
||||
_VT_ ZCLink* SendFreeOut(CStringBase& AO_ArgData)
|
||||
{
|
||||
cout<<"** ZCBaseListEx11 : SendFreeOut(CStringBase&)"<<endl;
|
||||
|
||||
return this->ZCBaseList::NewLink(AO_ArgData);
|
||||
}/*
|
||||
_VT_ ZCLink* SendFreeOut(CStringBase& AO_ArgData)*/
|
||||
|
||||
_VT_ void SendFreeOut
|
||||
(ZTypLong AL_NeedCnt, ZCLink*& APR_HeadLink, ZCLink*& APR_TailLink)
|
||||
{
|
||||
cout<<"** ZCBaseListEx11 : SendFreeOut("<<AL_NeedCnt<<", ZCLink*&, ZCLink*&)"<<endl;
|
||||
|
||||
this->ZCBaseList::NewLink(AL_NeedCnt, APR_HeadLink, APR_TailLink);
|
||||
}
|
||||
|
||||
_VT_ void SendFreeOutCopy /*///////////////////////*/
|
||||
(
|
||||
ZCLink* AP_LinkOrgin, ZTypLong AL_FarNum ,
|
||||
ZCLink*& APR_HeadCopy, ZCLink*& APR_TailCopy
|
||||
)
|
||||
/////////////////////////////////////////////////////
|
||||
{
|
||||
cout<<"** ZCBaseListEx11 : SendFreeOut(ZCLink*, "<<AL_FarNum<<", ZCLink*&, ZCLink*&)"<<endl;
|
||||
|
||||
this->ZCBaseList::NewLinkCopy(AP_LinkOrgin, AL_FarNum, APR_HeadCopy, APR_TailCopy);
|
||||
}
|
||||
|
||||
_VT_ void RecvFreeIn(ZCLink* AP_DelLink)
|
||||
{
|
||||
cout<<"** ZCBaseListEx11 : RecvFreeIn(AP_DelLink)"<<endl;
|
||||
|
||||
this->ZCBaseList::DelLink(AP_DelLink);
|
||||
}/*
|
||||
_VT_ void RecvFreeIn(ZCLink* AP_DelLink)*/
|
||||
|
||||
_VT_ void RecvFreeIn //////////////////////////////////
|
||||
(
|
||||
ZTypLong AL_CutCnt ,
|
||||
ZCLink* AP_CutHead,
|
||||
ZCLink* AP_CutTail
|
||||
)
|
||||
///////////////////////////////////////////////////////
|
||||
{
|
||||
cout<<"** ZCBaseListEx11: RecvFreeIn("<<AL_CutCnt<<", AP_CutHead, AP_CutTail)"<<endl;
|
||||
|
||||
this->ZCBaseList::DelLink(AL_CutCnt, AP_CutHead, AP_CutTail);
|
||||
}
|
||||
|
||||
private:
|
||||
};/*
|
||||
class ZCBaseListEx11 : public ZtCBaseList*/
|
||||
|
||||
|
||||
typedef typename ZCBaseListEx10::ZCLink ZCLink10;
|
||||
typedef typename ZCBaseListEx11::ZCLink ZCLink11;
|
||||
|
||||
|
||||
static void ShowDataInNode(const CStringBase& AR_Data, ZTypLong& ARRI_CallCnt)
|
||||
{
|
||||
cout<<++ARRI_CallCnt<<"* Data : "<<AR_Data<<endl;
|
||||
}/*
|
||||
static void ShowDataInNode(const CStringBase& AR_Data, ZTypLong& ARRI_CallCnt)*/
|
||||
|
||||
|
||||
static void Append10(ZCLink10& AR_CLink)
|
||||
{
|
||||
(*AR_CLink).append("__");
|
||||
}/*
|
||||
static void Append10(ZCLink10& AR_CLink)*/
|
||||
|
||||
|
||||
static void ShowNode10(ZCLink10& AR_CLink, ZTypLong& ARRI_CallCnt)
|
||||
{
|
||||
++ARRI_CallCnt;
|
||||
|
||||
cout<<ARRI_CallCnt<<" * Node10 Prev : "<<*(AR_CLink-1)<<endl;
|
||||
cout<<ARRI_CallCnt<<" * Node10 Curr : " <<*(AR_CLink )<<endl;
|
||||
cout<<ARRI_CallCnt<<" * Node10 Prev : "<<*(AR_CLink+1)<<endl;
|
||||
}/*
|
||||
static void ShowNode10(ZCLink10& AR_CLink, ZTypLong& ARRI_CallCnt)*/
|
||||
static void ShowNode11(ZCLink11& AR_CLink, ZTypLong& ARRI_CallCnt)
|
||||
{
|
||||
++ARRI_CallCnt;
|
||||
|
||||
cout<<ARRI_CallCnt<<" * Node11 Prev : "<<*(AR_CLink-1)<<endl;
|
||||
cout<<ARRI_CallCnt<<" * Node11 Curr : " <<*(AR_CLink )<<endl;
|
||||
cout<<ARRI_CallCnt<<" * Node11 Prev : "<<*(AR_CLink+1)<<endl;
|
||||
}/*
|
||||
static void ShowNode11(ZCLink11& AR_CLink, ZTypLong& ARRI_CallCnt)*/
|
||||
|
||||
|
||||
static void ShowNode10_2(ZCLink10& AR_CLink, ostream& AR_OS, ZTypLong& ARRI_CallCnt)
|
||||
{
|
||||
++ARRI_CallCnt;
|
||||
|
||||
cout<<ARRI_CallCnt<<" * Node10_2 Prev : "<<*(AR_CLink-1)<<endl;
|
||||
cout<<ARRI_CallCnt<<" * Node10_2 Curr : " <<*(AR_CLink )<<endl;
|
||||
cout<<ARRI_CallCnt<<" * Node10_2 Prev : "<<*(AR_CLink+1)<<endl;
|
||||
}/*
|
||||
static void ShowNode10_2(ZCLink10& AR_CLink, ostream& AR_OS, ZTypLong& ARRI_CallCnt)*/
|
||||
static void ShowNode11_2(ZCLink11& AR_CLink, ostream& AR_OS, ZTypLong& ARRI_CallCnt)
|
||||
{
|
||||
++ARRI_CallCnt;
|
||||
|
||||
cout<<ARRI_CallCnt<<" * Node11_2 Prev : "<<*(AR_CLink-1)<<endl;
|
||||
cout<<ARRI_CallCnt<<" * Node11_2 Curr : " <<*(AR_CLink )<<endl;
|
||||
cout<<ARRI_CallCnt<<" * Node11_2 Prev : "<<*(AR_CLink+1)<<endl;
|
||||
}/*
|
||||
static void ShowNode11_2(ZCLink11& AR_CLink, ostream& AR_OS, ZTypLong& ARRI_CallCnt)*/
|
||||
|
||||
|
||||
static void ShowNode10_3(ZCLink10& AR_CLink, ZTypLong& ARRI_CallCnt)
|
||||
{
|
||||
cout<<++ARRI_CallCnt<<" * Node10 Curr : " <<*(AR_CLink )<<endl;
|
||||
}/*
|
||||
static void ShowNode10_3(ZCLink10& AR_CLink, ZTypLong& ARRI_CallCnt)*/
|
||||
static void ShowNode11_3(ZCLink11& AR_CLink, ZTypLong& ARRI_CallCnt)
|
||||
{
|
||||
cout<<++ARRI_CallCnt<<" * Node11 Curr : " <<*(AR_CLink )<<endl;
|
||||
}/*
|
||||
static void ShowNode11_3(ZCLink11& AR_CLink, ZTypLong& ARRI_CallCnt)*/
|
||||
|
||||
|
||||
static int Main(int AI_ArgCnt=0, char* APP_ArgVal[]=0)
|
||||
{
|
||||
ZTypLong VI_CallCnt=0;
|
||||
|
||||
CStringBase VO_CStringBase;
|
||||
CStringList1 VO_ListOfStr1 ;
|
||||
CStringList2 VO_ListOfStr2 ;
|
||||
|
||||
VO_ListOfStr1.AddTail(VO_CStringBase("data 10"));
|
||||
VO_ListOfStr1.AddTail(VO_CStringBase("data 40"));
|
||||
VO_ListOfStr1.AddTail(VO_CStringBase("data 20"));
|
||||
VO_ListOfStr1.AddTail(VO_CStringBase("data 40"));
|
||||
VO_ListOfStr1.AddTail(VO_CStringBase("data 04"));
|
||||
|
||||
cout<<"# VO_CStringBase data : " <<VO_CStringBase<<endl;
|
||||
|
||||
cout<<"# 1th IterElement ####" <<endl;
|
||||
{
|
||||
VO_ListOfStr1.IterElement(&ShowDataInNode, ZftMCP(VI_CallCnt=0));
|
||||
}
|
||||
/*///////////////////////////////////*/
|
||||
|
||||
|
||||
cout<<endl;
|
||||
|
||||
|
||||
VO_ListOfStr2.AddTail(VO_CStringBase("data 10"));
|
||||
VO_ListOfStr2.AddTail(VO_CStringBase("data 40"));
|
||||
VO_ListOfStr2.AddTail(VO_CStringBase("data 20"));
|
||||
VO_ListOfStr2.AddTail(VO_CStringBase("data 40"));
|
||||
VO_ListOfStr2.AddTail(VO_CStringBase("data 04"));
|
||||
|
||||
cout<<"# VO_CStringBase data : " <<VO_CStringBase<<endl;
|
||||
|
||||
cout<<"# 2th IterElement ####" <<endl;
|
||||
{
|
||||
VO_ListOfStr2.IterElement(&ShowDataInNode, ZftMCP(VI_CallCnt=0));
|
||||
}
|
||||
/*///////////////////////////////////*/
|
||||
|
||||
|
||||
typedef ZtCBaseList<int> CIntList;
|
||||
|
||||
CHelpObj VO_CHelpObj;
|
||||
CIntList VO_CIntList;
|
||||
|
||||
VO_CIntList.AddTail(10);
|
||||
VO_CIntList.AddTail(20);
|
||||
VO_CIntList.AddTail(30);
|
||||
VO_CIntList.AddTail(40);
|
||||
|
||||
cout<<endl<<"#### Show CIntList Element ####"<<endl<<endl;
|
||||
|
||||
VO_CIntList.IterElement(StFunctor ::ShowElement);
|
||||
VO_CIntList.IterElement(StFunctor2::ShowElement, VO_CHelpObj );
|
||||
VO_CIntList.IterElement(StFunctor3::ShowElement, ZftMCR(VO_CHelpObj) );
|
||||
VO_CIntList.IterElement(StFunctor4::ShowElement, ZftMCP(VO_CHelpObj) );
|
||||
VO_CIntList.IterElement(StFunctor5::ShowElement, ZftMCP(VO_CHelpObj), ZftMCP(VO_CHelpObj) );
|
||||
VO_CIntList.IterElement(StFunctor6::ShowElement, ZftMCP(VO_CHelpObj), VO_CHelpObj );
|
||||
|
||||
|
||||
cout<<endl<<"#### ZCBaseListEx10 and ZCBaseListEx11 ####"<<endl<<endl;
|
||||
|
||||
ZCBaseListEx10 VO_ZCBaseListEx10 ;
|
||||
ZCBaseListEx10 VO_ZCBaseListEx10_2;
|
||||
ZCBaseListEx11 VO_ZCBaseListEx11 ;
|
||||
|
||||
VO_CStringBase="";
|
||||
|
||||
VO_ZCBaseListEx10.AddTail(VO_CStringBase("data ex 10-1"));
|
||||
VO_ZCBaseListEx10.AddTail(VO_CStringBase("data ex 10-2"));
|
||||
|
||||
VO_ZCBaseListEx11.AddTail(VO_CStringBase("data ex 11-1"));
|
||||
VO_ZCBaseListEx11.AddTail(VO_CStringBase("data ex 11-2"));
|
||||
|
||||
cout<<endl<<"# VO_ZCBaseListEx10_2 = VO_ZCBaseListEx10"<<endl<<endl;
|
||||
|
||||
VO_ZCBaseListEx10_2 = VO_ZCBaseListEx10 ;
|
||||
VO_ZCBaseListEx10_2.IterElement(&ShowDataInNode, ZftMCP(VI_CallCnt=0));
|
||||
|
||||
VO_ZCBaseListEx10.AddTail().Fetch(VO_CStringBase("data ex 10-3"));
|
||||
VO_ZCBaseListEx10.AddTail().Fetch(VO_CStringBase("data ex 10-4"));
|
||||
|
||||
cout<<endl<<"# VO_ZCBaseListEx10_2 = VO_ZCBaseListEx10 after VO_ZCBaseListEx10.AddTail() 2 times"<<endl<<endl;
|
||||
|
||||
VO_ZCBaseListEx10_2 = VO_ZCBaseListEx10 ;
|
||||
VO_ZCBaseListEx10_2.IterElement(&ShowDataInNode, ZftMCP(VI_CallCnt=0));
|
||||
|
||||
cout<<endl<<"# VO_ZCBaseListEx10_2.AddHead(VO_ZCBaseListEx10)"<<endl<<endl;
|
||||
|
||||
VO_ZCBaseListEx10_2.AddHead(VO_ZCBaseListEx10) ;
|
||||
VO_ZCBaseListEx10_2.IterElemRev(&ShowDataInNode, ZftMCP(VI_CallCnt=0));
|
||||
|
||||
|
||||
cout<<endl<<"# VO_ZCBaseListEx10_2 : DeleteTail(2)"<<endl<<endl;
|
||||
|
||||
VO_ZCBaseListEx10_2.DeleteTail(2);
|
||||
VO_ZCBaseListEx10_2.IterElemRev(&ShowDataInNode, ZftMCP(VI_CallCnt=0));
|
||||
|
||||
|
||||
cout<<endl<<"# VO_ZCBaseListEx10_2 : DeleteHead(1)"<<endl<<endl;
|
||||
|
||||
VO_ZCBaseListEx10_2.DeleteHead(1);
|
||||
VO_ZCBaseListEx10_2.IterElement(&ShowDataInNode, ZftMCP(VI_CallCnt=0));
|
||||
|
||||
cout<<"# VO_ZCBaseListEx10 : capacity()="<<VO_ZCBaseListEx10 .capacity()<<endl;
|
||||
cout<<"# VO_ZCBaseListEx10_2 : capacity()="<<VO_ZCBaseListEx10_2.capacity()<<endl;
|
||||
|
||||
VO_ZCBaseListEx10_2.IterElemLink(&ShowNode10 , ZftMCP(VI_CallCnt=0));
|
||||
cout<<"*****************************************************"<<endl;
|
||||
VO_ZCBaseListEx10_2.IterElemLink(&ShowNode10_2, ZftMCP(cout), ZftMCP(VI_CallCnt=0));
|
||||
|
||||
|
||||
cout<<endl<<"# show VO_ZCBaseListEx10 element"<<endl;
|
||||
|
||||
VO_ZCBaseListEx10 .IterElemLink(&ShowNode10, ZftMCP(VI_CallCnt=0));
|
||||
VO_ZCBaseListEx10_2.SendOutTail
|
||||
(*VO_ZCBaseListEx10_2.GetLinkPtr(2), VO_ZCBaseListEx10);
|
||||
|
||||
cout<<endl<<"# after VO_ZCBaseListEx10_2's 2th link to VO_ZCBaseListEx10's tail"<<endl;
|
||||
|
||||
cout<<"+++++++++++++++++++++++++++++++++++++++++++++++++++++"<<endl;
|
||||
VO_ZCBaseListEx10 .IterElemLink(&ShowNode10 , ZftMCP(VI_CallCnt=0));
|
||||
cout<<"*****************************************************"<<endl;
|
||||
VO_ZCBaseListEx10_2.IterElemLink(&ShowNode10_2, ZftMCP(cout), ZftMCP(VI_CallCnt=0));
|
||||
|
||||
VO_ZCBaseListEx10.IterElemLink(&Append10);
|
||||
cout<<"+++++++++++++++++++++++++++++++++++++++++++++++++++++"<<endl;
|
||||
VO_ZCBaseListEx10 .IterElemLink(&ShowNode10_3, ZftMCP(VI_CallCnt=0));
|
||||
cout<<"*****************************************************"<<endl;
|
||||
VO_ZCBaseListEx10_2.IterElemLink(&ShowNode10_3, ZftMCP(VI_CallCnt=0));
|
||||
|
||||
|
||||
VO_ZCBaseListEx10.SendRangeOutAfter
|
||||
(
|
||||
*VO_ZCBaseListEx10.GetLinkPtr(2)
|
||||
, *VO_ZCBaseListEx10.GetLinkPtr(3)
|
||||
, 2
|
||||
, VO_ZCBaseListEx10_2
|
||||
, VO_ZCBaseListEx10_2.GetLinkOpt(2)
|
||||
);
|
||||
cout<<endl<<"# after VO_ZCBaseListEx10's 2~3th link to VO_ZCBaseListEx10_2's 2th link after"<<endl;
|
||||
|
||||
cout<<"+++++++++++++++++++++++++++++++++++++++++++++++++++++"<<endl;
|
||||
VO_ZCBaseListEx10 .IterElemLink(&ShowNode10_3, ZftMCP(VI_CallCnt=0));
|
||||
cout<<"*****************************************************"<<endl;
|
||||
VO_ZCBaseListEx10_2.IterElemLink(&ShowNode10_3, ZftMCP(VI_CallCnt=0));
|
||||
|
||||
|
||||
cout<<endl<<"# after VO_ZCBaseListEx10_2 = VO_ZCBaseListEx10"<<endl;
|
||||
|
||||
VO_ZCBaseListEx10_2 = VO_ZCBaseListEx10 ;
|
||||
cout<<"+++++++++++++++++++++++++++++++++++++++++++++++++++++"<<endl;
|
||||
VO_ZCBaseListEx10 .IterElemLink(&ShowNode10_3, ZftMCP(VI_CallCnt=0));
|
||||
cout<<"*****************************************************"<<endl;
|
||||
VO_ZCBaseListEx10_2.IterElemLink(&ShowNode10_3, ZftMCP(VI_CallCnt=0));
|
||||
|
||||
|
||||
cout<<endl<<"# after VO_ZCBaseListEx10.SendRangeOutBefore(1th, 2th, 2, rhs, 1th)"<<endl;
|
||||
|
||||
VO_ZCBaseListEx10.SendRangeOutBefore
|
||||
(
|
||||
*VO_ZCBaseListEx10.GetLinkPtr(1)
|
||||
, *VO_ZCBaseListEx10.GetLinkPtr(2)
|
||||
, 2
|
||||
, VO_ZCBaseListEx10_2
|
||||
, VO_ZCBaseListEx10_2.GetLinkOpt(1)
|
||||
);
|
||||
cout<<"+++++++++++++++++++++++++++++++++++++++++++++++++++++"<<endl;
|
||||
VO_ZCBaseListEx10 .IterElemLink(&ShowNode10_3, ZftMCP(VI_CallCnt=0));
|
||||
cout<<"*****************************************************"<<endl;
|
||||
VO_ZCBaseListEx10_2.IterElemLink(&ShowNode10_3, ZftMCP(VI_CallCnt=0));
|
||||
|
||||
|
||||
cout<<endl<<"# after VO_ZCBaseListEx10.CopyThis(RR(VO_ZCBaseListEx10_2))"<<endl;
|
||||
VO_ZCBaseListEx10.CopyThis(RR(VO_ZCBaseListEx10_2));
|
||||
cout<<"+++++++++++++++++++++++++++++++++++++++++++++++++++++"<<endl;
|
||||
VO_ZCBaseListEx10 .IterElemLink(&ShowNode10_3, ZftMCP(VI_CallCnt=0));
|
||||
cout<<"*****************************************************"<<endl;
|
||||
VO_ZCBaseListEx10_2.IterElemLink(&ShowNode10_3, ZftMCP(VI_CallCnt=0));
|
||||
|
||||
|
||||
return 0;
|
||||
}/*
|
||||
static int Main(int AI_ArgCnt=0, char* APP_ArgVal[]=0)*/
|
||||
|
||||
|
||||
public:
|
||||
};/*
|
||||
template<typename TDummy=void*> class ZtCExamCList*/
|
||||
|
||||
}/*
|
||||
namespace ZNsExam*/
|
||||
|
||||
}/*
|
||||
namespace ZNsMain*/
|
||||
|
||||
|
||||
int main(int AI_ArgCnt, char* APP_ArgVal[])
|
||||
{
|
||||
return ZNsMain::ZNsExam::
|
||||
|
||||
ZtCExamCList<>::Main(AI_ArgCnt, APP_ArgVal);
|
||||
}/*
|
||||
int main(int AI_ArgCnt, char* APP_ArgVal[])*/
|
||||
|
||||
|
||||
/*////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
■ cygwin 컴파일
|
||||
|
||||
// g++ -mno-cygwin -o ZtCBaseList_000.exe ZtCBaseList_000.cpp -I../../my_CPP/CPP_Main/ -I../../my_CPP/CPP_Std/ -D__CYGWIN32__ -D__VISUAL_CPP_VER__=200300
|
||||
// g++ -mno-cygwin -o ZtCBaseList_000_D.exe ZtCBaseList_000.cpp -I../../my_CPP/CPP_Main/ -I../../my_CPP/CPP_Std/ -D__CYGWIN32__ -D__VISUAL_CPP_VER__=200300 -D_DEBUG
|
||||
|
||||
■ mingw 컴파일
|
||||
|
||||
g++.exe -o ZtCBaseList_000_mw.exe ZtCBaseList_000.cpp -I../ -lWs2_32
|
||||
g++.exe -o ZtCBaseList_000_mw_D.exe ZtCBaseList_000.cpp -I../ -lWs2_32 -D_DEBUG
|
||||
|
||||
./ZtCBaseList_000_mw.exe
|
||||
./ZtCBaseList_000_mw_D.exe
|
||||
|
||||
|
||||
Administrator@q381-2673 UCRT64 /e/my_CPP/ZCpp/ZCppMainTest
|
||||
# date
|
||||
Sun Aug 24 10:47:09 KST 2025
|
||||
|
||||
Administrator@q381-2673 UCRT64 /e/my_CPP/ZCpp/ZCppMainTest
|
||||
# g++ --version
|
||||
g++.exe (Rev2, Built by MSYS2 project) 13.2.0
|
||||
Copyright (C) 2023 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
■ Linux 컴파일
|
||||
|
||||
g++ -std=c++98 -o ZtCBaseList_000.exe ZtCBaseList_000.cpp -I../
|
||||
g++ -std=c++98 -o ZtCBaseList_000_D.exe ZtCBaseList_000.cpp -I../ -D_DEBUG
|
||||
|
||||
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ gcc --version
|
||||
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ date
|
||||
Sun Aug 24 00:05:51 DST 2025
|
||||
|
||||
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ cat /etc/os-release
|
||||
NAME="Ubuntu"
|
||||
VERSION="20.04.6 LTS (Focal Fossa)"
|
||||
ID=ubuntu
|
||||
ID_LIKE=debian
|
||||
PRETTY_NAME="Ubuntu 20.04.6 LTS"
|
||||
VERSION_ID="20.04"
|
||||
HOME_URL="https://www.ubuntu.com/"
|
||||
SUPPORT_URL="https://help.ubuntu.com/"
|
||||
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
|
||||
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
|
||||
VERSION_CODENAME=focal
|
||||
UBUNTU_CODENAME=focal
|
||||
|
||||
|
||||
[sauron@q381-2657 ZCppMainTest]$ cat /etc/centos-release
|
||||
CentOS Linux release 7.9.2009 (Core)
|
||||
|
||||
[sauron@q381-2657 ZCppMainTest]$ g++ --version
|
||||
g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
|
||||
Copyright (C) 2015 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
■ 실행
|
||||
|
||||
./ZtCBaseList_000.exe
|
||||
./ZtCBaseList_000_D.exe
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////*/
|
252
ZCppMainTest/ZtCLinkList_000.cpp
Normal file
252
ZCppMainTest/ZtCLinkList_000.cpp
Normal file
@ -0,0 +1,252 @@
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include "ZCppMain/ZtCLinkList.H"
|
||||
|
||||
|
||||
using namespace std ;
|
||||
using namespace ZNsMain ;
|
||||
|
||||
|
||||
namespace ZNsMain
|
||||
{
|
||||
|
||||
namespace ZNsExam
|
||||
{
|
||||
|
||||
template<typename TDummy=void*> class ZtCExamCLinkList
|
||||
{
|
||||
public:
|
||||
typedef ZNsIFaceEx::ZtCLink<string, ZCEmpty> ZCLinkCStr ;
|
||||
typedef ZtCLinkList<ZCLinkCStr> ZCLinkStrList;
|
||||
typedef ZCLinkStrList::ZCLinkOpt ZCStrLinkOpt ;
|
||||
public:
|
||||
|
||||
|
||||
static void ShowNode0(ZCLinkCStr& AR_CLink, ZTypLong& ARRI_CallCnt)
|
||||
{
|
||||
++ARRI_CallCnt;
|
||||
|
||||
cout<<ARRI_CallCnt<<" * Node Curr : "<<(AR_CLink)()<<endl;
|
||||
}/*
|
||||
static void ShowNode0(ZCLinkCStr& AR_CLink, ZTypLong& ARRI_CallCnt)*/
|
||||
|
||||
static void ShowNode1(ZCLinkCStr& AR_CLink, ZTypLong& ARRI_CallCnt)
|
||||
{
|
||||
++ARRI_CallCnt;
|
||||
|
||||
cout<<ARRI_CallCnt<<" * Node Prev : "<<(AR_CLink-1)()<<endl;
|
||||
cout<<ARRI_CallCnt<<" * Node Curr : " <<(AR_CLink )()<<endl;
|
||||
cout<<ARRI_CallCnt<<" * Node Next : "<<(AR_CLink+1)()<<endl;
|
||||
}/*
|
||||
static void ShowNode1(ZCLinkCStr& AR_CLink, ZTypLong& ARRI_CallCnt)*/
|
||||
|
||||
|
||||
static void AppendEach(ZCLinkCStr& AR_CLink)
|
||||
{
|
||||
AR_CLink().append("_");
|
||||
}/*
|
||||
static void AppendEach(ZCLinkCStr& AR_CLink)*/
|
||||
|
||||
|
||||
static int Main(int AI_ArgCnt=0, char* APP_ArgVal[]=0)
|
||||
{
|
||||
ZTypLong VI_CallCnt = 0 ;
|
||||
ZCLinkStrList VO_ZCLinkStrLis1;
|
||||
ZCLinkStrList VO_ZCLinkStrLis2;
|
||||
ZCStrLinkOpt VO_StrLinkOpt = VO_ZCLinkStrLis1.GetObjOpt(1);
|
||||
|
||||
cout<<"# VO_StrLinkOpt.has_value()="<<VO_StrLinkOpt.has_value()<<endl;
|
||||
cout<<"# VO_StrLinkOpt.bool() ="<<bool(VO_StrLinkOpt) <<endl;
|
||||
|
||||
VO_ZCLinkStrLis1.AddTail()()=string("123");
|
||||
VO_ZCLinkStrLis1.AddTail()()=string("ABC");
|
||||
VO_ZCLinkStrLis1.AddTail()()=string("xyz");
|
||||
|
||||
VO_ZCLinkStrLis2.AddTail()()=string("Z01");
|
||||
VO_ZCLinkStrLis2.AddTail()()=string("Z02");
|
||||
VO_ZCLinkStrLis2.AddTail()()=string("Z03");
|
||||
|
||||
VO_StrLinkOpt = VO_ZCLinkStrLis1.GetObjOpt(1);
|
||||
|
||||
cout<<"# VO_StrLinkOpt.GetObjOpt(1) : has_value()="<<VO_StrLinkOpt.has_value()<<endl;
|
||||
cout<<"# VO_StrLinkOpt.GetObjOpt(1) : bool ()="<<bool(VO_StrLinkOpt) <<endl;
|
||||
|
||||
if(VO_StrLinkOpt.has_value())
|
||||
cout<<"# value by VO_StrLinkOpt : "<<VO_StrLinkOpt.value()<<endl;
|
||||
|
||||
VO_StrLinkOpt = VO_ZCLinkStrLis1.GetTailOpt();
|
||||
|
||||
cout<<"# VO_StrLinkOpt.GetTailOpt() : has_value()="<<VO_StrLinkOpt.has_value()<<endl;
|
||||
cout<<"# VO_StrLinkOpt.GetTailOpt() : bool ()="<<bool(VO_StrLinkOpt) <<endl;
|
||||
|
||||
if(VO_StrLinkOpt.has_value())
|
||||
cout<<"# value by VO_StrLinkOpt : "<<VO_StrLinkOpt.value()<<endl;
|
||||
|
||||
|
||||
cout<<"+++++++++++++++++++++++++++++++++++++++++++++++"<<endl;
|
||||
VO_ZCLinkStrLis1.IterElement(&ShowNode0, ZftMCP(VI_CallCnt=0));
|
||||
cout<<"***********************************************"<<endl;
|
||||
VO_ZCLinkStrLis1.IterElement(&ShowNode1, ZftMCP(VI_CallCnt=0));
|
||||
|
||||
|
||||
VO_ZCLinkStrLis1.JoinHead(VO_ZCLinkStrLis2);
|
||||
|
||||
cout<<"# after VO_ZCLinkStrLis1.JoinHead(VO_ZCLinkStrLis2)"<<endl;
|
||||
|
||||
cout<<"+++++++++++++++++++++++++++++++++++++++++++++++"<<endl;
|
||||
VO_ZCLinkStrLis2.IterElement(&ShowNode0, ZftMCP(VI_CallCnt=0));
|
||||
cout<<"***********************************************"<<endl;
|
||||
VO_ZCLinkStrLis1.IterElement(&ShowNode0, ZftMCP(VI_CallCnt=0));
|
||||
cout<<"***********************************************"<<endl;
|
||||
VO_ZCLinkStrLis1.IterElement(&ShowNode1, ZftMCP(VI_CallCnt=0));
|
||||
|
||||
|
||||
VO_ZCLinkStrLis2 = VO_ZCLinkStrLis1 ;
|
||||
|
||||
cout<<"# after VO_ZCLinkStrLis2 = VO_ZCLinkStrLis1"<<endl;
|
||||
|
||||
cout<<"+++++++++++++++++++++++++++++++++++++++++++++++"<<endl;
|
||||
VO_ZCLinkStrLis2.IterElement(&ShowNode0, ZftMCP(VI_CallCnt=0));
|
||||
cout<<"***********************************************"<<endl;
|
||||
VO_ZCLinkStrLis1.IterElement(&ShowNode0, ZftMCP(VI_CallCnt=0));
|
||||
cout<<"***********************************************"<<endl;
|
||||
|
||||
|
||||
VO_ZCLinkStrLis1.IterElement(&AppendEach);
|
||||
cout<<"***********************************************"<<endl;
|
||||
VO_ZCLinkStrLis1.IterElement(&ShowNode0, ZftMCP(VI_CallCnt=0));
|
||||
cout<<"***********************************************"<<endl;
|
||||
|
||||
VO_ZCLinkStrLis1.SendRangeOutAfter
|
||||
(
|
||||
VO_ZCLinkStrLis1.GetObjOpt(1).value()
|
||||
, VO_ZCLinkStrLis1.GetObjOpt(2).value()
|
||||
, 2
|
||||
, VO_ZCLinkStrLis2
|
||||
, VO_ZCLinkStrLis2.GetObjOpt(1)
|
||||
) ;
|
||||
cout<<"# after VO_ZCLinkStrLis1.SendRangeOutAfter(1th, 2th, 2, rhs, rhs's 1th)"<<endl;
|
||||
|
||||
cout<<"+++++++++++++++++++++++++++++++++++++++++++++++"<<endl;
|
||||
VO_ZCLinkStrLis2.IterElement(&ShowNode0, ZftMCP(VI_CallCnt=0));
|
||||
cout<<"***********************************************"<<endl;
|
||||
VO_ZCLinkStrLis1.IterElement(&ShowNode0, ZftMCP(VI_CallCnt=0));
|
||||
cout<<"***********************************************"<<endl;
|
||||
|
||||
|
||||
VO_ZCLinkStrLis2.SendRangeOutBefore
|
||||
(
|
||||
VO_ZCLinkStrLis2.GetObjOpt(7).value()
|
||||
, VO_ZCLinkStrLis2.GetObjOpt(8).value()
|
||||
, 2
|
||||
, VO_ZCLinkStrLis1
|
||||
, VO_ZCLinkStrLis1.GetObjOpt(1)
|
||||
) ;
|
||||
cout<<"# after VO_ZCLinkStrLis2.SendRangeOutAfter(7th, 8th, 2, rhs, rhs's 1th)"<<endl;
|
||||
|
||||
cout<<"+++++++++++++++++++++++++++++++++++++++++++++++"<<endl;
|
||||
VO_ZCLinkStrLis2.IterElement(&ShowNode0, ZftMCP(VI_CallCnt=0));
|
||||
cout<<"***********************************************"<<endl;
|
||||
VO_ZCLinkStrLis1.IterElement(&ShowNode0, ZftMCP(VI_CallCnt=0));
|
||||
cout<<"***********************************************"<<endl;
|
||||
|
||||
|
||||
return 0;
|
||||
}/*
|
||||
static int Main(int AI_ArgCnt=0, char* APP_ArgVal[]=0)*/
|
||||
|
||||
|
||||
public:
|
||||
};/*
|
||||
template<typename TDummy=void*> class ZtCExamCLinkList*/
|
||||
|
||||
}/*
|
||||
namespace ZNsExam*/
|
||||
|
||||
}/*
|
||||
namespace ZNsMain*/
|
||||
|
||||
|
||||
int main(int AI_ArgCnt, char* APP_ArgVal[])
|
||||
{
|
||||
return ZNsMain::ZNsExam::
|
||||
|
||||
ZtCExamCLinkList<>::Main(AI_ArgCnt, APP_ArgVal);
|
||||
}/*
|
||||
int main(int AI_ArgCnt, char* APP_ArgVal[])*/
|
||||
|
||||
|
||||
/*////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
<EFBFBD><EFBFBD> cygwin <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
// g++ -mno-cygwin -o ZtCLinkList_000.exe ZtCLinkList_000.cpp -I../../my_CPP/CPP_Main/ -I../../my_CPP/CPP_Std/ -D__CYGWIN32__ -D__VISUAL_CPP_VER__=200300
|
||||
// g++ -mno-cygwin -o ZtCLinkList_000_D.exe ZtCLinkList_000.cpp -I../../my_CPP/CPP_Main/ -I../../my_CPP/CPP_Std/ -D__CYGWIN32__ -D__VISUAL_CPP_VER__=200300 -D_DEBUG
|
||||
|
||||
<EFBFBD><EFBFBD> mingw <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
g++.exe -o ZtCLinkList_000_mw.exe ZtCLinkList_000.cpp -I../ -lWs2_32
|
||||
g++.exe -o ZtCLinkList_000_mw_D.exe ZtCLinkList_000.cpp -I../ -lWs2_32 -D_DEBUG
|
||||
|
||||
./ZtCLinkList_000_mw.exe
|
||||
./ZtCLinkList_000_mw_D.exe
|
||||
|
||||
|
||||
Administrator@q381-2673 UCRT64 /e/my_CPP/ZCpp/ZCppMainTest
|
||||
# date
|
||||
Sun Aug 24 10:47:09 KST 2025
|
||||
|
||||
Administrator@q381-2673 UCRT64 /e/my_CPP/ZCpp/ZCppMainTest
|
||||
# g++ --version
|
||||
g++.exe (Rev2, Built by MSYS2 project) 13.2.0
|
||||
Copyright (C) 2023 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
<EFBFBD><EFBFBD> Linux <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
g++ -std=c++98 -o ZtCLinkList_000.exe ZtCLinkList_000.cpp -I../
|
||||
g++ -std=c++98 -o ZtCLinkList_000_D.exe ZtCLinkList_000.cpp -I../ -D_DEBUG
|
||||
|
||||
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ gcc --version
|
||||
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ date
|
||||
Sun Aug 24 00:05:51 DST 2025
|
||||
|
||||
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ cat /etc/os-release
|
||||
NAME="Ubuntu"
|
||||
VERSION="20.04.6 LTS (Focal Fossa)"
|
||||
ID=ubuntu
|
||||
ID_LIKE=debian
|
||||
PRETTY_NAME="Ubuntu 20.04.6 LTS"
|
||||
VERSION_ID="20.04"
|
||||
HOME_URL="https://www.ubuntu.com/"
|
||||
SUPPORT_URL="https://help.ubuntu.com/"
|
||||
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
|
||||
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
|
||||
VERSION_CODENAME=focal
|
||||
UBUNTU_CODENAME=focal
|
||||
|
||||
|
||||
[sauron@q381-2657 ZCppMainTest]$ cat /etc/centos-release
|
||||
CentOS Linux release 7.9.2009 (Core)
|
||||
|
||||
[sauron@q381-2657 ZCppMainTest]$ g++ --version
|
||||
g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
|
||||
Copyright (C) 2015 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
|
||||
./ZtCLinkList_000.exe
|
||||
./ZtCLinkList_000_D.exe
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////*/
|
324
ZCppMainTest/ZtCLinkList_001.cpp
Normal file
324
ZCppMainTest/ZtCLinkList_001.cpp
Normal file
@ -0,0 +1,324 @@
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include "ZCppMain/ZtCLinkList.H"
|
||||
|
||||
|
||||
using namespace std ;
|
||||
using namespace ZNsMain ;
|
||||
|
||||
|
||||
namespace ZNsMain
|
||||
{
|
||||
|
||||
namespace ZNsExam
|
||||
{
|
||||
|
||||
template<typename TDummy=void*> class ZtCExamCLinkList
|
||||
{
|
||||
public:
|
||||
|
||||
class ZCLinkData : public ZNsIFaceEx::ZtCLink<ZCEmpty, ZCLinkData>
|
||||
{
|
||||
private:
|
||||
string mo_DataCStr;
|
||||
private:
|
||||
static int SI_CallCnt;
|
||||
public :
|
||||
typedef ZNsIFaceEx::ZtCLink<ZCEmpty, ZCLinkData> TypeBase;
|
||||
public :
|
||||
|
||||
ZCLinkData() : ZNsIFaceEx::ZtCLink<ZCEmpty, ZCLinkData>()
|
||||
{
|
||||
cout<<"* ZCLinkData() : "<<++ZCLinkData::SI_CallCnt<<endl;
|
||||
}
|
||||
ZCLinkData(const ZCLinkData& rhs) :
|
||||
ZNsIFaceEx::
|
||||
ZtCLink<ZCEmpty, ZCLinkData>(),
|
||||
mo_DataCStr(rhs.mo_DataCStr)
|
||||
{cout<<"* ZCLinkData(const ZCLinkData& rhs) : "<<++ZCLinkData::SI_CallCnt<<endl;}
|
||||
|
||||
ZCLinkData(const TypeBase& rhs) :
|
||||
ZNsIFaceEx::
|
||||
ZtCLink<ZCEmpty, ZCLinkData>(),
|
||||
mo_DataCStr
|
||||
(
|
||||
(*static_cast<const ZCLinkData*>(&rhs)).mo_DataCStr
|
||||
)
|
||||
{cout<<"* ZCLinkData(const TypeBase& rhs) : "<<++ZCLinkData::SI_CallCnt<<endl;}
|
||||
|
||||
|
||||
~ZCLinkData()
|
||||
{
|
||||
cout<<"* ~ZCLinkData() : "<<ZCLinkData::SI_CallCnt--<<endl;
|
||||
}
|
||||
|
||||
|
||||
ZCLinkData& operator=(const ZCLinkData& rhs)
|
||||
{
|
||||
mo_DataCStr = rhs.mo_DataCStr; return *this;
|
||||
}/*
|
||||
ZCLinkData& operator=(const ZCLinkData& rhs)*/
|
||||
|
||||
/***/ string& GetData() {return mo_DataCStr;}
|
||||
const string& GetData() const{return mo_DataCStr;}
|
||||
|
||||
public :
|
||||
};/*
|
||||
class ZCLinkData : public ZNsIFaceEx::ZtCLink<ZCEmpty, ZCLinkData>*/
|
||||
|
||||
|
||||
typedef ZNsIFaceEx::ZtCLink
|
||||
<ZCEmpty, ZCLinkData> ZCLinkBase;
|
||||
|
||||
public:
|
||||
typedef ZCLinkData ZCLinkCStr ;
|
||||
typedef ZtCLinkList<ZCLinkBase> ZCLinkStrList;
|
||||
typedef typename
|
||||
ZCLinkStrList::ZCLinkOpt ZCStrLinkOpt ;
|
||||
public:
|
||||
|
||||
|
||||
static void ShowNode0(ZCLinkBase& AR_CLink, ZTypLong& ARRI_CallCnt)
|
||||
{
|
||||
++ARRI_CallCnt;
|
||||
|
||||
cout<<ARRI_CallCnt<<" * Node Curr : "<<(AR_CLink)().GetData()<<endl;
|
||||
}/*
|
||||
static void ShowNode0(ZCLinkBase& AR_CLink, ZTypLong& ARRI_CallCnt)*/
|
||||
|
||||
static void ShowNode1(ZCLinkBase& AR_CLink, ZTypLong& ARRI_CallCnt)
|
||||
{
|
||||
++ARRI_CallCnt;
|
||||
|
||||
cout<<ARRI_CallCnt<<" * Node Prev : "<<(AR_CLink-1)().GetData()<<endl;
|
||||
cout<<ARRI_CallCnt<<" * Node Curr : " <<(AR_CLink )().GetData()<<endl;
|
||||
cout<<ARRI_CallCnt<<" * Node Next : "<<(AR_CLink+1)().GetData()<<endl;
|
||||
}/*
|
||||
static void ShowNode1(ZCLinkBase& AR_CLink, ZTypLong& ARRI_CallCnt)*/
|
||||
|
||||
|
||||
static void AppendEach(ZCLinkBase& AR_CLink)
|
||||
{
|
||||
AR_CLink().GetData().append("_");
|
||||
}/*
|
||||
static void AppendEach(ZCLinkBase& AR_CLink)*/
|
||||
|
||||
|
||||
static int Main(int AI_ArgCnt=0, char* APP_ArgVal[]=0)
|
||||
{
|
||||
ZTypLong VI_CallCnt = 0 ;
|
||||
ZCLinkStrList VO_ZCLinkStrLis1;
|
||||
ZCLinkStrList VO_ZCLinkStrLis2;
|
||||
ZCStrLinkOpt VO_StrLinkOpt = VO_ZCLinkStrLis1.GetObjOpt(1);
|
||||
|
||||
cout<<"# VO_StrLinkOpt.has_value()="<<VO_StrLinkOpt.has_value()<<endl;
|
||||
cout<<"# VO_StrLinkOpt.bool() ="<<bool(VO_StrLinkOpt) <<endl;
|
||||
|
||||
VO_ZCLinkStrLis1.AddTail()().GetData()=string("123");
|
||||
VO_ZCLinkStrLis1.AddTail()().GetData()=string("ABC");
|
||||
VO_ZCLinkStrLis1.AddTail()().GetData()=string("xyz");
|
||||
|
||||
VO_ZCLinkStrLis2.AddTail()().GetData()=string("Z01");
|
||||
VO_ZCLinkStrLis2.AddTail()().GetData()=string("Z02");
|
||||
VO_ZCLinkStrLis2.AddTail()().GetData()=string("Z03");
|
||||
|
||||
VO_StrLinkOpt = VO_ZCLinkStrLis1.GetObjOpt(1);
|
||||
|
||||
cout<<"# VO_StrLinkOpt.GetObjOpt(1) : has_value()="<<VO_StrLinkOpt.has_value()<<endl;
|
||||
cout<<"# VO_StrLinkOpt.GetObjOpt(1) : bool ()="<<bool(VO_StrLinkOpt) <<endl;
|
||||
|
||||
if(VO_StrLinkOpt.has_value())
|
||||
cout<<"# value by VO_StrLinkOpt : "<<VO_StrLinkOpt.value()().GetData()<<endl;
|
||||
|
||||
VO_StrLinkOpt = VO_ZCLinkStrLis1.GetTailOpt();
|
||||
|
||||
cout<<"# VO_StrLinkOpt.GetTailOpt() : has_value()="<<VO_StrLinkOpt.has_value()<<endl;
|
||||
cout<<"# VO_StrLinkOpt.GetTailOpt() : bool ()="<<bool(VO_StrLinkOpt) <<endl;
|
||||
|
||||
if(VO_StrLinkOpt.has_value())
|
||||
cout<<"# value by VO_StrLinkOpt : "<<VO_StrLinkOpt.value()().GetData()<<endl;
|
||||
|
||||
|
||||
cout<<"+++++++++++++++++++++++++++++++++++++++++++++++"<<endl;
|
||||
VO_ZCLinkStrLis1.IterElement(&ShowNode0, ZftMCP(VI_CallCnt=0));
|
||||
cout<<"***********************************************"<<endl;
|
||||
VO_ZCLinkStrLis1.IterElement(&ShowNode1, ZftMCP(VI_CallCnt=0));
|
||||
|
||||
|
||||
VO_ZCLinkStrLis1.JoinHead(VO_ZCLinkStrLis2);
|
||||
|
||||
cout<<"# after VO_ZCLinkStrLis1.JoinHead(VO_ZCLinkStrLis2)"<<endl;
|
||||
|
||||
cout<<"+++++++++++++++++++++++++++++++++++++++++++++++"<<endl;
|
||||
VO_ZCLinkStrLis2.IterElement(&ShowNode0, ZftMCP(VI_CallCnt=0));
|
||||
cout<<"***********************************************"<<endl;
|
||||
VO_ZCLinkStrLis1.IterElement(&ShowNode0, ZftMCP(VI_CallCnt=0));
|
||||
cout<<"***********************************************"<<endl;
|
||||
VO_ZCLinkStrLis1.IterElement(&ShowNode1, ZftMCP(VI_CallCnt=0));
|
||||
|
||||
|
||||
VO_ZCLinkStrLis2 = VO_ZCLinkStrLis1 ;
|
||||
|
||||
cout<<"# after VO_ZCLinkStrLis2 = VO_ZCLinkStrLis1"<<endl;
|
||||
|
||||
cout<<"+++++++++++++++++++++++++++++++++++++++++++++++"<<endl;
|
||||
VO_ZCLinkStrLis2.IterElement(&ShowNode0, ZftMCP(VI_CallCnt=0));
|
||||
cout<<"***********************************************"<<endl;
|
||||
VO_ZCLinkStrLis1.IterElement(&ShowNode0, ZftMCP(VI_CallCnt=0));
|
||||
cout<<"***********************************************"<<endl;
|
||||
|
||||
|
||||
VO_ZCLinkStrLis1.IterElement(&AppendEach);
|
||||
cout<<"***********************************************"<<endl;
|
||||
VO_ZCLinkStrLis1.IterElement(&ShowNode0, ZftMCP(VI_CallCnt=0));
|
||||
cout<<"***********************************************"<<endl;
|
||||
|
||||
VO_ZCLinkStrLis1.SendRangeOutAfter
|
||||
(
|
||||
VO_ZCLinkStrLis1.GetObjOpt(1).value()
|
||||
, VO_ZCLinkStrLis1.GetObjOpt(2).value()
|
||||
, 2
|
||||
, VO_ZCLinkStrLis2
|
||||
, VO_ZCLinkStrLis2.GetObjOpt(1)
|
||||
) ;
|
||||
cout<<"# after VO_ZCLinkStrLis1.SendRangeOutAfter(1th, 2th, 2, rhs, rhs's 1th)"<<endl;
|
||||
|
||||
cout<<"+++++++++++++++++++++++++++++++++++++++++++++++"<<endl;
|
||||
VO_ZCLinkStrLis2.IterElement(&ShowNode0, ZftMCP(VI_CallCnt=0));
|
||||
cout<<"***********************************************"<<endl;
|
||||
VO_ZCLinkStrLis1.IterElement(&ShowNode0, ZftMCP(VI_CallCnt=0));
|
||||
cout<<"***********************************************"<<endl;
|
||||
|
||||
|
||||
VO_ZCLinkStrLis2.SendRangeOutBefore
|
||||
(
|
||||
VO_ZCLinkStrLis2.GetObjOpt(7).value()
|
||||
, VO_ZCLinkStrLis2.GetObjOpt(8).value()
|
||||
, 2
|
||||
, VO_ZCLinkStrLis1
|
||||
, VO_ZCLinkStrLis1.GetObjOpt(1)
|
||||
) ;
|
||||
cout<<"# after VO_ZCLinkStrLis2.SendRangeOutAfter(7th, 8th, 2, rhs, rhs's 1th)"<<endl;
|
||||
|
||||
cout<<"+++++++++++++++++++++++++++++++++++++++++++++++"<<endl;
|
||||
VO_ZCLinkStrLis2.IterElement(&ShowNode0, ZftMCP(VI_CallCnt=0));
|
||||
cout<<"***********************************************"<<endl;
|
||||
VO_ZCLinkStrLis1.IterElement(&ShowNode0, ZftMCP(VI_CallCnt=0));
|
||||
cout<<"***********************************************"<<endl;
|
||||
|
||||
|
||||
VO_ZCLinkStrLis2.CopyThis( RR(VO_ZCLinkStrLis1) );
|
||||
cout<<"# after VO_ZCLinkStrLis2.CopyThis( RR(VO_ZCLinkStrLis1) )"<<endl;
|
||||
|
||||
cout<<"+++++++++++++++++++++++++++++++++++++++++++++++"<<endl;
|
||||
VO_ZCLinkStrLis2.IterElement(&ShowNode0, ZftMCP(VI_CallCnt=0));
|
||||
cout<<"***********************************************"<<endl;
|
||||
VO_ZCLinkStrLis1.IterElement(&ShowNode0, ZftMCP(VI_CallCnt=0));
|
||||
cout<<"***********************************************"<<endl;
|
||||
|
||||
|
||||
return 0;
|
||||
}/*
|
||||
static int Main(int AI_ArgCnt=0, char* APP_ArgVal[]=0)*/
|
||||
|
||||
|
||||
public:
|
||||
};/*
|
||||
template<typename TDummy=void*> class ZtCExamCLinkList*/
|
||||
|
||||
|
||||
|
||||
template<typename TDummy> int
|
||||
ZtCExamCLinkList<TDummy>::ZCLinkData::SI_CallCnt(0) ;
|
||||
|
||||
|
||||
}/*
|
||||
namespace ZNsExam*/
|
||||
|
||||
}/*
|
||||
namespace ZNsMain*/
|
||||
|
||||
|
||||
int main(int AI_ArgCnt, char* APP_ArgVal[])
|
||||
{
|
||||
return ZNsMain::ZNsExam::
|
||||
|
||||
ZtCExamCLinkList<>::Main(AI_ArgCnt, APP_ArgVal);
|
||||
}/*
|
||||
int main(int AI_ArgCnt, char* APP_ArgVal[])*/
|
||||
|
||||
|
||||
/*////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
<EFBFBD><EFBFBD> cygwin <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
// g++ -mno-cygwin -o ZtCLinkList_001.exe ZtCLinkList_001.cpp -I../../my_CPP/CPP_Main/ -I../../my_CPP/CPP_Std/ -D__CYGWIN32__ -D__VISUAL_CPP_VER__=200300
|
||||
// g++ -mno-cygwin -o ZtCLinkList_001_D.exe ZtCLinkList_001.cpp -I../../my_CPP/CPP_Main/ -I../../my_CPP/CPP_Std/ -D__CYGWIN32__ -D__VISUAL_CPP_VER__=200300 -D_DEBUG
|
||||
|
||||
<EFBFBD><EFBFBD> mingw <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
g++.exe -o ZtCLinkList_001_mw.exe ZtCLinkList_001.cpp -I../ -lWs2_32
|
||||
g++.exe -o ZtCLinkList_001_mw_D.exe ZtCLinkList_001.cpp -I../ -lWs2_32 -D_DEBUG
|
||||
|
||||
./ZtCLinkList_001_mw.exe
|
||||
./ZtCLinkList_001_mw_D.exe
|
||||
|
||||
|
||||
Administrator@q381-2673 UCRT64 /e/my_CPP/ZCpp/ZCppMainTest
|
||||
# date
|
||||
Sun Aug 24 10:47:09 KST 2025
|
||||
|
||||
Administrator@q381-2673 UCRT64 /e/my_CPP/ZCpp/ZCppMainTest
|
||||
# g++ --version
|
||||
g++.exe (Rev2, Built by MSYS2 project) 13.2.0
|
||||
Copyright (C) 2023 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
<EFBFBD><EFBFBD> Linux <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
g++ -std=c++98 -o ZtCLinkList_001.exe ZtCLinkList_001.cpp -I../
|
||||
g++ -std=c++98 -o ZtCLinkList_001_D.exe ZtCLinkList_001.cpp -I../ -D_DEBUG
|
||||
|
||||
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ gcc --version
|
||||
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ date
|
||||
Sun Aug 24 00:05:51 DST 2025
|
||||
|
||||
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ cat /etc/os-release
|
||||
NAME="Ubuntu"
|
||||
VERSION="20.04.6 LTS (Focal Fossa)"
|
||||
ID=ubuntu
|
||||
ID_LIKE=debian
|
||||
PRETTY_NAME="Ubuntu 20.04.6 LTS"
|
||||
VERSION_ID="20.04"
|
||||
HOME_URL="https://www.ubuntu.com/"
|
||||
SUPPORT_URL="https://help.ubuntu.com/"
|
||||
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
|
||||
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
|
||||
VERSION_CODENAME=focal
|
||||
UBUNTU_CODENAME=focal
|
||||
|
||||
|
||||
[sauron@q381-2657 ZCppMainTest]$ cat /etc/centos-release
|
||||
CentOS Linux release 7.9.2009 (Core)
|
||||
|
||||
[sauron@q381-2657 ZCppMainTest]$ g++ --version
|
||||
g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
|
||||
Copyright (C) 2015 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
|
||||
./ZtCLinkList_001.exe
|
||||
./ZtCLinkList_001_D.exe
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////*/
|
260
ZCppMainTest/ZtCLinkMoveList_000.cpp
Normal file
260
ZCppMainTest/ZtCLinkMoveList_000.cpp
Normal file
@ -0,0 +1,260 @@
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include "ZCppMain/ZtCLinkList.H"
|
||||
|
||||
|
||||
using namespace std ;
|
||||
using namespace ZNsMain ;
|
||||
|
||||
|
||||
namespace ZNsMain
|
||||
{
|
||||
|
||||
namespace ZNsExam
|
||||
{
|
||||
|
||||
template<typename TDummy=void*> class ZtCExamCLinkList
|
||||
{
|
||||
public:
|
||||
typedef ZNsIFaceEx::ZtCLink<string, ZCEmpty> ZCLinkCStr ;
|
||||
typedef ZtCLinkMoveList<ZCLinkCStr> ZCLinkStrList;
|
||||
typedef ZCLinkStrList::ZCLinkOpt ZCStrLinkOpt ;
|
||||
public:
|
||||
|
||||
|
||||
static void ShowNode0(ZCLinkCStr& AR_CLink, ZTypLong& ARRI_CallCnt)
|
||||
{
|
||||
++ARRI_CallCnt; cout<<ARRI_CallCnt<<" * Node Curr : "<<(AR_CLink)()<<endl;
|
||||
}/*
|
||||
static void ShowNode0(ZCLinkCStr& AR_CLink, ZTypLong& ARRI_CallCnt)*/
|
||||
|
||||
static void ShowNode1(ZCLinkCStr& AR_CLink, ZTypLong& ARRI_CallCnt)
|
||||
{
|
||||
++ARRI_CallCnt;
|
||||
|
||||
cout<<ARRI_CallCnt<<" * Node Prev : "<<(AR_CLink-1)()<<endl;
|
||||
cout<<ARRI_CallCnt<<" * Node Curr : " <<(AR_CLink )()<<endl;
|
||||
cout<<ARRI_CallCnt<<" * Node Next : "<<(AR_CLink+1)()<<endl;
|
||||
}/*
|
||||
static void ShowNode1(ZCLinkCStr& AR_CLink, ZTypLong& ARRI_CallCnt)*/
|
||||
|
||||
|
||||
static void AppendEach(ZCLinkCStr& AR_CLink)
|
||||
{
|
||||
AR_CLink().append("_");
|
||||
}/*
|
||||
static void AppendEach(ZCLinkCStr& AR_CLink)*/
|
||||
|
||||
|
||||
static int Main(int AI_ArgCnt=0, char* APP_ArgVal[]=0)
|
||||
{
|
||||
ZTypLong VI_CallCnt = 0 ;
|
||||
ZCLinkStrList VO_ZCLinkStrLis1;
|
||||
ZCLinkStrList VO_ZCLinkStrLis2;
|
||||
ZCStrLinkOpt VO_StrLinkOpt = VO_ZCLinkStrLis1.GetObjOpt(1);
|
||||
|
||||
cout<<"# VO_StrLinkOpt.has_value()="<<VO_StrLinkOpt.has_value()<<endl;
|
||||
cout<<"# VO_StrLinkOpt.bool() ="<<bool(VO_StrLinkOpt) <<endl;
|
||||
|
||||
VO_ZCLinkStrLis1.AddTail()()=string("123");
|
||||
VO_ZCLinkStrLis1.AddTail()()=string("ABC");
|
||||
VO_ZCLinkStrLis1.AddTail()()=string("xyz");
|
||||
|
||||
VO_ZCLinkStrLis2.AddTail()()=string("Z01");
|
||||
VO_ZCLinkStrLis2.AddTail()()=string("Z02");
|
||||
VO_ZCLinkStrLis2.AddTail()()=string("Z03");
|
||||
|
||||
VO_StrLinkOpt = VO_ZCLinkStrLis1.GetObjOpt(1);
|
||||
|
||||
cout<<"# VO_StrLinkOpt.GetObjOpt(1) : has_value()="<<VO_StrLinkOpt.has_value()<<endl;
|
||||
cout<<"# VO_StrLinkOpt.GetObjOpt(1) : bool ()="<<bool(VO_StrLinkOpt) <<endl;
|
||||
|
||||
if(VO_StrLinkOpt.has_value())
|
||||
cout<<"# value by VO_StrLinkOpt : "<<VO_StrLinkOpt.value()<<endl;
|
||||
|
||||
VO_StrLinkOpt = VO_ZCLinkStrLis1.GetTailOpt();
|
||||
|
||||
cout<<"# VO_StrLinkOpt.GetTailOpt() : has_value()="<<VO_StrLinkOpt.has_value()<<endl;
|
||||
cout<<"# VO_StrLinkOpt.GetTailOpt() : bool ()="<<bool(VO_StrLinkOpt) <<endl;
|
||||
|
||||
if(VO_StrLinkOpt.has_value())
|
||||
cout<<"# value by VO_StrLinkOpt : "<<VO_StrLinkOpt.value()<<endl;
|
||||
|
||||
|
||||
cout<<"+++++++++++++++++++++++++++++++++++++++++++++++"<<endl;
|
||||
VO_ZCLinkStrLis1.IterElement(&ShowNode0, ZftMCP(VI_CallCnt=0));
|
||||
cout<<"***********************************************"<<endl;
|
||||
VO_ZCLinkStrLis1.IterElement(&ShowNode1, ZftMCP(VI_CallCnt=0));
|
||||
|
||||
|
||||
VO_ZCLinkStrLis1.JoinHead(VO_ZCLinkStrLis2);
|
||||
|
||||
cout<<"# after VO_ZCLinkStrLis1.JoinHead(VO_ZCLinkStrLis2)"<<endl;
|
||||
|
||||
cout<<"+++++++++++++++++++++++++++++++++++++++++++++++"<<endl;
|
||||
VO_ZCLinkStrLis2.IterElement(&ShowNode0, ZftMCP(VI_CallCnt=0));
|
||||
cout<<"***********************************************"<<endl;
|
||||
VO_ZCLinkStrLis1.IterElement(&ShowNode0, ZftMCP(VI_CallCnt=0));
|
||||
cout<<"***********************************************"<<endl;
|
||||
VO_ZCLinkStrLis1.IterElement(&ShowNode1, ZftMCP(VI_CallCnt=0));
|
||||
|
||||
|
||||
VO_ZCLinkStrLis2 = VO_ZCLinkStrLis1 ;
|
||||
|
||||
cout<<"# after VO_ZCLinkStrLis2 = VO_ZCLinkStrLis1"<<endl;
|
||||
|
||||
cout<<"+++++++++++++++++++++++++++++++++++++++++++++++"<<endl;
|
||||
VO_ZCLinkStrLis2.IterElement(&ShowNode0, ZftMCP(VI_CallCnt=0));
|
||||
cout<<"***********************************************"<<endl;
|
||||
VO_ZCLinkStrLis1.IterElement(&ShowNode0, ZftMCP(VI_CallCnt=0));
|
||||
cout<<"***********************************************"<<endl;
|
||||
|
||||
|
||||
VO_ZCLinkStrLis1.IterElement(&AppendEach);
|
||||
cout<<"***********************************************"<<endl;
|
||||
VO_ZCLinkStrLis1.IterElement(&ShowNode0, ZftMCP(VI_CallCnt=0));
|
||||
cout<<"***********************************************"<<endl;
|
||||
|
||||
VO_ZCLinkStrLis1.SendRangeOutAfter
|
||||
(
|
||||
VO_ZCLinkStrLis1.GetObjOpt(1).value()
|
||||
, VO_ZCLinkStrLis1.GetObjOpt(2).value()
|
||||
, 2
|
||||
, VO_ZCLinkStrLis2
|
||||
, VO_ZCLinkStrLis2.GetObjOpt(1)
|
||||
) ;
|
||||
cout<<"# after VO_ZCLinkStrLis1.SendRangeOutAfter(1th, 2th, 2, rhs, rhs's 1th)"<<endl;
|
||||
|
||||
cout<<"+++++++++++++++++++++++++++++++++++++++++++++++"<<endl;
|
||||
VO_ZCLinkStrLis2.IterElement(&ShowNode0, ZftMCP(VI_CallCnt=0));
|
||||
cout<<"***********************************************"<<endl;
|
||||
VO_ZCLinkStrLis1.IterElement(&ShowNode0, ZftMCP(VI_CallCnt=0));
|
||||
cout<<"***********************************************"<<endl;
|
||||
|
||||
|
||||
VO_ZCLinkStrLis2.SendRangeOutBefore
|
||||
(
|
||||
VO_ZCLinkStrLis2.GetObjOpt(2).value()
|
||||
, VO_ZCLinkStrLis2.GetObjOpt(3).value()
|
||||
, 2
|
||||
, VO_ZCLinkStrLis1
|
||||
, VO_ZCLinkStrLis1.GetObjOpt(1)
|
||||
) ;
|
||||
cout<<"# after VO_ZCLinkStrLis2.SendRangeOutBefore(VO_ZCLinkStrLis2 2th, 3th, 2, rhs, rhs's 1th)"<<endl;
|
||||
|
||||
cout<<"+++++++++++++++++++++++++++++++++++++++++++++++"<<endl;
|
||||
VO_ZCLinkStrLis2.IterElement(&ShowNode0, ZftMCP(VI_CallCnt=0));
|
||||
cout<<"***********************************************"<<endl;
|
||||
VO_ZCLinkStrLis1.IterElement(&ShowNode0, ZftMCP(VI_CallCnt=0));
|
||||
cout<<"***********************************************"<<endl;
|
||||
|
||||
|
||||
VO_ZCLinkStrLis2.CopyThis(VO_ZCLinkStrLis1);
|
||||
cout<<"# after VO_ZCLinkStrLis2.CopyThis(VO_ZCLinkStrLis1)"<<endl;
|
||||
|
||||
cout<<"+++++++++++++++++++++++++++++++++++++++++++++++"<<endl;
|
||||
VO_ZCLinkStrLis2.IterElement(&ShowNode0, ZftMCP(VI_CallCnt=0));
|
||||
cout<<"***********************************************"<<endl;
|
||||
VO_ZCLinkStrLis1.IterElement(&ShowNode0, ZftMCP(VI_CallCnt=0));
|
||||
cout<<"***********************************************"<<endl;
|
||||
|
||||
|
||||
return 0;
|
||||
}/*
|
||||
static int Main(int AI_ArgCnt=0, char* APP_ArgVal[]=0)*/
|
||||
|
||||
|
||||
public:
|
||||
};/*
|
||||
template<typename TDummy=void*> class ZtCExamCLinkList*/
|
||||
|
||||
}/*
|
||||
namespace ZNsExam*/
|
||||
|
||||
}/*
|
||||
namespace ZNsMain*/
|
||||
|
||||
|
||||
int main(int AI_ArgCnt, char* APP_ArgVal[])
|
||||
{
|
||||
return ZNsMain::ZNsExam::
|
||||
|
||||
ZtCExamCLinkList<>::Main(AI_ArgCnt, APP_ArgVal);
|
||||
}/*
|
||||
int main(int AI_ArgCnt, char* APP_ArgVal[])*/
|
||||
|
||||
|
||||
/*////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
<EFBFBD><EFBFBD> cygwin <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
// g++ -mno-cygwin -o ZtCLinkMoveList_000.exe ZtCLinkMoveList_000.cpp -I../../my_CPP/CPP_Main/ -I../../my_CPP/CPP_Std/ -D__CYGWIN32__ -D__VISUAL_CPP_VER__=200300
|
||||
// g++ -mno-cygwin -o ZtCLinkMoveList_000_D.exe ZtCLinkMoveList_000.cpp -I../../my_CPP/CPP_Main/ -I../../my_CPP/CPP_Std/ -D__CYGWIN32__ -D__VISUAL_CPP_VER__=200300 -D_DEBUG
|
||||
|
||||
<EFBFBD><EFBFBD> mingw <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
g++.exe -o ZtCLinkMoveList_000_mw.exe ZtCLinkMoveList_000.cpp -I../ -lWs2_32
|
||||
g++.exe -o ZtCLinkMoveList_000_mw_D.exe ZtCLinkMoveList_000.cpp -I../ -lWs2_32 -D_DEBUG
|
||||
|
||||
./ZtCLinkMoveList_000_mw.exe
|
||||
./ZtCLinkMoveList_000_mw_D.exe
|
||||
|
||||
|
||||
Administrator@q381-2673 UCRT64 /e/my_CPP/ZCpp/ZCppMainTest
|
||||
# date
|
||||
Sun Aug 24 10:47:09 KST 2025
|
||||
|
||||
Administrator@q381-2673 UCRT64 /e/my_CPP/ZCpp/ZCppMainTest
|
||||
# g++ --version
|
||||
g++.exe (Rev2, Built by MSYS2 project) 13.2.0
|
||||
Copyright (C) 2023 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
<EFBFBD><EFBFBD> Linux <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
g++ -std=c++98 -o ZtCLinkMoveList_000.exe ZtCLinkMoveList_000.cpp -I../
|
||||
g++ -std=c++98 -o ZtCLinkMoveList_000_D.exe ZtCLinkMoveList_000.cpp -I../ -D_DEBUG
|
||||
|
||||
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ gcc --version
|
||||
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ date
|
||||
Sun Aug 24 00:05:51 DST 2025
|
||||
|
||||
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ cat /etc/os-release
|
||||
NAME="Ubuntu"
|
||||
VERSION="20.04.6 LTS (Focal Fossa)"
|
||||
ID=ubuntu
|
||||
ID_LIKE=debian
|
||||
PRETTY_NAME="Ubuntu 20.04.6 LTS"
|
||||
VERSION_ID="20.04"
|
||||
HOME_URL="https://www.ubuntu.com/"
|
||||
SUPPORT_URL="https://help.ubuntu.com/"
|
||||
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
|
||||
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
|
||||
VERSION_CODENAME=focal
|
||||
UBUNTU_CODENAME=focal
|
||||
|
||||
|
||||
[sauron@q381-2657 ZCppMainTest]$ cat /etc/centos-release
|
||||
CentOS Linux release 7.9.2009 (Core)
|
||||
|
||||
[sauron@q381-2657 ZCppMainTest]$ g++ --version
|
||||
g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
|
||||
Copyright (C) 2015 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
|
||||
./ZtCLinkMoveList_000.exe
|
||||
./ZtCLinkMoveList_000_D.exe
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////*/
|
270
ZCppMainTest/ZtCLoadXml_000.cpp
Normal file
270
ZCppMainTest/ZtCLoadXml_000.cpp
Normal file
@ -0,0 +1,270 @@
|
||||
|
||||
|
||||
#include "ZCppMain/ZtCLoadXml.H"
|
||||
|
||||
|
||||
namespace ZNsMain
|
||||
{
|
||||
|
||||
namespace ZNsExam
|
||||
{
|
||||
|
||||
template<typename TDymmy=void*> class ZtExamLoadXml
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
/* 아래 Main() 함수 선언을 아래로 하면
|
||||
|
||||
static int Main(int AI_ArgCnt=0, const char* APP_ArgVal[]=0)
|
||||
|
||||
mingw g++ 에서 희한하게 에러다.
|
||||
|
||||
Administrator@q381-2673 UCRT64 /e/my_CPP/ZCpp/ZCppMainTest
|
||||
# g++.exe -o ZtCLoadXml_000_mw.exe ZtCLoadXml_000.cpp -I../ -lWs2_32
|
||||
ZtCLoadXml_000.cpp: In function 'int main(int, char**)':
|
||||
ZtCLoadXml_000.cpp:171:42: error: invalid conversion from 'char**' to 'const char**' [-fpermissive]
|
||||
171 | ZtExamLoadXml<>::Main(AI_ArgCnt, APP_ArgVal);
|
||||
| ^~~~~~~~~~
|
||||
| |
|
||||
| char**
|
||||
ZtCLoadXml_000.cpp:16:58: note: initializing argument 2 of 'static int ZNsMain::ZNsExam::ZtExamLoadXml<TDymmy>::Main(int, const char**) [with TDymmy = void*]'
|
||||
16 | static int Main(int AI_ArgCnt=0, const char* APP_ArgVal[]=0)
|
||||
| ~~~~~~~~~~~~^~~~~~~~~~~~~~
|
||||
|
||||
*/
|
||||
static int Main(int AI_ArgCnt=0, char* APP_ArgVal[]=0)
|
||||
{
|
||||
typedef ZNsMain::ZtCStringBase<char> ZCStringData ;
|
||||
|
||||
typedef ZNsMain::ZNsViewIFace::ZNsExam::ZtCViewLoadXml<
|
||||
ZCStringData
|
||||
/*/////////*/ > ZCViewLoadXml; ////////////////////////
|
||||
typedef ZNsMain::ZNsType::ZtCTypeXmlInfo<
|
||||
ZCStringData
|
||||
/*/////////*/ > ZCTypeXmlInfo; ////////////////////////
|
||||
|
||||
typedef ZNsMain::ZtCXmlInfo<ZCTypeXmlInfo> ZCXmlInfo;
|
||||
typedef ZNsMain::ZNsView::ZtCViewLoadXmlOfXmlInfo<
|
||||
ZCXmlInfo
|
||||
/*/////////*/ > ZCViewLoadXmlOfXmlInfo; ///////////////
|
||||
typedef ZNsMain::ZtCLoadXml<ZCStringData> ZCLoadXml;
|
||||
|
||||
|
||||
const char* CPC_XmlData1=
|
||||
"<!-- My Comment0 --><? Header ?>\n"
|
||||
"<!DOCTYPE ele0[ \n"
|
||||
"<!ELEMENT ele1>\n"
|
||||
"<!ATTLIST prop>\n"
|
||||
"]>\n"
|
||||
"<ele0 prop0 = \"prop00\" /><!-- My Comment1 -->\n"
|
||||
"<ele1>ele1 data</ele1> <!-- My Comment2 -> ---- --->\n"
|
||||
"<ele2 >ele2 data</ele2>\n"
|
||||
"<요소3 prop1= \"prop1 value\" prop2 = \"prop2 value\" >"
|
||||
" <ele3_1 prop3=\"prop3 value\" prop33=\"prop33 value\" > MyData"
|
||||
" </ele3_1>\n"
|
||||
" <ele3_2 prop4=\"prop4 value\" prop44=\"prop44 value\" > <![CDATA[ myCDATA ]]>\n"
|
||||
" </ele3_2> \n"
|
||||
"</요소3"
|
||||
;
|
||||
const char* CPC_XmlData2=
|
||||
">\n<ele4 >ele4 data\n"
|
||||
"</ele4>\n"
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
|
||||
const char* CPC_XmlDataOfID=
|
||||
"<?xml version=\"1.0\" encoding=\"euc-kr\" ?>\n"
|
||||
"<!DOCTYPE data[\n"
|
||||
"<!ELEMENT data ANY>\n"
|
||||
"<!ENTITY nbsp " " >\n"
|
||||
"<!ATTLIST data id ID #REQUIRED>\n"
|
||||
"]>\n"
|
||||
"<data id = \"id-set\" desc=\"Xml 로 출력되는 홈페이지의 내용 예시\">\n"
|
||||
"\n"
|
||||
" <data id=\"id-info-login\" login_enum=\"1\" login_msg=\"Login Already\" login_rightnum=\"515\"\n"
|
||||
" login_isadmin=\"0\" login_sessno=\"\" login_memno=\"1\" login_id=\"test\" login_name=\"\"\n"
|
||||
" login_icon=\"/testfile\" login_iconhtml=\"\" login_point=\"0\" login_mail=\"\" login_level=\"0\"\n"
|
||||
" login_no_fc=\"0\" login_no_fbinf=\"7\" login_notecnt=\"0\" login_type=\"0\" login_lastip=\"\"\n"
|
||||
" login_lastlogin=\"2008-09-28 08:29:51.904506\" login_filecnt=\"0\" login_filesum=\"0\"\n"
|
||||
" login_filemax=\"0\" />\n"
|
||||
"\n"
|
||||
" <data id=\"id-binfo-main\" binf_cntitem=\"12\" binf_cntpage=\"10\" binf_count=\"1001\" binf_maxnum=\"501\"\n"
|
||||
" binf_config=\"360943\" binf_bbit_fbinf=\"0\" binf_rn_fbinf=\"0\" binf_no_fc=\"0\" />\n"
|
||||
"\n"
|
||||
" <data id = \"id-binfo-var\" attcnt = \"0\" />\n"
|
||||
"\n"
|
||||
" <data id=\"id-binfo-top-set\" recordcnt=\"3\" fieldcnt=\"16\">\n"
|
||||
" <data id=\"id-binfo-top1\" no=\"1\" b_itemnum=\"1\" b_title=\"자유게시판입니다.\" b_tstyle=\"\"\n"
|
||||
" b_wdate=\"2008-09-28\" b_no=\"1\" b_depth=\"0\" b_hit=\"0\" b_commcnt=\"0\" b_filecnt=\"0\"\n"
|
||||
" b_userip=\"\" m_no=\"0\" m_point=\"0\" m_nick=\"\" m_userid=\"\" m_mail=\"\"\n"
|
||||
" f_icon=\"<img src="/testfile" class="member_img_icon" />\"\n"
|
||||
" />\n"
|
||||
" <data id=\"id-binfo-top2\" no=\"2\" b_itemnum=\"2\" b_title=\"술탄 메메트 2세 Title=2\" b_tstyle=\"\"\n"
|
||||
" b_wdate=\"2008-09-28\" b_no=\"2\" b_depth=\"0\" b_hit=\"0\" b_commcnt=\"0\" b_filecnt=\"0\" b_userip=\"\" m_no=\"0\" m_point=\"0\" m_nick=\"\" m_userid=\"\" m_mail=\"\"\n"
|
||||
" f_icon=\"<img src="/testfile" class="member_img_icon" />\"\n"
|
||||
" />\n"
|
||||
" <data id=\"id-binfo-top3\" no=\"3\" b_itemnum=\"1-1\" b_title=\"술탄 메메트 2세 Title=1-1\"\n"
|
||||
" b_tstyle=\"\" b_wdate=\"2008-09-28\" b_no=\"3\" b_depth=\"1\" b_hit=\"0\" b_commcnt=\"0\"\n"
|
||||
" b_filecnt=\"0\" b_userip=\"\" m_no=\"0\" m_point=\"0\" m_nick=\"\" m_userid=\"\" m_mail=\"\"\n"
|
||||
" f_icon=\"<img src="/testfile" class="member_img_icon" />\"\n"
|
||||
" />\n"
|
||||
" </data><!-- id=\"binfo-top-set\" -->\n"
|
||||
" <data id=\"id-binfo-modevar\" attcnt=\"5\" b_listbackcolor1=\"#ffeeff\" b_listbackcolor2=\"#cceedd\"\n"
|
||||
" b_listbackcolorcnt=\"2\" b_listlinecolor=\"black\" b_listmouseovercolor=\"#ffc0cb\" />\n"
|
||||
"\n"
|
||||
"</data><!-- id=\"id-set\" -->\n";
|
||||
/*const char* CPC_XmlDataOfID=*/
|
||||
|
||||
|
||||
ZCViewLoadXml VO_CViewLoadXml;
|
||||
ZCLoadXml VO_CLoadXml ;
|
||||
|
||||
if(AI_ArgCnt<2)
|
||||
{
|
||||
VO_CLoadXml.Exec(VO_CViewLoadXml, CPC_XmlData1, ZNsMain::ZftLength(CPC_XmlData1));
|
||||
VO_CLoadXml.Exec(VO_CViewLoadXml, CPC_XmlData2, ZNsMain::ZftLength(CPC_XmlData2));
|
||||
}
|
||||
else
|
||||
{
|
||||
for(int i=1; i<AI_ArgCnt; ++i) VO_CLoadXml.Exec
|
||||
(
|
||||
VO_CViewLoadXml, APP_ArgVal[i], ZNsMain::ZftLength(APP_ArgVal[i])
|
||||
);
|
||||
/*:::::::::::::::::::::::::::::::::::::::::::*/
|
||||
|
||||
return 0;
|
||||
}/*
|
||||
else*/
|
||||
|
||||
|
||||
cout<<endl;
|
||||
cout<<"## Show Xml Info With 'ID' Attribute. Press Enter. ##"; cin.get();
|
||||
|
||||
VO_CLoadXml.clear(); ZCViewLoadXmlOfXmlInfo VO_CViewLoadXmlOfXmlInfo;
|
||||
|
||||
ZNsMain::ZNsEnum::ZERunEx VE_ERunEx=VO_CLoadXml.ExecAll( ////////////
|
||||
VO_CViewLoadXmlOfXmlInfo,
|
||||
CPC_XmlDataOfID ,
|
||||
ZNsMain::ZftLength(CPC_XmlDataOfID)
|
||||
/*/////////*/ ); /*////////////////////////////////////////////////*/
|
||||
|
||||
if(VE_ERunEx!=ZNsMain::ZNsEnum::ZERunEx_OK)
|
||||
{
|
||||
cout<<endl<<endl<<
|
||||
"■ Error !! : Line="<<VO_CLoadXml.GetLineNo()<<", "<<
|
||||
"CharNo=" <<VO_CLoadXml.GetCharNo() <<", "<<
|
||||
"EWaitByte="<<VO_CLoadXml.GetMSG_EWaitByte() <<", "
|
||||
"Error MSG="<<VO_CViewLoadXmlOfXmlInfo.GetErrorMSG()<<endl;
|
||||
|
||||
return 0;
|
||||
}/*
|
||||
if(VE_ERunEx!=ZNsMain::ZNsEnum::ZERunEx_OK)*/
|
||||
|
||||
VO_CViewLoadXmlOfXmlInfo.GetCXmlInfo().IterPreOrderElementTreeStd();
|
||||
|
||||
cout<<endl;
|
||||
cout<<"## Show Xml ID ##"<<endl;
|
||||
cout<<endl;
|
||||
|
||||
VO_CViewLoadXmlOfXmlInfo.GetCXmlInfo().IterElementIDSetStd();
|
||||
|
||||
return 0;
|
||||
}/*
|
||||
static int Main(int AI_ArgCnt=0, char* APP_ArgVal[]=0)*/
|
||||
|
||||
public:
|
||||
};/*
|
||||
template<typename TDymmy=void*> class ZtExamLoadXml*/
|
||||
|
||||
}/*
|
||||
namespace ZNsExam*/
|
||||
|
||||
}/*
|
||||
namespace ZNsMain*/
|
||||
|
||||
|
||||
int main(int AI_ArgCnt, char* APP_ArgVal[])
|
||||
{
|
||||
return ZNsMain::ZNsExam::
|
||||
|
||||
ZtExamLoadXml<>::Main(AI_ArgCnt, APP_ArgVal);
|
||||
}/*
|
||||
int main(int AI_ArgCnt, char* APP_ArgVal[])*/
|
||||
|
||||
|
||||
/*////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
■ cygwin 컴파일
|
||||
|
||||
// g++ -mno-cygwin -o ZtCLoadXml_000.exe ZtCLoadXml_000.cpp -I../../my_CPP/CPP_Main/ -I../../my_CPP/CPP_Std/ -D__CYGWIN32__ -D__VISUAL_CPP_VER__=200300
|
||||
// g++ -mno-cygwin -o ZtCLoadXml_000_D.exe ZtCLoadXml_000.cpp -I../../my_CPP/CPP_Main/ -I../../my_CPP/CPP_Std/ -D__CYGWIN32__ -D__VISUAL_CPP_VER__=200300 -D_DEBUG
|
||||
|
||||
■ mingw 컴파일
|
||||
|
||||
g++.exe -o ZtCLoadXml_000_mw.exe ZtCLoadXml_000.cpp -I../ -lWs2_32
|
||||
g++.exe -o ZtCLoadXml_000_mw_D.exe ZtCLoadXml_000.cpp -I../ -lWs2_32 -D_DEBUG
|
||||
|
||||
./ZtCLoadXml_000_mw.exe
|
||||
./ZtCLoadXml_000_mw_D.exe
|
||||
|
||||
|
||||
Administrator@q381-2673 UCRT64 /e/my_CPP/ZCpp/ZCppMainTest
|
||||
# date
|
||||
Sun Aug 24 10:47:09 KST 2025
|
||||
|
||||
Administrator@q381-2673 UCRT64 /e/my_CPP/ZCpp/ZCppMainTest
|
||||
# g++ --version
|
||||
g++.exe (Rev2, Built by MSYS2 project) 13.2.0
|
||||
Copyright (C) 2023 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
■ Linux 컴파일
|
||||
|
||||
g++ -std=c++98 -o ZtCLoadXml_000.exe ZtCLoadXml_000.cpp -I../
|
||||
g++ -std=c++98 -o ZtCLoadXml_000_D.exe ZtCLoadXml_000.cpp -I../ -D_DEBUG
|
||||
|
||||
g++ -std=c++98 -o ZtCLoadXml_000_r.exe ZtCLoadXml_000.cpp -I../ -D_REENTRANT
|
||||
g++ -std=c++98 -o ZtCLoadXml_000_r_D.exe ZtCLoadXml_000.cpp -I../ -D_REENTRANT -D_DEBUG
|
||||
|
||||
|
||||
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ gcc --version
|
||||
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ date
|
||||
Sun Aug 24 00:05:51 DST 2025
|
||||
|
||||
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ cat /etc/os-release
|
||||
NAME="Ubuntu"
|
||||
VERSION="20.04.6 LTS (Focal Fossa)"
|
||||
ID=ubuntu
|
||||
ID_LIKE=debian
|
||||
PRETTY_NAME="Ubuntu 20.04.6 LTS"
|
||||
VERSION_ID="20.04"
|
||||
HOME_URL="https://www.ubuntu.com/"
|
||||
SUPPORT_URL="https://help.ubuntu.com/"
|
||||
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
|
||||
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
|
||||
VERSION_CODENAME=focal
|
||||
UBUNTU_CODENAME=focal
|
||||
|
||||
|
||||
[sauron@q381-2657 ZCppMainTest]$ cat /etc/centos-release
|
||||
CentOS Linux release 7.9.2009 (Core)
|
||||
|
||||
[sauron@q381-2657 ZCppMainTest]$ g++ --version
|
||||
g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
|
||||
Copyright (C) 2015 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
■ 실행
|
||||
|
||||
./ZtCLoadXml_000.exe
|
||||
./ZtCLoadXml_000_D.exe
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////*/
|
139
ZCppMainTest/ZtCObjAVL_000.cpp
Normal file
139
ZCppMainTest/ZtCObjAVL_000.cpp
Normal file
@ -0,0 +1,139 @@
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#include "ZCppMain/ZtCObjAVL.H"
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
namespace ZNsMain
|
||||
{
|
||||
|
||||
namespace ZNsExam
|
||||
{
|
||||
|
||||
template<typename TDummy=void*> class ZtCExamAVL
|
||||
{
|
||||
public:
|
||||
|
||||
static void ShowDataInNode(int AI_Data)
|
||||
{
|
||||
cout<<"* Node Data : "<<AI_Data<<endl;
|
||||
}/*
|
||||
static void ShowDataInNode(int AI_Data)*/
|
||||
|
||||
static int Main(int AI_ArgCnt=0, char* APP_ArgVal[]=0)
|
||||
{
|
||||
using namespace std ;
|
||||
using namespace ZNsMain;
|
||||
|
||||
ZtCObjAVL<int, int> VO_CObjAVL;
|
||||
|
||||
VO_CObjAVL.AddData(10);
|
||||
VO_CObjAVL.AddData(20);
|
||||
VO_CObjAVL.AddData(30);
|
||||
VO_CObjAVL.AddData(40);
|
||||
VO_CObjAVL.AddData(9 );
|
||||
|
||||
cout<<"# In Order" <<endl; VO_CObjAVL.IterInOrder (&ShowDataInNode);
|
||||
cout<<"# Post Order"<<endl; VO_CObjAVL.IterPostOrder(&ShowDataInNode);
|
||||
cout<<"# Pre Order" <<endl; VO_CObjAVL.IterPreOrder (&ShowDataInNode);
|
||||
|
||||
return 0;
|
||||
}/*
|
||||
static int Main(int AI_ArgCnt=0, char* APP_ArgVal[]=0)*/
|
||||
|
||||
|
||||
public:
|
||||
};/*
|
||||
template<typename TDummy=void*> class ZtCExamAVL*/
|
||||
|
||||
}/*
|
||||
namespace ZNsExam*/
|
||||
|
||||
}/*
|
||||
namespace ZNsMain*/
|
||||
|
||||
|
||||
int main(int AI_ArgCnt, char* APP_ArgVal[])
|
||||
{
|
||||
return ZNsMain::ZNsExam::
|
||||
|
||||
ZtCExamAVL<>::Main(AI_ArgCnt, APP_ArgVal);
|
||||
}/*
|
||||
int main(int AI_ArgCnt, char* APP_ArgVal[])*/
|
||||
|
||||
|
||||
/*////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
■ cygwin 컴파일
|
||||
|
||||
// g++ -mno-cygwin -o ZtCObjAVL_000.exe ZtCObjAVL_000.cpp -I../../my_CPP/CPP_Main/ -I../../my_CPP/CPP_Std/ -D__CYGWIN32__ -D__VISUAL_CPP_VER__=200300
|
||||
// g++ -mno-cygwin -o ZtCObjAVL_000_D.exe ZtCObjAVL_000.cpp -I../../my_CPP/CPP_Main/ -I../../my_CPP/CPP_Std/ -D__CYGWIN32__ -D__VISUAL_CPP_VER__=200300 -D_DEBUG
|
||||
|
||||
■ mingw 컴파일
|
||||
|
||||
g++.exe -o ZtCObjAVL_000_mw.exe ZtCObjAVL_000.cpp -I../
|
||||
g++.exe -o ZtCObjAVL_000_mw_D.exe ZtCObjAVL_000.cpp -I../ -D_DEBUG
|
||||
|
||||
./ZtCObjAVL_000_mw.exe
|
||||
./ZtCObjAVL_000_mw_D.exe
|
||||
|
||||
|
||||
Administrator@q381-2673 UCRT64 /e/my_CPP/ZCpp/ZCppMainTest
|
||||
# date
|
||||
Sun Aug 24 10:47:09 KST 2025
|
||||
|
||||
Administrator@q381-2673 UCRT64 /e/my_CPP/ZCpp/ZCppMainTest
|
||||
# g++ --version
|
||||
g++.exe (Rev2, Built by MSYS2 project) 13.2.0
|
||||
Copyright (C) 2023 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
■ Linux 컴파일
|
||||
|
||||
g++ -std=c++98 -o ZtCObjAVL_000.exe ZtCObjAVL_000.cpp -I../
|
||||
g++ -std=c++98 -o ZtCObjAVL_000_D.exe ZtCObjAVL_000.cpp -I../ -D_DEBUG
|
||||
|
||||
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ gcc --version
|
||||
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ date
|
||||
Sun Aug 24 00:05:51 DST 2025
|
||||
|
||||
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ cat /etc/os-release
|
||||
NAME="Ubuntu"
|
||||
VERSION="20.04.6 LTS (Focal Fossa)"
|
||||
ID=ubuntu
|
||||
ID_LIKE=debian
|
||||
PRETTY_NAME="Ubuntu 20.04.6 LTS"
|
||||
VERSION_ID="20.04"
|
||||
HOME_URL="https://www.ubuntu.com/"
|
||||
SUPPORT_URL="https://help.ubuntu.com/"
|
||||
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
|
||||
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
|
||||
VERSION_CODENAME=focal
|
||||
UBUNTU_CODENAME=focal
|
||||
|
||||
|
||||
[sauron@q381-2657 ZCppMainTest]$ cat /etc/centos-release
|
||||
CentOS Linux release 7.9.2009 (Core)
|
||||
|
||||
[sauron@q381-2657 ZCppMainTest]$ g++ --version
|
||||
g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
|
||||
Copyright (C) 2015 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
■ 실행
|
||||
|
||||
./ZtCObjAVL_000.exe
|
||||
./ZtCObjAVL_000_D.exe
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////*/
|
456
ZCppMainTest/ZtCObjList_000.cpp
Normal file
456
ZCppMainTest/ZtCObjList_000.cpp
Normal file
@ -0,0 +1,456 @@
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#include "ZCppMain/ZtCObjList.H"
|
||||
#include "ZCppMain/ZtCStringEx.H"
|
||||
|
||||
|
||||
using namespace std ;
|
||||
using namespace ZNsMain ;
|
||||
|
||||
|
||||
namespace ZNsMain
|
||||
{
|
||||
|
||||
namespace ZNsExam
|
||||
{
|
||||
|
||||
template<typename TDummy=void*> class ZtCExamCObjList
|
||||
{
|
||||
public:
|
||||
|
||||
typedef ZtCStringBase<char> CStringBase ;
|
||||
typedef const CStringBase CCStringBase;
|
||||
|
||||
/* 아래 자료형에 대해, CStringBase::Fetch() 호출 여부 실험.
|
||||
|
||||
ZtCObjList<CStringBase&, CCStringBase&>
|
||||
ZtCObjList<CStringBase&, CCCStringBase&>
|
||||
|
||||
*/
|
||||
typedef ZtCObjList
|
||||
<CStringBase, CStringBase& > CStringList1 ;
|
||||
typedef ZtCObjList
|
||||
<CStringBase, CCStringBase&> CStringList2 ;
|
||||
|
||||
typedef CStringList1::ZCLink ZCLink1;
|
||||
typedef CStringList2::ZCLink ZCLink2;
|
||||
|
||||
typedef CStringList1::ZCLinkOpt ZCLinkOpt1;
|
||||
typedef CStringList2::ZCLinkOpt ZCLinkOpt2;
|
||||
|
||||
typedef CStringList1::ZCDataOpt ZCDataOpt1;
|
||||
typedef CStringList2::ZCDataOpt ZCDataOpt2;
|
||||
|
||||
|
||||
static void ShowDataInNode(const CStringBase& AR_Data)
|
||||
{
|
||||
cout<<"* Data : "<<AR_Data<<endl;
|
||||
}/*
|
||||
static void ShowDataInNode(const CStringBase& AR_Data)*/
|
||||
|
||||
static void ShowNode1(ZCLink1& AR_CLink)
|
||||
{
|
||||
cout<<"* Node Prev : "<<*(AR_CLink-1)<<endl;
|
||||
cout<<"* Node Curr : "<<*(AR_CLink )<<endl;
|
||||
cout<<"* Node Next : "<<*(AR_CLink+1)<<endl;
|
||||
}/*
|
||||
static void ShowNode1(ZCLink1& AR_CLink)*/
|
||||
|
||||
static void ShowNode2(ZCLink2& AR_CLink)
|
||||
{
|
||||
cout<<"* Node Prev : "<<*(AR_CLink-1)<<endl;
|
||||
cout<<"* Node Curr : "<<*(AR_CLink )<<endl;
|
||||
cout<<"* Node Next : "<<*(AR_CLink+1)<<endl;
|
||||
}/*
|
||||
static void ShowNode2(ZCLink2& AR_CLink)*/
|
||||
|
||||
|
||||
static void Append1(ZCLink1& AR_CLink)
|
||||
{
|
||||
(*AR_CLink).append("__");
|
||||
}/*
|
||||
static void Append1(ZCLink1& AR_CLink)*/
|
||||
|
||||
|
||||
static void ShowNode1_2(ZCLink1& AR_CLink, int& ARRI_CallCnt)
|
||||
{
|
||||
++ARRI_CallCnt;
|
||||
|
||||
cout<<ARRI_CallCnt<<" * Node Prev : "<<*(AR_CLink-1)<<endl;
|
||||
cout<<ARRI_CallCnt<<" * Node Curr : "<<*(AR_CLink )<<endl;
|
||||
cout<<ARRI_CallCnt<<" * Node Next : "<<*(AR_CLink+1)<<endl;
|
||||
}/*
|
||||
static void ShowNode1(ZCLink1& AR_CLink, int& ARRI_CallCnt)*/
|
||||
|
||||
static void ShowNode2_2(ZCLink2& AR_CLink, int& ARRI_CallCnt)
|
||||
{
|
||||
++ARRI_CallCnt;
|
||||
|
||||
cout<<ARRI_CallCnt<<" * Node Prev : "<<*(AR_CLink-1)<<endl;
|
||||
cout<<ARRI_CallCnt<<" * Node Curr : "<<*(AR_CLink )<<endl;
|
||||
cout<<ARRI_CallCnt<<" * Node Next : "<<*(AR_CLink+1)<<endl;
|
||||
}/*
|
||||
static void ShowNode2(ZCLink2& AR_CLink, int& ARRI_CallCnt)*/
|
||||
|
||||
|
||||
static void ShowNode1_3(ZCLink1& AR_CLink, int& ARRI_CallCnt)
|
||||
{
|
||||
++ARRI_CallCnt;
|
||||
|
||||
cout<<ARRI_CallCnt<<" * Node Curr : "<<*(AR_CLink )<<endl;
|
||||
}/*
|
||||
static void ShowNode1(ZCLink1& AR_CLink, int& ARRI_CallCnt)*/
|
||||
|
||||
static void ShowNode2_3(ZCLink2& AR_CLink, int& ARRI_CallCnt)
|
||||
{
|
||||
++ARRI_CallCnt;
|
||||
|
||||
cout<<ARRI_CallCnt<<" * Node Curr : "<<*(AR_CLink )<<endl;
|
||||
}/*
|
||||
static void ShowNode2(ZCLink2& AR_CLink, int& ARRI_CallCnt)*/
|
||||
|
||||
|
||||
static int Main(int AI_ArgCnt=0, char* APP_ArgVal[]=0)
|
||||
{
|
||||
CStringBase VO_CStringBase ;
|
||||
CStringList1 VO_ListOfStr10 ;
|
||||
CStringList2 VO_ListOfStr20 ;
|
||||
|
||||
ZCDataOpt1 VO_ZCDataOpt1 = VO_ListOfStr10.GetHeadDataOpt() ;
|
||||
ZCLinkOpt1 VO_ZCLinkOpt1 = VO_ListOfStr10.GetTailLinkOpt() ;
|
||||
|
||||
if(bool(VO_ZCDataOpt1))
|
||||
cout<<"# VO_ListOfStr10's head data : " <<*VO_ZCDataOpt1<<endl;
|
||||
else cout<<"# VO_ListOfStr10's head data none "<<endl;
|
||||
if(bool(VO_ZCLinkOpt1))
|
||||
cout<<"# VO_ListOfStr10's tail link data : " <<**VO_ZCLinkOpt1<<endl;
|
||||
else cout<<"# VO_ListOfStr10's tail link data none "<<endl;
|
||||
|
||||
VO_ListOfStr10.AddTail(VO_CStringBase("data 10"));
|
||||
VO_ListOfStr10.AddTail(VO_CStringBase("data 40"));
|
||||
VO_ListOfStr10.AddTail(VO_CStringBase("data 20"));
|
||||
VO_ListOfStr10.AddTail(VO_CStringBase("data 40"));
|
||||
VO_ListOfStr10.AddTail(VO_CStringBase("data 04"));
|
||||
|
||||
cout<<"# VO_CStringBase data : " <<VO_CStringBase<<endl;
|
||||
|
||||
|
||||
VO_ZCDataOpt1 = VO_ListOfStr10.GetHeadDataOpt() ;
|
||||
VO_ZCLinkOpt1 = VO_ListOfStr10.GetTailLinkOpt() ;
|
||||
|
||||
if(bool(VO_ZCDataOpt1))
|
||||
cout<<"# VO_ListOfStr10's head data : " <<*VO_ZCDataOpt1<<endl;
|
||||
else cout<<"# VO_ListOfStr10's head data none "<<endl;
|
||||
if(bool(VO_ZCLinkOpt1))
|
||||
cout<<"# VO_ListOfStr10's tail link data : " <<**VO_ZCLinkOpt1<<endl;
|
||||
else cout<<"# VO_ListOfStr10's tail link data none "<<endl;
|
||||
|
||||
|
||||
cout<<"# 1th IterElement ####" <<endl;
|
||||
{
|
||||
VO_ListOfStr10.IterElement(&ShowDataInNode);
|
||||
}
|
||||
cout<<"# 1th IterElemRev ####" <<endl;
|
||||
{
|
||||
VO_ListOfStr10.IterElemRev(&ShowDataInNode);
|
||||
}
|
||||
/*///////////////////////////////////*/
|
||||
|
||||
|
||||
cout<<endl;
|
||||
|
||||
|
||||
VO_ListOfStr20.AddTail(VO_CStringBase("data 10"));
|
||||
VO_ListOfStr20.AddTail(VO_CStringBase("data 40"));
|
||||
VO_ListOfStr20.AddTail(VO_CStringBase("data 20"));
|
||||
VO_ListOfStr20.AddTail(VO_CStringBase("data 40"));
|
||||
VO_ListOfStr20.AddTail(VO_CStringBase("data 04"));
|
||||
|
||||
cout<<"# VO_CStringBase data : " <<VO_CStringBase<<endl;
|
||||
|
||||
cout<<"# 2th IterElement ####" <<endl;
|
||||
{
|
||||
VO_ListOfStr20.IterElement(&ShowDataInNode);
|
||||
}
|
||||
cout<<"# 2th IterElemRev ####" <<endl;
|
||||
{
|
||||
VO_ListOfStr20.IterElemRev(&ShowDataInNode);
|
||||
}
|
||||
/*///////////////////////////////////*/
|
||||
|
||||
|
||||
cout<<"# list10 size : " <<VO_ListOfStr10.size ()<<endl;
|
||||
cout<<"# list20 size : " <<VO_ListOfStr20.size ()<<endl;
|
||||
cout<<"# list10 free size: " <<VO_ListOfStr10.GetFreeSize ()<<endl;
|
||||
cout<<"# list20 free size: " <<VO_ListOfStr20.GetFreeSize ()<<endl;
|
||||
cout<<"# list10 capacity : " <<VO_ListOfStr10.capacity ()<<endl;
|
||||
cout<<"# list20 capacity : " <<VO_ListOfStr20.capacity ()<<endl;
|
||||
|
||||
VO_ListOfStr10.clear(); VO_ListOfStr20.clear();
|
||||
|
||||
VO_ListOfStr10.GetCFreeHeap().AddHeap(3);
|
||||
VO_ListOfStr20.GetCFreeHeap().AddHeap(3);
|
||||
|
||||
cout<<"# After clear() & AddHeap(3)"<<endl;
|
||||
|
||||
cout<<"# list10 size : " <<VO_ListOfStr10.size ()<<endl;
|
||||
cout<<"# list20 size : " <<VO_ListOfStr20.size ()<<endl;
|
||||
cout<<"# list10 free size: " <<VO_ListOfStr10.GetFreeSize ()<<endl;
|
||||
cout<<"# list20 free size: " <<VO_ListOfStr20.GetFreeSize ()<<endl;
|
||||
cout<<"# list10 capacity : " <<VO_ListOfStr10.capacity ()<<endl;
|
||||
cout<<"# list20 capacity : " <<VO_ListOfStr20.capacity ()<<endl;
|
||||
|
||||
CStringList1 VO_ListOfStr11 ;
|
||||
|
||||
cout<<"# add 2 elements and clear in VO_ListOfStr11"<<endl;
|
||||
|
||||
VO_ListOfStr11.AddTail(VO_CStringBase("lsit 11 data 01"));
|
||||
VO_ListOfStr11.AddTail(VO_CStringBase("lsit 11 data 02"));
|
||||
VO_ListOfStr11.clear();
|
||||
|
||||
cout<<"# After list10 Fetch from list11"<<endl;
|
||||
|
||||
VO_ListOfStr10.GetCFreeHeap().Fetch( VO_ListOfStr11.GetCFreeHeap() );
|
||||
|
||||
cout<<"# list10 size : " <<VO_ListOfStr10.size ()<<endl;
|
||||
cout<<"# list11 size : " <<VO_ListOfStr11.size ()<<endl;
|
||||
cout<<"# list10 free size: " <<VO_ListOfStr10.GetFreeSize ()<<endl;
|
||||
cout<<"# list11 free size: " <<VO_ListOfStr11.GetFreeSize ()<<endl;
|
||||
cout<<"# list10 capacity : " <<VO_ListOfStr10.capacity ()<<endl;
|
||||
cout<<"# list11 capacity : " <<VO_ListOfStr11.capacity ()<<endl;
|
||||
|
||||
cout<<"# After list11 Fetch 3 from list10"<<endl;
|
||||
|
||||
VO_ListOfStr11.GetCFreeHeap().
|
||||
Fetch( VO_ListOfStr10.GetCFreeHeap(), 3);
|
||||
|
||||
cout<<"# list10 size : " <<VO_ListOfStr10.size ()<<endl;
|
||||
cout<<"# list11 size : " <<VO_ListOfStr11.size ()<<endl;
|
||||
cout<<"# list10 free size: " <<VO_ListOfStr10.GetFreeSize ()<<endl;
|
||||
cout<<"# list11 free size: " <<VO_ListOfStr11.GetFreeSize ()<<endl;
|
||||
cout<<"# list10 capacity : " <<VO_ListOfStr10.capacity ()<<endl;
|
||||
cout<<"# list11 capacity : " <<VO_ListOfStr11.capacity ()<<endl;
|
||||
|
||||
VO_ListOfStr11.AddTail(VO_CStringBase("list11 add1"));
|
||||
VO_ListOfStr11.AddTail(VO_CStringBase("list11 add2"));
|
||||
VO_ListOfStr11.AddTail(VO_CStringBase("list11 add3"));
|
||||
VO_ListOfStr11.AddTail(VO_CStringBase("list11 add4"));
|
||||
|
||||
cout<<"# After add 4 in list11"<<endl;
|
||||
|
||||
cout<<"# list10 size : " <<VO_ListOfStr10.size ()<<endl;
|
||||
cout<<"# list11 size : " <<VO_ListOfStr11.size ()<<endl;
|
||||
cout<<"# list10 free size: " <<VO_ListOfStr10.GetFreeSize ()<<endl;
|
||||
cout<<"# list11 free size: " <<VO_ListOfStr11.GetFreeSize ()<<endl;
|
||||
cout<<"# list10 capacity : " <<VO_ListOfStr10.capacity ()<<endl;
|
||||
cout<<"# list11 capacity : " <<VO_ListOfStr11.capacity ()<<endl;
|
||||
|
||||
cout<<"# After MakeEqual() : list10 and list11"<<endl;
|
||||
|
||||
VO_ListOfStr10.GetCFreeHeap().MakeEqual( VO_ListOfStr11.GetCFreeHeap() );
|
||||
|
||||
cout<<"# list10 size : " <<VO_ListOfStr10.size ()<<endl;
|
||||
cout<<"# list11 size : " <<VO_ListOfStr11.size ()<<endl;
|
||||
cout<<"# list10 free size: " <<VO_ListOfStr10.GetFreeSize ()<<endl;
|
||||
cout<<"# list11 free size: " <<VO_ListOfStr11.GetFreeSize ()<<endl;
|
||||
cout<<"# list10 capacity : " <<VO_ListOfStr10.capacity ()<<endl;
|
||||
cout<<"# list11 capacity : " <<VO_ListOfStr11.capacity ()<<endl;
|
||||
|
||||
cout<<"# list11 IterElemRev ####" <<endl;
|
||||
{
|
||||
VO_ListOfStr11.IterElemRev(&ShowDataInNode);
|
||||
}/*
|
||||
cout<<"# list11 IterElemRev ####" <<endl;*/
|
||||
|
||||
|
||||
VO_ListOfStr11.RotateBack();
|
||||
|
||||
cout<<"# list11 IterElemRev after RotateBack"<<endl;
|
||||
|
||||
cout<<"# list11 IterElemRev ####" <<endl;
|
||||
{
|
||||
VO_ListOfStr11.IterElemRev(&ShowDataInNode);
|
||||
}/*
|
||||
cout<<"# list11 IterElemRev ####" <<endl;*/
|
||||
|
||||
|
||||
VO_ListOfStr10 = VO_ListOfStr11 ;
|
||||
|
||||
cout<<"# list10 IterElement after list10 = list11"<<endl;
|
||||
VO_ListOfStr10.IterElement(&ShowDataInNode);
|
||||
|
||||
cout<<"# list10 size : " <<VO_ListOfStr10.size ()<<endl;
|
||||
cout<<"# list11 size : " <<VO_ListOfStr11.size ()<<endl;
|
||||
cout<<"# list10 free size: " <<VO_ListOfStr10.GetFreeSize ()<<endl;
|
||||
cout<<"# list11 free size: " <<VO_ListOfStr11.GetFreeSize ()<<endl;
|
||||
cout<<"# list10 capacity : " <<VO_ListOfStr10.capacity ()<<endl;
|
||||
cout<<"# list11 capacity : " <<VO_ListOfStr11.capacity ()<<endl;
|
||||
|
||||
|
||||
VO_ListOfStr11.AddHead(VO_CStringBase("list11 add99"));
|
||||
VO_ListOfStr10 = VO_ListOfStr11 ;
|
||||
|
||||
cout<<"# list10 IterElement after list11.addhead, list10 = list11"<<endl;
|
||||
VO_ListOfStr10.IterElement(&ShowDataInNode);
|
||||
|
||||
|
||||
cout<<"# list10 size : " <<VO_ListOfStr10.size ()<<endl;
|
||||
cout<<"# list11 size : " <<VO_ListOfStr11.size ()<<endl;
|
||||
cout<<"# list10 free size: " <<VO_ListOfStr10.GetFreeSize ()<<endl;
|
||||
cout<<"# list11 free size: " <<VO_ListOfStr11.GetFreeSize ()<<endl;
|
||||
cout<<"# list10 capacity : " <<VO_ListOfStr10.capacity ()<<endl;
|
||||
cout<<"# list11 capacity : " <<VO_ListOfStr11.capacity ()<<endl;
|
||||
|
||||
|
||||
int VI_CallCnt=0;
|
||||
|
||||
cout<<"# list10 IterElemLink ################"<<endl;
|
||||
VO_ListOfStr10.IterElemLink(&ShowNode1_2, ZftMCP(VI_CallCnt=0));
|
||||
|
||||
cout<<"# list10 2th link to list11 tail"<<endl;
|
||||
VO_ListOfStr10.SendOutTail(*VO_ListOfStr10.GetLinkPtr(2), VO_ListOfStr11);
|
||||
|
||||
cout<<"# list10 IterElemLink ################"<<endl;
|
||||
VO_ListOfStr10.IterElemLink(&ShowNode1_2, ZftMCP(VI_CallCnt=0));
|
||||
cout<<"# list11 IterElemLink ################"<<endl;
|
||||
VO_ListOfStr11.IterElemLink(&ShowNode1_2, ZftMCP(VI_CallCnt=0));
|
||||
|
||||
cout<<"# list10 1th link to list10 head"<<endl;
|
||||
VO_ListOfStr10.SendOutHead(*VO_ListOfStr10.GetLinkPtr(1), VO_ListOfStr11);
|
||||
|
||||
cout<<"# list10 IterElemLink ################"<<endl;
|
||||
VO_ListOfStr10.IterElemLink(&ShowNode1_3, ZftMCP(VI_CallCnt=0));
|
||||
cout<<"# list11 IterElemLink ################"<<endl;
|
||||
VO_ListOfStr11.IterElemLink(&ShowNode1_3, ZftMCP(VI_CallCnt=0));
|
||||
|
||||
|
||||
VO_ListOfStr11.IterElemLink(&Append1);
|
||||
|
||||
VO_ListOfStr11.SendRangeOutAfter
|
||||
(
|
||||
*VO_ListOfStr11.GetLinkPtr(2)
|
||||
, *VO_ListOfStr11.GetLinkPtr(3)
|
||||
, 2
|
||||
, RR(VO_ListOfStr10)
|
||||
, VO_ListOfStr10.GetLinkOpt(2)
|
||||
);
|
||||
cout<<"# list11's 2th ~ 3th link to list10's 2th link after"<<endl;
|
||||
cout<<"# list10 IterElemLink ################"<<endl;
|
||||
VO_ListOfStr10.IterElemLink(&ShowNode1_3, ZftMCP(VI_CallCnt=0));
|
||||
cout<<"# list11 IterElemLink ################"<<endl;
|
||||
VO_ListOfStr11.IterElemLink(&ShowNode1_3, ZftMCP(VI_CallCnt=0));
|
||||
|
||||
|
||||
VO_ListOfStr10.SendRangeOutBefore
|
||||
(
|
||||
*VO_ListOfStr10.GetLinkPtr(3)
|
||||
, *VO_ListOfStr10.GetLinkPtr(4)
|
||||
, 2
|
||||
, RR(VO_ListOfStr11)
|
||||
, VO_ListOfStr11.GetLinkOpt(1)
|
||||
);
|
||||
cout<<"# list10's 3th ~ 4th link to list11's 1th link before"<<endl;
|
||||
cout<<"# list10 IterElemLink ################"<<endl;
|
||||
VO_ListOfStr10.IterElemLink(&ShowNode1_3, ZftMCP(VI_CallCnt=0));
|
||||
cout<<"# list11 IterElemLink ################"<<endl;
|
||||
VO_ListOfStr11.IterElemLink(&ShowNode1_3, ZftMCP(VI_CallCnt=0));
|
||||
|
||||
|
||||
return 0;
|
||||
}/*
|
||||
static int Main(int AI_ArgCnt=0, char* APP_ArgVal[]=0)*/
|
||||
|
||||
|
||||
public:
|
||||
};/*
|
||||
template<typename TDummy=void*> class ZtCExamCObjList*/
|
||||
|
||||
}/*
|
||||
namespace ZNsExam*/
|
||||
|
||||
}/*
|
||||
namespace ZNsMain*/
|
||||
|
||||
|
||||
int main(int AI_ArgCnt, char* APP_ArgVal[])
|
||||
{
|
||||
return ZNsMain::ZNsExam::
|
||||
|
||||
ZtCExamCObjList<>::Main(AI_ArgCnt, APP_ArgVal);
|
||||
}/*
|
||||
int main(int AI_ArgCnt, char* APP_ArgVal[])*/
|
||||
|
||||
|
||||
/*////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
■ cygwin 컴파일
|
||||
|
||||
// g++ -mno-cygwin -o ZtCObjList_000.exe ZtCObjList_000.cpp -I../../my_CPP/CPP_Main/ -I../../my_CPP/CPP_Std/ -D__CYGWIN32__ -D__VISUAL_CPP_VER__=200300
|
||||
// g++ -mno-cygwin -o ZtCObjList_000_D.exe ZtCObjList_000.cpp -I../../my_CPP/CPP_Main/ -I../../my_CPP/CPP_Std/ -D__CYGWIN32__ -D__VISUAL_CPP_VER__=200300 -D_DEBUG
|
||||
|
||||
■ mingw 컴파일
|
||||
|
||||
g++.exe -o ZtCObjList_000_mw.exe ZtCObjList_000.cpp -I../ -lWs2_32
|
||||
g++.exe -o ZtCObjList_000_mw_D.exe ZtCObjList_000.cpp -I../ -lWs2_32 -D_DEBUG
|
||||
|
||||
./ZtCObjList_000_mw.exe
|
||||
./ZtCObjList_000_mw_D.exe
|
||||
|
||||
|
||||
Administrator@q381-2673 UCRT64 /e/my_CPP/ZCpp/ZCppMainTest
|
||||
# date
|
||||
Sun Aug 24 10:47:09 KST 2025
|
||||
|
||||
Administrator@q381-2673 UCRT64 /e/my_CPP/ZCpp/ZCppMainTest
|
||||
# g++ --version
|
||||
g++.exe (Rev2, Built by MSYS2 project) 13.2.0
|
||||
Copyright (C) 2023 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
■ Linux 컴파일
|
||||
|
||||
g++ -std=c++98 -o ZtCObjList_000.exe ZtCObjList_000.cpp -I../
|
||||
g++ -std=c++98 -o ZtCObjList_000_D.exe ZtCObjList_000.cpp -I../ -D_DEBUG
|
||||
|
||||
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ gcc --version
|
||||
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ date
|
||||
Sun Aug 24 00:05:51 DST 2025
|
||||
|
||||
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ cat /etc/os-release
|
||||
NAME="Ubuntu"
|
||||
VERSION="20.04.6 LTS (Focal Fossa)"
|
||||
ID=ubuntu
|
||||
ID_LIKE=debian
|
||||
PRETTY_NAME="Ubuntu 20.04.6 LTS"
|
||||
VERSION_ID="20.04"
|
||||
HOME_URL="https://www.ubuntu.com/"
|
||||
SUPPORT_URL="https://help.ubuntu.com/"
|
||||
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
|
||||
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
|
||||
VERSION_CODENAME=focal
|
||||
UBUNTU_CODENAME=focal
|
||||
|
||||
|
||||
[sauron@q381-2657 ZCppMainTest]$ cat /etc/centos-release
|
||||
CentOS Linux release 7.9.2009 (Core)
|
||||
|
||||
[sauron@q381-2657 ZCppMainTest]$ g++ --version
|
||||
g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
|
||||
Copyright (C) 2015 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
■ 실행
|
||||
|
||||
./ZtCObjList_000.exe
|
||||
./ZtCObjList_000_D.exe
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////*/
|
337
ZCppMainTest/ZtCSimList_000.cpp
Normal file
337
ZCppMainTest/ZtCSimList_000.cpp
Normal file
@ -0,0 +1,337 @@
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#include "ZCppMain/ZtCSimList.H"
|
||||
#include "ZCppMain/ZtCStringEx.H"
|
||||
|
||||
|
||||
using namespace std ;
|
||||
using namespace ZNsMain ;
|
||||
|
||||
|
||||
namespace ZNsMain
|
||||
{
|
||||
|
||||
namespace ZNsExam
|
||||
{
|
||||
|
||||
template<typename TDummy=void*> class ZtCExamCSimList
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
typedef ZtCStringBase<char> CStringBase ;
|
||||
typedef const CStringBase CCStringBase;
|
||||
|
||||
/* 아래 자료형에 대해, CStringBase::Fetch() 호출 여부 실험.
|
||||
|
||||
ZtCSimList<CStringBase&, CCStringBase&>
|
||||
ZtCSimList<CStringBase&, CCCStringBase&>
|
||||
|
||||
*/
|
||||
typedef ZtCSimList
|
||||
<CStringBase, CStringBase&> CStringList1 ;
|
||||
typedef ZtCSimList
|
||||
<CStringBase, CCStringBase&> CStringList2 ;
|
||||
|
||||
|
||||
|
||||
class CHelpObj
|
||||
{
|
||||
public:
|
||||
int mi_CallNo;
|
||||
public:
|
||||
|
||||
CHelpObj() : mi_CallNo(0)
|
||||
{
|
||||
cout<<"* CHelpObj()"<<endl;
|
||||
}
|
||||
|
||||
CHelpObj(const CHelpObj& rhs) : mi_CallNo(0)
|
||||
{
|
||||
cout<<"* CHelpObj(const CHelpObj& rhs)"<<endl;
|
||||
}
|
||||
|
||||
void operator()( CStringBase& AR_DataCStr)
|
||||
{ cout<<"# CallNo="<<++mi_CallNo<<" : "<<AR_DataCStr<<endl; }
|
||||
void operator()(CCStringBase& AR_DataCStr)
|
||||
{ cout<<"# CallNo="<<++mi_CallNo<<" : "<<AR_DataCStr<<endl; }
|
||||
|
||||
public:
|
||||
};/*
|
||||
class CHelpObj*/
|
||||
|
||||
|
||||
struct StFunctor
|
||||
{
|
||||
static void ShowElement(int ArgiValue){cout<<"#1 Value="<<ArgiValue<<endl;}
|
||||
};
|
||||
struct StFunctor2
|
||||
{
|
||||
static void ShowElement(int ArgiValue, CHelpObj)
|
||||
{cout<<"#2 Value="<<ArgiValue<<", CHelpObj Addr=None"<<" With CHelpObj"<<endl;}
|
||||
};
|
||||
struct StFunctor3
|
||||
{
|
||||
static void ShowElement(int ArgiValue, CHelpObj& AR_CHelpObj)
|
||||
{cout<<"#3 Value="<<ArgiValue<<", HelpObj Ptr="<<&AR_CHelpObj<<" With CHelpObj Ref"<<endl;}
|
||||
};
|
||||
struct StFunctor4
|
||||
{
|
||||
static void ShowElement(int ArgiValue, CHelpObj& AR_CHelpObj)
|
||||
{cout<<"#4 Value="<<ArgiValue<<", HelpObj Ptr="<<&AR_CHelpObj<<" With CHelpObj in Ptr"<<endl;}
|
||||
};
|
||||
struct StFunctor5
|
||||
{
|
||||
static void ShowElement(int ArgiValue, CHelpObj& AR_CHelpObj, CHelpObj& AR_CHelpObj2)
|
||||
{cout<<"#5 Value="<<ArgiValue<<", HelpObj Ptr="<<&AR_CHelpObj<<" With CHelpObj Ref 2"<<endl;}
|
||||
};
|
||||
struct StFunctor6
|
||||
{
|
||||
static void ShowElement(int ArgiValue, CHelpObj& AR_CHelpObj, CHelpObj AO_CHelpObj2)
|
||||
{cout<<"#6 Value="<<ArgiValue<<", HelpObj Ptr="<<&AR_CHelpObj<<" With CHelpObj Half Ref"<<endl;}
|
||||
};
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
static void ShowDataInNode(const CStringBase& AR_Data)
|
||||
{
|
||||
cout<<"* Data : "<<AR_Data<<endl;
|
||||
}/*
|
||||
static void ShowDataInNode(const CStringBase& AR_Data)*/
|
||||
|
||||
static int Main(int AI_ArgCnt=0, char* APP_ArgVal[]=0)
|
||||
{
|
||||
CStringBase VO_CStringBase;
|
||||
CStringList1 VO_ListOfStr10 ;
|
||||
CStringList2 VO_ListOfStr20 ;
|
||||
|
||||
VO_ListOfStr10.AddTail(VO_CStringBase("data 10"));
|
||||
VO_ListOfStr10.AddTail(VO_CStringBase("data 40"));
|
||||
VO_ListOfStr10.AddTail(VO_CStringBase("data 20"));
|
||||
VO_ListOfStr10.AddTail(VO_CStringBase("data 40"));
|
||||
VO_ListOfStr10.AddTail(VO_CStringBase("data 04"));
|
||||
|
||||
cout<<"# VO_CStringBase data : " <<VO_CStringBase<<endl;
|
||||
|
||||
cout<<"# 1th IterElement ####" <<endl;
|
||||
{
|
||||
VO_ListOfStr10.IterElement(&ShowDataInNode);
|
||||
}
|
||||
/*///////////////////////////////////*/
|
||||
|
||||
|
||||
cout<<endl;
|
||||
|
||||
|
||||
VO_ListOfStr20.AddTail(VO_CStringBase("data 10"));
|
||||
VO_ListOfStr20.AddTail(VO_CStringBase("data 40"));
|
||||
VO_ListOfStr20.AddTail(VO_CStringBase("data 20"));
|
||||
VO_ListOfStr20.AddTail(VO_CStringBase("data 40"));
|
||||
VO_ListOfStr20.AddTail(VO_CStringBase("data 04"));
|
||||
|
||||
cout<<"# VO_CStringBase data : " <<VO_CStringBase<<endl;
|
||||
|
||||
cout<<"# 2th IterElement ####" <<endl;
|
||||
{
|
||||
VO_ListOfStr20.IterElement(&ShowDataInNode);
|
||||
}
|
||||
/*///////////////////////////////////*/
|
||||
|
||||
|
||||
typedef ZtCSimList<int> CIntList;
|
||||
|
||||
CHelpObj VO_CHelpObj;
|
||||
CIntList VO_CIntList;
|
||||
|
||||
VO_CIntList.AddTail(10);
|
||||
VO_CIntList.AddTail(20);
|
||||
VO_CIntList.AddTail(30);
|
||||
VO_CIntList.AddTail(40);
|
||||
|
||||
cout<<endl<<"#### Show CIntList Element ####"<<endl<<endl;
|
||||
|
||||
VO_CIntList.IterElement(StFunctor ::ShowElement);
|
||||
VO_CIntList.IterElement(StFunctor2::ShowElement, VO_CHelpObj );
|
||||
VO_CIntList.IterElement(StFunctor3::ShowElement, ZftMCR(VO_CHelpObj) );
|
||||
VO_CIntList.IterElement(StFunctor4::ShowElement, ZftMCP(VO_CHelpObj) );
|
||||
VO_CIntList.IterElement(StFunctor5::ShowElement, ZftMCP(VO_CHelpObj), ZftMCP(VO_CHelpObj) );
|
||||
VO_CIntList.IterElement(StFunctor6::ShowElement, ZftMCP(VO_CHelpObj), VO_CHelpObj );
|
||||
|
||||
|
||||
|
||||
CStringList1 VO_ListOfStr11 ;
|
||||
|
||||
cout<<"# add 2 elements and clear in VO_ListOfStr11"<<endl;
|
||||
|
||||
VO_ListOfStr11.AddTail(VO_CStringBase("lsit 11 data 01"));
|
||||
VO_ListOfStr11.AddTail(VO_CStringBase("lsit 11 data 02"));
|
||||
VO_ListOfStr11.clear();
|
||||
|
||||
cout<<"# After list10 Fetch from list11"<<endl;
|
||||
|
||||
VO_ListOfStr10.GetCFreeHeap().Fetch( VO_ListOfStr11.GetCFreeHeap() );
|
||||
|
||||
cout<<"# list10 size : " <<VO_ListOfStr10.size ()<<endl;
|
||||
cout<<"# list11 size : " <<VO_ListOfStr11.size ()<<endl;
|
||||
cout<<"# list10 free size: " <<VO_ListOfStr10.GetFreeSize ()<<endl;
|
||||
cout<<"# list11 free size: " <<VO_ListOfStr11.GetFreeSize ()<<endl;
|
||||
cout<<"# list10 capacity : " <<VO_ListOfStr10.capacity ()<<endl;
|
||||
cout<<"# list11 capacity : " <<VO_ListOfStr11.capacity ()<<endl;
|
||||
|
||||
cout<<"# After list11 Fetch 3 from list10"<<endl;
|
||||
|
||||
VO_ListOfStr11.GetCFreeHeap().
|
||||
Fetch( VO_ListOfStr10.GetCFreeHeap(), 3);
|
||||
|
||||
cout<<"# list10 size : " <<VO_ListOfStr10.size ()<<endl;
|
||||
cout<<"# list11 size : " <<VO_ListOfStr11.size ()<<endl;
|
||||
cout<<"# list10 free size: " <<VO_ListOfStr10.GetFreeSize ()<<endl;
|
||||
cout<<"# list11 free size: " <<VO_ListOfStr11.GetFreeSize ()<<endl;
|
||||
cout<<"# list10 capacity : " <<VO_ListOfStr10.capacity ()<<endl;
|
||||
cout<<"# list11 capacity : " <<VO_ListOfStr11.capacity ()<<endl;
|
||||
|
||||
VO_ListOfStr11.AddTail(VO_CStringBase("list11 add1"));
|
||||
VO_ListOfStr11.AddTail(VO_CStringBase("list11 add2"));
|
||||
VO_ListOfStr11.AddTail(VO_CStringBase("list11 add3"));
|
||||
VO_ListOfStr11.AddTail(VO_CStringBase("list11 add4"));
|
||||
|
||||
cout<<"# After add 4 in list11"<<endl;
|
||||
|
||||
cout<<"# list10 size : " <<VO_ListOfStr10.size ()<<endl;
|
||||
cout<<"# list11 size : " <<VO_ListOfStr11.size ()<<endl;
|
||||
cout<<"# list10 free size: " <<VO_ListOfStr10.GetFreeSize ()<<endl;
|
||||
cout<<"# list11 free size: " <<VO_ListOfStr11.GetFreeSize ()<<endl;
|
||||
cout<<"# list10 capacity : " <<VO_ListOfStr10.capacity ()<<endl;
|
||||
cout<<"# list11 capacity : " <<VO_ListOfStr11.capacity ()<<endl;
|
||||
|
||||
VO_ListOfStr11.GetCFreeHeap().AddHeap(2);
|
||||
VO_ListOfStr10.GetCFreeHeap().MakeEqual( VO_ListOfStr11.GetCFreeHeap() );
|
||||
|
||||
cout<<"# After adding free 2 in list11 and MakeEqual() : list10 and list11"<<endl;
|
||||
|
||||
cout<<"# list10 size : " <<VO_ListOfStr10.size ()<<endl;
|
||||
cout<<"# list11 size : " <<VO_ListOfStr11.size ()<<endl;
|
||||
cout<<"# list10 free size: " <<VO_ListOfStr10.GetFreeSize ()<<endl;
|
||||
cout<<"# list11 free size: " <<VO_ListOfStr11.GetFreeSize ()<<endl;
|
||||
cout<<"# list10 capacity : " <<VO_ListOfStr10.capacity ()<<endl;
|
||||
cout<<"# list11 capacity : " <<VO_ListOfStr11.capacity ()<<endl;
|
||||
|
||||
cout<<"# list11 IterElement ####" <<endl;
|
||||
{
|
||||
VO_ListOfStr11.IterElement(&ShowDataInNode);
|
||||
}/*
|
||||
cout<<"# list11 IterElement ####" <<endl;*/
|
||||
|
||||
|
||||
cout<<"# list11 IterElement : ZftMCR(CHelpObj)" <<endl;
|
||||
VO_ListOfStr11.IterElement(ZftMCR(VO_CHelpObj));
|
||||
cout<<"# list11 IterElement : ZftMCP(CHelpObj)" <<endl;
|
||||
VO_ListOfStr11.IterElement(ZftMCP(VO_CHelpObj));
|
||||
|
||||
|
||||
VO_ListOfStr11 = VO_ListOfStr10 ;
|
||||
|
||||
cout<<"# list11 IterElement : after list11=list10" <<endl;
|
||||
VO_ListOfStr11.IterElement(ZftMCP(VO_CHelpObj));
|
||||
|
||||
|
||||
return 0;
|
||||
}/*
|
||||
static int Main(int AI_ArgCnt=0, char* APP_ArgVal[]=0)*/
|
||||
|
||||
|
||||
public:
|
||||
};/*
|
||||
template<typename TDummy=void*> class ZtCExamCSimList*/
|
||||
|
||||
}/*
|
||||
namespace ZNsExam*/
|
||||
|
||||
}/*
|
||||
namespace ZNsMain*/
|
||||
|
||||
|
||||
int main(int AI_ArgCnt, char* APP_ArgVal[])
|
||||
{
|
||||
return ZNsMain::ZNsExam::
|
||||
|
||||
ZtCExamCSimList<>::Main(AI_ArgCnt, APP_ArgVal);
|
||||
}/*
|
||||
int main(int AI_ArgCnt, char* APP_ArgVal[])*/
|
||||
|
||||
|
||||
/*////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
■ cygwin 컴파일
|
||||
|
||||
// g++ -mno-cygwin -o ZtCSimList_000.exe ZtCSimList_000.cpp -I../../my_CPP/CPP_Main/ -I../../my_CPP/CPP_Std/ -D__CYGWIN32__ -D__VISUAL_CPP_VER__=200300
|
||||
// g++ -mno-cygwin -o ZtCSimList_000_D.exe ZtCSimList_000.cpp -I../../my_CPP/CPP_Main/ -I../../my_CPP/CPP_Std/ -D__CYGWIN32__ -D__VISUAL_CPP_VER__=200300 -D_DEBUG
|
||||
|
||||
■ mingw 컴파일
|
||||
|
||||
g++.exe -o ZtCSimList_000_mw.exe ZtCSimList_000.cpp -I../ -lWs2_32
|
||||
g++.exe -o ZtCSimList_000_mw_D.exe ZtCSimList_000.cpp -I../ -lWs2_32 -D_DEBUG
|
||||
|
||||
./ZtCSimList_000_mw.exe
|
||||
./ZtCSimList_000_mw_D.exe
|
||||
|
||||
|
||||
Administrator@q381-2673 UCRT64 /e/my_CPP/ZCpp/ZCppMainTest
|
||||
# date
|
||||
Sun Aug 24 10:47:09 KST 2025
|
||||
|
||||
Administrator@q381-2673 UCRT64 /e/my_CPP/ZCpp/ZCppMainTest
|
||||
# g++ --version
|
||||
g++.exe (Rev2, Built by MSYS2 project) 13.2.0
|
||||
Copyright (C) 2023 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
■ Linux 컴파일
|
||||
|
||||
g++ -std=c++98 -o ZtCSimList_000.exe ZtCSimList_000.cpp -I../
|
||||
g++ -std=c++98 -o ZtCSimList_000_D.exe ZtCSimList_000.cpp -I../ -D_DEBUG
|
||||
|
||||
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ gcc --version
|
||||
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ date
|
||||
Sun Aug 24 00:05:51 DST 2025
|
||||
|
||||
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ cat /etc/os-release
|
||||
NAME="Ubuntu"
|
||||
VERSION="20.04.6 LTS (Focal Fossa)"
|
||||
ID=ubuntu
|
||||
ID_LIKE=debian
|
||||
PRETTY_NAME="Ubuntu 20.04.6 LTS"
|
||||
VERSION_ID="20.04"
|
||||
HOME_URL="https://www.ubuntu.com/"
|
||||
SUPPORT_URL="https://help.ubuntu.com/"
|
||||
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
|
||||
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
|
||||
VERSION_CODENAME=focal
|
||||
UBUNTU_CODENAME=focal
|
||||
|
||||
|
||||
[sauron@q381-2657 ZCppMainTest]$ cat /etc/centos-release
|
||||
CentOS Linux release 7.9.2009 (Core)
|
||||
|
||||
[sauron@q381-2657 ZCppMainTest]$ g++ --version
|
||||
g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
|
||||
Copyright (C) 2015 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
■ 실행
|
||||
|
||||
./ZtCSimList_000.exe
|
||||
./ZtCSimList_000_D.exe
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////*/
|
242
ZCppMainTest/ZtCStringBase_000.cpp
Normal file
242
ZCppMainTest/ZtCStringBase_000.cpp
Normal file
@ -0,0 +1,242 @@
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include "ZCppMain/ZtCStringEx.H"
|
||||
#include "ZCppMain/ZtCStringStd.H"
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
namespace ZNsMain
|
||||
{
|
||||
|
||||
namespace ZNsExam
|
||||
{
|
||||
typedef ZtCStringStd<string> ZCStringStd ;
|
||||
typedef ZtCStringStd<wstring> ZCStringStdW ;
|
||||
|
||||
|
||||
typedef ZtCStringBase<char> ZCStringBase ;
|
||||
typedef ZtCStringBase<wchar_t> ZCStringBaseW ;
|
||||
typedef ZCStringBase::ZCCharView ZCCharView ;
|
||||
typedef ZtCCharType<ZCStringBase> ZCCharType ;
|
||||
typedef ZtCCharType<ZCStringBaseW> ZCCharTypeW ;
|
||||
|
||||
typedef ZCCharType ::TypeChar TypeChar ;
|
||||
typedef ZCCharTypeW::TypeChar TypeCharW ;
|
||||
typedef ZCCharType ::TypeInt TypeCharInt ;
|
||||
typedef ZCCharTypeW::TypeInt TypeCharIntW ;
|
||||
|
||||
const int CI_ByteSize = ZCCharType ::CI_ByteSize ;
|
||||
const int CI_ByteSizeW= ZCCharTypeW::CI_ByteSize ;
|
||||
|
||||
|
||||
template<typename TDummy=void*> class ZtCExamCStringBase_000
|
||||
{
|
||||
public:
|
||||
|
||||
static int Main(int AI_ArgCnt=0, char* APP_ArgVal[]=0)
|
||||
{
|
||||
cout<<"# TypeChar ="<<typeid(TypeChar ).name()<<endl;
|
||||
cout<<"# TypeCharW ="<<typeid(TypeCharW ).name()<<endl;
|
||||
cout<<"# TypeCharInt ="<<typeid(TypeCharInt ).name()<<endl;
|
||||
cout<<"# TypeCharIntW="<<typeid(TypeCharIntW).name()<<endl;
|
||||
cout<<"# CI_ByteSize ="<<CI_ByteSize <<endl;
|
||||
cout<<"# CI_ByteSizeW="<<CI_ByteSizeW <<endl;
|
||||
|
||||
cout<<"# ZCStringBase ::TypeCharInt="<<typeid(ZCStringBase ::TypeCharInt).name()<<endl;
|
||||
cout<<"# ZCStringBaseW::TypeCharInt="<<typeid(ZCStringBaseW::TypeCharInt).name()<<endl;
|
||||
|
||||
cout<<"# ZCStringBase ::traits_type::char_type="<<typeid(ZCStringBase ::traits_type::char_type).name()<<endl;
|
||||
cout<<"# ZCStringBaseW::traits_type::char_type="<<typeid(ZCStringBaseW::traits_type::char_type).name()<<endl;
|
||||
cout<<"# ZCStringBase ::traits_type::int_type ="<<typeid(ZCStringBase ::traits_type::int_type ).name()<<endl;
|
||||
cout<<"# ZCStringBaseW::traits_type::int_type ="<<typeid(ZCStringBaseW::traits_type::int_type ).name()<<endl;
|
||||
|
||||
cout<<"# ZCStringBase ::traits_type="<<typeid(ZCStringBase ::traits_type).name()<<endl;
|
||||
cout<<"# ZCStringBaseW::traits_type="<<typeid(ZCStringBaseW::traits_type).name()<<endl;
|
||||
cout<<"*****************************************************"<<endl;
|
||||
|
||||
ZCStringBaseW VO_ZCStringBaseW;
|
||||
ZCStringStdW VO_ZCStringStdW ;
|
||||
|
||||
VO_ZCStringBaseW(123);
|
||||
cout<<"* after VO_ZCStringBaseW(123)"<<endl;
|
||||
cout<<"# VO_ZCStringBaseW[0]="<<int(VO_ZCStringBaseW[0])<<endl;
|
||||
cout<<"# VO_ZCStringBaseW[1]="<<int(VO_ZCStringBaseW[1])<<endl;
|
||||
cout<<"# VO_ZCStringBaseW[2]="<<int(VO_ZCStringBaseW[2])<<endl;
|
||||
cout<<"*****************************************************"<<endl;
|
||||
|
||||
VO_ZCStringStdW(1.2);
|
||||
cout<<"* after VO_ZCStringStdW(1.2)"<<endl;
|
||||
cout<<"# VO_ZCStringStdW [0]="<<int(VO_ZCStringStdW[0])<<endl;
|
||||
cout<<"# VO_ZCStringStdW [1]="<<int(VO_ZCStringStdW[1])<<endl;
|
||||
cout<<"# VO_ZCStringStdW [2]="<<int(VO_ZCStringStdW[2])<<endl;
|
||||
cout<<"*****************************************************"<<endl;
|
||||
|
||||
|
||||
const ZCCharView CO_ZCCharView("1234AA5678AA90abcAAss");
|
||||
|
||||
ZCStringBase VO_ZCStringStd(CO_ZCCharView);
|
||||
cout<<"# "<<VO_ZCStringStd<<endl;
|
||||
|
||||
cout<<"* after Replace('12', '***')"<<endl;
|
||||
VO_ZCStringStd.Replace(ZCCharView("12"), ZCCharView("***"));
|
||||
cout<<"# "<<VO_ZCStringStd<<endl;
|
||||
cout<<"*****************************************************"<<endl;
|
||||
|
||||
cout<<"* after VO_ZCStringStd=CO_ZCCharView"<<endl;
|
||||
VO_ZCStringStd=CO_ZCCharView;
|
||||
cout<<"# "<<VO_ZCStringStd<<endl;
|
||||
cout<<"*****************************************************"<<endl;
|
||||
|
||||
cout<<"* after Replace('AA', '___')"<<endl;
|
||||
VO_ZCStringStd.Replace(ZCCharView("AA"), ZCCharView("___"));
|
||||
cout<<"# "<<VO_ZCStringStd<<endl;
|
||||
cout<<"*****************************************************"<<endl;
|
||||
|
||||
cout<<"* after Replace('12', '###')"<<endl;
|
||||
VO_ZCStringStd.Replace(ZCCharView("12"), ZCCharView("###"));
|
||||
cout<<"# "<<VO_ZCStringStd<<endl;
|
||||
cout<<"*****************************************************"<<endl;
|
||||
|
||||
cout<<"* after Replace('##', 'T')"<<endl;
|
||||
VO_ZCStringStd.Replace(ZCCharView("##"), ZCCharView("T"));
|
||||
cout<<"# "<<VO_ZCStringStd<<endl;
|
||||
cout<<"*****************************************************"<<endl;
|
||||
|
||||
cout<<"* after Replace('ss', '')"<<endl;
|
||||
VO_ZCStringStd.Replace(ZCCharView("ss"), ZCCharView(""));
|
||||
cout<<"# "<<VO_ZCStringStd<<endl;
|
||||
cout<<"*****************************************************"<<endl;
|
||||
|
||||
|
||||
ZftMakeStr(VO_ZCStringStd, 1234);
|
||||
ZftMakeStr(VO_ZCStringStd, double(10.01));
|
||||
ZftMakeStr(VO_ZCStringStd, true);
|
||||
ZftMakeStr(VO_ZCStringStd,'Z');
|
||||
ZftMakeStr(VO_ZCStringStd, ZCCharView("_Z_"));
|
||||
|
||||
|
||||
cout<<"* after ZftMakeStr()"<<endl;
|
||||
cout<<"# "<<VO_ZCStringStd<<endl;
|
||||
cout<<"*****************************************************"<<endl;
|
||||
|
||||
cout<<"* after Replace('T#', '')"<<endl;
|
||||
VO_ZCStringStd.Replace(ZCCharView("T#"), ZCCharView(""));
|
||||
cout<<"# "<<VO_ZCStringStd<<endl;
|
||||
cout<<"*****************************************************"<<endl;
|
||||
|
||||
cout<<"* after Replace('Z_', 'Z@%')"<<endl;
|
||||
VO_ZCStringStd.Replace(ZCCharView("Z_"), ZCCharView("Z@%"));
|
||||
cout<<"# "<<VO_ZCStringStd<<endl;
|
||||
cout<<"*****************************************************"<<endl;
|
||||
|
||||
cout<<"* after Replace('true', '_TRUE_')"<<endl;
|
||||
VO_ZCStringStd.Replace(ZCCharView("true"), ZCCharView("_TRUE_"));
|
||||
cout<<"# "<<VO_ZCStringStd<<endl;
|
||||
cout<<"*****************************************************"<<endl;
|
||||
|
||||
cout<<"* after Replace('_', '~&')"<<endl;
|
||||
VO_ZCStringStd.Replace(ZCCharView("_"), ZCCharView("~&"));
|
||||
cout<<"# "<<VO_ZCStringStd<<endl;
|
||||
cout<<"*****************************************************"<<endl;
|
||||
|
||||
|
||||
return 0;
|
||||
}/*
|
||||
static int Main(int AI_ArgCnt=0, char* APP_ArgVal[]=0)*/
|
||||
|
||||
public:
|
||||
};/*
|
||||
template<typename TDummy=void*> class ZtCExamCStringBase_000*/
|
||||
|
||||
}/*
|
||||
namespace ZNsExam*/
|
||||
|
||||
}/*
|
||||
namespace ZNsMain*/
|
||||
|
||||
|
||||
int main(int AI_ArgCnt, char* APP_ArgVal[])
|
||||
{
|
||||
return ZNsMain::ZNsExam::
|
||||
|
||||
ZtCExamCStringBase_000<>::Main(AI_ArgCnt, APP_ArgVal);
|
||||
}/*
|
||||
int main(int AI_ArgCnt, char* APP_ArgVal[])*/
|
||||
|
||||
|
||||
/*////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
■ cygwin 컴파일
|
||||
|
||||
// g++ -mno-cygwin -o ZtCStringBase_000.exe ZtCStringBase_000.cpp -I../../my_CPP/CPP_Main/ -I../../my_CPP/CPP_Std/ -D__CYGWIN32__ -D__VISUAL_CPP_VER__=200300
|
||||
// g++ -mno-cygwin -o ZtCStringBase_000_D.exe ZtCStringBase_000.cpp -I../../my_CPP/CPP_Main/ -I../../my_CPP/CPP_Std/ -D__CYGWIN32__ -D__VISUAL_CPP_VER__=200300 -D_DEBUG
|
||||
|
||||
■ mingw 컴파일
|
||||
|
||||
g++.exe -o ZtCStringBase_000_mw.exe ZtCStringBase_000.cpp -I../ -lWs2_32
|
||||
g++.exe -o ZtCStringBase_000_mw_D.exe ZtCStringBase_000.cpp -I../ -lWs2_32 -D_DEBUG
|
||||
|
||||
./ZtCStringBase_000_mw.exe
|
||||
./ZtCStringBase_000_mw_D.exe
|
||||
|
||||
|
||||
Administrator@q381-2673 UCRT64 /e/my_CPP/ZCpp/ZCppMainTest
|
||||
# date
|
||||
Sun Aug 24 10:47:09 KST 2025
|
||||
|
||||
Administrator@q381-2673 UCRT64 /e/my_CPP/ZCpp/ZCppMainTest
|
||||
# g++ --version
|
||||
g++.exe (Rev2, Built by MSYS2 project) 13.2.0
|
||||
Copyright (C) 2023 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
■ Linux 컴파일
|
||||
|
||||
g++ -std=c++98 -o ZtCStringBase_000.exe ZtCStringBase_000.cpp -I../
|
||||
g++ -std=c++98 -o ZtCStringBase_000_D.exe ZtCStringBase_000.cpp -I../ -D_DEBUG
|
||||
|
||||
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ gcc --version
|
||||
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ date
|
||||
Sun Aug 24 00:05:51 DST 2025
|
||||
|
||||
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ cat /etc/os-release
|
||||
NAME="Ubuntu"
|
||||
VERSION="20.04.6 LTS (Focal Fossa)"
|
||||
ID=ubuntu
|
||||
ID_LIKE=debian
|
||||
PRETTY_NAME="Ubuntu 20.04.6 LTS"
|
||||
VERSION_ID="20.04"
|
||||
HOME_URL="https://www.ubuntu.com/"
|
||||
SUPPORT_URL="https://help.ubuntu.com/"
|
||||
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
|
||||
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
|
||||
VERSION_CODENAME=focal
|
||||
UBUNTU_CODENAME=focal
|
||||
|
||||
|
||||
[sauron@q381-2657 ZCppMainTest]$ cat /etc/centos-release
|
||||
CentOS Linux release 7.9.2009 (Core)
|
||||
|
||||
[sauron@q381-2657 ZCppMainTest]$ g++ --version
|
||||
g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
|
||||
Copyright (C) 2015 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
■ 실행
|
||||
|
||||
./ZtCStringBase_000.exe
|
||||
./ZtCStringBase_000_D.exe
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////*/
|
232
ZCppMainTest/ZtCThreadEx_000.cpp
Normal file
232
ZCppMainTest/ZtCThreadEx_000.cpp
Normal file
@ -0,0 +1,232 @@
|
||||
|
||||
|
||||
#ifndef _REENTRANT_EX
|
||||
#define _REENTRANT_EX
|
||||
#endif
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#include "ZCppMain/ZCStringStd.H"
|
||||
#include "ZCppMain/ZCProcess.H"
|
||||
|
||||
|
||||
using namespace std ;
|
||||
using namespace ZNsMain;
|
||||
|
||||
|
||||
namespace ZNsMain
|
||||
{
|
||||
|
||||
namespace ZNsExam
|
||||
{
|
||||
|
||||
template<typename TDummy=void*> class ZtCExamThread
|
||||
{
|
||||
public:
|
||||
|
||||
class CThreadMy : public ZNsMain::ZtCThreadEx<CThreadMy>
|
||||
{
|
||||
public :
|
||||
typedef ZNsMain::ZtCThreadEx<CThreadMy> TypeBase;
|
||||
public :
|
||||
friend class ZNsMain:: ZtCThreadEx<CThreadMy>;
|
||||
private:
|
||||
|
||||
void Init()
|
||||
{
|
||||
this->TypeBase::Init(); cout<<"* Init0()"<<endl;
|
||||
}
|
||||
void Exec()
|
||||
{
|
||||
this->TypeBase::Exec(); cout<<"* Exec0()"<<endl;
|
||||
}
|
||||
void Fini()
|
||||
{
|
||||
this->TypeBase::Fini(); cout<<"* Fini0()"<<endl;
|
||||
}
|
||||
|
||||
|
||||
void Init(ZCStringStd& AR_KeyCStr)
|
||||
{
|
||||
this->TypeBase::template Init<ZCStringStd&>(AR_KeyCStr); cout<<"* Init1() : "<<AR_KeyCStr<<endl;
|
||||
}
|
||||
void Exec(ZCStringStd& AR_KeyCStr)
|
||||
{
|
||||
this->TypeBase::template Exec<ZCStringStd&>(AR_KeyCStr); cout<<"* Exec1() : "<<AR_KeyCStr<<endl;
|
||||
}
|
||||
void Fini(ZCStringStd& AR_KeyCStr)
|
||||
{
|
||||
this->TypeBase::template Fini<ZCStringStd&>(AR_KeyCStr); cout<<"* Fini1() : "<<AR_KeyCStr<<endl;
|
||||
}
|
||||
|
||||
|
||||
void Init(ZCStringStd& AR_KeyCStr, ZCStringStd& AR_KeyCStr2)
|
||||
{
|
||||
this->TypeBase::template Init
|
||||
<ZCStringStd&, ZCStringStd&>(AR_KeyCStr, AR_KeyCStr2);
|
||||
|
||||
cout<<"* Init2() : "<<AR_KeyCStr<<", "<<AR_KeyCStr2<<endl;
|
||||
}
|
||||
void Exec(ZCStringStd& AR_KeyCStr, ZCStringStd& AR_KeyCStr2)
|
||||
{
|
||||
this->TypeBase::template Exec
|
||||
<ZCStringStd&, ZCStringStd&>(AR_KeyCStr, AR_KeyCStr2);
|
||||
|
||||
cout<<"* Init2() : "<<AR_KeyCStr<<", "<<AR_KeyCStr2<<endl;
|
||||
}
|
||||
void Fini(ZCStringStd& AR_KeyCStr, ZCStringStd& AR_KeyCStr2)
|
||||
{
|
||||
this->TypeBase::template Fini
|
||||
<ZCStringStd&, ZCStringStd&>(AR_KeyCStr, AR_KeyCStr2);
|
||||
|
||||
cout<<"* Init2() : "<<AR_KeyCStr<<", "<<AR_KeyCStr2<<endl;
|
||||
}
|
||||
|
||||
|
||||
void Init(ZCStringStd& AR_KeyCStr, ZCStringStd& AR_KeyCStr2, ZCStringStd& AR_KeyCStr3)
|
||||
{
|
||||
this->TypeBase::template Init
|
||||
<ZCStringStd&, ZCStringStd&, ZCStringStd&>
|
||||
( AR_KeyCStr, AR_KeyCStr2, AR_KeyCStr3 ) ;
|
||||
|
||||
cout<<"* Init3() : "<<AR_KeyCStr<<", "<<AR_KeyCStr2<<", "<<AR_KeyCStr3<<endl;
|
||||
}
|
||||
void Exec(ZCStringStd& AR_KeyCStr, ZCStringStd& AR_KeyCStr2, ZCStringStd& AR_KeyCStr3)
|
||||
{
|
||||
this->TypeBase::template Exec
|
||||
<ZCStringStd&, ZCStringStd&, ZCStringStd&>
|
||||
( AR_KeyCStr, AR_KeyCStr2, AR_KeyCStr3 ) ;
|
||||
|
||||
cout<<"* Init3() : "<<AR_KeyCStr<<", "<<AR_KeyCStr2<<", "<<AR_KeyCStr3<<endl;
|
||||
}
|
||||
void Fini(ZCStringStd& AR_KeyCStr, ZCStringStd& AR_KeyCStr2, ZCStringStd& AR_KeyCStr3)
|
||||
{
|
||||
this->TypeBase::template Fini
|
||||
<ZCStringStd&, ZCStringStd&, ZCStringStd&>
|
||||
( AR_KeyCStr, AR_KeyCStr2, AR_KeyCStr3 ) ;
|
||||
|
||||
cout<<"* Init3() : "<<AR_KeyCStr<<", "<<AR_KeyCStr2<<", "<<AR_KeyCStr3<<endl;
|
||||
}
|
||||
|
||||
private:
|
||||
};/*
|
||||
class CThreadMy : public ZNsMain::ZtCThreadEx<CThreadMy>*/
|
||||
|
||||
|
||||
static int Main(int AI_ArgCnt=0, char* APP_ArgVal[]=0)
|
||||
{
|
||||
CThreadMy VO_CThreadMy1 ;
|
||||
CThreadMy VO_CThreadMy2 ;
|
||||
CThreadMy VO_CThreadMy3 ;
|
||||
CThreadMy VO_CThreadMy4 ;
|
||||
|
||||
ZCStringStd VO_ZCStringStd1("Help Data1");
|
||||
ZCStringStd VO_ZCStringStd2("Help Data2");
|
||||
ZCStringStd VO_ZCStringStd3("Help Data3");
|
||||
|
||||
VO_CThreadMy1.Make();
|
||||
cout<<"# Press Enter to continue."<<endl; cin.get();
|
||||
VO_CThreadMy2.Make(ZftMCP(VO_ZCStringStd1));
|
||||
cout<<"# Press Enter to continue."<<endl; cin.get();
|
||||
VO_CThreadMy3.Make(ZftMCP(VO_ZCStringStd1), ZftMCP(VO_ZCStringStd2));
|
||||
cout<<"# Press Enter to continue."<<endl; cin.get();
|
||||
VO_CThreadMy4.Make(ZftMCP(VO_ZCStringStd1), ZftMCP(VO_ZCStringStd2), ZftMCP(VO_ZCStringStd3));
|
||||
cout<<"# Press Enter to continue."<<endl; cin.get();
|
||||
|
||||
return 0;
|
||||
}/*
|
||||
static int Main(int AI_ArgCnt=0, char* APP_ArgVal[]=0)*/
|
||||
|
||||
|
||||
public:
|
||||
};/*
|
||||
template<typename TDummy=void*> class ZtCExamThread*/
|
||||
|
||||
}/*
|
||||
namespace ZNsExam*/
|
||||
|
||||
}/*
|
||||
namespace ZNsMain*/
|
||||
|
||||
|
||||
int main(int AI_ArgCnt, char* APP_ArgVal[])
|
||||
{
|
||||
return ZNsMain::ZNsExam::
|
||||
|
||||
ZtCExamThread<>::Main(AI_ArgCnt, APP_ArgVal);
|
||||
}/*
|
||||
int main(int AI_ArgCnt, char* APP_ArgVal[])*/
|
||||
|
||||
|
||||
/*////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
■ cygwin 컴파일
|
||||
|
||||
// g++ -mno-cygwin -o ZtCThreadEx_000.exe ZtCThreadEx_000.cpp -I../../my_CPP/CPP_Main/ -I../../my_CPP/CPP_Std/ -D__CYGWIN32__ -D__VISUAL_CPP_VER__=200300
|
||||
// g++ -mno-cygwin -o ZtCThreadEx_000_D.exe ZtCThreadEx_000.cpp -I../../my_CPP/CPP_Main/ -I../../my_CPP/CPP_Std/ -D__CYGWIN32__ -D__VISUAL_CPP_VER__=200300 -D_DEBUG
|
||||
|
||||
■ mingw 컴파일
|
||||
|
||||
g++.exe -std=c++98 -o ZtCThreadEx_000_mw.exe ZtCThreadEx_000.cpp -I../
|
||||
g++.exe -std=c++98 -o ZtCThreadEx_000_mw_D.exe ZtCThreadEx_000.cpp -I../ -D_DEBUG
|
||||
|
||||
./ZtCThreadEx_000_mw.exe
|
||||
./ZtCThreadEx_000_mw_D.exe
|
||||
|
||||
|
||||
Administrator@q381-2673 UCRT64 /e/my_CPP/ZCpp/ZCppMainTest
|
||||
# date
|
||||
Sun Aug 24 10:47:09 KST 2025
|
||||
|
||||
Administrator@q381-2673 UCRT64 /e/my_CPP/ZCpp/ZCppMainTest
|
||||
# g++ --version
|
||||
g++.exe (Rev2, Built by MSYS2 project) 13.2.0
|
||||
Copyright (C) 2023 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
■ Linux 컴파일
|
||||
|
||||
g++ -std=c++98 -o ZtCThreadEx_000.exe ZtCThreadEx_000.cpp -I../ -lpthread
|
||||
g++ -std=c++98 -o ZtCThreadEx_000_D.exe ZtCThreadEx_000.cpp -I../ -lpthread -D_DEBUG
|
||||
|
||||
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ gcc --version
|
||||
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ date
|
||||
Sun Aug 24 00:05:51 DST 2025
|
||||
|
||||
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ cat /etc/os-release
|
||||
NAME="Ubuntu"
|
||||
VERSION="20.04.6 LTS (Focal Fossa)"
|
||||
ID=ubuntu
|
||||
ID_LIKE=debian
|
||||
PRETTY_NAME="Ubuntu 20.04.6 LTS"
|
||||
VERSION_ID="20.04"
|
||||
HOME_URL="https://www.ubuntu.com/"
|
||||
SUPPORT_URL="https://help.ubuntu.com/"
|
||||
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
|
||||
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
|
||||
VERSION_CODENAME=focal
|
||||
UBUNTU_CODENAME=focal
|
||||
|
||||
|
||||
[sauron@q381-2657 ZCppMainTest]$ cat /etc/centos-release
|
||||
CentOS Linux release 7.9.2009 (Core)
|
||||
|
||||
[sauron@q381-2657 ZCppMainTest]$ g++ --version
|
||||
g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
|
||||
Copyright (C) 2015 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
■ 실행
|
||||
|
||||
./ZtCThreadEx_000.exe
|
||||
./ZtCThreadEx_000_D.exe
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////*/
|
231
ZCppMainTest/ZtCThreadEx_001.cpp
Normal file
231
ZCppMainTest/ZtCThreadEx_001.cpp
Normal file
@ -0,0 +1,231 @@
|
||||
|
||||
|
||||
#ifndef _REENTRANT_EX
|
||||
#define _REENTRANT_EX
|
||||
#endif
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#include "ZCppMain/ZCProcess.H"
|
||||
|
||||
|
||||
using namespace std ;
|
||||
using namespace ZNsMain;
|
||||
|
||||
|
||||
namespace ZNsMain
|
||||
{
|
||||
|
||||
namespace ZNsExam
|
||||
{
|
||||
|
||||
template<typename TDummy=void*> class ZtCExamThread_001
|
||||
{
|
||||
public:
|
||||
|
||||
class ZCThreadMy : public ZNsMain::ZtCThreadEx<ZCThreadMy>
|
||||
{
|
||||
public :
|
||||
typedef ZNsMain::ZtCThreadEx<ZCThreadMy> TypeBase;
|
||||
public :
|
||||
friend class ZNsMain:: ZtCThreadEx<ZCThreadMy>;
|
||||
public :
|
||||
static int GI_CallCnt;
|
||||
private:
|
||||
|
||||
void Init()
|
||||
{
|
||||
this->TypeBase::Init(); cout<<"* Init0() : "<<++ZCThreadMy::GI_CallCnt<<endl;
|
||||
}
|
||||
void Exec()
|
||||
{
|
||||
this->TypeBase::Exec(); cout<<"* Exec0() : "<<++ZCThreadMy::GI_CallCnt<<endl;
|
||||
}
|
||||
void Fini()
|
||||
{
|
||||
this->TypeBase::Fini(); cout<<"* Fini0() : "<<++ZCThreadMy::GI_CallCnt<<endl;
|
||||
}
|
||||
|
||||
|
||||
void Init(int& ARRI_CallCnt)
|
||||
{
|
||||
this->TypeBase::template Init<int&>(ARRI_CallCnt); cout<<"* Init1() : "<<++ARRI_CallCnt<<endl;
|
||||
}
|
||||
void Exec(int& ARRI_CallCnt)
|
||||
{
|
||||
this->TypeBase::template Exec<int&>(ARRI_CallCnt); cout<<"* Exec1() : "<<++ARRI_CallCnt<<endl;
|
||||
}
|
||||
void Fini(int& ARRI_CallCnt)
|
||||
{
|
||||
this->TypeBase::template Fini<int&>(ARRI_CallCnt); cout<<"* Fini1() : "<<++ARRI_CallCnt<<endl;
|
||||
}
|
||||
|
||||
|
||||
void Init(int& ARRI_CallCnt, int& ARRI_CallCnt2)
|
||||
{
|
||||
this->TypeBase::template Init
|
||||
<int&, int&>(ARRI_CallCnt, ARRI_CallCnt2);
|
||||
|
||||
cout<<"* Init2() : "<<++ARRI_CallCnt<<", "<<ARRI_CallCnt2<<endl;
|
||||
}
|
||||
void Exec(int& ARRI_CallCnt, int& ARRI_CallCnt2)
|
||||
{
|
||||
this->TypeBase::template Exec
|
||||
<int&, int&>(ARRI_CallCnt, ARRI_CallCnt2);
|
||||
|
||||
cout<<"* Init2() : "<<++ARRI_CallCnt<<", "<<ARRI_CallCnt2<<endl;
|
||||
}
|
||||
void Fini(int& ARRI_CallCnt, int& ARRI_CallCnt2)
|
||||
{
|
||||
this->TypeBase::template Fini
|
||||
<int&, int&>(ARRI_CallCnt, ARRI_CallCnt2);
|
||||
|
||||
cout<<"* Init2() : "<<++ARRI_CallCnt<<", "<<ARRI_CallCnt2<<endl;
|
||||
}
|
||||
|
||||
|
||||
void Init(int& ARRI_CallCnt, int& ARRI_CallCnt2, int& ARRI_CallCnt3)
|
||||
{
|
||||
this->TypeBase::template Init<int&, int&, int&>
|
||||
( ARRI_CallCnt, ARRI_CallCnt2, ARRI_CallCnt3 ) ;
|
||||
|
||||
cout<<"* Init3() : "<<++ARRI_CallCnt<<", "<<ARRI_CallCnt2<<", "<<ARRI_CallCnt3<<endl;
|
||||
}
|
||||
void Exec(int& ARRI_CallCnt, int& ARRI_CallCnt2, int& ARRI_CallCnt3)
|
||||
{
|
||||
this->TypeBase::template Exec<int&, int&, int&>
|
||||
( ARRI_CallCnt, ARRI_CallCnt2, ARRI_CallCnt3 ) ;
|
||||
|
||||
cout<<"* Init3() : "<<++ARRI_CallCnt<<", "<<ARRI_CallCnt2<<", "<<ARRI_CallCnt3<<endl;
|
||||
}
|
||||
void Fini(int& ARRI_CallCnt, int& ARRI_CallCnt2, int& ARRI_CallCnt3)
|
||||
{
|
||||
this->TypeBase::template Fini<int&, int&, int&>
|
||||
( ARRI_CallCnt, ARRI_CallCnt2, ARRI_CallCnt3 ) ;
|
||||
|
||||
cout<<"* Init3() : "<<++ARRI_CallCnt<<", "<<ARRI_CallCnt2<<", "<<ARRI_CallCnt3<<endl;
|
||||
}
|
||||
|
||||
private:
|
||||
};/*
|
||||
class ZCThreadMy : public ZNsMain::ZtCThreadEx<ZCThreadMy>*/
|
||||
|
||||
|
||||
static int Main(int AI_ArgCnt=0, char* APP_ArgVal[]=0)
|
||||
{
|
||||
ZCThreadMy VO_CThreadMy1 ;
|
||||
ZCThreadMy VO_CThreadMy2 ;
|
||||
ZCThreadMy VO_CThreadMy3 ;
|
||||
ZCThreadMy VO_CThreadMy4 ;
|
||||
|
||||
VO_CThreadMy1.Make();
|
||||
cout<<"# Press Enter to continue."<<endl; cin.get();
|
||||
VO_CThreadMy2.Make(ZftMCP(ZCThreadMy::GI_CallCnt));
|
||||
cout<<"# Press Enter to continue."<<endl; cin.get();
|
||||
VO_CThreadMy3.Make(ZftMCP(ZCThreadMy::GI_CallCnt), ZftMCP(ZCThreadMy::GI_CallCnt));
|
||||
cout<<"# Press Enter to continue."<<endl; cin.get();
|
||||
VO_CThreadMy4.Make(ZftMCP(ZCThreadMy::GI_CallCnt), ZftMCP(ZCThreadMy::GI_CallCnt), ZftMCP(ZCThreadMy::GI_CallCnt));
|
||||
cout<<"# Press Enter to continue."<<endl; cin.get();
|
||||
|
||||
return 0;
|
||||
}/*
|
||||
static int Main(int AI_ArgCnt=0, char* APP_ArgVal[]=0)*/
|
||||
|
||||
|
||||
public:
|
||||
};/*
|
||||
template<typename TDummy=void*> class ZtCExamThread_001*/
|
||||
|
||||
|
||||
|
||||
template<typename TDummy> int
|
||||
ZtCExamThread_001<TDummy>::ZCThreadMy::GI_CallCnt =0 ;
|
||||
|
||||
}/*
|
||||
namespace ZNsExam*/
|
||||
|
||||
}/*
|
||||
namespace ZNsMain*/
|
||||
|
||||
|
||||
int main(int AI_ArgCnt, char* APP_ArgVal[])
|
||||
{
|
||||
return ZNsMain::ZNsExam::
|
||||
|
||||
ZtCExamThread_001<>::Main(AI_ArgCnt, APP_ArgVal);
|
||||
}/*
|
||||
int main(int AI_ArgCnt, char* APP_ArgVal[])*/
|
||||
|
||||
|
||||
/*////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
■ cygwin 컴파일
|
||||
|
||||
// g++ -mno-cygwin -o ZtCThreadEx_001.exe ZtCThreadEx_001.cpp -I../../my_CPP/CPP_Main/ -I../../my_CPP/CPP_Std/ -D__CYGWIN32__ -D__VISUAL_CPP_VER__=200300
|
||||
// g++ -mno-cygwin -o ZtCThreadEx_001_D.exe ZtCThreadEx_001.cpp -I../../my_CPP/CPP_Main/ -I../../my_CPP/CPP_Std/ -D__CYGWIN32__ -D__VISUAL_CPP_VER__=200300 -D_DEBUG
|
||||
|
||||
■ mingw 컴파일
|
||||
|
||||
g++.exe -std=c++98 -o ZtCThreadEx_001_mw.exe ZtCThreadEx_001.cpp -I../
|
||||
g++.exe -std=c++98 -o ZtCThreadEx_001_mw_D.exe ZtCThreadEx_001.cpp -I../ -D_DEBUG
|
||||
|
||||
./ZtCThreadEx_001_mw.exe
|
||||
./ZtCThreadEx_001_mw_D.exe
|
||||
|
||||
|
||||
Administrator@q381-2673 UCRT64 /e/my_CPP/ZCpp/ZCppMainTest
|
||||
# date
|
||||
Sun Aug 24 10:47:09 KST 2025
|
||||
|
||||
Administrator@q381-2673 UCRT64 /e/my_CPP/ZCpp/ZCppMainTest
|
||||
# g++ --version
|
||||
g++.exe (Rev2, Built by MSYS2 project) 13.2.0
|
||||
Copyright (C) 2023 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
■ Linux 컴파일
|
||||
|
||||
g++ -std=c++98 -o ZtCThreadEx_001.exe ZtCThreadEx_001.cpp -I../ -lpthread
|
||||
g++ -std=c++98 -o ZtCThreadEx_001_D.exe ZtCThreadEx_001.cpp -I../ -lpthread -D_DEBUG
|
||||
|
||||
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ gcc --version
|
||||
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ date
|
||||
Sun Aug 24 00:05:51 DST 2025
|
||||
|
||||
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ cat /etc/os-release
|
||||
NAME="Ubuntu"
|
||||
VERSION="20.04.6 LTS (Focal Fossa)"
|
||||
ID=ubuntu
|
||||
ID_LIKE=debian
|
||||
PRETTY_NAME="Ubuntu 20.04.6 LTS"
|
||||
VERSION_ID="20.04"
|
||||
HOME_URL="https://www.ubuntu.com/"
|
||||
SUPPORT_URL="https://help.ubuntu.com/"
|
||||
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
|
||||
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
|
||||
VERSION_CODENAME=focal
|
||||
UBUNTU_CODENAME=focal
|
||||
|
||||
|
||||
[sauron@q381-2657 ZCppMainTest]$ cat /etc/centos-release
|
||||
CentOS Linux release 7.9.2009 (Core)
|
||||
|
||||
[sauron@q381-2657 ZCppMainTest]$ g++ --version
|
||||
g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
|
||||
Copyright (C) 2015 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
■ 실행
|
||||
|
||||
./ZtCThreadEx_001.exe
|
||||
./ZtCThreadEx_001_D.exe
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////*/
|
234
ZCppMainTest/ZtCThreadEx_002_MutexCond.cpp
Normal file
234
ZCppMainTest/ZtCThreadEx_002_MutexCond.cpp
Normal file
@ -0,0 +1,234 @@
|
||||
|
||||
|
||||
#ifndef _REENTRANT_EX
|
||||
#define _REENTRANT_EX
|
||||
#endif
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#include "ZCppMain/ZCProcess.H"
|
||||
#include "ZCppMain/ZMainHeadEx.H"
|
||||
|
||||
|
||||
using namespace std ;
|
||||
using namespace ZNsMain;
|
||||
|
||||
|
||||
const int CI_RepeatCnt = 3 ;
|
||||
const int CI_WaitMilli = 1000 ;
|
||||
|
||||
|
||||
namespace ZNsMain
|
||||
{
|
||||
|
||||
namespace ZNsExam
|
||||
{
|
||||
|
||||
template<typename TDummy=void*> class ZtCExamThread_002
|
||||
{
|
||||
public:
|
||||
typedef ZtCMutexCondData<> ZCMutexCondData;
|
||||
public:
|
||||
|
||||
class ZCThreadMy : public ZNsMain::ZtCThreadEx<ZCThreadMy>
|
||||
{
|
||||
public :
|
||||
typedef ZNsMain::ZtCThreadEx<ZCThreadMy> TypeBase;
|
||||
public :
|
||||
friend class ZNsMain:: ZtCThreadEx<ZCThreadMy>;
|
||||
private:
|
||||
|
||||
void Init(ZCMutexCondData& AR_CMutexCond)
|
||||
{
|
||||
this->TypeBase::template Init<ZCMutexCondData&>(AR_CMutexCond);
|
||||
|
||||
/*@@@@@@@@@*/ AR_CMutexCond.Lock(); /*@@@@@@@@@*/
|
||||
{
|
||||
__for1(int, i, CI_RepeatCnt)
|
||||
{
|
||||
cout<<"# *** Thread Init "<<i<<endl; ZfSuspendExec(CI_WaitMilli);
|
||||
}
|
||||
/*::::::::::::::::::::::::*/
|
||||
}
|
||||
AR_CMutexCond.WakeCond();
|
||||
AR_CMutexCond.WaitCond();
|
||||
}/*
|
||||
void Init(ZCMutexCondData& AR_CMutexCond)*/
|
||||
|
||||
void Exec(ZCMutexCondData& AR_CMutexCond)
|
||||
{
|
||||
this->TypeBase::template Exec<ZCMutexCondData&>(AR_CMutexCond);
|
||||
{
|
||||
__for1(int, i, CI_RepeatCnt)
|
||||
{
|
||||
cout<<"# >>> Thread Exec "<<i<<endl; ZfSuspendExec(CI_WaitMilli);
|
||||
}
|
||||
/*::::::::::::::::::::::::*/
|
||||
}
|
||||
AR_CMutexCond.WakeCond();
|
||||
AR_CMutexCond.WaitCond();
|
||||
}/*
|
||||
void Exec(ZCMutexCondData& AR_CMutexCond)*/
|
||||
|
||||
void Fini(ZCMutexCondData& AR_CMutexCond)
|
||||
{
|
||||
this->TypeBase::template Fini<ZCMutexCondData&>(AR_CMutexCond);
|
||||
{
|
||||
__for1(int, i, CI_RepeatCnt)
|
||||
{
|
||||
cout<<"# *** Thread Fini "<<i<<endl; ZfSuspendExec(CI_WaitMilli);
|
||||
}
|
||||
/*::::::::::::::::::::::::*/
|
||||
}
|
||||
AR_CMutexCond.WakeCond();
|
||||
|
||||
/*@@@@@@@@@*/ AR_CMutexCond.UnLock(); /*@@@@@@@@@*/
|
||||
}/*
|
||||
void Fini(ZCMutexCondData& AR_CMutexCond)*/
|
||||
|
||||
private:
|
||||
};/*
|
||||
class ZCThreadMy : public ZNsMain::ZtCThreadEx<ZCThreadMy>*/
|
||||
|
||||
|
||||
static int Main(int AI_ArgCnt=0, char* APP_ArgVal[]=0)
|
||||
{
|
||||
ZCMutexCondData VO_CMutexCond;
|
||||
ZCThreadMy VO_CThreadMy ;
|
||||
|
||||
VO_CMutexCond.InitCond();
|
||||
cout<<"- Mutex Init Cond" <<endl;
|
||||
VO_CMutexCond.Lock ();
|
||||
{
|
||||
VO_CThreadMy.Make(ZftMCP(VO_CMutexCond));
|
||||
cout<<"- Wait Thread Init"<<endl;
|
||||
VO_CMutexCond.WaitCond();
|
||||
{
|
||||
__for1(int, i, CI_RepeatCnt)
|
||||
{
|
||||
cout<<"- Ack Thread Init "<<i<<endl; ZfSuspendExec(CI_WaitMilli);
|
||||
}
|
||||
}
|
||||
VO_CMutexCond.WakeCond();
|
||||
cout<<"- Wait Thread Exec"<<endl;
|
||||
VO_CMutexCond.WaitCond();
|
||||
{
|
||||
__for1(int, i, CI_RepeatCnt)
|
||||
{
|
||||
cout<<"- Ack Thread Exec "<<i<<endl; ZfSuspendExec(CI_WaitMilli);
|
||||
}
|
||||
/*::::::::::::::::::::::::*/
|
||||
}
|
||||
VO_CMutexCond.WakeCond();
|
||||
cout<<"- Wait Thread Fini"<<endl;
|
||||
VO_CMutexCond.WaitCond();
|
||||
{
|
||||
__for1(int, i, CI_RepeatCnt)
|
||||
{
|
||||
cout<<"- Ack Thread Fini "<<i<<endl; ZfSuspendExec(CI_WaitMilli);
|
||||
}
|
||||
/*::::::::::::::::::::::::*/
|
||||
}
|
||||
}
|
||||
VO_CMutexCond.UnLock();
|
||||
|
||||
|
||||
VO_CMutexCond.FiniCond(); cout<<"- Mutex Fini Cond" <<endl;
|
||||
|
||||
return 0;
|
||||
}/*
|
||||
static int Main(int AI_ArgCnt=0, char* APP_ArgVal[]=0)*/
|
||||
|
||||
|
||||
public:
|
||||
};/*
|
||||
template<typename TDummy=void*> class ZtCExamThread_002*/
|
||||
|
||||
}/*
|
||||
namespace ZNsExam*/
|
||||
|
||||
}/*
|
||||
namespace ZNsMain*/
|
||||
|
||||
|
||||
int main(int AI_ArgCnt, char* APP_ArgVal[])
|
||||
{
|
||||
return ZNsMain::ZNsExam::
|
||||
|
||||
ZtCExamThread_002<>::Main(AI_ArgCnt, APP_ArgVal);
|
||||
}/*
|
||||
int main(int AI_ArgCnt, char* APP_ArgVal[])*/
|
||||
|
||||
|
||||
/*////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
■ cygwin 컴파일
|
||||
|
||||
// g++ -mno-cygwin -o ZtCThreadEx_002_MutexCond.exe ZtCThreadEx_002_MutexCond.cpp -I../../my_CPP/CPP_Main/ -I../../my_CPP/CPP_Std/ -D__CYGWIN32__ -D__VISUAL_CPP_VER__=200300
|
||||
// g++ -mno-cygwin -o ZtCThreadEx_002_MutexCond_D.exe ZtCThreadEx_002_MutexCond.cpp -I../../my_CPP/CPP_Main/ -I../../my_CPP/CPP_Std/ -D__CYGWIN32__ -D__VISUAL_CPP_VER__=200300 -D_DEBUG
|
||||
|
||||
■ mingw 컴파일
|
||||
|
||||
g++.exe -std=c++98 -o ZtCThreadEx_002_MutexCond_mw.exe ZtCThreadEx_002_MutexCond.cpp -I../ -lWs2_32
|
||||
g++.exe -std=c++98 -o ZtCThreadEx_002_MutexCond_mw_D.exe ZtCThreadEx_002_MutexCond.cpp -I../ -lWs2_32 -D_DEBUG
|
||||
|
||||
./ZtCThreadEx_002_MutexCond_mw.exe
|
||||
./ZtCThreadEx_002_MutexCond_mw_D.exe
|
||||
|
||||
|
||||
Administrator@q381-2673 UCRT64 /e/my_CPP/ZCpp/ZCppMainTest
|
||||
# date
|
||||
Sun Aug 24 10:47:09 KST 2025
|
||||
|
||||
Administrator@q381-2673 UCRT64 /e/my_CPP/ZCpp/ZCppMainTest
|
||||
# g++ --version
|
||||
g++.exe (Rev2, Built by MSYS2 project) 13.2.0
|
||||
Copyright (C) 2023 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
■ Linux 컴파일
|
||||
|
||||
g++ -std=c++98 -o ZtCThreadEx_002_MutexCond.exe ZtCThreadEx_002_MutexCond.cpp -I../ -lpthread
|
||||
g++ -std=c++98 -o ZtCThreadEx_002_MutexCond_D.exe ZtCThreadEx_002_MutexCond.cpp -I../ -lpthread -D_DEBUG
|
||||
|
||||
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ gcc --version
|
||||
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ date
|
||||
Sun Aug 24 00:05:51 DST 2025
|
||||
|
||||
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ cat /etc/os-release
|
||||
NAME="Ubuntu"
|
||||
VERSION="20.04.6 LTS (Focal Fossa)"
|
||||
ID=ubuntu
|
||||
ID_LIKE=debian
|
||||
PRETTY_NAME="Ubuntu 20.04.6 LTS"
|
||||
VERSION_ID="20.04"
|
||||
HOME_URL="https://www.ubuntu.com/"
|
||||
SUPPORT_URL="https://help.ubuntu.com/"
|
||||
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
|
||||
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
|
||||
VERSION_CODENAME=focal
|
||||
UBUNTU_CODENAME=focal
|
||||
|
||||
|
||||
[sauron@q381-2657 ZCppMainTest]$ cat /etc/centos-release
|
||||
CentOS Linux release 7.9.2009 (Core)
|
||||
|
||||
[sauron@q381-2657 ZCppMainTest]$ g++ --version
|
||||
g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
|
||||
Copyright (C) 2015 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
■ 실행
|
||||
|
||||
./ZtCThreadEx_002_MutexCond.exe
|
||||
./ZtCThreadEx_002_MutexCond_D.exe
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////*/
|
57
ZCppMainTest/c++_test_000.cpp
Normal file
57
ZCppMainTest/c++_test_000.cpp
Normal file
@ -0,0 +1,57 @@
|
||||
|
||||
|
||||
#include<iostream>
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
int Main(int AI_ArgCnt=0, const char* APP_ArgVal[]=0)
|
||||
{
|
||||
cout<<"Call Main()"<<endl; return 0;
|
||||
}/*
|
||||
int Main(int AI_ArgCnt=0, const char* APP_ArgVal[]=0)*/
|
||||
|
||||
|
||||
int main(int AI_ArgCnt, char* APP_ArgVal[])
|
||||
{
|
||||
return Main(AI_ArgCnt, APP_ArgVal);
|
||||
}/*
|
||||
int main(int AI_ArgCnt, char* APP_ArgVal[])*/
|
||||
|
||||
|
||||
/*################################################################################
|
||||
|
||||
■ mingw 컴파일
|
||||
|
||||
g++ -o c++_test_000.exe c++_test_000.cpp -I../
|
||||
|
||||
■ linux 컴파일
|
||||
|
||||
g++ -o c++_test_000.exe c++_test_000.cpp -I../
|
||||
|
||||
|
||||
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ g++ -o c++_test_000.exe c++_test_000.cpp -I../
|
||||
c++_test_000.cpp: In function ‘int main(int, char**)’:
|
||||
c++_test_000.cpp:18:28: error: invalid conversion from ‘char**’ to ‘const char**’ [-fpermissive]
|
||||
18 | return Main(AI_ArgCnt, APP_ArgVal);
|
||||
| ^~~~~~~~~~
|
||||
| |
|
||||
| char**
|
||||
c++_test_000.cpp:9:39: note: initializing argument 2 of ‘int Main(int, const char**)’
|
||||
9 | int Main(int AI_ArgCnt=0, const char* APP_ArgVal[]=0)
|
||||
| ~~~~~~~~~~~~^~~~~~~~~~~~~~
|
||||
|
||||
Administrator@q381-2673 UCRT64 /e/my_CPP/ZCpp/ZCppMainTest
|
||||
# date
|
||||
Mon Aug 25 01:39:11 KST 2025
|
||||
|
||||
Administrator@q381-2673 UCRT64 /e/my_CPP/ZCpp/ZCppMainTest
|
||||
# g++ --version
|
||||
g++.exe (Rev2, Built by MSYS2 project) 13.2.0
|
||||
Copyright (C) 2023 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
################################################################################*/
|
134
ZCppMainTest/c++_test_005.cpp
Normal file
134
ZCppMainTest/c++_test_005.cpp
Normal file
@ -0,0 +1,134 @@
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#include "ZCppMain/ZMainHead.H"
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
namespace ZNsMain
|
||||
{
|
||||
|
||||
namespace ZNsExam
|
||||
{
|
||||
|
||||
static void ShowFunctor(int AI_Data)
|
||||
{
|
||||
cout<<"* Show Data : "<<AI_Data<<endl;
|
||||
}/*
|
||||
static void ShowFunctor(int AI_Data)*/
|
||||
|
||||
template<typename TFunctor> static void
|
||||
CallFunctor(TFunctor AO_Functor, int AI_Data)
|
||||
{
|
||||
AO_Functor(AI_Data);
|
||||
}/*
|
||||
template<typename TFunctor> static void
|
||||
CallFunctor(TFunctor AO_Functor, int AI_Data)*/
|
||||
|
||||
|
||||
static int Main(int AI_ArgCnt=0, char* APP_ArgVal[]=0)
|
||||
{
|
||||
_FUNC_IN_FUNC_START_(My)(int ArgiData)
|
||||
{
|
||||
cout<<"# Show My() In Func : i = "<<ArgiData<<endl;
|
||||
}
|
||||
_FUNC_IN_FUNC_CLOSE_(My) /////////////
|
||||
|
||||
CallFunctor(&My::Exec, 1) ;
|
||||
CallFunctor(&My::Exec, 2) ;
|
||||
|
||||
CallFunctor(&ShowFunctor, 10) ;
|
||||
CallFunctor(&ShowFunctor, 20) ;
|
||||
|
||||
return 0;
|
||||
}/*
|
||||
static int Main(int AI_ArgCnt=0, char* APP_ArgVal[]=0)*/
|
||||
|
||||
}/*
|
||||
namespace ZNsExam*/
|
||||
|
||||
}/*
|
||||
namespace ZNsMain*/
|
||||
|
||||
|
||||
int main(int AI_ArgCnt, char* APP_ArgVal[])
|
||||
{
|
||||
return ZNsMain::ZNsExam::Main(AI_ArgCnt, APP_ArgVal);
|
||||
}/*
|
||||
int main(int AI_ArgCnt, char* APP_ArgVal[])*/
|
||||
|
||||
|
||||
/*////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
■ cygwin 컴파일
|
||||
|
||||
// g++ -mno-cygwin -o c++_test_005.exe c++_test_005.cpp -I../../my_CPP/CPP_Main/ -I../../my_CPP/CPP_Std/ -D__CYGWIN32__ -D__VISUAL_CPP_VER__=200300
|
||||
// g++ -mno-cygwin -o c++_test_005_D.exe c++_test_005.cpp -I../../my_CPP/CPP_Main/ -I../../my_CPP/CPP_Std/ -D__CYGWIN32__ -D__VISUAL_CPP_VER__=200300 -D_DEBUG
|
||||
|
||||
■ mingw 컴파일
|
||||
|
||||
g++.exe -o c++_test_005_mw.exe c++_test_005.cpp -I../
|
||||
g++.exe -o c++_test_005_mw_D.exe c++_test_005.cpp -I../ -D_DEBUG
|
||||
|
||||
./c++_test_005_mw.exe
|
||||
./c++_test_005_mw_D.exe
|
||||
|
||||
|
||||
Administrator@q381-2673 UCRT64 /e/my_CPP/ZCpp/ZCppMainTest
|
||||
# date
|
||||
Sun Aug 24 10:47:09 KST 2025
|
||||
|
||||
Administrator@q381-2673 UCRT64 /e/my_CPP/ZCpp/ZCppMainTest
|
||||
# g++ --version
|
||||
g++.exe (Rev2, Built by MSYS2 project) 13.2.0
|
||||
Copyright (C) 2023 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
■ Linux 컴파일
|
||||
|
||||
g++ -std=c++98 -o c++_test_005.exe c++_test_005.cpp -I../
|
||||
g++ -std=c++98 -o c++_test_005_D.exe c++_test_005.cpp -I../ -D_DEBUG
|
||||
|
||||
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ gcc --version
|
||||
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ date
|
||||
Sun Aug 24 00:05:51 DST 2025
|
||||
|
||||
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ cat /etc/os-release
|
||||
NAME="Ubuntu"
|
||||
VERSION="20.04.6 LTS (Focal Fossa)"
|
||||
ID=ubuntu
|
||||
ID_LIKE=debian
|
||||
PRETTY_NAME="Ubuntu 20.04.6 LTS"
|
||||
VERSION_ID="20.04"
|
||||
HOME_URL="https://www.ubuntu.com/"
|
||||
SUPPORT_URL="https://help.ubuntu.com/"
|
||||
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
|
||||
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
|
||||
VERSION_CODENAME=focal
|
||||
UBUNTU_CODENAME=focal
|
||||
|
||||
|
||||
[sauron@q381-2657 ZCppMainTest]$ cat /etc/centos-release
|
||||
CentOS Linux release 7.9.2009 (Core)
|
||||
|
||||
[sauron@q381-2657 ZCppMainTest]$ g++ --version
|
||||
g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
|
||||
Copyright (C) 2015 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
■ 실행
|
||||
|
||||
./c++_test_005.exe
|
||||
./c++_test_005_D.exe
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////*/
|
Reference in New Issue
Block a user