/***************************************************************************
xqlObject.h - description
-------------------
begin : Mon Jun 26 2000
copyright : (C) 2000 by Raoul Markus
email : raoul.markus@arcormail.de
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef main_xqlObject_h
#define main_xqlObject_h
//#include "xql.h"
#include "xqltypes.h"
#include "xqlodbc.h"
#include "xqlsession.h"
#include "xqlexception.h"
#include
#include "xqlsqlstmt.h"
#include
#include
/**
* root class for all abstract Objects.
* provides useraccess etc.
*/
class xqlObject
{
public:
xqlObject(xqlSession * pThisSession);
/** creates an object with owner admin. Needs no authentification */
xqlObject(xqlOdbc * pconnection);
virtual ~xqlObject();
virtual const char* getType () const ;
virtual bool isSame (const xqlObject& obj) const; // test for sameness
virtual bool isSaved();
virtual bool save();
// virtual bool read(xqlid pObjectId);
/**
to set the object name. this name must be unique. every object is identified by its objectname.
Setting the object name does not imply that it exists in the database.
*/
virtual bool setType(char* pType);
/**
this function creates all the nesseccary database objects to save instances of the object.
the objectname has to be set before by setObjectType()
*/
virtual bool createType();
/**
this function loads the structure information for the object "ObjectType"
from the database. The objectname has to be set before by setObjectType()
*/
virtual bool loadType(int pTypeId);
virtual bool saveType();
/**
creates a new instance of the object. an id is given, space is allocated
in the database.
*/
virtual bool createInstance();
/**
saves the current instance of the object.
*/
virtual bool saveInstance();
virtual bool deleteInstance();
/**
loads the instance given by pInstId from the database.
Attention with the objectname? is the objectname already known?
*/
virtual bool loadInstance(int pInstId);
/** Gibt die aktuelle ID des Objektes wieder */
virtual int getTypeId();
/** returns the classname of this type */
virtual char * className() const;
/** returns the table name in the variable pTableName */
void getTableName(char * pTableName);
/** returns the TypeId of a given Instance Id. */
int getTypeIdOfInstance(int pInstId);
/** returns the current instance id */
int getInstId();
/** returns the current xqlOdbc handle to the database */
xqlOdbc * getConnection();
/** No descriptions */
bool loadType(std::string& pType);
/** returns the classname for a given Typeid. */
std::string * getClassnameByTypeId(int pTypeId);
/** returns the Icon-Id for this object, XQL_DEFAULT_ICON if not set */
virtual const xqlid getIconId() const;
/** sets the icon for this object type. No check is performed. */
void setIconId(xqlid pIconId);
private:
protected:
int mInstId; // jeweilige Objekt-ID
xqlOdbc* thisOdbc;
/**
this var indicates if the instance of the object exists in database
*/
bool mIsSaved;
/**
this var indicates if the object type / structure exists in database
*/
bool mTypeCreated;
/**
this var indicates if the object is simple or has any substructure exists in database
*/
int mSimple;
char * mType;
/**
userId holds the current owner of this object
it has not to be equal to the user of the currents session!
*/
xqlUserId userId;
xqlSession * mCurrentSession;
/** the id of the given type. */
int mTypeId;
/** true, if the Type is set, i. e. that mType has a
meaningfull value. Is only manipulated by setType,
loadType.... */
bool mTypeIsSet;
xqlid mIconId;
protected:
void operator=(const xqlObject&) {
}
bool haveRight(const char * pAction);
/** loads the iconid for this type */
void loadIconId(xqlid pType);
/** saves the current IconId */
void saveIconId();
};
#endif
| Generated by: markus on hobbes on Fri Mar 29 16:15:24 2002, using kdoc 2.0a53. |