 |
Kea
1.5.0
|
Go to the documentation of this file.
7 #ifndef VERSIONED_CSV_FILE_H
8 #define VERSIONED_CSV_FILE_H
33 const std::string& default_value =
"")
155 const std::string& default_value =
"");
197 virtual void open(
const bool seek_to_end =
false);
293 std::vector<VersionedColumnPtr> columns_;
298 size_t valid_column_count_;
302 size_t minimum_valid_columns_;
307 size_t input_header_count_;
317 #endif // VERSIONED_CSV_FILE_H
int version()
returns Kea hooks version.
virtual void open(const bool seek_to_end=false)
Opens existing file or creates a new one.
VersionedColumn(const std::string &name, const std::string &version, const std::string &default_value="")
Constructor.
virtual bool validateHeader(const CSVRow &header)
Validates the header of a VersionedCSVFile.
VersionedCSVFile(const std::string &filename)
Constructor.
Contains the metadata for a single column in a file.
This is a base class for exceptions thrown from the DNS library module.
Defines the logger used by the top-level component of kea-dhcp-ddns.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
virtual ~VersionedColumn()
Destructor.
void columnCountError(const CSVRow &row, const std::string &reason)
Convenience method for adding an error message.
std::string name_
Name of the column.
void setMinimumValidColumns(const std::string &column_name)
Sets the minimum number of valid columns based on a given column.
size_t getValidColumnCount() const
Returns the number of valid columns found in the header For newly created files this will always matc...
const VersionedColumnPtr & getVersionedColumn(const size_t index) const
Fetch the column descriptor for a given index.
Represents a single row of the CSV file.
Provides input/output access to CSV files.
std::string getSchemaVersion() const
text version of current schema supported by the file's metadata
bool next(CSVRow &row)
Reads next row from the file file.
bool needsConversion() const
Returns true if the input file schema state is not CURRENT.
Exception thrown when an error occurs during CSV file processing.
Implements a CSV file that supports multiple versions of the file's "schema".
size_t getMinimumValidColumns() const
Returns the minimum number of columns which must be present for the file to be considered valid.
std::string version_
Text representation of the schema version in which this column first appeared.
size_t getInputHeaderCount() const
Returns the number of columns found in the input header.
void addColumn(const std::string &col_name, const std::string &version, const std::string &default_value="")
Adds metadata for a single column to the schema.
enum InputSchemaState getInputSchemaState() const
Fetches the state of the input file's schema.
std::string default_value_
default_value The value the column should be assigned if it is not present in a data row.
virtual void recreate()
Creates a new CSV file.
boost::shared_ptr< VersionedColumn > VersionedColumnPtr
Defines a smart pointer to VersionedColumn.
virtual ~VersionedCSVFile()
Destructor.
std::string getInputSchemaVersion() const
Returns the schema version of the physical file.
VersionedCSVFileError(const char *file, size_t line, const char *what)
InputSchemaState
Possible input file schema states.