Sha256: 9eefabe77694bd4e4ff8699eb665daea19dc77f79d9c6487677982572bf4b5bf

Contents?: true

Size: 910 Bytes

Versions: 2

Compression:

Stored size: 910 Bytes

Contents

#ifndef GOSU_WINUTILITY_HPP
#define GOSU_WINUTILITY_HPP

#include <Gosu/Platform.hpp>
#include <string>

namespace Gosu
{
    //! Implementation helpers for the Windows platform.
    namespace Win
    {
        //! Throws an exception according to the error which GetLastError()
        //! returns, optionally prefixed with "While (action), the following
        //! error occured: ".
        GOSU_NORETURN void throwLastError(const std::string& action = "");

        //! Small helper function that throws an exception whenever the value
        //! passed through is false. Note that this doesn't make sense for all
        //! Windows API functions, but for most of them.
        template<typename T>
        inline T check(T valToCheck, const std::string& action = "")
        {
            if (!valToCheck)
                throwLastError(action);
            return valToCheck;
        }
    }
}

#endif

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gosu-0.10.9.pre1 src/WinUtility.hpp
gosu-0.10.8 src/WinUtility.hpp