Public Member Functions

gfxSkipCharsIterator Class Reference

A gfxSkipCharsIterator represents a position in the original string. More...

#include <gfxSkipChars.h>

Collaboration diagram for gfxSkipCharsIterator:

List of all members.

Public Member Functions

 gfxSkipCharsIterator (const gfxSkipChars &aSkipChars, PRInt32 aOriginalStringToSkipCharsOffset, PRInt32 aOriginalStringOffset)
 gfxSkipCharsIterator (const gfxSkipChars &aSkipChars, PRInt32 aOriginalStringToSkipCharsOffset=0)
 gfxSkipCharsIterator (const gfxSkipCharsIterator &aIterator)
 gfxSkipCharsIterator ()
 The empty constructor creates an object that is useless until it is assigned.
PRBool IsInitialized ()
 Return true if this iterator is properly initialized and usable.
void SetOriginalOffset (PRInt32 aOriginalStringOffset)
 Set the iterator to aOriginalStringOffset in the original string.
void SetSkippedOffset (PRUint32 aSkippedStringOffset)
 Set the iterator to aSkippedStringOffset in the skipped string.
PRUint32 ConvertOriginalToSkipped (PRInt32 aOriginalStringOffset)
PRUint32 ConvertSkippedToOriginal (PRInt32 aSkippedStringOffset)
PRBool IsOriginalCharSkipped (PRInt32 *aRunLength=0L) const
 Test if the character at the current position in the original string is skipped or not.
void AdvanceOriginal (PRInt32 aDelta)
void AdvanceSkipped (PRInt32 aDelta)
PRInt32 GetOriginalOffset () const
PRUint32 GetSkippedOffset () const
PRInt32 GetOriginalEnd () const

Detailed Description

A gfxSkipCharsIterator represents a position in the original string.

It lets you map efficiently to and from positions in the string after skipped characters have been removed. You can also specify an offset that is added to all incoming original string offsets and subtracted from all outgoing original string offsets --- useful when the gfxSkipChars corresponds to something offset from the original DOM coordinates, which it often does for gfxTextRuns.

The current positions (in both the original and skipped strings) are always constrained to be >= 0 and <= the string length. When the position is equal to the string length, it is at the end of the string. The current positions do not include any aOriginalStringToSkipCharsOffset.

When the position in the original string corresponds to a skipped character, the skipped-characters offset is the offset of the next unskipped character, or the skipped-characters string length if there is no next unskipped character.


Constructor & Destructor Documentation

gfxSkipCharsIterator::gfxSkipCharsIterator ( const gfxSkipChars aSkipChars,
PRInt32  aOriginalStringToSkipCharsOffset,
PRInt32  aOriginalStringOffset 
) [inline]
Parameters:
aOriginalStringToSkipCharsOffset add this to all incoming and outgoing original string offsets
gfxSkipCharsIterator::gfxSkipCharsIterator ( const gfxSkipChars aSkipChars,
PRInt32  aOriginalStringToSkipCharsOffset = 0 
) [inline]
gfxSkipCharsIterator::gfxSkipCharsIterator ( const gfxSkipCharsIterator aIterator  )  [inline]
gfxSkipCharsIterator::gfxSkipCharsIterator (  )  [inline]

The empty constructor creates an object that is useless until it is assigned.


Member Function Documentation

void gfxSkipCharsIterator::AdvanceOriginal ( PRInt32  aDelta  )  [inline]
void gfxSkipCharsIterator::AdvanceSkipped ( PRInt32  aDelta  )  [inline]
PRUint32 gfxSkipCharsIterator::ConvertOriginalToSkipped ( PRInt32  aOriginalStringOffset  )  [inline]
PRUint32 gfxSkipCharsIterator::ConvertSkippedToOriginal ( PRInt32  aSkippedStringOffset  )  [inline]
PRInt32 gfxSkipCharsIterator::GetOriginalEnd (  )  const [inline]
PRInt32 gfxSkipCharsIterator::GetOriginalOffset (  )  const [inline]
Returns:
the offset within the original string
PRUint32 gfxSkipCharsIterator::GetSkippedOffset (  )  const [inline]
Returns:
the offset within the skipped string corresponding to the current position in the original string. If the current position in the original string is a character that is skipped, then we return the position corresponding to the first non-skipped character in the original string after the current position, or the length of the skipped string if there is no such character.
PRBool gfxSkipCharsIterator::IsInitialized (  )  [inline]

Return true if this iterator is properly initialized and usable.

PRBool gfxSkipCharsIterator::IsOriginalCharSkipped ( PRInt32 *  aRunLength = 0L  )  const

Test if the character at the current position in the original string is skipped or not.

If aRunLength is non-null, then *aRunLength is set to a number of characters all of which are either skipped or not, starting at this character. When the current position is at the end of the original string, we return PR_TRUE and *aRunLength is set to zero.

void gfxSkipCharsIterator::SetOriginalOffset ( PRInt32  aOriginalStringOffset  )  [inline]

Set the iterator to aOriginalStringOffset in the original string.

This can efficiently move forward or backward from the current position. aOriginalStringOffset is clamped to [0,originalStringLength].

void gfxSkipCharsIterator::SetSkippedOffset ( PRUint32  aSkippedStringOffset  )  [inline]

Set the iterator to aSkippedStringOffset in the skipped string.

This can efficiently move forward or backward from the current position. aSkippedStringOffset is clamped to [0,skippedStringLength].


The documentation for this class was generated from the following file: