Wolfgang Ortmann 9 år sedan
förälder
incheckning
873fc8ce0e
3 ändrade filer med 609 tillägg och 554 borttagningar
  1. 32 0
      src/Image.cpp
  2. 29 0
      src/Image.h
  3. 548 554
      src/kind.cpp

+ 32 - 0
src/Image.cpp

@@ -0,0 +1,32 @@
+#include "Exception.h"
+#include "Strings.h"
+#include "FileName.h"
+#include "expiretools.h"
+#include "filetools.h"
+
+#include "Image.h"
+
+using namespace std;
+
+Image::Image(const string& dir): name(dir)
+{
+  FileName fn(dir);
+  string dummy;
+  stringToDate(fn.getName(), time, dummy);
+  string expireFileName = name + "/expires";
+  valid = !fileExists(name + "/error") &&
+          fileExists(expireFileName) &&
+          dirExists(name + "/tree");
+
+  //  cout << boolalpha << dir << " " << image.valid << endl;
+
+  if (valid)
+    {
+      Strings ex;
+      file2Strings(expireFileName, ex);
+      if (ex.empty())
+        throw Exception("expireDate", "expire empty");
+      stringToDate(ex[0], expire, series);
+      expireRule = ex[1];
+    }
+}

+ 29 - 0
src/Image.h

@@ -0,0 +1,29 @@
+#ifndef KIND_IMAGE_H
+#define KIND_IMAGE_H
+
+#include <string>
+#include <vector>
+
+#include "DateTime.h"
+#include "expiretools.h"
+
+class Image
+{
+public:
+  Image(const std::string& dir);
+
+  std::string name;
+  DateTime time;
+  std::string series;
+  bool valid;
+  DateTime expire;
+  std::string expireRule;
+  friend bool operator<(const Image& i1, const Image& i2)
+  {
+    return i1.time < i2.time;
+  }
+};
+
+typedef std::vector<Image> Images;
+
+#endif

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 548 - 554
src/kind.cpp


Vissa filer visades inte eftersom för många filer har ändrats