X-Git-Url: https://code.wpia.club/?a=blobdiff_plain;ds=sidebyside;f=src%2Futil.h;h=766f7ca3f117aecc447044e8e0d32a5745f5e746;hb=605acfca533ba9eb66e192a18a3af5a847568a03;hp=b0d7fce7928459a8efb5a417a5450d915602fa7b;hpb=fca2260d735fe65cf5376449ba93b6a9148a97b9;p=cassiopeia.git diff --git a/src/util.h b/src/util.h index b0d7fce..766f7ca 100644 --- a/src/util.h +++ b/src/util.h @@ -1,6 +1,28 @@ #pragma once #include +#include +#include -void writeFile( const std::string& content, const std::string& name ); +void writeFile( const std::string& name, const std::string& content ); std::string readFile( const std::string& name ); + +std::string writeBackFile( const std::string& serial, const std::string& cert, const std::string& keydir ); + +std::pair parseDate( const std::string& date ); +std::pair parseMonthInterval( std::time_t t, const std::string& date ); +std::pair parseYearInterval( std::time_t t, const std::string& date ); + +std::unique_ptr openLogfile( const std::string& name ); + +#if __GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ > 8) +#else +namespace std { + template + std::unique_ptr make_unique( Args&& ... args ) { + return std::unique_ptr( new T( std::forward( args )... ) ); + } +} +#endif + +std::string timestamp();