TekFile.cpp

00001 /***************************************************************************
00002  *   Copyright (C) 2005 by Kevin McBride                                   *
00003  *   kevin@planetsaphire.com                                               *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU Library General Public License as       *
00007  *   published by the Free Software Foundation; either version 2 of the    *
00008  *   License, or (at your option) any later version.                       *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU Library General Public     *
00016  *   License along with this program; if not, write to the                 *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 
00021 
00022 #define     LIBTEKLTI_EXPORT  (0)
00023 /*#define   TEKFILE_INTERNAL  (0)
00024 #define     TEKSTD_INTERNAL   (0)*/
00025 
00026 
00027 #ifndef     _cplusplus
00028 #define     _cplusplus
00029 #endif      /* _cplusplus */
00030 #include "teklti.h"
00031 
00032 #ifdef      NULL
00033 #undef      NULL
00034 #endif      /* NULL */
00035 
00036 #define     NULL  0
00037 
00038 
00039 TEKERR TekFileCreate(TekFileType FileType, TekFile ** RetVal, uchar_t * FileName)
00040 {
00041       TekFileBinary * NewValBin;
00042 #ifdef      TEKLTI_USE_BZIP2
00043       TekFileBZ2 * NewValBZ2;
00044 #endif      /* TEKLTI_USE_BZIP2 */
00045       TekFile * NewVal;
00046       void * tmpvar;
00047 
00048 #ifndef     NO_SIZE_T_CHECKS
00049       if ( RetVal == NULL )
00050             return TEKERR_POINTER;
00051 #endif      /* NO_SIZE_T_CHECKS */
00052 
00053       switch ( FileType )
00054       {
00055             case TekFileType_Binary:
00056                   /* Make a new instance. */
00057                   NewVal = new TekFileBinary;
00058                   /* Check to see if we have to call put_Filename. */
00059                   if ( FileName != NULL )
00060                         NewVal->put_Filename(FileName);
00061 
00062                   /* Set TekFile. */
00063                   *RetVal = (TekFile *)NewVal;
00064                   /* Return to caller. */
00065                   return TEKERR_OK;
00066             case TekFileType_BinaryPipe:
00067                   /* Make a new instance. */
00068                   NewValBin = new TekFileBinary;
00069                   /* Change flag to Binary_Pipe. */
00070                   NewValBin->ConvertToPipe();
00071 
00072                   /* Set the RetVal. */
00073                   *RetVal = (TekFile *)NewValBin;
00074                   /* Return to caller. */
00075                   return TEKERR_OK;
00076             case TekFileType_ASCII:
00077                   /* Make a new instance. */
00078                   NewVal = new TekFileASCIIBare;
00079                   /* Check to see if we have to call put_Filename. */
00080                   if ( FileName != NULL )
00081                         NewVal->put_Filename(FileName);
00082 
00083                   /* Set TekFile. */
00084                   *RetVal = (TekFile *)NewVal;
00085                   /* Return to caller. */
00086                   return TEKERR_OK;
00087             case TekFileType_BZIP2:
00088 #ifdef      TEKLTI_USE_BZIP2
00089                   /* Make a new instance. */
00090                   NewVal = new TekFileBZ2Binary;
00091                   /* Check to see if we have to call put_Filename. */
00092                   if ( FileName != NULL )
00093                         NewVal->put_Filename(FileName);
00094 
00095                   /* Set TekFile. */
00096                   *RetVal = NewVal;
00097                   /* Return to caller. */
00098                   return TEKERR_OK;
00099 #endif      /*TEKLTI_USE_BZIP2 */
00100             case TekFileType_BZIP2_ASCII:
00101 #ifdef      TEKLTI_USE_BZIP2
00102                   /* Make a new instance. */
00103                   NewValBZ2 = new TekFileBZ2ASCII;
00104 
00105                   /* Check to see if we have to call put_Filename. */
00106                   if ( FileName != NULL )
00107                         NewValBZ2->put_Filename(FileName);
00108 
00109                   /* Set TekFile. */
00110                   tmpvar = (void *)NewValBZ2;
00111                   *RetVal = (TekFile *)tmpvar;
00112 
00113                   /* Return to caller. */
00114                   return TEKERR_OK;
00115 #else /* not TEKLTI_USE_BZIP2 */
00116                   return TEKERR_NOTIMPL;
00117 #endif      /* not TEKLTI_USE_BZIP2 */
00118             case TekFileType_ConfigASCII:
00119             case TekFileType_UNICODE:
00120             case TekFileType_ConfigUNICODE:
00121             case TekFileType_ASCIIPipe:
00122             case TekFileType_UnicodePipe:
00123             default:
00124                   return TEKERR_UNAVAILABLE;
00125       }
00126 }
00127 
00128 
00129 MKTEKUUID(UTekFile, "af7d74d2-db02-11d9-9782-000bdbc434d9")
00130 MKTEKDEBUGSTRING(DBTekFile, "TekFile")
00131 
00132 /* TEKSTD_IMPLEMENT_INTERFACE(UTekFile) */
00133 
00137 TekFile::TekFile()
00138 {
00139       ;
00140 }
00141 
00145 TekFile::~TekFile()
00146 {
00147       ;
00148 }
00149 
00150 
00151 
00152 #if   NULL != 0
00153 //TEKSTD_SOURCE_FUNC(TekFile);
00154 //TEKSTD_SOURCE_FUNC_CALLFUNC(TekFile);
00155 
00156 
00162 TEKERR TekFile::get_FILE(FILE ** FileDescriptor)
00163 {
00164       return TEKERR_NOTIMPL;
00165 }
00166 
00167 
00173 TEKERR TekFile::get_Filename(uchar_t ** Name)
00174 {
00175       return TEKERR_NOTIMPL;
00176 }
00177 
00178 
00189 TEKERR TekFile::put_FILE(FILE * FileDescriptor)
00190 {
00191       return TEKERR_NOTIMPL;
00192 }
00193 
00194 
00200 TEKERR TekFile::put_Filename(uchar_t * Name)
00201 {
00202       return TEKERR_NOTIMPL;
00203 }
00204 
00205 
00211 TEKERR TekFile::get_Type(TekFileType * FileTypePointer)
00212 {
00213       return TEKERR_NOTIMPL;
00214 }
00215 
00216 
00222 TEKERR TekFile::Close()
00223 {
00224       return TEKERR_NOTIMPL;
00225 }
00226 
00227 
00233 TEKERR TekFile::get_Mode(TekFileMode * ModeID)
00234 {
00235       return TEKERR_NOTIMPL;
00236 }
00237 
00238 
00244 TEKERR TekFile::Flush()
00245 {
00246       return TEKERR_NOTIMPL;
00247 }
00248 
00249 
00255 TEKERR TekFile::Open()
00256 {
00257       return TEKERR_NOTIMPL;
00258 }
00259 
00260 
00266 TEKERR TekFile::Open64()
00267 {
00268       return TEKERR_NOTIMPL;
00269 }
00270 
00271 
00277 TEKERR TekFile::put_Mode(TekFileMode ModeID)
00278 {
00279       return TEKERR_NOTIMPL;
00280 }
00281 
00282 
00288 TEKERR TekFile::Read64(void * Buffer, uint64_t BytesToRead, uint64_t * BytesRead)
00289 {
00290       return TEKERR_NOTIMPL;
00291 }
00292 
00293 
00299 TEKERR TekFile::Read(void * Buffer, unsigned long BytesToRead, unsigned long * BytesRead)
00300 {
00301       return TEKERR_NOTIMPL;
00302 }
00303 
00304 
00310 TEKERR TekFile::Seek64(TekFileSeek SeekWhere, int64_t NewLocation)
00311 {
00312       return TEKERR_NOTIMPL;
00313 }
00314 
00315 
00321 TEKERR TekFile::Seek(TekFileSeek SeekWhere, signed long NewLocation)
00322 {
00323       return TEKERR_NOTIMPL;
00324 }
00325 
00326 
00332 TEKERR TekFile::Write64(void * Buffer, uint64_t BytesToWrite, uint64_t * BytesWrote)
00333 {
00334       return TEKERR_NOTIMPL;
00335 }
00336 
00337 
00343 TEKERR TekFile::Write(void * Buffer, unsigned long BytesToWrite, unsigned long * BytesWrote)
00344 {
00345       return TEKERR_NOTIMPL;
00346 }
00347 
00348 
00355 TEKERR TekFile::get_Location(unsigned long * Location)
00356 {
00357       return TEKERR_NOTIMPL;
00358 }
00359 
00360 
00367 TEKERR TekFile::get_Location64(uint64_t * Location)
00368 {
00369       return TEKERR_NOTIMPL;
00370 }
00371 
00372 #endif      /* NULL != 0 */
00373 
SourceForge.net Logo  Technical Library Template Interface Project Page