okteta
#include <valuecodec.h>
Public Member Functions | |
virtual | ~ValueCodec () |
virtual bool | appendDigit (Byte *byte, unsigned char digit) const =0 |
unsigned int | decode (Byte *byte, const QString &text, unsigned int pos=0) const |
virtual Byte | digitsFilledLimit () const =0 |
virtual void | encode (QString &digits, unsigned int pos, Byte byte) const =0 |
virtual void | encodeShort (QString &digits, unsigned int pos, Byte byte) const =0 |
virtual unsigned int | encodingWidth () const =0 |
virtual bool | isValidDigit (unsigned char digit) const =0 |
virtual void | removeLastDigit (Byte *byte) const =0 |
virtual bool | turnToValue (unsigned char *digit) const =0 |
Static Public Member Functions | |
static ValueCodec * | createCodec (ValueCoding valueCoding) |
Protected Member Functions | |
ValueCodec () | |
Detailed Description
Class that is able to convert codings to and from hexadecimal, decimal, octal, and binary.
The buffer will be always filled up to CodingWidth, if not using shortCodingFunction.
Definition at line 45 of file valuecodec.h.
Constructor & Destructor Documentation
|
virtual |
Definition at line 73 of file valuecodec.cpp.
|
inlineprotected |
Definition at line 124 of file valuecodec.h.
Member Function Documentation
|
pure virtual |
Tries to increase the byte value by appending a digit to the digits of the current encoding.
- Parameters
-
digit digit to append to encoding of current value. pos offset in digits where to write the code to
- Returns
- true if successful, false otherwise
Implemented in Okteta::HexadecimalByteCodec, Okteta::BinaryByteCodec, Okteta::DecimalByteCodec, and Okteta::OctalByteCodec.
|
static |
Definition at line 36 of file valuecodec.cpp.
unsigned int Okteta::ValueCodec::decode | ( | Byte * | byte, |
const QString & | text, | ||
unsigned int | pos = 0 |
||
) | const |
Tries to decode the digits in the text into a byte.
- Parameters
-
byte pointer to the variable to store the result in text string to turn into the value pos offset in the text to start with decoding
- Returns
- used chars of the string for the decoding, beginning with pos
Definition at line 50 of file valuecodec.cpp.
|
pure virtual |
- Returns
- largest value which could get another digit appended and stay below 256.
Implemented in Okteta::HexadecimalByteCodec, Okteta::BinaryByteCodec, Okteta::DecimalByteCodec, and Okteta::OctalByteCodec.
|
pure virtual |
Encodes the byte using full coding width, prefixing with 0s if needed, and writes the result to digits.
- Parameters
-
digits string to write the digits into pos offset in digits where to write the code to byte data to encode
Implemented in Okteta::HexadecimalByteCodec, Okteta::BinaryByteCodec, Okteta::DecimalByteCodec, and Okteta::OctalByteCodec.
|
pure virtual |
Encodes the byte and writes the result to digits, no leading 0s.
- Parameters
-
digits string to write the digits into pos offset in digits where to write the code to byte data to encode
Implemented in Okteta::HexadecimalByteCodec, Okteta::BinaryByteCodec, Okteta::DecimalByteCodec, and Okteta::OctalByteCodec.
|
pure virtual |
- Returns
- number of digits the greatest byte gets decoded into
Implemented in Okteta::HexadecimalByteCodec, Okteta::BinaryByteCodec, Okteta::DecimalByteCodec, and Okteta::OctalByteCodec.
|
pure virtual |
Checks if the given digit is used in the encoding.
- Parameters
-
digit value to check
- Returns
- true if digit is valid, false otherwise
Implemented in Okteta::HexadecimalByteCodec, Okteta::BinaryByteCodec, Okteta::DecimalByteCodec, and Okteta::OctalByteCodec.
|
pure virtual |
Tries to remove the last (least significant) digit from byte.
- Parameters
-
byte value to remove the last digit from
- Returns
- true if successful, false otherwise
Implemented in Okteta::HexadecimalByteCodec, Okteta::BinaryByteCodec, Okteta::DecimalByteCodec, and Okteta::OctalByteCodec.
|
pure virtual |
Turns the digit into a byte with the value of the digit.
- Parameters
-
digit digit to turn into the value
- Returns
- true if successful, false otherwise
Implemented in Okteta::HexadecimalByteCodec, Okteta::BinaryByteCodec, Okteta::DecimalByteCodec, and Okteta::OctalByteCodec.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:04:13 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.