QXRD  0.11.16
qcepimagedataformat.cpp
Go to the documentation of this file.
1 #include "qcepimagedataformat.h"
3 #include <QFileInfo>
4 #include <QDir>
5 
6 void QcepImageDataFormatBase::mkPath(QString filePath)
7 {
8  QFileInfo f(filePath);
9  QDir dir = f.dir();
10 
11  if (!dir.exists()) {
12  dir.mkpath(dir.absolutePath());
13  }
14 }
15 
17 {
18  QFileInfo f(name);
19 
20  if (f.exists()) {
21  QDir dir = f.dir();
22  QString base = f.baseName();
23  QString suff = f.completeSuffix();
24 
25  int width = 5;
26 
27  for (int i=1; ; i++) {
28  QString newname = dir.filePath(base+QString().sprintf("-%0*d.",width,i)+suff);
29  QFileInfo f(newname);
30 
31  if (!f.exists()) {
32  return newname;
33  }
34  }
35  } else {
36  return name;
37  }
38 }
39 
40 template <typename T>
42  : QcepImageDataFormatBase(fmtname)
43 {
44 // printf("QcepImageDataFormatFactory<T>::factory()->insert(%s)\n", qPrintable(name()));
45 //
47 }
48 
50 template class QcepImageDataFormat<short>;
52 template class QcepImageDataFormat<int>;
53 template class QcepImageDataFormat<double>;
QString uniqueFileName(QString name)
static QcepImageDataFormatFactory< T > * factory()
void mkPath(QString filePath)
QcepImageDataFormat(QString fmtname)