mirror of
				https://github.com/msgpack/msgpack-c.git
				synced 2025-10-22 08:02:08 +02:00 
			
		
		
		
	Compare commits
	
		
			450 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 44c0f705c9 | ||
|   | ddb884e9cd | ||
|   | c593c32b87 | ||
|   | d812fa5edc | ||
|   | e9e06a546c | ||
|   | 1021aeea6f | ||
|   | 2c0040cef6 | ||
|   | f33c7dfdbe | ||
|   | d372a71786 | ||
|   | 2987022c10 | ||
|   | 34f531e26e | ||
|   | 91006555f1 | ||
|   | cd7c5bcfec | ||
|   | add68ff9e6 | ||
|   | ede530de0a | ||
|   | 62de80fa72 | ||
|   | f2b3f52d44 | ||
|   | 035bfeb39e | ||
|   | 04292fe63d | ||
|   | 573ebca3d2 | ||
|   | 37fcaa1264 | ||
|   | a55c73d90e | ||
|   | b2f056c8b6 | ||
|   | e7f7b51005 | ||
|   | 8c602e8579 | ||
|   | 0cc87c0a15 | ||
|   | 9d4ff7fe10 | ||
|   | 2486aad254 | ||
|   | 1fb1dad6bc | ||
|   | 2d65f66b0e | ||
|   | 4bc88d7f6f | ||
|   | 35638ead37 | ||
|   | f09713e838 | ||
|   | 6507243913 | ||
|   | f2ffcf0b08 | ||
|   | df1d126f61 | ||
|   | 211c50c755 | ||
|   | 8bd1b7877c | ||
|   | d6b2de9243 | ||
|   | 818d87c9cb | ||
|   | 327f3d1ad0 | ||
|   | ac062e28cb | ||
|   | 34f8fd65bb | ||
|   | 706fde4d56 | ||
|   | 2dd3dbc85f | ||
|   | 1edfba0cd2 | ||
|   | bc2c446e97 | ||
|   | ec8895155c | ||
|   | 8824c626b4 | ||
|   | 960656648b | ||
|   | dcabd641b5 | ||
|   | cfb543401a | ||
|   | db4fcf9109 | ||
|   | 0726c3d930 | ||
|   | 6c78b521b4 | ||
|   | f6d4704605 | ||
|   | 7c3ef8e7c5 | ||
|   | 8fac2a5ca9 | ||
|   | 7e56a08074 | ||
|   | d679ba57a0 | ||
|   | 2603c2a591 | ||
|   | 535bf33681 | ||
|   | b051192ed6 | ||
|   | fb64ea0b68 | ||
|   | 0b9a597360 | ||
|   | d5cef62cb9 | ||
|   | 0b2c6d9d1a | ||
|   | cef8a6fdfa | ||
|   | cd5ba5057e | ||
|   | 5eabf7189a | ||
|   | 12be5d06e3 | ||
|   | 25c3947a91 | ||
|   | d13d933eea | ||
|   | 33ff3a45b8 | ||
|   | 05de839b44 | ||
|   | d59e1d7716 | ||
|   | d5c837b612 | ||
|   | 3b405fcab3 | ||
|   | 68acf21a8e | ||
|   | 05f654fd64 | ||
|   | 07c5b00c4a | ||
|   | 7bcb6aad05 | ||
|   | 6f0683bb46 | ||
|   | 8b87e62835 | ||
|   | 63511f29db | ||
|   | ff707d8fb5 | ||
|   | 2c832ff91a | ||
|   | e596b6fe35 | ||
|   | 34e411436b | ||
|   | b4d800e6e4 | ||
|   | b350a00f6b | ||
|   | 79db041e8e | ||
|   | cd885d282a | ||
|   | 066d509a68 | ||
|   | 59f2da6a3b | ||
|   | bae76b7cf6 | ||
|   | f543d94521 | ||
|   | 9ff1b5e939 | ||
|   | 1f663d121e | ||
|   | 49bdd40eab | ||
|   | 683b6e42c6 | ||
|   | 53bfbba863 | ||
|   | 63221f5524 | ||
|   | fb01067a05 | ||
|   | af9ce1b627 | ||
|   | 9416c7cc5c | ||
|   | 241f001d17 | ||
|   | e148b2b26d | ||
|   | b4dcae20cc | ||
|   | 3bdbf0d2ee | ||
|   | d8324b58e9 | ||
|   | c0708dbcba | ||
|   | 5dc0a904de | ||
|   | 4ed6b45abd | ||
|   | 4ea4d69123 | ||
|   | 0b8d6a6614 | ||
|   | 1339343077 | ||
|   | 4ca74c28fb | ||
|   | 5ef0108088 | ||
|   | b065560404 | ||
|   | 93b41492fe | ||
|   | c1b3d7530f | ||
|   | ca9f25b51e | ||
|   | 860f7fce55 | ||
|   | 76f5af0593 | ||
|   | d04b1e7549 | ||
|   | 0fddfe8058 | ||
|   | 78814311cb | ||
|   | 073394cbba | ||
|   | 25d6f84f3c | ||
|   | 4022c2fc00 | ||
|   | 7b7615a6d9 | ||
|   | 0af15e45de | ||
|   | 18ec42ccac | ||
|   | be4d971c62 | ||
|   | 3feac1f51d | ||
|   | 2b78d50d13 | ||
|   | 77045f13bb | ||
|   | 388891edad | ||
|   | fc3de9806e | ||
|   | 54b2b23b25 | ||
|   | b9381f842e | ||
|   | 90677eb58c | ||
|   | dfbfd927b4 | ||
|   | e487321ed6 | ||
|   | 7c7f45fbea | ||
|   | 7707c81c5d | ||
|   | a66da75bd4 | ||
|   | 3944993686 | ||
|   | 6b6a05e07c | ||
|   | 6c8ec25016 | ||
|   | 04726a5acf | ||
|   | 44aa90eb50 | ||
|   | ab36ce2654 | ||
|   | 780c504c44 | ||
|   | d852e6e4fb | ||
|   | 65938a95e9 | ||
|   | b9d06fe207 | ||
|   | 555cd3ff68 | ||
|   | e88fa26f7a | ||
|   | 0d203644be | ||
|   | d53d42a791 | ||
|   | 14763a8b31 | ||
|   | 70912ffde4 | ||
|   | 6598c6228f | ||
|   | eb1e7e6e07 | ||
|   | 544978b343 | ||
|   | c8a053557c | ||
|   | 71687c4229 | ||
|   | 3557e6c9f9 | ||
|   | 0e22de17b1 | ||
|   | b0860a5f37 | ||
|   | 447e8dfb07 | ||
|   | 8ee6df83cc | ||
|   | 0168468ac8 | ||
|   | ee29324fd5 | ||
|   | 194d1a470d | ||
|   | ebb5e0ceca | ||
|   | f72c6c48f7 | ||
|   | fc18087cdf | ||
|   | da2fc25f87 | ||
|   | 4629583662 | ||
|   | c7b7e745b3 | ||
|   | 899d3319bf | ||
|   | 6eaf7fd38d | ||
|   | 01260a263d | ||
|   | 30ed4e35b7 | ||
|   | 44f2a6a56e | ||
|   | 3b80c45725 | ||
|   | 6b197e7328 | ||
|   | 498fe28b43 | ||
|   | ad9106e38b | ||
|   | 7ca4ec95e5 | ||
|   | 2f5b137997 | ||
|   | 328be0b445 | ||
|   | 689e6d053a | ||
|   | 6e7deb8091 | ||
|   | 66fa561256 | ||
|   | 243fb27c3c | ||
|   | 746e983bf3 | ||
|   | 766afb90ed | ||
|   | 403567c1c5 | ||
|   | f3fe1b801e | ||
|   | 4fdbc7518f | ||
|   | 0dbdb3d974 | ||
|   | d7d5be414f | ||
|   | 4d36456799 | ||
|   | b1725d4007 | ||
|   | 102dba8e24 | ||
|   | 1a372058a6 | ||
|   | f8b691f622 | ||
|   | 7893d4d8c9 | ||
|   | 9a3cd0c951 | ||
|   | 46684265d5 | ||
|   | 9e0d87b725 | ||
|   | bbc03b2b0a | ||
|   | b4d28c3d9d | ||
|   | cc1098998f | ||
|   | d9c5978958 | ||
|   | d05daa1df6 | ||
|   | 534466894e | ||
|   | d04520044f | ||
|   | c0fb6b3b8c | ||
|   | 19df3314f4 | ||
|   | b530b7f21a | ||
|   | ed49ea3c95 | ||
|   | 7918c19f8f | ||
|   | 0d7caecdb5 | ||
|   | f8b0ad1766 | ||
|   | 7ed7af90b6 | ||
|   | 4a94f836a7 | ||
|   | b36e548db2 | ||
|   | e6c276edf3 | ||
|   | befc3cdd0c | ||
|   | 2e2e93ba2e | ||
|   | 3b2bb56243 | ||
|   | 9c4562382b | ||
|   | 08b0c88c21 | ||
|   | d105f97ea0 | ||
|   | bd0665bed3 | ||
|   | 8dc865d92d | ||
|   | 8085ab8721 | ||
|   | b36e75a42e | ||
|   | f17f8d79c4 | ||
|   | f89f05b883 | ||
|   | bd5f814cb2 | ||
|   | bf6cc035c7 | ||
|   | a6bf728a5c | ||
|   | 698a482b67 | ||
|   | fbf5b9d74c | ||
|   | 65c35caab2 | ||
|   | ff9f14742b | ||
|   | 4b4eb83cd1 | ||
|   | 7761497778 | ||
|   | 6046d5c666 | ||
|   | 83eb70d718 | ||
|   | 70f950ac05 | ||
|   | 3129326432 | ||
|   | 799cd15107 | ||
|   | 942965ee87 | ||
|   | a123053823 | ||
|   | c7603fbbd1 | ||
|   | 6954e01338 | ||
|   | 7e23ec496a | ||
| ![박진형2 [ungeziefer]](/assets/img/avatar_default.png)  | bae148bd76 | ||
|   | 3fcecf7099 | ||
|   | 7d994630d2 | ||
|   | 29b9505cb7 | ||
|   | e07d774004 | ||
|   | ff77227e10 | ||
|   | de99222801 | ||
|   | 7cdc5b88e3 | ||
|   | fbdf16db09 | ||
|   | 41b2af8884 | ||
|   | 9389912eaf | ||
|   | d5242a7d8c | ||
|   | d3fecce359 | ||
|   | 7a70d74971 | ||
|   | fcf89fe901 | ||
|   | ec8c0bc1c1 | ||
|   | a2f3689865 | ||
|   | 2d54c0e918 | ||
|   | ce088e7e0a | ||
|   | a1b86507da | ||
|   | 9235d1acae | ||
|   | 12172e7dc7 | ||
|   | 6a08446b3d | ||
|   | c93a42b5f4 | ||
|   | 8febbfd9f5 | ||
|   | 33a8d8c30f | ||
|   | ef5bcadd95 | ||
|   | fadc615f4e | ||
|   | eff6f5a2fd | ||
|   | ed30252bdc | ||
|   | 2deed25da0 | ||
|   | 419877cf3a | ||
|   | 17267ed475 | ||
|   | b759f5bdf7 | ||
|   | f72372314e | ||
|   | 530561eec0 | ||
|   | aec88c06a0 | ||
|   | 09e06a8cb7 | ||
|   | 084db3fcf1 | ||
|   | 709d6f4fdd | ||
|   | 27cf578e8c | ||
|   | 7001679959 | ||
|   | daa78b4606 | ||
|   | b893f7750c | ||
|   | 8792f42f8d | ||
|   | 4f9ec65713 | ||
|   | db54c78ed4 | ||
|   | 1155babda8 | ||
|   | 83a82e3eb5 | ||
|   | aa9c73352c | ||
|   | df9e003b35 | ||
|   | f6ddc9b85a | ||
|   | 11cfeeec92 | ||
|   | d72765870a | ||
|   | 349c133171 | ||
|   | c056026dad | ||
|   | 0421dabc1e | ||
|   | 60930f4b12 | ||
|   | b3dfe28be4 | ||
|   | e703d8a2f7 | ||
|   | 801f61c12c | ||
|   | a3e75a0709 | ||
|   | 92d34cbd79 | ||
|   | c99fd62ae6 | ||
|   | a3986b3bdc | ||
|   | 7fed49e6fe | ||
|   | 005e06e00a | ||
|   | b6d4bb5cb0 | ||
|   | f57bfd998b | ||
|   | e8d3387a04 | ||
|   | 53d2ea9ad3 | ||
|   | b6803a5fec | ||
|   | 210d3ce390 | ||
|   | a350e0714e | ||
|   | 72757feae4 | ||
|   | fe2346efa1 | ||
|   | 43ae287be3 | ||
|   | b804e12dec | ||
|   | 99c221ad01 | ||
|   | 3a615bcf44 | ||
|   | 87863c1696 | ||
|   | 45defd565a | ||
|   | f1726cef0d | ||
|   | 8a788f3a48 | ||
|   | 7710868556 | ||
|   | 0b53833856 | ||
|   | 43c643bab6 | ||
|   | ac64fcace8 | ||
|   | 84ba0c7b4b | ||
|   | f79606d9ff | ||
|   | 3aaadb9b12 | ||
|   | 8a3a11f123 | ||
|   | 32f1f0edf2 | ||
|   | 5bd75905cb | ||
|   | eebdc007a9 | ||
|   | 3aae588a6a | ||
|   | cb2dcb19b9 | ||
|   | c58a565366 | ||
|   | 93b944eec4 | ||
|   | 7340f1e9c8 | ||
|   | 0a65c443a2 | ||
|   | bae6a8db57 | ||
|   | ddb320197a | ||
|   | dc51f6493b | ||
|   | c027909acc | ||
|   | 2bd56533fa | ||
|   | c07452a7a2 | ||
|   | 8701aeec30 | ||
|   | 2c4f2b890e | ||
|   | f1acd78e54 | ||
|   | 49d22b7d28 | ||
|   | 96133c8dd9 | ||
|   | bd18a36dae | ||
|   | 3fe630769e | ||
|   | 2f80758889 | ||
|   | 9f3efe9e54 | ||
|   | 6e44edf290 | ||
|   | d28cbf32b9 | ||
|   | 48d226e97c | ||
|   | 64698e8e8c | ||
|   | e0d098641c | ||
|   | 06f4b05487 | ||
|   | 122fce5aee | ||
|   | e3f5281903 | ||
|   | 88e94e3776 | ||
|   | 95275ff16e | ||
|   | 4cb938ed18 | ||
|   | 5f3e62461e | ||
|   | ec239933db | ||
|   | de59b393c7 | ||
|   | b02371efe5 | ||
|   | f34289fdfd | ||
|   | 584478a4f1 | ||
|   | 700ec688f7 | ||
|   | a133c1d393 | ||
|   | 6ba9a58648 | ||
|   | bb92d326c8 | ||
|   | 1e13dadf1f | ||
|   | 7b271c2af2 | ||
|   | c3f4e52bdb | ||
|   | 458b4c0363 | ||
|   | f8dc0f0d04 | ||
|   | 347658cdc1 | ||
|   | 427a6e7313 | ||
|   | 7f76a3caf0 | ||
|   | 40539727e6 | ||
|   | 30e56d0a45 | ||
|   | 8eef2a245b | ||
|   | 2bcfe2fdb0 | ||
|   | 2b49e62b3c | ||
|   | bf70a36a1d | ||
|   | eb92058cf4 | ||
|   | 423eaf25fb | ||
|   | 280abe852c | ||
|   | c91307aaa1 | ||
|   | 88ffd08087 | ||
|   | bd337129c6 | ||
|   | 1f5cb86366 | ||
|   | 0d39c577d8 | ||
|   | 7e66dc28f0 | ||
|   | bec47a59f0 | ||
|   | 064f854ddf | ||
|   | a05d92ae85 | ||
|   | 1fdfde5d5f | ||
|   | b1620f1f6a | ||
|   | f789635ddc | ||
|   | f65c26e280 | ||
|   | 579212996f | ||
|   | 208595b262 | ||
|   | 83a4b89818 | ||
|   | d46f220737 | ||
|   | b4db293181 | ||
|   | d1eac600e9 | ||
|   | 7e758ca053 | ||
|   | db6d4f2003 | ||
|   | 1ba46a30ce | ||
|   | 5ece2ef2c7 | ||
|   | 9513734040 | ||
|   | d452625ed1 | ||
|   | b02c6beb4d | ||
|   | 06c2896def | ||
|   | 724db8ed89 | ||
|   | fa48078a52 | ||
|   | d8ad85fa8c | ||
|   | cc3b895449 | ||
|   | 384242e5eb | 
							
								
								
									
										72
									
								
								.github/depends/boost.sh
									
									
									
									
										vendored
									
									
										Executable file
									
								
							
							
						
						
									
										72
									
								
								.github/depends/boost.sh
									
									
									
									
										vendored
									
									
										Executable file
									
								
							| @@ -0,0 +1,72 @@ | |||||||
|  | #!/bin/bash | ||||||
|  |  | ||||||
|  | usage() | ||||||
|  | { | ||||||
|  |   cat <<EOL | ||||||
|  |   -b   - 32-bit or 64-bit library, maybe 32, 64 or both | ||||||
|  |   -t   - the toolset, maybe gcc, clang or both | ||||||
|  |   -p   - installation prefix | ||||||
|  | EOL | ||||||
|  | } | ||||||
|  |  | ||||||
|  | build_boost() | ||||||
|  | { | ||||||
|  |   ./b2 \ | ||||||
|  |       --toolset=$1 \ | ||||||
|  |       --prefix=$3/$2 \ | ||||||
|  |       --with-test \ | ||||||
|  |       --with-headers \ | ||||||
|  |       --with-chrono \ | ||||||
|  |       --with-context \ | ||||||
|  |       --with-filesystem \ | ||||||
|  |       --with-system \ | ||||||
|  |       --with-timer \ | ||||||
|  |       address-model=$2 \ | ||||||
|  |       install || exit 1 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | bit="64" | ||||||
|  | toolset="gcc" | ||||||
|  | prefix="$HOME/boost-prefix" | ||||||
|  |  | ||||||
|  | while getopts "b:t:p:" c; do | ||||||
|  |   case "$c" in | ||||||
|  |     b) | ||||||
|  |       bit="$OPTARG" | ||||||
|  |       [ "$bit" != "32" ] && [ "$bit" != "64" ] && [ "$bit" != "both" ] && usage && exit 1 | ||||||
|  |       ;; | ||||||
|  |     t) | ||||||
|  |       toolset="$OPTARG" | ||||||
|  |       [ "$toolset" != "gcc" ] && [ "$toolset" != "clang" ] && [ "$toolset" != "both" ] && usage && exit 1 | ||||||
|  |       ;; | ||||||
|  |     p) | ||||||
|  |       prefix="$OPTARG" | ||||||
|  |       ;; | ||||||
|  |     ?*) | ||||||
|  |       echo "invalid arguments." && exit 1 | ||||||
|  |       ;; | ||||||
|  |   esac | ||||||
|  | done | ||||||
|  |  | ||||||
|  | mkdir $prefix || exit 1 | ||||||
|  | wget https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.bz2 || exit 1 | ||||||
|  | tar xf boost_1_76_0.tar.bz2 || exit 1 | ||||||
|  | cd boost_1_76_0 | ||||||
|  | ./bootstrap.sh || exit 1 | ||||||
|  |  | ||||||
|  | build() | ||||||
|  | { | ||||||
|  |   if [ "$bit" = "both" ]; then | ||||||
|  |     build_boost $1 32 $prefix | ||||||
|  |     build_boost $1 64 $prefix | ||||||
|  |   else | ||||||
|  |     build_boost $1 $bit $prefix | ||||||
|  |   fi | ||||||
|  | } | ||||||
|  |  | ||||||
|  | if [ "$toolset" = "both" ]; then | ||||||
|  |   build gcc | ||||||
|  |   build clang | ||||||
|  | else | ||||||
|  |   build $toolset | ||||||
|  | fi | ||||||
							
								
								
									
										51
									
								
								.github/depends/zlib.sh
									
									
									
									
										vendored
									
									
										Executable file
									
								
							
							
						
						
									
										51
									
								
								.github/depends/zlib.sh
									
									
									
									
										vendored
									
									
										Executable file
									
								
							| @@ -0,0 +1,51 @@ | |||||||
|  | #!/bin/bash | ||||||
|  |  | ||||||
|  | usage() | ||||||
|  | { | ||||||
|  |   cat <<EOL | ||||||
|  |   -b   - 32-bit or 64-bit library, maybe 32 or 64 | ||||||
|  |   -p   - installation prefix | ||||||
|  | EOL | ||||||
|  | } | ||||||
|  |  | ||||||
|  | bit="64" | ||||||
|  | prefix="$HOME/zlib-prefix" | ||||||
|  |  | ||||||
|  | while getopts "b:t:p:" c; do | ||||||
|  |   case "$c" in | ||||||
|  |     b) | ||||||
|  |       bit="$OPTARG" | ||||||
|  |       [ "$bit" != "32" ] && [ "$bit" != "64" ] && [ "$bit" != "both" ] && usage && exit 1 | ||||||
|  |       ;; | ||||||
|  |     p) | ||||||
|  |       prefix="$OPTARG" | ||||||
|  |       ;; | ||||||
|  |     ?*) | ||||||
|  |       echo "invalid arguments." && exit 1 | ||||||
|  |       ;; | ||||||
|  |   esac | ||||||
|  | done | ||||||
|  |  | ||||||
|  | mkdir $prefix || exit 1 | ||||||
|  | wget https://zlib.net/zlib-1.3.1.tar.gz || exit 1 | ||||||
|  | tar -xf zlib-1.3.1.tar.gz || exit 1 | ||||||
|  | cd zlib-1.3.1 | ||||||
|  |  | ||||||
|  | build() | ||||||
|  | { | ||||||
|  |   cmake \ | ||||||
|  |     -D CMAKE_BUILD_TYPE=Release \ | ||||||
|  |     -D CMAKE_INSTALL_PREFIX=$2/$1 \ | ||||||
|  |     -D CMAKE_C_FLAGS="-m$1" \ | ||||||
|  |     -D CMAKE_SHARED_LINKER_FLAGS="-m$1" \ | ||||||
|  |     -B build$1 \ | ||||||
|  |     -S . | ||||||
|  |   cmake --build build$1 --target install | ||||||
|  | } | ||||||
|  |  | ||||||
|  | if [ "$bit" = "both" ]; then | ||||||
|  |   build 32 $prefix | ||||||
|  |   build 64 $prefix | ||||||
|  | else | ||||||
|  |   build $bit $prefix | ||||||
|  | fi | ||||||
							
								
								
									
										74
									
								
								.github/workflows/coverage.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										74
									
								
								.github/workflows/coverage.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,74 @@ | |||||||
|  | name: coverage | ||||||
|  |  | ||||||
|  | on: | ||||||
|  |   pull_request: | ||||||
|  |     types: [opened, synchronize] | ||||||
|  |   push: | ||||||
|  |     branches: | ||||||
|  |     - cpp_master | ||||||
|  |     tags: | ||||||
|  |     - '*' | ||||||
|  |  | ||||||
|  | jobs: | ||||||
|  |   codecov: | ||||||
|  |     timeout-minutes: 30 | ||||||
|  |     runs-on: ubuntu-latest | ||||||
|  |  | ||||||
|  |     steps: | ||||||
|  |     - uses: actions/checkout@v1 | ||||||
|  |     - name: Install build dependencies | ||||||
|  |       run: | | ||||||
|  |         sudo apt-get update | ||||||
|  |         sudo apt-get install g++-10 cmake lcov -y | ||||||
|  |         ./ci/set_gcc_10.sh | ||||||
|  |  | ||||||
|  |     - name: Cache boost | ||||||
|  |       id: cache-boost | ||||||
|  |       uses: actions/cache@v1 | ||||||
|  |       with: | ||||||
|  |         path: ~/boost-prefix/ | ||||||
|  |         key: ${{ runner.os }}-boost-64-1-76-0-2021-08-09 | ||||||
|  |  | ||||||
|  |     - name: Build boost | ||||||
|  |       if: steps.cache-boost.outputs.cache-hit != 'true' | ||||||
|  |       run: ./.github/depends/boost.sh -b 64 -t gcc -p $HOME/boost-prefix | ||||||
|  |  | ||||||
|  |     - name: Cache zlib | ||||||
|  |       id: cache-zlib | ||||||
|  |       uses: actions/cache@v1 | ||||||
|  |       with: | ||||||
|  |         path: ~/zlib-prefix/ | ||||||
|  |         key: ${{ runner.os }}-zlib-64-1-2-11-2021-08-09 | ||||||
|  |  | ||||||
|  |     - name: Build zlib | ||||||
|  |       if: steps.cache-zlib.outputs.cache-hit != 'true' | ||||||
|  |       run: ./.github/depends/zlib.sh -b 64 -p $HOME/zlib-prefix | ||||||
|  |  | ||||||
|  |     - name: Compile tests | ||||||
|  |       run: | | ||||||
|  |         mkdir build | ||||||
|  |         cmake \ | ||||||
|  |             -D MSGPACK_CXX20=ON \ | ||||||
|  |             -D MSGPACK_32BIT=OFF \ | ||||||
|  |             -D MSGPACK_CHAR_SIGN=signed \ | ||||||
|  |             -D MSGPACK_USE_X3_PARSE=ON \ | ||||||
|  |             -D MSGPACK_BUILD_EXAMPLES=ON \ | ||||||
|  |             -D MSGPACK_BUILD_TESTS=ON \ | ||||||
|  |             -D CMAKE_BUILD_TYPE=Debug \ | ||||||
|  |             -D MSGPACK_GEN_COVERAGE=ON \ | ||||||
|  |             -D MSGPACK_USE_STD_VARIANT_ADAPTOR=ON \ | ||||||
|  |             -D CMAKE_PREFIX_PATH="$HOME/zlib-prefix/64;$HOME/boost-prefix/64" \ | ||||||
|  |             -B build \ | ||||||
|  |             -S . || exit 1 | ||||||
|  |         cmake --build build --target all || exit 1 | ||||||
|  |         ctest --test-dir build || exit 1 | ||||||
|  |  | ||||||
|  |     - name: Upload coverage to Codecov | ||||||
|  |       working-directory: build | ||||||
|  |       run: | | ||||||
|  |         # Create lcov report | ||||||
|  |         lcov --capture --directory . --output-file coverage.info | ||||||
|  |         lcov --remove coverage.info '/usr/*' --output-file coverage.info # filter system-files | ||||||
|  |         lcov --list coverage.info # debug info | ||||||
|  |         # Uploading report to CodeCov | ||||||
|  |         bash <(curl -s https://codecov.io/bash) -f coverage.info || echo "Codecov did not collect coverage reports" | ||||||
							
								
								
									
										239
									
								
								.github/workflows/gha.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										239
									
								
								.github/workflows/gha.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,239 @@ | |||||||
|  | name: CI | ||||||
|  |  | ||||||
|  | on: | ||||||
|  |   pull_request: | ||||||
|  |     types: [opened, synchronize] | ||||||
|  |   push: | ||||||
|  |     branches: | ||||||
|  |     - cpp_master | ||||||
|  |     tags: | ||||||
|  |     - '*' | ||||||
|  |  | ||||||
|  | jobs: | ||||||
|  |   macos: | ||||||
|  |     name: ${{ format('macOS (pattern {0})', matrix.pattern) }} | ||||||
|  |     runs-on: macos-latest | ||||||
|  |     strategy: | ||||||
|  |       fail-fast: false | ||||||
|  |       matrix: | ||||||
|  |         pattern: [0, 1, 2, 3, 4] | ||||||
|  |     steps: | ||||||
|  |     - uses: actions/checkout@v2 | ||||||
|  |  | ||||||
|  |     - name: Cache boost | ||||||
|  |       id: cache-boost | ||||||
|  |       uses: actions/cache@v2 | ||||||
|  |       with: | ||||||
|  |         path: ~/boost-prefix/ | ||||||
|  |         key: ${{ runner.os }}-boost-1-76-0-2022-08-09 | ||||||
|  |  | ||||||
|  |     - name: Build boost | ||||||
|  |       if: steps.cache-boost.outputs.cache-hit != 'true' | ||||||
|  |       run: ./.github/depends/boost.sh -b 64 -t clang -p $HOME/boost-prefix | ||||||
|  |  | ||||||
|  |     - name: Cache zlib | ||||||
|  |       id: cache-zlib | ||||||
|  |       uses: actions/cache@v2 | ||||||
|  |       with: | ||||||
|  |         path: ~/zlib-prefix/ | ||||||
|  |         key: ${{ runner.os }}-zlib-1-2-13-2022-11-02 | ||||||
|  |  | ||||||
|  |     - name: Build zlib | ||||||
|  |       if: steps.cache-zlib.outputs.cache-hit != 'true' | ||||||
|  |       run: ./.github/depends/zlib.sh -b 64 -p $HOME/zlib-prefix | ||||||
|  |  | ||||||
|  |     - name: Build and test | ||||||
|  |       shell: bash | ||||||
|  |       run: | | ||||||
|  |         # default configuration - overwrite its params later depending on matrix.pattern | ||||||
|  |         export MSGPACK_CXX_VERSION="MSGPACK_CXX20=ON" | ||||||
|  |         export ARCH=64 | ||||||
|  |         export API_VERSION=3 | ||||||
|  |         export CHAR_SIGN="signed" | ||||||
|  |         export X3_PARSE="OFF" | ||||||
|  |         export SANITIZE="-fsanitize=undefined -fno-sanitize-recover=all" | ||||||
|  |  | ||||||
|  |         case ${{ matrix.pattern }} in | ||||||
|  |           0) | ||||||
|  |             export MSGPACK_CXX_VERSION="MSGPACK_CXX11=OFF" | ||||||
|  |             ;; | ||||||
|  |           1) | ||||||
|  |             export API_VERSION=1 | ||||||
|  |             ;; | ||||||
|  |           2) | ||||||
|  |             export API_VERSION=2 | ||||||
|  |             ;; | ||||||
|  |           3) | ||||||
|  |             export X3_PARSE="ON" | ||||||
|  |             ;; | ||||||
|  |           4) | ||||||
|  |             export CHAR_SIGN="unsigned" | ||||||
|  |             ;; | ||||||
|  |         esac | ||||||
|  |  | ||||||
|  |         # build and test | ||||||
|  |         export CXX="clang++" | ||||||
|  |         CMAKE_CXX_COMPILER="$CXX" CXXFLAGS="-Werror -g ${SANITIZE}" ci/build_cmake.sh || exit 1 | ||||||
|  |  | ||||||
|  |         cat Files.cmake| grep ".*\.[h|hpp]" | perl -pe 's/ //g' | sort > tmp1  && find include -name "*.h" -o -name "*.hpp" | sort > tmp2 && diff tmp1 tmp2 | ||||||
|  |  | ||||||
|  |   linux: | ||||||
|  |     name: ${{ format('Linux (pattern {0})', matrix.pattern) }} | ||||||
|  |     runs-on: ubuntu-20.04 | ||||||
|  |     strategy: | ||||||
|  |       fail-fast: false | ||||||
|  |       matrix: | ||||||
|  |         pattern: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] | ||||||
|  |     steps: | ||||||
|  |     - uses: actions/checkout@v2 | ||||||
|  |  | ||||||
|  |     - name: Install build dependencies | ||||||
|  |       shell: bash | ||||||
|  |       run: | | ||||||
|  |         sudo apt-get update | ||||||
|  |         sudo apt-get install g++-10 cmake valgrind -y | ||||||
|  |         sudo apt-get install g++-10-multilib -y  # for 32-bit compile | ||||||
|  |         ./ci/set_gcc_10.sh | ||||||
|  |  | ||||||
|  |     - name: Cache boost | ||||||
|  |       id: cache-boost | ||||||
|  |       uses: actions/cache@v2 | ||||||
|  |       with: | ||||||
|  |         path: ~/boost-prefix/ | ||||||
|  |         key: ${{ runner.os }}-boost-1-76-0-2021-08-09 | ||||||
|  |  | ||||||
|  |     - name: Build boost | ||||||
|  |       if: steps.cache-boost.outputs.cache-hit != 'true' | ||||||
|  |       run: ./.github/depends/boost.sh -b both -t gcc -p $HOME/boost-prefix | ||||||
|  |  | ||||||
|  |     - name: Cache zlib | ||||||
|  |       id: cache-zlib | ||||||
|  |       uses: actions/cache@v2 | ||||||
|  |       with: | ||||||
|  |         path: ~/zlib-prefix/ | ||||||
|  |         key: ${{ runner.os }}-zlib-1-2-13-2022-11-02 | ||||||
|  |  | ||||||
|  |     - name: Build zlib | ||||||
|  |       if: steps.cache-zlib.outputs.cache-hit != 'true' | ||||||
|  |       run: ./.github/depends/zlib.sh -b both -p $HOME/zlib-prefix | ||||||
|  |  | ||||||
|  |     - name: Build and test | ||||||
|  |       shell: bash | ||||||
|  |       run: | | ||||||
|  |         # default configuration - overwrite its params later depending on matrix.pattern | ||||||
|  |         export MSGPACK_CXX_VERSION="MSGPACK_CXX20=ON" | ||||||
|  |         export ARCH=64 | ||||||
|  |         export API_VERSION=3 | ||||||
|  |         export CHAR_SIGN="signed" | ||||||
|  |         export X3_PARSE="OFF" | ||||||
|  |         export SANITIZE="-fsanitize=undefined -fno-sanitize-recover=all" | ||||||
|  |         export ACTION="ci/build_cmake.sh" | ||||||
|  |  | ||||||
|  |         case ${{ matrix.pattern }} in | ||||||
|  |           0) | ||||||
|  |             export CXX="clang++-10" | ||||||
|  |             export MSGPACK_CXX_VERSION="MSGPACK_CXX11=OFF" | ||||||
|  |             ;; | ||||||
|  |           1) | ||||||
|  |             export CXX="g++-10" | ||||||
|  |             export MSGPACK_CXX_VERSION="MSGPACK_CXX11=ON" | ||||||
|  |             ;; | ||||||
|  |           2) | ||||||
|  |             export CXX="clang++-10" | ||||||
|  |             export MSGPACK_CXX_VERSION="MSGPACK_CXX14=ON" | ||||||
|  |             ;; | ||||||
|  |           3) | ||||||
|  |             export CXX="g++-10" | ||||||
|  |             export MSGPACK_CXX_VERSION="MSGPACK_CXX17=ON" | ||||||
|  |             export MSGPACK_USE_STD_VARIANT_ADAPTOR="MSGPACK_USE_STD_VARIANT_ADAPTOR=ON" | ||||||
|  |             ;; | ||||||
|  |           4) | ||||||
|  |             export CXX="clang++-10" | ||||||
|  |             export MSGPACK_CXX_VERSION="MSGPACK_CXX20=ON" | ||||||
|  |             export NO_BOOST="-DMSGPACK_NO_BOOST" | ||||||
|  |             ;; | ||||||
|  |           5) | ||||||
|  |             export CXX="g++-10" | ||||||
|  |             export ARCH=32 | ||||||
|  |             ;; | ||||||
|  |           6) | ||||||
|  |             export CXX="clang++-10" | ||||||
|  |             export API_VERSION=2 | ||||||
|  |             ;; | ||||||
|  |           7) | ||||||
|  |             export CXX="g++-10" | ||||||
|  |             export API_VERSION=1 | ||||||
|  |             ;; | ||||||
|  |           8) | ||||||
|  |             export CXX="clang++-10" | ||||||
|  |             export CHAR_SIGN="unsigned" | ||||||
|  |             ;; | ||||||
|  |           9) | ||||||
|  |             export CXX="g++-10" | ||||||
|  |             export X3_PARSE="ON" | ||||||
|  |             ;; | ||||||
|  |           10) | ||||||
|  |             export CXX="clang++-10" | ||||||
|  |             export ACTION="ci/build_regression.sh" | ||||||
|  |             ;; | ||||||
|  |           11) | ||||||
|  |             export CXX="g++-10" | ||||||
|  |             export ARCH=32 | ||||||
|  |             export CHAR_SIGN="unsigned" | ||||||
|  |             export X3_PARSE="ON" | ||||||
|  |             ;; | ||||||
|  |         esac | ||||||
|  |  | ||||||
|  |         # build and test | ||||||
|  |         CMAKE_CXX_COMPILER="$CXX" CXXFLAGS="-Werror -g ${SANITIZE} ${NO_BOOST}" ci/build_cmake.sh || exit 1 | ||||||
|  |         cat Files.cmake| grep ".*\.[h|hpp]" | perl -pe 's/ //g' | sort > tmp1  && find include -name "*.h" -o -name "*.hpp" | sort > tmp2 && diff tmp1 tmp2 | ||||||
|  |  | ||||||
|  |   windows: | ||||||
|  |     name: ${{ format('Windows cxx{0}', matrix.cxx) }} | ||||||
|  |     runs-on: windows-2019 | ||||||
|  |     strategy: | ||||||
|  |       fail-fast: false | ||||||
|  |       matrix: | ||||||
|  |         # MSVC2019 only supports /std:c++14, /std:c++17 and /std:c++latest | ||||||
|  |         cxx: [14, 17, 20] | ||||||
|  |         pp_flag: ["/Zc:preprocessor-", "/Zc:preprocessor"] | ||||||
|  |     steps: | ||||||
|  |     - uses: actions/checkout@v2 | ||||||
|  |  | ||||||
|  |     - name: Cache vcpkg dependencies | ||||||
|  |       id: cache-vcpkg | ||||||
|  |       uses: actions/cache@v2 | ||||||
|  |       with: | ||||||
|  |         path: C:/vcpkg/installed/x64-windows | ||||||
|  |         key: ${{ runner.os }}-vcpkg-2021-08-09 | ||||||
|  |  | ||||||
|  |     - name: Install vcpkg dependencies | ||||||
|  |       if: steps.cache-vcpkg.outputs.cache-hit != 'true' | ||||||
|  |       shell: powershell | ||||||
|  |       run: | | ||||||
|  |         vcpkg update | ||||||
|  |         vcpkg install zlib:x64-windows | ||||||
|  |         vcpkg install boost-assert:x64-windows boost-numeric-conversion:x64-windows boost-variant:x64-windows boost-utility:x64-windows boost-fusion:x64-windows boost-optional:x64-windows boost-predef:x64-windows boost-preprocessor:x64-windows boost-timer:x64-windows boost-test:x64-windows | ||||||
|  |  | ||||||
|  |     - name: Build and test | ||||||
|  |       shell: powershell | ||||||
|  |       run: | | ||||||
|  |         $CPPVER="MSGPACK_CXX${{ matrix.cxx }}=ON" | ||||||
|  |  | ||||||
|  |         md build | ||||||
|  |         cmake ` | ||||||
|  |             -A x64 ` | ||||||
|  |             -G "Visual Studio 16 2019" ` | ||||||
|  |             -D CMAKE_TOOLCHAIN_FILE="C:/vcpkg/scripts/buildsystems/vcpkg.cmake" ` | ||||||
|  |             -D MSGPACK_BUILD_TESTS=ON ` | ||||||
|  |             -D $CPPVER ` | ||||||
|  |             -D CMAKE_CXX_FLAGS="${{ matrix.pp_flag }} /D_VARIADIC_MAX=10 /EHsc /D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING /D_SILENCE_CXX17_ALLOCATOR_VOID_DEPRECATION_WARNING /D_SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING /W3 /WX" ` | ||||||
|  |             -B build ` | ||||||
|  |             -S . | ||||||
|  |         if ($LastExitCode -ne 0) { exit $LastExitCode } | ||||||
|  |  | ||||||
|  |         cmake --build build --config Release | ||||||
|  |         if ($LastExitCode -ne 0) { exit $LastExitCode } | ||||||
|  |  | ||||||
|  |         ctest -VV --test-dir build -C Release | ||||||
|  |         if ($LastExitCode -ne 0) { exit $LastExitCode } | ||||||
							
								
								
									
										5
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										5
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -49,3 +49,8 @@ Makefile | |||||||
| /test/streaming_c | /test/streaming_c | ||||||
| /test/version | /test/version | ||||||
| /test/zone | /test/zone | ||||||
|  |  | ||||||
|  | build | ||||||
|  | *-build | ||||||
|  | .cache | ||||||
|  | compile_commands.json | ||||||
|   | |||||||
							
								
								
									
										6
									
								
								.gitmodules
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								.gitmodules
									
									
									
									
										vendored
									
									
								
							| @@ -1,6 +0,0 @@ | |||||||
