This commit is contained in:
Jorijn van der Graaf 2025-11-09 18:56:24 +01:00
commit f90881b03d
9824 changed files with 1706556 additions and 114 deletions

View file

@ -1,82 +0,0 @@
/*
Crafter® Build
Copyright (C) 2025 Catcrafts®
Catcrafts.net
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License version 3.0 as published by the Free Software Foundation;
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
export module Crafter.Build:FixedVector;
import std;
namespace fs = std::filesystem;
namespace Crafter {
export template <typename T>
class FixedVector {
public:
using value_type = T;
using iterator = T*;
using const_iterator = const T*;
T* values;
std::uint_fast32_t size_;
FixedVector() {}
FixedVector(std::uint_fast32_t size): values(reinterpet_cast<T*>(operator new[](size * sizeof(T)))), size_(size) {}
void Set(std::uint_fast32_t size) {
#ifdef CRAFTER_BUILD_CONFIGURATION_DEBUG
if(this->size_ != 0) {
throw std::runtime_error("FixedVector already set!");
}
#endif
values = reinterpet_cast<T*>(operator new[](size * sizeof(T)));
this->size_ = size;
}
~FixedVector() {
delete[] values;
}
FixedVector(const FixedVector&) = delete;
FixedVector& operator=(const FixedVector&) = delete;
FixedVector(FixedVector&& other) noexcept : values(other.values), size_(other.size_) {
other.values = nullptr;
other.size_ = 0;
}
FixedVector& operator=(FixedVector&& other) noexcept {
if (this != &other) {
delete[] values;
values = other.values;
size_ = other.size_;
other.values = nullptr;
other.size_ = 0;
}
return *this;
}
T& operator[](std::uint_fast32_t index) { return values[index]; }
const T& operator[](std::uint_fast32_t index) const { return values[index]; }
std::uint_fast32_t size() const { return size_; }
iterator begin() { return values; }
const_iterator begin() const { return values; }
const_iterator cbegin() const { return values; }
iterator end() { return values + size_; }
const_iterator end() const { return values + size_; }
const_iterator cend() const { return values + size_; }
};
}

View file

@ -37,11 +37,11 @@ namespace Crafter {
Configuration& Build(std::string_view configuration);
Configuration& Build(std::string_view configuration, const fs::path& outputDir);
Configuration& Build(std::string_view configuration, const fs::path& outputDir, const fs::path& binDir);
Configuration& Build(std::string_view configuration, const fs::path& outputDir, const fs::path& binDir, const std::string_view outputName);
Configuration& Build(std::string_view configuration, const fs::path& outputDir, const fs::path& binDir, std::string outputName);
void Build(Configuration& configuration) const;
void Build(Configuration& configuration, const fs::path& binDir) const;
void Build(Configuration& configuration, const fs::path& binDir, const fs::path& builDir) const;
void Build(Configuration& configuration, const fs::path& binDir, const fs::path& builDir, const std::string_view outputName) const;
void Build(Configuration& configuration, const fs::path& binDir, const fs::path& builDir, std::string outputName) const;
TestResult RunTest(const std::string_view test);
TestResult RunTest(Test& test) const;
std::vector<TestResult> RunTests();

View file

@ -24,5 +24,4 @@ export import :Module;
export import :Configuration;
export import :Shader;
export import :Implementation;
export import :FixedVector;
export import :Test;