Permalink
Browse files

Don't store file names separately

  • Loading branch information...
1 parent cffef28 commit 099353b7824c081afa028a9adefca93007baf33d @lalinsky lalinsky committed Feb 7, 2011
Showing with 2 additions and 7 deletions.
  1. +1 −1 run-tests.sh
  2. +1 −5 src/store/ram_directory.cpp
  3. +0 −1 src/store/ram_directory.h
View
@@ -1,4 +1,4 @@
#!/bin/sh
-make && ./tests --gtest_filter="*$1*"
+make && ./tests --gtest_print_time --gtest_filter="*$1*"
@@ -32,22 +32,19 @@ void RAMDirectory::close()
QStringList RAMDirectory::listFiles()
{
- return m_names;
+ return m_data.keys();
}
void RAMDirectory::deleteFile(const QString &name)
{
if (!m_data.contains(name)) {
return;
}
- m_names.removeAll(name);
delete m_data.take(name);
}
void RAMDirectory::renameFile(const QString &oldName, const QString &newName)
{
- m_names.removeAll(oldName);
- m_names.append(newName);
m_data.insert(newName, m_data.take(oldName));
}
@@ -64,7 +61,6 @@ OutputStream *RAMDirectory::createFile(const QString &name)
{
QByteArray *data = new QByteArray();
m_data.insert(name, data);
- m_names.append(name);
return new RAMOutputStream(data);
}
@@ -42,7 +42,6 @@ class RAMDirectory : public Directory
QStringList listFiles();
private:
- QStringList m_names;
QHash<QString, QByteArray*> m_data;
};

0 comments on commit 099353b

Please sign in to comment.