• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdesdk API Reference
  • KDE Home
  • Contact Us
 

okteta

  • Okteta
  • ValueCodec
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
Okteta::ValueCodec Class Referenceabstract

#include <valuecodec.h>

Inheritance diagram for Okteta::ValueCodec:
Inheritance graph
[legend]

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.

Author
Friedrich W. H. Kossebau

Definition at line 45 of file valuecodec.h.

Constructor & Destructor Documentation

Okteta::ValueCodec::~ValueCodec ( )
virtual

Definition at line 73 of file valuecodec.cpp.

Okteta::ValueCodec::ValueCodec ( )
inlineprotected

Definition at line 124 of file valuecodec.h.

Member Function Documentation

virtual bool Okteta::ValueCodec::appendDigit ( Byte *  byte,
unsigned char  digit 
) const
pure virtual

Tries to increase the byte value by appending a digit to the digits of the current encoding.

Parameters
digitdigit to append to encoding of current value.
posoffset 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.

ValueCodec * Okteta::ValueCodec::createCodec ( ValueCoding  valueCoding)
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
bytepointer to the variable to store the result in
textstring to turn into the value
posoffset 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.

virtual Byte Okteta::ValueCodec::digitsFilledLimit ( ) const
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.

virtual void Okteta::ValueCodec::encode ( QString &  digits,
unsigned int  pos,
Byte  byte 
) const
pure virtual

Encodes the byte using full coding width, prefixing with 0s if needed, and writes the result to digits.

Parameters
digitsstring to write the digits into
posoffset in digits where to write the code to
bytedata to encode

Implemented in Okteta::HexadecimalByteCodec, Okteta::BinaryByteCodec, Okteta::DecimalByteCodec, and Okteta::OctalByteCodec.

virtual void Okteta::ValueCodec::encodeShort ( QString &  digits,
unsigned int  pos,
Byte  byte 
) const
pure virtual

Encodes the byte and writes the result to digits, no leading 0s.

Parameters
digitsstring to write the digits into
posoffset in digits where to write the code to
bytedata to encode

Implemented in Okteta::HexadecimalByteCodec, Okteta::BinaryByteCodec, Okteta::DecimalByteCodec, and Okteta::OctalByteCodec.

virtual unsigned int Okteta::ValueCodec::encodingWidth ( ) const
pure virtual
Returns
number of digits the greatest byte gets decoded into

Implemented in Okteta::HexadecimalByteCodec, Okteta::BinaryByteCodec, Okteta::DecimalByteCodec, and Okteta::OctalByteCodec.

virtual bool Okteta::ValueCodec::isValidDigit ( unsigned char  digit) const
pure virtual

Checks if the given digit is used in the encoding.

Parameters
digitvalue to check
Returns
true if digit is valid, false otherwise

Implemented in Okteta::HexadecimalByteCodec, Okteta::BinaryByteCodec, Okteta::DecimalByteCodec, and Okteta::OctalByteCodec.

virtual void Okteta::ValueCodec::removeLastDigit ( Byte *  byte) const
pure virtual

Tries to remove the last (least significant) digit from byte.

Parameters
bytevalue to remove the last digit from
Returns
true if successful, false otherwise

Implemented in Okteta::HexadecimalByteCodec, Okteta::BinaryByteCodec, Okteta::DecimalByteCodec, and Okteta::OctalByteCodec.

virtual bool Okteta::ValueCodec::turnToValue ( unsigned char *  digit) const
pure virtual

Turns the digit into a byte with the value of the digit.

Parameters
digitdigit 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:
  • valuecodec.h
  • valuecodec.cpp
This file is part of the KDE documentation.
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.

okteta

Skip menu "okteta"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdesdk API Reference

Skip menu "kdesdk API Reference"
  • kapptemplate
  • kcachegrind
  • kompare
  • lokalize
  • okteta
  • umbrello
  •   umbrello

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal