//---------------------------------------------------------------------------------------- void nsSimpleCharString::operator = (const char* inString) //---------------------------------------------------------------------------------------- { if (inString) CopyFrom(inString, strlen(inString)); else SetToEmpty(); } // nsSimpleCharString::operator =
//---------------------------------------------------------------------------------------- void nsSimpleCharString::LeafReplace(char inSeparator, const char* inLeafName) //---------------------------------------------------------------------------------------- { // Find the existing leaf name if (IsEmpty()) return; if (!inLeafName) { SetToEmpty(); return; } char* chars = mData->mString; char* lastSeparator = GetLastSeparator(chars, inSeparator); int oldLength = Length(); PRBool trailingSeparator = (lastSeparator + 1 == chars + oldLength); if (trailingSeparator) { char savedCh = *lastSeparator; char *savedLastSeparator = lastSeparator; *lastSeparator = '\0'; lastSeparator = GetLastSeparator(chars, inSeparator); *savedLastSeparator = savedCh; } if (lastSeparator) lastSeparator++; // point at the trailing string else lastSeparator = chars; // the full monty PRUint32 savedLastSeparatorOffset = (lastSeparator - chars); int newLength = (lastSeparator - chars) + strlen(inLeafName) + (trailingSeparator != 0); ReallocData(newLength); chars = mData->mString; // it might have moved. chars[savedLastSeparatorOffset] = '\0'; // strip the current leaf name strcat(chars, inLeafName); if (trailingSeparator) { // If the original ended in a slash, then the new one should, too. char sepStr[2] = "/"; *sepStr = inSeparator; strcat(chars, sepStr); } } // nsSimpleCharString::LeafReplace
shortBounds_t() { SetToEmpty(); }