MCPcopy Create free account
hub / github.com/creatale/node-dv / icvYMLParseValue

Function icvYMLParseValue

deps/opencv/modules/core/src/persistence.cpp:1062–1368  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1060
1061
1062static char*
1063icvYMLParseValue( CvFileStorage* fs, char* ptr, CvFileNode* node,
1064 int parent_flags, int min_indent )
1065{
1066 char buf[CV_FS_MAX_LEN + 1024];
1067 char* endptr = 0;
1068 char c = ptr[0], d = ptr[1];
1069 int is_parent_flow = CV_NODE_IS_FLOW(parent_flags);
1070 int value_type = CV_NODE_NONE;
1071 int len;
1072
1073 memset( node, 0, sizeof(*node) );
1074
1075 if( c == '!' ) // handle explicit type specification
1076 {
1077 if( d == '!' || d == '^' )
1078 {
1079 ptr++;
1080 value_type |= CV_NODE_USER;
1081 }
1082
1083 endptr = ptr++;
1084 do d = *++endptr;
1085 while( cv_isprint(d) && d != ' ' );
1086 len = (int)(endptr - ptr);
1087 if( len == 0 )
1088 CV_PARSE_ERROR( "Empty type name" );
1089 d = *endptr;
1090 *endptr = '\0';
1091
1092 if( len == 3 && !CV_NODE_IS_USER(value_type) )
1093 {
1094 if( memcmp( ptr, "str", 3 ) == 0 )
1095 value_type = CV_NODE_STRING;
1096 else if( memcmp( ptr, "int", 3 ) == 0 )
1097 value_type = CV_NODE_INT;
1098 else if( memcmp( ptr, "seq", 3 ) == 0 )
1099 value_type = CV_NODE_SEQ;
1100 else if( memcmp( ptr, "map", 3 ) == 0 )
1101 value_type = CV_NODE_MAP;
1102 }
1103 else if( len == 5 && !CV_NODE_IS_USER(value_type) )
1104 {
1105 if( memcmp( ptr, "float", 5 ) == 0 )
1106 value_type = CV_NODE_REAL;
1107 }
1108 else if( CV_NODE_IS_USER(value_type) )
1109 {
1110 node->info = cvFindType( ptr );
1111 if( !node->info )
1112 node->tag &= ~CV_NODE_USER;
1113 }
1114
1115 *endptr = d;
1116 ptr = icvYMLSkipSpaces( fs, endptr, min_indent, INT_MAX );
1117
1118 c = *ptr;
1119

Callers 1

icvYMLParseFunction · 0.85

Calls 9

cvFindTypeFunction · 0.85
icvYMLSkipSpacesFunction · 0.85
cv_isdigitFunction · 0.85
cv_isalnumFunction · 0.85
icv_strtodFunction · 0.85
cvMemStorageAllocStringFunction · 0.85
icvFSCreateCollectionFunction · 0.85
icvYMLParseKeyFunction · 0.85
cvSeqPushFunction · 0.85

Tested by

no test coverage detected