X-Git-Url: https://code.wpia.club/?a=blobdiff_plain;f=src%2Futil.h;h=529820adab8d0106047e8a17acb98ad886a31c05;hb=8c36452a1422eea1631cff4d90a3b801ed05cd77;hp=94ca64fa96b8117cc988916f28fabac34c05b2c4;hpb=956e14c8c610af488cdb94ae57ae1b4aa819aa83;p=cassiopeia.git diff --git a/src/util.h b/src/util.h old mode 100644 new mode 100755 index 94ca64f..529820a --- a/src/util.h +++ b/src/util.h @@ -1,6 +1,28 @@ #pragma once #include +#include +#include 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();