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


C++ StringBuffer::charAt方法代码示例

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


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

示例1: strip

void GermanStemmer::strip(StringBuffer& buffer)
{
    bool doMore = true;
    while ( doMore && buffer.length() > 3 ) {
        if ( ( buffer.length() + substCount > 5 ) &&
                buffer.substringEquals( buffer.length() - 2, buffer.length(), _T("nd"), 2 ) )
        {
            buffer.deleteChars( buffer.length() - 2, buffer.length() );
        }
        else if ( ( buffer.length() + substCount > 4 ) &&
                  buffer.substringEquals( buffer.length() - 2, buffer.length(), _T("em"), 2 ) ) {
            buffer.deleteChars( buffer.length() - 2, buffer.length() );
        }
        else if ( ( buffer.length() + substCount > 4 ) &&
                  buffer.substringEquals( buffer.length() - 2, buffer.length(), _T("er"), 2 ) ) {
            buffer.deleteChars( buffer.length() - 2, buffer.length() );
        }
        else if ( buffer.charAt( buffer.length() - 1 ) == _T('e') ) {
            buffer.deleteCharAt( buffer.length() - 1 );
        }
        else if ( buffer.charAt( buffer.length() - 1 ) == _T('s') ) {
            buffer.deleteCharAt( buffer.length() - 1 );
        }
        else if ( buffer.charAt( buffer.length() - 1 ) == _T('n') ) {
            buffer.deleteCharAt( buffer.length() - 1 );
        }
        // "t" occurs only as suffix of verbs.
        else if ( buffer.charAt( buffer.length() - 1 ) == _T('t') ) {
            buffer.deleteCharAt( buffer.length() - 1 );
        }
        else {
            doMore = false;
        }
    }
}
开发者ID:Chen-Zhihui,项目名称:WizQTClient,代码行数:35,代码来源:GermanStemmer.cpp

示例2: resubstitute

 void GermanStemmer::resubstitute(StringBuffer& buffer) {
   for ( size_t c = 0; c < buffer.length(); c++ ) {
     if ( buffer.charAt( c ) == _T('*') ) {
       TCHAR x = buffer.charAt( c - 1 );
       buffer.setCharAt( c, x );
     }
     else if ( buffer.charAt( c ) == _T('$') ) {
       buffer.setCharAt( c, 's' );
       TCHAR ch[] = { _T('c'), _T('h')};
       buffer.insert( c + 1, ch );
     }
     else if ( buffer.charAt( c ) == _T('§') ) {
       buffer.setCharAt( c, _T('c') );
       buffer.insert( c + 1, _T('h') );
     }
     else if ( buffer.charAt( c ) == _T('%') ) {
       buffer.setCharAt( c, _T('e') );
       buffer.insert( c + 1, _T('i') );
     }
     else if ( buffer.charAt( c ) == _T('&') ) {
       buffer.setCharAt( c, _T('i') );
       buffer.insert( c + 1, _T('e') );
     }
     else if ( buffer.charAt( c ) == _T('#') ) {
       buffer.setCharAt( c, _T('i') );
       buffer.insert( c + 1, _T('g') );
     }
     else if ( buffer.charAt( c ) == _T('!') ) {
       buffer.setCharAt( c, _T('s') );
       buffer.insert( c + 1, _T('t') );
     }
   }
 }
开发者ID:Beirdo,项目名称:beirdobot,代码行数:33,代码来源:GermanStemmer.cpp

示例3: MakeStringException

IClientWsWorkunits * createWorkunitsClient(IProperties * _globals)
{
    Owned<IClientWsWorkunits> wuclient = createWsWorkunitsClient();
    
    const char* eclwatch = _globals->queryProp("server");
    if(eclwatch == NULL)
        throw MakeStringException(0, "Server url not defined");
    
    StringBuffer url;
    if(Utils::strncasecmp(eclwatch, "http://", 7) != 0 && Utils::strncasecmp(eclwatch, "https://", 8) != 0)
        url.append("http://");
    url.append(eclwatch);
    if(strchr(url.str() + 7, ':') == NULL)
        url.append(":8010/");
    if(url.charAt(url.length() - 1) != '/')
        url.append("/");
    url.append("WsWorkUnits");
    wuclient->addServiceUrl(url.str());
    const char* username = _globals->queryProp("user");
    if (!username)
        username = _globals->queryProp("owner");
    const char* password = _globals->queryProp("password");
    if(username != NULL)
        wuclient->setUsernameToken(username, password, NULL);

    return LINK(wuclient.get());
}
开发者ID:AsherBond,项目名称:HPCC-Platform,代码行数:27,代码来源:eclplus.cpp

示例4:

StringBuffer::StringBuffer(const StringBuffer& obj) {

	
	str_->strlen = obj.length();
	str_->string_buf = new char[str_->strlen];
	for (int i = 0; i<str_->strlen; i++)
	{
		str_->string_buf[i] = obj.charAt(i);
	}
	reflink* rlinking = new reflink;
	rlinking->_address = this;
	rlinking->next = NULL;
	if (str_->_reflink == NULL)
	{
		str_->_reflink = rlinking;
	}
	else
	{
		reflink* ptr = str_->_reflink;
		reflink*  prev = NULL;
		while (ptr)
		{
			prev = ptr;
			ptr = ptr->next;
		}
		prev->next = rlinking;
	}
}
开发者ID:hamidbscs12,项目名称:AP_Labs,代码行数:28,代码来源:StringBuffer.cpp

示例5:

StringBuffer::StringBuffer(const StringBuffer& obj){
	
	// -> shallow copying constructor 
	_str->_length = obj.length();
	_str->_strbuf= new char[_str->_length];
	for (int i = 0;i<_str->_length;i++)
	{
		_str->_strbuf[i]=obj.charAt(i);
	}
	reflink* rlinking= new reflink;
	rlinking->_address=this;
	rlinking->next=NULL;
	if(_str->_reflink==NULL)
	{
		_str->_reflink=rlinking;
	}
	else
	{
		reflink* ptr = _str->_reflink;
		reflink*  prev = NULL;
		while(ptr)
		{
			prev= ptr;
			ptr= ptr->next;
		}
		prev->next=rlinking;
	}
}
开发者ID:amal-mubashar,项目名称:Assignment1_Smart_Pointers,代码行数:28,代码来源:String_Buffer.cpp

示例6:

StringBuffer::StringBuffer(const StringBuffer& object) {
	strlen = object.length(); 
	strBuffer = new char[strlen];  
	for (int i = 0; i < strlen; i++)
	{
		strBuffer[i] = object.charAt(i); 
	}
}
开发者ID:hussey05,项目名称:smart_strings,代码行数:8,代码来源:StringBuffer.cpp

示例7: readLogFilters

bool CLogContentFilter::readLogFilters(IPropertyTree* cfg, unsigned groupID)
{
    Owned<CESPLogContentGroupFilters> espLogContentGroupFilters = new CESPLogContentGroupFilters((ESPLogContentGroup) groupID);
    StringBuffer xpath;
    if (groupID != ESPLCGAll)
        xpath.appendf("Filters/Filter[@type='%s']", espLogContentGroupNames[groupID]);
    else
        xpath.append("Filters/Filter");
    Owned<IPropertyTreeIterator> filters = cfg->getElements(xpath.str());
    ForEach(*filters)
    {
        IPropertyTree &filter = filters->query();
        StringBuffer value = filter.queryProp("@value");
        if (!value.length())
            continue;

        //clean "//"
        unsigned idx = value.length()-1;
        while (idx)
        {
            if ((value.charAt(idx-1) == '/') && (value.charAt(idx) == '/'))
                value.remove(idx, 1);
            idx--;
        }

        //clean "/*" at the end
        while ((value.length() > 1) && (value.charAt(value.length()-2) == '/') && (value.charAt(value.length()-1) == '*'))
            value.setLength(value.length() - 2);

        if (value.length() && !streq(value.str(), "*") && !streq(value.str(), "/") && !streq(value.str(), "*/"))
        {
            espLogContentGroupFilters->addFilter(value.str());
        }
        else
        {
            espLogContentGroupFilters->clearFilters();
            break;
        }
    }

    bool hasFilter = espLogContentGroupFilters->getFilterCount() > 0;
    if (hasFilter)
        groupFilters.append(*espLogContentGroupFilters.getClear());
    return hasFilter;
}
开发者ID:Michael-Gardner,项目名称:HPCC-Platform,代码行数:45,代码来源:loggingagentbase.cpp

示例8: optimize

void GermanStemmer::optimize(StringBuffer& buffer) {
    // Additional step for female plurals of professions and inhabitants.
    if ( buffer.length() > 5 && buffer.substringEquals( buffer.length() - 5, buffer.length(), _T("erin*"), 5 ) ) {
        buffer.deleteCharAt( buffer.length() -1 );
        strip( buffer );
    }
    // Additional step for irregular plural nouns like "Matrizen -> Matrix".
    if ( buffer.charAt( buffer.length() - 1 ) == ( _T('z') ) ) {
        buffer.setCharAt( buffer.length() - 1, _T('x') );
    }
}
开发者ID:Chen-Zhihui,项目名称:WizQTClient,代码行数:11,代码来源:GermanStemmer.cpp

示例9: setWizardRules

void CWizardInputs::setWizardRules()
{ 
   const char* roxieRedTypes[] = {"Full", "Circular", "None", "Overloaded"};
   m_roxieAgentRedType.clear().append("Circular");
   m_roxieAgentRedChannels = 2;
   m_roxieAgentRedOffset = 1;
   m_genOptForAllComps = GENOPTIONAL_ALL;

   if(m_algProp)
   {
     Owned<IPropertyIterator> iter = m_algProp->getIterator();
     StringBuffer prop;
     ForEach(*iter)
     {
       m_algProp->getProp(iter->getPropKey(), prop.clear());
       if(prop.length() && prop.charAt(prop.length()-1) == ',')
          prop.setCharAt((prop.length()-1),' ');

       if(!strcmp(iter->getPropKey(), "max_comps_per_node"))
       {
         m_maxCompOnNode = atoi(prop.str());
       }
       else if(!strcmp(iter->getPropKey(), "avoid_combo"))
       {
         StringArray pairValue;
         DelimToStringArray(prop.str(), pairValue, ",");
         if( pairValue.ordinality() > 0)
         {
           for( unsigned i = 0; i < pairValue.ordinality() ; i++)
           {
             StringArray eachpair;
             DelimToStringArray(pairValue.item(i), eachpair, "-");
             if(eachpair.ordinality() == 2 )
             {
               StringArray* serverCompArr = 0;
               ForEachItemIn(x, eachpair)
               {
                 StringArrayPtr* pairServerArr = m_invalidServerCombo.getValue(eachpair.item(x));
                 if(pairServerArr)  
                 {
                   serverCompArr = (*pairServerArr);
                   serverCompArr->append(x == 0 ? eachpair.item(1): eachpair.item(0));
                 }
                 else
                 {
                   serverCompArr = new StringArray();
                   serverCompArr->append(x == 0 ? eachpair.item(1): eachpair.item(0));
                   m_invalidServerCombo.setValue(eachpair.item(x),serverCompArr);
                 }
               }
             }
           }
         }
       }
开发者ID:lorraineachapman,项目名称:HPCC-Platform,代码行数:54,代码来源:wizardInputs.cpp

示例10: appendFileName

static inline void appendFileName(StringBuffer &path, const char *filename)
{
    if (!filename)
        return;
    while (*filename==PATHSEPCHAR)
        filename++;
    if (!*filename)
        return;
    if (path.length() && path.charAt(path.length()-1) != PATHSEPCHAR)
        path.append(PATHSEPCHAR);
    path.append(filename);
}
开发者ID:RogerDev,项目名称:HPCC-Platform,代码行数:12,代码来源:esdlcmd_common.cpp

示例11: loadValueFromFile

String AbstractContextI::loadValueFromFile(const String& fileurl) const throw (Exception)
{
	StringBuffer buf;
	buf->append(fileurl);
	if (0 != buf->indexOf(L"file://")) throw NamingException(WITHDETAILS(L"Expected url starting wtih 'file://' but found : " + fileurl));
	
	bool mustprependworkingdirectory = L'/' != buf->charAt(7);
	
	StringBuffer filename;
	if (L':' == buf->charAt(9)) // windows filepath
	{
		filename->append(buf->substring(8));
		filename = filename->replaceAll(L"/", L"\\");
	}
	else
	{
		filename->append(buf->substring(7));
	}


	String fullpath;
	if (mustprependworkingdirectory)
	{
		Anything value;
		lookup(L"/env/jlj_context_working_directory", value);
		String workingdirectory = value;
		fullpath = workingdirectory + filename;
	}
	else
	{
		fullpath = filename->toString();
	}
	if (verboseOutput()) cout << "JNDI context : Reading from file : " << fullpath << endl;
	InputStream file = new FileInputStreamI(fullpath);
	UTF8String content;
	file->read(content, 0);
	file->close();
	return content->toString();
}
开发者ID:weltermann17,项目名称:just-like-java,代码行数:39,代码来源:AbstractContext.cpp

示例12: resubstitute

void GermanStemmer::resubstitute(StringBuffer& buffer) {
    for ( size_t i = 0; i < buffer.length(); i++ ) {
#ifdef _UCS2
        TCHAR c = buffer.charAt(i);
#else
        unsigned char c = buffer.charAt(i);
#endif
        if ( c == _T('*') ) {
            buffer.setCharAt( i, buffer.charAt( i - 1 ) );
        }
        else if ( c == _T('$') ) {
            buffer.setCharAt( i, 's' );
            buffer.insert( i + 1, _T("ch"), 2 );
        }
        else if ( c == 0xa7 ) { // section sign in UTF-16
            buffer.setCharAt( i, _T('c') );
            buffer.insert( i + 1, _T('h') );
        }
        else if ( c == _T('%') ) {
            buffer.setCharAt( i, _T('e') );
            buffer.insert( i + 1, _T('i') );
        }
        else if ( c == _T('&') ) {
            buffer.setCharAt( i, _T('i') );
            buffer.insert( i + 1, _T('e') );
        }
        else if ( c == _T('#') ) {
            buffer.setCharAt( i, _T('i') );
            buffer.insert( i + 1, _T('g') );
        }
        else if ( c == _T('!') ) {
            buffer.setCharAt( i, _T('s') );
            buffer.insert( i + 1, _T('t') );
        }
    }
}
开发者ID:Chen-Zhihui,项目名称:WizQTClient,代码行数:36,代码来源:GermanStemmer.cpp

示例13: json_create_zval

static void json_create_zval(Variant &z, StringBuffer &buf, int type) {
  switch (type) {
  case KindOfInt64:
    {
      const char *p = buf.data();
      ASSERT(p);
      if (p == NULL) {
        z = 0LL;
        return;
      }

      bool neg = (buf.charAt(0) == '-');

      int len = buf.size();
      if (neg) len--;
      if (len >= MAX_LENGTH_OF_LONG - 1) {
        if (len == MAX_LENGTH_OF_LONG - 1) {
          int cmp = strcmp(p + (neg ? 1 : 0), long_min_digits);
          if (!(cmp < 0 || (cmp == 0 && neg))) {
            z = strtod(p, NULL);
            return;
          }
        } else {
          z = strtod(p, NULL);
          return;
        }
      }
      z = strtoll(buf.data(), NULL, 10);
    }
    break;
  case KindOfDouble:
    z = buf.data() ? strtod(buf.data(), NULL) : 0.0;
    break;
  case KindOfString:
    z = buf.detach();
    buf.reset();
    break;
  case KindOfBoolean:
    z = (buf.data() && (*buf.data() == 't'));
    break;
  default:
    z = null;
    break;
  }
}
开发者ID:GunioRobot,项目名称:hiphop-php,代码行数:45,代码来源:JSON_parser.cpp

示例14: queryActiveTableSelector

IHqlExpression * HqlCppCaseInfo::buildIndexedMap(BuildCtx & ctx, IHqlExpression * test, unsigned lower, unsigned upper)
{
    ITypeInfo * compareType = test->queryType()->queryPromotedType();
    type_t compareTypeCode = compareType->getTypeCode();

    HqlExprArray values;
    IHqlExpression * dft = queryActiveTableSelector();  // value doesn't matter as long as it will not occur
    unsigned num = (upper-lower+1);
    values.ensure(num);
    unsigned idx;
    for (idx = 0; idx < num; idx++)
        values.append(*LINK(dft));

    ForEachItemIn(idx2, pairs)
    {
        IHqlExpression & cur = pairs.item(idx2);
        IValue * value = cur.queryChild(0)->queryValue();
        unsigned replaceIndex;
        switch (compareTypeCode)
        {
        case type_int:
            replaceIndex = (int)value->getIntValue()-lower;
            break;
        case type_string:
            {
                StringBuffer temp;
                value->getStringValue(temp);
                replaceIndex = (int)(unsigned char)temp.charAt(0)-lower;
                break;
            }
        default:
            throwUnexpectedType(compareType);
        }

        IHqlExpression * mapTo = cur.queryChild(1);
        if (mapTo->getOperator() != no_constant)
            throwUnexpected();
        if (replaceIndex >= num)
            translator.reportWarning(CategoryIgnored, HQLWRN_CaseCanNeverMatch, "CASE entry %d can never match the test condition", replaceIndex);
        else
            values.replace(*LINK(mapTo),replaceIndex);
    }
开发者ID:RogerDev,项目名称:HPCC-Platform,代码行数:42,代码来源:hqlcppcase.cpp

示例15: MakeStringException

CDfuPlusHelper::CDfuPlusHelper(IProperties* _globals,   CDfuPlusMessagerIntercept *_msgintercept)
{
    msgintercept = _msgintercept;
    globals.setown(_globals);
    sprayclient.setown(createFileSprayClient());

    const char* server = globals->queryProp("server");
    if(server == NULL)
        throw MakeStringException(-1, "Server url not specified");
    
    StringBuffer url;
    if(Utils::strncasecmp(server, "http://", 7) != 0 && Utils::strncasecmp(server, "https://", 8) != 0)
        url.append("http://");
    url.append(server);

    if(strchr(url.str() + 7, ':') == NULL)
    url.append(":8010/");

    if(url.charAt(url.length() - 1) != '/')
        url.append("/");

    StringBuffer fsurl(url.str());
    fsurl.append("FileSpray");
    sprayclient->addServiceUrl(fsurl.str());
    
    dfuclient.setown(createWsDfuClient());
    StringBuffer dfuurl(url.str());
    dfuurl.append("WsDfu");
    dfuclient->addServiceUrl(dfuurl.str());

    const char* username = globals->queryProp("username");
    const char* password = globals->queryProp("password");
    sprayclient->setUsernameToken(username, password, NULL);
    dfuclient->setUsernameToken(username, password, NULL);

}
开发者ID:EwokVillage,项目名称:HPCC-Platform,代码行数:36,代码来源:dfuplus.cpp


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