summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-02-14 18:57:18 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-02-14 21:36:32 (GMT)
commitcb05f5a908e20006c954ce38755c2e422ecc2388 (patch)
treea793551a5fe279a57d4330119560e8542f745484 /SwifTools/Application
parentcad974b45c0fb9355e68d9728e42c9ae3dbcebc7 (diff)
downloadswift-contrib-cb05f5a908e20006c954ce38755c2e422ecc2388.zip
swift-contrib-cb05f5a908e20006c954ce38755c2e422ecc2388.tar.bz2
Removed Swift::String.
Diffstat (limited to 'SwifTools/Application')
-rw-r--r--SwifTools/Application/ApplicationPathProvider.cpp10
-rw-r--r--SwifTools/Application/ApplicationPathProvider.h12
-rw-r--r--SwifTools/Application/MacOSXApplicationPathProvider.cpp4
-rw-r--r--SwifTools/Application/MacOSXApplicationPathProvider.h2
-rw-r--r--SwifTools/Application/UnitTest/ApplicationPathProviderTest.cpp5
-rw-r--r--SwifTools/Application/UnixApplicationPathProvider.cpp16
-rw-r--r--SwifTools/Application/UnixApplicationPathProvider.h2
-rw-r--r--SwifTools/Application/WindowsApplicationPathProvider.cpp2
-rw-r--r--SwifTools/Application/WindowsApplicationPathProvider.h4
9 files changed, 29 insertions, 28 deletions
diff --git a/SwifTools/Application/ApplicationPathProvider.cpp b/SwifTools/Application/ApplicationPathProvider.cpp
index 8457f88..e683563 100644
--- a/SwifTools/Application/ApplicationPathProvider.cpp
+++ b/SwifTools/Application/ApplicationPathProvider.cpp
@@ -13,14 +13,14 @@
namespace Swift {
-ApplicationPathProvider::ApplicationPathProvider(const String& applicationName) : applicationName(applicationName) {
+ApplicationPathProvider::ApplicationPathProvider(const std::string& applicationName) : applicationName(applicationName) {
}
ApplicationPathProvider::~ApplicationPathProvider() {
}
-boost::filesystem::path ApplicationPathProvider::getProfileDir(const String& profile) const {
- boost::filesystem::path result(getHomeDir() / profile.getUTF8String());
+boost::filesystem::path ApplicationPathProvider::getProfileDir(const std::string& profile) const {
+ boost::filesystem::path result(getHomeDir() / profile);
try {
boost::filesystem::create_directory(result);
}
@@ -30,10 +30,10 @@ boost::filesystem::path ApplicationPathProvider::getProfileDir(const String& pro
return result;
}
-boost::filesystem::path ApplicationPathProvider::getResourcePath(const String& resource) const {
+boost::filesystem::path ApplicationPathProvider::getResourcePath(const std::string& resource) const {
std::vector<boost::filesystem::path> resourcePaths = getResourceDirs();
foreach(const boost::filesystem::path& resourcePath, resourcePaths) {
- boost::filesystem::path r(resourcePath / resource.getUTF8String());
+ boost::filesystem::path r(resourcePath / resource);
if (boost::filesystem::exists(r)) {
return r;
}
diff --git a/SwifTools/Application/ApplicationPathProvider.h b/SwifTools/Application/ApplicationPathProvider.h
index 722f1ad..48a9602 100644
--- a/SwifTools/Application/ApplicationPathProvider.h
+++ b/SwifTools/Application/ApplicationPathProvider.h
@@ -9,27 +9,27 @@
#include <boost/filesystem.hpp>
#include <vector>
-#include "Swiften/Base/String.h"
+#include <string>
namespace Swift {
class ApplicationPathProvider {
public:
- ApplicationPathProvider(const String& applicationName);
+ ApplicationPathProvider(const std::string& applicationName);
virtual ~ApplicationPathProvider();
virtual boost::filesystem::path getHomeDir() const = 0;
virtual boost::filesystem::path getDataDir() const = 0;
virtual boost::filesystem::path getExecutableDir() const;
- boost::filesystem::path getProfileDir(const String& profile) const;
- boost::filesystem::path getResourcePath(const String& resource) const;
+ boost::filesystem::path getProfileDir(const std::string& profile) const;
+ boost::filesystem::path getResourcePath(const std::string& resource) const;
protected:
virtual std::vector<boost::filesystem::path> getResourceDirs() const = 0;
- const String& getApplicationName() const {
+ const std::string& getApplicationName() const {
return applicationName;
}
private:
- String applicationName;
+ std::string applicationName;
};
}
diff --git a/SwifTools/Application/MacOSXApplicationPathProvider.cpp b/SwifTools/Application/MacOSXApplicationPathProvider.cpp
index fb6523c..0ed4d40 100644
--- a/SwifTools/Application/MacOSXApplicationPathProvider.cpp
+++ b/SwifTools/Application/MacOSXApplicationPathProvider.cpp
@@ -13,13 +13,13 @@
namespace Swift {
-MacOSXApplicationPathProvider::MacOSXApplicationPathProvider(const String& name) : ApplicationPathProvider(name) {
+MacOSXApplicationPathProvider::MacOSXApplicationPathProvider(const std::string& name) : ApplicationPathProvider(name) {
resourceDirs.push_back(getExecutableDir() / "../Resources");
resourceDirs.push_back(getExecutableDir() / "../resources"); // Development
}
boost::filesystem::path MacOSXApplicationPathProvider::getDataDir() const {
- boost::filesystem::path result(getHomeDir() / "Library/Application Support" / getApplicationName().getUTF8String());
+ boost::filesystem::path result(getHomeDir() / "Library/Application Support" / getApplicationName());
try {
boost::filesystem::create_directory(result);
}
diff --git a/SwifTools/Application/MacOSXApplicationPathProvider.h b/SwifTools/Application/MacOSXApplicationPathProvider.h
index d2613f8..fec1944 100644
--- a/SwifTools/Application/MacOSXApplicationPathProvider.h
+++ b/SwifTools/Application/MacOSXApplicationPathProvider.h
@@ -11,7 +11,7 @@
namespace Swift {
class MacOSXApplicationPathProvider : public ApplicationPathProvider {
public:
- MacOSXApplicationPathProvider(const String& name);
+ MacOSXApplicationPathProvider(const std::string& name);
virtual boost::filesystem::path getHomeDir() const;
boost::filesystem::path getDataDir() const;
diff --git a/SwifTools/Application/UnitTest/ApplicationPathProviderTest.cpp b/SwifTools/Application/UnitTest/ApplicationPathProviderTest.cpp
index cd171cb..a418bc2 100644
--- a/SwifTools/Application/UnitTest/ApplicationPathProviderTest.cpp
+++ b/SwifTools/Application/UnitTest/ApplicationPathProviderTest.cpp
@@ -6,9 +6,10 @@
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
+#include <string>
+#include <boost/algorithm/string.hpp>
#include "SwifTools/Application/PlatformApplicationPathProvider.h"
-#include "Swiften/Base/String.h"
using namespace Swift;
@@ -39,7 +40,7 @@ class ApplicationPathProviderTest : public CppUnit::TestFixture {
void testGetExecutableDir() {
boost::filesystem::path dir = testling_->getExecutableDir();
CPPUNIT_ASSERT(boost::filesystem::is_directory(dir));
- CPPUNIT_ASSERT(String(dir.string()).endsWith("UnitTest"));
+ CPPUNIT_ASSERT(boost::ends_with(dir.string(), "UnitTest"));
}
private:
diff --git a/SwifTools/Application/UnixApplicationPathProvider.cpp b/SwifTools/Application/UnixApplicationPathProvider.cpp
index 06fa977..2ac39ab 100644
--- a/SwifTools/Application/UnixApplicationPathProvider.cpp
+++ b/SwifTools/Application/UnixApplicationPathProvider.cpp
@@ -8,14 +8,14 @@
namespace Swift {
-UnixApplicationPathProvider::UnixApplicationPathProvider(const String& name) : ApplicationPathProvider(name) {
+UnixApplicationPathProvider::UnixApplicationPathProvider(const std::string& name) : ApplicationPathProvider(name) {
resourceDirs.push_back(getExecutableDir() / "../resources"); // Development
char* xdgDataDirs = getenv("XDG_DATA_DIRS");
if (xdgDataDirs) {
- std::vector<String> dataDirs = String(xdgDataDirs).split(':');
+ std::vector<std::string> dataDirs = std::string(xdgDataDirs).split(':');
if (!dataDirs.empty()) {
- foreach(const String& dir, dataDirs) {
- resourceDirs.push_back(boost::filesystem::path(dir.getUTF8String()) / "swift");
+ foreach(const std::string& dir, dataDirs) {
+ resourceDirs.push_back(boost::filesystem::path(dir) / "swift");
}
return;
}
@@ -31,14 +31,14 @@ boost::filesystem::path UnixApplicationPathProvider::getHomeDir() const {
boost::filesystem::path UnixApplicationPathProvider::getDataDir() const {
char* xdgDataHome = getenv("XDG_DATA_HOME");
- String dataDir;
+ std::string dataDir;
if (xdgDataHome) {
- dataDir = String(xdgDataHome);
+ dataDir = std::string(xdgDataHome);
}
- boost::filesystem::path dataPath = (dataDir.isEmpty() ?
+ boost::filesystem::path dataPath = (dataDir.empty() ?
getHomeDir() / ".local" / "share"
- : boost::filesystem::path(dataDir.getUTF8String())) / getApplicationName().getLowerCase().getUTF8String();
+ : boost::filesystem::path(dataDir)) / getApplicationName().getLowerCase();
try {
boost::filesystem::create_directories(dataPath);
diff --git a/SwifTools/Application/UnixApplicationPathProvider.h b/SwifTools/Application/UnixApplicationPathProvider.h
index 0c2f643..e043976 100644
--- a/SwifTools/Application/UnixApplicationPathProvider.h
+++ b/SwifTools/Application/UnixApplicationPathProvider.h
@@ -17,7 +17,7 @@
namespace Swift {
class UnixApplicationPathProvider : public ApplicationPathProvider {
public:
- UnixApplicationPathProvider(const String& name);
+ UnixApplicationPathProvider(const std::string& name);
virtual boost::filesystem::path getHomeDir() const;
boost::filesystem::path getDataDir() const;
diff --git a/SwifTools/Application/WindowsApplicationPathProvider.cpp b/SwifTools/Application/WindowsApplicationPathProvider.cpp
index e19606f..d645b90 100644
--- a/SwifTools/Application/WindowsApplicationPathProvider.cpp
+++ b/SwifTools/Application/WindowsApplicationPathProvider.cpp
@@ -12,7 +12,7 @@
namespace Swift {
-WindowsApplicationPathProvider::WindowsApplicationPathProvider(const String& name) : ApplicationPathProvider(name) {
+WindowsApplicationPathProvider::WindowsApplicationPathProvider(const std::string& name) : ApplicationPathProvider(name) {
resourceDirs.push_back(getExecutableDir());
resourceDirs.push_back(getExecutableDir() / "../resources"); // Development
}
diff --git a/SwifTools/Application/WindowsApplicationPathProvider.h b/SwifTools/Application/WindowsApplicationPathProvider.h
index 26f7045..9428908 100644
--- a/SwifTools/Application/WindowsApplicationPathProvider.h
+++ b/SwifTools/Application/WindowsApplicationPathProvider.h
@@ -11,11 +11,11 @@
namespace Swift {
class WindowsApplicationPathProvider : public ApplicationPathProvider {
public:
- WindowsApplicationPathProvider(const String& name);
+ WindowsApplicationPathProvider(const std::string& name);
boost::filesystem::path getDataDir() const {
char* appDirRaw = getenv("APPDATA");
- boost::filesystem::path result(boost::filesystem::path(appDirRaw) / getApplicationName().getUTF8String());
+ boost::filesystem::path result(boost::filesystem::path(appDirRaw) / getApplicationName());
boost::filesystem::create_directory(result);
return result;
}