Main Page | Data Structures | File List | Data Fields | Globals | Related Pages

kconvert.h File Reference

Tests functions of KToolLib - convert. More...

#include "ktypes.h"
#include "KWString.h"

Defines

#define K_MIN_CB   -240.0
 Minimum value of centi-Bel (cB).
#define KMIX_SINT8   ((KDouble) 0x8000)
 Maximal value of an signed 16 bit integer.
#define k_intToString(n)   _k_intToString (n, __K_FILE__, __K_LINE__)
 Converts a 64 bits integral number as a string.
#define k_convert_i16BE_to_i16LE(i)   k_convert_i16LE_to_i16BE (i)
 Converts a 16 bits big endian integral number as a 16 bits little endian integral number.
#define k_convert_i32BE_to_i32LE(i)   k_convert_i32LE_to_i32BE (i)
 Converts a 32 bits big endian integral number as a 32 bits little endian integral number.
#define k_convert_i64BE_to_i64LE(i)   k_convert_i64LE_to_i64BE (i)
 Converts a 64 bits big endian integral number as a 64 bits little endian integral number.

Functions

KTL_API k_size_t k_i64_to_sizet (const KInt64 n)
 Converts a 64 bit integer in k_size_t.
KTL_API KString k_itoa (KInt n, KString str, KInt len)
 Converts an integer to a null-terminated string using the specified base and stores the result in an array.
KTL_API KInt k_atoi (KCString str)
 Parses a string and interpreting its content as an integral number.
KTL_API KDouble k_atof (KString str)
 Parses the string and interpreting its content as a floating point number.
KTL_API KDouble k_strtod (KString str)
 Parses the string and interpreting its content as a floating point number.
KTL_API KUInt32 k_hexastrtoi (KString str)
 Converts the hexadecimal string as an unsigned 32 bits integral number.
KTL_API KInt32 k_float10_to_i32 (KUChar *pBytes)
 Converts a floating point number represented by 10 bytes as a 32 bits integral number.
KTL_API KString k_doubleToString (KDouble n)
 Converts a floating point number as a string Allocates the necessary memory that must be freed after its used.
KTL_API KString k_doubleToDBString (KDouble n)
 Converts a floating point number as a string with one digit after the decimal point.
KTL_API KString _k_intToString (KInt64 n, KString sFile, KInt32 iLine)
 Converts a 64 bits integral number as a string.
KTL_API KString k_doublearrayToString (KDouble *darray, KInt n)
 Converts an array of double as a string Introduces spaces between the converted values Allocates the necessary memory that must be freed after its used.
KTL_API KInt k_stringToDoublearray (KString string, KDouble *darray, KInt n)
 Converts a string as a an array of double.
KTL_API KWString k_stringToWString (KCString string)
 Converts an ASCII string as an unicode one Allocates the necessary memory that must be freed after its used.
KTL_API KString k_wStringToString (KWString wString)
 Converts an unicode string as an ASCII one Allocates the necessary memory that must be freed after its used.
KTL_API KWString k_intToWString (KInt n)
 Converts an integral number as an unicode string Allocates the necessary memory that must be freed after its used.
KTL_API KInt64 k_wStringToInt (KWString string)
 Converts an unicode string as a 64 bits integral number.
KTL_API KInt32 k_doubleToCB (KDouble level)
 Converts a floating point number as a 32 bits integral number where value is in cB.
KTL_API KDouble k_cBToDouble (KInt32 cB)
 Converts a 32 bits integral number where value is in cB as a floating point number.
KTL_API KDouble k_mBToDouble (KInt32 level)
 Converts a 32 bits integral number where value is in mB as a floating point number.
KTL_API KInt32 k_doubleTomB (KDouble level)
 Converts a floating point number as a 32 bits integral number where value is in mB.
KTL_API void k_convertFloatToInt (KFloat *fIn, KUInt16 *out, KInt32 frame)
 Converts an array of floating point numbers as an array of 16 bits unsigned integral number.
KTL_API void k_convertDoubleToInt (KDouble *dIn, KInt16 *out, KInt32 frame)
 Converts an array of floating point number as an array of 16 bits unsigned integral number.
KTL_API void k_convertIntToDouble (KInt16 *in, KDouble *out, KInt32 frame)
 Converts an array of 16 bits unsigned integral number as an array of floating point number.
KTL_API void k_convertIntTo2Double (KInt16 *in, KDouble **out, KInt32 samples)
 Converts an array of 16 bits integral number as a 2-D array of floating point numbers.
KTL_API void k_convertIntTo2Float (KInt16 *in, KFloat **out, KInt32 samples)
 Converts an array of 16 bits integral number as a 2-D array of floating point numbers.
KTL_API void k_convertDoubleTo2Float (KDouble *in, KFloat **out, KInt32 samples)
 Converts an array of double number as a 2-D array of floating point numbers.
KTL_API void k_convert2DoubleToInt (KDouble **in, KInt16 *out, KInt32 samples)
 Converts a 2-D array of floating point numbers as an array of 16 bits integral number.
KTL_API void k_convert2FloatToDouble (KFloat **pIn, KDouble *pOut, KInt32 iSamples)
 Converts a 2-D array of floating point numbers as an array of double number.
KTL_API void k_convertIntToFloat (KInt16 *in, KFloat *out, KInt32 frame)
 Converts an array of 16 bits integral numbers as an array of floating point numbers.
KTL_API void k_convertFloatToDouble (KFloat *in, KDouble *out, KInt32 frame)
 Converts an array of floating point numbers as an array of double numbers.
KTL_API void k_convertInt16ToInt32 (KInt16 *in, KInt32 *out, KInt32 frame)
 Converts an array of 16 bits integral numbers as an array of 32 bits integral numbers.
KTL_API void k_convertInt16ToInt16 (KInt16 *in, KInt16 *out, KInt32 frame)
 Copies an array of 16 bits integral numbers in an another array of 16 bits integral numbers.
KTL_API KInt16 k_convert_i16LE_to_i16BE (KInt16 i)
 Converts a 16 bits little endian integral number as a 16 bits big endian integral number.
KTL_API KInt32 k_convert_i32LE_to_i32BE (KInt32 i)
 Converts a 32 bits little endian integral number as a 32 bits big endian integral number.
KTL_API KInt64 k_convert_i64LE_to_i64BE (KInt64 i)
 Converts a 64 bits little endian integral number as a 64 bits big endian integral number.


Detailed Description

Tests functions of KToolLib - convert.

Version:
KToolLib-1.0
Author:
Fabien Gallot
Date:
30/03/2009
Note:
Copyright © 2008-2010 iKlax Media SAS (www.iklaxmedia.com). All rights reserved.

Define Documentation

#define k_convert_i16BE_to_i16LE  )     k_convert_i16LE_to_i16BE (i)
 

Converts a 16 bits big endian integral number as a 16 bits little endian integral number.

Parameters:
i the 16 bits big endian integral number to be converted
Returns:
the converted 16 bits little endian integral number

#define k_convert_i32BE_to_i32LE  )     k_convert_i32LE_to_i32BE (i)
 

Converts a 32 bits big endian integral number as a 32 bits little endian integral number.

Parameters:
i the 32 bits big endian integral number to be converted
Returns:
the converted 32 bits little endian integral number

#define k_convert_i64BE_to_i64LE  )     k_convert_i64LE_to_i64BE (i)
 

Converts a 64 bits big endian integral number as a 64 bits little endian integral number.

Parameters:
i the 64 bits big endian integral number to be converted
Returns:
the converted 64 bits little endian integral number

#define k_intToString  )     _k_intToString (n, __K_FILE__, __K_LINE__)
 

Converts a 64 bits integral number as a string.

Allocates the necessary memory that must be freed after its used

Parameters:
n the 64 bits integral number to be converted
Returns:
the converted string


Function Documentation

KTL_API KString _k_intToString KInt64  n,
KString  sFile,
KInt32  iLine
 

Converts a 64 bits integral number as a string.

Allocates the necessary memory that must be freed after its used

Warning:
do not use directly this function. Prefer k_intToString
Parameters:
n the 64 bits integral number to be converted
sFile the file name where this function is called
iLine the line number where this function is called
Returns:
the converted string

KTL_API KDouble k_atof KString  str  ) 
 

Parses the string and interpreting its content as a floating point number.

Identical to atof(a) of <stdlib.h>

Parameters:
str the string to be converted
Returns:
the converted floating point number

0.0 if no valid conversion could be performed

HUGE_VAL if the correct value is out of the range of representable values

KTL_API KInt k_atoi KCString  str  ) 
 

Parses a string and interpreting its content as an integral number.

Identical to atoi(a) of <stdlib.h>

Parameters:
str the string to be converted
Returns:
the converted integral number

0 if no valid conversion could be performed

INT_MAX or INT_MIN if the correct value is out of the range of representable values

KTL_API KDouble k_cBToDouble KInt32  cB  ) 
 

Converts a 32 bits integral number where value is in cB as a floating point number.

Parameters:
cB the 32 bits integral number where value is in cB to be converted
Returns:
the converted floating point number

KTL_API void k_convert2DoubleToInt KDouble **  in,
KInt16 out,
KInt32  samples
 

Converts a 2-D array of floating point numbers as an array of 16 bits integral number.

out[0][k] -> in[k*2] out[1][k] -> in[k*2+1]

