CodePorting.Translator Cs2Cpp
CodePorting.Translator.Cs2Cpp.Framework
bit_converter_le.h
1
2#ifndef __BitConverterLE_h__
3#define __BitConverterLE_h__
4
5#include "system/array.h"
6#include "fwd.h"
7
8namespace Mono { namespace Security {
9
14 {
15 private:
19 static System::ArrayPtr<uint8_t> GetUShortBytes(const uint8_t *bytes);
23 static System::ArrayPtr<uint8_t> GetUIntBytes(const uint8_t *bytes);
27 static System::ArrayPtr<uint8_t> GetULongBytes(const uint8_t *bytes);
28
29 public:
33 static ASPOSECPP_SHARED_API System::ArrayPtr<uint8_t> GetBytes(bool value);
37 static ASPOSECPP_SHARED_API System::ArrayPtr<uint8_t> GetBytes(char_t value);
41 static ASPOSECPP_SHARED_API System::ArrayPtr<uint8_t> GetBytes(int16_t value);
45 static ASPOSECPP_SHARED_API System::ArrayPtr<uint8_t> GetBytes(int value);
49 static ASPOSECPP_SHARED_API System::ArrayPtr<uint8_t> GetBytes(int64_t value);
53 static ASPOSECPP_SHARED_API System::ArrayPtr<uint8_t> GetBytes(uint16_t value);
57 static ASPOSECPP_SHARED_API System::ArrayPtr<uint8_t> GetBytes(uint32_t value);
61 static ASPOSECPP_SHARED_API System::ArrayPtr<uint8_t> GetBytes(uint64_t value);
65 static ASPOSECPP_SHARED_API System::ArrayPtr<uint8_t> GetBytes(float value);
69 static ASPOSECPP_SHARED_API System::ArrayPtr<uint8_t> GetBytes(double value);
70
71 private:
76 static void UShortFromBytes(uint8_t* dst, const System::ArrayPtr<uint8_t>& src, int startIndex);
81 static void UIntFromBytes(uint8_t *dst, const System::ArrayPtr<uint8_t>& src, int startIndex);
86 static void ULongFromBytes(uint8_t *dst, const System::ArrayPtr<uint8_t>& src, int startIndex);
87
88 public:
93 static ASPOSECPP_SHARED_API bool ToBoolean(const System::ArrayPtr<uint8_t>& value, int startIndex);
98 static ASPOSECPP_SHARED_API char_t ToChar(const System::ArrayPtr<uint8_t>& value, int startIndex);
103 static ASPOSECPP_SHARED_API int16_t ToInt16(const System::ArrayPtr<uint8_t>& value, int startIndex);
108 static ASPOSECPP_SHARED_API int ToInt32(const System::ArrayPtr<uint8_t>& value, int startIndex);
113 static ASPOSECPP_SHARED_API int64_t ToInt64(const System::ArrayPtr<uint8_t>& value, int startIndex);
118 static ASPOSECPP_SHARED_API uint16_t ToUInt16(const System::ArrayPtr<uint8_t>& value, int startIndex);
123 static ASPOSECPP_SHARED_API uint32_t ToUInt32(const System::ArrayPtr<uint8_t>& value, int startIndex);
128 static ASPOSECPP_SHARED_API uint64_t ToUInt64(const System::ArrayPtr<uint8_t>& value, int startIndex);
133 static ASPOSECPP_SHARED_API float ToSingle(const System::ArrayPtr<uint8_t>& value, int startIndex);
138 static ASPOSECPP_SHARED_API double ToDouble(const System::ArrayPtr<uint8_t>& value, int startIndex);
139 };
140
141}}
142
143
144#endif //#ifndef __BITCONVERTERLE__
Bit converter implementation that works with little endian representation. This is a static type with...
Definition: bit_converter_le.h:14
static System::ArrayPtr< uint8_t > GetBytes(int value)
Gets byte representation of integer.
static System::ArrayPtr< uint8_t > GetBytes(uint64_t value)
Gets byte representation of unsigned long long.
static char_t ToChar(const System::ArrayPtr< uint8_t > &value, int startIndex)
Converts byte representation to char.
static int64_t ToInt64(const System::ArrayPtr< uint8_t > &value, int startIndex)
Converts byte representation to long long.
static uint32_t ToUInt32(const System::ArrayPtr< uint8_t > &value, int startIndex)
Converts byte representation to unsigned integer.
static System::ArrayPtr< uint8_t > GetBytes(uint32_t value)
Gets byte representation of unsigned integer.
static System::ArrayPtr< uint8_t > GetBytes(bool value)
Gets byte representation of boolean.
static System::ArrayPtr< uint8_t > GetBytes(char_t value)
Gets byte representation of char.
static System::ArrayPtr< uint8_t > GetBytes(float value)
Gets byte representation of single precision float.
static int ToInt32(const System::ArrayPtr< uint8_t > &value, int startIndex)
Converts byte representation to integer.
static int16_t ToInt16(const System::ArrayPtr< uint8_t > &value, int startIndex)
Converts byte representation to short.
static System::ArrayPtr< uint8_t > GetBytes(double value)
Gets byte representation of double precision float.
static bool ToBoolean(const System::ArrayPtr< uint8_t > &value, int startIndex)
Converts byte representation to boolean.
static float ToSingle(const System::ArrayPtr< uint8_t > &value, int startIndex)
Converts byte representation to single precision float.
static System::ArrayPtr< uint8_t > GetBytes(int64_t value)
Gets byte representation of long long.
static uint16_t ToUInt16(const System::ArrayPtr< uint8_t > &value, int startIndex)
Converts byte representation to unsigned short.
static uint64_t ToUInt64(const System::ArrayPtr< uint8_t > &value, int startIndex)
Converts byte representation to unsigned long long.
static System::ArrayPtr< uint8_t > GetBytes(uint16_t value)
Gets byte representation of unsigned short.
static System::ArrayPtr< uint8_t > GetBytes(int16_t value)
Gets byte representation of short int.
static double ToDouble(const System::ArrayPtr< uint8_t > &value, int startIndex)
Converts byte representation to double precision float.
Pointer class to wrap types being allocated on heap. Use it to manage memory for classes inheriting O...
Definition: smart_ptr.h:180
Definition: bit_converter_le.h:8