From 182c8f8357739f905bbd721006480502435b6b43 Mon Sep 17 00:00:00 2001 From: rtk0c Date: Sun, 27 Nov 2022 12:04:31 -0800 Subject: Update brace style to match rest of my projects --- app/source/Cplt/Model/GlobalStates.cpp | 48 ++++++++++++---------------------- 1 file changed, 16 insertions(+), 32 deletions(-) (limited to 'app/source/Cplt/Model/GlobalStates.cpp') diff --git a/app/source/Cplt/Model/GlobalStates.cpp b/app/source/Cplt/Model/GlobalStates.cpp index 417514f..b21e299 100644 --- a/app/source/Cplt/Model/GlobalStates.cpp +++ b/app/source/Cplt/Model/GlobalStates.cpp @@ -16,13 +16,11 @@ namespace fs = std::filesystem; static std::unique_ptr globalStateInstance; static fs::path globalDataPath; -void GlobalStates::Init() -{ +void GlobalStates::Init() { Init(StandardDirectories::UserData() / "cplt"); } -void GlobalStates::Init(std::filesystem::path userDataDir) -{ +void GlobalStates::Init(std::filesystem::path userDataDir) { globalStateInstance = std::make_unique(); globalDataPath = userDataDir; fs::create_directories(globalDataPath); @@ -53,8 +51,7 @@ void GlobalStates::Init(std::filesystem::path userDataDir) } } -void GlobalStates::Shutdown() -{ +void GlobalStates::Shutdown() { if (!globalStateInstance) return; globalStateInstance->SetCurrentProject(nullptr); @@ -64,29 +61,24 @@ void GlobalStates::Shutdown() } } -GlobalStates& GlobalStates::GetInstance() -{ +GlobalStates& GlobalStates::GetInstance() { return *globalStateInstance; } -const std::filesystem::path& GlobalStates::GetUserDataPath() -{ +const std::filesystem::path& GlobalStates::GetUserDataPath() { return globalDataPath; } -const std::vector& GlobalStates::GetRecentProjects() const -{ +const std::vector& GlobalStates::GetRecentProjects() const { return mRecentProjects; } -void GlobalStates::ClearRecentProjects() -{ +void GlobalStates::ClearRecentProjects() { mRecentProjects.clear(); MarkDirty(); } -void GlobalStates::AddRecentProject(const Project& project) -{ +void GlobalStates::AddRecentProject(const Project& project) { mRecentProjects.push_back(RecentProject{ .Path = project.GetPath(), .CachedUtf8String = project.GetPath().string(), @@ -94,8 +86,7 @@ void GlobalStates::AddRecentProject(const Project& project) MarkDirty(); } -void GlobalStates::MoveProjectToTop(const Project& project) -{ +void GlobalStates::MoveProjectToTop(const Project& project) { for (auto it = mRecentProjects.begin(); it != mRecentProjects.end(); ++it) { if (it->Path == project.GetPath()) { std::rotate(it, it + 1, mRecentProjects.end()); @@ -106,26 +97,22 @@ void GlobalStates::MoveProjectToTop(const Project& project) AddRecentProject(project); } -void GlobalStates::RemoveRecentProject(int idx) -{ +void GlobalStates::RemoveRecentProject(int idx) { assert(idx >= 0 && idx < mRecentProjects.size()); mRecentProjects.erase(mRecentProjects.begin() + idx); MarkDirty(); } -bool GlobalStates::HasCurrentProject() const -{ +bool GlobalStates::HasCurrentProject() const { return mCurrentProject != nullptr; } -Project* GlobalStates::GetCurrentProject() const -{ +Project* GlobalStates::GetCurrentProject() const { return mCurrentProject.get(); } -void GlobalStates::SetCurrentProject(std::unique_ptr project) -{ +void GlobalStates::SetCurrentProject(std::unique_ptr project) { if (mCurrentProject) { mCurrentProject->WriteToDisk(); mCurrentProject = nullptr; @@ -136,8 +123,7 @@ void GlobalStates::SetCurrentProject(std::unique_ptr project) mCurrentProject = std::move(project); } -void GlobalStates::WriteToDisk() const -{ +void GlobalStates::WriteToDisk() const { Json::Value root; auto& recentProjects = root["RecentProjects"] = Json::Value(Json::arrayValue); @@ -151,13 +137,11 @@ void GlobalStates::WriteToDisk() const mDirty = false; } -bool GlobalStates::IsDirty() const -{ +bool GlobalStates::IsDirty() const { return mDirty; } -void GlobalStates::MarkDirty() -{ +void GlobalStates::MarkDirty() { mDirty = true; OnModified(); } -- cgit v1.2.3-70-g09d2