Migrate to C++17 and misc code cleanups
Change-Id: I6b63385c92361a7ef5803d2bfd00f39c77e88d34
diff --git a/src/repo-command.cpp b/src/repo-command.cpp
index 0c1cc21..69d3c9e 100644
--- a/src/repo-command.cpp
+++ b/src/repo-command.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2018, Regents of the University of California.
+/*
+ * Copyright (c) 2014-2022, Regents of the University of California.
*
* This file is part of NDN repo-ng (Next generation of NDN repository).
* See AUTHORS.md for complete list of repo-ng authors and contributors.
@@ -22,7 +22,8 @@
namespace repo {
void
-RepoCommand::validateRequest(const RepoCommandParameter& parameters) {
+RepoCommand::validateRequest(const RepoCommandParameter& parameters)
+{
m_requestValidator.validate(parameters);
check(parameters);
}
@@ -36,11 +37,11 @@
bool isPresent = presentFields[i];
if (m_required[i]) {
if (!isPresent) {
- BOOST_THROW_EXCEPTION(ArgumentError(REPO_PARAMETER_FIELD[i] + " is required but missing"));
+ NDN_THROW(ArgumentError(REPO_PARAMETER_FIELD[i] + " is required but missing"));
}
}
else if (isPresent && !m_optional[i]) {
- BOOST_THROW_EXCEPTION(ArgumentError(REPO_PARAMETER_FIELD[i] + " is forbidden but present"));
+ NDN_THROW(ArgumentError(REPO_PARAMETER_FIELD[i] + " is forbidden but present"));
}
}
}
@@ -52,7 +53,7 @@
}
InsertCommand::InsertCommand()
-: RepoCommand()
+ : RepoCommand()
{
m_requestValidator
.required(REPO_PARAMETER_NAME)
@@ -83,14 +84,14 @@
if (parameters.hasEndBlockId()) {
SegmentNo startBlockId = parameters.getStartBlockId();
SegmentNo endBlockId = parameters.getEndBlockId();
-
if (startBlockId > endBlockId) {
- BOOST_THROW_EXCEPTION(ArgumentError("start block Id is bigger than end block Id"));
+ NDN_THROW(ArgumentError("Start block Id is bigger than end block Id"));
}
}
else {
- BOOST_THROW_EXCEPTION(ArgumentError("Segmented deletion without EndBlockId, not implemented"));
+ NDN_THROW(ArgumentError("Segmented deletion without EndBlockId, not implemented"));
}
}
}
-} // namespace repo
\ No newline at end of file
+
+} // namespace repo