![]() |
OpenCV
4.1.0
Open Source Computer Vision
|
XML/YAML/JSON file storage class that encapsulates all the information necessary for writing or reading data to/from a file. More...
#include <opencv2/core/persistence.hpp>
Public Types | |
| enum | Mode { READ = 0, WRITE = 1, APPEND = 2, MEMORY = 4, FORMAT_MASK = (7<<3), FORMAT_AUTO = 0, FORMAT_XML = (1<<3), FORMAT_YAML = (2<<3), FORMAT_JSON = (3<<3), BASE64 = 64, WRITE_BASE64 = BASE64 | WRITE } |
| file storage mode More... | |
| enum | State { UNDEFINED = 0, VALUE_EXPECTED = 1, NAME_EXPECTED = 2, INSIDE_MAP = 4 } |
Public Member Functions | |
| FileStorage () | |
| The constructors. | |
| FileStorage (const String &filename, int flags, const String &encoding=String()) | |
| Opens a file. | |
| virtual | ~FileStorage () |
| the destructor. calls release() | |
| void | endWriteStruct () |
| FileNode | getFirstTopLevelNode () const |
| Returns the first element of the top-level mapping. | |
| int | getFormat () const |
| Returns the current format. | |
| virtual bool | isOpened () const |
| Checks whether the file is opened. | |
| virtual bool | open (const String &filename, int flags, const String &encoding=String()) |
| Opens a file. | |
| FileNode | operator[] (const String &nodename) const |
| Returns the specified element of the top-level mapping. | |
| FileNode | operator[] (const char *nodename) const |
| virtual void | release () |
| Closes the file and releases all the memory buffers. | |
| virtual String | releaseAndGetString () |
| Closes the file and releases all the memory buffers. | |
| FileNode | root (int streamidx=0) const |
| Returns the top-level mapping. | |
| void | startWriteStruct (const String &name, int flags, const String &typeName) |
| void | write (const String &name, int val) |
| Simplified writing API to use with bindings. | |
| void | write (const String &name, double val) |
| void | write (const String &name, const String &val) |
| void | write (const String &name, const Mat &val) |
| void | write (const String &name, const std::vector< String > &val) |
| void | writeComment (const String &comment, bool append=false) |
| Writes a comment. | |
| void | writeRaw (const String &fmt, const void *vec, size_t len) |
| Writes multiple numbers. | |
Static Public Member Functions | |
| static String | getDefaultObjectName (const String &filename) |
| Returns the normalized object name for the specified name of a file. | |
Public Attributes | |
| std::string | elname |
| Ptr< Impl > | p |
| int | state |
Related Functions | |
(Note that these are not member functions.) | |
| FileStorage & | operator<< (FileStorage &fs, const String &str) |
| Writes string to a file storage. | |
| void | write (FileStorage &fs, const String &name, int value) |
| void | write (FileStorage &fs, const String &name, float value) |
| void | write (FileStorage &fs, const String &name, double value) |
| void | write (FileStorage &fs, const String &name, const String &value) |
| void | write (FileStorage &fs, const String &name, const Mat &value) |
| void | write (FileStorage &fs, const String &name, const SparseMat &value) |
| void | writeScalar (FileStorage &fs, int value) |
| void | writeScalar (FileStorage &fs, float value) |
| void | writeScalar (FileStorage &fs, double value) |
| void | writeScalar (FileStorage &fs, const String &value) |
| template<typename _Tp > | |
| static void | write (FileStorage &fs, const _Tp &value) |
| template<> | |
| void | write (FileStorage &fs, const int &value) |
| template<> | |
| void | write (FileStorage &fs, const float &value) |
| template<> | |
| void | write (FileStorage &fs, const double &value) |
| template<> | |
| void | write (FileStorage &fs, const String &value) |
| template<typename _Tp > | |
| static void | write (FileStorage &fs, const Point_< _Tp > &pt) |
| template<typename _Tp > | |
| static void | write (FileStorage &fs, const Point3_< _Tp > &pt) |
| template<typename _Tp > | |
| static void | write (FileStorage &fs, const Size_< _Tp > &sz) |
| template<typename _Tp > | |
| static void | write (FileStorage &fs, const Complex< _Tp > &c) |
| template<typename _Tp > | |
| static void | write (FileStorage &fs, const Rect_< _Tp > &r) |
| template<typename _Tp , int cn> | |
| static void | write (FileStorage &fs, const Vec< _Tp, cn > &v) |
| template<typename _Tp , int m, int n> | |
| static void | write (FileStorage &fs, const Matx< _Tp, m, n > &x) |
| template<typename _Tp > | |
| static void | write (FileStorage &fs, const Scalar_< _Tp > &s) |
| static void | write (FileStorage &fs, const Range &r) |
| template<typename _Tp > | |
| static void | write (FileStorage &fs, const std::vector< _Tp > &vec) |
| template<typename _Tp > | |
| static void | write (FileStorage &fs, const String &name, const Point_< _Tp > &pt) |
| template<typename _Tp > | |
| static void | write (FileStorage &fs, const String &name, const Point3_< _Tp > &pt) |
| template<typename _Tp > | |
| static void | write (FileStorage &fs, const String &name, const Size_< _Tp > &sz) |
| template<typename _Tp > | |
| static void | write (FileStorage &fs, const String &name, const Complex< _Tp > &c) |
| template<typename _Tp > | |
| static void | write (FileStorage &fs, const String &name, const Rect_< _Tp > &r) |
| template<typename _Tp , int cn> | |
| static void | write (FileStorage &fs, const String &name, const Vec< _Tp, cn > &v) |
| template<typename _Tp , int m, int n> | |
| static void | write (FileStorage &fs, const String &name, const Matx< _Tp, m, n > &x) |
| template<typename _Tp > | |
| static void | write (FileStorage &fs, const String &name, const Scalar_< _Tp > &s) |
| static void | write (FileStorage &fs, const String &name, const Range &r) |
| static void | write (FileStorage &fs, const String &name, const KeyPoint &kpt) |
| static void | write (FileStorage &fs, const String &name, const DMatch &m) |
| template<typename _Tp , typename std::enable_if< std::is_enum< _Tp >::value >::type * = nullptr> | |
| static void | write (FileStorage &fs, const String &name, const _Tp &val) |
| template<typename _Tp > | |
| static void | write (FileStorage &fs, const String &name, const std::vector< _Tp > &vec) |
| template<typename _Tp > | |
| static void | write (FileStorage &fs, const String &name, const std::vector< std::vector< _Tp > > &vec) |
| template<typename _Tp > | |
| static FileStorage & | operator<< (FileStorage &fs, const _Tp &value) |
| Writes data to a file storage. | |
| static FileStorage & | operator<< (FileStorage &fs, const char *str) |
| Writes data to a file storage. | |
| static FileStorage & | operator<< (FileStorage &fs, char *value) |
| Writes data to a file storage. | |
XML/YAML/JSON file storage class that encapsulates all the information necessary for writing or reading data to/from a file.
file storage mode
| Enumerator | |
|---|---|
| READ |
value, open the file for reading |
| WRITE |
value, open the file for writing |
| APPEND |
value, open the file for appending |
| MEMORY |
returned by FileStorage::release) flag, read data from source or write data to the internal buffer (which is |
| FORMAT_MASK |
mask for format flags |
| FORMAT_AUTO |
flag, auto format |
| FORMAT_XML |
flag, XML format |
| FORMAT_YAML |
flag, YAML format |
| FORMAT_JSON |
flag, JSON format |
| BASE64 |
flag, write rawdata in Base64 by default. (consider using WRITE_BASE64) |
| WRITE_BASE64 |
flag, enable both WRITE and BASE64 |
| cv::FileStorage::FileStorage | ( | ) |
| Python: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| <FileStorage object> | = | cv.FileStorage( | ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <FileStorage object> | = | cv.FileStorage( | filename, flags[, encoding] | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
The constructors.
The full constructor opens the file. Alternatively you can use the default constructor and then call FileStorage::open.
| cv::FileStorage::FileStorage | ( | const String & | filename, |
| int | flags, | ||
| const String & | encoding = String() |
||
| ) |
| Python: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| <FileStorage object> | = | cv.FileStorage( | ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <FileStorage object> | = | cv.FileStorage( | filename, flags[, encoding] | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Opens a file.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.See description of parameters in FileStorage::FileStorage. The method calls FileStorage::release before opening the file.
| filename | Name of the file to open or the text string to read the data from. Extension of the file (.xml, .yml/.yaml or .json) determines its format (XML, YAML or JSON respectively). Also you can append .gz to work with compressed files, for example myHugeMatrix.xml.gz. If both FileStorage::WRITE and FileStorage::MEMORY flags are specified, source is used just to specify the output file format (e.g. mydata.xml, .yml etc.). A file name can also contain parameters. You can use this format, "*?base64" (e.g. "file.json?base64" (case sensitive)), as an alternative to FileStorage::BASE64 flag. |
| flags | Mode of operation. One of FileStorage::Mode |
| encoding | Encoding of the file. Note that UTF-16 XML encoding is not supported currently and you should use 8-bit encoding instead of it. |