最新的版本ACE-5.6.8,刚从外文网上搬下,与大家分享.

源代码在线查看: command.cpp

软件大小: 24894 K
上传用户: guozhongjiesg02
关键词: ACE 版本
下载地址: 免注册下载 普通下载 VIP

相关代码

				/* FUZZ: disable check_for_improper_main_declaration */
				
				#include 
				#include 
				
				using std::cerr;
				using std::endl;
				
				class Command
				{
				public:
				  enum Value
				  {
				    HELP = 0,
				    VERSION,
				    DEFAULT
				  };
				
				  Command (Value v = Command::DEFAULT)
				      : v_ (v)
				  {
				  }
				
				  operator Value () const
				  {
				    return v_;
				  }
				
				  friend std::ostream&
				  operator				
				  friend std::istream&
				  operator>> (std::istream& is, Command& c);
				
				private:
				  Value v_;
				  static char* labels_[];
				};
				
				char* Command::labels_[] = {"help", "version", "default"};
				
				
				std::ostream&
				operator				{
				  return os 				}
				
				std::istream&
				operator>> (std::istream& is, Command& c)
				{
				  std::string s;
				  is >> s;
				  if (is)
				  {
				    if (s == Command::labels_[Command::HELP]) c.v_ = Command::HELP;
				    else if (s == Command::labels_[Command::VERSION]) c.v_ = Command::VERSION;
				    else is.setstate (std::ios::failbit);
				  }
				  return is;
				}
				
				int
				main ()
				{
				  Command c = Command::HELP;
				
				  c = Command::DEFAULT;
				
				  Command c1 (Command::HELP);
				
				  c = c1;
				
				  cerr 				
				  switch (c)
				  {
				  case Command::HELP:
				    {
				      cerr 				    }
				  }
				
				  std::cin >> c1;
				  if (std::cin) cerr 				  else cerr 				}
				//$Id: command.cpp 80826 2008-03-04 14:51:23Z wotte $
							

相关资源