OpenTTD Source 20260208-master-g43af8e94d0
win32.h File Reference

Declarations of functions for MS windows systems. More...

Go to the source code of this file.

Functions

bool MyShowCursor (bool show, bool toggle=false)
std::string_view convert_from_fs (const std::wstring_view src, std::span< char > dst_buf)
 Convert to OpenTTD's encoding from that of the environment in UNICODE.
wchar_t * convert_to_fs (std::string_view src, std::span< wchar_t > dst_buf)
 Convert from OpenTTD's encoding to that of the environment in UNICODE.
int OTTDStringCompare (std::string_view s1, std::string_view s2)
int Win32StringContains (std::string_view str, std::string_view value, bool case_insensitive)
 Search if a string is contained in another string using the current locale.

Detailed Description

Declarations of functions for MS windows systems.

Definition in file win32.h.

Function Documentation

◆ convert_from_fs()

std::string_view convert_from_fs ( const std::wstring_view src,
std::span< char > dst_buf )

Convert to OpenTTD's encoding from that of the environment in UNICODE.

OpenTTD encoding is UTF8, local is wide.

Parameters
srcwide string that will be converted
dst_bufspan of valid char buffer that will receive the converted string
Returns
pointer to dst_buf. If conversion fails the string is of zero-length

Definition at line 374 of file win32.cpp.

Referenced by HandleIMEComposition(), MusicDriver_DMusic::Start(), and MusicDriver_Win32::Start().

◆ convert_to_fs()

wchar_t * convert_to_fs ( std::string_view src,
std::span< wchar_t > dst_buf )

Convert from OpenTTD's encoding to that of the environment in UNICODE.

OpenTTD encoding is UTF8, local is wide.

Parameters
srcstring that will be converted
dst_bufspan of valid wide-char buffer that will receive the converted string
Returns
pointer to dst_buf. If conversion fails the string is of zero-length

Definition at line 391 of file win32.cpp.

Referenced by HFontFromFont(), and Win32FontCacheFactory::LoadFont().

◆ MyShowCursor()

bool MyShowCursor ( bool show,
bool toggle = false )

Definition at line 41 of file win32.cpp.

◆ OTTDStringCompare()

int OTTDStringCompare ( std::string_view s1,
std::string_view s2 )

Definition at line 441 of file win32.cpp.

◆ Win32StringContains()

int Win32StringContains ( std::string_view str,
std::string_view value,
bool case_insensitive )

Search if a string is contained in another string using the current locale.

Parameters
strString to search in.
valueString to search for.
case_insensitiveSearch case-insensitive.
Returns
1 if value was found, 0 if it was not found, or -1 if not supported by the OS.

Definition at line 479 of file win32.cpp.

Referenced by StrNaturalContains(), and StrNaturalContainsIgnoreCase().