当前位置: 首页>>代码示例>>C++>>正文


C++ CStrRef::toInt64方法代码示例

本文整理汇总了C++中CStrRef::toInt64方法的典型用法代码示例。如果您正苦于以下问题:C++ CStrRef::toInt64方法的具体用法?C++ CStrRef::toInt64怎么用?C++ CStrRef::toInt64使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CStrRef的用法示例。


在下文中一共展示了CStrRef::toInt64方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Set

bool IniSetting::Set(CStrRef name, CStrRef value) {
    CallbackMap::iterator iter = s_callbacks->find(name.data());
    if (iter != s_callbacks->end()) {
        return (*iter->second.callback)(value, iter->second.p);
    }
    if (name == "memory_limit") {
        if (!value.empty()) {
            int64_t newInt = value.toInt64();
            char lastChar = value.charAt(value.size() - 1);
            if (lastChar == 'K' || lastChar == 'k') {
                newInt <<= 10;
            } else if (lastChar == 'M' || lastChar == 'm') {
                newInt <<= 20;
            } else if (lastChar == 'G' || lastChar == 'g') {
                newInt <<= 30;
            }
            g_context->setRequestMemoryMaxBytes(newInt);
            return true;
        }
    } else if (name == "max_execution_time" || name == "maximum_execution_time") {
        int64_t limit = value.toInt64();
        TimeoutThread::DeferTimeout(limit);
        // Just for ini_get
        g_context->setRequestTimeLimit(limit);
        return true;
    } else if (name == "arg_separator.output") {
        g_context->setArgSeparatorOutput(value);
        return true;
    } else if (name == "log_errors") {
        bool log;
        ini_on_update_bool(value, &log);
        g_context->setLogErrors(log);
        return true;
    } else if (name == "error_log") {
        g_context->setErrorLog(value);
        return true;
    } else if (name == "notice_frequency") {
        RuntimeOption::NoticeFrequency = value.toInt64();
        return true;
    } else if (name == "warning_frequency") {
        RuntimeOption::WarningFrequency = value.toInt64();
        return true;
    } else if (name == "include_path") {
        g_context->setIncludePath(value);
        return true;
    }

    return false;
}
开发者ID:TingoZhou,项目名称:hiphop-php,代码行数:49,代码来源:ini_setting.cpp

示例2: Set

bool IniSetting::Set(CStrRef name, CStrRef value) {
  CallbackMap::iterator iter = s_callbacks->find(name.data());
  if (iter != s_callbacks->end()) {
    return (*iter->second.callback)(value, iter->second.p);
  }
  if (name == s_memory_limit) {
    if (!value.empty()) {
      int64_t newInt = value.toInt64();
      char lastChar = value.charAt(value.size() - 1);
      if (lastChar == 'K' || lastChar == 'k') {
        newInt <<= 10;
      } else if (lastChar == 'M' || lastChar == 'm') {
        newInt <<= 20;
      } else if (lastChar == 'G' || lastChar == 'g') {
        newInt <<= 30;
      }
      g_context->setRequestMemoryMaxBytes(newInt);
      return true;
    }
  } else if (name == s_max_execution_time || name == s_maximum_execution_time){
    int64_t limit = value.toInt64();
    ThreadInfo::s_threadInfo.getNoCheck()->
      m_reqInjectionData.setTimeout(limit);
    return true;
  } else if (name == s_arg_separator_output) {
    g_context->setArgSeparatorOutput(value);
    return true;
  } else if (name == s_log_errors) {
    bool log;
    ini_on_update_bool(value, &log);
    g_context->setLogErrors(log);
    return true;
  } else if (name == s_error_log) {
    g_context->setErrorLog(value);
    return true;
  } else if (name == s_notice_frequency) {
    RuntimeOption::NoticeFrequency = value.toInt64();
    return true;
  } else if (name == s_warning_frequency) {
    RuntimeOption::WarningFrequency = value.toInt64();
    return true;
  } else if (name == s_include_path) {
    g_context->setIncludePath(value);
    return true;
  }

  return false;
}
开发者ID:Tlamelo,项目名称:hiphop-php,代码行数:48,代码来源:ini-setting.cpp

示例3: ini_on_update_non_negative

bool ini_on_update_non_negative(CStrRef value, void *p) {
    int64_t v = value.toInt64();
    if (v < 0) {
        return false;
    }
    if (p) {
        *((int64_t*)p) = v;
    }
    return true;
}
开发者ID:TingoZhou,项目名称:hiphop-php,代码行数:10,代码来源:ini_setting.cpp

示例4: ini_on_update_long

bool ini_on_update_long(CStrRef value, void *p) {
    if (p) {
        *((int64_t*)p) = value.toInt64();
    }
    return true;
}
开发者ID:TingoZhou,项目名称:hiphop-php,代码行数:6,代码来源:ini_setting.cpp


注:本文中的CStrRef::toInt64方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。