Responsible for conversion between binary data and strings.
More...
#include <sttnet_English.h>
|
| static std::string & | bitOutput (char input, std::string &result) |
| | Convert a single character to its corresponding 8-bit binary string. More...
|
| |
| static std::string & | bitOutput (const std::string &input, std::string &result) |
| | Convert each character in the string to binary bits and concatenate them into an overall string. More...
|
| |
| static char & | bitOutput_bit (char input, const int pos, char &result) |
| | Get the pos-th bit (from left to right) of the character input (binary) and return '1' or '0'. More...
|
| |
| static unsigned long & | bitStrToNumber (const std::string &input, unsigned long &result) |
| | Convert a "01" string (binary string) to an unsigned integer. More...
|
| |
| static unsigned long & | bitToNumber (const std::string &input, unsigned long &result) |
| | Convert a string to binary and then to the corresponding numeric value. More...
|
| |
| static char & | toBit (const std::string &input, char &result) |
| | Compress a "01" string of up to 8 bits into 1 byte (char). More...
|
| |
| static std::string & | toBit (const std::string &input, std::string &result) |
| | Compress an arbitrary length "01" string into binary data, with every 8 bits as a byte. More...
|
| |
Responsible for conversion between binary data and strings.
| static std::string& stt::data::BitUtil::bitOutput |
( |
char |
input, |
|
|
std::string & |
result |
|
) |
| |
|
static |
Convert a single character to its corresponding 8-bit binary string.
- Parameters
-
| input | Input character. |
| result | Used to save the output binary string (e.g., 'A' -> "01000001"). |
- Returns
- Reference to result.
| static std::string& stt::data::BitUtil::bitOutput |
( |
const std::string & |
input, |
|
|
std::string & |
result |
|
) |
| |
|
static |
Convert each character in the string to binary bits and concatenate them into an overall string.
- Parameters
-
| input | Input string. |
| result | Save the output continuous bit string (length is input.size() * 8). |
- Returns
- Reference to result.
| static char& stt::data::BitUtil::bitOutput_bit |
( |
char |
input, |
|
|
const int |
pos, |
|
|
char & |
result |
|
) |
| |
|
static |
Get the pos-th bit (from left to right) of the character input (binary) and return '1' or '0'.
- Parameters
-
| input | Input character. |
| pos | Bit position (1~8, 1 is the most significant bit). |
| result | Returned bit character: '1' or '0'. |
- Returns
- Reference to result.
| static unsigned long& stt::data::BitUtil::bitStrToNumber |
( |
const std::string & |
input, |
|
|
unsigned long & |
result |
|
) |
| |
|
static |
Convert a "01" string (binary string) to an unsigned integer.
- Parameters
-
| input | Input binary string (e.g., "1011"). |
| result | Output result value. |
- Returns
- Reference to result.
| static unsigned long& stt::data::BitUtil::bitToNumber |
( |
const std::string & |
input, |
|
|
unsigned long & |
result |
|
) |
| |
|
static |
Convert a string to binary and then to the corresponding numeric value.
- Parameters
-
| input | Any original data string. |
| result | Return the converted numeric value. |
- Returns
- Reference to result.
- Note
- Actually calls bitOutput to get the bit string first, then converts it to an integer via bitStrToNumber.
| static char& stt::data::BitUtil::toBit |
( |
const std::string & |
input, |
|
|
char & |
result |
|
) |
| |
|
static |
Compress a "01" string of up to 8 bits into 1 byte (char).
- Parameters
-
| input | Binary string, up to 8 bits. |
| result | Output compressed byte. |
- Returns
- Reference to result.
| static std::string& stt::data::BitUtil::toBit |
( |
const std::string & |
input, |
|
|
std::string & |
result |
|
) |
| |
|
static |
Compress an arbitrary length "01" string into binary data, with every 8 bits as a byte.
- Parameters
-
| input | Input bit string (length should be a multiple of 8). |
| result | Return the compressed binary data (each character represents 1 byte). |
- Returns
- Reference to result.
The documentation for this class was generated from the following file: