From a4838124252ac14467e101dbe4821073f9fdab5a Mon Sep 17 00:00:00 2001 From: Lukasz Stanislawski Date: Thu, 18 Aug 2016 16:25:22 +0200 Subject: [PATCH] merge common & worldclock namespaces Change-Id: Ieaadb5f6693331de1f0e998c31a060f44757ae15 --- clock/inc/Controller/MainController.h | 106 +++++++++--------- clock/inc/Internal/AlarmProviderFile.h | 30 +++--- clock/inc/Internal/AlarmProviderStub.h | 26 +++-- clock/inc/Model/Alarm.h | 125 +++++++++++---------- clock/inc/Model/AlarmProvider.h | 30 +++--- clock/inc/Model/Location.h | 21 ++-- clock/inc/Model/StopWatch.h | 30 +++--- clock/inc/Model/StopWatchLap.h | 20 ++-- clock/inc/Model/Timer.h | 18 ++-- clock/inc/Model/WeekFlags.h | 66 ++++++------ clock/inc/Model/WordlClock.h | 21 ++-- clock/inc/Presenter/AlarmPresenter.h | 26 +++-- clock/inc/UI/Time.h | 8 -- clock/inc/UI/View.h | 2 - clock/inc/Utils/BinaryFileReader.h | 24 ++--- clock/inc/Utils/BinaryFileWriter.h | 24 ++--- clock/inc/Utils/Log.h | 11 +- clock/inc/Utils/Reader.h | 17 ++- clock/inc/Utils/Serialization.h | 185 ++++++++++++++++---------------- clock/inc/Utils/Time.h | 40 ++++--- clock/inc/Utils/Utils.h | 62 +++++------ clock/inc/Utils/Writer.h | 17 ++- clock/inc/View/AlarmView.h | 67 ++++++------ clock/inc/View/MainView.h | 174 +++++++++++++++--------------- clock/inc/View/PageView.h | 102 +++++++++--------- clock/inc/View/StopWatchView.h | 19 ++-- clock/inc/View/TimerView.h | 19 ++-- clock/inc/View/WorldClockView.h | 19 ++-- clock/src/Clock.cpp | 2 +- clock/src/Controller/MainController.cpp | 4 +- clock/src/Model/Alarm.cpp | 14 +-- clock/src/Model/AlarmProvider.cpp | 6 +- clock/src/Model/AlarmProviderFile.cpp | 20 ++-- clock/src/Model/AlarmProviderStub.cpp | 6 +- clock/src/Model/WeekFlags.cpp | 2 +- clock/src/Presenter/AlarmPresenter.cpp | 6 +- clock/src/Utils/BinaryFileReader.cpp | 2 +- clock/src/Utils/BinaryFileWriter.cpp | 2 +- clock/src/Utils/Time.cpp | 2 +- clock/src/Utils/Utils.cpp | 2 +- clock/src/View/AlarmView.cpp | 6 +- clock/src/View/MainView.cpp | 8 +- clock/src/View/PageView.cpp | 4 +- clock/src/View/StopWatchView.cpp | 4 +- clock/src/View/TimerView.cpp | 4 +- clock/src/View/WorldClockView.cpp | 4 +- 46 files changed, 673 insertions(+), 734 deletions(-) delete mode 100644 clock/inc/UI/Time.h diff --git a/clock/inc/Controller/MainController.h b/clock/inc/Controller/MainController.h index 6a0ee71..ca1e57c 100644 --- a/clock/inc/Controller/MainController.h +++ b/clock/inc/Controller/MainController.h @@ -31,65 +31,61 @@ * @{ */ -namespace worldclock { - namespace controller { - +namespace controller { /** * @brief Application lifecycle main controller singleton class * @remarks This is singleton class. */ - class MainController { - public: - /** - * @brief Retrieves singleton instance. - */ - static MainController &GetInstance(); - - /** - * @brief Destructor. - */ - ~MainController(); - - /** - * @brief Initializes application. - */ - int Init(); - - /** - * @brief Denitializes application. - */ - void Deinit(); - - /** - * @brief Pause application. - */ - void Pause(); - - /** - * @brief Resume application. - */ - void Resume(); - - /** - * @briefs Copies this class object instance. - * @remarks Customized for singleton purpose - make no effect. - */ - MainController(MainController const&) = delete; - - /** - * @briefs Overloads equation mark. - * @remarks Customized for singleton purpose - make no effect. - */ - void operator=(MainController const&) = delete; - - private: - /** - * @brief Constructs MainController class object. - */ - MainController() {}; - }; - - } + class MainController { + public: + /** + * @brief Retrieves singleton instance. + */ + static MainController &GetInstance(); + + /** + * @brief Destructor. + */ + ~MainController(); + + /** + * @brief Initializes application. + */ + int Init(); + + /** + * @brief Denitializes application. + */ + void Deinit(); + + /** + * @brief Pause application. + */ + void Pause(); + + /** + * @brief Resume application. + */ + void Resume(); + + /** + * @briefs Copies this class object instance. + * @remarks Customized for singleton purpose - make no effect. + */ + MainController(MainController const&) = delete; + + /** + * @briefs Overloads equation mark. + * @remarks Customized for singleton purpose - make no effect. + */ + void operator=(MainController const&) = delete; + + private: + /** + * @brief Constructs MainController class object. + */ + MainController() {}; + }; } /** diff --git a/clock/inc/Internal/AlarmProviderFile.h b/clock/inc/Internal/AlarmProviderFile.h index a3c9e20..2d530ea 100644 --- a/clock/inc/Internal/AlarmProviderFile.h +++ b/clock/inc/Internal/AlarmProviderFile.h @@ -7,22 +7,20 @@ #include "Model/AlarmProvider.h" namespace internal { - namespace model { - class AlarmProviderFile : public common::model::AlarmProvider - { - public: - std::vector> GetAlarms(); - common::model::Alarm* GetAlarmWithId(common::model::AlarmId id); - void Add(common::model::Alarm& alarm); - void Remove(common::model::Alarm& alarm); - AlarmProviderFile(common::utils::IReader &r); - ~AlarmProviderFile(); - void Serialize(common::utils::IWriter &w) const; - private: - std::list alarms; - static const int db_schema_version; - }; - } /* model */ + class AlarmProviderFile : public model::AlarmProvider + { + public: + std::vector> GetAlarms(); + model::Alarm* GetAlarmWithId(model::AlarmId id); + void Add(model::Alarm& alarm); + void Remove(model::Alarm& alarm); + AlarmProviderFile(utils::IReader &r); + ~AlarmProviderFile(); + void Serialize(utils::IWriter &w) const; + private: + std::list alarms; + static const int db_schema_version; + }; } /* internal */ #endif diff --git a/clock/inc/Internal/AlarmProviderStub.h b/clock/inc/Internal/AlarmProviderStub.h index 4beec80..791e039 100644 --- a/clock/inc/Internal/AlarmProviderStub.h +++ b/clock/inc/Internal/AlarmProviderStub.h @@ -4,20 +4,18 @@ #include "Model/AlarmProvider.h" namespace internal { - namespace model { - class AlarmProviderStub : public common::model::AlarmProvider - { - public: - std::vector> GetAlarms(); - common::model::Alarm* GetAlarmWithId(common::model::AlarmId id); - void Add(common::model::Alarm& alarm); - void Remove(common::model::Alarm& alarm); - AlarmProviderStub(common::utils::IReader &r); - void Serialize(common::utils::IWriter &w) const {} - private: - std::vector alarms; - }; - } /* model */ + class AlarmProviderStub : public model::AlarmProvider + { + public: + std::vector> GetAlarms(); + model::Alarm* GetAlarmWithId(model::AlarmId id); + void Add(model::Alarm& alarm); + void Remove(model::Alarm& alarm); + AlarmProviderStub(utils::IReader &r); + void Serialize(utils::IWriter &w) const {} + private: + std::vector alarms; + }; } /* internal */ #endif diff --git a/clock/inc/Model/Alarm.h b/clock/inc/Model/Alarm.h index 065294b..ddfa63c 100644 --- a/clock/inc/Model/Alarm.h +++ b/clock/inc/Model/Alarm.h @@ -9,69 +9,68 @@ #include "Utils/Serialization.h" #include "Utils/Time.h" -namespace common { - namespace model { - typedef int AlarmId; - enum class AlarmType { - SOUND_ONLY, - VIBRATION, - VIBRATION_AND_SOUND - }; - void Serialize(utils::IWriter &w, AlarmType type); - void Deserialize(utils::IReader &w, AlarmType &type); - class CLOCK_EXPORT_API Alarm : public utils::ISerializable { - public: - Alarm(); - Alarm(utils::IReader &); - void Activate(); - bool IsActivated() const; - void Deactivate(); - void Snooze(); - void EnableSnooze(); - void DisableSnooze(); - bool IsSnoozeEnabled(); - void SetSnoozeInterval(unsigned int seconds); - unsigned int GetSnoozeInterval() const; - void SetSnoozeMaxAttemps(unsigned int attemps); - unsigned int GetSnoozeMaxAttempts() const; - std::string GetName() const; - void SetName(std::string name); - utils::Time GetTime() const; - void SetTime(utils::Time time); - std::string GetMelody() const; - void SetMelody(std::string path); - AlarmType GetType() const; - void SetType(AlarmType pattern); - WeekFlags GetWeekFlags() const; - void SetWeekFlags(WeekFlags flags); - void Serialize(utils::IWriter &w) const; - unsigned int GetVolume() const; - void SetVolume(unsigned int volume); +namespace model { + typedef int AlarmId; + enum class AlarmType { + SOUND_ONLY, + VIBRATION, + VIBRATION_AND_SOUND + }; + void Serialize(utils::IWriter &w, AlarmType type); + void Deserialize(utils::IReader &w, AlarmType &type); + class CLOCK_EXPORT_API Alarm : public utils::ISerializable { + public: + Alarm(); + Alarm(utils::IReader &); + void Activate(); + bool IsActivated() const; + void Deactivate(); + void Snooze(); + void EnableSnooze(); + void DisableSnooze(); + bool IsSnoozeEnabled(); + void SetSnoozeInterval(unsigned int seconds); + unsigned int GetSnoozeInterval() const; + void SetSnoozeMaxAttemps(unsigned int attemps); + unsigned int GetSnoozeMaxAttempts() const; + std::string GetName() const; + void SetName(std::string name); + utils::Time GetTime() const; + void SetTime(utils::Time time); + std::string GetMelody() const; + void SetMelody(std::string path); + AlarmType GetType() const; + void SetType(AlarmType pattern); + WeekFlags GetWeekFlags() const; + void SetWeekFlags(WeekFlags flags); + void Serialize(utils::IWriter &w) const; + unsigned int GetVolume() const; + void SetVolume(unsigned int volume); - /** Implement guideline requirement. Two alarms are considered - * same if they have same time and name */ - inline bool operator==(const Alarm &a) { return (time == a.time) && (a.name == name); } - inline bool operator==(const AlarmId id) { return this->alarm_id == id; } - private: - int alarm_id; - std::string name; - struct { - std::string melody; - unsigned int volume; - } sound; - AlarmType type_; - WeekFlags flags; - bool activated; - bool snooze_enabled; - struct { - int alarm_id; - unsigned int interval; - unsigned int attempt; - unsigned int attempts_max; - } snooze; - utils::Time time; - }; - } /* model */ -} /* common */ + /** Implement guideline requirement. Two alarms are considered + * same if they have same time and name */ + inline bool operator==(const Alarm &a) { return (time == a.time) && (a.name == name); } + inline bool operator==(const AlarmId id) { return this->alarm_id == id; } + private: + int alarm_id; + std::string name; + struct { + std::string melody; + unsigned int volume; + } sound; + std::string vibration; + WeekFlags flags; + bool activated; + bool snooze_enabled; + AlarmType type_; + struct { + int alarm_id; + unsigned int interval; + unsigned int attempt; + unsigned int attempts_max; + } snooze; + utils::Time time; + }; +} /* model */ #endif diff --git a/clock/inc/Model/AlarmProvider.h b/clock/inc/Model/AlarmProvider.h index 7468100..a04939f 100644 --- a/clock/inc/Model/AlarmProvider.h +++ b/clock/inc/Model/AlarmProvider.h @@ -25,22 +25,20 @@ #include -namespace common { - namespace model { - class CLOCK_EXPORT_API AlarmProvider : public utils::ISerializable { - public: - static AlarmProvider *GetInstance(); - static void Sync(); +namespace model { + class CLOCK_EXPORT_API AlarmProvider : public utils::ISerializable { + public: + static AlarmProvider *GetInstance(); + static void Sync(); - virtual std::vector> GetAlarms() = 0; - virtual Alarm *GetAlarmWithId(AlarmId id) = 0; - virtual void Add(Alarm& alarm) = 0; - virtual void Remove(Alarm& alarm) = 0; - protected: - AlarmProvider() {} - virtual ~AlarmProvider() {} - }; - } /* model */ -} /* common */ + virtual std::vector> GetAlarms() = 0; + virtual Alarm *GetAlarmWithId(AlarmId id) = 0; + virtual void Add(Alarm& alarm) = 0; + virtual void Remove(Alarm& alarm) = 0; + protected: + AlarmProvider() {} + virtual ~AlarmProvider() {} + }; +} /* model */ #endif diff --git a/clock/inc/Model/Location.h b/clock/inc/Model/Location.h index 2f5a973..e8eefa8 100644 --- a/clock/inc/Model/Location.h +++ b/clock/inc/Model/Location.h @@ -1,14 +1,15 @@ #ifndef _CLOCK_LOCATION_H_ #define _CLOCK_LOCATION_H_ -namespace clock { - namespace model { - struct Location { - std::string Name; - std::string Country; - std::string Timezone; - std::string TzPath; - }; - } /* model */ -} /* clock */ +#include + +namespace model { + struct Location { + std::string Name; + std::string Country; + std::string Timezone; + std::string TzPath; + }; +} /* model */ + #endif diff --git a/clock/inc/Model/StopWatch.h b/clock/inc/Model/StopWatch.h index 3c25532..0e19576 100644 --- a/clock/inc/Model/StopWatch.h +++ b/clock/inc/Model/StopWatch.h @@ -1,21 +1,19 @@ #ifndef _CLOCK_STOPWATCH_H_ #define _CLOCK_STOPWATCH_H_ -namespace clock { - namespace model { - class StopWatch { - public: - void Start(); - void Stop(); - void EndLap(); - void Reset(); - time_t ElapsedTime(); - std::vector GetLaps(); - private: - time_t start_time; - std::vector laps; - }; - } /* model */ -} /* clock */ +namespace model { + class StopWatch { + public: + void Start(); + void Stop(); + void EndLap(); + void Reset(); + time_t ElapsedTime(); + std::vector GetLaps(); + private: + time_t start_time; + std::vector laps; + }; +} /* model */ #endif diff --git a/clock/inc/Model/StopWatchLap.h b/clock/inc/Model/StopWatchLap.h index 3d21b6f..d55ac40 100644 --- a/clock/inc/Model/StopWatchLap.h +++ b/clock/inc/Model/StopWatchLap.h @@ -1,16 +1,14 @@ #ifndef _CLOCK_STOPWATCH_LAP_H_ #define _CLOCK_STOPWATCH_LA_H_ -namespace clock { - namespace model { - class StopWatchLap { - public: - StopWatchLap(time_t start, time_t duration); - ~StopWatchLap(); - time_t LapDuration(); - time_t LapStartTime(); - }; - } /* model */ -} /* clock */ +namespace model { + class StopWatchLap { + public: + StopWatchLap(time_t start, time_t duration); + ~StopWatchLap(); + time_t LapDuration(); + time_t LapStartTime(); + }; +} /* model */ #endif diff --git a/clock/inc/Model/Timer.h b/clock/inc/Model/Timer.h index 945f521..ea2203a 100644 --- a/clock/inc/Model/Timer.h +++ b/clock/inc/Model/Timer.h @@ -1,15 +1,13 @@ #ifndef _CLOCK_TIMER_H_ #define _CLOCK_TIMER_H_ -namespace clock { - namespace model { - class Timer { - public: - Start(time_t delay); - time_t StartTime(); - time_t RemainingTime(); - }; - } /* model */ -} /* clock */ +namespace model { + class Timer { + public: + Start(time_t delay); + time_t StartTime(); + time_t RemainingTime(); + }; +} /* model */ #endif diff --git a/clock/inc/Model/WeekFlags.h b/clock/inc/Model/WeekFlags.h index b020703..26612e4 100644 --- a/clock/inc/Model/WeekFlags.h +++ b/clock/inc/Model/WeekFlags.h @@ -22,39 +22,37 @@ #include -namespace common { - namespace model { - enum class WeekDay : int { - MONDAY = ALARM_WEEK_FLAG_MONDAY, - TUESDAY = ALARM_WEEK_FLAG_TUESDAY, - WEDNESDAY = ALARM_WEEK_FLAG_WEDNESDAY, - THURSDAY = ALARM_WEEK_FLAG_THURSDAY, - FRIDAY = ALARM_WEEK_FLAG_FRIDAY, - SATURDAY = ALARM_WEEK_FLAG_SATURDAY, - SUNDAY = ALARM_WEEK_FLAG_SUNDAY, - ALL_WEEK = (MONDAY | TUESDAY | WEDNESDAY | THURSDAY | FRIDAY | SATURDAY | SUNDAY), - WEEKEND = (SATURDAY | SUNDAY), - }; - inline constexpr WeekDay - operator|(WeekDay a, WeekDay b) - { - return static_cast(static_cast(a) | static_cast(b)); - } - class CLOCK_EXPORT_API WeekFlags : public utils::ISerializable { - public: - WeekFlags(); - WeekFlags(utils::IReader &r); - WeekFlags(WeekDay day); - void AddDay(WeekDay day); - void RemoveDay(WeekDay day); - bool IsOn(WeekDay day); - void Serialize(utils::IWriter &w) const; - int GetBitMask() const; - inline bool operator==(const WeekFlags &a) { return a.raw_flags == raw_flags; } - private: - int raw_flags; - }; - } /* model */ -} /* common */ +namespace model { + enum class WeekDay : int { + MONDAY = ALARM_WEEK_FLAG_MONDAY, + TUESDAY = ALARM_WEEK_FLAG_TUESDAY, + WEDNESDAY = ALARM_WEEK_FLAG_WEDNESDAY, + THURSDAY = ALARM_WEEK_FLAG_THURSDAY, + FRIDAY = ALARM_WEEK_FLAG_FRIDAY, + SATURDAY = ALARM_WEEK_FLAG_SATURDAY, + SUNDAY = ALARM_WEEK_FLAG_SUNDAY, + ALL_WEEK = (MONDAY | TUESDAY | WEDNESDAY | THURSDAY | FRIDAY | SATURDAY | SUNDAY), + WEEKEND = (SATURDAY | SUNDAY), + }; + inline constexpr WeekDay + operator|(WeekDay a, WeekDay b) + { + return static_cast(static_cast(a) | static_cast(b)); + } + class CLOCK_EXPORT_API WeekFlags : public utils::ISerializable { + public: + WeekFlags(); + WeekFlags(utils::IReader &r); + WeekFlags(WeekDay day); + void AddDay(WeekDay day); + void RemoveDay(WeekDay day); + bool IsOn(WeekDay day); + void Serialize(utils::IWriter &w) const; + int GetBitMask() const; + inline bool operator==(const WeekFlags &a) { return a.raw_flags == raw_flags; } + private: + int raw_flags; + }; +} /* model */ #endif diff --git a/clock/inc/Model/WordlClock.h b/clock/inc/Model/WordlClock.h index 21b5ef8..7307218 100644 --- a/clock/inc/Model/WordlClock.h +++ b/clock/inc/Model/WordlClock.h @@ -3,16 +3,15 @@ #include -namespace clock { - namespace model { - class WorldClock { - public: - const std::vector Locations; - const std::vector UserLocations; +namespace model { + class WorldClock { + public: + const std::vector Locations; + const std::vector UserLocations; + + void AddUserLocation(Location loc); + void RemoveUserLocation(Location loc); + }; +} /* model */ - void AddUserLocation(Location loc); - void RemoveUserLocation(Location loc); - }; - } /* model */ -} /* clock */ #endif diff --git a/clock/inc/Presenter/AlarmPresenter.h b/clock/inc/Presenter/AlarmPresenter.h index bf974da..883c120 100644 --- a/clock/inc/Presenter/AlarmPresenter.h +++ b/clock/inc/Presenter/AlarmPresenter.h @@ -20,19 +20,17 @@ #include "View/AlarmView.h" #include "Model/AlarmProvider.h" -namespace worldclock { - namespace presenters { - class AlarmPresenter { - public: - AlarmPresenter(view::AlarmView *view, common::model::AlarmProvider *model); - private: - view::AlarmView *view; - common::model::AlarmProvider *model; - void ShowAll(); - void OnItemSelected(int idx); - void OnItemActiveStatusChanged(int idx); - }; - } /* presenters */ -} /* worldclock */ +namespace presenter { + class AlarmPresenter { + public: + AlarmPresenter(view::AlarmView *view, model::AlarmProvider *model); + private: + view::AlarmView *view; + model::AlarmProvider *model; + void ShowAll(); + void OnItemSelected(int idx); + void OnItemActiveStatusChanged(int idx); + }; +} /* presenters */ #endif diff --git a/clock/inc/UI/Time.h b/clock/inc/UI/Time.h deleted file mode 100644 index 1d1a923..0000000 --- a/clock/inc/UI/Time.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef _CLOCK_TIME_H_ -#define _CLOCK_TIME_H_ - -#include - -time_t MakeTime(int day, int month, int year, int hour, int min); - -#endif diff --git a/clock/inc/UI/View.h b/clock/inc/UI/View.h index 432aa08..4593e91 100644 --- a/clock/inc/UI/View.h +++ b/clock/inc/UI/View.h @@ -3,13 +3,11 @@ #include -namespace common { namespace ui { class IView { public: virtual Evas_Object *GetEvasObject() = 0; }; }; -}; #endif diff --git a/clock/inc/Utils/BinaryFileReader.h b/clock/inc/Utils/BinaryFileReader.h index 0582fcb..1e38683 100644 --- a/clock/inc/Utils/BinaryFileReader.h +++ b/clock/inc/Utils/BinaryFileReader.h @@ -21,18 +21,16 @@ #include "Utils/Utils.h" #include -namespace common { - namespace utils { - class BinaryFileReader : public IReader { - public: - BinaryFileReader(Utils::AppSubdirectory dir, const char *filename); - ~BinaryFileReader() {} - void Read(void *buffer, size_t size); - private: - std::vector buffer; - unsigned int offset; - }; - } /* utils */ -} /* common */ +namespace utils { + class BinaryFileReader : public IReader { + public: + BinaryFileReader(Utils::AppSubdirectory dir, const char *filename); + ~BinaryFileReader() {} + void Read(void *buffer, size_t size); + private: + std::vector buffer; + unsigned int offset; + }; +} /* utils */ #endif diff --git a/clock/inc/Utils/BinaryFileWriter.h b/clock/inc/Utils/BinaryFileWriter.h index e09c73d..1dad58b 100644 --- a/clock/inc/Utils/BinaryFileWriter.h +++ b/clock/inc/Utils/BinaryFileWriter.h @@ -22,18 +22,16 @@ #include -namespace common { - namespace utils { - class BinaryFileWriter : public IWriter { - public: - BinaryFileWriter(Utils::AppSubdirectory dir, const char *filename); - ~BinaryFileWriter(); - void Write(const void *buffer, size_t size); - void Flush(); - private: - std::ofstream file; - }; - } /* utils */ -} /* common */ +namespace utils { + class BinaryFileWriter : public IWriter { + public: + BinaryFileWriter(Utils::AppSubdirectory dir, const char *filename); + ~BinaryFileWriter(); + void Write(const void *buffer, size_t size); + void Flush(); + private: + std::ofstream file; + }; +} /* utils */ #endif diff --git a/clock/inc/Utils/Log.h b/clock/inc/Utils/Log.h index 7809d98..30bc0d7 100644 --- a/clock/inc/Utils/Log.h +++ b/clock/inc/Utils/Log.h @@ -1,10 +1,9 @@ #ifndef _CLOCK_LOC #define _CLOCK_LOC -namespace clock { - namespace utils { - class Log { - }; - } /* utils */ -} /* clock */ +namespace utils { + class Log { + }; +} /* utils */ + #endif diff --git a/clock/inc/Utils/Reader.h b/clock/inc/Utils/Reader.h index ba65b90..57de5e3 100644 --- a/clock/inc/Utils/Reader.h +++ b/clock/inc/Utils/Reader.h @@ -19,13 +19,12 @@ #include -namespace common { - namespace utils { - class IReader { - public: - virtual void Read(void *buffer, size_t size) = 0; - virtual ~IReader() {} - }; - } /* utils */ -} /* common */ +namespace utils { + class IReader { + public: + virtual void Read(void *buffer, size_t size) = 0; + virtual ~IReader() {} + }; +} /* utils */ + #endif diff --git a/clock/inc/Utils/Serialization.h b/clock/inc/Utils/Serialization.h index 911e404..a4abff4 100644 --- a/clock/inc/Utils/Serialization.h +++ b/clock/inc/Utils/Serialization.h @@ -7,104 +7,103 @@ #include #include -namespace common { - namespace utils { - class ISerializable { - public: - ISerializable() {} - ISerializable(IReader &reader) {} - virtual void Serialize(IWriter &writer) const = 0; - virtual ~ISerializable() {} - }; +namespace utils { + class ISerializable { + public: + ISerializable() {} + ISerializable(IReader &reader) {} + virtual void Serialize(IWriter &writer) const = 0; + virtual ~ISerializable() {} + }; - // serialization/deserialization for basic types - // ISerializable - inline void Serialize(IWriter &w, const ISerializable &o) { - o.Serialize(w); - } - template - inline void Deserialize(IReader &r, T &obj) { - obj = T(r); - } + // serialization/deserialization for basic types + // ISerializable + inline void Serialize(IWriter &w, const ISerializable &o) { + o.Serialize(w); + } + template + inline void Deserialize(IReader &r, T &obj) { + obj = T(r); + } - // int - inline void Serialize(IWriter &w, const int v) { - w.Write(&v, sizeof(v)); - } - inline void Deserialize(IReader &r, int *v) { - r.Read(v, sizeof(v)); - } - inline void Deserialize(IReader &r, int &v) { - r.Read(&v, sizeof(v)); - } + // int + inline void Serialize(IWriter &w, const int v) { + w.Write(&v, sizeof(v)); + } + inline void Deserialize(IReader &r, int *v) { + r.Read(v, sizeof(v)); + } + inline void Deserialize(IReader &r, int &v) { + r.Read(&v, sizeof(v)); + } - // unsigned int - inline void Serialize(IWriter &w, const unsigned int v) { - w.Write(&v, sizeof(v)); - } - inline void Deserialize(IReader &r, unsigned int *v) { - r.Read(v, sizeof(v)); - } - inline void Deserialize(IReader &r, unsigned int &v) { - r.Read(&v, sizeof(v)); - } + // unsigned int + inline void Serialize(IWriter &w, const unsigned int v) { + w.Write(&v, sizeof(v)); + } + inline void Deserialize(IReader &r, unsigned int *v) { + r.Read(v, sizeof(v)); + } + inline void Deserialize(IReader &r, unsigned int &v) { + r.Read(&v, sizeof(v)); + } - // bool - inline void Serialize(IWriter &w, const bool v) { - w.Write(&v, sizeof(v)); - } - inline void Deserialize(IReader &r, bool *v) { - r.Read(v, sizeof(v)); - } - inline void Deserialize(IReader &r, bool &v) { - r.Read(&v, sizeof(v)); - } + // bool + inline void Serialize(IWriter &w, const bool v) { + w.Write(&v, sizeof(v)); + } + inline void Deserialize(IReader &r, bool *v) { + r.Read(v, sizeof(v)); + } + inline void Deserialize(IReader &r, bool &v) { + r.Read(&v, sizeof(v)); + } - // time_t - inline void Serialize(IWriter &w, const time_t v) { - w.Write(&v, sizeof(v)); - } - inline void Deserialize(IReader &r, time_t *v) { - r.Read(v, sizeof(v)); - } - inline void Deserialize(IReader &r, time_t &v) { - r.Read(&v, sizeof(v)); - } + // time_t + inline void Serialize(IWriter &w, const time_t v) { + w.Write(&v, sizeof(v)); + } + inline void Deserialize(IReader &r, time_t *v) { + r.Read(v, sizeof(v)); + } + inline void Deserialize(IReader &r, time_t &v) { + r.Read(&v, sizeof(v)); + } - // serialization for std::string - inline void Serialize(IWriter &w, const std::string &v) { - int len = v.size(); - w.Write(&len, sizeof(len)); - w.Write(v.c_str(), len); - } - inline void Deserialize(IReader &r, std::string &v) { - int len; - r.Read(&len, sizeof(len)); - char *buf = new char[len + 1]; - r.Read(buf, len); - buf[len] = '\0'; - v = std::string(buf); - delete buf; - }; + // serialization for std::string + inline void Serialize(IWriter &w, const std::string &v) { + int len = v.size(); + w.Write(&len, sizeof(len)); + w.Write(v.c_str(), len); + } + inline void Deserialize(IReader &r, std::string &v) { + int len; + r.Read(&len, sizeof(len)); + char *buf = new char[len + 1]; + r.Read(buf, len); + buf[len] = '\0'; + v = std::string(buf); + delete buf; + }; + + // serialization for std::list + template + inline void Serialize(IWriter &w, const std::list &list) { + int len = list.size(); + w.Write(&len, sizeof(len)); + for (auto it = list.begin(); it != list.end(); ++it) { + Serialize(w, *it); + } + } + template + inline void Deserialize(IReader &r, std::list &list) { + int len; + r.Read(&len, sizeof(len)); + for (int i = 0; i < len; i++) { + T obj(r); + list.push_back(std::move(obj)); + } + } +} /* utils */ - // serialization for std::list - template - inline void Serialize(IWriter &w, const std::list &list) { - int len = list.size(); - w.Write(&len, sizeof(len)); - for (auto it = list.begin(); it != list.end(); ++it) { - Serialize(w, *it); - } - } - template - inline void Deserialize(IReader &r, std::list &list) { - int len; - r.Read(&len, sizeof(len)); - for (int i = 0; i < len; i++) { - T obj(r); - list.push_back(std::move(obj)); - } - } - } /* utils */ -} /* common */ #endif diff --git a/clock/inc/Utils/Time.h b/clock/inc/Utils/Time.h index 06b5af5..6856453 100644 --- a/clock/inc/Utils/Time.h +++ b/clock/inc/Utils/Time.h @@ -4,26 +4,24 @@ #include "Common/Defines.h" #include "Utils/Serialization.h" -namespace common { - namespace utils { - enum Format { - FORMAT_12H, - FORMAT_24H - }; - class CLOCK_EXPORT_API Time : public utils::ISerializable { - public: - unsigned int Hour, Min, Sec; - Time() : Hour(0), Min(0), Sec(0) {} - Time(unsigned int h, unsigned int m, unsigned int s) : Hour(h), Min(m), Sec(s) {} - Time(utils::IReader &); - void Serialize(utils::IWriter &w) const; - inline bool operator==(const Time &a) { return (a.Hour == Hour ) && - (a.Min == Min) && (a.Sec == Sec); } - std::string Format(enum Format format) const; - std::string Meridiem() const; - std::string getFormattedTime(const char *icu_format) const; - }; - } /* utils */ -} /* common */ +namespace utils { + enum Format { + FORMAT_12H, + FORMAT_24H + }; + class CLOCK_EXPORT_API Time : public utils::ISerializable { + public: + unsigned int Hour, Min, Sec; + Time() : Hour(0), Min(0), Sec(0) {} + Time(unsigned int h, unsigned int m, unsigned int s) : Hour(h), Min(m), Sec(s) {} + Time(utils::IReader &); + void Serialize(utils::IWriter &w) const; + inline bool operator==(const Time &a) { return (a.Hour == Hour ) && + (a.Min == Min) && (a.Sec == Sec); } + std::string Format(enum Format format) const; + std::string Meridiem() const; + std::string getFormattedTime(const char *icu_format) const; + }; +} /* utils */ #endif diff --git a/clock/inc/Utils/Utils.h b/clock/inc/Utils/Utils.h index 8b9fb7e..288d832 100644 --- a/clock/inc/Utils/Utils.h +++ b/clock/inc/Utils/Utils.h @@ -18,40 +18,36 @@ #define _CLOCK_UTILS_H_ -namespace common { - namespace utils { - - class Utils { - public: - /* - * @brief Application sub-directories type. - */ - enum AppSubdirectory { - APP_DIR_DATA, - APP_DIR_CACHE, - APP_DIR_RESOURCE, - APP_DIR_SHARED_DATA, - APP_DIR_SHARED_RESOURCE, - APP_DIR_SHARED_TRUSTED, - APP_DIR_EXTERNAL_DATA, - APP_DIR_EXTERNAL_CACHE, - APP_DIR_EXTERNAL_SHARED_DATA, - }; - - /** - * @brief Returns absolute path to resource file located in applications directory. - * - * @param dir type of subdirectory - * @param relative path of resource from starting from given sub dir. - * eg. for APP_DATA_DIR subdir and relative "database.db" => "/home/owner/apps/org.tizen.clock/data/database.db" - * @return absolute path string. - * - * @note returns statically allocated string - */ - static const char *GetAppResourcePath(enum AppSubdirectory dir, const char *relative); +namespace utils { + class Utils { + public: + /* + * @brief Application sub-directories type. + */ + enum AppSubdirectory { + APP_DIR_DATA, + APP_DIR_CACHE, + APP_DIR_RESOURCE, + APP_DIR_SHARED_DATA, + APP_DIR_SHARED_RESOURCE, + APP_DIR_SHARED_TRUSTED, + APP_DIR_EXTERNAL_DATA, + APP_DIR_EXTERNAL_CACHE, + APP_DIR_EXTERNAL_SHARED_DATA, }; - } -} + /** + * @brief Returns absolute path to resource file located in applications directory. + * + * @param dir type of subdirectory + * @param relative path of resource from starting from given sub dir. + * eg. for APP_DATA_DIR subdir and relative "database.db" => "/home/owner/apps/org.tizen.clock/data/database.db" + * @return absolute path string. + * + * @note returns statically allocated string + */ + static const char *GetAppResourcePath(enum AppSubdirectory dir, const char *relative); + }; +} #endif /* _CLOCK_UTILS_H_ */ diff --git a/clock/inc/Utils/Writer.h b/clock/inc/Utils/Writer.h index da38d02..cce995e 100644 --- a/clock/inc/Utils/Writer.h +++ b/clock/inc/Utils/Writer.h @@ -19,13 +19,12 @@ #include -namespace common { - namespace utils { - class IWriter { - public: - virtual void Write(const void *buffer, size_t size) = 0; - virtual ~IWriter() {} - }; - } /* utils */ -} /* common */ +namespace utils { + class IWriter { + public: + virtual void Write(const void *buffer, size_t size) = 0; + virtual ~IWriter() {} + }; +} /* utils */ + #endif diff --git a/clock/inc/View/AlarmView.h b/clock/inc/View/AlarmView.h index b9c3966..cda88ba 100644 --- a/clock/inc/View/AlarmView.h +++ b/clock/inc/View/AlarmView.h @@ -23,41 +23,38 @@ #include -namespace worldclock { - namespace view { - class AlarmView : public common::ui::IView { - public: - typedef std::function SelectCallback; - typedef std::function ToggleCallback; - typedef std::function ButtonClickedCallback; - - AlarmView(); - void Clear(); - int ItemAppend(common::utils::Time time, const char *name, - const common::model::WeekFlags flags, bool active); - void RemoveItem(int idx); - void ItemUpdate(int idx, common::utils::Time time, const char *name, - const common::model::WeekFlags flags, bool active); - void ItemEnable(int idx); - void ItemDisable(int idx); - - void SetItemToggleCallback(ToggleCallback func); - void SetItemSelectCallback(SelectCallback func);; - void SetButtonClickedCallback(ButtonClickedCallback func); - Evas_Object *GetEvasObject(); - private: - static Elm_Genlist_Item_Class alarm_itc; - static Evas_Object *ContentGet(void *data, Evas_Object *obj, const char *part); - static char *TextGet(void *data, Evas_Object *obj, const char *part); - static void ItemClicked(void *data, Evas_Object *obj, void *info); - static void ItemRealized(void *data, Evas_Object *obj, void *info); - Evas_Object *genlist; - SelectCallback onSelected; - ToggleCallback onToggled; - ButtonClickedCallback onClicked;; - }; - } +namespace view { + class AlarmView : public ui::IView { + public: + typedef std::function SelectCallback; + typedef std::function ToggleCallback; + typedef std::function ButtonClickedCallback; + + AlarmView(); + void Clear(); + int ItemAppend(utils::Time time, const char *name, + const model::WeekFlags flags, bool active); + void RemoveItem(int idx); + void ItemUpdate(int idx, utils::Time time, const char *name, + const model::WeekFlags flags, bool active); + void ItemEnable(int idx); + void ItemDisable(int idx); + + void SetItemToggleCallback(ToggleCallback func); + void SetItemSelectCallback(SelectCallback func);; + void SetButtonClickedCallback(ButtonClickedCallback func); + Evas_Object *GetEvasObject(); + private: + static Elm_Genlist_Item_Class alarm_itc; + static Evas_Object *ContentGet(void *data, Evas_Object *obj, const char *part); + static char *TextGet(void *data, Evas_Object *obj, const char *part); + static void ItemClicked(void *data, Evas_Object *obj, void *info); + static void ItemRealized(void *data, Evas_Object *obj, void *info); + Evas_Object *genlist; + SelectCallback onSelected; + ToggleCallback onToggled; + ButtonClickedCallback onClicked;; + }; } - #endif /* ALARMVIEW_H_ */ diff --git a/clock/inc/View/MainView.h b/clock/inc/View/MainView.h index 5177089..bce1df6 100644 --- a/clock/inc/View/MainView.h +++ b/clock/inc/View/MainView.h @@ -36,94 +36,92 @@ * @{ */ -namespace worldclock { - namespace view { - - /** - * @brief Application main view class - * @remarks This is singleton class. - */ - class MainView : public common::ui::IView { - public: - - /** - * @brief Retrieves singleton instance. - */ - static MainView &GetInstance(); - - /** - * @brief Destructor - */ - ~MainView(); - - /** - * @brief Creates content of application - * @remarks It not creates base GUI - */ - void CreateContent(); - - /** - * @brief Retrieves naviframe object. - */ - Evas_Object *GetEvasObject(); - - /** - * @briefs Copies this class object instance. - * @remarks Customized for singleton purpose - make no effect. - */ - MainView(MainView const&) = delete; - /** - * @briefs Overloads equation mark. - * @remarks Customized for singleton purpose - make no effect. - */ - void operator=(MainView const&) = delete; - private: - - /** - * @brief Constructs MainView class object - * @remarks Creates base GUI - */ - MainView(); - - /** - * Adds conformant to window. - */ - void ConformantAdd(); - - /** - * @brief Adds naviframe to conformant - * @remarks it also fills indicator_bg part in conformant - */ - void NaviframeAdd(); - - /** - * @brief Creates content for Alarm, World Clock, Stopwatch and Timer pages - */ - void CreatePages(); - - /** - * @brief Creates toolbar buttons. - */ - void CreateToolbarButtons(); - - /** - * @brief Creates toolbar. - */ - void CreateToolbar(); - - Evas_Object *window_; - Evas_Object *conformant_; - Evas_Object *naviframe_; - - /* Content */ - Evas_Object *toolbar_; - - IView *alarm_; - IView *world_clock_; - IView *stop_watch_; - IView *timer_; - }; - } +namespace view { + + /** + * @brief Application main view class + * @remarks This is singleton class. + */ + class MainView : public ui::IView { + public: + + /** + * @brief Retrieves singleton instance. + */ + static MainView &GetInstance(); + + /** + * @brief Destructor + */ + ~MainView(); + + /** + * @brief Creates content of application + * @remarks It not creates base GUI + */ + void CreateContent(); + + /** + * @brief Retrieves naviframe object. + */ + Evas_Object *GetEvasObject(); + + /** + * @briefs Copies this class object instance. + * @remarks Customized for singleton purpose - make no effect. + */ + MainView(MainView const&) = delete; + /** + * @briefs Overloads equation mark. + * @remarks Customized for singleton purpose - make no effect. + */ + void operator=(MainView const&) = delete; + private: + + /** + * @brief Constructs MainView class object + * @remarks Creates base GUI + */ + MainView(); + + /** + * Adds conformant to window. + */ + void ConformantAdd(); + + /** + * @brief Adds naviframe to conformant + * @remarks it also fills indicator_bg part in conformant + */ + void NaviframeAdd(); + + /** + * @brief Creates content for Alarm, World Clock, Stopwatch and Timer pages + */ + void CreatePages(); + + /** + * @brief Creates toolbar buttons. + */ + void CreateToolbarButtons(); + + /** + * @brief Creates toolbar. + */ + void CreateToolbar(); + + Evas_Object *window_; + Evas_Object *conformant_; + Evas_Object *naviframe_; + + /* Content */ + Evas_Object *toolbar_; + + IView *alarm_; + IView *world_clock_; + IView *stop_watch_; + IView *timer_; + }; } /** diff --git a/clock/inc/View/PageView.h b/clock/inc/View/PageView.h index fae0215..f28f62b 100644 --- a/clock/inc/View/PageView.h +++ b/clock/inc/View/PageView.h @@ -30,58 +30,56 @@ * @{ */ -namespace worldclock { - namespace view { - - /* - * @brief Base class for pages(Alarm, World Clock, StopWatch and Timer) - */ - class PageView : public common::ui::IView { - public: - - /** - * @brief Constructs class object. - */ - PageView(const char *title_label, Evas_Object *left_button, Evas_Object *right_button, Evas_Object *content); - /** - * @brief Cleans all resources needed to be cleaned up. - */ - ~PageView(); - - /** - * @brief Gets object of the page. - */ - virtual Evas_Object *GetEvasObject(); - - /** - * @brief Creates page content. - */ - virtual void CreateContent(){}; - - /** - * @brief Requests data refresh. - */ - virtual void RefreshContent(){}; - - /** - * @brief Creates new naviframe item page. - * @remarks Used to create "Add ..." pages in Alarm or World Clock - */ - virtual void CreateNewNaviPage(){}; - - protected: - - /** - * Requestes and retrives new naviframe item pushed to naviframe. - */ - void PushNewNaviPage(); - - Elm_Object_Item *subpage_; - const char *title_label_; - Evas_Object *left_button_; - Evas_Object *right_button_; - Evas_Object *content_; - }; +namespace view { + + /* + * @brief Base class for pages(Alarm, World Clock, StopWatch and Timer) + */ + class PageView : public ui::IView { + public: + + /** + * @brief Constructs class object. + */ + PageView(const char *title_label, Evas_Object *left_button, Evas_Object *right_button, Evas_Object *content); + /** + * @brief Cleans all resources needed to be cleaned up. + */ + ~PageView(); + + /** + * @brief Gets object of the page. + */ + virtual Evas_Object *GetEvasObject(); + + /** + * @brief Creates page content. + */ + virtual void CreateContent(){}; + + /** + * @brief Requests data refresh. + */ + virtual void RefreshContent(){}; + + /** + * @brief Creates new naviframe item page. + * @remarks Used to create "Add ..." pages in Alarm or World Clock + */ + virtual void CreateNewNaviPage(){}; + + protected: + + /** + * Requestes and retrives new naviframe item pushed to naviframe. + */ + void PushNewNaviPage(); + + Elm_Object_Item *subpage_; + const char *title_label_; + Evas_Object *left_button_; + Evas_Object *right_button_; + Evas_Object *content_; }; }; diff --git a/clock/inc/View/StopWatchView.h b/clock/inc/View/StopWatchView.h index 4bd1fad..ce5ef82 100644 --- a/clock/inc/View/StopWatchView.h +++ b/clock/inc/View/StopWatchView.h @@ -20,19 +20,16 @@ #include "View/PageView.h" #include "UI/View.h" -namespace worldclock { - namespace view { +namespace view { - class StopWatchView : public common::ui::IView { - public: - StopWatchView(); - Evas_Object *GetEvasObject(){return stopwatch_;}; + class StopWatchView : public ui::IView { + public: + StopWatchView(); + Evas_Object *GetEvasObject(){return stopwatch_;}; - private: - Evas_Object *stopwatch_; - }; - } + private: + Evas_Object *stopwatch_; + }; } - #endif /* STOPWATCHVIEW_H_ */ diff --git a/clock/inc/View/TimerView.h b/clock/inc/View/TimerView.h index a32a5fa..8c10bec 100644 --- a/clock/inc/View/TimerView.h +++ b/clock/inc/View/TimerView.h @@ -20,18 +20,15 @@ #include "View/PageView.h" #include "UI/View.h" -namespace worldclock { - namespace view { - class TimerView : public common::ui::IView { - public: - TimerView(); - Evas_Object *GetEvasObject(){return timer_;}; +namespace view { + class TimerView : public ui::IView { + public: + TimerView(); + Evas_Object *GetEvasObject(){return timer_;}; - private: - Evas_Object *timer_; - }; - } + private: + Evas_Object *timer_; + }; } - #endif /* TIMERVIEW_H_ */ diff --git a/clock/inc/View/WorldClockView.h b/clock/inc/View/WorldClockView.h index 183bcad..7910786 100644 --- a/clock/inc/View/WorldClockView.h +++ b/clock/inc/View/WorldClockView.h @@ -20,18 +20,15 @@ #include "View/PageView.h" #include "UI/View.h" -namespace worldclock { - namespace view { - class WorldClockView : public common::ui::IView { - public: - WorldClockView(); - Evas_Object *GetEvasObject(){return world_clock_;}; +namespace view { + class WorldClockView : public ui::IView { + public: + WorldClockView(); + Evas_Object *GetEvasObject(){return world_clock_;}; - private: - Evas_Object *world_clock_; - }; - } + private: + Evas_Object *world_clock_; + }; } - #endif /* WORLDCLOCKVIEW_H_ */ diff --git a/clock/src/Clock.cpp b/clock/src/Clock.cpp index 7914a85..0efebdc 100644 --- a/clock/src/Clock.cpp +++ b/clock/src/Clock.cpp @@ -21,7 +21,7 @@ #include "Clock.h" #include "Controller/MainController.h" -using namespace worldclock::controller; +using namespace controller; static bool diff --git a/clock/src/Controller/MainController.cpp b/clock/src/Controller/MainController.cpp index cc6e806..9cdc6f3 100644 --- a/clock/src/Controller/MainController.cpp +++ b/clock/src/Controller/MainController.cpp @@ -18,8 +18,8 @@ #include "View/MainView.h" #include "Controller/MainController.h" -using namespace worldclock::controller; -using namespace worldclock::view; +using namespace controller; +using namespace view; MainController &MainController::GetInstance() { diff --git a/clock/src/Model/Alarm.cpp b/clock/src/Model/Alarm.cpp index f00210c..eae1826 100644 --- a/clock/src/Model/Alarm.cpp +++ b/clock/src/Model/Alarm.cpp @@ -2,8 +2,8 @@ #include "Model/Alarm.h" #include "Common/Defines.h" -using namespace common::model; -using namespace common::utils; +using namespace model; +using namespace utils; static app_control_h AppControlCreate() { @@ -204,12 +204,12 @@ bool Alarm::IsActivated() const return activated; } -void common::model::Serialize(IWriter &w, AlarmType type) +void model::Serialize(IWriter &w, AlarmType type) { - common::utils::Serialize(w, static_cast(type)); + utils::Serialize(w, static_cast(type)); } -void common::model::Deserialize(IReader &r, AlarmType &type) +void model::Deserialize(IReader &r, AlarmType &type) { int tmp; utils::Deserialize(r, tmp); @@ -226,7 +226,7 @@ Alarm::Alarm(IReader &r) utils::Deserialize(r, name); utils::Deserialize(r, sound.melody); utils::Deserialize(r, sound.volume); - common::model::Deserialize(r, type_); + model::Deserialize(r, type_); utils::Deserialize(r, flags); utils::Deserialize(r, activated); utils::Deserialize(r, snooze_enabled); @@ -243,7 +243,7 @@ void Alarm::Serialize(utils::IWriter &w) const utils::Serialize(w, name); utils::Serialize(w, sound.melody); utils::Serialize(w, sound.volume); - common::model::Serialize(w, type_); + model::Serialize(w, type_); utils::Serialize(w, flags); utils::Serialize(w, activated); utils::Serialize(w, snooze_enabled); diff --git a/clock/src/Model/AlarmProvider.cpp b/clock/src/Model/AlarmProvider.cpp index da0409b..035a292 100644 --- a/clock/src/Model/AlarmProvider.cpp +++ b/clock/src/Model/AlarmProvider.cpp @@ -7,9 +7,9 @@ static const char DATABASE_FILE[] = "alarmsdb.cfg"; -using namespace common::model; -using namespace common::utils; -using namespace internal::model; +using namespace model; +using namespace utils; +using namespace internal; AlarmProvider *AlarmProvider::GetInstance() { diff --git a/clock/src/Model/AlarmProviderFile.cpp b/clock/src/Model/AlarmProviderFile.cpp index 9a3f114..7703762 100644 --- a/clock/src/Model/AlarmProviderFile.cpp +++ b/clock/src/Model/AlarmProviderFile.cpp @@ -4,14 +4,14 @@ #include #include -using namespace internal::model; -using namespace common::model; -using namespace common::utils; +using namespace internal; +using namespace model; +using namespace utils; const int AlarmProviderFile::db_schema_version = 1; -void AlarmProviderFile::Add(common::model::Alarm& alarm) +void AlarmProviderFile::Add(model::Alarm& alarm) { auto it = std::find(alarms.begin(), alarms.end(), alarm); @@ -22,7 +22,7 @@ void AlarmProviderFile::Add(common::model::Alarm& alarm) //FIXME emit AlarmAddedEvent } -void AlarmProviderFile::Remove(common::model::Alarm& alarm) +void AlarmProviderFile::Remove(model::Alarm& alarm) { auto it = std::find(alarms.begin(), alarms.end(), alarm); @@ -35,16 +35,16 @@ void AlarmProviderFile::Remove(common::model::Alarm& alarm) AlarmProviderFile::AlarmProviderFile(IReader &r) { - common::utils::Deserialize(r, alarms); + utils::Deserialize(r, alarms); } AlarmProviderFile::~AlarmProviderFile() { } -std::vector> AlarmProviderFile::GetAlarms() +std::vector> AlarmProviderFile::GetAlarms() { - return std::vector>( + return std::vector>( alarms.begin(), alarms.end()); } @@ -54,7 +54,7 @@ Alarm* AlarmProviderFile::GetAlarmWithId(AlarmId id) return nullptr; } -void AlarmProviderFile::Serialize(common::utils::IWriter &w) const +void AlarmProviderFile::Serialize(utils::IWriter &w) const { - common::utils::Serialize(w, alarms); + utils::Serialize(w, alarms); } diff --git a/clock/src/Model/AlarmProviderStub.cpp b/clock/src/Model/AlarmProviderStub.cpp index 105cd75..14edc35 100644 --- a/clock/src/Model/AlarmProviderStub.cpp +++ b/clock/src/Model/AlarmProviderStub.cpp @@ -4,9 +4,9 @@ #include -using namespace internal::model; -using namespace common::model; -using namespace common::utils; +using namespace internal; +using namespace model; +using namespace utils; AlarmProviderStub::AlarmProviderStub(IReader &r) { diff --git a/clock/src/Model/WeekFlags.cpp b/clock/src/Model/WeekFlags.cpp index eb24013..4fa395b 100644 --- a/clock/src/Model/WeekFlags.cpp +++ b/clock/src/Model/WeekFlags.cpp @@ -1,6 +1,6 @@ #include -using namespace common::model; +using namespace model; WeekFlags::WeekFlags() { raw_flags = 0; diff --git a/clock/src/Presenter/AlarmPresenter.cpp b/clock/src/Presenter/AlarmPresenter.cpp index 0bbbce9..4e58821 100644 --- a/clock/src/Presenter/AlarmPresenter.cpp +++ b/clock/src/Presenter/AlarmPresenter.cpp @@ -1,9 +1,9 @@ #include "Presenter/AlarmPresenter.h" #include "log.h" -using namespace worldclock::presenters; -using namespace worldclock::view; -using namespace common::model; +using namespace presenter; +using namespace view; +using namespace model; AlarmPresenter::AlarmPresenter(AlarmView *v, AlarmProvider *m) : model(m), view(v) { diff --git a/clock/src/Utils/BinaryFileReader.cpp b/clock/src/Utils/BinaryFileReader.cpp index 4d53a90..26793c0 100644 --- a/clock/src/Utils/BinaryFileReader.cpp +++ b/clock/src/Utils/BinaryFileReader.cpp @@ -4,7 +4,7 @@ #include #include -using namespace common::utils; +using namespace utils; using namespace std; BinaryFileReader::BinaryFileReader(Utils::AppSubdirectory dir, const char *filename) diff --git a/clock/src/Utils/BinaryFileWriter.cpp b/clock/src/Utils/BinaryFileWriter.cpp index c31eb95..3f66ac7 100644 --- a/clock/src/Utils/BinaryFileWriter.cpp +++ b/clock/src/Utils/BinaryFileWriter.cpp @@ -2,7 +2,7 @@ #include -using namespace common::utils; +using namespace utils; using namespace std; BinaryFileWriter::BinaryFileWriter(Utils::AppSubdirectory dir, const char *filename) : diff --git a/clock/src/Utils/Time.cpp b/clock/src/Utils/Time.cpp index 55c6cbf..90e3682 100644 --- a/clock/src/Utils/Time.cpp +++ b/clock/src/Utils/Time.cpp @@ -1,7 +1,7 @@ #include "Utils/Time.h" #include -using namespace common::utils; +using namespace utils; Time::Time(utils::IReader &r) { diff --git a/clock/src/Utils/Utils.cpp b/clock/src/Utils/Utils.cpp index 1b92772..2f72b42 100644 --- a/clock/src/Utils/Utils.cpp +++ b/clock/src/Utils/Utils.cpp @@ -23,7 +23,7 @@ #include #include -using namespace common::utils; +using namespace utils; const char *Utils::GetAppResourcePath(enum AppSubdirectory dir, const char *relative) { diff --git a/clock/src/View/AlarmView.cpp b/clock/src/View/AlarmView.cpp index 6ff2d2b..cf84ea6 100644 --- a/clock/src/View/AlarmView.cpp +++ b/clock/src/View/AlarmView.cpp @@ -23,9 +23,9 @@ #include "log.h" -using namespace worldclock::view; -using namespace common::model; -using namespace common::utils; +using namespace view; +using namespace model; +using namespace utils; struct ItemData { AlarmView *instance; diff --git a/clock/src/View/MainView.cpp b/clock/src/View/MainView.cpp index 19614ec..a839125 100644 --- a/clock/src/View/MainView.cpp +++ b/clock/src/View/MainView.cpp @@ -31,10 +31,10 @@ #include "Presenter/AlarmPresenter.h" #include "Model/AlarmProvider.h" -using namespace worldclock::view; -using namespace worldclock::presenters; -using namespace common::utils; -using namespace common::model; +using namespace view; +using namespace presenter; +using namespace utils; +using namespace model; static void WinDeleteRequestCb(void *data, Evas_Object *obj, void *event_info) diff --git a/clock/src/View/PageView.cpp b/clock/src/View/PageView.cpp index 4daef8f..1b6e9dc 100644 --- a/clock/src/View/PageView.cpp +++ b/clock/src/View/PageView.cpp @@ -24,8 +24,8 @@ #include -using namespace worldclock::view; -using namespace common::utils; +using namespace view; +using namespace utils; PageView::PageView(const char *title_label, Evas_Object *left_button, Evas_Object *right_button, Evas_Object *content) : title_label_(title_label), left_button_(left_button), right_button_(right_button), content_(content) diff --git a/clock/src/View/StopWatchView.cpp b/clock/src/View/StopWatchView.cpp index 9b7bcc5..e9935b9 100644 --- a/clock/src/View/StopWatchView.cpp +++ b/clock/src/View/StopWatchView.cpp @@ -18,8 +18,8 @@ #include "View/MainView.h" #include "Utils/Utils.h" -using namespace worldclock::view; -using namespace common::utils; +using namespace view; +using namespace utils; StopWatchView::StopWatchView() { diff --git a/clock/src/View/TimerView.cpp b/clock/src/View/TimerView.cpp index c375861..ebe506c 100644 --- a/clock/src/View/TimerView.cpp +++ b/clock/src/View/TimerView.cpp @@ -18,8 +18,8 @@ #include "View/MainView.h" #include "Utils/Utils.h" -using namespace worldclock::view; -using namespace common::utils; +using namespace view; +using namespace utils; TimerView::TimerView() diff --git a/clock/src/View/WorldClockView.cpp b/clock/src/View/WorldClockView.cpp index a26068e..2efe90b 100644 --- a/clock/src/View/WorldClockView.cpp +++ b/clock/src/View/WorldClockView.cpp @@ -18,8 +18,8 @@ #include "View/MainView.h" #include "Utils/Utils.h" -using namespace worldclock::view; -using namespace common::utils; +using namespace view; +using namespace utils; WorldClockView::WorldClockView() { -- 2.7.4