define the base class to define different file formats

This commit is contained in:
Sven Czarnian
2021-08-10 08:40:53 +02:00
parent 5543d28bbf
commit 163786698c
3 changed files with 99 additions and 0 deletions

View File

@@ -14,11 +14,17 @@ SET(SOURCE_FILES
stdafx.cpp
stdafx.h
)
SET(SOURCE_CONFIG_FILES
config/FileFormat.cpp
)
SET(SOURCE_FILES_RES
${CMAKE_BINARY_DIR}/ArrivalMANager.rc
${CMAKE_SOURCE_DIR}/res/resource.h
${CMAKE_SOURCE_DIR}/res/targetver.h
)
SET(INCLUDE_CONFIG_FILES
${CMAKE_SOURCE_DIR}/include/aman/config/FileFormat.h
)
SET(INCLUDE_HELPER_FILES
${CMAKE_SOURCE_DIR}/include/aman/helper/String.h
)
@@ -27,7 +33,9 @@ SET(INCLUDE_HELPER_FILES
ADD_LIBRARY(
ArrivalMANager SHARED
${SOURCE_FILES_RES}
${SOURCE_CONFIG_FILES}
${SOURCE_FILES}
${INCLUDE_CONFIG_FILES}
${INCLUDE_HELPER_FILES}
)
@@ -50,4 +58,5 @@ ENDIF()
SOURCE_GROUP("Source Files" FILES ${SOURCE_FILES})
SOURCE_GROUP("Source Files\\res" FILES ${SOURCE_FILES_RES})
SOURCE_GROUP("Header Files\\config" FILES ${INCLUDE_CONFIG_FILES})
SOURCE_GROUP("Header Files\\helper" FILES ${INCLUDE_HELPER_FILES})

37
src/config/FileFormat.cpp Normal file
View File

@@ -0,0 +1,37 @@
/*
* Author:
* Sven Czarnian <devel@svcz.de>
* Brief:
* Implements the generic file format
* Copyright:
* 2021 Sven Czarnian
* License:
* GNU General Public License v3 (GPLv3)
*/
#include <limits>
#include <aman/config/FileFormat.h>
using namespace aman;
FileFormat::FileFormat() noexcept :
m_errorLine(std::numeric_limits<std::uint32_t>::max()),
m_errorMessage() { }
void FileFormat::reset() noexcept {
this->m_errorLine = std::numeric_limits<std::uint32_t>::max();
this->m_errorMessage.clear();
}
bool FileFormat::errorFound() const noexcept {
return std::numeric_limits<std::uint32_t>::max() != this->m_errorLine;
}
std::uint32_t FileFormat::errorLine() const noexcept {
return this->m_errorLine;
}
const std::string& FileFormat::errorMessage() const noexcept {
return this->m_errorMessage;
}