Add const modifier for constants methods

This commit is contained in:
Stefan Müller 2024-12-25 21:24:20 +01:00
parent c783d20755
commit d314b2fc70
17 changed files with 45 additions and 45 deletions

View File

@ -23,11 +23,11 @@ class CeresSearch
: public LinesSolver
{
public:
std::string getPuzzleName() const override;
std::string getInputFileName() const override;
const std::string getPuzzleName() const override;
const std::string getInputFileName() const override;
void finish() override;
private:
char xmas_[4] = { 'X', 'M', 'A', 'S' };
const char xmas_[4] = { 'X', 'M', 'A', 'S' };
void computeXmasCount(const Point2& start);
void computeX_MasCount(const Point2& start);
};

View File

@ -21,8 +21,8 @@ class GuardGallivant
: public LinesSolver
{
public:
std::string getPuzzleName() const override;
std::string getInputFileName() const override;
const std::string getPuzzleName() const override;
const std::string getInputFileName() const override;
void processDataLine(const std::string& line) override;
void finish() override;
private:
@ -30,7 +30,7 @@ class GuardGallivant
void visitPosition(const Point2& current);
size_t turnDirection(const size_t current) const;
size_t getStartDirectionIndex() const;
char getStartChar() const;
char getVisitedChar() const;
char getObstructionChar() const;
const char getStartChar() const;
const char getVisitedChar() const;
const char getObstructionChar() const;
};

View File

@ -23,8 +23,8 @@ class HistorianHysteria
: public Solver
{
public:
virtual std::string getPuzzleName() const override;
virtual std::string getInputFileName() const override;
virtual const std::string getPuzzleName() const override;
virtual const std::string getInputFileName() const override;
virtual void processDataLine(const std::string& line) override;
virtual void finish() override;
private:

View File

@ -24,11 +24,11 @@ class HoofIt
: public LinesSolver
{
public:
std::string getPuzzleName() const override;
std::string getInputFileName() const override;
const std::string getPuzzleName() const override;
const std::string getInputFileName() const override;
void finish() override;
private:
char getTrailheadChar() const;
char getTrailTopChar() const;
const char getTrailheadChar() const;
const char getTrailTopChar() const;
void addUnique(const std::vector<Point2>& source, std::vector<Point2>& destination);
};

View File

@ -21,8 +21,8 @@
class LanParty : public Solver
{
public:
std::string getPuzzleName() const override;
std::string getInputFileName() const override;
const std::string getPuzzleName() const override;
const std::string getInputFileName() const override;
void processDataLine(const std::string& line) override;
void finish() override;
private:

View File

@ -24,8 +24,8 @@ class MullItOver
{
public:
MullItOver();
std::string getPuzzleName() const override;
std::string getInputFileName() const override;
const std::string getPuzzleName() const override;
const std::string getInputFileName() const override;
void processDataLine(const std::string& line) override;
void finish() override;
private:

View File

@ -22,8 +22,8 @@ class PrintQueue
{
public:
PrintQueue();
std::string getPuzzleName() const override;
std::string getInputFileName() const override;
const std::string getPuzzleName() const override;
const std::string getInputFileName() const override;
void processDataLine(const std::string& line) override;
void finish() override;
private:

View File

@ -23,8 +23,8 @@ class RedNosedReports
: public Solver
{
public:
std::string getPuzzleName() const override;
std::string getInputFileName() const override;
const std::string getPuzzleName() const override;
const std::string getInputFileName() const override;
void processDataLine(const std::string& line) override;
void finish() override;
private:

View File

@ -22,8 +22,8 @@ class Solver
public:
Solver();
virtual ~Solver(){};
virtual std::string getPuzzleName() const = 0;
virtual std::string getInputFileName() const = 0;
virtual const std::string getPuzzleName() const = 0;
virtual const std::string getInputFileName() const = 0;
virtual void processDataLine(const std::string &line) = 0;
virtual void finish() = 0;
long long int getResultPart1() const;

View File

@ -15,12 +15,12 @@
#include <aoc/CeresSearch.hpp>
std::string CeresSearch::getPuzzleName() const
const std::string CeresSearch::getPuzzleName() const
{
return "Day 4: Ceres Search";
}
std::string CeresSearch::getInputFileName() const
const std::string CeresSearch::getInputFileName() const
{
return "ceres_search.txt";
}

View File

@ -15,12 +15,12 @@
#include <aoc/GuardGallivant.hpp>
std::string GuardGallivant::getPuzzleName() const
const std::string GuardGallivant::getPuzzleName() const
{
return "Day 6: Guard Gallivant";
}
std::string GuardGallivant::getInputFileName() const
const std::string GuardGallivant::getInputFileName() const
{
return "guard_gallivant.txt";
}
@ -75,17 +75,17 @@ size_t GuardGallivant::getStartDirectionIndex() const
return 2;
}
char GuardGallivant::getStartChar() const
const char GuardGallivant::getStartChar() const
{
return '^';
}
char GuardGallivant::getVisitedChar() const
const char GuardGallivant::getVisitedChar() const
{
return 'X';
}
char GuardGallivant::getObstructionChar() const
const char GuardGallivant::getObstructionChar() const
{
return '#';
}

View File

@ -17,12 +17,12 @@
#include <aoc/HistorianHysteria.hpp>
std::string HistorianHysteria::getPuzzleName() const
const std::string HistorianHysteria::getPuzzleName() const
{
return "Day 1: Historian Hysteria";
}
std::string HistorianHysteria::getInputFileName() const
const std::string HistorianHysteria::getInputFileName() const
{
return "historian_hysteria.txt";
}

View File

@ -21,12 +21,12 @@
#include <aoc/Point2.hpp>
std::string HoofIt::getPuzzleName() const
const std::string HoofIt::getPuzzleName() const
{
return "Day 10: Hoof It";
}
std::string HoofIt::getInputFileName() const
const std::string HoofIt::getInputFileName() const
{
return "hoof_it.txt";
}
@ -89,12 +89,12 @@ void HoofIt::finish()
}
}
char HoofIt::getTrailheadChar() const
const char HoofIt::getTrailheadChar() const
{
return '0';
}
char HoofIt::getTrailTopChar() const
const char HoofIt::getTrailTopChar() const
{
return '9';
}

View File

@ -15,12 +15,12 @@
#include <aoc/LanParty.hpp>
std::string LanParty::getPuzzleName() const
const std::string LanParty::getPuzzleName() const
{
return "Day 23: LAN Party";
}
std::string LanParty::getInputFileName() const
const std::string LanParty::getInputFileName() const
{
return "lan_party.txt";
}

View File

@ -22,12 +22,12 @@ MullItOver::MullItOver()
data_
} {}
std::string MullItOver::getPuzzleName() const
const std::string MullItOver::getPuzzleName() const
{
return "Day 3: Mull It Over";
}
std::string MullItOver::getInputFileName() const
const std::string MullItOver::getInputFileName() const
{
return "mull_it_over.txt";
}

View File

@ -36,12 +36,12 @@ PrintQueue::PrintQueue()
}
}
std::string PrintQueue::getPuzzleName() const
const std::string PrintQueue::getPuzzleName() const
{
return "Day 5: Print Queue";
}
std::string PrintQueue::getInputFileName() const
const std::string PrintQueue::getInputFileName() const
{
return "print_queue.txt";
}

View File

@ -19,12 +19,12 @@
#include <sstream>
#include <vector>
std::string RedNosedReports::getPuzzleName() const
const std::string RedNosedReports::getPuzzleName() const
{
return "Day 2: Red-Nosed Reports";
}
std::string RedNosedReports::getInputFileName() const
const std::string RedNosedReports::getInputFileName() const
{
return "red-nosed_reports.txt";
}