mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 23:33:05 +04:00
Merge pull request #6949 from wiryls:FileStorageBase64DocsTests
This commit is contained in:
@@ -1976,8 +1976,16 @@ CVAPI(void) cvSetIPLAllocators( Cv_iplCreateImageHeader create_header,
|
||||
|
||||
The function opens file storage for reading or writing data. In the latter case, a new file is
|
||||
created or an existing file is rewritten. The type of the read or written file is determined by the
|
||||
filename extension: .xml for XML and .yml or .yaml for YAML. The function returns a pointer to the
|
||||
CvFileStorage structure. If the file cannot be opened then the function returns NULL.
|
||||
filename extension: .xml for XML and .yml or .yaml for YAML.
|
||||
|
||||
At the same time, it also supports adding parameters like "example.xml?base64". The three ways
|
||||
are the same:
|
||||
@snippet samples/cpp/filestorage_base64.cpp suffix_in_file_name
|
||||
@snippet samples/cpp/filestorage_base64.cpp flag_write_base64
|
||||
@snippet samples/cpp/filestorage_base64.cpp flag_write_and_flag_base64
|
||||
|
||||
The function returns a pointer to the CvFileStorage structure.
|
||||
If the file cannot be opened then the function returns NULL.
|
||||
@param filename Name of the file associated with the storage
|
||||
@param memstorage Memory storage used for temporary data and for
|
||||
: storing dynamic structures, such as CvSeq or CvGraph . If it is NULL, a temporary memory
|
||||
@@ -1985,6 +1993,7 @@ CvFileStorage structure. If the file cannot be opened then the function returns
|
||||
@param flags Can be one of the following:
|
||||
> - **CV_STORAGE_READ** the storage is open for reading
|
||||
> - **CV_STORAGE_WRITE** the storage is open for writing
|
||||
(use **CV_STORAGE_WRITE | CV_STORAGE_WRITE_BASE64** to write rawdata in Base64)
|
||||
@param encoding
|
||||
*/
|
||||
CVAPI(CvFileStorage*) cvOpenFileStorage( const char* filename, CvMemStorage* memstorage,
|
||||
@@ -2162,7 +2171,7 @@ the file with multiple streams looks like this:
|
||||
@endcode
|
||||
The YAML file will look like this:
|
||||
@code{.yaml}
|
||||
%YAML:1.0
|
||||
%YAML 1.0
|
||||
# stream #1 data
|
||||
...
|
||||
---
|
||||
@@ -2187,6 +2196,28 @@ to a sequence rather than a map.
|
||||
CVAPI(void) cvWriteRawData( CvFileStorage* fs, const void* src,
|
||||
int len, const char* dt );
|
||||
|
||||
/** @brief Writes multiple numbers in Base64.
|
||||
|
||||
If either CV_STORAGE_WRITE_BASE64 or cv::FileStorage::WRITE_BASE64 is used,
|
||||
this function will be the same as cvWriteRawData. If neither, the main
|
||||
difference is that it outputs a sequence in Base64 encoding rather than
|
||||
in plain text.
|
||||
|
||||
This function can only be used to write a sequence with a type "binary".
|
||||
|
||||
Consider the following two examples where their output is the same:
|
||||
@snippet samples/cpp/filestorage_base64.cpp without_base64_flag
|
||||
and
|
||||
@snippet samples/cpp/filestorage_base64.cpp with_write_base64_flag
|
||||
|
||||
@param fs File storage
|
||||
@param src Pointer to the written array
|
||||
@param len Number of the array elements to write
|
||||
@param dt Specification of each array element, see @ref format_spec "format specification"
|
||||
*/
|
||||
CVAPI(void) cvWriteRawDataBase64( CvFileStorage* fs, const void* src,
|
||||
int len, const char* dt );
|
||||
|
||||
/** @brief Returns a unique pointer for a given name.
|
||||
|
||||
The function returns a unique pointer for each particular file node name. This pointer can be then
|
||||
|
||||
@@ -311,7 +311,10 @@ public:
|
||||
FORMAT_MASK = (7<<3), //!< mask for format flags
|
||||
FORMAT_AUTO = 0, //!< flag, auto format
|
||||
FORMAT_XML = (1<<3), //!< flag, XML format
|
||||
FORMAT_YAML = (2<<3) //!< flag, YAML format
|
||||
FORMAT_YAML = (2<<3), //!< flag, YAML format
|
||||
|
||||
BASE64 = 64, //!< flag, write rawdata in Base64 by default. (consider using WRITE_BASE64)
|
||||
WRITE_BASE64 = BASE64 | WRITE, //!< flag, enable both WRITE and BASE64
|
||||
};
|
||||
enum
|
||||
{
|
||||
@@ -354,7 +357,9 @@ public:
|
||||
Extension of the file (.xml or .yml/.yaml) determines its format (XML or YAML 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.).
|
||||
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.xml?base64"), as an alternative to
|
||||
FileStorage::BASE64 flag. Note: it is case sensitive.
|
||||
@param flags Mode of operation. One of FileStorage::Mode
|
||||
@param 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.
|
||||
|
||||
@@ -1669,6 +1669,8 @@ typedef struct CvFileStorage CvFileStorage;
|
||||
#define CV_STORAGE_FORMAT_AUTO 0
|
||||
#define CV_STORAGE_FORMAT_XML 8
|
||||
#define CV_STORAGE_FORMAT_YAML 16
|
||||
#define CV_STORAGE_BASE64 64
|
||||
#define CV_STORAGE_WRITE_BASE64 (CV_STORAGE_BASE64 | CV_STORAGE_WRITE)
|
||||
|
||||
/** @brief List of attributes. :
|
||||
|
||||
|
||||
Reference in New Issue
Block a user