From f5c98467bad8bda8e28f4326bf357395c8d490f5 Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Thu, 10 Aug 2017 11:34:08 +0200 Subject: [PATCH] feat(object): ObjectPrivate is now in object-p.h --- src/CMakeLists.txt | 2 ++ src/cpim/header/cpim-header-p.h | 1 + src/cpim/message/cpim-message.cpp | 1 + src/cpim/parser/cpim-parser.cpp | 1 + src/object/object-p.h | 41 +++++++++++++++++++++++++++++++ src/object/object.cpp | 33 +++++++++++++++++++++++++ src/object/object.h | 21 +++------------- 7 files changed, 82 insertions(+), 18 deletions(-) create mode 100644 src/object/object-p.h create mode 100644 src/object/object.cpp diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d886ea863..bf1e95202 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -30,6 +30,7 @@ set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES cpim/parser/cpim-grammar.h cpim/parser/cpim-parser.h object/object.h + object/object-p.h object/singleton.h utils/general.h utils/utils.h @@ -42,6 +43,7 @@ set(LINPHONE_CXX_OBJECTS_SOURCE_FILES cpim/message/cpim-message.cpp cpim/parser/cpim-grammar.cpp cpim/parser/cpim-parser.cpp + object/object.cpp utils/utils.cpp ) diff --git a/src/cpim/header/cpim-header-p.h b/src/cpim/header/cpim-header-p.h index 2e3208dd4..446e98647 100644 --- a/src/cpim/header/cpim-header-p.h +++ b/src/cpim/header/cpim-header-p.h @@ -20,6 +20,7 @@ #define _CPIM_HEADER_P_H_ #include "cpim-header.h" +#include "object/object-p.h" // ============================================================================= diff --git a/src/cpim/message/cpim-message.cpp b/src/cpim/message/cpim-message.cpp index af1e06209..7eab6fea0 100644 --- a/src/cpim/message/cpim-message.cpp +++ b/src/cpim/message/cpim-message.cpp @@ -19,6 +19,7 @@ #include #include "cpim/parser/cpim-parser.h" +#include "object/object-p.h" #include "utils/utils.h" #include "cpim-message.h" diff --git a/src/cpim/parser/cpim-parser.cpp b/src/cpim/parser/cpim-parser.cpp index 8d2a88e97..8c637fcb4 100644 --- a/src/cpim/parser/cpim-parser.cpp +++ b/src/cpim/parser/cpim-parser.cpp @@ -24,6 +24,7 @@ #include "linphone/core.h" #include "cpim-grammar.h" +#include "object/object-p.h" #include "utils/utils.h" #include "cpim-parser.h" diff --git a/src/object/object-p.h b/src/object/object-p.h new file mode 100644 index 000000000..f08a6b968 --- /dev/null +++ b/src/object/object-p.h @@ -0,0 +1,41 @@ +/* + * object-p.h + * Copyright (C) 2017 Belledonne Communications SARL + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef _OBJECT_P_H_ +#define _OBJECT_P_H_ + +#include "utils/general.h" + +// ============================================================================= + +namespace LinphonePrivate { + class Object; + + class ObjectPrivate { + public: + virtual ~ObjectPrivate () = default; + + protected: + Object *mPublic = nullptr; + + private: + L_DECLARE_PUBLIC(Object); + }; +} + +#endif // ifndef _OBJECT_P_H_ diff --git a/src/object/object.cpp b/src/object/object.cpp new file mode 100644 index 000000000..a4c0a5a34 --- /dev/null +++ b/src/object/object.cpp @@ -0,0 +1,33 @@ +/* + * object.cpp + * Copyright (C) 2017 Belledonne Communications SARL + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "object-p.h" + +#include "object.h" + +using namespace LinphonePrivate; + +// ============================================================================= + +Object::~Object () { + delete mPrivate; +} + +Object::Object (ObjectPrivate &p) : mPrivate(&p) { + mPrivate->mPublic = this; +} diff --git a/src/object/object.h b/src/object/object.h index 18c39489d..5756bcc8e 100644 --- a/src/object/object.h +++ b/src/object/object.h @@ -24,29 +24,14 @@ // ============================================================================= namespace LinphonePrivate { - class Object; - - class ObjectPrivate { - public: - virtual ~ObjectPrivate () = default; - - protected: - Object *mPublic = nullptr; - - private: - L_DECLARE_PUBLIC(Object); - }; + class ObjectPrivate; class LINPHONE_PUBLIC Object { public: - virtual ~Object () { - delete mPrivate; - } + virtual ~Object (); protected: - explicit Object (ObjectPrivate &p) : mPrivate(&p) { - mPrivate->mPublic = this; - } + explicit Object (ObjectPrivate &p); ObjectPrivate *mPrivate = nullptr;