All Classes Files Functions Variables Enumerations Enumerator Macros
options.hpp
Go to the documentation of this file.
1 
12 #ifdef _WIN32
13 // Use Windows system specifics
14  #define MKDIR "mkdir "
15  #define COPY "copy "
16  #define MOVE "move "
17  #define RENAME "move "
18  #define SCRIPT1 "@ECHO OFF"
19  #define SCRIPT2 "bat"
20  #define SLASH "\\"
21  #define LOC1 ".\\"
22  #define LOC2 "C:\\Program Files\\clerk\\"
23  #define LOC3 "C:\\clerk\\"
24 #else
25 // Use Linux system specifics
26  #define MKDIR "mkdir -p "
27  #define COPY "cp "
28  #define MOVE "mv "
29  #define RENAME "mv "
30  #define SCRIPT1 "#!/bin/bash"
31  #define SCRIPT2 "sh"
32  #define SLASH "/"
33  #define LOC1 "./"
34  #define LOC2 "/etc/clerk/"
35  #define LOC3 "/usr/share/clerk/"
36 #endif
37 
38 #ifndef CONFIGOPTS_H
39 #define CONFIGOPTS_H
40 
41 #include <cstdlib>
42 #include <iostream>
43 #include <fstream>
44 #include <sstream>
45 #include <string>
46 #include <vector>
47 #include <sys/stat.h>
48 #include <dirent.h>
49 
50 using namespace std;
51 
59 
61 {
62 public:
63  // Constructors and destructors
64  ConfigOpts(); // Default constructor
65  ~ConfigOpts(); // Default destructor
66 
68  {
91  Default_opt
92  };
93 
94  enum flagValue
95  {
118  Default_flag
119  };
120 
122  {
127  NoError
128  };
129 
130  // User methods
131  static bool Configure( int, char ** ); // Reads all args into their appropriate vars
132 
133  static void setOptions( optionValue, string ); // Sets the user config options into an array
134  static string getOptions( optionValue ); // Retrieves the user config options from an array
135 
136  static void setFlags( flagValue ); // Sets the user config flags into an array
137  static bool getFlags( flagValue ); // Retrieves the user config flags from an array
138 
139  // Lists
140  static vector< vector<string> > v_showList;
141  static vector<string> v_blackList;
142  static vector<string> v_fileList;
143 
144 private:
145  // Internal methods
146  static bool argsTest( int, char ** ); // Checks for command line args before reading the config file
147 
148  static void configRead(); // Reads config options into their appropriate vars
149  static void configCheck(); // Set unset config options to default values
150 
151  static bool argsRead( int, char ** ); // Reads command line args into their appropriate vars
152  static bool argsCheck( int, string ); // Set unset command line args to default values
153 
154  static void writeFout( string ); // Recreates the showlist, blacklist, and config files
155  static void writeShowList( string ); // Writes the showlist file
156  static void writeBlackList( string ); // Writes the blacklist file
157  static void writeConfigFile( string ); // Writes the configuration file
158 
159  static void printHelp(); // Outputs the help information
160  static void printVersion(); // Outputs the version information
161 
162  static string options[Default_opt];
192  static bool flags[Default_flag];
222 };
223 
224 #endif
output help info
Definition: options.hpp:111
season is double digit
Definition: options.hpp:113
A Show name match failure occured.
Definition: options.hpp:124
max size of a episode, in bytes
Definition: options.hpp:69
output summary and error information
Definition: options.hpp:109
move the input files
Definition: options.hpp:105
file types that should be filtered
Definition: options.hpp:73
perform an internal action instead of writing a script
Definition: options.hpp:101
holds season digit option
Definition: options.hpp:88
the location of the blacklist file
Definition: options.hpp:70
read input from a directory
Definition: options.hpp:97
holds the output level option
Definition: options.hpp:87
copy the input files
Definition: options.hpp:106
rewrite showlist, blacklist, config files
Definition: options.hpp:114
not sure if needed (WTF?)
Definition: options.hpp:99
static vector< vector< string > > v_showList
A vector of vectors the will store a list of shows and a list of their episodes.
Definition: options.hpp:140
A sort failure occured.
Definition: options.hpp:126
holds xml file name and location
Definition: options.hpp:89
output directory from args
Definition: options.hpp:80
holds the execute option
Definition: options.hpp:86
not sure if needed (WTF?)
Definition: options.hpp:100
read input from a file
Definition: options.hpp:96
output version information
Definition: options.hpp:112
the delimters used to parse the file filter
Definition: options.hpp:74
the delimiters used to parse showlist lines
Definition: options.hpp:72
holds gap file name and location
Definition: options.hpp:90
recurse directories
Definition: options.hpp:98
the delimters used to parse the no uppercased words
Definition: options.hpp:77
static vector< string > v_fileList
A vector that contains the list of input files to be parsed.
Definition: options.hpp:142
holds script file name and location
Definition: options.hpp:82
holds the recurse option
Definition: options.hpp:84
take no real actions - just output to stdout
Definition: options.hpp:102
write a script instead of internal action
Definition: options.hpp:103
output to log instead of stdout
Definition: options.hpp:110
holds the mode option
Definition: options.hpp:85
holds the season/episode and title separator
Definition: options.hpp:78
words that should not be uppercased
Definition: options.hpp:76
rename the input files
Definition: options.hpp:104
A duplicate Episode failure occured.
Definition: options.hpp:125
A Season or Episode pattern match failure occured.
Definition: options.hpp:123
input directory/file from args
Definition: options.hpp:79
Stores all config options, settings, and flags for clerk.
Definition: options.hpp:60
static vector< string > v_blackList
A vector that holds a list of tags to be removed from each file's name.
Definition: options.hpp:141
holds log file name and location
Definition: options.hpp:81
the location of the showlist file
Definition: options.hpp:71
holds showlist, blacklist, config rewrite location
Definition: options.hpp:83