Besides being the Right Thing, this helps classes that have HttpHeader data
members to avoid defining explicit assignment operators.
clean();
}
+const HttpHeader &
+HttpHeader::operator =(const HttpHeader &other)
+{
+ if (this != &other) {
+ // we do not really care, but the caller probably does
+ assert(owner == other.owner);
+ clean();
+ update(&other, NULL); // will update the mask as well
+ len = other.len;
+ }
+ return *this;
+}
+
void
HttpHeader::clean()
{
}
entries.clean();
httpHeaderMaskInit(&mask, 0);
+ len = 0; // TODO: this line was missing for a while; do we need len at all?
PROF_stop(HttpHeaderClean);
}
int
HttpHeader::reset()
{
- http_hdr_owner_type ho;
- ho = owner;
clean();
- *this = HttpHeader(ho);
return 0;
}
HttpHeader();
HttpHeader(http_hdr_owner_type const &owner);
~HttpHeader();
+
+ const HttpHeader &operator =(const HttpHeader &other);
+
/* Interface functions */
void clean();
void append(const HttpHeader * src);
HttpHeaderEntry *findLastEntry(http_hdr_type id) const;
/// Made it non-copyable. Our destructor is a bit nasty...
HttpHeader(const HttpHeader &);
- //assignment is used by the reset method, can't block it..
- //const HttpHeader operator=(const HttpHeader &);
};