From f3e79c6b4cca34d2dac50fbd1376d3348a4c8691 Mon Sep 17 00:00:00 2001 From: Veloman Yunkan Date: Mon, 25 May 2020 16:43:44 +0400 Subject: [PATCH] Introduced src/server/byte_range.cpp --- src/meson.build | 1 + src/server/byte_range.cpp | 37 +++++++++++++++++++++++++++++++++++++ src/server/byte_range.h | 11 ++++------- 3 files changed, 42 insertions(+), 7 deletions(-) create mode 100644 src/server/byte_range.cpp diff --git a/src/meson.build b/src/meson.build index 411f14f28..ddb188119 100644 --- a/src/meson.build +++ b/src/meson.build @@ -21,6 +21,7 @@ kiwix_sources = [ 'tools/otherTools.cpp', 'kiwixserve.cpp', 'name_mapper.cpp', + 'server/byte_range.cpp', 'server/etag.cpp', 'server/request_context.cpp', 'server/response.cpp' diff --git a/src/server/byte_range.cpp b/src/server/byte_range.cpp new file mode 100644 index 000000000..5b3c98b2e --- /dev/null +++ b/src/server/byte_range.cpp @@ -0,0 +1,37 @@ +/* + * Copyright 2020 Veloman Yunkan + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + */ + + +#include "byte_range.h" + +namespace kiwix { + +ByteRange::ByteRange() + : kind_(NONE) + , first_(0) + , last_(-1) +{} + +ByteRange::ByteRange(Kind kind, int64_t first, int64_t last) + : kind_(kind) + , first_(first) + , last_(last) +{} + +} // namespace kiwix diff --git a/src/server/byte_range.h b/src/server/byte_range.h index b9719d8b9..4df6bd93c 100644 --- a/src/server/byte_range.h +++ b/src/server/byte_range.h @@ -21,6 +21,8 @@ #ifndef KIWIXLIB_SERVER_BYTE_RANGE_H #define KIWIXLIB_SERVER_BYTE_RANGE_H +#include + namespace kiwix { class ByteRange @@ -41,13 +43,8 @@ class ByteRange }; public: // functions - ByteRange() : kind_(NONE), first_(0), last_(-1) {} - - ByteRange(Kind kind, int64_t first, int64_t last) - : kind_(kind) - , first_(first) - , last_(last) - {} + ByteRange(); + ByteRange(Kind kind, int64_t first, int64_t last); Kind kind() const { return kind_; } int64_t first() const { return first_; }