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

Function icvXMLParseValue

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

Source from the content-addressed store, hash-verified

1849 CvAttrList** _list, int* _tag_type );
1850
1851static char*
1852icvXMLParseValue( CvFileStorage* fs, char* ptr, CvFileNode* node,
1853 int value_type CV_DEFAULT(CV_NODE_NONE))
1854{
1855 CvFileNode *elem = node;
1856 int have_space = 1, is_simple = 1;
1857 int is_user_type = CV_NODE_IS_USER(value_type);
1858 memset( node, 0, sizeof(*node) );
1859
1860 value_type = CV_NODE_TYPE(value_type);
1861
1862 for(;;)
1863 {
1864 char c = *ptr, d;
1865 char* endptr;
1866
1867 if( cv_isspace(c) || c == '\0' || (c == '<' && ptr[1] == '!' && ptr[2] == '-') )
1868 {
1869 ptr = icvXMLSkipSpaces( fs, ptr, 0 );
1870 have_space = 1;
1871 c = *ptr;
1872 }
1873
1874 d = ptr[1];
1875
1876 if( c =='<' || c == '\0' )
1877 {
1878 CvStringHashNode *key = 0, *key2 = 0;
1879 CvAttrList* list = 0;
1880 CvTypeInfo* info = 0;
1881 int tag_type = 0;
1882 int is_noname = 0;
1883 const char* type_name = 0;
1884 int elem_type = CV_NODE_NONE;
1885
1886 if( d == '/' || c == '\0' )
1887 break;
1888
1889 ptr = icvXMLParseTag( fs, ptr, &key, &list, &tag_type );
1890
1891 if( tag_type == CV_XML_DIRECTIVE_TAG )
1892 CV_PARSE_ERROR( "Directive tags are not allowed here" );
1893 if( tag_type == CV_XML_EMPTY_TAG )
1894 CV_PARSE_ERROR( "Empty tags are not supported" );
1895
1896 assert( tag_type == CV_XML_OPENING_TAG );
1897
1898 type_name = list ? cvAttrValue( list, "type_id" ) : 0;
1899 if( type_name )
1900 {
1901 if( strcmp( type_name, "str" ) == 0 )
1902 elem_type = CV_NODE_STRING;
1903 else if( strcmp( type_name, "map" ) == 0 )
1904 elem_type = CV_NODE_MAP;
1905 else if( strcmp( type_name, "seq" ) == 0 )
1906 elem_type = CV_NODE_SEQ;
1907 else
1908 {

Callers 2

icvXMLParseTagFunction · 0.85
icvXMLParseFunction · 0.85

Calls 12

cv_isspaceFunction · 0.85
icvXMLSkipSpacesFunction · 0.85
icvXMLParseTagFunction · 0.85
cvAttrValueFunction · 0.85
cvFindTypeFunction · 0.85
icvFSCreateCollectionFunction · 0.85
cvSeqPushFunction · 0.85
cvGetFileNodeFunction · 0.85
cv_isdigitFunction · 0.85
cv_isalnumFunction · 0.85
icv_strtodFunction · 0.85
cvMemStorageAllocStringFunction · 0.85

Tested by

no test coverage detected