diff options
Diffstat (limited to 'src/modules/StorageBackendFile/StorageBackendFile.cpp')
-rw-r--r-- | src/modules/StorageBackendFile/StorageBackendFile.cpp | 32 |
1 files changed, 16 insertions, 16 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) |