⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 options.cpp

📁 一个开源的网络开发库ACE
💻 CPP
字号:
// Options.cpp,v 1.5 2001/12/26 15:46:23 schmidt Exp

#include "ace/Get_Opt.h"
#include "ace/ARGV.h"
#include "Blob.h"
#include "Blob_Handler.h"
#include "Options.h"

ACE_RCSID(Blobby, Options, "Options.cpp,v 1.5 2001/12/26 15:46:23 schmidt Exp")

Options *Options::instance_ = 0;

Options *
Options::instance (void)
{

  if (Options::instance_ == 0) 
    Options::instance_ = new Options;

  return Options::instance_;
}

void
Options::parse_args (int argc, ACE_TCHAR *argv[])
{
  ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("rwh:p:f:l:o:d"));

  int c;

  while ((c = get_opt ()) != -1)
    switch (c)
      {
      case 'd':
        this->debug_ = 1;
        break;
      case 'r':
        this->operation_ = 'r';
        break;
      case 'w':
        this->operation_ = 'w';
        break;
      case 'h':
        this->hostname_ = get_opt.opt_arg ();
        break;
      case 'p':
        this->port_ = ACE_OS::atoi (get_opt.opt_arg ());
        break;
      case 'f':
        this->filename_ = get_opt.opt_arg ();
        break;
      case 'l':
        this->length_ = ACE_OS::atoi (get_opt.opt_arg ());
        break;
      case 'o':
        this->offset_ = ACE_OS::atoi (get_opt.opt_arg ());
        break;
        // Usage fallthrough.
      default:
        ACE_DEBUG ((LM_DEBUG, "%s -h hostname -f filename -[r/w] [-p port] [-l length] [-o offset] [-d]\n", argv[0]));
        ACE_OS::exit (1);
      }
  if (this->hostname_ == 0 || this->filename_ == 0)
    {
      ACE_DEBUG ((LM_DEBUG, 
		  "%s -h hostname -f filename -[r/w] [-p port] [-l length] [-o offset] [-d]\n", 
		  argv[0]));
      ACE_OS::exit (1);
    }

}

Options::Options (void) 
  : hostname_ (0),
    port_ (ACE_DEFAULT_HTTP_SERVER_PORT),
    filename_ (0),
    length_ (0),
    offset_ (0),
    operation_ ('r'),
    debug_ (0)
{
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -