Hydra 0.20
hydra::Engine Class Reference

#include <Engine.h>

List of all members.

Public Types

enum  {
  Add_New = 10, Add_Exists, Add_NewPath, Add_UpdatedPath,
  Add_Error, Load_OK = 100, Load_ErrorNeedsUpdate, Load_ErrorNotFound,
  Load_ErrorFatal, Load_ErrorFileMissing
}

Public Member Functions

 Engine (void)
 constructor
 ~Engine ()
 destructor
int addFile (const QString &fullfilename, const QString *precalchash=0)
bool erasePath (const QString &fullfilename)
bool eraseHash (const QString &hash)
int getFileItem (const QString &fullfilename, hydra::FileItemRecord *item, hydra::FileHashRecord *hash, hydra::FilePathRecord *path)
int getFileItem (const QString &fullfilename, hydra::FileItemRecord &rec)
int getFileItemByHash (const QString &hashkey, hydra::FileItemRecord *item, hydra::FileHashRecord *hash)
int regetFileItem (hydra::FileItemRecord &rec)
bool saveFileItem (hydra::FileItemRecord &rec, const QDateTime &newmodtime)
hydra::DBfilePathDB (void)
hydra::DBfileHashDB (void)
hydra::DBfileItemDB (void)

Static Public Member Functions

static Engineinstance (void)
static QString homeDir (void)
static QString dbDir (void)
static char codeToChar (int code)
static bool statFile (const QString &fullfilename, double &modtime, qint64 &filesize)

Detailed Description

The main processing engine for hydra applications. It is a singleton class that should be instatiated by your main or similar function.

Author:
Aleksander Demko

Member Function Documentation

int hydra::Engine::addFile ( const QString &  fullfilename,
const QString *  precalchash = 0 
)

Adds a file to the db. This will also repair/update any outof date records. If precalchash is provided, then it is assumed to be the hash of the given file.

Author:
Aleksander Demko
static char hydra::Engine::codeToChar ( int  code) [static]

This converts any of the errors codes into a ascii char that may be suitable for status output.

Author:
Aleksander Demko
static QString hydra::Engine::dbDir ( void  ) [static]

Returns the directory where the database files are stored. (This is usually ~/.hydradb)

This will also create it, if necesary.

Author:
Aleksander Demko
bool hydra::Engine::eraseHash ( const QString &  hash)

Erase the given hash from the database. Note, that this will UNTIE the hash from its current item record, effectivly forgetting its tags, etc. Upon rediscovery, the hash will get a new item record. Returns true on success (which for now, is always)

Author:
Aleksander Demko
bool hydra::Engine::erasePath ( const QString &  fullfilename)

Erase the given path from the database. Returns true on success (which for now, is always)

Author:
Aleksander Demko
int hydra::Engine::getFileItem ( const QString &  fullfilename,
hydra::FileItemRecord item,
hydra::FileHashRecord hash,
hydra::FilePathRecord path 
)

Loads the given file from the DB Any of the pointers may be null.

Returns:
a Load_* error code
Author:
Aleksander Demko
int hydra::Engine::getFileItem ( const QString &  fullfilename,
hydra::FileItemRecord rec 
)

Loads the given file from the DB

This is a shorter version of the above.

Returns:
a Load_* error code
Author:
Aleksander Demko
int hydra::Engine::getFileItemByHash ( const QString &  hashkey,
hydra::FileItemRecord item,
hydra::FileHashRecord hash 
)

Loads the given file from the DB, by hash

Returns:
a Load_* error code
Author:
Aleksander Demko
static QString hydra::Engine::homeDir ( void  ) [static]

Gets the path to the user's home directory, or "." if not found.

Author:
Aleksander Demko
static Engine* hydra::Engine::instance ( void  ) [inline, static]

Returns the static instance, if any

Author:
Aleksander Demko
int hydra::Engine::regetFileItem ( hydra::FileItemRecord rec)

Reloads the given file item from db. The fileitem must have previously been loaded from the db (ie. its id field must be valid).

Returns the same codes as getFileItem()

Author:
Aleksander Demko
bool hydra::Engine::saveFileItem ( hydra::FileItemRecord rec,
const QDateTime &  newmodtime 
)

Saves the given item to the db.

Parameters:
recthe record to save
newmodtimethe modification time to use. If this isValid, rec.modtime will be set to this before saving
Returns:
true on success
Author:
Aleksander Demko
static bool hydra::Engine::statFile ( const QString &  fullfilename,
double &  modtime,
qint64 &  filesize 
) [static]

gets the mod time and file size of the given file returns true on success


The documentation for this class was generated from the following file:
 All Classes Namespaces Functions Variables