1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 15:23:05 +04:00

Add support of type headings from YAML1.2

This commit is contained in:
Vladislav Sovrasov
2017-01-17 16:40:38 +03:00
parent 89a740a62f
commit 896c34fab3
2 changed files with 37 additions and 0 deletions
+20
View File
@@ -1475,6 +1475,26 @@ icvYMLParseValue( CvFileStorage* fs, char* ptr, CvFileNode* node,
ptr++;
value_type |= CV_NODE_USER;
}
if ( d == '<') //support of full type heading from YAML 1.2
{
const char* yamlTypeHeading = "<tag:yaml.org,2002:";
const size_t headingLenght = strlen(yamlTypeHeading);
char* typeEndPtr = ++ptr;
do d = *++typeEndPtr;
while( cv_isprint(d) && d != ' ' && d != '>' );
if ( d == '>' && (size_t)(typeEndPtr - ptr) > headingLenght )
{
if ( memcmp(ptr, yamlTypeHeading, headingLenght) == 0 )
{
value_type |= CV_NODE_USER;
*typeEndPtr = ' ';
ptr += headingLenght - 1;
}
}
}
endptr = ptr++;
do d = *++endptr;