浏览代码

Small changes

Kandrashin Denis 13 年之前
父节点
当前提交
d2e96131ac
共有 2 个文件被更改,包括 12 次插入2 次删除
  1. 10 1
      source/fb2temp.cpp
  2. 2 1
      source/fb2temp.hpp

+ 10 - 1
source/fb2temp.cpp

@@ -48,7 +48,7 @@ Fb2TemporaryFile & Fb2TemporaryList::get(const QString &name)
     return *file;
 }
 
-void Fb2TemporaryList::set(QString name, QByteArray data)
+void Fb2TemporaryList::set(const QString &name, const QByteArray &data)
 {
     get(name).write(data);
 }
@@ -83,3 +83,12 @@ QString Fb2TemporaryList::data(const QString &name) const
     return QString();
 }
 
+bool Fb2TemporaryList::exists(const QString &name)
+{
+    Fb2TemporaryIterator it(*this);
+    while (it.hasNext()) {
+        Fb2TemporaryFile *file = it.next();
+        if (file->name() == name) return true;
+    }
+    return false;
+}

+ 2 - 1
source/fb2temp.hpp

@@ -25,8 +25,9 @@ public:
     explicit Fb2TemporaryList();
     virtual ~Fb2TemporaryList();
 
+    bool exists(const QString &name);
     Fb2TemporaryFile & get(const QString &name);
-    void set(QString name, QByteArray data);
+    void set(const QString &name, const QByteArray &data);
 
     QString hash(const QString &path) const;
     QString name(const QString &hash) const;