common_util
|
Common system utilities. More...
#include <cstdint>
#include <string>
Go to the source code of this file.
Enumerations | |
enum class | cutl::endian { little , big } |
Endianness type. More... | |
enum class | cutl::os_platform { os_windows , os_macos , os_linux , os_unix , os_unknown } |
Operating system platform type. More... | |
Functions | |
os_platform | cutl::platform_type () |
Get the platform type for the current operating system. | |
std::string | cutl::architecture () |
Get the architecture of the cpu processor(or operating system). | |
std::string | cutl::platform_name (os_platform type) |
Get the platform name for the current operating system. | |
std::string | cutl::cpp_stl_version () |
Get the C++ standard library version. | |
uint16_t | cutl::program_bit () |
Get the program bit. | |
endian | cutl::endian_type () |
Get the program endianness. | |
uint16_t | cutl::byteswap (uint16_t value) |
Byteswap a 16-bit value. | |
uint32_t | cutl::byteswap (uint32_t value) |
Byteswap a 32-bit value. | |
uint64_t | cutl::byteswap (uint64_t value) |
Byteswap a 64-bit value. | |
void | cutl::byteswap (uint8_t *data, uint32_t size) |
Byteswap an array of bytes. | |
bool | cutl::system (const std::string &cmd) |
Execute a system command. | |
bool | cutl::callcmd (const std::string &cmd, std::string &result) |
Execute a system command and get the output. | |
std::string | cutl::getenv (const std::string &name, const std::string &default_value) |
Get an environment variable. | |
std::string | cutl::getcwd () |
Get the working directory of the current excuting process. | |
std::string | cutl::homedir () |
Get the home dir for the current user. | |
Common system utilities.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations.
|
strong |
|
strong |
std::string cutl::architecture | ( | ) |
Get the architecture of the cpu processor(or operating system).
uint16_t cutl::byteswap | ( | uint16_t | value | ) |
Byteswap a 16-bit value.
value | the value to byteswap. |
uint32_t cutl::byteswap | ( | uint32_t | value | ) |
Byteswap a 32-bit value.
value | the value to byteswap. |
uint64_t cutl::byteswap | ( | uint64_t | value | ) |
Byteswap a 64-bit value.
value | the value to byteswap. |
void cutl::byteswap | ( | uint8_t * | data, |
uint32_t | size ) |
Byteswap an array of bytes.
data | the array of bytes to byteswap. |
size | the size of the array. |
bool cutl::callcmd | ( | const std::string & | cmd, |
std::string & | result ) |
Execute a system command and get the output.
cmd | the command to be executed. |
result | the output of the command. |
std::string cutl::cpp_stl_version | ( | ) |
Get the C++ standard library version.
endian cutl::endian_type | ( | ) |
Get the program endianness.
std::string cutl::getcwd | ( | ) |
Get the working directory of the current excuting process.
std::string cutl::getenv | ( | const std::string & | name, |
const std::string & | default_value ) |
Get an environment variable.
name | the name of the environment variable. |
default_value | the default value if the variable is not found. |
std::string cutl::homedir | ( | ) |
Get the home dir for the current user.
std::string cutl::platform_name | ( | os_platform | type | ) |
Get the platform name for the current operating system.
type | the operating system platform type. |
os_platform cutl::platform_type | ( | ) |
Get the platform type for the current operating system.
uint16_t cutl::program_bit | ( | ) |
Get the program bit.
bool cutl::system | ( | const std::string & | cmd | ) |
Execute a system command.
cmd | the command to be executed. |