| 1 | // |
|---|---|
| 2 | // Page.cpp |
| 3 | // |
| 4 | // Copyright (c) 2008, Applied Informatics Software Engineering GmbH. |
| 5 | // and Contributors. |
| 6 | // |
| 7 | // SPDX-License-Identifier: BSL-1.0 |
| 8 | // |
| 9 | |
| 10 | |
| 11 | #include "Page.h" |
| 12 | #include "Poco/String.h" |
| 13 | #include "Poco/NumberParser.h" |
| 14 | |
| 15 | |
| 16 | Page::Page() |
| 17 | { |
| 18 | } |
| 19 | |
| 20 | |
| 21 | Page::~Page() |
| 22 | { |
| 23 | } |
| 24 | |
| 25 | |
| 26 | bool Page::getBool(const std::string& property, bool deflt) const |
| 27 | { |
| 28 | if (has(property)) |
| 29 | { |
| 30 | const std::string& value = get(property); |
| 31 | return Poco::icompare(value, "true") == 0 |
| 32 | || Poco::icompare(value, "yes") == 0 |
| 33 | || Poco::icompare(value, "on") == 0; |
| 34 | } |
| 35 | else return deflt; |
| 36 | } |
| 37 | |
| 38 | |
| 39 | int Page::getInt(const std::string& property, int deflt) const |
| 40 | { |
| 41 | if (has(property)) |
| 42 | { |
| 43 | return Poco::NumberParser::parse(get(property)); |
| 44 | } |
| 45 | else return deflt; |
| 46 | } |
| 47 |