#pragma region CPL License /* Nuclex Native Framework Copyright (C) 2002-2023 Nuclex Development Labs This library is free software; you can redistribute it and/or modify it under the terms of the IBM Common Public License as published by the IBM Corporation; either version 1.0 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the IBM Common Public License for more details. You should have received a copy of the IBM Common Public License along with this library */ #pragma endregion // CPL License #ifndef NUCLEX_SUPPORT_PLATFORM_POSIXAPI_H #define NUCLEX_SUPPORT_PLATFORM_POSIXAPI_H #include "Nuclex/Support/Config.h" #if !defined(NUCLEX_SUPPORT_WINDOWS) #include // for std::string namespace Nuclex { namespace Support { namespace Platform { // ------------------------------------------------------------------------------------------- // /// Offers generic methods for dealing with the Posix API class PosixApi { /// Returns the error message for the specified error number /// /// Error number for which the error message will be looked up /// /// The error message for the specified error number public: static std::string GetErrorMessage(int errorNumber); /// Throws the appropriate exception for an error reported by the OS /// /// Error message that should be included in the exception, will be prefixed to /// the OS error message /// /// Value that 'errno' had at the time of failure public: [[noreturn]] static void ThrowExceptionForSystemError( const std::string &errorMessage, int errorNumber ); }; // ------------------------------------------------------------------------------------------- // }}} // namespace Nuclex::Support::Platform #endif // !defined(NUCLEX_SUPPORT_WINDOWS) #endif // NUCLEX_SUPPORT_PLATFORM_POSIXAPI_H