Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(159)

Side by Side Diff: net/http/http_byte_range.h

Issue 92006: Implement a parser that parses the "Range" HTTP header... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | net/http/http_byte_range.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef NET_HTTP_HTTP_BYTE_RANGE_H_
6 #define NET_HTTP_HTTP_BYTE_RANGE_H_
7
8 #include "base/basictypes.h"
9
10 namespace net {
11
12 // A container class that represents a "range" specified for range request
13 // specified by RFC 2616 Section 14.35.1.
14 // http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35.1
15 class HttpByteRange {
16 public:
17 HttpByteRange();
18
19 // Since this class is POD, we use constructor, assignment operator
20 // and destructor provided by compiler.
21 int64 first_byte_position() const { return first_byte_position_; }
22 void set_first_byte_position(int64 value) { first_byte_position_ = value; }
23
24 int64 last_byte_position() const { return last_byte_position_; }
25 void set_last_byte_position(int64 value) { last_byte_position_ = value; }
26
27 int64 suffix_length() const { return suffix_length_; }
28 void set_suffix_length(int64 value) { suffix_length_ = value; }
29
30 // Returns true if this is a suffix byte range.
31 bool IsSuffixByteRange() const;
32 // Returns true if the first byte position is specified in this request.
33 bool HasFirstBytePosition() const;
34 // Returns true if the last byte position is specified in this request.
35 bool HasLastBytePosition() const;
36
37 // Returns true if this range is valid.
38 bool IsValid() const;
39
40 // A method that when given the size in bytes of a file, adjust the internal
41 // |first_byte_position_| and |last_byte_position_| values according to the
42 // range specified by this object. If the range specified is invalid with
43 // regard to the size or |size| is negative, returns false and there will be
44 // no side effect.
45 // Returns false if this method is called more than once and there will be
46 // no side effect.
47 bool ComputeBounds(int64 size);
48
49 private:
50 int64 first_byte_position_;
51 int64 last_byte_position_;
52 int64 suffix_length_;
53 bool has_computed_bounds_;
54 };
55
56 } // namespace net
57
58 #endif // NET_HTTP_HTTP_BYTE_RANGE_H_
OLDNEW
« no previous file with comments | « no previous file | net/http/http_byte_range.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698