Skip to content

Commit

Permalink
Simplify using magic_enum
Browse files Browse the repository at this point in the history
  • Loading branch information
TLCFEM committed Nov 15, 2024
1 parent 8b321a8 commit 2431e53
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 11 deletions.
4 changes: 2 additions & 2 deletions Include/magic_enum/magic_enum.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// | | | | (_| | (_| | | (__ | |____| | | | |_| | | | | | | | |____|_| |_|
// |_| |_|\__,_|\__, |_|\___| |______|_| |_|\__,_|_| |_| |_| \_____|
// __/ | https://github.com/Neargye/magic_enum
// |___/ version 0.9.6
// |___/ version 0.9.7
//
// Licensed under the MIT License <http://opensource.org/licenses/MIT>.
// SPDX-License-Identifier: MIT
Expand Down Expand Up @@ -34,7 +34,7 @@

#define MAGIC_ENUM_VERSION_MAJOR 0
#define MAGIC_ENUM_VERSION_MINOR 9
#define MAGIC_ENUM_VERSION_PATCH 6
#define MAGIC_ENUM_VERSION_PATCH 7

#ifndef MAGIC_ENUM_USE_STD_MODULE
#include <array>
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ Additional libraries used in **suanPan** are listed as follows.
- [**fmt**](https://github.com/fmtlib/fmt) version 10.2.1
- [**whereami**](https://github.com/gpakosz/whereami)
- [**exprtk**](https://github.com/ArashPartow/exprtk)
- [**magic_enum**](https://github.com/Neargye/magic_enum) version 0.9.7
- **thread_pool** abridged version of [`thread-pool`](https://github.com/bshoshany/thread-pool)

Those libraries may depend on other libraries such as [zlib](https://zlib.net/)
Expand Down
4 changes: 0 additions & 4 deletions Recorder/OutputType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@
******************************************************************************/

#include "OutputType.h"
#include <Toolbox/utility.h>


OutputType to_token(const std::string& L) { return to_token(L.c_str()); }

int to_index(const OutputType config) {
if(config == OutputType::S11) return 0;
Expand Down
9 changes: 4 additions & 5 deletions Recorder/OutputType.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#ifndef OUTPUTTYPE_H
#define OUTPUTTYPE_H

#include <string>
#include <magic_enum/magic_enum.hpp>

enum class OutputType {
Expand Down Expand Up @@ -259,17 +258,17 @@ enum class OutputType {

// amplitude
AMP,
NL = 256
NL
};

template<> struct magic_enum::customize::enum_range<OutputType> {
static constexpr int min = 0;
static constexpr int max = 512;
};

constexpr std::string_view to_name(OutputType L) { return magic_enum::enum_name(L);}
constexpr OutputType to_token(const char* L) { return magic_enum::enum_cast<OutputType>(L).value_or(OutputType::NL);}
OutputType to_token(const std::string&);
constexpr std::string_view to_name(OutputType L) { return magic_enum::enum_name(L); }

constexpr OutputType to_token(std::string_view L) { return magic_enum::enum_cast<OutputType>(L).value_or(OutputType::NL); }

const char* to_category(OutputType);
int to_index(OutputType);
Expand Down

0 comments on commit 2431e53

Please sign in to comment.