summaryrefslogtreecommitdiffstats
path: root/src/modules/StorageBackendFile
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/StorageBackendFile')
-rw-r--r--src/modules/StorageBackendFile/StorageBackendFile.cpp32
-rw-r--r--src/modules/StorageBackendFile/StorageBackendFile.h18
2 files changed, 25 insertions, 25 deletions
diff --git a/src/modules/StorageBackendFile/StorageBackendFile.cpp b/src/modules/StorageBackendFile/StorageBackendFile.cpp
index aae7e03..0affc2c 100644
--- a/src/modules/StorageBackendFile/StorageBackendFile.cpp
+++ b/src/modules/StorageBackendFile/StorageBackendFile.cpp
@@ -62,29 +62,29 @@ void StorageBackendFile::configFinished() {
configured = true;
}
-boost::filesystem::path StorageBackendFile::getFileName(const std::string &type, const std::string &name) {
+boost::filesystem::path StorageBackendFile::getFileName(const Core::String &type, const Core::String &name) {
boost::filesystem::path path(storageRoot);
- path /= type;
- path /= (name + ".xml");
+ path /= type.extract();
+ path /= Core::String(name + ".xml").extract();
return path;
}
-std::set<std::string> StorageBackendFile::listTypes() throw (Core::Exception) {
+std::set<Core::String> StorageBackendFile::listTypes() throw (Core::Exception) {
boost::shared_lock<boost::shared_mutex> lock(mutex);
if(!configured)
throw Core::Exception(Core::Exception::NOT_AVAILABLE);
- std::set<std::string> ret;
+ std::set<Core::String> ret;
try {
for(boost::filesystem::directory_iterator it(storageRoot); it != boost::filesystem::directory_iterator(); ++it) {
boost::filesystem::path path = *it;
if(boost::filesystem::is_directory(path))
- ret.insert(path.filename());
+ ret.insert(path.filename().c_str());
}
}
catch(...) {} // Don't throw if we can't iterate over the dirs
@@ -92,23 +92,23 @@ std::set<std::string> StorageBackendFile::listTypes() throw (Core::Exception) {
return ret;
}
-std::set<std::string> StorageBackendFile::list(const std::string &type) throw (Core::Exception) {
+std::set<Core::String> StorageBackendFile::list(const Core::String &type) throw (Core::Exception) {
boost::shared_lock<boost::shared_mutex> lock(mutex);
if(!configured)
throw Core::Exception(Core::Exception::NOT_AVAILABLE);
- std::set<std::string> ret;
+ std::set<Core::String> ret;
boost::filesystem::path path(storageRoot);
- path /= type;
+ path /= type.extract();
try {
for(boost::filesystem::directory_iterator it(path); it != boost::filesystem::directory_iterator(); ++it) {
boost::filesystem::path filePath = *it;
if(boost::filesystem::is_regular_file(filePath) && filePath.extension() == ".xml")
- ret.insert(filePath.replace_extension().filename());
+ ret.insert(filePath.replace_extension().filename().c_str());
}
}
catch(...) {} // Don't throw if we can't iterate over the dirs
@@ -117,7 +117,7 @@ std::set<std::string> StorageBackendFile::list(const std::string &type) throw (C
}
-bool StorageBackendFile::exists(const std::string &type, const std::string &name) throw (Core::Exception) {
+bool StorageBackendFile::exists(const Core::String &type, const Core::String &name) throw (Core::Exception) {
boost::shared_lock<boost::shared_mutex> lock(mutex);
if(!configured)
@@ -128,7 +128,7 @@ bool StorageBackendFile::exists(const std::string &type, const std::string &name
return boost::filesystem::is_regular_file(path);
}
-void StorageBackendFile::store(const std::string &type, const std::string &name, const Common::XmlData *data) throw (Core::Exception) {
+void StorageBackendFile::store(const Core::String &type, const Core::String &name, const Common::XmlData *data) throw (Core::Exception) {
boost::lock_guard<boost::shared_mutex> lock(mutex);
if(!configured)
@@ -140,7 +140,7 @@ void StorageBackendFile::store(const std::string &type, const std::string &name,
data->toFile(path.file_string());
}
-boost::shared_ptr<Common::XmlData> StorageBackendFile::load(const std::string &type, const std::string &name) throw (Core::Exception) {
+boost::shared_ptr<Common::XmlData> StorageBackendFile::load(const Core::String &type, const Core::String &name) throw (Core::Exception) {
boost::shared_lock<boost::shared_mutex> lock(mutex);
if(!configured)
@@ -153,7 +153,7 @@ boost::shared_ptr<Common::XmlData> StorageBackendFile::load(const std::string &t
return boost::shared_ptr<Common::XmlData>(new Common::XmlData(path.file_string()));
}
-void StorageBackendFile::copy(const std::string &type, const std::string &name, const std::string &newName) throw (Core::Exception) {
+void StorageBackendFile::copy(const Core::String &type, const Core::String &name, const Core::String &newName) throw (Core::Exception) {
boost::lock_guard<boost::shared_mutex> lock(mutex);
if(!configured)
@@ -164,7 +164,7 @@ void StorageBackendFile::copy(const std::string &type, const std::string &name,
boost::filesystem::copy_file(path, newPath);
}
-void StorageBackendFile::rename(const std::string &type, const std::string &name, const std::string &newName) throw (Core::Exception) {
+void StorageBackendFile::rename(const Core::String &type, const Core::String &name, const Core::String &newName) throw (Core::Exception) {
boost::lock_guard<boost::shared_mutex> lock(mutex);
if(!configured)
@@ -175,7 +175,7 @@ void StorageBackendFile::rename(const std::string &type, const std::string &name
boost::filesystem::rename(path, newPath);
}
-void StorageBackendFile::remove(const std::string &type, const std::string &name) throw (Core::Exception) {
+void StorageBackendFile::remove(const Core::String &type, const Core::String &name) throw (Core::Exception) {
boost::lock_guard<boost::shared_mutex> lock(mutex);
if(!configured)
diff --git a/src/modules/StorageBackendFile/StorageBackendFile.h b/src/modules/StorageBackendFile/StorageBackendFile.h
index 9994500..f38e674 100644
--- a/src/modules/StorageBackendFile/StorageBackendFile.h
+++ b/src/modules/StorageBackendFile/StorageBackendFile.h
@@ -42,23 +42,23 @@ class StorageBackendFile : public Common::StorageBackend, private Core::Configur
boost::shared_mutex mutex;
- boost::filesystem::path getFileName(const std::string &type, const std::string &name);
+ boost::filesystem::path getFileName(const Core::String &type, const Core::String &name);
protected:
virtual bool handleConfigEntry(const Core::ConfigEntry &entry, bool handled);
virtual void configFinished();
- virtual std::set<std::string> listTypes() throw (Core::Exception);
- virtual std::set<std::string> list(const std::string &type) throw (Core::Exception);
+ virtual std::set<Core::String> listTypes() throw (Core::Exception);
+ virtual std::set<Core::String> list(const Core::String &type) throw (Core::Exception);
- virtual bool exists(const std::string &type, const std::string &name) throw (Core::Exception);
+ virtual bool exists(const Core::String &type, const Core::String &name) throw (Core::Exception);
- virtual void store(const std::string &type, const std::string &name, const Common::XmlData *data) throw (Core::Exception);
- virtual boost::shared_ptr<Common::XmlData> load(const std::string &type, const std::string &name) throw (Core::Exception);
+ virtual void store(const Core::String &type, const Core::String &name, const Common::XmlData *data) throw (Core::Exception);
+ virtual boost::shared_ptr<Common::XmlData> load(const Core::String &type, const Core::String &name) throw (Core::Exception);
- virtual void copy(const std::string &type, const std::string &name, const std::string &newName) throw (Core::Exception);
- virtual void rename(const std::string &type, const std::string &name, const std::string &newName) throw (Core::Exception);
- virtual void remove(const std::string &type, const std::string &name) throw (Core::Exception);
+ virtual void copy(const Core::String &type, const Core::String &name, const Core::String &newName) throw (Core::Exception);
+ virtual void rename(const Core::String &type, const Core::String &name, const Core::String &newName) throw (Core::Exception);
+ virtual void remove(const Core::String &type, const Core::String &name) throw (Core::Exception);
public:
StorageBackendFile(Common::Application *application0) : application(application0), configured(false) {