From 09b95e1089c22df6220f06e3190009f9cece5a6b Mon Sep 17 00:00:00 2001 From: ljb1 Date: Sun, 29 Aug 1999 06:11:13 +0000 Subject: ChangeLogTag: Sun Aug 29 00:14:09 1999 Luther Baker --- ace/Arg_Shifter.h | 48 +++++++++++++++++++++--------------------------- 1 file changed, 21 insertions(+), 27 deletions(-) (limited to 'ace/Arg_Shifter.h') diff --git a/ace/Arg_Shifter.h b/ace/Arg_Shifter.h index 012adfd3c0d..30ca53a9706 100644 --- a/ace/Arg_Shifter.h +++ b/ace/Arg_Shifter.h @@ -54,40 +54,34 @@ public: char* get_current (void) const; // Get the current head of the vector. - char* is_or_contains_ignore_case(const char* flag); - // Check if the current argument matches + int cur_arg_strncasecmp(const char* flag); + // Check if the current argument matches (case insensitive) // - // An argument matches if: - // - it STARTS with - // - any character may appear after the flag including - // - digits, spaces, characters or nothing at all - // - match is case insensitive. - // - ie: "-Foobar" "-FOOBAR" "-fOobAr" "-foobarVALUE" - // - all match the "-FooBar" + // ------------------------------------------------------------ // - // If there is NOT a match, nil is returned + // Case A: Perfect Match (case insensitive) + // 0 is returned. // - // If there IS a match: - // An attempt is made to return the 's parameter (or 'value') + // ie: when current_arg = "-foobar" or "-FOOBAR" or "-fooBAR" + // this->cur_arg_strncasecmp ("-FooBar); + // will return 0 // - // Case A: value is separated from flag with a space: - // Arg_Shifter calls consume_arg() () and advances to the next arg - // If the new current argument passes is_parameter_next() - // - we return the 'new' current argument, ('value') - // else, we return nil + // ------------------------------------------------------------ // - // Case B: value is mangled together with flag: ie: "-fooBarVALUE" - // A char* is returned - pointing to VALUE + // Case B: Perfect Match (case insensitive) but the current_arg + // is longer than the flag. Returns a number equal to the index + // in the char* indicating the start of the extra characters // - // This operation consumes the current argument if: - // - there is a match && - // - and the value for the flag is separated from the flag with a space. - // This operation does not consume the current argument if: - // - there is a match but - // - there is no space separating the value from the flag "-FooBarVALUE" + // ie: when current_arg = "-foobar98023" + // this->cur_arg_strncasecmp ("-FooBar); + // will return 7 // - // This method is safe to call without checking for a valid - // current argument. + // Notice: this number will always be > 0 + // + // ------------------------------------------------------------ + // + // Case C: If neither of Case A or B is met (no match) + // then -1 is returned int consume_arg (int number = 1); // Consume argument(s) by sticking them/it on the end of -- cgit v1.2.1