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

A thread-safe set of environment variables. More...

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

Public Member Functions

constexpr Environment ()=default
 Default ctor.
 
constexpr Environment (const EnvironmentRaw resource)
 Constructs from EnvironmentParam. More...
 
constexpr Environment (const Environment &other)=delete
 Copy constructor.
 
constexpr Environment (Environment &&other)
 Move constructor.
 
constexpr Environment (const EnvironmentRef &other)=delete
 
constexpr Environment (EnvironmentRef &&other)=delete
 
 Environment (bool populated)
 Create a set of environment variables. More...
 
 ~Environment ()
 Destructor.
 
Environmentoperator= (Environment other)
 Assignment operator.
 
constexpr EnvironmentRaw get () const
 Retrieves underlying EnvironmentRaw.
 
constexpr EnvironmentRaw release ()
 Retrieves underlying EnvironmentRaw and clear this.
 
constexpr auto operator<=> (const Environment &other) const =default
 Comparison.
 
constexpr bool operator== (std::nullptr_t _) const
 Comparison.
 
constexpr operator bool () const
 Converts to bool.
 
constexpr operator EnvironmentParam () const
 Converts to EnvironmentParam.
 
void Destroy ()
 Destroy a set of environment variables. More...
 
const char * GetVariable (StringParam name)
 Get the value of a variable in the environment. More...
 
OwnArray< char * > GetVariables ()
 Get all variables in the environment. More...
 
Uint64 GetVariableCount ()
 Get the Variables count. More...
 
void SetVariable (StringParam name, StringParam value, bool overwrite)
 Set the value of a variable in the environment. More...
 
void UnsetVariable (StringParam name)
 Clear a variable from the environment. More...
 

Detailed Description

Since
This struct is available since SDL 3.2.0.
Category:
Resource
See also
GetEnvironment
Environment.Environment
Environment.GetVariable
Environment.GetVariables
Environment.SetVariable
Environment.UnsetVariable
Environment.Destroy

Constructor & Destructor Documentation

◆ Environment() [1/2]

constexpr SDL::Environment::Environment ( const EnvironmentRaw  resource)
inlineexplicitconstexpr
Parameters
resourcea EnvironmentRaw to be wrapped.

This assumes the ownership, call release() if you need to take back.

◆ Environment() [2/2]

SDL::Environment::Environment ( bool  populated)
inline
Parameters
populatedtrue to initialize it from the C runtime environment, false to create an empty environment.
Postcondition
a pointer to the new environment or nullptr on failure; call GetError() for more information.
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
Environment.GetVariable
Environment.GetVariables
Environment.SetVariable
Environment.UnsetVariable
Environment.Destroy

Member Function Documentation

◆ GetVariableCount()

Uint64 SDL::Environment::GetVariableCount ( )
inline
Returns
the number of existing environment variables

This might be slow.


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