00001 /* Copyright 2009 Andreas Gölzer 00002 00003 This file is part of readESM. 00004 00005 readESM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 00006 00007 readESM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 00008 00009 You should have received a copy of the GNU General Public License along with readESM. If not, see <http://www.gnu.org/licenses/>. */ 00010 #ifndef ESMFILEHEAD_H 00011 #define ESMFILEHEAD_H 00012 #include <string> 00013 #include "slurpedfile.h" 00014 #ifndef HAVE_NO_CRYPTO 00015 #include "crypto.h" 00016 #endif 00017 #include "time.h" 00018 00019 00020 class esmfilehead{ 00021 public: 00022 slurpedfile content; 00023 string title; 00024 Time first; 00025 Time last; 00026 #ifndef HAVE_NO_CRYPTO 00027 shared_ptr<verifiedcert> CAcert; 00028 shared_ptr<verifiedcert> devicecert; 00029 #endif 00030 void reportDate(const Time& torep){ 00031 if(torep < first) first = torep; 00032 if(torep > last) last = torep; 00033 } 00034 int daycount; 00035 int drivenkm; 00036 int drivenminutes; 00037 void reportDayStatistics(Time day, int daydrivenkm, int daydrivenminutes){ 00038 reportDate(day); 00039 ++daycount; 00040 drivenkm += daydrivenkm; 00041 drivenminutes += daydrivenminutes; 00042 } 00043 esmfilehead(const string& filename) : 00044 content(slurp(filename)), 00045 first(0x7fFfFfFf), 00046 last(0), 00047 daycount(0),drivenkm(0),drivenminutes(0) 00048 {} 00049 }; 00050 00051 00052 #endif