2
0
Эх сурвалжийг харах

resource: move macros to .inl

Daniele Bartolini 1 жил өмнө
parent
commit
d53b781577

+ 0 - 35
src/resource/compile_options.h

@@ -20,41 +20,6 @@
 #include "resource/types.h"
 #include <stdarg.h>
 
-#define DATA_COMPILER_ASSERT(condition, opts, msg, ...) \
-	do                                                  \
-	{                                                   \
-		if (!(condition))                               \
-		{                                               \
-			opts.error(msg, ## __VA_ARGS__);            \
-			return -1;                                  \
-		}                                               \
-	} while (0)
-
-#define DATA_COMPILER_ENSURE(condition, opts)             \
-	DATA_COMPILER_ASSERT(condition                        \
-		, opts                                            \
-		, "DATA_COMPILER_ENSURE(" # condition ") failed." \
-		)
-
-#define DATA_COMPILER_ASSERT_RESOURCE_EXISTS(type, name, opts) \
-	DATA_COMPILER_ASSERT(opts.resource_exists(type, name)      \
-		, opts                                                 \
-		, opts._server                                         \
-		? "Resource not found: " RESOURCE_ID_FMT_STR_PAIR      \
-		: "Resource not found: %s.%s"                          \
-		, name                                                 \
-		, type                                                 \
-		)
-
-#define DATA_COMPILER_ASSERT_FILE_EXISTS(name, opts) \
-	DATA_COMPILER_ASSERT(opts.file_exists(name)      \
-		, opts                                       \
-		, opts._server                               \
-		? "File not found: #FILE(%s)"                \
-		: "File not found: %s"                       \
-		, name                                       \
-		)
-
 namespace crown
 {
 struct CompileOptions

+ 36 - 1
src/resource/compile_options.inl

@@ -9,6 +9,41 @@
 #include "resource/compile_options.h"
 
 #if CROWN_CAN_COMPILE
+#define DATA_COMPILER_ASSERT(condition, opts, msg, ...) \
+	do                                                  \
+	{                                                   \
+		if (!(condition))                               \
+		{                                               \
+			opts.error(msg, ## __VA_ARGS__);            \
+			return -1;                                  \
+		}                                               \
+	} while (0)
+
+#define DATA_COMPILER_ENSURE(condition, opts)             \
+	DATA_COMPILER_ASSERT(condition                        \
+		, opts                                            \
+		, "DATA_COMPILER_ENSURE(" # condition ") failed." \
+		)
+
+#define DATA_COMPILER_ASSERT_RESOURCE_EXISTS(type, name, opts) \
+	DATA_COMPILER_ASSERT(opts.resource_exists(type, name)      \
+		, opts                                                 \
+		, opts._server                                         \
+		? "Resource not found: " RESOURCE_ID_FMT_STR_PAIR      \
+		: "Resource not found: %s.%s"                          \
+		, name                                                 \
+		, type                                                 \
+		)
+
+#define DATA_COMPILER_ASSERT_FILE_EXISTS(name, opts) \
+	DATA_COMPILER_ASSERT(opts.file_exists(name)      \
+		, opts                                       \
+		, opts._server                               \
+		? "File not found: #FILE(%s)"                \
+		: "File not found: %s"                       \
+		, name                                       \
+		)
+
 namespace crown
 {
 ///
@@ -20,4 +55,4 @@ void CompileOptions::write(const T &data)
 
 } // namespace crown
 
-#endif
+#endif // if CROWN_CAN_COMPILE