Lolly 1.4.28
Loading...
Searching...
No Matches
Namespaces | Functions | Variables
numeral.cpp File Reference
#include "numeral.hpp"
#include "analyze.hpp"
Include dependency graph for numeral.cpp:

Go to the source code of this file.

Namespaces

namespace  lolly
 
namespace  lolly::data
 

Functions

string lolly::data::to_roman (int32_t nr)
 Generates a Roman numeral string for an integer.
 
string lolly::data::to_Roman (int32_t nr)
 Generates an uppercase Roman numeral string for an integer.
 
string lolly::data::hanzi_sub (int16_t nr, bool leading_zero)
 
string lolly::data::to_hanzi (int32_t nr)
 Generates a Chinese numeral for a given integer.
 
string lolly::data::to_padded_Hex (uint8_t i)
 
string lolly::data::to_padded_hex (uint8_t i)
 Converts an 8-bit unsigned integer to a fixed-length (2) hex string.
 
template<typename T >
std::enable_if_t< std::conjunction_v< std::is_integral< T >, std::is_unsigned< T > >, voidlolly::data::to_Hex_positive (T i, string &s)
 Handle positive number separately to avoid unnecessary check of sign. string is passed into the function as reference, thus no reference counting is performed.
 
string lolly::data::to_Hex (int32_t i)
 
string lolly::data::to_hex (int32_t i)
 
string lolly::data::to_Hex (pointer ptr)
 
string lolly::data::to_hex (pointer ptr)
 Converts a pointer to a hexadecimal string.
 
int lolly::data::from_hex (string s)
 Converts a hexadecimal string to an integer.
 
template<unsigned int cur, typename T >
std::enable_if_t< std::conjunction_v< std::is_integral< T >, std::is_unsigned< T > >, voidlolly::data::as_hexadecimal_sub (T i, string &s)
 Handle positive number separately to avoid unnecessary check of sign. string is passed into the function as reference, thus no reference counting is performed. Because length of string s is known here, use index instead of appending operator can avoid cost of reallocation. Firstly a string of given length is constructed, then digits is filled according to index rather than appending to the tail.
 
string lolly::data::as_hexadecimal (int i, int length)
 Converts an unsigned integer to a hexadecimal string with a fixed length.
 
string lolly::data::uint32_to_Hex (uint32_t i)
 Converts an unsigned integer to a hexadecimal string.
 
string lolly::data::binary_to_hexadecimal (string bin)
 Converts a binary stream to its hexadecimal represention.
 

Variables

static const string lolly::data::roman_ones [10]
 
static const string lolly::data::roman_tens [10]
 
static const string lolly::data::roman_hundreds [10]
 
static const string lolly::data::roman_thousands [4] = {"", "m", "mm", "mmm"}
 
static const string lolly::data::chars_han [10]
 
static const charlolly::data::hex_string = "0123456789ABCDEF"