| [submodule "external/boost/predef"] |  | ||||||
| 	path = external/boost/predef |  | ||||||
| 	url = https://github.com/boostorg/predef.git |  | ||||||
| [submodule "external/boost/preprocessor"] |  | ||||||
| 	path = external/boost/preprocessor |  | ||||||
| 	url = https://github.com/boostorg/preprocessor.git |  | ||||||
							
								
								
									
										206
									
								
								.travis.yml
									
									
									
									
									
								
							
							
						
						
									
										206
									
								
								.travis.yml
									
									
									
									
									
								
							| @@ -1,206 +0,0 @@ | |||||||
| language: cpp |  | ||||||
| sudo: false |  | ||||||
|  |  | ||||||
| install: |  | ||||||
|  - export BASE=`pwd` |  | ||||||
|  - mkdir ${BASE}/usr |  | ||||||
|  - if [ "$TRAVIS_OS_NAME" == "linux" ]; then wget --no-check-certificate https://cmake.org/files/v3.7/cmake-3.7.1-Linux-x86_64.sh -O cmake-3.7.1-Linux-x86_64.sh; fi |  | ||||||
|  - if [ "$TRAVIS_OS_NAME" == "linux" ]; then chmod a+x cmake-3.7.1-Linux-x86_64.sh; fi |  | ||||||
|  - if [ "$TRAVIS_OS_NAME" == "linux" ]; then ./cmake-3.7.1-Linux-x86_64.sh --prefix=${BASE}/usr --skip-license; fi |  | ||||||
|  - if [ "$TRAVIS_OS_NAME" == "linux" ]; then export PATH="${BASE}/usr/bin:$PATH"; fi |  | ||||||
|  - if [ "$TRAVIS_OS_NAME" == "linux" ]; then export LD_LIBRARY_PATH="${BASE}/usr/lib:$LD_LIBRARY_PATH"; fi |  | ||||||
|  - if [ "$CXX" = "g++" ]; then export CXX="g++-6" CC="gcc-6"; fi |  | ||||||
|  - if [ "$CXX" = "clang++" ] && [ "$TRAVIS_OS_NAME" == "linux" ]; then export CXX="clang++-3.9" CC="clang-3.9"; fi |  | ||||||
| #gtest |  | ||||||
|  - wget https://github.com/google/googletest/archive/release-1.7.0.zip -O googletest-release-1.7.0.zip |  | ||||||
|  - unzip -q googletest-release-1.7.0.zip |  | ||||||
|  - cd googletest-release-1.7.0 |  | ||||||
|  - $CXX -m${ARCH} src/gtest-all.cc -I. -Iinclude -c |  | ||||||
|  - $CXX -m${ARCH} src/gtest_main.cc -I. -Iinclude -c |  | ||||||
|  - ar -rv libgtest.a gtest-all.o |  | ||||||
|  - ar -rv libgtest_main.a gtest_main.o |  | ||||||
|  - mkdir -p ${BASE}/usr/include |  | ||||||
|  - cp -r include/gtest ${BASE}/usr/include |  | ||||||
|  - mkdir -p ${BASE}/usr/lib |  | ||||||
|  - mv *.a ${BASE}/usr/lib |  | ||||||
|  - cd .. |  | ||||||
| # valgrind |  | ||||||
|  - if [ "$TRAVIS_OS_NAME" == "linux" ]; then wget http://valgrind.org/downloads/valgrind-3.12.0.tar.bz2 && tar xjf valgrind-3.12.0.tar.bz2 && cd valgrind-3.12.0 && ./configure --prefix=${BASE}/usr > /dev/null && make -j3 > /dev/null && make install > /dev/null && cd ..; fi |  | ||||||
| # boost |  | ||||||
|  - if [ "$BOOST" == "ON" ]; then wget http://sourceforge.net/projects/boost/files/boost/1.63.0/boost_1_63_0.zip && unzip -q boost_1_63_0.zip && cd boost_1_63_0 && ./bootstrap.sh && ./b2 -j3 --prefix=${BASE}/usr --with-chrono --with-context --with-system --with-timer address-model=${ARCH} install > /dev/null && cd ..; fi |  | ||||||
|  |  | ||||||
| matrix: |  | ||||||
|   include: |  | ||||||
|     - os: osx |  | ||||||
|       compiler: clang |  | ||||||
|       env: ACTION="ci/build_cmake.sh"  CXX11="ON" ARCH="64"   BOOST="ON" SHARED="ON"  CHAR_SIGN="unsigned" API_VERSION="1" |  | ||||||
|     - os: osx |  | ||||||
|       compiler: clang |  | ||||||
|       env:  ACTION="ci/build_cmake.sh" CXX11="ON" ARCH="64"   BOOST="ON" SHARED="ON"  CHAR_SIGN="signed"   API_VERSION="2" |  | ||||||
|     - os: osx |  | ||||||
|       compiler: clang |  | ||||||
|       env: ACTION="ci/build_cmake.sh"  CXX11="ON" ARCH="64"              SHARED="ON"  CHAR_SIGN="signed"   API_VERSION="2" |  | ||||||
|     - os: osx |  | ||||||
|       compiler: clang |  | ||||||
|       env: ACTION="ci/build_cmake.sh"             ARCH="64"              SHARED="ON"  CHAR_SIGN="unsigned" API_VERSION="2" |  | ||||||
|     - os: linux |  | ||||||
|       compiler: clang |  | ||||||
|       env: ACTION="ci/build_cmake.sh"             ARCH="64"   BOOST="ON" SHARED="ON"  CHAR_SIGN="unsigned" API_VERSION="1" |  | ||||||
|       addons: |  | ||||||
|         apt: |  | ||||||
|           sources: |  | ||||||
|             - ubuntu-toolchain-r-test |  | ||||||
|             - llvm-toolchain-precise-3.9 |  | ||||||
|             - llvm-toolchain-precise |  | ||||||
|           packages: |  | ||||||
|             - g++-multilib |  | ||||||
|             - gcc-multilib |  | ||||||
|             - gcc-5-multilib |  | ||||||
|             - g++-5-multilib |  | ||||||
|             - bzip2 |  | ||||||
|             - clang-3.9 |  | ||||||
|             - libc6-dbg |  | ||||||
|     - os: linux |  | ||||||
|       compiler: clang |  | ||||||
|       env: ACTION="ci/build_cmake.sh"             ARCH="32"              SHARED="ON"  CHAR_SIGN="signed"   API_VERSION="2" |  | ||||||
|       addons: |  | ||||||
|         apt: |  | ||||||
|           sources: |  | ||||||
|             - ubuntu-toolchain-r-test |  | ||||||
|             - llvm-toolchain-precise-3.9 |  | ||||||
|             - llvm-toolchain-precise |  | ||||||
|           packages: |  | ||||||
|             - g++-multilib |  | ||||||
|             - gcc-multilib |  | ||||||
|             - gcc-5-multilib |  | ||||||
|             - g++-5-multilib |  | ||||||
|             - lib32stdc++6-6-dbg |  | ||||||
|             - lib32gcc1 |  | ||||||
|             - libc6-i386 |  | ||||||
|             - lib32z1-dev |  | ||||||
|             - bzip2 |  | ||||||
|             - clang-3.9 |  | ||||||
|             - libc6-dbg |  | ||||||
|     - os: linux |  | ||||||
|       compiler: clang |  | ||||||
|       env: ACTION="ci/build_cmake.sh"  CXX11="ON" ARCH="64"   BOOST="ON" SHARED="ON"  CHAR_SIGN="signed"   API_VERSION="2" X3_PARSE="ON" |  | ||||||
|       addons: |  | ||||||
|         apt: |  | ||||||
|           sources: |  | ||||||
|             - ubuntu-toolchain-r-test |  | ||||||
|             - llvm-toolchain-precise-3.9 |  | ||||||
|             - llvm-toolchain-precise |  | ||||||
|           packages: |  | ||||||
|             - g++-multilib |  | ||||||
|             - gcc-multilib |  | ||||||
|             - gcc-5-multilib |  | ||||||
|             - g++-5-multilib |  | ||||||
|             - bzip2 |  | ||||||
|             - clang-3.9 |  | ||||||
|             - libc6-dbg |  | ||||||
|     - os: linux |  | ||||||
|       compiler: clang |  | ||||||
|       env: ACTION="ci/build_cmake.sh"  CXX11="ON" ARCH="32"              SHARED="OFF" CHAR_SIGN="unsigned" API_VERSION="2" |  | ||||||
|       addons: |  | ||||||
|         apt: |  | ||||||
|           sources: |  | ||||||
|             - ubuntu-toolchain-r-test |  | ||||||
|             - llvm-toolchain-precise-3.9 |  | ||||||
|             - llvm-toolchain-precise |  | ||||||
|           packages: |  | ||||||
|             - g++-multilib |  | ||||||
|             - gcc-multilib |  | ||||||
|             - gcc-5-multilib |  | ||||||
|             - g++-5-multilib |  | ||||||
|             - lib32stdc++6-6-dbg |  | ||||||
|             - lib32gcc1 |  | ||||||
|             - libc6-i386 |  | ||||||
|             - lib32z1-dev |  | ||||||
|             - bzip2 |  | ||||||
|             - clang-3.9 |  | ||||||
|             - libc6-dbg |  | ||||||
|     - os: linux |  | ||||||
|       compiler: gcc |  | ||||||
|       env: ACTION="ci/build_cmake.sh"  CXX11="ON" ARCH="64"              SHARED="ON"  CHAR_SIGN="signed"   API_VERSION="2" |  | ||||||
|       addons: |  | ||||||
|         apt: |  | ||||||
|           sources: |  | ||||||
|             - ubuntu-toolchain-r-test |  | ||||||
|           packages: |  | ||||||
|             - g++-multilib |  | ||||||
|             - gcc-multilib |  | ||||||
|             - gcc-6-multilib |  | ||||||
|             - g++-6-multilib |  | ||||||
|             - bzip2 |  | ||||||
|             - libc6-dbg |  | ||||||
|     - os: linux |  | ||||||
|       compiler: gcc |  | ||||||
|       env: ACTION="ci/build_cmake.sh"  CXX11="ON" ARCH="32"   BOOST="ON" SHARED="ON"  CHAR_SIGN="unsigned" API_VERSION="2" X3_PARSE="ON" |  | ||||||
|       addons: |  | ||||||
|         apt: |  | ||||||
|           sources: |  | ||||||
|             - ubuntu-toolchain-r-test |  | ||||||
|           packages: |  | ||||||
|             - g++-multilib |  | ||||||
|             - gcc-multilib |  | ||||||
|             - gcc-6-multilib |  | ||||||
|             - g++-6-multilib |  | ||||||
|             - lib32stdc++6-6-dbg |  | ||||||
|             - lib32gcc1 |  | ||||||
|             - libc6-i386 |  | ||||||
|             - lib32z1-dev |  | ||||||
|             - bzip2 |  | ||||||
|             - libc6-dbg |  | ||||||
|     - os: linux |  | ||||||
|       compiler: gcc |  | ||||||
|       env: ACTION="ci/build_cmake.sh"             ARCH="64"              SHARED="ON"  CHAR_SIGN="unsigned" API_VERSION="2" |  | ||||||
|       addons: |  | ||||||
|         apt: |  | ||||||
|           sources: |  | ||||||
|             - ubuntu-toolchain-r-test |  | ||||||
|           packages: |  | ||||||
|             - g++-multilib |  | ||||||
|             - gcc-multilib |  | ||||||
|             - gcc-6-multilib |  | ||||||
|             - g++-6-multilib |  | ||||||
|             - bzip2 |  | ||||||
|             - libc6-dbg |  | ||||||
|     - os: linux |  | ||||||
|       compiler: gcc |  | ||||||
|       env: ACTION="ci/build_cmake.sh"             ARCH="32"   BOOST="ON" SHARED="OFF" CHAR_SIGN="signed"   API_VERSION="1" |  | ||||||
|       addons: |  | ||||||
|         apt: |  | ||||||
|           sources: |  | ||||||
|             - ubuntu-toolchain-r-test |  | ||||||
|           packages: |  | ||||||
|             - g++-multilib |  | ||||||
|             - gcc-multilib |  | ||||||
|             - gcc-6-multilib |  | ||||||
|             - g++-6-multilib |  | ||||||
|             - lib32stdc++6-6-dbg |  | ||||||
|             - lib32gcc1 |  | ||||||
|             - libc6-i386 |  | ||||||
|             - lib32z1-dev |  | ||||||
|             - bzip2 |  | ||||||
|             - libc6-dbg |  | ||||||
|     - os: linux |  | ||||||
|       compiler: gcc |  | ||||||
|       env: ACTION="ci/build_cmake.sh"             ARCH="32"   BOOST="ON" SHARED="OFF" CHAR_SIGN="signed"   API_VERSION="2" |  | ||||||
|       addons: |  | ||||||
|         apt: |  | ||||||
|           sources: |  | ||||||
|             - ubuntu-toolchain-r-test |  | ||||||
|           packages: |  | ||||||
|             - g++-multilib |  | ||||||
|             - gcc-multilib |  | ||||||
|             - gcc-6-multilib |  | ||||||
|             - g++-6-multilib |  | ||||||
|             - lib32stdc++6-6-dbg |  | ||||||
|             - lib32gcc1 |  | ||||||
|             - libc6-i386 |  | ||||||
|             - lib32z1-dev |  | ||||||
|             - bzip2 |  | ||||||
|             - libc6-dbg |  | ||||||
|  |  | ||||||
| script: |  | ||||||
|   - CMAKE_CXX_COMPILER="${CXX}" CMAKE_C_COMPILER="${CC}" CMAKE_LIBRARY_PATH="${BASE}/usr/lib:${BASE}/build" GTEST_ROOT="${BASE}/usr" BOOST_ROOT="${BASE}/usr" ${ACTION} |  | ||||||
							
								
								
									
										155
									
								
								CHANGELOG.md
									
									
									
									
									
								
							
							
						
						
									
										155
									
								
								CHANGELOG.md
									
									
									
									
									
								
							| @@ -1,3 +1,158 @@ | |||||||
