Home Docs Forums Bugzilla LXR Doxygen CVS Bonsai
~ [ source navigation ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

tahoe/toolbox/src/misc/FileCrawlerT.h


Jump to: CVSweb (mirror) - ViewCVS (Sourceforge) - PCVweb

  1 /* $Id: FileCrawlerT.h,v 1.6 2004/02/26 08:56:02 paklein Exp $ */
  2 
  3 #ifndef _FILE_CRAWLER_T_H_
  4 #define _FILE_CRAWLER_T_H_
  5 
  6 #include "Environment.h"
  7 
  8 /* direct members */
  9 #include "ArrayT.h"
 10 #include "StringT.h"
 11 
 12 #include "ios_fwd_decl.h"
 13 
 14 namespace Tahoe {
 15 
 16 /* forward declarations */
 17 class ifstreamT;
 18 class StringT;
 19 
 20 /** run one file or a tree of files. Gives console prompt
 21  * for a file name which can be either a "job" file or a "batch"
 22  * file depending on the leading character. Lines beginning with
 23  * '-' are assumed to be application specific commands, which
 24  * are passed to derived classes for handling. */
 25 class FileCrawlerT
 26 {
 27 public:
 28 
 29     /** constructor */
 30     FileCrawlerT(int argc, char* argv[], char job_char, char batch_char);
 31 
 32     /** destructor */
 33     virtual ~FileCrawlerT(void);
 34 
 35     /** prompt input files until "quit" */
 36     virtual void Run(void);
 37 
 38 protected:
 39 
 40     /** application-specific job execution */
 41     virtual void RunJob(ifstreamT& in, ostream& status) = 0;
 42 
 43     /** handle batch file command */
 44     virtual void BatchFileCommand(const StringT& command, ifstreamT& batch) = 0;
 45 
 46     /** batch file processing */
 47     virtual void RunBatch(ifstreamT& in, ostream& status);
 48 
 49     /** returns the index of the requested option */
 50     bool CommandLineOption(const char* str) const;
 51     bool CommandLineOption(const char* str, int& index) const;
 52     void AddCommandLineOption(const char* str);
 53 
 54     /** recursive dispatch */
 55     virtual void JobOrBatch(ifstreamT& in, ostream& status);
 56     
 57 protected:
 58 
 59     /* filetype character codes */
 60     char fJobChar;
 61     char fBatchChar;
 62 
 63     /* command line arguments */
 64     ArrayT<StringT> fCommandLineOptions;
 65     
 66 private:    
 67 
 68     /* batch file recursion depth - safety */
 69     int fRecursionDepth;
 70 };
 71 
 72 /* inlines */
 73 inline bool FileCrawlerT::CommandLineOption(const char* str) const
 74 {
 75     int index;
 76     return CommandLineOption(str, index);
 77 }
 78 
 79 } // namespace Tahoe 
 80 #endif /* _FILE_CRAWLER_T_H_ */
 81 

~ [ source navigation ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.