rolmodl
C++ API for the Simple Directmedia Library 2 (SDL2)
Public Member Functions | Friends | List of all members
rolmodl::SDLString Class Reference

Container for SDL-owned strings that must be freed with SDL_free. More...

#include <Base.hpp>

Public Member Functions

 ~SDLString () noexcept
 SDL_free the underlying char*.
 
 SDLString (const SDLString &that)
 Copying SDLStrings is not allowed as SDL does not provide a way to allocate a new string. We can only free existing strings.
 
 SDLString (SDLString &&that) noexcept
 Take over the underlying char* of that.
 
SDLStringoperator= (const SDLString &that)
 Copying SDLStrings is not allowed as SDL does not provide a way to allocate a new string. We can only free existing strings.
 
SDLStringoperator= (SDLString &&that) noexcept
 Take over the underlying char* of that.
 
char * unsafeRaw () noexcept
 Get the underlying char*. Unsafe because it allows invalidating the pointer by freeing it.
 
const char * unsafeRaw () const noexcept
 Get the underlying char* in a const context. Unsafe because it allows saving a pointer and using it after it has been freed.
 

Friends

SDLString sys::clipboard::getText ()
 The clipboard text is an SDL-owned string.
 
std::optional< Eventevent::poll () noexcept
 The drag-n-drop text and file paths are SDL-owned strings.
 
void swap (SDLString &a, SDLString &b) noexcept
 Exchange the underlying char* with that.
 

Detailed Description

Container for SDL-owned strings that must be freed with SDL_free.

Definition at line 425 of file Base.hpp.


The documentation for this class was generated from the following files: