Logo Search packages:      
Sourcecode: xulrunner version File versions  Download package

void nsTextFragment::CopyTo ( PRUnichar *  aDest,
PRInt32  aOffset,
PRInt32  aCount 
)

Make a copy of the fragments contents starting at offset for count characters. The offset and count will be adjusted to lie within the fragments data. The fragments data is converted if necessary.

Definition at line 263 of file nsTextFragment.cpp.

References GetLength().

{
  NS_ASSERTION(aOffset >= 0, "Bad offset passed to nsTextFragment::CopyTo()!");
  NS_ASSERTION(aCount >= 0, "Bad count passed to nsTextFragment::CopyTo()!");

  if (aOffset < 0) {
    aOffset = 0;
  }

  if (aOffset + aCount > GetLength()) {
    aCount = mState.mLength - aOffset;
  }

  if (aCount != 0) {
    if (mState.mIs2b) {
      memcpy(aDest, m2b + aOffset, sizeof(PRUnichar) * aCount);
    } else {
      const char *cp = m1b + aOffset;
      const char *end = cp + aCount;
      while (cp < end) {
        *aDest++ = (unsigned char)(*cp++);
      }
    }
  }
}


Generated by  Doxygen 1.6.0   Back to index