|  | # 2024-04-02 version 6.1.1 | ||||||
|  |   * Fix compilation error when std::variant has the same types (#1112) | ||||||
|  |   * Improve CI (#1090, #1110) | ||||||
|  |   * Fix to avoid common function name's (has_as::check) ambiguity/conflict with other libraries' macros  (#1085) | ||||||
|  |  | ||||||
|  | # 2023-07-08 version 6.1.0 | ||||||
|  |   * Remove dependency on boost in chrono.hpp (#1076) | ||||||
|  |   * Add support for std::variant behavior (#1075) | ||||||
|  |   * Fix msgpack::type::variant behavior to respect MessagePack format (#1071) | ||||||
|  |   * Add rebind allocators (#1065) | ||||||
|  |  | ||||||
|  | # 2023-03-02 version 6.0.0 | ||||||
|  | ## << breaking changes >> | ||||||
|  |   * Change CMake package name of C++ library to msgpack-cxx (#1054) | ||||||
|  |     Unified all C++ package, library, cmake, tarball name become msgpack-cxx. | ||||||
|  |  | ||||||
|  | # 2023-01-10 version 5.0.0 for C++ | ||||||
|  |  * Fix config for new MSVC preprocessor (#1040) | ||||||
|  | ## << breaking changes >> | ||||||
|  |  * Change CMake package name of C++ library to msgpackc-cxx (#1045, #1048) | ||||||
|  |  | ||||||
|  | # 2022-11-02 version 4.1.3 for C++ | ||||||
|  |   * Fix compile error that direct inclusion of chrono with `MSGPACK_NO_BOOST` (#1038)) | ||||||
|  |  | ||||||
|  | # 2022-09-07 version 4.1.2 for C++ | ||||||
|  |   * Fix noexcept on zone (#1030) | ||||||
|  |   * Improve cmake support (#1028, #1032) | ||||||
|  |   * Improve CI (#1023) | ||||||
|  |   * Improve supporting platform (#1021) | ||||||
|  |   * Refine double/float packing (#1018) | ||||||
|  |   * Refine include files dependency (#1011) | ||||||
|  |  | ||||||
|  | # 2022-03-09 version 4.1.1 for C++ | ||||||
|  |   * Remove chrono support on `MSGPACK_NO_BOOST` to fix  compile error. | ||||||
|  |   * Improve build system (#1003) | ||||||
|  |  | ||||||
|  | # 2022-02-12 version 4.1.0 for C++ | ||||||
|  |   * Add experimental support for no boost dependency (#1001) | ||||||
|  |     * For cmake, add `-DMSGPACK_USE_BOOST=OFF`. For C++ compiler add `-DMSGPACK_NO_BOOST`. | ||||||
|  |   * Improve BIN console output (#995) | ||||||
|  |   * Fix include notation (#991) | ||||||
|  |  | ||||||
|  | # 2021-10-23 version 4.0.3 for C++ | ||||||
|  |   * Remove Enabler2 template parameter from object adaptor (#987) | ||||||
|  |   * Add MSGPACK_BUILD_DOCS cmake option (#983, #984) | ||||||
|  |  | ||||||
|  | # 2021-08-31 version 4.0.2 for C++ | ||||||
|  |   * Fix fuzzer interface function name (#972) | ||||||
|  |   * Fix boost test link error and support both dynamin(default) and static link boost (#971) | ||||||
|  |  | ||||||
|  | # 2021-08-30 version 4.0.1 for C++ | ||||||
|  |   * Fix release tarball and its generation script (#967) | ||||||
|  |  | ||||||
|  | # 2021-08-29 version 4.0.0 for C++ | ||||||
|  |   * Improve zone alignment logic (#965) | ||||||
|  |   * Fix v1 unpack logic for STR and BIN (#957, #951) | ||||||
|  |   * Fix UB on memcmp with size 0 (#954) | ||||||
|  |   * Fix `iovec` name conflict (#952) | ||||||
|  |   * Add `std::array<std::byte>` `std::span<char>` `std::span<unsigned char>` `std::span<std::byte>` adaptors (#951) | ||||||
|  |   * Improve documents (#918, #919, #951) | ||||||
|  |   * Improve tests (#916) | ||||||
|  |   * Introduce BOOST_ASSERT (#898) | ||||||
|  |   * Improve build system (#897, #905, #924, #951) | ||||||
|  |   * Improve Boost.Fusion support (#894) | ||||||
|  |   * Check nullptr before call memcpy (#891) | ||||||
|  |   * Refine and bugfix `std::chrono::time_point` adaptor (#888, #893) | ||||||
|  |   * Improve CI (#884, #892, #895, #951, #955) | ||||||
|  | ## << breaking changes >> | ||||||
|  |   * Separate C++ part of the msgpack-c  from C/C++ mixed msgpack-c (#876, #878) | ||||||
|  |   * Require boost libraries. See README.md Dependency(#912) | ||||||
|  |  | ||||||
|  | # 2020-06-05 version 3.3.0 | ||||||
|  |   * Add json example for C (#870) | ||||||
|  |   * Add both header and body packing functions for C (#870) | ||||||
|  |   * Set default ref_size and chunk_size to vrefbuffer (#865) | ||||||
|  |   * Add examples (#861) | ||||||
|  |   * Improve build system (#839, #842) | ||||||
|  |   * Improve tests (#829) | ||||||
|  |   * Improve documents (#828) | ||||||
|  |   * Remove some warnings (#827, #851, #871) | ||||||
|  |   * Improve CI environment (#824, #831, #833, #834, #846, #860, 874) | ||||||
|  |  | ||||||
|  | # 2019-12-10 version 3.2.1 | ||||||
|  |   * Fix snprintf return value checking (#821) | ||||||
|  |   * Remove some warnings (#819) | ||||||
|  |   * Fix fbuffer result checking (#812) | ||||||
|  |   * Fix temporary object handling (#807) | ||||||
|  |   * Improve cmake support (#804) | ||||||
|  |   * Fix invalid `int main` parameter (#800) | ||||||
|  |   * Improve supporting platform (#797, #817) | ||||||
|  |   * Fix ZLIB error handling (#795) | ||||||
|  |   * Remove unused variable (#793) | ||||||
|  |   * Improve integer overflow checking (#792) | ||||||
|  |  | ||||||
|  | # 2019-05-27 version 3.2.0 | ||||||
|  |  | ||||||
|  |   * Fix invalid include (#783) | ||||||
|  |   * Add timespec support (#781) | ||||||
|  |   * Fix unchecked fnprintf on C (#780) | ||||||
|  |   * Improve integer overflow checking on C (#776) | ||||||
|  |   * Fix warnings on `-Wconversion` (#770, #777, #784) | ||||||
|  |   * Fix invalid passed by value on aligned_zone_size_visitor (#764) | ||||||
|  |   * Improve windows support (#757, #779) | ||||||
|  |   * Fix msgpack::object size caluclation error (#754) | ||||||
|  |   * Fix memory error on example code (#753) | ||||||
|  |   * Fix redundant memory allocation on C (#747) | ||||||
|  |   * Fix msgpack::type::tuple base class conversion (#743) | ||||||
|  |  | ||||||
|  | # 2018-09-09 version 3.1.1 | ||||||
|  |  | ||||||
|  |   * Add force endian set functionality (#736) | ||||||
|  |   * Fix vrefbuffer memory management problem (#733) | ||||||
|  |   * Fix msvc specific problem (#731, #732) | ||||||
|  |   * Update boost from 1.61.0 to 1.68.0 (#730) | ||||||
|  |   * Fix msgpack_timestamp type mismatch bug (#726) | ||||||
|  |  | ||||||
|  | # 2018-08-10 version 3.1.0 | ||||||
|  |  | ||||||
|  |   * Improve documents (#687, #718) | ||||||
|  |   * Add fuzzer support (#689) | ||||||
|  |   * Fix msgpack::object union member access bug (#694) | ||||||
|  |   * Improve cross platform configuration (#704) | ||||||
|  |   * Fix out of range dereference bug of EXT (#705) | ||||||
|  |   * Add timestamp support. std::chrono::system_clock::time_point is mapped to TIMESTAMP (#706) | ||||||
|  |   * Add minimal timestamp support for C. The type `msgpack_timestamp` and the function `msgpack_object_to_timestamp()` are introduced (#707) | ||||||
|  |   * Improve MSGPACK_DEFINE family name confliction probability (#710) | ||||||
|  |   * Add no static-library build option (BUILD_SHARED_LIBS=ON) (#713, #717, #722) | ||||||
|  |   * Add header only cmake target (#721) | ||||||
|  |   * Add `std::byte` adaptor (#719) | ||||||
|  |   * Remove some warnings (#720) | ||||||
|  |  | ||||||
|  | # 2018-05-12 version 3.0.1 | ||||||
|  |  | ||||||
|  |   * Add fuzz directory to release tar ball (#686) | ||||||
|  |   * Add include file checking for X-Code (#683) | ||||||
|  |  | ||||||
|  | # 2018-05-09 version 3.0.0 | ||||||
|  |  | ||||||
|  | ## << breaking changes >> | ||||||
|  |  | ||||||
|  |   * Change offset parameter updating rule. If parse error happens, offset is updated to the error position. (#639, #666) | ||||||
|  |  | ||||||
|  | ## << other updates >> | ||||||
|  |  | ||||||
|  |   * Improve cross platform configuration (#655, #677) | ||||||
|  |   * Improve build system (#647) | ||||||
|  |   * Improve user class adaptor (#645, #673) | ||||||
|  |   * Improve msgpack::object visitation logic (#676) | ||||||
|  |   * Remove some warnings (#641, 659) | ||||||
|  |   * Add `->` and `*` operators to object_handle (#635) | ||||||
|  |   * Improve CI environment (#631, #634, #643, #657, #662, #668) | ||||||
|  |   * Improve documents (#630, #661) | ||||||
|  |   * Refactoring (#670) | ||||||
|  |   * Add OSS-Fuzz support (#672, #674, #675, #678) | ||||||
|  |  | ||||||
| # 2017-08-04 version 2.1.5 | # 2017-08-04 version 2.1.5 | ||||||
|   * Improve cross platform configuration (#624) |   * Improve cross platform configuration (#624) | ||||||
|   * Add boost asio examples (including zlib) (#610) |   * Add boost asio examples (including zlib) (#610) | ||||||
|   | |||||||
							
								
								
									
										452
									
								
								CMakeLists.txt
									
									
									
									
									
								
							
							
						
						
									
										452
									
								
								CMakeLists.txt
									
									
									
									
									
								
							| @@ -1,13 +1,12 @@ | |||||||
| CMAKE_MINIMUM_REQUIRED (VERSION 2.8.12) | CMAKE_MINIMUM_REQUIRED (VERSION 3.1 FATAL_ERROR) | ||||||
|  |  | ||||||
| IF ((CMAKE_VERSION VERSION_GREATER 3.1) OR | CMAKE_POLICY (SET CMP0054 NEW) | ||||||
|     (CMAKE_VERSION VERSION_EQUAL 3.1)) |  | ||||||
|     CMAKE_POLICY(SET CMP0054 NEW) |  | ||||||
| ENDIF () |  | ||||||
|  |  | ||||||
| PROJECT (msgpack) | PROJECT (msgpack-cxx LANGUAGES CXX) | ||||||
|  |  | ||||||
| FILE (READ ${CMAKE_CURRENT_SOURCE_DIR}/include/msgpack/version_master.h contents) | ADD_LIBRARY (msgpack-cxx INTERFACE) | ||||||
|  |  | ||||||
|  | FILE (READ ${CMAKE_CURRENT_SOURCE_DIR}/include/msgpack/version_master.hpp contents) | ||||||
| STRING (REGEX MATCH "#define MSGPACK_VERSION_MAJOR *([0-9a-zA-Z_]*)" NULL_OUT ${contents}) | STRING (REGEX MATCH "#define MSGPACK_VERSION_MAJOR *([0-9a-zA-Z_]*)" NULL_OUT ${contents}) | ||||||
| SET (VERSION_MAJOR ${CMAKE_MATCH_1}) | SET (VERSION_MAJOR ${CMAKE_MATCH_1}) | ||||||
| STRING (REGEX MATCH "#define MSGPACK_VERSION_MINOR *([0-9a-zA-Z_]*)" NULL_OUT ${contents}) | STRING (REGEX MATCH "#define MSGPACK_VERSION_MINOR *([0-9a-zA-Z_]*)" NULL_OUT ${contents}) | ||||||
| @@ -16,149 +15,92 @@ STRING (REGEX MATCH "#define MSGPACK_VERSION_REVISION *([0-9a-zA-Z_]*)" NULL_OUT | |||||||
| SET (VERSION_REVISION ${CMAKE_MATCH_1}) | SET (VERSION_REVISION ${CMAKE_MATCH_1}) | ||||||
| SET (VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REVISION}) | SET (VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REVISION}) | ||||||
|  |  | ||||||
| SET (prefix ${CMAKE_INSTALL_PREFIX}) | LIST (APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/") | ||||||
| SET (exec_prefix "\${prefix}") |  | ||||||
| SET (libdir "\${exec_prefix}/lib") |  | ||||||
| SET (includedir "\${prefix}/include") |  | ||||||
| SET (GNUCXX_STD_SUPPORT_VERSION "4.3") | SET (GNUCXX_STD_SUPPORT_VERSION "4.3") | ||||||
|  |  | ||||||
| OPTION (MSGPACK_CXX11 "Using c++11 compiler" OFF) | OPTION (MSGPACK_CXX11 "Using c++11 compiler" OFF) | ||||||
| OPTION (MSGPACK_32BIT "32bit compile" OFF) | OPTION (MSGPACK_CXX14 "Using c++14 compiler" OFF) | ||||||
| OPTION (MSGPACK_BOOST "Using boost libraries" OFF) | OPTION (MSGPACK_CXX17 "Using c++17 compiler" OFF) | ||||||
|  | OPTION (MSGPACK_CXX20 "Using c++20 compiler" OFF) | ||||||
|  |  | ||||||
| IF (APPLE) | OPTION (MSGPACK_32BIT                   "32bit compile"                        OFF) | ||||||
|     SET(CMAKE_MACOSX_RPATH ON) | OPTION (MSGPACK_USE_BOOST               "Use Boost libraried"                  ON) | ||||||
|     SET(CMAKE_SKIP_BUILD_RPATH FALSE) | OPTION (MSGPACK_USE_X3_PARSE            "Use Boost X3 parse"                   OFF) | ||||||
|     SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) | OPTION (MSGPACK_BUILD_TESTS             "Build tests"                          OFF) | ||||||
|     SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") | OPTION (MSGPACK_BUILD_DOCS              "Build Doxygen documentation"          ON) | ||||||
|     SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) | OPTION (MSGPACK_FUZZ_REGRESSION         "Enable regression testing"            OFF) | ||||||
|     LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir) | OPTION (MSGPACK_BUILD_EXAMPLES          "Build msgpack examples"               OFF) | ||||||
|     IF ("${isSystemDir}" STREQUAL "-1") | OPTION (MSGPACK_GEN_COVERAGE            "Generate coverage report"             OFF) | ||||||
|         SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") | OPTION (MSGPACK_USE_STATIC_BOOST        "Statically link with boost libraries" OFF) | ||||||
|     ENDIF () | OPTION (MSGPACK_CHAR_SIGN               "Char sign to use (signed or unsigned)") | ||||||
| ENDIF () | OPTION (MSGPACK_USE_STD_VARIANT_ADAPTOR "Enable the adaptor for std::variant"  OFF) | ||||||
|  |  | ||||||
|  | SET (CMAKE_CXX_STANDARD_REQUIRED ON) | ||||||
|  |  | ||||||
| IF (MSGPACK_USE_X3_PARSE) | IF (MSGPACK_USE_X3_PARSE) | ||||||
|    IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") |     IF (NOT (MSGPACK_CXX14 OR MSGPACK_CXX17 OR MSGPACK_CXX20)) | ||||||
|       SET (CMAKE_CXX_FLAGS "-DMSGPACK_USE_X3_PARSE -std=c++14 ${CMAKE_CXX_FLAGS}") |         MESSAGE (FATAL_ERROR "MSGPACK_USE_X3_PARSE requires MSGPACK_CXX14 or newer") | ||||||
|    ELSEIF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") |     ENDIF () | ||||||
|       SET (CMAKE_CXX_FLAGS "-DMSGPACK_USE_X3_PARSE -std=c++14 ${CMAKE_CXX_FLAGS}") |     SET (CMAKE_CXX_FLAGS "-DMSGPACK_USE_X3_PARSE ${CMAKE_CXX_FLAGS}") | ||||||
|    ELSEIF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") | ENDIF () | ||||||
|       SET (CMAKE_CXX_FLAGS "-DMSGPACK_USE_X3_PARSE ${CMAKE_CXX_FLAGS}") |  | ||||||
|       IF (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19) | IF (MSGPACK_CXX20) | ||||||
|           MESSAGE ( FATAL_ERROR "MSVC doesn't support C++14.") |     SET (CMAKE_CXX_STANDARD 20) | ||||||
|       ENDIF () | ELSEIF (MSGPACK_CXX17) | ||||||
|    ENDIF () |     SET (CMAKE_CXX_STANDARD 17) | ||||||
|  | ELSEIF (MSGPACK_CXX14) | ||||||
|  |     SET (CMAKE_CXX_STANDARD 14) | ||||||
|  | ELSEIF (MSGPACK_CXX11) | ||||||
|  |     SET (CMAKE_CXX_STANDARD 11) | ||||||
| ELSE () | ELSE () | ||||||
|    IF (MSGPACK_CXX17) |     SET (CMAKE_CXX_STANDARD 98) | ||||||
|       IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") |  | ||||||
|          SET (CMAKE_CXX_FLAGS "-std=c++17 ${CMAKE_CXX_FLAGS}") |  | ||||||
|       ELSEIF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") |  | ||||||
|          SET (CMAKE_CXX_FLAGS "-std=c++17 ${CMAKE_CXX_FLAGS}") |  | ||||||
|       ELSEIF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") |  | ||||||
|          MESSAGE ( FATAL_ERROR "MSVC doesn't support C++17.") |  | ||||||
|       ENDIF () |  | ||||||
|    ELSEIF (MSGPACK_CXX11) |  | ||||||
|       IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") |  | ||||||
|          SET (CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}") |  | ||||||
|       ELSEIF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") |  | ||||||
|          SET (CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}") |  | ||||||
|       ELSEIF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") |  | ||||||
|          IF (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19) |  | ||||||
|              MESSAGE ( FATAL_ERROR "MSVC doesn't support C++11.") |  | ||||||
|          ENDIF () |  | ||||||
|       ENDIF () |  | ||||||
|    ELSE () |  | ||||||
|       IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") |  | ||||||
|          IF ((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER ${GNUCXX_STD_SUPPORT_VERSION}) OR |  | ||||||
|              (CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL   ${GNUCXX_STD_SUPPORT_VERSION})) |  | ||||||
|              SET (CMAKE_CXX_FLAGS "-std=c++98 ${CMAKE_CXX_FLAGS}") |  | ||||||
|          ENDIF () |  | ||||||
|       ELSEIF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") |  | ||||||
|          SET (CMAKE_CXX_FLAGS "-std=c++98 ${CMAKE_CXX_FLAGS}") |  | ||||||
|       ELSEIF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") |  | ||||||
|          IF (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 18) |  | ||||||
|              SET (CMAKE_CXX_FLAGS "-DMSGPACK_USE_CPP03 ${CMAKE_CXX_FLAGS}") |  | ||||||
|          ENDIF () |  | ||||||
|       ENDIF () |  | ||||||
|    ENDIF () |  | ||||||
| ENDIF () | ENDIF () | ||||||
|  |  | ||||||
| IF (MSGPACK_32BIT) | IF (MSGPACK_32BIT) | ||||||
|    IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") |     IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") | ||||||
|       SET (CMAKE_CXX_FLAGS "-m32 ${CMAKE_CXX_FLAGS}") |         TARGET_COMPILE_OPTIONS(msgpack-cxx INTERFACE -m32) | ||||||
|       SET (CMAKE_C_FLAGS "-m32 ${CMAKE_C_FLAGS}") |         TARGET_LINK_OPTIONS(msgpack-cxx INTERFACE -m32) | ||||||
|       SET (CMAKE_EXE_LINKER_FLAGS "-m32 ${CMAKE_EXE_LINKER_FLAGS}") |     ELSEIF ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") | ||||||
|    ELSEIF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") |         TARGET_COMPILE_OPTIONS(msgpack-cxx INTERFACE -m32) | ||||||
|       SET (CMAKE_CXX_FLAGS "-m32 ${CMAKE_CXX_FLAGS}") |         TARGET_LINK_OPTIONS(msgpack-cxx INTERFACE -m32) | ||||||
|       SET (CMAKE_C_FLAGS "-m32 ${CMAKE_C_FLAGS}") |     ENDIF () | ||||||
|       SET (CMAKE_EXE_LINKER_FLAGS "-m32 ${CMAKE_EXE_LINKER_FLAGS}") |  | ||||||
|    ENDIF () |  | ||||||
| ENDIF () | ENDIF () | ||||||
|  |  | ||||||
| OPTION (MSGPACK_BUILD_EXAMPLES "Build msgpack examples." ON) | IF (MSGPACK_USE_BOOST) | ||||||
|  |     SET (Boost_USE_MULTITHREADED ON) | ||||||
|  |  | ||||||
| IF (MSGPACK_BOOST) |     IF (MSGPACK_USE_STATIC_BOOST) | ||||||
|    SET (CMAKE_CXX_FLAGS "-DMSGPACK_USE_BOOST ${CMAKE_CXX_FLAGS}") |         MESSAGE (STATUS "Staticly linking with Boost") | ||||||
|    SET (Boost_USE_MULTITHREADED      ON) |         SET (Boost_USE_STATIC_LIBS TRUE) | ||||||
|    SET (Boost_USE_STATIC_RUNTIME    OFF) |     ELSE () | ||||||
|    FIND_PACKAGE (Boost REQUIRED COMPONENTS chrono context system timer) |         MESSAGE (STATUS "Dynamically linking with Boost") | ||||||
|    INCLUDE_DIRECTORIES ( |         SET (Boost_USE_STATIC_LIBS FALSE) | ||||||
|       ${Boost_INCLUDE_DIRS} |     ENDIF () | ||||||
|    ) |  | ||||||
|    LINK_DIRECTORIES ( |     FIND_PACKAGE (Boost REQUIRED) | ||||||
|       ${Boost_LIBRARY_DIRS} | ELSE () | ||||||
|    ) |     TARGET_COMPILE_DEFINITIONS(msgpack-cxx INTERFACE MSGPACK_NO_BOOST) | ||||||
|    IF (MSGPACK_BOOST_DIR) |  | ||||||
|       INCLUDE_DIRECTORIES ( |  | ||||||
|          ${MSGPACK_BOOST_DIR} |  | ||||||
|       ) |  | ||||||
|    ENDIF () |  | ||||||
| ENDIF () | ENDIF () | ||||||
|  |  | ||||||
| IF (MSGPACK_CHAR_SIGN) | IF (MSGPACK_CHAR_SIGN) | ||||||
|    SET (CMAKE_C_FLAGS "-f${MSGPACK_CHAR_SIGN}-char ${CMAKE_C_FLAGS}") |     TARGET_COMPILE_OPTIONS(msgpack-cxx INTERFACE -f${MSGPACK_CHAR_SIGN}-char) | ||||||
|    SET (CMAKE_CXX_FLAGS "-f${MSGPACK_CHAR_SIGN}-char ${CMAKE_CXX_FLAGS}") |  | ||||||
| ENDIF () | ENDIF () | ||||||
|  |  | ||||||
| IF (MSGPACK_DEFAULT_API_VERSION) | IF (MSGPACK_DEFAULT_API_VERSION) | ||||||
|    SET (CMAKE_CXX_FLAGS "-DMSGPACK_DEFAULT_API_VERSION=${MSGPACK_DEFAULT_API_VERSION} ${CMAKE_CXX_FLAGS}") |     TARGET_COMPILE_DEFINITIONS(msgpack-cxx INTERFACE MSGPACK_DEFAULT_API_VERSION=${MSGPACK_DEFAULT_API_VERSION}) | ||||||
| ELSE () | ELSE () | ||||||
|    SET (CMAKE_CXX_FLAGS "-DMSGPACK_DEFAULT_API_VERSION=2 ${CMAKE_CXX_FLAGS}") |     SET (MSGPACK_DEFAULT_API_VERSION 3) | ||||||
|  |     TARGET_COMPILE_DEFINITIONS(msgpack-cxx INTERFACE MSGPACK_DEFAULT_API_VERSION=3) | ||||||
| ENDIF () | ENDIF () | ||||||
|  |  | ||||||
| FILE (GLOB_RECURSE PREDEF_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/external/boost/predef/include/boost ${CMAKE_CURRENT_SOURCE_DIR}/external/boost/predef/include/boost/*.h) | IF (MSGPACK_USE_STD_VARIANT_ADAPTOR) | ||||||
| FOREACH (F ${PREDEF_FILES}) |     TARGET_COMPILE_DEFINITIONS(msgpack-cxx INTERFACE MSGPACK_USE_STD_VARIANT_ADAPTOR) | ||||||
|    SET(M "Converting ${F}") |  | ||||||
|    MESSAGE(STATUS ${M}) |  | ||||||
|    FILE (READ ${CMAKE_CURRENT_SOURCE_DIR}/external/boost/predef/include/boost/${F} CONTENT) |  | ||||||
|    STRING(REPLACE "BOOST_" "MSGPACK_" CONTENT ${CONTENT}) |  | ||||||
|    STRING(REPLACE "boost/" "msgpack/" CONTENT ${CONTENT}) |  | ||||||
|    FILE (GENERATE OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/include/msgpack/${F} CONTENT ${CONTENT}) |  | ||||||
| ENDFOREACH () |  | ||||||
|  |  | ||||||
| FILE (GLOB_RECURSE PREPROCESSOR_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/external/boost/preprocessor/include/boost ${CMAKE_CURRENT_SOURCE_DIR}/external/boost/preprocessor/include/boost/*.hpp) |  | ||||||
| FOREACH (F ${PREPROCESSOR_FILES}) |  | ||||||
|    SET(M "Converting ${F}") |  | ||||||
|    MESSAGE(STATUS ${M}) |  | ||||||
|    FILE (READ ${CMAKE_CURRENT_SOURCE_DIR}/external/boost/preprocessor/include/boost/${F} CONTENT) |  | ||||||
|    STRING(REPLACE "BOOST_" "MSGPACK_" CONTENT ${CONTENT}) |  | ||||||
|    STRING(REPLACE "boost/" "msgpack/" CONTENT ${CONTENT}) |  | ||||||
|    FILE (GENERATE OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/include/msgpack/${F} CONTENT ${CONTENT}) |  | ||||||
| ENDFOREACH () |  | ||||||
|  |  | ||||||
| FIND_PACKAGE (GTest) |  | ||||||
| FIND_PACKAGE (ZLIB) |  | ||||||
| FIND_PACKAGE (Threads) |  | ||||||
| IF (GTEST_FOUND AND ZLIB_FOUND AND THREADS_FOUND) |  | ||||||
|     OPTION (MSGPACK_BUILD_TESTS "Build msgpack tests." ON) |  | ||||||
| ENDIF () | ENDIF () | ||||||
|  |  | ||||||
| OPTION (MSGPACK_ENABLE_CXX "Enable C++ interface." ON) | IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") | ||||||
| OPTION (MSGPACK_ENABLE_SHARED "Build shared libaries in addition to static libraries." ON) |     IF (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.1) | ||||||
|  |         INCLUDE (CheckCXXSourceCompiles) | ||||||
| INCLUDE (CheckCXXSourceCompiles) |         CHECK_CXX_SOURCE_COMPILES (" | ||||||
| CHECK_CXX_SOURCE_COMPILES (" |  | ||||||
| #include <bits/atomicity.h> | #include <bits/atomicity.h> | ||||||
| int atomic_sub(int i) { return __gnu_cxx::__exchange_and_add(&i, -1) - 1; } | int atomic_sub(int i) { return __gnu_cxx::__exchange_and_add(&i, -1) - 1; } | ||||||
| int atomic_add(int i) { return __gnu_cxx::__exchange_and_add(&i, 1) + 1; } | int atomic_add(int i) { return __gnu_cxx::__exchange_and_add(&i, 1) + 1; } | ||||||
| @@ -167,215 +109,143 @@ int main(int argc, char * argv[]) | |||||||
|     atomic_sub(1); |     atomic_sub(1); | ||||||
|     atomic_add(1); |     atomic_add(1); | ||||||
| } | } | ||||||
| " MSGPACK_ENABLE_GCC_CXX_ATOMIC) | " | ||||||
|  |         MSGPACK_ENABLE_GCC_CXX_ATOMIC) | ||||||
|  |     ENDIF () | ||||||
|  | ENDIF () | ||||||
|  |  | ||||||
|  |  | ||||||
| INCLUDE (Files.cmake) | INCLUDE (Files.cmake) | ||||||
|  |  | ||||||
| EXECUTE_PROCESS ( | TARGET_INCLUDE_DIRECTORIES (msgpack-cxx | ||||||
|     COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/src/msgpack |     INTERFACE | ||||||
| ) |  | ||||||
|  |  | ||||||
| CONFIGURE_FILE ( |  | ||||||
|     msgpack.pc.in |  | ||||||
|     msgpack.pc |  | ||||||
|     @ONLY |  | ||||||
| ) |  | ||||||
|  |  | ||||||
| IF (MSGPACK_ENABLE_SHARED) |  | ||||||
|     ADD_LIBRARY (msgpackc SHARED |  | ||||||
|         ${msgpackc_SOURCES} |  | ||||||
|         ${msgpackc_HEADERS} |  | ||||||
|     ) |  | ||||||
|  |  | ||||||
|     TARGET_INCLUDE_DIRECTORIES (msgpackc |  | ||||||
|         PUBLIC |  | ||||||
|             $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> |  | ||||||
|             $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include> |  | ||||||
|             $<INSTALL_INTERFACE:include> |  | ||||||
|         PRIVATE |  | ||||||
|             ${CMAKE_CURRENT_SOURCE_DIR} |  | ||||||
|     ) |  | ||||||
| ENDIF () |  | ||||||
|  |  | ||||||
| ADD_LIBRARY (msgpackc-static STATIC |  | ||||||
|     ${msgpackc_SOURCES} |  | ||||||
|     ${msgpackc_HEADERS} |  | ||||||
| ) |  | ||||||
|  |  | ||||||
| TARGET_INCLUDE_DIRECTORIES (msgpackc-static |  | ||||||
|     PUBLIC |  | ||||||
|         $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> |         $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> | ||||||
|         $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include> |         $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include> | ||||||
|         $<INSTALL_INTERFACE:include> |         $<INSTALL_INTERFACE:include> | ||||||
|     PRIVATE |  | ||||||
|         ${CMAKE_CURRENT_SOURCE_DIR} |  | ||||||
| ) | ) | ||||||
|  |  | ||||||
| IF (NOT MSGPACK_ENABLE_SHARED) | IF (MSGPACK_USE_BOOST) | ||||||
|     # Add alias for subdirectories |     TARGET_LINK_LIBRARIES (msgpack-cxx INTERFACE Boost::boost) | ||||||
|     ADD_LIBRARY (msgpackc ALIAS msgpackc-static) |  | ||||||
| ENDIF () | ENDIF () | ||||||
|  |  | ||||||
| SET_TARGET_PROPERTIES (msgpackc-static PROPERTIES OUTPUT_NAME "msgpackc") | IF (MSGPACK_GEN_COVERAGE) | ||||||
| IF (MSGPACK_ENABLE_SHARED) |     IF (NOT MSGPACK_BUILD_TESTS) | ||||||
|     IF (MSVC) |         MESSAGE(FATAL_ERROR "Coverage requires -DMSGPACK_BUILD_TESTS=ON") | ||||||
|         SET_TARGET_PROPERTIES (msgpackc PROPERTIES IMPORT_SUFFIX "_import.lib") |  | ||||||
|     ELSEIF (MINGW) |  | ||||||
|         SET_TARGET_PROPERTIES (msgpackc PROPERTIES IMPORT_SUFFIX ".dll.a") |  | ||||||
|     ENDIF () |     ENDIF () | ||||||
|     SET_TARGET_PROPERTIES (msgpackc PROPERTIES SOVERSION 2 VERSION 2.0.0) |     STRING (TOUPPER "${CMAKE_BUILD_TYPE}" UPPER_CMAKE_BUILD_TYPE) | ||||||
|  |     IF (NOT "${UPPER_CMAKE_BUILD_TYPE}" STREQUAL "DEBUG") | ||||||
|  |         MESSAGE (FATAL_ERROR "Coverage requires -DCMAKE_BUILD_TYPE=Debug") | ||||||
|  |     ENDIF () | ||||||
|  |  | ||||||
|  |     INCLUDE (CodeCoverage) | ||||||
|  |     SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COVERAGE_FLAGS}") | ||||||
|  |     SETUP_TARGET_FOR_COVERAGE(coverage make coverage test) | ||||||
| ENDIF () | ENDIF () | ||||||
|  |  | ||||||
| IF (MSGPACK_BUILD_TESTS) | IF (MSGPACK_BUILD_TESTS) | ||||||
|  |     IF (NOT MSGPACK_USE_BOOST) | ||||||
|  |         MESSAGE(FATAL_ERROR "Test requires -DMSGPACK_USE_BOOST=ON") | ||||||
|  |     ENDIF () | ||||||
|     ENABLE_TESTING () |     ENABLE_TESTING () | ||||||
|     # MEMORYCHECK_COMMAND_OPTIONS needs to place prior to CTEST_MEMORYCHECK_COMMAND |     # MEMORYCHECK_COMMAND_OPTIONS needs to place prior to CTEST_MEMORYCHECK_COMMAND | ||||||
|     SET (MEMORYCHECK_COMMAND_OPTIONS "--leak-check=full --show-leak-kinds=definite,possible --error-exitcode=1") |     SET (MEMORYCHECK_COMMAND_OPTIONS "--leak-check=full --show-leak-kinds=definite,possible --error-exitcode=1") | ||||||
|     FIND_PROGRAM(CTEST_MEMORYCHECK_COMMAND NAMES valgrind) |     FIND_PROGRAM (CTEST_MEMORYCHECK_COMMAND NAMES valgrind) | ||||||
|     INCLUDE(Dart) |     INCLUDE (Dart) | ||||||
|     ADD_SUBDIRECTORY (test) |     ADD_SUBDIRECTORY (test) | ||||||
| ENDIF () | ENDIF () | ||||||
|  |  | ||||||
| IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") | # enable regression testing | ||||||
|     IF (MSGPACK_ENABLE_SHARED) | IF (MSGPACK_FUZZ_REGRESSION) | ||||||
|         SET_PROPERTY (TARGET msgpackc APPEND_STRING PROPERTY COMPILE_FLAGS "-Wall -Wextra -Werror -g -O3 -DPIC") |     ENABLE_TESTING () | ||||||
|     ENDIF () |     ADD_SUBDIRECTORY (fuzz) | ||||||
|     SET_PROPERTY (TARGET msgpackc-static APPEND_STRING PROPERTY COMPILE_FLAGS "-Wall -Wextra -Werror -g -O3" ) |  | ||||||
| ENDIF () |  | ||||||
|  |  | ||||||
| IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") |  | ||||||
|     IF (MSGPACK_ENABLE_SHARED) |  | ||||||
|         SET_PROPERTY (TARGET msgpackc APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-mismatched-tags") |  | ||||||
|     ENDIF () |  | ||||||
|     SET_PROPERTY (TARGET msgpackc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-mismatched-tags") |  | ||||||
| ENDIF () |  | ||||||
|  |  | ||||||
| IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") |  | ||||||
|     IF (CMAKE_CXX_FLAGS MATCHES "/W[0-4]") |  | ||||||
|         STRING(REGEX REPLACE "/W[0-4]" "/W3 /WX" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") |  | ||||||
|     ELSE () |  | ||||||
|         SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3 /WX") |  | ||||||
|     ENDIF () |  | ||||||
| ENDIF () |  | ||||||
|  |  | ||||||
| IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC90" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC10") |  | ||||||
|     SET_SOURCE_FILES_PROPERTIES(${msgpackc_SOURCES} PROPERTIES LANGUAGE CXX) |  | ||||||
| ENDIF () | ENDIF () | ||||||
|  |  | ||||||
| IF ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "sparc") | IF ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "sparc") | ||||||
|     SET (CMAKE_C_FLAGS   "-DMSGPACK_ZONE_ALIGN=8 ${CMAKE_C_FLAGS}") |     TARGET_COMPILE_DEFINITIONS(msgpack-cxx INTERFACE MSGPACK_ZONE_ALIGN=8) | ||||||
|     SET (CMAKE_CXX_FLAGS "-DMSGPACK_ZONE_ALIGN=8 ${CMAKE_CXX_FLAGS}") |  | ||||||
| ENDIF () |  | ||||||
|  |  | ||||||
| IF (NOT DEFINED CMAKE_INSTALL_BINDIR) |  | ||||||
|     SET(CMAKE_INSTALL_BINDIR bin) |  | ||||||
| ENDIF () |  | ||||||
|  |  | ||||||
| IF (NOT DEFINED CMAKE_INSTALL_LIBDIR) |  | ||||||
|     SET(CMAKE_INSTALL_LIBDIR lib) |  | ||||||
| ENDIF () | ENDIF () | ||||||
|  |  | ||||||
| IF (MSGPACK_BUILD_EXAMPLES) | IF (MSGPACK_BUILD_EXAMPLES) | ||||||
|     ADD_SUBDIRECTORY (example) |     ADD_SUBDIRECTORY (example) | ||||||
| ENDIF () | ENDIF () | ||||||
|  |  | ||||||
| IF (MSGPACK_ENABLE_SHARED) |  | ||||||
|     SET (MSGPACK_INSTALLTARGETS msgpackc msgpackc-static) |  | ||||||
| ELSE() |  | ||||||
|     SET (MSGPACK_INSTALLTARGETS msgpackc-static) |  | ||||||
| ENDIF () |  | ||||||
|  |  | ||||||
| INSTALL (TARGETS ${MSGPACK_INSTALLTARGETS} EXPORT msgpack-targets |  | ||||||
|     RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} |  | ||||||
|     LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} |  | ||||||
|     ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} |  | ||||||
| ) |  | ||||||
| FOREACH (file ${msgpackc_HEADERS}) |  | ||||||
|     GET_FILENAME_COMPONENT (dir ${file} PATH) |  | ||||||
|     INSTALL (FILES ${file} DESTINATION ${CMAKE_INSTALL_PREFIX}/${dir}) |  | ||||||
| ENDFOREACH () |  | ||||||
| IF (NOT MSVC) |  | ||||||
|     INSTALL (FILES ${CMAKE_CURRENT_BINARY_DIR}/msgpack.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) |  | ||||||
| ENDIF () |  | ||||||
|  |  | ||||||
| # Doxygen | # Doxygen | ||||||
| FIND_PACKAGE (Doxygen) | IF (MSGPACK_BUILD_DOCS) | ||||||
| IF (DOXYGEN_FOUND) |     FIND_PACKAGE (Doxygen) | ||||||
|     LIST (APPEND Doxyfile_c_CONTENT |     IF (DOXYGEN_FOUND) | ||||||
|         COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_c |  | ||||||
|         COMMAND ${CMAKE_COMMAND} -E echo "FILE_PATTERNS      = *.h" >> ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_c |  | ||||||
|         COMMAND ${CMAKE_COMMAND} -E echo "OUTPUT_DIRECTORY   = doc_c" >> ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_c |  | ||||||
|         COMMAND ${CMAKE_COMMAND} -E echo "INPUT              = ${CMAKE_CURRENT_SOURCE_DIR}/include" >> ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_c |  | ||||||
|         COMMAND ${CMAKE_COMMAND} -E echo "EXTRACT_ALL        = YES" >> ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_c |  | ||||||
|         COMMAND ${CMAKE_COMMAND} -E echo "PROJECT_NAME       = \"MessagePack for C\"" >> ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_c |  | ||||||
|     ) |  | ||||||
|     IF (DOXYGEN_DOT_FOUND) |  | ||||||
|         LIST (APPEND Doxyfile_c_CONTENT |  | ||||||
|             COMMAND ${CMAKE_COMMAND} -E echo "HAVE_DOT       = YES" >> ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_c |  | ||||||
|         ) |  | ||||||
|     ENDIF () |  | ||||||
|     ADD_CUSTOM_TARGET ( |  | ||||||
|         doxygen_c |  | ||||||
|         ${Doxyfile_c_CONTENT} |  | ||||||
|         COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_c |  | ||||||
|         VERBATIM |  | ||||||
|     ) |  | ||||||
|     LIST (APPEND Doxyfile_cpp_CONTENT |  | ||||||
|         COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_cpp |  | ||||||
|         COMMAND ${CMAKE_COMMAND} -E echo "FILE_PATTERNS      = *.hpp" >> ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_cpp |  | ||||||
|         COMMAND ${CMAKE_COMMAND} -E echo "OUTPUT_DIRECTORY   = doc_cpp" >> ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_cpp |  | ||||||
|         COMMAND ${CMAKE_COMMAND} -E echo "INPUT              = ${CMAKE_CURRENT_SOURCE_DIR}/include" >> ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_cpp |  | ||||||
|         COMMAND ${CMAKE_COMMAND} -E echo "EXTRACT_ALL        = YES" >> ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_cpp |  | ||||||
|     ) |  | ||||||
|     IF (DOXYGEN_DOT_FOUND) |  | ||||||
|         LIST (APPEND Doxyfile_cpp_CONTENT |         LIST (APPEND Doxyfile_cpp_CONTENT | ||||||
|             COMMAND ${CMAKE_COMMAND} -E echo "HAVE_DOT       = YES" >> ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_cpp |             COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_cpp | ||||||
|  |             COMMAND ${CMAKE_COMMAND} -E echo "FILE_PATTERNS      = *.hpp" >> ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_cpp | ||||||
|  |             COMMAND ${CMAKE_COMMAND} -E echo "OUTPUT_DIRECTORY   = doc_cpp" >> ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_cpp | ||||||
|  |             COMMAND ${CMAKE_COMMAND} -E echo "INPUT              = ${CMAKE_CURRENT_SOURCE_DIR}/include" >> ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_cpp | ||||||
|  |             COMMAND ${CMAKE_COMMAND} -E echo "EXTRACT_ALL        = YES" >> ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_cpp | ||||||
|  |             COMMAND ${CMAKE_COMMAND} -E echo "STRIP_FROM_PATH    = ${CMAKE_CURRENT_SOURCE_DIR}/include" >> ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_cpp | ||||||
|  |         ) | ||||||
|  |         IF (DOXYGEN_DOT_FOUND) | ||||||
|  |             LIST (APPEND Doxyfile_cpp_CONTENT | ||||||
|  |                 COMMAND ${CMAKE_COMMAND} -E echo "HAVE_DOT       = YES" >> ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_cpp | ||||||
|  |             ) | ||||||
|  |         ENDIF () | ||||||
|  |         ADD_CUSTOM_TARGET ( | ||||||
|  |             doxygen | ||||||
|  |             ${Doxyfile_cpp_CONTENT} | ||||||
|  |             COMMAND ${CMAKE_COMMAND} -E echo "PROJECT_NAME       = \"MessagePack for C++\"" >> ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_cpp | ||||||
|  |             COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_cpp | ||||||
|  |             VERBATIM | ||||||
|         ) |         ) | ||||||
|     ENDIF () |     ENDIF () | ||||||
|     ADD_CUSTOM_TARGET ( |  | ||||||
|         doxygen_cpp |  | ||||||
|         ${Doxyfile_cpp_CONTENT} |  | ||||||
|         COMMAND ${CMAKE_COMMAND} -E echo "PROJECT_NAME       = \"MessagePack for C++\"" >> ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_cpp |  | ||||||
|         COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_cpp |  | ||||||
|         VERBATIM |  | ||||||
|     ) |  | ||||||
|     ADD_CUSTOM_TARGET ( |  | ||||||
|         doxygen |  | ||||||
|         DEPENDS doxygen_c doxygen_cpp |  | ||||||
|     ) |  | ||||||
| ENDIF () | ENDIF () | ||||||
|  |  | ||||||
|  | include (GNUInstallDirs) | ||||||
|  |  | ||||||
|  | # Install library. | ||||||
|  | INSTALL (TARGETS msgpack-cxx | ||||||
|  |          EXPORT msgpack-cxx-targets | ||||||
|  |          COMPONENT msgpack-cxx | ||||||
|  |          # This provides include directory in exported target | ||||||
|  |          # relative to prefix in single directory we've put everything in. | ||||||
|  |          INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" | ||||||
|  | ) | ||||||
|  |  | ||||||
|  | # Install headers from source tree. | ||||||
|  | INSTALL (DIRECTORY include/ | ||||||
|  |          DESTINATION include | ||||||
|  |          COMPONENT msgpack-cxx | ||||||
|  | ) | ||||||
|  |  | ||||||
| INCLUDE (CMakePackageConfigHelpers) | INCLUDE (CMakePackageConfigHelpers) | ||||||
|  |  | ||||||
| SET (CMAKE_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/msgpack") | IF (NOT (CMAKE_VERSION VERSION_LESS 3.14)) | ||||||
|  |     SET (extra_version_file_args ARCH_INDEPENDENT) | ||||||
|  | ENDIF () | ||||||
|  | SET (cmake_config_path "${CMAKE_INSTALL_LIBDIR}/cmake/msgpack-cxx") | ||||||
|  |  | ||||||
|  | # Configure the main package file from source tree. | ||||||
|  | CONFIGURE_PACKAGE_CONFIG_FILE ( | ||||||
|  |     msgpack-cxx-config.cmake.in | ||||||
|  |     "${CMAKE_CURRENT_BINARY_DIR}/msgpack-cxx-config.cmake" | ||||||
|  |     INSTALL_DESTINATION "${cmake_config_path}" | ||||||
|  | ) | ||||||
|  |  | ||||||
|  | # Write package version file. | ||||||
| WRITE_BASIC_PACKAGE_VERSION_FILE ( | WRITE_BASIC_PACKAGE_VERSION_FILE ( | ||||||
|     msgpack-config-version.cmake |     msgpack-cxx-config-version.cmake | ||||||
|     VERSION ${VERSION} |     VERSION ${VERSION} | ||||||
|     COMPATIBILITY SameMajorVersion |     COMPATIBILITY SameMajorVersion | ||||||
|  |     ${extra_version_file_args} | ||||||
| ) | ) | ||||||
|  |  | ||||||
| IF (NOT CMAKE_VERSION VERSION_LESS 3.0) | # Install the generated package version file and the main package file. | ||||||
|     EXPORT (EXPORT msgpack-targets | INSTALL (FILES | ||||||
|         FILE "${CMAKE_CURRENT_BINARY_DIR}/msgpack-targets.cmake" |     "${CMAKE_CURRENT_BINARY_DIR}/msgpack-cxx-config.cmake" | ||||||
|     ) |     "${CMAKE_CURRENT_BINARY_DIR}/msgpack-cxx-config-version.cmake" | ||||||
| ENDIF () |     DESTINATION "${cmake_config_path}" | ||||||
|  |     COMPONENT msgpack-cxx | ||||||
| CONFIGURE_PACKAGE_CONFIG_FILE (msgpack-config.cmake.in |  | ||||||
|     msgpack-config.cmake |  | ||||||
|     INSTALL_DESTINATION "${CMAKE_INSTALL_CMAKEDIR}" |  | ||||||
| ) |  | ||||||
|  |  | ||||||
| INSTALL (EXPORT msgpack-targets |  | ||||||
|     FILE |  | ||||||
|         msgpack-targets.cmake |  | ||||||
|     DESTINATION |  | ||||||
|         "${CMAKE_INSTALL_CMAKEDIR}" |  | ||||||
| ) | ) | ||||||
|  |  | ||||||
|  | # This installs package in install tree for using installed targets. | ||||||
| INSTALL ( | INSTALL ( | ||||||
|     FILES |     EXPORT msgpack-cxx-targets | ||||||
|         "${CMAKE_CURRENT_BINARY_DIR}/msgpack-config.cmake" |     FILE msgpack-cxx-targets.cmake | ||||||
|         "${CMAKE_CURRENT_BINARY_DIR}/msgpack-config-version.cmake" |     DESTINATION "${cmake_config_path}" | ||||||
|     DESTINATION |     COMPONENT msgpack-cxx | ||||||
|         "${CMAKE_INSTALL_CMAKEDIR}" |  | ||||||
| ) | ) | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								Doxyfile
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								Doxyfile
									
									
									
									
									
								
							| @@ -281,7 +281,7 @@ TYPEDEF_HIDES_STRUCT   = NO | |||||||
| # causing a significant performance penality. | # causing a significant performance penality. | ||||||
| # If the system has enough physical memory increasing the cache will improve the | # If the system has enough physical memory increasing the cache will improve the | ||||||
| # performance by keeping more symbols in memory. Note that the value works on | # performance by keeping more symbols in memory. Note that the value works on | ||||||
| # a logarithmic scale so increasing the size by one will rougly double the | # a logarithmic scale so increasing the size by one will roughly double the | ||||||
| # memory usage. The cache size is given by this formula: | # memory usage. The cache size is given by this formula: | ||||||
| # 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, | # 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, | ||||||
| # corresponding to a cache size of 2^16 = 65536 symbols | # corresponding to a cache size of 2^16 = 65536 symbols | ||||||
|   | |||||||
							
								
								
									
										1143
									
								
								Files.cmake
									
									
									
									
									
								
							
							
						
						
									
										1143
									
								
								Files.cmake
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										194
									
								
								QUICKSTART-C.md
									
									
									
									
									
								
							
							
						
						
									
										194
									
								
								QUICKSTART-C.md
									
									
									
									
									
								
							| @@ -1,194 +0,0 @@ | |||||||
| # Implementation Status |  | ||||||
|  |  | ||||||
| The serialization library is production-ready. |  | ||||||
|  |  | ||||||
| Currently, RPC implementation is not available. |  | ||||||
|  |  | ||||||
| # Install |  | ||||||
|  |  | ||||||
|  |  | ||||||
| ## Mac OS X with MacPorts |  | ||||||
|  |  | ||||||
| On Mac OS X, you can install MessagePack for C using MacPorts. |  | ||||||
|  |  | ||||||
| ``` |  | ||||||
| $ sudo port install msgpack |  | ||||||
| ``` |  | ||||||
|  |  | ||||||
| You might need to run `sudo port selfupdate` before installing to update the package repository. |  | ||||||
|  |  | ||||||
| You can also install via Homebrew. |  | ||||||
|  |  | ||||||
| ``` |  | ||||||
| $ sudo brew install msgpack |  | ||||||
| ``` |  | ||||||
|  |  | ||||||
| ## FreeBSD with Ports Collection |  | ||||||
|  |  | ||||||
| On FreeBSD, you can use Ports Collection. Install [net/msgpack|http://www.freebsd.org/cgi/cvsweb.cgi/ports/devel/msgpack/] package. |  | ||||||
|  |  | ||||||
| ## Gentoo Linux with Portage |  | ||||||
|  |  | ||||||
| On Gentoo Linux, you can use emerge. Install [dev-libs/msgpack|http://gentoo-portage.com/dev-libs/msgpack] package. |  | ||||||
|  |  | ||||||
| ## Other UNIX-like platform with ./configure |  | ||||||
|  |  | ||||||
| On the other UNIX-like platforms, download source package from [Releases|http://msgpack.org/releases/cpp/] and run `./configure && make && make install`. |  | ||||||
|  |  | ||||||
| ``` |  | ||||||
| $ wget http://msgpack.org/releases/cpp/msgpack-1.3.0.tar.gz |  | ||||||
| $ tar zxvf msgpack-1.3.0.tar.gz |  | ||||||
| $ cd msgpack-1.3.0 |  | ||||||
| $ ./configure |  | ||||||
| $ make |  | ||||||
| $ sudo make install |  | ||||||
| ``` |  | ||||||
|  |  | ||||||
| ## Windows |  | ||||||
|  |  | ||||||
| On Windows, download source package from [here|https://sourceforge.net/projects/msgpack/files/] and extract it. |  | ||||||
| Then open `msgpack_vc8.vcproj` file and build it using batch build. It builds libraries on `lib/` folder and header files on `include/` folder. |  | ||||||
|  |  | ||||||
| You can build using command line as follows: |  | ||||||
|  |  | ||||||
| ``` |  | ||||||
| > vcbuild msgpack_vc2008.vcproj |  | ||||||
| > dir lib       % DLL files are here |  | ||||||
| > dir include   % header files are here |  | ||||||
| ``` |  | ||||||
|  |  | ||||||
| ## Install from git repository |  | ||||||
|  |  | ||||||
| You need to install gcc (4.1.0 or higher), autotools. |  | ||||||
|  |  | ||||||
| ``` |  | ||||||
| $ git clone git@github.com:msgpack/msgpack.git |  | ||||||
| $ cd msgpack/cpp |  | ||||||
| $ ./bootstrap |  | ||||||
| $ ./configure |  | ||||||
| $ make |  | ||||||
| $ sudo make install |  | ||||||
| ``` |  | ||||||
|  |  | ||||||
| # Serialization QuickStart for C |  | ||||||
|  |  | ||||||
| ## First program |  | ||||||
|  |  | ||||||
| Include `msgpack.h` header and link `msgpack` library to use MessagePack on your program. |  | ||||||
|  |  | ||||||
| ```c |  | ||||||
| #include <msgpack.h> |  | ||||||
| #include <stdio.h> |  | ||||||
|  |  | ||||||
| int main(void) { |  | ||||||
|  |  | ||||||
|         /* creates buffer and serializer instance. */ |  | ||||||
|         msgpack_sbuffer* buffer = msgpack_sbuffer_new(); |  | ||||||
|         msgpack_packer* pk = msgpack_packer_new(buffer, msgpack_sbuffer_write); |  | ||||||
|  |  | ||||||
|         /* serializes ["Hello", "MessagePack"]. */ |  | ||||||
|         msgpack_pack_array(pk, 2); |  | ||||||
|         msgpack_pack_bin(pk, 5); |  | ||||||
|         msgpack_pack_bin_body(pk, "Hello", 5); |  | ||||||
|         msgpack_pack_bin(pk, 11); |  | ||||||
|         msgpack_pack_bin_body(pk, "MessagePack", 11); |  | ||||||
|  |  | ||||||
|         /* deserializes it. */ |  | ||||||
|         msgpack_unpacked msg; |  | ||||||
|         msgpack_unpacked_init(&msg); |  | ||||||
|         msgpack_unpack_return ret = msgpack_unpack_next(&msg, buffer->data, buffer->size, NULL); |  | ||||||
|  |  | ||||||
|         /* prints the deserialized object. */ |  | ||||||
|         msgpack_object obj = msg.data; |  | ||||||
|         msgpack_object_print(stdout, obj);  /*=> ["Hello", "MessagePack"] */ |  | ||||||
|  |  | ||||||
|         /* cleaning */ |  | ||||||
|         msgpack_sbuffer_free(buffer); |  | ||||||
|         msgpack_packer_free(pk); |  | ||||||
| } |  | ||||||
| ``` |  | ||||||
|  |  | ||||||
| ## Simple program with a loop |  | ||||||
|  |  | ||||||
| ```c |  | ||||||
| #include <msgpack.h> |  | ||||||
| #include <stdio.h> |  | ||||||
|  |  | ||||||
| int main(void) { |  | ||||||
|  |  | ||||||
|         /* creates buffer and serializer instance. */ |  | ||||||
|         msgpack_sbuffer* buffer = msgpack_sbuffer_new(); |  | ||||||
|         msgpack_packer* pk = msgpack_packer_new(buffer, msgpack_sbuffer_write); |  | ||||||
|  |  | ||||||
|         int j; |  | ||||||
|  |  | ||||||
|         for(j = 0; j<23; j++) { |  | ||||||
|            /* NB: the buffer needs to be cleared on each iteration */ |  | ||||||
|            msgpack_sbuffer_clear(buffer); |  | ||||||
|  |  | ||||||
|            /* serializes ["Hello", "MessagePack"]. */ |  | ||||||
|            msgpack_pack_array(pk, 3); |  | ||||||
|            msgpack_pack_bin(pk, 5); |  | ||||||
|            msgpack_pack_bin_body(pk, "Hello", 5); |  | ||||||
|            msgpack_pack_bin(pk, 11); |  | ||||||
|            msgpack_pack_bin_body(pk, "MessagePack", 11); |  | ||||||
|            msgpack_pack_int(pk, j); |  | ||||||
|  |  | ||||||
|            /* deserializes it. */ |  | ||||||
|            msgpack_unpacked msg; |  | ||||||
|            msgpack_unpacked_init(&msg); |  | ||||||
|            msgpack_unpack_return ret = msgpack_unpack_next(&msg, buffer->data, buffer->size, NULL); |  | ||||||
|  |  | ||||||
|            /* prints the deserialized object. */ |  | ||||||
|            msgpack_object obj = msg.data; |  | ||||||
|            msgpack_object_print(stdout, obj);  /*=> ["Hello", "MessagePack"] */ |  | ||||||
|            puts(""); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         /* cleaning */ |  | ||||||
|         msgpack_sbuffer_free(buffer); |  | ||||||
|         msgpack_packer_free(pk); |  | ||||||
| } |  | ||||||
| ``` |  | ||||||
|  |  | ||||||
| ## Streaming feature |  | ||||||
|  |  | ||||||
| ```c |  | ||||||
| #include <msgpack.h> |  | ||||||
| #include <stdio.h> |  | ||||||
|  |  | ||||||
| int main(void) { |  | ||||||
|         /* serializes multiple objects using msgpack_packer. */ |  | ||||||
|         msgpack_sbuffer* buffer = msgpack_sbuffer_new(); |  | ||||||
|         msgpack_packer* pk = msgpack_packer_new(buffer, msgpack_sbuffer_write); |  | ||||||
|         msgpack_pack_int(pk, 1); |  | ||||||
|         msgpack_pack_int(pk, 2); |  | ||||||
|         msgpack_pack_int(pk, 3); |  | ||||||
|  |  | ||||||
|         /* deserializes these objects using msgpack_unpacker. */ |  | ||||||
|         msgpack_unpacker pac; |  | ||||||
|         msgpack_unpacker_init(&pac, MSGPACK_UNPACKER_INIT_BUFFER_SIZE); |  | ||||||
|  |  | ||||||
|         /* feeds the buffer. */ |  | ||||||
|         msgpack_unpacker_reserve_buffer(&pac, buffer->size); |  | ||||||
|         memcpy(msgpack_unpacker_buffer(&pac), buffer->data, buffer->size); |  | ||||||
|         msgpack_unpacker_buffer_consumed(&pac, buffer->size); |  | ||||||
|  |  | ||||||
|         /* now starts streaming deserialization. */ |  | ||||||
|         msgpack_unpacked result; |  | ||||||
|         msgpack_unpacked_init(&result); |  | ||||||
|  |  | ||||||
|         while(msgpack_unpacker_next(&pac, &result)) { |  | ||||||
|             msgpack_object_print(stdout, result.data); |  | ||||||
|             puts(""); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         /* results: |  | ||||||
|          * $ gcc stream.cc -lmsgpackc -o stream |  | ||||||
|          * $ ./stream |  | ||||||
|          * 1 |  | ||||||
|          * 2 |  | ||||||
|          * 3 |  | ||||||
|          */ |  | ||||||
| } |  | ||||||
| ``` |  | ||||||
| @@ -59,7 +59,7 @@ $ ./hello | |||||||
| #include <iostream> | #include <iostream> | ||||||
| #include <string> | #include <string> | ||||||
|  |  | ||||||
| int main(void) { | int main() { | ||||||
|         // serializes multiple objects using msgpack::packer. |         // serializes multiple objects using msgpack::packer. | ||||||
|         msgpack::sbuffer buffer; |         msgpack::sbuffer buffer; | ||||||
|  |  | ||||||
| @@ -98,7 +98,7 @@ int main(void) { | |||||||
| #include <iostream> | #include <iostream> | ||||||
| #include <string> | #include <string> | ||||||
|  |  | ||||||
| int main(void) { | int main() { | ||||||
|         // serializes multiple objects into one message containing an array using msgpack::packer. |         // serializes multiple objects into one message containing an array using msgpack::packer. | ||||||
|         msgpack::sbuffer buffer; |         msgpack::sbuffer buffer; | ||||||
|  |  | ||||||
| @@ -139,7 +139,7 @@ public: | |||||||
|     MSGPACK_DEFINE(m_str, m_vec); |     MSGPACK_DEFINE(m_str, m_vec); | ||||||
| }; | }; | ||||||
|  |  | ||||||
| int main(void) { | int main() { | ||||||
|         std::vector<myclass> vec; |         std::vector<myclass> vec; | ||||||
|         // add some elements into vec... |         // add some elements into vec... | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										207
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										207
									
								
								README.md
									
									
									
									
									
								
							| @@ -1,9 +1,10 @@ | |||||||
| `msgpack` for C/C++ | `msgpack` for C++ | ||||||
| =================== | =================== | ||||||
|  |  | ||||||
| Version 2.1.5 [](https://travis-ci.org/msgpack/msgpack-c) [](https://ci.appveyor.com/project/redboltz/msgpack-c/branch/master) | Version 6.1.1 [](https://github.com/msgpack/msgpack-c/actions) [](https://ci.appveyor.com/project/redboltz/msgpack-c/branch/cpp_master) | ||||||
|  | [](https://codecov.io/gh/msgpack/msgpack-c/branch/cpp_master) | ||||||
|  |  | ||||||
| It's like JSON but small and fast. | It's like JSON but smaller and faster. | ||||||
|  |  | ||||||
| Overview | Overview | ||||||
| -------- | -------- | ||||||
| @@ -11,64 +12,19 @@ Overview | |||||||
| [MessagePack](http://msgpack.org/) is an efficient binary serialization | [MessagePack](http://msgpack.org/) is an efficient binary serialization | ||||||
| format, which lets you exchange data among multiple languages like JSON, | format, which lets you exchange data among multiple languages like JSON, | ||||||
| except that it's faster and smaller. Small integers are encoded into a | except that it's faster and smaller. Small integers are encoded into a | ||||||
| single byte while typical short strings require only one extra byte in | single byte and short strings require only one extra byte in | ||||||
| addition to the strings themselves. | addition to the strings themselves. | ||||||
|  |  | ||||||
| Example | Example | ||||||
| ------- | ------- | ||||||
|  |  | ||||||
| In C: |  | ||||||
|  |  | ||||||
| ```c |  | ||||||
| #include <msgpack.h> |  | ||||||
| #include <stdio.h> |  | ||||||
|  |  | ||||||
| int main(void) |  | ||||||
| { |  | ||||||
|     /* msgpack::sbuffer is a simple buffer implementation. */ |  | ||||||
|     msgpack_sbuffer sbuf; |  | ||||||
|     msgpack_sbuffer_init(&sbuf); |  | ||||||
|  |  | ||||||
|     /* serialize values into the buffer using msgpack_sbuffer_write callback function. */ |  | ||||||
|     msgpack_packer pk; |  | ||||||
|     msgpack_packer_init(&pk, &sbuf, msgpack_sbuffer_write); |  | ||||||
|  |  | ||||||
|     msgpack_pack_array(&pk, 3); |  | ||||||
|     msgpack_pack_int(&pk, 1); |  | ||||||
|     msgpack_pack_true(&pk); |  | ||||||
|     msgpack_pack_str(&pk, 7); |  | ||||||
|     msgpack_pack_str_body(&pk, "example", 7); |  | ||||||
|  |  | ||||||
|     /* deserialize the buffer into msgpack_object instance. */ |  | ||||||
|     /* deserialized object is valid during the msgpack_zone instance alive. */ |  | ||||||
|     msgpack_zone mempool; |  | ||||||
|     msgpack_zone_init(&mempool, 2048); |  | ||||||
|  |  | ||||||
|     msgpack_object deserialized; |  | ||||||
|     msgpack_unpack(sbuf.data, sbuf.size, NULL, &mempool, &deserialized); |  | ||||||
|  |  | ||||||
|     /* print the deserialized object. */ |  | ||||||
|     msgpack_object_print(stdout, deserialized); |  | ||||||
|     puts(""); |  | ||||||
|  |  | ||||||
|     msgpack_zone_destroy(&mempool); |  | ||||||
|     msgpack_sbuffer_destroy(&sbuf); |  | ||||||
|  |  | ||||||
|     return 0; |  | ||||||
| } |  | ||||||
| ``` |  | ||||||
|  |  | ||||||
| See [`QUICKSTART-C.md`](./QUICKSTART-C.md) for more details. |  | ||||||
|  |  | ||||||
| In C++: |  | ||||||
|  |  | ||||||
| ```c++ | ```c++ | ||||||
| #include <msgpack.hpp> | #include <msgpack.hpp> | ||||||
| #include <string> | #include <string> | ||||||
| #include <iostream> | #include <iostream> | ||||||
| #include <sstream> | #include <sstream> | ||||||
|  |  | ||||||
| int main(void) | int main() | ||||||
| { | { | ||||||
|     msgpack::type::tuple<int, bool, std::string> src(1, true, "example"); |     msgpack::type::tuple<int, bool, std::string> src(1, true, "example"); | ||||||
|  |  | ||||||
| @@ -97,80 +53,157 @@ int main(void) | |||||||
|     msgpack::type::tuple<int, bool, std::string> dst; |     msgpack::type::tuple<int, bool, std::string> dst; | ||||||
|     deserialized.convert(dst); |     deserialized.convert(dst); | ||||||
|  |  | ||||||
|  |     // or create the new instance | ||||||
|  |     msgpack::type::tuple<int, bool, std::string> dst2 = | ||||||
|  |         deserialized.as<msgpack::type::tuple<int, bool, std::string> >(); | ||||||
|  |  | ||||||
|     return 0; |     return 0; | ||||||
| } | } | ||||||
| ``` | ``` | ||||||
|  |  | ||||||
| See [`QUICKSTART-CPP.md`](./QUICKSTART-CPP.md) for more details. | See [`QUICKSTART-CPP.md`](./QUICKSTART-CPP.md) for more details. | ||||||
|  |  | ||||||
|  | Dependency | ||||||
|  | ---------- | ||||||
|  |  | ||||||
|  | msgpack-c requires [boost library](https://www.boost.org/). | ||||||
|  | C++ version of msgpack-c itself is a header-only library and depends only on | ||||||
|  | boost headers. Tests depend on boost unit test framework and are linked with | ||||||
|  | it, so if you want to build them, you need to have this dependency installed. | ||||||
|  |  | ||||||
|  | Experimental support for removing boost dependency | ||||||
|  |  | ||||||
|  | For cmake: | ||||||
|  |  | ||||||
|  | ``` | ||||||
|  | cmake -DMSGPACK_USE_BOOST=OFF .. | ||||||
|  | ``` | ||||||
|  |  | ||||||
|  | NOTE: `-DMSGPACK_BUILD_TESTS=ON` doesn't work with `-DMSGPACK_USE_BOOST=OFF`. | ||||||
|  |  | ||||||
|  | For C++ compiler | ||||||
|  |  | ||||||
|  | ``` | ||||||
|  | clang++ -DMSGPACK_NO_BOOST your_code.cpp | ||||||
|  | ``` | ||||||
|  |  | ||||||
|  |  | ||||||
| Usage | Usage | ||||||
| ----- | ----- | ||||||
|  |  | ||||||
| ### C++ Header Only Library | - If you build your project with cmake, you can find msgpack-c with a | ||||||
|  |   canonical cmake-way: | ||||||
|  |  | ||||||
| When you use msgpack on C++03 and C++11, you can just add |   ```cmake | ||||||
| msgpack-c/include to your include path: |   # ... | ||||||
|  |   find_package(msgpack REQUIRED) | ||||||
|  |   # ... | ||||||
|  |   target_link_libraries(your_target_name <PRIVATE/PUBLIC/INTERFACE> msgpack-cxx) | ||||||
|  |   # ... | ||||||
|  |   ``` | ||||||
|  |  | ||||||
|     g++ -I msgpack-c/include your_source_file.cpp |   This will search for `msgpack` cmake package in a system prefix and in | ||||||
|  |   prefixes from `CMAKE_PREFIX_PATH`. Note that msgpack-c depends on boost | ||||||
|  |   headers, and `msgpack` cmake package depends on `Boost` cmake package. The | ||||||
|  |   library is header-only and `target_link_libraries` command just adds path | ||||||
|  |   to msgpack-c headers to your compiler's include path. | ||||||
|  |  | ||||||
| If you want to use C version of msgpack, you need to build it. You can |   A usage example can be found at [test-install](test-install) directory. | ||||||
| also install the C and C++ versions of msgpack. |  | ||||||
|  |  | ||||||
| ### Building and Installing | - If you do not use cmake, you can just add path yo msgpack-c and boost | ||||||
|  |   headers to your include path: | ||||||
|  |  | ||||||
| #### Install from git repository |   ```bash | ||||||
|  |   g++ -I msgpack-c/include -I path_to_boost your_source_file.cpp | ||||||
|  |   ``` | ||||||
|  |  | ||||||
| ##### Using the Terminal (CLI) | Building and Installing | ||||||
|  | ----------------------- | ||||||
|  |  | ||||||
|  | ### Install from git repository | ||||||
|  |  | ||||||
|  | #### Using the Terminal (CLI) | ||||||
|  |  | ||||||
| You will need: | You will need: | ||||||
|  |  | ||||||
|  - `gcc >= 4.1.0` | - `gcc >= 4.1.0` | ||||||
|  - `cmake >= 2.8.0` | - `cmake >= 3.1.0` | ||||||
|  |  | ||||||
| C and C++03: | C++03: | ||||||
|  |  | ||||||
|     $ git clone https://github.com/msgpack/msgpack-c.git | ```bash | ||||||
|     $ cd msgpack-c | git clone https://github.com/msgpack/msgpack-c.git | ||||||
|     $ cmake . | cd msgpack-c | ||||||
|     $ make | git checkout cpp_master | ||||||
|     $ sudo make install | cmake . | ||||||
|  | sudo cmake --build . --target install | ||||||
|  | ``` | ||||||
|  |  | ||||||
| If you want to setup C++11 version of msgpack instead, | If you want to build tests with different C++ version, you can use | ||||||
| execute the following commands: | `MSGPACK_CXX11`, `MSGPACK_CXX14`, `MSGPACK_CXX17`, `MSGPACK_CXX20` options. | ||||||
|  | Just replace the line | ||||||
|  |  | ||||||
|     $ git clone https://github.com/msgpack/msgpack-c.git | ```bash | ||||||
|     $ cd msgpack-c | cmake . | ||||||
|     $ cmake -DMSGPACK_CXX11=ON . | ``` | ||||||
|     $ sudo make install |  | ||||||
|  | with a line like that: | ||||||
|  |  | ||||||
|  | ```bash | ||||||
|  | cmake -DMSGPACK_CXX20=ON . | ||||||
|  | ``` | ||||||
|  |  | ||||||
|  | Note that these flags do not affect installation. They just switch test cases. | ||||||
|  | All files are installed in every settings. | ||||||
|  |  | ||||||
|  | If you don't have superuser permissions or don't want to install the library | ||||||
|  | to a system-wide prefix, you can use `CMAKE_INSTALL_PREFIX` option like that: | ||||||
|  |  | ||||||
|  | ```bash | ||||||
|  | cmake -DCMAKE_INSTALL_PREFIX=/your/custom/prefix . | ||||||
|  | ``` | ||||||
|  |  | ||||||
|  | Other useful options: | ||||||
|  |  | ||||||
|  | - `MSGPACK_BUILD_TESTS` (default `OFF`): build tests | ||||||
|  | - `MSGPACK_BUILD_EXAMPLES` (default `OFF`): build examples | ||||||
|  | - `MSGPACK_32BIT` (default `OFF`): 32bit compile | ||||||
|  | - `MSGPACK_USE_X3_PARSE` (default `OFF`): use Boost X3 parse | ||||||
|  |   (note that it requires C++14 or newer) | ||||||
|  | - `MSGPACK_CHAR_SIGN` (not set explicitly by default): char sign to use (signed or unsigned) | ||||||
|  | - `MSGPACK_USE_STATIC_BOOST` (default `OFF`): statically link with boost libraries | ||||||
|  |  | ||||||
| #### GUI on Windows | #### GUI on Windows | ||||||
|  |  | ||||||
| Clone msgpack-c git repository. | Clone msgpack-c git repository with the command: | ||||||
|  |  | ||||||
|     $ git clone https://github.com/msgpack/msgpack-c.git | ``` | ||||||
|  | git clone https://github.com/msgpack/msgpack-c.git | ||||||
|  | ``` | ||||||
|  |  | ||||||
| or using GUI git client. | or using GUI git client (e.g. [tortoise git](https://code.google.com/p/tortoisegit/)). | ||||||
|  |  | ||||||
| e.g.) tortoise git https://code.google.com/p/tortoisegit/ | 1. Checkout to `cpp_master` branch | ||||||
|  |  | ||||||
| 1. Launch [cmake GUI client](http://www.cmake.org/cmake/resources/software.html). | 2. Launch [cmake GUI client](http://www.cmake.org/cmake/resources/software.html). | ||||||
|  |  | ||||||
| 2. Set 'Where is the source code:' text box and 'Where to build | 3. Set 'Where is the source code:' text box and | ||||||
| the binaries:' text box. |    'Where to build the binaries:' text box. | ||||||
|  |  | ||||||
| 3. Click 'Configure' button. | 4. Click 'Configure' button. | ||||||
|  |  | ||||||
| 4. Choose your Visual Studio version. | 5. Choose your Visual Studio version. | ||||||
|  |  | ||||||
| 5. Click 'Generate' button. | 6. Click 'Generate' button. | ||||||
|  |  | ||||||
| 6. Open the created msgpack.sln on Visual Studio. | 7. Open the created msgpack.sln on Visual Studio. | ||||||
|  |  | ||||||
| 7. Build all. | 8. Build all. | ||||||
|  |  | ||||||
| ### Documentation | Documentation | ||||||
|  | ------------- | ||||||
|  |  | ||||||
| You can get addtional information on the | You can get additional information including the tutorial on the | ||||||
| [wiki](https://github.com/msgpack/msgpack-c/wiki). | [wiki](https://github.com/msgpack/msgpack-c/wiki). | ||||||
|  |  | ||||||
| Contributing | Contributing | ||||||
|   | |||||||
							
								
								
									
										106
									
								
								appveyor.yml
									
									
									
									
									
								
							
							
						
						
									
										106
									
								
								appveyor.yml
									
									
									
									
									
								
							| @@ -1,58 +1,66 @@ | |||||||
| version: 2.1.5.{build} | version: 6.1.1.{build} | ||||||
|  |  | ||||||
|  | branches: | ||||||
|  |   only: | ||||||
|  |   - cpp_master | ||||||
|  |  | ||||||
| image: |  | ||||||
| - Visual Studio 2015 |  | ||||||
| environment: | environment: | ||||||
|   global: |  | ||||||
|     BOOST_ROOT: C:\Libraries\boost_1_60_0 |  | ||||||
|   matrix: |   matrix: | ||||||
|     - cpp11: -DMSGPACK_CXX11=OFF |     - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013 | ||||||
|       boost: -DMSGPACK_BOOST=OFF |       cpp11: -DMSGPACK_CXX11=OFF | ||||||
|       msvc: '"Visual Studio 10 2010"' |  | ||||||
|     - cpp11: -DMSGPACK_CXX11=OFF |  | ||||||
|       boost: -DMSGPACK_BOOST=OFF |  | ||||||
|       msvc: '"Visual Studio 11 2012"' |  | ||||||
|     - cpp11: -DMSGPACK_CXX11=OFF |  | ||||||
|       boost: -DMSGPACK_BOOST=OFF |  | ||||||
|       msvc: '"Visual Studio 12 2013"' |       msvc: '"Visual Studio 12 2013"' | ||||||
|     - cpp11: -DMSGPACK_CXX11=ON |       boost_prefix: C:\Libraries\boost_1_58_0 | ||||||
|       boost: -DMSGPACK_BOOST=ON |       boost_subdir: lib32-msvc-12.0 | ||||||
|  |     - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 | ||||||
|  |       cpp11: -DMSGPACK_CXX11=OFF | ||||||
|       msvc: '"Visual Studio 14 2015"' |       msvc: '"Visual Studio 14 2015"' | ||||||
|     - cpp11: -DMSGPACK_CXX11=OFF |       boost_prefix: C:\Libraries\boost_1_69_0 | ||||||
|       boost: -DMSGPACK_BOOST=ON |       boost_subdir: lib32-msvc-14.0 | ||||||
|       msvc: '"Visual Studio 14 2015"' |     - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 | ||||||
|     - cpp11: -DMSGPACK_CXX11=ON |       cpp11: -DMSGPACK_CXX11=ON | ||||||
|       boost: -DMSGPACK_BOOST=OFF |  | ||||||
|       msvc: '"Visual Studio 14 2015"' |  | ||||||
|     - cpp11: -DMSGPACK_CXX11=OFF |  | ||||||
|       boost: -DMSGPACK_BOOST=OFF |  | ||||||
|       msvc: '"Visual Studio 14 2015"' |       msvc: '"Visual Studio 14 2015"' | ||||||
|  |       boost_prefix: C:\Libraries\boost_1_69_0 | ||||||
|  |       boost_subdir: lib32-msvc-14.0 | ||||||
| build_script: | build_script: | ||||||
| - appveyor DownloadFile https://github.com/google/googletest/archive/release-1.7.0.zip -FileName googletest-release-1.7.0.zip |   - ps: | | ||||||
| - 7z x googletest-release-1.7.0.zip > NUL |       appveyor DownloadFile http://zlib.net/zlib-1.3.1.tar.gz -FileName zlib-1.3.1.tar.gz | ||||||
| - cd googletest-release-1.7.0 |       7z x zlib-1.3.1.tar.gz 2> $null | ||||||
| - md build |       7z x zlib-1.3.1.tar 2> $null | ||||||
| - cd build |       cd zlib-1.3.1 | ||||||
| - cmake -G %msvc% -DBUILD_SHARED_LIBS=ON -DCMAKE_CXX_FLAGS=/D_VARIADIC_MAX=10 .. |  | ||||||
| - cmake --build . --config Release |       md build | ||||||
| - cd .. |       md prefix | ||||||
| - cd .. |       cd build | ||||||
| - appveyor DownloadFile http://zlib.net/zlib-1.2.11.tar.gz -FileName zlib-1.2.11.tar.gz |  | ||||||
| - 7z x zlib-1.2.11.tar.gz > NUL |       cmake ` | ||||||
| - 7z x zlib-1.2.11.tar > NUL |           -G $env:msvc ` | ||||||
| - cd zlib-1.2.11 |           -D CMAKE_INSTALL_PREFIX="$env:APPVEYOR_BUILD_FOLDER\zlib-1.3.1\prefix" ` | ||||||
| - md build |           .. | ||||||
| - cd build |       if ($LastExitCode -ne 0) { exit $LastExitCode } | ||||||
| - cmake -G %msvc% .. |  | ||||||
| - cmake --build . --config Release |       cmake --build . --target install --config Release | ||||||
| - copy zconf.h .. |       if ($LastExitCode -ne 0) { exit $LastExitCode } | ||||||
| - cd .. |       cd ..\.. | ||||||
| - cd .. |  | ||||||
| - md build |       md build | ||||||
| - cd build |       md prefix | ||||||
| - cmake -G %msvc% %cpp11% %boost% %x3_parse% -DGTEST_LIBRARY=%APPVEYOR_BUILD_FOLDER%\googletest-release-1.7.0\build\Release\gtest.lib -DGTEST_MAIN_LIBRARY=%APPVEYOR_BUILD_FOLDER%\googletest-release-1.7.0\build\Release\gtest_main.lib -DGTEST_INCLUDE_DIR=%APPVEYOR_BUILD_FOLDER%\googletest-release-1.7.0\include -DZLIB_LIBRARY=%APPVEYOR_BUILD_FOLDER%\zlib-1.2.11\build\Release\zlib.lib -DZLIB_INCLUDE_DIR=%APPVEYOR_BUILD_FOLDER%\zlib-1.2.11 -DCMAKE_CXX_FLAGS='"/D_VARIADIC_MAX=10 /EHsc"' .. |       cd build | ||||||
| - cmake --build . --config Release |  | ||||||
|  |       cmake ` | ||||||
|  |           -G $env:msvc ` | ||||||
|  |           $env:cpp11 ` | ||||||
|  |           -D MSGPACK_BUILD_EXAMPLES=ON ` | ||||||
|  |           -D MSGPACK_BUILD_TESTS=ON ` | ||||||
|  |           -D CMAKE_EXE_LINKER_FLAGS=/LIBPATH:"$env:boost_prefix\$env:boost_subdir" ` | ||||||
|  |           -D CMAKE_PREFIX_PATH="$env:boost_prefix;$env:APPVEYOR_BUILD_FOLDER\zlib-1.3.1\prefix" ` | ||||||
|  |           -D CMAKE_INSTALL_PREFIX="$env:APPVEYOR_BUILD_FOLDER\prefix" ` | ||||||
|  |           -D CMAKE_CXX_FLAGS="/D_VARIADIC_MAX=10 /EHsc /DBOOST_ALL_DYN_LINK" ` | ||||||
|  |           .. | ||||||
|  |       if ($LastExitCode -ne 0) { exit $LastExitCode } | ||||||
|  |  | ||||||
|  |       cmake --build . --config Release | ||||||
|  |       if ($LastExitCode -ne 0) { exit $LastExitCode } | ||||||
|  |  | ||||||
| test_script: | test_script: | ||||||
| - set PATH=%PATH%;%APPVEYOR_BUILD_FOLDER%\googletest-release-1.7.0\build\Release;%APPVEYOR_BUILD_FOLDER%\zlib-1.2.11\build\Release;%APPVEYOR_BUILD_FOLDER%\build\release | - set PATH=%PATH%;%APPVEYOR_BUILD_FOLDER%\zlib-1.3.1\build\Release;%APPVEYOR_BUILD_FOLDER%\build\release;%boost_prefix%\%boost_subdir% | ||||||
| - ctest -V | - ctest -VV -C Release | ||||||
|   | |||||||
| @@ -1,63 +1,38 @@ | |||||||
| #!/bin/bash | #!/bin/bash | ||||||
|  |  | ||||||
| mkdir build | build_dir="$CXX-build" | ||||||
|  | prefix_dir="`pwd`/$CXX-prefix" | ||||||
|  | mkdir $build_dir  || exit 1 | ||||||
|  | mkdir $prefix_dir || exit 1 | ||||||
|  |  | ||||||
| ret=$? | if [ "${ARCH}" == "32" ]; then | ||||||
| if [ $ret -ne 0 ] |  | ||||||
| then |  | ||||||
|     exit $ret |  | ||||||
| fi |  | ||||||
|  |  | ||||||
| cd build |  | ||||||
|  |  | ||||||
| ret=$? |  | ||||||
| if [ $ret -ne 0 ] |  | ||||||
| then |  | ||||||
|     exit $ret |  | ||||||
| fi |  | ||||||
|  |  | ||||||
| if [ "${ARCH}" == "32" ] |  | ||||||
| then |  | ||||||
|     export BIT32="ON" |     export BIT32="ON" | ||||||
|  |     export ARCH_FLAG="-m32" | ||||||
| else | else | ||||||
|     export BIT32="OFF" |     export BIT32="OFF" | ||||||
|  |     export ARCH_FLAG="-m64" | ||||||
| fi | fi | ||||||
|  |  | ||||||
| cmake -DMSGPACK_CXX11=${CXX11} -DMSGPACK_32BIT=${BIT32} -DMSGPACK_BOOST=${BOOST} -DMSGPACK_ENABLE_SHARED=${SHARED} -DMSGPACK_CHAR_SIGN=${CHAR_SIGN} -DMSGPACK_DEFAULT_API_VERSION=${API_VERSION} -DMSGPACK_USE_X3_PARSE=${X3_PARSE} .. | cmake \ | ||||||
|  |     -D CMAKE_PREFIX_PATH="${HOME}/boost-prefix/${ARCH};${HOME}/zlib-prefix/${ARCH}" \ | ||||||
|  |     -D MSGPACK_BUILD_TESTS=ON \ | ||||||
|  |     -D ${MSGPACK_CXX_VERSION} \ | ||||||
|  |     -D MSGPACK_32BIT=${BIT32} \ | ||||||
|  |     -D MSGPACK_CHAR_SIGN=${CHAR_SIGN} \ | ||||||
|  |     -D MSGPACK_DEFAULT_API_VERSION=${API_VERSION} \ | ||||||
|  |     -D MSGPACK_USE_X3_PARSE=${X3_PARSE} \ | ||||||
|  |     -D MSGPACK_USE_STD_VARIANT_ADAPTOR=${STD_VARIANT_ADAPTOR} \ | ||||||
|  |     -D CMAKE_CXX_FLAGS="${CXXFLAGS} ${ARCH_FLAG}" \ | ||||||
|  |     -D CMAKE_INSTALL_PREFIX=$prefix_dir \ | ||||||
|  |     -B $build_dir \ | ||||||
|  |     -S . || exit 1 | ||||||
|  |  | ||||||
| ret=$? | cmake --build $build_dir --target install || exit 1 | ||||||
| if [ $ret -ne 0 ] |  | ||||||
| then |  | ||||||
|     exit $ret |  | ||||||
| fi |  | ||||||
|  |  | ||||||
| make | ctest -VV --test-dir $build_dir || exit 1 | ||||||
|  |  | ||||||
| ret=$? | if [ "${ARCH}" != "32" ] && [ `uname` = "Linux" ]; then | ||||||
| if [ $ret -ne 0 ] |     ctest -T memcheck --test-dir $build_dir | tee memcheck.log | ||||||
| then |  | ||||||
|     exit $ret |  | ||||||
| fi |  | ||||||
|  |  | ||||||
| make test |  | ||||||
|  |  | ||||||
| ret=$? |  | ||||||
| if [ $ret -ne 0 ] |  | ||||||
| then |  | ||||||
|     exit $ret |  | ||||||
| fi |  | ||||||
|  |  | ||||||
| make install DESTDIR=`pwd`/install |  | ||||||
|  |  | ||||||
| ret=$? |  | ||||||
| if [ $ret -ne 0 ] |  | ||||||
| then |  | ||||||
|     exit $ret |  | ||||||
| fi |  | ||||||
|  |  | ||||||
| if [ "${ARCH}" != "32" ] && [ `uname` = "Linux" ] |  | ||||||
| then |  | ||||||
|     ctest -T memcheck | tee memcheck.log |  | ||||||
|  |  | ||||||
|     ret=${PIPESTATUS[0]} |     ret=${PIPESTATUS[0]} | ||||||
|     if [ $ret -ne 0 ] |     if [ $ret -ne 0 ] | ||||||
| @@ -72,4 +47,15 @@ then | |||||||
|     fi |     fi | ||||||
| fi | fi | ||||||
|  |  | ||||||
| exit 0 | if [ "${ARCH}" != "32" ]; then | ||||||
|  |     cd test-install || exit 1 | ||||||
|  |  | ||||||
|  |     mkdir $build_dir | ||||||
|  |     cmake \ | ||||||
|  |         -D CMAKE_PREFIX_PATH="$prefix_dir;${HOME}/boost-prefix/${ARCH}" \ | ||||||
|  |         -B $build_dir \ | ||||||
|  |         -S . || exit 1 | ||||||
|  |     cmake --build $build_dir --target all || exit 1 | ||||||
|  |  | ||||||
|  |     $build_dir/test-install || exit 1 | ||||||
|  | fi | ||||||
|   | |||||||
							
								
								
									
										25
									
								
								ci/build_regression.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										25
									
								
								ci/build_regression.sh
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,25 @@ | |||||||
|  | #!/bin/bash | ||||||
|  |  | ||||||
|  | build_dir="$CXX-build" | ||||||
|  | mkdir $build_dir || exit 1 | ||||||
|  |  | ||||||
|  | if [ "${ARCH}" == "32" ] | ||||||
|  | then | ||||||
|  |     echo "64 bit support required for regressions" | ||||||
|  |     exit 1 | ||||||
|  | fi | ||||||
|  |  | ||||||
|  | cmake \ | ||||||
|  |     -D CMAKE_PREFIX_PATH="${HOME}/boost-prefix/${ARCH};${HOME}/zlib-prefix/${ARCH}" \ | ||||||
|  |     -D MSGPACK_FUZZ_REGRESSION="ON" \ | ||||||
|  |     -D ${MSGPACK_CXX_VERSION} \ | ||||||
|  |     -D MSGPACK_CHAR_SIGN=${CHAR_SIGN} \ | ||||||
|  |     -D MSGPACK_DEFAULT_API_VERSION=${API_VERSION} \ | ||||||
|  |     -D MSGPACK_USE_X3_PARSE=${X3_PARSE} \ | ||||||
|  |     -D CMAKE_CXX_FLAGS="${CXXFLAGS}" \ | ||||||
|  |     -B $build_dir \ | ||||||
|  |     -S . || exit 1 | ||||||
|  |  | ||||||
|  | cmake --build $build_dir --target all || exit 1 | ||||||
|  |  | ||||||
|  | ctest -VV --test-dir $build_dir || exit 1 | ||||||
							
								
								
									
										17
									
								
								ci/set_gcc_10.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										17
									
								
								ci/set_gcc_10.sh
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,17 @@ | |||||||
|  | #!/bin/bash | ||||||
|  |  | ||||||
|  | version=10 | ||||||
|  | priority=100 | ||||||
|  |  | ||||||
|  | sudo update-alternatives --install /usr/bin/gcc         gcc         /usr/bin/gcc-${version}         ${priority} | ||||||
|  | sudo update-alternatives --install /usr/bin/gcc-ar      gcc-ar      /usr/bin/gcc-ar-${version}      ${priority} | ||||||
|  | sudo update-alternatives --install /usr/bin/gcc-nm      gcc-nm      /usr/bin/gcc-nm-${version}      ${priority} | ||||||
|  | sudo update-alternatives --install /usr/bin/gcc-ranlib  gcc-ranlib  /usr/bin/gcc-ranlib-${version}  ${priority} | ||||||
|  | sudo update-alternatives --install /usr/bin/gcov        gcov        /usr/bin/gcov-${version}        ${priority} | ||||||
|  | sudo update-alternatives --install /usr/bin/gcov-dump   gcov-dump   /usr/bin/gcov-dump-${version}   ${priority} | ||||||
|  | sudo update-alternatives --install /usr/bin/gcov-tool   gcov-tool   /usr/bin/gcov-tool-${version}   ${priority} | ||||||
|  | sudo update-alternatives --install /usr/bin/lto-dump    lto-dump    /usr/bin/lto-dump-${version}    ${priority} | ||||||
|  | sudo update-alternatives --install /usr/bin/g++         g++         /usr/bin/g++-${version}         ${priority} | ||||||
|  |  | ||||||
|  | sudo update-alternatives --install /usr/bin/cc   cc   /usr/bin/gcc-${version} ${priority} | ||||||
|  | sudo update-alternatives --install /usr/bin/c++  c++  /usr/bin/g++-${version} ${priority} | ||||||
							
								
								
									
										55
									
								
								cmake/CodeCoverage.cmake
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										55
									
								
								cmake/CodeCoverage.cmake
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,55 @@ | |||||||
|  | # Check prereqs | ||||||
|  | FIND_PROGRAM(GCOV_PATH gcov) | ||||||
|  | FIND_PROGRAM(LCOV_PATH lcov) | ||||||
|  | FIND_PROGRAM(GENHTML_PATH genhtml) | ||||||
|  |  | ||||||
|  | IF(NOT GCOV_PATH) | ||||||
|  |     MESSAGE(FATAL_ERROR "gcov not found! Aborting...") | ||||||
|  | ENDIF() | ||||||
|  |  | ||||||
|  | IF(NOT CMAKE_COMPILER_IS_GNUCC AND NOT CMAKE_COMPILER_IS_GNUCXX) | ||||||
|  |     # Clang version 3.0.0 and greater now supports gcov as well. | ||||||
|  |     MESSAGE(STATUS "Compiler is not GNU gcc! Clang Version 3.0.0 and greater supports gcov as well, but older versions don't.") | ||||||
|  |     IF(NOT "${CMAKE_C_COMPILER_ID}" MATCHES "Clang" AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") | ||||||
|  |         MESSAGE(FATAL_ERROR "Compiler is not GNU gcc! Aborting...") | ||||||
|  |     ENDIF() | ||||||
|  | ENDIF() | ||||||
|  |  | ||||||
|  | SET(COVERAGE_FLAGS "-g -O0 --coverage") | ||||||
|  |  | ||||||
|  | FUNCTION(SETUP_TARGET_FOR_COVERAGE _targetname _testrunner _outputname) | ||||||
|  |  | ||||||
|  |     IF(NOT LCOV_PATH) | ||||||
|  |         MESSAGE(FATAL_ERROR "lcov not found! Aborting...") | ||||||
|  |     ENDIF() | ||||||
|  |  | ||||||
|  |     IF(NOT GENHTML_PATH) | ||||||
|  |         MESSAGE(FATAL_ERROR "genhtml not found! Aborting...") | ||||||
|  |     ENDIF() | ||||||
|  |  | ||||||
|  |     # Setup target | ||||||
|  |     ADD_CUSTOM_TARGET(${_targetname} | ||||||
|  |  | ||||||
|  |         # Cleanup lcov | ||||||
|  |         ${LCOV_PATH} --directory . --zerocounters | ||||||
|  |  | ||||||
|  |         # Run tests | ||||||
|  |         COMMAND ${_testrunner} ${ARGV3} | ||||||
|  |  | ||||||
|  |         # Capturing lcov counters and generating report | ||||||
|  |         COMMAND ${LCOV_PATH} --directory . --capture --output-file ${_outputname}.info --base-directory ${CMAKE_SOURCE_DIR} --no-external --quiet | ||||||
|  |         COMMAND ${LCOV_PATH} --remove ${_outputname}.info '*/test/*' '*/fuzz/*' --output-file ${_outputname}.info.cleaned --quiet | ||||||
|  |         COMMAND ${GENHTML_PATH} -o ${_outputname} ${_outputname}.info.cleaned --prefix ${CMAKE_SOURCE_DIR} | ||||||
|  |         # COMMAND ${CMAKE_COMMAND} -E remove ${_outputname}.info ${_outputname}.info.cleaned | ||||||
|  |  | ||||||
|  |         WORKING_DIRECTORY ${CMAKE_BINARY_DIR} | ||||||
|  |         COMMENT "Resetting code coverage counters to zero.\nProcessing code coverage counters and generating report." | ||||||
|  |     ) | ||||||
|  |  | ||||||
|  |     # Show info where to find the report | ||||||
|  |     ADD_CUSTOM_COMMAND(TARGET ${_targetname} POST_BUILD | ||||||
|  |         COMMAND ; | ||||||
|  |         COMMENT "Open ./${_outputname}/index.html in your browser to view the coverage report." | ||||||
|  |     ) | ||||||
|  |  | ||||||
|  | ENDFUNCTION() | ||||||
							
								
								
									
										36
									
								
								codecov.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								codecov.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,36 @@ | |||||||
|  | codecov: | ||||||
|  |   notify: | ||||||
|  |     require_ci_to_pass: yes | ||||||
|  |  | ||||||
|  | coverage: | ||||||
|  |   precision: 2 | ||||||
|  |   round: down | ||||||
|  |   range: "70...100" | ||||||
|  |  | ||||||
|  |   status: | ||||||
|  |     project: yes | ||||||
|  |     patch: yes | ||||||
|  |     changes: no | ||||||
|  |  | ||||||
|  | parsers: | ||||||
|  |   gcov: | ||||||
|  |     branch_detection: | ||||||
|  |       conditional: yes | ||||||
|  |       loop: yes | ||||||
|  |       method: no | ||||||
|  |       macro: no | ||||||
|  |  | ||||||
|  | comment: | ||||||
|  |   layout: "header, diff" | ||||||
|  |   behavior: default | ||||||
|  |   require_changes: no | ||||||
|  |  | ||||||
|  | ignore: | ||||||
|  |   - "test" | ||||||
|  |   - "fuzz" | ||||||
|  |   - "erb" | ||||||
|  |   - "ci" | ||||||
|  |   - "cmake" | ||||||
|  |   - "examle" | ||||||
|  |   - "external" | ||||||
|  |   - "usr" | ||||||
| @@ -61,6 +61,7 @@ struct define_map<A0<%1.upto(i) {|j|%>, A<%=j%><%}%>> { | |||||||
|         if(o.type != msgpack::type::MAP) { throw msgpack::type_error(); } |         if(o.type != msgpack::type::MAP) { throw msgpack::type_error(); } | ||||||
|         std::map<std::string, msgpack::object const*> kvmap; |         std::map<std::string, msgpack::object const*> kvmap; | ||||||
|         for (uint32_t i = 0; i < o.via.map.size; ++i) { |         for (uint32_t i = 0; i < o.via.map.size; ++i) { | ||||||
|  |             if (o.via.map.ptr[i].key.type != msgpack::type::STR) { throw msgpack::type_error(); } | ||||||
|             kvmap.insert( |             kvmap.insert( | ||||||
|                 std::map<std::string, msgpack::object const*>::value_type( |                 std::map<std::string, msgpack::object const*>::value_type( | ||||||
|                     std::string( |                     std::string( | ||||||
|   | |||||||
| @@ -121,7 +121,7 @@ inline tuple<> make_tuple() | |||||||
| /// @cond | /// @cond | ||||||
| <%0.upto(GENERATION_LIMIT) {|i|%> | <%0.upto(GENERATION_LIMIT) {|i|%> | ||||||
| template <typename A0<%1.upto(i) {|j|%>, typename A<%=j%><%}%>> | template <typename A0<%1.upto(i) {|j|%>, typename A<%=j%><%}%>> | ||||||
| inline tuple<A0<%1.upto(i) {|j|%>, A<%=j%><%}%>> make_tuple(typename tuple_type<A0>::transparent_reference a0<%1.upto(i) {|j|%>, typename tuple_type<A<%=j%>>::transparent_reference a<%=j%><%}%>) | tuple<A0<%1.upto(i) {|j|%>, A<%=j%><%}%>> make_tuple(A0 const& a0<%1.upto(i) {|j|%>, A<%=j%> const& a<%=j%><%}%>) | ||||||
| { | { | ||||||
|     return tuple<A0<%1.upto(i) {|j|%>, A<%=j%><%}%>>(a0<%1.upto(i) {|j|%>, a<%=j%><%}%>); |     return tuple<A0<%1.upto(i) {|j|%>, A<%=j%><%}%>>(a0<%1.upto(i) {|j|%>, a<%=j%><%}%>); | ||||||
| } | } | ||||||
|   | |||||||
| @@ -54,7 +54,7 @@ tuple<> make_tuple(); | |||||||
| /// @cond | /// @cond | ||||||
| <%0.upto(GENERATION_LIMIT) {|i|%> | <%0.upto(GENERATION_LIMIT) {|i|%> | ||||||
| template <typename A0<%1.upto(i) {|j|%>, typename A<%=j%><%}%>> | template <typename A0<%1.upto(i) {|j|%>, typename A<%=j%><%}%>> | ||||||
| tuple<A0<%1.upto(i) {|j|%>, A<%=j%><%}%>> make_tuple(typename tuple_type<A0>::transparent_reference a0<%1.upto(i) {|j|%>, typename tuple_type<A<%=j%>>::transparent_reference a<%=j%><%}%>); | tuple<A0<%1.upto(i) {|j|%>, A<%=j%><%}%>> make_tuple(A0 const& a0<%1.upto(i) {|j|%>, A<%=j%> const& a<%=j%><%}%>); | ||||||
| <%}%> | <%}%> | ||||||
| /// @endcond | /// @endcond | ||||||
|  |  | ||||||
|   | |||||||
| @@ -10,7 +10,15 @@ | |||||||
| #ifndef MSGPACK_V1_CPP03_ZONE_HPP | #ifndef MSGPACK_V1_CPP03_ZONE_HPP | ||||||
| #define MSGPACK_V1_CPP03_ZONE_HPP | #define MSGPACK_V1_CPP03_ZONE_HPP | ||||||
|  |  | ||||||
|  | #include "msgpack/versioning.hpp" | ||||||
|  | #include "msgpack/cpp_config.hpp" | ||||||
| #include "msgpack/zone_decl.hpp" | #include "msgpack/zone_decl.hpp" | ||||||
|  | #include "msgpack/assert.hpp" | ||||||
|  |  | ||||||
|  | #include <stdint.h> | ||||||
|  | #include <cstdlib> | ||||||
|  | #include <memory> | ||||||
|  | #include <vector> | ||||||
|  |  | ||||||
| <% GENERATION_LIMIT = 15 %> | <% GENERATION_LIMIT = 15 %> | ||||||
| namespace msgpack { | namespace msgpack { | ||||||
| @@ -55,7 +63,7 @@ class zone { | |||||||
|             ++m_tail; |             ++m_tail; | ||||||
|         } |         } | ||||||
|         void push_expand(void (*func)(void*), void* data) { |         void push_expand(void (*func)(void*), void* data) { | ||||||
|             const size_t nused = m_end - m_array; |             const size_t nused = static_cast<size_t>(m_end - m_array); | ||||||
|             size_t nnext; |             size_t nnext; | ||||||
|             if(nused == 0) { |             if(nused == 0) { | ||||||
|                 nnext = (sizeof(finalizer) < 72/2) ? |                 nnext = (sizeof(finalizer) < 72/2) ? | ||||||
| @@ -130,7 +138,7 @@ class zone { | |||||||
|     finalizer_array m_finalizer_array; |     finalizer_array m_finalizer_array; | ||||||
|  |  | ||||||
| public: | public: | ||||||
|     zone(size_t chunk_size = MSGPACK_ZONE_CHUNK_SIZE) /* throw() */; |     zone(size_t chunk_size = MSGPACK_ZONE_CHUNK_SIZE); | ||||||
|  |  | ||||||
| public: | public: | ||||||
|     void* allocate_align(size_t size, size_t align = MSGPACK_ZONE_ALIGN); |     void* allocate_align(size_t size, size_t align = MSGPACK_ZONE_ALIGN); | ||||||
| @@ -186,27 +194,28 @@ private: | |||||||
|     zone& operator=(const zone&); |     zone& operator=(const zone&); | ||||||
| }; | }; | ||||||
|  |  | ||||||
| inline zone::zone(size_t chunk_size) /* throw() */ :m_chunk_size(chunk_size), m_chunk_list(m_chunk_size) | inline zone::zone(size_t chunk_size):m_chunk_size(chunk_size), m_chunk_list(m_chunk_size) | ||||||
| { | { | ||||||
| } | } | ||||||
|  |  | ||||||
| inline char* zone::get_aligned(char* ptr, size_t align) | inline char* zone::get_aligned(char* ptr, size_t align) | ||||||
| { | { | ||||||
|  |     MSGPACK_ASSERT(align != 0 && (align & (align - 1)) == 0); // align must be 2^n (n >= 0) | ||||||
|     return |     return | ||||||
|         reinterpret_cast<char*>( |         reinterpret_cast<char*>( | ||||||
|             reinterpret_cast<size_t>( |             reinterpret_cast<uintptr_t>(ptr + (align - 1)) & ~static_cast<uintptr_t>(align - 1) | ||||||
|             (ptr + (align - 1))) / align * align); |         ); | ||||||
| } | } | ||||||
|  |  | ||||||
| inline void* zone::allocate_align(size_t size, size_t align) | inline void* zone::allocate_align(size_t size, size_t align) | ||||||
| { | { | ||||||
|     char* aligned = get_aligned(m_chunk_list.m_ptr, align); |     char* aligned = get_aligned(m_chunk_list.m_ptr, align); | ||||||
|     size_t adjusted_size = size + (aligned - m_chunk_list.m_ptr); |     size_t adjusted_size = size + static_cast<size_t>(aligned - m_chunk_list.m_ptr); | ||||||
|     if (m_chunk_list.m_free < adjusted_size) { |     if (m_chunk_list.m_free < adjusted_size) { | ||||||
|         size_t enough_size = size + align - 1; |         size_t enough_size = size + align - 1; | ||||||
|         char* ptr = allocate_expand(enough_size); |         char* ptr = allocate_expand(enough_size); | ||||||
|         aligned = get_aligned(ptr, align); |         aligned = get_aligned(ptr, align); | ||||||
|         adjusted_size = size + (aligned - m_chunk_list.m_ptr); |         adjusted_size = size + static_cast<size_t>(aligned - m_chunk_list.m_ptr); | ||||||
|     } |     } | ||||||
|     m_chunk_list.m_free -= adjusted_size; |     m_chunk_list.m_free -= adjusted_size; | ||||||
|     m_chunk_list.m_ptr  += adjusted_size; |     m_chunk_list.m_ptr  += adjusted_size; | ||||||
|   | |||||||
| @@ -1,5 +1,9 @@ | |||||||
| ADD_SUBDIRECTORY (c) |  | ||||||
| ADD_SUBDIRECTORY (cpp03) | ADD_SUBDIRECTORY (cpp03) | ||||||
| ADD_SUBDIRECTORY (cpp11) | ADD_SUBDIRECTORY (cpp11) | ||||||
| ADD_SUBDIRECTORY (boost) |  | ||||||
| ADD_SUBDIRECTORY (x3) | IF (MSGPACK_USE_BOOST) | ||||||
|  |     ADD_SUBDIRECTORY (boost) | ||||||
|  |     IF (MSGPACK_USE_X3_PARSE) | ||||||
|  |         ADD_SUBDIRECTORY (x3) | ||||||
|  |     ENDIF () | ||||||
|  | ENDIF () | ||||||
|   | |||||||
| @@ -1,21 +1,16 @@ | |||||||
| IF (MSGPACK_BOOST) | FIND_PACKAGE (Boost REQUIRED) | ||||||
|     LIST (APPEND exec_PROGRAMS | FIND_PACKAGE (Threads REQUIRED) | ||||||
|         msgpack_variant_capitalize.cpp | FIND_PACKAGE (ZLIB REQUIRED) | ||||||
|         msgpack_variant_mapbased.cpp |  | ||||||
|     ) | LIST (APPEND exec_PROGRAMS | ||||||
|     IF (MSGPACK_CXX11 OR MSGPACK_CXX17) |     msgpack_variant_capitalize.cpp | ||||||
|         FIND_PACKAGE (Threads REQUIRED) |     msgpack_variant_mapbased.cpp | ||||||
|         LIST (APPEND exec_PROGRAMS | ) | ||||||
|             asio_send_recv.cpp |  | ||||||
|         ) | IF (MSGPACK_CXX11 OR MSGPACK_CXX14 OR MSGPACK_CXX17 OR MSGPACK_CXX20) | ||||||
|         IF (ZLIB_FOUND) |     LIST (APPEND exec_PROGRAMS asio_send_recv.cpp) | ||||||
|             INCLUDE_DIRECTORIES ( |     IF (ZLIB_FOUND) | ||||||
|                 ${ZLIB_INCLUDE_DIRS} |         LIST (APPEND exec_PROGRAMS asio_send_recv_zlib.cpp) | ||||||
|             ) |  | ||||||
|             LIST (APPEND exec_PROGRAMS |  | ||||||
|                 asio_send_recv_zlib.cpp |  | ||||||
|             ) |  | ||||||
|         ENDIF () |  | ||||||
|     ENDIF () |     ENDIF () | ||||||
| ENDIF () | ENDIF () | ||||||
|  |  | ||||||
| @@ -25,24 +20,18 @@ FOREACH (source_file ${exec_PROGRAMS}) | |||||||
|         ${source_file_we} |         ${source_file_we} | ||||||
|         ${source_file} |         ${source_file} | ||||||
|     ) |     ) | ||||||
|     TARGET_INCLUDE_DIRECTORIES (${source_file_we} |     TARGET_LINK_LIBRARIES (${source_file_we} PRIVATE | ||||||
|         PRIVATE |         msgpack-cxx | ||||||
|             $<TARGET_PROPERTY:msgpackc,INTERFACE_INCLUDE_DIRECTORIES> |         Threads::Threads | ||||||
|     ) |  | ||||||
|     TARGET_LINK_LIBRARIES (${source_file_we} |  | ||||||
|         ${Boost_SYSTEM_LIBRARY} |  | ||||||
|         ${CMAKE_THREAD_LIBS_INIT} |  | ||||||
|     ) |     ) | ||||||
|     IF (ZLIB_FOUND) |     IF (ZLIB_FOUND) | ||||||
|         TARGET_LINK_LIBRARIES (${source_file_we} |         TARGET_LINK_LIBRARIES (${source_file_we} PRIVATE ZLIB::ZLIB) | ||||||
|             ${ZLIB_LIBRARIES} |     ENDIF () | ||||||
|         ) |     IF ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") | ||||||
|     ENDIF() |         SET_PROPERTY (TARGET ${source_file_we} APPEND_STRING PROPERTY COMPILE_FLAGS " -Wall -Wextra") | ||||||
|     IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") |  | ||||||
|         SET_PROPERTY (TARGET ${source_file_we} APPEND_STRING PROPERTY COMPILE_FLAGS "-Wall -Wextra -Werror -g -O3") |  | ||||||
|     ENDIF () |     ENDIF () | ||||||
|  |  | ||||||
|     IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") |     IF ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") | ||||||
|         SET_PROPERTY (TARGET ${source_file_we} APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-mismatched-tags") |         SET_PROPERTY (TARGET ${source_file_we} APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-mismatched-tags") | ||||||
|     ENDIF () |     ENDIF () | ||||||
|  |  | ||||||
|   | |||||||
| @@ -38,8 +38,8 @@ int main() { | |||||||
|                     std::cout << __LINE__ << ":" << e.message() << std::endl; |                     std::cout << __LINE__ << ":" << e.message() << std::endl; | ||||||
|                     return; |                     return; | ||||||
|                 } |                 } | ||||||
|                 unp.reserve_buffer(window_size); |  | ||||||
|                 do_async_read_some = [&] { |                 do_async_read_some = [&] { | ||||||
|  |                     unp.reserve_buffer(window_size); | ||||||
|                     ss.async_read_some( |                     ss.async_read_some( | ||||||
|                         boost::asio::buffer(unp.buffer(), window_size), |                         boost::asio::buffer(unp.buffer(), window_size), | ||||||
|                         [&](boost::system::error_code const& e, std::size_t bytes_transferred) { |                         [&](boost::system::error_code const& e, std::size_t bytes_transferred) { | ||||||
| @@ -70,13 +70,22 @@ int main() { | |||||||
|     // Client |     // Client | ||||||
|     auto host = "localhost"; |     auto host = "localhost"; | ||||||
|     boost::asio::ip::tcp::resolver r(ios); |     boost::asio::ip::tcp::resolver r(ios); | ||||||
|  |  | ||||||
|  | #if BOOST_VERSION < 106600 | ||||||
|     boost::asio::ip::tcp::resolver::query q(host, boost::lexical_cast<std::string>(port)); |     boost::asio::ip::tcp::resolver::query q(host, boost::lexical_cast<std::string>(port)); | ||||||
|     auto it = r.resolve(q); |     auto it = r.resolve(q); | ||||||
|  |     boost::asio::ip::tcp::resolver::iterator end; | ||||||
|  | #else  // BOOST_VERSION < 106600 | ||||||
|  |     auto eps = r.resolve(host, boost::lexical_cast<std::string>(port)); | ||||||
|  |     auto it = eps.begin(); | ||||||
|  |     auto end = eps.end(); | ||||||
|  | #endif // BOOST_VERSION < 106600 | ||||||
|  |  | ||||||
|     boost::asio::ip::tcp::socket cs(ios); |     boost::asio::ip::tcp::socket cs(ios); | ||||||
|     boost::asio::async_connect( |     boost::asio::async_connect( | ||||||
|         cs, |         cs, | ||||||
|  |  | ||||||
|         it, |         it, | ||||||
|  |         end, | ||||||
|         [&] |         [&] | ||||||
|         (boost::system::error_code const& e, boost::asio::ip::tcp::resolver::iterator) { |         (boost::system::error_code const& e, boost::asio::ip::tcp::resolver::iterator) { | ||||||
|             if (e) { |             if (e) { | ||||||
|   | |||||||
| @@ -85,12 +85,12 @@ int main() { | |||||||
|                             } |                             } | ||||||
|                             std::cout << bytes_transferred << " bytes read." << std::endl; |                             std::cout << bytes_transferred << " bytes read." << std::endl; | ||||||
|                             print(std::string(std::string(&buf[0], buf.size()))); |                             print(std::string(std::string(&buf[0], buf.size()))); | ||||||
|                             strm.avail_in = bytes_transferred; |                             strm.avail_in = static_cast<uInt>(bytes_transferred); | ||||||
|                             do { |                             do { | ||||||
|                                 strm.next_in = reinterpret_cast<unsigned char*>(&buf[0]) + (bytes_transferred - strm.avail_in); |                                 strm.next_in = reinterpret_cast<unsigned char*>(&buf[0]) + (bytes_transferred - strm.avail_in); | ||||||
|                                 int zret; |                                 int zret; | ||||||
|                                 unp.reserve_buffer(window_size); |                                 unp.reserve_buffer(window_size); | ||||||
|                                 strm.avail_out = window_size; |                                 strm.avail_out = static_cast<uInt>(window_size); | ||||||
|                                 strm.next_out = reinterpret_cast<unsigned char*>(unp.buffer()); |                                 strm.next_out = reinterpret_cast<unsigned char*>(unp.buffer()); | ||||||
|                                 do { |                                 do { | ||||||
|                                     zret = inflate(&strm, Z_NO_FLUSH); |                                     zret = inflate(&strm, Z_NO_FLUSH); | ||||||
| @@ -136,13 +136,24 @@ int main() { | |||||||
|  |  | ||||||
|     // Client |     // Client | ||||||
|     auto host = "localhost"; |     auto host = "localhost"; | ||||||
|  |  | ||||||
|     boost::asio::ip::tcp::resolver r(ios); |     boost::asio::ip::tcp::resolver r(ios); | ||||||
|  |  | ||||||
|  | #if BOOST_VERSION < 106600 | ||||||
|     boost::asio::ip::tcp::resolver::query q(host, boost::lexical_cast<std::string>(port)); |     boost::asio::ip::tcp::resolver::query q(host, boost::lexical_cast<std::string>(port)); | ||||||
|     auto it = r.resolve(q); |     auto it = r.resolve(q); | ||||||
|  |     boost::asio::ip::tcp::resolver::iterator end; | ||||||
|  | #else  // BOOST_VERSION < 106600 | ||||||
|  |     auto eps = r.resolve(host, boost::lexical_cast<std::string>(port)); | ||||||
|  |     auto it = eps.begin(); | ||||||
|  |     auto end = eps.end(); | ||||||
|  | #endif // BOOST_VERSION < 106600 | ||||||
|  |  | ||||||
|     boost::asio::ip::tcp::socket cs(ios); |     boost::asio::ip::tcp::socket cs(ios); | ||||||
|     boost::asio::async_connect( |     boost::asio::async_connect( | ||||||
|         cs, |         cs, | ||||||
|         it, |         it, | ||||||
|  |         end, | ||||||
|         [&] |         [&] | ||||||
|         (boost::system::error_code const& e, boost::asio::ip::tcp::resolver::iterator) { |         (boost::system::error_code const& e, boost::asio::ip::tcp::resolver::iterator) { | ||||||
|             if (e) { |             if (e) { | ||||||
|   | |||||||
| @@ -83,7 +83,8 @@ int main() { | |||||||
|     u.address = "Tokyo"; |     u.address = "Tokyo"; | ||||||
|     msgpack::pack(ss, u); |     msgpack::pack(ss, u); | ||||||
|  |  | ||||||
|     msgpack::object_handle oh = msgpack::unpack(ss.str().data(), ss.str().size()); |     std::string const& str = ss.str(); | ||||||
|  |     msgpack::object_handle oh = msgpack::unpack(str.data(), str.size()); | ||||||
|     msgpack::object const& obj = oh.get(); |     msgpack::object const& obj = oh.get(); | ||||||
|     std::cout << "Unpacked msgpack object." << std::endl; |     std::cout << "Unpacked msgpack object." << std::endl; | ||||||
|     std::cout << obj << std::endl; |     std::cout << obj << std::endl; | ||||||
|   | |||||||
| @@ -1,40 +0,0 @@ | |||||||
| IF (MSGPACK_ENABLE_SHARED) |  | ||||||
|     SET (MSGPACK_LIB msgpackc) |  | ||||||
| ELSE () |  | ||||||
|     SET (MSGPACK_LIB msgpackc-static) |  | ||||||
| ENDIF () |  | ||||||
|  |  | ||||||
|  |  | ||||||
| LIST (APPEND exec_PROGRAMS |  | ||||||
|     lib_buffer_unpack.c |  | ||||||
|     simple_c.c |  | ||||||
|     speed_test_uint32_array.c |  | ||||||
|     speed_test_uint64_array.c |  | ||||||
|     user_buffer_unpack.c |  | ||||||
| ) |  | ||||||
|  |  | ||||||
| FOREACH (source_file ${exec_PROGRAMS}) |  | ||||||
|     GET_FILENAME_COMPONENT (source_file_we ${source_file} NAME_WE) |  | ||||||
|     ADD_EXECUTABLE ( |  | ||||||
|         ${source_file_we} |  | ||||||
|         ${source_file} |  | ||||||
|     ) |  | ||||||
|     TARGET_LINK_LIBRARIES (${source_file_we} |  | ||||||
|         ${MSGPACK_LIB} |  | ||||||
|     ) |  | ||||||
|     IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") |  | ||||||
|         SET_PROPERTY (TARGET ${source_file_we} APPEND_STRING PROPERTY COMPILE_FLAGS "-Wall -Wextra -Werror -g -O3") |  | ||||||
|     ENDIF () |  | ||||||
|  |  | ||||||
|     IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") |  | ||||||
|         SET_PROPERTY (TARGET ${source_file_we} APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-mismatched-tags") |  | ||||||
|     ENDIF () |  | ||||||
|  |  | ||||||
|     IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") |  | ||||||
|         IF (CMAKE_CXX_FLAGS MATCHES "/W[0-4]") |  | ||||||
|             STRING(REGEX REPLACE "/W[0-4]" "/W3 /WX" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") |  | ||||||
|         ELSE () |  | ||||||
|             SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3 /WX") |  | ||||||
|         ENDIF () |  | ||||||
|     ENDIF () |  | ||||||
| ENDFOREACH () |  | ||||||
| @@ -1,127 +0,0 @@ | |||||||
| #include <msgpack.h> |  | ||||||
| #include <stdio.h> |  | ||||||
| #include <assert.h> |  | ||||||
|  |  | ||||||
|  |  | ||||||
| typedef struct receiver { |  | ||||||
|     msgpack_sbuffer sbuf; |  | ||||||
|     size_t rest; |  | ||||||
| } receiver; |  | ||||||
|  |  | ||||||
| void receiver_init(receiver *r) { |  | ||||||
|     msgpack_packer pk; |  | ||||||
|  |  | ||||||
|     msgpack_sbuffer_init(&r->sbuf); |  | ||||||
|     msgpack_packer_init(&pk, &r->sbuf, msgpack_sbuffer_write); |  | ||||||
|     /* 1st object */ |  | ||||||
|     msgpack_pack_array(&pk, 3); |  | ||||||
|     msgpack_pack_int(&pk, 1); |  | ||||||
|     msgpack_pack_true(&pk); |  | ||||||
|     msgpack_pack_str(&pk, 7); |  | ||||||
|     msgpack_pack_str_body(&pk, "example", 7); |  | ||||||
|     /* 2nd object */ |  | ||||||
|     msgpack_pack_str(&pk, 6); |  | ||||||
|     msgpack_pack_str_body(&pk, "second", 6); |  | ||||||
|     /* 3rd object */ |  | ||||||
|     msgpack_pack_array(&pk, 2); |  | ||||||
|     msgpack_pack_int(&pk, 42); |  | ||||||
|     msgpack_pack_false(&pk); |  | ||||||
|     r->rest = r->sbuf.size; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| size_t receiver_recv(receiver *r, char* buf, size_t try_size) { |  | ||||||
|     size_t off = r->sbuf.size - r->rest; |  | ||||||
|  |  | ||||||
|     size_t actual_size = try_size; |  | ||||||
|     if (actual_size > r->rest) actual_size = r->rest; |  | ||||||
|  |  | ||||||
|     memcpy(buf, r->sbuf.data + off, actual_size); |  | ||||||
|     r->rest -= actual_size; |  | ||||||
|  |  | ||||||
|     return actual_size; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| size_t receiver_to_unpacker(receiver* r, size_t request_size, |  | ||||||
|         msgpack_unpacker *unpacker) |  | ||||||
| { |  | ||||||
|     size_t recv_len; |  | ||||||
|     // make sure there's enough room, or expand the unpacker accordingly |  | ||||||
|     if (msgpack_unpacker_buffer_capacity(unpacker) < request_size) { |  | ||||||
|         msgpack_unpacker_reserve_buffer(unpacker, request_size); |  | ||||||
|         assert(msgpack_unpacker_buffer_capacity(unpacker) >= request_size); |  | ||||||
|     } |  | ||||||
|     recv_len = receiver_recv(r, msgpack_unpacker_buffer(unpacker), |  | ||||||
|                              request_size); |  | ||||||
|     msgpack_unpacker_buffer_consumed(unpacker, recv_len); |  | ||||||
|     return recv_len; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| #define EACH_RECV_SIZE 4 |  | ||||||
|  |  | ||||||
| void unpack(receiver* r) { |  | ||||||
|     /* buf is allocated by unpacker. */ |  | ||||||
|     msgpack_unpacker* unp = msgpack_unpacker_new(100); |  | ||||||
|     msgpack_unpacked result; |  | ||||||
|     msgpack_unpack_return ret; |  | ||||||
|     size_t recv_len; |  | ||||||
|     int recv_count = 0; |  | ||||||
|     int i = 0; |  | ||||||
|  |  | ||||||
|     msgpack_unpacked_init(&result); |  | ||||||
|     while (true) { |  | ||||||
|         recv_len = receiver_to_unpacker(r, EACH_RECV_SIZE, unp); |  | ||||||
|         if (recv_len == 0) break; // (reached end of input) |  | ||||||
| #if defined(_MSC_VER) || defined(__MINGW32__) |  | ||||||
|         printf("receive count: %d %Id bytes received.\n", recv_count++, recv_len); |  | ||||||
| #else // defined(_MSC_VER) || defined(__MINGW32__) |  | ||||||
|         printf("receive count: %d %zd bytes received.\n", recv_count++, recv_len); |  | ||||||
| #endif // defined(_MSC_VER) || defined(__MINGW32__) |  | ||||||
|         ret = msgpack_unpacker_next(unp, &result); |  | ||||||
|         while (ret == MSGPACK_UNPACK_SUCCESS) { |  | ||||||
|             msgpack_object obj = result.data; |  | ||||||
|  |  | ||||||
|             /* Use obj. */ |  | ||||||
|             printf("Object no %d:\n", ++i); |  | ||||||
|             msgpack_object_print(stdout, obj); |  | ||||||
|             printf("\n"); |  | ||||||
|             /* If you want to allocate something on the zone, you can use zone. */ |  | ||||||
|             /* msgpack_zone* zone = result.zone; */ |  | ||||||
|             /* The lifetime of the obj and the zone,  */ |  | ||||||
|  |  | ||||||
|             ret = msgpack_unpacker_next(unp, &result); |  | ||||||
|         } |  | ||||||
|         if (ret == MSGPACK_UNPACK_PARSE_ERROR) { |  | ||||||
|             printf("The data in the buf is invalid format.\n"); |  | ||||||
|             msgpack_unpacked_destroy(&result); |  | ||||||
|             return; |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
|     msgpack_unpacked_destroy(&result); |  | ||||||
|     msgpack_unpacker_free(unp); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| int main(void) { |  | ||||||
|     receiver r; |  | ||||||
|     receiver_init(&r); |  | ||||||
|  |  | ||||||
|     unpack(&r); |  | ||||||
|  |  | ||||||
|     return 0; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* Output */ |  | ||||||
|  |  | ||||||
| /* |  | ||||||
| receive count: 0 4 bytes received. |  | ||||||
| receive count: 1 4 bytes received. |  | ||||||
| receive count: 2 4 bytes received. |  | ||||||
| Object no 1: |  | ||||||
| [1, true, "example"] |  | ||||||
| receive count: 3 4 bytes received. |  | ||||||
| receive count: 4 4 bytes received. |  | ||||||
| Object no 2: |  | ||||||
| "second" |  | ||||||
| receive count: 5 1 bytes received. |  | ||||||
| Object no 3: |  | ||||||
| [42, false] |  | ||||||
| */ |  | ||||||
| @@ -1,47 +0,0 @@ | |||||||
| #include <msgpack.h> |  | ||||||
| #include <stdio.h> |  | ||||||
|  |  | ||||||
| void print(char const* buf, unsigned int len) |  | ||||||
| { |  | ||||||
|     size_t i = 0; |  | ||||||
|     for(; i < len ; ++i) |  | ||||||
|         printf("%02x ", 0xff & buf[i]); |  | ||||||
|     printf("\n"); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| int main(void) |  | ||||||
| { |  | ||||||
|     msgpack_sbuffer sbuf; |  | ||||||
|     msgpack_packer pk; |  | ||||||
|     msgpack_zone mempool; |  | ||||||
|     msgpack_object deserialized; |  | ||||||
|  |  | ||||||
|     /* msgpack::sbuffer is a simple buffer implementation. */ |  | ||||||
|     msgpack_sbuffer_init(&sbuf); |  | ||||||
|  |  | ||||||
|     /* serialize values into the buffer using msgpack_sbuffer_write callback function. */ |  | ||||||
|     msgpack_packer_init(&pk, &sbuf, msgpack_sbuffer_write); |  | ||||||
|  |  | ||||||
|     msgpack_pack_array(&pk, 3); |  | ||||||
|     msgpack_pack_int(&pk, 1); |  | ||||||
|     msgpack_pack_true(&pk); |  | ||||||
|     msgpack_pack_str(&pk, 7); |  | ||||||
|     msgpack_pack_str_body(&pk, "example", 7); |  | ||||||
|  |  | ||||||
|     print(sbuf.data, sbuf.size); |  | ||||||
|  |  | ||||||
|     /* deserialize the buffer into msgpack_object instance. */ |  | ||||||
|     /* deserialized object is valid during the msgpack_zone instance alive. */ |  | ||||||
|     msgpack_zone_init(&mempool, 2048); |  | ||||||
|  |  | ||||||
|     msgpack_unpack(sbuf.data, sbuf.size, NULL, &mempool, &deserialized); |  | ||||||
|  |  | ||||||
|     /* print the deserialized object. */ |  | ||||||
|     msgpack_object_print(stdout, deserialized); |  | ||||||
|     puts(""); |  | ||||||
|  |  | ||||||
|     msgpack_zone_destroy(&mempool); |  | ||||||
|     msgpack_sbuffer_destroy(&sbuf); |  | ||||||
|  |  | ||||||
|     return 0; |  | ||||||
| } |  | ||||||
| @@ -1,36 +0,0 @@ | |||||||
| #include <msgpack.h> |  | ||||||
|  |  | ||||||
| void test() |  | ||||||
| { |  | ||||||
|     size_t size = 10000000; |  | ||||||
|     msgpack_sbuffer buf; |  | ||||||
|     msgpack_packer * pk; |  | ||||||
|     size_t upk_pos = 0; |  | ||||||
|     msgpack_unpacked msg; |  | ||||||
|  |  | ||||||
|     msgpack_sbuffer_init(&buf); |  | ||||||
|  |  | ||||||
|     pk = msgpack_packer_new(&buf, msgpack_sbuffer_write); |  | ||||||
|  |  | ||||||
|     msgpack_pack_array(pk, size); |  | ||||||
|     { |  | ||||||
|         size_t idx = 0; |  | ||||||
|         for (; idx < size; ++idx) |  | ||||||
|             msgpack_pack_uint32(pk, 1); |  | ||||||
|     } |  | ||||||
|     msgpack_packer_free(pk); |  | ||||||
|  |  | ||||||
|     msgpack_unpacked_init(&msg); |  | ||||||
|  |  | ||||||
|     while (msgpack_unpack_next(&msg, buf.data, buf.size, &upk_pos) == MSGPACK_UNPACK_SUCCESS) { |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     msgpack_sbuffer_destroy(&buf); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| int main(void) |  | ||||||
| { |  | ||||||
|     int i = 0; |  | ||||||
|     for (; i < 10; ++i) test(); |  | ||||||
|     return 0; |  | ||||||
| } |  | ||||||
| @@ -1,37 +0,0 @@ | |||||||
| #include <msgpack.h> |  | ||||||
|  |  | ||||||
| void test() |  | ||||||
| { |  | ||||||
|     uint64_t test_u64 = 0xFFF0000000000001LL; |  | ||||||
|     size_t size = 10000000; |  | ||||||
|     msgpack_sbuffer buf; |  | ||||||
|     msgpack_packer * pk; |  | ||||||
|     size_t upk_pos = 0; |  | ||||||
|     msgpack_unpacked msg; |  | ||||||
|  |  | ||||||
|     msgpack_sbuffer_init(&buf); |  | ||||||
|  |  | ||||||
|     pk = msgpack_packer_new(&buf, msgpack_sbuffer_write); |  | ||||||
|  |  | ||||||
|     msgpack_pack_array(pk, size); |  | ||||||
|     { |  | ||||||
|         size_t idx = 0; |  | ||||||
|         for (; idx < size; ++idx) |  | ||||||
|             msgpack_pack_uint64(pk, test_u64); |  | ||||||
|     } |  | ||||||
|     msgpack_packer_free(pk); |  | ||||||
|  |  | ||||||
|     msgpack_unpacked_init(&msg); |  | ||||||
|  |  | ||||||
|     while (msgpack_unpack_next(&msg, buf.data, buf.size, &upk_pos) == MSGPACK_UNPACK_SUCCESS) { |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     msgpack_sbuffer_destroy(&buf); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| int main(void) |  | ||||||
| { |  | ||||||
|     int i = 0; |  | ||||||
|     for (; i < 10; ++i) test(); |  | ||||||
|     return 0; |  | ||||||
| } |  | ||||||
| @@ -1,81 +0,0 @@ | |||||||
| #include <msgpack.h> |  | ||||||
| #include <stdio.h> |  | ||||||
| #include <assert.h> |  | ||||||
|  |  | ||||||
| #define UNPACKED_BUFFER_SIZE 2048 |  | ||||||
|  |  | ||||||
| void prepare(msgpack_sbuffer* sbuf) { |  | ||||||
|     msgpack_packer pk; |  | ||||||
|  |  | ||||||
|     msgpack_packer_init(&pk, sbuf, msgpack_sbuffer_write); |  | ||||||
|     /* 1st object */ |  | ||||||
|     msgpack_pack_array(&pk, 3); |  | ||||||
|     msgpack_pack_int(&pk, 1); |  | ||||||
|     msgpack_pack_true(&pk); |  | ||||||
|     msgpack_pack_str(&pk, 7); |  | ||||||
|     msgpack_pack_str_body(&pk, "example", 7); |  | ||||||
|     /* 2nd object */ |  | ||||||
|     msgpack_pack_str(&pk, 6); |  | ||||||
|     msgpack_pack_str_body(&pk, "second", 6); |  | ||||||
|     /* 3rd object */ |  | ||||||
|     msgpack_pack_array(&pk, 2); |  | ||||||
|     msgpack_pack_int(&pk, 42); |  | ||||||
|     msgpack_pack_false(&pk); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| void unpack(char const* buf, size_t len) { |  | ||||||
|     /* buf is allocated by client. */ |  | ||||||
|     msgpack_unpacked result; |  | ||||||
|     size_t off = 0; |  | ||||||
|     msgpack_unpack_return ret; |  | ||||||
|     int i = 0; |  | ||||||
|     char unpacked_buffer[UNPACKED_BUFFER_SIZE]; |  | ||||||
|     msgpack_unpacked_init(&result); |  | ||||||
|     ret = msgpack_unpack_next(&result, buf, len, &off); |  | ||||||
|     while (ret == MSGPACK_UNPACK_SUCCESS) { |  | ||||||
|         msgpack_object obj = result.data; |  | ||||||
|  |  | ||||||
|         /* Use obj. */ |  | ||||||
|         printf("Object no %d:\n", ++i); |  | ||||||
|         msgpack_object_print(stdout, obj); |  | ||||||
|         printf("\n"); |  | ||||||
|         msgpack_object_print_buffer(unpacked_buffer, UNPACKED_BUFFER_SIZE, obj); |  | ||||||
|         printf("%s\n", unpacked_buffer); |  | ||||||
|         /* If you want to allocate something on the zone, you can use zone. */ |  | ||||||
|         /* msgpack_zone* zone = result.zone; */ |  | ||||||
|         /* The lifetime of the obj and the zone,  */ |  | ||||||
|  |  | ||||||
|         ret = msgpack_unpack_next(&result, buf, len, &off); |  | ||||||
|     } |  | ||||||
|     msgpack_unpacked_destroy(&result); |  | ||||||
|  |  | ||||||
|     if (ret == MSGPACK_UNPACK_CONTINUE) { |  | ||||||
|         printf("All msgpack_object in the buffer is consumed.\n"); |  | ||||||
|     } |  | ||||||
|     else if (ret == MSGPACK_UNPACK_PARSE_ERROR) { |  | ||||||
|         printf("The data in the buf is invalid format.\n"); |  | ||||||
|     } |  | ||||||
| } |  | ||||||
|  |  | ||||||
| int main(void) { |  | ||||||
|     msgpack_sbuffer sbuf; |  | ||||||
|     msgpack_sbuffer_init(&sbuf); |  | ||||||
|  |  | ||||||
|     prepare(&sbuf); |  | ||||||
|     unpack(sbuf.data, sbuf.size); |  | ||||||
|  |  | ||||||
|     msgpack_sbuffer_destroy(&sbuf); |  | ||||||
|     return 0; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* Output */ |  | ||||||
|  |  | ||||||
| /* |  | ||||||
| Object no 1: |  | ||||||
| [1, true, "example"] |  | ||||||
| Object no 2: |  | ||||||
| "second" |  | ||||||
| Object no 3: |  | ||||||
| [42, false] |  | ||||||
| All msgpack_object in the buffer is consumed. |  | ||||||
| */ |  | ||||||
| @@ -1,3 +1,7 @@ | |||||||
|  | FIND_PACKAGE (Threads REQUIRED) | ||||||
|  |  | ||||||
|  | FIND_PACKAGE (Boost COMPONENTS timer) | ||||||
|  |  | ||||||
| LIST (APPEND exec_PROGRAMS | LIST (APPEND exec_PROGRAMS | ||||||
|     class_intrusive.cpp |     class_intrusive.cpp | ||||||
|     class_intrusive_map.cpp |     class_intrusive_map.cpp | ||||||
| @@ -22,11 +26,14 @@ IF (NOT MSVC) | |||||||
|     ) |     ) | ||||||
| ENDIF () | ENDIF () | ||||||
|  |  | ||||||
| IF (MSGPACK_BOOST) |  | ||||||
|     LIST (APPEND with_boost_lib_PROGRAMS | IF (MSGPACK_USE_BOOST) | ||||||
|         speed_test.cpp |     IF (Boost_TIMER_LIBRARY) | ||||||
|         speed_test_nested_array.cpp |         LIST (APPEND with_boost_lib_PROGRAMS | ||||||
|     ) |             speed_test.cpp | ||||||
|  |             speed_test_nested_array.cpp | ||||||
|  |         ) | ||||||
|  |     ENDIF () | ||||||
| ENDIF () | ENDIF () | ||||||
|  |  | ||||||
| FOREACH (source_file ${exec_PROGRAMS}) | FOREACH (source_file ${exec_PROGRAMS}) | ||||||
| @@ -35,12 +42,11 @@ FOREACH (source_file ${exec_PROGRAMS}) | |||||||
|         ${source_file_we} |         ${source_file_we} | ||||||
|         ${source_file} |         ${source_file} | ||||||
|     ) |     ) | ||||||
|     TARGET_INCLUDE_DIRECTORIES (${source_file_we} |     TARGET_LINK_LIBRARIES (${source_file_we} PRIVATE | ||||||
|         PRIVATE |         msgpack-cxx | ||||||
|             $<TARGET_PROPERTY:msgpackc,INTERFACE_INCLUDE_DIRECTORIES> |  | ||||||
|     ) |     ) | ||||||
|     IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") |     IF ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") | ||||||
|         SET_PROPERTY (TARGET ${source_file_we} APPEND_STRING PROPERTY COMPILE_FLAGS "-Wall -Wextra -Werror -g -O3") |         SET_PROPERTY (TARGET ${source_file_we} APPEND_STRING PROPERTY COMPILE_FLAGS " -Wall -Wextra") | ||||||
|     ENDIF () |     ENDIF () | ||||||
|     IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") |     IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") | ||||||
|         IF (CMAKE_CXX_FLAGS MATCHES "/W[0-4]") |         IF (CMAKE_CXX_FLAGS MATCHES "/W[0-4]") | ||||||
| @@ -57,15 +63,12 @@ FOREACH (source_file ${with_pthread_PROGRAMS}) | |||||||
|         ${source_file_we} |         ${source_file_we} | ||||||
|         ${source_file} |         ${source_file} | ||||||
|     ) |     ) | ||||||
|     TARGET_INCLUDE_DIRECTORIES (${source_file_we} |     TARGET_LINK_LIBRARIES (${source_file_we} PRIVATE | ||||||
|         PRIVATE |         msgpack-cxx | ||||||
|             $<TARGET_PROPERTY:msgpackc,INTERFACE_INCLUDE_DIRECTORIES> |         Threads::Threads | ||||||
|     ) |     ) | ||||||
|     TARGET_LINK_LIBRARIES (${source_file_we} |     IF ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") | ||||||
|         ${CMAKE_THREAD_LIBS_INIT} |         SET_PROPERTY (TARGET ${source_file_we} APPEND_STRING PROPERTY COMPILE_FLAGS " -Wall -Wextra") | ||||||
|     ) |  | ||||||
|     IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") |  | ||||||
|         SET_PROPERTY (TARGET ${source_file_we} APPEND_STRING PROPERTY COMPILE_FLAGS "-Wall -Wextra -Werror -g -O3") |  | ||||||
|     ENDIF () |     ENDIF () | ||||||
|     IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") |     IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") | ||||||
|         IF (CMAKE_CXX_FLAGS MATCHES "/W[0-4]") |         IF (CMAKE_CXX_FLAGS MATCHES "/W[0-4]") | ||||||
| @@ -77,36 +80,26 @@ FOREACH (source_file ${with_pthread_PROGRAMS}) | |||||||
| ENDFOREACH () | ENDFOREACH () | ||||||
|  |  | ||||||
| FOREACH (source_file ${with_boost_lib_PROGRAMS}) | FOREACH (source_file ${with_boost_lib_PROGRAMS}) | ||||||
|     INCLUDE_DIRECTORIES ( |  | ||||||
|         ../include |  | ||||||
|         ${Boost_INCLUDE_DIRS} |  | ||||||
|     ) |  | ||||||
|     GET_FILENAME_COMPONENT (source_file_we ${source_file} NAME_WE) |     GET_FILENAME_COMPONENT (source_file_we ${source_file} NAME_WE) | ||||||
|     ADD_EXECUTABLE ( |     ADD_EXECUTABLE ( | ||||||
|         ${source_file_we} |         ${source_file_we} | ||||||
|         ${source_file} |         ${source_file} | ||||||
|     ) |     ) | ||||||
|     TARGET_INCLUDE_DIRECTORIES (${source_file_we} |     TARGET_LINK_LIBRARIES (${source_file_we} PRIVATE | ||||||
|         PRIVATE |         msgpack-cxx | ||||||
|             $<TARGET_PROPERTY:msgpackc,INTERFACE_INCLUDE_DIRECTORIES> |         Boost::timer | ||||||
|     ) |  | ||||||
|     LINK_DIRECTORIES(${Boost_LIBRARY_DIRS}) |  | ||||||
|     TARGET_LINK_LIBRARIES (${source_file_we} |  | ||||||
|         ${Boost_TIMER_LIBRARY} |  | ||||||
|         ${Boost_CHRONO_LIBRARY} |  | ||||||
|         ${Boost_SYSTEM_LIBRARY} |  | ||||||
|     ) |     ) | ||||||
|     IF (NOT MSVC AND NOT APPLE) |     IF (NOT MSVC AND NOT APPLE) | ||||||
|         TARGET_LINK_LIBRARIES (${source_file_we} |         TARGET_LINK_LIBRARIES (${source_file_we} PRIVATE | ||||||
|             rt |             rt | ||||||
|         ) |         ) | ||||||
|     ENDIF () |     ENDIF () | ||||||
|  |  | ||||||
|     IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") |     IF ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") | ||||||
|         SET_PROPERTY (TARGET ${source_file_we} APPEND_STRING PROPERTY COMPILE_FLAGS "-Wall -Wextra -Werror -O3") |         SET_PROPERTY (TARGET ${source_file_we} APPEND_STRING PROPERTY COMPILE_FLAGS "-Wall -Wextra -Werror -O3") | ||||||
|     ENDIF () |     ENDIF () | ||||||
|  |  | ||||||
|     IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") |     IF ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") | ||||||
|         SET_PROPERTY (TARGET ${source_file_we} APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-mismatched-tags") |         SET_PROPERTY (TARGET ${source_file_we} APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-mismatched-tags") | ||||||
|     ENDIF () |     ENDIF () | ||||||
|  |  | ||||||
|   | |||||||
| @@ -82,10 +82,11 @@ int main() { | |||||||
|         std::stringstream ss; |         std::stringstream ss; | ||||||
|         msgpack::pack(ss, my); |         msgpack::pack(ss, my); | ||||||
|  |  | ||||||
|         print(ss.str()); |         std::string const& str = ss.str(); | ||||||
|  |         print(str); | ||||||
|  |  | ||||||
|         msgpack::object_handle oh = |         msgpack::object_handle oh = | ||||||
|             msgpack::unpack(ss.str().data(), ss.str().size()); |             msgpack::unpack(str.data(), str.size()); | ||||||
|         msgpack::object obj = oh.get(); |         msgpack::object obj = oh.get(); | ||||||
|         std::cout << obj << std::endl; |         std::cout << obj << std::endl; | ||||||
|         assert(obj.as<my_class>() == my); |         assert(obj.as<my_class>() == my); | ||||||
|   | |||||||
| @@ -59,8 +59,9 @@ int main() { | |||||||
|  |  | ||||||
|         print(ss.str()); |         print(ss.str()); | ||||||
|  |  | ||||||
|  |         std::string const& str = ss.str(); | ||||||
|         msgpack::object_handle oh = |         msgpack::object_handle oh = | ||||||
|             msgpack::unpack(ss.str().data(), ss.str().size()); |             msgpack::unpack(str.data(), str.size()); | ||||||
|         msgpack::object obj = oh.get(); |         msgpack::object obj = oh.get(); | ||||||
|         std::cout << obj << std::endl; |         std::cout << obj << std::endl; | ||||||
|         assert(obj.as<my_class>() == my); |         assert(obj.as<my_class>() == my); | ||||||
|   | |||||||
| @@ -100,10 +100,11 @@ int main() { | |||||||
|         std::stringstream ss; |         std::stringstream ss; | ||||||
|         msgpack::pack(ss, my); |         msgpack::pack(ss, my); | ||||||
|  |  | ||||||
|         print(ss.str()); |         std::string const& str = ss.str(); | ||||||
|  |         print(str); | ||||||
|  |  | ||||||
|         msgpack::object_handle oh = |         msgpack::object_handle oh = | ||||||
|             msgpack::unpack(ss.str().data(), ss.str().size()); |             msgpack::unpack(str.data(), str.size()); | ||||||
|         msgpack::object obj = oh.get(); |         msgpack::object obj = oh.get(); | ||||||
|         std::cout << obj << std::endl; |         std::cout << obj << std::endl; | ||||||
|         assert(obj.as<my_class>() == my); |         assert(obj.as<my_class>() == my); | ||||||
|   | |||||||
| @@ -71,7 +71,8 @@ int main() { | |||||||
|  |  | ||||||
|         print(ss.str()); |         print(ss.str()); | ||||||
|  |  | ||||||
|         msgpack::object_handle oh = msgpack::unpack(ss.str().data(), ss.str().size()); |         std::string const& str = ss.str(); | ||||||
|  |         msgpack::object_handle oh = msgpack::unpack(str.data(), str.size()); | ||||||
|  |  | ||||||
|         msgpack::object obj = oh.get(); |         msgpack::object obj = oh.get(); | ||||||
|         std::cout << obj << std::endl; |         std::cout << obj << std::endl; | ||||||
|   | |||||||
| @@ -31,12 +31,13 @@ int main() { | |||||||
|     std::size_t offset = 0; |     std::size_t offset = 0; | ||||||
|  |  | ||||||
|     // msgpack array is constructed on z. |     // msgpack array is constructed on z. | ||||||
|     msgpack::object obj = msgpack::unpack(z, ss.str().data(), ss.str().size(), offset); |     std::string const& ps = ss.str(); | ||||||
|  |     msgpack::object obj = msgpack::unpack(z, ps.data(), ps.size(), offset); | ||||||
|     std::cout << obj << std::endl; |     std::cout << obj << std::endl; | ||||||
|     assert(obj.as<std::vector<int> >() == v); |     assert(obj.as<std::vector<int> >() == v); | ||||||
|  |  | ||||||
|     // msgpack str is constructed on z. |     // msgpack str is constructed on z. | ||||||
|     std::string const& str = msgpack::unpack(z, ss.str().data(), ss.str().size(), offset).as<std::string>(); |     std::string const& str = msgpack::unpack(z, ps.data(), ps.size(), offset).as<std::string>(); | ||||||
|     std::cout << str << std::endl; |     std::cout << str << std::endl; | ||||||
|     assert(str == s); |     assert(str == s); | ||||||
| } | } | ||||||
|   | |||||||
| @@ -1,8 +1,4 @@ | |||||||
| IF (MSGPACK_CXX11) | IF (MSGPACK_CXX11 OR MSGPACK_CXX14 OR MSGPACK_CXX17) | ||||||
|     INCLUDE_DIRECTORIES ( |  | ||||||
|         ../include |  | ||||||
|     ) |  | ||||||
|  |  | ||||||
|     LIST (APPEND exec_PROGRAMS |     LIST (APPEND exec_PROGRAMS | ||||||
|         container.cpp |         container.cpp | ||||||
|         non_def_con_class.cpp |         non_def_con_class.cpp | ||||||
| @@ -20,15 +16,14 @@ IF (MSGPACK_CXX11) | |||||||
|             ${source_file_we} |             ${source_file_we} | ||||||
|             ${source_file} |             ${source_file} | ||||||
|         ) |         ) | ||||||
|         TARGET_INCLUDE_DIRECTORIES (${source_file_we} |         TARGET_LINK_LIBRARIES (${source_file_we} PRIVATE | ||||||
|             PRIVATE |             msgpack-cxx | ||||||
|                 $<TARGET_PROPERTY:msgpackc,INTERFACE_INCLUDE_DIRECTORIES> |  | ||||||
|         ) |         ) | ||||||
|         IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") |         IF ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") | ||||||
|             SET_PROPERTY (TARGET ${source_file_we} APPEND_STRING PROPERTY COMPILE_FLAGS "-Wall -Wextra -Werror -g -O3 ") |             SET_PROPERTY (TARGET ${source_file_we} APPEND_STRING PROPERTY COMPILE_FLAGS " -Wall -Wextra") | ||||||
|         ENDIF () |         ENDIF () | ||||||
|  |  | ||||||
|         IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") |         IF ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") | ||||||
|             SET_PROPERTY (TARGET ${source_file_we} APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-mismatched-tags") |             SET_PROPERTY (TARGET ${source_file_we} APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-mismatched-tags") | ||||||
|         ENDIF () |         ENDIF () | ||||||
|  |  | ||||||
|   | |||||||
| @@ -25,8 +25,9 @@ void array() { | |||||||
|     std::stringstream ss; |     std::stringstream ss; | ||||||
|     msgpack::pack(ss, a); |     msgpack::pack(ss, a); | ||||||
|  |  | ||||||
|     msgpack::object_handle oh = msgpack::unpack(ss.str().data(), ss.str().size()); |     auto const& str = ss.str(); | ||||||
|     msgpack::object obj = oh.get(); |     auto oh = msgpack::unpack(str.data(), str.size()); | ||||||
|  |     auto obj = oh.get(); | ||||||
|  |  | ||||||
|     std::cout << obj << std::endl; |     std::cout << obj << std::endl; | ||||||
|     assert((obj.as<std::array<int, 5>>()) == a); |     assert((obj.as<std::array<int, 5>>()) == a); | ||||||
| @@ -37,7 +38,8 @@ void tuple() { | |||||||
|     std::stringstream ss; |     std::stringstream ss; | ||||||
|     msgpack::pack(ss, t); |     msgpack::pack(ss, t); | ||||||
|  |  | ||||||
|     auto oh = msgpack::unpack(ss.str().data(), ss.str().size()); |     auto const& str = ss.str(); | ||||||
|  |     auto oh = msgpack::unpack(str.data(), str.size()); | ||||||
|     auto obj = oh.get(); |     auto obj = oh.get(); | ||||||
|  |  | ||||||
|     std::cout << obj << std::endl; |     std::cout << obj << std::endl; | ||||||
| @@ -49,7 +51,8 @@ void unordered_map() { | |||||||
|     std::stringstream ss; |     std::stringstream ss; | ||||||
|     msgpack::pack(ss, m); |     msgpack::pack(ss, m); | ||||||
|  |  | ||||||
|     auto oh = msgpack::unpack(ss.str().data(), ss.str().size()); |     auto const& str = ss.str(); | ||||||
|  |     auto oh = msgpack::unpack(str.data(), str.size()); | ||||||
|     msgpack::object obj = oh.get(); |     msgpack::object obj = oh.get(); | ||||||
|  |  | ||||||
|     std::cout << obj << std::endl; |     std::cout << obj << std::endl; | ||||||
| @@ -61,7 +64,8 @@ void unordered_set() { | |||||||
|     std::stringstream ss; |     std::stringstream ss; | ||||||
|     msgpack::pack(ss, s); |     msgpack::pack(ss, s); | ||||||
|  |  | ||||||
|     auto oh = msgpack::unpack(ss.str().data(), ss.str().size()); |     auto const& str = ss.str(); | ||||||
|  |     auto oh = msgpack::unpack(str.data(), str.size()); | ||||||
|     auto obj = oh.get(); |     auto obj = oh.get(); | ||||||
|  |  | ||||||
|     std::cout << obj << std::endl; |     std::cout << obj << std::endl; | ||||||
| @@ -74,7 +78,8 @@ void forward_list() { | |||||||
|     std::stringstream ss; |     std::stringstream ss; | ||||||
|     msgpack::pack(ss, f); |     msgpack::pack(ss, f); | ||||||
|  |  | ||||||
|     auto oh = msgpack::unpack(ss.str().data(), ss.str().size()); |     auto const& str = ss.str(); | ||||||
|  |     auto oh = msgpack::unpack(str.data(), str.size()); | ||||||
|     auto obj = oh.get(); |     auto obj = oh.get(); | ||||||
|  |  | ||||||
|     std::cout << obj << std::endl; |     std::cout << obj << std::endl; | ||||||
| @@ -98,7 +103,8 @@ void combi() { | |||||||
|     std::size_t offset = 0; |     std::size_t offset = 0; | ||||||
|     std::cout << "offset: " << offset << std::endl; |     std::cout << "offset: " << offset << std::endl; | ||||||
|     { |     { | ||||||
|         auto oh = msgpack::unpack(ss.str().data(), ss.str().size(), offset); |         auto const& str = ss.str(); | ||||||
|  |         auto oh = msgpack::unpack(str.data(), str.size(), offset); | ||||||
|         auto obj = oh.get(); |         auto obj = oh.get(); | ||||||
|  |  | ||||||
|         std::cout << obj << std::endl; |         std::cout << obj << std::endl; | ||||||
| @@ -106,7 +112,8 @@ void combi() { | |||||||
|     } |     } | ||||||
|     std::cout << "offset: " << offset << std::endl; |     std::cout << "offset: " << offset << std::endl; | ||||||
|     { |     { | ||||||
|         auto oh = msgpack::unpack(ss.str().data(), ss.str().size(), offset); |         auto const& str = ss.str(); | ||||||
|  |         auto oh = msgpack::unpack(str.data(), str.size(), offset); | ||||||
|         auto obj = oh.get(); |         auto obj = oh.get(); | ||||||
|  |  | ||||||
|         std::cout << obj << std::endl; |         std::cout << obj << std::endl; | ||||||
| @@ -114,7 +121,8 @@ void combi() { | |||||||
|     } |     } | ||||||
|     std::cout << "offset: " << offset << std::endl; |     std::cout << "offset: " << offset << std::endl; | ||||||
|     { |     { | ||||||
|         auto oh = msgpack::unpack(ss.str().data(), ss.str().size(), offset); |         auto const& str = ss.str(); | ||||||
|  |         auto oh = msgpack::unpack(str.data(), str.size(), offset); | ||||||
|         auto obj = oh.get(); |         auto obj = oh.get(); | ||||||
|  |  | ||||||
|         std::cout << obj << std::endl; |         std::cout << obj << std::endl; | ||||||
| @@ -122,7 +130,8 @@ void combi() { | |||||||
|     } |     } | ||||||
|     std::cout << "offset: " << offset << std::endl; |     std::cout << "offset: " << offset << std::endl; | ||||||
|     { |     { | ||||||
|         auto oh = msgpack::unpack(ss.str().data(), ss.str().size(), offset); |         auto const& str = ss.str(); | ||||||
|  |         auto oh = msgpack::unpack(str.data(), str.size(), offset); | ||||||
|         auto obj = oh.get(); |         auto obj = oh.get(); | ||||||
|  |  | ||||||
|         std::cout << obj << std::endl; |         std::cout << obj << std::endl; | ||||||
| @@ -130,7 +139,8 @@ void combi() { | |||||||
|     } |     } | ||||||
|     std::cout << "offset: " << offset << std::endl; |     std::cout << "offset: " << offset << std::endl; | ||||||
|     { |     { | ||||||
|         auto oh = msgpack::unpack(ss.str().data(), ss.str().size(), offset); |         auto const& str = ss.str(); | ||||||
|  |         auto oh = msgpack::unpack(str.data(), str.size(), offset); | ||||||
|         auto obj = oh.get(); |         auto obj = oh.get(); | ||||||
|  |  | ||||||
|         std::cout << obj << std::endl; |         std::cout << obj << std::endl; | ||||||
|   | |||||||
| @@ -1,32 +1,27 @@ | |||||||
| IF (MSGPACK_USE_X3_PARSE) | IF (MSGPACK_USE_X3_PARSE AND MSGPACK_DEFAULT_API_VERSION VERSION_GREATER 1) | ||||||
|     INCLUDE_DIRECTORIES ( |     FIND_PACKAGE (Boost REQUIRED COMPONENTS context) | ||||||
|         ../include |     FIND_PACKAGE (Threads REQUIRED) | ||||||
|     ) |  | ||||||
|  |  | ||||||
|     LIST (APPEND exec_PROGRAMS |     LIST (APPEND exec_PROGRAMS | ||||||
|         unpack.cpp |         unpack.cpp | ||||||
|         parse.cpp |         parse.cpp | ||||||
|     ) |     ) | ||||||
|     IF (MSGPACK_BOOST) |     LIST (APPEND with_boost_PROGRAMS | ||||||
|         LIST (APPEND with_boost_PROGRAMS |         stream_unpack.cpp | ||||||
|             stream_unpack.cpp |     ) | ||||||
|         ) |  | ||||||
|     ENDIF () |  | ||||||
|     FOREACH (source_file ${exec_PROGRAMS}) |     FOREACH (source_file ${exec_PROGRAMS}) | ||||||
|         GET_FILENAME_COMPONENT (source_file_we ${source_file} NAME_WE) |         GET_FILENAME_COMPONENT (source_file_we ${source_file} NAME_WE) | ||||||
|         ADD_EXECUTABLE ( |         ADD_EXECUTABLE ( | ||||||
|             ${source_file_we} |             ${source_file_we} | ||||||
|             ${source_file} |             ${source_file} | ||||||
|         ) |         ) | ||||||
|         TARGET_INCLUDE_DIRECTORIES (${source_file_we} |         TARGET_LINK_LIBRARIES (${source_file_we} PRIVATE msgpack-cxx) | ||||||
|             PRIVATE |  | ||||||
|                 $<TARGET_PROPERTY:msgpackc,INTERFACE_INCLUDE_DIRECTORIES> |         IF ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") | ||||||
|         ) |             SET_PROPERTY (TARGET ${source_file_we} APPEND_STRING PROPERTY COMPILE_FLAGS " -Wall -Wextra") | ||||||
|         IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") |  | ||||||
|             SET_PROPERTY (TARGET ${source_file_we} APPEND_STRING PROPERTY COMPILE_FLAGS "-Wall -Wextra -Werror -g ") |  | ||||||
|         ENDIF () |         ENDIF () | ||||||
|  |  | ||||||
|         IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") |         IF ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") | ||||||
|             SET_PROPERTY (TARGET ${source_file_we} APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-mismatched-tags") |             SET_PROPERTY (TARGET ${source_file_we} APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-mismatched-tags") | ||||||
|         ENDIF () |         ENDIF () | ||||||
|  |  | ||||||
| @@ -44,20 +39,16 @@ IF (MSGPACK_USE_X3_PARSE) | |||||||
|             ${source_file_we} |             ${source_file_we} | ||||||
|             ${source_file} |             ${source_file} | ||||||
|         ) |         ) | ||||||
|         TARGET_INCLUDE_DIRECTORIES (${source_file_we} |         TARGET_LINK_LIBRARIES (${source_file_we} PRIVATE | ||||||
|             PRIVATE |             msgpack-cxx | ||||||
|                 $<TARGET_PROPERTY:msgpackc,INTERFACE_INCLUDE_DIRECTORIES> |             Boost::context | ||||||
|  |             Threads::Threads | ||||||
|         ) |         ) | ||||||
|         TARGET_LINK_LIBRARIES (${source_file_we} |         IF ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") | ||||||
|             ${Boost_CONTEXT_LIBRARY} |             SET_PROPERTY (TARGET ${source_file_we} APPEND_STRING PROPERTY COMPILE_FLAGS " -Wall -Wextra") | ||||||
|             ${Boost_SYSTEM_LIBRARY} |  | ||||||
|             ${CMAKE_THREAD_LIBS_INIT} |  | ||||||
|         ) |  | ||||||
|         IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") |  | ||||||
|             SET_PROPERTY (TARGET ${source_file_we} APPEND_STRING PROPERTY COMPILE_FLAGS "-Wall -Wextra -Werror -g ") |  | ||||||
|         ENDIF () |         ENDIF () | ||||||
|  |  | ||||||
|         IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") |         IF ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") | ||||||
|             SET_PROPERTY (TARGET ${source_file_we} APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-mismatched-tags") |             SET_PROPERTY (TARGET ${source_file_we} APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-mismatched-tags") | ||||||
|         ENDIF () |         ENDIF () | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										1
									
								
								external/boost/predef
									
									
									
									
										vendored
									
									
								
							
							
								
								
								
								
								
							
						
						
									
										1
									
								
								external/boost/predef
									
									
									
									
										vendored
									
									
								
							 Submodule external/boost/predef deleted from 1e8d1c2cfc
									
								
							
							
								
								
									
										1
									
								
								external/boost/preprocessor
									
									
									
									
										vendored
									
									
								
							
							
								
								
								
								
								
							
						
						
									
										1
									
								
								external/boost/preprocessor
									
									
									
									
										vendored
									
									
								
							 Submodule external/boost/preprocessor deleted from c2beb74b90
									
								
							
							
								
								
									
										37
									
								
								fuzz/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								fuzz/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,37 @@ | |||||||
|  | FIND_PACKAGE (Threads REQUIRED) | ||||||
|  | FIND_PACKAGE (Boost REQUIRED COMPONENTS filesystem unit_test_framework) | ||||||
|  |  | ||||||
|  | LIST (APPEND check_PROGRAMS | ||||||
|  |     regression_runner.cpp | ||||||
|  | ) | ||||||
|  |  | ||||||
|  | FOREACH (source_file ${check_PROGRAMS}) | ||||||
|  |     GET_FILENAME_COMPONENT (source_file_we ${source_file} NAME_WE) | ||||||
|  |     ADD_EXECUTABLE ( | ||||||
|  |         ${source_file_we} | ||||||
|  |         ${source_file} | ||||||
|  |     ) | ||||||
|  |  | ||||||
|  |     TARGET_COMPILE_DEFINITIONS (${source_file_we} PRIVATE | ||||||
|  |         $<IF:$<BOOL:${MSGPACK_USE_STATIC_BOOST}>,,BOOST_TEST_DYN_LINK>) | ||||||
|  |  | ||||||
|  |     TARGET_LINK_LIBRARIES (${source_file_we} | ||||||
|  |         msgpack-cxx | ||||||
|  |         Threads::Threads | ||||||
|  |         Boost::filesystem | ||||||
|  |         Boost::unit_test_framework | ||||||
|  |     ) | ||||||
|  |  | ||||||
|  |     ADD_TEST (${source_file_we} ${source_file_we}) | ||||||
|  |  | ||||||
|  |     IF ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") | ||||||
|  |       SET_PROPERTY (TARGET ${source_file_we} APPEND_STRING PROPERTY COMPILE_FLAGS "-Wall -Wextra -Wno-mismatched-tags -g") | ||||||
|  |         IF ("${MSGPACK_SAN}" STREQUAL "ASAN") | ||||||
|  |             SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-omit-frame-pointer -fsanitize=address") | ||||||
|  |             SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-omit-frame-pointer -fsanitize=address") | ||||||
|  |         ELSEIF ("${MSGPACK_SAN}" STREQUAL "UBSAN") | ||||||
|  |             SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined") | ||||||
|  |             SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined") | ||||||
|  |         ENDIF() | ||||||
|  |     ENDIF() | ||||||
|  | ENDFOREACH () | ||||||
							
								
								
									
										49
									
								
								fuzz/regression_runner.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								fuzz/regression_runner.cpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,49 @@ | |||||||
|  | #include <boost/filesystem.hpp> | ||||||
|  |  | ||||||
|  | // Use parameterized tests instead of modern data-driven test cases | ||||||
|  | // because BOOST_DATA_TEST_CASE requires C++11 or newer. See: | ||||||
|  | // - https://www.boost.org/doc/libs/1_76_0/libs/test/doc/html/boost_test/tests_organization/test_cases/param_test.html | ||||||
|  | // - https://www.boost.org/doc/libs/1_76_0/libs/test/doc/html/boost_test/tests_organization/test_cases/test_case_generation.html | ||||||
|  | #include <boost/test/included/unit_test.hpp> | ||||||
|  | #include <boost/test/parameterized_test.hpp> | ||||||
|  |  | ||||||
|  | #include <fstream> | ||||||
|  | #include <string> | ||||||
|  | #include <vector> | ||||||
|  |  | ||||||
|  | #include "unpack_pack_fuzzer.cpp" | ||||||
|  |  | ||||||
|  | std::vector<std::string> ListDirectory(const std::string& path) { | ||||||
|  |   std::vector<std::string> v; | ||||||
|  |  | ||||||
|  |   boost::filesystem::path p(path); | ||||||
|  |   boost::filesystem::directory_iterator f(p); | ||||||
|  |  | ||||||
|  |   if (boost::filesystem::is_directory(p)) { | ||||||
|  |     while (f != boost::filesystem::directory_iterator()) { | ||||||
|  |       v.push_back((*f++).path().string()); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |   return v; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | void UnpackPackFuzzerRegressionTest(const std::string& fpath) { | ||||||
|  |   std::ifstream in(fpath.c_str(), std::ios_base::binary); | ||||||
|  |   if (!in) { | ||||||
|  |     BOOST_FAIL(fpath + " not found"); | ||||||
|  |   } | ||||||
|  |   in.seekg(0, in.end); | ||||||
|  |   size_t length = in.tellg(); | ||||||
|  |   in.seekg(0, in.beg); | ||||||
|  |   std::vector<char> bytes(length); | ||||||
|  |   in.read(bytes.data(), bytes.size()); | ||||||
|  |   BOOST_REQUIRE(in); | ||||||
|  |   BOOST_REQUIRE_EQUAL(0, LLVMFuzzerTestOneInput(reinterpret_cast<const uint8_t *>(bytes.data()), bytes.size())); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | boost::unit_test::test_suite* init_unit_test_suite(int /*argc*/, char* /*argv*/[]) | ||||||
|  | { | ||||||
|  |   std::vector<std::string> files = ListDirectory("../../fuzz/unpack_pack_fuzzer_regressions"); | ||||||
|  |   boost::unit_test::framework::master_test_suite().add(BOOST_PARAM_TEST_CASE(&UnpackPackFuzzerRegressionTest, files.begin(), files.end())); | ||||||
|  |   return 0; | ||||||
|  | } | ||||||
							
								
								
									
										27
									
								
								fuzz/unpack_pack_fuzzer.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								fuzz/unpack_pack_fuzzer.cpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,27 @@ | |||||||
|  | #include <msgpack.hpp> | ||||||
|  |  | ||||||
|  | // The function's signature must NOT be changed since other projects rely on it: | ||||||
|  | // - libFuzzer | ||||||
|  | // - AFL++ | ||||||
|  | // - Google's oss-fuzz (uses the previous two ones) | ||||||
|  | extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { | ||||||
|  |   try { | ||||||
|  |     // NOTE(derwolfe): by default the limits are set at 2^32-1 length. I'm | ||||||
|  |     // setting these at far smaller values to avoid OOMs | ||||||
|  |     const int test_limit = 1000; | ||||||
|  |     msgpack::object_handle unpacked = msgpack::unpack(reinterpret_cast<const char *>(data), | ||||||
|  |                                                       size, | ||||||
|  |                                                       MSGPACK_NULLPTR, | ||||||
|  |                                                       MSGPACK_NULLPTR, | ||||||
|  |                                                       msgpack::unpack_limit(test_limit, | ||||||
|  |                                                                             test_limit, | ||||||
|  |                                                                             test_limit, | ||||||
|  |                                                                             test_limit, | ||||||
|  |                                                                             test_limit, | ||||||
|  |                                                                             test_limit)); | ||||||
|  |     msgpack::sbuffer sbuf; | ||||||
|  |     msgpack::pack(sbuf, unpacked.get()); | ||||||
|  |   } catch (...) { | ||||||
|  |   } | ||||||
|  |   return 0; | ||||||
|  | } | ||||||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										1
									
								
								fuzz/unpack_pack_fuzzer_seed_corpus/EmptyArray
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								fuzz/unpack_pack_fuzzer_seed_corpus/EmptyArray
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | |||||||
|  | <EFBFBD> | ||||||
							
								
								
									
										1
									
								
								fuzz/unpack_pack_fuzzer_seed_corpus/EmptyObject
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								fuzz/unpack_pack_fuzzer_seed_corpus/EmptyObject
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | |||||||
|  | <EFBFBD> | ||||||
							
								
								
									
										2
									
								
								fuzz/unpack_pack_fuzzer_seed_corpus/ExcessiveNesting
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								fuzz/unpack_pack_fuzzer_seed_corpus/ExcessiveNesting
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,2 @@ | |||||||
|  | <EFBFBD><01><02><03><04><05><06><07><08>	<09> | ||||||
|  | <EFBFBD><0B><0C> | ||||||
							
								
								
									
										
											BIN
										
									
								
								fuzz/unpack_pack_fuzzer_seed_corpus/OpenWeatherMap
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								fuzz/unpack_pack_fuzzer_seed_corpus/OpenWeatherMap
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								fuzz/unpack_pack_fuzzer_seed_corpus/WeatherUnderground
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								fuzz/unpack_pack_fuzzer_seed_corpus/WeatherUnderground
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| @@ -1,24 +0,0 @@ | |||||||
| /* |  | ||||||
|  * MessagePack for C |  | ||||||
|  * |  | ||||||
|  * Copyright (C) 2008-2009 FURUHASHI Sadayuki |  | ||||||
|  * |  | ||||||
|  *    Distributed under the Boost Software License, Version 1.0. |  | ||||||
|  *    (See accompanying file LICENSE_1_0.txt or copy at |  | ||||||
|  *    http://www.boost.org/LICENSE_1_0.txt) |  | ||||||
|  */ |  | ||||||
| /** |  | ||||||
|  * @defgroup msgpack MessagePack C |  | ||||||
|  * @{ |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #include "msgpack/util.h" |  | ||||||
| #include "msgpack/object.h" |  | ||||||
| #include "msgpack/zone.h" |  | ||||||
| #include "msgpack/pack.h" |  | ||||||
| #include "msgpack/unpack.h" |  | ||||||
| #include "msgpack/sbuffer.h" |  | ||||||
| #include "msgpack/vrefbuffer.h" |  | ||||||
| #include "msgpack/version.h" |  | ||||||
|  |  | ||||||
| @@ -11,7 +11,11 @@ | |||||||
| #include "msgpack/iterator.hpp" | #include "msgpack/iterator.hpp" | ||||||
| #include "msgpack/zone.hpp" | #include "msgpack/zone.hpp" | ||||||
| #include "msgpack/pack.hpp" | #include "msgpack/pack.hpp" | ||||||
|  | #include "msgpack/null_visitor.hpp" | ||||||
|  | #include "msgpack/parse.hpp" | ||||||
| #include "msgpack/unpack.hpp" | #include "msgpack/unpack.hpp" | ||||||
|  | #include "msgpack/x3_parse.hpp" | ||||||
|  | #include "msgpack/x3_unpack.hpp" | ||||||
| #include "msgpack/sbuffer.hpp" | #include "msgpack/sbuffer.hpp" | ||||||
| #include "msgpack/vrefbuffer.hpp" | #include "msgpack/vrefbuffer.hpp" | ||||||
| #include "msgpack/version.hpp" | #include "msgpack/version.hpp" | ||||||
|   | |||||||
| @@ -14,5 +14,6 @@ | |||||||
|  |  | ||||||
| #include "msgpack/v1/adaptor/adaptor_base.hpp" | #include "msgpack/v1/adaptor/adaptor_base.hpp" | ||||||
| #include "msgpack/v2/adaptor/adaptor_base.hpp" | #include "msgpack/v2/adaptor/adaptor_base.hpp" | ||||||
|  | #include "msgpack/v3/adaptor/adaptor_base.hpp" | ||||||
|  |  | ||||||
| #endif // MSGPACK_ADAPTOR_BASE_HPP | #endif // MSGPACK_ADAPTOR_BASE_HPP | ||||||
|   | |||||||
| @@ -12,5 +12,6 @@ | |||||||
|  |  | ||||||
| #include "msgpack/v1/adaptor/adaptor_base_decl.hpp" | #include "msgpack/v1/adaptor/adaptor_base_decl.hpp" | ||||||
| #include "msgpack/v2/adaptor/adaptor_base_decl.hpp" | #include "msgpack/v2/adaptor/adaptor_base_decl.hpp" | ||||||
|  | #include "msgpack/v3/adaptor/adaptor_base_decl.hpp" | ||||||
|  |  | ||||||
| #endif // MSGPACK_ADAPTOR_BASE_DECL_HPP | #endif // MSGPACK_ADAPTOR_BASE_DECL_HPP | ||||||
|   | |||||||
| @@ -12,5 +12,6 @@ | |||||||
|  |  | ||||||
| #include "msgpack/v1/adaptor/array_ref_decl.hpp" | #include "msgpack/v1/adaptor/array_ref_decl.hpp" | ||||||
| #include "msgpack/v2/adaptor/array_ref_decl.hpp" | #include "msgpack/v2/adaptor/array_ref_decl.hpp" | ||||||
|  | #include "msgpack/v3/adaptor/array_ref_decl.hpp" | ||||||
|  |  | ||||||
| #endif // MSGPACK_TYPE_ARRAY_REF_DECL_HPP | #endif // MSGPACK_TYPE_ARRAY_REF_DECL_HPP | ||||||
|   | |||||||
| @@ -12,5 +12,6 @@ | |||||||
|  |  | ||||||
| #include "msgpack/v1/adaptor/boost/msgpack_variant_decl.hpp" | #include "msgpack/v1/adaptor/boost/msgpack_variant_decl.hpp" | ||||||
| #include "msgpack/v2/adaptor/boost/msgpack_variant_decl.hpp" | #include "msgpack/v2/adaptor/boost/msgpack_variant_decl.hpp" | ||||||
|  | #include "msgpack/v3/adaptor/boost/msgpack_variant_decl.hpp" | ||||||
|  |  | ||||||
| #endif // MSGPACK_TYPE_BOOST_MSGPACK_VARIANT_DECL_HPP | #endif // MSGPACK_TYPE_BOOST_MSGPACK_VARIANT_DECL_HPP | ||||||
|   | |||||||
| @@ -12,5 +12,6 @@ | |||||||
|  |  | ||||||
| #include "msgpack/v1/adaptor/check_container_size_decl.hpp" | #include "msgpack/v1/adaptor/check_container_size_decl.hpp" | ||||||
| #include "msgpack/v2/adaptor/check_container_size_decl.hpp" | #include "msgpack/v2/adaptor/check_container_size_decl.hpp" | ||||||
|  | #include "msgpack/v3/adaptor/check_container_size_decl.hpp" | ||||||
|  |  | ||||||
| #endif // MSGPACK_CHECK_CONTAINER_SIZE_DECL_HPP | #endif // MSGPACK_CHECK_CONTAINER_SIZE_DECL_HPP | ||||||
|   | |||||||
							
								
								
									
										15
									
								
								include/msgpack/adaptor/complex.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								include/msgpack/adaptor/complex.hpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,15 @@ | |||||||
|  | // | ||||||
|  | // MessagePack for C++ static resolution routine | ||||||
|  | // | ||||||
|  | // Copyright (C) 2020 KONDO Takatoshi | ||||||
|  | // | ||||||
|  | //    Distributed under the Boost Software License, Version 1.0. | ||||||
|  | //    (See accompanying file LICENSE_1_0.txt or copy at | ||||||
|  | //    http://www.boost.org/LICENSE_1_0.txt) | ||||||
|  | // | ||||||
|  | #ifndef MSGPACK_TYPE_COMPLEX_HPP | ||||||
|  | #define MSGPACK_TYPE_COMPLEX_HPP | ||||||
|  |  | ||||||
|  | #include "msgpack/v1/adaptor/complex.hpp" | ||||||
|  |  | ||||||
|  | #endif // MSGPACK_TYPE_COMPLEX_HPP | ||||||
							
								
								
									
										16
									
								
								include/msgpack/adaptor/cpp11/chrono.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								include/msgpack/adaptor/cpp11/chrono.hpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,16 @@ | |||||||
|  | // | ||||||
|  | // MessagePack for C++ static resolution routine | ||||||
|  | // | ||||||
|  | // Copyright (C) 2017 KONDO Takatoshi | ||||||
|  | // | ||||||
|  | //    Distributed under the Boost Software License, Version 1.0. | ||||||
|  | //    (See accompanying file LICENSE_1_0.txt or copy at | ||||||
|  | //    http://www.boost.org/LICENSE_1_0.txt) | ||||||
|  | // | ||||||
|  |  | ||||||
|  | #ifndef MSGPACK_TYPE_CPP11_CHRONO_HPP | ||||||
|  | #define MSGPACK_TYPE_CPP11_CHRONO_HPP | ||||||
|  |  | ||||||
|  | #include "msgpack/v1/adaptor/cpp11/chrono.hpp" | ||||||
|  |  | ||||||
|  | #endif // MSGPACK_TYPE_CPP11_CHRONO_HPP | ||||||
							
								
								
									
										16
									
								
								include/msgpack/adaptor/cpp11/timespec.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								include/msgpack/adaptor/cpp11/timespec.hpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,16 @@ | |||||||
|  | // | ||||||
|  | // MessagePack for C++ static resolution routine | ||||||
|  | // | ||||||
|  | // Copyright (C) 2019 KONDO Takatoshi | ||||||
|  | // | ||||||
|  | //    Distributed under the Boost Software License, Version 1.0. | ||||||
|  | //    (See accompanying file LICENSE_1_0.txt or copy at | ||||||
|  | //    http://www.boost.org/LICENSE_1_0.txt) | ||||||
|  | // | ||||||
|  |  | ||||||
|  | #ifndef MSGPACK_TYPE_CPP11_TIMESPEC_HPP | ||||||
|  | #define MSGPACK_TYPE_CPP11_TIMESPEC_HPP | ||||||
|  |  | ||||||
|  | #include "msgpack/v1/adaptor/cpp11/timespec.hpp" | ||||||
|  |  | ||||||
|  | #endif // MSGPACK_TYPE_CPP11_TIMESPEC_HPP | ||||||
							
								
								
									
										16
									
								
								include/msgpack/adaptor/cpp17/array_byte.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								include/msgpack/adaptor/cpp17/array_byte.hpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,16 @@ | |||||||
|  | // | ||||||
|  | // MessagePack for C++ static resolution routine | ||||||
|  | // | ||||||
|  | // Copyright (C) 2021 KONDO Takatoshi | ||||||
|  | // | ||||||
|  | //    Distributed under the Boost Software License, Version 1.0. | ||||||
|  | //    (See accompanying file LICENSE_1_0.txt or copy at | ||||||
|  | //    http://www.boost.org/LICENSE_1_0.txt) | ||||||
|  | // | ||||||
|  |  | ||||||
|  | #ifndef MSGPACK_TYPE_CPP17_ARRAY_BYTE_HPP | ||||||
|  | #define MSGPACK_TYPE_CPP17_ARRAY_BYTE_HPP | ||||||
|  |  | ||||||
|  | #include "msgpack/v1/adaptor/cpp17/array_byte.hpp" | ||||||
|  |  | ||||||
|  | #endif // MSGPACK_TYPE_CPP17_ARRAY_BYTE_HPP | ||||||
							
								
								
									
										16
									
								
								include/msgpack/adaptor/cpp17/byte.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								include/msgpack/adaptor/cpp17/byte.hpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,16 @@ | |||||||
|  | // | ||||||
|  | // MessagePack for C++ static resolution routine | ||||||
|  | // | ||||||
|  | // Copyright (C) 2018 KONDO Takatoshi | ||||||
|  | // | ||||||
|  | //    Distributed under the Boost Software License, Version 1.0. | ||||||
|  | //    (See accompanying file LICENSE_1_0.txt or copy at | ||||||
|  | //    http://www.boost.org/LICENSE_1_0.txt) | ||||||
|  | // | ||||||
|  |  | ||||||
|  | #ifndef MSGPACK_TYPE_CPP17_BYTE_HPP | ||||||
|  | #define MSGPACK_TYPE_CPP17_BYTE_HPP | ||||||
|  |  | ||||||
|  | #include "msgpack/v1/adaptor/cpp17/byte.hpp" | ||||||
|  |  | ||||||
|  | #endif // MSGPACK_TYPE_CPP17_BYTE_HPP | ||||||
							
								
								
									
										16
									
								
								include/msgpack/adaptor/cpp17/carray_byte.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								include/msgpack/adaptor/cpp17/carray_byte.hpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,16 @@ | |||||||
|  | // | ||||||
|  | // MessagePack for C++ static resolution routine | ||||||
|  | // | ||||||
|  | // Copyright (C) 2018 KONDO Takatoshi | ||||||
|  | // | ||||||
|  | //    Distributed under the Boost Software License, Version 1.0. | ||||||
|  | //    (See accompanying file LICENSE_1_0.txt or copy at | ||||||
|  | //    http://www.boost.org/LICENSE_1_0.txt) | ||||||
|  | // | ||||||
|  |  | ||||||
|  | #ifndef MSGPACK_TYPE_CPP17_CARRAY_BYTE_HPP | ||||||
|  | #define MSGPACK_TYPE_CPP17_CARRAY_BYTE_HPP | ||||||
|  |  | ||||||
|  | #include "msgpack/v1/adaptor/cpp17/carray_byte.hpp" | ||||||
|  |  | ||||||
|  | #endif // MSGPACK_TYPE_CPP17_CARRAY_BYTE_HPP | ||||||
							
								
								
									
										16
									
								
								include/msgpack/adaptor/cpp17/variant.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								include/msgpack/adaptor/cpp17/variant.hpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,16 @@ | |||||||
|  | // | ||||||
|  | // MessagePack for C++ static resolution routine | ||||||
|  | // | ||||||
|  | // Copyright (C) 2023 Uy Ha | ||||||
|  | // | ||||||
|  | //    Distributed under the Boost Software License, Version 1.0. | ||||||
|  | //    (See accompanying file LICENSE_1_0.txt or copy at | ||||||
|  | //    http://www.boost.org/LICENSE_1_0.txt) | ||||||
|  | // | ||||||
|  |  | ||||||
|  | #ifndef MSGPACK_TYPE_CPP17_VARIANT_HPP | ||||||
|  | #define MSGPACK_TYPE_CPP17_VARIANT_HPP | ||||||
|  |  | ||||||
|  | #include "msgpack/v1/adaptor/cpp17/variant.hpp" | ||||||
|  |  | ||||||
|  | #endif // MSGPACK_TYPE_CPP17_VARIANT_HPP | ||||||
							
								
								
									
										16
									
								
								include/msgpack/adaptor/cpp17/vector_byte.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								include/msgpack/adaptor/cpp17/vector_byte.hpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,16 @@ | |||||||
|  | // | ||||||
|  | // MessagePack for C++ static resolution routine | ||||||
|  | // | ||||||
|  | // Copyright (C) 2018 KONDO Takatoshi | ||||||
|  | // | ||||||
|  | //    Distributed under the Boost Software License, Version 1.0. | ||||||
|  | //    (See accompanying file LICENSE_1_0.txt or copy at | ||||||
|  | //    http://www.boost.org/LICENSE_1_0.txt) | ||||||
|  | // | ||||||
|  |  | ||||||
|  | #ifndef MSGPACK_TYPE_CPP17_VECTOR_BYTE_HPP | ||||||
|  | #define MSGPACK_TYPE_CPP17_VECTOR_BYTE_HPP | ||||||
|  |  | ||||||
|  | #include "msgpack/v1/adaptor/cpp17/vector_byte.hpp" | ||||||
|  |  | ||||||
|  | #endif // MSGPACK_TYPE_CPP17_VECTOR_BYTE_HPP | ||||||
							
								
								
									
										16
									
								
								include/msgpack/adaptor/cpp20/span.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								include/msgpack/adaptor/cpp20/span.hpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,16 @@ | |||||||
|  | // | ||||||
|  | // MessagePack for C++ static resolution routine | ||||||
|  | // | ||||||
|  | // Copyright (C) 2021 KONDO Takatoshi | ||||||
|  | // | ||||||
|  | //    Distributed under the Boost Software License, Version 1.0. | ||||||
|  | //    (See accompanying file LICENSE_1_0.txt or copy at | ||||||
|  | //    http://www.boost.org/LICENSE_1_0.txt) | ||||||
|  | // | ||||||
|  |  | ||||||
|  | #ifndef MSGPACK_TYPE_CPP20_SPAN_HPP | ||||||
|  | #define MSGPACK_TYPE_CPP20_SPAN_HPP | ||||||
|  |  | ||||||
|  | #include "msgpack/v1/adaptor/cpp20/span.hpp" | ||||||
|  |  | ||||||
|  | #endif // MSGPACK_TYPE_CPP20_SPAN_HPP | ||||||
| @@ -10,37 +10,18 @@ | |||||||
| #ifndef MSGPACK_DEFINE_DECL_HPP | #ifndef MSGPACK_DEFINE_DECL_HPP | ||||||
| #define MSGPACK_DEFINE_DECL_HPP | #define MSGPACK_DEFINE_DECL_HPP | ||||||
|  |  | ||||||
| // BOOST_PP_VARIADICS is defined in boost/preprocessor/config/config.hpp | #if defined(MSGPACK_NO_BOOST) | ||||||
|  |  | ||||||
|  | // MSGPACK_PP_VARIADICS is defined in msgpack/preprocessor/config/config.hpp | ||||||
| // http://www.boost.org/libs/preprocessor/doc/ref/variadics.html | // http://www.boost.org/libs/preprocessor/doc/ref/variadics.html | ||||||
| // However, supporting compiler detection is not complete. msgpack-c requires | // However, supporting compiler detection is not complete. msgpack-c requires | ||||||
| // variadic macro arguments support. So BOOST_PP_VARIADICS is defined here explicitly. | // variadic macro arguments support. So MSGPACK_PP_VARIADICS is defined here explicitly. | ||||||
| #if !defined(MSGPACK_PP_VARIADICS) | #if !defined(MSGPACK_PP_VARIADICS) | ||||||
| #define MSGPACK_PP_VARIADICS | #define MSGPACK_PP_VARIADICS | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #include <msgpack/preprocessor.hpp> | #include <msgpack/preprocessor.hpp> | ||||||
|  |  | ||||||
| #include "msgpack/versioning.hpp" |  | ||||||
|  |  | ||||||
| // for MSGPACK_ADD_ENUM |  | ||||||
| #include "msgpack/adaptor/int.hpp" |  | ||||||
|  |  | ||||||
| #define MSGPACK_DEFINE_ARRAY(...) \ |  | ||||||
|     template <typename Packer> \ |  | ||||||
|     void msgpack_pack(Packer& pk) const \ |  | ||||||
|     { \ |  | ||||||
|         msgpack::type::make_define_array(__VA_ARGS__).msgpack_pack(pk); \ |  | ||||||
|     } \ |  | ||||||
|     void msgpack_unpack(msgpack::object const& o) \ |  | ||||||
|     { \ |  | ||||||
|         msgpack::type::make_define_array(__VA_ARGS__).msgpack_unpack(o); \ |  | ||||||
|     }\ |  | ||||||
|     template <typename MSGPACK_OBJECT> \ |  | ||||||
|     void msgpack_object(MSGPACK_OBJECT* o, msgpack::zone& z) const \ |  | ||||||
|     { \ |  | ||||||
|         msgpack::type::make_define_array(__VA_ARGS__).msgpack_object(o, z); \ |  | ||||||
|     } |  | ||||||
|  |  | ||||||
| #define MSGPACK_BASE_ARRAY(base) (*const_cast<base *>(static_cast<base const*>(this))) | #define MSGPACK_BASE_ARRAY(base) (*const_cast<base *>(static_cast<base const*>(this))) | ||||||
| #define MSGPACK_NVP(name, value) (name) (value) | #define MSGPACK_NVP(name, value) (name) (value) | ||||||
|  |  | ||||||
| @@ -62,29 +43,108 @@ | |||||||
|  |  | ||||||
| #define MSGPACK_DEFINE_MAP(...) \ | #define MSGPACK_DEFINE_MAP(...) \ | ||||||
|     template <typename Packer> \ |     template <typename Packer> \ | ||||||
|     void msgpack_pack(Packer& pk) const \ |     void msgpack_pack(Packer& msgpack_pk) const \ | ||||||
|     { \ |     { \ | ||||||
|         msgpack::type::make_define_map \ |         msgpack::type::make_define_map \ | ||||||
|             MSGPACK_DEFINE_MAP_IMPL(__VA_ARGS__) \ |             MSGPACK_DEFINE_MAP_IMPL(__VA_ARGS__) \ | ||||||
|             .msgpack_pack(pk); \ |             .msgpack_pack(msgpack_pk); \ | ||||||
|     } \ |     } \ | ||||||
|     void msgpack_unpack(msgpack::object const& o) \ |     void msgpack_unpack(msgpack::object const& msgpack_o) \ | ||||||
|     { \ |     { \ | ||||||
|         msgpack::type::make_define_map \ |         msgpack::type::make_define_map \ | ||||||
|             MSGPACK_DEFINE_MAP_IMPL(__VA_ARGS__) \ |             MSGPACK_DEFINE_MAP_IMPL(__VA_ARGS__) \ | ||||||
|             .msgpack_unpack(o); \ |             .msgpack_unpack(msgpack_o); \ | ||||||
|     }\ |     }\ | ||||||
|     template <typename MSGPACK_OBJECT> \ |     template <typename MSGPACK_OBJECT> \ | ||||||
|     void msgpack_object(MSGPACK_OBJECT* o, msgpack::zone& z) const \ |     void msgpack_object(MSGPACK_OBJECT* msgpack_o, msgpack::zone& msgpack_z) const \ | ||||||
|     { \ |     { \ | ||||||
|         msgpack::type::make_define_map \ |         msgpack::type::make_define_map \ | ||||||
|             MSGPACK_DEFINE_MAP_IMPL(__VA_ARGS__) \ |             MSGPACK_DEFINE_MAP_IMPL(__VA_ARGS__) \ | ||||||
|             .msgpack_object(o, z); \ |             .msgpack_object(msgpack_o, msgpack_z); \ | ||||||
|     } |     } | ||||||
|  |  | ||||||
| #define MSGPACK_BASE_MAP(base) \ | #define MSGPACK_BASE_MAP(base) \ | ||||||
|     (MSGPACK_PP_STRINGIZE(base))(*const_cast<base *>(static_cast<base const*>(this))) |     (MSGPACK_PP_STRINGIZE(base))(*const_cast<base *>(static_cast<base const*>(this))) | ||||||
|  |  | ||||||
|  | #else  // defined(MSGPACK_NO_BOOST) | ||||||
|  |  | ||||||
|  | // BOOST_PP_VARIADICS is defined in boost/preprocessor/config/config.hpp | ||||||
|  | // http://www.boost.org/libs/preprocessor/doc/ref/variadics.html | ||||||
|  | // However, supporting compiler detection is not complete. msgpack-c requires | ||||||
|  | // variadic macro arguments support. So BOOST_PP_VARIADICS is defined here explicitly. | ||||||
|  | #if !defined(BOOST_PP_VARIADICS) | ||||||
|  | #define BOOST_PP_VARIADICS | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #include <boost/preprocessor.hpp> | ||||||
|  |  | ||||||
|  | #define MSGPACK_BASE_ARRAY(base) (*const_cast<base *>(static_cast<base const*>(this))) | ||||||
|  | #define MSGPACK_NVP(name, value) (name) (value) | ||||||
|  |  | ||||||
|  | #define MSGPACK_DEFINE_MAP_EACH_PROC(r, data, elem) \ | ||||||
|  |     BOOST_PP_IF( \ | ||||||
|  |         BOOST_PP_IS_BEGIN_PARENS(elem), \ | ||||||
|  |         elem, \ | ||||||
|  |         (BOOST_PP_STRINGIZE(elem))(elem) \ | ||||||
|  |     ) | ||||||
|  |  | ||||||
|  | #define MSGPACK_DEFINE_MAP_IMPL(...) \ | ||||||
|  |     BOOST_PP_SEQ_TO_TUPLE( \ | ||||||
|  |         BOOST_PP_SEQ_FOR_EACH( \ | ||||||
|  |             MSGPACK_DEFINE_MAP_EACH_PROC, \ | ||||||
|  |             0, \ | ||||||
|  |             BOOST_PP_VARIADIC_TO_SEQ(__VA_ARGS__) \ | ||||||
|  |         ) \ | ||||||
|  |     ) | ||||||
|  |  | ||||||
|  | #define MSGPACK_DEFINE_MAP(...) \ | ||||||
|  |     template <typename Packer> \ | ||||||
|  |     void msgpack_pack(Packer& msgpack_pk) const \ | ||||||
|  |     { \ | ||||||
|  |         msgpack::type::make_define_map \ | ||||||
|  |             MSGPACK_DEFINE_MAP_IMPL(__VA_ARGS__) \ | ||||||
|  |             .msgpack_pack(msgpack_pk); \ | ||||||
|  |     } \ | ||||||
|  |     void msgpack_unpack(msgpack::object const& msgpack_o) \ | ||||||
|  |     { \ | ||||||
|  |         msgpack::type::make_define_map \ | ||||||
|  |             MSGPACK_DEFINE_MAP_IMPL(__VA_ARGS__) \ | ||||||
|  |             .msgpack_unpack(msgpack_o); \ | ||||||
|  |     }\ | ||||||
|  |     template <typename MSGPACK_OBJECT> \ | ||||||
|  |     void msgpack_object(MSGPACK_OBJECT* msgpack_o, msgpack::zone& msgpack_z) const \ | ||||||
|  |     { \ | ||||||
|  |         msgpack::type::make_define_map \ | ||||||
|  |             MSGPACK_DEFINE_MAP_IMPL(__VA_ARGS__) \ | ||||||
|  |             .msgpack_object(msgpack_o, msgpack_z); \ | ||||||
|  |     } | ||||||
|  |  | ||||||
|  | #define MSGPACK_BASE_MAP(base) \ | ||||||
|  |     (BOOST_PP_STRINGIZE(base))(*const_cast<base *>(static_cast<base const*>(this))) | ||||||
|  |  | ||||||
|  | #endif // defined(MSGPACK_NO_BOOST) | ||||||
|  |  | ||||||
|  | #include "msgpack/versioning.hpp" | ||||||
|  |  | ||||||
|  | // for MSGPACK_ADD_ENUM | ||||||
|  | #include "msgpack/adaptor/int.hpp" | ||||||
|  |  | ||||||
|  | #define MSGPACK_DEFINE_ARRAY(...) \ | ||||||
|  |     template <typename Packer> \ | ||||||
|  |     void msgpack_pack(Packer& msgpack_pk) const \ | ||||||
|  |     { \ | ||||||
|  |         msgpack::type::make_define_array(__VA_ARGS__).msgpack_pack(msgpack_pk); \ | ||||||
|  |     } \ | ||||||
|  |     void msgpack_unpack(msgpack::object const& msgpack_o) \ | ||||||
|  |     { \ | ||||||
|  |         msgpack::type::make_define_array(__VA_ARGS__).msgpack_unpack(msgpack_o); \ | ||||||
|  |     }\ | ||||||
|  |     template <typename MSGPACK_OBJECT> \ | ||||||
|  |     void msgpack_object(MSGPACK_OBJECT* msgpack_o, msgpack::zone& msgpack_z) const \ | ||||||
|  |     { \ | ||||||
|  |         msgpack::type::make_define_array(__VA_ARGS__).msgpack_object(msgpack_o, msgpack_z); \ | ||||||
|  |     } | ||||||
|  |  | ||||||
| // MSGPACK_ADD_ENUM must be used in the global namespace. | // MSGPACK_ADD_ENUM must be used in the global namespace. | ||||||
| #define MSGPACK_ADD_ENUM(enum_name) \ | #define MSGPACK_ADD_ENUM(enum_name) \ | ||||||
|   namespace msgpack { \ |   namespace msgpack { \ | ||||||
| @@ -94,32 +154,32 @@ | |||||||
|   namespace adaptor { \ |   namespace adaptor { \ | ||||||
|     template<> \ |     template<> \ | ||||||
|     struct convert<enum_name> { \ |     struct convert<enum_name> { \ | ||||||
|       msgpack::object const& operator()(msgpack::object const& o, enum_name& v) const { \ |       msgpack::object const& operator()(msgpack::object const& msgpack_o, enum_name& msgpack_v) const { \ | ||||||
|         msgpack::underlying_type<enum_name>::type tmp; \ |         msgpack::underlying_type<enum_name>::type tmp; \ | ||||||
|         msgpack::operator>>(o, tmp);                   \ |         msgpack::operator>>(msgpack_o, tmp);                   \ | ||||||
|         v = static_cast<enum_name>(tmp);   \ |         msgpack_v = static_cast<enum_name>(tmp);   \ | ||||||
|         return o; \ |         return msgpack_o; \ | ||||||
|       } \ |       } \ | ||||||
|     }; \ |     }; \ | ||||||
|     template<> \ |     template<> \ | ||||||
|     struct object<enum_name> { \ |     struct object<enum_name> { \ | ||||||
|       void operator()(msgpack::object& o, const enum_name& v) const { \ |       void operator()(msgpack::object& msgpack_o, const enum_name& msgpack_v) const { \ | ||||||
|         msgpack::underlying_type<enum_name>::type tmp = static_cast<msgpack::underlying_type<enum_name>::type>(v); \ |         msgpack::underlying_type<enum_name>::type tmp = static_cast<msgpack::underlying_type<enum_name>::type>(msgpack_v); \ | ||||||
|         msgpack::operator<<(o, tmp);                                    \ |         msgpack::operator<<(msgpack_o, tmp);                                    \ | ||||||
|       } \ |       } \ | ||||||
|     }; \ |     }; \ | ||||||
|     template<> \ |     template<> \ | ||||||
|     struct object_with_zone<enum_name> { \ |     struct object_with_zone<enum_name> { \ | ||||||
|       void operator()(msgpack::object::with_zone& o, const enum_name& v) const {  \ |       void operator()(msgpack::object::with_zone& msgpack_o, const enum_name& msgpack_v) const {  \ | ||||||
|         msgpack::underlying_type<enum_name>::type tmp = static_cast<msgpack::underlying_type<enum_name>::type>(v); \ |         msgpack::underlying_type<enum_name>::type tmp = static_cast<msgpack::underlying_type<enum_name>::type>(msgpack_v); \ | ||||||
|         msgpack::operator<<(o, tmp);                                    \ |         msgpack::operator<<(msgpack_o, tmp);                                    \ | ||||||
|       } \ |       } \ | ||||||
|     }; \ |     }; \ | ||||||
|     template <> \ |     template <> \ | ||||||
|     struct pack<enum_name> { \ |     struct pack<enum_name> { \ | ||||||
|       template <typename Stream> \ |       template <typename Stream> \ | ||||||
|       msgpack::packer<Stream>& operator()(msgpack::packer<Stream>& o, const enum_name& v) const { \ |       msgpack::packer<Stream>& operator()(msgpack::packer<Stream>& msgpack_o, const enum_name& msgpack_v) const { \ | ||||||
|           return msgpack::operator<<(o, static_cast<msgpack::underlying_type<enum_name>::type>(v)); \ |           return msgpack::operator<<(msgpack_o, static_cast<msgpack::underlying_type<enum_name>::type>(msgpack_v)); \ | ||||||
|       } \ |       } \ | ||||||
|     }; \ |     }; \ | ||||||
|   } \ |   } \ | ||||||
| @@ -139,5 +199,6 @@ | |||||||
|  |  | ||||||
| #include "msgpack/v1/adaptor/define_decl.hpp" | #include "msgpack/v1/adaptor/define_decl.hpp" | ||||||
| #include "msgpack/v2/adaptor/define_decl.hpp" | #include "msgpack/v2/adaptor/define_decl.hpp" | ||||||
|  | #include "msgpack/v3/adaptor/define_decl.hpp" | ||||||
|  |  | ||||||
| #endif // MSGPACK_DEFINE_DECL_HPP | #endif // MSGPACK_DEFINE_DECL_HPP | ||||||
|   | |||||||
| @@ -12,5 +12,6 @@ | |||||||
|  |  | ||||||
| #include "msgpack/v1/adaptor/ext_decl.hpp" | #include "msgpack/v1/adaptor/ext_decl.hpp" | ||||||
| #include "msgpack/v2/adaptor/ext_decl.hpp" | #include "msgpack/v2/adaptor/ext_decl.hpp" | ||||||
|  | #include "msgpack/v3/adaptor/ext_decl.hpp" | ||||||
|  |  | ||||||
| #endif // MSGPACK_TYPE_EXT_DECL_HPP | #endif // MSGPACK_TYPE_EXT_DECL_HPP | ||||||
|   | |||||||
| @@ -12,5 +12,6 @@ | |||||||
|  |  | ||||||
| #include "msgpack/v1/adaptor/fixint_decl.hpp" | #include "msgpack/v1/adaptor/fixint_decl.hpp" | ||||||
| #include "msgpack/v2/adaptor/fixint_decl.hpp" | #include "msgpack/v2/adaptor/fixint_decl.hpp" | ||||||
|  | #include "msgpack/v3/adaptor/fixint_decl.hpp" | ||||||
|  |  | ||||||
| #endif // MSGPACK_TYPE_FIXINT_DECL_HPP | #endif // MSGPACK_TYPE_FIXINT_DECL_HPP | ||||||
|   | |||||||
| @@ -12,5 +12,6 @@ | |||||||
|  |  | ||||||
| #include "msgpack/v1/adaptor/int_decl.hpp" | #include "msgpack/v1/adaptor/int_decl.hpp" | ||||||
| #include "msgpack/v2/adaptor/int_decl.hpp" | #include "msgpack/v2/adaptor/int_decl.hpp" | ||||||
|  | #include "msgpack/v3/adaptor/int_decl.hpp" | ||||||
|  |  | ||||||
| #endif // MSGPACK_TYPE_INT_DECL_HPP | #endif // MSGPACK_TYPE_INT_DECL_HPP | ||||||
|   | |||||||
| @@ -12,5 +12,6 @@ | |||||||
|  |  | ||||||
| #include "msgpack/v1/adaptor/map_decl.hpp" | #include "msgpack/v1/adaptor/map_decl.hpp" | ||||||
| #include "msgpack/v2/adaptor/map_decl.hpp" | #include "msgpack/v2/adaptor/map_decl.hpp" | ||||||
|  | #include "msgpack/v3/adaptor/map_decl.hpp" | ||||||
|  |  | ||||||
| #endif // MSGPACK_TYPE_MAP_DECL_HPP | #endif // MSGPACK_TYPE_MAP_DECL_HPP | ||||||
|   | |||||||
| @@ -12,5 +12,6 @@ | |||||||
|  |  | ||||||
| #include "msgpack/v1/adaptor/msgpack_tuple_decl.hpp" | #include "msgpack/v1/adaptor/msgpack_tuple_decl.hpp" | ||||||
| #include "msgpack/v2/adaptor/msgpack_tuple_decl.hpp" | #include "msgpack/v2/adaptor/msgpack_tuple_decl.hpp" | ||||||
|  | #include "msgpack/v3/adaptor/msgpack_tuple_decl.hpp" | ||||||
|  |  | ||||||
| #endif // MSGPACK_MSGPACK_TUPLE_DECL_HPP | #endif // MSGPACK_MSGPACK_TUPLE_DECL_HPP | ||||||
|   | |||||||
| @@ -12,5 +12,6 @@ | |||||||
|  |  | ||||||
| #include "msgpack/v1/adaptor/nil_decl.hpp" | #include "msgpack/v1/adaptor/nil_decl.hpp" | ||||||
| #include "msgpack/v2/adaptor/nil_decl.hpp" | #include "msgpack/v2/adaptor/nil_decl.hpp" | ||||||
|  | #include "msgpack/v3/adaptor/nil_decl.hpp" | ||||||
|  |  | ||||||
| #endif // MSGPACK_TYPE_NIL_DECL_HPP | #endif // MSGPACK_TYPE_NIL_DECL_HPP | ||||||
|   | |||||||
| @@ -12,5 +12,6 @@ | |||||||
|  |  | ||||||
| #include "msgpack/v1/adaptor/raw_decl.hpp" | #include "msgpack/v1/adaptor/raw_decl.hpp" | ||||||
| #include "msgpack/v2/adaptor/raw_decl.hpp" | #include "msgpack/v2/adaptor/raw_decl.hpp" | ||||||
|  | #include "msgpack/v3/adaptor/raw_decl.hpp" | ||||||
|  |  | ||||||
| #endif // MSGPACK_TYPE_RAW_DECL_HPP | #endif // MSGPACK_TYPE_RAW_DECL_HPP | ||||||
|   | |||||||
| @@ -12,5 +12,6 @@ | |||||||
|  |  | ||||||
| #include "msgpack/v1/adaptor/size_equal_only_decl.hpp" | #include "msgpack/v1/adaptor/size_equal_only_decl.hpp" | ||||||
| #include "msgpack/v2/adaptor/size_equal_only_decl.hpp" | #include "msgpack/v2/adaptor/size_equal_only_decl.hpp" | ||||||
|  | #include "msgpack/v3/adaptor/size_equal_only_decl.hpp" | ||||||
|  |  | ||||||
| #endif // MSGPACK_TYPE_SIZE_EQUAL_ONLY_DECL_HPP | #endif // MSGPACK_TYPE_SIZE_EQUAL_ONLY_DECL_HPP | ||||||
|   | |||||||
| @@ -12,6 +12,7 @@ | |||||||
|  |  | ||||||
| #include "msgpack/versioning.hpp" | #include "msgpack/versioning.hpp" | ||||||
| #include "msgpack/adaptor/adaptor_base.hpp" | #include "msgpack/adaptor/adaptor_base.hpp" | ||||||
|  | #include "msgpack/object.hpp" | ||||||
| #include "msgpack/adaptor/check_container_size.hpp" | #include "msgpack/adaptor/check_container_size.hpp" | ||||||
|  |  | ||||||
| #if defined(_LIBCPP_VERSION) || (_MSC_VER >= 1700) | #if defined(_LIBCPP_VERSION) || (_MSC_VER >= 1700) | ||||||
|   | |||||||
| @@ -12,6 +12,7 @@ | |||||||
|  |  | ||||||
| #include "msgpack/versioning.hpp" | #include "msgpack/versioning.hpp" | ||||||
| #include "msgpack/adaptor/adaptor_base.hpp" | #include "msgpack/adaptor/adaptor_base.hpp" | ||||||
|  | #include "msgpack/object.hpp" | ||||||
| #include "msgpack/adaptor/check_container_size.hpp" | #include "msgpack/adaptor/check_container_size.hpp" | ||||||
|  |  | ||||||
| #if defined(_LIBCPP_VERSION) || (_MSC_VER >= 1700) | #if defined(_LIBCPP_VERSION) || (_MSC_VER >= 1700) | ||||||
|   | |||||||
| @@ -12,5 +12,6 @@ | |||||||
|  |  | ||||||
| #include "msgpack/v1/adaptor/v4raw_decl.hpp" | #include "msgpack/v1/adaptor/v4raw_decl.hpp" | ||||||
| #include "msgpack/v2/adaptor/v4raw_decl.hpp" | #include "msgpack/v2/adaptor/v4raw_decl.hpp" | ||||||
|  | #include "msgpack/v3/adaptor/v4raw_decl.hpp" | ||||||
|  |  | ||||||
| #endif // MSGPACK_TYPE_V4RAW_DECL_HPP | #endif // MSGPACK_TYPE_V4RAW_DECL_HPP | ||||||
|   | |||||||
							
								
								
									
										15
									
								
								include/msgpack/adaptor/wstring.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								include/msgpack/adaptor/wstring.hpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,15 @@ | |||||||
|  | // | ||||||
|  | // MessagePack for C++ static resolution routine | ||||||
|  | // | ||||||
|  | // Copyright (C) 2018 KONDO Takatoshi | ||||||
|  | // | ||||||
|  | //    Distributed under the Boost Software License, Version 1.0. | ||||||
|  | //    (See accompanying file LICENSE_1_0.txt or copy at | ||||||
|  | //    http://www.boost.org/LICENSE_1_0.txt) | ||||||
|  | // | ||||||
|  | #ifndef MSGPACK_TYPE_WSTRING_HPP | ||||||
|  | #define MSGPACK_TYPE_WSTRING_HPP | ||||||
|  |  | ||||||
|  | #include "msgpack/v1/adaptor/wstring.hpp" | ||||||
|  |  | ||||||
|  | #endif // MSGPACK_TYPE_WSTRING_HPP | ||||||
							
								
								
									
										26
									
								
								include/msgpack/assert.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								include/msgpack/assert.hpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,26 @@ | |||||||
|  | // | ||||||
|  | // MessagePack for C++ static resolution routine | ||||||
|  | // | ||||||
|  | // Copyright (C) 2022 KONDO Takatoshi | ||||||
|  | // | ||||||
|  | //    Distributed under the Boost Software License, Version 1.0. | ||||||
|  | //    (See accompanying file LICENSE_1_0.txt or copy at | ||||||
|  | //    http://www.boost.org/LICENSE_1_0.txt) | ||||||
|  | // | ||||||
|  |  | ||||||
|  | #ifndef MSGPACK_ASSERT_HPP | ||||||
|  | #define MSGPACK_ASSERT_HPP | ||||||
|  |  | ||||||
|  | #if defined(MSGPACK_NO_BOOST) | ||||||
|  |  | ||||||
|  | #include <cassert> | ||||||
|  | #define MSGPACK_ASSERT assert | ||||||
|  |  | ||||||
|  | #else  // defined(MSGPACK_NO_BOOST) | ||||||
|  |  | ||||||
|  | #include <boost/assert.hpp> | ||||||
|  | #define MSGPACK_ASSERT BOOST_ASSERT | ||||||
|  |  | ||||||
|  | #endif // defined(MSGPACK_NO_BOOST) | ||||||
|  |  | ||||||
|  | #endif // MSGPACK_ASSERT_HPP | ||||||
| @@ -12,5 +12,6 @@ | |||||||
|  |  | ||||||
| #include "msgpack/v1/cpp_config_decl.hpp" | #include "msgpack/v1/cpp_config_decl.hpp" | ||||||
| #include "msgpack/v2/cpp_config_decl.hpp" | #include "msgpack/v2/cpp_config_decl.hpp" | ||||||
|  | #include "msgpack/v3/cpp_config_decl.hpp" | ||||||
|  |  | ||||||
| #endif // MSGPACK_CPP_CONFIG_DECL_HPP | #endif // MSGPACK_CPP_CONFIG_DECL_HPP | ||||||
|   | |||||||
							
								
								
									
										18
									
								
								include/msgpack/cpp_version.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								include/msgpack/cpp_version.hpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,18 @@ | |||||||
|  | #ifndef MSGPACK_CPP_VERSION_HPP | ||||||
|  | #define MSGPACK_CPP_VERSION_HPP | ||||||
|  |  | ||||||
|  | #if defined(_MSC_VER) | ||||||
|  | #  if _MSC_VER < 1900 | ||||||
|  | #    define MSGPACK_USE_CPP03 | ||||||
|  | #  endif | ||||||
|  | #elif (__cplusplus < 201103L) | ||||||
|  | #  define MSGPACK_USE_CPP03 | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #if defined(_MSVC_LANG) | ||||||
|  | #  define MSGPACK_CPP_VERSION _MSVC_LANG | ||||||
|  | #else | ||||||
|  | #  define MSGPACK_CPP_VERSION __cplusplus | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #endif // MSGPACK_CPP_VERSION_HPP | ||||||
							
								
								
									
										17
									
								
								include/msgpack/create_object_visitor.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								include/msgpack/create_object_visitor.hpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,17 @@ | |||||||
|  | // | ||||||
|  | // MessagePack for C++ deserializing routine | ||||||
|  | // | ||||||
|  | // Copyright (C) 2018 KONDO Takatoshi | ||||||
|  | // | ||||||
|  | //    Distributed under the Boost Software License, Version 1.0. | ||||||
|  | //    (See accompanying file LICENSE_1_0.txt or copy at | ||||||
|  | //    http://www.boost.org/LICENSE_1_0.txt) | ||||||
|  | // | ||||||
|  | #ifndef MSGPACK_CREATE_OBJECT_VISITOR_HPP | ||||||
|  | #define MSGPACK_CREATE_OBJECT_VISITOR_HPP | ||||||
|  |  | ||||||
|  | #include "msgpack/create_object_visitor_decl.hpp" | ||||||
|  |  | ||||||
|  | #include "msgpack/v2/create_object_visitor.hpp" | ||||||
|  |  | ||||||
|  | #endif // MSGPACK_CREATE_OBJECT_VISITOR_HPP | ||||||
							
								
								
									
										16
									
								
								include/msgpack/create_object_visitor_decl.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								include/msgpack/create_object_visitor_decl.hpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,16 @@ | |||||||
|  | // | ||||||
|  | // MessagePack for C++ deserializing routine | ||||||
|  | // | ||||||
|  | // Copyright (C) 2018 KONDO Takatoshi | ||||||
|  | // | ||||||
|  | //    Distributed under the Boost Software License, Version 1.0. | ||||||
|  | //    (See accompanying file LICENSE_1_0.txt or copy at | ||||||
|  | //    http://www.boost.org/LICENSE_1_0.txt) | ||||||
|  | // | ||||||
|  | #ifndef MSGPACK_CREATE_OBJECT_VISITOR_DECL_HPP | ||||||
|  | #define MSGPACK_CREATE_OBJECT_VISITOR_DECL_HPP | ||||||
|  |  | ||||||
|  | #include "msgpack/v2/create_object_visitor_decl.hpp" | ||||||
|  | #include "msgpack/v3/create_object_visitor_decl.hpp" | ||||||
|  |  | ||||||
|  | #endif // MSGPACK_CREATE_OBJECT_VISITOR_DECL_HPP | ||||||
| @@ -1,38 +0,0 @@ | |||||||
| /* |  | ||||||
|  * MessagePack for C FILE* buffer adaptor |  | ||||||
|  * |  | ||||||
|  * Copyright (C) 2013 Vladimir Volodko |  | ||||||
|  * |  | ||||||
|  *    Distributed under the Boost Software License, Version 1.0. |  | ||||||
|  *    (See accompanying file LICENSE_1_0.txt or copy at |  | ||||||
|  *    http://www.boost.org/LICENSE_1_0.txt) |  | ||||||
|  */ |  | ||||||
| #ifndef MSGPACK_FBUFFER_H |  | ||||||
| #define MSGPACK_FBUFFER_H |  | ||||||
|  |  | ||||||
| #include <stdio.h> |  | ||||||
|  |  | ||||||
| #ifdef __cplusplus |  | ||||||
| extern "C" { |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @defgroup msgpack_fbuffer FILE* buffer |  | ||||||
|  * @ingroup msgpack_buffer |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| static inline int msgpack_fbuffer_write(void* data, const char* buf, size_t len) |  | ||||||
| { |  | ||||||
|     return (len == fwrite(buf, len, 1, (FILE *)data)) ? 0 : -1; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /** @} */ |  | ||||||
|  |  | ||||||
|  |  | ||||||
| #ifdef __cplusplus |  | ||||||
| } |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| #endif /* msgpack/fbuffer.h */ |  | ||||||
| @@ -12,5 +12,6 @@ | |||||||
|  |  | ||||||
| #include "msgpack/v1/fbuffer_decl.hpp" | #include "msgpack/v1/fbuffer_decl.hpp" | ||||||
| #include "msgpack/v2/fbuffer_decl.hpp" | #include "msgpack/v2/fbuffer_decl.hpp" | ||||||
|  | #include "msgpack/v3/fbuffer_decl.hpp" | ||||||
|  |  | ||||||
| #endif // MSGPACK_FBUFFER_DECL_HPP | #endif // MSGPACK_FBUFFER_DECL_HPP | ||||||
|   | |||||||
| @@ -1,25 +0,0 @@ | |||||||
| /* |  | ||||||
|  *    Distributed under the Boost Software License, Version 1.0. |  | ||||||
|  *    (See accompanying file LICENSE_1_0.txt or copy at |  | ||||||
|  *    http://www.boost.org/LICENSE_1_0.txt) |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef MSGPACK_GCC_ATOMIC_H |  | ||||||
| #define MSGPACK_GCC_ATOMIC_H |  | ||||||
|  |  | ||||||
| #if defined(__cplusplus) |  | ||||||
| extern "C" { |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| typedef int _msgpack_atomic_counter_t; |  | ||||||
|  |  | ||||||
| int _msgpack_sync_decr_and_fetch(volatile _msgpack_atomic_counter_t* ptr); |  | ||||||
| int _msgpack_sync_incr_and_fetch(volatile _msgpack_atomic_counter_t* ptr); |  | ||||||
|  |  | ||||||
|  |  | ||||||
| #if defined(__cplusplus) |  | ||||||
| } |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
|  |  | ||||||
| #endif // MSGPACK_GCC_ATOMIC_H |  | ||||||
| @@ -13,7 +13,6 @@ | |||||||
|  |  | ||||||
| #if defined(__GNUC__) && ((__GNUC__*10 + __GNUC_MINOR__) < 41) | #if defined(__GNUC__) && ((__GNUC__*10 + __GNUC_MINOR__) < 41) | ||||||
|  |  | ||||||
| #include "msgpack/gcc_atomic.h" |  | ||||||
| #include <bits/atomicity.h> | #include <bits/atomicity.h> | ||||||
|  |  | ||||||
| int _msgpack_sync_decr_and_fetch(volatile _msgpack_atomic_counter_t* ptr) | int _msgpack_sync_decr_and_fetch(volatile _msgpack_atomic_counter_t* ptr) | ||||||
|   | |||||||
| @@ -11,8 +11,8 @@ | |||||||
| #ifndef MSGPACK_ITERATOR_HPP | #ifndef MSGPACK_ITERATOR_HPP | ||||||
| #define MSGPACK_ITERATOR_HPP | #define MSGPACK_ITERATOR_HPP | ||||||
|  |  | ||||||
| #include <msgpack/iterator_decl.hpp> | #include "msgpack/iterator_decl.hpp" | ||||||
|  |  | ||||||
| #include <msgpack/v1/iterator.hpp> | #include "msgpack/v1/iterator.hpp" | ||||||
|  |  | ||||||
| #endif // MSGPACK_ITERATOR_HPP | #endif // MSGPACK_ITERATOR_HPP | ||||||
|   | |||||||
| @@ -11,7 +11,8 @@ | |||||||
| #ifndef MSGPACK_ITERATOR_DECL_HPP | #ifndef MSGPACK_ITERATOR_DECL_HPP | ||||||
| #define MSGPACK_ITERATOR_DECL_HPP | #define MSGPACK_ITERATOR_DECL_HPP | ||||||
|  |  | ||||||
| #include <msgpack/v1/iterator_decl.hpp> | #include "msgpack/v1/iterator_decl.hpp" | ||||||
| #include <msgpack/v2/iterator_decl.hpp> | #include "msgpack/v2/iterator_decl.hpp" | ||||||
|  | #include "msgpack/v3/iterator_decl.hpp" | ||||||
|  |  | ||||||
| #endif // MSGPACK_V1_ITERATOR_DECL_HPP | #endif // MSGPACK_ITERATOR_DECL_HPP | ||||||
|   | |||||||
| @@ -13,5 +13,6 @@ | |||||||
|  |  | ||||||
| #include "msgpack/v1/meta_decl.hpp" | #include "msgpack/v1/meta_decl.hpp" | ||||||
| #include "msgpack/v2/meta_decl.hpp" | #include "msgpack/v2/meta_decl.hpp" | ||||||
|  | #include "msgpack/v3/meta_decl.hpp" | ||||||
|  |  | ||||||
| #endif // MSGPACK_META_DECL_HPP | #endif // MSGPACK_META_DECL_HPP | ||||||
|   | |||||||
							
								
								
									
										17
									
								
								include/msgpack/null_visitor.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								include/msgpack/null_visitor.hpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,17 @@ | |||||||
|  | // | ||||||
|  | // MessagePack for C++ deserializing routine | ||||||
|  | // | ||||||
|  | // Copyright (C) 2018 KONDO Takatoshi | ||||||
|  | // | ||||||
|  | //    Distributed under the Boost Software License, Version 1.0. | ||||||
|  | //    (See accompanying file LICENSE_1_0.txt or copy at | ||||||
|  | //    http://www.boost.org/LICENSE_1_0.txt) | ||||||
|  | // | ||||||
|  | #ifndef MSGPACK_NULL_VISITOR_HPP | ||||||
|  | #define MSGPACK_NULL_VISITOR_HPP | ||||||
|  |  | ||||||
|  | #include "msgpack/null_visitor_decl.hpp" | ||||||
|  |  | ||||||
|  | #include "msgpack/v2/null_visitor.hpp" | ||||||
|  |  | ||||||
|  | #endif // MSGPACK_NULL_VISITOR_HPP | ||||||
							
								
								
									
										16
									
								
								include/msgpack/null_visitor_decl.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								include/msgpack/null_visitor_decl.hpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,16 @@ | |||||||
|  | // | ||||||
|  | // MessagePack for C++ deserializing routine | ||||||
|  | // | ||||||
|  | // Copyright (C) 2018 KONDO Takatoshi | ||||||
|  | // | ||||||
|  | //    Distributed under the Boost Software License, Version 1.0. | ||||||
|  | //    (See accompanying file LICENSE_1_0.txt or copy at | ||||||
|  | //    http://www.boost.org/LICENSE_1_0.txt) | ||||||
|  | // | ||||||
|  | #ifndef MSGPACK_NULL_VISITOR_DECL_HPP | ||||||
|  | #define MSGPACK_NULL_VISITOR_DECL_HPP | ||||||
|  |  | ||||||
|  | #include "msgpack/v2/null_visitor_decl.hpp" | ||||||
|  | #include "msgpack/v3/null_visitor_decl.hpp" | ||||||
|  |  | ||||||
|  | #endif // MSGPACK_NULL_VISITOR_DECL_HPP | ||||||
| @@ -1,116 +0,0 @@ | |||||||
| /* |  | ||||||
|  * MessagePack for C dynamic typing routine |  | ||||||
|  * |  | ||||||
|  * Copyright (C) 2008-2009 FURUHASHI Sadayuki |  | ||||||
|  * |  | ||||||
|  *    Distributed under the Boost Software License, Version 1.0. |  | ||||||
|  *    (See accompanying file LICENSE_1_0.txt or copy at |  | ||||||
|  *    http://www.boost.org/LICENSE_1_0.txt) |  | ||||||
|  */ |  | ||||||
| #ifndef MSGPACK_OBJECT_H |  | ||||||
| #define MSGPACK_OBJECT_H |  | ||||||
|  |  | ||||||
| #include "zone.h" |  | ||||||
| #include <stdio.h> |  | ||||||
|  |  | ||||||
| #ifdef __cplusplus |  | ||||||
| extern "C" { |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @defgroup msgpack_object Dynamically typed object |  | ||||||
|  * @ingroup msgpack |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| typedef enum { |  | ||||||
|     MSGPACK_OBJECT_NIL                  = 0x00, |  | ||||||
|     MSGPACK_OBJECT_BOOLEAN              = 0x01, |  | ||||||
|     MSGPACK_OBJECT_POSITIVE_INTEGER     = 0x02, |  | ||||||
|     MSGPACK_OBJECT_NEGATIVE_INTEGER     = 0x03, |  | ||||||
|     MSGPACK_OBJECT_FLOAT32              = 0x0a, |  | ||||||
|     MSGPACK_OBJECT_FLOAT64              = 0x04, |  | ||||||
|     MSGPACK_OBJECT_FLOAT                = 0x04, |  | ||||||
| #if defined(MSGPACK_USE_LEGACY_NAME_AS_FLOAT) |  | ||||||
|     MSGPACK_OBJECT_DOUBLE               = MSGPACK_OBJECT_FLOAT, /* obsolete */ |  | ||||||
| #endif /* MSGPACK_USE_LEGACY_NAME_AS_FLOAT */ |  | ||||||
|     MSGPACK_OBJECT_STR                  = 0x05, |  | ||||||
|     MSGPACK_OBJECT_ARRAY                = 0x06, |  | ||||||
|     MSGPACK_OBJECT_MAP                  = 0x07, |  | ||||||
|     MSGPACK_OBJECT_BIN                  = 0x08, |  | ||||||
|     MSGPACK_OBJECT_EXT                  = 0x09 |  | ||||||
| } msgpack_object_type; |  | ||||||
|  |  | ||||||
|  |  | ||||||
| struct msgpack_object; |  | ||||||
| struct msgpack_object_kv; |  | ||||||
|  |  | ||||||
| typedef struct { |  | ||||||
|     uint32_t size; |  | ||||||
|     struct msgpack_object* ptr; |  | ||||||
| } msgpack_object_array; |  | ||||||
|  |  | ||||||
| typedef struct { |  | ||||||
|     uint32_t size; |  | ||||||
|     struct msgpack_object_kv* ptr; |  | ||||||
| } msgpack_object_map; |  | ||||||
|  |  | ||||||
| typedef struct { |  | ||||||
|     uint32_t size; |  | ||||||
|     const char* ptr; |  | ||||||
| } msgpack_object_str; |  | ||||||
|  |  | ||||||
| typedef struct { |  | ||||||
|     uint32_t size; |  | ||||||
|     const char* ptr; |  | ||||||
| } msgpack_object_bin; |  | ||||||
|  |  | ||||||
| typedef struct { |  | ||||||
|     int8_t type; |  | ||||||
|     uint32_t size; |  | ||||||
|     const char* ptr; |  | ||||||
| } msgpack_object_ext; |  | ||||||
|  |  | ||||||
| typedef union { |  | ||||||
|     bool boolean; |  | ||||||
|     uint64_t u64; |  | ||||||
|     int64_t  i64; |  | ||||||
| #if defined(MSGPACK_USE_LEGACY_NAME_AS_FLOAT) |  | ||||||
|     double   dec; /* obsolete*/ |  | ||||||
| #endif /* MSGPACK_USE_LEGACY_NAME_AS_FLOAT */ |  | ||||||
|     double   f64; |  | ||||||
|     msgpack_object_array array; |  | ||||||
|     msgpack_object_map map; |  | ||||||
|     msgpack_object_str str; |  | ||||||
|     msgpack_object_bin bin; |  | ||||||
|     msgpack_object_ext ext; |  | ||||||
| } msgpack_object_union; |  | ||||||
|  |  | ||||||
| typedef struct msgpack_object { |  | ||||||
|     msgpack_object_type type; |  | ||||||
|     msgpack_object_union via; |  | ||||||
| } msgpack_object; |  | ||||||
|  |  | ||||||
| typedef struct msgpack_object_kv { |  | ||||||
|     msgpack_object key; |  | ||||||
|     msgpack_object val; |  | ||||||
| } msgpack_object_kv; |  | ||||||
|  |  | ||||||
| MSGPACK_DLLEXPORT |  | ||||||
| void msgpack_object_print(FILE* out, msgpack_object o); |  | ||||||
|  |  | ||||||
| MSGPACK_DLLEXPORT |  | ||||||
| int msgpack_object_print_buffer(char *buffer, size_t buffer_size, msgpack_object o); |  | ||||||
|  |  | ||||||
| MSGPACK_DLLEXPORT |  | ||||||
| bool msgpack_object_equal(const msgpack_object x, const msgpack_object y); |  | ||||||
|  |  | ||||||
| /** @} */ |  | ||||||
|  |  | ||||||
|  |  | ||||||
| #ifdef __cplusplus |  | ||||||
| } |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| #endif /* msgpack/object.h */ |  | ||||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user