本文整理汇总了C++中store::Item_t类的典型用法代码示例。如果您正苦于以下问题:C++ Item_t类的具体用法?C++ Item_t怎么用?C++ Item_t使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Item_t类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: nextImpl
/*******************************************************************************
14.9.2 fn:parse-xml-fragment
********************************************************************************/
bool FnParseXmlFragmentIterator::nextImpl(
store::Item_t& result,
PlanState& planState) const
{
zstring docString;
FnParseXmlFragmentIteratorState* state;
DEFAULT_STACK_INIT(FnParseXmlFragmentIteratorState, state, planState);
if (consumeNext(result, theChildren[0].getp(), planState))
{
if (result->isStreamable())
{
state->theFragmentStream.theStream = &result->getStream();
}
else
{
result->getStringValue2(docString);
state->theFragmentStream.theIss = new std::istringstream(docString.c_str());
state->theFragmentStream.theStream = state->theFragmentStream.theIss;
}
state->theProperties.setBaseUri(theSctx->get_base_uri());
state->theProperties.setParseExternalParsedEntity(true);
state->theProperties.setStoreDocument(false);
state->baseUri = state->theProperties.getBaseUri();
// create only one document node holding all fragment nodes
state->theFragmentStream.only_one_doc_node = 1;
try
{
result = GENV.getStore().loadDocument(state->baseUri,
state->docUri,
state->theFragmentStream,
state->theProperties);
}
catch ( ZorbaException const &e )
{
if ( !state->theProperties.getNoError() )
{
XQueryException xe(
XQUERY_EXCEPTION(err::FODC0006,
ERROR_PARAMS( "fn:parse-xml-fragment()", e.what() ),
ERROR_LOC( loc )));
set_data( xe, e );
throw xe;
}
result = nullptr;
}
if (result != NULL)
STACK_PUSH(true, state);
} // if
STACK_END(state);
}
示例2: addGeneralPair
void IndexDelta::addGeneralPair(store::Item_t& node, store::Item_t& key)
{
assert(node->isNode() && key->isAtomic());
theGeneralDelta.resize(theGeneralDelta.size() + 1);
theGeneralDelta.back().first.transfer(node);
theGeneralDelta.back().second.transfer(key);
}
示例3: 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();
}
示例4: get_variable
void dynamic_context::get_variable(
ulong varid,
const store::Item_t& varname,
const QueryLoc& loc,
store::Item_t& itemValue,
store::TempSeq_t& seqValue) const
{
itemValue = NULL;
seqValue = NULL;
if (varid >= theVarValues.size() ||
theVarValues[varid].theState == VarValue::undeclared)
{
zstring varName = static_context::var_name(varname.getp());
if (varid >= theVarValues.size() ||
theVarValues[varid].theIsExternalOrLocal ||
(varid > 0 && varid < MAX_IDVARS_RESERVED))
{
RAISE_ERROR(err::XPDY0002, loc,
ERROR_PARAMS(ZED(XPDY0002_VariableUndeclared_2), varName));
}
else
{
RAISE_ERROR(err::XQDY0054, loc, ERROR_PARAMS(varName));
}
}
const VarValue& var = theVarValues[varid];
if (var.theState == VarValue::declared)
{
zstring varName = static_context::var_name(varname.getp());
if (var.theIsExternalOrLocal)
{
RAISE_ERROR(err::XPDY0002, loc,
ERROR_PARAMS(ZED(XPDY0002_VariableHasNoValue_2), varName));
}
else
{
RAISE_ERROR(err::XQDY0054, loc, ERROR_PARAMS(varName));
}
}
if (var.theState == VarValue::item)
itemValue = var.theValue.item;
else
seqValue = var.theValue.temp_seq;
}
示例5: XQUERY_EXCEPTION
bool
ZorbaValidateInPlaceIterator::nextImpl(store::Item_t& result, PlanState& planState) const
{
store::Item_t node;
PlanIteratorState* state;
store::PUL_t pul;
DEFAULT_STACK_INIT(PlanIteratorState, state, planState);
if (consumeNext(node, theChild.getp(), planState))
{
// verify that if the element being revalidated is an element it is the root
if (node->getNodeKind()==store::StoreConsts::elementNode &&
node->getParent() &&
node->getParent()->getNodeKind()!=store::StoreConsts::documentNode)
throw XQUERY_EXCEPTION( zerr::ZAPI0090_CANNOT_VALIDATE_NON_ROOT, ERROR_LOC( loc ) );
pul = GENV_ITEMFACTORY->createPendingUpdateList();
pul->addRevalidate(&loc,node);
result.transfer(pul);
STACK_PUSH(true, state);
}
STACK_END(state);
}
示例6: x2j_children
static void x2j_children( store::Item_t const &parent,
vector<store::Item_t> *children ) {
ZORBA_ASSERT( children );
store::Iterator_t i( parent->getChildren() );
i->open();
store::Item_t child_item, temp_item;
while ( i->next( child_item ) ) {
if ( !x2j_map_atomic( child_item, &temp_item ) ) {
if ( !child_item->isNode() )
throw XQUERY_EXCEPTION(
zerr::ZJ2X0001_JSONML_ARRAY_BAD_JSON,
ERROR_PARAMS( ZED( ZJ2X0001_BadElement ), child_item->getKind() )
);
switch ( child_item->getNodeKind() ) {
case store::StoreConsts::elementNode:
x2j_element( child_item, &temp_item );
break;
case store::StoreConsts::textNode: {
zstring s( child_item->getStringValue() );
GENV_ITEMFACTORY->createString( temp_item, s );
break;
}
default:
continue;
} // switch
} // if
children->push_back( temp_item );
} // while
i->close();
}
示例7: consumeNext
bool PlanIterator::consumeNext(
store::Item_t& result,
const PlanIterator* iter,
PlanState& planState)
{
if (planState.theHasToQuit)
{
// std::cout << "Plan interupted" << std::endl;
throw FlowCtlException(FlowCtlException::INTERRUPT);
}
bool status = iter->produceNext(result, planState);
if (planState.theCompilerCB->theConfig.print_item_flow)
{
if (Properties::instance().getStableIteratorIDs())
std::cout << "next (" << iter->getId();
else
std::cout << "next (" << iter;
std::cout << " = " << iter->getNameAsString() // typeid (*iter).name()
<< ") -> "
<< "status: " << status << " -> "
<< ((status && result != NULL) ? result->show().c_str() : "null")
<< std::endl;
}
return status;
}
示例8: computeAtomic
bool NumArithIterator<Operation>::compute(
store::Item_t& result,
dynamic_context* dctx,
const TypeManager* tm,
const QueryLoc& aLoc,
store::Item_t& n0,
store::Item_t& n1)
{
assert(n0->isAtomic());
assert(n1->isAtomic());
store::SchemaTypeCode type0 = n0->getTypeCode();
store::SchemaTypeCode type1 = n1->getTypeCode();
return computeAtomic(result, dctx, tm, aLoc, n0, type0, n1, type1);
}
示例9: get_json_value
store::Item_t get_json_value( store::Item_t const &object,
char const *key ) {
zstring key_str( key );
store::Item_t key_item;
GENV_ITEMFACTORY->createString( key_item, key_str );
return object->getObjectValue( key_item );
}
示例10: getFirstAttribute
store::Item_t getFirstAttribute(store::Item_t node)
{
store::Item_t attr;
store::Iterator_t attributes = node->getAttributes();
attributes->open();
attributes->next(attr);
attributes->close();
return attr;
}
示例11: xml_to_json
void xml_to_json( store::Item_t const &xml_item, store::Item_t *json_item ) {
ZORBA_ASSERT( json_item );
switch ( xml_item->getNodeKind() ) {
case store::StoreConsts::elementNode:
x2j_element( xml_item, json_item );
break;
default:
throw XQUERY_EXCEPTION( zerr::ZJSE0001_NOT_ELEMENT_NODE );
}
}
示例12: 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;
}
示例13: set_variable
void dynamic_context::set_variable(
ulong varid,
const store::Item_t& varname,
const QueryLoc& loc,
store::Item_t& valueItem)
{
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];
// 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::item;
var.theValue.item = valueItem.release();
}
示例14: j2x_object
static void j2x_object( store::Item_t const &object_item,
store::Item_t *parent_xml_item ) {
ZORBA_ASSERT( parent_xml_item );
store::Item_t junk_item, key_item, type_name;
store::Iterator_t k( object_item->getObjectKeys() );
k->open();
while ( k->next( key_item ) ) {
store::Item_t att_name;
GENV_ITEMFACTORY->createQName(
att_name, "", "", key_item->getStringValue()
);
store::Item_t value_item( object_item->getObjectValue( key_item ) );
zstring value_str( value_item->getStringValue() );
GENV_ITEMFACTORY->createString( value_item, value_str );
type_name = GENV_TYPESYSTEM.XS_UNTYPED_QNAME;
GENV_ITEMFACTORY->createAttributeNode(
junk_item, *parent_xml_item, att_name, type_name, value_item
);
}
k->close();
}
示例15: pushRange
void GeneralIndexCondition::pushRange(
store::Item_t& lower,
store::Item_t& upper,
bool haveLower,
bool haveUpper,
bool lowerIncl,
bool upperIncl)
{
assert(theKind == BOX_VALUE);
assert(!theIsSet);
assert(!haveLower || (lower && lower->isAtomic()));
assert(!haveUpper || (upper && upper->isAtomic()));
theRangeFlags.theHaveLowerBound = haveLower;
theRangeFlags.theHaveUpperBound = haveUpper;
theRangeFlags.theLowerBoundIncl = lowerIncl;
theRangeFlags.theUpperBoundIncl = upperIncl;
if (haveLower)
{
theLowerBound.transfer(lower);
store::Item* baseItem = theLowerBound->getBaseItem();
if (baseItem != NULL)
theLowerBound = baseItem;
}
if (haveUpper)
{
theUpperBound.transfer(upper);
store::Item* baseItem = theUpperBound->getBaseItem();
if (baseItem != NULL)
theUpperBound = baseItem;
}
theIsSet = true;
}