diff options
author | Zeno Albisser <zeno.albisser@digia.com> | 2013-08-15 21:46:11 +0200 |
---|---|---|
committer | Zeno Albisser <zeno.albisser@digia.com> | 2013-08-15 21:46:11 +0200 |
commit | 679147eead574d186ebf3069647b4c23e8ccace6 (patch) | |
tree | fc247a0ac8ff119f7c8550879ebb6d3dd8d1ff69 /chromium/net/http/http_version.h | |
download | qtwebengine-chromium-679147eead574d186ebf3069647b4c23e8ccace6.tar.gz |
Initial import.
Diffstat (limited to 'chromium/net/http/http_version.h')
-rw-r--r-- | chromium/net/http/http_version.h | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/chromium/net/http/http_version.h b/chromium/net/http/http_version.h new file mode 100644 index 00000000000..127e7115bf9 --- /dev/null +++ b/chromium/net/http/http_version.h @@ -0,0 +1,58 @@ +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef NET_HTTP_HTTP_VERSION_H_ +#define NET_HTTP_HTTP_VERSION_H_ + +#include "base/basictypes.h" + +namespace net { + +// Wrapper for an HTTP (major,minor) version pair. +class HttpVersion { + public: + // Default constructor (major=0, minor=0). + HttpVersion() : value_(0) { } + + // Build from unsigned major/minor pair. + HttpVersion(uint16 major, uint16 minor) : value_(major << 16 | minor) { } + + // Major version number. + uint16 major_value() const { + return value_ >> 16; + } + + // Minor version number. + uint16 minor_value() const { + return value_ & 0xffff; + } + + // Overloaded operators: + + bool operator==(const HttpVersion& v) const { + return value_ == v.value_; + } + bool operator!=(const HttpVersion& v) const { + return value_ != v.value_; + } + bool operator>(const HttpVersion& v) const { + return value_ > v.value_; + } + bool operator>=(const HttpVersion& v) const { + return value_ >= v.value_; + } + bool operator<(const HttpVersion& v) const { + return value_ < v.value_; + } + bool operator<=(const HttpVersion& v) const { + return value_ <= v.value_; + } + + private: + uint32 value_; // Packed as <major>:<minor> +}; + +} // namespace net + +#endif // NET_HTTP_HTTP_VERSION_H_ |