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


C++ Item_t::getKind方法代码示例

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


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

示例1: get_options

static void get_options( store::Item_t const &options_object,
                         options_type *options ) {
  ZORBA_ASSERT( options_object->getKind() == store::Item::OBJECT );
  store::Iterator_t i( options_object->getObjectKeys() );
  i->open();
  store::Item_t opt_key;
  while ( i->next( opt_key ) ) {
    zstring const opt_name( opt_key->getStringValue() );
    store::Item_t const opt_value( options_object->getObjectValue( opt_key ) );
    (*options)[ opt_name ] = opt_value->getStringValue();
  }
  i->close();
}
开发者ID:cezarfx,项目名称:zorba,代码行数:13,代码来源:json_impl.cpp

示例2: json_to_xml

void json_to_xml( store::Item_t const &json_item, store::Item_t *xml_item ) {
  ZORBA_ASSERT( xml_item );
  switch ( json_item->getKind() ) {
    case store::Item::ARRAY:
      *xml_item = j2x_array( json_item, nullptr );
      break;
    case store::Item::OBJECT:
      throw XQUERY_EXCEPTION(
        zerr::ZJ2X0001_JSONML_ARRAY_BAD_JSON,
        ERROR_PARAMS( ZED( ZJ2X0001_ArrayRequired ) )
      );
    default:
      ZORBA_ASSERT( false );
  }
}
开发者ID:alyst,项目名称:zorba,代码行数:15,代码来源:jsonml_array.cpp

示例3: deepEqual

bool deepEqual(
    const QueryLoc& loc,
    static_context* sctx,
    store::Item_t& item1,
    store::Item_t& item2,
    XQPCollator* collator,
    int timezone,
    bool raiseError)
{
  if (item1->isFunction() || item2->isFunction())
  {
    if (raiseError)
    {
      RAISE_ERROR(err::FOTY0015, loc,
        ERROR_PARAMS((item1->isFunction() ? item1 : item2)->getFunctionName()->getStringValue()));
    }
    else
      return false;
  }

  if (item1->getKind() != item2->getKind())
    return false;

  switch (item1->getKind())
  {
  case store::Item::ATOMIC:
  {
    assert(item2->isAtomic());

    store::SchemaTypeCode type1 = item1->getTypeCode();
    store::SchemaTypeCode type2 = item2->getTypeCode();

    // check if both items are NaN
    if (((type1 == store::XS_FLOAT && item1->getFloatValue().isNaN()) ||
         (type1 == store::XS_DOUBLE && item1->getDoubleValue().isNaN()))
        &&
        ((type2 == store::XS_FLOAT && item2->getFloatValue().isNaN()) ||
         (type2 == store::XS_DOUBLE && item2->getDoubleValue().isNaN())))
    {
      return true;
    }

    if (raiseError)
    {
      try
      {
        TypeManager* tm = sctx->get_typemanager();
        return CompareIterator::valueEqual(loc, item1, item2, tm, timezone, collator, raiseError);
       }
       catch (ZorbaException const& e)
       {
        if (e.diagnostic() == err::XPTY0004)
          return false;
        throw;
       }
    }
    else
    {
      TypeManager* tm = sctx->get_typemanager();
      return CompareIterator::valueEqual(loc, item1, item2, tm, timezone, collator, raiseError);
    }

    break;
  }
  case store::Item::NODE:
  {
    return deepEqualNodes(loc, sctx, item1, item2, collator, timezone, raiseError);
  }
  case store::Item::OBJECT:
  {
    return deepEqualObjects(loc, sctx, item1, item2, collator, timezone, raiseError);
  }
  case store::Item::ARRAY:
  {
    return deepEqualArrays(loc, sctx, item1, item2, collator, timezone, raiseError);
  }
  default:
  {
    ZORBA_ASSERT(false);  // should never reach here
  }
  }

  return false;
}
开发者ID:alyst,项目名称:zorba,代码行数:84,代码来源:deep_equality.cpp


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