void Settings::buildGroupString(String &name, const UTF8 *settingName) { // here we want to loop through the stack and build a "/" seperated string // representing the entire current group stack that gets pre-pended to the // setting name passed in if(mGroupStack.size() > 0) { for(S32 i=0; i < mGroupStack.size(); i++) { S32 pos = 0; if(name.size() > 0) pos = name.size()-1; // tack on the "/" in front if this isn't the first if(i == 0) { name.insert(pos, mGroupStack[i]); } else { name.insert(pos, "/"); name.insert(pos+1, mGroupStack[i]); } } // tack on a final "/" name.insert(name.size()-1, "/"); if(dStrlen(settingName) > 0) name.insert(name.size()-1, settingName); } else name = settingName; }
/** * @brief Show contributors list. * Opens Contributors.txt into notepad. */ void CAboutDlg::OnBnClickedOpenContributors() { String defPath = GetModulePath(); // Don't add quotation marks yet, CFile doesn't like them String docPath = defPath + ContributorsPath; HINSTANCE ret = 0; if (paths_DoesPathExist(docPath.c_str()) == IS_EXISTING_FILE) { // Now, add quotation marks so ShellExecute() doesn't fail if path // includes spaces docPath.insert(0, _T("\"")); docPath.insert(docPath.length(), _T("\"")); ret = ShellExecute(m_hWnd, NULL, _T("notepad"), docPath.c_str(), defPath.c_str(), SW_SHOWNORMAL); // values < 32 are errors (ref to MSDN) if ((int)ret < 32) { // Try to open with associated application (.txt) ret = ShellExecute(m_hWnd, _T("open"), docPath.c_str(), NULL, NULL, SW_SHOWNORMAL); if ((int)ret < 32) ResMsgBox1(IDS_ERROR_EXECUTE_FILE, _T("Notepad.exe"), MB_ICONSTOP); } } else ResMsgBox1(IDS_ERROR_FILE_NOT_FOUND, docPath.c_str(), MB_ICONSTOP); }
void CDatabaseFixedPointTest::TestCase_FixedPointMedPrecisionMedDecimals() { CLogger::LogInfo( StringStream() << "**** Start TestCase_FixedPointMedPrecisionMedDecimals ****" ); int precision = CFixedPoint::GetMaxPrecision() / 2; int decimals = precision / 2; int64_t value; String sval; CLogger::LogInfo( StringStream() << " Max Value" ); value = int64_t( std::numeric_limits< int64_t >::max() % CFixedPoint::Get10Pow256( precision ) ); sval = StringUtils::ToString( value ); sval.insert( ( sval.rbegin() + decimals ).base(), STR( '.' ) ); CheckFixedPoint( precision, decimals, value, sval ); CLogger::LogInfo( StringStream() << " Min Value" ); value = int64_t( std::numeric_limits< int64_t >::min() % CFixedPoint::Get10Pow256( precision ) ); sval = StringUtils::ToString( value ); sval.insert( ( sval.rbegin() + decimals ).base(), STR( '.' ) ); CheckFixedPoint( precision, decimals, value, sval ); CLogger::LogInfo( StringStream() << " Lowest Value" ); value = int64_t( std::numeric_limits< int64_t >::lowest() % CFixedPoint::Get10Pow256( precision ) ); sval = StringUtils::ToString( value ); sval.insert( ( sval.rbegin() + decimals ).base(), STR( '.' ) ); CheckFixedPoint( precision, decimals, value, sval ); CLogger::LogInfo( StringStream() << " Invalid Value (greater precision than wanted)" ); BOOST_CHECK_THROW( CFixedPoint( std::numeric_limits< int64_t >::max(), precision, decimals ), CDatabaseException ); CLogger::LogInfo( StringStream() << "**** End TestCase_FixedPointMaxPrecisionMinDecimals ****" ); }
String DateTime::createTimeString(int minutes, int seconds) { String minString = String::number(minutes); if (minString.length() == 1) minString.insert(minString.begin(), '0'); String secString = String::number(seconds); if (secString.length() == 1) secString.insert(secString.begin(), '0'); return minString + ":" + secString; }
String Location::context(Flags<ToStringFlag> flags, Hash<Path, String> *cache) const { String copy; String *code = 0; const Path p = path(); if (cache) { String &ref = (*cache)[p]; if (ref.isEmpty()) { ref = p.readAll(); } code = &ref; } else { copy = p.readAll(); code = © } String ret; if (!code->isEmpty()) { unsigned int l = line(); if (!l) return String(); const char *ch = code->constData(); while (--l) { ch = strchr(ch, '\n'); if (!ch) return String(); ++ch; } const char *end = strchr(ch, '\n'); if (!end) return String(); ret.assign(ch, end - ch); // error() << "foobar" << ret << bool(flags & NoColor); if (!(flags & NoColor)) { const size_t col = column() - 1; if (col + 1 < ret.size()) { size_t last = col; if (ret.at(last) == '~') ++last; while (ret.size() > last && (isalnum(ret.at(last)) || ret.at(last) == '_')) ++last; static const char *color = "\x1b[32;1m"; // dark yellow static const char *resetColor = "\x1b[0;0m"; // error() << "foobar"<< end << col << ret.size(); ret.insert(last, resetColor); ret.insert(col, color); } // printf("[%s]\n", ret.constData()); } } return ret; }
void String::replace(String before_string, String after_string, String::CaseSensitivity cs) { size_t found = 0; String sub = *this; if (before_string == after_string) assert(false); if (cs == String::NotCaseSensitive) { sub.toLowerCase(); before_string.toLowerCase(); } while (found != std::string::npos) { found = sub.find(before_string); if (found != std::string::npos) { erase(int(found), before_string.length()); sub.erase(int(found), before_string.length()); insert(found, after_string); sub.insert(found, after_string); } } }
void CharacterData::replaceData(unsigned offset, unsigned count, const String& arg, ExceptionCode& ec) { checkCharDataOperation(offset, ec); if (ec) return; unsigned realCount; if (offset + count > length()) realCount = length() - offset; else realCount = count; String newStr = m_data; newStr.remove(offset, realCount); newStr.insert(arg, offset); RefPtr<StringImpl> oldStr = m_data; m_data = newStr.impl(); if ((!renderer() || !rendererIsNeeded(renderer()->style())) && attached()) { detach(); attach(); } else if (renderer()) static_cast<RenderText*>(renderer())->setTextWithOffset(m_data, offset, count); dispatchModifiedEvent(oldStr.get()); // update the markers for spell checking and grammar checking document()->textRemoved(this, offset, realCount); document()->textInserted(this, offset, arg.length()); }
String UriNdefRecord::getUri() { valid = false; int tnf = getTnf(); byte type[1]; byte payload[256]; switch (tnf) { case MA_NFC_NDEF_TNF_ABSOLUTE_URI: valid = true; return String((char*)getPayload().pointer()); case MA_NFC_NDEF_TNF_WELL_KNOWN: int typeLen = maNFCGetNDEFType(fHandle, type, 1); if (typeLen > 0 && type[0] == 0x55) { Vector<byte> payload = getPayload(); int length = payload.size(); if (length > 0) { String result = String(); const char* prefix = getPrefix(payload[0]); result.append(prefix, strlen(prefix)); for (int i = 1; i < length; i++) { result.insert(result.size(), (char)payload[i]); } valid = true; return result; } } break; } // No match. return String(); }
/** * @brief Write path and filename to headerbar * @note SetText() does not repaint unchanged text */ void CHexMergeDoc::UpdateHeaderPath(int pane) { CHexMergeFrame *pf = GetParentFrame(); ASSERT(pf); String sText; if (m_nBufferType[pane] == BUFFER_UNNAMED || m_nBufferType[pane] == BUFFER_NORMAL_NAMED) { sText = m_strDesc[pane]; } else { sText = m_filePaths.GetPath(pane); if (m_pDirDoc) { if (pane == 0) m_pDirDoc->ApplyLeftDisplayRoot(sText); else m_pDirDoc->ApplyRightDisplayRoot(sText); } } if (m_pView[pane]->GetModified()) sText.insert(0, _T("* ")); pf->GetHeaderInterface()->SetText(pane, sText.c_str()); SetTitle(NULL); }
QualifiedName Symbol::fullyQualifiedName() const { if (!isResolved()) resolve(); if (!scope()) return name(); String qname; const Symbol* g = globalScope(); for (const Symbol *s = this; s && s->scope(); s = s->scope()) { qname.insert(0, s->name().c_str()); if (s->scope() != g) qname.insert(0, "."); } return context()->internName(qname); }
/** * @brief Replace internal root by display root (left). * When we have a archive file open, this function converts physical folder * (that is in the temp folder where archive was extracted) to the virtual * path for showing. The virtual path is path to the archive file, archive * file name and folder inside the archive. * @param [in, out] sText Path to convert. */ void CDirDoc::ApplyLeftDisplayRoot(String &sText) { if (m_pTempPathContext) { sText.erase(0, m_pTempPathContext->m_strLeftRoot.length()); sText.insert(0, m_pTempPathContext->m_strLeftDisplayRoot.c_str()); } }
/** This function aligns the string table to a 4-byte boundary @internalComponent @released @return Error status @param aStr - string to be aligned */ void ElfProducer::AlignString(String& aStr) { if( aStr.size() %4 ){ PLUCHAR aPad = (PLUCHAR)(4 - (aStr.size() %4)); while(aPad--) { aStr.insert(aStr.end(), 0); } } }
void Dtime::Time_Label (string label, Units_Type time_format) { String time; if (time_format == NO_UNITS) time_format = Time_Format (); dtime = 0; time = label; time.Trim (" \t"); if (time.empty ()) { exe->Warning ("Time Label Conversion "); return; } if (time.find_first_of (".:") == time.npos) { size_t len = time.length (); //---- scan for clock time ---- if (len >= 3 && len <= 4) { bool flag = false; if (time [0] == '0') { flag = true; } else if (len == 4) { if (time [0] <= '2' && time [2] <= '5') { flag = true; } } else if (time [1] <= '5') { flag = true; } if (flag) { if (len == 4) { time.insert (2, ":"); } else { time.insert (1, ":"); } } } } Time_String (time, time_format); return; }
void HTMLTextFormControlElement::setRangeText(const String& replacement, unsigned start, unsigned end, const String& selectionMode, ExceptionState& exceptionState) { if (start > end) { exceptionState.throwDOMException(IndexSizeError, "The provided start value (" + String::number(start) + ") is larger than the provided end value (" + String::number(end) + ")."); return; } if (hasAuthorShadowRoot()) return; String text = innerTextValue(); unsigned textLength = text.length(); unsigned replacementLength = replacement.length(); unsigned newSelectionStart = selectionStart(); unsigned newSelectionEnd = selectionEnd(); start = std::min(start, textLength); end = std::min(end, textLength); if (start < end) text.replace(start, end - start, replacement); else text.insert(replacement, start); setInnerTextValue(text); // FIXME: What should happen to the value (as in value()) if there's no renderer? if (!renderer()) return; subtreeHasChanged(); if (equalIgnoringCase(selectionMode, "select")) { newSelectionStart = start; newSelectionEnd = start + replacementLength; } else if (equalIgnoringCase(selectionMode, "start")) newSelectionStart = newSelectionEnd = start; else if (equalIgnoringCase(selectionMode, "end")) newSelectionStart = newSelectionEnd = start + replacementLength; else { // Default is "preserve". long delta = replacementLength - (end - start); if (newSelectionStart > end) newSelectionStart += delta; else if (newSelectionStart > start) newSelectionStart = start; if (newSelectionEnd > end) newSelectionEnd += delta; else if (newSelectionEnd > start) newSelectionEnd = start + replacementLength; } setSelectionRange(newSelectionStart, newSelectionEnd, SelectionHasNoDirection); }
void HTMLTextFormControlElement::setRangeText(const String& replacement, unsigned start, unsigned end, const String& selectionMode, ExceptionCode& ec) { if (start > end) { ec = INDEX_SIZE_ERR; return; } String text = innerTextValue(); unsigned textLength = text.length(); unsigned replacementLength = replacement.length(); unsigned newSelectionStart = selectionStart(); unsigned newSelectionEnd = selectionEnd(); start = std::min(start, textLength); end = std::min(end, textLength); if (start < end) text.replace(start, end - start, replacement); else text.insert(replacement, start); setInnerTextValue(text); // FIXME: What should happen to the value (as in value()) if there's no renderer? if (!renderer()) return; subtreeHasChanged(); if (equalIgnoringCase(selectionMode, "select")) { newSelectionStart = start; newSelectionEnd = start + replacementLength; } else if (equalIgnoringCase(selectionMode, "start")) newSelectionStart = newSelectionEnd = start; else if (equalIgnoringCase(selectionMode, "end")) newSelectionStart = newSelectionEnd = start + replacementLength; else { // Default is "preserve". long delta = replacementLength - (end - start); if (newSelectionStart > end) newSelectionStart += delta; else if (newSelectionStart > start) newSelectionStart = start; if (newSelectionEnd > end) newSelectionEnd += delta; else if (newSelectionEnd > start) newSelectionEnd = start + replacementLength; } setSelectionRange(newSelectionStart, newSelectionEnd, SelectionHasNoDirection); }
bool test_20() { OS::get_singleton()->print("\n\nTest 20: Insertion\n"); String s = "Who is Frederic?"; OS::get_singleton()->print("\tString: %ls\n", s.c_str()); s = s.insert(s.find("?"), " Chopin"); OS::get_singleton()->print("\tInserted Chopin: %ls.\n", s.c_str()); return (s == "Who is Frederic Chopin?"); }
//-------------------------------------------------------------------------- // On add - verify data settings //-------------------------------------------------------------------------- bool CustomMaterial::onAdd() { if (Parent::onAdd() == false) return false; mShaderData = dynamic_cast<ShaderData*>(Sim::findObject( mShaderDataName ) ); if(mShaderDataName.isNotEmpty() && mShaderData == NULL) { logError("Failed to find ShaderData %s", mShaderDataName.c_str()); return false; } const char* samplerDecl = "sampler"; S32 i = 0; for (SimFieldDictionaryIterator itr(getFieldDictionary()); *itr; ++itr) { SimFieldDictionary::Entry* entry = *itr; if (dStrStartsWith(entry->slotName, samplerDecl)) { if (i >= MAX_TEX_PER_PASS) { logError("Too many sampler declarations, you may only have %i", MAX_TEX_PER_PASS); return false; } if (dStrlen(entry->slotName) == dStrlen(samplerDecl)) { logError("sampler declarations must have a sampler name, e.g. sampler[\"diffuseMap\"]"); return false; } // Assert sampler names are defined on ShaderData S32 pos = -1; String samplerName = entry->slotName + dStrlen(samplerDecl); samplerName.insert(0, '$'); mShaderData->hasSamplerDef(samplerName, pos); if(pos == -1) { const char *error = (avar("CustomMaterial(%s) bind sampler[%s] and is not present on ShaderData(%s)", getName(), samplerName.c_str(), mShaderDataName.c_str() )); Con::errorf(error); GFXAssertFatal(0, error); continue; } mSamplerNames[pos] = samplerName; mTexFilename[pos] = entry->value; ++i; } } return true; }
void report() { if (!m_scriptState->contextIsValid()) return; // If execution termination has been triggered, quietly bail out. if (v8::V8::IsExecutionTerminating(m_scriptState->isolate())) return; ExecutionContext* executionContext = m_scriptState->executionContext(); if (!executionContext) return; ScriptState::Scope scope(m_scriptState); v8::Local<v8::Value> value = m_promise.newLocal(m_scriptState->isolate()); v8::Local<v8::Value> reason = m_exception.newLocal(m_scriptState->isolate()); // Either collected or https://crbug.com/450330 if (value.IsEmpty() || !value->IsPromise()) return; ASSERT(!hasHandler()); EventTarget* target = executionContext->errorEventTarget(); if (RuntimeEnabledFeatures::promiseRejectionEventEnabled() && target && !executionContext->shouldSanitizeScriptError(m_resourceName, m_corsStatus)) { PromiseRejectionEventInit init; init.setPromise(ScriptPromise(m_scriptState, value)); init.setReason(ScriptValue(m_scriptState, reason)); init.setCancelable(true); RefPtrWillBeRawPtr<PromiseRejectionEvent> event = PromiseRejectionEvent::create(m_scriptState, EventTypeNames::unhandledrejection, init); // Log to console if event was not preventDefault()'ed. m_shouldLogToConsole = target->dispatchEvent(event); } if (m_shouldLogToConsole) { const String errorMessage = "Uncaught (in promise)"; Vector<ScriptValue> args; args.append(ScriptValue(m_scriptState, v8String(m_scriptState->isolate(), errorMessage))); args.append(ScriptValue(m_scriptState, reason)); RefPtrWillBeRawPtr<ScriptArguments> arguments = ScriptArguments::create(m_scriptState, args); String embedderErrorMessage = m_errorMessage; if (embedderErrorMessage.isEmpty()) embedderErrorMessage = errorMessage; else if (embedderErrorMessage.startsWith("Uncaught ")) embedderErrorMessage.insert(" (in promise)", 8); RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, embedderErrorMessage, m_resourceName, m_lineNumber, m_columnNumber); consoleMessage->setScriptArguments(arguments); consoleMessage->setCallStack(m_callStack); consoleMessage->setScriptId(m_scriptId); m_consoleMessageId = consoleMessage->assignMessageId(); executionContext->addConsoleMessage(consoleMessage.release()); } m_callStack.clear(); }
const UTF8 *Settings::getCurrentGroups() { // we want to return a string with our group setup String returnString; for(S32 i=0; i<mGroupStack.size(); i++) { S32 pos = returnString.size() - 1; if(pos < 0) pos = 0; if(i == 0) { returnString.insert(pos, mGroupStack[i]); } else { returnString.insert(pos, "/"); returnString.insert(pos+1, mGroupStack[i]); } } return StringTable->insert(returnString.c_str()); }
String SynonymPath::calculate(const String& _srcPath) { // This name and base archive's name are the same directory. // However the names must be different to allow // to find archives by unique name. String retPath = _srcPath; size_t slashPos = retPath.rfind('\\'); if(slashPos != String.npos) { retPath.insert(slashPos, "\\"); } else { slashPos = retPath.rfind('/'); if(slashPos != String.npos) { retPath.insert(slashPos, "/"); } } GOTHOGRE_ASSERT(retPath != _srcPath, "Pathes must differs!"); return retPath; }
void CharacterData::insertData(unsigned offset, const String& data, ExceptionCode& ec) { checkCharDataOperation(offset, ec); if (ec) return; String newStr = m_data; newStr.insert(data, offset); setDataAndUpdate(newStr, offset, 0, data.length()); document()->textInserted(this, offset, data.length()); }
bool Editbox::handleEvent( const WM_Base &wm ) { if(wm.type==WMT_KeyChar) { if(isFocused()) { const WM_Keyboard &m = WM_Keyboard::cast(wm); wchar_t c = (wchar_t)m.key; String text = getText(); bool changed = false; if(isprint(c)) { text.insert(text.begin()+m_cursor, &c, &c+1); ++m_cursor; changed = true; } if(changed) { setText(text); } return true; } } else if(wm.type==WMT_KeyDown) { if(isFocused()) { const WM_Keyboard &m = WM_Keyboard::cast(wm); wchar_t c = (wchar_t)m.key; String text = getText(); bool changed = false; if(c==ist::KEY_ENTER) { callIfValid(m_on_chnage); setFocus(false); } else if(c==ist::KEY_DELETE) { if(m_cursor<(int32)text.size()) { text.erase(text.begin()+m_cursor, text.begin()+m_cursor+1); changed = true; } } else if(c==ist::KEY_BACK) { if(m_cursor>0) { text.erase(text.begin()+m_cursor-1, text.begin()+m_cursor); --m_cursor; changed = true; } } else if(c==ist::KEY_RIGHT) { m_cursor = ist::clamp<int32>(m_cursor+1, 0, text.size()); } else if(c==ist::KEY_LEFT) { m_cursor = ist::clamp<int32>(m_cursor-1, 0, text.size()); } if(changed) { setText(text); } } } return super::handleEvent(wm); }
void CharacterData::insertData(unsigned offset, const String& data, ExceptionState& exceptionState, RecalcStyleBehavior recalcStyleBehavior) { if (offset > length()) { exceptionState.ThrowDOMException(IndexSizeError, "The offset " + String::number(offset) + " is greater than the node's length (" + String::number(length()) + ")."); return; } String newStr = m_data; newStr.insert(data, offset); setDataAndUpdate(newStr, offset, 0, data.length(), recalcStyleBehavior); document().didInsertText(this, offset, data.length()); }
void CommentOutFunction(String& code, const String& signature) { unsigned startPos = code.find(signature.c_str()); unsigned braceLevel = 0; if (startPos == String::npos) return; code.insert(startPos, "/*"); for (unsigned i = startPos + 2 + signature.size(); i < code.size(); ++i) { if (code[i] == '{') ++braceLevel; else if (code[i] == '}') { --braceLevel; if (braceLevel == 0) { code.insert(i + 1, "*/"); return; } } } }
void HTMLTextFormControlElement::setRangeText(const String& replacement, unsigned start, unsigned end, const String& selectionMode, ExceptionState& exceptionState) { if (start > end) { exceptionState.throwDOMException(IndexSizeError, "The provided start value (" + String::number(start) + ") is larger than the provided end value (" + String::number(end) + ")."); return; } if (openShadowRoot()) return; String text = innerEditorValue(); unsigned textLength = text.length(); unsigned replacementLength = replacement.length(); unsigned newSelectionStart = selectionStart(); unsigned newSelectionEnd = selectionEnd(); start = std::min(start, textLength); end = std::min(end, textLength); if (start < end) text.replace(start, end - start, replacement); else text.insert(replacement, start); setValue(text, TextFieldEventBehavior::DispatchNoEvent); if (selectionMode == "select") { newSelectionStart = start; newSelectionEnd = start + replacementLength; } else if (selectionMode == "start") { newSelectionStart = newSelectionEnd = start; } else if (selectionMode == "end") { newSelectionStart = newSelectionEnd = start + replacementLength; } else { ASSERT(selectionMode == "preserve"); long delta = replacementLength - (end - start); if (newSelectionStart > end) newSelectionStart += delta; else if (newSelectionStart > start) newSelectionStart = start; if (newSelectionEnd > end) newSelectionEnd += delta; else if (newSelectionEnd > start) newSelectionEnd = start + replacementLength; } setSelectionRange(newSelectionStart, newSelectionEnd, SelectionHasNoDirection); }
String CVarRecord::generateSyncedStringRepresentation() const { // Replace the old value with the new. std::stringstream ss; if (cvar.getType() == sani::cvarlang::ValueType::StringVal) { String value; cvar.read(value); ss << value; } else if (cvar.getType() == sani::cvarlang::ValueType::IntVal) { int32 value = 0; cvar.read(value); ss << value; } else if (cvar.getType() == sani::cvarlang::ValueType::FloatVal) { float32 value = 0.0f; cvar.read(value); ss << value; } else if (cvar.getType() == sani::cvarlang::ValueType::DoubleVal) { float64 value = 0.0; cvar.read(value); ss << value; } // Create the new representation. const String newValue = ss.str(); String newRepresentation = token.getLine(); if (newValue.size() < originalValue.size()) { // Remove chars. const size_t diff = originalValue.size() - newValue.size(); newRepresentation.erase(indexOfValue, diff); } else if (newValue.size() > originalValue.size()) { // Add chars. const size_t diff = newValue.size() - originalValue.size(); String insertion; insertion.resize(diff, ' '); newRepresentation.insert(indexOfValue, insertion); } newRepresentation.replace(indexOfValue, newValue.size(), newValue); return newRepresentation; }
static void generateSecWebSocketKey(uint32_t& number, String& key) { uint32_t space = randomNumberLessThan(12) + 1; uint32_t max = 4294967295U / space; number = randomNumberLessThan(max); uint32_t product = number * space; String s = String::number(product); int n = randomNumberLessThan(12) + 1; DEFINE_STATIC_LOCAL(String, randomChars, (randomCharacterInSecWebSocketKey)); for (int i = 0; i < n; i++) { int pos = randomNumberLessThan(s.length() + 1); int chpos = randomNumberLessThan(randomChars.length()); s.insert(randomChars.substring(chpos, 1), pos); } DEFINE_STATIC_LOCAL(String, spaceChar, (" ")); for (uint32_t i = 0; i < space; i++) { int pos = randomNumberLessThan(s.length() - 1) + 1; s.insert(spaceChar, pos); } ASSERT(s[0] != ' '); ASSERT(s[s.length() - 1] != ' '); key = s; }
void DuplicateAmpersand(String& str) { String::size_type pos= str.find(_T('&'), 0); while (pos != String::npos) { str.insert(pos, _T("&")); pos += 2; if (pos >= str.length()) break; pos = str.find(_T('&'), pos); } }
void CharacterData::replaceData(unsigned offset, unsigned count, const String& data, ExceptionState& exceptionState) { unsigned realCount = 0; if (!validateOffsetCount(offset, count, length(), realCount, exceptionState)) return; String newStr = m_data; newStr.remove(offset, realCount); newStr.insert(data, offset); setDataAndUpdate(newStr, offset, realCount, data.length()); // update the markers for spell checking and grammar checking document().didRemoveText(this, offset, realCount); document().didInsertText(this, offset, data.length()); }
/// Append a second path to this one. /// @pre o's separator is the same as this one's, or o has no separators string_path& operator /=(const string_path &o) { // If it's single, there's no separator. This allows to do // p /= "piece"; // even for non-default separators. assert((m_separator == o.m_separator || o.empty() || o.single()) && "Incompatible paths."); if(!o.empty()) { String sub; if(!this->empty()) { sub.push_back(m_separator); } sub.insert(sub.end(), o.cstart(), o.m_value.end()); detail::append_and_preserve_iter(m_value, sub, m_start, typename std::iterator_traits<s_iter>::iterator_category()); } return *this; }