Skip to content

Commit

Permalink
[qtaround] qtaround library is wrapped into namespace
Browse files Browse the repository at this point in the history
Signed-off-by: Denis Zalevskiy <denis.zalevskiy@jolla.com>
  • Loading branch information
Denis Zalevskiy committed Oct 7, 2014
1 parent 615e9be commit 7a63509
Show file tree
Hide file tree
Showing 16 changed files with 61 additions and 7 deletions.
6 changes: 6 additions & 0 deletions examples/test_cutes.cpp
Expand Up @@ -7,6 +7,12 @@
#include <QCoreApplication>
#include <QDebug>

namespace os = qtaround::os;
namespace error = qtaround::error;
namespace sys = qtaround::sys;
namespace json = qtaround::json;
namespace debug = qtaround::debug;

int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
Expand Down
2 changes: 2 additions & 0 deletions include/vault/config.hpp
Expand Up @@ -22,6 +22,8 @@ namespace vault { namespace config {

namespace {

namespace os = qtaround::os;

const QString prefix = ".f8b52b7481393a3e6ade051ecfb549fa";

static inline QString units_path(QString const &vaultDir)
Expand Down
7 changes: 4 additions & 3 deletions include/vault/unit.hpp
Expand Up @@ -11,13 +11,14 @@
#include <vault/config.hpp>
#include <memory>

namespace sys { class GetOpt; }
namespace qtaround { namespace sys { class GetOpt; }}

namespace vault { namespace unit {

std::unique_ptr<sys::GetOpt> getopt();
typedef std::unique_ptr<qtaround::sys::GetOpt> options_uptr;
options_uptr getopt();

int execute(std::unique_ptr<sys::GetOpt>, QVariantMap const &info);
int execute(options_uptr, QVariantMap const &info);

}}

Expand Down
4 changes: 4 additions & 0 deletions qml/Vault/vault.cpp
Expand Up @@ -8,6 +8,10 @@

#include "vault.hpp"

namespace os = qtaround::os;
namespace error = qtaround::error;
namespace debug = qtaround::debug;

Q_DECLARE_METATYPE(Vault::Operation)
static const int _vault_operation_ __attribute__((unused))
= qRegisterMetaType<Vault::Operation>();
Expand Down
6 changes: 6 additions & 0 deletions src/transfer.cpp
Expand Up @@ -18,6 +18,12 @@
#include "QVariant"
#include "QMap"

namespace os = qtaround::os;
namespace subprocess = qtaround::subprocess;
namespace error = qtaround::error;
namespace debug = qtaround::debug;
using qtaround::subprocess::Process;

namespace {

using vault::File;
Expand Down
2 changes: 1 addition & 1 deletion src/transfer.hpp
Expand Up @@ -62,7 +62,7 @@ class CardTransfer : public QObject
signals:
void vaultChanged();
private:
static subprocess::Process doIO(IoCmd const &info);
static qtaround::subprocess::Process doIO(IoCmd const &info);
static void validateDump(QString const &archive, QVariantMap const &err);
void estimateSpace();
void exportStorage(progressCallback);
Expand Down
7 changes: 7 additions & 0 deletions src/unit.cpp
Expand Up @@ -15,6 +15,13 @@

#include <QString>

namespace os = qtaround::os;
namespace error = qtaround::error;
namespace sys = qtaround::sys;
namespace util = qtaround::util;
namespace json = qtaround::json;
namespace debug = qtaround::debug;

namespace vault { namespace unit {

static const unsigned current_version = 1;
Expand Down
2 changes: 2 additions & 0 deletions src/vault-cli.cpp
Expand Up @@ -13,6 +13,8 @@
#include <vault/vault.hpp>
#include <qtaround/debug.hpp>

namespace debug = qtaround::debug;

void set(QVariantMap &map, const QCommandLineParser &parser, const QString &option, bool optional = false)
{
if (!optional || parser.isSet(option)) {
Expand Down
6 changes: 6 additions & 0 deletions src/vault.cpp
Expand Up @@ -24,6 +24,12 @@
#include <QDateTime>
#include <QDir>

namespace os = qtaround::os;
namespace subprocess = qtaround::subprocess;
namespace error = qtaround::error;
namespace debug = qtaround::debug;


namespace vault {

static const QMap<File, QString> fileNames = {
Expand Down
5 changes: 5 additions & 0 deletions src/vault_config.cpp
Expand Up @@ -18,6 +18,11 @@
#include <qtaround/debug.hpp>
#include <qtaround/json.hpp>

namespace os = qtaround::os;
namespace error = qtaround::error;
namespace json = qtaround::json;
namespace debug = qtaround::debug;

namespace vault { namespace config {

Unit::Unit()
Expand Down
2 changes: 2 additions & 0 deletions tests/transfer.cpp
Expand Up @@ -22,6 +22,8 @@
#include <iostream>
#include <unistd.h>

namespace subprocess = qtaround::subprocess;

namespace tut
{

Expand Down
7 changes: 6 additions & 1 deletion tests/unit.cpp
Expand Up @@ -13,6 +13,11 @@
#include <iostream>
#include <unistd.h>

namespace os = qtaround::os;
namespace subprocess = qtaround::subprocess;
namespace error = qtaround::error;
namespace sys = qtaround::sys;

namespace tut
{

Expand Down Expand Up @@ -77,7 +82,7 @@ void setup()
auto root_path = it.value();

mkdir(root_path);
using os::path;
namespace path = os::path;
auto dir_content = path::join(root_path, "content");
mkdir(dir_content);
mkdir(path::join(dir_content, "content_subdir"));
Expand Down
2 changes: 1 addition & 1 deletion tests/unit1_vault_test.cpp
Expand Up @@ -21,7 +21,7 @@ int main(int argc, char *argv[])
QCoreApplication app(argc, argv);
using namespace vault::unit;
execute(getopt(), info);
} catch (error::Error const &e) {
} catch (qtaround::error::Error const &e) {
qDebug() << e;
} catch (std::exception const &e) {
qDebug() << e.what();
Expand Down
2 changes: 1 addition & 1 deletion tests/unit_all.cpp
Expand Up @@ -31,7 +31,7 @@ int main(int argc, char *argv[])
QCoreApplication app(argc, argv);
using namespace vault::unit;
execute(getopt(), info);
} catch (error::Error const &e) {
} catch (qtaround::error::Error const &e) {
qDebug() << e;
} catch (std::exception const &e) {
qDebug() << e.what();
Expand Down
3 changes: 3 additions & 0 deletions tests/vault.cpp
Expand Up @@ -16,6 +16,9 @@
#include <iostream>
#include <unistd.h>

namespace os = qtaround::os;
namespace error = qtaround::error;

namespace tut
{

Expand Down
5 changes: 5 additions & 0 deletions tests/vault_context.hpp
Expand Up @@ -10,6 +10,11 @@

namespace {

using qtaround::subprocess::Process;
namespace os = qtaround::os;
namespace error = qtaround::error;
namespace util = qtaround::util;

QSet<QString> get_ftree(QString const &root)
{
Process ps;
Expand Down

0 comments on commit 7a63509

Please sign in to comment.