All Classes Files Functions Variables Enumerations Enumerator Macros
mainPublic.cpp
Go to the documentation of this file.
1 
17 #include "options.hpp"
18 
19 // Instantiate static data members
22 
23 vector< vector<string> > ConfigOpts::v_showList;
24 vector<string> ConfigOpts::v_blackList;
25 vector<string> ConfigOpts::v_fileList;
26 
29 {
30  // Causes all flags to be set to default
32  // Causes all options to be set to default
33  setOptions( Default_opt, "" );
34 };
35 
38 {
39  // If the showlist is not empty
40  if( !v_showList.empty() )
41  {
42  // Clear the showlist
43  v_showList.clear();
44  }
45 
46  // If the blacklist is not empty
47  if( !v_blackList.empty() )
48  {
49  // Clear the blacklist
50  v_blackList.clear();
51  }
52 
53  // If the filelist is not empty
54  if( !v_fileList.size() )
55  {
56  // Clear the filelist
57  v_fileList.clear();
58  }
59 };
60 
65 // Read all args into their appropriate vars
66 bool ConfigOpts::Configure( int argCount, char **argVar )
67 {
68  // Create an error flag set to false
69  bool errorFlag = 0;
70 
71  // Check if there are any command line args
72  if( argCount > 1 )
73  {
74  // Check for specific command line args
75  if ( argsTest( argCount, argVar ) )
76  {
77  // Return 1 = failure
78  return 1;
79  }
80  }
81 
82  // Read config file options into their appropriate vars
83  configRead();
84 
85  // Check if there are any command line args
86  if( argCount > 1 )
87  {
88  // Read command line args into their appropriate vars
89  if( argsRead( argCount, argVar ) )
90  {
91  // Set error flag to true
92  errorFlag = 1;
93  }
94  }
95 
96  // Return 0 = Success
97  return errorFlag;
98 };
99 
104 // Set the user config options into an array
105 void ConfigOpts::setOptions( optionValue optInt, string argStr )
106 {
107  // If the user option is less than the number of optionValue items
108  if( optInt < Default_opt )
109  {
110  // Store the argument
111  options[optInt] = argStr;
112  }
113  // If the user option is more then the number of optionValue items
114  else
115  {
116  // For each element in the options array
117  for( int i = 0; i < Default_opt; i++ )
118  {
119  // Set each element value to ""
120  options[i] = "";
121  }
122  }
123 };
124 
128 // Retrieve the user config options from an array
130 {
131  return options[optInt];
132 };
133 
136 // Set the user config flags into an array
138 {
139  switch( optInt )
140  {
141  case ReadFromFile_flag:
142  //inputfile
145  break;
147  //inputdir
150  break;
151  case Recurse_flag:
152  //recurse
153  flags[Recurse_flag] = 1;
154  break;
155  case Input_flag:
156  //input
157  flags[Input_flag] = 1;
158  break;
159  case Output_flag:
160  //output
161  flags[Output_flag] = 1;
162  break;
164  //execute
166  flags[TestActions_flag] = 0;
168  break;
169  case TestActions_flag:
170  //test
172  flags[TestActions_flag] = 1;
174  break;
176  //script
178  flags[TestActions_flag] = 0;
180  break;
182  //rename
186  break;
187  case MoveInputFiles_flag:
188  //move
192  break;
193  case CopyInputFiles_flag:
194  //copy
198  break;
200  //quiet
204  break;
206  //summary
210  break;
212  //verbose
216  break;
217  case WriteToLogFile_flag:
218  //log
220  break;
221  case PrintHelp_flag:
222  //help
223  flags[PrintHelp_flag] = 1;
224  break;
225  case PrintVersion_flag:
226  //version
228  break;
229  case SeasonDigit_flag:
230  //seasondd
231  flags[SeasonDigit_flag] = 1;
232  break;
234  //rewrite
236  break;
238  //noClerk
240  break;
241  case WriteToXmlFile_flag:
242  //XML
244  break;
245  case WriteToGapFile_flag:
246  //gap
248  break;
249  default:
250  //default
253  flags[Recurse_flag] = 0;
254  flags[Input_flag] = 0;
255  flags[Output_flag] = 0;
257  flags[TestActions_flag] = 0;
266  flags[PrintHelp_flag] = 0;
268  flags[SeasonDigit_flag] = 0;
273  }
274 };
275 
279 // Retrieve the user config flags from an array
281 {
282  return flags[optInt];
283 };
output help info
Definition: options.hpp:111
season is double digit
Definition: options.hpp:113
static bool argsTest(int, char **)
Reads command line arguments into their appropriate variables.
Definition: testArgs.cpp:13
static bool getFlags(flagValue)
Retrieves the user configuration flags from an array.
Definition: mainPublic.cpp:280
output summary and error information
Definition: options.hpp:109
move the input files
Definition: options.hpp:105
perform an internal action instead of writing a script
Definition: options.hpp:101
static bool flags[Default_flag]
Definition: options.hpp:192
~ConfigOpts()
Default destructor, empties showlist, blacklist, and filelist vectors.
Definition: mainPublic.cpp:37
read input from a directory
Definition: options.hpp:97
static string options[Default_opt]
Definition: options.hpp:162
resets all flags to a standardized default
Definition: options.hpp:118
static bool Configure(int, char **)
Reads all arguments into their appropriate variables.
Definition: mainPublic.cpp:66
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
ConfigOpts()
Default constructor, sets all flags and options to default values.
Definition: mainPublic.cpp:28
static string getOptions(optionValue)
Retrieves the user configuration options from an array.
Definition: mainPublic.cpp:129
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
resets all options to a standardized default
Definition: options.hpp:91
static bool argsRead(int, char **)
Reads command line args into their appropriate variables.
Definition: readArgs.cpp:17
recurse directories
Definition: options.hpp:98
static void configRead()
Reads configuration arguments into their appropriate variables from the configuration file...
Definition: readOpts.cpp:13
static vector< string > v_fileList
A vector that contains the list of input files to be parsed.
Definition: options.hpp:142
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
rename the input files
Definition: options.hpp:104
The ConfigOpts class stores all config options, settings, and flags for clerk.
static void setFlags(flagValue)
Sets the user configuration flags into an array.
Definition: mainPublic.cpp:137
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
static void setOptions(optionValue, string)
Sets the user configuration options into an array.
Definition: mainPublic.cpp:105