1
0
mirror of https://github.com/borgesdan/xn65 synced 2024-12-29 21:54:47 +01:00
xn65/includes/csharp/io/exception.hpp

45 lines
1.8 KiB
C++
Raw Normal View History

2024-12-03 17:30:36 -03:00
#ifndef CSHARP_IO_EXCEPTION_HPP
#define CSHARP_IO_EXCEPTION_HPP
#include "../exception.hpp"
#include <source_location>
namespace csharp {
class IOException : public SystemException {
public:
IOException(OptionalString const& message = std::nullopt, std::source_location const& source = std::source_location::current())
: SystemException(message.value_or(SR::Arg_IOException), source)
2024-12-03 17:30:36 -03:00
{
HRresult = HResults::HR_COR_E_IO;
}
IOException(OptionalString const& message, size_t hresult, std::source_location const& source = std::source_location::current())
: SystemException(message.value_or(SR::Arg_IOException), source)
2024-12-03 17:30:36 -03:00
{
HRresult = hresult;
}
IOException(OptionalString const& message, std::shared_ptr<Exception>& innerException, std::source_location const& source = std::source_location::current())
: SystemException(message.value_or(SR::Arg_IOException), innerException, source)
2024-12-03 17:30:36 -03:00
{
HRresult = HResults::HR_COR_E_IO;
}
};
class EndOfStreamException : public IOException {
public:
EndOfStreamException(OptionalString const& message = std::nullopt, std::source_location const& source = std::source_location::current())
: IOException(message.value_or(SR::Arg_IOException), source)
2024-12-03 17:30:36 -03:00
{
HRresult = HResults::HR_COR_E_ENDOFSTREAM;
}
EndOfStreamException(OptionalString const& message, std::shared_ptr<Exception>& innerException, std::source_location const& source = std::source_location::current())
: IOException(message.value_or(SR::Arg_IOException), innerException, source)
2024-12-03 17:30:36 -03:00
{
HRresult = HResults::HR_COR_E_ENDOFSTREAM;
}
};
}
#endif