00001 /** @file db2cppc_cmdline.h 00002 * @brief The header file for the command line option parser 00003 * generated by GNU Gengetopt version 2.22.2 00004 * http://www.gnu.org/software/gengetopt. 00005 * DO NOT modify this file, since it can be overwritten 00006 * @author GNU Gengetopt by Lorenzo Bettini */ 00007 00008 #ifndef DB2CPPC_CMDLINE_H 00009 #define DB2CPPC_CMDLINE_H 00010 00011 /* If we use autoconf. */ 00012 #ifdef HAVE_CONFIG_H 00013 #include "config.h" 00014 #endif 00015 00016 #include <stdio.h> /* for FILE */ 00017 00018 #ifdef __cplusplus 00019 extern "C" { 00020 #endif /* __cplusplus */ 00021 00022 #ifndef CMDLINE_PARSER_PACKAGE 00023 /** @brief the program name (used for printing errors) */ 00024 #define CMDLINE_PARSER_PACKAGE "db2cppc" 00025 #endif 00026 00027 #ifndef CMDLINE_PARSER_PACKAGE_NAME 00028 /** @brief the complete program name (used for help and version) */ 00029 #define CMDLINE_PARSER_PACKAGE_NAME "db2cppc" 00030 #endif 00031 00032 #ifndef CMDLINE_PARSER_VERSION 00033 /** @brief the program version */ 00034 #define CMDLINE_PARSER_VERSION "1.0.2" 00035 #endif 00036 00037 /** @brief Where the command line options are stored */ 00038 struct db2cppc_args 00039 { 00040 const char *help_help; /**< @brief Print help and exit help description. */ 00041 const char *version_help; /**< @brief Print version and exit help description. */ 00042 char * database_arg; /**< @brief Mysql database name. */ 00043 char * database_orig; /**< @brief Mysql database name original value given at command line. */ 00044 const char *database_help; /**< @brief Mysql database name help description. */ 00045 char * user_arg; /**< @brief Mysql user name (default='root'). */ 00046 char * user_orig; /**< @brief Mysql user name original value given at command line. */ 00047 const char *user_help; /**< @brief Mysql user name help description. */ 00048 char * password_arg; /**< @brief Mysql password. */ 00049 char * password_orig; /**< @brief Mysql password original value given at command line. */ 00050 const char *password_help; /**< @brief Mysql password help description. */ 00051 char * host_arg; /**< @brief Name of host where database can be found. */ 00052 char * host_orig; /**< @brief Name of host where database can be found original value given at command line. */ 00053 const char *host_help; /**< @brief Name of host where database can be found help description. */ 00054 char * out_arg; /**< @brief Output file (base name) if different from default classname.h. */ 00055 char * out_orig; /**< @brief Output file (base name) if different from default classname.h original value given at command line. */ 00056 const char *out_help; /**< @brief Output file (base name) if different from default classname.h help description. */ 00057 int xml_flag; /**< @brief Generate functions that convert objects to XML nodes (needs dvxml) (default=off). */ 00058 const char *xml_help; /**< @brief Generate functions that convert objects to XML nodes (needs dvxml) help description. */ 00059 char * include_arg; /**< @brief Database definition file to include, e.g. module/database.h. */ 00060 char * include_orig; /**< @brief Database definition file to include, e.g. module/database.h original value given at command line. */ 00061 const char *include_help; /**< @brief Database definition file to include, e.g. module/database.h help description. */ 00062 char * class_arg; /**< @brief Class name if different from default. */ 00063 char * class_orig; /**< @brief Class name if different from default original value given at command line. */ 00064 const char *class_help; /**< @brief Class name if different from default help description. */ 00065 char * table_arg; /**< @brief Name of table to generate class for. */ 00066 char * table_orig; /**< @brief Name of table to generate class for original value given at command line. */ 00067 const char *table_help; /**< @brief Name of table to generate class for help description. */ 00068 char * namespace_arg; /**< @brief Namespace(s) containing classes, e.g. 'Dv::Aiv' (default=''). */ 00069 char * namespace_orig; /**< @brief Namespace(s) containing classes, e.g. 'Dv::Aiv' original value given at command line. */ 00070 const char *namespace_help; /**< @brief Namespace(s) containing classes, e.g. 'Dv::Aiv' help description. */ 00071 int verbose_flag; /**< @brief Idle chatter (default=off). */ 00072 const char *verbose_help; /**< @brief Idle chatter help description. */ 00073 00074 unsigned int help_given ; /**< @brief Whether help was given. */ 00075 unsigned int version_given ; /**< @brief Whether version was given. */ 00076 unsigned int database_given ; /**< @brief Whether database was given. */ 00077 unsigned int user_given ; /**< @brief Whether user was given. */ 00078 unsigned int password_given ; /**< @brief Whether password was given. */ 00079 unsigned int host_given ; /**< @brief Whether host was given. */ 00080 unsigned int out_given ; /**< @brief Whether out was given. */ 00081 unsigned int xml_given ; /**< @brief Whether xml was given. */ 00082 unsigned int include_given ; /**< @brief Whether include was given. */ 00083 unsigned int class_given ; /**< @brief Whether class was given. */ 00084 unsigned int table_given ; /**< @brief Whether table was given. */ 00085 unsigned int namespace_given ; /**< @brief Whether namespace was given. */ 00086 unsigned int verbose_given ; /**< @brief Whether verbose was given. */ 00087 00088 } ; 00089 00090 /** @brief The additional parameters to pass to parser functions */ 00091 struct cmdline_parser_params 00092 { 00093 int override; /**< @brief whether to override possibly already present options (default 0) */ 00094 int initialize; /**< @brief whether to initialize the option structure db2cppc_args (default 1) */ 00095 int check_required; /**< @brief whether to check that all required options were provided (default 1) */ 00096 int check_ambiguity; /**< @brief whether to check for options already specified in the option structure db2cppc_args (default 0) */ 00097 int print_errors; /**< @brief whether getopt_long should print an error message for a bad option (default 1) */ 00098 } ; 00099 00100 /** @brief the purpose string of the program */ 00101 extern const char *db2cppc_args_purpose; 00102 /** @brief the usage string of the program */ 00103 extern const char *db2cppc_args_usage; 00104 /** @brief all the lines making the help output */ 00105 extern const char *db2cppc_args_help[]; 00106 00107 /** 00108 * The command line parser 00109 * @param argc the number of command line options 00110 * @param argv the command line options 00111 * @param args_info the structure where option information will be stored 00112 * @return 0 if everything went fine, NON 0 if an error took place 00113 */ 00114 int cmdline_parser (int argc, char * const *argv, 00115 struct db2cppc_args *args_info); 00116 00117 /** 00118 * The command line parser (version with additional parameters - deprecated) 00119 * @param argc the number of command line options 00120 * @param argv the command line options 00121 * @param args_info the structure where option information will be stored 00122 * @param override whether to override possibly already present options 00123 * @param initialize whether to initialize the option structure my_args_info 00124 * @param check_required whether to check that all required options were provided 00125 * @return 0 if everything went fine, NON 0 if an error took place 00126 * @deprecated use cmdline_parser_ext() instead 00127 */ 00128 int cmdline_parser2 (int argc, char * const *argv, 00129 struct db2cppc_args *args_info, 00130 int override, int initialize, int check_required); 00131 00132 /** 00133 * The command line parser (version with additional parameters) 00134 * @param argc the number of command line options 00135 * @param argv the command line options 00136 * @param args_info the structure where option information will be stored 00137 * @param params additional parameters for the parser 00138 * @return 0 if everything went fine, NON 0 if an error took place 00139 */ 00140 int cmdline_parser_ext (int argc, char * const *argv, 00141 struct db2cppc_args *args_info, 00142 struct cmdline_parser_params *params); 00143 00144 /** 00145 * Save the contents of the option struct into an already open FILE stream. 00146 * @param outfile the stream where to dump options 00147 * @param args_info the option struct to dump 00148 * @return 0 if everything went fine, NON 0 if an error took place 00149 */ 00150 int cmdline_parser_dump(FILE *outfile, 00151 struct db2cppc_args *args_info); 00152 00153 /** 00154 * Save the contents of the option struct into a (text) file. 00155 * This file can be read by the config file parser (if generated by gengetopt) 00156 * @param filename the file where to save 00157 * @param args_info the option struct to save 00158 * @return 0 if everything went fine, NON 0 if an error took place 00159 */ 00160 int cmdline_parser_file_save(const char *filename, 00161 struct db2cppc_args *args_info); 00162 00163 /** 00164 * Print the help 00165 */ 00166 void cmdline_parser_print_help(void); 00167 /** 00168 * Print the version 00169 */ 00170 void cmdline_parser_print_version(void); 00171 00172 /** 00173 * Initializes all the fields a cmdline_parser_params structure 00174 * to their default values 00175 * @param params the structure to initialize 00176 */ 00177 void cmdline_parser_params_init(struct cmdline_parser_params *params); 00178 00179 /** 00180 * Allocates dynamically a cmdline_parser_params structure and initializes 00181 * all its fields to their default values 00182 * @return the created and initialized cmdline_parser_params structure 00183 */ 00184 struct cmdline_parser_params *cmdline_parser_params_create(void); 00185 00186 /** 00187 * Initializes the passed db2cppc_args structure's fields 00188 * (also set default values for options that have a default) 00189 * @param args_info the structure to initialize 00190 */ 00191 void cmdline_parser_init (struct db2cppc_args *args_info); 00192 /** 00193 * Deallocates the string fields of the db2cppc_args structure 00194 * (but does not deallocate the structure itself) 00195 * @param args_info the structure to deallocate 00196 */ 00197 void cmdline_parser_free (struct db2cppc_args *args_info); 00198 00199 /** 00200 * Checks that all the required options were specified 00201 * @param args_info the structure to check 00202 * @param prog_name the name of the program that will be used to print 00203 * possible errors 00204 * @return 00205 */ 00206 int cmdline_parser_required (struct db2cppc_args *args_info, 00207 const char *prog_name); 00208 00209 00210 #ifdef __cplusplus 00211 } 00212 #endif /* __cplusplus */ 00213 #endif /* DB2CPPC_CMDLINE_H */
dvmysql-1.0.3 | [17 November, 2010] |