Commit 041797ae authored by Ghislain MARY's avatar Ghislain MARY
Browse files

Add ClonableObject base class.

parent 21e6a2b6
......@@ -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
)
......
/*
* 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_
/*
* 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
/*
* 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_
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment