44 lines
848 B
C
44 lines
848 B
C
|
|
#ifndef STM32API_CCSTRING_H
|
||
|
|
#define STM32API_CCSTRING_H
|
||
|
|
#include <cstdio>
|
||
|
|
|
||
|
|
#define PC
|
||
|
|
#ifdef PC
|
||
|
|
#include <cstring>
|
||
|
|
#include "strstream"
|
||
|
|
#include "sstream"
|
||
|
|
#include <iostream>
|
||
|
|
#include <string>
|
||
|
|
#include <locale>
|
||
|
|
#include <codecvt>
|
||
|
|
#include <algorithm>
|
||
|
|
#include "CCEncode.h"
|
||
|
|
#include "CCByteArray.h"
|
||
|
|
|
||
|
|
using CCStream = std::strstream;
|
||
|
|
class CCString : public std::string
|
||
|
|
{
|
||
|
|
public:
|
||
|
|
using std::string::string;
|
||
|
|
CCString(basic_string<char> basicString);
|
||
|
|
CCString Format(const CCString& EncodeStr);
|
||
|
|
CCByteArray getByteArray(const CCString& EncodeStr = "UTF-8");
|
||
|
|
int to_int();
|
||
|
|
float to_float();
|
||
|
|
double to_double();
|
||
|
|
template<typename... T>
|
||
|
|
static CCString format(int Size,const char *str,T&&... arg) {
|
||
|
|
char data[Size] = {0};
|
||
|
|
sprintf(data,str,arg...);
|
||
|
|
return data;
|
||
|
|
}
|
||
|
|
};
|
||
|
|
#else
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
#endif
|
||
|
|
|
||
|
|
#endif
|
||
|
|
|