-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Issue #7 | Fix state insolvency, add more debug code, add YO_ prefix to internal macros * Issue #7 | Try to fix the GitHub Action pipeline * Committing clang-format changes * Issue #7 | Trigger clang-format and fix logo and name * Issue #0 | General readability enhancements * Committing clang-format changes * Issue #17 | Add examples of library optimisation to README.md --------- Co-authored-by: Clang Robot <robot@example.com> Co-authored-by: GitHub Actions <actions@github.com>
- Loading branch information
1 parent
c789968
commit 7116ab5
Showing
35 changed files
with
615 additions
and
378 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#pragma once | ||
|
||
#include "debug/exception.h" | ||
#include "debug/throw.h" | ||
|
||
#include <sstream> | ||
|
||
#define YO_DEBUG_ASSERT(condition) YO_DEBUG_ASSERT_WITH_MSG(condition, ""); | ||
|
||
#define YO_DEBUG_ASSERT_WITH_MSG(condition, description, ...) \ | ||
do \ | ||
{ \ | ||
if (!(condition)) \ | ||
{ \ | ||
YO_THROW(YamlOptimizerError, \ | ||
"Assertion failed: {} in file " __FILE__ " at line {}", \ | ||
fmt::format(description, ##__VA_ARGS__), __LINE__) \ | ||
} \ | ||
} while (false); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#pragma once | ||
|
||
#include <istream> | ||
#include <string> | ||
|
||
namespace io_utils | ||
{ | ||
|
||
std::string get_file_content(std::istream& is); | ||
|
||
} // namespace io_utils |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#pragma once | ||
|
||
#include "ryml.hpp" | ||
|
||
namespace node_utils | ||
{ | ||
|
||
void set_reference(ryml::NodeRef& node, ryml::csubstr anchor); | ||
|
||
std::size_t | ||
get_next_valid_id_after_content_removal(ryml::NodeRef node, | ||
std::size_t max_possible_id); | ||
|
||
std::string to_string(const ryml::ConstNodeRef& node); | ||
|
||
class NodeDiff | ||
{ | ||
ryml::ConstNodeRef lhs_; | ||
ryml::ConstNodeRef rhs_; | ||
|
||
public: | ||
NodeDiff(const ryml::ConstNodeRef& lhs, const ryml::ConstNodeRef& rhs); | ||
|
||
std::string str() const; | ||
|
||
friend std::ostream& operator<<(std::ostream& os, NodeDiff const& diff); | ||
}; | ||
|
||
} // namespace node_utils |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#pragma once | ||
|
||
/* clang-format off */ | ||
#if defined(__APPLE__) && defined(__MACH__) | ||
// Apple platforms | ||
#define YO_APPLE | ||
|
||
#include <TargetConditionals.h> | ||
#if TARGET_OS_MAC | ||
// macOS | ||
#define YO_MACOS | ||
#endif | ||
|
||
#if TARGET_OS_IOS | ||
// iOS | ||
#define YO_IOS | ||
#endif | ||
|
||
#if TARGET_OS_TV | ||
// tvOS | ||
#define YO_TVOS | ||
#endif | ||
|
||
#if TARGET_OS_WATCH | ||
// watchOS | ||
#define YO_WATCHOS | ||
#endif | ||
#elif defined(_WIN32) || defined(_WIN64) | ||
// Windows platforms | ||
#define YO_WINDOWS | ||
|
||
#ifdef _WIN32 | ||
#define YO_WINDOWS32 | ||
#endif | ||
|
||
#ifdef _WIN64 | ||
#define YO_WINDOWS64 | ||
#endif | ||
#elif defined(__linux__) | ||
// Linux platform | ||
#define YO_LINUX | ||
#elif defined(__ANDROID__) | ||
// Android platform | ||
#define YO_ANDROID | ||
#elif defined(__FreeBSD__) | ||
// FreeBSD platform | ||
#define YO_FREEBSD | ||
#elif defined(__unix__) || defined(__unix) | ||
// Generic Unix platform | ||
#define YO_UNIX | ||
#else | ||
// Unsupported platform | ||
#error Unsupported platform | ||
#endif | ||
/* clang-format off */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#pragma once | ||
|
||
#include <string> | ||
|
||
namespace string_utils | ||
{ | ||
|
||
// Function to check if a string starts with a given substring | ||
bool starts_with(std::string_view str, std::string_view start); | ||
|
||
// Function to check if a string ends with a given substring | ||
bool ends_with(std::string_view str, std::string_view end); | ||
|
||
class StringDiff | ||
{ | ||
std::string lhs_; | ||
std::string rhs_; | ||
|
||
public: | ||
StringDiff(const std::string& lhs, const std::string& rhs); | ||
|
||
std::string str() const; | ||
|
||
friend std::ostream& operator<<(std::ostream& os, StringDiff const& diff); | ||
}; // class StringDiff | ||
|
||
} // namespace string_utils |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#include "debug/exception.h" | ||
|
||
YamlOptimizerError::YamlOptimizerError(std::string const& what) | ||
: std::runtime_error(what) | ||
{ | ||
} |
Oops, something went wrong.