Add ClonableObject base class.

This commit is contained in:
Ghislain MARY 2017-08-11 10:29:29 +02:00
parent 21e6a2b679
commit 041797aed1
4 changed files with 126 additions and 0 deletions

View file

@ -30,6 +30,8 @@ set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES
cpim/parser/cpim-grammar.h
cpim/parser/cpim-parser.h
logger/logger.h
object/clonable-object.h
object/clonable-object-p.h
object/object-p.h
object/object.h
object/singleton.h
@ -45,6 +47,7 @@ set(LINPHONE_CXX_OBJECTS_SOURCE_FILES
cpim/parser/cpim-grammar.cpp
cpim/parser/cpim-parser.cpp
logger/logger.cpp
object/clonable-object.cpp
object/object.cpp
utils/utils.cpp
)

View file

@ -0,0 +1,43 @@
/*
* clonable-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 <http://www.gnu.org/licenses/>.
*/
#ifndef _CLONABLE_OBJECT_P_H_
#define _CLONABLE_OBJECT_P_H_
#include "utils/general.h"
// =============================================================================
LINPHONE_BEGIN_NAMESPACE
class ClonableObject;
class ClonableObjectPrivate {
public:
virtual ~ClonableObjectPrivate () = default;
protected:
ClonableObject *mPublic = nullptr;
private:
L_DECLARE_PUBLIC(ClonableObject);
};
LINPHONE_END_NAMESPACE
#endif // ifndef _CLONABLE_OBJECT_P_H_

View file

@ -0,0 +1,35 @@
/*
* clonable-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 <http://www.gnu.org/licenses/>.
*/
#include "clonable-object-p.h"
#include "clonable-object.h"
LINPHONE_BEGIN_NAMESPACE
// =============================================================================
ClonableObject::~ClonableObject () {
delete mPrivate;
}
ClonableObject::ClonableObject (ClonableObjectPrivate &p) : mPrivate(&p) {
mPrivate->mPublic = this;
}
LINPHONE_END_NAMESPACE

View file

@ -0,0 +1,45 @@
/*
* clonable-object.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 <http://www.gnu.org/licenses/>.
*/
#ifndef _CLONABLE_OBJECT_H_
#define _CLONABLE_OBJECT_H_
#include "utils/general.h"
// =============================================================================
LINPHONE_BEGIN_NAMESPACE
class ClonableObjectPrivate;
class LINPHONE_PUBLIC ClonableObject {
public:
virtual ~ClonableObject ();
protected:
explicit ClonableObject (ClonableObjectPrivate &p);
ClonableObjectPrivate *mPrivate = nullptr;
private:
L_DECLARE_PRIVATE(ClonableObject);
};
LINPHONE_END_NAMESPACE
#endif // ifndef _CLONABLE_OBJECT_H_