aboutsummaryrefslogtreecommitdiff
path: root/app/source/Cplt/Model/Template
diff options
context:
space:
mode:
authorrtk0c <[email protected]>2022-11-27 12:04:31 -0800
committerrtk0c <[email protected]>2022-11-27 12:04:31 -0800
commit182c8f8357739f905bbd721006480502435b6b43 (patch)
tree082613a474d863182e2ad8f2167f1643f26e67a3 /app/source/Cplt/Model/Template
parentb01ed99a1cd0c863c8709930658513c04dd70f61 (diff)
Update brace style to match rest of my projectscplt-imgui
Diffstat (limited to 'app/source/Cplt/Model/Template')
-rw-r--r--app/source/Cplt/Model/Template/TableTemplate.cpp150
-rw-r--r--app/source/Cplt/Model/Template/TableTemplate.hpp24
-rw-r--r--app/source/Cplt/Model/Template/TableTemplateIterator.cpp27
-rw-r--r--app/source/Cplt/Model/Template/TableTemplateIterator.hpp6
-rw-r--r--app/source/Cplt/Model/Template/Template.hpp9
-rw-r--r--app/source/Cplt/Model/Template/Template_Main.cpp39
-rw-r--r--app/source/Cplt/Model/Template/Template_RTTI.cpp9
7 files changed, 88 insertions, 176 deletions
diff --git a/app/source/Cplt/Model/Template/TableTemplate.cpp b/app/source/Cplt/Model/Template/TableTemplate.cpp
index 5cd9ed8..c7faf24 100644
--- a/app/source/Cplt/Model/Template/TableTemplate.cpp
+++ b/app/source/Cplt/Model/Template/TableTemplate.cpp
@@ -12,24 +12,20 @@
#include <iostream>
#include <map>
-bool TableCell::IsDataHoldingCell() const
-{
+bool TableCell::IsDataHoldingCell() const {
return IsPrimaryCell() || !IsMergedCell();
}
-bool TableCell::IsPrimaryCell() const
-{
+bool TableCell::IsPrimaryCell() const {
return PrimaryCellLocation == Location;
}
-bool TableCell::IsMergedCell() const
-{
+bool TableCell::IsMergedCell() const {
return PrimaryCellLocation.x == -1 || PrimaryCellLocation.y == -1;
}
template <class TTableCell, class TStream>
-void OperateStreamForTableCell(TTableCell& cell, TStream& proxy)
-{
+void OperateStreamForTableCell(TTableCell& cell, TStream& proxy) {
proxy.template ObjectAdapted<DataStreamAdapters::String>(cell.Content);
proxy.Object(cell.Location);
proxy.Object(cell.PrimaryCellLocation);
@@ -41,40 +37,33 @@ void OperateStreamForTableCell(TTableCell& cell, TStream& proxy)
proxy.Value(cell.DataId);
}
-void TableCell::ReadFromDataStream(InputDataStream& stream)
-{
+void TableCell::ReadFromDataStream(InputDataStream& stream) {
::OperateStreamForTableCell(*this, stream);
}
-void TableCell::WriteToDataStream(OutputDataStream& stream) const
-{
+void TableCell::WriteToDataStream(OutputDataStream& stream) const {
::OperateStreamForTableCell(*this, stream);
}
-Vec2i TableArrayGroup::GetLeftCell() const
-{
+Vec2i TableArrayGroup::GetLeftCell() const {
return { Row, LeftCell };
}
-Vec2i TableArrayGroup::GetRightCell() const
-{
+Vec2i TableArrayGroup::GetRightCell() const {
return { Row, RightCell };
}
-int TableArrayGroup::GetCount() const
-{
+int TableArrayGroup::GetCount() const {
return RightCell - LeftCell + 1;
}
-Vec2i TableArrayGroup::FindCell(std::string_view name)
-{
+Vec2i TableArrayGroup::FindCell(std::string_view name) {
// TODO
return Vec2i{};
}
template <class TMap>
-static bool UpdateElementName(TMap& map, std::string_view oldName, std::string_view newName)
-{
+static bool UpdateElementName(TMap& map, std::string_view oldName, std::string_view newName) {
auto iter = map.find(oldName);
if (iter == map.end()) {
return false;
@@ -90,75 +79,62 @@ static bool UpdateElementName(TMap& map, std::string_view oldName, std::string_v
return true;
}
-bool TableArrayGroup::UpdateCellName(std::string_view oldName, std::string_view newName)
-{
+bool TableArrayGroup::UpdateCellName(std::string_view oldName, std::string_view newName) {
return ::UpdateElementName(mName2Cell, oldName, newName);
}
template <class TTableArrayGroup, class TStream>
-void OperateStreamForTableArrayGroup(TTableArrayGroup& group, TStream& stream)
-{
+void OperateStreamForTableArrayGroup(TTableArrayGroup& group, TStream& stream) {
stream.Value(group.Row);
stream.Value(group.LeftCell);
stream.Value(group.RightCell);
}
-void TableArrayGroup::ReadFromDataStream(InputDataStream& stream)
-{
+void TableArrayGroup::ReadFromDataStream(InputDataStream& stream) {
::OperateStreamForTableArrayGroup(*this, stream);
}
-void TableArrayGroup::WriteToDataStream(OutputDataStream& stream) const
-{
+void TableArrayGroup::WriteToDataStream(OutputDataStream& stream) const {
::OperateStreamForTableArrayGroup(*this, stream);
}
TableInstantiationParameters::TableInstantiationParameters(const TableTemplate& table)
- : mTable{ &table }
-{
+ : mTable{ &table } {
}
-TableInstantiationParameters& TableInstantiationParameters::ResetTable(const TableTemplate& newTable)
-{
+TableInstantiationParameters& TableInstantiationParameters::ResetTable(const TableTemplate& newTable) {
mTable = &newTable;
return *this;
}
-TableInstantiationParameters TableInstantiationParameters::RebindTable(const TableTemplate& newTable) const
-{
+TableInstantiationParameters TableInstantiationParameters::RebindTable(const TableTemplate& newTable) const {
TableInstantiationParameters result(newTable);
result.SingularCells = this->SingularCells;
result.ArrayGroups = this->ArrayGroups;
return result;
}
-const TableTemplate& TableInstantiationParameters::GetTable() const
-{
+const TableTemplate& TableInstantiationParameters::GetTable() const {
return *mTable;
}
-bool TableTemplate::IsInstance(const Template* tmpl)
-{
+bool TableTemplate::IsInstance(const Template* tmpl) {
return tmpl->GetKind() == KD_Table;
}
TableTemplate::TableTemplate()
- : Template(KD_Table)
-{
+ : Template(KD_Table) {
}
-int TableTemplate::GetTableWidth() const
-{
+int TableTemplate::GetTableWidth() const {
return mColumnWidths.size();
}
-int TableTemplate::GetTableHeight() const
-{
+int TableTemplate::GetTableHeight() const {
return mRowHeights.size();
}
-void TableTemplate::Resize(int newWidth, int newHeight)
-{
+void TableTemplate::Resize(int newWidth, int newHeight) {
// TODO this doesn't gracefully handle resizing to a smaller size which trims some merged cells
std::vector<TableCell> cells;
@@ -190,39 +166,32 @@ void TableTemplate::Resize(int newWidth, int newHeight)
mRowHeights.resize(newHeight, 20);
}
-int TableTemplate::GetRowHeight(int row) const
-{
+int TableTemplate::GetRowHeight(int row) const {
return mRowHeights[row];
}
-void TableTemplate::SetRowHeight(int row, int height)
-{
+void TableTemplate::SetRowHeight(int row, int height) {
mRowHeights[row] = height;
}
-int TableTemplate::GetColumnWidth(int column) const
-{
+int TableTemplate::GetColumnWidth(int column) const {
return mColumnWidths[column];
}
-void TableTemplate::SetColumnWidth(int column, int width)
-{
+void TableTemplate::SetColumnWidth(int column, int width) {
mColumnWidths[column] = width;
}
-const TableCell& TableTemplate::GetCell(Vec2i pos) const
-{
+const TableCell& TableTemplate::GetCell(Vec2i pos) const {
int tableWidth = GetTableWidth();
return mCells[pos.y * tableWidth + pos.x];
}
-TableCell& TableTemplate::GetCell(Vec2i pos)
-{
+TableCell& TableTemplate::GetCell(Vec2i pos) {
return const_cast<TableCell&>(const_cast<const TableTemplate*>(this)->GetCell(pos));
}
-void TableTemplate::SetCellType(Vec2i pos, TableCell::CellType type)
-{
+void TableTemplate::SetCellType(Vec2i pos, TableCell::CellType type) {
auto& cell = GetCell(pos);
if (cell.Type == type) {
return;
@@ -274,28 +243,23 @@ void TableTemplate::SetCellType(Vec2i pos, TableCell::CellType type)
cell.Type = type;
}
-bool TableTemplate::UpdateParameterName(std::string_view oldName, std::string_view newName)
-{
+bool TableTemplate::UpdateParameterName(std::string_view oldName, std::string_view newName) {
return ::UpdateElementName(mName2Parameters, oldName, newName);
}
-int TableTemplate::GetArrayGroupCount() const
-{
+int TableTemplate::GetArrayGroupCount() const {
return mArrayGroups.size();
}
-const TableArrayGroup& TableTemplate::GetArrayGroup(int id) const
-{
+const TableArrayGroup& TableTemplate::GetArrayGroup(int id) const {
return mArrayGroups[id];
}
-TableArrayGroup& TableTemplate::GetArrayGroup(int id)
-{
+TableArrayGroup& TableTemplate::GetArrayGroup(int id) {
return mArrayGroups[id];
}
-TableArrayGroup* TableTemplate::AddArrayGroup(int row, int left, int right)
-{
+TableArrayGroup* TableTemplate::AddArrayGroup(int row, int left, int right) {
// size_t max value: 18446744073709551615
// ^~~~~~~~~~~~~~~~~~~~ 20 chars
char name[20];
@@ -305,8 +269,7 @@ TableArrayGroup* TableTemplate::AddArrayGroup(int row, int left, int right)
return AddArrayGroup(nameStr, row, left, right);
}
-TableArrayGroup* TableTemplate::AddArrayGroup(std::string_view name, int row, int left, int right)
-{
+TableArrayGroup* TableTemplate::AddArrayGroup(std::string_view name, int row, int left, int right) {
assert(row >= 0 && row < GetTableHeight());
assert(left >= 0 && left < GetTableWidth());
assert(right >= 0 && right < GetTableWidth());
@@ -349,13 +312,11 @@ TableArrayGroup* TableTemplate::AddArrayGroup(std::string_view name, int row, in
return &ag;
}
-bool TableTemplate::UpdateArrayGroupName(std::string_view oldName, std::string_view newName)
-{
+bool TableTemplate::UpdateArrayGroupName(std::string_view oldName, std::string_view newName) {
return ::UpdateElementName(mName2ArrayGroups, oldName, newName);
}
-bool TableTemplate::ExtendArrayGroupLeft(int id, int n)
-{
+bool TableTemplate::ExtendArrayGroupLeft(int id, int n) {
assert(n > 0);
auto& ag = mArrayGroups[id];
@@ -364,8 +325,7 @@ bool TableTemplate::ExtendArrayGroupLeft(int id, int n)
return false;
}
-bool TableTemplate::ExtendArrayGroupRight(int id, int n)
-{
+bool TableTemplate::ExtendArrayGroupRight(int id, int n) {
assert(n > 0);
auto& ag = mArrayGroups[id];
@@ -374,8 +334,7 @@ bool TableTemplate::ExtendArrayGroupRight(int id, int n)
return false;
}
-TableCell* TableTemplate::FindCell(std::string_view name)
-{
+TableCell* TableTemplate::FindCell(std::string_view name) {
auto iter = mName2Parameters.find(name);
if (iter != mName2Parameters.end()) {
return &mCells[iter.value()];
@@ -384,8 +343,7 @@ TableCell* TableTemplate::FindCell(std::string_view name)
}
}
-TableArrayGroup* TableTemplate::FindArrayGroup(std::string_view name)
-{
+TableArrayGroup* TableTemplate::FindArrayGroup(std::string_view name) {
auto iter = mName2ArrayGroups.find(name);
if (iter != mName2ArrayGroups.end()) {
return &mArrayGroups[iter.value()];
@@ -394,8 +352,7 @@ TableArrayGroup* TableTemplate::FindArrayGroup(std::string_view name)
}
}
-TableTemplate::MergeCellsResult TableTemplate::MergeCells(Vec2i topLeft, Vec2i bottomRight)
-{
+TableTemplate::MergeCellsResult TableTemplate::MergeCells(Vec2i topLeft, Vec2i bottomRight) {
auto SortTwo = [](int& a, int& b) {
if (a > b) {
std::swap(a, b);
@@ -432,8 +389,7 @@ TableTemplate::MergeCellsResult TableTemplate::MergeCells(Vec2i topLeft, Vec2i b
return MCR_Success;
}
-TableTemplate::BreakCellsResult TableTemplate::BreakCells(Vec2i topLeft)
-{
+TableTemplate::BreakCellsResult TableTemplate::BreakCells(Vec2i topLeft) {
auto& primaryCell = GetCell(topLeft);
if (!primaryCell.IsMergedCell()) {
return BCR_CellNotMerged;
@@ -452,15 +408,13 @@ TableTemplate::BreakCellsResult TableTemplate::BreakCells(Vec2i topLeft)
return BCR_Success;
}
-lxw_workbook* TableTemplate::InstantiateToExcelWorkbook(const TableInstantiationParameters& params) const
-{
+lxw_workbook* TableTemplate::InstantiateToExcelWorkbook(const TableInstantiationParameters& params) const {
auto workbook = workbook_new("Table.xlsx");
InstantiateToExcelWorksheet(workbook, params);
return workbook;
}
-lxw_worksheet* TableTemplate::InstantiateToExcelWorksheet(lxw_workbook* workbook, const TableInstantiationParameters& params) const
-{
+lxw_worksheet* TableTemplate::InstantiateToExcelWorksheet(lxw_workbook* workbook, const TableInstantiationParameters& params) const {
auto worksheet = workbook_add_worksheet(workbook, "CpltExport.xlsx");
// Map: row number -> length of generated ranges
@@ -565,12 +519,10 @@ lxw_worksheet* TableTemplate::InstantiateToExcelWorksheet(lxw_workbook* workbook
return worksheet;
}
-class TableTemplate::Private
-{
+class TableTemplate::Private {
public:
template <class TTableTemplate, class TProxy>
- static void OperateStream(TTableTemplate& table, TProxy& proxy)
- {
+ static void OperateStream(TTableTemplate& table, TProxy& proxy) {
proxy.template ObjectAdapted<DataStreamAdapters::Vector<>>(table.mColumnWidths);
proxy.template ObjectAdapted<DataStreamAdapters::Vector<>>(table.mRowHeights);
proxy.template ObjectAdapted<DataStreamAdapters::Vector<>>(table.mCells);
@@ -580,12 +532,10 @@ public:
}
};
-void TableTemplate::ReadFromDataStream(InputDataStream& stream)
-{
+void TableTemplate::ReadFromDataStream(InputDataStream& stream) {
Private::OperateStream(*this, stream);
}
-void TableTemplate::WriteToDataStream(OutputDataStream& stream) const
-{
+void TableTemplate::WriteToDataStream(OutputDataStream& stream) const {
Private::OperateStream(*this, stream);
}
diff --git a/app/source/Cplt/Model/Template/TableTemplate.hpp b/app/source/Cplt/Model/Template/TableTemplate.hpp
index 3e931d4..e0dea09 100644
--- a/app/source/Cplt/Model/Template/TableTemplate.hpp
+++ b/app/source/Cplt/Model/Template/TableTemplate.hpp
@@ -11,11 +11,9 @@
#include <string_view>
#include <vector>
-class TableCell
-{
+class TableCell {
public:
- enum TextAlignment
- {
+ enum TextAlignment {
/// For horizontal alignment, this means align left. For vertical alignment, this means align top.
AlignAxisMin,
/// Align middle of the text to the middle of the axis.
@@ -24,8 +22,7 @@ public:
AlignAxisMax,
};
- enum CellType
- {
+ enum CellType {
ConstantCell,
SingularParametricCell,
ArrayParametricCell,
@@ -89,8 +86,7 @@ public:
/// \see TableCell
/// \see TableInstantiationParameters
/// \see TableTemplate
-class TableArrayGroup
-{
+class TableArrayGroup {
public:
/// Parameter name mapped to cell location (index from LeftCell).
tsl::array_map<char, int> mName2Cell;
@@ -119,8 +115,7 @@ struct lxw_worksheet;
/// An object containing the necessary information to instantiate a table template.
/// \see TableTemplate
-class TableInstantiationParameters
-{
+class TableInstantiationParameters {
private:
const TableTemplate* mTable;
@@ -144,8 +139,7 @@ public:
/// parametric rows/columns, and grids are also supported.
///
/// This current supports exporting to xlsx files.
-class TableTemplate : public Template
-{
+class TableTemplate : public Template {
friend class TableSingleParamsIter;
friend class TableArrayGroupsIter;
class Private;
@@ -201,15 +195,13 @@ public:
/// Find an array group by its name.
TableArrayGroup* FindArrayGroup(std::string_view name);
- enum MergeCellsResult
- {
+ enum MergeCellsResult {
MCR_CellAlreadyMerged,
MCR_Success,
};
MergeCellsResult MergeCells(Vec2i topLeft, Vec2i bottomRight);
- enum BreakCellsResult
- {
+ enum BreakCellsResult {
BCR_CellNotMerged,
BCR_Success,
};
diff --git a/app/source/Cplt/Model/Template/TableTemplateIterator.cpp b/app/source/Cplt/Model/Template/TableTemplateIterator.cpp
index 19e30b9..3a8e8c2 100644
--- a/app/source/Cplt/Model/Template/TableTemplateIterator.cpp
+++ b/app/source/Cplt/Model/Template/TableTemplateIterator.cpp
@@ -2,17 +2,14 @@
TableSingleParamsIter::TableSingleParamsIter(TableTemplate& tmpl)
: mTemplate{ &tmpl }
- , mIter{ tmpl.mName2Parameters.begin() }
-{
+ , mIter{ tmpl.mName2Parameters.begin() } {
}
-bool TableSingleParamsIter::HasNext() const
-{
+bool TableSingleParamsIter::HasNext() const {
return mIter != mTemplate->mName2Parameters.end();
}
-TableCell& TableSingleParamsIter::Next()
-{
+TableCell& TableSingleParamsIter::Next() {
int id = mIter.value();
++mIter;
@@ -21,32 +18,26 @@ TableCell& TableSingleParamsIter::Next()
TableArrayGroupsIter::TableArrayGroupsIter(TableTemplate& tmpl)
: mTemplate{ &tmpl }
- , mIter{ tmpl.mName2ArrayGroups.begin() }
-{
+ , mIter{ tmpl.mName2ArrayGroups.begin() } {
}
-bool TableArrayGroupsIter::HasNext() const
-{
+bool TableArrayGroupsIter::HasNext() const {
return mIter != mTemplate->mName2ArrayGroups.end();
}
-TableArrayGroup& TableArrayGroupsIter::Peek() const
-{
+TableArrayGroup& TableArrayGroupsIter::Peek() const {
int id = mIter.value();
return mTemplate->mArrayGroups[id];
}
-std::string_view TableArrayGroupsIter::PeekName() const
-{
+std::string_view TableArrayGroupsIter::PeekName() const {
return mIter.key_sv();
}
-const char* TableArrayGroupsIter::PeekNameCStr() const
-{
+const char* TableArrayGroupsIter::PeekNameCStr() const {
return mIter.key();
}
-void TableArrayGroupsIter::Next()
-{
+void TableArrayGroupsIter::Next() {
++mIter;
}
diff --git a/app/source/Cplt/Model/Template/TableTemplateIterator.hpp b/app/source/Cplt/Model/Template/TableTemplateIterator.hpp
index c4b5bf9..d9cb2ad 100644
--- a/app/source/Cplt/Model/Template/TableTemplateIterator.hpp
+++ b/app/source/Cplt/Model/Template/TableTemplateIterator.hpp
@@ -5,8 +5,7 @@
#include <string_view>
-class TableSingleParamsIter
-{
+class TableSingleParamsIter {
private:
TableTemplate* mTemplate;
tsl::array_map<char, int>::iterator mIter;
@@ -18,8 +17,7 @@ public:
TableCell& Next();
};
-class TableArrayGroupsIter
-{
+class TableArrayGroupsIter {
private:
TableTemplate* mTemplate;
tsl::array_map<char, int>::iterator mIter;
diff --git a/app/source/Cplt/Model/Template/Template.hpp b/app/source/Cplt/Model/Template/Template.hpp
index cf926d0..9591eaa 100644
--- a/app/source/Cplt/Model/Template/Template.hpp
+++ b/app/source/Cplt/Model/Template/Template.hpp
@@ -8,11 +8,9 @@
#include <memory>
#include <string>
-class Template : public Asset
-{
+class Template : public Asset {
public:
- enum Kind
- {
+ enum Kind {
KD_Table,
InvalidKind,
@@ -39,8 +37,7 @@ public:
virtual void WriteToDataStream(OutputDataStream& stream) const = 0;
};
-class TemplateAssetList final : public AssetListTyped<Template>
-{
+class TemplateAssetList final : public AssetListTyped<Template> {
private:
// AC = Asset Creator
std::string mACNewName;
diff --git a/app/source/Cplt/Model/Template/Template_Main.cpp b/app/source/Cplt/Model/Template/Template_Main.cpp
index d658231..57f3925 100644
--- a/app/source/Cplt/Model/Template/Template_Main.cpp
+++ b/app/source/Cplt/Model/Template/Template_Main.cpp
@@ -17,23 +17,19 @@ using namespace std::literals::string_view_literals;
namespace fs = std::filesystem;
Template::Template(Kind kind)
- : mKind{ kind }
-{
+ : mKind{ kind } {
}
-Template::Kind Template::GetKind() const
-{
+Template::Kind Template::GetKind() const {
return mKind;
}
-void TemplateAssetList::DiscoverFiles(const std::function<void(SavedAsset)>& callback) const
-{
+void TemplateAssetList::DiscoverFiles(const std::function<void(SavedAsset)>& callback) const {
auto dir = GetConnectedProject().GetTemplatesDirectory();
DiscoverFilesByExtension(callback, dir, ".cplt-template"sv);
}
-std::string TemplateAssetList::RetrieveNameFromFile(const fs::path& file) const
-{
+std::string TemplateAssetList::RetrieveNameFromFile(const fs::path& file) const {
auto res = DataArchive::LoadFile(file);
if (!res) return "";
auto& stream = res.value();
@@ -44,19 +40,16 @@ std::string TemplateAssetList::RetrieveNameFromFile(const fs::path& file) const
return assetInfo.Name;
}
-uuids::uuid TemplateAssetList::RetrieveUuidFromFile(const fs::path& file) const
-{
+uuids::uuid TemplateAssetList::RetrieveUuidFromFile(const fs::path& file) const {
return uuids::uuid::from_string(file.stem().string());
}
-fs::path TemplateAssetList::RetrievePathFromAsset(const SavedAsset& asset) const
-{
+fs::path TemplateAssetList::RetrievePathFromAsset(const SavedAsset& asset) const {
auto fileName = uuids::to_string(asset.Uuid);
return GetConnectedProject().GetTemplatePath(fileName);
}
-bool TemplateAssetList::SaveInstance(const SavedAsset& assetInfo, const Asset* asset) const
-{
+bool TemplateAssetList::SaveInstance(const SavedAsset& assetInfo, const Asset* asset) const {
auto path = RetrievePathFromAsset(assetInfo);
auto res = DataArchive::SaveFile(path);
if (!res) return false;
@@ -71,8 +64,7 @@ bool TemplateAssetList::SaveInstance(const SavedAsset& assetInfo, const Asset* a
return true;
}
-static std::unique_ptr<Template> LoadTemplateFromFile(const fs::path& path)
-{
+static std::unique_ptr<Template> LoadTemplateFromFile(const fs::path& path) {
auto res = DataArchive::LoadFile(path);
if (!res) return nullptr;
auto& stream = res.value();
@@ -87,19 +79,16 @@ static std::unique_ptr<Template> LoadTemplateFromFile(const fs::path& path)
return tmpl;
}
-Template* TemplateAssetList::LoadInstance(const SavedAsset& assetInfo) const
-{
+Template* TemplateAssetList::LoadInstance(const SavedAsset& assetInfo) const {
return ::LoadTemplateFromFile(RetrievePathFromAsset(assetInfo)).release();
}
-Template* TemplateAssetList::CreateInstance(const SavedAsset& assetInfo) const
-{
+Template* TemplateAssetList::CreateInstance(const SavedAsset& assetInfo) const {
auto kind = static_cast<Template::Kind>(assetInfo.Payload);
return Template::CreateByKind(kind).release();
}
-bool TemplateAssetList::RenameInstanceOnDisk(const SavedAsset& assetInfo, std::string_view oldName) const
-{
+bool TemplateAssetList::RenameInstanceOnDisk(const SavedAsset& assetInfo, std::string_view oldName) const {
// Get asset path, which is only dependent on UUID
auto path = RetrievePathFromAsset(assetInfo);
@@ -112,8 +101,7 @@ bool TemplateAssetList::RenameInstanceOnDisk(const SavedAsset& assetInfo, std::s
return true;
}
-void TemplateAssetList::DisplayAssetCreator(ListState& state)
-{
+void TemplateAssetList::DisplayAssetCreator(ListState& state) {
auto ValidateNewName = [&]() -> void {
if (mACNewName.empty()) {
mACNewNameError = NameSelectionError::Empty;
@@ -189,8 +177,7 @@ void TemplateAssetList::DisplayAssetCreator(ListState& state)
}
}
-void TemplateAssetList::DisplayDetailsTable(ListState& state) const
-{
+void TemplateAssetList::DisplayDetailsTable(ListState& state) const {
ImGui::BeginTable("AssetDetailsTable", 2, ImGuiTableFlags_Borders);
ImGui::TableSetupColumn(I18N_TEXT("Name", L10N_NAME));
diff --git a/app/source/Cplt/Model/Template/Template_RTTI.cpp b/app/source/Cplt/Model/Template/Template_RTTI.cpp
index a96680b..40403ab 100644
--- a/app/source/Cplt/Model/Template/Template_RTTI.cpp
+++ b/app/source/Cplt/Model/Template/Template_RTTI.cpp
@@ -3,8 +3,7 @@
#include <Cplt/Model/Template/TableTemplate.hpp>
#include <Cplt/Utils/I18n.hpp>
-const char* Template::FormatKind(Kind kind)
-{
+const char* Template::FormatKind(Kind kind) {
switch (kind) {
case KD_Table: return I18N_TEXT("Table template", L10N_TEMPLATE_TABLE);
@@ -13,8 +12,7 @@ const char* Template::FormatKind(Kind kind)
return "";
}
-std::unique_ptr<Template> Template::CreateByKind(Kind kind)
-{
+std::unique_ptr<Template> Template::CreateByKind(Kind kind) {
switch (kind) {
case KD_Table: return std::make_unique<TableTemplate>();
@@ -23,7 +21,6 @@ std::unique_ptr<Template> Template::CreateByKind(Kind kind)
return nullptr;
}
-bool Template::IsInstance(const Template* tmpl)
-{
+bool Template::IsInstance(const Template* tmpl) {
return true;
}