os_string.ch

Declarations

Public Only
Publicnamespace std
namespace std
struct OsString
struct OsString
OsString: stores an OS-native string. Convert explicitly to/from UTF-8.
Publicfunction make
func make(str : native_string_t) : OsString
Publicfunction make2
func make2(utf8 : &string) : OsString
Construct from UTF-8. On POSIX this copies the bytes; on Windows this converts to UTF-16.
Publicfunction from_utf8
func from_utf8(utf8 : &string) : OsString
--- factory helpers ---
Publicfunction size
func size(self : &OsString) : size_t
--- accessors ---
Publicfunction empty
func empty(self : &OsString) : bool
Publicfunction native
func native(self : &OsString) : &native_string_t
Get access to the native underlying string/characters
Publicfunction c_str_native
func c_str_native(self : &OsString) : *native_char_t
Get a pointer to native data (null-terminated if you ensure it)
Publicfunction clear
func clear(self : &OsString) : void
--- modify ---
Publicfunction reserve
func reserve(self : &OsString, n : size_t) : void
Publicfunction append_utf8
func append_utf8(self : &OsString, data : *char, len : size_t) : void
TODO: support shrink_to_fit
Publicfunction append_utf8_str
func append_utf8_str(self : &OsString, utf8 : &string) : void
Append a UTF-8 string
Publicfunction append_utf8_view
func append_utf8_view(self : &OsString, utf8 : &string_view) : void
Publicfunction append_native
func append_native(self : &OsString, native : &native_string_t) : void
Append native data directly
Publicfunction to_utf8
func to_utf8(self : &OsString) : string
Swap
Publicfunction utf8_to_u16
func utf8_to_u16(utf8 : &string) : u16string
Helper: convert UTF-8 -> std::u16string using Win32 API
Publicfunction u16_to_utf8
func u16_to_utf8(str : &u16string) : string
Helper: convert std::u16string -> UTF-8 using Win32 API
function delete
func delete(self : *OsString) : void
OsString: stores an OS-native string. Convert explicitly to/from UTF-8.