Omit copy constructors for strings in constructors
This commit is contained in:
@@ -1,7 +1,8 @@
|
|||||||
#ifndef LUA_SCRIPT_COMPONENT_H
|
#ifndef LUA_SCRIPT_COMPONENT_H
|
||||||
#define LUA_SCRIPT_COMPONENT_H
|
#define LUA_SCRIPT_COMPONENT_H
|
||||||
|
|
||||||
#include <string> // std::string
|
#include <string> // std::string
|
||||||
|
#include <utility> // std::move
|
||||||
|
|
||||||
namespace Inferno {
|
namespace Inferno {
|
||||||
|
|
||||||
@@ -14,7 +15,7 @@ namespace Inferno {
|
|||||||
// Dont allow manually setting instance during construction
|
// Dont allow manually setting instance during construction
|
||||||
LuaScriptComponent() {}
|
LuaScriptComponent() {}
|
||||||
LuaScriptComponent(const std::string& path)
|
LuaScriptComponent(const std::string& path)
|
||||||
: path(path) {}
|
: path(std::move(path)) {}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#define TAG_COMPONENT_H
|
#define TAG_COMPONENT_H
|
||||||
|
|
||||||
#include <string> // std::string
|
#include <string> // std::string
|
||||||
|
#include <utility> // std::move
|
||||||
|
|
||||||
namespace Inferno {
|
namespace Inferno {
|
||||||
|
|
||||||
@@ -10,7 +11,7 @@ namespace Inferno {
|
|||||||
|
|
||||||
TagComponent() = default;
|
TagComponent() = default;
|
||||||
TagComponent(const std::string& tag)
|
TagComponent(const std::string& tag)
|
||||||
: tag(tag) {}
|
: tag(std::move(tag)) {}
|
||||||
|
|
||||||
operator const std::string&() const { return tag; }
|
operator const std::string&() const { return tag; }
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#include <limits> // std::numeric_limits
|
#include <limits> // std::numeric_limits
|
||||||
#include <string> // std::getline, std::stoi
|
#include <string> // std::getline, std::stoi
|
||||||
|
#include <utility> // std::move
|
||||||
|
|
||||||
#include "inferno/assert.h"
|
#include "inferno/assert.h"
|
||||||
#include "inferno/io/file.h"
|
#include "inferno/io/file.h"
|
||||||
@@ -10,6 +11,7 @@
|
|||||||
namespace Inferno {
|
namespace Inferno {
|
||||||
|
|
||||||
Font::Font(const std::string& name)
|
Font::Font(const std::string& name)
|
||||||
|
: m_name(std::move(name))
|
||||||
{
|
{
|
||||||
std::string path = name + ".fnt";
|
std::string path = name + ".fnt";
|
||||||
std::string image = name + ".png";
|
std::string image = name + ".png";
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
namespace Inferno {
|
namespace Inferno {
|
||||||
|
|
||||||
Gltf::Gltf(const std::string& path)
|
Gltf::Gltf(const std::string& path)
|
||||||
: m_path(path)
|
: m_path(std::move(path))
|
||||||
{
|
{
|
||||||
auto gltf = GltfFile::read(path);
|
auto gltf = GltfFile::read(path);
|
||||||
ASSERT(gltf.first, "Gltf model invalid JSON content '{}'", path);
|
ASSERT(gltf.first, "Gltf model invalid JSON content '{}'", path);
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include <vector> // std::vector
|
#include <utility> // std::move
|
||||||
|
#include <vector> // std::vector
|
||||||
|
|
||||||
#include "glad/glad.h"
|
#include "glad/glad.h"
|
||||||
#include "glm/gtc/type_ptr.hpp" // glm::value_ptr
|
#include "glm/gtc/type_ptr.hpp" // glm::value_ptr
|
||||||
@@ -12,7 +13,8 @@
|
|||||||
namespace Inferno {
|
namespace Inferno {
|
||||||
|
|
||||||
Shader::Shader(const std::string& name)
|
Shader::Shader(const std::string& name)
|
||||||
: m_id(0)
|
: m_name(std::move(name)),
|
||||||
|
m_id(0)
|
||||||
{
|
{
|
||||||
// Get file contents
|
// Get file contents
|
||||||
std::string vertexSrc = File::read(name + ".vert");
|
std::string vertexSrc = File::read(name + ".vert");
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#include <climits> // UINT_MAX
|
#include <climits> // UINT_MAX
|
||||||
#include <memory>
|
#include <memory> // std::shared_ptr
|
||||||
|
#include <utility> // std::move
|
||||||
|
|
||||||
#include "glad/glad.h"
|
#include "glad/glad.h"
|
||||||
#define STB_IMAGE_IMPLEMENTATION
|
#define STB_IMAGE_IMPLEMENTATION
|
||||||
@@ -11,6 +12,7 @@
|
|||||||
namespace Inferno {
|
namespace Inferno {
|
||||||
|
|
||||||
Texture::Texture(const std::string& path)
|
Texture::Texture(const std::string& path)
|
||||||
|
: m_path(std::move(path))
|
||||||
{
|
{
|
||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
|
|||||||
Reference in New Issue
Block a user