aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2023-01-15 14:23:54 +0100
committerLoic Guegan <manzerbredes@mailbox.org>2023-01-15 14:23:54 +0100
commit2ac42558f2b6269ad4d8e0809519f96aae1fd342 (patch)
tree8a1a062d71747484164009bd7826aee1db37d945
parent52c2fd4521d33616514dc2a43ad1ee432ce16275 (diff)
Add const qualifiers
-rw-r--r--src/HalfMove.cpp8
-rw-r--r--src/HalfMove.hpp6
2 files changed, 7 insertions, 7 deletions
diff --git a/src/HalfMove.cpp b/src/HalfMove.cpp
index 1375b25..8038acb 100644
--- a/src/HalfMove.cpp
+++ b/src/HalfMove.cpp
@@ -11,7 +11,7 @@ HalfMove::~HalfMove() {
}
}
-std::string HalfMove::NestedDump(HalfMove *m, int indent) {
+std::string HalfMove::NestedDump(const HalfMove *m, int indent) const{
std::stringstream ss;
for (int i = 0; i < indent; i++) {
@@ -33,11 +33,11 @@ std::string HalfMove::NestedDump(HalfMove *m, int indent) {
return (ss.str());
}
-std::string HalfMove::Dump() { return (NestedDump(this, 0)); }
+std::string HalfMove::Dump() const { return (NestedDump(this, 0)); }
-int HalfMove::GetLength() {
+int HalfMove::GetLength() const {
int length = 0;
- HalfMove *m = this;
+ const HalfMove *m = this;
while (m != NULL) {
length++;
m = m->MainLine;
diff --git a/src/HalfMove.hpp b/src/HalfMove.hpp
index 9e90fda..47caf05 100644
--- a/src/HalfMove.hpp
+++ b/src/HalfMove.hpp
@@ -13,7 +13,7 @@ namespace pgnp {
class HalfMove {
private:
/// @brief Recursive dump
- std::string NestedDump(HalfMove *, int);
+ std::string NestedDump(const HalfMove *, int) const;
public:
/// @brief Contains current move count
@@ -33,9 +33,9 @@ public:
HalfMove();
~HalfMove();
/// @brief Get number of HalfMove in the MailLine
- int GetLength();
+ int GetLength() const;
/// @brief Dump move and all its variations
- std::string Dump();
+ std::string Dump() const;
/// @brief Perform a deep copy of a HalfMove
void Copy(HalfMove *copy);
/// @brief Get HalfMove located x down the MainLine