FBB::LDC(3bobcat)

Convert (large) digital values to characters
(libbobcat-dev_6.02.02)

2005-2022

NAME

FBB::LDC - Converts (large) digital values to characters

SYNOPSIS

#include <bobcat/LDC>
Linking option: -lbobcat

DESCRIPTION

Objects of the class LDC (Large Digital Converter) convert (large) digital values (like values handled by the class BigInt (cf. bigint(3bobcat))) to character representations using radices from 2 through 36. For radices larger than 10 letters are used, using a through z to represent the (decimal) values 10 through 36. When specifying radices outside of this range an exception is thrown.

Alternatively, the digits of the converted number can be provided in a std::string argument, where the string's first character (at index 0) is used for value 0, the next character for value 1, etc., until the string's last character. In that case the string's length defines the number system that is used for converting the (large) digital value. Usually the first 10 characters will be "0123456789", but LDC doesn't enforce that. Instead, any series of characters can be specified, in which case the character at index idx is used to represent value idx in the converted value string. E.g., when specifying "abcdefghij" the hexadecimal value "deadbeef" is converted to "dhdfjciffj" instead of "3735928559", which is the normally used decimal digit representation. Digit strings must at least contain two characters or an exception is thrown.

NAMESPACE

FBB
All constructors, members, operators and manipulators, mentioned in this man-page, are defined in the namespace FBB.

INHERITS FROM

-

CONSTRUCTORS

Copy and move constructors (and assignment operators) are available.

OVERLOADED OPERATORS

In addition to the standard copy- and move-assignment operators the following operators are available:

FREE FUNCTION IN THE FBB NAMESPACE

MEMBER FUNCTIONS

EXAMPLE

#include <iostream>

#include <bobcat/ldc>

using namespace std;
using namespace FBB;

int main(int argc, char **argv)
{
    string value = "1122334455667788aabbcc";

    size_t radix = 10;

    LDC digits{ value, "0123456789ABCDEF" };

    LDC ldc{ value, radix };

    cout << "radix = " << radix << "\n"
            "value = " << value << "\n"
            "digits: " << digits << "\n"
            "   LDC: " << ldc << "\n"
            "        " << ldc(3, '.') << '\n';
}

// shows:
//     radix = 10
//     value = 1122334455667788aabbcc
//     digits: 1122334455667788AABBCC
//        LDC: 20713245101768454273940428
//             20.713.245.101.768.454.273.940.428

FILES

bobcat/ldc - defines the class interface

SEE ALSO

bobcat(7)

BUGS

None Reported.

BOBCAT PROJECT FILES

BOBCAT

Bobcat is an acronym of `Brokken's Own Base Classes And Templates'.

COPYRIGHT

This is free software, distributed under the terms of the GNU General Public License (GPL).

AUTHOR

Frank B. Brokken (f.b.brokken@rug.nl).