-static bool getAs(const ScalarNode *SN, bool &Result) {
- SmallString<4> Storage;
- StringRef Value = SN->getValue(Storage);
- if (Value == "true")
- Result = true;
- else if (Value == "false")
- Result = false;
- else
- return false;
- return true;
-}
-
-template<class T>
-typename enable_if_c<std::numeric_limits<T>::is_integer, bool>::type
-getAs(const ScalarNode *SN, T &Result) {
- SmallString<4> Storage;
- return !SN->getValue(Storage).getAsInteger(0, Result);
-}
-