diff options
author | Your Name <you@example.com> | 2021-05-06 14:13:28 -0400 |
---|---|---|
committer | Your Name <you@example.com> | 2021-05-06 14:13:28 -0400 |
commit | 9f3802690f9dd9452e96d1d7a879291978d66e35 (patch) | |
tree | 6d6c17b39abdb9490119241bc4fc061744b46d7d /src/rules.h | |
parent | 2a9f262e6db5906db445d465e500d7ba8c90fab3 (diff) | |
download | dmtool-9f3802690f9dd9452e96d1d7a879291978d66e35.tar.gz dmtool-9f3802690f9dd9452e96d1d7a879291978d66e35.tar.bz2 dmtool-9f3802690f9dd9452e96d1d7a879291978d66e35.zip |
Refactoring
Diffstat (limited to 'src/rules.h')
-rw-r--r-- | src/rules.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/rules.h b/src/rules.h index f41f7ad..c1b130d 100644 --- a/src/rules.h +++ b/src/rules.h @@ -143,4 +143,11 @@ namespace rules { std::ostream& operator<<(std::ostream& os, const Ability& a); std::ostream& operator<<(std::ostream& os, const Skill& s); std::ostream& operator<<(std::ostream& os, const Qualifier& q); + + template<typename T> T tryGetAbilityOrSkill(std::string src) { + try { + return T::fromString(src); + } catch(std::exception& e) {} // eat. + return T(); + } } |