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


C++ VRefParam::isArray方法代码示例

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


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

示例1: f_hphp_current_ref

Variant f_hphp_current_ref(VRefParam array) {
  if (!array.isArray()) {
    throw_bad_array_exception();
    return false;
  }
  return strongBind(array.array_iter_current_ref());
}
开发者ID:7755373049,项目名称:hiphop-php,代码行数:7,代码来源:ext_array.cpp

示例2: f_shuffle

bool f_shuffle(VRefParam array) {
  if (!array.isArray()) {
    throw_bad_array_exception();
    return false;
  }
  array = ArrayUtil::Shuffle(array);
  return true;
}
开发者ID:SagaieNet,项目名称:hiphop-php,代码行数:8,代码来源:ext_array.cpp

示例3: HHVM_METHOD

static bool HHVM_METHOD(Collator, sort, VRefParam arr,
                        int64_t sort_flag /* = Collator::SORT_REGULAR */) {
  FETCH_COL(data, this_, false);
  if (!arr.isArray()) {
    throw_expected_array_exception();
    return false;
  }
  data->clearError();
  bool ret = collator_sort(arr, sort_flag, true, data->collator(), data);
  if (U_FAILURE(data->getErrorCode())) {
    return false;
  }
  return ret;
}
开发者ID:Dream-Seeker,项目名称:hhvm,代码行数:14,代码来源:ext_icu_collator.cpp

示例4: f_array_walk

bool f_array_walk(VRefParam input, CVarRef funcname,
                  CVarRef userdata /* = null_variant */) {
  if (!input.isArray()) {
    throw_bad_array_exception();
    return false;
  }
  CallCtx ctx;
  CallerFrame cf;
  vm_decode_function(funcname, cf(), false, ctx);
  if (ctx.func == NULL) {
    return false;
  }
  ArrayUtil::Walk(input, walk_func, &ctx, false, NULL, userdata);
  return true;
}
开发者ID:vincentbdb,项目名称:hiphop-php,代码行数:15,代码来源:ext_array.cpp

示例5: f_array_walk_recursive

bool f_array_walk_recursive(VRefParam input, CVarRef funcname,
                            CVarRef userdata /* = null_variant */) {
  if (!input.isArray()) {
    throw_bad_array_exception();
    return false;
  }
  CallCtx ctx;
  CallerFrame cf;
  vm_decode_function(funcname, cf(), false, ctx);
  if (ctx.func == NULL) {
    return uninit_null();
  }
  PointerSet seen;
  ArrayUtil::Walk(input, walk_func, &ctx, true, &seen, userdata);
  return true;
}
开发者ID:mariusz-szydzik,项目名称:hiphop-php,代码行数:16,代码来源:ext_array.cpp

示例6: t_sort

bool c_Collator::t_sort(VRefParam arr,
                        int64_t sort_flag /* = q_Collator$$SORT_REGULAR */) {
  if (!arr.isArray()) {
    throw_expected_array_exception();
    return false;
  }
  if (!m_ucoll) {
    raise_warning("sort called on uninitialized Collator object");
    return false;
  }
  m_errcode.clearError();
  bool ret = collator_sort(arr, sort_flag, true, m_ucoll, &m_errcode);
  if (U_FAILURE(m_errcode.getErrorCode())) {
    return false;
  }
  return ret;
}
开发者ID:artursmolarek,项目名称:hhvm,代码行数:17,代码来源:ext_intl.cpp

示例7: f_hphp_get_iterator

