Public Types | Public Member Functions | Public Attributes | List of all members
cv::FileNode Class Reference

File Storage Node class. More...

#include <core.hpp>

Public Types

enum  {
  NONE =0, INT =1, REAL =2, FLOAT =REAL,
  STR =3, STRING =STR, REF =4, SEQ =5,
  MAP =6, TYPE_MASK =7, FLOW =8, USER =16,
  EMPTY =32, NAMED =64
}
 type of the file storage node More...
 

Public Member Functions

CV_WRAP FileNode ()
 the default constructor More...
 
 FileNode (const CvFileStorage *fs, const CvFileNode *node)
 the full constructor wrapping CvFileNode structure. More...
 
 FileNode (const FileNode &node)
 the copy constructor More...
 
FileNode operator[] (const string &nodename) const
 returns element of a mapping node More...
 
CV_WRAP FileNode operator[] (const char *nodename) const
 returns element of a mapping node More...
 
CV_WRAP FileNode operator[] (int i) const
 returns element of a sequence node More...
 
CV_WRAP int type () const
 returns type of the node More...
 
CV_WRAP bool empty () const
 returns true if the node is empty More...
 
CV_WRAP bool isNone () const
 returns true if the node is a "none" object More...
 
CV_WRAP bool isSeq () const
 returns true if the node is a sequence More...
 
CV_WRAP bool isMap () const
 returns true if the node is a mapping More...
 
CV_WRAP bool isInt () const
 returns true if the node is an integer More...
 
CV_WRAP bool isReal () const
 returns true if the node is a floating-point number More...
 
CV_WRAP bool isString () const
 returns true if the node is a text string More...
 
CV_WRAP bool isNamed () const
 returns true if the node has a name More...
 
CV_WRAP string name () const
 returns the node name or an empty string if the node is nameless More...
 
CV_WRAP size_t size () const
 returns the number of elements in the node, if it is a sequence or mapping, or 1 otherwise. More...
 
 operator int () const
 returns the node content as an integer. If the node stores floating-point number, it is rounded. More...
 
 operator float () const
 returns the node content as float More...
 
 operator double () const
 returns the node content as double More...
 
 operator string () const
 returns the node content as text string More...
 
CvFileNodeoperator* ()
 returns pointer to the underlying file node More...
 
const CvFileNodeoperator* () const
 returns pointer to the underlying file node More...
 
FileNodeIterator begin () const
 returns iterator pointing to the first node element More...
 
FileNodeIterator end () const
 returns iterator pointing to the element following the last node element More...
 
void readRaw (const string &fmt, uchar *vec, size_t len) const
 reads node elements to the buffer with the specified format More...
 
voidreadObj () const
 reads the registered object and returns pointer to it More...
 

Public Attributes

const CvFileStoragefs
 
const CvFileNodenode
 

Detailed Description

File Storage Node class.

The node is used to store each and every element of the file storage opened for reading - from the primitive objects, such as numbers and text strings, to the complex nodes: sequences, mappings and the registered objects.

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.

Member Enumeration Documentation

anonymous enum

type of the file storage node

Enumerator
NONE 

empty node

INT 

an integer

REAL 

floating-point number

FLOAT 

synonym or REAL

STR 

text string in UTF-8 encoding

STRING 

synonym for STR

REF 

integer of size size_t.

Typically used for storing complex dynamic structures where some elements reference the others

SEQ 

sequence

MAP 

mapping

TYPE_MASK 
FLOW 

compact representation of a sequence or mapping.

Used only by YAML writer

USER 

a registered object (e.g.

a matrix)

EMPTY 

empty structure (sequence or mapping)

NAMED 

the node has a name (i.e.

it is element of a mapping)

Constructor & Destructor Documentation

cv::FileNode::FileNode ( )

the default constructor

cv::FileNode::FileNode ( const CvFileStorage fs,
const CvFileNode node 
)

the full constructor wrapping CvFileNode structure.

cv::FileNode::FileNode ( const FileNode node)

the copy constructor

Member Function Documentation

FileNode cv::FileNode::operator[] ( const string nodename) const

returns element of a mapping node

CV_WRAP FileNode cv::FileNode::operator[] ( const char *  nodename) const

returns element of a mapping node

CV_WRAP FileNode cv::FileNode::operator[] ( int  i) const

returns element of a sequence node

int cv::FileNode::type ( ) const

returns type of the node

bool cv::FileNode::empty ( ) const

returns true if the node is empty

bool cv::FileNode::isNone ( ) const

returns true if the node is a "none" object

bool cv::FileNode::isSeq ( ) const

returns true if the node is a sequence

bool cv::FileNode::isMap ( ) const

returns true if the node is a mapping

bool cv::FileNode::isInt ( ) const

returns true if the node is an integer

bool cv::FileNode::isReal ( ) const

returns true if the node is a floating-point number

bool cv::FileNode::isString ( ) const

returns true if the node is a text string

bool cv::FileNode::isNamed ( ) const

returns true if the node has a name

CV_WRAP string cv::FileNode::name ( ) const

returns the node name or an empty string if the node is nameless

size_t cv::FileNode::size ( ) const

returns the number of elements in the node, if it is a sequence or mapping, or 1 otherwise.

cv::FileNode::operator int ( ) const

returns the node content as an integer. If the node stores floating-point number, it is rounded.

cv::FileNode::operator float ( ) const

returns the node content as float

cv::FileNode::operator double ( ) const

returns the node content as double

cv::FileNode::operator string ( ) const

returns the node content as text string

CvFileNode * cv::FileNode::operator* ( )

returns pointer to the underlying file node

const CvFileNode * cv::FileNode::operator* ( ) const

returns pointer to the underlying file node

FileNodeIterator cv::FileNode::begin ( ) const

returns iterator pointing to the first node element

FileNodeIterator cv::FileNode::end ( ) const

returns iterator pointing to the element following the last node element

void cv::FileNode::readRaw ( const string fmt,
uchar vec,
size_t  len 
) const

reads node elements to the buffer with the specified format

void* cv::FileNode::readObj ( ) const

reads the registered object and returns pointer to it

Member Data Documentation

const CvFileStorage* cv::FileNode::fs
const CvFileNode* cv::FileNode::node

The documentation for this class was generated from the following files: