summaryrefslogtreecommitdiff
path: root/src/generic
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2014-06-27 19:16:45 -0700
committerBen Longbons <b.r.longbons@gmail.com>2014-06-27 19:33:42 -0700
commit7af4c5b5c561362cb1135ab504095ae667a9270a (patch)
tree49ffd3008d7634ba36f3951493a68e928407ce89 /src/generic
parent8d7f1dadeeb1dc1609b72de5a4ee3a5247b0e9e6 (diff)
downloadtmwa-7af4c5b5c561362cb1135ab504095ae667a9270a.tar.gz
tmwa-7af4c5b5c561362cb1135ab504095ae667a9270a.tar.bz2
tmwa-7af4c5b5c561362cb1135ab504095ae667a9270a.tar.xz
tmwa-7af4c5b5c561362cb1135ab504095ae667a9270a.zip
This is more reliable
Diffstat (limited to 'src/generic')
-rw-r--r--src/generic/array.hpp13
-rw-r--r--src/generic/db.hpp11
-rw-r--r--src/generic/dumb_ptr.hpp23
-rw-r--r--src/generic/enum.hpp21
-rw-r--r--src/generic/fwd.hpp7
-rw-r--r--src/generic/intern-pool.hpp21
-rw-r--r--src/generic/matrix.hpp11
-rw-r--r--src/generic/md5.hpp15
-rw-r--r--src/generic/oops.hpp13
-rw-r--r--src/generic/operators.hpp7
-rw-r--r--src/generic/random.hpp11
-rw-r--r--src/generic/random.t.hpp7
-rw-r--r--src/generic/random2.hpp13
13 files changed, 67 insertions, 106 deletions
diff --git a/src/generic/array.hpp b/src/generic/array.hpp
index cf50dc8..dccb91e 100644
--- a/src/generic/array.hpp
+++ b/src/generic/array.hpp
@@ -1,5 +1,4 @@
-#ifndef TMWA_GENERIC_ARRAY_HPP
-#define TMWA_GENERIC_ARRAY_HPP
+#pragma once
// array.hpp - A simple bounds-checked array.
//
// Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com>
@@ -19,12 +18,12 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
-# include "fwd.hpp"
+#include "fwd.hpp"
-# include <cassert>
-# include <cstddef>
+#include <cassert>
+#include <cstddef>
-# include "oops.hpp"
+#include "oops.hpp"
namespace tmwa
@@ -117,5 +116,3 @@ 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/db.hpp b/src/generic/db.hpp
index 3caac91..90c4f92 100644
--- a/src/generic/db.hpp
+++ b/src/generic/db.hpp
@@ -1,5 +1,4 @@
-#ifndef TMWA_GENERIC_DB_HPP
-#define TMWA_GENERIC_DB_HPP
+#pragma once
// db.hpp - convenience wrappers over std::map<K, V>
//
// Copyright © 2013 Ben Longbons <b.r.longbons@gmail.com>
@@ -19,10 +18,10 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
-# include "fwd.hpp"
+#include "fwd.hpp"
-# include <map>
-# include <memory>
+#include <map>
+#include <memory>
namespace tmwa
@@ -180,5 +179,3 @@ public:
}
};
} // namespace tmwa
-
-#endif // TMWA_GENERIC_DB_HPP
diff --git a/src/generic/dumb_ptr.hpp b/src/generic/dumb_ptr.hpp
index 4d4473f..a9d6893 100644
--- a/src/generic/dumb_ptr.hpp
+++ b/src/generic/dumb_ptr.hpp
@@ -1,5 +1,4 @@
-#ifndef TMWA_GENERIC_DUMB_PTR_HPP
-#define TMWA_GENERIC_DUMB_PTR_HPP
+#pragma once
// dumb_ptr.hpp - temporary new/delete wrappers
//
// Copyright © 2013 Ben Longbons <b.r.longbons@gmail.com>
@@ -19,16 +18,16 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
-# include "fwd.hpp"
+#include "fwd.hpp"
-# include <cstring>
+#include <cstring>
-# include <algorithm>
-# include <utility>
+#include <algorithm>
+#include <utility>
-# include "../strings/astring.hpp"
-# include "../strings/zstring.hpp"
-# include "../strings/xstring.hpp"
+#include "../strings/astring.hpp"
+#include "../strings/zstring.hpp"
+#include "../strings/xstring.hpp"
namespace tmwa
@@ -208,9 +207,9 @@ struct dumb_string
return dumb_string::copy(&*s.begin(), &*s.end());
}
static
-# ifndef __clang__
+#ifndef __clang__
__attribute__((warning("shouldn't use this - slice instead")))
-# endif
+#endif
dumb_string copyn(const char *sn, size_t n)
{
return dumb_string::copy(sn, sn + strnlen(sn, n));
@@ -271,5 +270,3 @@ 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.hpp b/src/generic/enum.hpp
index 2fe748d..81c9b12 100644
--- a/src/generic/enum.hpp
+++ b/src/generic/enum.hpp
@@ -1,5 +1,4 @@
-#ifndef TMWA_GENERIC_ENUM_HPP
-#define TMWA_GENERIC_ENUM_HPP
+#pragma once
// enum.hpp - Safe building blocks for enumerated types.
//
// Copyright © 2012-2014 Ben Longbons <b.r.longbons@gmail.com>
@@ -19,17 +18,17 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
-# include "fwd.hpp"
+#include "fwd.hpp"
-# include <cassert>
-# include <cstddef>
+#include <cassert>
+#include <cstddef>
-# include <algorithm>
-# include <type_traits>
+#include <algorithm>
+#include <type_traits>
-# include "../compat/iter.hpp"
+#include "../compat/iter.hpp"
-# include "array.hpp"
+#include "array.hpp"
namespace tmwa
@@ -102,7 +101,7 @@ struct remove_enum<E, true>
// This really should just go in a namespace
// that's how I use it anyway ...
-# define ENUM_BITWISE_OPERATORS(E) \
+#define ENUM_BITWISE_OPERATORS(E) \
inline \
E operator & (E l, E r) \
{ \
@@ -160,5 +159,3 @@ 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 93d664c..81c4e26 100644
--- a/src/generic/fwd.hpp
+++ b/src/generic/fwd.hpp
@@ -1,5 +1,4 @@
-#ifndef TMWA_GENERIC_FWD_HPP
-#define TMWA_GENERIC_FWD_HPP
+#pragma once
// generic/fwd.hpp - list of type names for generic lib
//
// Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com>
@@ -19,7 +18,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
-# include "../sanity.hpp"
+#include "../sanity.hpp"
namespace tmwa
@@ -29,5 +28,3 @@ template<class T>
class dumb_ptr;
class dumb_string;
} // namespace tmwa
-
-#endif // TMWA_GENERIC_FWD_HPP
diff --git a/src/generic/intern-pool.hpp b/src/generic/intern-pool.hpp
index e209b4b..030aa38 100644
--- a/src/generic/intern-pool.hpp
+++ b/src/generic/intern-pool.hpp
@@ -1,5 +1,4 @@
-#ifndef TMWA_GENERIC_INTERN_POOL_HPP
-#define TMWA_GENERIC_INTERN_POOL_HPP
+#pragma once
// intern-pool.hpp - Cached integer/string lookups.
//
// Copyright © 2013 Ben Longbons <b.r.longbons@gmail.com>
@@ -19,17 +18,17 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
-# include "fwd.hpp"
+#include "fwd.hpp"
-# include <cassert>
-# include <cstddef>
+#include <cassert>
+#include <cstddef>
-# include <map>
-# include <vector>
+#include <map>
+#include <vector>
-# include "../strings/rstring.hpp"
-# include "../strings/zstring.hpp"
-# include "../strings/xstring.hpp"
+#include "../strings/rstring.hpp"
+#include "../strings/zstring.hpp"
+#include "../strings/xstring.hpp"
namespace tmwa
@@ -63,5 +62,3 @@ public:
}
};
} // namespace tmwa
-
-#endif // TMWA_GENERIC_INTERN_POOL_HPP
diff --git a/src/generic/matrix.hpp b/src/generic/matrix.hpp
index 36be084..86ce6c2 100644
--- a/src/generic/matrix.hpp
+++ b/src/generic/matrix.hpp
@@ -1,5 +1,4 @@
-#ifndef TMWA_GENERIC_MATRIX_HPP
-#define TMWA_GENERIC_MATRIX_HPP
+#pragma once
// matrix.hpp - A 2D array.
//
// Copyright © 2013 Ben Longbons <b.r.longbons@gmail.com>
@@ -19,11 +18,11 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
-# include "fwd.hpp"
+#include "fwd.hpp"
-# include <cassert>
+#include <cassert>
-# include "../compat/memory.hpp"
+#include "../compat/memory.hpp"
namespace tmwa
@@ -78,5 +77,3 @@ public:
}
};
} // namespace tmwa
-
-#endif // TMWA_GENERIC_MATRIX_HPP
diff --git a/src/generic/md5.hpp b/src/generic/md5.hpp
index fbe25d1..50bc987 100644
--- a/src/generic/md5.hpp
+++ b/src/generic/md5.hpp
@@ -1,5 +1,4 @@
-#ifndef TMWA_GENERIC_MD5CALC_HPP
-#define TMWA_GENERIC_MD5CALC_HPP
+#pragma once
// md5.hpp - Fundamental MD5 operations.
//
// Copyright © 2011-2014 Ben Longbons <b.r.longbons@gmail.com>
@@ -19,14 +18,14 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
-# include "fwd.hpp"
+#include "fwd.hpp"
-# include <cstdint>
+#include <cstdint>
-# include <array>
+#include <array>
-# include "../strings/fwd.hpp"
-# include "../strings/vstring.hpp"
+#include "../strings/fwd.hpp"
+#include "../strings/vstring.hpp"
namespace tmwa
@@ -58,5 +57,3 @@ 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/oops.hpp b/src/generic/oops.hpp
index 1501708..f5cf54a 100644
--- a/src/generic/oops.hpp
+++ b/src/generic/oops.hpp
@@ -1,5 +1,4 @@
-#ifndef TMWA_GENERIC_OOPS_HPP
-#define TMWA_GENERIC_OOPS_HPP
+#pragma once
// oops.hpp - Stuff that shouldn't happen.
//
// Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com>
@@ -19,11 +18,11 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
-# include "fwd.hpp"
+#include "fwd.hpp"
-# include <cstddef>
+#include <cstddef>
-# include <stdexcept>
+#include <stdexcept>
namespace tmwa
@@ -35,9 +34,7 @@ public:
const char *file, size_t line, const char *function);
};
-# define ALLEGE(desc, expr) \
+#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/operators.hpp b/src/generic/operators.hpp
index 15246ef..bb05765 100644
--- a/src/generic/operators.hpp
+++ b/src/generic/operators.hpp
@@ -1,5 +1,4 @@
-#ifndef TMWA_GENERIC_OPERATORS_HPP
-#define TMWA_GENERIC_OPERATORS_HPP
+#pragma once
// operators.hpp - ADL helper for value wrappers.
//
// Copyright © 2013 Ben Longbons <b.r.longbons@gmail.com>
@@ -19,7 +18,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
-# include "fwd.hpp"
+#include "fwd.hpp"
namespace tmwa
@@ -67,5 +66,3 @@ namespace _operators
using _operators::Comparable;
} // namespace tmwa
-
-#endif // TMWA_GENERIC_OPERATORS_HPP
diff --git a/src/generic/random.hpp b/src/generic/random.hpp
index 71883cc..5d67236 100644
--- a/src/generic/random.hpp
+++ b/src/generic/random.hpp
@@ -1,5 +1,4 @@
-#ifndef TMWA_GENERIC_RANDOM_HPP
-#define TMWA_GENERIC_RANDOM_HPP
+#pragma once
// random.hpp - Random number generation.
//
// Copyright © 2013 Ben Longbons <b.r.longbons@gmail.com>
@@ -19,11 +18,11 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
-# include "fwd.hpp"
+#include "fwd.hpp"
-# include "random.t.hpp"
+#include "random.t.hpp"
-# include <random>
+#include <random>
namespace tmwa
@@ -87,5 +86,3 @@ namespace random_
}
} // namespace random_
} // namespace tmwa
-
-#endif // TMWA_GENERIC_RANDOM_HPP
diff --git a/src/generic/random.t.hpp b/src/generic/random.t.hpp
index c68643a..b4c4764 100644
--- a/src/generic/random.t.hpp
+++ b/src/generic/random.t.hpp
@@ -1,5 +1,4 @@
-#ifndef TMWA_GENERIC_RANDOM_T_HPP
-#define TMWA_GENERIC_RANDOM_T_HPP
+#pragma once
// random.t.hpp - Random number generation.
//
// Copyright © 2013 Ben Longbons <b.r.longbons@gmail.com>
@@ -19,7 +18,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
-# include "fwd.hpp"
+#include "fwd.hpp"
namespace tmwa
@@ -43,5 +42,3 @@ 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 1aee094..23d165c 100644
--- a/src/generic/random2.hpp
+++ b/src/generic/random2.hpp
@@ -1,5 +1,4 @@
-#ifndef TMWA_GENERIC_RANDOM2_HPP
-#define TMWA_GENERIC_RANDOM2_HPP
+#pragma once
// random2.hpp - Random number generation.
//
// Copyright © 2013 Ben Longbons <b.r.longbons@gmail.com>
@@ -19,13 +18,13 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
-# include "fwd.hpp"
+#include "fwd.hpp"
-# include "random.hpp"
+#include "random.hpp"
-# include <algorithm>
+#include <algorithm>
-# include "../compat/iter.hpp"
+#include "../compat/iter.hpp"
namespace tmwa
@@ -95,5 +94,3 @@ namespace random_
}
} // namespace random_
} // namespace tmwa
-
-#endif // TMWA_GENERIC_RANDOM2_HPP