utils: remove dependency between modules 98/108798/2
authorLukasz Stanislawski <l.stanislaws@samsung.com>
Thu, 5 Jan 2017 18:16:12 +0000 (19:16 +0100)
committerLukasz Stanislawski <l.stanislaws@samsung.com>
Mon, 9 Jan 2017 10:01:18 +0000 (02:01 -0800)
BinaryFile reader and writer should not depend on TizenAppUtils

Change-Id: Iccb1c070c967f18ee589c06ee85438cbfe17fa58

clock/inc/Utils/BinaryFileReader.h
clock/inc/Utils/BinaryFileWriter.h
clock/src/Model/AlarmProvider.cpp
clock/src/Utils/BinaryFileReader.cpp
clock/src/Utils/BinaryFileWriter.cpp

index 2ba3dd3..5c5e5d4 100644 (file)
@@ -18,7 +18,6 @@
 #define _CLOCK_COMMON_BINARY_FILE_READER_H_
 
 #include "Utils/Reader.h"
-#include "Utils/TizenAppUtils.h"
 #include <vector>
 
 namespace utils {
@@ -29,10 +28,9 @@ namespace utils {
                public:
                        /**
                         * @brief Constructs object instance
-                        * @param dir the application accessible directory
                         * @param filename file name.
                         */
-                       BinaryFileReader(TizenAppUtils::AppSubdirectory dir, const char *filename);
+                       BinaryFileReader(const char *filename);
                        ~BinaryFileReader() {}
                        void Read(void *buffer, size_t size);
                private:
index c422be4..7f10753 100644 (file)
@@ -18,7 +18,6 @@
 #define _CLOCK_COMMON_BINARY_FILE_WRITER_H_
 
 #include "Utils/Writer.h"
-#include "Utils/TizenAppUtils.h"
 
 #include <fstream>
 
@@ -33,7 +32,7 @@ namespace utils {
                         * @param dir the application accessible directory
                         * @param filename file name.
                         */
-                       BinaryFileWriter(TizenAppUtils::AppSubdirectory dir, const char *filename);
+                       BinaryFileWriter(const char *filename);
                        ~BinaryFileWriter();
                        void Write(const void *buffer, size_t size);
                        /**
index fd098ab..29d1093 100644 (file)
@@ -29,7 +29,7 @@ using namespace internal;
 
 AlarmProvider::AlarmProvider()
 {
-       BinaryFileReader reader(TizenAppUtils::APP_DIR_DATA, DATABASE_FILE);
+       BinaryFileReader reader(TizenAppUtils::GetResourcePath(TizenAppUtils::APP_DIR_DATA, DATABASE_FILE));
        impl_ = new AlarmBinaryStorage(reader);
        if (HasActiveAlarms())
                Notifier::GetInstance().AlarmNotiPost();
@@ -43,7 +43,7 @@ AlarmProvider::~AlarmProvider()
 
 void AlarmProvider::Sync()
 {
-       BinaryFileWriter writer(TizenAppUtils::APP_DIR_DATA, DATABASE_FILE);
+       BinaryFileWriter writer(TizenAppUtils::GetResourcePath(TizenAppUtils::APP_DIR_DATA, DATABASE_FILE));
        impl_->Serialize(writer);
        writer.Flush();
 
index 2b489f1..9361862 100644 (file)
@@ -23,9 +23,9 @@
 using namespace utils;
 using namespace std;
 
-BinaryFileReader::BinaryFileReader(TizenAppUtils::AppSubdirectory dir, const char *filename)
+BinaryFileReader::BinaryFileReader(const char *filename)
 {
-       ifstream file(TizenAppUtils::GetResourcePath(dir, filename));
+       ifstream file(filename);
        offset = 0;
 
        if (!file.good()) {
index 836722f..2035ad2 100644 (file)
@@ -22,8 +22,8 @@
 using namespace utils;
 using namespace std;
 
-BinaryFileWriter::BinaryFileWriter(TizenAppUtils::AppSubdirectory dir, const char *filename) :
-       file(TizenAppUtils::GetResourcePath(dir, filename), ios::binary)
+BinaryFileWriter::BinaryFileWriter(const char *filename) :
+       file(filename, ios::binary)
 {
        if (!file.good())
                abort();