DumontEXE 0.0.1
cmcForms.cpp
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 #include "cmcForms.h"
00026 
00027 namespace cmcDatabaseApi {
00028 
00029 cmcForms::cmcForms( const cmcForms & copy ):
00030   cmcObjects( copy )
00031 {
00032 }
00033 
00034 cmcForms::cmcForms( cmcObject * parent ):
00035   cmcObjects( parent )
00036 {
00037   setObjectName("Forms");
00038 //  TRACE_FUNCTION
00039 }
00040 
00041 cmcForms::~cmcForms()
00042 {
00043 //  TRACE_FUNCTION
00044 }
00045 
00046 long cmcForms::add( cmcForm * form )
00047 {
00048   if( !get( form-> instanceID() ) )
00049     m_forms.append( form );
00050 
00051   return( m_forms.count() );
00052 }
00053 
00054 long cmcForms::count()
00055 {
00056   return( m_forms.count() );
00057 }
00058 
00059 cmcForm * cmcForms::get( long index )
00060 {
00061   if( index < m_forms.count() )
00062     return( m_forms.at(index) );
00063 
00064   return( NULL );
00065 }
00066 
00067 cmcForm * cmcForms::get( const QString & name )
00068 {
00069   /*
00070   ** Check the name we've been given to search by.  If it
00071   **  looks like a QUuid value then search first for a
00072   **  matching instance number.
00073   **
00074   */
00075   if( name.left(1)  == "{" &&
00076       name.right(1) == "}" )
00077   {
00078     for( int i=0; i<count(); i++ )
00079       if( m_forms.at(i)-> instanceID() == name )
00080         return( m_forms.at(i) );
00081   }
00082 
00083   /*
00084   ** Search for the form name by name
00085   **
00086   */
00087   for( int i=0; i<count(); i++ )
00088     if( m_forms.at(i)-> name() == name )
00089       return( m_forms.at(i) );
00090 
00091   /*
00092   ** Search for the form by alias name
00093   **
00094   */
00095   for( int i=0; i<count(); i++ )
00096     if( m_forms.at(i)-> aliasName() == name )
00097       return( m_forms.at(i) );
00098 
00099   /*
00100   ** If we couldn't find the form, the just return nothing.
00101   **
00102   */
00103   return( NULL );
00104 
00105 }
00106 
00107 } // endnamespace cmcDatabaseApi
00108 
 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