ZED Open Capture  v0.6.0
Low level camera driver for the ZED stereo camera family
Public Member Functions | Protected Member Functions | List of all members
sl_oc::tools::SI_ConvertA< SI_CHAR > Class Template Reference

#include <calibration.hpp>

Public Member Functions

 SI_ConvertA (bool a_bStoreIsUtf8)
 
 SI_ConvertA (const SI_ConvertA &rhs)
 
SI_ConvertAoperator= (const SI_ConvertA &rhs)
 
size_t SizeFromStore (const char *a_pInputData, size_t a_uInputDataLen)
 
bool ConvertFromStore (const char *a_pInputData, size_t a_uInputDataLen, SI_CHAR *a_pOutputData, size_t a_uOutputDataSize)
 
size_t SizeToStore (const SI_CHAR *a_pInputData)
 
bool ConvertToStore (const SI_CHAR *a_pInputData, char *a_pOutputData, size_t a_uOutputDataSize)
 

Protected Member Functions

 SI_ConvertA ()
 

Detailed Description

template<class SI_CHAR>
class sl_oc::tools::SI_ConvertA< SI_CHAR >

Null conversion class for MBCS/UTF-8 to char (or equivalent).

Definition at line 2553 of file calibration.hpp.

Constructor & Destructor Documentation

◆ SI_ConvertA() [1/3]

template<class SI_CHAR >
sl_oc::tools::SI_ConvertA< SI_CHAR >::SI_ConvertA ( )
inlineprotected

Definition at line 2557 of file calibration.hpp.

2557  {
2558  }

◆ SI_ConvertA() [2/3]

template<class SI_CHAR >
sl_oc::tools::SI_ConvertA< SI_CHAR >::SI_ConvertA ( bool  a_bStoreIsUtf8)
inline

Definition at line 2561 of file calibration.hpp.

2561  : m_bStoreIsUtf8(a_bStoreIsUtf8) {
2562  }

◆ SI_ConvertA() [3/3]

template<class SI_CHAR >
sl_oc::tools::SI_ConvertA< SI_CHAR >::SI_ConvertA ( const SI_ConvertA< SI_CHAR > &  rhs)
inline

Definition at line 2565 of file calibration.hpp.

2565  {
2566  operator=(rhs);
2567  }
SI_ConvertA & operator=(const SI_ConvertA &rhs)

References sl_oc::tools::SI_ConvertA< SI_CHAR >::operator=().

Member Function Documentation

◆ ConvertFromStore()

template<class SI_CHAR >
bool sl_oc::tools::SI_ConvertA< SI_CHAR >::ConvertFromStore ( const char *  a_pInputData,
size_t  a_uInputDataLen,
SI_CHAR *  a_pOutputData,
size_t  a_uOutputDataSize 
)
inline

Convert the input string from the storage format to SI_CHAR. The storage format is always UTF-8 or MBCS.

Parameters
a_pInputDataData in storage format to be converted to SI_CHAR.
a_uInputDataLenLength of storage format data in bytes. This must be the actual length of the data, including NULL byte if NULL terminated string is required.
a_pOutputDataPointer to the output buffer to received the converted data.
a_uOutputDataSizeSize of the output buffer in SI_CHAR.
Returns
true if all of the input data was successfully converted.

Definition at line 2610 of file calibration.hpp.

2614  {
2615  // ASCII/MBCS/UTF-8 needs no conversion
2616  if (a_uInputDataLen > a_uOutputDataSize) {
2617  return false;
2618  }
2619  memcpy(a_pOutputData, a_pInputData, a_uInputDataLen);
2620  return true;
2621  }

◆ ConvertToStore()

template<class SI_CHAR >
bool sl_oc::tools::SI_ConvertA< SI_CHAR >::ConvertToStore ( const SI_CHAR *  a_pInputData,
char *  a_pOutputData,
size_t  a_uOutputDataSize 
)
inline

Convert the input string to the storage format of this data. The storage format is always UTF-8 or MBCS.

Parameters
a_pInputDataNULL terminated source string to convert. All of the data will be converted including the terminating NULL character.
a_pOutputDataPointer to the buffer to receive the converted string.
a_uOutputDataSizeSize of the output buffer in char.
Returns
true if all of the input data, including the terminating NULL character was successfully converted.

Definition at line 2652 of file calibration.hpp.

2655  {
2656  // calc input string length (SI_CHAR type and size independent)
2657  size_t uInputLen = strlen((const char *) a_pInputData) + 1;
2658  if (uInputLen > a_uOutputDataSize) {
2659  return false;
2660  }
2661 
2662  // ascii/UTF-8 needs no conversion
2663  memcpy(a_pOutputData, a_pInputData, uInputLen);
2664  return true;
2665  }

◆ operator=()

template<class SI_CHAR >
SI_ConvertA& sl_oc::tools::SI_ConvertA< SI_CHAR >::operator= ( const SI_ConvertA< SI_CHAR > &  rhs)
inline

Definition at line 2569 of file calibration.hpp.

2569  {
2570  m_bStoreIsUtf8 = rhs.m_bStoreIsUtf8;
2571  return *this;
2572  }

Referenced by sl_oc::tools::SI_ConvertA< SI_CHAR >::SI_ConvertA().

◆ SizeFromStore()

template<class SI_CHAR >
size_t sl_oc::tools::SI_ConvertA< SI_CHAR >::SizeFromStore ( const char *  a_pInputData,
size_t  a_uInputDataLen 
)
inline

Calculate the number of SI_CHAR required for converting the input from the storage format. The storage format is always UTF-8 or MBCS.

Parameters
a_pInputDataData in storage format to be converted to SI_CHAR.
a_uInputDataLenLength of storage format data in bytes. This must be the actual length of the data, including NULL byte if NULL terminated string is required.
Returns
Number of SI_CHAR required by the string when converted. If there are embedded NULL bytes in the input data, only the string up and not including the NULL byte will be converted.
-1 cast to size_t on a conversion error.

Definition at line 2587 of file calibration.hpp.

2589  {
2590  (void) a_pInputData;
2591  SI_ASSERT(a_uInputDataLen != (size_t) - 1);
2592 
2593  // ASCII/MBCS/UTF-8 needs no conversion
2594  return a_uInputDataLen;
2595  }

◆ SizeToStore()

template<class SI_CHAR >
size_t sl_oc::tools::SI_ConvertA< SI_CHAR >::SizeToStore ( const SI_CHAR *  a_pInputData)
inline

Calculate the number of char required by the storage format of this data. The storage format is always UTF-8 or MBCS.

Parameters
a_pInputDataNULL terminated string to calculate the number of bytes required to be converted to storage format.
Returns
Number of bytes required by the string when converted to storage format. This size always includes space for the terminating NULL character.
-1 cast to size_t on a conversion error.

Definition at line 2633 of file calibration.hpp.

2634  {
2635  // ASCII/MBCS/UTF-8 needs no conversion
2636  return strlen((const char *) a_pInputData) + 1;
2637  }

The documentation for this class was generated from the following file: