diff --git a/include/drive.h b/include/drive.h index eae0643..071b08a 100644 --- a/include/drive.h +++ b/include/drive.h @@ -50,7 +50,7 @@ public: uint16_t u16DriveIndex = 0U; // Index of TUI list private: - string sPath; + std::string sPath; time_t u32Timestamp = 0U; // unix timestamp for detecting a frozen drive double d32TaskPercentage = 0U; // in percent for Shred (1 to 100) time_t u32TimestampTaskStart = 0U; // unix timestamp for duration of an action @@ -58,9 +58,9 @@ private: struct { - string sModelFamily; - string sModelName; - string sSerial; + std::string sModelFamily; + std::string sModelName; + std::string sSerial; uint64_t u64Capacity = 0U; // in byte uint32_t u32ErrorCount = 0U; uint32_t u32PowerOnHours = 0U; // in hours @@ -73,15 +73,15 @@ private: protected: public: - Drive(string path) + Drive(std::string path) { this->sPath = path; } - string getPath(void); - string getModelFamily(void); - string getModelName(void); - string getSerial(void); + std::string getPath(void); + std::string getModelFamily(void); + std::string getModelName(void); + std::string getSerial(void); uint64_t getCapacity(void); // in byte uint32_t getErrorCount(void); uint32_t getPowerOnHours(void); // in hours @@ -89,20 +89,20 @@ public: uint32_t getTemperature(void); // in Fahrenheit, just kidding: degree Celsius void checkFrozenDrive(void); - void setDriveSMARTData(string modelFamily, - string modelName, - string serial, + void setDriveSMARTData(std::string modelFamily, + std::string modelName, + std::string serial, uint64_t capacity, uint32_t errorCount, uint32_t powerOnHours, uint32_t powerCycles, uint32_t temperature); - string sCapacityToText(); - string sErrorCountToText(); - string sPowerOnHoursToText(); - string sPowerCyclesToText(); - string sTemperatureToText(); + std::string sCapacityToText(); + std::string sErrorCountToText(); + std::string sPowerOnHoursToText(); + std::string sPowerCyclesToText(); + std::string sTemperatureToText(); void setTaskPercentage(double d32TaskPercentage); double getTaskPercentage(void); diff --git a/include/reHDD.h b/include/reHDD.h index ad23206..ee71711 100644 --- a/include/reHDD.h +++ b/include/reHDD.h @@ -56,9 +56,6 @@ #include #include #include - -using namespace std; - #include "drive.h" #include "smart.h" #include "shred.h" diff --git a/include/smart.h b/include/smart.h index 735f92e..2d4f4fd 100644 --- a/include/smart.h +++ b/include/smart.h @@ -19,15 +19,15 @@ public: private: SMART(void); - static bool parseExitStatus(string sLine, uint8_t &status); - static bool parseModelFamily(string sLine, string &modelFamily); - static bool parseModelName(string sLine, string &modelName); - static bool parseSerial(string sLine, string &serial); - static bool parseCapacity(string sLine, uint64_t &capacity); - static bool parseErrorCount(string sLine, uint32_t &errorCount); - static bool parsePowerOnHours(string sLine, uint32_t &powerOnHours); - static bool parsePowerCycles(string sLine, uint32_t &powerCycles); - static bool parseTemperature(string sLine, uint32_t &temperature); + static bool parseExitStatus(std::string sLine, uint8_t &status); + static bool parseModelFamily(std::string sLine, std::string &modelFamily); + static bool parseModelName(std::string sLine, std::string &modelName); + static bool parseSerial(std::string sLine, std::string &serial); + static bool parseCapacity(std::string sLine, uint64_t &capacity); + static bool parseErrorCount(std::string sLine, uint32_t &errorCount); + static bool parsePowerOnHours(std::string sLine, uint32_t &powerOnHours); + static bool parsePowerCycles(std::string sLine, uint32_t &powerCycles); + static bool parseTemperature(std::string sLine, uint32_t &temperature); }; #endif // SMART_H_ \ No newline at end of file diff --git a/include/tui.h b/include/tui.h index 9e671e6..d5585d5 100644 --- a/include/tui.h +++ b/include/tui.h @@ -47,16 +47,16 @@ public: static void initTUI(); - void updateTUI(list *plistDrives, uint8_t u8SelectedEntry); + void updateTUI(std::list *plistDrives, uint8_t u8SelectedEntry); static enum UserInput readUserInput(); static void terminateTUI(); private: - static string sCpuUsage; - static string sRamUsage; - static string sLocalTime; + static std::string sCpuUsage; + static std::string sRamUsage; + static std::string sLocalTime; WINDOW *overview; WINDOW *systemview; @@ -69,17 +69,17 @@ private: static WINDOW *createOverViewWindow(int iXSize, int iYSize); static WINDOW *createDetailViewWindow(int iXSize, int iYSize, int iXStart, Drive drive); static WINDOW *overwriteDetailViewWindow(int iXSize, int iYSize, int iXStart); - static WINDOW *createEntryWindow(int iXSize, int iYSize, int iXStart, int iYStart, int iListIndex, string sModelFamily, string sSerial, string sCapacity, string sState, string sTime, string sSpeed, string sTemp, string sConnection, bool bSelected); + static WINDOW *createEntryWindow(int iXSize, int iYSize, int iXStart, int iYStart, int iListIndex, std::string sModelFamily, std::string sSerial, std::string sCapacity, std::string sState, std::string sTime, std::string sSpeed, std::string sTemp, std::string sConnection, bool bSelected); static WINDOW *createSystemStats(int iXSize, int iYSize, int iXStart, int iYStart); static WINDOW *createMenuView(int iXSize, int iYSize, int iXStart, int iYStart, struct MenuState menustate); - static WINDOW *createDialog(int iXSize, int iYSize, int iXStart, int iYStart, string selectedTask, string optionA, string optionB); - static WINDOW *createFrozenWarning(int iXSize, int iYSize, int iXStart, int iYStart, string sPath, string sModelFamily, string sModelName, string sSerial, string sProgress); - static WINDOW *createSmartWarning(int iXSize, int iYSize, int iXStart, int iYStart, string sPath, uint32_t u32PowerOnHours, uint32_t u32PowerCycles, uint32_t u32ErrorCount, uint32_t u32Temperature); - static WINDOW *createZeroChecksumWarning(int iXSize, int iYSize, int iXStart, int iYStart, string sPath, string sModelFamily, string sModelName, string sSerial, uint32_t u32Checksum); + static WINDOW *createDialog(int iXSize, int iYSize, int iXStart, int iYStart, std::string selectedTask, std::string optionA, std::string optionB); + static WINDOW *createFrozenWarning(int iXSize, int iYSize, int iXStart, int iYStart, std::string sPath, std::string sModelFamily, std::string sModelName, std::string sSerial, std::string sProgress); + static WINDOW *createSmartWarning(int iXSize, int iYSize, int iXStart, int iYStart, std::string sPath, uint32_t u32PowerOnHours, uint32_t u32PowerCycles, uint32_t u32ErrorCount, uint32_t u32Temperature); + static WINDOW *createZeroChecksumWarning(int iXSize, int iYSize, int iXStart, int iYStart, std::string sPath, std::string sModelFamily, std::string sModelName, std::string sSerial, uint32_t u32Checksum); void displaySelectedDrive(Drive drive, int stdscrX, int stdscrY); - string formatTimeDuration(time_t u32Duration); - string formatSpeed(time_t u32ShredTimeDelta, unsigned long ulWrittenBytes); - static void vTruncateText(string *psText, uint16_t u16MaxLenght); + std::string formatTimeDuration(time_t u32Duration); + std::string formatSpeed(time_t u32ShredTimeDelta, unsigned long ulWrittenBytes); + static void vTruncateText(std::string *psText, uint16_t u16MaxLenght); }; #endif // TUI_H_ diff --git a/src/delete.cpp b/src/delete.cpp index 01f06b4..ca7d63c 100644 --- a/src/delete.cpp +++ b/src/delete.cpp @@ -6,6 +6,7 @@ */ #include "../include/reHDD.h" +using namespace std; /** * \brief delete drive with wipefs @@ -34,7 +35,7 @@ void Delete::deleteDrive(Drive *drive) if (drive->bWasShredStarted == false) { - //only start delete if the drive was not shredded before + // only start delete if the drive was not shredded before FILE *deleteCmdOutput = popen(cpComand, "r"); while ((getline(&cLine, &len, deleteCmdOutput)) != -1) diff --git a/src/drive.cpp b/src/drive.cpp index 5ae0b7e..56069df 100644 --- a/src/drive.cpp +++ b/src/drive.cpp @@ -6,6 +6,7 @@ */ #include "../include/reHDD.h" +using namespace std; string Drive::getPath(void) { diff --git a/src/main.cpp b/src/main.cpp index 5b1798d..fb91bcc 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -6,6 +6,7 @@ */ #include "../include/reHDD.h" +using namespace std; /** * \brief app entry point diff --git a/src/printer.cpp b/src/printer.cpp index 59ea30f..ead3876 100644 --- a/src/printer.cpp +++ b/src/printer.cpp @@ -6,6 +6,7 @@ */ #include "../include/reHDD.h" +using namespace std; bool Printer::instanceFlag = false; Printer *Printer::single = NULL; diff --git a/src/reHDD.cpp b/src/reHDD.cpp index aa13b32..2156da9 100644 --- a/src/reHDD.cpp +++ b/src/reHDD.cpp @@ -6,6 +6,7 @@ */ #include "../include/reHDD.h" +using namespace std; static int fdNewDrivesInformPipe[2]; // File descriptor for pipe that informs if new drives are found diff --git a/src/shred.cpp b/src/shred.cpp index 906e908..5e5df7a 100644 --- a/src/shred.cpp +++ b/src/shred.cpp @@ -6,6 +6,7 @@ */ #include "../include/reHDD.h" +using namespace std; #ifdef __cplusplus extern "C" diff --git a/src/smart.cpp b/src/smart.cpp index 334f21a..2a10855 100644 --- a/src/smart.cpp +++ b/src/smart.cpp @@ -6,6 +6,7 @@ */ #include "../include/reHDD.h" +using namespace std; /** * \brief get and set S.M.A.R.T. values in Drive diff --git a/src/tui.cpp b/src/tui.cpp index e011eb1..4ec6efa 100644 --- a/src/tui.cpp +++ b/src/tui.cpp @@ -6,6 +6,7 @@ */ #include "../include/reHDD.h" +using namespace std; static std::mutex mxUIrefresh;