Преглед изворни кода

resource: split in resource_id.{h,inl}

Daniele Bartolini пре 5 година
родитељ
комит
816548ebc3

+ 1 - 1
src/device/device.cpp

@@ -45,7 +45,7 @@
 #include "resource/mesh_resource.h"
 #include "resource/package_resource.h"
 #include "resource/physics_resource.h"
-#include "resource/resource_id.h"
+#include "resource/resource_id.inl"
 #include "resource/resource_loader.h"
 #include "resource/resource_manager.h"
 #include "resource/resource_package.h"

+ 1 - 1
src/lua/lua_api.cpp

@@ -24,7 +24,7 @@
 #include "device/profiler.h"
 #include "lua/lua_environment.h"
 #include "lua/lua_stack.inl"
-#include "resource/resource_id.h"
+#include "resource/resource_id.inl"
 #include "resource/resource_manager.h"
 #include "resource/resource_package.h"
 #include "world/animation_state_machine.h"

+ 1 - 1
src/resource/package_resource.cpp

@@ -19,7 +19,7 @@
 #include "resource/compile_options.h"
 #include "resource/data_compiler.h"
 #include "resource/package_resource.h"
-#include "resource/resource_id.h"
+#include "resource/resource_id.inl"
 
 namespace crown
 {

+ 1 - 1
src/resource/resource_id.cpp

@@ -7,7 +7,7 @@
 #include "core/filesystem/path.h"
 #include "core/memory/temp_allocator.inl"
 #include "core/strings/dynamic_string.inl"
-#include "resource/resource_id.h"
+#include "resource/resource_id.inl"
 
 namespace crown
 {

+ 2 - 9
src/resource/resource_id.h

@@ -17,17 +17,10 @@ namespace crown
 typedef StringId64 ResourceId;
 
 /// Returns the resource id from @a type and @a name.
-inline ResourceId resource_id(StringId64 type, StringId64 name)
-{
-	ResourceId id { type._id ^ name._id };
-	return id;
-}
+inline ResourceId resource_id(StringId64 type, StringId64 name);
 
 /// Returns the resource id from @a type and @a name.
-inline ResourceId resource_id(const char* type, u32 type_len, const char* name, u32 name_len)
-{
-	return resource_id(StringId64(type, type_len), StringId64(name, name_len));
-}
+inline ResourceId resource_id(const char* type, u32 type_len, const char* name, u32 name_len);
 
 /// Returns the resource id from @a path.
 ResourceId resource_id(const char* path);

+ 23 - 0
src/resource/resource_id.inl

@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2012-2020 Daniele Bartolini and individual contributors.
+ * License: https://github.com/dbartolini/crown/blob/master/LICENSE
+ */
+
+#pragma once
+
+#include "resource/resource_id.h"
+
+namespace crown
+{
+inline ResourceId resource_id(StringId64 type, StringId64 name)
+{
+	ResourceId id { type._id ^ name._id };
+	return id;
+}
+
+inline ResourceId resource_id(const char* type, u32 type_len, const char* name, u32 name_len)
+{
+	return resource_id(StringId64(type, type_len), StringId64(name, name_len));
+}
+
+} // namespace crown

+ 1 - 1
src/resource/resource_loader.cpp

@@ -16,7 +16,7 @@
 #include "core/strings/string_id.inl"
 #include "core/thread/scoped_mutex.h"
 #include "device/log.h"
-#include "resource/resource_id.h"
+#include "resource/resource_id.inl"
 #include "resource/resource_loader.h"
 #include "resource/types.h"
 

+ 1 - 1
src/resource/resource_manager.cpp

@@ -8,7 +8,7 @@
 #include "core/memory/temp_allocator.inl"
 #include "core/strings/dynamic_string.inl"
 #include "core/strings/string_id.inl"
-#include "resource/resource_id.h"
+#include "resource/resource_id.inl"
 #include "resource/resource_loader.h"
 #include "resource/resource_manager.h"