Sha256: f5069749cbd9f48fde9036935519e12574f076f4c1df5e4aba6c621a7f7733cc

Contents?: true

Size: 856 Bytes

Versions: 18

Compression:

Stored size: 856 Bytes

Contents

#pragma once

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

namespace Gosu
{
    //! Converts UTF-8 to UTF-16, as it is used in Windows APIs.
    std::wstring utf8_to_utf16(const std::string& utf8);
    //! Converts UTF-16 to UTF-8.
    std::string utf16_to_utf8(const std::wstring& utf16);

    //! Throws an exception according to the error returned by  GetLastError(), optionally prefixed
    //! with "While (action), the following error occured: ".
    GOSU_NORETURN void throw_last_winapi_error(const std::string& action = "");

    //! Small helper function that throws the last Windows error when val_to_check is false.
    template<typename T>
    inline T winapi_check(T val_to_check, const std::string& action = "")
    {
        if (!val_to_check) {
            throw_last_winapi_error(action);
        }
        return val_to_check;
    }
}

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
gosu-1.2.0 src/WinUtility.hpp
gosu-1.1.1.1 src/WinUtility.hpp
gosu-1.1.0 src/WinUtility.hpp
gosu-1.1.0.pre2 src/WinUtility.hpp
gosu-1.1.0.pre1 src/WinUtility.hpp
gosu-1.0.0 src/WinUtility.hpp
gosu-1.0.0.pre2 src/WinUtility.hpp
gosu-1.0.0.pre1 src/WinUtility.hpp
gosu-0.15.2 src/WinUtility.hpp
gosu-0.15.1 src/WinUtility.hpp
gosu-0.15.0 src/WinUtility.hpp
gosu-0.14.6.pre1 src/WinUtility.hpp
gosu-0.14.5 src/WinUtility.hpp
gosu-0.14.4 src/WinUtility.hpp
gosu-0.14.4.pre2 src/WinUtility.hpp
gosu-0.14.3.pre1 src/WinUtility.hpp
gosu-0.14.3 src/WinUtility.hpp
gosu-0.14.0 src/WinUtility.hpp