LAR Library: conv.h Source File

LAR Library

conv.h
Go to the documentation of this file.
1 #ifndef LARLIB_CONV_H
2 #define LARLIB_CONV_H
3 
68 #include <larlib/base.h>
69 
75 };
76 
95 int convTxtToInt(const char *txt, int cnt, int base, uint64_t *n);
96 
115 int convTxtToInt8(const char *txt, int cnt, int base, uint8_t *n);
116 
135 int convTxtToInt16(const char *txt, int cnt, int base, uint16_t *n);
136 
155 int convTxtToInt32(const char *txt, int cnt, int base, uint32_t *n);
156 
175 int convTxtToInt64(const char *txt, int cnt, int base, uint64_t *n);
176 
200 int convIntToTxt(uint64_t n, char *txt, int maxcnt, int base);
201 
223 int convIntToTxtPad(uint64_t n, char *txt, int cnt, int base);
224 
239 int convBufToHex(const uint8_t *buf, int nbuf, char *hex, int maxcnt);
240 
268 int convHexToBuf(const char *hex, int cnt, uint8_t *buf, int maxbuf);
269 
288 int convIntToBcd(uint64_t n, uint8_t *bcd, int maxcnt, int padRight);
289 
321 int convIntToBcdPad(uint64_t n, uint8_t *bcd, int nibbles);
322 
335 int convBcdToInt(const uint8_t *bcd, int cnt, uint64_t *n);
336 
357 int convTxtToBcd(const char *txt, int maxtxt, uint8_t *bcd, int maxbcd);
358 
381 int convBcdToTxt(const uint8_t *bcd, int maxbcd, char *txt, int maxtxt);
382 
401 int convIntToBuf(uint64_t n, uint8_t *buf, int maxbuf);
402 
424 int convIntToBufPad(uint64_t n, uint8_t *buf, int maxbuf);
425 
436 uint64_t convBufToInt(const uint8_t *buf, int nbuf);
437 
461 int convBase64ToBuf(const char *b64, int cnt, uint8_t *buf, int maxbuf);
462 
479 int convBufToBase64(const uint8_t *buf, int nbuf, char *b64, int maxb64);
480 
481 /* @} */
482 
483 #endif
484 
int convTxtToBcd(const char *txt, int maxtxt, uint8_t *bcd, int maxbcd)
Convert a string of decimal digits (or ISO PAN) to BCD.
unsigned long long uint64_t
Unsigned 64-bit integer.
Definition: base.h:171
convErrors_t
Error codes specific to this module.
Definition: conv.h:73
int convIntToBufPad(uint64_t n, uint8_t *buf, int maxbuf)
Convert an integer to a sequence of bytes in big-endian ordering and with padding.
int convIntToBuf(uint64_t n, uint8_t *buf, int maxbuf)
Convert an integer to a sequence of bytes in big-endian ordering.
int convBufToHex(const uint8_t *buf, int nbuf, char *hex, int maxcnt)
Convert buffer to hexadecimal string.
int convIntToBcdPad(uint64_t n, uint8_t *bcd, int nibbles)
Convert Integer to BCD with left padding.
int convIntToTxtPad(uint64_t n, char *txt, int cnt, int base)
Convert Integer to Text padding left with zeroes to fill cnt chars.
int convBcdToInt(const uint8_t *bcd, int cnt, uint64_t *n)
Convert BCD to Integer.
int convTxtToInt32(const char *txt, int cnt, int base, uint32_t *n)
Convert Text to an uint32_t.
int convTxtToInt8(const char *txt, int cnt, int base, uint8_t *n)
Convert Text to an uint8_t.
int convIntToTxt(uint64_t n, char *txt, int maxcnt, int base)
Convert Integer to Text.
int convTxtToInt64(const char *txt, int cnt, int base, uint64_t *n)
This function is a synonym to convTxtToInt().
int convBufToBase64(const uint8_t *buf, int nbuf, char *b64, int maxb64)
Encode a sequence of bytes into a Base-64 string.
Invalid base for Text parameter.
Definition: conv.h:74
unsigned int uint32_t
Unsigned 32-bit integer.
Definition: base.h:168
uint64_t convBufToInt(const uint8_t *buf, int nbuf)
Convert a sequence of bytes in big-endian ordering to an integer.
unsigned short uint16_t
Unsigned 16-bit integer.
Definition: base.h:165
int convBcdToTxt(const uint8_t *bcd, int maxbcd, char *txt, int maxtxt)
Convert a sequence of digits in BCD format to a decimal string.
int convBase64ToBuf(const char *b64, int cnt, uint8_t *buf, int maxbuf)
Decode a base-64 encoded string into a sequence of bytes.
Larlib basic definitions.
int convHexToBuf(const char *hex, int cnt, uint8_t *buf, int maxbuf)
Convert hexadecimal string to buffer.
int convTxtToInt16(const char *txt, int cnt, int base, uint16_t *n)
Convert Text to an uint16_t.
int convTxtToInt(const char *txt, int cnt, int base, uint64_t *n)
Convert Text to Integer.
unsigned char uint8_t
Unsigned 8-bit integer.
Definition: base.h:162
int convIntToBcd(uint64_t n, uint8_t *bcd, int maxcnt, int padRight)
Convert Integer to BCD.
Generated on Mon Mar 27 2017 15:42:52 for LAR Library by   doxygen 1.8.9.1