All Classes Files Functions Variables Enumerations Enumerator Macros
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Static Private Member Functions | Static Private Attributes | List of all members
ConfigOpts Class Reference

Stores all config options, settings, and flags for clerk. More...

#include <options.hpp>

Public Types

enum  optionValue {
  MaxEpisodeSize_opt, BlackListLocation_opt, ShowListLocation_opt, ShowListDelimiter_opt,
  FileTypeFilter_opt, DelimiterFilter_opt, Filler_opt, LowerCaseWords_opt,
  DelimiterWords_opt, TitleFormat_opt, InputSourceArgument_opt, OutputSourceArgument_opt,
  LogFileLocation_opt, ScriptFileLocation_opt, RewriteLocation_opt, Recurse_opt,
  Mode_opt, Execute_opt, VerbosityLevel_opt, SeasonDigit_opt,
  XmlFileLocation_opt, GapFileLocation_opt, Default_opt
}
 
enum  flagValue {
  ReadFromFile_flag, ReadFromDirectory_flag, Recurse_flag, Input_flag,
  Output_flag, ExecuteInternally_flag, TestActions_flag, WriteToScriptFile_flag,
  RenameInputFiles_flag, MoveInputFiles_flag, CopyInputFiles_flag, VerbosityLevelQuiet_flag,
  VerbosityLevelSummary_flag, VerbosityLevelVerbose_flag, WriteToLogFile_flag, PrintHelp_flag,
  PrintVersion_flag, SeasonDigit_flag, RewriteDefaultFiles_flag, ConfigFileNotFound_flag,
  WriteToXmlFile_flag, WriteToGapFile_flag, Default_flag
}
 
enum  errorType {
  SeasonEpisodeError, ShowNameMatchError, DuplicateEpisodeError, SortFailureError,
  NoError
}
 

Public Member Functions

 ConfigOpts ()
 Default constructor, sets all flags and options to default values. More...
 
 ~ConfigOpts ()
 Default destructor, empties showlist, blacklist, and filelist vectors. More...
 

Static Public Member Functions

static bool Configure (int, char **)
 Reads all arguments into their appropriate variables. More...
 
static void setOptions (optionValue, string)
 Sets the user configuration options into an array. More...
 
static string getOptions (optionValue)
 Retrieves the user configuration options from an array. More...
 
static void setFlags (flagValue)
 Sets the user configuration flags into an array. More...
 
static bool getFlags (flagValue)
 Retrieves the user configuration flags from an array. More...
 

Static Public Attributes

static vector< vector< string > > v_showList
 A vector of vectors the will store a list of shows and a list of their episodes. More...
 
static vector< string > v_blackList
 A vector that holds a list of tags to be removed from each file's name. More...
 
static vector< string > v_fileList
 A vector that contains the list of input files to be parsed. More...
 

Static Private Member Functions

static bool argsTest (int, char **)
 Reads command line arguments into their appropriate variables. More...
 
static void configRead ()
 Reads configuration arguments into their appropriate variables from the configuration file. More...
 
static void configCheck ()
 Sets any unset configuration options to their default values. More...
 
static bool argsRead (int, char **)
 Reads command line args into their appropriate variables. More...
 
static bool argsCheck (int, string)
 Reads command line args into their appropriate variables. (WTF?) More...
 
static void writeFout (string)
 Recreates the showlist, blacklist, and configuration files. More...
 
static void writeShowList (string)
 Generates a default showlist file in a given directory. More...
 
static void writeBlackList (string)
 Generates a default blacklist file in the given directory. More...
 
static void writeConfigFile (string)
 Generates a default configuration file in the given directory. More...
 
static void printHelp ()
 Outputs the help information to the console. More...
 
static void printVersion ()
 Outputs the version information to the console. More...
 

Static Private Attributes

static string options [Default_opt]
 
static bool flags [Default_flag]
 

Detailed Description

Stores all config options, settings, and flags for clerk.

Checks the existence of a configuration file, and stores the options then reads and stores the arguments from the command line. Recreates the showlist, blacklist, and config files. Creates vectors to store the show list, black list, and files list. Prints help and version information.

Definition at line 60 of file options.hpp.

Member Enumeration Documentation

Enumerator
SeasonEpisodeError 

A Season or Episode pattern match failure occured.

ShowNameMatchError 

A Show name match failure occured.

DuplicateEpisodeError 

A duplicate Episode failure occured.

SortFailureError 

A sort failure occured.

NoError 

No errors occured.

Definition at line 121 of file options.hpp.

Enumerator
ReadFromFile_flag 

read input from a file

ReadFromDirectory_flag 

read input from a directory

Recurse_flag 

recurse directories

Input_flag 

not sure if needed (WTF?)

Output_flag 

not sure if needed (WTF?)

ExecuteInternally_flag 

