Skip to content

Commit

Permalink
pass by const ref
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperWig committed Oct 28, 2019
1 parent c8c54bb commit 342fc82
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/duckx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ std::string duckx::Run::get_text() const {
return this->current.child("w:t").text().get();
}

bool duckx::Run::set_text(std::string text) const {
bool duckx::Run::set_text(const std::string& text) const {
return this->current.child("w:t").text().set(text.c_str());
}

Expand Down Expand Up @@ -199,7 +199,7 @@ duckx::Run &duckx::Paragraph::runs() {
return this->run;
}

duckx::Run &duckx::Paragraph::add_run(std::string text) {
duckx::Run &duckx::Paragraph::add_run(const std::string& text) {
return this->add_run(text.c_str());
}

Expand All @@ -214,7 +214,7 @@ duckx::Run &duckx::Paragraph::add_run(const char *text) {
return *new Run(this->current, new_run);
}

duckx::Paragraph &duckx::Paragraph::insert_paragraph_after(std::string text) {
duckx::Paragraph &duckx::Paragraph::insert_paragraph_after(const std::string& text) {
pugi::xml_node new_para = this->parent.insert_child_after("w:p", this->current);

Paragraph *p = new Paragraph();
Expand Down
6 changes: 3 additions & 3 deletions src/duckx.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace duckx {
void set_current(pugi::xml_node);

std::string get_text() const;
bool set_text(std::string) const;
bool set_text(const std::string&) const;
bool set_text(const char *) const;

Run &next();
Expand Down Expand Up @@ -61,9 +61,9 @@ namespace duckx {
bool has_next() const;

Run &runs();
Run &add_run(std::string);
Run &add_run(const std::string&);
Run &add_run(const char*);
Paragraph &insert_paragraph_after(std::string);
Paragraph &insert_paragraph_after(const std::string&);
};

// TableCell contains one or more paragraphs
Expand Down

0 comments on commit 342fc82

Please sign in to comment.