Skip to content

Commit 2bcbf91

Browse files
committed
make some virtual functions const
Signed-off-by: Rosen Penev <[email protected]>
1 parent ae6cb21 commit 2bcbf91

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/basicio.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -990,7 +990,7 @@ class RemoteIo::Impl {
990990
@return Return -1 if the size is unknown. Otherwise it returns the length of remote file (in bytes).
991991
@throw Error if the server returns the error code.
992992
*/
993-
virtual int64_t getFileLength() = 0;
993+
virtual int64_t getFileLength() const = 0;
994994
/*!
995995
@brief Get the data by range.
996996
@param lowBlock The start block index.
@@ -999,7 +999,7 @@ class RemoteIo::Impl {
999999
@throw Error if the server returns the error code.
10001000
@note Set lowBlock = -1 and highBlock = -1 to get the whole file content.
10011001
*/
1002-
virtual void getDataByRange(size_t lowBlock, size_t highBlock, std::string& response) = 0;
1002+
virtual void getDataByRange(size_t lowBlock, size_t highBlock, std::string& response) const = 0;
10031003
/*!
10041004
@brief Submit the data to the remote machine. The data replace a part of the remote file.
10051005
The replaced part of remote file is indicated by from and to parameters.
@@ -1354,7 +1354,7 @@ class HttpIo::HttpImpl : public Impl {
13541354
@return Return -1 if the size is unknown. Otherwise it returns the length of remote file (in bytes).
13551355
@throw Error if the server returns the error code.
13561356
*/
1357-
int64_t getFileLength() override;
1357+
int64_t getFileLength() const override;
13581358
/*!
13591359
@brief Get the data by range.
13601360
@param lowBlock The start block index.
@@ -1363,7 +1363,7 @@ class HttpIo::HttpImpl : public Impl {
13631363
@throw Error if the server returns the error code.
13641364
@note Set lowBlock = -1 and highBlock = -1 to get the whole file content.
13651365
*/
1366-
void getDataByRange(size_t lowBlock, size_t highBlock, std::string& response) override;
1366+
void getDataByRange(size_t lowBlock, size_t highBlock, std::string& response) const override;
13671367
/*!
13681368
@brief Submit the data to the remote machine. The data replace a part of the remote file.
13691369
The replaced part of remote file is indicated by from and to parameters.
@@ -1385,7 +1385,7 @@ HttpIo::HttpImpl::HttpImpl(const std::string& url, size_t blockSize) : Impl(url,
13851385
Exiv2::Uri::Decode(hostInfo_);
13861386
}
13871387

1388-
int64_t HttpIo::HttpImpl::getFileLength() {
1388+
int64_t HttpIo::HttpImpl::getFileLength() const {
13891389
Exiv2::Dictionary response;
13901390
Exiv2::Dictionary request;
13911391
std::string errors;
@@ -1403,7 +1403,7 @@ int64_t HttpIo::HttpImpl::getFileLength() {
14031403
return (lengthIter == response.end()) ? -1 : std::stoll(lengthIter->second);
14041404
}
14051405

1406-
void HttpIo::HttpImpl::getDataByRange(size_t lowBlock, size_t highBlock, std::string& response) {
1406+
void HttpIo::HttpImpl::getDataByRange(size_t lowBlock, size_t highBlock, std::string& response) const {
14071407
Exiv2::Dictionary responseDic;
14081408
Exiv2::Dictionary request;
14091409
request["server"] = hostInfo_.Host;
@@ -1490,7 +1490,7 @@ class CurlIo::CurlImpl : public Impl {
14901490
@return Return -1 if the size is unknown. Otherwise it returns the length of remote file (in bytes).
14911491
@throw Error if the server returns the error code.
14921492
*/
1493-
int64_t getFileLength() override;
1493+
int64_t getFileLength() const override;
14941494
/*!
14951495
@brief Get the data by range.
14961496
@param lowBlock The start block index.
@@ -1499,7 +1499,7 @@ class CurlIo::CurlImpl : public Impl {
14991499
@throw Error if the server returns the error code.
15001500
@note Set lowBlock = -1 and highBlock = -1 to get the whole file content.
15011501
*/
1502-
void getDataByRange(size_t lowBlock, size_t highBlock, std::string& response) override;
1502+
void getDataByRange(size_t lowBlock, size_t highBlock, std::string& response) const override;
15031503
/*!
15041504
@brief Submit the data to the remote machine. The data replace a part of the remote file.
15051505
The replaced part of remote file is indicated by from and to parameters.
@@ -1536,7 +1536,7 @@ CurlIo::CurlImpl::CurlImpl(const std::string& url, size_t blockSize) :
15361536
}
15371537
}
15381538

1539-
int64_t CurlIo::CurlImpl::getFileLength() {
1539+
int64_t CurlIo::CurlImpl::getFileLength() const {
15401540
curl_easy_reset(curl_.get()); // reset all options
15411541
curl_easy_setopt(curl_.get(), CURLOPT_URL, path_.c_str());
15421542
curl_easy_setopt(curl_.get(), CURLOPT_NOBODY, 1); // HEAD
@@ -1562,7 +1562,7 @@ int64_t CurlIo::CurlImpl::getFileLength() {
15621562
return temp;
15631563
}
15641564

1565-
void CurlIo::CurlImpl::getDataByRange(size_t lowBlock, size_t highBlock, std::string& response) {
1565+
void CurlIo::CurlImpl::getDataByRange(size_t lowBlock, size_t highBlock, std::string& response) const {
15661566
curl_easy_reset(curl_.get()); // reset all options
15671567
curl_easy_setopt(curl_.get(), CURLOPT_URL, path_.c_str());
15681568
curl_easy_setopt(curl_.get(), CURLOPT_NOPROGRESS, 1L); // no progress meter please

0 commit comments

Comments
 (0)