MCPcopy Create free account
hub / github.com/assimp/assimp / ParseProperty

Method ParseProperty

code/AssetLib/Ply/PlyParser.cpp:189–245  ·  view source on GitHub ↗

------------------------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

187
188// ------------------------------------------------------------------------------------------------
189bool PLY::Property::ParseProperty(std::vector<char> &buffer, PLY::Property *pOut) {
190 ai_assert(!buffer.empty());
191
192 // Forms supported:
193 // "property float x"
194 // "property list uchar int vertex_index"
195
196 // skip leading spaces
197 if (!DOM::SkipSpaces(buffer)) {
198 return false;
199 }
200
201 // skip the "property" string at the beginning
202 if (!DOM::TokenMatch(buffer, "property", 8)) {
203 // seems not to be a valid property entry
204 return false;
205 }
206 // get next word
207 if (!PLY::DOM::SkipSpaces(buffer)) {
208 return false;
209 }
210 if (PLY::DOM::TokenMatch(buffer, "list", 4)) {
211 pOut->bIsList = true;
212
213 // seems to be a list.
214 if (EDT_INVALID == (pOut->eFirstType = PLY::Property::ParseDataType(buffer))) {
215 // unable to parse list size data type
216 PLY::DOM::SkipLine(buffer);
217 return false;
218 }
219 if (!PLY::DOM::SkipSpaces(buffer)) return false;
220 if (EDT_INVALID == (pOut->eType = PLY::Property::ParseDataType(buffer))) {
221 // unable to parse list data type
222 PLY::DOM::SkipLine(buffer);
223 return false;
224 }
225 } else {
226 if (EDT_INVALID == (pOut->eType = PLY::Property::ParseDataType(buffer))) {
227 // unable to parse data type. Skip the property
228 PLY::DOM::SkipLine(buffer);
229 return false;
230 }
231 }
232
233 if (!PLY::DOM::SkipSpaces(buffer))
234 return false;
235
236 pOut->Semantic = PLY::Property::ParseSemantic(buffer);
237
238 if (PLY::EST_INVALID == pOut->Semantic) {
239 ASSIMP_LOG_INFO("Found unknown semantic in PLY file. This is OK");
240 std::string(&buffer[0], &buffer[0] + strlen(&buffer[0]));
241 }
242
243 PLY::DOM::SkipSpacesAndLineEnd(buffer);
244 return true;
245}
246

Callers

nothing calls this directly

Calls 5

TokenMatchFunction · 0.85
SkipSpacesFunction · 0.50
SkipLineFunction · 0.50
SkipSpacesAndLineEndFunction · 0.50
emptyMethod · 0.45

Tested by

no test coverage detected