Add const modifier for constants methods
This commit is contained in:
parent
c783d20755
commit
d314b2fc70
|
@ -23,11 +23,11 @@ class CeresSearch
|
||||||
: public LinesSolver
|
: public LinesSolver
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
std::string getPuzzleName() const override;
|
const std::string getPuzzleName() const override;
|
||||||
std::string getInputFileName() const override;
|
const std::string getInputFileName() const override;
|
||||||
void finish() override;
|
void finish() override;
|
||||||
private:
|
private:
|
||||||
char xmas_[4] = { 'X', 'M', 'A', 'S' };
|
const char xmas_[4] = { 'X', 'M', 'A', 'S' };
|
||||||
void computeXmasCount(const Point2& start);
|
void computeXmasCount(const Point2& start);
|
||||||
void computeX_MasCount(const Point2& start);
|
void computeX_MasCount(const Point2& start);
|
||||||
};
|
};
|
||||||
|
|
|
@ -21,8 +21,8 @@ class GuardGallivant
|
||||||
: public LinesSolver
|
: public LinesSolver
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
std::string getPuzzleName() const override;
|
const std::string getPuzzleName() const override;
|
||||||
std::string getInputFileName() const override;
|
const std::string getInputFileName() const override;
|
||||||
void processDataLine(const std::string& line) override;
|
void processDataLine(const std::string& line) override;
|
||||||
void finish() override;
|
void finish() override;
|
||||||
private:
|
private:
|
||||||
|
@ -30,7 +30,7 @@ class GuardGallivant
|
||||||
void visitPosition(const Point2& current);
|
void visitPosition(const Point2& current);
|
||||||
size_t turnDirection(const size_t current) const;
|
size_t turnDirection(const size_t current) const;
|
||||||
size_t getStartDirectionIndex() const;
|
size_t getStartDirectionIndex() const;
|
||||||
char getStartChar() const;
|
const char getStartChar() const;
|
||||||
char getVisitedChar() const;
|
const char getVisitedChar() const;
|
||||||
char getObstructionChar() const;
|
const char getObstructionChar() const;
|
||||||
};
|
};
|
||||||
|
|
|
@ -23,8 +23,8 @@ class HistorianHysteria
|
||||||
: public Solver
|
: public Solver
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual std::string getPuzzleName() const override;
|
virtual const std::string getPuzzleName() const override;
|
||||||
virtual std::string getInputFileName() const override;
|
virtual const std::string getInputFileName() const override;
|
||||||
virtual void processDataLine(const std::string& line) override;
|
virtual void processDataLine(const std::string& line) override;
|
||||||
virtual void finish() override;
|
virtual void finish() override;
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -24,11 +24,11 @@ class HoofIt
|
||||||
: public LinesSolver
|
: public LinesSolver
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
std::string getPuzzleName() const override;
|
const std::string getPuzzleName() const override;
|
||||||
std::string getInputFileName() const override;
|
const std::string getInputFileName() const override;
|
||||||
void finish() override;
|
void finish() override;
|
||||||
private:
|
private:
|
||||||
char getTrailheadChar() const;
|
const char getTrailheadChar() const;
|
||||||
char getTrailTopChar() const;
|
const char getTrailTopChar() const;
|
||||||
void addUnique(const std::vector<Point2>& source, std::vector<Point2>& destination);
|
void addUnique(const std::vector<Point2>& source, std::vector<Point2>& destination);
|
||||||
};
|
};
|
||||||
|
|
|
@ -21,8 +21,8 @@
|
||||||
class LanParty : public Solver
|
class LanParty : public Solver
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
std::string getPuzzleName() const override;
|
const std::string getPuzzleName() const override;
|
||||||
std::string getInputFileName() const override;
|
const std::string getInputFileName() const override;
|
||||||
void processDataLine(const std::string& line) override;
|
void processDataLine(const std::string& line) override;
|
||||||
void finish() override;
|
void finish() override;
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -24,8 +24,8 @@ class MullItOver
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MullItOver();
|
MullItOver();
|
||||||
std::string getPuzzleName() const override;
|
const std::string getPuzzleName() const override;
|
||||||
std::string getInputFileName() const override;
|
const std::string getInputFileName() const override;
|
||||||
void processDataLine(const std::string& line) override;
|
void processDataLine(const std::string& line) override;
|
||||||
void finish() override;
|
void finish() override;
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -22,8 +22,8 @@ class PrintQueue
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PrintQueue();
|
PrintQueue();
|
||||||
std::string getPuzzleName() const override;
|
const std::string getPuzzleName() const override;
|
||||||
std::string getInputFileName() const override;
|
const std::string getInputFileName() const override;
|
||||||
void processDataLine(const std::string& line) override;
|
void processDataLine(const std::string& line) override;
|
||||||
void finish() override;
|
void finish() override;
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -23,8 +23,8 @@ class RedNosedReports
|
||||||
: public Solver
|
: public Solver
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
std::string getPuzzleName() const override;
|
const std::string getPuzzleName() const override;
|
||||||
std::string getInputFileName() const override;
|
const std::string getInputFileName() const override;
|
||||||
void processDataLine(const std::string& line) override;
|
void processDataLine(const std::string& line) override;
|
||||||
void finish() override;
|
void finish() override;
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -22,8 +22,8 @@ class Solver
|
||||||
public:
|
public:
|
||||||
Solver();
|
Solver();
|
||||||
virtual ~Solver(){};
|
virtual ~Solver(){};
|
||||||
virtual std::string getPuzzleName() const = 0;
|
virtual const std::string getPuzzleName() const = 0;
|
||||||
virtual std::string getInputFileName() const = 0;
|
virtual const std::string getInputFileName() const = 0;
|
||||||
virtual void processDataLine(const std::string &line) = 0;
|
virtual void processDataLine(const std::string &line) = 0;
|
||||||
virtual void finish() = 0;
|
virtual void finish() = 0;
|
||||||
long long int getResultPart1() const;
|
long long int getResultPart1() const;
|
||||||
|
|
|
@ -15,12 +15,12 @@
|
||||||
|
|
||||||
#include <aoc/CeresSearch.hpp>
|
#include <aoc/CeresSearch.hpp>
|
||||||
|
|
||||||
std::string CeresSearch::getPuzzleName() const
|
const std::string CeresSearch::getPuzzleName() const
|
||||||
{
|
{
|
||||||
return "Day 4: Ceres Search";
|
return "Day 4: Ceres Search";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CeresSearch::getInputFileName() const
|
const std::string CeresSearch::getInputFileName() const
|
||||||
{
|
{
|
||||||
return "ceres_search.txt";
|
return "ceres_search.txt";
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,12 +15,12 @@
|
||||||
|
|
||||||
#include <aoc/GuardGallivant.hpp>
|
#include <aoc/GuardGallivant.hpp>
|
||||||
|
|
||||||
std::string GuardGallivant::getPuzzleName() const
|
const std::string GuardGallivant::getPuzzleName() const
|
||||||
{
|
{
|
||||||
return "Day 6: Guard Gallivant";
|
return "Day 6: Guard Gallivant";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string GuardGallivant::getInputFileName() const
|
const std::string GuardGallivant::getInputFileName() const
|
||||||
{
|
{
|
||||||
return "guard_gallivant.txt";
|
return "guard_gallivant.txt";
|
||||||
}
|
}
|
||||||
|
@ -75,17 +75,17 @@ size_t GuardGallivant::getStartDirectionIndex() const
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
char GuardGallivant::getStartChar() const
|
const char GuardGallivant::getStartChar() const
|
||||||
{
|
{
|
||||||
return '^';
|
return '^';
|
||||||
}
|
}
|
||||||
|
|
||||||
char GuardGallivant::getVisitedChar() const
|
const char GuardGallivant::getVisitedChar() const
|
||||||
{
|
{
|
||||||
return 'X';
|
return 'X';
|
||||||
}
|
}
|
||||||
|
|
||||||
char GuardGallivant::getObstructionChar() const
|
const char GuardGallivant::getObstructionChar() const
|
||||||
{
|
{
|
||||||
return '#';
|
return '#';
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,12 +17,12 @@
|
||||||
|
|
||||||
#include <aoc/HistorianHysteria.hpp>
|
#include <aoc/HistorianHysteria.hpp>
|
||||||
|
|
||||||
std::string HistorianHysteria::getPuzzleName() const
|
const std::string HistorianHysteria::getPuzzleName() const
|
||||||
{
|
{
|
||||||
return "Day 1: Historian Hysteria";
|
return "Day 1: Historian Hysteria";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string HistorianHysteria::getInputFileName() const
|
const std::string HistorianHysteria::getInputFileName() const
|
||||||
{
|
{
|
||||||
return "historian_hysteria.txt";
|
return "historian_hysteria.txt";
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,12 +21,12 @@
|
||||||
|
|
||||||
#include <aoc/Point2.hpp>
|
#include <aoc/Point2.hpp>
|
||||||
|
|
||||||
std::string HoofIt::getPuzzleName() const
|
const std::string HoofIt::getPuzzleName() const
|
||||||
{
|
{
|
||||||
return "Day 10: Hoof It";
|
return "Day 10: Hoof It";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string HoofIt::getInputFileName() const
|
const std::string HoofIt::getInputFileName() const
|
||||||
{
|
{
|
||||||
return "hoof_it.txt";
|
return "hoof_it.txt";
|
||||||
}
|
}
|
||||||
|
@ -89,12 +89,12 @@ void HoofIt::finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char HoofIt::getTrailheadChar() const
|
const char HoofIt::getTrailheadChar() const
|
||||||
{
|
{
|
||||||
return '0';
|
return '0';
|
||||||
}
|
}
|
||||||
|
|
||||||
char HoofIt::getTrailTopChar() const
|
const char HoofIt::getTrailTopChar() const
|
||||||
{
|
{
|
||||||
return '9';
|
return '9';
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,12 +15,12 @@
|
||||||
|
|
||||||
#include <aoc/LanParty.hpp>
|
#include <aoc/LanParty.hpp>
|
||||||
|
|
||||||
std::string LanParty::getPuzzleName() const
|
const std::string LanParty::getPuzzleName() const
|
||||||
{
|
{
|
||||||
return "Day 23: LAN Party";
|
return "Day 23: LAN Party";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string LanParty::getInputFileName() const
|
const std::string LanParty::getInputFileName() const
|
||||||
{
|
{
|
||||||
return "lan_party.txt";
|
return "lan_party.txt";
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,12 +22,12 @@ MullItOver::MullItOver()
|
||||||
data_
|
data_
|
||||||
} {}
|
} {}
|
||||||
|
|
||||||
std::string MullItOver::getPuzzleName() const
|
const std::string MullItOver::getPuzzleName() const
|
||||||
{
|
{
|
||||||
return "Day 3: Mull It Over";
|
return "Day 3: Mull It Over";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string MullItOver::getInputFileName() const
|
const std::string MullItOver::getInputFileName() const
|
||||||
{
|
{
|
||||||
return "mull_it_over.txt";
|
return "mull_it_over.txt";
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,12 +36,12 @@ PrintQueue::PrintQueue()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string PrintQueue::getPuzzleName() const
|
const std::string PrintQueue::getPuzzleName() const
|
||||||
{
|
{
|
||||||
return "Day 5: Print Queue";
|
return "Day 5: Print Queue";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string PrintQueue::getInputFileName() const
|
const std::string PrintQueue::getInputFileName() const
|
||||||
{
|
{
|
||||||
return "print_queue.txt";
|
return "print_queue.txt";
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,12 +19,12 @@
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
std::string RedNosedReports::getPuzzleName() const
|
const std::string RedNosedReports::getPuzzleName() const
|
||||||
{
|
{
|
||||||
return "Day 2: Red-Nosed Reports";
|
return "Day 2: Red-Nosed Reports";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string RedNosedReports::getInputFileName() const
|
const std::string RedNosedReports::getInputFileName() const
|
||||||
{
|
{
|
||||||
return "red-nosed_reports.txt";
|
return "red-nosed_reports.txt";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue