summaryrefslogtreecommitdiff
path: root/src/generic
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2014-06-26 21:59:27 -0700
committerBen Longbons <b.r.longbons@gmail.com>2014-06-26 22:28:22 -0700
commit2f4fc005937e75d931eb6ef87a3fe16364d45113 (patch)
tree2a60ea7b58e9a3045ec0e0754e075ae958e46409 /src/generic
parentf5fcb973cfad6221264a2a859f5236c3cef2c470 (diff)
downloadtmwa-2f4fc005937e75d931eb6ef87a3fe16364d45113.tar.gz
tmwa-2f4fc005937e75d931eb6ef87a3fe16364d45113.tar.bz2
tmwa-2f4fc005937e75d931eb6ef87a3fe16364d45113.tar.xz
tmwa-2f4fc005937e75d931eb6ef87a3fe16364d45113.zip
Stick everything in a namespace
Diffstat (limited to 'src/generic')
-rw-r--r--src/generic/array.cpp5
-rw-r--r--src/generic/array.hpp4
-rw-r--r--src/generic/array_test.cpp3
-rw-r--r--src/generic/db.cpp5
-rw-r--r--src/generic/db.hpp4
-rw-r--r--src/generic/dumb_ptr.cpp5
-rw-r--r--src/generic/dumb_ptr.hpp4
-rw-r--r--src/generic/enum.cpp5
-rw-r--r--src/generic/enum.hpp4
-rw-r--r--src/generic/fwd.hpp4
-rw-r--r--src/generic/intern-pool.cpp5
-rw-r--r--src/generic/intern-pool.hpp4
-rw-r--r--src/generic/intern-pool_test.cpp3
-rw-r--r--src/generic/matrix.cpp5
-rw-r--r--src/generic/matrix.hpp4
-rw-r--r--src/generic/md5.cpp4
-rw-r--r--src/generic/md5.hpp4
-rw-r--r--src/generic/md5_test.cpp3
-rw-r--r--src/generic/oops.cpp3
-rw-r--r--src/generic/oops.hpp3
-rw-r--r--src/generic/oops_test.cpp5
-rw-r--r--src/generic/operators.cpp5
-rw-r--r--src/generic/operators.hpp4
-rw-r--r--src/generic/random.cpp4
-rw-r--r--src/generic/random.hpp4
-rw-r--r--src/generic/random.t.hpp4
-rw-r--r--src/generic/random2.hpp4
27 files changed, 110 insertions, 1 deletions
diff --git a/src/generic/array.cpp b/src/generic/array.cpp
index 96c85ac..3063569 100644
--- a/src/generic/array.cpp
+++ b/src/generic/array.cpp
@@ -19,3 +19,8 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "../poison.hpp"
+
+
+namespace tmwa
+{
+} // namespace tmwa
diff --git a/src/generic/array.hpp b/src/generic/array.hpp
index 5e4dd67..cf50dc8 100644
--- a/src/generic/array.hpp
+++ b/src/generic/array.hpp
@@ -26,6 +26,9 @@
# include "oops.hpp"
+
+namespace tmwa
+{
template<class I, I be, I en>
struct ExclusiveIndexing
{
@@ -113,5 +116,6 @@ public:
template<class T, size_t n>
using Array = GenericArray<T, SimpleIndexing<n>>;
+} // namespace tmwa
#endif // TMWA_GENERIC_ARRAY_HPP
diff --git a/src/generic/array_test.cpp b/src/generic/array_test.cpp
index a4d4d74..eb31523 100644
--- a/src/generic/array_test.cpp
+++ b/src/generic/array_test.cpp
@@ -23,6 +23,8 @@
#include "../poison.hpp"
+namespace tmwa
+{
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
TEST(Array, simple)
@@ -159,3 +161,4 @@ TEST(Array, enum)
SUCCEED();
}
}
+} // namespace tmwa
diff --git a/src/generic/db.cpp b/src/generic/db.cpp
index b953ff0..458068c 100644
--- a/src/generic/db.cpp
+++ b/src/generic/db.cpp
@@ -19,3 +19,8 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "../poison.hpp"
+
+
+namespace tmwa
+{
+} // namespace tmwa
diff --git a/src/generic/db.hpp b/src/generic/db.hpp
index 0eac890..3caac91 100644
--- a/src/generic/db.hpp
+++ b/src/generic/db.hpp
@@ -24,6 +24,9 @@
# include <map>
# include <memory>
+
+namespace tmwa
+{
template<class K, class V>
class Map
{
@@ -176,5 +179,6 @@ public:
return impl.size();
}
};
+} // namespace tmwa
#endif // TMWA_GENERIC_DB_HPP
diff --git a/src/generic/dumb_ptr.cpp b/src/generic/dumb_ptr.cpp
index 77e3080..e690f7d 100644
--- a/src/generic/dumb_ptr.cpp
+++ b/src/generic/dumb_ptr.cpp
@@ -19,3 +19,8 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "../poison.hpp"
+
+
+namespace tmwa
+{
+} // namespace tmwa
diff --git a/src/generic/dumb_ptr.hpp b/src/generic/dumb_ptr.hpp
index ed18317..4d4473f 100644
--- a/src/generic/dumb_ptr.hpp
+++ b/src/generic/dumb_ptr.hpp
@@ -30,6 +30,9 @@
# include "../strings/zstring.hpp"
# include "../strings/xstring.hpp"
+
+namespace tmwa
+{
// unmanaged new/delete-able pointer
// should be replaced by std::unique_ptr<T>
template<class T>
@@ -267,5 +270,6 @@ const char *convert_for_printf(dumb_string ds)
{
return ds.c_str();
}
+} // namespace tmwa
#endif // TMWA_GENERIC_DUMB_PTR_HPP
diff --git a/src/generic/enum.cpp b/src/generic/enum.cpp
index 8c54aba..49402e9 100644
--- a/src/generic/enum.cpp
+++ b/src/generic/enum.cpp
@@ -19,3 +19,8 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "../poison.hpp"
+
+
+namespace tmwa
+{
+} // namespace tmwa
diff --git a/src/generic/enum.hpp b/src/generic/enum.hpp
index 1e83c24..2fe748d 100644
--- a/src/generic/enum.hpp
+++ b/src/generic/enum.hpp
@@ -31,6 +31,9 @@
# include "array.hpp"
+
+namespace tmwa
+{
template<class T, class E, E max>
using earray = GenericArray<T, EnumIndexing<E, max>>;
@@ -156,5 +159,6 @@ IteratorPair<ValueIterator<E, EnumMath<E>>> erange(E b, E e)
{
return {b, e};
}
+} // namespace tmwa
#endif // TMWA_GENERIC_ENUM_HPP
diff --git a/src/generic/fwd.hpp b/src/generic/fwd.hpp
index fcb1fab..93d664c 100644
--- a/src/generic/fwd.hpp
+++ b/src/generic/fwd.hpp
@@ -21,9 +21,13 @@
# include "../sanity.hpp"
+
+namespace tmwa
+{
// meh, add more when I feel like it
template<class T>
class dumb_ptr;
class dumb_string;
+} // namespace tmwa
#endif // TMWA_GENERIC_FWD_HPP
diff --git a/src/generic/intern-pool.cpp b/src/generic/intern-pool.cpp
index f6df5a6..f45b098 100644
--- a/src/generic/intern-pool.cpp
+++ b/src/generic/intern-pool.cpp
@@ -19,3 +19,8 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "../poison.hpp"
+
+
+namespace tmwa
+{
+} // namespace tmwa
diff --git a/src/generic/intern-pool.hpp b/src/generic/intern-pool.hpp
index 62a1d7f..e209b4b 100644
--- a/src/generic/intern-pool.hpp
+++ b/src/generic/intern-pool.hpp
@@ -31,6 +31,9 @@
# include "../strings/zstring.hpp"
# include "../strings/xstring.hpp"
+
+namespace tmwa
+{
class InternPool
{
std::map<RString, size_t> known;
@@ -59,5 +62,6 @@ public:
return known.size();
}
};
+} // namespace tmwa
#endif // TMWA_GENERIC_INTERN_POOL_HPP
diff --git a/src/generic/intern-pool_test.cpp b/src/generic/intern-pool_test.cpp
index 66490be..5858031 100644
--- a/src/generic/intern-pool_test.cpp
+++ b/src/generic/intern-pool_test.cpp
@@ -25,6 +25,8 @@
#include "../poison.hpp"
+namespace tmwa
+{
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
TEST(InternPool, whydoesthisalwaysneedasecondname)
@@ -41,3 +43,4 @@ TEST(InternPool, whydoesthisalwaysneedasecondname)
EXPECT_EQ("hello"_s, p.outtern(0));
EXPECT_EQ("world"_s, p.outtern(1));
}
+} // namespace tmwa
diff --git a/src/generic/matrix.cpp b/src/generic/matrix.cpp
index e1e1f5e..b14ab7d 100644
--- a/src/generic/matrix.cpp
+++ b/src/generic/matrix.cpp
@@ -19,3 +19,8 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "../poison.hpp"
+
+
+namespace tmwa
+{
+} // namespace tmwa
diff --git a/src/generic/matrix.hpp b/src/generic/matrix.hpp
index fb18a4c..36be084 100644
--- a/src/generic/matrix.hpp
+++ b/src/generic/matrix.hpp
@@ -25,6 +25,9 @@
# include "../compat/memory.hpp"
+
+namespace tmwa
+{
template<class T>
class Matrix
{
@@ -74,5 +77,6 @@ public:
return _ys;
}
};
+} // namespace tmwa
#endif // TMWA_GENERIC_MATRIX_HPP
diff --git a/src/generic/md5.cpp b/src/generic/md5.cpp
index 38a605c..771ad0f 100644
--- a/src/generic/md5.cpp
+++ b/src/generic/md5.cpp
@@ -24,6 +24,9 @@
#include "../poison.hpp"
+
+namespace tmwa
+{
// auxilary data
/*
sin() constant table
@@ -245,3 +248,4 @@ MD5_state MD5_from_string(XString msg)
}
return state;
}
+} // namespace tmwa
diff --git a/src/generic/md5.hpp b/src/generic/md5.hpp
index fd23eca..fbe25d1 100644
--- a/src/generic/md5.hpp
+++ b/src/generic/md5.hpp
@@ -28,6 +28,9 @@
# include "../strings/fwd.hpp"
# include "../strings/vstring.hpp"
+
+namespace tmwa
+{
/// The digest state - becomes the output
struct MD5_state
{
@@ -54,5 +57,6 @@ void MD5_to_str(MD5_state state, md5_string& out);
// Convenience
MD5_state MD5_from_string(XString msg);
+} // namespace tmwa
#endif // TMWA_GENERIC_MD5CALC_HPP
diff --git a/src/generic/md5_test.cpp b/src/generic/md5_test.cpp
index b7854c9..929e94f 100644
--- a/src/generic/md5_test.cpp
+++ b/src/generic/md5_test.cpp
@@ -26,6 +26,8 @@
#include "../poison.hpp"
+namespace tmwa
+{
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
// This should be made part of the main API,
@@ -49,3 +51,4 @@ TEST(md5calc, rfc1321)
EXPECT_EQ("d174ab98d277d9f5a5611c2c9f419d9f"_s, MD5("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"_s));
EXPECT_EQ("57edf4a22be3c955ac49da2e2107b67a"_s, MD5("12345678901234567890123456789012345678901234567890123456789012345678901234567890"_s));
}
+} // namespace tmwa
diff --git a/src/generic/oops.cpp b/src/generic/oops.cpp
index 95fdcad..601ab37 100644
--- a/src/generic/oops.cpp
+++ b/src/generic/oops.cpp
@@ -25,6 +25,8 @@
//#include "../poison.hpp"
+namespace tmwa
+{
static
std::string do_asprintf(const char *desc, const char *expr,
const char *file, size_t line, const char *function)
@@ -43,3 +45,4 @@ AssertionError::AssertionError(const char *desc, const char *expr,
const char *file, size_t line, const char *function)
: std::runtime_error(do_asprintf(desc, expr, file, line, function))
{}
+} // namespace tmwa
diff --git a/src/generic/oops.hpp b/src/generic/oops.hpp
index cc0cdcd..7c03e42 100644
--- a/src/generic/oops.hpp
+++ b/src/generic/oops.hpp
@@ -28,6 +28,8 @@
# include "oops.hpp"
+namespace tmwa
+{
class AssertionError : public std::runtime_error
{
public:
@@ -38,5 +40,6 @@ public:
# define ALLEGE(desc, expr) \
if (expr) {} \
else throw AssertionError(desc, #expr, __FILE__, __LINE__, __PRETTY_FUNCTION__)
+} // namespace tmwa
#endif // TMWA_GENERIC_OOPS_HPP
diff --git a/src/generic/oops_test.cpp b/src/generic/oops_test.cpp
index 13f7fac..e1a5381 100644
--- a/src/generic/oops_test.cpp
+++ b/src/generic/oops_test.cpp
@@ -23,6 +23,8 @@
#include "../poison.hpp"
+namespace tmwa
+{
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
TEST(oops, okay)
@@ -48,6 +50,7 @@ TEST(oops, uhoh)
catch (const AssertionError& e)
{
ASSERT_STREQ(strstr(e.what(), "src/generic/"),
- "src/generic/oops_test.cpp:45: error: in 'virtual void oops_uhoh_Test::TestBody()', incorrectly alleged that 'the sky is falling' (1 == 0)");
+ "src/generic/oops_test.cpp:47: error: in 'virtual void tmwa::oops_uhoh_Test::TestBody()', incorrectly alleged that 'the sky is falling' (1 == 0)");
}
}
+} // namespace tmwa
diff --git a/src/generic/operators.cpp b/src/generic/operators.cpp
index 8d79e1b..614ae51 100644
--- a/src/generic/operators.cpp
+++ b/src/generic/operators.cpp
@@ -19,3 +19,8 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "../poison.hpp"
+
+
+namespace tmwa
+{
+} // namespace tmwa
diff --git a/src/generic/operators.hpp b/src/generic/operators.hpp
index ca9311a..15246ef 100644
--- a/src/generic/operators.hpp
+++ b/src/generic/operators.hpp
@@ -21,6 +21,9 @@
# include "fwd.hpp"
+
+namespace tmwa
+{
namespace _operators
{
class Comparable {};
@@ -63,5 +66,6 @@ namespace _operators
}
using _operators::Comparable;
+} // namespace tmwa
#endif // TMWA_GENERIC_OPERATORS_HPP
diff --git a/src/generic/random.cpp b/src/generic/random.cpp
index 8a06571..e37a3d1 100644
--- a/src/generic/random.cpp
+++ b/src/generic/random.cpp
@@ -20,7 +20,11 @@
#include "../poison.hpp"
+
+namespace tmwa
+{
namespace random_
{
std::mt19937 generate{std::random_device()()};
} // namespace random_
+} // namespace tmwa
diff --git a/src/generic/random.hpp b/src/generic/random.hpp
index 3b27b36..71883cc 100644
--- a/src/generic/random.hpp
+++ b/src/generic/random.hpp
@@ -25,6 +25,9 @@
# include <random>
+
+namespace tmwa
+{
// This is not namespace random since that collides with a C function,
// but this can be revisited when everything goes into namespace tmwa.
namespace random_
@@ -83,5 +86,6 @@ namespace random_
return random_::choice(il);
}
} // namespace random_
+} // namespace tmwa
#endif // TMWA_GENERIC_RANDOM_HPP
diff --git a/src/generic/random.t.hpp b/src/generic/random.t.hpp
index b20cb64..c68643a 100644
--- a/src/generic/random.t.hpp
+++ b/src/generic/random.t.hpp
@@ -21,6 +21,9 @@
# include "fwd.hpp"
+
+namespace tmwa
+{
namespace random_
{
struct Fraction
@@ -39,5 +42,6 @@ namespace random_
}
};
} // namespace random_
+} // namespace tmwa
#endif // TMWA_GENERIC_RANDOM_T_HPP
diff --git a/src/generic/random2.hpp b/src/generic/random2.hpp
index 47e4222..1aee094 100644
--- a/src/generic/random2.hpp
+++ b/src/generic/random2.hpp
@@ -27,6 +27,9 @@
# include "../compat/iter.hpp"
+
+namespace tmwa
+{
namespace random_
{
namespace detail
@@ -91,5 +94,6 @@ namespace random_
std::random_shuffle(c.begin(), c.end(), random_::to);
}
} // namespace random_
+} // namespace tmwa
#endif // TMWA_GENERIC_RANDOM2_HPP