Document Reference. More...

#include <gdocref.h>

Public Member Functions

 GDocRef (GDoc *doc)
 
int Compare (const GDocRef &ref) const
 
int Compare (const GDoc *doc) const
 
GDocGetDoc (void) const
 
void Clear (void)
 
GDocFragmentAddFragment (const GConceptRecord *rec, size_t pos, size_t spos, size_t begin, size_t end, bool &exist)
 
GDocFragmentAddFragment (const GConceptRecord *rec)
 
GDocFragmentAddFragment (const GConceptRecord *rec, const GConceptRecord *child, size_t pos, size_t spos, size_t begin, size_t end, bool &exist)
 
GDocFragmentAddFragment (const GConceptRecord *rec, const GConceptRecord *child, bool &exist)
 
GDocFragmentAddFragment (GDoc *doc, const GConceptRecord *child, size_t begin, size_t end, bool &exist)
 
GDocFragmentCopyFragment (const GDocFragment *tocopy, bool &exist)
 
void CopyFragments (const GDocRef *tocopy)
 
size_t GetNbFragments (void) const
 
R::RCursor< GDocFragmentGetFragments (void) const
 
bool FindSibling (GDocFragment *fragment) const
 
bool FindChild (GDocFragment *fragment) const
 
void Reduce (bool force)
 
void Print (void)
 

Private Attributes

GDocDoc
 
R::RContainer< GDocFragment,
true, true > 
Fragments
 

Detailed Description

Document Reference.

The GDocRef class provides a reference of a document and a set of fragments.

Constructor & Destructor Documentation

GDocRef ( GDoc doc)

Construct a reference to a document.

Parameters
docDocument referenced.

Member Function Documentation

int Compare ( const GDocRef ref) const

Compare two document references.

Parameters
refDocument reference to compare with.
Returns
-1,0 or 1 depending on the comparison of the document identifiers.
int Compare ( const GDoc doc) const

Compare a document reference and a document.

Parameters
docDocument to compare with.
Returns
-1,0 or 1 depending on the comparison of the document identifiers.
GDoc* GetDoc ( void  ) const

Get the document referenced.

Returns
a pointer to a GDoc.
void Clear ( void  )

Clear the fragments.

GDocFragment* AddFragment ( const GConceptRecord rec,
size_t  pos,
size_t  spos,
size_t  begin,
size_t  end,
bool &  exist 
)

Add a fragment related to a given node.

Parameters
nodeConcept node associated to the fragment.
posPosition of the concept node that identifies the fragment.
sposSyntactic position of the fragment centre.
beginBeginning of the fragment.
endEnding of the fragment.
existSet by the method to specify if the fragment already exists (true) or was created (false).
Returns
a pointer to a GDocFragment.
GDocFragment* AddFragment ( const GConceptRecord rec)

Add a fragment related to a given record. The fragment is limited to the concept node.

Parameters
nodeConcept node associated to the fragment.
Returns
a pointer to a GDocFragment.
GDocFragment* AddFragment ( const GConceptRecord rec,
const GConceptRecord child,
size_t  pos,
size_t  spos,
size_t  begin,
size_t  end,
bool &  exist 
)

Add a fragment selected by a child node.

Parameters
nodeConcept node associated to the fragment. child Child concept node use to select the concept node.
posPosition of the concept node that identifies the fragment.
sposSyntactic position of the fragment centre.
beginBeginning of the fragment.
endEnding of the fragment.
existSet by the method to specify if the fragment already exists (true) or was created (false).
Returns
a pointer to a GDocFragment.
GDocFragment* AddFragment ( const GConceptRecord rec,
const GConceptRecord child,
bool &  exist 
)

Add a fragment selected by a child node. The fragment is limited to the concept node and the child node.

Parameters
nodeConcept node associated to the fragment.
childChild concept node use to select the concept node.
existSet by the method to specify if the fragment already exists (true) or was created (false).
Returns
a pointer to a GDocFragment.
GDocFragment* AddFragment ( GDoc doc,
const GConceptRecord child,
size_t  begin,
size_t  end,
bool &  exist 
)

Add a document that represents the whole document.

Parameters
docDocument.
childChild concept node use to select the concept node.
beginBeginning of the fragment.
endEnding of the fragment.
existSet by the method to specify if the fragment already exists (true) or was created (false).
Returns
a pointer to a GDocFragment.
GDocFragment* CopyFragment ( const GDocFragment tocopy,
bool &  exist 
)

Copy a fragment into the container.

Parameters
tocopyFragment to copy.
existSet by the method to specify if the fragment already exists (true) or was created (false).
Returns
a pointer to a GDocFragment.
void CopyFragments ( const GDocRef tocopy)

Copy a set of fragments into the container.

Parameters
tocopyFragments to copy.
Returns
size_t GetNbFragments ( void  ) const
Returns
the number of fragment.
R::RCursor<GDocFragment> GetFragments ( void  ) const

Get all the fragments.

Returns
a R::RCursor of GDocFragment.
bool FindSibling ( GDocFragment fragment) const

Look if a document fragment has a sibling fragment in the container.

Parameters
fragmentFragment to analyse.
Returns
true if it is the case.
bool FindChild ( GDocFragment fragment) const

Look if a document fragment has a child fragment in the container.

Parameters
fragmentFragment to analyse.
Returns
true if it is the case.
void Reduce ( bool  force)

Reduce the fragments.

Parameters
forceForce to merge the fragments sharing the same node. It should be true in the case of an AND operator, and false in the case of an OR operator.
void Print ( void  )

Print the information of each fragment.

Member Data Documentation

GDoc* Doc
private

Document referenced.

R::RContainer<GDocFragment,true,true> Fragments
private

List of fragments.