expose line iteration in Buffer API

This commit is contained in:
Josh Holtrop 2016-06-29 22:03:40 -04:00
parent fdcba81a3d
commit 6d6988c027

View File

@ -10,8 +10,20 @@ class Buffer
public: public:
bool load_from_file(const char * filename); bool load_from_file(const char * filename);
typedef std::shared_ptr<Text> LineType;
typedef std::list<LineType> LinesType;
auto begin() { return m_lines.begin(); }
auto end() { return m_lines.end(); }
auto cbegin() const { return m_lines.cbegin(); }
auto cend() const { return m_lines.cend(); }
auto rbegin() { return m_lines.rbegin(); }
auto rend() { return m_lines.rend(); }
auto crbegin() const { return m_lines.crbegin(); }
auto crend() const { return m_lines.crend(); }
protected: protected:
std::list<std::shared_ptr<Text>> m_lines; LinesType m_lines;
}; };
#endif #endif