Parameters:
in the 2-D array of floating point numbers to be converted
out the array of converted 16 bits integral numbers
samples the number of converted 16 bits integral numbers

KTL_API void k_convert2FloatToDouble KFloat **  pIn,
KDouble pOut,
KInt32  iSamples
 

Converts a 2-D array of floating point numbers as an array of double number.

pOut[0][k] -> pIn[k*2] pOut[1][k] -> pIn[k*2+1]

Parameters:
pIn the 2-D array of floating point numbers to be converted
pOut the array of converted 16 bits integral numbers
iSamples the number of converted 16 bits integral numbers

KTL_API KInt16 k_convert_i16LE_to_i16BE KInt16  i  ) 
 

Converts a 16 bits little endian integral number as a 16 bits big endian integral number.

Parameters:
i the 16 bits little endian integral number to be converted
Returns:
the converted 16 bits big endian integral number

KTL_API KInt32 k_convert_i32LE_to_i32BE KInt32  i  ) 
 

Converts a 32 bits little endian integral number as a 32 bits big endian integral number.

Parameters:
i the 32 bits little endian integral number to be converted
Returns:
the converted 32 bits big endian integral number

KTL_API KInt64 k_convert_i64LE_to_i64BE KInt64  i  ) 
 

Converts a 64 bits little endian integral number as a 64 bits big endian integral number.

Parameters:
i the 64 bits little endian integral number to be converted
Returns:
the converted 64 bits big endian integral number

KTL_API void k_convertDoubleTo2Float KDouble in,
KFloat **  out,
KInt32  samples
 

Converts an array of double number as a 2-D array of floating point numbers.

in[k*2] -> out[0][k] in[k*2+1] -> out[1][k]

Parameters:
in the array of double number to be converted
out the 2-D array of converted floating point numbers
samples the number of double number to be converted

KTL_API void k_convertDoubleToInt KDouble dIn,
KInt16 out,
KInt32  frame
 

Converts an array of floating point number as an array of 16 bits unsigned integral number.

Parameters:
dIn the array of floating point number to be converted
out the array of converted 16 bits signed integral numbers
frame the number of floating point number to be converted

KTL_API void k_convertFloatToDouble KFloat in,
KDouble out,
KInt32  frame
 

Converts an array of floating point numbers as an array of double numbers.

Parameters:
in the array of floating point number to be converted
out the array of converted double point numbers
frame the number of converted double point numbers

KTL_API void k_convertFloatToInt KFloat fIn,
KUInt16 out,
KInt32  frame
 

Converts an array of floating point numbers as an array of 16 bits unsigned integral number.

Parameters:
fIn the array of floating point number to be converted
out the array of converted 16 bits unsigned integral numbers
frame the number of floating point number to be converted

KTL_API void k_convertInt16ToInt16 KInt16 in,
KInt16 out,
KInt32  frame
 

Copies an array of 16 bits integral numbers in an another array of 16 bits integral numbers.

Parameters:
in the array of 16 bits integral numbers to be copied
out the array in which the array in is copied
frame the number of copied 16 bits integral numbers

KTL_API void k_convertInt16ToInt32 KInt16 in,
KInt32 out,
KInt32  frame
 

Converts an array of 16 bits integral numbers as an array of 32 bits integral numbers.

Parameters:
in the array of 16 bits integral numbers to be converted
out the array of converted 32 bits integral numbers
frame the number of converted 32 bits integral numbers

KTL_API void k_convertIntTo2Double KInt16 in,
KDouble **  out,
KInt32  samples
 

Converts an array of 16 bits integral number as a 2-D array of floating point numbers.

in[k*2] -> out[0][k] in[k*2+1] -> out[1][k]

Parameters:
in the array of 16 bits integral number to be converted
out the 2-D array of converted floating point numbers
samples the number of 16 bits integral number to be converted

KTL_API void k_convertIntTo2Float KInt16 in,
KFloat **  out,
KInt32  samples
 

Converts an array of 16 bits integral number as a 2-D array of floating point numbers.

in[k*2] -> out[0][k] in[k*2+1] -> out[1][k]

Parameters:
in the array of 16 bits integral number to be converted
out the 2-D array of converted floating point numbers
samples the number of 16 bits integral number to be converted

KTL_API void k_convertIntToDouble KInt16 in,
KDouble out,
KInt32  frame
 

Converts an array of 16 bits unsigned integral number as an array of floating point number.

Parameters:
in the array of 16 bits integral number to be converted
out the array of converted floating point numbers
frame the number of 16 bits integral number to be converted

KTL_API void k_convertIntToFloat KInt16 in,
KFloat out,
KInt32  frame
 

Converts an array of 16 bits integral numbers as an array of floating point numbers.

