par1repairersourcefile.h

Go to the documentation of this file.
00001 // This file is part of par2cmdline (a PAR 2.0 compatible file verification and
00002 // repair tool). See https://parchive.sourceforge.net for details of PAR 2.0.
00003 //
00004 // Copyright (c) 2003 Peter Brian Clements
00005 //
00006 // par2cmdline is free software; you can redistribute it and/or modify
00007 // it under the terms of the GNU General Public License as published by
00008 // the Free Software Foundation; either version 2 of the License, or
00009 // (at your option) any later version.
00010 //
00011 // par2cmdline is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00014 // GNU General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU General Public License
00017 // along with this program; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
00019 
00020 #ifndef __PAR1REPAIRERSOURCEFILE_H__
00021 #define __PAR1REPAIRERSOURCEFILE_H__
00022 
00023 // The Par1RepairerSourceFile object is used during verification and repair
00024 // to record details about a particular source file and the data blocks
00025 // for that file.
00026 
00027 class Par1RepairerSourceFile
00028 {
00029 public:
00030   // Construct the object and set the description and verification packets
00031   Par1RepairerSourceFile(PAR1FILEENTRY *fileentry, string searchpath);
00032   ~Par1RepairerSourceFile(void);
00033 
00034   string FileName(void) const {return filename;}
00035   u64 FileSize(void) const {return filesize;}
00036   const MD5Hash& HashFull(void) const {return hashfull;}
00037   const MD5Hash& Hash16k(void) const {return hash16k;}
00038 
00039   // Set/Get which DiskFile will contain the final repaired version of the file
00040   void SetTargetFile(DiskFile *diskfile);
00041   DiskFile* GetTargetFile(void) const;
00042 
00043   // Set/Get whether or not the target file actually exists
00044   void SetTargetExists(bool exists);
00045   bool GetTargetExists(void) const;
00046 
00047   // Set/Get which DiskFile contains a full undamaged version of the source file
00048   void SetCompleteFile(DiskFile *diskfile);
00049   DiskFile* GetCompleteFile(void) const;
00050 
00051   void SetTargetBlock(DiskFile *diskfile);
00052 
00053   DataBlock* SourceBlock(void) {return &sourceblock;}
00054   DataBlock* TargetBlock(void) {return &targetblock;}
00055 
00056 
00057 protected:
00058   string       filename;
00059   u64          filesize;
00060   MD5Hash      hashfull;
00061   MD5Hash      hash16k;
00062 
00063   DataBlock    sourceblock;
00064   DataBlock    targetblock;
00065 
00066   bool         targetexists;        // Whether the target file exists
00067   DiskFile    *targetfile;          // The final version of the file
00068   DiskFile    *completefile;        // A complete version of the file
00069 
00070 
00071 };
00072 
00073 
00074 #endif // __PAR1REPAIRERSOURCEFILE_H__

Generated on Sun Oct 12 01:45:30 2008 for NNTPGrab by  1.5.4