Skip to content

Commit 44f53bb

Browse files
committed
Take advantage of nested namespace declarations
1 parent 3051983 commit 44f53bb

4 files changed

Lines changed: 274 additions & 286 deletions

File tree

include/TGUI/Backend/Renderer/OpenGL.hpp

Lines changed: 40 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -90,54 +90,51 @@
9090
#define TGUI_GL_CHECK(expr) expr
9191
#endif
9292

93-
namespace tgui
93+
namespace tgui::priv
9494
{
95-
namespace priv
96-
{
9795
#if !defined(NDEBUG) && !defined(TGUI_NO_RUNTIME_WARNINGS)
98-
inline void checkAndLogErrorOpenGL(const char* file, unsigned int line, const char* expression)
99-
{
100-
const GLenum errorCode = glGetError();
101-
if (errorCode == GL_NO_ERROR)
102-
return;
103-
104-
const char* error;
105-
switch (errorCode)
106-
{
107-
case GL_INVALID_ENUM:
108-
error = "GL_INVALID_ENUM";
109-
break;
110-
case GL_INVALID_VALUE:
111-
error = "GL_INVALID_VALUE";
112-
break;
113-
case GL_INVALID_OPERATION:
114-
error = "GL_INVALID_OPERATION";
115-
break;
116-
case GL_STACK_OVERFLOW:
117-
error = "GL_STACK_OVERFLOW";
118-
break;
119-
case GL_STACK_UNDERFLOW:
120-
error = "GL_STACK_UNDERFLOW";
121-
break;
122-
case GL_OUT_OF_MEMORY:
123-
error = "GL_OUT_OF_MEMORY";
124-
break;
125-
default:
126-
error = "Unknown error";
127-
break;
128-
}
96+
inline void checkAndLogErrorOpenGL(const char* file, unsigned int line, const char* expression)
97+
{
98+
const GLenum errorCode = glGetError();
99+
if (errorCode == GL_NO_ERROR)
100+
return;
129101

130-
const std::string fileStr = file;
131-
TGUI_PRINT_WARNING(
132-
"An internal OpenGL call failed in " + fileStr.substr(fileStr.find_last_of("\\/") + 1) + "("
133-
+ std::to_string(line) + ")." + "\nExpression:\n " + expression + "\nError description:\n " + error + "\n");
134-
}
135-
#else
136-
inline void checkAndLogErrorOpenGL(const char*, unsigned int, const char*)
102+
const char* error;
103+
switch (errorCode)
137104
{
105+
case GL_INVALID_ENUM:
106+
error = "GL_INVALID_ENUM";
107+
break;
108+
case GL_INVALID_VALUE:
109+
error = "GL_INVALID_VALUE";
110+
break;
111+
case GL_INVALID_OPERATION:
112+
error = "GL_INVALID_OPERATION";
113+
break;
114+
case GL_STACK_OVERFLOW:
115+
error = "GL_STACK_OVERFLOW";
116+
break;
117+
case GL_STACK_UNDERFLOW:
118+
error = "GL_STACK_UNDERFLOW";
119+
break;
120+
case GL_OUT_OF_MEMORY:
121+
error = "GL_OUT_OF_MEMORY";
122+
break;
123+
default:
124+
error = "Unknown error";
125+
break;
138126
}
127+
128+
const std::string fileStr = file;
129+
TGUI_PRINT_WARNING(
130+
"An internal OpenGL call failed in " + fileStr.substr(fileStr.find_last_of("\\/") + 1) + "(" + std::to_string(line)
131+
+ ")." + "\nExpression:\n " + expression + "\nError description:\n " + error + "\n");
132+
}
133+
#else
134+
inline void checkAndLogErrorOpenGL(const char*, unsigned int, const char*)
135+
{
136+
}
139137
#endif
140-
} // namespace priv
141-
} // namespace tgui
138+
} // namespace tgui::priv
142139

143140
#endif // TGUI_OPENGL_HPP

include/TGUI/SvgImage.hpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,10 @@
3232

3333
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
3434

35-
namespace tgui
35+
namespace tgui::priv
3636
{
37-
namespace priv
38-
{
39-
struct SvgImageData;
40-
} // namespace priv
41-
} // namespace tgui
37+
struct SvgImageData;
38+
} // namespace tgui::priv
4239

4340
namespace tgui
4441
{

0 commit comments

Comments
 (0)