54 #include <wx/filename.h>
56 #include <wx/wxcrtvararg.h>
57 #include <wx/wfstream.h>
58 #include <wx/zipstrm.h>
59 #include <wx/txtstrm.h>
61 #include <wx/version.h>
73 #define m_pStream_Base ((wxStreamBase *)m_pStream)
74 #define m_pStream_I ((wxFFileInputStream *)m_pStream)
75 #define m_pStream_O ((wxFFileOutputStream *)m_pStream)
76 #define m_pStream_IO ((wxFFileStream *)m_pStream)
96 Open(FileName, Mode, bBinary, Encoding);
128 m_pStream =
new wxFFileOutputStream(FileName.
c_str(), bBinary ?
"wb" :
"w");
132 m_pStream =
new wxFFileInputStream (FileName.
c_str(), bBinary ?
"rb" :
"r");
137 ? (bBinary ?
"r+b" :
"r+")
138 : (bBinary ?
"w+b" :
"w+")
281 wxString _Format(Format); _Format.Replace(
"%s",
"%ls");
282 va_list argptr; va_start(argptr, _Format);
283 int Result = String.PrintfV(_Format, argptr);
285 va_list argptr; va_start(argptr, Format);
286 int Result = String.PrintfV(Format, argptr);
306 wxString _Format(Format); _Format.Replace(
"%s",
"%ls");
307 va_list argptr; va_start(argptr, _Format);
308 int Result = String.PrintfV(_Format, argptr);
310 va_list argptr; va_start(argptr, Format);
311 int Result = String.PrintfV(Format, argptr);
326 :
m_pStream_IO->Read(Buffer, Size * Count).LastRead() / Size
366 wxString _Buffer(Buffer.
w_str());
368 const wxScopedCharBuffer s(_Buffer.mb_str(*((wxMBConv *)
m_pConvert)));
370 return(
Write((
void *)s.data(),
sizeof(
char), s.length()) );
403 wxTextInputStream Stream(*
m_pStream_I ,
" \t" ); s = Stream.ReadLine();
407 wxTextInputStream Stream(*
m_pStream_IO,
" \t" ); s = Stream.ReadLine();
427 if(
Read(&Value,
sizeof(Value)) == 1 )
445 return(
Write(&Value,
sizeof(Value)) ==
sizeof(Value) );
453 if(
Read(&Value,
sizeof(Value)) == 1 )
471 return(
Write(&Value,
sizeof(Value)) ==
sizeof(Value) );
481 if( isdigit(c) || strchr(
"-+", c) )
490 return( s.
asInt(Value) );
503 if( isdigit(c) || strchr(
"-+.,eE", c) )
507 while( !
is_EOF() && (isdigit(c =
Read_Char()) || strchr(
".,eE", c) || strchr(
"", c)) )
525 int c;
while( !
is_EOF() && (c =
Read_Char()) != Separator && c != EOF )
539 int Value;
return(
Scan(Value) ? Value : 0 );
544 double Value;
return(
Scan(Value) ? Value : 0.0 );
570 Open(FileName, Mode, Encoding);
592 m_pStream =
new wxZipOutputStream(
new wxFileOutputStream(FileName.
c_str()));
596 m_pStream =
new wxZipInputStream (
new wxFileInputStream (FileName.
c_str()));
610 while( (pEntry = ((wxZipInputStream *)
m_pStream)->GetNextEntry()) != NULL )
624 delete((wxZipEntry *)
m_Files[i]);
643 wxZipEntry *pEntry =
new wxZipEntry(Name.
c_str());
645 pEntry->SetIsText(bBinary ==
false);
647 #if wxCHECK_VERSION(3, 1, 1)
648 ((wxZipOutputStream *)
m_pStream)->SetFormat(wxZIP_FORMAT_ZIP64);
651 if( ((wxZipOutputStream *)
m_pStream)->PutNextEntry(pEntry) )
667 return( ((wxZipEntry *)
m_Files[Index])->IsDir() );
678 if( ((wxZipInputStream *)
m_pStream)->OpenEntry(*(wxZipEntry *)
m_Files[Index]) )
696 if( !((wxZipEntry *)
m_Files[i])->GetName().Cmp(Name.
c_str()) )
713 wxString Name(((wxZipEntry *)
m_Files[Index])->GetName()); s = &Name;
729 return( wxFileName::DirExists(Directory.
c_str()) );
740 return( wxFileName::Mkdir(Directory.
c_str(), wxS_DIR_DEFAULT, bFullPath ? wxPATH_MKDIR_FULL : 0) );
751 return( wxDir::Remove(Directory.
c_str(), bRecursive ? wxPATH_RMDIR_RECURSIVE : 0) );
757 wxString cwd = wxFileName::GetCwd();
765 wxString fname = wxFileName::GetTempDir();
777 if( Dir.Open(Directory.
c_str()) )
781 if( Dir.GetFirst(&FileName, wxEmptyString, wxDIR_DIRS) )
787 while( Dir.GetNext(&FileName) );
806 if( Dir.Open(Directory.
c_str()) )
810 if( Dir.GetFirst(&FileName, wxEmptyString, wxDIR_FILES) )
819 while( Dir.GetNext(&FileName) );
836 return( wxFileExists(FileName.
c_str()) );
855 return(
CSG_String(wxFileName::CreateTempFileName(Prefix.
c_str()).wc_str()) );
864 wxFileName fn(full_Path.
c_str());
868 wxString s(fn.GetFullName());
return(
CSG_String(&s) );
871 wxString s(fn.GetName());
return( &s );
877 wxString s(wxFileName(full_Path.
c_str()).GetPath(wxPATH_GET_VOLUME|wxPATH_GET_SEPARATOR));
885 wxFileName fn(full_Path.
c_str());
889 wxString s(fn.GetFullPath());
return( &s );
895 wxFileName fn(full_Path.
c_str());
897 fn.MakeRelativeTo(Directory.
c_str());
899 wxString s(fn.GetFullPath());
return( &s );
917 fn.SetExt (Extension.
c_str());
924 wxString s(fn.GetFullPath());
return( &s );
936 if( FileName.
Length() > 0 )
938 wxFileName fn(FileName.
c_str());
940 fn.SetExt(Extension.
c_str());
942 wxString s(fn.GetFullPath());
955 wxFileName fn(FileName.
c_str());
957 wxString s(fn.GetExt());
return( &s );
972 return( wxGetEnv(Variable.
w_str(), NULL) );
977 if( wxGetEnv(Variable.
w_str(), &s) )
990 return( wxSetEnv(Variable.
w_str(), Value.
w_str()) );