mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-19 08:31:11 +00:00
Gives function overloading a try.
This commit is contained in:
parent
7bf04d5338
commit
d6c6b9bdb8
@ -11,7 +11,6 @@
|
||||
|
||||
#include "../../../Reflection/Enum.h"
|
||||
|
||||
ReflectiveEnum(MacintoshModel, int, Mac128k, Mac512k, Mac128ke, MacPlus);
|
||||
|
||||
namespace Analyser {
|
||||
namespace Static {
|
||||
@ -19,11 +18,24 @@ namespace Macintosh {
|
||||
|
||||
|
||||
struct Target: public ::Analyser::Static::Target {
|
||||
MacintoshModel model = MacintoshModel::MacPlus;
|
||||
ReflectiveEnum(Model, int, Mac128k, Mac512k, Mac512ke, MacPlus);
|
||||
|
||||
Target() {
|
||||
// Model m;
|
||||
// printf("%s\n", __declaration(m));
|
||||
printf("%zu\n", Reflection::Enum<Model>::size());
|
||||
// for(size_t c = 0; c < Reflection::Enum<Model>::size(); ++c) {
|
||||
// const auto name = Reflection::Enum<Model>::toString(Model(c));
|
||||
// printf("%.*s\n", int(name.size()), name.data());
|
||||
// }
|
||||
}
|
||||
|
||||
Model model = Model::MacPlus;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif /* Analyser_Static_Macintosh_Target_h */
|
||||
|
@ -34,6 +34,7 @@
|
||||
buildConfiguration = "Release"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
enableThreadSanitizer = "YES"
|
||||
disableMainThreadChecker = "YES"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
|
@ -40,8 +40,8 @@ template <typename EnumType> struct Enum {
|
||||
@returns A vector of string_views naming the members of this enum in value order.
|
||||
*/
|
||||
static std::vector<std::string_view> members() {
|
||||
Enum<EnumType> m;
|
||||
const char *const declaration = m.declaration();
|
||||
EnumType m;
|
||||
const char *const declaration = __declaration(m);
|
||||
const char *d_ptr = declaration;
|
||||
|
||||
std::vector<std::string_view> result;
|
||||
@ -60,10 +60,6 @@ template <typename EnumType> struct Enum {
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private:
|
||||
constexpr const char *declaration();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
@ -75,6 +71,6 @@ template <typename EnumType> struct Enum {
|
||||
*/
|
||||
#define ReflectiveEnum(Name, Type, ...) \
|
||||
enum class Name: Type { __VA_ARGS__ }; \
|
||||
template <> constexpr const char *::Reflection::Enum<Name>::declaration() { return #__VA_ARGS__; };
|
||||
constexpr const char *__declaration(Name) { return #__VA_ARGS__; }
|
||||
|
||||
#endif /* Enum_h */
|
||||
|
Loading…
Reference in New Issue
Block a user