IPBS_Station/SDK/include/CC.h
2025-09-05 08:44:30 +08:00

143 lines
6.5 KiB
C++

#ifndef T_CC_H
#define T_CC_H
#pragma once
#include <sstream>
#include <iomanip>
#include <thread>
#include "iostream"
#include "mutex"
#define CCVar auto
using String = std::string;
typedef std::exception CCException;
typedef std::unique_lock<std::mutex> CCUniqueLock;
namespace CC
{
inline String to_String(int v){
return std::to_string(v);
}
inline String to_String(double v){
return std::to_string(v);
}
inline String to_String(bool v){
return v ? "true" : "false";
}
inline String to_String(const char* v){
return v;
}
inline String to_String(String v){
return v;
}
inline String to_String(void* v){
return std::to_string((size_t)v);
}
template<typename T>
inline void Print(const T& v){
std::cout << v;
}
template<typename T,typename... Args>
inline void Print(const T& v,Args&&... args){
std::cout << v;
Print(args...);
}
template<typename T>
inline void Println(const T& v){
std::cout<< v << std::endl;
}
inline void ErrorPrintln(const String& v){
throw std::out_of_range(v.c_str());
}
inline int LogoTimeMS = 110;
inline void CC_Print_Logo(){
std::cout << " CCCCCCCCCCCCC CCCCCCCCCCCCC AAA PPPPPPPPPPPPPPPPP IIIIIIIIII " << std::endl;
std::this_thread::sleep_for(std::chrono::milliseconds(LogoTimeMS));
std::cout << " CCC::::::::::::C CCC::::::::::::C A:::A P::::::::::::::::P I::::::::I" << std::endl;
std::this_thread::sleep_for(std::chrono::milliseconds(LogoTimeMS));
std::cout << " CC:::::::::::::::C CC:::::::::::::::C A:::::A P::::::PPPPPP:::::P I::::::::I" << std::endl;
std::this_thread::sleep_for(std::chrono::milliseconds(LogoTimeMS));
std::cout << " C:::::CCCCCCCC::::C C:::::CCCCCCCC::::C A:::::::A PP:::::P P:::::PII::::::II" << std::endl;
std::this_thread::sleep_for(std::chrono::milliseconds(LogoTimeMS));
std::cout << " C:::::C CCCCCC C:::::C CCCCCC A:::::::::A P::::P P:::::P I::::I " << std::endl;
std::this_thread::sleep_for(std::chrono::milliseconds(LogoTimeMS));
std::cout << "C:::::C C:::::C A:::::A:::::A P::::P P:::::P I::::I " << std::endl;
std::this_thread::sleep_for(std::chrono::milliseconds(LogoTimeMS));
std::cout << "C:::::C C:::::C A:::::A A:::::A P::::PPPPPP:::::P I::::I " << std::endl;
std::this_thread::sleep_for(std::chrono::milliseconds(LogoTimeMS));
std::cout << "C:::::C C:::::C A:::::A A:::::A P:::::::::::::PP I::::I " << std::endl;
std::this_thread::sleep_for(std::chrono::milliseconds(LogoTimeMS));
std::cout << "C:::::C C:::::C A:::::A A:::::A P::::PPPPPPPPP I::::I " << std::endl;
std::this_thread::sleep_for(std::chrono::milliseconds(LogoTimeMS));
std::cout << "C:::::C C:::::C A:::::AAAAAAAAA:::::A P::::P I::::I " << std::endl;
std::this_thread::sleep_for(std::chrono::milliseconds(LogoTimeMS));
std::cout << "C:::::C C:::::C A:::::::::::::::::::::A P::::P I::::I " << std::endl;
std::this_thread::sleep_for(std::chrono::milliseconds(LogoTimeMS));
std::cout << " C:::::C CCCCCC C:::::C CCCCCC A:::::AAAAAAAAAAAAA:::::A P::::P I::::I " << std::endl;
std::this_thread::sleep_for(std::chrono::milliseconds(LogoTimeMS));
std::cout << " C:::::CCCCCCCC::::C C:::::CCCCCCCC::::C A:::::A A:::::A PP::::::PP II::::::II" << std::endl;
std::this_thread::sleep_for(std::chrono::milliseconds(LogoTimeMS));
std::cout << " CC:::::::::::::::C CC:::::::::::::::C A:::::A A:::::A P::::::::P I::::::::I" << std::endl;
std::this_thread::sleep_for(std::chrono::milliseconds(LogoTimeMS));
std::cout << " CCC::::::::::::C CCC::::::::::::C A:::::A A:::::A P::::::::P I::::::::I" << std::endl;
std::this_thread::sleep_for(std::chrono::milliseconds(LogoTimeMS));
std::cout << " CCCCCCCCCCCCC CCCCCCCCCCCCC AAAAAAA AAAAAAAPPPPPPPPPP IIIIIIIIII" << std::endl;
std::this_thread::sleep_for(std::chrono::milliseconds(LogoTimeMS));
std::cout << " ________________________ "<< std::endl;
std::this_thread::sleep_for(std::chrono::milliseconds(LogoTimeMS));
std::cout << " _:::::::::::::::::::::_ " << std::endl;
std::cout << " ________________________ "<< std::endl;
std::cout << " " << std::endl;
}
}
class CCInt
{
private:
int value;
public:
CCInt() = default;
CCInt(int v){
this->value = v;
}
String to_String() const{
return std::to_string(value);
}
};
class CCDouble
{
private:
double value;
public:
CCDouble() = default;
CCDouble(double v){
this->value = v;
}
String to_String(int x = 5) const{
std::ostringstream stream;
stream << std::fixed << std::setprecision(x) << value;
return stream.str();
}
};
class CCFloat
{
private:
float value;
public:
CCFloat() = default;
CCFloat(float v){
this->value = v;
}
String to_String(int x = 5) const{
std::ostringstream stream;
stream << std::fixed << std::setprecision(x) << value;
return stream.str();
}
};
#endif