Ficheiros
aman-es/include/aman/config/FileFormat.h
2021-08-10 08:40:53 +02:00

54 linhas
1.4 KiB
C++

/*
* @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;
};
}