diff options
author | seibelr <seibelr@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2006-11-24 22:12:20 +0000 |
---|---|---|
committer | seibelr <seibelr@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2006-11-24 22:12:20 +0000 |
commit | 47b676670dc9373bc77af80388e0b51e36134738 (patch) | |
tree | aacce0809279e1d142e7b196a84ff10dfbdae4d0 /CIAO/CCF/CCF/CodeGenerationKit/CommandLineParser.cpp | |
parent | 3dd4e2fe6c64de3a9db04757eade78d764b578f1 (diff) | |
download | ATCD-GH5_0port.tar.gz |
Added the ACE and TAO for this branchGH5_0port
Diffstat (limited to 'CIAO/CCF/CCF/CodeGenerationKit/CommandLineParser.cpp')
-rw-r--r-- | CIAO/CCF/CCF/CodeGenerationKit/CommandLineParser.cpp | 120 |
1 files changed, 0 insertions, 120 deletions
diff --git a/CIAO/CCF/CCF/CodeGenerationKit/CommandLineParser.cpp b/CIAO/CCF/CCF/CodeGenerationKit/CommandLineParser.cpp deleted file mode 100644 index 5f7d1d603bd..00000000000 --- a/CIAO/CCF/CCF/CodeGenerationKit/CommandLineParser.cpp +++ /dev/null @@ -1,120 +0,0 @@ -// file : CCF/CodeGenerationKit/CommandLineParser.cpp -// author : Boris Kolpackov <boris@dre.vanderbilt.edu> -// cvs-id : $Id$ - -#include "CCF/CodeGenerationKit/CommandLineParser.hpp" - -#include <string> -#include <iostream> - -using std::cerr; -using std::endl; - -bool -parse (int argc, char* argv[], CL::Description const& cld, CommandLine& cl) -{ - cl.command = argv[0]; - - bool seen_double_dash (false); - - for (int i (1); i < argc; ++i) - { - std::string arg (argv[i]); - - if (seen_double_dash) - { - cl.arguments.push_back (arg); - continue; - } - - if (arg == "--") - { - seen_double_dash = true; - continue; - } - - if (arg.length () > 0 && arg[0] == '-') - { - if (arg.length () > 1 && arg[1] == '-') - { - // Double-dash (long) option. - // - - std::string op (arg, 2); - - if (CL::OptionDescription const* d = cld.find_option (op)) - { - if (d->type () == CL::OptionType::value) - { - if (++i >= argc) - { - cerr << argv[0] << ": argument expected for option '--" - << op << "'" << endl; - return false; - } - - // cerr << "--" << op << ": " << argv[i] << endl; - - cl.options.push_back (CommandLine::Option (op, argv[i])); - } - else - cl.options.push_back (CommandLine::Option (op)); - - continue; - } - } - else - { - // Single-dash (short) option. We support two formats: '-D foo' and - // -Dfoo. - // - std::string op (arg, 1, 1); - - if (CL::OptionDescription const* d = cld.find_option (op)) - { - if (d->type () == CL::OptionType::value) - { - std::string value; - - if (arg.length () > 2) - { - value.assign (arg, 2, arg.size () - 2); - } - else - { - if (++i >= argc) - { - cerr << argv[0] << ": argument expected for option '-" - << op << "'" << endl; - return false; - } - - value = argv[i]; - } - - // cerr << "-" << op << ": " << value << endl; - - cl.options.push_back (CommandLine::Option (op, value)); - } - else - { - if (arg.length () > 2) - { - cerr << argv[0] << ": argument not expected for option '-" - << op << "' in '" << arg << "'" << endl; - return false; - } - - cl.options.push_back (CommandLine::Option (op)); - } - - continue; - } - } - } - - cl.arguments.push_back (arg); - } - - return true; -} |