-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MathObjectClass, new Parser, class body macro
- Loading branch information
Showing
354 changed files
with
2,219 additions
and
2,874 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
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,46 @@ | ||
#pragma once | ||
|
||
#include <memory> | ||
|
||
#include "fintamath/core/MathObjectClass.hpp" | ||
#include "fintamath/core/Parser.hpp" | ||
|
||
#define FINTAMATH_CLASS_BODY(Class) \ | ||
public: \ | ||
static constexpr MathObjectClass getClassStatic() { \ | ||
return {#Class}; \ | ||
} \ | ||
\ | ||
private: | ||
|
||
#define FINTAMATH_PARENT_CLASS_BODY(Class) \ | ||
FINTAMATH_CLASS_BODY(Class) \ | ||
\ | ||
private: \ | ||
using Class##Parser = detail::Parser<std::unique_ptr<Class>>; \ | ||
\ | ||
static Class##Parser &getParser(); \ | ||
\ | ||
public: \ | ||
template <std::convertible_to<std::string> String> \ | ||
static auto parse(String &&str) { \ | ||
return getParser().parse(std::forward<String>(str)); \ | ||
} \ | ||
\ | ||
static auto parseFirst(const std::string &str) { \ | ||
return getParser().parseFirst(str); \ | ||
} \ | ||
\ | ||
template <std::derived_from<Class> T> \ | ||
static void registerType() { \ | ||
MathObjectClass::bindTypes<Class, T>(); \ | ||
getParser().registerType<T>(); \ | ||
} \ | ||
\ | ||
private: | ||
|
||
#define FINTAMATH_PARENT_CLASS_IMPLEMENTATION(Class) \ | ||
Class::Class##Parser &Class::getParser() { \ | ||
static Class##Parser parser; \ | ||
return parser; \ | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.