Global Using Namespace in Header

This commit is contained in:
2025-12-09 21:58:57 +01:00
parent c9c4c0fac2
commit 15014d8542
12 changed files with 47 additions and 42 deletions

View File

@ -50,7 +50,7 @@ public:
uint16_t u16DriveIndex = 0U; // Index of TUI list uint16_t u16DriveIndex = 0U; // Index of TUI list
private: private:
string sPath; std::string sPath;
time_t u32Timestamp = 0U; // unix timestamp for detecting a frozen drive time_t u32Timestamp = 0U; // unix timestamp for detecting a frozen drive
double d32TaskPercentage = 0U; // in percent for Shred (1 to 100) double d32TaskPercentage = 0U; // in percent for Shred (1 to 100)
time_t u32TimestampTaskStart = 0U; // unix timestamp for duration of an action time_t u32TimestampTaskStart = 0U; // unix timestamp for duration of an action
@ -58,9 +58,9 @@ private:
struct struct
{ {
string sModelFamily; std::string sModelFamily;
string sModelName; std::string sModelName;
string sSerial; std::string sSerial;
uint64_t u64Capacity = 0U; // in byte uint64_t u64Capacity = 0U; // in byte
uint32_t u32ErrorCount = 0U; uint32_t u32ErrorCount = 0U;
uint32_t u32PowerOnHours = 0U; // in hours uint32_t u32PowerOnHours = 0U; // in hours
@ -73,15 +73,15 @@ private:
protected: protected:
public: public:
Drive(string path) Drive(std::string path)
{ {
this->sPath = path; this->sPath = path;
} }
string getPath(void); std::string getPath(void);
string getModelFamily(void); std::string getModelFamily(void);
string getModelName(void); std::string getModelName(void);
string getSerial(void); std::string getSerial(void);
uint64_t getCapacity(void); // in byte uint64_t getCapacity(void); // in byte
uint32_t getErrorCount(void); uint32_t getErrorCount(void);
uint32_t getPowerOnHours(void); // in hours uint32_t getPowerOnHours(void); // in hours
@ -89,20 +89,20 @@ public:
uint32_t getTemperature(void); // in Fahrenheit, just kidding: degree Celsius uint32_t getTemperature(void); // in Fahrenheit, just kidding: degree Celsius
void checkFrozenDrive(void); void checkFrozenDrive(void);
void setDriveSMARTData(string modelFamily, void setDriveSMARTData(std::string modelFamily,
string modelName, std::string modelName,
string serial, std::string serial,
uint64_t capacity, uint64_t capacity,
uint32_t errorCount, uint32_t errorCount,
uint32_t powerOnHours, uint32_t powerOnHours,
uint32_t powerCycles, uint32_t powerCycles,
uint32_t temperature); uint32_t temperature);
string sCapacityToText(); std::string sCapacityToText();
string sErrorCountToText(); std::string sErrorCountToText();
string sPowerOnHoursToText(); std::string sPowerOnHoursToText();
string sPowerCyclesToText(); std::string sPowerCyclesToText();
string sTemperatureToText(); std::string sTemperatureToText();
void setTaskPercentage(double d32TaskPercentage); void setTaskPercentage(double d32TaskPercentage);
double getTaskPercentage(void); double getTaskPercentage(void);

View File

@ -56,9 +56,6 @@
#include <sstream> #include <sstream>
#include <iomanip> #include <iomanip>
#include <signal.h> #include <signal.h>
using namespace std;
#include "drive.h" #include "drive.h"
#include "smart.h" #include "smart.h"
#include "shred.h" #include "shred.h"

View File

@ -19,15 +19,15 @@ public:
private: private:
SMART(void); SMART(void);
static bool parseExitStatus(string sLine, uint8_t &status); static bool parseExitStatus(std::string sLine, uint8_t &status);
static bool parseModelFamily(string sLine, string &modelFamily); static bool parseModelFamily(std::string sLine, std::string &modelFamily);
static bool parseModelName(string sLine, string &modelName); static bool parseModelName(std::string sLine, std::string &modelName);
static bool parseSerial(string sLine, string &serial); static bool parseSerial(std::string sLine, std::string &serial);
static bool parseCapacity(string sLine, uint64_t &capacity); static bool parseCapacity(std::string sLine, uint64_t &capacity);
static bool parseErrorCount(string sLine, uint32_t &errorCount); static bool parseErrorCount(std::string sLine, uint32_t &errorCount);
static bool parsePowerOnHours(string sLine, uint32_t &powerOnHours); static bool parsePowerOnHours(std::string sLine, uint32_t &powerOnHours);
static bool parsePowerCycles(string sLine, uint32_t &powerCycles); static bool parsePowerCycles(std::string sLine, uint32_t &powerCycles);
static bool parseTemperature(string sLine, uint32_t &temperature); static bool parseTemperature(std::string sLine, uint32_t &temperature);
}; };
#endif // SMART_H_ #endif // SMART_H_

