From 79b1c44721776765173191dc7cba612169a8b601 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Sun, 10 Apr 2022 23:43:43 +0100 Subject: Add a method to ConfigTag to help with retrieving a single character. --- src/configparser.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/configparser.cpp') diff --git a/src/configparser.cpp b/src/configparser.cpp index e05dcd6ff..e5a12d319 100644 --- a/src/configparser.cpp +++ b/src/configparser.cpp @@ -755,6 +755,16 @@ bool ConfigTag::getBool(const std::string &key, bool def) return def; } +unsigned char ConfigTag::getCharacter(const std::string &key, unsigned char def) +{ + std::string result; + if (!readString(key, result) || result.size() != 1) + return def; + + return result[0]; +} + + std::string ConfigTag::getTagLocation() { return src_name + ":" + ConvToStr(src_line); -- cgit v1.3.1-10-gc9f91