| 2387 | |
| 2388 | |
| 2389 | static void |
| 2390 | icvXMLStartWriteStruct( CvFileStorage* fs, const char* key, int struct_flags, |
| 2391 | const char* type_name CV_DEFAULT(0)) |
| 2392 | { |
| 2393 | CvXMLStackRecord parent; |
| 2394 | const char* attr[10]; |
| 2395 | int idx = 0; |
| 2396 | |
| 2397 | struct_flags = (struct_flags & (CV_NODE_TYPE_MASK|CV_NODE_FLOW)) | CV_NODE_EMPTY; |
| 2398 | if( !CV_NODE_IS_COLLECTION(struct_flags)) |
| 2399 | CV_Error( CV_StsBadArg, |
| 2400 | "Some collection type: CV_NODE_SEQ or CV_NODE_MAP must be specified" ); |
| 2401 | |
| 2402 | if( type_name ) |
| 2403 | { |
| 2404 | attr[idx++] = "type_id"; |
| 2405 | attr[idx++] = type_name; |
| 2406 | } |
| 2407 | attr[idx++] = 0; |
| 2408 | |
| 2409 | icvXMLWriteTag( fs, key, CV_XML_OPENING_TAG, cvAttrList(attr,0) ); |
| 2410 | |
| 2411 | parent.struct_flags = fs->struct_flags & ~CV_NODE_EMPTY; |
| 2412 | parent.struct_indent = fs->struct_indent; |
| 2413 | parent.struct_tag = fs->struct_tag; |
| 2414 | cvSaveMemStoragePos( fs->strstorage, &parent.pos ); |
| 2415 | cvSeqPush( fs->write_stack, &parent ); |
| 2416 | |
| 2417 | fs->struct_indent += CV_XML_INDENT; |
| 2418 | if( !CV_NODE_IS_FLOW(struct_flags) ) |
| 2419 | icvXMLFlush( fs ); |
| 2420 | |
| 2421 | fs->struct_flags = struct_flags; |
| 2422 | if( key ) |
| 2423 | { |
| 2424 | fs->struct_tag = cvMemStorageAllocString( fs->strstorage, (char*)key, -1 ); |
| 2425 | } |
| 2426 | else |
| 2427 | { |
| 2428 | fs->struct_tag.ptr = 0; |
| 2429 | fs->struct_tag.len = 0; |
| 2430 | } |
| 2431 | } |
| 2432 | |
| 2433 | |
| 2434 | static void |
nothing calls this directly
no test coverage detected