| 788 | } |
| 789 | |
| 790 | const char* Properties::getString(const char* name, const char* defaultValue) const |
| 791 | { |
| 792 | char variable[256]; |
| 793 | const char* value = NULL; |
| 794 | |
| 795 | if (name) |
| 796 | { |
| 797 | // If 'name' is a variable, return the variable value |
| 798 | if (isVariable(name, variable, 256)) |
| 799 | { |
| 800 | return getVariable(variable, defaultValue); |
| 801 | } |
| 802 | |
| 803 | for (const auto& itr : _properties) |
| 804 | { |
| 805 | if (itr.name == name) |
| 806 | { |
| 807 | value = itr.value.c_str(); |
| 808 | break; |
| 809 | } |
| 810 | } |
| 811 | } |
| 812 | else |
| 813 | { |
| 814 | // No name provided - get the value at the current iterator position |
| 815 | if (_propertiesItr != _properties.end()) |
| 816 | { |
| 817 | value = _propertiesItr->value.c_str(); |
| 818 | } |
| 819 | } |
| 820 | |
| 821 | if (value) |
| 822 | { |
| 823 | // If the value references a variable, return the variable value |
| 824 | if (isVariable(value, variable, 256)) |
| 825 | return getVariable(variable, defaultValue); |
| 826 | |
| 827 | return value; |
| 828 | } |
| 829 | |
| 830 | return defaultValue; |
| 831 | } |
| 832 | |
| 833 | bool Properties::setString(const char* name, const char* value) |
| 834 | { |
no test coverage detected