template<typename _Tp> static inline
void write( FileStorage& fs, const String& name, const std::vector<_Tp>& vec )
{
- fs << (DataType<_Tp>::fmt != 0 ? "[:" : "[");
+ internal::WriteStructContext ws(fs, name, FileNode::SEQ+(DataType<_Tp>::fmt != 0 ? FileNode::FLOW : 0));
write(fs, vec);
- fs << "]";
}
static inline
{
cvStartWriteStruct(**fs, !name.empty() ? name.c_str() : 0, flags,
!typeName.empty() ? typeName.c_str() : 0);
+ if ((flags & FileNode::TYPE_MASK) == FileNode::SEQ)
+ {
+ fs->elname = String();
+ fs->state = FileStorage::VALUE_EXPECTED;
+ fs->structs.push_back('[');
+ }
+ else
+ {
+ fs->elname = String();
+ fs->state = FileStorage::NAME_EXPECTED + FileStorage::INSIDE_MAP;
+ fs->structs.push_back('{');
+ }
}
internal::WriteStructContext::~WriteStructContext()
{
cvEndWriteStruct(**fs);
+ fs->structs.pop_back();
+ fs->state = fs->structs.empty() || fs->structs.back() == '{' ?
+ FileStorage::NAME_EXPECTED + FileStorage::INSIDE_MAP :
+ FileStorage::VALUE_EXPECTED;
+ fs->elname = String();
}