xString xRegex::Replace(const xString& input, const xString replacement) { xString result; if (pImpl->mCompiledPattern) { int offsets[OFFSET_COUNT]; unsigned int offset = 0; unsigned int len = input.Length(); while (offset < len) { int rc = pcre_exec(pImpl->mCompiledPattern, 0, input.c_str(), len, offset, 0, offsets, OFFSET_COUNT); if (rc > 0) { const char* s1 = input.c_str() + offset; result += xString(input.c_str() + offset, offsets[0] - offset) + replacement; offset = offsets[1]; } else { result += xString(input.c_str() + offset, len - offset); break; } } } return result; }
C_String C_BigInt::hexString (void) const { C_String result ; if (sign () >= 0) { result << "0x" << xString () ; }else{ result << "-0x" << abs ().xString () ; } return result ; }
xString CXmlNode::GetProperty(xString name) const { int indice=this->GetIndiceProp(name); if(indice>=0) { return nodeData.nodeProperties[indice].GetValue(); }else{ std::cout<<"Xml Property "<<name<<" doesn't exist !"<<std::endl; return xString(); } }
//############################################################################## //# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # //############################################################################## xString xNullObject::toString() { return xString(_T("Null Object")); }
static int restoreChikujiYomi(uiContext d, int old) { yomiContext yc = (yomiContext)d->modec; WCHAR_T *s = d->buffer_return, *e = s + d->n_buffer; RkStat stat; int len, i, j, yomilen, ll = 0, m = 0, n = 0, recalc = 0; d->nbytes = 0; yomilen = yc->kEndp - yc->cStartp; if (yc->nbunsetsu) { yc->status |= CHIKUJI_ON_BUNSETSU; if (yc->nbunsetsu > old) { recalc = 1; } if (nKouhoBunsetsu) { (void)cutOffLeftSide(d, yc, nKouhoBunsetsu - yc->nbunsetsu); if (nKouhoBunsetsu < yc->nbunsetsu) { n = yc->nbunsetsu - nKouhoBunsetsu; if (n > old) { n = old; /* Á°¤Ë¤Þ¤À´Á»ú¤Ë¤Ê¤Ã¤Æ¤¤¤Ê¤«¤Ã¤¿Ê¬¤Þ¤Ç¤Ï³ÎÄꤵ¤»¤Ê¤¤ */ } } } if (n > 0) { /* ³ÎÄꤵ¤»¤ëʸÀá¿ô */ recalc = 1; for (i = 0 ; i < n ; i++) { if (RkwGoTo(yc->context, i) < 0 || (len = RkwGetKanji(yc->context, s, (int)(e - s))) < 0 || RkwGetStat(yc->context, &stat) == -1) { return -1; } s += len; ll += stat.ylen; m += stat.klen; } d->nbytes = s - d->buffer_return; if (s < e) { *s++ = (WCHAR_T)'\0'; } if (RkwRemoveBun(yc->context, cannaconf.Gakushu ? 1 : 0) == -1) { return -1; } /* ¤«¤Ê¥Ð¥Ã¥Õ¥¡¤È¤«¤âºï¤ë */ kPos2rPos(yc, 0, ll, (int *)0, &j); if (yomiInfoLevel > 0) { d->kanji_status_return->info |= KanjiYomiInfo; len = xString(yc->kana_buffer, ll, s, e); s += len; if (s < e) { *s++ = (WCHAR_T)'\0'; } if (yomiInfoLevel > 1) { len = xString(yc->romaji_buffer, j, s, e); s += len; } if (s < e) { *s++ = (WCHAR_T)'\0'; } } removeKana(d, yc, ll, j); yc->nbunsetsu -= n; } if (RkwGoTo(yc->context, yc->nbunsetsu - 1) == -1) return(-1); yc->curbun = yc->nbunsetsu - 1; if (old < yc->curbun) { /* ¤»¤á¤ÆÁ°¤Î¤ä¤Ä¤Î±¦¤Ë¹Ô¤¯ */ yc->curbun = old; } } if (recalc) { yomilen = RkwGetLastYomi(yc->context, d->genbuf, ROMEBUFSIZE); if (yomilen == -1) { return -1; } if (yomilen < yc->kEndp) { /* ɬ¤º¿¿¤Ç¤Ï¡© */ kPos2rPos(yc, 0, yc->kEndp - yomilen, (int *)0, &j); yc->cStartp = yc->kEndp - yomilen; yc->cRStartp = j; } yc->ys = yc->ye = yc->kEndp; } if (yc->nbunsetsu) { moveToChikujiTanMode(d); } return(0); }
void Application::StartTest(xTest* test) { mConsole->Print(xString(test->Name()) + "..", xConsoleColor::Yellow); mLastTestSuccessful = true; }