QGpCoreTools/File.h
Go to the documentation of this file.
00001 /***************************************************************************
00002 **
00003 **  This file is part of QGpCoreTools.
00004 **
00005 **  This library is free software; you can redistribute it and/or
00006 **  modify it under the terms of the GNU Lesser General Public
00007 **  License as published by the Free Software Foundation; either
00008 **  version 2.1 of the License, or (at your option) any later version.
00009 **
00010 **  This file is distributed in the hope that it will be useful, but WITHOUT
00011 **  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 **  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
00013 **  License for more details.
00014 **
00015 **  You should have received a copy of the GNU Lesser General Public
00016 **  License along with this library; if not, write to the Free Software
00017 **  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00018 **
00019 **  See http://www.geopsy.org for more information.
00020 **
00021 **  Created : 2004-03-10
00022 **  Authors :
00023 **    Marc Wathelet
00024 **    Marc Wathelet (ULg, Liège, Belgium)
00025 **    Marc Wathelet (LGIT, Grenoble, France)
00026 **
00027 ***************************************************************************/
00028 
00029 #ifndef FILE_H
00030 #define FILE_H
00031 
00032 #include <zlib.h>
00033 #include <QtCore>
00034 
00035 #include "QGpCoreToolsDLLExport.h"
00036 
00037 namespace QGpCoreTools {
00038 
00039 class QGPCORETOOLS_EXPORT File
00040 {
00041 public:
00042   static QStringList expand(const QStringList& fileNames);
00043   static QStringList expand(const QString& fileName);
00044   static QString uniqueName(QString fileName, const QDir& d);
00045   // Text file reading util functions
00046   static char * readAll(const char * fileName);
00047   static bool readLine(char *& buf, int& bufLen, gzFile f, bool delEOL=false);
00048   static bool readLine(char *& buf, int& bufLen, FILE * f, bool delEOL=false);
00049   static QString readLine(FILE * f, bool delEOL=false);
00050   static QString readLine(bool delEOL);
00051   static void readBreakLine(char *& buf, int& bufLen, FILE * f);
00052   static bool readCleanUp(char * buf, bool returnValue);
00053   static void readLineNoComments(char * buf, int& bufLen, FILE *  f, QString * comments);
00054   static QString readLineNoComments(QTextStream& s, QString * comments);
00055   static char * stripWhiteSpace(char * buf);
00056   static const char * stripWhiteSpace(const char * buf, int& len);
00057   static char * nextField(char *& buf, const char * sep);
00058   static void getKeyValue(const char * fileNAme, const char * varName, QString& value);
00059   // Util function for library or plugin management
00060   static QStringList getLibList(QStringList pathList);
00061   // Util for reading fixed file formats
00062   static qint32 fromBigEndian(qint32 v);
00063   static qint32 fromLittleEndian(qint32 v);
00064   static qint16 fromBigEndian(qint16 v);
00065   static qint16 fromLittleEndian(qint16 v);
00066 private:
00067   static QStringList expand(QDir d, QStringList filters, QString levelName, int level);
00068 };
00069 
00070 } // namespace QGpCoreTools
00071 
00072 #endif // FILE_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines