diff options
author | Hieu Hoang <hieuhoang@gmail.com> | 2014-11-28 02:02:41 +0300 |
---|---|---|
committer | Hieu Hoang <hieuhoang@gmail.com> | 2014-11-28 02:02:41 +0300 |
commit | 8306de019c02bfe141ac7a3ae9a1ce5d9ccb2e6a (patch) | |
tree | f569725335adb53fd5e1fd18cb8d1e3220a394b6 /moses/Util.h | |
parent | d249e398eacf1e91161c6b78fb5c6870e9923ea4 (diff) |
make GetParam() a const method with no side effect
Diffstat (limited to 'moses/Util.h')
-rw-r--r-- | moses/Util.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/moses/Util.h b/moses/Util.h index 0e3ead4e1..8e8ccf34b 100644 --- a/moses/Util.h +++ b/moses/Util.h @@ -120,6 +120,22 @@ inline SearchAlgorithm Scan<SearchAlgorithm>(const std::string &input) return (SearchAlgorithm) Scan<size_t>(input); } +template<> +inline XmlInputType Scan<XmlInputType>(const std::string &input) +{ + XmlInputType ret; + if (input=="exclusive") ret = XmlExclusive; + else if (input=="inclusive") ret = XmlInclusive; + else if (input=="constraint") ret = XmlConstraint; + else if (input=="ignore") ret = XmlIgnore; + else if (input=="pass-through") ret = XmlPassThrough; + else { + UTIL_THROW2("Unknown XML input type"); + } + + return ret; +} + //! Specialisation to understand yes/no y/n true/false 0/1 template<> bool Scan<bool>(const std::string &input); |