mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-23 14:18:07 +00:00
feat(core): add cpp Address interface
This commit is contained in:
parent
ad493beca7
commit
e69cc32264
4 changed files with 313 additions and 0 deletions
|
|
@ -21,6 +21,7 @@
|
|||
############################################################################
|
||||
|
||||
set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES
|
||||
address/address.h
|
||||
c-wrapper/api/c-event-log.h
|
||||
c-wrapper/c-tools.h
|
||||
c-wrapper/c-types.h
|
||||
|
|
@ -43,6 +44,7 @@ set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES
|
|||
db/provider/db-session-p.h
|
||||
db/provider/db-session-provider.h
|
||||
db/provider/db-session.h
|
||||
enums.h
|
||||
event-log/call-event.h
|
||||
event-log/conference-event-p.h
|
||||
event-log/conference-event.h
|
||||
|
|
@ -66,6 +68,7 @@ set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES
|
|||
)
|
||||
|
||||
set(LINPHONE_CXX_OBJECTS_SOURCE_FILES
|
||||
address/address.cpp
|
||||
c-wrapper/api/c-event-log.cpp
|
||||
chat/chat-room.cpp
|
||||
content/content.cpp
|
||||
|
|
|
|||
182
src/address/address.cpp
Normal file
182
src/address/address.cpp
Normal file
|
|
@ -0,0 +1,182 @@
|
|||
/*
|
||||
* address.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 "object/clonable-object-p.h"
|
||||
|
||||
#include "address.h"
|
||||
|
||||
// =============================================================================
|
||||
|
||||
using namespace std;
|
||||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
class AddressPrivate : public ClonableObjectPrivate {
|
||||
// TODO.
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
Address::Address (const string &address) : ClonableObject(*new AddressPrivate) {
|
||||
// TODO.
|
||||
}
|
||||
|
||||
Address::Address (const Address &src) : ClonableObject(*new AddressPrivate) {
|
||||
// TODO.
|
||||
}
|
||||
|
||||
Address &Address::operator= (const Address &src) {
|
||||
// TODO.
|
||||
return *this;
|
||||
}
|
||||
|
||||
Address::operator bool () const {
|
||||
// TODO.
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Address::operator== (const Address &address) const {
|
||||
// TODO.
|
||||
return false;
|
||||
}
|
||||
|
||||
string Address::getScheme () const {
|
||||
// TODO.
|
||||
return "";
|
||||
}
|
||||
|
||||
string Address::getDisplayName () const {
|
||||
// TODO.
|
||||
return "";
|
||||
}
|
||||
|
||||
bool setDisplayName (const string &displayName) {
|
||||
// TODO.
|
||||
return false;
|
||||
}
|
||||
|
||||
string Address::getUsername () const {
|
||||
// TODO.
|
||||
return "";
|
||||
}
|
||||
|
||||
bool setUsername (const string &username) {
|
||||
// TODO.
|
||||
return false;
|
||||
}
|
||||
|
||||
string Address::getDomain () const {
|
||||
// TODO.
|
||||
return "";
|
||||
}
|
||||
|
||||
bool setDomain (const string &host) {
|
||||
// TODO.
|
||||
return false;
|
||||
}
|
||||
|
||||
int Address::getPort () const {
|
||||
// TODO.
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool Address::setPort (int port) {
|
||||
// TODO.
|
||||
return false;
|
||||
}
|
||||
|
||||
Transport Address::getTransport () const {
|
||||
// TODO.
|
||||
return Transport::Dtls;
|
||||
}
|
||||
|
||||
bool setTransport (Transport transport) {
|
||||
// TODO.
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Address::getSecure () const {
|
||||
// TODO.
|
||||
return false;
|
||||
}
|
||||
|
||||
void Address::setSecure (bool enabled) {
|
||||
// TODO.
|
||||
}
|
||||
|
||||
bool Address::isSip () const {
|
||||
// TODO.
|
||||
return false;
|
||||
}
|
||||
|
||||
string Address::getMethodParam () const {
|
||||
// TODO.
|
||||
return "";
|
||||
}
|
||||
|
||||
void Address::setMethodParam (const string &method) {
|
||||
// TODO.
|
||||
}
|
||||
|
||||
string Address::getPassword () const {
|
||||
// TODO.
|
||||
return "";
|
||||
}
|
||||
|
||||
void Address::setPassword (const string &passwd) {
|
||||
// TODO.
|
||||
}
|
||||
|
||||
void clean () {
|
||||
// TODO.
|
||||
}
|
||||
|
||||
string Address::asString () const {
|
||||
// TODO.
|
||||
return "";
|
||||
}
|
||||
|
||||
string Address::asStringUriOnly () const {
|
||||
// TODO.
|
||||
return "";
|
||||
}
|
||||
|
||||
bool Address::equal (const shared_ptr<const Address> &address) const {
|
||||
// TODO.
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Address::weakEqual (const shared_ptr<const Address> &a2) const {
|
||||
// TODO.
|
||||
return false;
|
||||
}
|
||||
|
||||
string Address::getHeaderValue (const string &headerName) const {
|
||||
// TODO.
|
||||
return "";
|
||||
}
|
||||
|
||||
void addHeader (const string &headerName, const string &headerValue) {
|
||||
// TODO.
|
||||
}
|
||||
|
||||
void removeHeader (const string &headerName) {
|
||||
// TODO.
|
||||
}
|
||||
|
||||
LINPHONE_END_NAMESPACE
|
||||
91
src/address/address.h
Normal file
91
src/address/address.h
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
/*
|
||||
* address.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 _ADDRESS_H_
|
||||
#define _ADDRESS_H_
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "enums.h"
|
||||
#include "object/clonable-object.h"
|
||||
|
||||
// =============================================================================
|
||||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
class AddressPrivate;
|
||||
|
||||
class LINPHONE_PUBLIC Address : public ClonableObject {
|
||||
public:
|
||||
Address (const std::string &address);
|
||||
Address (const Address &src);
|
||||
|
||||
Address &operator= (const Address &src);
|
||||
|
||||
operator bool () const;
|
||||
|
||||
bool operator== (const Address &address) const;
|
||||
|
||||
std::string getScheme () const;
|
||||
|
||||
std::string getDisplayName () const;
|
||||
bool setDisplayName (const std::string &displayName);
|
||||
|
||||
std::string getUsername () const;
|
||||
bool setUsername (const std::string &username);
|
||||
|
||||
std::string getDomain () const;
|
||||
bool setDomain (const std::string &host);
|
||||
|
||||
int getPort () const;
|
||||
bool setPort (int port);
|
||||
|
||||
Transport getTransport () const;
|
||||
bool setTransport (Transport transport);
|
||||
|
||||
bool getSecure () const;
|
||||
void setSecure (bool enabled);
|
||||
|
||||
bool isSip () const;
|
||||
|
||||
std::string getMethodParam () const;
|
||||
void setMethodParam (const std::string &method);
|
||||
|
||||
std::string getPassword () const;
|
||||
void setPassword (const std::string &passwd);
|
||||
|
||||
void clean ();
|
||||
|
||||
std::string asString () const;
|
||||
std::string asStringUriOnly () const;
|
||||
|
||||
bool equal (const std::shared_ptr<const Address> &address) const;
|
||||
bool weakEqual (const std::shared_ptr<const Address> &a2) const;
|
||||
|
||||
std::string getHeaderValue (const std::string &headerName) const;
|
||||
void addHeader (const std::string &headerName, const std::string &headerValue);
|
||||
void removeHeader (const std::string &headerName);
|
||||
|
||||
private:
|
||||
L_DECLARE_PRIVATE(Address);
|
||||
};
|
||||
|
||||
LINPHONE_END_NAMESPACE
|
||||
|
||||
#endif // ifndef _ADDRESS_H_
|
||||
37
src/enums.h
Normal file
37
src/enums.h
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* 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 _ENUMS_H_
|
||||
#define _ENUMS_H_
|
||||
|
||||
#include "utils/general.h"
|
||||
|
||||
// =============================================================================
|
||||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
enum class Transport {
|
||||
Udp,
|
||||
Tcp,
|
||||
Tls,
|
||||
Dtls
|
||||
};
|
||||
|
||||
LINPHONE_END_NAMESPACE
|
||||
|
||||
#endif // ifndef _ENUMS_H_
|
||||
Loading…
Add table
Reference in a new issue