Foxit PDF SDK

Public Types | Public Member Functions | List of all members
foxit::common::Range Class Reference
Inheritance diagram for foxit::common::Range:

## Public Types
enum | Filter { e_All = 0, e_Even = 1, e_Odd = 2 }
| Enumeration for range filter. More...

## Public Member Functions
| Range ()
| Constructor.
| Range (const Range &other)
| Constructor, with another range object. More...
| Range (int index)
| Constructor, with a single index. More...
| Range (int start_index, int end_index, Filter filter=e_All)
| Constructor, with a specified index range. More...
| ~Range ()
| Destructor.
void | AddSegment (int start_index, int end_index, Filter filter=e_All)
| Add a new range segment. (Reverse ordering is legal.) More...
void | AddSingle (int index)
| Add an index as a new range segment. More...
int | GetSegmentCount () const
| Get the count of range segments. More...
int | GetSegmentEnd (int segment_index) const
| Get the end index of a specified range segment. More...
int | GetSegmentStart (int segment_index) const
| Get the start index of a specified range segment. More...
bool | IsEmpty () const
| Check whether current object is empty or not. More...
bool | operator!= (const Range &other) const
| Not equal operator. More...
Range & | operator= (const Range &other)
| Assign operator. More...
bool | operator== (const Range &other) const
| Equal operator. More...
void | RemoveAll ()
| Remove all range segments. More...
Public Member Functions inherited from foxit::Base
FS_HANDLE | Handle () const
| Get the handle of current object. More...

## Detailed Description

This class represents index range. Here, a range consists of one or more segments and each segment consists of one single index or a group of consecutive indexes.
For some special case, such as used in pdf::HeaderFooter, index values specified in this range represent page numbers directly instead of page indexes.

See also
  pdf::HeaderFooter

## Member Enumeration Documentation

## ◆ Filter

enum foxit::common::Range::Filter

Enumeration for range filter.

Values of this enumeration should be used alone.

Enumerator
e_All | All the indexes within a range will be used.
e_Even | Only even numbers in a range will be used (discards odd numbers).
e_Odd | Only odd numbers in a range will be used (discards even numbers).

## Constructor & Destructor Documentation

## ◆ Range() [1/3]

foxit::common::Range::Range | ( | int | index | ) |
| explicit

Constructor, with a single index.

Parameters

  [in] | index | A single index.

## ◆ Range() [2/3]

foxit::common::Range::Range | ( | int | start_index,
|  | int | end_index,
|  | Filter | filter = `e_All`
| ) |  |
| explicit

Constructor, with a specified index range.

Parameters

  [in] | start_index | The start index of a range segment.
  [in] | end_index | The end index of a range segment.
  [in] | filter | Filter type to decide which indexes of this range would be used. Please refer to values starting from Range::e_All and this should be one of these values. Default value: Range::e_All. Specially, when this value is Range::e_Even or Range::e_Odd, that means each even or odd number within the specified range segment will be treated as a single segment.

## ◆ Range() [3/3]

foxit::common::Range::Range | ( | const Range & | other | ) |

Constructor, with another range object.

Parameters

  [in] | other | Another range object.

## Member Function Documentation

## ◆ AddSegment()

void foxit::common::Range::AddSegment | ( | int | start_index,
|  | int | end_index,
|  | Filter | filter = `e_All`
| ) |  |

Add a new range segment. (Reverse ordering is legal.)

Parameters

  [in] | start_index | The start index of a new range segment.
  [in] | end_index | The end index of a new range segment.
  [in] | filter | Filter type to decide which indexes of this range would be used. Please refer to values starting from Range::e_All and this should be one of these values. Default value: Range::e_All. Specially, when this value is Range::e_Even or Range::e_Odd, that means each even or odd number within the specified range segment will be treated as a single segment.

Returns
  None.

## ◆ AddSingle()

void foxit::common::Range::AddSingle | ( | int | index | ) |

Add an index as a new range segment.

Parameters

  [in] | index | An index to be added as a new range segment.

## ◆ GetSegmentCount()

int foxit::common::Range::GetSegmentCount | ( |  | ) | const

Get the count of range segments.

Returns
  The count of range segments.

## ◆ GetSegmentEnd()

int foxit::common::Range::GetSegmentEnd | ( | int | segment_index | ) | const

Get the end index of a specified range segment.

Parameters

  [in] | segment_index | The segment index. Valid range: 0 to (count-1). count is returned by function Range::GetSegmentCount.

Returns
  The end index of a specified range segment.

## ◆ GetSegmentStart()

int foxit::common::Range::GetSegmentStart | ( | int | segment_index | ) | const

Get the start index of a specified range segment.

Parameters

  [in] | segment_index | The segment index. Valid range: 0 to (count-1). count is returned by function Range::GetSegmentCount.

Returns
  The start index of a specified range segment.

## ◆ IsEmpty()

bool foxit::common::Range::IsEmpty | ( |  | ) | const

Check whether current object is empty or not.

When the current object is empty, that means current object is useless.

Returns
  true means current object is empty, while false means not.

## ◆ operator!=()

bool foxit::common::Range::operator!= | ( | const Range & | other | ) | const

Not equal operator.

Parameters

  [in] | other | Another range object. This function will check if current object is not equal to this one.

Returns
  true means not equal, while false means equal.

## ◆ operator=()

Range& foxit::common::Range::operator= | ( | const Range & | other | ) |

Assign operator.

Parameters

  [in] | other | Another range object, whose value would be assigned to current object.

Returns
  Reference to current object itself.

## ◆ operator==()

bool foxit::common::Range::operator== | ( | const Range & | other | ) | const

Equal operator.

Parameters

  [in] | other | Another range object. This function will check if current object is equal to this one.

Returns
  true means equal, while false means not equal.

## ◆ RemoveAll()

void foxit::common::Range::RemoveAll | ( |  | ) |

Remove all range segments.

Returns
  None.