Update V8 to version 4.7.53.
[chromium-blink-merge.git] / net / http / http_version.h
blob127e7115bf9966614963d3403b4e570a884a79c4
1 // Copyright (c) 2006-2008 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.
5 #ifndef NET_HTTP_HTTP_VERSION_H_
6 #define NET_HTTP_HTTP_VERSION_H_
8 #include "base/basictypes.h"
10 namespace net {
12 // Wrapper for an HTTP (major,minor) version pair.
13 class HttpVersion {
14 public:
15 // Default constructor (major=0, minor=0).
16 HttpVersion() : value_(0) { }
18 // Build from unsigned major/minor pair.
19 HttpVersion(uint16 major, uint16 minor) : value_(major << 16 | minor) { }
21 // Major version number.
22 uint16 major_value() const {
23 return value_ >> 16;
26 // Minor version number.
27 uint16 minor_value() const {
28 return value_ & 0xffff;
31 // Overloaded operators:
33 bool operator==(const HttpVersion& v) const {
34 return value_ == v.value_;
36 bool operator!=(const HttpVersion& v) const {
37 return value_ != v.value_;
39 bool operator>(const HttpVersion& v) const {
40 return value_ > v.value_;
42 bool operator>=(const HttpVersion& v) const {
43 return value_ >= v.value_;
45 bool operator<(const HttpVersion& v) const {
46 return value_ < v.value_;
48 bool operator<=(const HttpVersion& v) const {
49 return value_ <= v.value_;
52 private:
53 uint32 value_; // Packed as <major>:<minor>
56 } // namespace net
58 #endif // NET_HTTP_HTTP_VERSION_H_