--- parser3/src/include/pa_table.h 2024/11/17 14:04:28 1.76 +++ parser3/src/include/pa_table.h 2024/12/11 15:46:38 1.78 @@ -8,7 +8,7 @@ #ifndef PA_TABLE_H #define PA_TABLE_H -#define IDENT_PA_TABLE_H "$Id: pa_table.h,v 1.76 2024/11/17 14:04:28 moko Exp $" +#define IDENT_PA_TABLE_H "$Id: pa_table.h,v 1.78 2024/12/11 15:46:38 moko Exp $" #include "pa_types.h" #include "pa_hash.h" @@ -40,15 +40,20 @@ public: /// gets column names columns_type columns() { return fcolumns; } - /// moves @a current pointer, can be out of range when restoring current in modified table + /// @return current pointer + size_t current() const { return fcurrent; } + + /// sets @a current pointer, can be out of range when restoring current in modified table void set_current(size_t acurrent) { fcurrent=acurrent0 ? count()-1 : 0; } - /// @return current pointer - size_t current() const { return fcurrent; } + /// sets or offsets @a current pointer, wrapping within the table void offset(bool absolute, int offset); + /// is that @c index falid? + bool valid(size_t index) const { return index - void table_for_each(void (*func)(Table& self, I* info), I* info, Action_options& o) { - if(!o.adjust(count())) - return; - - Temp_current tc(*this); - size_t row=o.offset; - if(o.reverse) { // reverse - for(size_t i=0; i bool table_first_that(bool (*func)(Table& self, I info), I info, Action_options& o) { @@ -139,8 +127,6 @@ private: typedef HashString name2number_hash_class; name2number_hash_class* name2number; - /// is that @c index falid? - bool valid(size_t index) const { return index void Table::table_for_each(void (*func)(Table& self, I* info), I* info, Action_options& o) { + if(!o.adjust(count())) + return; + + Temp_current tc(*this); + size_t row=o.offset; + if(o.reverse) { // reverse + for(size_t i=0; i