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
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);

View File

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

View File

@ -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_

View File

@ -47,16 +47,16 @@ public:
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 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_

View File

@ -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)

View File

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

View File

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

View File

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

View File

@ -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

View File

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

View File

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

View File

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