00001
00015 #ifndef COPT_H_INCLUDED
00016 #define COPT_H_INCLUDED
00017
00018 #include <Coconut/coconut-sysdep.h>
00019
00021 typedef enum {
00023 COPT_ARG_TYPE_NONE,
00025 COPT_ARG_TYPE_STRING,
00027 COPT_ARG_TYPE_INT
00028 } COptArgType ;
00029
00037 @interface COpt : NSObject
00038 {
00040 uint_t opt_id ;
00041
00043 BOOL is_given ;
00044
00046 NSString * long_name ;
00048 char short_name ;
00049
00051 COptArgType arg_type ;
00053 union {
00055 NSString * str_arg ;
00057 int int_arg ;
00058 } arg_data ;
00059
00061 NSString * opt_desc ;
00063 NSString * arg_desc ;
00064 }
00065
00075 - initOptNoArg: (char) sname longName: (const char *) lname
00076 optDesc: (const char *) odesc ;
00077
00088 - initOptHasStr: (char) sname longName: (const char *) lname
00089 optDesc: (const char *) odesc argDesc: (const char *) adesc ;
00090
00101 - initOptHasNum: (char) sname longName: (const char *) lname
00102 optDesc: (const char *) odesc argDesc: (const char *) adesc ;
00103
00109 - (void) dealloc ;
00110
00117 - (int) optId ;
00118
00125 - (void) setGivenFlag: (BOOL) flag ;
00126
00133 - (BOOL) isGiven ;
00134
00142 - (NSString *) longName ;
00143
00151 - (char) shortName ;
00152
00159 - (COptArgType) argType ;
00160
00167 - (void) setStrArg: (NSString *) src ;
00168
00177 - (NSString *) strArg ;
00178
00185 - (void) setIntArg: (int) src ;
00186
00194 - (int) intArg ;
00195
00202 - (NSString *) optDescription ;
00203
00211 - (NSString *) stringForOptionsForHelpMessage ;
00212
00219 - (void) print: (FILE *) outfp ;
00220
00221 @end
00222
00223 #endif
00224