Skip to content

Commit

Permalink
Improve return const value of qualify member functions. (vesoft-inc#340)
Browse files Browse the repository at this point in the history
* Improve qualify member functions should return const value

* Address comments.
  • Loading branch information
boshengchen authored and dutor committed May 10, 2019
1 parent 71dd6ca commit e3c8eb9
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion src/graph/AssignmentExecutor.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class AssignmentExecutor final : public Executor {
private:
AssignmentSentence *sentence_{nullptr};
std::unique_ptr<TraverseExecutor> executor_;
std::string *var_;
const std::string *var_{nullptr};
};


Expand Down
8 changes: 4 additions & 4 deletions src/graph/CreateSpaceExecutor.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ class CreateSpaceExecutor final : public Executor {
void execute() override;

private:
CreateSpaceSentence *sentence_{nullptr};
std::string *spaceName_{nullptr};
int32_t partNum_{0};
int32_t replicaFactor_{0};
CreateSpaceSentence *sentence_{nullptr};
const std::string *spaceName_{nullptr};
int32_t partNum_{0};
int32_t replicaFactor_{0};
};

} // namespace graph
Expand Down
2 changes: 1 addition & 1 deletion src/graph/DropSpaceExecutor.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class DropSpaceExecutor final : public Executor {

private:
DropSpaceSentence *sentence_{nullptr};
std::string *spaceName_{nullptr};
const std::string *spaceName_{nullptr};
};

} // namespace graph
Expand Down
2 changes: 1 addition & 1 deletion src/graph/InsertVertexExecutor.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class InsertVertexExecutor final : public Executor {
InsertVertexSentence *sentence_{nullptr};
bool overwritable_{true};
TagID tagId_{0};
std::string *vertex_{nullptr};
const std::string *vertex_{nullptr};
TagSchema schema_;
std::vector<std::string*> properties_;
std::vector<VertexRowItem*> rows_;
Expand Down
4 changes: 2 additions & 2 deletions src/parser/AdminSentences.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ class CreateSpaceSentence final : public Sentence {
kind_ = Kind::kCreateSpace;
}

std::string* spaceName() {
const std::string* spaceName() const {
return spaceName_.get();
}

Expand All @@ -224,7 +224,7 @@ class DropSpaceSentence final : public Sentence {
kind_ = Kind::kDropSpace;
}

std::string* spaceName() {
const std::string* spaceName() const {
return spaceName_.get();
}

Expand Down
14 changes: 7 additions & 7 deletions src/parser/MaintainSentences.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class ColumnSpecification final {
return type_;
}

std::string* name() const {
const std::string* name() const {
return name_.get();
}

Expand Down Expand Up @@ -85,7 +85,7 @@ class CreateTagSentence final : public Sentence {

std::string toString() const override;

std::string* name() const {
const std::string* name() const {
return name_.get();
}

Expand All @@ -110,7 +110,7 @@ class CreateEdgeSentence final : public Sentence {

std::string toString() const override;

std::string* name() const {
const std::string* name() const {
return name_.get();
}

Expand Down Expand Up @@ -189,7 +189,7 @@ class AlterTagSentence final : public Sentence {

std::string toString() const override;

std::string* name() const {
const std::string* name() const {
return name_.get();
}

Expand All @@ -213,7 +213,7 @@ class AlterEdgeSentence final : public Sentence {

std::string toString() const override;

std::string* name() const {
const std::string* name() const {
return name_.get();
}

Expand All @@ -236,7 +236,7 @@ class DescribeTagSentence final : public Sentence {

std::string toString() const override;

std::string* name() const {
const std::string* name() const {
return name_.get();
}

Expand All @@ -254,7 +254,7 @@ class DescribeEdgeSentence final : public Sentence {

std::string toString() const override;

std::string* name() const {
const std::string* name() const {
return name_.get();
}

Expand Down
12 changes: 6 additions & 6 deletions src/parser/MutateSentences.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class InsertVertexSentence final : public Sentence {
return overwritable_;
}

std::string* vertex() const {
const std::string* vertex() const {
return vertex_.get();
}

Expand Down Expand Up @@ -223,7 +223,7 @@ class InsertEdgeSentence final : public Sentence {
edge_.reset(edge);
}

std::string* edge() const {
const std::string* edge() const {
return edge_.get();
}

Expand Down Expand Up @@ -363,15 +363,15 @@ class DeleteVertexSentence final : public Sentence {
kind_ = Kind::kDeleteVertex;
}

SourceNodeList* srcNodeLists() const {
const SourceNodeList* srcNodeLists() const {
return srcNodeList_.get();
}

void setWhereClause(WhereClause *clause) {
whereClause_.reset(clause);
}

WhereClause* whereClause() const {
const WhereClause* whereClause() const {
return whereClause_.get();
}

Expand Down Expand Up @@ -405,15 +405,15 @@ class DeleteEdgeSentence final : public Sentence {
kind_ = Kind::kDeleteEdge;
}

EdgeList* edgeList() const {
const EdgeList* edgeList() const {
return edgeList_.get();
}

void setWhereClause(WhereClause *clause) {
whereClause_.reset(clause);
}

WhereClause* whereClause() const {
const WhereClause* whereClause() const {
return whereClause_.get();
}

Expand Down
16 changes: 8 additions & 8 deletions src/parser/TraverseSentences.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,23 @@ class GoSentence final : public Sentence {
yieldClause_.reset(clause);
}

StepClause* stepClause() const {
const StepClause* stepClause() const {
return stepClause_.get();
}

FromClause* fromClause() const {
const FromClause* fromClause() const {
return fromClause_.get();
}

OverClause* overClause() const {
const OverClause* overClause() const {
return overClause_.get();
}

WhereClause* whereClause() const {
const WhereClause* whereClause() const {
return whereClause_.get();
}

YieldClause* yieldClause() const {
const YieldClause* yieldClause() const {
return yieldClause_.get();
}

Expand Down Expand Up @@ -88,7 +88,7 @@ class FindSentence final : public Sentence {
kind_ = Kind::kFind;
}

std::string* type() const {
const std::string* type() const {
return type_.get();
}

Expand All @@ -100,7 +100,7 @@ class FindSentence final : public Sentence {
whereClause_.reset(whereClause);
}

WhereClause* whereClause() const {
const WhereClause* whereClause() const {
return whereClause_.get();
}

Expand Down Expand Up @@ -185,7 +185,7 @@ class AssignmentSentence final : public Sentence {
sentence_.reset(sentence);
}

std::string* var() const {
const std::string* var() const {
return variable_.get();
}

Expand Down

0 comments on commit e3c8eb9

Please sign in to comment.