summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2016-03-31 14:57:35 (GMT)
committerTobias Markmann <tm@ayena.de>2016-03-31 14:57:35 (GMT)
commitcfbdb43d2cadd40aa87338d41548e4bf89e146e6 (patch)
tree18d94153a302445196fc0c18586abf44a1ce4a38 /SwifTools/Application
parent1d545a4a7fb877f021508094b88c1f17b30d8b4e (diff)
downloadswift-cfbdb43d2cadd40aa87338d41548e4bf89e146e6.zip
swift-cfbdb43d2cadd40aa87338d41548e4bf89e146e6.tar.bz2
Convert tabs to 4 spaces for all source files
Removed trailing spaces and whitespace on empty lines in the process. Changed CheckTabs.py tool to disallow hard tabs in source files. Test-Information: Manually checked 30 random files that the conversion worked as expected. Change-Id: I874f99d617bd3d2bb55f02d58f22f58f9b094480
Diffstat (limited to 'SwifTools/Application')
-rw-r--r--SwifTools/Application/ApplicationPathProvider.cpp34
-rw-r--r--SwifTools/Application/ApplicationPathProvider.h34
-rw-r--r--SwifTools/Application/CocoaApplication.h16
-rw-r--r--SwifTools/Application/CocoaApplication.mm14
-rw-r--r--SwifTools/Application/MacOSXApplicationPathProvider.cpp22
-rw-r--r--SwifTools/Application/MacOSXApplicationPathProvider.h22
-rw-r--r--SwifTools/Application/PlatformApplicationPathProvider.h6
-rw-r--r--SwifTools/Application/UnitTest/ApplicationPathProviderTest.cpp62
-rw-r--r--SwifTools/Application/UnixApplicationPathProvider.cpp62
-rw-r--r--SwifTools/Application/UnixApplicationPathProvider.h22
-rw-r--r--SwifTools/Application/WindowsApplicationPathProvider.cpp24
-rw-r--r--SwifTools/Application/WindowsApplicationPathProvider.h22
12 files changed, 170 insertions, 170 deletions
diff --git a/SwifTools/Application/ApplicationPathProvider.cpp b/SwifTools/Application/ApplicationPathProvider.cpp
index ebe9654..3a86f28 100644
--- a/SwifTools/Application/ApplicationPathProvider.cpp
+++ b/SwifTools/Application/ApplicationPathProvider.cpp
@@ -22,29 +22,29 @@ ApplicationPathProvider::~ApplicationPathProvider() {
}
boost::filesystem::path ApplicationPathProvider::getProfileDir(const std::string& profile) const {
- boost::filesystem::path result(getHomeDir() / profile);
- try {
- boost::filesystem::create_directory(result);
- }
- catch (const boost::filesystem::filesystem_error& e) {
- std::cerr << "ERROR: " << e.what() << std::endl;
- }
- return result;
+ boost::filesystem::path result(getHomeDir() / profile);
+ try {
+ boost::filesystem::create_directory(result);
+ }
+ catch (const boost::filesystem::filesystem_error& e) {
+ std::cerr << "ERROR: " << e.what() << std::endl;
+ }
+ return result;
}
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);
- if (boost::filesystem::exists(r)) {
- return r;
- }
- }
- return boost::filesystem::path();
+ std::vector<boost::filesystem::path> resourcePaths = getResourceDirs();
+ foreach(const boost::filesystem::path& resourcePath, resourcePaths) {
+ boost::filesystem::path r(resourcePath / resource);
+ if (boost::filesystem::exists(r)) {
+ return r;
+ }
+ }
+ return boost::filesystem::path();
}
boost::filesystem::path ApplicationPathProvider::getExecutableDir() const {
- return Paths::getExecutablePath();
+ return Paths::getExecutablePath();
}
}
diff --git a/SwifTools/Application/ApplicationPathProvider.h b/SwifTools/Application/ApplicationPathProvider.h
index aba9687..399ac5d 100644
--- a/SwifTools/Application/ApplicationPathProvider.h
+++ b/SwifTools/Application/ApplicationPathProvider.h
@@ -12,24 +12,24 @@
#include <boost/filesystem.hpp>
namespace Swift {
- class ApplicationPathProvider {
- public:
- ApplicationPathProvider(const std::string& applicationName);
- virtual ~ApplicationPathProvider();
+ class ApplicationPathProvider {
+ public:
+ ApplicationPathProvider(const std::string& applicationName);
+ virtual ~ApplicationPathProvider();
- virtual boost::filesystem::path getHomeDir() const = 0;
- virtual boost::filesystem::path getDataDir() const = 0;
- boost::filesystem::path getExecutableDir() const;
- boost::filesystem::path getProfileDir(const std::string& profile) const;
- boost::filesystem::path getResourcePath(const std::string& resource) const;
+ virtual boost::filesystem::path getHomeDir() const = 0;
+ virtual boost::filesystem::path getDataDir() const = 0;
+ boost::filesystem::path getExecutableDir() 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 std::string& getApplicationName() const {
- return applicationName;
- }
+ protected:
+ virtual std::vector<boost::filesystem::path> getResourceDirs() const = 0;
+ const std::string& getApplicationName() const {
+ return applicationName;
+ }
- private:
- std::string applicationName;
- };
+ private:
+ std::string applicationName;
+ };
}
diff --git a/SwifTools/Application/CocoaApplication.h b/SwifTools/Application/CocoaApplication.h
index 2653aca..a3e281c 100644
--- a/SwifTools/Application/CocoaApplication.h
+++ b/SwifTools/Application/CocoaApplication.h
@@ -7,13 +7,13 @@
#pragma once
namespace Swift {
- class CocoaApplication {
- public:
- CocoaApplication();
- ~CocoaApplication();
+ class CocoaApplication {
+ public:
+ CocoaApplication();
+ ~CocoaApplication();
- private:
- class Private;
- Private* d;
- };
+ private:
+ class Private;
+ Private* d;
+ };
}
diff --git a/SwifTools/Application/CocoaApplication.mm b/SwifTools/Application/CocoaApplication.mm
index cbb5f2e..f879014 100644
--- a/SwifTools/Application/CocoaApplication.mm
+++ b/SwifTools/Application/CocoaApplication.mm
@@ -6,19 +6,19 @@
namespace Swift {
class CocoaApplication::Private {
- public:
- NSAutoreleasePool* autoReleasePool_;
+ public:
+ NSAutoreleasePool* autoReleasePool_;
};
CocoaApplication::CocoaApplication() {
- d = new CocoaApplication::Private();
- NSApplicationLoad();
- d->autoReleasePool_ = [[NSAutoreleasePool alloc] init];
+ d = new CocoaApplication::Private();
+ NSApplicationLoad();
+ d->autoReleasePool_ = [[NSAutoreleasePool alloc] init];
}
CocoaApplication::~CocoaApplication() {
- [d->autoReleasePool_ release];
- delete d;
+ [d->autoReleasePool_ release];
+ delete d;
}
}
diff --git a/SwifTools/Application/MacOSXApplicationPathProvider.cpp b/SwifTools/Application/MacOSXApplicationPathProvider.cpp
index 2c35cbe..086bbaa 100644
--- a/SwifTools/Application/MacOSXApplicationPathProvider.cpp
+++ b/SwifTools/Application/MacOSXApplicationPathProvider.cpp
@@ -13,23 +13,23 @@
namespace Swift {
MacOSXApplicationPathProvider::MacOSXApplicationPathProvider(const std::string& name) : ApplicationPathProvider(name) {
- resourceDirs.push_back(getExecutableDir() / "../Resources");
- resourceDirs.push_back(getExecutableDir() / "../resources"); // Development
+ 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());
- try {
- boost::filesystem::create_directory(result);
- }
- catch (const boost::filesystem::filesystem_error& e) {
- std::cerr << "ERROR: " << e.what() << std::endl;
- }
- return result;
+ boost::filesystem::path result(getHomeDir() / "Library/Application Support" / getApplicationName());
+ try {
+ boost::filesystem::create_directory(result);
+ }
+ catch (const boost::filesystem::filesystem_error& e) {
+ std::cerr << "ERROR: " << e.what() << std::endl;
+ }
+ return result;
}
boost::filesystem::path MacOSXApplicationPathProvider::getHomeDir() const {
- return boost::filesystem::path(getenv("HOME"));
+ return boost::filesystem::path(getenv("HOME"));
}
}
diff --git a/SwifTools/Application/MacOSXApplicationPathProvider.h b/SwifTools/Application/MacOSXApplicationPathProvider.h
index 93797bc..9d8f619 100644
--- a/SwifTools/Application/MacOSXApplicationPathProvider.h
+++ b/SwifTools/Application/MacOSXApplicationPathProvider.h
@@ -9,18 +9,18 @@
#include <SwifTools/Application/ApplicationPathProvider.h>
namespace Swift {
- class MacOSXApplicationPathProvider : public ApplicationPathProvider {
- public:
- MacOSXApplicationPathProvider(const std::string& name);
+ class MacOSXApplicationPathProvider : public ApplicationPathProvider {
+ public:
+ MacOSXApplicationPathProvider(const std::string& name);
- virtual boost::filesystem::path getHomeDir() const;
- boost::filesystem::path getDataDir() const;
+ virtual boost::filesystem::path getHomeDir() const;
+ boost::filesystem::path getDataDir() const;
- virtual std::vector<boost::filesystem::path> getResourceDirs() const {
- return resourceDirs;
- }
+ virtual std::vector<boost::filesystem::path> getResourceDirs() const {
+ return resourceDirs;
+ }
- private:
- std::vector<boost::filesystem::path> resourceDirs;
- };
+ private:
+ std::vector<boost::filesystem::path> resourceDirs;
+ };
}
diff --git a/SwifTools/Application/PlatformApplicationPathProvider.h b/SwifTools/Application/PlatformApplicationPathProvider.h
index d9400a4..5de91fe 100644
--- a/SwifTools/Application/PlatformApplicationPathProvider.h
+++ b/SwifTools/Application/PlatformApplicationPathProvider.h
@@ -11,16 +11,16 @@
#if defined(SWIFTEN_PLATFORM_MACOSX)
#include <SwifTools/Application/MacOSXApplicationPathProvider.h>
namespace Swift {
- typedef MacOSXApplicationPathProvider PlatformApplicationPathProvider;
+ typedef MacOSXApplicationPathProvider PlatformApplicationPathProvider;
}
#elif defined(SWIFTEN_PLATFORM_WIN32)
#include <SwifTools/Application/WindowsApplicationPathProvider.h>
namespace Swift {
- typedef WindowsApplicationPathProvider PlatformApplicationPathProvider;
+ typedef WindowsApplicationPathProvider PlatformApplicationPathProvider;
}
#else
#include <SwifTools/Application/UnixApplicationPathProvider.h>
namespace Swift {
- typedef UnixApplicationPathProvider PlatformApplicationPathProvider;
+ typedef UnixApplicationPathProvider PlatformApplicationPathProvider;
}
#endif
diff --git a/SwifTools/Application/UnitTest/ApplicationPathProviderTest.cpp b/SwifTools/Application/UnitTest/ApplicationPathProviderTest.cpp
index df59505..433b379 100644
--- a/SwifTools/Application/UnitTest/ApplicationPathProviderTest.cpp
+++ b/SwifTools/Application/UnitTest/ApplicationPathProviderTest.cpp
@@ -18,37 +18,37 @@
using namespace Swift;
class ApplicationPathProviderTest : public CppUnit::TestFixture {
- CPPUNIT_TEST_SUITE(ApplicationPathProviderTest);
- CPPUNIT_TEST(testGetDataDir);
- CPPUNIT_TEST(testGetExecutableDir);
- CPPUNIT_TEST_SUITE_END();
-
- public:
- void setUp() {
- testling_ = new PlatformApplicationPathProvider("SwiftTest");
- }
-
- void tearDown() {
- delete testling_;
- }
-
- void testGetDataDir() {
- boost::filesystem::path dir = testling_->getDataDir();
-
- CPPUNIT_ASSERT(boost::filesystem::exists(dir));
- CPPUNIT_ASSERT(boost::filesystem::is_directory(dir));
-
- boost::filesystem::remove(dir);
- }
-
- void testGetExecutableDir() {
- boost::filesystem::path dir = testling_->getExecutableDir();
- CPPUNIT_ASSERT(boost::filesystem::is_directory(dir));
- CPPUNIT_ASSERT(boost::ends_with(pathToString(dir), "UnitTest"));
- }
-
- private:
- ApplicationPathProvider* testling_;
+ CPPUNIT_TEST_SUITE(ApplicationPathProviderTest);
+ CPPUNIT_TEST(testGetDataDir);
+ CPPUNIT_TEST(testGetExecutableDir);
+ CPPUNIT_TEST_SUITE_END();
+
+ public:
+ void setUp() {
+ testling_ = new PlatformApplicationPathProvider("SwiftTest");
+ }
+
+ void tearDown() {
+ delete testling_;
+ }
+
+ void testGetDataDir() {
+ boost::filesystem::path dir = testling_->getDataDir();
+
+ CPPUNIT_ASSERT(boost::filesystem::exists(dir));
+ CPPUNIT_ASSERT(boost::filesystem::is_directory(dir));
+
+ boost::filesystem::remove(dir);
+ }
+
+ void testGetExecutableDir() {
+ boost::filesystem::path dir = testling_->getExecutableDir();
+ CPPUNIT_ASSERT(boost::filesystem::is_directory(dir));
+ CPPUNIT_ASSERT(boost::ends_with(pathToString(dir), "UnitTest"));
+ }
+
+ private:
+ ApplicationPathProvider* testling_;
};
CPPUNIT_TEST_SUITE_REGISTRATION(ApplicationPathProviderTest);
diff --git a/SwifTools/Application/UnixApplicationPathProvider.cpp b/SwifTools/Application/UnixApplicationPathProvider.cpp
index 0708bb2..c561d72 100644
--- a/SwifTools/Application/UnixApplicationPathProvider.cpp
+++ b/SwifTools/Application/UnixApplicationPathProvider.cpp
@@ -20,45 +20,45 @@
namespace Swift {
UnixApplicationPathProvider::UnixApplicationPathProvider(const std::string& name) : ApplicationPathProvider(name) {
- resourceDirs.push_back(getExecutableDir() / "../resources"); // Development
- resourceDirs.push_back(getExecutableDir() / ".." / "share" / boost::to_lower_copy(getApplicationName())); // Local install
- char* xdgDataDirs = getenv("XDG_DATA_DIRS");
- if (xdgDataDirs) {
- std::vector<std::string> dataDirs = String::split(xdgDataDirs, ':');
- if (!dataDirs.empty()) {
- foreach(const std::string& dir, dataDirs) {
- resourceDirs.push_back(boost::filesystem::path(dir) / "swift");
- }
- return;
- }
- }
- resourceDirs.push_back("/usr/local/share/" + boost::to_lower_copy(getApplicationName()));
- resourceDirs.push_back("/usr/share/" + boost::to_lower_copy(getApplicationName()));
+ resourceDirs.push_back(getExecutableDir() / "../resources"); // Development
+ resourceDirs.push_back(getExecutableDir() / ".." / "share" / boost::to_lower_copy(getApplicationName())); // Local install
+ char* xdgDataDirs = getenv("XDG_DATA_DIRS");
+ if (xdgDataDirs) {
+ std::vector<std::string> dataDirs = String::split(xdgDataDirs, ':');
+ if (!dataDirs.empty()) {
+ foreach(const std::string& dir, dataDirs) {
+ resourceDirs.push_back(boost::filesystem::path(dir) / "swift");
+ }
+ return;
+ }
+ }
+ resourceDirs.push_back("/usr/local/share/" + boost::to_lower_copy(getApplicationName()));
+ resourceDirs.push_back("/usr/share/" + boost::to_lower_copy(getApplicationName()));
}
boost::filesystem::path UnixApplicationPathProvider::getHomeDir() const {
- char* home = getenv("HOME");
- return home ? boost::filesystem::path(home) : boost::filesystem::path();
+ char* home = getenv("HOME");
+ return home ? boost::filesystem::path(home) : boost::filesystem::path();
}
boost::filesystem::path UnixApplicationPathProvider::getDataDir() const {
- char* xdgDataHome = getenv("XDG_DATA_HOME");
- std::string dataDir;
- if (xdgDataHome) {
- dataDir = std::string(xdgDataHome);
- }
+ char* xdgDataHome = getenv("XDG_DATA_HOME");
+ std::string dataDir;
+ if (xdgDataHome) {
+ dataDir = std::string(xdgDataHome);
+ }
- boost::filesystem::path dataPath = (dataDir.empty() ?
- getHomeDir() / ".local" / "share"
- : boost::filesystem::path(dataDir)) / boost::to_lower_copy(getApplicationName());
+ boost::filesystem::path dataPath = (dataDir.empty() ?
+ getHomeDir() / ".local" / "share"
+ : boost::filesystem::path(dataDir)) / boost::to_lower_copy(getApplicationName());
- try {
- boost::filesystem::create_directories(dataPath);
- }
- catch (const boost::filesystem::filesystem_error& e) {
- std::cerr << "ERROR: " << e.what() << std::endl;
- }
- return dataPath;
+ try {
+ boost::filesystem::create_directories(dataPath);
+ }
+ catch (const boost::filesystem::filesystem_error& e) {
+ std::cerr << "ERROR: " << e.what() << std::endl;
+ }
+ return dataPath;
}
}
diff --git a/SwifTools/Application/UnixApplicationPathProvider.h b/SwifTools/Application/UnixApplicationPathProvider.h
index 96f4955..9e27a93 100644
--- a/SwifTools/Application/UnixApplicationPathProvider.h
+++ b/SwifTools/Application/UnixApplicationPathProvider.h
@@ -9,19 +9,19 @@
#include <SwifTools/Application/ApplicationPathProvider.h>
namespace Swift {
- class UnixApplicationPathProvider : public ApplicationPathProvider {
- public:
- UnixApplicationPathProvider(const std::string& name);
+ class UnixApplicationPathProvider : public ApplicationPathProvider {
+ public:
+ UnixApplicationPathProvider(const std::string& name);
- virtual boost::filesystem::path getHomeDir() const;
- boost::filesystem::path getDataDir() const;
+ virtual boost::filesystem::path getHomeDir() const;
+ boost::filesystem::path getDataDir() const;
- virtual std::vector<boost::filesystem::path> getResourceDirs() const {
- return resourceDirs;
- }
+ virtual std::vector<boost::filesystem::path> getResourceDirs() const {
+ return resourceDirs;
+ }
- private:
- std::vector<boost::filesystem::path> resourceDirs;
- };
+ private:
+ std::vector<boost::filesystem::path> resourceDirs;
+ };
}
diff --git a/SwifTools/Application/WindowsApplicationPathProvider.cpp b/SwifTools/Application/WindowsApplicationPathProvider.cpp
index 0b0c9cf..e90214c 100644
--- a/SwifTools/Application/WindowsApplicationPathProvider.cpp
+++ b/SwifTools/Application/WindowsApplicationPathProvider.cpp
@@ -15,24 +15,24 @@
namespace Swift {
WindowsApplicationPathProvider::WindowsApplicationPathProvider(const std::string& name) : ApplicationPathProvider(name) {
- resourceDirs.push_back(getExecutableDir());
- resourceDirs.push_back(getExecutableDir() / "../resources"); // Development
+ resourceDirs.push_back(getExecutableDir());
+ resourceDirs.push_back(getExecutableDir() / "../resources"); // Development
}
boost::filesystem::path WindowsApplicationPathProvider::getDataDir() const {
- wchar_t* appDirRaw = _wgetenv(L"APPDATA");
- assert(appDirRaw);
- boost::filesystem::path result(
- boost::filesystem::path(appDirRaw) / getApplicationName());
- boost::filesystem::create_directory(result);
- return result;
+ wchar_t* appDirRaw = _wgetenv(L"APPDATA");
+ assert(appDirRaw);
+ boost::filesystem::path result(
+ boost::filesystem::path(appDirRaw) / getApplicationName());
+ boost::filesystem::create_directory(result);
+ return result;
}
boost::filesystem::path WindowsApplicationPathProvider::getHomeDir() const {
- //FIXME: This should be My Documents
- wchar_t* homeDirRaw = _wgetenv(L"USERPROFILE");
- assert(homeDirRaw);
- return boost::filesystem::path(homeDirRaw);
+ //FIXME: This should be My Documents
+ wchar_t* homeDirRaw = _wgetenv(L"USERPROFILE");
+ assert(homeDirRaw);
+ return boost::filesystem::path(homeDirRaw);
}
diff --git a/SwifTools/Application/WindowsApplicationPathProvider.h b/SwifTools/Application/WindowsApplicationPathProvider.h
index 6d0f5bd..bf8dada 100644
--- a/SwifTools/Application/WindowsApplicationPathProvider.h
+++ b/SwifTools/Application/WindowsApplicationPathProvider.h
@@ -9,18 +9,18 @@
#include <SwifTools/Application/ApplicationPathProvider.h>
namespace Swift {
- class WindowsApplicationPathProvider : public ApplicationPathProvider {
- public:
- WindowsApplicationPathProvider(const std::string& name);
+ class WindowsApplicationPathProvider : public ApplicationPathProvider {
+ public:
+ WindowsApplicationPathProvider(const std::string& name);
- boost::filesystem::path getDataDir() const;
- boost::filesystem::path getHomeDir() const;
+ boost::filesystem::path getDataDir() const;
+ boost::filesystem::path getHomeDir() const;
- virtual std::vector<boost::filesystem::path> getResourceDirs() const {
- return resourceDirs;
- }
+ virtual std::vector<boost::filesystem::path> getResourceDirs() const {
+ return resourceDirs;
+ }
- private:
- std::vector<boost::filesystem::path> resourceDirs;
- };
+ private:
+ std::vector<boost::filesystem::path> resourceDirs;
+ };
}