diff options
Diffstat (limited to 'mtxhistory.h')
-rw-r--r-- | mtxhistory.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/mtxhistory.h b/mtxhistory.h index e3d3abc..ee2e2d7 100644 --- a/mtxhistory.h +++ b/mtxhistory.h @@ -24,17 +24,56 @@ #include <string> #include <vector> +/** + * Object implementing history support. + * + * Mainly used for command line history. + */ class MtxHistory { private: + /** + * Vector of strings handled. + */ std::vector<std::string> strings; + + /** + * Iterator pointing to the current string. + */ std::vector<std::string>::iterator offset; public: + /** + * Default constructor. + */ MtxHistory(); + + /** + * Add a string at the end of the vector of strings. + * + * The offset is automatically set to this string. + */ void addString(const std::string &string); + + /** + * Return string at current offset. + * + * Return an empty string if offset points at the end of the vector. + */ std::string getString() const; + + /** + * Decrement offset. + * + * If offset is already set to the first string, nothing is done. + */ void previousString(); + + /** + * Increment offset. + * + * If offset is already set to the end of the vector, nothing is done. + */ void nextString(); }; |