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


C++ Ptr::isNull方法代码示例

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


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

示例1: execute

Item::Ptr Multiply::execute(const AnyAtomicType::Ptr &atom1, const AnyAtomicType::Ptr &atom2, DynamicContext *context) const
{
  if(atom1.isNull() || atom2.isNull()) return 0;

  // xs:double * xs:duration (only xdt:dayTimeDuration and xdt:yearMonthDuration)
  if(atom1->isNumericValue() &&
     (atom2->getPrimitiveTypeIndex() == AnyAtomicType::DAY_TIME_DURATION ||
      atom2->getPrimitiveTypeIndex() == AnyAtomicType::YEAR_MONTH_DURATION)) {
      return ((const ATDurationOrDerived*)atom2.get())->multiply((const Numeric*)atom1.get(), context);
  }
  // xs:duration * xs:double (only xdt:dayTimeDuration and xdt:yearMonthDuration)
  if(atom2->isNumericValue() &&
     (atom1->getPrimitiveTypeIndex() == AnyAtomicType::DAY_TIME_DURATION ||
      atom1->getPrimitiveTypeIndex() == AnyAtomicType::YEAR_MONTH_DURATION)) {
    return ((const ATDurationOrDerived*)atom1.get())->multiply((const Numeric*)atom2.get(), context);
  }

  // numeric * numeric
  if(atom1->isNumericValue()) {
    if(atom2->isNumericValue()) {
      return ((const Numeric*)atom1.get())->multiply((const Numeric*)atom2.get(), context);
    }
    else {
      XQThrow(XPath2ErrorException,X("Multiply::createSequence"), X("An attempt to multiply a non numeric type to a numeric type has occurred [err:XPTY0004]"));
    }
  }

  XQThrow(XPath2ErrorException,X("Multiply::createSequence"), X("The operator * has been called on invalid operand types [err:XPTY0004]"));

}
开发者ID:kanbang,项目名称:Colt,代码行数:30,代码来源:Multiply.cpp

示例2: next

Item::Ptr DistinctValueResult::next(DynamicContext *context)
{
  if(toDo_) {
    toDo_ = false;
    parent_ = fdv_->getParamNumber(1, context);

    Collation *collation;
    if(fdv_->getNumArgs() > 1) {
        const XMLCh* collName = fdv_->getParamNumber(2, context)->next(context)->asString(context);
        try {
            context->getItemFactory()->createAnyURI(collName, context);
        } catch(XPath2ErrorException &e) {
            XQThrow(FunctionException, X("FunctionDistinctValues::DistinctValueResult::next"), X("Invalid collationURI"));  
        }
        collation = context->getCollation(collName, this);
    }
    else
        collation = context->getDefaultCollation(this);

    alreadySeen_ = new DistinctSet(dvCompare(collation, context));
  }

  AnyAtomicType::Ptr item;
  while(true) {
    item = (const AnyAtomicType *)parent_->next(context).get();
    if(item.isNull()) break;

    if(alreadySeen_->insert(item).second)
      return item;
  }

  parent_ = 0;
  return 0;
}
开发者ID:kanbang,项目名称:Colt,代码行数:34,代码来源:FunctionDistinctValues.cpp

示例3: isEmptyOrNaN

 static inline bool isEmptyOrNaN(const AnyAtomicType::Ptr &si)
 {
   return si.isNull() || (si->isNumericValue() && ((Numeric*)si.get())->isNaN());
 }
开发者ID:xubingyue,项目名称:xqilla,代码行数:4,代码来源:OrderByTuple.cpp


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