MCPcopy Create free account
hub / github.com/MyGUI/mygui / checkPair

Method checkPair

MyGUIEngine/src/MyGUI_XmlDocument.cpp:744–764  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

742 }
743
744 bool Document::checkPair(std::string& _key, std::string& _value)
745 {
746 // в ключе не должно быть ковычек и пробелов
747 MyGUI::utility::trim(_key);
748 if (_key.empty())
749 return false;
750 size_t start = _key.find_first_of(" \t\"\'&");
751 if (start != std::string::npos)
752 return false;
753
754 // в значении, ковычки по бокам
755 MyGUI::utility::trim(_value);
756 if (_value.size() < 2)
757 return false;
758 if (((_value[0] != '"') || (_value[_value.length() - 1] != '"')) &&
759 ((_value[0] != '\'') || (_value[_value.length() - 1] != '\'')))
760 return false;
761 bool ok = true;
762 _value = utility::convert_from_xml(_value.substr(1, _value.length() - 2), ok);
763 return ok;
764 }
765
766 // ищет символ без учета ковычек
767 size_t Document::find(std::string_view _text, char _char, size_t _start)

Callers

nothing calls this directly

Calls 7

trimFunction · 0.85
convert_from_xmlFunction · 0.85
find_first_ofMethod · 0.80
substrMethod · 0.80
emptyMethod · 0.45
sizeMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected