• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ zstring类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: result

zstring zstring::replace(zstring const& src, zstring const& dst) const {
    zstring result(m_encoding);
    if (length() < src.length()) {
        return zstring(*this);
    }
    if (src.length() == 0) {
        return zstring(*this);
    }
    bool found = false;
    for (unsigned i = 0; i < length(); ++i) {
        bool eq = !found && i + src.length() <= length();
        for (unsigned j = 0; eq && j < src.length(); ++j) {
            eq = m_buffer[i+j] == src[j];
        }
        if (eq) {
            result.m_buffer.append(dst.m_buffer);
            found = true;
            i += src.length() - 1;
        }
        else {
            result.m_buffer.push_back(m_buffer[i]);
        }
    }
    return result;
}
开发者ID:AleksandarZeljic,项目名称:z3,代码行数:25,代码来源:seq_decl_plugin.cpp


示例2: if

bool operator<(const zstring& lhs, const zstring& rhs) {
    // This has the same semantics as strcmp()
    unsigned len = lhs.length();
    if (rhs.length() < len) {
        len = rhs.length();
    }
    for (unsigned i = 0; i < len; ++i) {
        unsigned Li = lhs[i];
        unsigned Ri = rhs[i];
        if (Li < Ri) {
            return true;
        } else if (Li > Ri) {
            return false;
        } else {
            continue;
        }
    }
    // at this point, all compared characters are equal,
    // so decide based on the relative lengths
    if (lhs.length() < rhs.length()) {
        return true;
    } else {
        return false;
    }
}
开发者ID:delcypher,项目名称:z3,代码行数:25,代码来源:seq_decl_plugin.cpp


示例3: suffixof

bool zstring::suffixof(zstring const& other) const {
    if (length() > other.length()) return false;
    bool suffix = true;
    for (unsigned i = 0; suffix && i < length(); ++i) {
        suffix = m_buffer[length()-i-1] == other[other.length()-i-1];
    }
    return suffix;
}
开发者ID:AleksandarZeljic,项目名称:z3,代码行数:8,代码来源:seq_decl_plugin.cpp


示例4: contains

bool zstring::contains(zstring const& other) const {
    if (other.length() > length()) return false;
    unsigned last = length() - other.length();
    bool cont = false;
    for (unsigned i = 0; !cont && i <= last; ++i) {
        cont = true;
        for (unsigned j = 0; cont && j < other.length(); ++j) {
            cont = other[j] == m_buffer[j+i];
        }
    }
    return cont;
}
开发者ID:AleksandarZeljic,项目名称:z3,代码行数:12,代码来源:seq_decl_plugin.cpp


示例5: beginVisitFlworLetVariable

void PrinterVisitor::
beginVisitFlworLetVariable( bool materialize, zstring const &varName,
                            vector<PlanIter_t> const &varRefs ) {
  thePrinter.startBeginVisit( "LetVariable", ++theId );

  thePrinter.addAttribute( "name", varName.str() );
  thePrinter.addAttribute( "materialize", materialize ? "true" : "false");

  ostringstream str;
  vector<PlanIter_t>::size_type const numRefs = varRefs.size();
  for ( vector<PlanIter_t>::size_type i = 0; i < numRefs; ++i ) {
#ifndef NDEBUG
    str << varRefs[i]->getId();
#else
    str << varRefs[i].getp();
#endif
    if ( i < numRefs - 1 )
      str << ' ';
  }

  if ( !Properties::instance().getNoTreeIDs() )
    thePrinter.addAttribute( "referenced-by", str.str() );

  thePrinter.endBeginVisit( theId );
}
开发者ID:cezarfx,项目名称:zorba,代码行数:25,代码来源:printer_visitor_impl.cpp


示例6: beginVisitFlworForVariable

