2000-03-07 01:02:10 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/*
|
|
|
|
* The contents of this file are subject to the Netscape Public
|
|
|
|
* License Version 1.1 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.mozilla.org/NPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS
|
|
|
|
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
|
|
* implied. See the License for the specific language governing
|
|
|
|
* rights and limitations under the License.
|
|
|
|
*
|
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is Netscape
|
|
|
|
* Communications Corporation. Portions created by Netscape are
|
|
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All
|
|
|
|
* Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
* Scott Collins <scc@netscape.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _nsAWritableString_h__
|
|
|
|
#define _nsAWritableString_h__
|
|
|
|
|
|
|
|
// WORK IN PROGRESS
|
|
|
|
|
|
|
|
// See also...
|
|
|
|
#include "nsAReadableString.h"
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
This file defines the abstract interfaces |nsAWritableString| and
|
|
|
|
|nsAWritableCString|.
|
|
|
|
|
|
|
|
|nsAWritableString| is a string of |PRUnichar|s. |nsAWritableCString| (note the
|
|
|
|
'C') is a string of |char|s.
|
|
|
|
*/
|
|
|
|
|
|
|
|
template <class CharT>
|
|
|
|
class basic_nsAWritableString
|
|
|
|
: public basic_nsAReadableString<CharT>
|
|
|
|
/*
|
|
|
|
...
|
|
|
|
*/
|
|
|
|
{
|
|
|
|
protected:
|
|
|
|
typedef typename basic_nsAReadableString<CharT>::FragmentRequest FragmentRequest;
|
|
|
|
|
|
|
|
struct Fragment
|
|
|
|
{
|
2000-03-12 01:28:16 +00:00
|
|
|
CharT* mStart;
|
|
|
|
CharT* mEnd;
|
|
|
|
PRUint32 mFragmentIdentifier;
|
2000-03-07 01:02:10 +00:00
|
|
|
|
2000-03-12 01:28:16 +00:00
|
|
|
Fragment()
|
|
|
|
: mStart(0), mEnd(0), mFragmentIdentifier(0)
|
2000-03-07 20:56:07 +00:00
|
|
|
{
|
|
|
|
// nothing else to do here
|
|
|
|
}
|
2000-03-07 01:02:10 +00:00
|
|
|
};
|
|
|
|
|
2000-03-07 20:56:07 +00:00
|
|
|
public:
|
|
|
|
virtual CharT* GetFragment( Fragment&, FragmentRequest, PRUint32 = 0 ) = 0;
|
|
|
|
|
|
|
|
friend class Iterator;
|
|
|
|
class Iterator
|
|
|
|
: public std::bidirectional_iterator_tag
|
|
|
|
{
|
2000-03-12 01:28:16 +00:00
|
|
|
public:
|
|
|
|
typedef ptrdiff_t difference_type;
|
|
|
|
typedef CharT value_type;
|
2000-03-22 08:19:48 +00:00
|
|
|
typedef CharT* pointer;
|
|
|
|
typedef CharT& reference;
|
2000-03-12 01:28:16 +00:00
|
|
|
typedef bidirectional_iterator_tag iterator_category;
|
|
|
|
|
|
|
|
private:
|
2000-03-07 20:56:07 +00:00
|
|
|
friend class basic_nsAWritableString<CharT>;
|
|
|
|
|
|
|
|
Fragment mFragment;
|
|
|
|
CharT* mPosition;
|
2000-03-12 01:28:16 +00:00
|
|
|
basic_nsAWritableString<CharT>* mOwningString;
|
2000-03-07 20:56:07 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
normalize_forward()
|
|
|
|
{
|
|
|
|
if ( mPosition == mFragment.mEnd )
|
2000-03-12 01:28:16 +00:00
|
|
|
if ( mOwningString->GetFragment(mFragment, kNextFragment) )
|
2000-03-07 20:56:07 +00:00
|
|
|
mPosition = mFragment.mStart;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
normalize_backward()
|
|
|
|
{
|
|
|
|
if ( mPosition == mFragment.mStart )
|
2000-03-12 01:28:16 +00:00
|
|
|
if ( mOwningString->GetFragment(mFragment, kPrevFragment) )
|
2000-03-07 20:56:07 +00:00
|
|
|
mPosition = mFragment.mEnd;
|
|
|
|
}
|
|
|
|
|
2000-03-12 01:28:16 +00:00
|
|
|
Iterator( Fragment& aFragment,
|
|
|
|
CharT* aStartingPosition,
|
|
|
|
basic_nsAWritableString<CharT>& aOwningString )
|
|
|
|
: mFragment(aFragment),
|
|
|
|
mPosition(aStartingPosition),
|
|
|
|
mOwningString(&aOwningString)
|
2000-03-07 20:56:07 +00:00
|
|
|
{
|
|
|
|
// nothing else to do here
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
// Iterator( const Iterator& ); ...use default copy-constructor
|
|
|
|
// Iterator& operator=( const Iterator& ); ...use default copy-assignment operator
|
|
|
|
|
|
|
|
|
2000-03-22 08:19:48 +00:00
|
|
|
reference
|
|
|
|
operator*() const
|
2000-03-07 20:56:07 +00:00
|
|
|
{
|
|
|
|
return *mPosition;
|
|
|
|
}
|
|
|
|
|
2000-03-22 08:19:48 +00:00
|
|
|
pointer
|
|
|
|
operator->() const
|
|
|
|
{
|
|
|
|
return mPosition;
|
|
|
|
}
|
|
|
|
|
2000-03-07 20:56:07 +00:00
|
|
|
Iterator&
|
|
|
|
operator++()
|
|
|
|
{
|
|
|
|
++mPosition;
|
2000-03-08 21:57:14 +00:00
|
|
|
normalize_forward();
|
2000-03-07 20:56:07 +00:00
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
Iterator
|
|
|
|
operator++( int )
|
|
|
|
{
|
|
|
|
Iterator result(*this);
|
|
|
|
++mPosition;
|
2000-03-08 21:57:14 +00:00
|
|
|
normalize_forward();
|
2000-03-07 20:56:07 +00:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
Iterator&
|
|
|
|
operator--()
|
|
|
|
{
|
|
|
|
normalize_backward();
|
2000-03-08 21:57:14 +00:00
|
|
|
--mPosition;
|
2000-03-07 20:56:07 +00:00
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
Iterator
|
|
|
|
operator--( int )
|
|
|
|
{
|
|
|
|
Iterator result(*this);
|
|
|
|
normalize_backward();
|
2000-03-08 21:57:14 +00:00
|
|
|
--mPosition;
|
2000-03-07 20:56:07 +00:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2000-03-22 08:19:48 +00:00
|
|
|
const Fragment&
|
|
|
|
fragment() const
|
|
|
|
{
|
|
|
|
return mFragment;
|
|
|
|
}
|
|
|
|
|
|
|
|
difference_type
|
|
|
|
size_forward() const
|
|
|
|
{
|
|
|
|
return mFragment.mEnd - mPosition;
|
|
|
|
}
|
|
|
|
|
|
|
|
difference_type
|
|
|
|
size_backward() const
|
|
|
|
{
|
|
|
|
return mPosition - mFragment.mStart;
|
|
|
|
}
|
|
|
|
|
|
|
|
Iterator&
|
|
|
|
operator+=( difference_type n )
|
|
|
|
{
|
|
|
|
if ( n < 0 )
|
|
|
|
return operator-=(-n);
|
|
|
|
|
|
|
|
while ( n )
|
|
|
|
{
|
|
|
|
difference_type one_hop = std::min(n, size_forward());
|
|
|
|
mPosition += one_hop;
|
|
|
|
normalize_forward();
|
|
|
|
n -= one_hop;
|
|
|
|
}
|
|
|
|
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
Iterator&
|
|
|
|
operator-=( difference_type n )
|
|
|
|
{
|
|
|
|
if ( n < 0 )
|
|
|
|
return operator+=(-n);
|
|
|
|
|
|
|
|
while ( n )
|
|
|
|
{
|
|
|
|
difference_type one_hop = std::min(n, size_backward());
|
|
|
|
mPosition -= one_hop;
|
|
|
|
normalize_backward();
|
|
|
|
n -= one_hop;
|
|
|
|
}
|
|
|
|
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2000-03-08 21:57:14 +00:00
|
|
|
PRBool
|
2000-03-22 08:19:48 +00:00
|
|
|
operator==( const Iterator& rhs ) const
|
2000-03-08 21:57:14 +00:00
|
|
|
{
|
|
|
|
return mPosition == rhs.mPosition;
|
|
|
|
}
|
|
|
|
|
|
|
|
PRBool
|
2000-03-22 08:19:48 +00:00
|
|
|
operator!=( const Iterator& rhs ) const
|
2000-03-07 20:56:07 +00:00
|
|
|
{
|
2000-03-08 21:57:14 +00:00
|
|
|
return mPosition != rhs.mPosition;
|
2000-03-07 20:56:07 +00:00
|
|
|
}
|
|
|
|
};
|
2000-03-07 01:02:10 +00:00
|
|
|
|
|
|
|
public:
|
2000-03-12 01:28:16 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_CPP_USING
|
2000-03-07 20:56:07 +00:00
|
|
|
using basic_nsAReadableString<CharT>::Begin;
|
2000-03-12 01:28:16 +00:00
|
|
|
using basic_nsAReadableString<CharT>::End;
|
|
|
|
#else
|
|
|
|
basic_nsAReadableString<CharT>::ConstIterator
|
|
|
|
Begin( PRUint32 aOffset = 0 ) const
|
|
|
|
{
|
|
|
|
return basic_nsAReadableString<CharT>::Begin(aOffset);
|
|
|
|
}
|
|
|
|
|
|
|
|
basic_nsAReadableString<CharT>::ConstIterator
|
|
|
|
End( PRUint32 aOffset = 0 ) const
|
|
|
|
{
|
|
|
|
return basic_nsAReadableString<CharT>::End(aOffset);
|
|
|
|
}
|
|
|
|
#endif
|
2000-03-07 20:56:07 +00:00
|
|
|
|
|
|
|
Iterator
|
|
|
|
Begin( PRUint32 aOffset = 0 )
|
|
|
|
{
|
2000-03-12 01:28:16 +00:00
|
|
|
Fragment fragment;
|
2000-03-07 20:56:07 +00:00
|
|
|
CharT* startPos = GetFragment(fragment, kFragmentAt, aOffset);
|
2000-03-12 01:28:16 +00:00
|
|
|
return Iterator(fragment, startPos, *this);
|
2000-03-07 20:56:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Iterator
|
|
|
|
End( PRUint32 aOffset = 0 )
|
|
|
|
{
|
2000-03-12 01:28:16 +00:00
|
|
|
Fragment fragment;
|
2000-03-08 21:57:14 +00:00
|
|
|
CharT* startPos = GetFragment(fragment, kFragmentAt, max(0U, Length()-aOffset));
|
2000-03-12 01:28:16 +00:00
|
|
|
return Iterator(fragment, startPos, *this);
|
2000-03-07 20:56:07 +00:00
|
|
|
}
|
|
|
|
|
2000-03-10 02:30:14 +00:00
|
|
|
|
2000-03-07 20:56:07 +00:00
|
|
|
virtual void SetCapacity( PRUint32 ) = 0;
|
|
|
|
virtual void SetLength( PRUint32 ) = 0;
|
2000-03-07 01:02:10 +00:00
|
|
|
|
|
|
|
|
|
|
|
void
|
2000-03-07 20:56:07 +00:00
|
|
|
Truncate( PRUint32 aNewLength=0 )
|
2000-03-07 01:02:10 +00:00
|
|
|
{
|
2000-03-22 08:19:48 +00:00
|
|
|
NS_ASSERTION(aNewLength<=Length(), "Can't use |Truncate()| to make a string longer.");
|
|
|
|
|
|
|
|
if ( aNewLength < Length() )
|
|
|
|
SetLength(aNewLength);
|
2000-03-07 01:02:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-03-12 17:39:49 +00:00
|
|
|
// PRBool SetCharAt( char_type, index_type ) = 0;
|
|
|
|
|
|
|
|
|
2000-03-07 01:02:10 +00:00
|
|
|
|
2000-03-12 01:28:16 +00:00
|
|
|
// void ToLowerCase();
|
|
|
|
// void ToUpperCase();
|
2000-03-07 01:02:10 +00:00
|
|
|
|
|
|
|
// void StripChars( const CharT* aSet );
|
|
|
|
// void StripChar( ... );
|
|
|
|
// void StripWhitespace();
|
|
|
|
// void ReplaceChar( ... );
|
|
|
|
// void ReplaceSubstring( ... );
|
|
|
|
// void Trim( ... );
|
|
|
|
// void CompressSet( ... );
|
2000-03-22 08:19:48 +00:00
|
|
|
// void CompressWhitespace( ... );
|
2000-03-07 01:02:10 +00:00
|
|
|
|
2000-03-10 02:30:14 +00:00
|
|
|
|
2000-03-07 01:02:10 +00:00
|
|
|
|
2000-03-12 20:57:35 +00:00
|
|
|
virtual void Assign( const basic_nsAReadableString<CharT>& rhs );
|
2000-03-12 17:39:49 +00:00
|
|
|
// virtual void AssignChar( CharT ) = 0;
|
|
|
|
|
2000-03-12 20:57:35 +00:00
|
|
|
virtual void Append( const basic_nsAReadableString<CharT>& );
|
|
|
|
virtual void AppendChar( CharT );
|
2000-03-12 17:39:49 +00:00
|
|
|
|
2000-03-12 20:57:35 +00:00
|
|
|
virtual void Insert( const basic_nsAReadableString<CharT>&, PRUint32 atPosition );
|
2000-03-12 17:39:49 +00:00
|
|
|
// virtual void InsertChar( CharT, PRUint32 atPosition ) = 0;
|
|
|
|
|
2000-03-12 20:57:35 +00:00
|
|
|
virtual void Cut( PRUint32 cutStart, PRUint32 cutLength );
|
|
|
|
|
|
|
|
virtual void Replace( PRUint32 cutStart, PRUint32 cutLength, const basic_nsAReadableString<CharT>& );
|
2000-03-12 17:39:49 +00:00
|
|
|
|
2000-03-10 02:30:14 +00:00
|
|
|
|
|
|
|
basic_nsAWritableString<CharT>&
|
|
|
|
operator+=( const basic_nsAReadableString<CharT>& rhs )
|
|
|
|
{
|
|
|
|
Append(rhs);
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
basic_nsAWritableString<CharT>&
|
|
|
|
operator+=( const basic_nsLiteralString<CharT>& rhs )
|
|
|
|
{
|
|
|
|
Append(rhs);
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
basic_nsAWritableString<CharT>&
|
|
|
|
operator=( const basic_nsAReadableString<CharT>& rhs )
|
|
|
|
{
|
|
|
|
Assign(rhs);
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
basic_nsAWritableString<CharT>&
|
|
|
|
operator=( const basic_nsLiteralString<CharT>& rhs )
|
|
|
|
{
|
|
|
|
Assign(rhs);
|
|
|
|
return *this;
|
|
|
|
}
|
2000-03-07 01:02:10 +00:00
|
|
|
};
|
|
|
|
|
2000-03-10 02:30:14 +00:00
|
|
|
NS_DEF_STRING_COMPARISONS(basic_nsAWritableString<CharT>)
|
|
|
|
|
2000-03-22 08:19:48 +00:00
|
|
|
template <class CharT>
|
|
|
|
typename basic_nsAWritableString<CharT>::Iterator
|
|
|
|
copy_chunky( typename basic_nsAReadableString<CharT>::ConstIterator first,
|
|
|
|
typename basic_nsAReadableString<CharT>::ConstIterator last,
|
|
|
|
typename basic_nsAWritableString<CharT>::Iterator result )
|
|
|
|
{
|
|
|
|
while ( first != last )
|
|
|
|
{
|
2000-03-22 22:51:18 +00:00
|
|
|
PRUint32 lengthToCopy = PRUint32( std::min(first.size_forward(), result.size_forward()) );
|
2000-03-22 08:19:48 +00:00
|
|
|
if ( first.fragment().mStart == last.fragment().mStart )
|
2000-03-22 22:51:18 +00:00
|
|
|
lengthToCopy = std::min(lengthToCopy, PRUint32(last.operator->() - first.operator->()));
|
2000-03-22 08:19:48 +00:00
|
|
|
|
|
|
|
// assert(lengthToCopy > 0);
|
|
|
|
|
|
|
|
std::char_traits<CharT>::copy(result.operator->(), first.operator->(), lengthToCopy);
|
|
|
|
|
2000-03-22 22:51:18 +00:00
|
|
|
first += PRInt32(lengthToCopy);
|
|
|
|
result += PRInt32(lengthToCopy);
|
2000-03-22 08:19:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class CharT>
|
|
|
|
typename basic_nsAWritableString<CharT>::Iterator
|
|
|
|
copy_backward_chunky( typename basic_nsAReadableString<CharT>::ConstIterator first,
|
|
|
|
typename basic_nsAReadableString<CharT>::ConstIterator last,
|
|
|
|
typename basic_nsAWritableString<CharT>::Iterator result )
|
|
|
|
{
|
|
|
|
while ( first != last )
|
|
|
|
{
|
2000-03-22 22:51:18 +00:00
|
|
|
PRUint32 lengthToCopy = PRUint32( std::min(first.size_backward(), result.size_backward()) );
|
2000-03-22 08:19:48 +00:00
|
|
|
if ( first.fragment().mStart == last.fragment().mStart )
|
2000-03-22 22:51:18 +00:00
|
|
|
lengthToCopy = std::min(lengthToCopy, PRUint32(first.operator->() - last.operator->()));
|
2000-03-22 08:19:48 +00:00
|
|
|
|
|
|
|
std::char_traits<CharT>::move(result.operator->(), first.operator->(), lengthToCopy);
|
|
|
|
|
2000-03-22 22:51:18 +00:00
|
|
|
first -= PRInt32(lengthToCopy);
|
|
|
|
result -= PRInt32(lengthToCopy);
|
2000-03-22 08:19:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-03-12 20:57:35 +00:00
|
|
|
template <class CharT>
|
|
|
|
void
|
|
|
|
basic_nsAWritableString<CharT>::Assign( const basic_nsAReadableString<CharT>& rhs )
|
|
|
|
{
|
|
|
|
SetLength(rhs.Length());
|
2000-03-22 08:19:48 +00:00
|
|
|
copy_chunky<CharT>(rhs.Begin(), rhs.End(), Begin());
|
2000-03-12 20:57:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template <class CharT>
|
|
|
|
void
|
|
|
|
basic_nsAWritableString<CharT>::Append( const basic_nsAReadableString<CharT>& rhs )
|
|
|
|
{
|
|
|
|
PRUint32 oldLength = Length();
|
|
|
|
SetLength(oldLength + rhs.Length());
|
2000-03-22 08:19:48 +00:00
|
|
|
copy_chunky<CharT>(rhs.Begin(), rhs.End(), Begin(oldLength));
|
2000-03-12 20:57:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template <class CharT>
|
|
|
|
void
|
|
|
|
basic_nsAWritableString<CharT>::AppendChar( CharT aChar )
|
|
|
|
{
|
|
|
|
SetLength(Length()+1);
|
|
|
|
*End(1) = aChar;
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class CharT>
|
|
|
|
void
|
|
|
|
basic_nsAWritableString<CharT>::Insert( const basic_nsAReadableString<CharT>& aReadable, PRUint32 aPosition )
|
|
|
|
{
|
2000-03-22 08:19:48 +00:00
|
|
|
typedef typename basic_nsAReadableString<CharT> readable_t;
|
|
|
|
|
2000-03-12 20:57:35 +00:00
|
|
|
PRUint32 oldLength = Length();
|
|
|
|
SetLength(oldLength + aReadable.Length());
|
|
|
|
if ( aPosition < oldLength )
|
2000-03-22 08:19:48 +00:00
|
|
|
copy_backward_chunky<CharT>(readable_t::Begin(aPosition), readable_t::Begin(oldLength), End());
|
2000-03-12 20:57:35 +00:00
|
|
|
else
|
|
|
|
aPosition = oldLength;
|
2000-03-22 08:19:48 +00:00
|
|
|
copy_chunky<CharT>(aReadable.Begin(), aReadable.End(), Begin(aPosition));
|
2000-03-12 20:57:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template <class CharT>
|
|
|
|
void
|
|
|
|
basic_nsAWritableString<CharT>::Cut( PRUint32 cutStart, PRUint32 cutLength )
|
|
|
|
{
|
2000-03-22 08:19:48 +00:00
|
|
|
typedef typename basic_nsAReadableString<CharT> readable_t;
|
|
|
|
|
|
|
|
copy_chunky<CharT>(readable_t::Begin(cutStart+cutLength), readable_t::End(), Begin(cutStart));
|
2000-03-12 20:57:35 +00:00
|
|
|
SetLength(Length()-cutLength);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class CharT>
|
|
|
|
void
|
|
|
|
basic_nsAWritableString<CharT>::Replace( PRUint32 cutStart, PRUint32 cutLength, const basic_nsAReadableString<CharT>& aReplacement )
|
|
|
|
{
|
|
|
|
PRUint32 oldLength = Length();
|
|
|
|
|
|
|
|
cutStart = min(cutStart, oldLength);
|
|
|
|
cutLength = min(cutLength, oldLength-cutStart);
|
|
|
|
PRUint32 cutEnd = cutStart + cutLength;
|
|
|
|
|
|
|
|
PRUint32 replacementLength = aReplacement.Length();
|
|
|
|
PRUint32 replacementEnd = cutStart + replacementLength;
|
|
|
|
|
|
|
|
PRUint32 newLength = oldLength - cutLength + replacementLength;
|
|
|
|
|
2000-03-22 08:19:48 +00:00
|
|
|
typedef typename basic_nsAReadableString<CharT> readable_t;
|
|
|
|
|
2000-03-12 20:57:35 +00:00
|
|
|
if ( cutLength > replacementLength )
|
2000-03-22 08:19:48 +00:00
|
|
|
copy_chunky<CharT>(readable_t::Begin(cutEnd), readable_t::End(), Begin(replacementEnd));
|
2000-03-12 20:57:35 +00:00
|
|
|
SetLength(newLength);
|
|
|
|
if ( cutLength < replacementLength )
|
2000-03-22 08:19:48 +00:00
|
|
|
copy_backward_chunky<CharT>(readable_t::Begin(cutEnd), readable_t::Begin(oldLength), Begin(replacementEnd));
|
2000-03-12 20:57:35 +00:00
|
|
|
|
2000-03-22 08:19:48 +00:00
|
|
|
copy_chunky<CharT>(aReplacement.Begin(), aReplacement.End(), Begin(cutStart));
|
2000-03-12 20:57:35 +00:00
|
|
|
}
|
2000-03-10 02:30:14 +00:00
|
|
|
|
2000-03-07 01:02:10 +00:00
|
|
|
// operator>>
|
|
|
|
// getline (maybe)
|
|
|
|
|
|
|
|
typedef basic_nsAWritableString<PRUnichar> nsAWritableString;
|
|
|
|
typedef basic_nsAWritableString<char> nsAWritableCString;
|
|
|
|
|
|
|
|
#endif // !defined(_nsAWritableString_h__)
|