define the base class to define different file formats
This commit is contained in:
53
include/aman/config/FileFormat.h
Normal file
53
include/aman/config/FileFormat.h
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* @brief Defines the base class for all file formats
|
||||
* @file aman/config/FileFormat.h
|
||||
* @author Sven Czarnian <devel@svcz.de>
|
||||
* @copyright Copyright 2021 Sven Czarnian
|
||||
* @license This project is published under the GNU General Public License v3 (GPLv3)
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
namespace aman {
|
||||
/**
|
||||
* @brief Defines the base class for all file formats
|
||||
* @ingroup format
|
||||
*
|
||||
* The base class provides error information, etc.
|
||||
*/
|
||||
class FileFormat {
|
||||
protected:
|
||||
std::uint32_t m_errorLine; /**< Defines the line number if a parser detected an error */
|
||||
std::string m_errorMessage; /**< Defines the descriptive error message */
|
||||
|
||||
/**
|
||||
* @brief Creates the default file format
|
||||
*/
|
||||
FileFormat() noexcept;
|
||||
|
||||
/**
|
||||
* @brief Resets the internal structures
|
||||
*/
|
||||
void reset() noexcept;
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief Checks if an error was found
|
||||
* @return True if an error was found, else false
|
||||
*/
|
||||
bool errorFound() const noexcept;
|
||||
/**
|
||||
* @brief Returns the error line
|
||||
* @return The error line
|
||||
*/
|
||||
std::uint32_t errorLine() const noexcept;
|
||||
/**
|
||||
* @brief Returns the error message
|
||||
* @return The error message
|
||||
*/
|
||||
const std::string& errorMessage() const noexcept;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user