DumontEXE 0.0.1
cmcFieldDef.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 <QStringList>
00026 
00027 #include "cmcConversation.h"
00028 #include "cmcCategoryDef.h"
00029 #include "cmcCategoryDefs.h"
00030 #include "cmcFieldDef.h"
00031 #include "cmcFieldDefs.h"
00032 
00033 namespace cmcDatabaseApi {
00034 
00035 
00036 cmcFieldDef::cmcFieldDef( const cmcFieldDef & copy ):
00037   cmcObject( copy )
00038 {
00039 }
00040 
00041 cmcFieldDef::cmcFieldDef( const QString & fieldName, cmcApplication * application, cmcFieldDefs * parent ):
00042   cmcObject( fieldName, application, parent )
00043 {
00044 //  TRACE_FUNCTION
00045 }
00046 
00047 
00048 cmcFieldDef::~cmcFieldDef()
00049 {
00050 //  TRACE_FUNCTION
00051 }
00052 
00053 cmcFieldDefs * cmcFieldDef::fieldDefs()
00054 {
00055   return( qobject_cast<cmcFieldDefs*>(parent()) );
00056 }
00057 
00058 cmcCategoryDef * cmcFieldDef::categoryDef()
00059 {
00060   return( fieldDefs()-> categoryDef() );
00061 }
00062 
00063 QString cmcFieldDef::categoryName()
00064 {
00065   return( categoryDef()-> categoryName() );
00066 }
00067 
00068 QString cmcFieldDef::fieldName()
00069 {
00070   return( name() );
00071 }
00072 
00073 
00074 QStringList cmcFieldDef::stringList()
00075 {
00076   if(     m_stringList.count() == 0 )
00077           m_stringList = cv()-> getFieldDefinition( categoryName(), fieldName() ).split("\r\n");
00078   return( m_stringList );
00079 }
00080 
00081 QString cmcFieldDef::string()
00082 {
00083   return( stringList().join("\r\n") );
00084 }
00085 
00086 long cmcFieldDef::typeCode()
00087 {
00088   return( stringList()[0].mid(0,2).toLong() );
00089 }
00090 
00091 QString cmcFieldDef::typeName()
00092 {
00093   QString retVal;
00094   switch( typeCode() )
00095   {
00096     case ft_text           : retVal = "Text";       break;
00097     case ft_number         : retVal = "Number";     break;
00098     case ft_date           : retVal = "Date";       break;
00099     case ft_telephone      : retVal = "Telephone";  break;
00100     case ft_checkBox       : retVal = "Check Box";  break;
00101     case ft_name           : retVal = "Name";       break;
00102     case ft_dataFile       : retVal = "Data File";  break;
00103     case ft_image          : retVal = "Image";      break;
00104     case ft_time           : retVal = "Time";       break;
00105     case ft_excelCell      : retVal = "Excel Cell"; break;
00106     case ft_calculation    : retVal = "Calc";       break;
00107     case ft_sequence       : retVal = "Sequence";   break;
00108     case ft_selection      : retVal = "Selection";  break;
00109     case ft_eMailAddress   : retVal = "E-Mail";     break;
00110     case ft_internetAddress: retVal = "Internet";   break;
00111   }
00112 
00113   return( retVal );
00114 }
00115 
00116 bool cmcFieldDef::isShared(void)
00117 {
00118   if( stringList()[1].mid(7,1) == "1" )
00119     return(true);
00120   return(false);
00121 }
00122 
00123 bool cmcFieldDef::isMandatory(void)
00124 {
00125   if( stringList()[1].mid(8,1) == "1" )
00126     return(true);
00127   return(false);
00128 }
00129 
00130 bool cmcFieldDef::isRecurring(void)
00131 {
00132   if( stringList()[1].mid(9,1) == "1" )
00133     return(true);
00134   return(false);
00135 }
00136 
00137 bool cmcFieldDef::isSelection(void)
00138 {
00139   if( stringList()[1].mid(6,1) == "1" )
00140     return(true);
00141   return(false);
00142 }
00143 
00144 long cmcFieldDef::maxChars(void)
00145 {
00146   return( stringList()[2].toLong() );
00147 }
00148 
00149 QString cmcFieldDef::defaultString(void)
00150 {
00151   QString retVal = stringList()[3];
00152 
00153   for( int i=4; i<stringList().count(); i++ )
00154     retVal += "\n" + stringList()[i];
00155 
00156   return( retVal );
00157 }
00158 
00159 } // endnamespace Commence
00160 
 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