MCPcopy Create free account
hub / github.com/axmolengine/axmol / getString

Method getString

core/base/Properties.cpp:790–831  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

788}
789
790const 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
833bool Properties::setString(const char* name, const char* value)
834{

Callers 2

mergeWithMethod · 0.45
createStatsLabelMethod · 0.45

Calls 3

isVariableFunction · 0.85
c_strMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected