summaryrefslogtreecommitdiff
path: root/config_ns.h
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2019-05-17 15:18:17 -0400
committerGitHub <noreply@github.com>2019-05-17 15:18:17 -0400
commitc51f0ecbfd21b1eb29cfd26ea870b175d92db6c6 (patch)
tree87f0f2dbe92e25d2816ab6077e93714b2e69d863 /config_ns.h
parentb25b6f0892ebab5cc8a5e8c494c0db69057e1ba8 (diff)
downloadcryptopp-git-c51f0ecbfd21b1eb29cfd26ea870b175d92db6c6.tar.gz
Make config.h more Autoconf friendly (GH #835, PR #836)
Diffstat (limited to 'config_ns.h')
-rw-r--r--config_ns.h68
1 files changed, 68 insertions, 0 deletions
diff --git a/config_ns.h b/config_ns.h
new file mode 100644
index 00000000..bf91c2fb
--- /dev/null
+++ b/config_ns.h
@@ -0,0 +1,68 @@
+// config_ns.h - written and placed in public domain by Jeffrey Walton
+// the bits that make up this source file are from the
+// library's monolithic config.h.
+
+/// \file config_ns.h
+/// \brief Library configuration file
+/// \details <tt>config.h</tt> was split into components in May 2019 to better
+/// integrate with Autoconf and its feature tests. The splitting occured so
+/// users could continue to include <tt>config.h</tt> while allowing Autoconf
+/// to write new <tt>config_asm.h</tt> and new <tt>config_cxx.h</tt> using
+/// its feature tests.
+/// \sa <A HREF="https://github.com/weidai11/cryptopp/issues/835">Issue 835</A>
+/// \since Crypto++ 8.3
+
+#ifndef CRYPTOPP_CONFIG_NAMESPACE_H
+#define CRYPTOPP_CONFIG_NAMESPACE_H
+
+// namespace support is now required
+#ifdef NO_NAMESPACE
+# error namespace support is now required
+#endif
+
+#ifdef CRYPTOPP_DOXYGEN_PROCESSING
+
+/// \namespace CryptoPP
+/// \brief Crypto++ library namespace
+/// \details Nearly all classes are located in the CryptoPP namespace. Within
+/// the namespace, there are two additional namespaces.
+/// <ul>
+/// <li>Name - namespace for names used with NameValuePairs and documented
+/// in argnames.h
+/// <li>NaCl - namespace for NaCl test functions like crypto_box,
+/// crypto_box_open, crypto_sign, and crypto_sign_open
+/// <li>Donna - namespace for curve25519 library operations. The name was
+/// selected due to use of Langley and Moon's curve25519-donna.
+/// <li>Test - namespace for testing and benchmarks classes
+/// <li>Weak - namespace for weak and wounded algorithms, like ARC4, MD5
+/// and Pananma
+/// </ul>
+namespace CryptoPP { }
+
+// Bring in the symbols found in the weak namespace; and fold Weak1 into Weak
+#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1
+#define Weak1 Weak
+// Avoid putting "CryptoPP::" in front of everything in Doxygen output
+#define CryptoPP
+#define NAMESPACE_BEGIN(x)
+#define NAMESPACE_END
+// Get Doxygen to generate better documentation for these typedefs
+#define DOCUMENTED_TYPEDEF(x, y) class y : public x {};
+// Make "protected" "private" so the functions and members are not documented
+#define protected private
+
+#else
+// Not Doxygen
+#define NAMESPACE_BEGIN(x) namespace x {
+#define NAMESPACE_END }
+#define DOCUMENTED_TYPEDEF(x, y) typedef x y;
+
+#endif // CRYPTOPP_DOXYGEN_PROCESSING
+
+#define ANONYMOUS_NAMESPACE_BEGIN namespace {
+#define ANONYMOUS_NAMESPACE_END }
+#define USING_NAMESPACE(x) using namespace x;
+#define DOCUMENTED_NAMESPACE_BEGIN(x) namespace x {
+#define DOCUMENTED_NAMESPACE_END }
+
+#endif // CRYPTOPP_CONFIG_NAMESPACE_H