class ugcs::vsm::File_processor::Stream::Mode

Overview

Mode for file opening. More…

#include <file_processor.h>

class Mode
{
public:
    // fields

    bool read:1;
    bool write:1;
    bool extended:1;
    bool should_not_exist:1;

    // construction

    Mode(const std::string& mode_str);
};

Detailed Documentation

Mode for file opening.

Fields

bool read:1

Read access.

bool write:1

Write access.

File is truncated when opened.

bool extended:1

Extended access (corresponds to “+” in opening mode string.

File is not truncated when opened for write and also can be read. Also can be written when opened for read.

bool should_not_exist:1

File should not exist 1) When used with write access: If specified, opening fails if file is already existing.

If not specified, new file is created if it does not exist. 2) When used with read access: If specified, file is created if file does not exist. If not specified, opening fails if file does not exist. NOTE ‘x’ with ‘r’ combination is not allowed in standard fopen() call. It is our extension to allow creation new file while opening it in read-only mode. (Does not mean that file on filesystem is read only.)

Construction

Mode(const std::string& mode_str)

Parse and validate mode string into binary structure.

Parameters:

mode_str

Mode string, format is similar to fopen() function mode argument.

Invalid_param_exception

if mode string is not valid.