27 #ifndef FCML_ERRORS_HPP_ 28 #define FCML_ERRORS_HPP_ 166 return static_cast<fcml_usize
>( _errorInfos.size() );
177 checkVectorAccess( index );
178 return _errorInfos[index];
188 checkVectorAccess( index );
189 return _errorInfos[index];
198 _errorInfos.push_back(errorInfo);
200 case ErrorInfo::EL_ERROR:
203 case ErrorInfo::EL_WARN:
233 return _errorInfos.empty();
246 return _errorInfos[0];
259 return _errorInfos[0];
270 const ErrorInfo &errorInfo = getFirstError();
284 const fcml_cstring errorMessage = getFirstErrorMessage();
285 if( errorMessage.empty() ) {
288 return message +
FCML_TEXT(
": ") + errorMessage;
310 void checkVectorAccess( fcml_usize index )
const {
311 if( index >= _errorInfos.size() ) {
318 std::vector<ErrorInfo> _errorInfos;
358 BaseException( msg, error ), _errorContainer( errorContainer ) {
367 return _errorContainer;
376 _errorContainer = errorContainer;
388 #endif // FCML_ERRORS_HPP_ void addErrorInfo(const ErrorInfo &errorInfo)
Adds a new error into the container.
Definition: fcml_errors.hpp:197
bool isEmpty() const
Gets true if there is any error or warning in the container.
Definition: fcml_errors.hpp:232
void setCode(fcml_ceh_error code)
Sets a new error code.
Definition: fcml_errors.hpp:93
struct fcml_st_ceh_error_info * next_error
Next error/warning on the list.
Definition: fcml_errors.h:170
C++ wrappers common classes.
ErrorInfo & getFirstError()
Returns the first error from the container.
Definition: fcml_errors.hpp:255
Illegal state exception.
Definition: fcml_common.hpp:253
std::basic_string< fcml_char > fcml_cstring
By using this type definition here, it will be definitely much easier to support UNICODE in future re...
Definition: fcml_common.hpp:53
fcml_usize getSize() const
Gets number of errors in the container.
Definition: fcml_errors.hpp:165
const ErrorContainer & getErrorContainer() const
Gets a reference to an error container associated with the exception.
Definition: fcml_errors.hpp:366
void setMessage(const fcml_cstring &message)
Sets error message.
Definition: fcml_errors.hpp:129
ErrorContainer()
Default constructor.
Definition: fcml_errors.hpp:155
Container for all collected errors and warnings.
Definition: fcml_errors.h:180
#define FCML_TEXT(x)
Used to code literal strings.
Definition: fcml_types.h:61
const ErrorInfo & operator[](fcml_usize index) const
Gets an error at given index.
Definition: fcml_errors.hpp:176
Base class for all exceptions that are aware of ErrorContainer.
Definition: fcml_errors.hpp:347
const fcml_cstring & getMessage() const
Gets error message.
Definition: fcml_errors.hpp:120
ErrorInfo & operator[](fcml_usize index)
Gets an error at given index.
Definition: fcml_errors.hpp:187
ErrorLevel
Error level.
Definition: fcml_errors.hpp:48
Definition: fcml_assembler.hpp:39
fcml_cstring prepareErrorMessage(const fcml_cstring &message) const
Prepares an error message basing on the first error in the container.
Definition: fcml_errors.hpp:283
Types converter.
Definition: fcml_errors.hpp:329
Base exception for all exceptions exposed by FCML library.
Definition: fcml_common.hpp:187
ErrorLevel getLevel() const
Gets error level.
Definition: fcml_errors.hpp:102
bool isError() const
Returns true if there is any error in the container.
Definition: fcml_errors.hpp:214
void setErrorContainer(const ErrorContainer &errorContainer)
Sets a new error container for the exception.
Definition: fcml_errors.hpp:375
fcml_en_ceh_error_level level
Error level.
Definition: fcml_errors.h:176
fcml_ceh_error code
Error code.
Definition: fcml_errors.h:174
ErrorInfo(const fcml_cstring &message, fcml_ceh_error code=FCML_CEH_GEC_NO_ERROR, ErrorLevel level=EL_ERROR)
Creates an error for given message and optional error code and level.
Definition: fcml_errors.hpp:71
Wraps multiple errors into one component.
Definition: fcml_errors.hpp:148
Contains an error message together with error level and error code.
Definition: fcml_errors.hpp:42
void setLevel(ErrorLevel level)
Sets error level.
Definition: fcml_errors.hpp:111
fcml_ceh_error getCode() const
Gets error code.
Definition: fcml_errors.hpp:84
fcml_string message
Error message.
Definition: fcml_errors.h:172
Operation succeed.
Definition: fcml_errors.h:42
void clean()
Cleans all errors and warnings.
Definition: fcml_errors.hpp:296
Information about one particular error/warning.
Definition: fcml_errors.h:168
Bad arguments.
Definition: fcml_common.hpp:242
Errors are reported when something more important happened and processing should be stopped...
Definition: fcml_errors.h:164
fcml_st_ceh_error_info * errors
All errors and warnings going here.
Definition: fcml_errors.h:182
Global error handling related declarations.
fcml_cstring getFirstErrorMessage() const
Returns the first error message from the container.
Definition: fcml_errors.hpp:267
ErrorContainerAwareException(const fcml_cstring &msg, const ErrorContainer &errorContainer, fcml_ceh_error error=FCML_CEH_GEC_NO_ERROR)
Creates an error container aware exception instance and sets basic information for it...
Definition: fcml_errors.hpp:357
fcml_uint16_t fcml_ceh_error
All error codes should be held in variables of this type.
Definition: fcml_errors.h:156
const ErrorInfo & getFirstError() const
Returns the first error from the container.
Definition: fcml_errors.hpp:242
ErrorInfo()
Default constructor.
Definition: fcml_errors.hpp:59
bool isWarn() const
Returns true if there is any warning in the container.
Definition: fcml_errors.hpp:223