From: Bartosz Golaszewski Date: Tue, 27 Feb 2018 12:41:46 +0000 (+0100) Subject: bindings: cxx: rename line_bulk::add() to line_bulk::append() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=42038068fc6ab5d71cedcf6825d988b3eaa75400;p=qemu-gpiodev%2Flibgpiod.git bindings: cxx: rename line_bulk::add() to line_bulk::append() This routine adds the line at the end of the internal list of lines. Rename it to append() in case we ever want to introduce prepend(). Signed-off-by: Bartosz Golaszewski --- diff --git a/bindings/cxx/chip.cpp b/bindings/cxx/chip.cpp index 7d4d80b..43b411d 100644 --- a/bindings/cxx/chip.cpp +++ b/bindings/cxx/chip.cpp @@ -144,7 +144,7 @@ line_bulk chip::get_lines(const ::std::vector& offsets) const line_bulk lines; for (auto& it: offsets) - lines.add(this->get_line(it)); + lines.append(this->get_line(it)); return ::std::move(lines); } @@ -154,7 +154,7 @@ line_bulk chip::get_all_lines(void) const line_bulk lines; for (unsigned int i = 0; i < this->num_lines(); i++) - lines.add(this->get_line(i)); + lines.append(this->get_line(i)); return ::std::move(lines); } @@ -164,7 +164,7 @@ line_bulk chip::find_lines(const ::std::vector<::std::string>& names) const line_bulk lines; for (auto& it: names) - lines.add(this->find_line(it)); + lines.append(this->find_line(it)); return ::std::move(lines); } diff --git a/bindings/cxx/gpiod.hpp b/bindings/cxx/gpiod.hpp index ff46f26..032cb51 100644 --- a/bindings/cxx/gpiod.hpp +++ b/bindings/cxx/gpiod.hpp @@ -560,7 +560,7 @@ public: * @note The new line must be owned by the same chip as all the other * lines already held by this line_bulk object. */ - GPIOD_API void add(const line& new_line); + GPIOD_API void append(const line& new_line); /** * @brief Get the line at given offset. diff --git a/bindings/cxx/line_bulk.cpp b/bindings/cxx/line_bulk.cpp index 6f0d08f..9937a49 100644 --- a/bindings/cxx/line_bulk.cpp +++ b/bindings/cxx/line_bulk.cpp @@ -55,10 +55,10 @@ line_bulk::line_bulk(const ::std::vector& lines) this->_m_bulk.reserve(lines.size()); for (auto& it: lines) - this->add(it); + this->append(it); } -void line_bulk::add(const line& new_line) +void line_bulk::append(const line& new_line) { if (!new_line) throw ::std::logic_error("line_bulk cannot hold empty line objects"); @@ -199,7 +199,7 @@ line_bulk line_bulk::event_wait(const ::std::chrono::nanoseconds& timeout) const "error polling for events"); } else if (rv > 0) { for (unsigned int i = 0; i < event_bulk.num_lines; i++) - ret.add(line(event_bulk.lines[i], this->_m_bulk[i].get_chip())); + ret.append(line(event_bulk.lines[i], this->_m_bulk[i].get_chip())); } return ::std::move(ret);