fix(hex): basen::Exception

This commit is contained in:
2024-09-30 17:41:43 +03:00
parent 64c2e51104
commit edcaebcf53
3 changed files with 21 additions and 19 deletions

View File

@ -14,24 +14,24 @@ namespace hex
bool isValid(std::string_view str) noexcept;
/**
* @throw std::overflow_error if if there is an overflow
* @throw basen::Exception(OVERFLOW) if if there is an overflow
*/
size_t sizeEncoded(std::span<const uint8_t> data);
size_t sizeDecoded(std::string_view str) noexcept;
/**
* @throw std::length_error if not enough allocated length
* @throw basen::Exception(LENGTH) if not enough allocated length
* @warning contain leading zeros, returns count of them
*/
void encode(const uint8_t *data, size_t data_size, char *str, size_t str_size);
std::string encode(std::span<const uint8_t> data) noexcept;
std::string encode(std::span<const uint8_t> data);
/**
* @throw std::length_error if not enough allocated length
* @throw std::logic_error if out of digits map
* @throw std::logic_error if str_size %2 != 0 (isn't hex)
* @throw basen::Exception(LENGTH) if not enough allocated length
* @throw basen::Exception(OUT_OF_ALPH) if out of digits map
* @throw basen::Exception(PADDING) if str_size %2 != 0 (isn't hex)
* @warning contain leading zeros, returns count of them
*/
void decode(const char *str, size_t str_size, uint8_t *data, size_t data_size);
std::vector<uint8_t> decode(std::string_view str) noexcept;
std::vector<uint8_t> decode(std::string_view str);
}