Public Member Functions | Public Attributes

DataManager Class Reference
[Code for the parsing/indexing task]

Manages the data buffers and interface for the parser. More...

#include <datamanager.hpp>

Inheritance diagram for DataManager:
Database

List of all members.

Public Member Functions

 DataManager (GlobalParserDatabase &globalDatabase)
void addAttribute (int idTag, const QString &attributeName, QString attributeValue)
 Adds attribute data to the buffers.
void addTag (const Tag &tag)
 Adds tag data to the buffers.
void addText (const QString &text, bool separate=false)
 Adds text to the buffer.
void cancelCurrentFile (bool toError=false)
 Changes the status of the current file.
int currentOffset () const
 Returns the offset of the text.
void flushDocument (bool validateSource=false)
 Sends the current document data to the database.
int generateTagId ()
void startDocument (int sourceId)
 Initializes the buffers for a new document.
int tagNameId (const QString &tagName)
void validateSource (bool rollbackOnError=false)
 Validates the current source file status.

Public Attributes

QString _attributesBuffer
int _docId
QString _docTitle
GlobalParserDatabase_globalDatabase
int _sourceId
int _tagCount
QString _tagsBuffer
QString _text

Detailed Description

Manages the data buffers and interface for the parser.

This class is used by the parser and should only call local or thread-safe functions.


Constructor & Destructor Documentation

DataManager::DataManager ( GlobalParserDatabase globalDatabase  ) 

Member Function Documentation

void DataManager::addAttribute ( int  idTag,
const QString &  attributeName,
QString  attributeValue 
)

Adds attribute data to the buffers.

void DataManager::addTag ( const Tag tag  ) 

Adds tag data to the buffers.

void DataManager::addText ( const QString &  text,
bool  separate = false 
)

Adds text to the buffer.

Parameters:
separate Insert a space if text is going to concatenate two words together
void DataManager::cancelCurrentFile ( bool  toError = false  ) 

Changes the status of the current file.

Exceptions:
DatabaseException If a connection error occurs
Parameters:
toError Set the file to error status instead of waiting status
int DataManager::currentOffset (  )  const

Returns the offset of the text.

void DataManager::flushDocument ( bool  validateSource = false  ) 

Sends the current document data to the database.

Parameters:
validateSource If set, update the file status to 'parsed'.
Exceptions:
DatabaseException If a connection error occurs
int DataManager::generateTagId (  ) 
void DataManager::startDocument ( int  sourceId  ) 

Initializes the buffers for a new document.

Exceptions:
DatabaseException If a connection error occurs
int DataManager::tagNameId ( const QString &  tagName  ) 
Exceptions:
DatabaseException If a connection error occurs
void DataManager::validateSource ( bool  rollbackOnError = false  ) 

Validates the current source file status.

Parameters:
rollbackOnError Will exec a rollback query if an error occurs.
Exceptions:
DatabaseException If a connection error occurs

Member Data Documentation

All Classes Functions Variables Typedefs Enumerations Enumerator