MCPcopy Create free account
hub / github.com/CppMicroServices/CppMicroServices / ParseSimple

Method ParseSimple

framework/src/util/LDAPExpr.cpp:968–1004  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

966 }
967
968 LDAPExpr
969 LDAPExpr::ParseSimple(ParseState& ps)
970 {
971 std::string attrName = ps.getAttributeName();
972 if (attrName.empty())
973 {
974 ps.error(LDAPExprConstants::MALFORMED());
975 }
976 int op = 0;
977 if (ps.prefix("="))
978 {
979 op = EQ;
980 }
981 else if (ps.prefix("<="))
982 {
983 op = LE;
984 }
985 else if (ps.prefix(">="))
986 {
987 op = GE;
988 }
989 else if (ps.prefix("~="))
990 {
991 op = APPROX;
992 }
993 else
994 {
995 // System.out.println("undef op='" + ps.peek() + "'");
996 ps.error(LDAPExprConstants::OPERATOR()); // Does not return
997 }
998 std::string attrValue = ps.getAttributeValue();
999 if (!ps.prefix(")"))
1000 {
1001 ps.error(LDAPExprConstants::MALFORMED());
1002 }
1003 return LDAPExpr(op, attrName, attrValue);
1004 }
1005
1006 const std::string
1007 LDAPExpr::ToString() const

Callers

nothing calls this directly

Calls 6

getAttributeNameMethod · 0.80
prefixMethod · 0.80
getAttributeValueMethod · 0.80
LDAPExprClass · 0.70
emptyMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected