Program Listing for File environment.h
↰ Return to documentation for file (include\system\environment.h
)
/******************************************************************************
© Intel Corporation.
This software and the related documents are Intel copyrighted materials,
and your use of them is governed by the express license under which they
were provided to you ("License"). Unless the License provides otherwise,
you may not use, modify, copy, publish, distribute, disclose or transmit
this software or the related documents without Intel's prior written
permission.
This software and the related documents are provided as is, with no express
or implied warranties, other than those that are expressly stated in the
License.
******************************************************************************/
//Can't just use the #pragma once because this header is included second time into environment.cpp for another expansion of GPA_PUBLIC_ENV_* family
#ifndef GPA_ENVIRONMENT_HEADER
#define GPA_ENVIRONMENT_HEADER
#ifndef GPA_PUBLIC_ENV_ITEM
#define GPA_PUBLIC_ENV_BEGIN(name) \
namespace gpa { \
namespace system { \
enum name {
#define GPA_PUBLIC_ENV_ITEM(name, help) e##name,
#define GPA_PUBLIC_ENV_END() \
} \
; \
} \
}
#endif
GPA_PUBLIC_ENV_BEGIN(EGPAPublicEnv)
GPA_PUBLIC_ENV_ITEM(GPA_CHECK_RET, R"(Defines behavior for GPA_CHECK_RET, supports one or several (comma, space or | delimited):
stdout|stderr - dump message to one of outputs respectively
assert - show message box
break - generate debugger breakpoint
)")
GPA_PUBLIC_ENV_ITEM(GPA_LOG_STACK, R"(Sets number that represents log severity to start dumping log from:
kTrace = 0,
kDebug = 1,
kInfo = 2,
kWarn = 3,
kError = 4,
kFatal = 5
)")
GPA_PUBLIC_ENV_END()
#undef GPA_PUBLIC_ENV_BEGIN
#undef GPA_PUBLIC_ENV_ITEM
#undef GPA_PUBLIC_ENV_END
#if !defined(GPA_ENVIRONMENT_HEADER_EX)
namespace gpa {
namespace system {
namespace internal {
class Map;
}
class Environment
{
public:
Environment(bool bInit = false);
Environment(char const* const* envp);
Environment(Environment const& other);
~Environment();
Environment& operator=(Environment const& other);
bool operator==(Environment const& other) const;
bool operator!=(Environment const& other) const;
int GetKeyCount() const;
bool Empty() const;
char const* Get(char const* key) const;
static char const* GetPublic(EGPAPublicEnv name); //returns value of the publicly defined environment variable
static char const* GetPublicHelp(); //composes help from all the publicly defined variables in GPA_PUBLIC_ENV_BEGIN(EGPAPublicEnv)
void GetAllKeysValues(char const** keys, char const** values, int* count) const;
void Set(char const* key, char const* newValue);
void Remove(char const* key);
void AppendToPathValue(char const* key, char const* additionalPath);
void PrependToPathValue(char const* key, char const* additionalPath);
void RemoveFromPathValue(char const* key, char const* pathToRemove);
void RemovePathValueContaining(char const* key, char const* stringToFind);
void InitializeFromCurrentProcess();
void ApplyToCurrentProcess(bool replaceWholeEnvironment = false);
void MergeFrom(Environment const& other);
typedef void (*KeyValuePairEnumerateFn)(char const* key, char const* value, int index, void* context);
void EnumerateKeyValuePairs(KeyValuePairEnumerateFn callback, void* context) const;
private:
internal::Map* mEnv;
char PathSep() const;
};
} // namespace system
} // namespace gpa
#endif
#endif