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);
134 m_pStream =
new wxFFileOutputStream(FileName.
c_str(), bBinary ?
"wb" :
"w");
138 m_pStream =
new wxFFileInputStream (FileName.
c_str(), bBinary ?
"rb" :
"r");
143 ? (bBinary ?
"r+b" :
"r+")
144 : (bBinary ?
"w+b" :
"w+")
287 wxString _Format(Format); _Format.Replace(
"%s",
"%ls");
288 va_list argptr; va_start(argptr, _Format);
289 int Result = String.PrintfV(_Format, argptr);
291 va_list argptr; va_start(argptr, Format);
292 int Result = String.PrintfV(Format, argptr);
312 wxString _Format(Format); _Format.Replace(
"%s",
"%ls");
313 va_list argptr; va_start(argptr, _Format);
314 int Result = String.PrintfV(_Format, argptr);
316 va_list argptr; va_start(argptr, Format);
317 int Result = String.PrintfV(Format, argptr);
332 :
m_pStream_IO->Read(Buffer, Size * Count).LastRead() / Size
372 wxString _Buffer(Buffer.
w_str());
374 const wxScopedCharBuffer s(_Buffer.mb_str(*((wxMBConv *)
m_pConvert)));
376 return(
Write((
void *)s.data(),
sizeof(
char), s.length()) );
409 wxTextInputStream Stream(*
m_pStream_I ,
" \t" ); s = Stream.ReadLine();
413 wxTextInputStream Stream(*
m_pStream_IO,
" \t" ); s = Stream.ReadLine();
433 if(
Read(&Value,
sizeof(Value)) == 1 )
451 return(
Write(&Value,
sizeof(Value)) ==
sizeof(Value) );
459 if(
Read(&Value,
sizeof(Value)) == 1 )
477 return(
Write(&Value,
sizeof(Value)) ==
sizeof(Value) );
487 if( isdigit(c) || strchr(
"-+", c) )
496 return( s.
asInt(Value) );
509 if( isdigit(c) || strchr(
"-+.,eE", c) )
513 while( !
is_EOF() && (isdigit(c =
Read_Char()) || strchr(
".,eE", c) || strchr(
"", c)) )
531 int c;
while( !
is_EOF() && (c =
Read_Char()) != Separator && c != EOF )
545 int Value;
return(
Scan(Value) ? Value : 0 );
550 double Value;
return(
Scan(Value) ? Value : 0.0 );
576 Open(FileName, Mode, Encoding);
608 m_pStream =
new wxZipOutputStream(
new wxFileOutputStream(FileName.
c_str()));
612 m_pStream =
new wxZipInputStream (
new wxFileInputStream (FileName.
c_str()));
626 while( (pEntry = ((wxZipInputStream *)
m_pStream)->GetNextEntry()) != NULL )
640 delete((wxZipEntry *)
m_Files[i]);
659 wxZipEntry *pEntry =
new wxZipEntry(Name.
c_str());
661 pEntry->SetIsText(bBinary ==
false);
663 #if wxCHECK_VERSION(3, 1, 1)
664 ((wxZipOutputStream *)
m_pStream)->SetFormat(wxZIP_FORMAT_ZIP64);
667 if( ((wxZipOutputStream *)
m_pStream)->PutNextEntry(pEntry) )
683 return( ((wxZipEntry *)
m_Files[Index])->IsDir() );
694 if( ((wxZipInputStream *)
m_pStream)->OpenEntry(*(wxZipEntry *)
m_Files[Index]) )
712 if( !((wxZipEntry *)
m_Files[i])->GetName().Cmp(Name.
c_str()) )
729 wxString Name(((wxZipEntry *)
m_Files[Index])->GetName()); s = &Name;
745 return( wxFileName::DirExists(Directory.
c_str()) );
756 return( wxFileName::Mkdir(Directory.
c_str(), wxS_DIR_DEFAULT, bFullPath ? wxPATH_MKDIR_FULL : 0) );
767 return( wxDir::Remove(Directory.
c_str(), bRecursive ? wxPATH_RMDIR_RECURSIVE : 0) );
773 wxString cwd = wxFileName::GetCwd();
781 wxString fname = wxFileName::GetTempDir();
793 if( Dir.Open(Directory.
c_str()) )
797 if( Dir.GetFirst(&FileName, wxEmptyString, wxDIR_DIRS) )
803 while( Dir.GetNext(&FileName) );
822 if( Dir.Open(Directory.
c_str()) )
826 if( Dir.GetFirst(&FileName, wxEmptyString, wxDIR_FILES) )
835 while( Dir.GetNext(&FileName) );
852 return( wxFileExists(FileName.
c_str()) );
871 return(
CSG_String(wxFileName::CreateTempFileName(Prefix.
c_str()).wc_str()) );
880 wxFileName fn(full_Path.
c_str());
884 wxString s(fn.GetFullName());
return(
CSG_String(&s) );
887 wxString s(fn.GetName());
return( &s );
893 wxString s(wxFileName(full_Path.
c_str()).GetPath(wxPATH_GET_VOLUME|wxPATH_GET_SEPARATOR));
901 wxFileName fn(full_Path.
c_str());
905 wxString s(fn.GetFullPath());
return( &s );
911 wxFileName fn(full_Path.
c_str());
913 fn.MakeRelativeTo(Directory.
c_str());
915 wxString s(fn.GetFullPath());
return( &s );
933 fn.SetExt (Extension.
c_str());
940 wxString s(fn.GetFullPath());
return( &s );
946 wxFileName a(wxString(Path1.
c_str())), b(wxString(Path2.
c_str()));
948 return( a.SameAs(b) );
960 if( FileName.
Length() > 0 )
962 wxFileName fn(FileName.
c_str());
964 fn.SetExt(Extension.
c_str());
966 wxString s(fn.GetFullPath());
979 wxFileName fn(FileName.
c_str());
981 wxString s(fn.GetExt());
return( &s );
996 return( wxGetEnv(Variable.
w_str(), NULL) );
1001 if( wxGetEnv(Variable.
w_str(), &s) )
1003 *Value = s.wc_str();
1014 return( wxSetEnv(Variable.
w_str(), Value.
w_str()) );