Classified ads
Signals | Public Member Functions | Private Member Functions | Private Attributes | List of all members
TclModel Class Reference

Datamodel-part of storage related to TCL-programs. More...

#include <tclmodel.h>

Inheritance diagram for TclModel:
Inheritance graph
[legend]
Collaboration diagram for TclModel:
Collaboration graph
[legend]

Signals

void error (MController::CAErrorSituation aError, const QString &aExplanation)
 

Public Member Functions

 TclModel (MController *aMController, const MModelProtocolInterface &aModel)
 
 ~TclModel ()
 
Hash locallyStoreTclProgram (const TclProgram &aProgram, const Hash &aPreviousFingerPrint=KNullHash)
 
TclProgram tclProgramByFingerPrint (const Hash &aFingerPrint)
 
bool discardTclProgram (const Hash &aFingerPrint)
 
QMap< QString, HashgetListOfTclPrograms ()
 
QString storeTCLProgLocalData (const Hash &aProgram, const QByteArray &aData)
 
QByteArray retrieveTCLProgLocalData (const Hash &aProgram)
 

Private Member Functions

void installExamplePrograms ()
 

Private Attributes

MControlleriController
 
const MModelProtocolInterfaceiModel
 

Detailed Description

Datamodel-part of storage related to TCL-programs.

This class provides with storage of TCL-scripts themselves, possible settings related to TCL-scripts. See class TclProgram.

Constructor & Destructor Documentation

◆ TclModel()

TclModel::TclModel ( MController aMController,
const MModelProtocolInterface aModel 
)

◆ ~TclModel()

TclModel::~TclModel ( )

Member Function Documentation

◆ discardTclProgram()

bool TclModel::discardTclProgram ( const Hash aFingerPrint)

method for removing tcl script from local storage

Returns
true if program was deleted

◆ error

void TclModel::error ( MController::CAErrorSituation  aError,
const QString &  aExplanation 
)
signal

◆ getListOfTclPrograms()

QMap<QString, Hash> TclModel::getListOfTclPrograms ( )

method for getting list of tcl programs in local storage

Returns
Listing as qmap where key is the program name, and value is fingerprint of the program

◆ installExamplePrograms()

void TclModel::installExamplePrograms ( )
private

Method that scans directory /usr/share/doc/classified-ads/examples for files ending *.tcl and installs them into database table of tcl programs. This is done only if db table is empty, as it is during first install.

◆ locallyStoreTclProgram()

Hash TclModel::locallyStoreTclProgram ( const TclProgram aProgram,
const Hash aPreviousFingerPrint = KNullHash 
)

Method for putting tcl program into local storage. Method performs insert or update. Logick is this: if there is program in db with aPreviousFingerPrint then update is performed. In this case previous fingerprint won't be valid any more. Otherwise insert is done and method returns fingerprint of the program stored.

Parameters
aProgramis the program to store.
aPreviousFingerPrintif persisting program from UI, fingerprint of the program
Returns
fingerprint of program saved.

◆ retrieveTCLProgLocalData()

QByteArray TclModel::retrieveTCLProgLocalData ( const Hash aProgram)

Method for retrieving local data of a tcl program

Parameters
aProgramidentifies the program
Returns
data or empty

◆ storeTCLProgLocalData()

QString TclModel::storeTCLProgLocalData ( const Hash aProgram,
const QByteArray &  aData 
)

TCL programs may store data locally, key to the data is hash of the tcl program itself and the data is a byte-array. Previous contents are overwritten.

Parameters
aProgramidentifies the program
aDatais databytes
Returns
empty string on success

◆ tclProgramByFingerPrint()

TclProgram TclModel::tclProgramByFingerPrint ( const Hash aFingerPrint)

method for getting tcl progrom from local storage

Member Data Documentation

◆ iController

MController& TclModel::iController
private

◆ iModel

const MModelProtocolInterface& TclModel::iModel
private

The documentation for this class was generated from the following file: