diff options
Diffstat (limited to 'TAO/CIAO/CCF/CCF/CodeGenerationKit/CommandLine.hpp')
-rw-r--r-- | TAO/CIAO/CCF/CCF/CodeGenerationKit/CommandLine.hpp | 227 |
1 files changed, 0 insertions, 227 deletions
diff --git a/TAO/CIAO/CCF/CCF/CodeGenerationKit/CommandLine.hpp b/TAO/CIAO/CCF/CCF/CodeGenerationKit/CommandLine.hpp deleted file mode 100644 index 69d5716eeb8..00000000000 --- a/TAO/CIAO/CCF/CCF/CodeGenerationKit/CommandLine.hpp +++ /dev/null @@ -1,227 +0,0 @@ -// file : CCF/CodeGenerationKit/CommandLine.hpp -// author : Boris Kolpackov <boris@dre.vanderbilt.edu> -// cvs-id : $Id$ - -#ifndef COMMAND_LINE_HPP -#define COMMAND_LINE_HPP - -#include <algorithm> -#include <vector> -#include <string> - -//@@ this stuff needs proper reimplementation - -class CommandLine -{ -public: - - CommandLine () throw () : separator (false) {} - - - // Option constrain checking -public: - - bool - require (std::string option) const throw () - { - return std::find_if (options.begin (), - options.end (), - OptionNamePredicat (option)) != options.end (); - } - - bool - depends (std::string dependant, - std::string principal) const throw () - { - Options::const_iterator begin = options.begin (); - Options::const_iterator end = options.end (); - - if (std::find_if (begin, end, OptionNamePredicat (dependant)) != end) - { - return std::find_if (begin, end, OptionNamePredicat (principal)) != end; - } - else - { - return true; - } - } - - bool - inconsistent (std::string a, - std::string b) const throw () - { - Options::const_iterator begin = options.begin (); - Options::const_iterator end = options.end (); - - if (std::find_if (begin, end, OptionNamePredicat (a)) != end) - { - return std::find_if (begin, end, OptionNamePredicat (b)) == end; - } - else - { - return true; - } - } - - std::string - get_value (std::string name, std::string const& not_found_value) const - { - Options::const_iterator i = std::find_if ( - options.begin (), - options.end (), - OptionNamePredicat (name)); - - if (i != options.end () && !(i->value_.empty ())) - { - return i->value_; - } - else - { - return not_found_value; - } - } - - // @@ the option should probably be searched in reverse order - // - - std::string - get_value (std::string name, char const* not_found_value) const - { - Options::const_iterator i = std::find_if ( - options.begin (), - options.end (), - OptionNamePredicat (name)); - - if (i != options.end () && !(i->value_.empty ())) - { - return i->value_; - } - else - { - return std::string (not_found_value); - } - } - - bool - get_value (std::string name, bool not_found_value) const - { - Options::const_iterator i = std::find_if ( - options.begin (), - options.end (), - OptionNamePredicat (name)); - - if (i != options.end ()) - { - return true; - } - else - { - return not_found_value; - } - } - - - struct Option - { - enum OptionType - { - EQUATIONAL, - COMPOSITE - }; - - Option (OptionType type, - std::string const& name, - std::string const& value) throw () - : type_ (type), - name_ (name), - value_ (value) - { - } - - std::string - name () const - { - return name_; - } - - std::string - value () const - { - return value_; - } - - OptionType type_; - std::string name_; - std::string value_; - }; - - typedef - std::vector<Option> - Options; - - typedef - Options::const_iterator - OptionsIterator; - - OptionsIterator - options_begin () const - { - return options.begin (); - } - - OptionsIterator - options_end () const - { - return options.end (); - } - - // Arguments - // - // - - typedef - std::vector<std::string> - Arguments; - - typedef - Arguments::const_iterator - ArgumentsIterator; - - ArgumentsIterator - arguments_begin () const - { - return arguments.begin (); - } - - ArgumentsIterator - arguments_end () const - { - return arguments.end (); - } - -public: - - struct OptionNamePredicat - { - OptionNamePredicat (std::string const& name) - : name_ (name) - { - } - - bool operator ()(Option const& option) throw () - { - return name_ == option.name_; - } - - private: - std::string const name_; - }; - - std::string command; - Options options; - Arguments arguments; - - bool separator; -}; - -#endif // COMMAND_LINE_HPP |