OpenTTD Source: src/os/windows/win32.h File Reference

OpenTTD Source 14.1

Functions
win32.h File Reference

Go to the source code of this file.

## Functions
bool | MyShowCursor (bool show, bool toggle=false)
char * | convert_from_fs (const wchar_t *name, char *utf8_buf, size_t buflen)
| Convert to OpenTTD's encoding from that of the environment in UNICODE. More...
wchar_t * | convert_to_fs (const std::string_view name, wchar_t *utf16_buf, size_t buflen)
| Convert from OpenTTD's encoding to that of the environment in UNICODE. More...
void | Win32SetCurrentLocaleName (const char *iso_code)
int | OTTDStringCompare (std::string_view s1, std::string_view s2)
int | Win32StringContains (const std::string_view str, const std::string_view value, bool case_insensitive)
| Search if a string is contained in another string using the current locale. More...

## Detailed Description

declarations of functions for MS windows systems

Definition in file win32.h.

## Function Documentation

## ◆ convert_from_fs()

char* convert_from_fs | ( | const wchar_t * | name,
|  | char * | utf8_buf,
|  | size_t | buflen
| ) |  |

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

OpenTTD encoding is UTF8, local is wide.

Parameters

  name | pointer to a valid string that will be converted
  utf8_buf | pointer to a valid buffer that will receive the converted string
  buflen | length in characters of the receiving buffer

Returns
  pointer to utf8_buf. If conversion fails the string is of zero-length

Definition at line 498 of file win32.cpp.

## ◆ convert_to_fs()

wchar_t* convert_to_fs | ( | const std::string_view | name,
|  | wchar_t * | system_buf,
|  | size_t | buflen
| ) |  |

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

OpenTTD encoding is UTF8, local is wide.

Parameters

  name | pointer to a valid string that will be converted
  system_buf | pointer to a valid wide-char buffer that will receive the converted string
  buflen | length in wide characters of the receiving buffer
  console_cp | convert to the console encoding instead of the normal system encoding.

Returns
  pointer to system_buf. If conversion fails the string is of zero-length

Definition at line 518 of file win32.cpp.

Referenced by HelpDialogFunc(), and HFontFromFont().

## ◆ Win32StringContains()

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

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

Parameters

  str | String to search in.
  value | String to search for.
  case_insensitive | Search 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 614 of file win32.cpp.

References LibraryLoader::GetFunction().

Referenced by StrNaturalContains(), and StrNaturalContainsIgnoreCase().