mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-05-07 05:53:06 +00:00
fix(Content): use move function on headers (copy constructor)
This commit is contained in:
parent
607c7d92d1
commit
16558276c0
3 changed files with 15 additions and 16 deletions
|
|
@ -20,9 +20,6 @@
|
|||
#ifndef _L_CONTENT_P_H_
|
||||
#define _L_CONTENT_P_H_
|
||||
|
||||
#include <vector>
|
||||
#include <list>
|
||||
|
||||
#include "content-type.h"
|
||||
#include "content.h"
|
||||
#include "object/clonable-object-p.h"
|
||||
|
|
@ -36,7 +33,7 @@ private:
|
|||
std::vector<char> body;
|
||||
ContentType contentType;
|
||||
std::string contentDisposition;
|
||||
std::list<std::pair<std::string,std::string>> headers;
|
||||
std::list<std::pair<std::string, std::string>> headers;
|
||||
|
||||
L_DECLARE_PUBLIC(Content);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -46,10 +46,11 @@ Content::Content (const Content &other) : ClonableObject(*new ContentPrivate), A
|
|||
|
||||
Content::Content (Content &&other) : ClonableObject(*new ContentPrivate), AppDataContainer(move(other)) {
|
||||
L_D();
|
||||
d->body = move(other.getPrivate()->body);
|
||||
d->contentType = move(other.getPrivate()->contentType);
|
||||
d->contentDisposition = move(other.getPrivate()->contentDisposition);
|
||||
d->headers = other.getHeaders();
|
||||
ContentPrivate *dOther = other.getPrivate();
|
||||
d->body = move(dOther->body);
|
||||
d->contentType = move(dOther->contentType);
|
||||
d->contentDisposition = move(dOther->contentDisposition);
|
||||
d->headers = move(dOther->headers);
|
||||
}
|
||||
|
||||
Content::Content (ContentPrivate &p) : ClonableObject(p) {}
|
||||
|
|
@ -66,10 +67,10 @@ Content::~Content () {
|
|||
Content &Content::operator= (const Content &other) {
|
||||
L_D();
|
||||
if (this != &other) {
|
||||
AppDataContainer::operator=(other);
|
||||
d->body = other.getBody();
|
||||
d->contentType = other.getContentType();
|
||||
d->contentDisposition = other.getContentDisposition();
|
||||
AppDataContainer::operator=(other);
|
||||
d->headers = other.getHeaders();
|
||||
}
|
||||
return *this;
|
||||
|
|
@ -77,11 +78,12 @@ Content &Content::operator= (const Content &other) {
|
|||
|
||||
Content &Content::operator= (Content &&other) {
|
||||
L_D();
|
||||
d->body = move(other.getPrivate()->body);
|
||||
d->contentType = move(other.getPrivate()->contentType);
|
||||
d->contentDisposition = move(other.getPrivate()->contentDisposition);
|
||||
d->headers = other.getHeaders();
|
||||
AppDataContainer::operator=(move(other));
|
||||
ContentPrivate *dOther = other.getPrivate();
|
||||
d->body = move(dOther->body);
|
||||
d->contentType = move(dOther->contentType);
|
||||
d->contentDisposition = move(dOther->contentDisposition);
|
||||
d->headers = move(dOther->headers);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@
|
|||
#ifndef _L_CONTENT_H_
|
||||
#define _L_CONTENT_H_
|
||||
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#include <vector>
|
||||
|
||||
#include "object/app-data-container.h"
|
||||
#include "object/clonable-object.h"
|
||||
|
|
@ -72,10 +72,10 @@ public:
|
|||
|
||||
virtual bool isFile () const;
|
||||
|
||||
const std::list<std::pair<std::string, std::string>> &getHeaders () const;
|
||||
void addHeader (const std::string &headerName, const std::string &headerValue);
|
||||
const std::list<std::pair<std::string,std::string>> &getHeaders () const;
|
||||
void removeHeader (const std::string &headerName);
|
||||
std::list<std::pair<std::string,std::string>>::const_iterator findHeader (const std::string &headerName);
|
||||
std::list<std::pair<std::string, std::string>>::const_iterator findHeader (const std::string &headerName);
|
||||
|
||||
// TODO: Remove me later.
|
||||
virtual LinphoneContent *toLinphoneContent () const;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue