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

Function icvYMLStartWriteStruct

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

Source from the content-addressed store, hash-verified

1540
1541
1542static void
1543icvYMLStartWriteStruct( CvFileStorage* fs, const char* key, int struct_flags,
1544 const char* type_name CV_DEFAULT(0))
1545{
1546 int parent_flags;
1547 char buf[CV_FS_MAX_LEN + 1024];
1548 const char* data = 0;
1549
1550 struct_flags = (struct_flags & (CV_NODE_TYPE_MASK|CV_NODE_FLOW)) | CV_NODE_EMPTY;
1551 if( !CV_NODE_IS_COLLECTION(struct_flags))
1552 CV_Error( CV_StsBadArg,
1553 "Some collection type - CV_NODE_SEQ or CV_NODE_MAP, must be specified" );
1554
1555 if( CV_NODE_IS_FLOW(struct_flags) )
1556 {
1557 char c = CV_NODE_IS_MAP(struct_flags) ? '{' : '[';
1558 struct_flags |= CV_NODE_FLOW;
1559
1560 if( type_name )
1561 sprintf( buf, "!!%s %c", type_name, c );
1562 else
1563 {
1564 buf[0] = c;
1565 buf[1] = '\0';
1566 }
1567 data = buf;
1568 }
1569 else if( type_name )
1570 {
1571 sprintf( buf, "!!%s", type_name );
1572 data = buf;
1573 }
1574
1575 icvYMLWrite( fs, key, data );
1576
1577 parent_flags = fs->struct_flags;
1578 cvSeqPush( fs->write_stack, &parent_flags );
1579 fs->struct_flags = struct_flags;
1580
1581 if( !CV_NODE_IS_FLOW(parent_flags) )
1582 fs->struct_indent += CV_YML_INDENT + CV_NODE_IS_FLOW(struct_flags);
1583}
1584
1585
1586static void

Callers

nothing calls this directly

Calls 2

icvYMLWriteFunction · 0.85
cvSeqPushFunction · 0.85

Tested by

no test coverage detected