changed "void FileStorage::release(string&)" to "string FileStorage::releaseAndGetString()"

This commit is contained in:
Vadim Pisarevsky 2012-05-30 13:02:45 +00:00
parent 29b9070698
commit 17d9509e31
3 changed files with 5 additions and 6 deletions

View File

@ -3978,7 +3978,7 @@ public:
//! closes the file and releases all the memory buffers //! closes the file and releases all the memory buffers
CV_WRAP virtual void release(); CV_WRAP virtual void release();
//! closes the file, releases all the memory buffers and returns the text string //! closes the file, releases all the memory buffers and returns the text string
CV_WRAP_AS(releaseAndGetString) virtual void release(CV_OUT string& buf); CV_WRAP virtual string releaseAndGetString();
//! returns the first element of the top-level mapping //! returns the first element of the top-level mapping
CV_WRAP FileNode getFirstTopLevelNode() const; CV_WRAP FileNode getFirstTopLevelNode() const;

View File

@ -5161,16 +5161,16 @@ void FileStorage::release()
state = UNDEFINED; state = UNDEFINED;
} }
void FileStorage::release(string& buf) string FileStorage::releaseAndGetString()
{ {
string buf;
if( fs.obj && fs.obj->outbuf ) if( fs.obj && fs.obj->outbuf )
icvClose(fs.obj, &buf); icvClose(fs.obj, &buf);
else
buf.clear();
fs.release(); fs.release();
structs.clear(); structs.clear();
state = UNDEFINED; state = UNDEFINED;
return buf;
} }
FileNode FileStorage::root(int streamidx) const FileNode FileStorage::root(int streamidx) const

View File

@ -180,8 +180,7 @@ protected:
fs.writeObj("test_graph",graph); fs.writeObj("test_graph",graph);
CvGraph* graph2 = (CvGraph*)cvClone(graph); CvGraph* graph2 = (CvGraph*)cvClone(graph);
string content; string content = fs.releaseAndGetString();
fs.release(content);
if(!fs.open(mem ? content : filename, FileStorage::READ + (mem ? FileStorage::MEMORY : 0))) if(!fs.open(mem ? content : filename, FileStorage::READ + (mem ? FileStorage::MEMORY : 0)))
{ {