/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
OptionsAssigner::Impl::Impl(Options *options)
: options_(*options), bAcceptBooleanNoPrefix_(false),
- currentOption_(NULL), currentValueCount_(0), reverseBoolean_(false)
+ currentOption_(nullptr), currentValueCount_(0), reverseBoolean_(false)
{
sectionStack_.push_back(&options_.impl_->rootSection_);
}
AbstractOptionStorage *
OptionsAssigner::Impl::findOption(const char *name)
{
- GMX_RELEASE_ASSERT(currentOption_ == NULL,
+ GMX_RELEASE_ASSERT(currentOption_ == nullptr,
"Cannot search for another option while processing one");
const Section §ion = currentSection();
AbstractOptionStorage *option = section.findOption(name);
- if (option == NULL && bAcceptBooleanNoPrefix_)
+ if (option == nullptr && bAcceptBooleanNoPrefix_)
{
if (name[0] == 'n' && name[1] == 'o')
{
option = section.findOption(name + 2);
- if (option != NULL && option->isBoolean())
+ if (option != nullptr && option->isBoolean())
{
reverseBoolean_ = true;
}
else
{
- option = NULL;
+ option = nullptr;
}
}
}
void OptionsAssigner::startSection(const char *name)
{
Impl::Section *section = impl_->currentSection().findSection(name);
- if (section == NULL)
+ if (section == nullptr)
{
GMX_THROW(InvalidInputError("Unknown subsection"));
}
bool OptionsAssigner::tryStartOption(const char *name)
{
- GMX_RELEASE_ASSERT(impl_->currentOption_ == NULL, "finishOption() not called");
+ GMX_RELEASE_ASSERT(impl_->currentOption_ == nullptr, "finishOption() not called");
AbstractOptionStorage *option = impl_->findOption(name);
- if (option == NULL)
+ if (option == nullptr)
{
return false;
}
void OptionsAssigner::appendValue(const Variant &value)
{
AbstractOptionStorage *option = impl_->currentOption_;
- GMX_RELEASE_ASSERT(option != NULL, "startOption() not called");
+ GMX_RELEASE_ASSERT(option != nullptr, "startOption() not called");
++impl_->currentValueCount_;
option->appendValue(value);
}
void OptionsAssigner::finishOption()
{
AbstractOptionStorage *option = impl_->currentOption_;
- GMX_RELEASE_ASSERT(option != NULL, "startOption() not called");
+ GMX_RELEASE_ASSERT(option != nullptr, "startOption() not called");
bool bBoolReverseValue = false;
if (option->isBoolean())
{
bBoolReverseValue = true;
}
}
- impl_->currentOption_ = NULL;
+ impl_->currentOption_ = nullptr;
impl_->reverseBoolean_ = false;
option->finishSet();
if (bBoolReverseValue)
void OptionsAssigner::finish()
{
- GMX_RELEASE_ASSERT(impl_->currentOption_ == NULL, "finishOption() not called");
+ GMX_RELEASE_ASSERT(impl_->currentOption_ == nullptr, "finishOption() not called");
GMX_RELEASE_ASSERT(!impl_->inSection(), "finishSection() not called");
}