|
Teamcenter C++ API Reference
2312
|
Functions | |
| void | addPrefixMapping (const std::string &oldPrefix, const std::string &newPrefix) |
| std::string | get (const std::string &name, bool applyOSEnvNameMapping=true, bool throwStdExceptionIfNotFound=false) |
| std::string | getMappedName (const std::string &originalName) |
| const std::map< std::string, std::string > & | getNamePrefixMap () |
| bool | has (const std::string &name, bool applyOSEnvNameMapping=true) |
| void | removePrefixMapping (const std::string &oldPrefix) |
| void | set (const std::string &name, const std::string &value, bool applyOSEnvNameMapping=true) |
| void Teamcenter::OSEnvironment::addPrefixMapping | ( | const std::string & | oldPrefix, |
| const std::string & | newPrefix | ||
| ) |
Adds a name prefix mapping, e.g. from "OLDPREFIX_" to "NEWPREFIX_".
Subsequent calls to getMappedName with "OLDPREFIX_nametrailer" will return "NEWPREFIX_nametrailer"
| oldPrefix | (I) The name prefix that should be mapped to a new_prefix |
| newPrefix | (I) The replacement prefix |
| std::string Teamcenter::OSEnvironment::get | ( | const std::string & | name, |
| bool | applyOSEnvNameMapping = true, |
||
| bool | throwStdExceptionIfNotFound = false |
||
| ) |
Returns the value of the environment variable with the given name.
If name mapping is turned on, the value is retrieved using the mapped environment variable name. If no value is found, the value is retrieved using the originally given variable name.
| <std::exception> | if the parameter #throwStdExceptionIfNotFound is set to true and the environment variable was not found. |
| name | (I) The name of the unmapped environment variable |
| applyOSEnvNameMapping | (I) Specifies if the name should be mapped using Teamcenter::OSEnvNameMapping. |
| throwStdExceptionIfNotFound | (I) Specifies if an std::exception is to be thrown if the environment variable does not exist. If set to false, an empty string is returned if the environment variable does not exist. |
| std::string Teamcenter::OSEnvironment::getMappedName | ( | const std::string & | originalName | ) |
Returns the mapped name that applies to the provided name.
E.g. it returns "NEWPREFIX_nametrailer" for an input "OLDPREFIX_nametrailer" if the mappings "OLDPREFIX_" to "NEWPREFIX_" has been set through addPrefixMapping.
| originalName | (I) The name to be checked against mapping |
| const std::map< std::string, std::string >& Teamcenter::OSEnvironment::getNamePrefixMap | ( | ) |
Retrieves the actual map of prefixes.
| bool Teamcenter::OSEnvironment::has | ( | const std::string & | name, |
| bool | applyOSEnvNameMapping = true |
||
| ) |
Returns true if an environment variable with the given name is defined.
If name mapping is turned on, the mapped name is used first. If no environment variable with the mapped name can be found, the originally provided name is used.
| name | (I) The name of the unmapped environment variable |
| applyOSEnvNameMapping | (I) Specifies if the name should be mapped using Teamcenter::OSEnvNameMapping. |
| void Teamcenter::OSEnvironment::removePrefixMapping | ( | const std::string & | oldPrefix | ) |
Removes the prefix mapping that has previously been associated through a call to addPrefixMapping
Subsequent calls to getMappedName with "OLDPREFIX_nametrailer" will return "OLDPREFIX_nametrailer"
| oldPrefix | (I) The name prefix that should no longer be mapped to a new prefix |
| void Teamcenter::OSEnvironment::set | ( | const std::string & | name, |
| const std::string & | value, | ||
| bool | applyOSEnvNameMapping = true |
||
| ) |
Sets the environment variable with the given name to the given value.
The environment variable names are mapped using Teamcenter::OSEnvNameMapping unless the parameter #applyOSEnvNameMapping is set to false.
| name | (I) The name of the unmapped environment variable. |
| value | (I) The value to be given to the potentially mapped environment variable. |
| applyOSEnvNameMapping | (I) Specifies if the name should be mapped using Teamcenter::OSEnvNameMapping. |