Parameters:
in the array of 16 bits integral number to be converted
out the array of converted floating point numbers
frame the number of converted floating point numbers

KTL_API KString k_doublearrayToString KDouble darray,
KInt  n
 

Converts an array of double as a string Introduces spaces between the converted values Allocates the necessary memory that must be freed after its used.

Parameters:
darray the array of double to be converted
n the number of double to be converted
Returns:
the converted string

knull if no valid conversion could be performed

KTL_API KInt32 k_doubleToCB KDouble  level  ) 
 

Converts a floating point number as a 32 bits integral number where value is in cB.

Parameters:
level the floating point number to be converted
Returns:
the converted 32 bits integral number where value is in cB

K_MIN_CB if the correct value is out of the range of representable values

KTL_API KString k_doubleToDBString KDouble  n  ) 
 

Converts a floating point number as a string with one digit after the decimal point.

Allocates the necessary memory that must be freed after its used

Parameters:
n the floating point number to be converted
Returns:
the converted string or knull if no valid conversion could be performed

KTL_API KInt32 k_doubleTomB KDouble  level  ) 
 

Converts a floating point number as a 32 bits integral number where value is in mB.

Parameters:
level the floating point number to be converted
Returns:
the converted 32 bits integral number where value is in mB

K_MIN_DB*10 if the correct value is out of the range of representable values

KTL_API KString k_doubleToString KDouble  n  ) 
 

Converts a floating point number as a string Allocates the necessary memory that must be freed after its used.

Parameters:
n the floating point number to be converted
Returns:
the converted string

knull if no valid conversion could be performed

KTL_API KInt32 k_float10_to_i32 KUChar pBytes  ) 
 

Converts a floating point number represented by 10 bytes as a 32 bits integral number.

Parameters:
pBytes the floating point number to be converted
Returns:
the converted 32 bits integral number

0 if the floating point number is negative

1 if the floating point number is less than 1

0x4000000 or 800000000 is the floating point number is too big

KTL_API KUInt32 k_hexastrtoi KString  str  ) 
 

Converts the hexadecimal string as an unsigned 32 bits integral number.

Parameters:
str the hexadecimal string to be converted
Returns:
the converted unsigned 32 bits integral number

0 if no valid conversion could be performed

KTL_API k_size_t k_i64_to_sizet const KInt64  n  ) 
 

Converts a 64 bit integer in k_size_t.

Parameters:
n the 64 bits integer to be converted
Returns:
the converted 64 bits integer

0 if no valid conversion could be performed

KTL_API KWString k_intToWString KInt  n  ) 
 

Converts an integral number as an unicode string Allocates the necessary memory that must be freed after its used.

Parameters:
n the integer to be converted
Returns:
the converted unicode string

KTL_API KString k_itoa KInt  n,
KString  str,
KInt  len
 

Converts an integer to a null-terminated string using the specified base and stores the result in an array.

Parameters:
n the integer to be converted
str the string where to store the resulting null-terminated string
len the length of the resulting string
Returns:
the resulting string

KTL_API KDouble k_mBToDouble KInt32  level  ) 
 

Converts a 32 bits integral number where value is in mB as a floating point number.

Parameters:
level the 32 bits integral number where value is in mB to be converted
Returns:
the converted floating point number

KTL_API KInt k_stringToDoublearray KString  string,
KDouble darray,
KInt  n
 

Converts a string as a an array of double.

Parameters:
string the string to be converted
darray an allocated array of double
n the number of double in the array
Returns:
the number of double read and then converted

0 if no valid conversion could be performed

KTL_API KWString k_stringToWString KCString  string  ) 
 

Converts an ASCII string as an unicode one Allocates the necessary memory that must be freed after its used.

Parameters:
string the ASCII string to be converted
Returns:
the converted unicode string

knull if no valid conversion could be performed

KTL_API KDouble k_strtod KString  str  ) 
 

Parses the string and interpreting its content as a floating point number.

Identical to strtod(str,NULL) of <stdlib.h>

Parameters:
str the string to be converted
Returns:
the converted floating point number

0.0 if no valid conversion could be performed

HUGE_VAL if the correct value is out of the range of representable values

KTL_API KInt64 k_wStringToInt KWString  string  ) 
 

Converts an unicode string as a 64 bits integral number.

Parameters:
string the unicode string to be converted
Returns:
the converted 64 bits integral number

KTL_API KString k_wStringToString KWString  wString  ) 
 

Converts an unicode string as an ASCII one Allocates the necessary memory that must be freed after its used.

Parameters:
wString the unicode string to be converted
Returns:
the converted ASCII string

knull if no valid conversion could be performed


Generated on Tue Mar 9 10:49:29 2010 for iKlax Tools Library (KToolLib) by doxygen 1.3.8