class DjVuParseOptions

Main class for parsing options.

Public

[more] Creation/destruction.

[more] ~DjVuParseOptions()
Normal Destructor.
[more] DjVuParseOptions(const char [])
This is the normal constructor. A profile name must be specified.
[more] DjVuParseOptions(const char [], const char [], DjVuTokenList *VarTokens=0)
This constructor is for using an alternate configuration file
[more]void init(const char [], const char [])
This reinitallizes with the above constructor
[more] DjVuParseOptions(DjVuParseOptions &)
This is a copy constructor.

[more] Accessing options

[more]inline int SetVarToken(const char xname[]) const
This is the same as GetVarToken() except if a variable name is NOT currently tokenized, a new token is created and returned.
[more]inline int GetProfileToken(const char xname[]) const
This is similar to GetVarToken(), but it looks up the token for profile name instead.
[more]inline int SetProfileToken(const char xname[]) const
This is similar to SetVarToken(), but it looks up the token for profile name instead.
[more]inline const char* const GetVarName(const int token) const
This is the reverse transform of the GetVarToken() routine.
[more]inline const char* const GetProfileName(const int token) const
This is the reverse transform of the GetProfileToken() routine.
[more]const char* const GetValue(const int token) const
This is the primary lookup routine.
[more]int GetBest(const int listsize, const int tokens[], bool=false)
Multiple tokens may be in an array of the specified listsize.
[more]inline int GetBest(const int tokens[], bool=false)
Same as above, but -1 terminated
[more]inline const char* const GetValue(const char xname[]) const
This is just a short cut, when a token value is only needed for one lookup.
[more]int GetBest(const int listsize, const char * const[], bool=false)
Multiple names may be in an array of the specified listsize.
[more]inline int GetBest(const char * const names[], bool=false)
Same as above, but NULL terminated
[more]int GetInteger( const int token, const int errval=0, const int falseval=0, const int trueval=1) const
This just checks for TRUE, and it not does an atoi() conversion.
[more]inline int GetInteger(const char xname[], const int errval=0, const int falseval=0, const int trueval=1) const
This is just a short cut, when a token value is only needed for one lookup.
[more]int GetNumber(const int token, const int errval=0) const
This just checks for valid integer numbers only.
[more]inline int GetNumber(const char xname[], const int errval=0) const
This is just a short cut, when a token value is only needed for one lookup.

[more] Error handling

[more]int HasError() const
This method allows us to check if any errors occurred.
[more]const char* GetError()
This allows us to retrieve and clear errors one at a time.
[more]void ClearError()
This deletes and recreates the Errors object, to clear all errors without the need to do a GetError() loop.
[more]void perror(const char *mesg=0)
This simple perror() type function prints all errors to stderr, with a GetError() loop, so the errors are cleared.

[more] Parsing profiles or arguments

[more]bool ChangeProfile(const char [])
This is the only method of reading a new profile, and changing it to the current profile that will be used with the Get*() methods.
[more]int ParseArguments(const int, const char * const [], const djvu_option [], const int=0)
This is the primary function for reading command line arguments.
[more]inline const char* const* get_argv(void) const
These are the arguments sent to ParseArguments
[more]inline int get_argc(void) const
These are the arguments sent to ParseArguments
[more]inline int get_optind(void) const
These are the arguments sent to ParseArguments
[more]const char* const ConfigFilename(const char [], int)
Get the name of the last configuration file corresponding to the profile


Documentation

Main class for parsing options. DjVuParseOptions is the only class you really need to declare. This will handle all of the details of parsing options from the command line and configuration files on disk.
o Creation/destruction.

o ~DjVuParseOptions()
Normal Destructor. This uses reference counts to decide when references should be destroyed.

o DjVuParseOptions(const char [])
This is the normal constructor. A profile name must be specified.

o DjVuParseOptions(const char [], const char [], DjVuTokenList *VarTokens=0)
This constructor is for using an alternate configuration file

ovoid init(const char [], const char [])
This reinitallizes with the above constructor

o DjVuParseOptions(DjVuParseOptions &)
This is a copy constructor. Arguments, and ErrorLists are not copied. VarTokens, ProfileTokens, and Configuration are copied by reference, not value.

o Accessing options

oinline int SetVarToken(const char xname[]) const
This is the same as GetVarToken() except if a variable name is NOT currently tokenized, a new token is created and returned. If you are Use of this is recommended when the token value is to be stored statically.

oinline int GetProfileToken(const char xname[]) const
This is similar to GetVarToken(), but it looks up the token for profile name instead.

oinline int SetProfileToken(const char xname[]) const
This is similar to SetVarToken(), but it looks up the token for profile name instead. Care should be used when using this method. Once a token is assigned to a profile, then the profile is assumed to have been read. Consequently, if you use this function, and the profile did not exist. An empty profile will be created... Perhaps this method should be private instead.

oinline const char* const GetVarName(const int token) const
This is the reverse transform of the GetVarToken() routine. Given the token, it returns the var name. This is handy for creating readable messages for log files and such.

oinline const char* const GetProfileName(const int token) const
This is the reverse transform of the GetProfileToken() routine. Given the token, it returns the profile name. This is handy for creating readable messages for log files and such.

oconst char* const GetValue(const int token) const
This is the primary lookup routine. Input is the token as returned by GetToken(), and the return value is the string associated with the token. Multiple tokens may be in an array of the specified listsize.

oint GetBest(const int listsize, const int tokens[], bool=false)
Multiple tokens may be in an array of the specified listsize. The index of the token with a value of the highest precedence will be is returned. Command line arguments have the highest precedence. Default profile values have the lowest precedence. It is an error to have two values f the same precedence.

oinline int GetBest(const int tokens[], bool=false)
Same as above, but -1 terminated

oinline const char* const GetValue(const char xname[]) const
This is just a short cut, when a token value is only needed for one lookup. A list of tokens may be specified as well.

oint GetBest(const int listsize, const char * const[], bool=false)
Multiple names may be in an array of the specified listsize. The index of the name with a value of the highest precedence will be is returned. Command line arguments have the highest precedence. Default profile values have the lowest precedence. It is an error to have two values with the same precedence.

oinline int GetBest(const char * const names[], bool=false)
Same as above, but NULL terminated

oint GetInteger( const int token, const int errval=0, const int falseval=0, const int trueval=1) const
This just checks for TRUE, and it not does an atoi() conversion. Anything beginning with [Tt] is returned as trueval, [Ff] is returned as falseval, and anything else that is not a legal integer is returned as errval.

oinline int GetInteger(const char xname[], const int errval=0, const int falseval=0, const int trueval=1) const
This is just a short cut, when a token value is only needed for one lookup.

oint GetNumber(const int token, const int errval=0) const
This just checks for valid integer numbers only. If the string contains something other than [-0-9] the supplied errval is returned. Otherwise an integer is returned.

oinline int GetNumber(const char xname[], const int errval=0) const
This is just a short cut, when a token value is only needed for one lookup.

o Error handling

oint HasError() const
This method allows us to check if any errors occurred.

oconst char* GetError()
This allows us to retrieve and clear errors one at a time. A NULL is returned when all errors have been cleared.

ovoid ClearError()
This deletes and recreates the Errors object, to clear all errors without the need to do a GetError() loop.

ovoid perror(const char *mesg=0)
This simple perror() type function prints all errors to stderr, with a GetError() loop, so the errors are cleared.

o Parsing profiles or arguments

obool ChangeProfile(const char [])
This is the only method of reading a new profile, and changing it to the current profile that will be used with the Get*() methods. Returns true if the profile exists.

oint ParseArguments(const int, const char * const [], const djvu_option [], const int=0)
This is the primary function for reading command line arguments.

oinline const char* const* get_argv(void) const
These are the arguments sent to ParseArguments

oinline int get_argc(void) const
These are the arguments sent to ParseArguments

oinline int get_optind(void) const
These are the arguments sent to ParseArguments

oconst char* const ConfigFilename(const char [], int)
Get the name of the last configuration file corresponding to the profile


This class has no child classes.

Alphabetic index HTML hierarchy of classes or Java


DjVu is a trademark of LizardTech, Inc.
All other products mentioned are registered trademarks or trademarks of their respective companies.