![]() |
TerraLib 4.1
|
00001 /************************************************************************************ 00002 TerraLib - a library for developing GIS applications. 00003 Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio. 00004 00005 This code is part of the TerraLib library. 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Lesser General Public 00008 License as published by the Free Software Foundation; either 00009 version 2.1 of the License, or (at your option) any later version. 00010 00011 You should have received a copy of the GNU Lesser General Public 00012 License along with this library. 00013 00014 The authors reassure the license terms regarding the warranties. 00015 They specifically disclaim any warranties, including, but not limited to, 00016 the implied warranties of merchantability and fitness for a particular purpose. 00017 The library provided hereunder is on an "as is" basis, and the authors have no 00018 obligation to provide maintenance, support, updates, enhancements, or modifications. 00019 In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct, 00020 indirect, special, incidental, or consequential damages arising out of the use 00021 of this library and its documentation. 00022 *************************************************************************************/ 00026 #ifndef __TERRALIB_INTERNAL_ASCIIFILE_H 00027 #define __TERRALIB_INTERNAL_ASCIIFILE_H 00028 00029 #include "TeDefines.h" 00030 #include "TeStdFile.h" 00031 #include "TeCoord2D.h" 00032 #include "TeBox.h" 00033 00034 #include <stdio.h> 00035 00036 #include <vector> 00037 #include <string> 00038 using namespace std; 00039 00041 00047 class TL_DLL TeAsciiFile: public TeStdFile { 00048 00049 public: 00050 00052 TeAsciiFile(const string& name, const char* mode = "r"); 00053 00055 virtual ~TeAsciiFile(); 00056 00058 void writeNewLine () 00059 { fprintf ( file_, "\n" ); } 00060 00062 void findNewLine () ; 00063 00065 string readString(); 00066 00068 string readLine(); 00069 00071 void writeString (const string& s); 00072 00074 string readQuotedString(); 00075 00077 string readStringCSV( const char sep = ',', bool skip = false, 00078 const char skip_char = ' '); 00079 00081 char readQuotedChar(); 00082 00084 char readChar(); 00085 00087 string readStringCSVNoSpace( const char del = ','); 00088 00090 string readStringCSVNoQuote ( const char del = ',' ); 00091 00093 int readInt(); 00094 00096 int readIntCSV( const char del = ','); 00097 00099 double readFloat(); 00100 00102 double readFloatCSV( const char del = ','); 00103 00105 TeCoord2D readCoord2D(); 00106 00108 void readStringList ( vector<string>& ); 00109 00111 void readStringListCSV ( vector<string>&, const char sep = ','); 00112 00114 void readNStringCSV ( vector<string>&, unsigned int n, const char sep = ','); 00115 00117 TeBox readBox(); 00118 00120 string readAll(); 00121 00128 bool writeCoordPairVect2CSV( const TeCoordPairVect& coordsVec ); 00129 00135 bool readCoordPairVect2CSV( TeCoordPairVect& coordsVec ); 00136 00137 00139 00143 double readAngle(const std::string &value); 00144 00146 00148 std::string readFont(); 00149 00150 private: 00151 00152 // No copy allowed 00153 00154 TeAsciiFile(const TeAsciiFile&); 00155 TeAsciiFile& operator=(const TeAsciiFile&); 00156 00157 }; 00158 #endif 00159 00160