-
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.
- Loading branch information
Showing
8 changed files
with
111 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#pragma once | ||
|
||
#include <algorithm> | ||
#include <string> | ||
#include <vector> | ||
|
||
#include "wamon/exception.h" | ||
|
||
namespace wamon { | ||
|
||
class EnumDef { | ||
public: | ||
EnumDef(const std::string& enum_name) : enum_name_(enum_name) {} | ||
|
||
void AddEnumItem(const std::string& enum_id) { | ||
auto it = std::find(enum_items_.begin(), enum_items_.end(), enum_id); | ||
if (it != enum_items_.end()) { | ||
throw WamonException("EnumDef.AddEnumItem error, duplicate enum id {}", enum_id); | ||
} | ||
enum_items_.push_back(enum_id); | ||
} | ||
|
||
const std::string& GetEnumName() const { return enum_name_; } | ||
|
||
void SetEnumName(const std::string& name) { enum_name_ = name; } | ||
|
||
const std::vector<std::string>& GetEnumItems() const { return enum_items_; } | ||
|
||
private: | ||
std::string enum_name_; | ||
std::vector<std::string> enum_items_; | ||
}; | ||
|
||
} // namespace wamon |
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