Repository: godotengine/godot
File: core/io/resource.h (C/C++)

Code before:
/* included in all copies or substantial portions of the Software.        */
/*                                                                        */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,        */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF     */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY   */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,   */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE      */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                 */
/**************************************************************************/

#pragma once

#include "core/io/resource_uid.h"
#include "core/object/gdvirtual.gen.h"
#include "core/object/ref_counted.h"
#include "core/templates/safe_refcount.h"
#include "core/templates/self_list.h"

class Node;
class RWLock;

#define RES_BASE_EXTENSION(m_ext) \
public: \
	static void register_custom_data_to_otdb() { \
		Resource::register_custom_data_to_otdb(m_ext, get_class_static()); \
	} \
	virtual String get_base_extension() const override { \
		return m_ext; \
	} \
\
private:

class Resource : public RefCounted {
	GDCLASS(Resource, RefCounted);

public:
	static constexpr AncestralClass static_ancestral_class = AncestralClass::RESOURCE;

	static void register_custom_data_to_otdb(String p_extension = "res", String p_class = get_class_static());
	virtual String get_base_extension() const { return "res"; }

protected:
	struct DuplicateParams {
		bool deep = false;
		ResourceDeepDuplicateMode subres_mode = RESOURCE_DEEP_DUPLICATE_MAX;
		Node *local_scene = nullptr;
	};

private:
	friend class ResBase;

Review comment (suggestion):
```suggestion
		_add_resource_base_extension_to_classdb(m_ext, get_class_static()); \
```

Code after:
/* included in all copies or substantial portions of the Software.        */
/*                                                                        */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,        */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF     */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY   */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,   */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE      */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                 */
/**************************************************************************/

#pragma once

#include "core/io/resource_uid.h"
#include "core/object/gdvirtual.gen.h"
#include "core/object/ref_counted.h"
#include "core/templates/safe_refcount.h"
#include "core/templates/self_list.h"

class Node;
class RWLock;

#define RES_BASE_EXTENSION(m_ext) \
public: \
	static void register_custom_data_to_otdb() { \
		Resource::_add_resource_base_extension_to_classdb(m_ext, get_class_static()); \
	} \
	virtual String get_base_extension() const override { \
		return m_ext; \
	} \
\
private:

class Resource : public RefCounted {
	GDCLASS(Resource, RefCounted);

public:
	static constexpr AncestralClass static_ancestral_class = AncestralClass::RESOURCE;

	static void register_custom_data_to_otdb();
	virtual String get_base_extension() const { return "res"; }

protected:
	static void _add_resource_base_extension_to_classdb(const String &p_extension, const String &p_class);
	struct DuplicateParams {
		bool deep = false;
		ResourceDeepDuplicateMode subres_mode = RESOURCE_DEEP_DUPLICATE_MAX;
		Node *local_scene = nullptr;
	};

private: