aboutsummaryrefslogtreecommitdiffstats
path: root/yage/core
diff options
context:
space:
mode:
authorYann Herklotz <ymherklotz@gmail.com>2018-06-23 15:49:21 +0100
committerYann Herklotz <ymherklotz@gmail.com>2018-06-23 15:49:21 +0100
commit9f92cab6b884711ca8be050b500a2880a955f001 (patch)
treefa0999a72436a81c82c49ba8dc473522ac30ceb6 /yage/core
parent3702e753a5f7b31c31261c968757e19e808a84ec (diff)
downloadYAGE-9f92cab6b884711ca8be050b500a2880a955f001.tar.gz
YAGE-9f92cab6b884711ca8be050b500a2880a955f001.zip
Switching to east const
This is compared to const west, which is not very consistent, as const always acts on what is on its left, and if there isn't anything on the left, it will act on what is on its right. By always placing const on the right of what it should act on, the rule becomes more consistent.
Diffstat (limited to 'yage/core')
-rw-r--r--yage/core/core.h2
-rw-r--r--yage/core/exception.cpp2
-rw-r--r--yage/core/exception.h2
-rw-r--r--yage/core/imageloader.cpp2
-rw-r--r--yage/core/imageloader.h2
-rw-r--r--yage/core/iomanager.cpp2
-rw-r--r--yage/core/iomanager.h2
-rw-r--r--yage/core/logger.cpp24
-rw-r--r--yage/core/logger.h42
-rw-r--r--yage/core/resourcemanager.cpp2
-rw-r--r--yage/core/resourcemanager.h2
-rw-r--r--yage/core/texturecache.cpp2
-rw-r--r--yage/core/texturecache.h2
-rw-r--r--yage/core/window.h4
14 files changed, 46 insertions, 46 deletions
diff --git a/yage/core/core.h b/yage/core/core.h
index 1237d9d0..5411eaac 100644
--- a/yage/core/core.h
+++ b/yage/core/core.h
@@ -20,7 +20,7 @@ namespace yage
/**
*
*/
-extern void glfwErrorCallback(int, const char *);
+extern void glfwErrorCallback(int, char const *);
/**
* Initializes YAGE.
diff --git a/yage/core/exception.cpp b/yage/core/exception.cpp
index 6001213c..82bbe6c3 100644
--- a/yage/core/exception.cpp
+++ b/yage/core/exception.cpp
@@ -22,7 +22,7 @@ FileLoadException::FileLoadException(std::string err)
err_msg = msg.str();
}
-const char *FileLoadException::what() const throw()
+char const *FileLoadException::what() const throw()
{
return err_msg.c_str();
}
diff --git a/yage/core/exception.h b/yage/core/exception.h
index 70042e02..0c53aba3 100644
--- a/yage/core/exception.h
+++ b/yage/core/exception.h
@@ -20,7 +20,7 @@ class FileLoadException : public std::runtime_error
public:
FileLoadException(std::string err);
- virtual const char *what() const throw();
+ virtual char const *what() const throw();
private:
std::string err_msg;
diff --git a/yage/core/imageloader.cpp b/yage/core/imageloader.cpp
index d3c978c1..fd458717 100644
--- a/yage/core/imageloader.cpp
+++ b/yage/core/imageloader.cpp
@@ -19,7 +19,7 @@
namespace yage
{
-Texture ImageLoader::loadPng(const std::string &file_path)
+Texture ImageLoader::loadPng(std::string const &file_path)
{
int width, height, num_channels;
yLogDebug << "Loading image from disk: " << file_path;
diff --git a/yage/core/imageloader.h b/yage/core/imageloader.h
index f4c0d90d..0c78ae93 100644
--- a/yage/core/imageloader.h
+++ b/yage/core/imageloader.h
@@ -19,7 +19,7 @@ class Texture;
class ImageLoader
{
public:
- static Texture loadPng(const std::string &file_path);
+ static Texture loadPng(std::string const &file_path);
};
} // namespace yage
diff --git a/yage/core/iomanager.cpp b/yage/core/iomanager.cpp
index ff920f97..1b2aba02 100644
--- a/yage/core/iomanager.cpp
+++ b/yage/core/iomanager.cpp
@@ -19,7 +19,7 @@ namespace yage
namespace IoManager
{
-bool readFileToBuffer(const std::string &file_path,
+bool readFileToBuffer(std::string const &file_path,
std::vector<unsigned char> &buffer)
{
std::ifstream file(file_path, std::ios::binary);
diff --git a/yage/core/iomanager.h b/yage/core/iomanager.h
index 9d796914..69436364 100644
--- a/yage/core/iomanager.h
+++ b/yage/core/iomanager.h
@@ -18,7 +18,7 @@ namespace yage
namespace IoManager
{
-extern bool readFileToBuffer(const std::string &file_path,
+extern bool readFileToBuffer(std::string const &file_path,
std::vector<unsigned char> &buffer);
}
diff --git a/yage/core/logger.cpp b/yage/core/logger.cpp
index f420502d..261d8bca 100644
--- a/yage/core/logger.cpp
+++ b/yage/core/logger.cpp
@@ -24,7 +24,7 @@ namespace yage
{
LogMessage::LogMessage(Logger *owner, LogLevel level,
- const std::string &file_name, int line_num)
+ std::string const &file_name, int line_num)
: owner_(owner), meta_({level, file_name, line_num})
{
}
@@ -44,11 +44,11 @@ LogMessage &LogMessage::operator<<(std::ostream &(*fn)(std::ostream &os))
return *this;
}
-LogSink::LogSink(const LogSink &sink) : wrapper_(sink.wrapper_->clone()) {}
+LogSink::LogSink(LogSink const &sink) : wrapper_(sink.wrapper_->clone()) {}
LogSink::LogSink(LogSink &&sink) : wrapper_(std::move(sink.wrapper_)) {}
-LogSink &LogSink::operator=(const LogSink &sink)
+LogSink &LogSink::operator=(LogSink const &sink)
{
wrapper_.reset(sink.wrapper_->clone());
return *this;
@@ -60,19 +60,19 @@ LogSink &LogSink::operator=(LogSink &&sink)
return *this;
}
-bool LogSink::operator==(const LogSink &sink)
+bool LogSink::operator==(LogSink const &sink)
{
return (wrapper_.get() == sink.wrapper_.get());
}
-void LogSink::write(const LogMessage::Meta &meta, const std::string &msg) const
+void LogSink::write(LogMessage::Meta const &meta, std::string const &msg) const
{
wrapper_->write(meta, msg);
}
LogSink makeConsoleSink()
{
- return [](const LogMessage::Meta &meta, const std::string &msg) {
+ return [](LogMessage::Meta const &meta, std::string const &msg) {
std::cout << msg << "\n";
};
}
@@ -91,7 +91,7 @@ public:
}
}
- FileSink(const std::string filename)
+ FileSink(std::string const filename)
: fileHandle_(std::make_shared<std::ofstream>(filename))
{
if (!fileHandle_->good()) {
@@ -101,7 +101,7 @@ public:
~FileSink() = default;
- void operator()(const LogMessage::Meta &meta, const std::string &msg) const
+ void operator()(const LogMessage::Meta &meta, std::string const &msg) const
{
using namespace std::chrono;
@@ -148,7 +148,7 @@ private:
} // namespace
-LogSink makeFileSink(const std::string &filename)
+LogSink makeFileSink(std::string const &filename)
{
return FileSink(filename);
}
@@ -163,7 +163,7 @@ Logger::Logger() : active_(Active::create()), min_level_(LogLevel::INFO)
add(makeConsoleSink());
}
-Logger::Logger(const std::string &file_path)
+Logger::Logger(std::string const &file_path)
: active_(Active::create()), min_level_(LogLevel::INFO)
{
add(makeConsoleSink());
@@ -176,14 +176,14 @@ Logger::Logger(LogLevel min_level)
add(makeConsoleSink());
}
-Logger::Logger(LogLevel min_level, const std::string &file_path)
+Logger::Logger(LogLevel min_level, std::string const &file_path)
: active_(Active::create()), min_level_(min_level)
{
add(makeConsoleSink());
add(makeFileSink(file_path));
}
-LogMessage Logger::operator()(LogLevel level, const std::string &fileName,
+LogMessage Logger::operator()(LogLevel level, std::string const &fileName,
int lineNum)
{
return LogMessage(this, level, fileName, lineNum);
diff --git a/yage/core/logger.h b/yage/core/logger.h
index 3da959c6..81b0f556 100644
--- a/yage/core/logger.h
+++ b/yage/core/logger.h
@@ -64,13 +64,13 @@ class LogMessage
public:
~LogMessage();
- LogMessage(const LogMessage &msg) = delete;
+ LogMessage(LogMessage const &msg) = delete;
- LogMessage &operator=(const LogMessage &msg) = delete;
+ LogMessage &operator=(LogMessage const &msg) = delete;
LogMessage &operator=(LogMessage &&msg) = delete;
template <typename T>
- LogMessage &operator<<(const T &value);
+ LogMessage &operator<<(T const &value);
LogMessage &operator<<(std::ostream &(*fn)(std::ostream &os));
@@ -87,7 +87,7 @@ private:
Logger *owner_;
LogMessage::Meta meta_;
- LogMessage(Logger *owner, LogLevel level, const std::string &file_name,
+ LogMessage(Logger *owner, LogLevel level, std::string const &file_name,
int line_num);
LogMessage(LogMessage &&msg);
};
@@ -98,22 +98,22 @@ public:
template <typename T>
LogSink(T impl);
- LogSink(const LogSink &sink);
+ LogSink(LogSink const &sink);
LogSink(LogSink &&sink);
- LogSink &operator=(const LogSink &sink);
+ LogSink &operator=(LogSink const &sink);
LogSink &operator=(LogSink &&sink);
- bool operator==(const LogSink &sink);
+ bool operator==(LogSink const &sink);
- void write(const LogMessage::Meta &meta, const std::string &msg) const;
+ void write(LogMessage::Meta const &meta, std::string const &msg) const;
private:
struct Concept {
virtual ~Concept() = default;
virtual Concept *clone() const = 0;
- virtual void write(const LogMessage::Meta &meta,
- const std::string &msg) const = 0;
+ virtual void write(LogMessage::Meta const &meta,
+ std::string const &msg) const = 0;
};
template <typename T>
@@ -121,7 +121,7 @@ private:
Model(T impl_i);
virtual Concept *clone() const override;
virtual void write(const LogMessage::Meta &meta,
- const std::string &msg) const override;
+ std::string const &msg) const override;
T impl;
};
@@ -133,16 +133,16 @@ class Logger
{
public:
Logger();
- explicit Logger(const std::string &file_path);
+ explicit Logger(std::string const &file_path);
explicit Logger(LogLevel min_level);
- Logger(LogLevel min_level, const std::string &file_path);
+ Logger(LogLevel min_level, std::string const &file_path);
LogMessage operator()(LogLevel level = LogLevel::INFO,
- const std::string &fileName = "", int lineNum = -1);
+ std::string const &fileName = "", int lineNum = -1);
- void flush(const LogMessage *msg);
- void add(const LogSink &sink);
- void remove(const LogSink &sink);
+ void flush(LogMessage const *msg);
+ void add(LogSink const &sink);
+ void remove(LogSink const &sink);
void clear();
static Logger &instance();
@@ -158,7 +158,7 @@ private:
LogSink makeConsoleSink();
-LogSink makeFileSink(const std::string &filename);
+LogSink makeFileSink(std::string const &filename);
LogSink makeFileSink(std::string &&filename);
/* -----------------------------------------------------------------------------
@@ -183,14 +183,14 @@ LogSink::Concept *LogSink::Model<T>::clone() const
}
template <typename T>
-void LogSink::Model<T>::write(const LogMessage::Meta &meta,
- const std::string &msg) const
+void LogSink::Model<T>::write(LogMessage::Meta const &meta,
+ std::string const &msg) const
{
impl(meta, msg);
}
template <typename T>
-LogMessage &LogMessage::operator<<(const T &value)
+LogMessage &LogMessage::operator<<(T const &value)
{
buffer_ << value;
return *this;
diff --git a/yage/core/resourcemanager.cpp b/yage/core/resourcemanager.cpp
index 984b381c..f41a658c 100644
--- a/yage/core/resourcemanager.cpp
+++ b/yage/core/resourcemanager.cpp
@@ -15,7 +15,7 @@ namespace yage
TextureCache ResourceManager::texture_cache_;
-Texture ResourceManager::getTexture(const std::string &texture_path, int x,
+Texture ResourceManager::getTexture(std::string const &texture_path, int x,
int y)
{
return texture_cache_.getTexture(texture_path, x, y);
diff --git a/yage/core/resourcemanager.h b/yage/core/resourcemanager.h
index dcc77ab7..0e57f227 100644
--- a/yage/core/resourcemanager.h
+++ b/yage/core/resourcemanager.h
@@ -24,7 +24,7 @@ private:
static TextureCache texture_cache_;
public:
- static Texture getTexture(const std::string &texture_path, int x = 1,
+ static Texture getTexture(std::string const &texture_path, int x = 1,
int y = 1);
};
diff --git a/yage/core/texturecache.cpp b/yage/core/texturecache.cpp
index 5f78a37e..a9ff169c 100644
--- a/yage/core/texturecache.cpp
+++ b/yage/core/texturecache.cpp
@@ -14,7 +14,7 @@
namespace yage
{
-Texture TextureCache::getTexture(const std::string &texture_path, int x, int y)
+Texture TextureCache::getTexture(std::string const &texture_path, int x, int y)
{
auto itr = texture_map_.find(texture_path);
diff --git a/yage/core/texturecache.h b/yage/core/texturecache.h
index 45cc0a9d..1a0b3e0d 100644
--- a/yage/core/texturecache.h
+++ b/yage/core/texturecache.h
@@ -24,7 +24,7 @@ private:
public:
TextureCache() = default;
- Texture getTexture(const std::string &texture_path, int x = 1, int y = 1);
+ Texture getTexture(std::string const &texture_path, int x = 1, int y = 1);
};
} // namespace yage
diff --git a/yage/core/window.h b/yage/core/window.h
index 6b0e7fed..f633f3f7 100644
--- a/yage/core/window.h
+++ b/yage/core/window.h
@@ -35,12 +35,12 @@ private:
public:
Window() = default;
- Window(const Window &) = delete;
+ Window(Window const &) = delete;
Window(Window &&) = delete;
/// destroys the window handle
~Window();
- Window &operator=(const Window &) = delete;
+ Window &operator=(Window const &) = delete;
Window &operator=(Window &&) = delete;
/// create the window, initialize the handle and update the width and height