MCPcopy Create free account
hub / github.com/ComodoSecurity/openedr / parsePath

Function parsePath

edrav2/iprj/libcore/src/lvbs.cpp:130–180  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

128//
129//
130FieldFlags parsePath(std::string& sPath, std::string& sName)
131{
132/*
133 // TODO: Add support of Sequence::Sequence::... hierarchy
134 size_t nPos = 0;
135 while (sPath[nPos] != 0 && sPath[nPos] != '.' && sPath[nPos] != '[')
136 ++nPos;
137 FieldFlags eFlags = FieldFlags::Value;
138 if (sPath[nPos] == '.')
139 {
140 setFlag(eFlags, FieldFlags::Dictionary);
141 sName = sPath.substr(0, nPos);
142 sPath = sPath.substr(nPos + 1);
143 }
144 else if (sPath[nPos] == '[')
145 {
146 setFlag(eFlags, FieldFlags::Sequence);
147 sName = sPath.substr(0, nPos);
148 sPath = sPath.substr(nPos + 2);
149 }
150 else
151 {
152 sName = sPath;
153 sPath.clear();
154 }
155 return eFlags;
156*/
157
158 FieldFlags eFlags = FieldFlags::Value;
159 std::string::size_type nDict = sPath.find(".");
160 if (nDict == std::string::npos)
161 {
162 sName = sPath;
163 sPath.clear();
164 }
165 else
166 {
167 sName = sPath.substr(0, nDict);
168 sPath = sPath.substr(nDict + 1);
169 setFlag(eFlags, FieldFlags::Dictionary);
170 }
171
172 std::string::size_type nSeq = sName.find("[]");
173 if (nSeq != std::string::npos)
174 {
175 sName = sName.substr(0, nSeq);
176 setFlag(eFlags, FieldFlags::Sequence);
177 }
178
179 return eFlags;
180}
181
182//
183//

Callers 1

putDataFunction · 0.85

Calls 4

setFlagFunction · 0.50
findMethod · 0.45
clearMethod · 0.45
substrMethod · 0.45

Tested by

no test coverage detected