Collapse nested namespaces

pull/1273/head
Andrew Tribick 2021-12-22 18:31:28 +01:00 committed by ajtribick
parent 279c721373
commit 4f913eb3ad
22 changed files with 53 additions and 108 deletions

View File

@ -19,9 +19,7 @@
#include <config.h> #include <config.h>
#include "cc.h" #include "cc.h"
namespace celestia namespace celestia::compat
{
namespace compat
{ {
namespace namespace
{ {
@ -236,5 +234,4 @@ from_chars(const char* first, const char* last, long double &value, chars_format
return from_chars_impl(first, last, value, fmt); return from_chars_impl(first, last, value, fmt);
} }
} // end namespace compat } // end namespace celestia::compat
} // end namespace celestia

View File

@ -18,9 +18,7 @@
#include <system_error> #include <system_error>
#include <type_traits> #include <type_traits>
namespace celestia namespace celestia::compat
{
namespace compat
{ {
#ifdef HAVE_CHARCONV #ifdef HAVE_CHARCONV
using std::from_chars_result; using std::from_chars_result;
@ -194,5 +192,4 @@ from_chars(const char* first, const char* last, T& value, int base)
} }
#endif #endif
} // end namespace compat } // end namespace celestia::compat
} // end namespace celestia

View File

@ -4,15 +4,12 @@
#ifdef HAVE_FLOAT_CHARCONV #ifdef HAVE_FLOAT_CHARCONV
#include <charconv> #include <charconv>
namespace celestia namespace celestia::compat
{
namespace compat
{ {
using std::chars_format; using std::chars_format;
using std::from_chars_result; using std::from_chars_result;
using std::from_chars; using std::from_chars;
} }
}
#else #else
#include "cc.h" #include "cc.h"
#endif #endif

View File

@ -1,9 +1,7 @@
#include "glsupport.h" #include "glsupport.h"
#include <algorithm> #include <algorithm>
namespace celestia namespace celestia::gl
{
namespace gl
{ {
#ifdef GL_ES #ifdef GL_ES
@ -75,5 +73,4 @@ bool checkVersion(int v) noexcept
{ {
return epoxy_gl_version() >= v; return epoxy_gl_version() >= v;
} }
} // gl } // end namespace celestia::gl
} // celestia

View File

@ -29,9 +29,7 @@
#define glDepthRange glDepthRangef #define glDepthRange glDepthRangef
#endif #endif
namespace celestia namespace celestia::gl
{
namespace gl
{ {
constexpr const int GL_2_1 = 21; constexpr const int GL_2_1 = 21;
@ -55,5 +53,5 @@ extern GLint maxTextureAnisotropy;
bool init(util::array_view<std::string> = {}) noexcept; bool init(util::array_view<std::string> = {}) noexcept;
bool checkVersion(int) noexcept; bool checkVersion(int) noexcept;
} // gl
} // celestia } // end namespace celestia::gl

View File

@ -35,9 +35,7 @@ inline void glVertexAttrib(GLuint index, const Eigen::Vector4f &v)
glVertexAttrib4fv(index, v.data()); glVertexAttrib4fv(index, v.data());
} }
namespace celestia namespace celestia::vecgl
{
namespace vecgl
{ {
template<typename T> template<typename T>
inline Eigen::Matrix<T,4,4> inline Eigen::Matrix<T,4,4>
@ -152,7 +150,6 @@ translate(T x, T y, T z)
{ {
return Eigen::Transform<T,3,Eigen::Affine>(Eigen::Translation<T,3>(Eigen::Matrix<T,3,1>(x,y,z))).matrix(); return Eigen::Transform<T,3,Eigen::Affine>(Eigen::Translation<T,3>(Eigen::Matrix<T,3,1>(x,y,z))).matrix();
} }
} // namespace vecgl } // end namespace celestia::vecgl
} // namespace celestia
#endif // _CELENGINE_VECGL_H_ #endif // _CELENGINE_VECGL_H_

View File

@ -9,9 +9,7 @@
#include "script.h" #include "script.h"
namespace celestia namespace celestia::scripts
{
namespace scripts
{ {
bool IScript::handleMouseButtonEvent(float /*x*/, float /*y*/, int /*button*/, bool /*down*/) bool IScript::handleMouseButtonEvent(float /*x*/, float /*y*/, int /*button*/, bool /*down*/)
@ -34,5 +32,4 @@ bool IScript::handleTickEvent(double /*dt*/)
return false; return false;
} }
} } // end namespace celestia::scripts
}

View File

@ -14,9 +14,7 @@
class CelestiaCore; class CelestiaCore;
namespace celestia namespace celestia::scripts
{
namespace scripts
{ {
class IScript class IScript
@ -74,5 +72,4 @@ class IScriptHook
CelestiaCore *m_appCore; CelestiaCore *m_appCore;
}; };
} } // end namespace celestia::scripts
}

View File

@ -2,9 +2,7 @@
#include <celestia/celestiacore.h> #include <celestia/celestiacore.h>
#include <celengine/render.h> #include <celengine/render.h>
namespace celestia namespace celestia::scripts
{
namespace scripts
{ {
void initRenderFlagMap(FlagMap64 &RenderFlagMap) void initRenderFlagMap(FlagMap64 &RenderFlagMap)
@ -219,5 +217,4 @@ ScriptMaps::ScriptMaps()
initLineColorMap(LineColorMap); initLineColorMap(LineColorMap);
} }
} } // end namespace celestia::scripts
}

View File

@ -4,10 +4,9 @@
#include <string> #include <string>
#include <celutil/color.h> #include <celutil/color.h>
namespace celestia namespace celestia::scripts
{
namespace scripts
{ {
// String to flag mappings // String to flag mappings
typedef std::map<std::string, uint32_t> FlagMap; typedef std::map<std::string, uint32_t> FlagMap;
typedef std::map<std::string, uint64_t> FlagMap64; typedef std::map<std::string, uint64_t> FlagMap64;
@ -32,5 +31,5 @@ class ScriptMaps
ColorMap LineColorMap; ColorMap LineColorMap;
ColorMap LabelColorMap; ColorMap LabelColorMap;
}; };
}
} } // end namespace celestia::scripts

View File

@ -18,9 +18,7 @@
using namespace std; using namespace std;
namespace celestia namespace celestia::scripts
{
namespace scripts
{ {
// Extremely basic implementation of an ExecutionEnvironment for // Extremely basic implementation of an ExecutionEnvironment for
@ -110,4 +108,3 @@ unique_ptr<IScript> LegacyScriptPlugin::loadScript(const fs::path &path)
} }
} }
}

View File

@ -16,9 +16,7 @@ class Execution;
class ExecutionEnvironment; class ExecutionEnvironment;
class CelestiaCore; class CelestiaCore;
namespace celestia namespace celestia::scripts
{
namespace scripts
{ {
class LegacyScript : public IScript class LegacyScript : public IScript
@ -54,5 +52,4 @@ class LegacyScriptPlugin : public IScriptPlugin
std::unique_ptr<IScript> loadScript(const fs::path&) override; std::unique_ptr<IScript> loadScript(const fs::path&) override;
}; };
} } // end namespace celestia::scripts
}

View File

@ -17,9 +17,7 @@ class CelestiaConfig;
class CelestiaCore; class CelestiaCore;
class ProgressNotifier; class ProgressNotifier;
namespace celestia namespace celestia::scripts
{
namespace scripts
{ {
class LuaScript : public IScript class LuaScript : public IScript
@ -83,5 +81,4 @@ class LuaHook : public IScriptHook
bool CreateLuaEnvironment(CelestiaCore *appCore, const CelestiaConfig *config, ProgressNotifier *progressNotifier = nullptr); bool CreateLuaEnvironment(CelestiaCore *appCore, const CelestiaConfig *config, ProgressNotifier *progressNotifier = nullptr);
} } // end namespace celestia::scripts
}

View File

@ -14,9 +14,7 @@
#include <type_traits> // std::remove_cv #include <type_traits> // std::remove_cv
#include <cstddef> // std::size_t #include <cstddef> // std::size_t
namespace celestia namespace celestia::util
{
namespace util
{ {
/** /**
@ -174,5 +172,5 @@ class array_view
const element_type* m_ptr; const element_type* m_ptr;
size_t m_size; size_t m_size;
}; };
}
} } // end namespace celestia::util

View File

@ -8,10 +8,9 @@
#include <config.h> #include <config.h>
namespace celestia namespace celestia::util
{
namespace util
{ {
/*! Read a value stored in machine-native byte order from an input stream. /*! Read a value stored in machine-native byte order from an input stream.
*/ */
template<typename T, typename = std::enable_if_t<std::is_trivially_copyable<T>::value>> template<typename T, typename = std::enable_if_t<std::is_trivially_copyable<T>::value>>
@ -120,5 +119,4 @@ inline bool readBE(std::istream& in, T& value)
#endif #endif
} } // end namespace celestia::util
}

View File

@ -8,10 +8,9 @@
#include <config.h> #include <config.h>
namespace celestia namespace celestia::util
{
namespace util
{ {
/*! Write a value to an output stream in machine-native byte order. /*! Write a value to an output stream in machine-native byte order.
*/ */
template<typename T, typename = std::enable_if_t<std::is_trivially_copyable<T>::value>> template<typename T, typename = std::enable_if_t<std::is_trivially_copyable<T>::value>>
@ -111,5 +110,4 @@ inline bool writeBE(std::ostream& out, T value)
#endif #endif
} } // end namespace celestia::util
}

View File

@ -31,9 +31,7 @@
using namespace std; using namespace std;
namespace celestia namespace celestia::util
{
namespace util
{ {
fs::path LocaleFilename(const fs::path &p) fs::path LocaleFilename(const fs::path &p)
@ -185,5 +183,4 @@ fs::path WriteableDataPath()
} }
#endif // !PORTABLE_BUILD #endif // !PORTABLE_BUILD
} } // end namespace celestia::util
}

View File

@ -15,10 +15,9 @@
#include <celutil/array_view.h> #include <celutil/array_view.h>
#include <celcompat/filesystem.h> #include <celcompat/filesystem.h>
namespace celestia namespace celestia::util
{
namespace util
{ {
fs::path LocaleFilename(const fs::path& filename); fs::path LocaleFilename(const fs::path& filename);
fs::path PathExp(const fs::path& filename); fs::path PathExp(const fs::path& filename);
fs::path ResolveWildcard(const fs::path& wildcard, fs::path ResolveWildcard(const fs::path& wildcard,
@ -27,5 +26,5 @@ fs::path ResolveWildcard(const fs::path& wildcard,
fs::path HomeDir(); fs::path HomeDir();
fs::path WriteableDataPath(); fs::path WriteableDataPath();
#endif #endif
}
} } // end namespace celestia::util

View File

@ -15,9 +15,7 @@
#include <fmt/ostream.h> #include <fmt/ostream.h>
#include "logger.h" #include "logger.h"
namespace celestia namespace celestia::util
{
namespace util
{ {
Logger* Logger::g_logger = nullptr; Logger* Logger::g_logger = nullptr;
@ -53,5 +51,4 @@ void Logger::vlog(Level level, fmt::string_view format, fmt::format_args args) c
fmt::vprint(stream, format, args); fmt::vprint(stream, format, args);
} }
} } // end namespace celestia::util
}

View File

@ -25,9 +25,7 @@ struct fmt::formatter<fs::path> : formatter<std::string>
} }
}; };
namespace celestia namespace celestia::util
{
namespace util
{ {
enum class Level enum class Level
@ -126,5 +124,5 @@ Logger* CreateLogger(Level level = Level::Info,
Logger::Stream &log = std::clog, Logger::Stream &log = std::clog,
Logger::Stream &err = std::cerr); Logger::Stream &err = std::cerr);
void DestroyLogger(); void DestroyLogger();
}
} } // end namespace celestia::util

View File

@ -1,8 +1,6 @@
#include "glsupport.h" #include "glsupport.h"
namespace celestia namespace celestia::gl
{
namespace gl
{ {
bool ARB_shader_objects = false; bool ARB_shader_objects = false;
@ -30,5 +28,5 @@ bool checkVersion(int v) noexcept
{ {
return epoxy_gl_version() >= v; return epoxy_gl_version() >= v;
} }
} // gl
} // celestia } // end namespace celestia::gl

View File

@ -10,9 +10,7 @@
#include <GL/glu.h> #include <GL/glu.h>
#endif #endif
namespace celestia namespace celestia::gl
{
namespace gl
{ {
constexpr const int GL_2_1 = 21; constexpr const int GL_2_1 = 21;
@ -23,5 +21,5 @@ extern bool EXT_framebuffer_object;
bool init() noexcept; bool init() noexcept;
bool checkVersion(int) noexcept; bool checkVersion(int) noexcept;
} // gl
} // celestia } // end namespace celestia::gl