static Variant f_hphp_get_iterator(VRefParam iterable, bool isMutable) {
  if (iterable.isArray()) {
    if (isMutable) {
      return create_object(s_MutableArrayIterator,
                           CREATE_VECTOR1(ref(iterable)));
    }
    return create_object(s_ArrayIterator,
                         CREATE_VECTOR1(iterable));
  }
  if (iterable.isObject()) {
    ObjectData *obj = iterable.getObjectData();
    Variant iterator;
    while (obj->instanceof(SystemLib::s_IteratorAggregateClass)) {
      iterator = obj->o_invoke(s_getIterator, Array());
      if (!iterator.isObject()) break;
      obj = iterator.getObjectData();
    }
    VM::Class*ctx = g_vmContext->getContextClass();
    CStrRef context = ctx ? ctx->nameRef() : empty_string;
    if (isMutable) {
      if (obj->instanceof(SystemLib::s_IteratorClass)) {
        throw FatalErrorException("An iterator cannot be used for "
                                  "iteration by reference");
      }
      Array properties = obj->o_toIterArray(context, true);
      return create_object(s_MutableArrayIterator,
                           CREATE_VECTOR1(ref(properties)));
    } else {
      if (obj->instanceof(SystemLib::s_IteratorClass)) {
        return obj;
      }
      return create_object(s_ArrayIterator,
                           CREATE_VECTOR1(obj->o_toIterArray(context)));
    }
  }
  raise_warning("Invalid argument supplied for iteration");
  if (isMutable) {
    return create_object(s_MutableArrayIterator,
                         CREATE_VECTOR1(Array::Create()));
  }
  return create_object(s_ArrayIterator,
                       CREATE_VECTOR1(Array::Create()));
}
开发者ID:SagaieNet,项目名称:hiphop-php,代码行数:43,代码来源:ext_array.cpp

示例8: t_sort

bool c_Collator::t_sort(VRefParam arr,
                        int64_t sort_flag /* = q_Collator$$SORT_REGULAR */) {
  if (!arr.isArray()) {
    throw_bad_array_exception();
    return false;
  }
  if (!m_ucoll) {
    raise_warning("sort called on uninitialized Collator object");
    return false;
  }
  m_errcode.clear();
  bool ret = collator_sort(arr, sort_flag, true, m_ucoll, &(m_errcode));
  s_intl_error->m_error.clear();
  s_intl_error->m_error.code = m_errcode.code;
  s_intl_error->m_error.custom_error_message = m_errcode.custom_error_message;
  if (U_FAILURE(m_errcode.code)) {
    return false;
  }
  return ret;
}
开发者ID:360buyliulei,项目名称:hiphop-php,代码行数:20,代码来源:ext_intl.cpp

示例9: t_asort

bool c_Collator::t_asort(VRefParam arr,
                         int64 sort_flag /* = q_Collator___SORT_REGULAR */) {
  INSTANCE_METHOD_INJECTION_BUILTIN(Collator, Collator::asort);
  if (!arr.isArray()) {
    throw_bad_array_exception();
    return false;
  }
  if (!m_ucoll) {
    raise_warning("asort called on uninitialized Collator object");
    return false;
  }
  m_errcode.clear();
  bool ret = collator_asort(arr, sort_flag, true, m_ucoll, &m_errcode);
  s_intl_error->m_error.clear();
  s_intl_error->m_error.code = m_errcode.code;
  s_intl_error->m_error.custom_error_message = m_errcode.custom_error_message;
  if (U_FAILURE(m_errcode.code)) {
    return false;
  }
  return ret;
}
开发者ID:cdnewbee,项目名称:hiphop-php,代码行数:21,代码来源:ext_intl.cpp

示例10: t_sortwithsortkeys

bool c_Collator::t_sortwithsortkeys(VRefParam arr) {
  INSTANCE_METHOD_INJECTION_BUILTIN(Collator, Collator::sortwithsortkeys);
  char*       sortKeyBuf = NULL; /* buffer to store sort keys */
  int32_t     sortKeyBufSize = DEF_SORT_KEYS_BUF_SIZE; /* buffer size */
  ptrdiff_t   sortKeyBufOffset = 0; /* pos in buffer to store sort key */
  int32_t     sortKeyLen = 0; /* the length of currently processing key */
  int32_t     bufLeft = 0;
  int32_t     bufIncrement = 0;

  /* buffer to store 'indexes' which will be passed to 'qsort' */
  collator_sort_key_index_t* sortKeyIndxBuf = NULL;
  int32_t     sortKeyIndxBufSize   = DEF_SORT_KEYS_INDX_BUF_SIZE;
  int32_t     sortKeyIndxSize      = sizeof( collator_sort_key_index_t );

  int32_t     sortKeyCount         = 0;
  int32_t     j                    = 0;

  /* tmp buffer to hold current processing string in utf-16 */
  UChar*      utf16_buf            = NULL;
  /* the length of utf16_buf */
  int         utf16_buf_size       = DEF_UTF16_BUF_SIZE;
  /* length of converted string */
  int         utf16_len            = 0;

  m_errcode.clear();
  s_intl_error->m_error.clear();

  /*
   * Sort specified array.
   */
  if (!arr.isArray()) {
    return true;
  }
  Array hash = arr.toArray();
  if (hash.size() == 0) {
    return true;
  }

  /* Create bufers */
  sortKeyBuf     = (char*)calloc(sortKeyBufSize, sizeof(char));
  sortKeyIndxBuf = (collator_sort_key_index_t*)malloc(sortKeyIndxBufSize);
  utf16_buf      = (UChar*)malloc(utf16_buf_size);

  /* Iterate through input hash and create a sort key for each value. */
  for (ssize_t pos = hash->iter_begin(); pos != ArrayData::invalid_index;
       pos = hash->iter_advance(pos)) {
    /* Convert current hash item from UTF-8 to UTF-16LE and save the result
     * to utf16_buf. */
    utf16_len = utf16_buf_size;
    /* Process string values only. */
    Variant val(hash->getValue(pos));
    if (val.isString()) {
      String str = val.toString();
      intl_convert_utf8_to_utf16(&utf16_buf, &utf16_len, str.data(),
                                 str.size(), &(m_errcode.code));
      if (U_FAILURE(m_errcode.code)) {
        m_errcode.custom_error_message = "Sort with sort keys failed";
        if (utf16_buf) {
          free(utf16_buf);
        }
        free(sortKeyIndxBuf);
        free(sortKeyBuf);
        return false;
      }
    } else {
      /* Set empty string */
      utf16_len = 0;
      utf16_buf[utf16_len] = 0;
    }

    if ((utf16_len + 1) > utf16_buf_size) {
      utf16_buf_size = utf16_len + 1;
    }

    /* Get sort key, reallocating the buffer if needed. */
    bufLeft = sortKeyBufSize - sortKeyBufOffset;

    sortKeyLen = ucol_getSortKey(m_ucoll,
                    utf16_buf,
                    utf16_len,
                    (uint8_t*)sortKeyBuf + sortKeyBufOffset,
                    bufLeft);

    /* check for sortKeyBuf overflow, increasing its size of the buffer if
       needed */
    if (sortKeyLen > bufLeft) {
      bufIncrement = ( sortKeyLen > DEF_SORT_KEYS_BUF_INCREMENT ) ?
        sortKeyLen : DEF_SORT_KEYS_BUF_INCREMENT;
      sortKeyBufSize += bufIncrement;
      bufLeft += bufIncrement;
      sortKeyBuf = (char*)realloc(sortKeyBuf, sortKeyBufSize);
      sortKeyLen = ucol_getSortKey(m_ucoll, utf16_buf, utf16_len,
                                   (uint8_t*)sortKeyBuf + sortKeyBufOffset,
                                   bufLeft);
    }

    /* check sortKeyIndxBuf overflow, increasing its size of the buffer if
       needed */
    if ((sortKeyCount + 1) * sortKeyIndxSize > sortKeyIndxBufSize) {
      bufIncrement = (sortKeyIndxSize > DEF_SORT_KEYS_INDX_BUF_INCREMENT) ?
//.........这里部分代码省略.........
开发者ID:cdnewbee,项目名称:hiphop-php,代码行数:101,代码来源:ext_intl.cpp


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