perform an internal action instead of writing a script

TestActions_flag 

take no real actions - just output to stdout

WriteToScriptFile_flag 

write a script instead of internal action

RenameInputFiles_flag 

rename the input files

MoveInputFiles_flag 

move the input files

CopyInputFiles_flag 

copy the input files

VerbosityLevelQuiet_flag 

output nothing

VerbosityLevelSummary_flag 

output summary

VerbosityLevelVerbose_flag 

output summary and error information

WriteToLogFile_flag 

output to log instead of stdout

PrintHelp_flag 

output help info

PrintVersion_flag 

output version information

SeasonDigit_flag 

season is double digit

RewriteDefaultFiles_flag 

rewrite showlist, blacklist, config files

ConfigFileNotFound_flag 

clerk.conf not found

WriteToXmlFile_flag 

output xml file

WriteToGapFile_flag 

output gap file

Default_flag 

resets all flags to a standardized default

Definition at line 94 of file options.hpp.

Enumerator
MaxEpisodeSize_opt 

max size of a episode, in bytes

BlackListLocation_opt 

the location of the blacklist file

ShowListLocation_opt 

the location of the showlist file

ShowListDelimiter_opt 

the delimiters used to parse showlist lines

FileTypeFilter_opt 

file types that should be filtered

DelimiterFilter_opt 

the delimters used to parse the file filter

Filler_opt 

filler

LowerCaseWords_opt 

words that should not be uppercased

DelimiterWords_opt 

the delimters used to parse the no uppercased words

TitleFormat_opt 

holds the season/episode and title separator

InputSourceArgument_opt 

input directory/file from args

OutputSourceArgument_opt 

output directory from args

LogFileLocation_opt 

holds log file name and location

ScriptFileLocation_opt 

holds script file name and location

RewriteLocation_opt 

holds showlist, blacklist, config rewrite location

Recurse_opt 

holds the recurse option

Mode_opt 

holds the mode option

Execute_opt 

holds the execute option

VerbosityLevel_opt 

holds the output level option

SeasonDigit_opt 

holds season digit option

XmlFileLocation_opt 

holds xml file name and location

GapFileLocation_opt 

holds gap file name and location

Default_opt 

resets all options to a standardized default

Definition at line 67 of file options.hpp.

Constructor & Destructor Documentation

ConfigOpts::ConfigOpts ( )

Default constructor, sets all flags and options to default values.

Definition at line 28 of file mainPublic.cpp.

Here is the call graph for this function:

ConfigOpts::~ConfigOpts ( )

Default destructor, empties showlist, blacklist, and filelist vectors.

Definition at line 37 of file mainPublic.cpp.

Member Function Documentation

bool ConfigOpts::argsCheck ( int  errorFlag,
string  errorArg 
)
staticprivate

Reads command line args into their appropriate variables. (WTF?)

Parameters
errorFlag- the number of error arguments submitted.
errorArg- the contents of the error arguments submitted.
Returns
A boolean, 0 for success, 1 for failure

Definition at line 192 of file readArgs.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool ConfigOpts::argsRead ( int  argCount,
char **  argVar 
)
staticprivate

Reads command line args into their appropriate variables.

Parameters
argCount- the number of arguments submitted.
argVar- the contents of the arguments submitted.
Returns
A boolean, 0 for success, 1 for failure

Definition at line 17 of file readArgs.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool ConfigOpts::argsTest ( int  argCount,
char **  argVar 
)
staticprivate

Reads command line arguments into their appropriate variables.

Parameters
argCount- the number of arguments to be read in.
argVar- the contents of each argument.

Definition at line 13 of file testArgs.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void ConfigOpts::configCheck ( )
staticprivate

Sets any unset configuration options to their default values.

Definition at line 273 of file readOpts.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void ConfigOpts::configRead ( )
staticprivate

Reads configuration arguments into their appropriate variables from the configuration file.

Definition at line 13 of file readOpts.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool ConfigOpts::Configure ( int  argCount,
char **  argVar 
)
static

Reads all arguments into their appropriate variables.

Parameters
argCount- the number of arguments
argVar- an array of arguments
Returns
a boolean, true for sucess, false for failure

Definition at line 66 of file mainPublic.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool ConfigOpts::getFlags ( flagValue  optInt)
static

Retrieves the user configuration flags from an array.

Parameters
optInt- the index of the argument option
Returns
the argument boolean value

Definition at line 280 of file mainPublic.cpp.

Here is the caller graph for this function:

string ConfigOpts::getOptions ( optionValue  optInt)
static

Retrieves the user configuration options from an array.

Parameters
optInt- the index of the argument option
Returns
the argument string value

Definition at line 129 of file mainPublic.cpp.

Here is the caller graph for this function:

void ConfigOpts::printHelp ( )
staticprivate

Outputs the help information to the console.

Definition at line 53 of file outPut.cpp.

Here is the caller graph for this function:

void ConfigOpts::printVersion ( )
staticprivate

Outputs the version information to the console.

Definition at line 110 of file outPut.cpp.

Here is the caller graph for this function:

void ConfigOpts::setFlags ( flagValue  optInt)
static

Sets the user configuration flags into an array.

Parameters
optInt- the index of the argument flag

Definition at line 137 of file mainPublic.cpp.

Here is the caller graph for this function:

void ConfigOpts::setOptions ( optionValue  optInt,
string  argStr 
)
static

Sets the user configuration options into an array.

Parameters
optInt- the index of the argument option
argStr- the argument to be stored
Returns
a boolean, true for sucess, false for failure

Definition at line 105 of file mainPublic.cpp.

Here is the caller graph for this function:

void ConfigOpts::writeBlackList ( string  dirOut)
staticprivate

Generates a default blacklist file in the given directory.

Parameters
dirOut- the directory location to which the blacklist file is to be written.

Definition at line 12 of file writeBlack.cpp.

Here is the caller graph for this function:

void ConfigOpts::writeConfigFile ( string  dirOut)
staticprivate

Generates a default configuration file in the given directory.

Parameters
dirOut- the directory location to which the configuration file is to be written.

Definition at line 12 of file writeConf.cpp.

Here is the caller graph for this function:

void ConfigOpts::writeFout ( string  dirOut)
staticprivate

Recreates the showlist, blacklist, and configuration files.

Parameters
dirOut- the directory to which these files should be output.

Definition at line 16 of file outPut.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void ConfigOpts::writeShowList ( string  dirOut)
staticprivate

Generates a default showlist file in a given directory.

Parameters
dirOut- the directory location to which the showlist file is to be written.

Definition at line 12 of file writeShow.cpp.

Here is the caller graph for this function:

Member Data Documentation

bool ConfigOpts::flags
staticprivate

Configuration flags

Value Reference:
flags[0]  = inputfile            // read input from a file
flags[1]  = inputdir             // read input from a directory
flags[2]  = recurse              // recurse directories
flags[3]  = input                // not sure if needed
flags[4]  = output               // not sure if needed
flags[5]  = execute              // perform an internal action instead of writing a script
flags[6]  = test                 // take no real actions - just output to stdout
flags[7]  = script               // write a script instead of internal action
flags[8]  = rename               // rename the input files
flags[9]  = move                 // move the input files
flags[10] = copy                 // copy the input files
flags[11] = quiet                // output nothing
flags[12] = summary              // output summary
flags[13] = verbose              // output summary and error information
flags[14] = log                  // output to log instead of stdout
flags[15] = help                 // output help info
flags[16] = version              // output version information
flags[17] = seasondd             // season is double digit
flags[18] = rewrite              // rewrite showlist, blacklist, config files
flags[19] = noConfig             // clerk.conf not found
flags[20] = xml                  // output xml file
flags[21] = gap                  // output gap file

Definition at line 192 of file options.hpp.

string ConfigOpts::options
staticprivate

Configuration options

Value Reference:
options[0]  = episodeSize          // max size of a episode, in bytes
options[1]  = blackList            // the location of the blacklist file
options[2]  = showList             // the location of the showlist file
options[3]  = delimShowList        // the delimters used to parse showlist lines
options[4]  = fileFilter           // file types that should be filtered
options[5]  = delimFilter          // the delimters used to parse the file filter
options[6]  = filler               // filler
options[7]  = noCase               // words that should not be uppercased
options[8]  = delimCase            // the delimters used to parse the no uppercased words
options[9]  = titleFormat          // holds the season/episode and title separator
options[10] = inputArg             // input directory/file from args
options[11] = outputArg            // output directory from args
options[12] = logfile              // holds log file name and location
options[13] = scriptfile           // holds script file name and location
options[14] = rewriteLoc           // holds showlist, blacklist, config rewrite location
options[15] = recurse              // holds the recurse option
options[16] = mode                 // holds the mode option
options[17] = execute              // holds the execute option
options[18] = level                // holds the output level option
options[19] = seasondd             // holds season digit option
options[20] = xml                  // holds xml file name and location
options[21] = gap                  // holds gap file name and location

Definition at line 162 of file options.hpp.

vector< string > ConfigOpts::v_blackList
static

A vector that holds a list of tags to be removed from each file's name.

Definition at line 141 of file options.hpp.

vector< string > ConfigOpts::v_fileList
static

A vector that contains the list of input files to be parsed.

Definition at line 142 of file options.hpp.

vector< vector< string > > ConfigOpts::v_showList
static

A vector of vectors the will store a list of shows and a list of their episodes.

Definition at line 140 of file options.hpp.


The documentation for this class was generated from the following files: