Skip to content

Commit

Permalink
Docs
Browse files Browse the repository at this point in the history
  • Loading branch information
captainurist committed Nov 7, 2023
1 parent 0c921e5 commit 15f006c
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/Library/Environment/Interface/Environment.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@

#include "EnvironmentEnums.h"

/**
* Base class akin to `Platform` that provides an abstraction for the process's environment.
*
* All strings accepted by and returned from methods of this class are UTF8-encoded.
*/
class Environment {
public:
virtual ~Environment() = default;
Expand All @@ -17,21 +22,25 @@ class Environment {
/**
* Windows-only function for querying the registry. Always returns an empty string on non-Windows systems.
*
* @param path Registry path to query.
* @return Value at the given path, or an empty string in case of an error.
* @param path UTF8-encoded registry path to query.
* @return UTF8-encoded value at the given path, or an empty string in case of an error.
*/
virtual std::string queryRegistry(const std::string &path) const = 0;

/**
* Accessor for various system paths.
*
* @param path Path to get.
* @return UTF8-encoded path, or an empty string in case of an error.
*/
virtual std::string path(EnvironmentPath path) const = 0;

/**
* Same as `std::getenv`, but takes & returns UTF8-encoded keys and values on all platforms.
*
* Note that on Windows `std::getenv` doesn't switch to UTF8 even if `UnicodeCrt` is used
* (aka `std::setlocale(LC_ALL, ".UTF-8")`).
*
* Returns an empty string for non-existent environment variables, and thus doesn't distinguish between empty and
* non-existent values (and you shouldn't, either).
*
Expand Down

0 comments on commit 15f006c

Please sign in to comment.