#include <ExCFile2.h>
Public Methods | |
| ExCFile2 () | |
| ~ExCFile2 () | |
| tFileInfo | LoadFile (std::string FileName) |
| tFileInfo | GetFileInfo (void) |
| float | GetElementFloatAt (int position) |
| std::string | GetElementStringAt (int position) |
| int | GetElementIntAt (int position) |
Private Attributes | |
| std::vector< std::string > | m_VecElement |
| std::vector< std::string >::iterator | m_ItVecElement |
| tFileInfo | m_Info |
|
|
Definition at line 27 of file ExCFile2.cpp.
00028 {
00029
00030 }
|
|
|
Definition at line 32 of file ExCFile2.cpp.
00033 {
00034 }
|
|
|
Definition at line 91 of file ExCFile2.cpp. References GetElementFloatAt(), Guard, and m_VecElement. Referenced by GetElementFloatAt().
00092 {
00093 Guard(float ExCFile2::GetElementFloatAt(int position))
00094 try
00095 {
00096 return atof(m_VecElement.at(position).data());
00097 }catch(...)
00098 {
00099 return 0;
00100 }
00101 UnGuard
00102 }
|
|
|
Definition at line 117 of file ExCFile2.cpp. References GetElementIntAt(), Guard, and m_VecElement. Referenced by GetElementIntAt().
00118 {
00119 Guard(int ExCFile2::GetElementIntAt(int position))
00120 try
00121 {
00122 return atoi(m_VecElement.at(position).data());
00123 }catch(...)
00124 {
00125 return 0;
00126 }
00127 UnGuard
00128 } |
|
|
Definition at line 104 of file ExCFile2.cpp. References GetElementStringAt(), Guard, and m_VecElement. Referenced by GetElementStringAt().
00105 {
00106 Guard(std::string ExCFile2::GetElementStringAt(int position))
00107 try
00108 {
00109 return m_VecElement.at(position);
00110 }catch(...)
00111 {
00112 return "NULL";
00113 }
00114 UnGuard
00115 }
|
|
|
Definition at line 56 of file ExCFile2.h.
00056 {return m_Info;}
|
|
|
Definition at line 36 of file ExCFile2.cpp. References tFileInfo::m_FileName, tFileInfo::m_FileType, m_Info, tFileInfo::m_NumberElement, and m_VecElement.
00037 {
00038 char ch;
00039 int RetVal;
00040 FILE *MyFile;
00041 std::string StBuffer;
00042
00043 m_Info.m_NumberElement=0;
00044 m_Info.m_FileName=FileName;
00045 MyFile=fopen (FileName.data(),"r");
00046 if(!MyFile)
00047 {
00048 m_Info.m_NumberElement=-1;
00049 return m_Info;
00050 }
00051
00052 //-------------------------------
00053 //Reading file type
00054 //-------------------------------
00055 fseek(MyFile,0,SEEK_SET);
00056 do
00057 {
00058 RetVal=fread(&ch,sizeof(char),1,MyFile);
00059 }while(ch!='#');
00060 do
00061 {
00062 RetVal=fread(&ch,sizeof(char),1,MyFile);
00063 StBuffer=StBuffer+ch;
00064 }while(ch!='#');
00065 StBuffer.erase(StBuffer.end()-1,StBuffer.end());
00066 m_Info.m_FileType=StBuffer;
00067 //-------------------------------
00068 //Reading data
00069 //-------------------------------
00070 while(!feof(MyFile))
00071 {
00072 StBuffer.erase(StBuffer.begin(),StBuffer.end());
00073 do
00074 {
00075 RetVal=fread(&ch,sizeof(char),1,MyFile);
00076 if(ch!='\n')StBuffer=StBuffer+ch;
00077 }while(ch!='#');
00078 StBuffer.erase(StBuffer.end()-1,StBuffer.end());
00079 m_VecElement.push_back(StBuffer);
00080 m_Info.m_NumberElement++;
00081 }
00082 fclose(MyFile);
00083
00084 std::cout<<"File Name :"<<m_Info.m_FileName<<std::endl;
00085 std::cout<<"File Type :"<<m_Info.m_FileType<<std::endl;
00086 std::cout<<"Numb elem :"<<m_Info.m_NumberElement<<std::endl;
00087
00088 return m_Info;
00089 }
|
|
|
Definition at line 44 of file ExCFile2.h. Referenced by LoadFile(). |
|
|
Definition at line 43 of file ExCFile2.h. |
|
|
Definition at line 42 of file ExCFile2.h. Referenced by GetElementFloatAt(), GetElementIntAt(), GetElementStringAt(), and LoadFile(). |
1.3-rc1