void PrinterVisitor::
beginVisitFlworForVariable( zstring const &varName,
                            vector<PlanIter_t> const &varRefs,
                            vector<PlanIter_t> const &posRefs ) {
  thePrinter.startBeginVisit( "ForVariable", ++theId );
  thePrinter.addAttribute( "name", varName.str() );

  ostringstream ref_oss;
  vector<PlanIter_t>::size_type const numRefs = varRefs.size();
  for ( vector<PlanIter_t>::size_type i = 0; i < numRefs; ++i ) {
#ifndef NDEBUG
    ref_oss << varRefs[i]->getId();
#else
    ref_oss << varRefs[i].getp();
#endif
    if ( i < numRefs - 1 )
      ref_oss << ' ';
  }

  if ( !Properties::instance().getNoTreeIDs() )
    thePrinter.addAttribute( "referenced-by", ref_oss.str() );

  if ( !posRefs.empty() ) {
    string const ref_s( var_refs( posRefs ) );
    if ( !Properties::instance().getNoTreeIDs() )
      thePrinter.addAttribute( "pos-referenced-by", ref_s );
  }

  thePrinter.endBeginVisit( theId );
}
开发者ID:cezarfx,项目名称:zorba,代码行数:30,代码来源:printer_visitor_impl.cpp


示例7:

zstring::zstring(const zstring &rzw)
	{
	const char *rstr;rstr=rzw.getString();
	mem_data.mem_length=(unsigned int)strlen(rstr);    	
	mem_data.mem_string=(char *)malloc(mem_data.mem_length+1);
	unsigned int i;for(i=0;i<=mem_data.mem_length;i++)mem_data.mem_string[i]='\0';	
	strcpy(mem_data.mem_string,rstr);	
    
	mem_data.mem_erchar=rzw.mem_data.mem_erchar;	    	
	if(rzw.Buffer!=0)
		{
		unsigned int len=(unsigned int)strlen(rzw.Buffer);		
		Buffer=(char *)malloc(len+1);
	    unsigned int i;for(i=0;i<=len;i++)Buffer[i]='\0';
		strcpy(this->Buffer,rzw.Buffer);
		}
	else {this->Buffer=0;}

	mem_data.mem_encryptkey=0;
	mem_data.mem_copy=0;
	mem_data.mem_ifile=0;
	mem_data.mem_ofile=0;
	   #ifndef  _zhuwei_ztools_NOT_USE_MFC_CLASS 
	mem_data.mem_ReadWatchfile=0;
	mem_data.mem_WriteWatchfile=0;
		mem_data.mem_runfilelock=0;
#endif
	}
开发者ID:Leoyuseu,项目名称:CodeHub,代码行数:28,代码来源:zstring.cpp


示例8: indexof

int zstring::indexof(zstring const& other, int offset) const {
    SASSERT(offset >= 0);
    if (static_cast<unsigned>(offset) == length()) return -1;
    if (other.length() + offset > length()) return -1;
    unsigned last = length() - other.length();
    for (unsigned i = static_cast<unsigned>(offset); i <= last; ++i) {
        bool prefix = true;
        for (unsigned j = 0; prefix && j < other.length(); ++j) {
            prefix = m_buffer[i + j] == other[j];
        }
        if (prefix) {
            return static_cast<int>(i);
        }
    }
    return -1;
}
开发者ID:AleksandarZeljic,项目名称:z3,代码行数:16,代码来源:seq_decl_plugin.cpp


示例9: compile

PlanIter_t XQueryCompiler::compile(
    std::istream& aXQuery,
    const zstring& aFileName,
    ulong& nextDynamicVarId)
{
  audit::Event* ae = theCompilerCB->theRootSctx->get_audit_event();
  zorba::audit::ScopedRecord sar(ae);

  const char* lFileName = aFileName.c_str();

  audit::ScopedAuditor<const char*>
  filenameAudit(sar, zorba::audit::XQUERY_COMPILATION_FILENAME, lFileName);

  parsenode_t lAST;

  {
    time::Timer lTimer;

    audit::DurationAuditor
    durationAudit(sar, audit::XQUERY_COMPILATION_PARSE_DURATION, lTimer);

    lAST = parse(aXQuery, aFileName);

    if (theCompilerCB->theConfig.lib_module &&
        dynamic_cast<LibraryModule*>(lAST.getp()) != NULL)
    {
      lAST = createMainModule(lAST, aXQuery, aFileName);
    }
  }

  return compile(lAST, true, nextDynamicVarId, sar);
}
开发者ID:alyst,项目名称:zorba,代码行数:32,代码来源:compiler_api.cpp


示例10: prefixof

bool zstring::prefixof(zstring const& other) const {
    if (length() > other.length()) return false;
    bool prefix = true;
    for (unsigned i = 0; prefix && i < length(); ++i) {
        prefix = m_buffer[i] == other[i];
    }
    return prefix;
}
开发者ID:AleksandarZeljic,项目名称:z3,代码行数:8,代码来源:seq_decl_plugin.cpp


示例11: beginVisitWinCondVariable

void PrinterVisitor::
beginVisitWinCondVariable( zstring const &varName,
                           vector<PlanIter_t> const &varRefs ) {
  thePrinter.startBeginVisit( "WinCondVariable", theId );
  thePrinter.addAttribute( "name", varName.str() );

  if ( !Properties::instance().getNoTreeIDs() )
    printVarRefs( "referenced-by", varRefs );

  thePrinter.endBeginVisit( theId );
}
开发者ID:buchenberg,项目名称:zorba,代码行数:11,代码来源:printer_visitor_impl.cpp


示例12: xqdoc

void XQueryCompiler::xqdoc(
    std::istream&         aXQuery,
    const zstring&        aFileName,
    store::Item_t&        aResult,
    const store::Item_t&  aDateTime,
    uint32_t              aOptions)
{
  parsenode_t lAST = parse(aXQuery, aFileName);

  print_parsetree_xqdoc(aResult, lAST.getp(),
                        aFileName.c_str(), aDateTime, aOptions);
}
开发者ID:alyst,项目名称:zorba,代码行数:12,代码来源:compiler_api.cpp


示例13: beginVisitFlworLetVariable

void PrinterVisitor::
beginVisitFlworLetVariable( bool materialize, zstring const &varName,
                            vector<PlanIter_t> const &varRefs ) {
  thePrinter.startBeginVisit( "LetVariable", ++theId );

  thePrinter.addAttribute( "name", varName.str() );
  thePrinter.addBoolAttribute( "materialize", materialize ? true : false);

  if ( !Properties::instance().getNoTreeIDs() )
    printVarRefs( "referenced-by", varRefs );

  thePrinter.endBeginVisit( theId );
}
开发者ID:buchenberg,项目名称:zorba,代码行数:13,代码来源:printer_visitor_impl.cpp


示例14: getInteger

/**
 * Utility function: Given a string aStr and position aPos, populate
 * aInt with the integer at that position in the string. aPos will be
 * updated to next character.
 * @return true if an integer found, false if not.
 */
static bool
getInteger(zstring const& aStr, size_t& aPos, int& aInt)
{
  char lChar;
  size_t lLen = aStr.length();
  size_t const lOrigPos = aPos;

  aInt = 0;
  while (aPos < lLen && isdigit(lChar = aStr[aPos])) {
    aInt = aInt * 10 + (lChar - '0');
    aPos++;
  }
  return (aPos != lOrigPos);
}
开发者ID:alyst,项目名称:zorba,代码行数:20,代码来源:module_version.cpp


示例15:

bool zstring::operator==(const zstring& other) const {
    // two strings are equal iff they have the same length and characters
    if (length() != other.length()) {
        return false;
    }
    for (unsigned i = 0; i < length(); ++i) {
        unsigned Xi = m_buffer[i];
        unsigned Yi = other[i];
        if (Xi != Yi) {
            return false;
        }
    }

    return true;
}
开发者ID:delcypher,项目名称:z3,代码行数:15,代码来源:seq_decl_plugin.cpp


示例16: beginVisitFlworForVariable

