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


C++ URI::get_encoded_path方法代码示例

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


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

示例1: XQUERY_EXCEPTION

bool
SerializeURIIterator::nextImpl(store::Item_t& result, PlanState& planState) const
{
  store::Item_t     lItemURI, lItemKey;
  zorba::zstring    lStrValue, lStrKey, lStrRes;
  store::Iterator_t lKeys;
  URI               uri = URI();
  int               lIntPort = 0;
  bool              lHasSchemeField, lHasOpaqueField, lHasNotOpaqueField;

  PlanIteratorState* state;
  DEFAULT_STACK_INIT(PlanIteratorState, state, planState);

  consumeNext(lItemURI, theChildren[0].getp(), planState);

  lHasSchemeField = lHasOpaqueField = lHasNotOpaqueField = false;
  if(lItemURI->isObject()) {
    lKeys = lItemURI->getObjectKeys();
    if(!lKeys.isNull()){
      lKeys->open();
      while(lKeys->next(lItemKey)){
        lStrKey = lItemKey->getStringValue();
        lStrValue = lItemURI->getObjectValue(lItemKey)->getStringValue();
        if(lStrKey == SCHEME_NAME && !lStrValue.empty()){
          uri.set_scheme(lStrValue);
          lHasSchemeField = true;
        } else if(lStrKey == OPAQUE_PART_NAME && !lStrValue.empty()){
          uri.set_opaque_part(lStrValue);
          lHasOpaqueField = true;
        } else if(lStrKey == AUTHORITY_NAME && !lStrValue.empty()){
          uri.set_reg_based_authority(lStrValue);
          lHasNotOpaqueField = true;
        } else if(lStrKey == USER_INFO_NAME && !lStrValue.empty()){
          uri.set_user_info(lStrValue);
          lHasNotOpaqueField = true;
        } else if(lStrKey == HOST_NAME && !lStrValue.empty()){
          uri.set_host(lStrValue);
          lHasNotOpaqueField = true;
        } else if(lStrKey == PORT_NAME){
          sscanf(lStrValue.str().c_str(), "%d", &lIntPort);
          if(lIntPort != 0){
            uri.set_port(lIntPort);
            lHasNotOpaqueField = true;
          }
        } else if(lStrKey == PATH_NAME && !lStrValue.empty()){
          uri.set_path(lStrValue);
          lHasNotOpaqueField = true;
        } else if(lStrKey == QUERY_NAME){
          uri.set_query(lStrValue);
          lHasNotOpaqueField = true;
        } else if(lStrKey == FRAGMENT_NAME){
          uri.set_fragment(lStrValue);
        }
      }
      lKeys->close();
    }
  }

  // check for errors
  if(lHasOpaqueField && lHasNotOpaqueField)
  {
    throw XQUERY_EXCEPTION(
      zuri::OPAQUE_COMB_NOT_VALID,
      ERROR_LOC( loc )
    );
  }
  if(lHasOpaqueField && !lHasSchemeField)
  {
    throw XQUERY_EXCEPTION(
      zuri::OPAQUE_WITHOUT_SCHEME,
      ERROR_LOC( loc )
    );
  }
  if(lHasSchemeField && !uri.get_encoded_path().empty() && (uri.get_encoded_path().substr(0,1) != "/"))
  {
    throw XQUERY_EXCEPTION(
      zuri::INVALID_ABSOLUTE_PATH,
      ERROR_LOC( loc )
    );
  }
  
  lStrRes = zorba::zstring(uri.toString());
  STACK_PUSH(GENV_ITEMFACTORY->createString(result, lStrRes), state );

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

示例2: consumeNext

bool
ParseURIIterator::nextImpl(store::Item_t& result, PlanState& planState) const
{
  store::Item_t              lItemURI, lName, lValue;
  std::vector<store::Item_t> lNames;
  std::vector<store::Item_t> lValues;
  zorba::zstring             lStrURI, lZKey, lZVal;
  PlanIteratorState* state;
  URI uri;
  
  DEFAULT_STACK_INIT(PlanIteratorState, state, planState);

  consumeNext(lItemURI, theChildren[0].getp(), planState);
  lItemURI->getStringValue2(lStrURI);
  uri = URI(lStrURI);

  lZVal = uri.get_scheme();
  if(!lZVal.empty())
  {
    lZKey = zorba::zstring(SCHEME_NAME);
    GENV_ITEMFACTORY->createString(lName, lZKey);
    GENV_ITEMFACTORY->createString(lValue, lZVal);
    lNames.push_back(lName);
    lValues.push_back(lValue);
  }

  lZVal = uri.get_opaque_part();
  if(!lZVal.empty())
  {
    lZKey = zorba::zstring(OPAQUE_PART_NAME);
    GENV_ITEMFACTORY->createString(lName, lZKey);
    GENV_ITEMFACTORY->createString(lValue, lZVal);
    lNames.push_back(lName);
    lValues.push_back(lValue);
  }

  lZVal = uri.get_encoded_reg_based_authority();
  if(!lZVal.empty())
  {
    lZKey = zorba::zstring(AUTHORITY_NAME);
    GENV_ITEMFACTORY->createString(lName, lZKey);
    GENV_ITEMFACTORY->createString(lValue, lZVal);
    lNames.push_back(lName);
    lValues.push_back(lValue);
  }

  lZVal = uri.get_encoded_user_info();
  if(!lZVal.empty())
  {
    lZKey = zorba::zstring(USER_INFO_NAME);
    GENV_ITEMFACTORY->createString(lName, lZKey);
    GENV_ITEMFACTORY->createString(lValue, lZVal);
    lNames.push_back(lName);
    lValues.push_back(lValue);
  }
  
  lZVal = uri.get_host();
  if(!lZVal.empty())
  {
    lZKey = zorba::zstring(HOST_NAME);
    GENV_ITEMFACTORY->createString(lName, lZKey);
    GENV_ITEMFACTORY->createString(lValue, lZVal);
    lNames.push_back(lName);
    lValues.push_back(lValue);
  }
  
  if(uri.get_port() != 0)
  {
    lZKey = zorba::zstring(PORT_NAME);
    GENV_ITEMFACTORY->createString(lName, lZKey);
    GENV_ITEMFACTORY->createInt(lValue, uri.get_port());
    lNames.push_back(lName);
    lValues.push_back(lValue);
  }
  
  lZVal = uri.get_encoded_path();
  if(!lZVal.empty())
  {
    lZKey = zorba::zstring(PATH_NAME);
    GENV_ITEMFACTORY->createString(lName, lZKey);
    GENV_ITEMFACTORY->createString(lValue, lZVal);
    lNames.push_back(lName);
    lValues.push_back(lValue);
  }
  
  lZVal = uri.get_encoded_query();
  if(uri.is_set(URI::QueryString))
  {
    lZKey = zorba::zstring(QUERY_NAME);
    GENV_ITEMFACTORY->createString(lName, lZKey);
    GENV_ITEMFACTORY->createString(lValue, lZVal);
    lNames.push_back(lName);
    lValues.push_back(lValue);
  }
  
  lZVal = uri.get_encoded_fragment();
  if(!lZVal.empty())
  {
    lZKey = zorba::zstring(FRAGMENT_NAME);
    GENV_ITEMFACTORY->createString(lName, lZKey);
//.........这里部分代码省略.........
开发者ID:alyst,项目名称:zorba,代码行数:101,代码来源:uris_impl.cpp


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