View File

@ -47,16 +47,16 @@ public:
static void initTUI(); static void initTUI();
void updateTUI(list<Drive> *plistDrives, uint8_t u8SelectedEntry); void updateTUI(std::list<Drive> *plistDrives, uint8_t u8SelectedEntry);
static enum UserInput readUserInput(); static enum UserInput readUserInput();
static void terminateTUI(); static void terminateTUI();
private: private:
static string sCpuUsage; static std::string sCpuUsage;
static string sRamUsage; static std::string sRamUsage;
static string sLocalTime; static std::string sLocalTime;
WINDOW *overview; WINDOW *overview;
WINDOW *systemview; WINDOW *systemview;
@ -69,17 +69,17 @@ private:
static WINDOW *createOverViewWindow(int iXSize, int iYSize); static WINDOW *createOverViewWindow(int iXSize, int iYSize);
static WINDOW *createDetailViewWindow(int iXSize, int iYSize, int iXStart, Drive drive); static WINDOW *createDetailViewWindow(int iXSize, int iYSize, int iXStart, Drive drive);
static WINDOW *overwriteDetailViewWindow(int iXSize, int iYSize, int iXStart); 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 *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 *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 *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, string sPath, string sModelFamily, string sModelName, string sSerial, string sProgress); 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, string sPath, uint32_t u32PowerOnHours, uint32_t u32PowerCycles, uint32_t u32ErrorCount, uint32_t u32Temperature); 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, string sPath, string sModelFamily, string sModelName, string sSerial, uint32_t u32Checksum); 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); void displaySelectedDrive(Drive drive, int stdscrX, int stdscrY);
string formatTimeDuration(time_t u32Duration); std::string formatTimeDuration(time_t u32Duration);
string formatSpeed(time_t u32ShredTimeDelta, unsigned long ulWrittenBytes); std::string formatSpeed(time_t u32ShredTimeDelta, unsigned long ulWrittenBytes);
static void vTruncateText(string *psText, uint16_t u16MaxLenght); static void vTruncateText(std::string *psText, uint16_t u16MaxLenght);
}; };
#endif // TUI_H_ #endif // TUI_H_

View File

@ -6,6 +6,7 @@
*/ */
#include "../include/reHDD.h" #include "../include/reHDD.h"
using namespace std;
/** /**
* \brief delete drive with wipefs * \brief delete drive with wipefs
@ -34,7 +35,7 @@ void Delete::deleteDrive(Drive *drive)
if (drive->bWasShredStarted == false) 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"); FILE *deleteCmdOutput = popen(cpComand, "r");
while ((getline(&cLine, &len, deleteCmdOutput)) != -1) while ((getline(&cLine, &len, deleteCmdOutput)) != -1)

View File

@ -6,6 +6,7 @@
*/ */
#include "../include/reHDD.h" #include "../include/reHDD.h"
using namespace std;
string Drive::getPath(void) string Drive::getPath(void)
{ {

View File

@ -6,6 +6,7 @@
*/ */
#include "../include/reHDD.h" #include "../include/reHDD.h"
using namespace std;
/** /**
* \brief app entry point * \brief app entry point

View File

@ -6,6 +6,7 @@
*/ */
#include "../include/reHDD.h" #include "../include/reHDD.h"
using namespace std;
bool Printer::instanceFlag = false; bool Printer::instanceFlag = false;
Printer *Printer::single = NULL; Printer *Printer::single = NULL;

View File

@ -6,6 +6,7 @@
*/ */
#include "../include/reHDD.h" #include "../include/reHDD.h"
using namespace std;
static int fdNewDrivesInformPipe[2]; // File descriptor for pipe that informs if new drives are found static int fdNewDrivesInformPipe[2]; // File descriptor for pipe that informs if new drives are found

View File

@ -6,6 +6,7 @@
*/ */
#include "../include/reHDD.h" #include "../include/reHDD.h"
using namespace std;
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"

View File

@ -6,6 +6,7 @@
*/ */
#include "../include/reHDD.h" #include "../include/reHDD.h"
using namespace std;
/** /**
* \brief get and set S.M.A.R.T. values in Drive * \brief get and set S.M.A.R.T. values in Drive

View File

@ -6,6 +6,7 @@
*/ */
#include "../include/reHDD.h" #include "../include/reHDD.h"
using namespace std;
static std::mutex mxUIrefresh; static std::mutex mxUIrefresh;