mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-04-22 23:48:36 +00:00
feat(enums): supports C export
This commit is contained in:
parent
3e7e4cb56d
commit
d7d78a515b
8 changed files with 111 additions and 46 deletions
|
|
@ -43,6 +43,7 @@ set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES
|
||||||
event-log/conference-event-p.h
|
event-log/conference-event-p.h
|
||||||
event-log/conference-event.h
|
event-log/conference-event.h
|
||||||
event-log/conference-participant-event.h
|
event-log/conference-participant-event.h
|
||||||
|
event-log/event-log-enums.h
|
||||||
event-log/event-log-p.h
|
event-log/event-log-p.h
|
||||||
event-log/event-log.h
|
event-log/event-log.h
|
||||||
event-log/message-event.h
|
event-log/message-event.h
|
||||||
|
|
|
||||||
|
|
@ -22,10 +22,11 @@
|
||||||
// From coreapi.
|
// From coreapi.
|
||||||
#include "private.h"
|
#include "private.h"
|
||||||
|
|
||||||
#include "event-log/event-log.h"
|
// Must be included before cpp headers.
|
||||||
|
|
||||||
#include "c-types.h"
|
#include "c-types.h"
|
||||||
|
|
||||||
|
#include "event-log/event-log.h"
|
||||||
|
|
||||||
// ================================================================²=============
|
// ================================================================²=============
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
@ -54,5 +55,14 @@ extern "C" {
|
||||||
);
|
);
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
L_DECLARE_C_STRUCT_IMPL(EventLog);
|
L_DECLARE_C_STRUCT_IMPL(EventLog);
|
||||||
|
|
||||||
|
LinphoneEventLog *event_log_new () {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
LinphoneEventLogType event_log_get_type (const LinphoneEventLog *eventLog) {
|
||||||
|
return LinphoneEventLogType::NoneEvent;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,17 +19,27 @@
|
||||||
#ifndef _C_TYPES_H_
|
#ifndef _C_TYPES_H_
|
||||||
#define _C_TYPES_H_
|
#define _C_TYPES_H_
|
||||||
|
|
||||||
|
#define L_DECLARE_ENUM(CLASS, ENUM) enum Linphone ## CLASS ## ENUM
|
||||||
|
#define L_DECLARE_C_STRUCT(STRUCT) typedef struct _Linphone ## STRUCT Linphone ## STRUCT;
|
||||||
|
|
||||||
|
#include "event-log/event-log-enums.h"
|
||||||
|
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define L_DECLARE_C_STRUCT(STRUCT) typedef struct _Linphone ## STRUCT Linphone ## STRUCT;
|
// -----------------------------------------------------------------------------
|
||||||
|
// Event log.
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
L_DECLARE_C_STRUCT(EventLog)
|
L_DECLARE_C_STRUCT(EventLog);
|
||||||
|
|
||||||
#undef L_DECLARE_C_STRUCT
|
LINPHONE_PUBLIC LinphoneEventLog *event_log_new ();
|
||||||
|
LINPHONE_PUBLIC LinphoneEventLogType event_log_get_type (const LinphoneEventLog *eventLog);
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -252,7 +252,7 @@ EventsDb::EventsDb () : AbstractDb(*new EventsDbPrivate) {}
|
||||||
bool EventsDb::addEvent (const EventLog &eventLog) {
|
bool EventsDb::addEvent (const EventLog &eventLog) {
|
||||||
// TODO.
|
// TODO.
|
||||||
switch (eventLog.getType()) {
|
switch (eventLog.getType()) {
|
||||||
case EventLog::None:
|
case EventLog::NoneEvent:
|
||||||
return false;
|
return false;
|
||||||
case EventLog::MessageEvent:
|
case EventLog::MessageEvent:
|
||||||
case EventLog::CallStartEvent:
|
case EventLog::CallStartEvent:
|
||||||
|
|
|
||||||
43
src/event-log/event-log-enums.h
Normal file
43
src/event-log/event-log-enums.h
Normal file
|
|
@ -0,0 +1,43 @@
|
||||||
|
/*
|
||||||
|
* event-log-enums.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 _EVENT_LOG_ENUMS_H_
|
||||||
|
#define _EVENT_LOG_ENUMS_H_
|
||||||
|
|
||||||
|
#include "utils/general.h"
|
||||||
|
|
||||||
|
// =============================================================================
|
||||||
|
|
||||||
|
L_DECLARE_ENUM(EventLog, Type) {
|
||||||
|
NoneEvent,
|
||||||
|
// MessageEvent.
|
||||||
|
MessageEvent,
|
||||||
|
// CallEvent.
|
||||||
|
CallStartEvent,
|
||||||
|
CallEndEvent,
|
||||||
|
// ConferenceEvent.
|
||||||
|
ConferenceCreatedEvent,
|
||||||
|
ConferenceDestroyedEvent,
|
||||||
|
// ConferenceParticipantEvent.
|
||||||
|
ConferenceParticipantAddedEvent,
|
||||||
|
ConferenceParticipantRemovedEvent,
|
||||||
|
ConferenceParticipantSetAdminEvent,
|
||||||
|
ConferenceParticipantUnsetAdminEvent
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // ifndef _EVENT_LOG_ENUMS_H_
|
||||||
|
|
@ -28,7 +28,7 @@ LINPHONE_BEGIN_NAMESPACE
|
||||||
|
|
||||||
class EventLogPrivate : public ClonableObjectPrivate {
|
class EventLogPrivate : public ClonableObjectPrivate {
|
||||||
private:
|
private:
|
||||||
EventLog::Type type = EventLog::None;
|
EventLog::Type type = EventLog::NoneEvent;
|
||||||
|
|
||||||
L_DECLARE_PUBLIC(EventLog);
|
L_DECLARE_PUBLIC(EventLog);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -29,22 +29,7 @@ class EventLogPrivate;
|
||||||
|
|
||||||
class LINPHONE_PUBLIC EventLog : public ClonableObject {
|
class LINPHONE_PUBLIC EventLog : public ClonableObject {
|
||||||
public:
|
public:
|
||||||
enum Type {
|
enum Type : int;
|
||||||
None,
|
|
||||||
// MessageEvent.
|
|
||||||
MessageEvent,
|
|
||||||
// CallEvent.
|
|
||||||
CallStartEvent,
|
|
||||||
CallEndEvent,
|
|
||||||
// ConferenceEvent.
|
|
||||||
ConferenceCreatedEvent,
|
|
||||||
ConferenceDestroyedEvent,
|
|
||||||
// ConferenceParticipantEvent.
|
|
||||||
ConferenceParticipantAddedEvent,
|
|
||||||
ConferenceParticipantRemovedEvent,
|
|
||||||
ConferenceParticipantSetAdminEvent,
|
|
||||||
ConferenceParticipantUnsetAdminEvent
|
|
||||||
};
|
|
||||||
|
|
||||||
EventLog ();
|
EventLog ();
|
||||||
EventLog (const EventLog &src);
|
EventLog (const EventLog &src);
|
||||||
|
|
@ -61,6 +46,8 @@ private:
|
||||||
L_DECLARE_PRIVATE(EventLog);
|
L_DECLARE_PRIVATE(EventLog);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#include "event-log-enums.h"
|
||||||
|
|
||||||
LINPHONE_END_NAMESPACE
|
LINPHONE_END_NAMESPACE
|
||||||
|
|
||||||
#endif // ifndef _EVENT_LOG_H_
|
#endif // ifndef _EVENT_LOG_H_
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,14 @@
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
|
|
||||||
#define LINPHONE_NAMESPACE LinphonePrivate
|
#define LINPHONE_NAMESPACE LinphonePrivate
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
#define LINPHONE_BEGIN_NAMESPACE namespace LINPHONE_NAMESPACE {
|
#define LINPHONE_BEGIN_NAMESPACE namespace LINPHONE_NAMESPACE {
|
||||||
#define LINPHONE_END_NAMESPACE }
|
#define LINPHONE_END_NAMESPACE }
|
||||||
|
#else
|
||||||
|
#define LINPHONE_BEGIN_NAMESPACE
|
||||||
|
#define LINPHONE_END_NAMESPACE
|
||||||
|
#endif
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
@ -47,6 +53,12 @@ LINPHONE_BEGIN_NAMESPACE
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
|
||||||
|
#ifndef L_DECLARE_ENUM
|
||||||
|
#define L_DECLARE_ENUM(CLASS, ENUM) enum CLASS::ENUM : int
|
||||||
|
#endif
|
||||||
|
|
||||||
void l_assert (const char *condition, const char *file, int line);
|
void l_assert (const char *condition, const char *file, int line);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
|
@ -117,6 +129,8 @@ inline const Object *getPublicHelper (const T *object, const ObjectPrivate *) {
|
||||||
return *this; \
|
return *this; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
LINPHONE_END_NAMESPACE
|
LINPHONE_END_NAMESPACE
|
||||||
|
|
||||||
#endif // ifndef _GENERAL_H_
|
#endif // ifndef _GENERAL_H_
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue