int FarString::Insert (int nIndex, const char * Str, size_t nLength) { far_assert (nIndex >= 0); if (nLength > 0) { int newLength = fData->fLength; UniqueString(); if (nIndex > newLength) nIndex = newLength; newLength += nLength; fData->SetCapacity (newLength); memmove (fData->fText + nIndex + nLength, fData->fText + nIndex, newLength - nIndex - nLength + 1 ); memmove (fData->fText + nIndex, Str, nLength); fData->fLength = newLength; } return nLength; }
char *uniquify(char *s){ node ss = UniqueString(s); int seqno = ss->body.unique_string.seqno++; char buf[1000]; if (seqno == 0) return s; sprintf(buf,"%s_%d",s,seqno); return strperm(buf); }
int FarString::Delete (int nIndex, int nCount /* = 1 */) { far_assert (nIndex >= 0); int nNewLength = fData->fLength; if (nIndex + nCount > nNewLength) nCount = nNewLength - nIndex; if (nCount > 0 && nIndex < nNewLength) { UniqueString(); int nBytesToCopy = nNewLength - (nIndex + nCount) + 1; memmove (fData->fText + nIndex, fData->fText + nIndex + nCount, nBytesToCopy); fData->fLength = nNewLength - nCount; } return fData->fLength; }
static void uniquifyCXX(char *s){ node ss = UniqueString(s); ss->body.unique_string.flags |= str_keyword_F; }
FarString& FarString::MakeLower() { UniqueString(); CharLowerBuff (fData->fText, fData->fLength); return * this; }