SDL3pp
A slim C++ wrapper for SDL3
Loading...
Searching...
No Matches
Public Member Functions | List of all members
SDL::EnvironmentRef Struct Reference

Handle to a non owned environment. More...

Inheritance diagram for SDL::EnvironmentRef:
Inheritance graph
[legend]

Public Member Functions

constexpr EnvironmentRef (const EnvironmentRef &other)
 Copy constructor.
 
constexpr EnvironmentRef (EnvironmentRef &&other)
 Move constructor.
 
constexpr ~EnvironmentRef ()=default
 Default constructor.
 
EnvironmentRefoperator= (EnvironmentRef other)
 Assignment operator.
 
void reset (SDL_Environment *newResource={})
 Destroy a set of environment variables.
 
 EnvironmentBase (bool populated)
 Create a set of environment variables.
 
- Public Member Functions inherited from SDL::EnvironmentBase
 EnvironmentBase (bool populated)
 Create a set of environment variables.
 
const char * GetVariable (StringParam name)
 Get the value of a variable in the environment.
 
OwnArray< char * > GetVariables ()
 Get all variables in the environment.
 
Uint64 GetVariableCount ()
 Get the Variables count.
 
void SetVariable (StringParam name, StringParam value, bool overwrite)
 Set the value of a variable in the environment.
 
void UnsetVariable (StringParam name)
 Clear a variable from the environment.
 
constexpr Resource (T resource={})
 Constructs the underlying resource.
 
constexpr Resource (std::nullptr_t)
 Equivalent to default ctor.
 
constexpr Resource (std::nullopt_t)
 Equivalent to default ctor.
 
 Resource (const Resource &other)=delete
 
 Resource (Resource &&other)=delete
 
- Public Member Functions inherited from SDL::Resource< SDL_Environment * >
constexpr Resource (SDL_Environment * resource={})
 Constructs the underlying resource.
 
constexpr Resource (std::nullptr_t)
 Equivalent to default ctor.
 
constexpr Resource (std::nullopt_t)
 Equivalent to default ctor.
 
 Resource (const Resource &other)=delete
 
 Resource (Resource &&other)=delete
 
Resourceoperator= (const Resource &other)=delete
 
Resourceoperator= (Resource &&other)=delete
 
constexpr operator bool () const
 True if contains a valid resource.
 
constexpr bool operator== (const Resource &other) const=default
 Comparison.
 
constexpr bool operator== (std::nullopt_t) const
 Comparison.
 
constexpr bool operator== (std::nullptr_t) const
 Comparison.
 
constexpr SDL_Environment * get () const
 Return contained resource;.
 
constexpr SDL_Environment * release (SDL_Environment * newResource={})
 Return contained resource and empties or replace value.
 
constexpr const SDL_Environment * operator-> () const
 Access to fields.
 
constexpr SDL_Environment * operator-> ()
 Access to fields.
 

Detailed Description

Category:
Resource
See also
EnvironmentBase
Environment

Member Function Documentation

◆ EnvironmentBase()

SDL::EnvironmentBase::EnvironmentBase ( bool  populated)
inline
Parameters
populatedtrue to initialize it from the C runtime environment, false to create an empty environment.
Postcondition
the new environment on success.
Exceptions
Erroron failure.
Thread safety:
If populated is false, it is safe to call this function from any thread, otherwise it is safe if no other threads are calling setenv() or unsetenv()
Since
This function is available since SDL 3.2.0.
See also
EnvironmentBase.GetVariable
EnvironmentBase.GetVariables
EnvironmentBase.SetVariable
EnvironmentBase.UnsetVariable

◆ reset()

void SDL::EnvironmentRef::reset ( SDL_Environment *  newResource = {})
inline

This object becomes empty after the call.

Thread safety:
It is safe to call this function from any thread, as long as the environment is no longer in use.
Since
This function is available since SDL 3.2.0.
See also
EnvironmentBase.EnvironmentBase

The documentation for this struct was generated from the following file: