From c4cc2f1913b5b7d79ca2740bad6295a252017dea Mon Sep 17 00:00:00 2001 From: John Denker Date: Mon, 30 Jul 2012 14:35:05 -0700 Subject: start handling two (or more) directories --- tools/libltgrey.h | 47 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 34 insertions(+), 13 deletions(-) (limited to 'tools/libltgrey.h') diff --git a/tools/libltgrey.h b/tools/libltgrey.h index 14ed144..9891256 100644 --- a/tools/libltgrey.h +++ b/tools/libltgrey.h @@ -3,12 +3,7 @@ #include #include -// beware: access illogically comes *before* modification -// in the array passed to utimes: -const int upd_ac(0); -const int upd_mod(1); - -#define state_40_macro \ +#define box_state_macro \ foo(unseen) \ foo(green) \ foo(ripe) \ @@ -18,10 +13,20 @@ foo(fail) // expand the codes to make some names: #define foo(name) name, typedef enum { - state_40_macro -} state_40; + box_state_macro +} box_state; #undef foo +class boxer{ +public: + std::string dir; + int min; + int max; + boxer(const std::string _dir, const int _min, const int _max) + : dir(_dir), min(_min), max(_max) + {} +}; + class whatsit{ public: std::string parent_dir; @@ -30,7 +35,7 @@ public: std::string suffix; std::string progid; int verbosity; - std::map decode_40; + std::map decode_40; whatsit(const std::string name, const std::string _parent_dir); int doit(const int penalty, const int stain); @@ -44,8 +49,24 @@ public: std::vector &checked); void dump(const std::string var); int maybe_mkdir(const std::string somedir, const std::string msg); - state_40 get40(const std::string mid); - state_40 get40(const std::string mid, timeval times[2]); - int set40(const std::string mid, const int shift); - void scan40(const int copies); + + int set_box(const boxer, const std::string mid, const int shift); + box_state get_box(const boxer, const std::string mid, timeval times[2]); + void scan_box(const boxer, const int copies); + + box_state get_40(const std::string mid); + int set_40(const std::string mid, const int shift); + box_state get_rep(const std::string mid); }; + +// beware: access illogically comes *before* modification +// in the array passed to utimes: +const int upd_ac(0); +const int upd_mod(1); + +const int minute(60); +const int hour(60*minute); +const int day(24*hour); + +const boxer box_40 ("quarante", 15*minute, 4*hour); +const boxer box_rep("repute", 0, 35*day); -- cgit v1.2.3