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

📄 options.cpp

📁 最新的版本ACE-5.6.8,刚从外文网上搬下,与大家分享.
💻 CPP
📖 第 1 页 / 共 3 页
字号:
            ACE_SET_BITS (option_word_, MUTE);
            break;
          }
        // Skip the class definition while in C++ mode.
        case 'M':
          {
            ACE_SET_BITS (option_word_, SKIPCLASS);
            break;
          }
        // Don't include the length when computing hash function.
        case 'n':
          {
            ACE_SET_BITS (option_word_, NOLENGTH);
            break;
          }
        // Make generated lookup function name be.opt_arg ()
        case 'N':
          {
            function_name_ = ACE_TEXT_ALWAYS_CHAR(getopt.opt_arg ());
            break;
          }
        // Make fill_default be.opt_arg ()
        case 'F':
          {
            fill_default_ = ACE_TEXT_ALWAYS_CHAR(getopt.opt_arg ());
            break;
          }
        // Order input by frequency of key set occurrence.
        case 'o':
          {
            ACE_SET_BITS (option_word_, ORDER);
            break;
          }
        case 'O':
          {
            ACE_SET_BITS (option_word_, OPTIMIZE);
            break;
          }
        // Generated lookup function now a pointer instead of int.
        case 'p':
          {
            ACE_SET_BITS (option_word_, POINTER);
            break;
          }
        // Utilize randomness to initialize the associated values
        // table.
        case 'r':
          {
            ACE_SET_BITS (option_word_, RANDOM);
            if (initial_asso_value_ != 0)
              ACE_ERROR ((LM_ERROR,
                          "warning, -r option superceeds -i, disabling -i option and continuing\n"));
            break;
          }
        // Range of associated values, determines size of final table.
        case 's':
          {
            size_ = ACE_OS::atoi (getopt.opt_arg ());
            if (abs (size_) > 50)
              ACE_ERROR ((LM_ERROR,
                          "%d is excessive, did you really mean this?! (type %n -h for help)\n",
                          size_));
            break;
          }
        // Generate switch statement output, rather than lookup table.
        case 'S':
          {
            ACE_SET_BITS (option_word_, SWITCH);
            total_switches_ = ACE_OS::atoi (getopt.opt_arg ());
            if (total_switches_ <= 0)
              ACE_ERROR_RETURN ((LM_ERROR,
                                 "number of switches %s must be a positive number\n%r",
                                 getopt.opt_arg (),
                                 &Options::usage),
                                -1);
            break;
          }
        // Enable the TYPE mode, allowing arbitrary user structures.
        case 't':
          {
            ACE_SET_BITS (option_word_, TYPE);
            break;
          }
        // Don't print structure definition.
        case 'T':
          {
            ACE_SET_BITS (option_word_, NOTYPE);
            break;
          }
        // Print out the version and quit.
        case 'v':
          ACE_ERROR ((LM_ERROR,
                      "%n: version %s\n%r\n",
                      version_string,
                      &Options::usage));
          ACE_OS::exit (0);
          /* NOTREACHED */
          break;
        // Exit with value of 0 (this is useful to check if gperf exists)
        case 'V':
          ACE_OS::exit (0);
          /* NOTREACHED */
          break;
        // Set the class name.
        case 'Z':
          {
            class_name_ = ACE_TEXT_ALWAYS_CHAR(getopt.opt_arg ());
            break;
          }
        default:
          ACE_ERROR_RETURN ((LM_ERROR,
                             "%r",
                             &Options::usage),
                            -1);
        }

    }

  if (argv[getopt.opt_ind ()] &&
    ACE_OS::freopen (argv[getopt.opt_ind ()],
                     ACE_TEXT("r"),
                     stdin) == 0)
    ACE_ERROR_RETURN ((LM_ERROR,
                       "Cannot open keyword file %p\n%r",
                       argv[getopt.opt_ind ()],
                       &Options::usage),
                      -1);
  if (getopt.opt_ind () + 1 < argc)
    ACE_ERROR_RETURN ((LM_ERROR,
                       "Extra trailing arguments to %n.\n%r",
                       usage),
                      -1);
  return 0;
}

// True if option enable, else false.

int
Options::operator[] (Option_Type option)
{
  return ACE_BIT_ENABLED (option_word_, option);
}

// Enables option OPT.

void
Options::operator = (enum Option_Type opt)
{
  ACE_SET_BITS (option_word_, opt);
}

// Disables option OPT.

bool
Options::operator != (enum Option_Type opt)
{
  // @@ Why is this inequality comparison operator clearing bits?
  ACE_CLR_BITS (option_word_, opt);

  return true;
}

// Initializes the key Iterator.

void
Options::reset (void)
{
  key_pos_ = 0;
}

// Returns current key_position and advanced index.

int
Options::get (void)
{
  return key_positions_[key_pos_++];
}

// Sets the size of the table size.

void
Options::asso_max (int r)
{
  size_ = r;
}

// Returns the size of the table size.

int
Options::asso_max (void)
{
  return size_;
}

// Returns total distinct key positions.

u_int
Options::max_keysig_size (void)
{
  return total_keysig_size_;
}

// Sets total distinct key positions.

void
Options::keysig_size (u_int a_size)
{
  total_keysig_size_ = a_size;
}

// Returns the jump value.

int
Options::jump (void)
{
  return jump_;
}

// Returns the generated function name.

const char *
Options::function_name (void)
{
  return function_name_.c_str ();
}

// Returns the fill default

const char *
Options::fill_default (void)
{
  return fill_default_.c_str ();
}

// Returns the keyword key name.

const char *
Options::key_name (void)
{
  return key_name_.c_str ();
}

// Returns the hash function name.

const char *
Options::hash_name (void)
{
  return hash_name_.c_str ();
}

// Returns the generated class name.

const char *
Options::class_name (void)
{
  return class_name_.c_str ();
}

// Returns the initial associated character value.

int
Options::initial_value (void)
{
  return initial_asso_value_;
}

// Returns the iterations value.

int
Options::iterations (void)
{
  return iterations_;
}

// Returns the string used to delimit keywords from other attributes.

const char *
Options::delimiter (void)
{
  return delimiters_.c_str ();
}

// Gets the total number of switch statements to generate.

int
Options::total_switches (void)
{
  return total_switches_;
}

#endif /* ACE_HAS_GPERF */

⌨️ 快捷键说明

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