Changeset 16 for trunk/tmdmcreator/src/tmdmcopier.cpp
- Timestamp:
- 02/21/13 16:20:42 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tmdmcreator/src/tmdmcopier.cpp
r15 r16 2 2 tmdmcopier.cpp 3 3 ------------------- 4 copyright : (C) 2013 CREALP Lucien Schreiber 4 copyright : (C) 2013 CREALP Lucien Schreiber 5 5 email : lucien.schreiber at crealp dot vs dot ch 6 6 ***************************************************************************/ … … 18 18 19 19 TmDmCopier::TmDmCopier(const wxFileName & destfile) { 20 m_File = new wxFFile(); 21 bool bOpen = m_File->Open(destfile.GetFullPath(), "a"); 22 wxASSERT(bOpen == true); 20 23 } 21 24 25 26 22 27 TmDmCopier::~TmDmCopier() { 28 wxDELETE(m_File); 23 29 } 24 30 25 void TmDmCopier::SetCopyMode(TMDMCOPIER_MODE value) { 26 m_CopyMode = value; 31 32 33 bool TmDmCopier::CopyFrom(const wxFileName & filename) { 34 wxFFile mySrcFile; 35 if (mySrcFile.Open(filename.GetFullPath()) == false) { 36 m_Errors.Add(wxString::Format(_("Unable to open: %s"), filename.GetFullPath())); 37 return false; 38 } 39 40 wxString mySrcTxt; 41 if(mySrcFile.ReadAll(&mySrcTxt)==false){ 42 m_Errors.Add(wxString::Format(_("Reading from: %s failed!"), filename.GetFullPath())); 43 return false; 44 } 45 return CopyFrom(mySrcTxt); 27 46 } 28 47 29 bool TmDmCopier::CopyFrom(const wxFileName & filename) { 48 49 50 bool TmDmCopier::CopyFrom(const wxString & text) { 51 if (m_File->Write(text) == false) { 52 m_Errors.Add(wxString::Format(_("Writing to: %s failed!"), m_File->GetName())); 53 return false; 54 } 55 56 return true; 30 57 } 31 58 32 bool TmDmCopier::CopyFrom(const wxString & text) { 59 60 61 wxArrayString TmDmCopier::GetErrors(){ 62 return m_Errors; 33 63 } 34 35 bool TmDmCopier::IsCopyAllowed() {36 }37
Note: See TracChangeset
for help on using the changeset viewer.