Noexcept all the things!
This commit is contained in:
@@ -20,7 +20,7 @@ namespace Nz
|
||||
public:
|
||||
AbstractHash() = default;
|
||||
AbstractHash(const AbstractHash&) = delete;
|
||||
AbstractHash(AbstractHash&&) = default;
|
||||
AbstractHash(AbstractHash&&) noexcept = default;
|
||||
virtual ~AbstractHash();
|
||||
|
||||
virtual void Append(const UInt8* data, std::size_t len) = 0;
|
||||
@@ -31,7 +31,7 @@ namespace Nz
|
||||
virtual const char* GetHashName() const = 0;
|
||||
|
||||
AbstractHash& operator=(const AbstractHash&) = delete;
|
||||
AbstractHash& operator=(AbstractHash&&) = default;
|
||||
AbstractHash& operator=(AbstractHash&&) noexcept = default;
|
||||
|
||||
static std::unique_ptr<AbstractHash> Get(HashType hash);
|
||||
};
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace Nz
|
||||
inline ByteArray(size_type n, value_type value);
|
||||
template <class InputIterator> ByteArray(InputIterator first, InputIterator last);
|
||||
ByteArray(const ByteArray& other) = default;
|
||||
ByteArray(ByteArray&& other) = default;
|
||||
ByteArray(ByteArray&& other) noexcept = default;
|
||||
~ByteArray() = default;
|
||||
|
||||
inline iterator Append(const void* buffer, size_type size);
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Nz
|
||||
ByteStream(void* ptr, Nz::UInt64 size);
|
||||
ByteStream(const void* ptr, Nz::UInt64 size);
|
||||
ByteStream(const ByteStream&) = delete;
|
||||
inline ByteStream(ByteStream&& stream);
|
||||
ByteStream(ByteStream&& stream) noexcept = default;
|
||||
virtual ~ByteStream();
|
||||
|
||||
inline Endianness GetDataEndianness() const;
|
||||
@@ -50,7 +50,7 @@ namespace Nz
|
||||
ByteStream& operator<<(const T& value);
|
||||
|
||||
ByteStream& operator=(const ByteStream&) = delete;
|
||||
inline ByteStream& operator=(ByteStream&&);
|
||||
ByteStream& operator=(ByteStream&&) noexcept = default;
|
||||
|
||||
private:
|
||||
virtual void OnEmptyStream();
|
||||
|
||||
@@ -16,19 +16,6 @@ namespace Nz
|
||||
m_context.stream = stream;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Constructs a ByteStream object by move semantic
|
||||
*
|
||||
* \param stream ByteStream to move into this
|
||||
*/
|
||||
|
||||
inline ByteStream::ByteStream(ByteStream&& stream) :
|
||||
m_ownedStream(std::move(stream.m_ownedStream)),
|
||||
m_context(stream.m_context)
|
||||
{
|
||||
stream.m_context.stream = nullptr;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Destructs the object and calls FlushBits
|
||||
*
|
||||
@@ -204,23 +191,6 @@ namespace Nz
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Moves the other byte stream into this
|
||||
* \return A reference to this
|
||||
*
|
||||
* \param stream ByteStream to move in this
|
||||
*/
|
||||
|
||||
inline ByteStream& ByteStream::operator=(ByteStream&& stream)
|
||||
{
|
||||
m_context = stream.m_context;
|
||||
m_ownedStream = std::move(stream.m_ownedStream);
|
||||
|
||||
stream.m_context.stream = nullptr;
|
||||
|
||||
return *this;
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Core/DebugOff.hpp>
|
||||
|
||||
@@ -19,14 +19,14 @@ namespace Nz
|
||||
public:
|
||||
CallOnExit(Func func = nullptr);
|
||||
CallOnExit(const CallOnExit&) = delete;
|
||||
CallOnExit(CallOnExit&&) = delete;
|
||||
CallOnExit(CallOnExit&&) noexcept = delete;
|
||||
~CallOnExit();
|
||||
|
||||
void CallAndReset(Func func = nullptr);
|
||||
void Reset(Func func = nullptr);
|
||||
|
||||
CallOnExit& operator=(const CallOnExit&) = delete;
|
||||
CallOnExit& operator=(CallOnExit&&) = default;
|
||||
CallOnExit& operator=(CallOnExit&&) noexcept = default;
|
||||
|
||||
private:
|
||||
Func m_func;
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Nz
|
||||
public:
|
||||
FileLogger(const String& logPath = "NazaraLog.log");
|
||||
FileLogger(const FileLogger&) = default;
|
||||
FileLogger(FileLogger&&) = default;
|
||||
FileLogger(FileLogger&&) noexcept = default;
|
||||
~FileLogger();
|
||||
|
||||
void EnableTimeLogging(bool enable);
|
||||
@@ -32,7 +32,7 @@ namespace Nz
|
||||
void WriteError(ErrorType type, const String& error, unsigned int line = 0, const char* file = nullptr, const char* function = nullptr) override;
|
||||
|
||||
FileLogger& operator=(const FileLogger&) = default;
|
||||
FileLogger& operator=(FileLogger&&) = default;
|
||||
FileLogger& operator=(FileLogger&&) noexcept = default;
|
||||
|
||||
private:
|
||||
File m_outputFile;
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Nz
|
||||
GuillotineBinPack(unsigned int width, unsigned int height);
|
||||
GuillotineBinPack(const Vector2ui& size);
|
||||
GuillotineBinPack(const GuillotineBinPack&) = default;
|
||||
GuillotineBinPack(GuillotineBinPack&&) = default;
|
||||
GuillotineBinPack(GuillotineBinPack&&) noexcept = default;
|
||||
~GuillotineBinPack() = default;
|
||||
|
||||
void Clear();
|
||||
@@ -52,7 +52,7 @@ namespace Nz
|
||||
void Reset(const Vector2ui& size);
|
||||
|
||||
GuillotineBinPack& operator=(const GuillotineBinPack&) = default;
|
||||
GuillotineBinPack& operator=(GuillotineBinPack&&) = default;
|
||||
GuillotineBinPack& operator=(GuillotineBinPack&&) noexcept = default;
|
||||
|
||||
enum FreeRectChoiceHeuristic : int
|
||||
{
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#define NAZARA_MEMORYSTREAM_HPP
|
||||
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Core/MovablePtr.hpp>
|
||||
#include <Nazara/Core/Stream.hpp>
|
||||
|
||||
namespace Nz
|
||||
@@ -20,7 +21,7 @@ namespace Nz
|
||||
inline MemoryStream();
|
||||
inline MemoryStream(ByteArray* byteArray, OpenModeFlags openMode = OpenMode_ReadWrite);
|
||||
MemoryStream(const MemoryStream&) = default;
|
||||
MemoryStream(MemoryStream&&) = default;
|
||||
MemoryStream(MemoryStream&&) noexcept = default;
|
||||
~MemoryStream() = default;
|
||||
|
||||
void Clear();
|
||||
@@ -36,14 +37,14 @@ namespace Nz
|
||||
bool SetCursorPos(UInt64 offset) override;
|
||||
|
||||
MemoryStream& operator=(const MemoryStream&) = default;
|
||||
MemoryStream& operator=(MemoryStream&&) = default;
|
||||
MemoryStream& operator=(MemoryStream&&) noexcept = default;
|
||||
|
||||
private:
|
||||
void FlushStream() override;
|
||||
std::size_t ReadBlock(void* buffer, std::size_t size) override;
|
||||
std::size_t WriteBlock(const void* buffer, std::size_t size) override;
|
||||
|
||||
ByteArray* m_buffer;
|
||||
MovablePtr<ByteArray> m_buffer;
|
||||
UInt64 m_pos;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Core/Color.hpp>
|
||||
#include <Nazara/Core/MovablePtr.hpp>
|
||||
#include <Nazara/Core/String.hpp>
|
||||
#include <atomic>
|
||||
#include <unordered_map>
|
||||
@@ -72,7 +73,7 @@ namespace Nz
|
||||
|
||||
std::atomic_uint counter;
|
||||
Destructor destructor;
|
||||
void* ptr;
|
||||
MovablePtr<void> ptr;
|
||||
};
|
||||
|
||||
ParameterType type;
|
||||
@@ -81,6 +82,7 @@ namespace Nz
|
||||
// We define an empty constructor/destructor, to be able to put classes in the union
|
||||
Value() {}
|
||||
Value(const Value&) {} // Placeholder
|
||||
Value(Value&&) noexcept {} // Placeholder
|
||||
~Value() {}
|
||||
|
||||
bool boolVal;
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Nz
|
||||
public:
|
||||
PrimitiveList() = default;
|
||||
PrimitiveList(const PrimitiveList&) = default;
|
||||
PrimitiveList(PrimitiveList&&) = default;
|
||||
PrimitiveList(PrimitiveList&&) noexcept = default;
|
||||
~PrimitiveList() = default;
|
||||
|
||||
void AddBox(const Vector3f& lengths, const Vector3ui& subdivision = Vector3ui(0U), const Matrix4f& transformMatrix = Matrix4f::Identity());
|
||||
@@ -41,7 +41,7 @@ namespace Nz
|
||||
std::size_t GetSize() const;
|
||||
|
||||
PrimitiveList& operator=(const PrimitiveList&) = default;
|
||||
PrimitiveList& operator=(PrimitiveList&&) = default;
|
||||
PrimitiveList& operator=(PrimitiveList&&) noexcept = default;
|
||||
|
||||
Primitive& operator()(unsigned int i);
|
||||
const Primitive& operator()(unsigned int i) const;
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace Nz
|
||||
public:
|
||||
RefCounted(bool persistent = true);
|
||||
RefCounted(const RefCounted&) = delete;
|
||||
RefCounted(RefCounted&&) = default;
|
||||
RefCounted(RefCounted&&) = delete;
|
||||
virtual ~RefCounted();
|
||||
|
||||
void AddReference() const;
|
||||
@@ -37,7 +37,7 @@ namespace Nz
|
||||
bool SetPersistent(bool persistent = true, bool checkReferenceCount = false);
|
||||
|
||||
RefCounted& operator=(const RefCounted&) = delete;
|
||||
RefCounted& operator=(RefCounted&&) = default;
|
||||
RefCounted& operator=(RefCounted&&) = delete;
|
||||
|
||||
private:
|
||||
std::atomic_bool m_persistent;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Core/Config.hpp>
|
||||
#include <Nazara/Core/Endianness.hpp>
|
||||
#include <Nazara/Core/MovablePtr.hpp>
|
||||
#include <Nazara/Core/TypeTag.hpp>
|
||||
|
||||
namespace Nz
|
||||
@@ -18,7 +19,7 @@ namespace Nz
|
||||
|
||||
struct NAZARA_CORE_API SerializationContext
|
||||
{
|
||||
Stream* stream;
|
||||
MovablePtr<Stream> stream;
|
||||
Endianness endianness = Endianness_BigEndian; //< Default to Big Endian encoding
|
||||
UInt8 readBitPos = 8; //< 8 means no bit is currently read
|
||||
UInt8 readByte; //< Undefined value, will be initialized at the first bit read
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Nz
|
||||
public:
|
||||
StdLogger() = default;
|
||||
StdLogger(const StdLogger&) = default;
|
||||
StdLogger(StdLogger&&) = default;
|
||||
StdLogger(StdLogger&&) noexcept = default;
|
||||
~StdLogger();
|
||||
|
||||
void EnableStdReplication(bool enable) override;
|
||||
@@ -28,7 +28,7 @@ namespace Nz
|
||||
void WriteError(ErrorType type, const String& error, unsigned int line = 0, const char* file = nullptr, const char* function = nullptr) override;
|
||||
|
||||
StdLogger& operator=(const StdLogger&) = default;
|
||||
StdLogger& operator=(StdLogger&&) = default;
|
||||
StdLogger& operator=(StdLogger&&) noexcept = default;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace Nz
|
||||
{
|
||||
public:
|
||||
Stream(const Stream&) = default;
|
||||
Stream(Stream&&) = default;
|
||||
Stream(Stream&&) noexcept = default;
|
||||
virtual ~Stream();
|
||||
|
||||
virtual bool EndOfStream() const = 0;
|
||||
@@ -52,7 +52,7 @@ namespace Nz
|
||||
inline std::size_t Write(const void* buffer, std::size_t size);
|
||||
|
||||
Stream& operator=(const Stream&) = default;
|
||||
Stream& operator=(Stream&&) = default;
|
||||
Stream& operator=(Stream&&) noexcept = default;
|
||||
|
||||
protected:
|
||||
inline Stream(StreamOptionFlags streamOptions = StreamOption_None, OpenModeFlags openMode = OpenMode_NotOpen);
|
||||
|
||||
Reference in New Issue
Block a user