|
| FileNode () |
| The constructors. More...
|
|
| FileNode (const FileStorage *fs, size_t blockIdx, size_t ofs) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
|
|
| FileNode (const FileNode &node) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
|
|
FileNodeIterator | begin () const |
| returns iterator pointing to the first node element More...
|
|
bool | empty () const |
| returns true if the node is empty More...
|
|
FileNodeIterator | end () const |
| returns iterator pointing to the element following the last node element More...
|
|
bool | isInt () const |
| returns true if the node is an integer More...
|
|
bool | isMap () const |
| returns true if the node is a mapping More...
|
|
bool | isNamed () const |
| returns true if the node has a name More...
|
|
bool | isNone () const |
| returns true if the node is a "none" object More...
|
|
bool | isReal () const |
| returns true if the node is a floating-point number More...
|
|
bool | isSeq () const |
| returns true if the node is a sequence More...
|
|
bool | isString () const |
| returns true if the node is a text string More...
|
|
std::vector< String > | keys () const |
| Returns keys of a mapping node. More...
|
|
Mat | mat () const |
| Simplified reading API to use with bindings. More...
|
|
std::string | name () const |
| returns the node name or an empty string if the node is nameless More...
|
|
| operator double () const |
| returns the node content as double More...
|
|
| operator float () const |
| returns the node content as float More...
|
|
| operator std::string () const |
| returns the node content as text string More...
|
|
FileNode | operator[] (const String &nodename) const |
| Returns element of a mapping node or a sequence node. More...
|
|
FileNode | operator[] (const char *nodename) const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
|
|
FileNode | operator[] (int i) const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
|
|
uchar * | ptr () |
|
const uchar * | ptr () const |
|
size_t | rawSize () const |
| returns raw size of the FileNode in bytes More...
|
|
void | readRaw (const String &fmt, void *vec, size_t len) const |
| Reads node elements to the buffer with the specified format. More...
|
|
double | real () const |
| Simplified reading API to use with bindings. More...
|
|
void | setValue (int type, const void *value, int len=-1) |
| Internal method used when reading FileStorage. More...
|
|
size_t | size () const |
| returns the number of elements in the node, if it is a sequence or mapping, or 1 otherwise. More...
|
|
std::string | string () const |
| Simplified reading API to use with bindings. More...
|
|
int | type () const |
| Returns type of the node. More...
|
|
|
(Note that these are not member functions.)
|
|
void | read (const FileNode &node, int &value, int default_value) |
|
void | read (const FileNode &node, float &value, float default_value) |
|
void | read (const FileNode &node, double &value, double default_value) |
|
void | read (const FileNode &node, std::string &value, const std::string &default_value) |
|
void | read (const FileNode &node, Mat &mat, const Mat &default_mat=Mat()) |
|
void | read (const FileNode &node, SparseMat &mat, const SparseMat &default_mat=SparseMat()) |
|
void | read (const FileNode &node, KeyPoint &value, const KeyPoint &default_value) |
|
void | read (const FileNode &node, DMatch &value, const DMatch &default_value) |
|
template<typename _Tp > |
static void | read (const FileNode &node, Point_< _Tp > &value, const Point_< _Tp > &default_value) |
|
template<typename _Tp > |
static void | read (const FileNode &node, Point3_< _Tp > &value, const Point3_< _Tp > &default_value) |
|
template<typename _Tp > |
static void | read (const FileNode &node, Size_< _Tp > &value, const Size_< _Tp > &default_value) |
|
template<typename _Tp > |
static void | read (const FileNode &node, Complex< _Tp > &value, const Complex< _Tp > &default_value) |
|
template<typename _Tp > |
static void | read (const FileNode &node, Rect_< _Tp > &value, const Rect_< _Tp > &default_value) |
|
template<typename _Tp , int cn> |
static void | read (const FileNode &node, Vec< _Tp, cn > &value, const Vec< _Tp, cn > &default_value) |
|
template<typename _Tp , int m, int n> |
static void | read (const FileNode &node, Matx< _Tp, m, n > &value, const Matx< _Tp, m, n > &default_matx=Matx< _Tp, m, n >()) |
|
template<typename _Tp > |
static void | read (const FileNode &node, Scalar_< _Tp > &value, const Scalar_< _Tp > &default_value) |
|
static void | read (const FileNode &node, Range &value, const Range &default_value) |
|
|
static void | read (const FileNode &node, bool &value, bool default_value) |
|
static void | read (const FileNode &node, uchar &value, uchar default_value) |
|
static void | read (const FileNode &node, schar &value, schar default_value) |
|
static void | read (const FileNode &node, ushort &value, ushort default_value) |
|
static void | read (const FileNode &node, short &value, short default_value) |
|
template<typename _Tp > |
static void | read (FileNodeIterator &it, std::vector< _Tp > &vec, size_t maxCount=(size_t) INT_MAX) |
|
template<typename _Tp , typename std::enable_if< std::is_enum< _Tp >::value >::type * = nullptr> |
static void | read (const FileNode &node, _Tp &value, const _Tp &default_value=static_cast< _Tp >(0)) |
|
template<typename _Tp > |
static void | read (const FileNode &node, std::vector< _Tp > &vec, const std::vector< _Tp > &default_value=std::vector< _Tp >()) |
|
static void | read (const FileNode &node, std::vector< KeyPoint > &vec, const std::vector< KeyPoint > &default_value) |
|
static void | read (const FileNode &node, std::vector< DMatch > &vec, const std::vector< DMatch > &default_value) |
|
|
template<typename _Tp > |
static void | operator>> (const FileNode &n, _Tp &value) |
| Reads data from a file storage. More...
|
|
template<typename _Tp > |
static void | operator>> (const FileNode &n, std::vector< _Tp > &vec) |
| Reads data from a file storage. More...
|
|
static void | operator>> (const FileNode &n, KeyPoint &kpt) |
| Reads KeyPoint from a file storage. More...
|
|
static void | operator>> (const FileNode &n, DMatch &m) |
| Reads DMatch from a file storage. More...
|
|
File Storage Node class.
The node is used to store each and every element of the file storage opened for reading. When XML/YAML file is read, it is first parsed and stored in the memory as a hierarchical collection of nodes. Each node can be a "leaf" that is contain a single number or a string, or be a collection of other nodes. There can be named collections (mappings) where each element has a name and it is accessed by a name, and ordered collections (sequences) where elements do not have names but rather accessed by index. Type of the file node can be determined using FileNode::type method.
Note that file nodes are only used for navigating file storages opened for reading. When a file storage is opened for writing, no data is stored in memory after it is written.
- Examples:
- samples/cpp/filestorage.cpp.