C# Class nl.siegmann.epublib.domain.TableOfContents

Exibir arquivo Open project: lanfengqi/EpubLib-Sharp Class Usage Examples

Public Methods

Method Description
TableOfContents ( ) : System
TableOfContents ( List tocReferences ) : System
addSection ( Resource resource, String pathElements ) : TOCReference

Adds the given Resources to the TableOfContents at the location specified by the pathElements. Example: Calling this method with a Resource and new String[] {"chapter1", "paragraph1"} will result in the following:

  • a TOCReference with the title "chapter1" at the root level.
    If this TOCReference did not yet exist it will have been created and does not point to any resource
  • A TOCReference that has the title "paragraph1". This TOCReference will be the child of TOCReference "chapter1" and will point to the given Resource

addSection ( Resource resource, int pathElements, string sectionTitlePrefix, string sectionNumberSeparator ) : TOCReference

Adds the given Resources to the TableOfContents at the location specified by the pathElements. Example: Calling this method with a Resource and new int[] {0, 0} will result in the following:

  • a TOCReference at the root level.
    If this TOCReference did not yet exist it will have been created with a title of "" and does not point to any resource
  • A TOCReference that points to the given resource and is a child of the previously created TOCReference.
    If this TOCReference didn't exist yet it will be created and have a title of ""

addSection ( Resource resource, string path ) : TOCReference

Calls addTOCReferenceAtLocation after splitting the path using the DEFAULT_PATH_SEPARATOR.

addSection ( Resource resource, string path, string pathSeparator ) : TOCReference

Calls addTOCReferenceAtLocation after splitting the path using the given pathSeparator.

addTOCReference ( TOCReference tocReference ) : TOCReference
calculateDepth ( ) : int
getAllUniqueResources ( ) : List

All unique references (unique by href) in the order in which they are referenced to in the table of contents.

getTocReferences ( ) : List
setTocReferences ( List tocReferences ) : void
size ( ) : int

The total number of references in this table of contents.

Private Methods

Method Description
calculateDepth ( List tocReferences, int currentDepth ) : int
createSectionTitle ( int pathElements, int pathPos, int lastPos, string sectionPrefix, string sectionNumberSeparator ) : string
findTocReferenceByTitle ( string title, List tocReferences ) : TOCReference

Finds the first TOCReference in the given list that has the same title as the given Title.

getAllUniqueResources ( List uniqueHrefs, List result, List tocReferences ) : void
getTotalSize ( List tocReferences ) : int
paddTOCReferences ( List currentTocReferences, int pathElements, int pathPos, string sectionPrefix, string sectionNumberSeparator ) : void

Method Details

TableOfContents() public method

public TableOfContents ( ) : System
return System

TableOfContents() public method

public TableOfContents ( List tocReferences ) : System
tocReferences List
return System

addSection() public method

Adds the given Resources to the TableOfContents at the location specified by the pathElements. Example: Calling this method with a Resource and new String[] {"chapter1", "paragraph1"} will result in the following:
  • a TOCReference with the title "chapter1" at the root level.
    If this TOCReference did not yet exist it will have been created and does not point to any resource
  • A TOCReference that has the title "paragraph1". This TOCReference will be the child of TOCReference "chapter1" and will point to the given Resource
public addSection ( Resource resource, String pathElements ) : TOCReference
resource Resource
pathElements String
return TOCReference

addSection() public method

Adds the given Resources to the TableOfContents at the location specified by the pathElements. Example: Calling this method with a Resource and new int[] {0, 0} will result in the following:
  • a TOCReference at the root level.
    If this TOCReference did not yet exist it will have been created with a title of "" and does not point to any resource
  • A TOCReference that points to the given resource and is a child of the previously created TOCReference.
    If this TOCReference didn't exist yet it will be created and have a title of ""
public addSection ( Resource resource, int pathElements, string sectionTitlePrefix, string sectionNumberSeparator ) : TOCReference
resource Resource
pathElements int
sectionTitlePrefix string
sectionNumberSeparator string
return TOCReference

addSection() public method

Calls addTOCReferenceAtLocation after splitting the path using the DEFAULT_PATH_SEPARATOR.
public addSection ( Resource resource, string path ) : TOCReference
resource Resource
path string
return TOCReference

addSection() public method

Calls addTOCReferenceAtLocation after splitting the path using the given pathSeparator.
public addSection ( Resource resource, string path, string pathSeparator ) : TOCReference
resource Resource
path string
pathSeparator string
return TOCReference

addTOCReference() public method

public addTOCReference ( TOCReference tocReference ) : TOCReference
tocReference TOCReference
return TOCReference

calculateDepth() public method

public calculateDepth ( ) : int
return int

getAllUniqueResources() public method

All unique references (unique by href) in the order in which they are referenced to in the table of contents.
public getAllUniqueResources ( ) : List
return List

getTocReferences() public method

public getTocReferences ( ) : List
return List

setTocReferences() public method

public setTocReferences ( List tocReferences ) : void
tocReferences List
return void

size() public method

The total number of references in this table of contents.
public size ( ) : int
return int