DumontEXE 0.0.1
cmcObjects.h
00001 /* ***************************************************************************
00002 **
00003 ** Copyright (C) 2007 Lorimark Solutions, LLC. All rights reserved.
00004 **
00005 ** This file is part of the DumontEXE Scripting Extension Kit
00006 **
00007 ** This file may be used under the terms of the GNU General Public
00008 ** License version 2.0 as published by the Free Software Foundation
00009 ** and appearing in the file LICENSE.GPL included in the packaging of
00010 ** this file.  Please review the following information to ensure GNU
00011 ** General Public Licensing requirements will be met:
00012 ** http://dumont.showoff-db.org/opensource.html
00013 **
00014 ** If you are unsure which license is appropriate for your use, please
00015 ** review the following information:
00016 ** http://dumont.showoff-db.org/licensing.html 
00017 ** or contact the sales department at sales@lorimarksolutions.com.
00018 **
00019 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00020 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00021 **
00022 ** author: Mark Petryk ~ Lorimark Solutions, LLC
00023 ** **************************************************************************/
00024 
00025 #ifndef CDA_OBJECTS_H_422FD07F_0597_4cbb_A034_9AE85166472E
00026 #define CDA_OBJECTS_H_422FD07F_0597_4cbb_A034_9AE85166472E
00027 
00028 #include <QStringList>
00029 
00030 #include "cmcObject.h"
00031 
00032 namespace cmcDatabaseApi {
00033 
00034 class cmcApplication;
00035 
00036 /*!
00037 ** \brief Collection Manager
00038 **
00039 **
00040 */
00041 class cmcObjects:
00042   public cmcObject
00043 {
00044   Q_OBJECT
00045   public:
00046 
00047     cmcObjects( const cmcObjects & copy );
00048 
00049     /*!
00050     ** \brief Basic Constructor
00051     **
00052     */
00053     cmcObjects( cmcObject * parent = NULL );
00054 
00055     /*!
00056     ** \brief Application Constructor
00057     **
00058     */
00059     cmcObjects( const QString & objectName, cmcApplication * application, cmcObject * parent );
00060 
00061     /*
00062     ** \brief Default Destructor
00063     **
00064     */
00065     virtual ~cmcObjects();
00066 
00067   public slots:
00068 
00069     /*!
00070     ** \brief Number of items in the collection
00071     **
00072     */
00073     virtual long count(void);
00074 
00075     /*!
00076     ** \brief Add an item to the collection
00077     **
00078     */
00079     virtual long add( cmcObject * object );
00080 
00081     /*!
00082     ** \brief Remove an item from the collection
00083     **
00084     */
00085     virtual long remove( cmcObject * object );
00086 
00087     /*!
00088     ** \brief String List of all children
00089     **
00090     */
00091     virtual QStringList list( void );
00092 
00093     /*!
00094     ** \brief Check children for a named item
00095     **
00096     */
00097     virtual bool contains( const QString & name );
00098 
00099     /*!
00100     ** \brief Return the index of an item
00101     **
00102     */
00103     virtual long indexOf( const QString & name );
00104 
00105     /*!
00106     ** \brief 
00107     **
00108     */
00109     virtual long first() {return(0);}
00110 
00111     virtual long last() {return(count()-1);}
00112 
00113     /*!
00114     ** \brief Get an item by index number
00115     **
00116     */
00117     cmcObject * get( const long index );
00118 
00119     /*!
00120     ** \brief Get an item by item name
00121     **
00122     */
00123     cmcObject * get( const QString & name );
00124 
00125     /*!
00126     ** \brief Signal when an object is destroyed.
00127     **
00128     ** This is an internal function for use by the cmcDatabaseApi
00129     **
00130     ** In the cmcDatabaseApi framework, when an object is destroyed,
00131     **  by any process or function, that object emits a signal that indicates
00132     **  the destruction of itself.  If the object is part of one or more collections
00133     **  (like this one) a signal is sent here, to this function.  This
00134     **  function takes care of removing the reference to that object from 
00135     **  this collection.
00136     **
00137     */
00138     void on_objectDestroyed( QObject * object );
00139 
00140   signals:
00141 
00142     /*!
00143     ** \brief Inticate when an object has been added
00144     **
00145     ** This is an internal function for use by the cmcDatabaseApi
00146     **
00147     ** When objects are added to this collection, a signal is emitted with a reference
00148     **  to the object.  Interested clients can receive this signal and respond to changes
00149     **  in the collection.
00150     **
00151     */
00152     void objectAdded( cmcObject * object );
00153 
00154     /*!
00155     ** \brief Indicate when an object has been removed
00156     **
00157     ** This is an internal function for use by the cmcDatabaseApi
00158     **
00159     ** When objects are removed from this collection, a signal is emitted with a reference
00160     **  to the object.  Interested clients can receive this signal and respond to changes
00161     **  in the collection.
00162     **
00163     */
00164     void objectRemoved( cmcObject * object );
00165 
00166   protected:
00167 
00168     virtual bool load() { TRACE_FUNCTION return(false); }
00169 
00170     virtual cmcObject * load( const QString & name ) { TRACE_FUNCTION return(NULL); }
00171 
00172     virtual bool save() { TRACE_FUNCTION return(false); }
00173 
00174     QStringList m_names;
00175 
00176   private:
00177 
00178     /*!
00179     ** \brief the object collection
00180     **
00181     */
00182     QList<cmcObject*> m_objects;
00183 
00184 }; // endclass cmcObjects:
00185 
00186 
00187 } // endnamespace cmcDatabaseApi
00188 
00189 #endif // #ifndef CDA_OBJECTS_H
00190 
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties




~ ~ ~ ~ ~ ~
Source Code without Comments is like a Cranberry Garland
without the berries. Comment your Code!
 
Commence Database User Support Group Forum
http://newsgroup.showoff-db.org/
~ ~ ~ ~ ~ ~
Author: Mark Petryk
Lorimark Solutions, LLC
mark@lorimarksolutions.com