diff --git a/.gitignore b/.gitignore
index d5acdb6154..1a834f299e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -24,3 +24,5 @@ contents.xcworkspacedata
profile
Builds/VisualStudio2012/Debug
Builds/VisualStudio2012/Release
+
+modules/beast_cryptopp
diff --git a/Builds/VisualStudio2012/Beast.props b/Builds/VisualStudio2012/Beast.props
index 2428672bea..792f3409ca 100644
--- a/Builds/VisualStudio2012/Beast.props
+++ b/Builds/VisualStudio2012/Beast.props
@@ -1,16 +1,22 @@
-
+
+ ..\..
+
Level4
- _CRTDBG_MAP_ALLOC;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions)
+ BEAST_COMPILING_STATIC_LIBARARY=1;_CRTDBG_MAP_ALLOC;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions)
true
false
- %(AdditionalIncludeDirectories)
+ $(RepoDir)\config;%(AdditionalIncludeDirectories)
-
+
+
+ $(RepoDir)
+
+
\ No newline at end of file
diff --git a/Builds/VisualStudio2012/beast.vcxproj b/Builds/VisualStudio2012/beast.vcxproj
index 422e763b14..455746b304 100644
--- a/Builds/VisualStudio2012/beast.vcxproj
+++ b/Builds/VisualStudio2012/beast.vcxproj
@@ -21,6 +21,17 @@
+
+
+
+
+
+
+
+
+
+
+
@@ -29,31 +40,31 @@
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
@@ -67,28 +78,130 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
@@ -97,10 +210,11 @@
+
+
+
-
-
@@ -127,174 +241,108 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -302,15 +350,14 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -323,11 +370,13 @@
-
+
+
+
-
+
-
+
@@ -351,16 +400,192 @@
-
-
+
+
+
true
true
true
true
-
+
+ true
+ true
+ true
+ true
+
+
+
+ true
+ true
+ true
+ true
+
+
+ true
+ true
+ true
+ true
+
+
+ true
+ true
+ true
+ true
+
+
+ true
+ true
+ true
+ true
+
+
+
+ true
+ true
+ true
+ true
+
+
+ true
+ true
+ true
+ true
+
+
+ true
+ true
+ true
+ true
+
+
+ true
+ true
+ true
+ true
+
+
+ true
+ true
+ true
+ true
+
+
+ true
+ true
+ true
+ true
+
+
+ true
+ true
+ true
+ true
+
+
+ true
+ true
+ true
+ true
+
+
+ true
+ true
+ true
+ true
+
+
+
+
+ true
+ true
+ true
+ true
+
+
+ true
+ true
+ true
+ true
+
+
+
+ true
+ true
+ true
+ true
+
+
+ true
+ true
+ true
+ true
+
+
+ true
+ true
+ true
+ true
+
+
+ true
+ true
+ true
+ true
+
+
+ true
+ true
+ true
+ true
+
+
+ true
+ true
+ true
+ true
+
+
+
+ true
+ true
+ true
+ true
+
+
+ true
+ true
+ true
+ true
+
+
+ true
+ true
+ true
+ true
+
+
+ true
+ true
+ true
+ true
+
+
+ true
+ true
+ true
+ true
+
+
+ true
+ true
+ true
+ true
+
+
+
true
true
true
@@ -407,30 +632,36 @@
true
true
+
+ true
+ true
+ true
+ true
+
+
+ true
+ true
+ true
+ true
+
true
true
true
true
+
+ true
+ true
+ true
+ true
+
true
true
true
true
-
- true
- true
- true
- true
-
-
- true
- true
- true
- true
-
true
true
@@ -510,431 +741,359 @@
true
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
- true
- true
-
-
- true
- true
- true
- true
-
-
- true
- true
- true
- true
-
-
- true
- true
- true
- true
-
-
- true
- true
- true
- true
-
-
- true
- true
-
-
- true
- true
- true
- true
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
- true
- true
- true
- true
-
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
- true
- true
- true
- true
-
-
- true
- true
- true
- true
-
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
- true
true
- true
-
-
- true
true
- true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
- true
- true
- true
- true
-
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
- true
- true
- true
- true
-
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
@@ -952,169 +1111,85 @@
true
true
-
+
true
true
true
true
-
- true
- true
- true
- true
-
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
- true
- true
- true
- true
-
-
+
true
true
true
true
-
+
true
true
true
true
-
- true
- true
- true
- true
-
-
- true
- true
- true
- true
-
-
- true
- true
- true
- true
-
-
+
true
true
true
true
-
- true
- true
- true
- true
-
-
- true
- true
- true
- true
-
-
- true
- true
- true
- true
-
-
- true
- true
- true
- true
-
-
- true
- true
- true
- true
-
-
- true
- true
- true
- true
-
-
- true
- true
- true
- true
-
-
- true
- true
- true
- true
-
-
- true
- true
- true
- true
-
-
+
true
true
true
@@ -1126,55 +1201,49 @@
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
+
true
true
true
true
-
- true
- true
- true
- true
-
-
+
true
true
true
@@ -1247,14 +1316,20 @@
true
-
+
+ true
+ true
+ true
+ true
+
+
true
true
true
true
-
+
true
true
true
diff --git a/Builds/VisualStudio2012/beast.vcxproj.filters b/Builds/VisualStudio2012/beast.vcxproj.filters
index a10f8600c3..077df7635a 100644
--- a/Builds/VisualStudio2012/beast.vcxproj.filters
+++ b/Builds/VisualStudio2012/beast.vcxproj.filters
@@ -1,24 +1,19 @@
-
-
-
- beast_core
-
-
+
beast_core\native
-
+
beast_core\native
-
+
beast_core\native
-
+
beast_core\native
-
+
beast_core\native
@@ -27,9 +22,60 @@
beast_core\native\java
-
-
-
+
+ _meta
+
+
+ _meta
+
+
+ _meta
+
+
+ _meta
+
+
+ _meta
+
+
+ beast\http\impl\http-parser
+
+
+ beast\http\impl\http-parser
+
+
+ beast\http\impl\http-parser
+
+
+ beast\http\impl\http-parser
+
+
+ beast\http\impl\http-parser
+
+
+ beast\http\impl\http-parser
+
+
+ beast\http\impl\http-parser
+
+
+ beast\http\impl\http-parser
+
+
+ beast\http\impl\http-parser
+
+
+ beast_core
+
+
+ beast\crypto\impl\sha2
+
+
+ beast\crypto\impl\sha2
+
+
+ scripts
+
@@ -149,17 +195,20 @@
{91538dcf-b219-4c80-9861-bb4949089775}
-
- {5df65855-1ccd-4997-97c1-f9788924ee2b}
-
{2f5b95a8-1adf-4319-8464-ddc2b2e03f0b}
{bf498396-2e1f-4903-be68-3053ba439af5}
-
- {08ec13ba-4058-4ad7-afbb-cbb1c6e2fc4a}
+
+ {c0724499-ab69-40c3-90e2-65242dbd2eaa}
+
+
+ {f7252567-a5bb-4be2-bbd0-c9d9b62298de}
+
+
+ {27052a76-e315-4725-9d9a-1233c7d71aba}
{92d1bb42-289a-4444-85c7-cb87540f2fff}
@@ -170,300 +219,306 @@
{5904368f-a0f2-4d26-a031-8cbe4448dc3f}
-
- {ac367054-ddbf-4118-a41a-07bea34d32c8}
+
+ {5faa76ea-5691-4e63-8833-577f92991356}
-
- {c0724499-ab69-40c3-90e2-65242dbd2eaa}
+
+ {93670bc9-a748-42bd-8118-8de30c468b16}
-
- {f7252567-a5bb-4be2-bbd0-c9d9b62298de}
+
+ {85158eb2-9340-4b3d-a136-f7631c7f1b7c}
+
+
+ {56d34c67-7027-44ba-9f09-4591ce4afb36}
+
+
+ {775ab0d6-aa5f-43d7-ab3b-3c01652a9ef1}
+
+
+ {56ef157f-ad92-4da7-8fbf-00723f769732}
+
+
+ {565f012b-42b7-42c9-81b7-9e93aa378000}
+
+
+ {7eead15d-f9dc-4b4d-a653-57d9c090e697}
+
+
+ {233e3c4d-e398-4c11-a42c-3483107eb8e9}
+
+
+ {8d80e304-a42d-411a-9528-811eddff3191}
+
+
+ {eabf472c-e198-409a-a65b-7c087ae911d0}
+
+
+ {1fff3bd8-44ae-41df-8dd4-8bb6f07b2908}
+
+
+ {9c1ef4c4-5623-4500-859f-12d6ce5ae362}
+
+
+ {fc3d3f14-9ba1-43e4-b086-cbbd2f63b944}
+
+
+ {44489531-f44a-439a-a6ea-d32c252b1e8b}
+
+
+ {57dc7059-cbb2-437c-9c52-79825d9a4cf5}
+
+
+ {39886e0f-1607-4b7a-81cf-011d83dadee3}
+
+
+ {c65af439-8c23-46c3-9b95-7da15651e5f6}
+
+
+ {8d88283b-24ec-49ca-a94b-cb6271bc14f9}
+
+
+ {38c81e1f-f831-4632-af45-6340683f3346}
+
+
+ {7243e5e5-ad7e-4d81-8444-d545919e850c}
+
+
+ {4e9c54da-1581-41d7-ac75-48140e4a13d4}
+
+
+ {f864ff58-1055-4c56-805f-9f181c4f0aa1}
+
+
+ {386a8cd8-6be3-4cac-9bca-7a01fdb5327a}
+
+
+ {b116764e-1ad5-4854-a549-73c5beb5ae37}
+
+
+ {d7ec873a-d1e7-4341-9d20-a1be8f8ddd88}
beast_core
-
+
beast_core\containers
-
+
beast_core\containers
-
+
beast_core\containers
-
+
beast_core\containers
-
+
beast_core\containers
-
+
beast_core\containers
-
+
beast_core\containers
-
+
beast_core\containers
-
+
beast_core\containers
-
+
beast_core\containers
-
+
beast_core\containers
-
+
beast_core\containers
-
+
beast_core\containers
-
+
beast_core\files
-
+
beast_core\files
-
+
beast_core\files
-
+
beast_core\files
-
+
beast_core\files
-
+
beast_core\files
-
+
beast_core\files
-
+
beast_core\json
-
+
beast_core\logging
-
+
beast_core\logging
-
+
beast_core\maths
-
+
beast_core\maths
-
+
beast_core\maths
-
+
beast_core\maths
-
- beast_core\maths
-
-
+
beast_core\memory
-
+
beast_core\memory
-
+
beast_core\memory
-
- beast_core\memory
-
-
- beast_core\memory
-
-
- beast_core\memory
-
-
- beast_core\memory
-
-
- beast_core\memory
-
-
+
beast_core\misc
-
+
beast_core\misc
-
+
beast_core\misc
-
+
beast_core\native
-
+
beast_core\native
-
+
beast_core\native
-
+
beast_core\native
-
+
beast_core\native
-
+
beast_core\network
-
+
beast_core\network
-
+
beast_core\network
-
+
beast_core\network
-
- beast_core\network
-
-
+
beast_core\streams
-
+
beast_core\streams
-
+
beast_core\streams
-
+
beast_core\streams
-
+
beast_core\streams
-
+
beast_core\streams
-
+
beast_core\streams
-
+
beast_core\streams
-
+
beast_core\text
-
+
beast_core\text
-
+
beast_core\text
-
+
beast_core\text
-
+
beast_core\text
-
+
beast_core\text
-
- beast_core\text
-
-
- beast_core\text
-
-
- beast_core\text
-
-
- beast_core\text
-
-
- beast_core\text
-
-
- beast_core\text
-
-
- beast_core\text
-
-
+
beast_core\threads
-
+
beast_core\threads
-
+
beast_core\threads
-
+
beast_core\threads
-
+
beast_core\threads
-
+
beast_core\threads
-
+
beast_core\threads
-
+
beast_core\threads
-
+
beast_core\threads
-
+
beast_core\threads
-
- beast_core\threads
-
-
- beast_core\threads
-
-
- beast_core\threads
-
-
- beast_core\threads
-
-
- beast_core\threads
-
-
- beast_core\threads
-
-
+
beast_core\time
-
+
beast_core\time
-
- beast_core\time
-
-
+
beast_core\xml
-
+
beast_core\xml
-
+
beast_core\zip
-
+
beast_core\zip
-
+
beast_core\zip
@@ -499,98 +554,61 @@
beast_core\zip\zlib
-
-
+
beast_core\memory
-
+
beast_core\memory
-
+
beast_core\memory
-
+
beast_core\memory
-
+
beast_core\memory
-
+
beast_core\memory
-
+
beast_core\containers
-
- beast_core\containers
-
-
+
beast_core\threads
-
- beast_core\memory
-
-
- beast_core\containers
-
-
- beast_core\containers
-
-
+
beast_core\diagnostic
-
+
beast_core\diagnostic
-
- beast_core\diagnostic
-
-
- beast_core\diagnostic
-
-
- beast_core\diagnostic
-
-
- beast_core\diagnostic
-
-
- beast_core\memory
-
-
- beast_core\memory
-
-
+
beast_core\maths
-
- beast_core\time
-
-
+
beast_core\diagnostic
-
- beast_crypto\math
-
beast_crypto
-
+
beast_core\containers
-
+
beast_core\files
-
+
beast_core\diagnostic
-
+
beast_core\memory
beast_db
-
+
beast_db\keyvalue
@@ -662,42 +680,21 @@
beast_sqdb\detail
-
+
beast_core\maths
-
- beast_core\diagnostic
-
-
- beast_core\misc
-
-
+
beast_core\text
-
+
beast_core\diagnostic
-
- beast_core\diagnostic
-
-
+
beast_core\maths
-
- beast_core\memory
-
-
- beast_core\memory
-
beast_core\diagnostic
-
- beast_core\threads
-
-
- beast_core\threads
-
beast_core\thread
@@ -719,72 +716,18 @@
beast_core\thread\impl
-
+
beast_core\thread
-
+
beast_core\thread
-
+
beast_core\thread
-
- beast_core\thread
-
-
- beast_core\thread
-
-
- beast_core\thread
-
-
- beast_core\thread
-
-
- beast_core\thread
-
-
- beast_core\thread
-
-
- beast_core\thread
-
-
- beast_core\thread
-
-
- beast_core\thread
-
-
- beast_core\thread
-
-
+
beast_core\maths
-
- beast_core\functional
-
-
- beast_core\memory
-
-
- beast_core\memory
-
-
- beast_core\memory
-
-
- beast_core\memory
-
-
- beast_core\memory
-
-
- beast_core\memory
-
-
- beast_core\memory
-
beast_asio\sockets
@@ -797,7 +740,7 @@
beast_asio\system
-
+
beast_extras\traits
@@ -812,51 +755,15 @@
beast_core\system
-
- beast_core\system
-
beast_core\system
-
- beast_core\system
-
-
- beast_core\system
-
beast_core\system
beast_core\system
-
- beast_core\system
-
-
- beast_core\containers
-
-
- beast_core\containers
-
-
- beast_core\containers
-
-
- beast_core\containers
-
-
- beast_core\containers\detail
-
-
- beast_core\containers\detail
-
-
- beast_core\text
-
-
- beast_core\text
-
beast\intrusive
@@ -878,24 +785,9 @@
beast\mpl
-
- beast
-
beast\mpl
-
- beast_core\memory
-
-
- beast_core\memory
-
-
- beast_core\diagnostic
-
-
- beast_asio\parsehttp
-
beast_asio\async
@@ -986,12 +878,6 @@
beast_asio\protocol
-
- beast_core\functional
-
-
- beast_asio\basics
-
beast_asio\http
@@ -1016,228 +902,544 @@
beast_asio\http
-
- beast_asio\http
-
beast\mpl
beast_asio\basics
-
+
+ beast_core\memory
+
+
+ beast_core\time
+
+
+ beast_core\misc
+
+
+ beast_core\diagnostic
+
+
+ beast_crypto\math
+
+
+ beast_crypto\math
+
+
+ beast_crypto\math
+
+
+ beast_core\memory
+
+
+ beast\net
+
+
+ beast
+
+
+ beast
+
+
+ beast
+
+
+ beast
+
+
+ beast
+
+
+ beast\type_traits
+
+
+ beast\type_traits
+
+
+ beast\type_traits
+
+
+ beast\type_traits
+
+
+ beast\utility
+
+
+ beast\utility
+
+
+ beast
+
+
+ beast\mpl
+
+
+ beast
+
+
+ beast_asio\http
+
+
+ beast_asio\async
+
+
beast_asio\basics
+
+ beast
+
+
+ beast
+
+
+ beast\intrusive
+
+
+ beast\intrusive
+
+
+ beast\mpl
+
+
+ beast\http\impl\http-parser
+
+
+ beast
+
+
+ beast\strings
+
+
+ beast\strings
+
+
+ beast\strings
+
+
+ beast\strings
+
+
+ beast\strings
+
+
+ beast\strings
+
+
+ beast\strings
+
+
+ beast\strings
+
+
+ beast\strings
+
+
+ beast
+
+
+ beast\config
+
+
+ beast\config
+
+
+ beast\config
+
+
+ beast
+
+
+ beast\config
+
+
+ beast\config
+
+
+ beast
+
+
+ beast
+
+
+ beast
+
+
+ beast
+
+
+ beast
+
+
+ beast_core\system
+
+
+ beast\http
+
+
+ beast\http
+
+
+ beast
+
+
+ beast\intrusive
+
+
+ beast
+
+
+ beast\crypto\impl\sha2
+
+
+ beast\crypto
+
+
+ beast_asio\async
+
+
+ beast_asio\async
+
+
+ beast
+
+
+ beast\chrono
+
+
+ beast
+
+
+
+ beast\utility
+
+
+ beast\utility
+
+
+ beast\config\compiler
+
+
+ beast\config\compiler
+
+
+ beast\config\compiler
+
+
+ beast\config\compiler
+
+
+ beast\config\platform
+
+
+ beast\config\platform
+
+
+ beast\config\platform
+
+
+ beast\config\platform
+
+
+ beast\config\platform
+
+
+ beast\config
+
+
+ beast\config
+
+
+ beast\config
+
+
+ beast\smart_ptr
+
+
+ beast\smart_ptr
+
+
+ beast
+
+
+ beast\net
+
+
+ beast\net
+
+
+ beast_asio\http
+
+
+ beast_asio\http
+
+
+ beast\chrono
+
+
+ beast\chrono
+
+
+ beast\smart_ptr
+
+
+ beast\smart_ptr
+
+
+ beast
+
+
+ beast\threads
+
+
+ beast\threads
+
+
+ beast\threads
+
+
+ beast\threads
+
+
+ beast\threads
+
+
+ beast\threads
+
+
+ beast\threads
+
+
+ beast\threads
+
+
+ beast\threads
+
+
+ beast\threads
+
+
+ beast\threads
+
+
+ beast\threads
+
+
+ beast\utility
+
+
+ beast\utility
+
+
+ beast\threads
+
+
+ beast\threads\detail
+
+
+ beast\threads\detail
+
+
+ beast\boost
+
+
+ beast
+
+
+ beast\utility
+
+
+ beast\threads
+
+
+ beast\utility
+
-
- beast_core
-
-
+
beast_core\containers
-
+
beast_core\containers
-
+
beast_core\containers
-
+
beast_core\containers
-
+
beast_core\containers
-
+
beast_core\files
-
+
beast_core\files
-
+
beast_core\files
-
+
beast_core\files
-
+
beast_core\files
-
+
beast_core\files
-
+
beast_core\json
-
+
beast_core\logging
-
+
beast_core\logging
-
+
beast_core\maths
-
+
beast_core\maths
-
+
beast_core\maths
-
+
beast_core\memory
-
+
beast_core\misc
-
+
beast_core\misc
-
+
beast_core\native
-
+
beast_core\native
-
+
beast_core\native
-
+
beast_core\native
-
+
beast_core\native
-
+
beast_core\native
-
+
beast_core\native
-
+
beast_core\native
-
+
beast_core\native
-
+
beast_core\native
-
+
beast_core\native
-
+
beast_core\native
-
+
beast_core\native
-
+
beast_core\native
-
+
beast_core\native
-
+
beast_core\network
-
+
beast_core\network
-
+
beast_core\network
-
+
beast_core\network
-
- beast_core\network
-
-
+
beast_core\streams
-
+
beast_core\streams
-
+
beast_core\streams
-
+
beast_core\streams
-
+
beast_core\streams
-
+
beast_core\streams
-
+
beast_core\streams
-
+
beast_core\text
-
+
beast_core\text
-
+
beast_core\text
-
+
beast_core\text
-
+
beast_core\text
-
+
beast_core\text
-
- beast_core\text
-
-
- beast_core\text
-
-
+
beast_core\threads
-
+
beast_core\threads
-
+
beast_core\threads
-
- beast_core\threads
-
-
- beast_core\threads
-
-
- beast_core\threads
-
-
+
beast_core\time
-
+
beast_core\time
-
- beast_core\time
-
-
+
beast_core\xml
-
+
beast_core\xml
-
+
beast_core\zip
-
+
beast_core\zip
-
+
beast_core\zip
@@ -1273,61 +1475,43 @@
beast_core\zip\zlib
-
+
beast_core\native
-
+
beast_core\native
-
+
beast_core\native
-
+
beast_core\native
-
+
beast_core\diagnostic
-
- beast_core\diagnostic
-
-
- beast_core\diagnostic
-
-
- beast_core\diagnostic
-
-
+
beast_core\threads
-
+
beast_core\native
-
+
beast_core\native
-
- beast_core\time
-
-
+
beast_core\diagnostic
-
- beast_crypto
-
-
- beast_crypto\math
-
-
+
beast_core\files
-
+
beast_core\diagnostic
beast_db
-
+
beast_db\keyvalue
@@ -1375,102 +1559,36 @@
beast_sqdb\source
-
+
beast_core\maths
-
- beast_core\diagnostic
-
-
- beast_core\misc
-
-
+
beast_core\text
-
+
beast_core\diagnostic
-
- beast_core\diagnostic
-
-
- beast_asio
-
-
- beast_core\threads
-
beast_core\thread\impl
-
+
beast_core\thread
-
+
beast_core\thread
-
+
beast_core\thread
-
- beast_core\thread
-
-
- beast_core\thread
-
-
- beast_core\thread
-
-
- beast_core\thread
-
-
- beast_core\thread
-
-
- beast_core\thread
-
-
- beast_core\thread
-
-
- beast_core\thread
-
-
- beast_core\memory
-
-
- beast_core\memory
-
-
- beast_core\memory
-
-
- beast_core\memory
-
beast_asio\basics
-
- beast_extras
-
beast_core\system
beast_core\system
-
- beast_core\containers
-
-
- beast_core\containers
-
-
- beast_core\containers
-
-
- beast_asio\parsehttp
-
beast_asio\async
@@ -1516,9 +1634,6 @@
beast_asio\protocol
-
- beast_asio\basics
-
beast_asio\http
@@ -1540,11 +1655,160 @@
beast_asio\http
-
+
+ beast_crypto
+
+
+ beast_core
+
+
+ beast_asio
+
+
+ beast_core\time
+
+
+ beast_core\misc
+
+
+ beast_core\diagnostic
+
+
+ beast_crypto\math
+
+
+ beast_crypto\math
+
+
+ beast_extras
+
+
+ beast\net\impl
+
+
+ beast\net
+
+
+ beast\utility
+
+
+ beast\utility\impl
+
+
beast_asio\http
+
+ beast\http\impl\http-parser
+
+
+ beast\http\impl\http-parser
+
+
+ beast\http\impl\http-parser\contrib
+
+
+ beast\http\impl\http-parser\contrib
+
+
+ beast\http
+
+
+ beast\http\impl
+
+
+ beast\strings\impl
+
+
+ beast\strings\impl
+
+
+ beast\strings
+
+
+ beast\http\impl
+
+
+ beast\http\impl
+
+
+ beast\crypto\impl\sha2
+
+
+ beast\crypto\impl\sha2
+
+
+ beast\crypto\impl\sha2
+
+
+ beast\crypto
+
+
+ beast\crypto\impl
+
+
+ beast\chrono\impl
+
+
+ beast\chrono
+
+
+ beast\utility\impl
+
+
+ beast\utility\impl
+
+
+ beast\net\impl
+
+
+ beast_asio\http
+
+
+ beast_asio\http
+
+
+ beast\chrono\impl
+
+
+ beast\smart_ptr
+
+
+ beast\threads\impl
+
+
+ beast\threads\impl
+
+
+ beast\threads\impl
+
+
+ beast\threads\impl
+
+
+ beast\threads
+
+
+ beast\threads\impl
+
+
+ beast\utility\impl
+
+
+ beast\utility\impl
+
+
+ beast\threads\impl
+
+
+ beast\boost
+
+
+ beast\utility\impl
+
-
+
+ _meta
+
\ No newline at end of file
diff --git a/LICENSE_1_0.txt b/LICENSE_1_0.txt
new file mode 100644
index 0000000000..36b7cd93cd
--- /dev/null
+++ b/LICENSE_1_0.txt
@@ -0,0 +1,23 @@
+Boost Software License - Version 1.0 - August 17th, 2003
+
+Permission is hereby granted, free of charge, to any person or organization
+obtaining a copy of the software and accompanying documentation covered by
+this license (the "Software") to use, reproduce, display, distribute,
+execute, and transmit the Software, and to prepare derivative works of the
+Software, and to permit third-parties to whom the Software is furnished to
+do so, all subject to the following:
+
+The copyright notices in the Software and this entire statement, including
+the above license grant, this restriction and the following disclaimer,
+must be included in all copies of the Software, in whole or in part, and
+all derivative works of the Software, unless such copies or derivative
+works are solely in the form of machine-executable object code generated by
+a source language processor.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/TODO.txt b/TODO.txt
index bf1437e8e0..965d1721e4 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -2,10 +2,6 @@
BEAST TODO
--------------------------------------------------------------------------------
-- Use new file naming convention
-
-- Rename ReadWriteMutex to SharedMutex
-
- Use SemanticVersion for beast version numbers to replace BEAST_VERSION
- add support for a __PRETTY_FUNCTION__ equivalent for all environments
@@ -14,13 +10,6 @@ BEAST TODO
- Import secp256k1 from sipa
-- HashMap work:
- - Add unit test
- - Return size_t from hash function, take out upperLimit, move mod % to caller
- - Make hash function a functor using operator()
- - Implement HardenedHashFunctions
- - Fix problem with assigning to the result of operator[] maybe use a proxy?
-
- Set sqlite thread safety model to '2' in beast_sqlite
- Document and rename all the sqdb files and classes
@@ -57,8 +46,6 @@ BEAST TODO
- Rename malloc/calloc JUCE members that conflict with the debug CRT from MSVC
-- Make beast::HashMap support assignment via operator[]
-
- Reformat every Doxygen comment
- Fix Doxygen metatags
- update Beast Doxyfile
diff --git a/modules/beast_core/maths/beast_MathsFunctions.h b/beast/Arithmetic.h
similarity index 79%
rename from modules/beast_core/maths/beast_MathsFunctions.h
rename to beast/Arithmetic.h
index 6532951c4b..8aba10345d 100644
--- a/modules/beast_core/maths/beast_MathsFunctions.h
+++ b/beast/Arithmetic.h
@@ -21,104 +21,48 @@
*/
//==============================================================================
-#ifndef BEAST_MATHSFUNCTIONS_H_INCLUDED
-#define BEAST_MATHSFUNCTIONS_H_INCLUDED
+#ifndef BEAST_ARITHMETIC_H_INCLUDED
+#define BEAST_ARITHMETIC_H_INCLUDED
-//==============================================================================
-/*
- This file sets up some handy mathematical typdefs and functions.
-*/
+#include "Config.h"
+#include "CStdInt.h"
-//==============================================================================
-// Definitions for the int8, int16, int32, int64 and pointer_sized_int types.
+#include
+#include
-/** A platform-independent 8-bit signed integer type. */
-typedef signed char int8;
-/** A platform-independent 8-bit unsigned integer type. */
-typedef unsigned char uint8;
-/** A platform-independent 16-bit signed integer type. */
-typedef signed short int16;
-/** A platform-independent 16-bit unsigned integer type. */
-typedef unsigned short uint16;
-/** A platform-independent 32-bit signed integer type. */
-typedef signed int int32;
-/** A platform-independent 32-bit unsigned integer type. */
-typedef unsigned int uint32;
+namespace beast {
-#if BEAST_MSVC
- /** A platform-independent 64-bit integer type. */
- typedef __int64 int64;
- /** A platform-independent 64-bit unsigned integer type. */
- typedef unsigned __int64 uint64;
- /** A platform-independent macro for writing 64-bit literals, needed because
- different compilers have different syntaxes for this.
-
- E.g. writing literal64bit (0x1000000000) will translate to 0x1000000000LL for
- GCC, or 0x1000000000 for MSVC.
- */
- #define literal64bit(longLiteral) ((__int64) longLiteral)
-#else
- /** A platform-independent 64-bit integer type. */
- typedef long long int64;
- /** A platform-independent 64-bit unsigned integer type. */
- typedef unsigned long long uint64;
- /** A platform-independent macro for writing 64-bit literals, needed because
- different compilers have different syntaxes for this.
-
- E.g. writing literal64bit (0x1000000000) will translate to 0x1000000000LL for
- GCC, or 0x1000000000 for MSVC.
- */
- #define literal64bit(longLiteral) (longLiteral##LL)
-#endif
-
-
-#if BEAST_64BIT
- /** A signed integer type that's guaranteed to be large enough to hold a pointer without truncating it. */
- typedef int64 pointer_sized_int;
- /** An unsigned integer type that's guaranteed to be large enough to hold a pointer without truncating it. */
- typedef uint64 pointer_sized_uint;
-#elif BEAST_MSVC
- /** A signed integer type that's guaranteed to be large enough to hold a pointer without truncating it. */
- typedef _W64 int pointer_sized_int;
- /** An unsigned integer type that's guaranteed to be large enough to hold a pointer without truncating it. */
- typedef _W64 unsigned int pointer_sized_uint;
-#else
- /** A signed integer type that's guaranteed to be large enough to hold a pointer without truncating it. */
- typedef int pointer_sized_int;
- /** An unsigned integer type that's guaranteed to be large enough to hold a pointer without truncating it. */
- typedef unsigned int pointer_sized_uint;
-#endif
-
-#if BEAST_MSVC
- typedef pointer_sized_int ssize_t;
-#endif
-
-//==============================================================================
// Some indispensible min/max functions
/** Returns the larger of two values. */
template
-inline Type bmax (const Type a, const Type b) { return (a < b) ? b : a; }
+inline Type bmax (const Type a, const Type b)
+ { return (a < b) ? b : a; }
/** Returns the larger of three values. */
template
-inline Type bmax (const Type a, const Type b, const Type c) { return (a < b) ? ((b < c) ? c : b) : ((a < c) ? c : a); }
+inline Type bmax (const Type a, const Type b, const Type c)
+ { return (a < b) ? ((b < c) ? c : b) : ((a < c) ? c : a); }
/** Returns the larger of four values. */
template
-inline Type bmax (const Type a, const Type b, const Type c, const Type d) { return bmax (a, bmax (b, c, d)); }
+inline Type bmax (const Type a, const Type b, const Type c, const Type d)
+ { return bmax (a, bmax (b, c, d)); }
/** Returns the smaller of two values. */
template
-inline Type bmin (const Type a, const Type b) { return (b < a) ? b : a; }
+inline Type bmin (const Type a, const Type b)
+ { return (b < a) ? b : a; }
/** Returns the smaller of three values. */
template
-inline Type bmin (const Type a, const Type b, const Type c) { return (b < a) ? ((c < b) ? c : b) : ((c < a) ? c : a); }
+inline Type bmin (const Type a, const Type b, const Type c)
+ { return (b < a) ? ((c < b) ? c : b) : ((c < a) ? c : a); }
/** Returns the smaller of four values. */
template
-inline Type bmin (const Type a, const Type b, const Type c, const Type d) { return bmin (a, bmin (b, c, d)); }
+inline Type bmin (const Type a, const Type b, const Type c, const Type d)
+ { return bmin (a, bmin (b, c, d)); }
/** Scans an array of values, returning the minimum value that it contains. */
template
@@ -183,7 +127,6 @@ void findMinAndMax (const Type* values, int numValues, Type& lowest, Type& highe
}
}
-
//==============================================================================
/** Constrains a value to keep it within a given range.
@@ -268,7 +211,7 @@ inline void swapVariables (Type& variable1, Type& variable2)
@endcode
*/
template
-inline int numElementsInArray (Type (&array)[N])
+int numElementsInArray (Type (&array)[N])
{
(void) array; // (required to avoid a spurious warning in MS compilers)
(void) sizeof (0[array]); // This line should cause an error if you pass an object with a user-defined subscript operator
@@ -509,7 +452,7 @@ namespace TypeHelpers
template <> struct SmallestFloatType { typedef double type; };
}
+}
-//==============================================================================
+#endif
-#endif // BEAST_MATHSFUNCTIONS_H_INCLUDED
diff --git a/modules/beast_core/memory/beast_Atomic.h b/beast/Atomic.h
similarity index 97%
rename from modules/beast_core/memory/beast_Atomic.h
rename to beast/Atomic.h
index 9fcc92fcfa..cd54d75ad0 100644
--- a/modules/beast_core/memory/beast_Atomic.h
+++ b/beast/Atomic.h
@@ -24,6 +24,11 @@
#ifndef BEAST_ATOMIC_H_INCLUDED
#define BEAST_ATOMIC_H_INCLUDED
+#include "Config.h"
+#include "CStdInt.h"
+#include "StaticAssert.h"
+
+namespace beast {
//==============================================================================
/**
@@ -65,13 +70,16 @@ public:
Type get() const noexcept;
/** Copies another value onto this one (atomically). */
- inline Atomic& operator= (const Atomic& other) noexcept { exchange (other.get()); return *this; }
+ Atomic& operator= (const Atomic& other) noexcept
+ { exchange (other.get()); return *this; }
/** Copies another value onto this one (atomically). */
- inline Atomic& operator= (const Type newValue) noexcept { exchange (newValue); return *this; }
+ Atomic& operator= (const Type newValue) noexcept
+ { exchange (newValue); return *this; }
/** Atomically sets the current value. */
- void set (Type newValue) noexcept { exchange (newValue); }
+ void set (Type newValue) noexcept
+ { exchange (newValue); }
/** Atomically sets the current value, returning the value that was replaced. */
Type exchange (Type value) noexcept;
@@ -131,9 +139,6 @@ public:
*/
Type compareAndSetValue (Type newValue, Type valueToCompare) noexcept;
- /** Implements a memory read/write barrier. */
- static void memoryBarrier() noexcept;
-
//==============================================================================
#if BEAST_64BIT
BEAST_ALIGN (8)
@@ -373,8 +378,7 @@ inline Type Atomic::compareAndSetValue (const Type newValue, const Type va
#endif
}
-template
-inline void Atomic::memoryBarrier() noexcept
+inline void memoryBarrier() noexcept
{
#if BEAST_ATOMICS_MAC
OSMemoryBarrier();
@@ -389,4 +393,6 @@ inline void Atomic::memoryBarrier() noexcept
#pragma warning (pop)
#endif
-#endif // BEAST_ATOMIC_H_INCLUDED
+}
+
+#endif
diff --git a/beast/Boost.h b/beast/Boost.h
new file mode 100644
index 0000000000..295eca5a58
--- /dev/null
+++ b/beast/Boost.h
@@ -0,0 +1,31 @@
+//------------------------------------------------------------------------------
+/*
+ This file is part of Beast: https://github.com/vinniefalco/Beast
+ Copyright 2013, Vinnie Falco
+
+ Portions of this file are from JUCE.
+ Copyright (c) 2013 - Raw Material Software Ltd.
+ Please visit http://www.juce.com
+
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+//==============================================================================
+
+#ifndef BEAST_BOOST_H_INCLUDED
+#define BEAST_BOOST_H_INCLUDED
+
+// These classes require boost in order to be used.
+
+#include "boost/ErrorCode.h"
+
+#endif
diff --git a/modules/beast_core/memory/beast_ByteOrder.h b/beast/ByteOrder.h
similarity index 78%
rename from modules/beast_core/memory/beast_ByteOrder.h
rename to beast/ByteOrder.h
index 191de0d943..0e40616e7d 100644
--- a/modules/beast_core/memory/beast_ByteOrder.h
+++ b/beast/ByteOrder.h
@@ -24,11 +24,17 @@
#ifndef BEAST_BYTEORDER_H_INCLUDED
#define BEAST_BYTEORDER_H_INCLUDED
+#include "Config.h"
+#include "CStdInt.h"
+#include "Uncopyable.h"
+
+namespace beast {
+
//==============================================================================
/** Contains static methods for converting the byte order between different
endiannesses.
*/
-class BEAST_API ByteOrder : public Uncopyable
+class ByteOrder : public Uncopyable
{
public:
//==============================================================================
@@ -182,5 +188,109 @@ inline int ByteOrder::bigEndian24Bit (const char* const bytes)
inline void ByteOrder::littleEndian24BitToChars (const int value, char* const destBytes) { destBytes[0] = (char)(value & 0xff); destBytes[1] = (char)((value >> 8) & 0xff); destBytes[2] = (char)((value >> 16) & 0xff); }
inline void ByteOrder::bigEndian24BitToChars (const int value, char* const destBytes) { destBytes[0] = (char)((value >> 16) & 0xff); destBytes[1] = (char)((value >> 8) & 0xff); destBytes[2] = (char)(value & 0xff); }
-#endif
+namespace detail
+{
+/** Specialized helper class template for swapping bytes.
+
+ Normally you won't use this directly, use the helper function
+ byteSwap instead. You can specialize this class for your
+ own user defined types, as was done for uint24.
+
+ @see swapBytes, uint24
+*/
+template
+struct SwapBytes
+{
+ inline IntegralType operator() (IntegralType value) const noexcept
+ {
+ return ByteOrder::swap (value);
+ }
+};
+
+// Specializations for signed integers
+
+template <>
+struct SwapBytes
+{
+ inline int16 operator() (int16 value) const noexcept
+ {
+ return static_cast (ByteOrder::swap (static_cast (value)));
+ }
+};
+
+template <>
+struct SwapBytes
+{
+ inline int32 operator() (int32 value) const noexcept
+ {
+ return static_cast (ByteOrder::swap (static_cast (value)));
+ }
+};
+
+template <>
+struct SwapBytes
+{
+ inline int64 operator() (int64 value) const noexcept
+ {
+ return static_cast (ByteOrder::swap (static_cast (value)));
+ }
+};
+
+}
+
+//------------------------------------------------------------------------------
+
+/** Returns a type with the bytes swapped.
+ Little endian becomes big endian and vice versa. The underlying
+ type must be an integral type or behave like one.
+*/
+template
+inline IntegralType swapBytes (IntegralType value) noexcept
+{
+ return detail::SwapBytes () (value);
+}
+
+/** Returns the machine byte-order value to little-endian byte order. */
+template
+inline IntegralType toLittleEndian (IntegralType value) noexcept
+{
+#if BEAST_LITTLE_ENDIAN
+ return value;
+#else
+ return swapBytes (value);
+#endif
+}
+
+/** Returns the machine byte-order value to big-endian byte order. */
+template
+inline IntegralType toBigEndian (IntegralType value) noexcept
+{
+#if BEAST_LITTLE_ENDIAN
+ return swapBytes (value);
+#else
+ return value;
+#endif
+}
+
+/** Returns the machine byte-order value to network byte order. */
+template
+inline IntegralType toNetworkByteOrder (IntegralType value) noexcept
+{
+ return toBigEndian (value);
+}
+
+/** Converts from network byte order to machine byte order. */
+template
+inline IntegralType fromNetworkByteOrder (IntegralType value) noexcept
+{
+#if BEAST_LITTLE_ENDIAN
+ return swapBytes (value);
+#else
+ return value;
+#endif
+}
+
+}
+
+#endif
diff --git a/beast/CStdInt.h b/beast/CStdInt.h
new file mode 100644
index 0000000000..265f3d9f19
--- /dev/null
+++ b/beast/CStdInt.h
@@ -0,0 +1,88 @@
+//------------------------------------------------------------------------------
+/*
+ This file is part of Beast: https://github.com/vinniefalco/Beast
+ Copyright 2013, Vinnie Falco
+
+ Portions of this file are from JUCE.
+ Copyright (c) 2013 - Raw Material Software Ltd.
+ Please visit http://www.juce.com
+
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+//==============================================================================
+
+#ifndef BEAST_CSTDINT_H_INCLUDED
+#define BEAST_CSTDINT_H_INCLUDED
+
+#include "Config.h"
+
+namespace beast {
+
+typedef signed char int8;
+typedef signed short int16;
+typedef signed int int32;
+typedef unsigned char uint8;
+typedef unsigned short uint16;
+typedef unsigned int uint32;
+
+#if BEAST_MSVC
+ typedef __int64 int64;
+ typedef unsigned __int64 uint64;
+
+ /** A platform-independent macro for writing 64-bit literals, needed because
+ different compilers have different syntaxes for this.
+
+ E.g. writing literal64bit (0x1000000000) will translate to 0x1000000000LL for
+ GCC, or 0x1000000000 for MSVC.
+ */
+ #define literal64bit(longLiteral) ((__int64) longLiteral)
+
+#else
+ /** A platform-independent 64-bit integer type. */
+ typedef long long int64;
+ /** A platform-independent 64-bit unsigned integer type. */
+ typedef unsigned long long uint64;
+ /** A platform-independent macro for writing 64-bit literals, needed because
+ different compilers have different syntaxes for this.
+
+ E.g. writing literal64bit (0x1000000000) will translate to 0x1000000000LL for
+ GCC, or 0x1000000000 for MSVC.
+ */
+ #define literal64bit(longLiteral) (longLiteral##LL)
+
+#endif
+
+#if BEAST_64BIT
+ /** A signed integer type that's guaranteed to be large enough to hold a pointer without truncating it. */
+ typedef int64 pointer_sized_int;
+ /** An unsigned integer type that's guaranteed to be large enough to hold a pointer without truncating it. */
+ typedef uint64 pointer_sized_uint;
+#elif BEAST_MSVC
+ /** A signed integer type that's guaranteed to be large enough to hold a pointer without truncating it. */
+ typedef _W64 int pointer_sized_int;
+ /** An unsigned integer type that's guaranteed to be large enough to hold a pointer without truncating it. */
+ typedef _W64 unsigned int pointer_sized_uint;
+#else
+ /** A signed integer type that's guaranteed to be large enough to hold a pointer without truncating it. */
+ typedef int pointer_sized_int;
+ /** An unsigned integer type that's guaranteed to be large enough to hold a pointer without truncating it. */
+ typedef unsigned int pointer_sized_uint;
+#endif
+
+#if BEAST_MSVC
+ typedef pointer_sized_int ssize_t;
+#endif
+
+}
+
+#endif
diff --git a/beast/Chrono.h b/beast/Chrono.h
new file mode 100644
index 0000000000..027b1f5f32
--- /dev/null
+++ b/beast/Chrono.h
@@ -0,0 +1,27 @@
+//------------------------------------------------------------------------------
+/*
+ This file is part of Beast: https://github.com/vinniefalco/Beast
+ Copyright 2013, Vinnie Falco
+
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+//==============================================================================
+
+#ifndef BEAST_CHRONO_H_INCLUDED
+#define BEAST_CHRONO_H_INCLUDED
+
+#include "chrono/CPUMeter.h"
+#include "chrono/RelativeTime.h"
+#include "chrono/ScopedTimeInterval.h"
+
+#endif
diff --git a/beast/Config.h b/beast/Config.h
new file mode 100644
index 0000000000..32164e7103
--- /dev/null
+++ b/beast/Config.h
@@ -0,0 +1,60 @@
+//------------------------------------------------------------------------------
+/*
+ This file is part of Beast: https://github.com/vinniefalco/Beast
+ Copyright 2013, Vinnie Falco
+
+ Portions of this file are from JUCE.
+ Copyright (c) 2013 - Raw Material Software Ltd.
+ Please visit http://www.juce.com
+
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+//==============================================================================
+
+#ifndef BEAST_CONFIG_H_INCLUDED
+#define BEAST_CONFIG_H_INCLUDED
+
+// VFALCO NOTE this is analogous to
+
+#if !defined(BEAST_COMPILER_CONFIG) && !defined(BEAST_NO_COMPILER_CONFIG) && !defined(BEAST_NO_CONFIG)
+#include "config/SelectCompilerConfig.h"
+#endif
+#ifdef BEAST_COMPILER_CONFIG
+#include BEAST_COMPILER_CONFIG
+#endif
+
+#if !defined(BEAST_STDLIB_CONFIG) && !defined(BEAST_NO_STDLIB_CONFIG) && !defined(BEAST_NO_CONFIG) && defined(__cplusplus)
+#include "config/SelectStdlibConfig.h"
+#endif
+#ifdef BEAST_STDLIB_CONFIG
+#include BEAST_STDLIB_CONFIG
+#endif
+
+#if !defined(BEAST_PLATFORM_CONFIG) && !defined(BEAST_NO_PLATFORM_CONFIG) && !defined(BEAST_NO_CONFIG)
+#include "config/SelectCompilerConfig.h"
+#endif
+#ifdef BEAST_PLATFORM_CONFIG
+#include BEAST_PLATFORM_CONFIG
+#endif
+
+// Legacy
+#include "Version.h"
+#include "config/PlatformConfig.h"
+#include "config/CompilerConfig.h"
+#include "config/StandardConfig.h"
+#include "config/ConfigCheck.h"
+
+// Suffix
+#include "config/Suffix.h"
+
+#endif
diff --git a/beast/Crypto.h b/beast/Crypto.h
new file mode 100644
index 0000000000..50d8204661
--- /dev/null
+++ b/beast/Crypto.h
@@ -0,0 +1,26 @@
+//------------------------------------------------------------------------------
+/*
+ This file is part of Beast: https://github.com/vinniefalco/Beast
+ Copyright 2013, Vinnie Falco
+
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+//==============================================================================
+
+#ifndef BEAST_CRYPTO_H_INCLUDED
+#define BEAST_CRYPTO_H_INCLUDED
+
+#include "crypto/Sha256.h"
+
+#endif
+
diff --git a/beast/FixedArray.h b/beast/FixedArray.h
new file mode 100644
index 0000000000..e9d50488af
--- /dev/null
+++ b/beast/FixedArray.h
@@ -0,0 +1,165 @@
+//------------------------------------------------------------------------------
+/*
+ This file is part of Beast: https://github.com/vinniefalco/Beast
+ Copyright 2013, Vinnie Falco
+
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+//==============================================================================
+
+#ifndef BEAST_FIXEDARRAY_H_INCLUDED
+#define BEAST_FIXEDARRAY_H_INCLUDED
+
+#include "Config.h"
+
+#include
+#include
+#include
+
+namespace beast {
+
+// Ideas from Boost
+
+/** An array whose size is determined at compile-time.
+ The interface tries to follow std::vector as closely as possible within
+ the limitations of having a fixed size.
+*/
+template
+class FixedArray
+{
+public:
+ T values [N];
+
+ typedef T value_type;
+ typedef T* iterator;
+ typedef T const* const_iterator;
+ typedef T& reference;
+ typedef T const& const_reference;
+ typedef std::size_t size_type;
+ typedef std::ptrdiff_t difference_type;
+
+ // iterators
+ iterator begin() { return values; }
+ const_iterator begin() const { return values; }
+ const_iterator cbegin() const { return values; }
+ iterator end() { return values+N; }
+ const_iterator end() const { return values+N; }
+ const_iterator cend() const { return values+N; }
+
+ typedef std::reverse_iterator reverse_iterator;
+ typedef std::reverse_iterator const_reverse_iterator;
+
+ reverse_iterator rbegin() { return reverse_iterator(end()); }
+ const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
+ const_reverse_iterator crbegin() const { return const_reverse_iterator(end()); }
+ reverse_iterator rend() { return reverse_iterator(begin()); }
+ const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
+ const_reverse_iterator crend() const { return const_reverse_iterator(begin()); }
+
+ reference operator[](size_type i)
+ {
+ bassert (i < N);
+ return values[i];
+ }
+
+ const_reference operator[](size_type i) const
+ {
+ bassert (i < N);
+ return values[i];
+ }
+
+ reference at(size_type i) { rangecheck(i); return values[i]; }
+ const_reference at(size_type i) const { rangecheck(i); return values[i]; }
+
+ reference front() { return values[0]; }
+ reference back() { return values[N-1]; }
+ const_reference front () const { return values[0]; }
+ const_reference back() const { return values[N-1]; }
+
+ static size_type size() { return N; }
+ static bool empty() { return false; }
+ static size_type max_size() { return N; }
+
+ enum { static_size = N };
+
+ T const* data() const { return values; }
+ T* data() { return values; }
+ T* c_array() { return values; }
+
+ template
+ FixedArray& operator= (FixedArray const& rhs)
+ {
+ std::copy (rhs.begin(), rhs.end(), begin());
+ return *this;
+ }
+
+ void assign (T const& value) { fill (value); }
+
+ void fill (T const& value)
+ {
+ std::fill_n (begin(), size(), value);
+ }
+
+ void clear ()
+ {
+ fill (T ());
+ }
+
+ static void rangecheck (size_type i)
+ {
+ if (i >= size())
+ throw std::out_of_range ("FixedArray<>: index out of range");
+ }
+};
+
+//------------------------------------------------------------------------------
+
+template
+bool operator== (FixedArray const& lhs, FixedArray const& rhs)
+{
+ return std::equal (lhs.begin(), lhs.end(), rhs.begin());
+}
+
+template
+bool operator!= (FixedArray const& lhs, FixedArray const& rhs)
+{
+ return !(lhs==rhs);
+}
+
+template
+bool operator< (FixedArray const& lhs, FixedArray const& rhs)
+{
+ return std::lexicographical_compare (lhs.begin(), lhs.end(), rhs.begin(), rhs.end());
+}
+
+template
+bool operator> (FixedArray const& lhs, FixedArray const& rhs)
+{
+ return rhs
+bool operator<= (FixedArray const& lhs, FixedArray const& rhs)
+{
+ return !(rhs
+bool operator>= (FixedArray const& lhs, FixedArray const& rhs)
+{
+ return !(lhs
+
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+//==============================================================================
+
+#ifndef BEAST_HTTP_H_INCLUDED
+#define BEAST_HTTP_H_INCLUDED
+
+#include "http/URL.h"
+#include "http/ParsedURL.h"
+
+#endif
diff --git a/modules/beast_core/memory/beast_HeapBlock.h b/beast/HeapBlock.h
similarity index 88%
rename from modules/beast_core/memory/beast_HeapBlock.h
rename to beast/HeapBlock.h
index 8d4dfc92f8..875dae0e47 100644
--- a/modules/beast_core/memory/beast_HeapBlock.h
+++ b/beast/HeapBlock.h
@@ -24,6 +24,46 @@
#ifndef BEAST_HEAPBLOCK_H_INCLUDED
#define BEAST_HEAPBLOCK_H_INCLUDED
+#include
+#include
+#include
+
+#include "Memory.h"
+#include "Uncopyable.h"
+
+// If the MSVC debug heap headers were included, disable
+// the macros during the juce include since they conflict.
+#ifdef _CRTDBG_MAP_ALLOC
+#pragma push_macro("calloc")
+#pragma push_macro("free")
+#pragma push_macro("malloc")
+#pragma push_macro("realloc")
+#pragma push_macro("_recalloc")
+#pragma push_macro("_aligned_free")
+#pragma push_macro("_aligned_malloc")
+#pragma push_macro("_aligned_offset_malloc")
+#pragma push_macro("_aligned_realloc")
+#pragma push_macro("_aligned_recalloc")
+#pragma push_macro("_aligned_offset_realloc")
+#pragma push_macro("_aligned_offset_recalloc")
+#pragma push_macro("_aligned_msize")
+#undef calloc
+#undef free
+#undef malloc
+#undef realloc
+#undef _recalloc
+#undef _aligned_free
+#undef _aligned_malloc
+#undef _aligned_offset_malloc
+#undef _aligned_realloc
+#undef _aligned_recalloc
+#undef _aligned_offset_realloc
+#undef _aligned_offset_recalloc
+#undef _aligned_msize
+#endif
+
+namespace beast {
+
#ifndef DOXYGEN
namespace HeapBlockHelper
{
@@ -305,5 +345,23 @@ private:
#endif
};
+}
+
+#ifdef _CRTDBG_MAP_ALLOC
+#pragma pop_macro("_aligned_msize")
+#pragma pop_macro("_aligned_offset_recalloc")
+#pragma pop_macro("_aligned_offset_realloc")
+#pragma pop_macro("_aligned_recalloc")
+#pragma pop_macro("_aligned_realloc")
+#pragma pop_macro("_aligned_offset_malloc")
+#pragma pop_macro("_aligned_malloc")
+#pragma pop_macro("_aligned_free")
+#pragma pop_macro("_recalloc")
+#pragma pop_macro("realloc")
+#pragma pop_macro("malloc")
+#pragma pop_macro("free")
+#pragma pop_macro("calloc")
+#endif
+
+#endif
-#endif // BEAST_HEAPBLOCK_H_INCLUDED
diff --git a/beast/Intrusive.h b/beast/Intrusive.h
new file mode 100644
index 0000000000..065b92c9dd
--- /dev/null
+++ b/beast/Intrusive.h
@@ -0,0 +1,28 @@
+//------------------------------------------------------------------------------
+/*
+ This file is part of Beast: https://github.com/vinniefalco/Beast
+ Copyright 2013, Vinnie Falco
+
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+//==============================================================================
+
+#ifndef BEAST_INTRUSIVE_H_INCLUDED
+#define BEAST_INTRUSIVE_H_INCLUDED
+
+#include "intrusive/ForwardList.h"
+#include "intrusive/IntrusiveArray.h"
+#include "intrusive/List.h"
+#include "intrusive/LockFreeStack.h"
+
+#endif
diff --git a/beast/mpl.h b/beast/MPL.h
similarity index 95%
rename from beast/mpl.h
rename to beast/MPL.h
index 051931e688..3be24c673a 100644
--- a/beast/mpl.h
+++ b/beast/MPL.h
@@ -21,7 +21,9 @@
#define BEAST_MPL_H_INCLUDED
#include "mpl/AddConst.h"
+#include "mpl/CopyConst.h"
#include "mpl/IfCond.h"
+#include "mpl/IsCallPossible.h"
#include "mpl/PointerToOther.h"
#include "mpl/RemoveConst.h"
#include "mpl/RemoveConstVolatile.h"
diff --git a/modules/beast_core/memory/beast_Memory.h b/beast/Memory.h
similarity index 86%
rename from modules/beast_core/memory/beast_Memory.h
rename to beast/Memory.h
index b67ec0cd7a..538e82e5a0 100644
--- a/modules/beast_core/memory/beast_Memory.h
+++ b/beast/Memory.h
@@ -24,13 +24,21 @@
#ifndef BEAST_MEMORY_H_INCLUDED
#define BEAST_MEMORY_H_INCLUDED
+#include
+
+#include "Config.h"
+
+namespace beast {
+
//==============================================================================
/** Fills a block of memory with zeros. */
-inline void zeromem (void* memory, size_t numBytes) noexcept { memset (memory, 0, numBytes); }
+inline void zeromem (void* memory, size_t numBytes) noexcept
+ { memset (memory, 0, numBytes); }
/** Overwrites a structure or object with zeros. */
template
-inline void zerostruct (Type& structure) noexcept { memset (&structure, 0, sizeof (structure)); }
+void zerostruct (Type& structure) noexcept
+ { memset (&structure, 0, sizeof (structure)); }
/** Delete an object pointer, and sets the pointer to null.
@@ -38,26 +46,30 @@ inline void zerostruct (Type& structure) noexcept { memset (&s
or other automatic lifetime-management system rather than resorting to deleting raw pointers!
*/
template
-inline void deleteAndZero (Type& pointer) { delete pointer; pointer = nullptr; }
+void deleteAndZero (Type& pointer)
+ { delete pointer; pointer = nullptr; }
/** A handy function which adds a number of bytes to any type of pointer and returns the result.
This can be useful to avoid casting pointers to a char* and back when you want to move them by
a specific number of bytes,
*/
template
-inline Type* addBytesToPointer (Type* pointer, IntegerType bytes) noexcept { return (Type*) (((char*) pointer) + bytes); }
+Type* addBytesToPointer (Type* pointer, IntegerType bytes) noexcept
+ { return (Type*) (((char*) pointer) + bytes); }
/** A handy function which returns the difference between any two pointers, in bytes.
The address of the second pointer is subtracted from the first, and the difference in bytes is returned.
*/
template
-inline int getAddressDifference (Type1* pointer1, Type2* pointer2) noexcept { return (int) (((const char*) pointer1) - (const char*) pointer2); }
+int getAddressDifference (Type1* pointer1, Type2* pointer2) noexcept
+ { return (int) (((const char*) pointer1) - (const char*) pointer2); }
/** If a pointer is non-null, this returns a new copy of the object that it points to, or safely returns
nullptr if the pointer is null.
*/
template
-inline Type* createCopyIfNotNull (const Type* pointer) { return pointer != nullptr ? new Type (*pointer) : nullptr; }
+Type* createCopyIfNotNull (const Type* pointer)
+ { return pointer != nullptr ? new Type (*pointer) : nullptr; }
//==============================================================================
#if BEAST_MAC || BEAST_IOS || DOXYGEN
@@ -90,5 +102,7 @@ inline Type* createCopyIfNotNull (const Type* pointer) { return pointer != n
#define BEAST_AUTORELEASEPOOL
#endif
+}
+
#endif
diff --git a/beast/Net.h b/beast/Net.h
new file mode 100644
index 0000000000..091c940f05
--- /dev/null
+++ b/beast/Net.h
@@ -0,0 +1,28 @@
+//------------------------------------------------------------------------------
+/*
+ This file is part of Beast: https://github.com/vinniefalco/Beast
+ Copyright 2013, Vinnie Falco
+
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+//==============================================================================
+
+#ifndef BEAST_NET_H_INCLUDED
+#define BEAST_NET_H_INCLUDED
+
+#include "net/BufferType.h"
+#include "net/DynamicBuffer.h"
+
+#include "net/IPEndpoint.h"
+
+#endif
diff --git a/modules/beast_core/diagnostic/beast_SafeBool.h b/beast/SafeBool.h
similarity index 93%
rename from modules/beast_core/diagnostic/beast_SafeBool.h
rename to beast/SafeBool.h
index 1b6dfad0e3..fbae195923 100644
--- a/modules/beast_core/diagnostic/beast_SafeBool.h
+++ b/beast/SafeBool.h
@@ -20,23 +20,11 @@
#ifndef BEAST_SAFEBOOL_H_INCLUDED
#define BEAST_SAFEBOOL_H_INCLUDED
-/** Safe evaluation of class as `bool`.
+namespace beast {
- This allows a class to be safely evaluated as a bool without the usual
- harmful side effects of the straightforward operator conversion approach.
- To use it, derive your class from SafeBool and implement `asBoolean()` as:
+namespace detail {
- @code
-
- bool asBoolean () const;
-
- @endcode
-
- Ideas from http://www.artima.com/cppsource/safebool.html
-
- @class SafeBool
-*/
-class BEAST_API SafeBoolBase
+class SafeBoolBase
{
private:
void disallowed () const { }
@@ -56,11 +44,29 @@ protected:
~SafeBoolBase () { }
};
+}
+
+/** Safe evaluation of class as `bool`.
+
+ This allows a class to be safely evaluated as a bool without the usual
+ harmful side effects of the straightforward operator conversion approach.
+ To use it, derive your class from SafeBool and implement `asBoolean()` as:
+
+ @code
+
+ bool asBoolean () const;
+
+ @endcode
+
+ Ideas from http://www.artima.com/cppsource/safebool.html
+
+ @class SafeBool
+*/
template
-class SafeBool : public SafeBoolBase
+class SafeBool : public detail::SafeBoolBase
{
public:
- operator boolean_t () const
+ operator detail::SafeBoolBase::boolean_t () const
{
return (static_cast (this))->asBoolean ()
? &SafeBoolBase::allowed : 0;
@@ -82,6 +88,8 @@ void operator!= (SafeBool const& lhs, SafeBool const& rhs)
lhs.disallowed ();
}
+}
+
#endif
diff --git a/beast/SmartPtr.h b/beast/SmartPtr.h
new file mode 100644
index 0000000000..13aab726a8
--- /dev/null
+++ b/beast/SmartPtr.h
@@ -0,0 +1,30 @@
+//------------------------------------------------------------------------------
+/*
+ This file is part of Beast: https://github.com/vinniefalco/Beast
+ Copyright 2013, Vinnie Falco
+
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+//==============================================================================
+
+#ifndef BEAST_SMARTPTR_H_INCLUDED
+#define BEAST_SMARTPTR_H_INCLUDED
+
+#include "Config.h"
+
+#include "smart_ptr/ContainerDeletePolicy.h"
+#include "smart_ptr/SharedObject.h"
+#include "smart_ptr/SharedPtr.h"
+#include "smart_ptr/ScopedPointer.h"
+
+#endif
diff --git a/modules/beast_core/thread/beast_GlobalThreadGroup.h b/beast/StaticAssert.h
similarity index 62%
rename from modules/beast_core/thread/beast_GlobalThreadGroup.h
rename to beast/StaticAssert.h
index 689b258b9c..1c36d0bd1c 100644
--- a/modules/beast_core/thread/beast_GlobalThreadGroup.h
+++ b/beast/StaticAssert.h
@@ -17,33 +17,29 @@
*/
//==============================================================================
-#ifndef BEAST_GLOBALTHREADGROUP_H_INCLUDED
-#define BEAST_GLOBALTHREADGROUP_H_INCLUDED
+#ifndef BEAST_STATICASSERT_H_INCLUDED
+#define BEAST_STATICASSERT_H_INCLUDED
-/*============================================================================*/
-/**
- A ThreadGroup singleton.
-
- @see ThreadGroup
-
- @ingroup beast_concurrent
-*/
-class BEAST_API GlobalThreadGroup : public ThreadGroup,
- public SharedSingleton
+#ifndef DOXYGEN
+namespace beast
{
-private:
- friend class SharedSingleton ;
+ template
+ struct BeastStaticAssert;
- GlobalThreadGroup ()
- : SharedSingleton (
- SingletonLifetime::persistAfterCreation)
+ template <>
+ struct BeastStaticAssert
{
- }
+ static void dummy() {}
+ };
+}
+#endif
- static GlobalThreadGroup* createInstance ()
- {
- return new GlobalThreadGroup;
- }
-};
+/** A compile-time assertion macro.
+ If the expression parameter is false, the macro will cause a compile error.
+ (The actual error message that the compiler generates may be completely
+ bizarre and seem to have no relation to the place where you put the
+ static_assert though!)
+*/
+#define static_bassert(expression) beast::BeastStaticAssert::dummy();
#endif
diff --git a/beast/Strings.h b/beast/Strings.h
new file mode 100644
index 0000000000..5b76162400
--- /dev/null
+++ b/beast/Strings.h
@@ -0,0 +1,27 @@
+//------------------------------------------------------------------------------
+/*
+ This file is part of Beast: https://github.com/vinniefalco/Beast
+ Copyright 2013, Vinnie Falco
+
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+//==============================================================================
+
+#ifndef BEAST_STRINGS_H_INCLUDED
+#define BEAST_STRINGS_H_INCLUDED
+
+#include "strings/String.h"
+#include "strings/NewLine.h"
+
+#endif
+
diff --git a/modules/beast_core/memory/beast_FifoFreeStore.h b/beast/Threads.h
similarity index 67%
rename from modules/beast_core/memory/beast_FifoFreeStore.h
rename to beast/Threads.h
index 1acbbf79d9..6c3859d9a6 100644
--- a/modules/beast_core/memory/beast_FifoFreeStore.h
+++ b/beast/Threads.h
@@ -17,22 +17,21 @@
*/
//==============================================================================
-#ifndef BEAST_FIFOFREESTORE_H_INCLUDED
-#define BEAST_FIFOFREESTORE_H_INCLUDED
+#ifndef BEAST_THREADS_H_INCLUDED
+#define BEAST_THREADS_H_INCLUDED
-/** Selected free store based on compilation settings.
-
- @ingroup beast_concurrent
-*/
-// VFALCO NOTE Disabled this because it seems that the TLS
-// implementation has a leak. Although the other
-// one also seems to have a leak.
-//
-//#if BEAST_USE_BOOST_FEATURES
-#if 0
-typedef FifoFreeStoreWithTLS FifoFreeStoreType;
-#else
-typedef FifoFreeStoreWithoutTLS FifoFreeStoreType;
-#endif
+#include "threads/LockGuard.h"
+#include "threads/UnlockGuard.h"
+#include "threads/TryLockGuard.h"
+#include "threads/SharedLockGuard.h"
+#include "threads/SharedMutexAdapter.h"
+#include "threads/SharedData.h"
+#include "threads/ServiceQueue.h"
+#include "threads/SpinLock.h"
+#include "threads/Stoppable.h"
+#include "threads/Thread.h"
+#include "threads/ThreadLocalValue.h"
+#include "threads/WaitableEvent.h"
+#include "threads/ScopedWrapperContext.h"
#endif
diff --git a/beast/TypeTraits.h b/beast/TypeTraits.h
new file mode 100644
index 0000000000..6af5fedc1a
--- /dev/null
+++ b/beast/TypeTraits.h
@@ -0,0 +1,28 @@
+//------------------------------------------------------------------------------
+/*
+ This file is part of Beast: https://github.com/vinniefalco/Beast
+ Copyright 2013, Vinnie Falco
+
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+//==============================================================================
+
+#ifndef BEAST_TYPETRAITS_H_INCLUDED
+#define BEAST_TYPETRAITS_H_INCLUDED
+
+#include "type_traits/IntegralConstant.h"
+#include "type_traits/IsIntegral.h"
+#include "type_traits/IsSigned.h"
+#include "type_traits/RemoveSigned.h"
+
+#endif
diff --git a/modules/beast_core/memory/beast_Uncopyable.h b/beast/Uncopyable.h
similarity index 95%
rename from modules/beast_core/memory/beast_Uncopyable.h
rename to beast/Uncopyable.h
index 0ddf154c4e..20a41770ba 100644
--- a/modules/beast_core/memory/beast_Uncopyable.h
+++ b/beast/Uncopyable.h
@@ -20,6 +20,11 @@
#ifndef BEAST_UNCOPYABLE_H_INCLUDED
#define BEAST_UNCOPYABLE_H_INCLUDED
+namespace beast
+{
+
+// Ideas from boost
+
/** Prevent copy construction and assignment.
This is used to suppress warnings and prevent unsafe operations on
@@ -59,12 +64,14 @@
class Uncopyable
{
protected:
- inline Uncopyable () { }
- inline ~Uncopyable () { }
+ Uncopyable () { }
+ ~Uncopyable () { }
private:
Uncopyable (Uncopyable const&);
Uncopyable const& operator= (Uncopyable const&);
};
+}
+
#endif
diff --git a/beast/Utility.h b/beast/Utility.h
new file mode 100644
index 0000000000..b7cd0854ce
--- /dev/null
+++ b/beast/Utility.h
@@ -0,0 +1,33 @@
+//------------------------------------------------------------------------------
+/*
+ This file is part of Beast: https://github.com/vinniefalco/Beast
+ Copyright 2013, Vinnie Falco
+
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+//==============================================================================
+
+#ifndef BEAST_UTILITY_H_INCLUDED
+#define BEAST_UTILITY_H_INCLUDED
+
+#include "utility/BaseFromMember.h"
+#include "utility/Debug.h"
+#include "utility/EnableIf.h"
+#include "utility/Error.h"
+#include "utility/Journal.h"
+#include "utility/LeakChecked.h"
+#include "utility/PropertyStream.h"
+#include "utility/StaticObject.h"
+
+#endif
+
diff --git a/beast/Version.h b/beast/Version.h
new file mode 100644
index 0000000000..e409692fb6
--- /dev/null
+++ b/beast/Version.h
@@ -0,0 +1,40 @@
+//------------------------------------------------------------------------------
+/*
+ This file is part of Beast: https://github.com/vinniefalco/Beast
+ Copyright 2013, Vinnie Falco
+
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+//==============================================================================
+
+#ifndef BEAST_VERSION_H_INCLUDED
+#define BEAST_VERSION_H_INCLUDED
+
+/** Current BEAST version number.
+ See also SystemStats::getBeastVersion() for a string version.
+*/
+// VFALCO TODO Replace this with SemanticVerson
+#define BEAST_MAJOR_VERSION 1
+#define BEAST_MINOR_VERSION 0
+#define BEAST_BUILDNUMBER 0
+
+/** Current Beast version number.
+ Bits 16 to 32 = major version.
+ Bits 8 to 16 = minor version.
+ Bits 0 to 8 = point release.
+ See also SystemStats::getBeastVersion() for a string version.
+*/
+#define BEAST_VERSION ((BEAST_MAJOR_VERSION << 16) + (BEAST_MINOR_VERSION << 8) + BEAST_BUILDNUMBER)
+
+#endif
+
diff --git a/beast/boost/Boost.cpp b/beast/boost/Boost.cpp
new file mode 100644
index 0000000000..7e26631060
--- /dev/null
+++ b/beast/boost/Boost.cpp
@@ -0,0 +1,22 @@
+//------------------------------------------------------------------------------
+/*
+ This file is part of Beast: https://github.com/vinniefalco/Beast
+ Copyright 2013, Vinnie Falco
+
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+//==============================================================================
+
+#include "BeastConfig.h"
+
+#include "ErrorCode.h"
diff --git a/beast/boost/ErrorCode.h b/beast/boost/ErrorCode.h
new file mode 100644
index 0000000000..ea2fb8436b
--- /dev/null
+++ b/beast/boost/ErrorCode.h
@@ -0,0 +1,35 @@
+//------------------------------------------------------------------------------
+/*
+ This file is part of Beast: https://github.com/vinniefalco/Beast
+ Copyright 2013, Vinnie Falco
+
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+//==============================================================================
+
+#ifndef BEAST_BOOST_ERRORCODE_H_INCLUDED
+#define BEAST_BOOST_ERRORCODE_H_INCLUDED
+
+#include
+
+namespace beast {
+
+// Lift this into our namespace. For now we will
+// use boost, and then switch to std::error_code when
+// it is available on all our supported platforms.
+//
+typedef boost::system::error_code ErrorCode;
+
+}
+
+#endif
diff --git a/beast/chrono/CPUMeter.h b/beast/chrono/CPUMeter.h
new file mode 100644
index 0000000000..b78da25d74
--- /dev/null
+++ b/beast/chrono/CPUMeter.h
@@ -0,0 +1,158 @@
+//------------------------------------------------------------------------------
+/*
+ This file is part of Beast: https://github.com/vinniefalco/Beast
+ Copyright 2013, Vinnie Falco
+
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+//==============================================================================
+
+#ifndef BEAST_CHRONO_CPUMETER_H_INCLUDED
+#define BEAST_CHRONO_CPUMETER_H_INCLUDED
+
+#include "RelativeTime.h"
+#include "ScopedTimeInterval.h"
+#include "../threads/SharedData.h"
+#include "../Atomic.h"
+
+namespace beast {
+
+/** Measurements of CPU utilization. */
+class CPUMeter
+{
+private:
+ struct MeasureIdle
+ {
+ explicit MeasureIdle (CPUMeter& meter)
+ : m_meter (&meter)
+ { }
+ void operator() (RelativeTime const& interval) const
+ { m_meter->addIdleTime (interval); }
+ CPUMeter* m_meter;
+ };
+
+ struct MeasureActive
+ {
+ explicit MeasureActive (CPUMeter& meter)
+ : m_meter (&meter)
+ { }
+ void operator() (RelativeTime const& interval) const
+ { m_meter->addActiveTime (interval); }
+ CPUMeter* m_meter;
+ };
+
+ enum
+ {
+ // The amount of time an aggregate must accrue before a swap
+ secondsPerAggregate = 3
+
+ // The number of aggregates in the rolling history buffer
+ ,numberOfAggregates = 20
+ };
+
+ // Aggregated sample data
+ struct Aggregate
+ {
+ RelativeTime idle;
+ RelativeTime active;
+
+ // Returns the total number of seconds in the aggregate
+ double seconds () const
+ { return idle.inSeconds() + active.inSeconds(); }
+
+ // Reset the accumulated times
+ void clear ()
+ { idle = RelativeTime (0); active = RelativeTime (0); }
+
+ Aggregate& operator+= (Aggregate const& other)
+ { idle += other.idle; active += other.active; return *this; }
+
+ Aggregate& operator-= (Aggregate const& other)
+ { idle -= other.idle; active -= other.active; return *this; }
+ };
+
+ struct State
+ {
+ State () : index (0)
+ {
+ }
+
+ // Returns a reference to the current aggregate
+ Aggregate& front ()
+ {
+ return history [index];
+ }
+
+ // Checks the current aggregate to see if we should advance
+ void update()
+ {
+ if (front().seconds() >= secondsPerAggregate)
+ advance();
+ }
+
+ // Advance the index in the rolling history
+ void advance ()
+ {
+ usage += history [index];
+ index = (index+1) % numberOfAggregates;
+ usage -= history [index];
+ history [index].clear ();
+ }
+
+ // Index of the current aggregate we are accumulating
+ int index;
+
+ // Delta summed usage over the entire history buffer
+ Aggregate usage;
+
+ // The rolling history buffer
+ Aggregate history [numberOfAggregates];
+ };
+
+ typedef SharedData SharedState;
+
+ SharedState m_state;
+
+ void addIdleTime (RelativeTime const& interval)
+ {
+ SharedState::Access state (m_state);
+ state->front().idle += interval;
+ state->update();
+ }
+
+ void addActiveTime (RelativeTime const& interval)
+ {
+ SharedState::Access state (m_state);
+ state->front().active += interval;
+ state->update();
+ }
+
+public:
+ /** The type of container that measures idle time. */
+ typedef ScopedTimeInterval ScopedIdleTime;
+ typedef ScopedTimeInterval ScopedActiveTime;
+
+ /** Returns the fraction of time that the CPU is being used. */
+ double getUtilizaton () const
+ {
+ SharedState::ConstAccess state (m_state);
+ double const seconds (state->usage.seconds());
+ if (seconds > 0)
+ return (state->usage.active.inSeconds() / seconds);
+ return 0;
+ }
+};
+
+}
+
+#endif
diff --git a/beast/chrono/Chrono.cpp b/beast/chrono/Chrono.cpp
new file mode 100644
index 0000000000..5ce5772e66
--- /dev/null
+++ b/beast/chrono/Chrono.cpp
@@ -0,0 +1,23 @@
+//------------------------------------------------------------------------------
+/*
+ This file is part of Beast: https://github.com/vinniefalco/Beast
+ Copyright 2013, Vinnie Falco
+
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+//==============================================================================
+
+#include "BeastConfig.h"
+
+#include "impl/CPUMeter.cpp"
+#include "impl/RelativeTime.cpp"
diff --git a/modules/beast_core/time/beast_RelativeTime.h b/beast/chrono/RelativeTime.h
similarity index 71%
rename from modules/beast_core/time/beast_RelativeTime.h
rename to beast/chrono/RelativeTime.h
index ed8c1f3ff2..41a65df625 100644
--- a/modules/beast_core/time/beast_RelativeTime.h
+++ b/beast/chrono/RelativeTime.h
@@ -21,8 +21,16 @@
*/
//==============================================================================
-#ifndef BEAST_RELATIVETIME_H_INCLUDED
-#define BEAST_RELATIVETIME_H_INCLUDED
+#ifndef BEAST_CHRONO_RELATIVETIME_H_INCLUDED
+#define BEAST_CHRONO_RELATIVETIME_H_INCLUDED
+
+#include "../Config.h"
+#include "../strings/String.h"
+
+#include
+#include
+
+namespace beast {
//==============================================================================
/** A relative measure of time.
@@ -35,13 +43,22 @@
class BEAST_API RelativeTime
{
public:
+ //==============================================================================
+ /** The underlying data type used by RelativeTime.
+
+ If you need to get to the underlying time and manipulate it
+ you can use this to declare a type that is guaranteed to
+ work cleanly.
+ */
+ typedef double value_type;
+
//==============================================================================
/** Creates a RelativeTime.
@param seconds the number of seconds, which may be +ve or -ve.
@see milliseconds, minutes, hours, days, weeks
*/
- explicit RelativeTime (double seconds = 0.0) noexcept;
+ explicit RelativeTime (value_type seconds = 0.0) noexcept;
/** Copies another relative time. */
RelativeTime (const RelativeTime& other) noexcept;
@@ -52,6 +69,15 @@ public:
/** Destructor. */
~RelativeTime() noexcept;
+ bool isZero() const
+ { return numSeconds == 0; }
+
+ bool isNotZero() const
+ { return numSeconds != 0; }
+
+ /** Returns the amount of time since the process was started. */
+ static RelativeTime fromStartup ();
+
//==============================================================================
/** Creates a new RelativeTime object representing a number of milliseconds.
@see seconds, minutes, hours, days, weeks
@@ -66,27 +92,27 @@ public:
/** Creates a new RelativeTime object representing a number of seconds.
@see milliseconds, minutes, hours, days, weeks
*/
- static RelativeTime seconds (double seconds) noexcept;
+ static RelativeTime seconds (value_type seconds) noexcept;
/** Creates a new RelativeTime object representing a number of minutes.
@see milliseconds, hours, days, weeks
*/
- static RelativeTime minutes (double numberOfMinutes) noexcept;
+ static RelativeTime minutes (value_type numberOfMinutes) noexcept;
/** Creates a new RelativeTime object representing a number of hours.
@see milliseconds, minutes, days, weeks
*/
- static RelativeTime hours (double numberOfHours) noexcept;
+ static RelativeTime hours (value_type numberOfHours) noexcept;
/** Creates a new RelativeTime object representing a number of days.
@see milliseconds, minutes, hours, weeks
*/
- static RelativeTime days (double numberOfDays) noexcept;
+ static RelativeTime days (value_type numberOfDays) noexcept;
/** Creates a new RelativeTime object representing a number of weeks.
@see milliseconds, minutes, hours, days
*/
- static RelativeTime weeks (double numberOfWeeks) noexcept;
+ static RelativeTime weeks (value_type numberOfWeeks) noexcept;
//==============================================================================
/** Returns the number of milliseconds this time represents.
@@ -97,27 +123,27 @@ public:
/** Returns the number of seconds this time represents.
@see inMilliseconds, inMinutes, inHours, inDays, inWeeks
*/
- double inSeconds() const noexcept { return numSeconds; }
+ value_type inSeconds() const noexcept { return numSeconds; }
/** Returns the number of minutes this time represents.
@see inMilliseconds, inSeconds, inHours, inDays, inWeeks
*/
- double inMinutes() const noexcept;
+ value_type inMinutes() const noexcept;
/** Returns the number of hours this time represents.
@see inMilliseconds, inSeconds, inMinutes, inDays, inWeeks
*/
- double inHours() const noexcept;
+ value_type inHours() const noexcept;
/** Returns the number of days this time represents.
@see inMilliseconds, inSeconds, inMinutes, inHours, inWeeks
*/
- double inDays() const noexcept;
+ value_type inDays() const noexcept;
/** Returns the number of weeks this time represents.
@see inMilliseconds, inSeconds, inMinutes, inHours, inDays
*/
- double inWeeks() const noexcept;
+ value_type inWeeks() const noexcept;
/** Returns a readable textual description of the time.
@@ -135,42 +161,55 @@ public:
@see inMilliseconds, inSeconds, inMinutes, inHours, inDays, inWeeks
*/
String getDescription (const String& returnValueForZeroTime = "0") const;
+ std::string to_string () const;
+ template
+ RelativeTime operator+ (Number seconds) const noexcept
+ { return RelativeTime (numSeconds + seconds); }
+
+ template
+ RelativeTime operator- (Number seconds) const noexcept
+ { return RelativeTime (numSeconds - seconds); }
- //==============================================================================
/** Adds another RelativeTime to this one. */
RelativeTime operator+= (RelativeTime timeToAdd) noexcept;
+
/** Subtracts another RelativeTime from this one. */
RelativeTime operator-= (RelativeTime timeToSubtract) noexcept;
/** Adds a number of seconds to this time. */
- RelativeTime operator+= (double secondsToAdd) noexcept;
+ RelativeTime operator+= (value_type secondsToAdd) noexcept;
+
/** Subtracts a number of seconds from this time. */
- RelativeTime operator-= (double secondsToSubtract) noexcept;
+ RelativeTime operator-= (value_type secondsToSubtract) noexcept;
private:
- //==============================================================================
- double numSeconds;
+ value_type numSeconds;
};
-//==============================================================================
-/** Compares two RelativeTimes. */
+//------------------------------------------------------------------------------
+
bool operator== (RelativeTime t1, RelativeTime t2) noexcept;
-/** Compares two RelativeTimes. */
bool operator!= (RelativeTime t1, RelativeTime t2) noexcept;
-/** Compares two RelativeTimes. */
bool operator> (RelativeTime t1, RelativeTime t2) noexcept;
-/** Compares two RelativeTimes. */
bool operator< (RelativeTime t1, RelativeTime t2) noexcept;
-/** Compares two RelativeTimes. */
bool operator>= (RelativeTime t1, RelativeTime t2) noexcept;
-/** Compares two RelativeTimes. */
bool operator<= (RelativeTime t1, RelativeTime t2) noexcept;
-//==============================================================================
-/** Adds two RelativeTimes together. */
-RelativeTime operator+ (RelativeTime t1, RelativeTime t2) noexcept;
-/** Subtracts two RelativeTimes. */
-RelativeTime operator- (RelativeTime t1, RelativeTime t2) noexcept;
+//------------------------------------------------------------------------------
-#endif // BEAST_RELATIVETIME_H_INCLUDED
+/** Adds two RelativeTimes together. */
+RelativeTime operator+ (RelativeTime t1, RelativeTime t2) noexcept;
+
+/** Subtracts two RelativeTimes. */
+RelativeTime operator- (RelativeTime t1, RelativeTime t2) noexcept;
+
+inline std::ostream& operator<< (std::ostream& os, RelativeTime const& diff)
+{
+ os << diff.to_string();
+ return os;
+}
+
+}
+
+#endif
diff --git a/modules/beast_core/memory/beast_GlobalPagedFreeStore.h b/beast/chrono/ScopedTimeInterval.h
similarity index 55%
rename from modules/beast_core/memory/beast_GlobalPagedFreeStore.h
rename to beast/chrono/ScopedTimeInterval.h
index 5e2d4e3ca4..53b85b7427 100644
--- a/modules/beast_core/memory/beast_GlobalPagedFreeStore.h
+++ b/beast/chrono/ScopedTimeInterval.h
@@ -17,43 +17,46 @@
*/
//==============================================================================
-#ifndef BEAST_GLOBALPAGEDFREESTORE_H_INCLUDED
-#define BEAST_GLOBALPAGEDFREESTORE_H_INCLUDED
+#ifndef BEAST_CHRONO_SCOPEDTIMEINTERVAL_H_INCLUDED
+#define BEAST_CHRONO_SCOPEDTIMEINTERVAL_H_INCLUDED
-/*============================================================================*/
-/**
- A PagedFreeStore singleton.
+#include "../Uncopyable.h"
+#include "RelativeTime.h"
- @ingroup beast_concurrent
+namespace beast {
+
+/** Time measurement using scoped RAII container.
+ UnaryFunction will be called with this signature:
+ void (RelativeTime const& interval);
*/
-class BEAST_API GlobalPagedFreeStore
- : public SharedSingleton
- , LeakChecked
+template
+class ScopedTimeInterval : public Uncopyable
{
public:
- GlobalPagedFreeStore ();
- ~GlobalPagedFreeStore ();
-
-public:
- inline size_t getPageBytes ()
+ /** Create the measurement with a default-constructed UnaryFunction. */
+ ScopedTimeInterval ()
+ : m_start (RelativeTime::fromStartup())
{
- return m_allocator.getPageBytes ();
}
- inline void* allocate ()
+ /** Create the measurement with UnaryFunction constructed from one argument. */
+ template
+ explicit ScopedTimeInterval (Arg& arg)
+ : m_func (arg)
+ , m_start (RelativeTime::fromStartup ())
{
- return m_allocator.allocate ();
}
- static inline void deallocate (void* const p)
+ ~ScopedTimeInterval ()
{
- PagedFreeStore::deallocate (p);
+ m_func (RelativeTime::fromStartup() - m_start);
}
- static GlobalPagedFreeStore* createInstance ();
-
private:
- PagedFreeStore m_allocator;
+ UnaryFunction m_func;
+ RelativeTime m_start;
};
+}
+
#endif
diff --git a/beast/chrono/impl/CPUMeter.cpp b/beast/chrono/impl/CPUMeter.cpp
new file mode 100644
index 0000000000..b5a67f4d1b
--- /dev/null
+++ b/beast/chrono/impl/CPUMeter.cpp
@@ -0,0 +1,21 @@
+//------------------------------------------------------------------------------
+/*
+ This file is part of Beast: https://github.com/vinniefalco/Beast
+ Copyright 2013, Vinnie Falco
+
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+//==============================================================================
+
+#include "../CPUMeter.h"
+
diff --git a/beast/chrono/impl/RelativeTime.cpp b/beast/chrono/impl/RelativeTime.cpp
new file mode 100644
index 0000000000..c18bc8f864
--- /dev/null
+++ b/beast/chrono/impl/RelativeTime.cpp
@@ -0,0 +1,326 @@
+//------------------------------------------------------------------------------
+/*
+ This file is part of Beast: https://github.com/vinniefalco/Beast
+ Copyright 2013, Vinnie Falco
+
+ Portions of this file are from JUCE.
+ Copyright (c) 2013 - Raw Material Software Ltd.
+ Please visit http://www.juce.com
+
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+//==============================================================================
+
+#include "../RelativeTime.h"
+
+// VFALCO TODO Migrate the localizable strings interfaces for this file
+
+#ifndef NEEDS_TRANS
+#define NEEDS_TRANS(s) (s)
+#endif
+
+#ifndef TRANS
+#define TRANS(s) (s)
+#endif
+
+namespace beast {
+
+RelativeTime::RelativeTime (const RelativeTime::value_type secs) noexcept
+ : numSeconds (secs)
+{
+}
+
+RelativeTime::RelativeTime (const RelativeTime& other) noexcept
+ : numSeconds (other.numSeconds)
+{
+}
+
+RelativeTime::~RelativeTime() noexcept {}
+
+//==============================================================================
+
+RelativeTime RelativeTime::milliseconds (const int milliseconds) noexcept
+{
+ return RelativeTime (milliseconds * 0.001);
+}
+
+RelativeTime RelativeTime::milliseconds (const int64 milliseconds) noexcept
+{
+ return RelativeTime (milliseconds * 0.001);
+}
+
+RelativeTime RelativeTime::seconds (RelativeTime::value_type s) noexcept
+{
+ return RelativeTime (s);
+}
+
+RelativeTime RelativeTime::minutes (const RelativeTime::value_type numberOfMinutes) noexcept
+{
+ return RelativeTime (numberOfMinutes * 60.0);
+}
+
+RelativeTime RelativeTime::hours (const RelativeTime::value_type numberOfHours) noexcept
+{
+ return RelativeTime (numberOfHours * (60.0 * 60.0));
+}
+
+RelativeTime RelativeTime::days (const RelativeTime::value_type numberOfDays) noexcept
+{
+ return RelativeTime (numberOfDays * (60.0 * 60.0 * 24.0));
+}
+
+RelativeTime RelativeTime::weeks (const RelativeTime::value_type numberOfWeeks) noexcept
+{
+ return RelativeTime (numberOfWeeks * (60.0 * 60.0 * 24.0 * 7.0));
+}
+
+//==============================================================================
+
+int64 RelativeTime::inMilliseconds() const noexcept
+{
+ return (int64) (numSeconds * 1000.0);
+}
+
+RelativeTime::value_type RelativeTime::inMinutes() const noexcept
+{
+ return numSeconds / 60.0;
+}
+
+RelativeTime::value_type RelativeTime::inHours() const noexcept
+{
+ return numSeconds / (60.0 * 60.0);
+}
+
+RelativeTime::value_type RelativeTime::inDays() const noexcept
+{
+ return numSeconds / (60.0 * 60.0 * 24.0);
+}
+
+RelativeTime::value_type RelativeTime::inWeeks() const noexcept
+{
+ return numSeconds / (60.0 * 60.0 * 24.0 * 7.0);
+}
+
+//==============================================================================
+
+RelativeTime& RelativeTime::operator= (const RelativeTime& other) noexcept { numSeconds = other.numSeconds; return *this; }
+
+RelativeTime RelativeTime::operator+= (RelativeTime t) noexcept
+{
+ numSeconds += t.numSeconds; return *this;
+}
+
+RelativeTime RelativeTime::operator-= (RelativeTime t) noexcept
+{
+ numSeconds -= t.numSeconds; return *this;
+}
+
+RelativeTime RelativeTime::operator+= (const RelativeTime::value_type secs) noexcept
+{
+ numSeconds += secs; return *this;
+}
+
+RelativeTime RelativeTime::operator-= (const RelativeTime::value_type secs) noexcept
+{
+ numSeconds -= secs; return *this;
+}
+
+RelativeTime operator+ (RelativeTime t1, RelativeTime t2) noexcept
+{
+ return t1 += t2;
+}
+
+RelativeTime operator- (RelativeTime t1, RelativeTime t2) noexcept
+{
+ return t1 -= t2;
+}
+
+bool operator== (RelativeTime t1, RelativeTime t2) noexcept
+{
+ return t1.inSeconds() == t2.inSeconds();
+}
+
+bool operator!= (RelativeTime t1, RelativeTime t2) noexcept
+{
+ return t1.inSeconds() != t2.inSeconds();
+}
+
+bool operator> (RelativeTime t1, RelativeTime t2) noexcept
+{
+ return t1.inSeconds() > t2.inSeconds();
+}
+
+bool operator< (RelativeTime t1, RelativeTime t2) noexcept
+{
+ return t1.inSeconds() < t2.inSeconds();
+}
+
+bool operator>= (RelativeTime t1, RelativeTime t2) noexcept
+{
+ return t1.inSeconds() >= t2.inSeconds();
+}
+
+bool operator<= (RelativeTime t1, RelativeTime t2) noexcept
+{
+ return t1.inSeconds() <= t2.inSeconds();
+}
+
+//==============================================================================
+
+static void translateTimeField (String& result, int n, const char* singular, const char* plural)
+{
+ result << TRANS (String((n == 1) ? singular : plural))
+ .replace (n == 1 ? "1" : "2", String (n))
+ << ' ';
+}
+
+String RelativeTime::getDescription (const String& returnValueForZeroTime) const
+{
+ if (numSeconds < 0.001 && numSeconds > -0.001)
+ return returnValueForZeroTime;
+
+ String result;
+ result.preallocateBytes (32);
+
+ if (numSeconds < 0)
+ result << '-';
+
+ int fieldsShown = 0;
+ int n = std::abs ((int) inWeeks());
+ if (n > 0)
+ {
+ translateTimeField (result, n, NEEDS_TRANS("1 week"), NEEDS_TRANS("2 weeks"));
+ ++fieldsShown;
+ }
+
+ n = std::abs ((int) inDays()) % 7;
+ if (n > 0)
+ {
+ translateTimeField (result, n, NEEDS_TRANS("1 day"), NEEDS_TRANS("2 days"));
+ ++fieldsShown;
+ }
+
+ if (fieldsShown < 2)
+ {
+ n = std::abs ((int) inHours()) % 24;
+ if (n > 0)
+ {
+ translateTimeField (result, n, NEEDS_TRANS("1 hour"), NEEDS_TRANS("2 hours"));
+ ++fieldsShown;
+ }
+
+ if (fieldsShown < 2)
+ {
+ n = std::abs ((int) inMinutes()) % 60;
+ if (n > 0)
+ {
+ translateTimeField (result, n, NEEDS_TRANS("1 minute"), NEEDS_TRANS("2 minutes"));
+ ++fieldsShown;
+ }
+
+ if (fieldsShown < 2)
+ {
+ n = std::abs ((int) inSeconds()) % 60;
+ if (n > 0)
+ {
+ translateTimeField (result, n, NEEDS_TRANS("1 seconds"), NEEDS_TRANS("2 seconds"));
+ ++fieldsShown;
+ }
+
+ if (fieldsShown == 0)
+ {
+ n = std::abs ((int) inMilliseconds()) % 1000;
+ if (n > 0)
+ result << n << ' ' << TRANS ("ms");
+ }
+ }
+ }
+ }
+
+ return result.trimEnd();
+}
+
+std::string RelativeTime::to_string () const
+{
+ return getDescription ().toStdString();
+}
+
+}
+
+#if BEAST_WINDOWS
+
+#include
+
+namespace beast {
+
+RelativeTime RelativeTime::fromStartup ()
+{
+ ULONGLONG ticks (GetTickCount64());
+
+ return RelativeTime (ticks / 1000.0);
+}
+
+}
+
+#else
+
+#include
+
+namespace beast {
+
+namespace detail {
+
+// Converts a timespec to a RelativeTme
+static RelativeTime toRelativeTime (timespec const& ts)
+{
+ return RelativeTime (ts.tv_sec +
+ ts.tv_nsec / 1000000000.0);
+}
+
+// Records and returns the time from process startup
+static RelativeTime getStartupTime()
+{
+ struct StartupTime
+ {
+ StartupTime ()
+ { clock_gettime (CLOCK_MONOTONIC, &ts); }
+ timespec ts;
+ };
+
+ static StartupTime startupTime;
+
+ return toRelativeTime (startupTime.ts);
+}
+
+// Used to call getStartupTime as early as possible
+struct StartupTimeStaticInitializer
+{
+ StartupTimeStaticInitializer ()
+ { getStartupTime(); }
+};
+
+static StartupTimeStaticInitializer startupTimeStaticInitializer;
+
+}
+
+RelativeTime RelativeTime::fromStartup ()
+{
+ timespec ts;
+ clock_gettime (CLOCK_MONOTONIC, &ts);
+
+ return detail::toRelativeTime (ts) - detail::getStartupTime();
+}
+
+}
+
+#endif
diff --git a/modules/beast_core/system/PlatformDefs.h b/beast/config/CompilerConfig.h
similarity index 91%
rename from modules/beast_core/system/PlatformDefs.h
rename to beast/config/CompilerConfig.h
index f9bd910a1d..46e3afbfa5 100644
--- a/modules/beast_core/system/PlatformDefs.h
+++ b/beast/config/CompilerConfig.h
@@ -21,16 +21,20 @@
*/
//==============================================================================
-#ifndef BEAST_PLATFORMDEFS_H_INCLUDED
-#define BEAST_PLATFORMDEFS_H_INCLUDED
+#ifndef BEAST_CONFIG_COMPILERCONFIG_H_INCLUDED
+#define BEAST_CONFIG_COMPILERCONFIG_H_INCLUDED
+
+// This file has to work when included in a C source file.
+
+#ifndef BEAST_CONFIG_PLATFORMCONFIG_H_INCLUDED
+#error "PlatformConfig.h must come first!"
+#endif
// This file defines miscellaneous macros for debugging, assertions, etc.
-#ifdef BEAST_FORCE_DEBUG
+#if BEAST_FORCE_DEBUG
# undef BEAST_DEBUG
-# if BEAST_FORCE_DEBUG
-# define BEAST_DEBUG 1
-# endif
+# define BEAST_DEBUG 1
#endif
/** This macro defines the C calling convention used as the standard for Beast calls.
@@ -86,6 +90,17 @@
//------------------------------------------------------------------------------
+#ifdef __cplusplus
+extern "C" {
+#endif
+/** Report a fatal error message and terminate the application.
+ Normally you won't call this directly.
+*/
+extern void beast_reportFatalError (char const* message, char const* fileName, int lineNumber);
+#ifdef __cplusplus
+}
+#endif
+
#if BEAST_DEBUG || DOXYGEN
/** Writes a string to the standard error stream.
@@ -101,17 +116,12 @@
#define bassertfalse { beast_LogCurrentAssertion; if (beast::beast_isRunningUnderDebugger()) beast_breakDebugger; BEAST_ANALYZER_NORETURN }
/** Platform-independent assertion macro.
-
This macro gets turned into a no-op when you're building with debugging turned off, so be
careful that the expression you pass to it doesn't perform any actions that are vital for the
correct behaviour of your program!
@see bassertfalse
*/
-#if 0
-#define bassert(expression) { if (! (expression)) bassertfalse; }
-#else
-#define bassert(expression) { if (! (expression)) fatal_error(#expression); }
-#endif
+#define bassert(expression) { if (! (expression)) beast_reportFatalError(#expression,__FILE__,__LINE__); }
#else
@@ -130,21 +140,6 @@
//------------------------------------------------------------------------------
-#ifndef DOXYGEN
-namespace beast
-{
-template struct BeastStaticAssert;
-template <> struct BeastStaticAssert { static void dummy() {} };
-}
-#endif
-
-/** A compile-time assertion macro.
- If the expression parameter is false, the macro will cause a compile error. (The actual error
- message that the compiler generates may be completely bizarre and seem to have no relation to
- the place where you put the static_assert though!)
-*/
-#define static_bassert(expression) beast::BeastStaticAssert::dummy();
-
/** This macro can be added to class definitions to disable the use of new/delete to
allocate the object on the heap, forcing it to only be used as a stack or member variable.
*/
@@ -300,4 +295,11 @@ template <> struct BeastStaticAssert { static void dummy() {} };
#define override
#endif
+#ifdef __cplusplus
+namespace beast {
+bool beast_isRunningUnderDebugger();
+void logAssertion (char const* file, int line) noexcept;
+}
+#endif
+
#endif
diff --git a/modules/beast_core/system/BeastConfigCheck.h b/beast/config/ConfigCheck.h
similarity index 91%
rename from modules/beast_core/system/BeastConfigCheck.h
rename to beast/config/ConfigCheck.h
index 2ce310578d..7ee5955762 100644
--- a/modules/beast_core/system/BeastConfigCheck.h
+++ b/beast/config/ConfigCheck.h
@@ -17,8 +17,8 @@
*/
//==============================================================================
-#ifndef BEAST_CORE_SYSTEM_BEASTCONFIGCHECK_H_INCLUDED
-#define BEAST_CORE_SYSTEM_BEASTCONFIGCHECK_H_INCLUDED
+#ifndef BEAST_CONFIG_CONFIGCHECK_H_INCLUDED
+#define BEAST_CONFIG_CONFIGCHECK_H_INCLUDED
// This file makes sure that BeastConfig.h was included.
// It also sets defaults for all config options.
@@ -55,10 +55,6 @@
# endif
#endif
-#ifndef BEAST_CATCH_UNHANDLED_EXCEPTIONS
-#define BEAST_CATCH_UNHANDLED_EXCEPTIONS 0
-#endif
-
#if BEAST_DEBUG && ! defined (BEAST_CHECK_MEMORY_LEAKS)
#define BEAST_CHECK_MEMORY_LEAKS 1
#endif
@@ -73,10 +69,6 @@
//------------------------------------------------------------------------------
-#ifndef BEAST_DISABLE_BEAST_VERSION_PRINTING
-#define BEAST_DISABLE_BEAST_VERSION_PRINTING 0
-#endif
-
#ifndef BEAST_DONT_AUTOLINK_TO_WIN32_LIBRARIES
#define BEAST_DONT_AUTOLINK_TO_WIN32_LIBRARIES 0
#endif
diff --git a/modules/beast_core/diagnostic/ContractChecks.h b/beast/config/ContractChecks.h
similarity index 92%
rename from modules/beast_core/diagnostic/ContractChecks.h
rename to beast/config/ContractChecks.h
index b7d9e09a0f..59cad4231c 100644
--- a/modules/beast_core/diagnostic/ContractChecks.h
+++ b/beast/config/ContractChecks.h
@@ -17,8 +17,10 @@
*/
//==============================================================================
-#ifndef BEAST_CONTRACTCHECKS_H_INCLUDED
-#define BEAST_CONTRACTCHECKS_H_INCLUDED
+#ifndef BEAST_CONFIG_CONTRACTCHECKS_H_INCLUDED
+#define BEAST_CONFIG_CONTRACTCHECKS_H_INCLUDED
+
+// This file has to work when included in a C source file.
#if defined (fatal_error) || \
defined (fatal_condition) || \
@@ -33,15 +35,13 @@
#error "Programming by contract macros cannot be overriden!"
#endif
-extern void reportFatalError (char const* message, char const* fileName, int lineNumber);
-
/** Report a fatal error message and terminate the application.
This macro automatically fills in the file and line number
Meets this declaration syntax:
@code inline void fatal_error (char const* message); @endif
@see FatalError
*/
-#define fatal_error(message) reportFatalError (message, __FILE__, __LINE__)
+#define fatal_error(message) beast_reportFatalError (message, __FILE__, __LINE__)
/** Reports a fatal error message type if the condition is false
The condition is always evaluated regardless of settings.
@@ -49,7 +49,7 @@ extern void reportFatalError (char const* message, char const* fileName, int lin
@code inline void fatal_condition (bool condition, char const* category); @endcode
*/
#define fatal_condition(condition,category) static_cast \
- (((!!(condition)) || (reportFatalError ( \
+ (((!!(condition)) || (beast_reportFatalError ( \
category " '" BEAST_STRINGIFY(condition) "' failed.", __FILE__, __LINE__), 0)))
/** Replacement for assert which generates a fatal error if the condition is false.
@@ -65,7 +65,7 @@ extern void reportFatalError (char const* message, char const* fileName, int lin
@code inline void fatal_condition (bool condition, char const* category); @endcode
*/
#define meets_condition(condition,category) static_cast \
- (((!!(condition)) || (reportFatalError ( \
+ (((!!(condition)) || (beast_reportFatalError ( \
category " '" BEAST_STRINGIFY(condition) "' failed.", __FILE__, __LINE__), false)))
/** Condition tests for programming by contract.
diff --git a/modules/beast_core/system/TargetPlatform.h b/beast/config/PlatformConfig.h
similarity index 98%
rename from modules/beast_core/system/TargetPlatform.h
rename to beast/config/PlatformConfig.h
index 4e60bf1d6d..ec59dab8d7 100644
--- a/modules/beast_core/system/TargetPlatform.h
+++ b/beast/config/PlatformConfig.h
@@ -21,8 +21,8 @@
*/
//==============================================================================
-#ifndef BEAST_TARGETPLATFORM_H_INCLUDED
-#define BEAST_TARGETPLATFORM_H_INCLUDED
+#ifndef BEAST_CONFIG_PLATFORMCONFIG_H_INCLUDED
+#define BEAST_CONFIG_PLATFORMCONFIG_H_INCLUDED
//==============================================================================
/* This file figures out which platform is being built, and defines some macros
@@ -213,4 +213,5 @@
#define BEAST_PP_STR1_(x) BEAST_PP_STR2_(x)
#define BEAST_FILEANDLINE_ __FILE__ "(" BEAST_PP_STR1_(__LINE__) "): warning:"
-#endif // BEAST_TARGETPLATFORM_H_INCLUDED
+#endif
+
diff --git a/beast/config/SelectCompilerConfig.h b/beast/config/SelectCompilerConfig.h
new file mode 100644
index 0000000000..addf083bbe
--- /dev/null
+++ b/beast/config/SelectCompilerConfig.h
@@ -0,0 +1,44 @@
+//------------------------------------------------------------------------------
+/*
+ This file is part of Beast: https://github.com/vinniefalco/Beast
+ Copyright 2013, Vinnie Falco
+
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+//==============================================================================
+
+// Ideas from boost
+
+// Intel
+#if defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC)
+#define BEAST_COMPILER_CONFIG "config/compiler/Intel.h"
+
+// Clang C++ emulates GCC, so it has to appear early.
+#elif defined __clang__
+#define BEAST_COMPILER_CONFIG "config/compiler/Clang.h"
+
+// GNU C++:
+#elif defined __GNUC__
+#define BEAST_COMPILER_CONFIG "config/compiler/Gcc.h"
+
+// Microsoft Visual C++
+//
+// Must remain the last #elif since some other vendors (Metrowerks, for
+// example) also #define _MSC_VER
+#elif defined _MSC_VER
+#define BEAST_COMPILER_CONFIG "config/compiler/VisualC.h"
+
+#else
+#error "Unsupported compiler."
+#endif
+
diff --git a/modules/beast_core/containers/detail/removecv.h b/beast/config/SelectPlatformConfig.h
similarity index 53%
rename from modules/beast_core/containers/detail/removecv.h
rename to beast/config/SelectPlatformConfig.h
index 19b3d3bc45..eb00e630bc 100644
--- a/modules/beast_core/containers/detail/removecv.h
+++ b/beast/config/SelectPlatformConfig.h
@@ -17,57 +17,28 @@
*/
//==============================================================================
-#ifndef BEAST_CORE_CONTAINERS_DETAIL_REMOVECV_H_INCLUDED
-#define BEAST_CORE_CONTAINERS_DETAIL_REMOVECV_H_INCLUDED
+// Ideas from boost
-namespace detail
-{
+// Android, which must be manually set by defining BEAST_ANDROID
+#if defined(BEAST_ANDROID)
+#define BEAST_PLATFORM_CONFIG "config/platform/Android.h"
-// Strip all cv qualifiers from T
-template
-struct removecv
-{
- typedef T type;
-};
+// linux, also other platforms (Hurd etc) that use GLIBC
+#elif (defined(linux) || defined(__linux) || defined(__linux__) || defined(__GNU__) || defined(__GLIBC__)) && !defined(_CRAYC)
+#define BEAST_PLATFORM_CONFIG "config/platform/Linux.h"
-template
-struct removecv
-{
- typedef typename removecv ::type type;
-};
+// BSD
+#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
+#define BEAST_PLATFORM_CONFIG "config/platform/Bsd.h"
-template
-struct removecv
-{
- typedef typename removecv ::type type;
-};
+// win32
+#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(_WIN64)
+#define BEAST_PLATFORM_CONFIG "config/platform/Win32.h"
-template
-struct removecv
-{
- typedef typename removecv ::type type;
-};
-
-template
-struct removecv
-{
- typedef typename removecv ::type type;
-};
-
-template
-struct removecv
-{
- typedef typename removecv ::type type;
-};
-
-#if BEAST_COMPILER_SUPPORTS_MOVE_SEMANTICS
-template
-struct removecv
-{
- typedef typename removecv ::type type;
-};
-#endif
-
-}
+// MacOS
+#elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) || defined(__APPLE_CPP__)
+#define BEAST_PLATFORM_CONFIG "config/platform/MacOS.h"
+#else
+#error "Unsupported platform."
#endif
diff --git a/beast/config/SelectStdlibConfig.h b/beast/config/SelectStdlibConfig.h
new file mode 100644
index 0000000000..ccc99a2a56
--- /dev/null
+++ b/beast/config/SelectStdlibConfig.h
@@ -0,0 +1,21 @@
+//------------------------------------------------------------------------------
+/*
+ This file is part of Beast: https://github.com/vinniefalco/Beast
+ Copyright 2013, Vinnie Falco
+
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+//==============================================================================
+
+// Ideas from boost
+
diff --git a/modules/beast_core/system/StandardHeader.h b/beast/config/StandardConfig.h
similarity index 66%
rename from modules/beast_core/system/StandardHeader.h
rename to beast/config/StandardConfig.h
index 43415b9659..6f2a67c875 100644
--- a/modules/beast_core/system/StandardHeader.h
+++ b/beast/config/StandardConfig.h
@@ -21,33 +21,12 @@
*/
//==============================================================================
-#ifndef BEAST_STANDARDHEADER_H_INCLUDED
-#define BEAST_STANDARDHEADER_H_INCLUDED
+#ifndef BEAST_CONFIG_STANDARDCONFIG_H_INCLUDED
+#define BEAST_CONFIG_STANDARDCONFIG_H_INCLUDED
-//------------------------------------------------------------------------------
-
-/** Current BEAST version number.
-
- See also SystemStats::getBeastVersion() for a string version.
-*/
-// VFALCO TODO Replace this with SemanticVerson
-#define BEAST_MAJOR_VERSION 1
-#define BEAST_MINOR_VERSION 0
-#define BEAST_BUILDNUMBER 0
-
-/** Current Beast version number.
-
- Bits 16 to 32 = major version.
- Bits 8 to 16 = minor version.
- Bits 0 to 8 = point release.
-
- See also SystemStats::getBeastVersion() for a string version.
-*/
-#define BEAST_VERSION ((BEAST_MAJOR_VERSION << 16) + (BEAST_MINOR_VERSION << 8) + BEAST_BUILDNUMBER)
-
-//------------------------------------------------------------------------------
-
-#include "PlatformDefs.h"
+#ifndef BEAST_CONFIG_COMPILERCONFIG_H_INCLUDED
+#error "CompilerConfig.h must be included first"
+#endif
// Now we'll include some common OS headers..
#if BEAST_MSVC
@@ -55,45 +34,6 @@
#pragma warning (disable: 4514 4245 4100)
#endif
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include