19 #ifndef NET_INSTAWEB_HTTP_PUBLIC_HTTP_VALUE_H_
20 #define NET_INSTAWEB_HTTP_PUBLIC_HTTP_VALUE_H_
24 #include "net/instaweb/util/public/shared_string.h"
28 namespace net_instaweb {
30 class ResponseHeaders;
44 bool Empty()
const {
return storage_.empty(); }
61 virtual bool Write(
const StringPiece& str, MessageHandler* handler);
62 virtual bool Flush(MessageHandler* handler);
65 bool ExtractHeaders(ResponseHeaders* headers, MessageHandler* handler)
const;
73 bool unique()
const {
return storage_.unique(); }
80 bool Link(SharedString* src, ResponseHeaders* headers,
81 MessageHandler* handler);
87 storage_ = src->storage_;
88 contents_size_ = src->contents_size();
93 SharedString*
share() {
return &storage_; }
95 size_t size()
const {
return storage_.size(); }
96 int64 contents_size() {
return contents_size_; }
99 friend class HTTPValueTest;
102 char type_identifier()
const {
return *storage_.data(); }
104 unsigned int SizeOfFirstChunk()
const;
105 void SetSizeOfFirstChunk(
unsigned int size);
106 int64 ComputeContentsSize()
const;
112 SharedString storage_;
114 int64 contents_size_;
116 DISALLOW_COPY_AND_ASSIGN(HTTPValue);
Definition: http_value.h:36
bool Link(SharedString *src, ResponseHeaders *headers, MessageHandler *handler)
bool Empty() const
Is this HTTPValue empty.
Definition: http_value.h:44
SharedString * share()
Access the shared string, for insertion into a cache via Put.
Definition: http_value.h:93
bool ExtractContents(StringPiece *str) const
void Clear()
Clears the value (both headers and content)
bool unique() const
Tests whether this reference is the only active one to the string object.
Definition: http_value.h:73
void SetHeaders(ResponseHeaders *headers)
void Link(HTTPValue *src)
Definition: http_value.h:85
bool ExtractHeaders(ResponseHeaders *headers, MessageHandler *handler) const
Retrieves the headers, returning false if empty.
virtual bool Write(const StringPiece &str, MessageHandler *handler)