#pragma once
#include <windows.h>
#include <string>
#include <cstdint>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <cstddef>
#include <vector>

#include "dt.h"
using std::string;

#ifdef FH_CONVERT_EXPORTS
#define FH_CONVERT_DLL_API __declspec(dllexport)
#else
#define FH_CONVERT_DLL_API //__declspec(dllimport)
#endif

class __declspec(dllexport) FHConvert
{
public:
	static unsigned short GetLowBit(unsigned int v);
	static unsigned short GetHightBit(unsigned int v);
	static unsigned int MergeHightLowBit(unsigned short hightbit, unsigned short lowbit);

	static double RoundDouble(double number, unsigned int bits);
	static LONG Char2Long(const CHAR *str);
	static INT Char2Int(const CHAR *str);
	static DOUBLE Char2Double(const CHAR *str);
	static bool Char2Bool(const CHAR *str);

	static LONG DoubleToLong(double value);
	//static void HexStr2Bytes(string hexStr,byte *byteStr,int byteLen);

	static int Unicode2Utf8(const wchar_t* wszString, char *szUtf8, int szLen);
	static int Utf82Unicode(const char* szUtf8, wchar_t *wszString, int wszLen);
	static int Ansi2Unicode(const char* szAnsi, wchar_t *wszString, int wszLen);
	static int Unicode2Ansi(const wchar_t* wszString, char *szAnsi, int szLen);
	static int Ansi2Utf8(const char* szAnsi,char *szUtf8, int szLen);
	static int Utf82Ansi(const char* szUtf8,char *szAnsi, int szLen);

	static int CopyStr(char *outbuf, int buflen, const char *format, ...);

	static unsigned long GetSysTime(void);
	static unsigned long DiffSysTime(unsigned long ulStime);

	static char* GetCurTime();
	static void GetCurTimeMill(char* pCurTime, int len);
	static unsigned long long GetSysTimeMill(void);
	static unsigned long long DiffSysTimeMill(unsigned long long ulStime);

	static void _Sleep(unsigned long ulDelay);

	//���ָ��������ַ������Ϊһ��������
	static LONG ParseNumber(string strInput, CHAR chKey, std::vector<INT>& vecNum);
	static LONG ParseNumber(string strInput, CHAR chKey, std::vector<UINT>& vecNum);

};