Skip to content

Commit

Permalink
Change constexpr statements to use auto instead of char* (#29)
Browse files Browse the repository at this point in the history
Signed-off-by: lbgracioso <[email protected]>
  • Loading branch information
lbgracioso committed Nov 13, 2023
1 parent 41f94ce commit a41f6e8
Show file tree
Hide file tree
Showing 14 changed files with 109 additions and 111 deletions.
2 changes: 1 addition & 1 deletion include/cloysterhpc/presenter/Presenter.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Presenter {

struct Messages {
struct Placeholder {
static constexpr const char* help
static constexpr const auto help
= "We're sorry, but there's no help available for this session";
};
};
Expand Down
16 changes: 8 additions & 8 deletions include/cloysterhpc/presenter/PresenterGeneralSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,23 @@
class PresenterGeneralSettings : public Presenter {
private:
struct Messages {
static constexpr const char* title = "General cluster settings";
static constexpr const auto title = "General cluster settings";

struct General {
static constexpr const char* question
static constexpr const auto question
= "Fill the required data about your new cluster";
static constexpr const char* help
static constexpr const auto help
= Presenter::Messages::Placeholder::help;

static constexpr const char* clusterName = "Cluster Name";
static constexpr const char* companyName = "Company Name";
static constexpr const char* adminEmail = "Administrator e-mail";
static constexpr const auto clusterName = "Cluster Name";
static constexpr const auto companyName = "Company Name";
static constexpr const auto adminEmail = "Administrator e-mail";
};

struct BootTarget {
static constexpr const char* question
static constexpr const auto question
= "Select the boot target for the headnode";
static constexpr const char* help
static constexpr const auto help
= Presenter::Messages::Placeholder::help;
};
};
Expand Down
10 changes: 5 additions & 5 deletions include/cloysterhpc/presenter/PresenterHostId.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
class PresenterHostId : public Presenter {
private:
struct Messages {
static constexpr const char* title = "Hostname settings";
static constexpr const char* question
static constexpr const auto title = "Hostname settings";
static constexpr const auto question
= "Enter the desired hostname and domain name for this machine";
static constexpr const char* help
static constexpr const auto help
= Presenter::Messages::Placeholder::help;

static constexpr const char* hostname = "Hostname";
static constexpr const char* domainName = "Domain name";
static constexpr const auto hostname = "Hostname";
static constexpr const auto domainName = "Domain name";
};

public:
Expand Down
10 changes: 5 additions & 5 deletions include/cloysterhpc/presenter/PresenterInfiniband.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@
class PresenterInfiniband : public Presenter {
private:
struct Messages {
static constexpr const char* title = "Infiniband settings";
static constexpr const char* question
static constexpr const auto title = "Infiniband settings";
static constexpr const auto question
= "Do you have an Infiniband Fabric available?";
static constexpr const char* help
static constexpr const auto help
= Presenter::Messages::Placeholder::help;

struct OFED {
static constexpr const char* question
static constexpr const auto question
= "Choose the desired Infiniband stack";
static constexpr const char* help
static constexpr const auto help
= Presenter::Messages::Placeholder::help;
};
};
Expand Down
2 changes: 1 addition & 1 deletion include/cloysterhpc/presenter/PresenterInstructions.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class PresenterInstructions : public Presenter {
private:
struct Messages {
struct Instructions {
static constexpr const char* message
static constexpr const auto message
= "We will start the installation phase now.\n\nYou will be "
"guided through "
"a series of questions about your HPC cluster so we can "
Expand Down
6 changes: 3 additions & 3 deletions include/cloysterhpc/presenter/PresenterLocale.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
class PresenterLocale : public Presenter {
private:
struct Messages {
static constexpr const char* title = "Locale settings";
static constexpr const char* question = "Pick your default locale";
static constexpr const char* help
static constexpr const auto title = "Locale settings";
static constexpr const auto question = "Pick your default locale";
static constexpr const auto help
= Presenter::Messages::Placeholder::help;
};

Expand Down
30 changes: 15 additions & 15 deletions include/cloysterhpc/presenter/PresenterMailSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,40 +11,40 @@
class PresenterMailSystem : public Presenter {
private:
struct Messages {
static constexpr const char* title = "Mail system settings";
static constexpr const char* question
static constexpr const auto title = "Mail system settings";
static constexpr const auto question
= "Do you want to enable Postfix mail system?";
static constexpr const char* help
static constexpr const auto help
= Presenter::Messages::Placeholder::help;

struct Profile {
static constexpr const char* question
static constexpr const auto question
= "Choose a profile for mail delivery";
static constexpr const char* help
static constexpr const auto help
= Presenter::Messages::Placeholder::help;
};

struct Relay {
static constexpr const char* question
static constexpr const auto question
= "Enter the destination MTA information to relay messages";
static constexpr const char* help
static constexpr const auto help
= Presenter::Messages::Placeholder::help;

static constexpr const char* hostname = "Hostname of the MTA";
static constexpr const char* port = "Port";
static constexpr const auto hostname = "Hostname of the MTA";
static constexpr const auto port = "Port";
};

struct SASL {
static constexpr const char* question
static constexpr const auto question
= "Enter the mail server and user information to deliver "
"messages";
static constexpr const char* help
static constexpr const auto help
= Presenter::Messages::Placeholder::help;

static constexpr const char* hostname = "Hostname of the MTA";
static constexpr const char* port = "Port";
static constexpr const char* username = "Username";
static constexpr const char* password = "Password";
static constexpr const auto hostname = "Hostname of the MTA";
static constexpr const auto port = "Port";
static constexpr const auto username = "Username";
static constexpr const auto password = "Password";
};
};

Expand Down
24 changes: 12 additions & 12 deletions include/cloysterhpc/presenter/PresenterNetwork.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,39 +24,39 @@ class PresenterNetwork : public Presenter {
Connection m_connection;

struct Messages {
static constexpr const char* title = "Network Settings";
static constexpr const auto title = "Network Settings";

// TODO: Find a way to express which interface you are dealing with:
// "Select your <external> network interface", for example.
struct Interface {
static constexpr const char* question
static constexpr const auto question
= "Select your network interface";
static constexpr const char* help
static constexpr const auto help
= Presenter::Messages::Placeholder::help;
};

struct Details {
static constexpr const char* question
static constexpr const auto question
= "Fill the required network details";
static constexpr const char* help
static constexpr const auto help
= Presenter::Messages::Placeholder::help;
};

struct IP {
static constexpr const char* address = "IP Address";
static constexpr const char* subnetMask = "Subnet Mask";
static constexpr const char* network = "Network Address";
static constexpr const char* gateway = "Gateway";
static constexpr const auto address = "IP Address";
static constexpr const auto subnetMask = "Subnet Mask";
static constexpr const auto network = "Network Address";
static constexpr const auto gateway = "Gateway";
};

struct Domain {
static constexpr const char* name = "Domain name";
static constexpr const char* servers = "Nameservers";
static constexpr const auto name = "Domain name";
static constexpr const auto servers = "Nameservers";
};

#ifndef NDEBUG
struct Debug {
static constexpr const char* attributes
static constexpr const auto attributes
= "The following network attributes were detected";
};
#endif
Expand Down
38 changes: 19 additions & 19 deletions include/cloysterhpc/presenter/PresenterNodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,49 +11,49 @@
class PresenterNodes : public Presenter {
private:
struct Messages {
static constexpr const char* title = "Compute nodes settings";
static constexpr const char* message
static constexpr const auto title = "Compute nodes settings";
static constexpr const auto message
= "We will now gather information to fill your compute nodes data";

struct Nodes {
static constexpr const char* question
static constexpr const auto question
= "Enter the compute nodes information";
static constexpr const char* help
static constexpr const auto help
= Presenter::Messages::Placeholder::help;

static constexpr const char* prefix = "Prefix";
static constexpr const char* padding = "Padding";
static constexpr const char* startIP = "Compute node first IP";
static constexpr const char* rootPassword
static constexpr const auto prefix = "Prefix";
static constexpr const auto padding = "Padding";
static constexpr const auto startIP = "Compute node first IP";
static constexpr const auto rootPassword
= "Compute node root password";
static constexpr const char* confirmRootPassword
static constexpr const auto confirmRootPassword
= "Confirm compute node root password";
static constexpr const char* DiskImagePath
static constexpr const auto DiskImagePath
= "Disk image path of node OS";
};

struct Error {
static constexpr const char* prefixLetter
static constexpr const auto prefixLetter
= "Prefix must start with a letter";
static constexpr const char* paddingMax
static constexpr const auto paddingMax
= "We can only support up to 1000 nodes";
};

struct Quantity {
static constexpr const char* question
static constexpr const auto question
= "Enter the compute nodes quantity information";
static constexpr const char* help
static constexpr const auto help
= Presenter::Messages::Placeholder::help;

static constexpr const char* racks = "Racks";
static constexpr const char* nodes = "Nodes";
static constexpr const char* startNumber = "Node start number";
static constexpr const auto racks = "Racks";
static constexpr const auto nodes = "Nodes";
static constexpr const auto startNumber = "Node start number";
};

struct MAC {
static constexpr const char* question
static constexpr const auto question
= "Enter the MAC address for node";
static constexpr const char* help
static constexpr const auto help
= Presenter::Messages::Placeholder::help;
};
};
Expand Down
25 changes: 12 additions & 13 deletions include/cloysterhpc/presenter/PresenterNodesOperationalSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,45 +11,44 @@
class PresenterNodesOperationalSystem : public Presenter {
private:
struct Messages {
static constexpr const char* title
= "Nodes operational system settings";
static constexpr const auto title = "Nodes operational system settings";

struct OperationalSystemDownloadIso {
struct FirstStage {
static constexpr const char* question
static constexpr const auto question
= "You want to download a ISO for your node?";
static constexpr const char* help
static constexpr const auto help
= "Choose 'YES' if you want to download a new one or 'NO' "
"if you already have an ISO.";
};
struct SecondStage {
static constexpr const char* question
static constexpr const auto question
= "Choose an ISO to download";
static constexpr const char* help
static constexpr const auto help
= Presenter::Messages::Placeholder::help;
};
};

struct OperationalSystemDirectoryPath {
static constexpr const char* question
static constexpr const auto question
= "Inform the directory where your operational system images "
"are";
static constexpr const char* help
static constexpr const auto help
= Presenter::Messages::Placeholder::help;
static constexpr const char* field = "Path to ISOs directory:";
static constexpr const auto field = "Path to ISOs directory:";
};

struct OperationalSystemDistro {
static constexpr const char* question
static constexpr const auto question
= "Choose your operational system distro";
static constexpr const char* help
static constexpr const auto help
= Presenter::Messages::Placeholder::help;
};

struct OperationalSystem {
static constexpr const char* question
static constexpr const auto question
= "Choose your operational system ISO";
static constexpr const char* help
static constexpr const auto help
= Presenter::Messages::Placeholder::help;
};
};
Expand Down
20 changes: 10 additions & 10 deletions include/cloysterhpc/presenter/PresenterQueueSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,28 @@
class PresenterQueueSystem : public Presenter {
private:
struct Messages {
static constexpr const char* title = "Queue System settings";
static constexpr const char* question
static constexpr const auto title = "Queue System settings";
static constexpr const auto question
= "Pick a queue system to run you compute jobs";
static constexpr const char* help
static constexpr const auto help
= Presenter::Messages::Placeholder::help;

struct SLURM {
static constexpr const char* title = "SLURM settings";
static constexpr const char* question
static constexpr const auto title = "SLURM settings";
static constexpr const auto question
= "Enter the default partition name for SLURM";
static constexpr const char* help
static constexpr const auto help
= Presenter::Messages::Placeholder::help;

static constexpr const char* partition = "Partition name";
static constexpr const auto partition = "Partition name";
};

struct PBS {
static constexpr const char* title = "PBS Professional settings";
static constexpr const char* question
static constexpr const auto title = "PBS Professional settings";
static constexpr const auto question
= "Select the default execution place for PBS Professional "
"jobs";
static constexpr const char* help
static constexpr const auto help
= Presenter::Messages::Placeholder::help;
};
};
Expand Down
Loading

0 comments on commit a41f6e8

Please sign in to comment.