Botan
1.11.15
|
Functions | |
bool | caseless_cmp (char a, char b) |
byte | char2digit (char c) |
char | digit2char (byte b) |
bool | is_digit (char c) |
bool | is_space (char c) |
std::string | transcode (const std::string &str, Character_Set to, Character_Set from) |
bool BOTAN_DLL Botan::Charset::caseless_cmp | ( | char | a, |
char | b | ||
) |
Definition at line 193 of file charset.cpp.
Referenced by Botan::x500_name_cmp().
{
return (std::tolower(static_cast<unsigned char>(a)) ==
std::tolower(static_cast<unsigned char>(b)));
}
byte BOTAN_DLL Botan::Charset::char2digit | ( | char | c | ) |
Definition at line 149 of file charset.cpp.
Referenced by Botan::BigInt::decode().
{ switch(c) { case '0': return 0; case '1': return 1; case '2': return 2; case '3': return 3; case '4': return 4; case '5': return 5; case '6': return 6; case '7': return 7; case '8': return 8; case '9': return 9; } throw Invalid_Argument("char2digit: Input is not a digit character"); }
char BOTAN_DLL Botan::Charset::digit2char | ( | byte | b | ) |
Definition at line 171 of file charset.cpp.
Referenced by Botan::BigInt::encode().
{ switch(b) { case 0: return '0'; case 1: return '1'; case 2: return '2'; case 3: return '3'; case 4: return '4'; case 5: return '5'; case 6: return '6'; case 7: return '7'; case 8: return '8'; case 9: return '9'; } throw Invalid_Argument("digit2char: Input is not a digit"); }
bool BOTAN_DLL Botan::Charset::is_digit | ( | char | c | ) |
Definition at line 128 of file charset.cpp.
Referenced by Botan::BigInt::decode(), Botan::X509_Time::set_to(), Botan::EAC_Time::set_to(), and Botan::timespec_to_u32bit().
bool BOTAN_DLL Botan::Charset::is_space | ( | char | c | ) |
Definition at line 139 of file charset.cpp.
Referenced by Botan::BigInt::decode(), Botan::PGP_decode(), and Botan::x500_name_cmp().
std::string BOTAN_DLL Botan::Charset::transcode | ( | const std::string & | str, |
Character_Set | to, | ||
Character_Set | from | ||
) |
Definition at line 103 of file charset.cpp.
References Botan::LATIN1_CHARSET, Botan::LOCAL_CHARSET, Botan::ASN1::to_string(), Botan::UCS2_CHARSET, and Botan::UTF8_CHARSET.
Referenced by Botan::ASN1_EAC_String::ASN1_EAC_String(), Botan::ASN1_String::ASN1_String(), Botan::ASN1_String::decode_from(), Botan::X509_Time::decode_from(), Botan::AlternativeName::decode_from(), Botan::ASN1_EAC_String::decode_from(), Botan::ASN1_String::encode_into(), Botan::X509_Time::encode_into(), Botan::ASN1_String::value(), and Botan::ASN1_EAC_String::value().
{ if(to == LOCAL_CHARSET) to = LATIN1_CHARSET; if(from == LOCAL_CHARSET) from = LATIN1_CHARSET; if(to == from) return str; if(from == LATIN1_CHARSET && to == UTF8_CHARSET) return latin1_to_utf8(str); if(from == UTF8_CHARSET && to == LATIN1_CHARSET) return utf8_to_latin1(str); if(from == UCS2_CHARSET && to == LATIN1_CHARSET) return ucs2_to_latin1(str); throw Invalid_Argument("Unknown transcoding operation from " + std::to_string(from) + " to " + std::to_string(to)); }