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


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

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


在下文中一共展示了Item_t::getStringValue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: set_variable

void dynamic_context::set_variable(
    ulong varid,
    const store::Item_t& varname,
    const QueryLoc& loc,
    store::Iterator_t& valueIter)
{
  if (varid >= theVarValues.size() ||
      theVarValues[varid].theState == VarValue::undeclared)
  {
    RAISE_ERROR(err::XPDY0002, loc,
    ERROR_PARAMS(ZED(XPDY0002_VariableUndeclared_2), varname->getStringValue()));
  }

  valueIter->open();

  // For now, use eager eval because the assignment expression may reference
  // the variable itself, and the current value of the variable is overwriten
  // here by this temp sequence. TODO: use lazy eval if we know the the
  // assignment expression does not reference the variable itself.
  store::TempSeq_t seq = GENV_STORE.createTempSeq(valueIter, false); // no lazy eval

  valueIter->close();

  VarValue& var = theVarValues[varid];

  // variables can be set multiple times, so we need to make sure to remove
  // previously set temp sequences
  if (var.theState == VarValue::item)
  {
    assert(var.theValue.item != NULL);
    var.theValue.item->removeReference();
  }
  else if (var.theState == VarValue::temp_seq)
  {
    assert(var.theValue.temp_seq != NULL);
    RCHelper::removeReference(var.theValue.temp_seq);
  }
  else if (var.theState == VarValue::declared)
  {
    assert(var.theValue.item == NULL);
  }
  else
  {
    ZORBA_ASSERT(false);
  }

  var.theState = VarValue::temp_seq;
  var.theValue.temp_seq = seq.release();
}
开发者ID:zorba-processor,项目名称:zorba,代码行数:49,代码来源:dynamic_context.cpp

示例3: x2j_map_atomic

bool x2j_map_atomic( store::Item_t const &xml_item, store::Item_t *json_item ) {
  if ( xml_item->isAtomic() ) {
    switch ( xml_item->getTypeCode() ) {
      case store::JS_NULL:
      case store::XS_BOOLEAN:
      case store::XS_BYTE:
      case store::XS_DECIMAL:
      case store::XS_DOUBLE:
      case store::XS_ENTITY:
      case store::XS_FLOAT:
      case store::XS_ID:
      case store::XS_IDREF:
      case store::XS_INT:
      case store::XS_INTEGER:
      case store::XS_LONG:
      case store::XS_NAME:
      case store::XS_NCNAME:
      case store::XS_NEGATIVE_INTEGER:
      case store::XS_NMTOKEN:
      case store::XS_NON_NEGATIVE_INTEGER:
      case store::XS_NON_POSITIVE_INTEGER:
      case store::XS_NORMALIZED_STRING:
      case store::XS_POSITIVE_INTEGER:
      case store::XS_SHORT:
      case store::XS_STRING:
      case store::XS_TOKEN:
      case store::XS_UNSIGNED_BYTE:
      case store::XS_UNSIGNED_INT:
      case store::XS_UNSIGNED_LONG:
      case store::XS_UNSIGNED_SHORT:
        *json_item = xml_item;
        break;
      default:
        zstring s( xml_item->getStringValue() );
        GENV_ITEMFACTORY->createString( *json_item, s );
        break;
    } // switch
    return true;
  } // if
  return false;
}
开发者ID:zorba-processor,项目名称:zorba,代码行数:41,代码来源:jsonml_common.cpp

示例4: unset_variable

void dynamic_context::unset_variable(
    ulong varid,
    const store::Item_t& varname,
    const QueryLoc& loc)
{
  if (varid >= theVarValues.size() ||
      theVarValues[varid].theState == VarValue::undeclared)
  {
    RAISE_ERROR(err::XPDY0002, loc,
    ERROR_PARAMS(ZED(XPDY0002_VariableUndeclared_2), varname->getStringValue()));
  }

  VarValue& var = theVarValues[varid];

  if (var.theState == VarValue::item)
  {
    assert(var.theValue.item != NULL);
    var.theValue.item->removeReference();
  }
  else if (var.theState == VarValue::temp_seq)
  {
    assert(var.theValue.temp_seq != NULL);
    RCHelper::removeReference(var.theValue.temp_seq);
  }
  else if (var.theState == VarValue::declared)
  {
    assert(var.theValue.item == NULL);
  }
  else
  {
    ZORBA_ASSERT(false);
  }

  var.theState = VarValue::declared;
  var.theValue.item = NULL;
}
开发者ID:zorba-processor,项目名称:zorba,代码行数:36,代码来源:dynamic_context.cpp

示例5: nextImpl

bool MultiDynamicFnCallIterator::nextImpl(
    store::Item_t& result,
    PlanState& planState) const
{
  store::Item_t item;
  store::Item_t targetItem;
  FunctionItem* fnItem;
  zstring key;

  MultiDynamicFnCallIteratorState* state;

  DEFAULT_STACK_INIT(MultiDynamicFnCallIteratorState, state, planState);

  while (consumeNext(targetItem, theChild, planState))
  {
    if (targetItem->isFunction())
    {
      fnItem = static_cast<FunctionItem*>(targetItem.getp());

      if (fnItem->getArity() != 0)
      {
        RAISE_ERROR(err::XPTY0004, loc,
        ERROR_PARAMS("dynamic function invoked with incorrect number of arguments"));
      }

      state->thePlan = fnItem->getImplementation(planState.theCompilerCB);
      
      // must be opened after vars and params are set
      state->thePlan->open(planState, state->theUDFStateOffset);
      state->theIsOpen = true;

      while (consumeNext(result, state->thePlan, planState))
      {
        STACK_PUSH(true, state);
      }

      // Need to close here early in case the plan is completely consumed.
      // Otherwise, the plan would still be opened if destroyed from the
      // state's destructor.
      state->thePlan->close(planState);
      state->theIsOpen = false;
    } // if (targetItem->isFunction())

    else if (targetItem->isJSONItem())
    {
      if (targetItem->isObject())
      {
        if (!state->theKeysSet.get())
          state->theKeysSet.reset(new HashSet<zstring, HashMapZStringCmp>(64, false));

        state->theIterator = targetItem->getObjectKeys();

        state->theIterator->open();

        while (state->theIterator->next(result))
        {
          key = result->getStringValue();

          if (!state->theKeysSet->exists(key))
          {
            state->theKeysSet->insert(key);
            STACK_PUSH(true, state);
          }
        }
      }
      else
      {
        state->theIterator = targetItem->getArrayValues();

        state->theIterator->open();

        while (state->theIterator->next(result))
        {
          STACK_PUSH(true, state);
        }
      }

      state->theIterator->close();
    } // jsoniq item
#if 0
    else if (theSctx->language_kind() == StaticContextConsts::language_kind_xquery)
    {
      xqtref_t type = theSctx->get_typemanager()->create_value_type(targetItem);

      RAISE_ERROR(err::XPTY0004, loc, 
      ERROR_PARAMS(ZED(XPTY0004_NoTypePromote_23),
                   type->toSchemaString(),
                   GENV_TYPESYSTEM.ANY_FUNCTION_TYPE_ONE->toSchemaString()));
    }
#endif
  }

  STACK_END(state);
};
开发者ID:alyst,项目名称:zorba,代码行数:94,代码来源:dynamic_fncall_iterator.cpp


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