void PrinterVisitor::
beginVisitFlworForVariable( zstring const &varName,
                            vector<PlanIter_t> const &varRefs,
                            vector<PlanIter_t> const &posRefs ) {
  thePrinter.startBeginVisit( "ForVariable", ++theId );
  thePrinter.addAttribute( "name", varName.str() );

  if ( !Properties::instance().getNoTreeIDs() )
  {
    printVarRefs( "referenced-by", varRefs );
    if (!posRefs.empty())
      printVarRefs( "pos-referenced-by", posRefs );
  }

  thePrinter.endBeginVisit( theId );
}
开发者ID:buchenberg,项目名称:zorba,代码行数:16,代码来源:printer_visitor_impl.cpp


示例17:

  void
  URIMapperWrapper::mapURI
  (const zstring& aUri,
    internal::EntityData const* aEntityData,
    static_context const& aSctx,
    std::vector<zstring>& oUris)
  {
    std::unique_ptr<const EntityDataWrapper> lDataWrap
        (EntityDataWrapper::create(aEntityData));
    if (lDataWrap.get() == NULL) {
      return;
    }

    std::vector<zorba::String> lUserUris;
    // QQQ should public API have a StaticContext on it?
    theUserMapper.mapURI(zorba::String(aUri.c_str()), lDataWrap.get(),
                         lUserUris);
    std::vector<zorba::String>::iterator iter;
    for (iter = lUserUris.begin(); iter != lUserUris.end(); iter++) {
      oUris.push_back(Unmarshaller::getInternalString(*iter));
    }
  }
开发者ID:zorba-processor,项目名称:zorba,代码行数:22,代码来源:uri_resolver_wrappers.cpp


示例18: if

bool
ModuleVersion::initValues(zstring const& aVersionDef)
{
  // Parse fragment for legal version specification. If any illegal
  // characters found, no versioning to be attempted.
  int lMajor, lMinor, lPatch = 0, lMajorB = -1;
  bool lExact = false;
  size_t lPos = 0;
  size_t lLen = aVersionDef.length();
  if (!getInteger(aVersionDef, lPos, lMajor)) {
    return false;
  }
  if (lPos >= lLen) {
    return false;
  }
  if (aVersionDef[lPos++] != '.') {
    return false;
  }
  if (!getInteger(aVersionDef, lPos, lMinor)) {
    return false;
  }
  if (lPos < lLen && aVersionDef[lPos] == '.') {
    // There's (potentially) a patch version specified as well
    lPos ++;
    if (lPos >= lLen) {
      return false;
    }
    if (!getInteger(aVersionDef, lPos, lPatch)) {
      return false;
    }
  }
  if (lPos < lLen) {
    // Found legal major.minor, but there's more to parse - could be "!"
    // or "-major.0"
    char lChar = aVersionDef[lPos++];
    if (lChar == '!' && lPos == lLen) {
      lExact = true;
    }
    else if (lChar == '-') {
      if (!getInteger(aVersionDef, lPos, lMajorB)) {
        return false;
      }
      if (lPos >= lLen || aVersionDef[lPos++] != '.') {
        return false;
      }
      if (lPos >= lLen || aVersionDef[lPos++] != '0') {
        return false;
      }
    }
    else {
      return false;
    }
  }

  // Verify there's no more to read.
  if (lPos != lLen) {
    return false;
  }

  // Ok, we successfully parsed a version definition; set all our variables.
  theMinMajor = lMajor;
  theMinMinor = lMinor;
  theMinPatch = lPatch;
  theMaxMajor = lMajorB == -1 ? lMajor : lMajorB;
  theIsExact = lExact;
  theValidVersion = true;
  return true;
}
开发者ID:alyst,项目名称:zorba,代码行数:68,代码来源:module_version.cpp


示例19: if

//          5>
const bool zstring::operator==(const zstring &rzw)   const
	{        if(strcmp(this->mem_data.mem_string,rzw.getString())==0)return true;else return false;	}
开发者ID:Leoyuseu,项目名称:CodeHub,代码行数:3,代码来源:zstring.cpp


示例20: instr

double  zstring::instr(unsigned int start,const zstring &rzw)	{return instr(start,rzw.getString());}
开发者ID:Leoyuseu,项目名称:CodeHub,代码行数:1,代码来源:zstring.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ zxing类代码示例发布时间:2022-05-31
下一篇:
C++ yvector类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap