All Classes Files Functions Variables Enumerations Enumerator Macros
parser.hpp
Go to the documentation of this file.
1 
10 #ifndef PARSER_H
11 #define PARSER_H
12 
13 #include "options.hpp"
14 
15 using namespace std;
16 
22 
23 class Parser
24 {
25 public:
26 
27  // Constructors and destructors
28  Parser(); // Default constructor
29  ~Parser(); // Default destructor
30 
31  // User methods
32  void parseShow( string, ConfigOpts * ); // Parses the filename
33 
34  // Data fetching methods
35  string getOldDir() const; // Fetches the original directory
36  string getOldFile() const; // Fetches the original filename
37  string getDir() const; // Fetches the new directory
38  string getShow() const; // Fetches the new filename
39  int getShowNameIndex() const; // Fetches the index of showname
40  int getSeason() const; // Fetches the integer for season
41  int getEpisode() const; // Fetches the integer for episode
42  int getXEpisode() const; // Fetches the integer for extra episode info
43  string getPEpisode() const; // Fetches the string with episode part info
44  string getTitle() const; // Fetches the new title
45  string getExtension() const; // Fetches the extension
46  bool getOverRideDir() const; // Fetches the over ride directory flag
47  bool getError() const; // Fetches the error flag
48  ConfigOpts::errorType getErrorData() const; // Fetches the error information
49 
50 private:
51  // Internal methods
52  bool findShow( string &, ConfigOpts * ); // Matches filename from showlist
53  void newName( ConfigOpts * ); // Creates new filename
54  void newDir( ConfigOpts * ); // Creates new directory
55 
56  static void matchPattern( string &, int *, int &,
57  int &, int &, string & ); // Matches season and episode patterns in the filename
58  static void cleanUp( string &, ConfigOpts * ); // Removes filler and extra white space
59  static void removeTag( string &, ConfigOpts * ); // Removes release group tags
60  static void titleCase( string &, ConfigOpts * ); // Corrects capitolization
61 
62  // vars to hold original file info
63  string oldDir;
64  string oldFile;
65  string dir;
66  string show;
68  int season;
69  int episode;
70  int xepisode;
71  string pepisode;
72  string title;
73  string extension;
74  bool overrideDir;
75  bool error;
77 
89  int weight;
90 
118 };
119 
120 #endif
string oldDir
Holds the show's original directory.
Definition: parser.hpp:63
bool overrideDir
Override directory flag - (WTF?)
Definition: parser.hpp:74
string oldFile
Holds the show's original filename.
Definition: parser.hpp:64
string show
Holds the show's new filename.
Definition: parser.hpp:66
Creates an object for each input file and parses file and folder names.
Definition: parser.hpp:23
string pepisode
Holds the show's episode part.
Definition: parser.hpp:71
int episode
Holds the show's episode number.
Definition: parser.hpp:69
int weight
Holds the value used for duplicate selection - (WTF?)
Definition: parser.hpp:89
int xepisode
Holds the show's multi-episode number.
Definition: parser.hpp:70
int showNameIndex
Holds the index of the showname.
Definition: parser.hpp:67
string extension
Holds the show's new extension.
Definition: parser.hpp:73
string dir
Holds the show's new directory.
Definition: parser.hpp:65
ConfigOpts::errorType errorData
Stores the error type code.
Definition: parser.hpp:76
string title
Holds the show's new title.
Definition: parser.hpp:72
The ConfigOpts class stores all config options, settings, and flags for clerk.
int season
Holds the show's season number.
Definition: parser.hpp:68
Stores all config options, settings, and flags for clerk.
Definition: options.hpp:60
bool error
Error flag - True if an error occured.
Definition: parser.hpp:75