Remove (part of) underscore-prefixed C++ symbols.
authorTeemu Murtola <teemu.murtola@gmail.com>
Sat, 9 Jun 2012 05:27:03 +0000 (08:27 +0300)
committerTeemu Murtola <teemu.murtola@gmail.com>
Wed, 20 Jun 2012 17:52:34 +0000 (20:52 +0300)
This commit is mostly the result of (using GNU sed syntax)
  sed -i -re 's/\<_([a-zA-Z]+)\>/\1_/g'
on the affected files. Some additional manual renaming was done.
optionsassigner.cpp was manually edited a bit more to update comments
and to remove unnecessary use of bit flags.
Also added a few 'explicit' keywords to constructors.

selection/ and trajectoryanalysis/ directories still contain a lot of
these, but this commit is large enough as it stands.

Change-Id: I7f4bf42ec5d9d762fefcff289e38b6b6b231b82b

31 files changed:
src/gromacs/analysisdata/abstractdata.cpp
src/gromacs/analysisdata/abstractdata.h
src/gromacs/analysisdata/arraydata.cpp
src/gromacs/analysisdata/arraydata.h
src/gromacs/analysisdata/dataproxy.cpp
src/gromacs/analysisdata/dataproxy.h
src/gromacs/analysisdata/modules/plot.cpp
src/gromacs/analysisdata/modules/plot.h
src/gromacs/commandline/cmdlineparser.cpp
src/gromacs/commandline/cmdlineparser.h
src/gromacs/commandline/tests/cmdlineparser.cpp
src/gromacs/options/abstractoption.cpp
src/gromacs/options/abstractoption.h
src/gromacs/options/abstractoptionstorage.h
src/gromacs/options/basicoptions.cpp
src/gromacs/options/basicoptions.h
src/gromacs/options/basicoptionstorage.h
src/gromacs/options/options-impl.h
src/gromacs/options/options.cpp
src/gromacs/options/options.h
src/gromacs/options/optionsassigner.cpp
src/gromacs/options/optionsassigner.h
src/gromacs/options/optionstoragetemplate.h
src/gromacs/options/optionsvisitor.cpp
src/gromacs/options/optionsvisitor.h
src/gromacs/options/tests/abstractoptionstorage.cpp
src/gromacs/selection/selectionoption.cpp
src/gromacs/selection/selectionoption.h
src/gromacs/utility/flags.h
src/testutils/refdata.cpp
src/testutils/refdata.h

index 997df29c6e48fdf4cd3e1daa44d0960c96480a3a..d9c28126f4e17c1b2d9acb27ad0d8305c9fe8f2f 100644 (file)
@@ -87,28 +87,28 @@ class AbstractAnalysisData::Impl
                          AnalysisDataModuleInterface *module);
 
         //! List of modules added to the data.
-        ModuleList              _modules;
+        ModuleList              modules_;
         //! true if all modules support missing data.
-        bool                    _bAllowMissing;
+        bool                    bAllowMissing_;
         //! Whether notifyDataStart() has been called.
-        mutable bool            _bDataStart;
+        mutable bool            bDataStart_;
         //! Whether new data is being added.
-        mutable bool            _bInData;
+        mutable bool            bInData_;
         //! Whether data for a frame is being added.
-        mutable bool            _bInFrame;
+        mutable bool            bInFrame_;
         //! Index of the currently active frame.
-        mutable int             _currIndex;
+        mutable int             currIndex_;
         /*! \brief
          * Total number of frames in the data.
          *
          * The counter is incremented in notifyFrameFinish().
          */
-        int                     _nframes;
+        int                     nframes_;
 };
 
 AbstractAnalysisData::Impl::Impl()
-    : _bAllowMissing(true), _bDataStart(false), _bInData(false), _bInFrame(false),
-      _currIndex(-1), _nframes(0)
+    : bAllowMissing_(true), bDataStart_(false), bInData_(false), bInFrame_(false),
+      currIndex_(-1), nframes_(0)
 {
 }
 
@@ -117,7 +117,7 @@ AbstractAnalysisData::Impl::presentData(AbstractAnalysisData *data,
                                         AnalysisDataModuleInterface *module)
 {
     module->dataStarted(data);
-    bool bCheckMissing = _bAllowMissing
+    bool bCheckMissing = bAllowMissing_
         && !(module->flags() & AnalysisDataModuleInterface::efAllowMissing);
     for (int i = 0; i < data->frameCount(); ++i)
     {
@@ -133,7 +133,7 @@ AbstractAnalysisData::Impl::presentData(AbstractAnalysisData *data,
         module->pointsAdded(frame.points());
         module->frameFinished(frame.header());
     }
-    if (!_bInData)
+    if (!bInData_)
     {
         module->dataFinished();
     }
@@ -145,7 +145,7 @@ AbstractAnalysisData::Impl::presentData(AbstractAnalysisData *data,
  */
 /*! \cond libapi */
 AbstractAnalysisData::AbstractAnalysisData()
-    : _impl(new Impl()), _ncol(0), _bMultiPoint(false)
+    : impl_(new Impl()), columnCount_(0), bMultiPoint_(false)
 {
 }
 //! \endcond
@@ -158,7 +158,7 @@ AbstractAnalysisData::~AbstractAnalysisData()
 int
 AbstractAnalysisData::frameCount() const
 {
-    return _impl->_nframes;
+    return impl_->nframes_;
 }
 
 
@@ -207,17 +207,17 @@ AbstractAnalysisData::addModule(AnalysisDataModulePointer module)
         GMX_THROW(APIError("Data module not compatible with data object properties"));
     }
 
-    if (_impl->_bDataStart)
+    if (impl_->bDataStart_)
     {
-        GMX_RELEASE_ASSERT(!_impl->_bInFrame,
+        GMX_RELEASE_ASSERT(!impl_->bInFrame_,
                            "Cannot add data modules in mid-frame");
-        _impl->presentData(this, module.get());
+        impl_->presentData(this, module.get());
     }
     if (!(module->flags() & AnalysisDataModuleInterface::efAllowMissing))
     {
-        _impl->_bAllowMissing = false;
+        impl_->bAllowMissing_ = false;
     }
-    _impl->_modules.push_back(module);
+    impl_->modules_.push_back(module);
 }
 
 
@@ -225,9 +225,9 @@ void
 AbstractAnalysisData::addColumnModule(int col, int span,
                                       AnalysisDataModulePointer module)
 {
-    GMX_RELEASE_ASSERT(col >= 0 && span >= 1 && col + span <= _ncol,
+    GMX_RELEASE_ASSERT(col >= 0 && span >= 1 && col + span <= columnCount_,
                        "Invalid columns specified for a column module");
-    if (_impl->_bDataStart)
+    if (impl_->bDataStart_)
     {
         GMX_THROW(NotImplementedError("Cannot add column modules after data"));
     }
@@ -248,33 +248,33 @@ AbstractAnalysisData::applyModule(AnalysisDataModuleInterface *module)
     {
         GMX_THROW(APIError("Data module not compatible with data object properties"));
     }
-    GMX_RELEASE_ASSERT(_impl->_bDataStart && !_impl->_bInData,
+    GMX_RELEASE_ASSERT(impl_->bDataStart_ && !impl_->bInData_,
                        "Data module can only be applied to ready data");
 
-    _impl->presentData(this, module);
+    impl_->presentData(this, module);
 }
 
 /*! \cond libapi */
 void
-AbstractAnalysisData::setColumnCount(int ncol)
+AbstractAnalysisData::setColumnCount(int columnCount)
 {
-    GMX_RELEASE_ASSERT(ncol > 0, "Invalid data column count");
-    GMX_RELEASE_ASSERT(_ncol == 0 || _impl->_modules.empty(),
+    GMX_RELEASE_ASSERT(columnCount > 0, "Invalid data column count");
+    GMX_RELEASE_ASSERT(columnCount_ == 0 || impl_->modules_.empty(),
                        "Data column count cannot be changed after modules are added");
-    GMX_RELEASE_ASSERT(!_impl->_bDataStart,
+    GMX_RELEASE_ASSERT(!impl_->bDataStart_,
                        "Data column count cannot be changed after data has been added");
-    _ncol = ncol;
+    columnCount_ = columnCount;
 }
 
 
 void
 AbstractAnalysisData::setMultipoint(bool multipoint)
 {
-    GMX_RELEASE_ASSERT(_impl->_modules.empty(),
+    GMX_RELEASE_ASSERT(impl_->modules_.empty(),
                        "Data type cannot be changed after modules are added");
-    GMX_RELEASE_ASSERT(!_impl->_bDataStart,
+    GMX_RELEASE_ASSERT(!impl_->bDataStart_,
                        "Data type cannot be changed after data has been added");
-    _bMultiPoint = multipoint;
+    bMultiPoint_ = multipoint;
 }
 
 
@@ -285,15 +285,15 @@ AbstractAnalysisData::setMultipoint(bool multipoint)
 void
 AbstractAnalysisData::notifyDataStart()
 {
-    GMX_RELEASE_ASSERT(!_impl->_bDataStart,
+    GMX_RELEASE_ASSERT(!impl_->bDataStart_,
                        "notifyDataStart() called more than once");
-    GMX_RELEASE_ASSERT(_ncol > 0, "Data column count is not set");
-    _impl->_bDataStart = _impl->_bInData = true;
+    GMX_RELEASE_ASSERT(columnCount_ > 0, "Data column count is not set");
+    impl_->bDataStart_ = impl_->bInData_ = true;
 
     Impl::ModuleList::const_iterator i;
-    for (i = _impl->_modules.begin(); i != _impl->_modules.end(); ++i)
+    for (i = impl_->modules_.begin(); i != impl_->modules_.end(); ++i)
     {
-        if (_ncol > 1 && !((*i)->flags() & AnalysisDataModuleInterface::efAllowMulticolumn))
+        if (columnCount_ > 1 && !((*i)->flags() & AnalysisDataModuleInterface::efAllowMulticolumn))
         {
             GMX_THROW(APIError("Data module not compatible with data object properties"));
         }
@@ -305,16 +305,16 @@ AbstractAnalysisData::notifyDataStart()
 void
 AbstractAnalysisData::notifyFrameStart(const AnalysisDataFrameHeader &header) const
 {
-    GMX_ASSERT(_impl->_bInData, "notifyDataStart() not called");
-    GMX_ASSERT(!_impl->_bInFrame,
+    GMX_ASSERT(impl_->bInData_, "notifyDataStart() not called");
+    GMX_ASSERT(!impl_->bInFrame_,
                "notifyFrameStart() called while inside a frame");
-    GMX_ASSERT(header.index() == _impl->_nframes,
+    GMX_ASSERT(header.index() == impl_->nframes_,
                "Out of order frames");
-    _impl->_bInFrame = true;
-    _impl->_currIndex = header.index();
+    impl_->bInFrame_ = true;
+    impl_->currIndex_ = header.index();
 
     Impl::ModuleList::const_iterator i;
-    for (i = _impl->_modules.begin(); i != _impl->_modules.end(); ++i)
+    for (i = impl_->modules_.begin(); i != impl_->modules_.end(); ++i)
     {
         (*i)->frameStarted(header);
     }
@@ -324,18 +324,18 @@ AbstractAnalysisData::notifyFrameStart(const AnalysisDataFrameHeader &header) co
 void
 AbstractAnalysisData::notifyPointsAdd(const AnalysisDataPointSetRef &points) const
 {
-    GMX_ASSERT(_impl->_bInData, "notifyDataStart() not called");
-    GMX_ASSERT(_impl->_bInFrame, "notifyFrameStart() not called");
+    GMX_ASSERT(impl_->bInData_, "notifyDataStart() not called");
+    GMX_ASSERT(impl_->bInFrame_, "notifyFrameStart() not called");
     GMX_ASSERT(points.lastColumn() < columnCount(), "Invalid columns");
-    GMX_ASSERT(points.frameIndex() == _impl->_currIndex,
+    GMX_ASSERT(points.frameIndex() == impl_->currIndex_,
                "Points do not correspond to current frame");
-    if (!_impl->_bAllowMissing && !points.allPresent())
+    if (!impl_->bAllowMissing_ && !points.allPresent())
     {
         GMX_THROW(APIError("Missing data not supported by a module"));
     }
 
     Impl::ModuleList::const_iterator i;
-    for (i = _impl->_modules.begin(); i != _impl->_modules.end(); ++i)
+    for (i = impl_->modules_.begin(); i != impl_->modules_.end(); ++i)
     {
         (*i)->pointsAdded(points);
     }
@@ -345,19 +345,19 @@ AbstractAnalysisData::notifyPointsAdd(const AnalysisDataPointSetRef &points) con
 void
 AbstractAnalysisData::notifyFrameFinish(const AnalysisDataFrameHeader &header)
 {
-    GMX_ASSERT(_impl->_bInData, "notifyDataStart() not called");
-    GMX_ASSERT(_impl->_bInFrame, "notifyFrameStart() not called");
-    GMX_ASSERT(header.index() == _impl->_currIndex,
+    GMX_ASSERT(impl_->bInData_, "notifyDataStart() not called");
+    GMX_ASSERT(impl_->bInFrame_, "notifyFrameStart() not called");
+    GMX_ASSERT(header.index() == impl_->currIndex_,
                "Header does not correspond to current frame");
-    _impl->_bInFrame = false;
-    _impl->_currIndex = -1;
+    impl_->bInFrame_ = false;
+    impl_->currIndex_ = -1;
 
     // Increment the counter before notifications to allow frame access from
     // modules.
-    ++_impl->_nframes;
+    ++impl_->nframes_;
 
     Impl::ModuleList::const_iterator i;
-    for (i = _impl->_modules.begin(); i != _impl->_modules.end(); ++i)
+    for (i = impl_->modules_.begin(); i != impl_->modules_.end(); ++i)
     {
         (*i)->frameFinished(header);
     }
@@ -367,13 +367,13 @@ AbstractAnalysisData::notifyFrameFinish(const AnalysisDataFrameHeader &header)
 void
 AbstractAnalysisData::notifyDataFinish() const
 {
-    GMX_RELEASE_ASSERT(_impl->_bInData, "notifyDataStart() not called");
-    GMX_RELEASE_ASSERT(!_impl->_bInFrame,
+    GMX_RELEASE_ASSERT(impl_->bInData_, "notifyDataStart() not called");
+    GMX_RELEASE_ASSERT(!impl_->bInFrame_,
                        "notifyDataFinish() called while inside a frame");
-    _impl->_bInData = false;
+    impl_->bInData_ = false;
 
     Impl::ModuleList::const_iterator i;
-    for (i = _impl->_modules.begin(); i != _impl->_modules.end(); ++i)
+    for (i = impl_->modules_.begin(); i != impl_->modules_.end(); ++i)
     {
         (*i)->dataFinished();
     }
index cb4e4cf0c10ea315d40b3db643f8e395db7c98ef..6c8ff7ee44c52c0b7f9a8dc12404c795c4620908 100644 (file)
@@ -131,7 +131,7 @@ class AbstractAnalysisData
          *
          * Does not throw.
          */
-        bool isMultipoint() const { return _bMultiPoint; }
+        bool isMultipoint() const { return bMultiPoint_; }
         /*! \brief
          * Returns the number of columns in the data.
          *
@@ -148,7 +148,7 @@ class AbstractAnalysisData
          *
          * Does not throw.
          */
-        int columnCount() const { return _ncol; }
+        int columnCount() const { return columnCount_; }
         /*! \brief
          * Returns the total number of frames in the data.
          *
@@ -270,7 +270,7 @@ class AbstractAnalysisData
         /*! \brief
          * Sets the number of columns.
          *
-         * \param[in] ncol  Number of columns in the data (must be > 0).
+         * \param[in] columnCount  Number of columns in the data (must be > 0).
          *
          * Can be called only before notifyDataStart(), otherwise asserts.
          * Multiple calls are only allowed if all of them occur before
@@ -286,7 +286,7 @@ class AbstractAnalysisData
          *
          * \see columnCount()
          */
-        void setColumnCount(int ncol);
+        void setColumnCount(int columnCount);
         /*! \brief
          * Sets whether the data has multiple points per column in a frame.
          *
@@ -415,9 +415,9 @@ class AbstractAnalysisData
     private:
         class Impl;
 
-        PrivateImplPointer<Impl> _impl;
-        int                     _ncol;
-        bool                    _bMultiPoint;
+        PrivateImplPointer<Impl> impl_;
+        int                     columnCount_;
+        bool                    bMultiPoint_;
 
         /*! \brief
          * Needed to provide access to notification methods.
index 30326e9ab9ef859fbe723329624b4c0abf6f5930..edf0e4b28248de3b37c63bfc7bcb9a69dda2642e 100644 (file)
@@ -47,7 +47,7 @@ namespace gmx
 {
 
 AbstractAnalysisArrayData::AbstractAnalysisArrayData()
-    : _nrows(0), _xstart(0.0), _xstep(1.0), _bReady(false)
+    : rowCount_(0), xstart_(0.0), xstep_(1.0), bReady_(false)
 {
 }
 
@@ -64,7 +64,7 @@ AbstractAnalysisArrayData::tryGetDataFrameInternal(int index) const
         return AnalysisDataFrameRef();
     }
     std::vector<AnalysisDataValue>::const_iterator begin
-        = _value.begin() + index * columnCount();
+        = value_.begin() + index * columnCount();
     return AnalysisDataFrameRef(
                 AnalysisDataFrameHeader(index, xvalue(index), 0.0),
                 AnalysisDataValuesRef(begin, begin + columnCount()));
@@ -88,12 +88,12 @@ AbstractAnalysisArrayData::setColumnCount(int ncols)
 
 
 void
-AbstractAnalysisArrayData::setRowCount(int nrows)
+AbstractAnalysisArrayData::setRowCount(int rowCount)
 {
-    GMX_RELEASE_ASSERT(nrows > 0, "Invalid number of rows");
+    GMX_RELEASE_ASSERT(rowCount > 0, "Invalid number of rows");
     GMX_RELEASE_ASSERT(!isAllocated(),
                        "Cannot change row count after data has been allocated");
-    _nrows = nrows;
+    rowCount_ = rowCount;
 }
 
 
@@ -103,9 +103,9 @@ AbstractAnalysisArrayData::allocateValues()
     GMX_RELEASE_ASSERT(!isAllocated(), "Can only allocate values once");
     GMX_RELEASE_ASSERT(rowCount() > 0 && columnCount() > 0,
                        "Row and column counts must be set before allocating values");
-    _value.resize(rowCount() * columnCount());
+    value_.resize(rowCount() * columnCount());
     std::vector<AnalysisDataValue>::iterator i;
-    for (i = _value.begin(); i != _value.end(); ++i)
+    for (i = value_.begin(); i != value_.end(); ++i)
     {
         i->setValue(0.0);
     }
@@ -115,9 +115,9 @@ AbstractAnalysisArrayData::allocateValues()
 void
 AbstractAnalysisArrayData::setXAxis(real start, real step)
 {
-    GMX_RELEASE_ASSERT(!_bReady, "X axis cannot be set after data is finished");
-    _xstart = start;
-    _xstep = step;
+    GMX_RELEASE_ASSERT(!bReady_, "X axis cannot be set after data is finished");
+    xstart_ = start;
+    xstep_ = step;
 }
 
 
@@ -125,13 +125,13 @@ void
 AbstractAnalysisArrayData::valuesReady()
 {
     GMX_RELEASE_ASSERT(isAllocated(), "There must be some data");
-    if (_bReady)
+    if (bReady_)
     {
         return;
     }
-    _bReady = true;
+    bReady_ = true;
 
-    std::vector<AnalysisDataValue>::const_iterator valueIter = _value.begin();
+    std::vector<AnalysisDataValue>::const_iterator valueIter = value_.begin();
     notifyDataStart();
     for (int i = 0; i < rowCount(); ++i, valueIter += columnCount())
     {
@@ -157,7 +157,7 @@ AbstractAnalysisArrayData::copyContents(const AbstractAnalysisArrayData *src,
     dest->setRowCount(src->rowCount());
     dest->allocateValues();
     dest->setXAxis(src->xstart(), src->xstep());
-    std::copy(src->_value.begin(), src->_value.end(), dest->_value.begin());
+    std::copy(src->value_.begin(), src->value_.end(), dest->value_.begin());
 }
 
 } // namespace gmx
index cc336b2031cef0002c1bd012afeebf6b5f6aa170..1c46fad609e73c55ec569118768d5b0fcb4df10c 100644 (file)
@@ -78,13 +78,13 @@ class AbstractAnalysisArrayData : public AbstractAnalysisData
          * This function is identical to frameCount(), except that frameCount()
          * returns 0 before valuesReady() has been called.
          */
-        int rowCount() const { return _nrows; }
+        int rowCount() const { return rowCount_; }
         //! Returns true if values have been allocated.
-        bool isAllocated() const { return !_value.empty(); }
+        bool isAllocated() const { return !value_.empty(); }
         //! Returns the x value of the first frame.
-        real xstart() const { return _xstart; }
+        real xstart() const { return xstart_; }
         //! Returns the step between frame x values.
-        real xstep() const { return _xstep; }
+        real xstep() const { return xstep_; }
         //! Returns the x value of a row.
         real xvalue(int row) const
         {
@@ -97,7 +97,7 @@ class AbstractAnalysisArrayData : public AbstractAnalysisData
             GMX_ASSERT(row >= 0 && row < rowCount(), "Row index out of range");
             GMX_ASSERT(col >= 0 && col < columnCount(), "Column index out of range");
             GMX_ASSERT(isAllocated(), "Data array not allocated");
-            return _value[row * columnCount() + col].value();
+            return value_[row * columnCount() + col].value();
         }
 
     protected:
@@ -121,13 +121,13 @@ class AbstractAnalysisArrayData : public AbstractAnalysisData
         /*! \brief
          * Sets the number of rows in the data array.
          *
-         * \param[in] nrows  Number of rows in the data.
+         * \param[in] rowCount  Number of rows in the data.
          *
          * Cannot be called after allocateValues().
          *
          * Does not throw.
          */
-        void setRowCount(int nrows);
+        void setRowCount(int rowCount);
         /*! \brief
          * Allocates memory for the values.
          *
@@ -155,7 +155,7 @@ class AbstractAnalysisArrayData : public AbstractAnalysisData
             GMX_ASSERT(row >= 0 && row < rowCount(), "Row index out of range");
             GMX_ASSERT(col >= 0 && col < columnCount(), "Column index out of range");
             GMX_ASSERT(isAllocated(), "Data array not allocated");
-            return _value[row * columnCount() + col].value();
+            return value_[row * columnCount() + col].value();
         }
         /*! \brief
          * Sets the value of an element in the array.
@@ -198,11 +198,11 @@ class AbstractAnalysisArrayData : public AbstractAnalysisData
         virtual AnalysisDataFrameRef tryGetDataFrameInternal(int index) const;
         virtual bool requestStorageInternal(int nframes);
 
-        int                  _nrows;
-        std::vector<AnalysisDataValue> _value;
-        real                 _xstart;
-        real                 _xstep;
-        bool                 _bReady;
+        int                  rowCount_;
+        std::vector<AnalysisDataValue> value_;
+        real                 xstart_;
+        real                 xstep_;
+        bool                 bReady_;
 
         // Copy and assign disallowed by base.
 };
index c46e446a1206c5b589a2336667cd8ae3af43fd73..8178355081030c3f2066f68d8298408fddb5d027 100644 (file)
 namespace gmx
 {
 
-AnalysisDataProxy::AnalysisDataProxy(int col, int span,
+AnalysisDataProxy::AnalysisDataProxy(int firstColumn, int columnSpan,
                                      AbstractAnalysisData *data)
-    : _source(*data), _col(col), _span(span)
+    : source_(*data), firstColumn_(firstColumn), columnSpan_(columnSpan)
 {
     GMX_RELEASE_ASSERT(data, "Source data must not be NULL");
-    GMX_RELEASE_ASSERT(col >= 0 && span > 0, "Invalid proxy column");
-    setColumnCount(span);
-    setMultipoint(_source.isMultipoint());
+    GMX_RELEASE_ASSERT(firstColumn >= 0 && columnSpan > 0, "Invalid proxy column");
+    setColumnCount(columnSpan);
+    setMultipoint(source_.isMultipoint());
 }
 
 
 AnalysisDataFrameRef
 AnalysisDataProxy::tryGetDataFrameInternal(int index) const
 {
-    AnalysisDataFrameRef frame = _source.tryGetDataFrame(index);
+    AnalysisDataFrameRef frame = source_.tryGetDataFrame(index);
     if (!frame.isValid())
     {
         return AnalysisDataFrameRef();
     }
-    return AnalysisDataFrameRef(frame, _col, _span);
+    return AnalysisDataFrameRef(frame, firstColumn_, columnSpan_);
 }
 
 
 bool
 AnalysisDataProxy::requestStorageInternal(int nframes)
 {
-    return _source.requestStorage(nframes);
+    return source_.requestStorage(nframes);
 }
 
 
@@ -83,8 +83,8 @@ AnalysisDataProxy::flags() const
 void
 AnalysisDataProxy::dataStarted(AbstractAnalysisData *data)
 {
-    GMX_RELEASE_ASSERT(data == &_source, "Source data mismatch");
-    GMX_RELEASE_ASSERT(_col + _span <= _source.columnCount(),
+    GMX_RELEASE_ASSERT(data == &source_, "Source data mismatch");
+    GMX_RELEASE_ASSERT(firstColumn_ + columnSpan_ <= source_.columnCount(),
                        "Invalid column(s) specified");
     notifyDataStart();
 }
@@ -100,7 +100,7 @@ AnalysisDataProxy::frameStarted(const AnalysisDataFrameHeader &frame)
 void
 AnalysisDataProxy::pointsAdded(const AnalysisDataPointSetRef &points)
 {
-    AnalysisDataPointSetRef columns(points, _col, _span);
+    AnalysisDataPointSetRef columns(points, firstColumn_, columnSpan_);
     if (columns.columnCount() > 0)
     {
         notifyPointsAdd(columns);
index 2ab1c277ff52c5b38cc930156378402ed3e1ffd0..7ea90261825bcf1fcdf33a73ef4213f626a169c2 100644 (file)
@@ -66,13 +66,14 @@ class AnalysisDataProxy : public AbstractAnalysisData,
         /*! \brief
          * Creates a proxy object that only presents certain columns.
          *
-         * \param[in] col   First column to present.
-         * \param[in] span  Number of columns to present.
-         * \param[in] data  Data object that should be wrapped.
+         * \param[in] firstColumn  First column to present.
+         * \param[in] columnSpan   Number of columns to present.
+         * \param[in] data         Data object that should be wrapped.
          *
          * Does not throw.
          */
-        AnalysisDataProxy(int col, int span, AbstractAnalysisData *data);
+        AnalysisDataProxy(int firstColumn, int columnSpan,
+                          AbstractAnalysisData *data);
 
         virtual int flags() const;
 
@@ -86,9 +87,9 @@ class AnalysisDataProxy : public AbstractAnalysisData,
         virtual AnalysisDataFrameRef tryGetDataFrameInternal(int index) const;
         virtual bool requestStorageInternal(int nframes);
 
-        AbstractAnalysisData   &_source;
-        int                     _col;
-        int                     _span;
+        AbstractAnalysisData   &source_;
+        int                     firstColumn_;
+        int                     columnSpan_;
 
         // Copy and assign disallowed by base.
 };
index f6e4fb5e43f47fb1efdd8f56a09502e624fbf821..0e1938251345476f791036670892922d1ca7b19e 100644 (file)
@@ -108,27 +108,28 @@ class AbstractPlotModule::Impl
 
         void closeFile();
 
-        AnalysisDataPlotSettings settings;
-        std::string             fnm;
-        FILE                   *fp;
-
-        bool                    bPlain;
-        bool                    bOmitX;
-        std::string             title;
-        std::string             subtitle;
-        std::string             xlabel;
-        std::string             ylabel;
-        std::vector<std::string>  leg;
-        char                    xfmt[15];
-        char                    yfmt[15];
-        real                    xscale;
+        AnalysisDataPlotSettings settings_;
+        std::string             filename_;
+        FILE                   *fp_;
+
+        bool                    bPlain_;
+        bool                    gOmitX_;
+        std::string             title_;
+        std::string             subtitle_;
+        std::string             xlabel_;
+        std::string             ylabel_;
+        std::vector<std::string>  legend_;
+        char                    xformat_[15];
+        char                    yformat_[15];
+        real                    xscale_;
 };
 
 AbstractPlotModule::Impl::Impl(const AnalysisDataPlotSettings &settings)
-    : settings(settings), fp(NULL), bPlain(false), bOmitX(false), xscale(1.0)
+    : settings_(settings), fp_(NULL), bPlain_(false), gOmitX_(false),
+      xscale_(1.0)
 {
-    strcpy(xfmt, "%11.3f");
-    strcpy(yfmt, " %8.3f");
+    strcpy(xformat_, "%11.3f");
+    strcpy(yformat_, " %8.3f");
 }
 
 AbstractPlotModule::Impl::~Impl()
@@ -140,17 +141,17 @@ AbstractPlotModule::Impl::~Impl()
 void
 AbstractPlotModule::Impl::closeFile()
 {
-    if (fp != NULL)
+    if (fp_ != NULL)
     {
-        if (bPlain)
+        if (bPlain_)
         {
-            gmx_fio_fclose(fp);
+            gmx_fio_fclose(fp_);
         }
         else
         {
-            xvgrclose(fp);
+            xvgrclose(fp_);
         }
-        fp = NULL;
+        fp_ = NULL;
     }
 }
 
@@ -160,12 +161,12 @@ AbstractPlotModule::Impl::closeFile()
  */
 /*! \cond libapi */
 AbstractPlotModule::AbstractPlotModule()
-    : _impl(new Impl(AnalysisDataPlotSettings()))
+    : impl_(new Impl(AnalysisDataPlotSettings()))
 {
 }
 
 AbstractPlotModule::AbstractPlotModule(const AnalysisDataPlotSettings &settings)
-    : _impl(new Impl(settings))
+    : impl_(new Impl(settings))
 {
 }
 //! \endcond
@@ -178,72 +179,72 @@ AbstractPlotModule::~AbstractPlotModule()
 void
 AbstractPlotModule::setSettings(const AnalysisDataPlotSettings &settings)
 {
-    _impl->settings = settings;
+    impl_->settings_ = settings;
 }
 
 
 void
-AbstractPlotModule::setFileName(const std::string &fnm)
+AbstractPlotModule::setFileName(const std::string &filename)
 {
-    _impl->fnm = fnm;
+    impl_->filename_ = filename;
 }
 
 
 void
 AbstractPlotModule::setPlainOutput(bool bPlain)
 {
-    _impl->bPlain = bPlain;
+    impl_->bPlain_ = bPlain;
 }
 
 
 void
 AbstractPlotModule::setOmitX(bool bOmitX)
 {
-    _impl->bOmitX = bOmitX;
+    impl_->gOmitX_ = bOmitX;
 }
 
 
 void
 AbstractPlotModule::setTitle(const char *title)
 {
-    _impl->title = title;
+    impl_->title_ = title;
 }
 
 
 void
 AbstractPlotModule::setSubtitle(const char *subtitle)
 {
-    _impl->subtitle = subtitle;
+    impl_->subtitle_ = subtitle;
 }
 
 
 void
 AbstractPlotModule::setXLabel(const char *label)
 {
-    _impl->xlabel = label;
+    impl_->xlabel_ = label;
 }
 
 
 void
 AbstractPlotModule::setXAxisIsTime()
 {
-    TimeUnitManager manager(_impl->settings.timeUnit());
-    _impl->xlabel = formatString("Time (%s)", manager.timeUnitAsString());
-    _impl->xscale = manager.inverseTimeScaleFactor();
+    TimeUnitManager manager(impl_->settings_.timeUnit());
+    impl_->xlabel_ = formatString("Time (%s)", manager.timeUnitAsString());
+    impl_->xscale_ = manager.inverseTimeScaleFactor();
 }
 
 
 void
 AbstractPlotModule::setYLabel(const char *label)
 {
-    _impl->ylabel = label;
+    impl_->ylabel_ = label;
 }
 
 
 void
 AbstractPlotModule::setLegend(int nsets, const char * const *setname)
 {
-    _impl->leg.reserve(_impl->leg.size() + nsets);
+    impl_->legend_.reserve(impl_->legend_.size() + nsets);
     for (int i = 0; i < nsets; ++i)
     {
         appendLegend(setname[i]);
@@ -254,29 +255,31 @@ AbstractPlotModule::setLegend(int nsets, const char * const *setname)
 void
 AbstractPlotModule::appendLegend(const char *setname)
 {
-    _impl->leg.push_back(setname);
+    impl_->legend_.push_back(setname);
 }
 
 
 void
-AbstractPlotModule::setXFormat(int width, int prec, char fmt)
+AbstractPlotModule::setXFormat(int width, int precision, char format)
 {
-    GMX_RELEASE_ASSERT(width >= 0 && prec >= 0 && width <= 99 && prec <= 99,
+    GMX_RELEASE_ASSERT(width >= 0 && precision >= 0
+                       && width <= 99 && precision <= 99,
                        "Invalid width or precision");
-    GMX_RELEASE_ASSERT(strchr("eEfFgG", fmt) != NULL,
+    GMX_RELEASE_ASSERT(strchr("eEfFgG", format) != NULL,
                        "Invalid format specifier");
-    sprintf(_impl->xfmt, "%%%d.%d%c", width, prec, fmt);
+    sprintf(impl_->xformat_, "%%%d.%d%c", width, precision, format);
 }
 
 
 void
-AbstractPlotModule::setYFormat(int width, int prec, char fmt)
+AbstractPlotModule::setYFormat(int width, int precision, char format)
 {
-    GMX_RELEASE_ASSERT(width >= 0 && prec >= 0 && width <= 99 && prec <= 99,
+    GMX_RELEASE_ASSERT(width >= 0 && precision >= 0
+                       && width <= 99 && precision <= 99,
                        "Invalid width or precision");
-    GMX_RELEASE_ASSERT(strchr("eEfFgG", fmt) != NULL,
+    GMX_RELEASE_ASSERT(strchr("eEfFgG", format) != NULL,
                        "Invalid format specifier");
-    sprintf(_impl->yfmt, " %%%d.%d%c", width, prec, fmt);
+    sprintf(impl_->yformat_, " %%%d.%d%c", width, precision, format);
 }
 
 
@@ -290,46 +293,46 @@ AbstractPlotModule::flags() const
 void
 AbstractPlotModule::dataStarted(AbstractAnalysisData *data)
 {
-    if (!_impl->fnm.empty())
+    if (!impl_->filename_.empty())
     {
-        if (_impl->bPlain)
+        if (impl_->bPlain_)
         {
-            _impl->fp = gmx_fio_fopen(_impl->fnm.c_str(), "w");
+            impl_->fp_ = gmx_fio_fopen(impl_->filename_.c_str(), "w");
         }
         else
         {
             time_unit_t time_unit
-                = static_cast<time_unit_t>(_impl->settings.timeUnit() + 1);
+                = static_cast<time_unit_t>(impl_->settings_.timeUnit() + 1);
             xvg_format_t xvg_format
-                = (_impl->settings.plotFormat() > 0
-                    ? static_cast<xvg_format_t>(_impl->settings.plotFormat())
+                = (impl_->settings_.plotFormat() > 0
+                    ? static_cast<xvg_format_t>(impl_->settings_.plotFormat())
                     : exvgNONE);
             output_env_t oenv;
             output_env_init(&oenv, 0, NULL, time_unit, FALSE, xvg_format, 0, 0);
             boost::shared_ptr<output_env> oenvGuard(oenv, &output_env_done);
-            _impl->fp = xvgropen(_impl->fnm.c_str(), _impl->title.c_str(),
-                                 _impl->xlabel.c_str(), _impl->ylabel.c_str(),
-                                 oenv);
+            impl_->fp_ = xvgropen(impl_->filename_.c_str(), impl_->title_.c_str(),
+                                  impl_->xlabel_.c_str(), impl_->ylabel_.c_str(),
+                                  oenv);
             const SelectionCollection *selections
-                = _impl->settings.selectionCollection();
+                = impl_->settings_.selectionCollection();
             if (selections != NULL)
             {
-                selections->printXvgrInfo(_impl->fp, oenv);
+                selections->printXvgrInfo(impl_->fp_, oenv);
             }
-            if (!_impl->subtitle.empty())
+            if (!impl_->subtitle_.empty())
             {
-                xvgr_subtitle(_impl->fp, _impl->subtitle.c_str(), oenv);
+                xvgr_subtitle(impl_->fp_, impl_->subtitle_.c_str(), oenv);
             }
             if (output_env_get_print_xvgr_codes(oenv)
-                && !_impl->leg.empty())
+                && !impl_->legend_.empty())
             {
-                std::vector<const char *> leg;
-                leg.reserve(_impl->leg.size());
-                for (size_t i = 0; i < _impl->leg.size(); ++i)
+                std::vector<const char *> legend;
+                legend.reserve(impl_->legend_.size());
+                for (size_t i = 0; i < impl_->legend_.size(); ++i)
                 {
-                    leg.push_back(_impl->leg[i].c_str());
+                    legend.push_back(impl_->legend_[i].c_str());
                 }
-                xvgr_legend(_impl->fp, leg.size(), &leg[0], oenv);
+                xvgr_legend(impl_->fp_, legend.size(), &legend[0], oenv);
             }
         }
     }
@@ -343,9 +346,9 @@ AbstractPlotModule::frameStarted(const AnalysisDataFrameHeader &frame)
     {
         return;
     }
-    if (!_impl->bOmitX)
+    if (!impl_->gOmitX_)
     {
-        std::fprintf(_impl->fp, _impl->xfmt, frame.x() * _impl->xscale);
+        std::fprintf(impl_->fp_, impl_->xformat_, frame.x() * impl_->xscale_);
     }
 }
 
@@ -357,21 +360,21 @@ AbstractPlotModule::frameFinished(const AnalysisDataFrameHeader & /*header*/)
     {
         return;
     }
-    std::fprintf(_impl->fp, "\n");
+    std::fprintf(impl_->fp_, "\n");
 }
 
 
 void
 AbstractPlotModule::dataFinished()
 {
-    _impl->closeFile();
+    impl_->closeFile();
 }
 
 /*! \cond libapi */
 bool
 AbstractPlotModule::isFileOpen() const
 {
-    return _impl->fp != NULL;
+    return impl_->fp_ != NULL;
 }
 
 
@@ -379,7 +382,7 @@ void
 AbstractPlotModule::writeValue(real value) const
 {
     GMX_ASSERT(isFileOpen(), "File not opened, but write attempted");
-    std::fprintf(_impl->fp, _impl->yfmt, value);
+    std::fprintf(impl_->fp_, impl_->yformat_, value);
 }
 //! \endcond
 
@@ -420,9 +423,9 @@ AnalysisDataVectorPlotModule::AnalysisDataVectorPlotModule()
 {
     for (int i = 0; i < DIM; ++i)
     {
-        _bWrite[i] = true;
+        bWrite_[i] = true;
     }
-    _bWrite[DIM] = false;
+    bWrite_[DIM] = false;
 }
 
 
@@ -432,37 +435,37 @@ AnalysisDataVectorPlotModule::AnalysisDataVectorPlotModule(
 {
     for (int i = 0; i < DIM; ++i)
     {
-        _bWrite[i] = true;
+        bWrite_[i] = true;
     }
-    _bWrite[DIM] = false;
+    bWrite_[DIM] = false;
 }
 
 
 void
 AnalysisDataVectorPlotModule::setWriteX(bool bWrite)
 {
-    _bWrite[XX] = bWrite;
+    bWrite_[XX] = bWrite;
 }
 
 
 void
 AnalysisDataVectorPlotModule::setWriteY(bool bWrite)
 {
-    _bWrite[YY] = bWrite;
+    bWrite_[YY] = bWrite;
 }
 
 
 void
 AnalysisDataVectorPlotModule::setWriteZ(bool bWrite)
 {
-    _bWrite[ZZ] = bWrite;
+    bWrite_[ZZ] = bWrite;
 }
 
 
 void
 AnalysisDataVectorPlotModule::setWriteNorm(bool bWrite)
 {
-    _bWrite[DIM] = bWrite;
+    bWrite_[DIM] = bWrite;
 }
 
 
@@ -471,7 +474,7 @@ AnalysisDataVectorPlotModule::setWriteMask(bool bWrite[DIM + 1])
 {
     for (int i = 0; i < DIM + 1; ++i)
     {
-        _bWrite[i] = bWrite[i];
+        bWrite_[i] = bWrite[i];
     }
 }
 
@@ -491,12 +494,12 @@ AnalysisDataVectorPlotModule::pointsAdded(const AnalysisDataPointSetRef &points)
     {
         for (int d = 0; d < DIM; ++d)
         {
-            if (_bWrite[i])
+            if (bWrite_[i])
             {
                 writeValue(points.y(i + d));
             }
         }
-        if (_bWrite[DIM])
+        if (bWrite_[DIM])
         {
             rvec y = { points.y(i), points.y(i + 1), points.y(i + 2) };
             writeValue(norm(y));
index a0b2a03793dc6f9e30e1671d82b37f2fdafb3370..e8df738bdab082a1e34b49934989a4667fd8e32c 100644 (file)
@@ -144,9 +144,9 @@ class AbstractPlotModule : public AnalysisDataModuleInterface
         /*! \brief
          * Set the output file name.
          *
-         * If no file name is set (or if \p fnm is NULL), no output occurs.
+         * If no file name is set (or if \p filename is empty), no output occurs.
          */
-        void setFileName(const std::string &fnm);
+        void setFileName(const std::string &filename);
         /*! \brief
          * Set plain output.
          *
@@ -201,11 +201,11 @@ class AbstractPlotModule : public AnalysisDataModuleInterface
         /*! \brief
          * Set field width and precision for X value output.
          */
-        void setXFormat(int width, int prec, char fmt = 'f');
+        void setXFormat(int width, int precision, char format = 'f');
         /*! \brief
          * Set field width and precision for Y value output.
          */
-        void setYFormat(int width, int prec, char fmt = 'f');
+        void setYFormat(int width, int precision, char format = 'f');
 
         virtual int flags() const;
 
@@ -239,7 +239,7 @@ class AbstractPlotModule : public AnalysisDataModuleInterface
     private:
         class Impl;
 
-        PrivateImplPointer<Impl> _impl;
+        PrivateImplPointer<Impl> impl_;
 };
 
 
@@ -303,7 +303,7 @@ class AnalysisDataVectorPlotModule : public AbstractPlotModule
         virtual void pointsAdded(const AnalysisDataPointSetRef &points);
 
     private:
-        bool                    _bWrite[4];
+        bool                    bWrite_[4];
 
         // Copy and assign disallowed by base.
 };
index 19c4d81a7980db5ad400547c74afde948bf0d7bc..d9544799dd4c51abe3bc3a73579587dbb637a1bd 100644 (file)
@@ -62,14 +62,14 @@ class CommandLineParser::Impl
         explicit Impl(Options *options);
 
         //! Helper object for assigning the options.
-        OptionsAssigner         _assigner;
+        OptionsAssigner         assigner_;
 };
 
 CommandLineParser::Impl::Impl(Options *options)
-    : _assigner(options)
+    : assigner_(options)
 {
-    _assigner.setAcceptBooleanNoPrefix(true);
-    _assigner.setNoStrictSectioning(true);
+    assigner_.setAcceptBooleanNoPrefix(true);
+    assigner_.setNoStrictSectioning(true);
 }
 
 /********************************************************************
@@ -77,7 +77,7 @@ CommandLineParser::Impl::Impl(Options *options)
  */
 
 CommandLineParser::CommandLineParser(Options *options)
-    : _impl(new Impl(options))
+    : impl_(new Impl(options))
 {
 }
 
@@ -101,7 +101,7 @@ void CommandLineParser::parse(std::vector<std::string> *commandLine)
     // Start in the discard phase to skip options that can't be understood.
     bool bDiscard = true;
 
-    _impl->_assigner.start();
+    impl_->assigner_.start();
     std::vector<std::string>::const_iterator arg;
     for (arg = commandLine->begin() + 1; arg != commandLine->end(); ++arg)
     {
@@ -112,7 +112,7 @@ void CommandLineParser::parse(std::vector<std::string> *commandLine)
             {
                 try
                 {
-                    _impl->_assigner.finishOption();
+                    impl_->assigner_.finishOption();
                 }
                 catch (const UserInputError &ex)
                 {
@@ -125,7 +125,7 @@ void CommandLineParser::parse(std::vector<std::string> *commandLine)
             try
             {
                 const char *name = arg->c_str() + 1;
-                _impl->_assigner.startOption(name);
+                impl_->assigner_.startOption(name);
             }
             catch (const UserInputError &ex)
             {
@@ -138,7 +138,7 @@ void CommandLineParser::parse(std::vector<std::string> *commandLine)
         {
             try
             {
-                _impl->_assigner.appendValue(*arg);
+                impl_->assigner_.appendValue(*arg);
             }
             catch (const UserInputError &ex)
             {
@@ -150,7 +150,7 @@ void CommandLineParser::parse(std::vector<std::string> *commandLine)
     {
         try
         {
-            _impl->_assigner.finishOption();
+            impl_->assigner_.finishOption();
         }
         catch (const UserInputError &ex)
         {
@@ -158,7 +158,7 @@ void CommandLineParser::parse(std::vector<std::string> *commandLine)
         }
         errors.finishContext();
     }
-    _impl->_assigner.finish();
+    impl_->assigner_.finish();
     if (!errors.isEmpty())
     {
         // TODO: This exception type may not always be appropriate.
index d5b0ac24cf67626771b9d4b381bdb358729fece7..dee2d3503a2173cf0114f34c398c4b804d7b520c 100644 (file)
@@ -114,7 +114,7 @@ class CommandLineParser
     private:
         class Impl;
 
-        PrivateImplPointer<Impl> _impl;
+        PrivateImplPointer<Impl> impl_;
 };
 
 } // namespace gmx
index 6e6a1074e3bcd7bea416b320f426fae7d11d3a17..2d5a2fb864c5adc86e287ddfccbaccd311d91582 100644 (file)
@@ -58,23 +58,23 @@ class CommandLineParserTest : public ::testing::Test
     public:
         CommandLineParserTest();
 
-        gmx::Options            _options;
-        gmx::CommandLineParser  _parser;
-        bool                    _flag;
-        std::vector<int>        _ivalues;
-        std::vector<double>     _dvalues;
+        gmx::Options            options_;
+        gmx::CommandLineParser  parser_;
+        bool                    flag_;
+        std::vector<int>        ivalues_;
+        std::vector<double>     dvalues_;
 };
 
 CommandLineParserTest::CommandLineParserTest()
-    : _options(NULL, NULL), _parser(&_options),
-      _flag(false)
+    : options_(NULL, NULL), parser_(&options_),
+      flag_(false)
 {
     using gmx::BooleanOption;
     using gmx::IntegerOption;
     using gmx::DoubleOption;
-    _options.addOption(BooleanOption("flag").store(&_flag));
-    _options.addOption(IntegerOption("mvi").storeVector(&_ivalues).multiValue());
-    _options.addOption(DoubleOption("mvd").storeVector(&_dvalues).allowMultiple());
+    options_.addOption(BooleanOption("flag").store(&flag_));
+    options_.addOption(IntegerOption("mvi").storeVector(&ivalues_).multiValue());
+    options_.addOption(DoubleOption("mvd").storeVector(&dvalues_).allowMultiple());
 }
 
 TEST_F(CommandLineParserTest, HandlesSingleValues)
@@ -83,14 +83,14 @@ TEST_F(CommandLineParserTest, HandlesSingleValues)
         "test", "-flag", "yes", "-mvi", "2", "-mvd", "2.7"
     };
     CommandLine args(CommandLine::create(cmdline));
-    ASSERT_NO_THROW(_parser.parse(&args.argc(), args.argv()));
-    ASSERT_NO_THROW(_options.finish());
+    ASSERT_NO_THROW(parser_.parse(&args.argc(), args.argv()));
+    ASSERT_NO_THROW(options_.finish());
 
-    EXPECT_TRUE(_flag);
-    ASSERT_EQ(1U, _ivalues.size());
-    EXPECT_EQ(2, _ivalues[0]);
-    ASSERT_EQ(1U, _dvalues.size());
-    EXPECT_DOUBLE_EQ(2.7, _dvalues[0]);
+    EXPECT_TRUE(flag_);
+    ASSERT_EQ(1U, ivalues_.size());
+    EXPECT_EQ(2, ivalues_[0]);
+    ASSERT_EQ(1U, dvalues_.size());
+    EXPECT_DOUBLE_EQ(2.7, dvalues_[0]);
 }
 
 TEST_F(CommandLineParserTest, HandlesNegativeNumbers)
@@ -99,14 +99,14 @@ TEST_F(CommandLineParserTest, HandlesNegativeNumbers)
         "test", "-mvi", "1", "-2", "-mvd", "-2.7"
     };
     CommandLine args(CommandLine::create(cmdline));
-    ASSERT_NO_THROW(_parser.parse(&args.argc(), args.argv()));
-    ASSERT_NO_THROW(_options.finish());
+    ASSERT_NO_THROW(parser_.parse(&args.argc(), args.argv()));
+    ASSERT_NO_THROW(options_.finish());
 
-    ASSERT_EQ(2U, _ivalues.size());
-    EXPECT_EQ(1, _ivalues[0]);
-    EXPECT_EQ(-2, _ivalues[1]);
-    ASSERT_EQ(1U, _dvalues.size());
-    EXPECT_DOUBLE_EQ(-2.7, _dvalues[0]);
+    ASSERT_EQ(2U, ivalues_.size());
+    EXPECT_EQ(1, ivalues_[0]);
+    EXPECT_EQ(-2, ivalues_[1]);
+    ASSERT_EQ(1U, dvalues_.size());
+    EXPECT_DOUBLE_EQ(-2.7, dvalues_[0]);
 }
 
 } // namespace
index 1b201a824106d8d0a8978d9c03a265560e4b3948..4f37892c3bc3553328aff1e320fa65425941469b 100644 (file)
@@ -54,28 +54,28 @@ namespace gmx
 
 AbstractOptionStorage::AbstractOptionStorage(const AbstractOption &settings,
                                              OptionFlags staticFlags)
-    : _flags(settings._flags | staticFlags),
-      _minValueCount(settings._minValueCount),
-      _maxValueCount(settings._maxValueCount),
-      _inSet(false)
+    : flags_(settings.flags_ | staticFlags),
+      minValueCount_(settings.minValueCount_),
+      maxValueCount_(settings.maxValueCount_),
+      inSet_(false)
 {
     // If the maximum number of values is not known, storage to
     // caller-allocated memory is unsafe.
-    if ((_maxValueCount < 0 || hasFlag(efMulti)) && hasFlag(efExternalStore))
+    if ((maxValueCount_ < 0 || hasFlag(efMulti)) && hasFlag(efExternalStore))
     {
         GMX_THROW(APIError("Cannot set user-allocated storage for arbitrary number of values"));
     }
     // Check that user has not provided incorrect values for vectors.
-    if (hasFlag(efVector) && (_minValueCount > 1 || _maxValueCount < 1))
+    if (hasFlag(efVector) && (minValueCount_ > 1 || maxValueCount_ < 1))
     {
         GMX_THROW(APIError("Inconsistent value counts for vector values"));
     }
 
-    if (settings._name != NULL)
+    if (settings.name_ != NULL)
     {
-        _name  = settings._name;
+        name_  = settings.name_;
     }
-    _descr = settings.createDescription();
+    descr_ = settings.createDescription();
 }
 
 AbstractOptionStorage::~AbstractOptionStorage()
@@ -94,7 +94,7 @@ void AbstractOptionStorage::startSource()
 
 void AbstractOptionStorage::startSet()
 {
-    GMX_RELEASE_ASSERT(!_inSet, "finishSet() not called");
+    GMX_RELEASE_ASSERT(!inSet_, "finishSet() not called");
     // The last condition takes care of the situation where multiple
     // sources are used, and a later source should be able to reassign
     // the value even though the option is already set.
@@ -103,19 +103,19 @@ void AbstractOptionStorage::startSet()
         GMX_THROW(InvalidInputError("Option specified multiple times"));
     }
     clearSet();
-    _inSet = true;
+    inSet_ = true;
 }
 
 void AbstractOptionStorage::appendValue(const std::string &value)
 {
-    GMX_RELEASE_ASSERT(_inSet, "startSet() not called");
+    GMX_RELEASE_ASSERT(inSet_, "startSet() not called");
     convertValue(value);
 }
 
 void AbstractOptionStorage::finishSet()
 {
-    GMX_RELEASE_ASSERT(_inSet, "startSet() not called");
-    _inSet = false;
+    GMX_RELEASE_ASSERT(inSet_, "startSet() not called");
+    inSet_ = false;
     // TODO: Should this be done only when processSet() does not throw?
     setFlag(efSet);
     processSet();
@@ -123,7 +123,7 @@ void AbstractOptionStorage::finishSet()
 
 void AbstractOptionStorage::finish()
 {
-    GMX_RELEASE_ASSERT(!_inSet, "finishSet() not called");
+    GMX_RELEASE_ASSERT(!inSet_, "finishSet() not called");
     processAll();
     if (hasFlag(efRequired) && !isSet())
     {
@@ -136,9 +136,9 @@ void AbstractOptionStorage::setMinValueCount(int count)
     GMX_RELEASE_ASSERT(!hasFlag(efMulti),
                        "setMinValueCount() not supported with efMulti");
     GMX_RELEASE_ASSERT(count >= 0, "Invalid value count");
-    _minValueCount = count;
+    minValueCount_ = count;
     if (isSet()
-        && !hasFlag(efDontCheckMinimumCount) && valueCount() < _minValueCount)
+        && !hasFlag(efDontCheckMinimumCount) && valueCount() < minValueCount_)
     {
         GMX_THROW(InvalidInputError("Too few values"));
     }
@@ -149,8 +149,8 @@ void AbstractOptionStorage::setMaxValueCount(int count)
     GMX_RELEASE_ASSERT(!hasFlag(efMulti),
                        "setMaxValueCount() not supported with efMulti");
     GMX_RELEASE_ASSERT(count >= -1, "Invalid value count");
-    _maxValueCount = count;
-    if (isSet() && _maxValueCount >= 0 && valueCount() > _maxValueCount)
+    maxValueCount_ = count;
+    if (isSet() && maxValueCount_ >= 0 && valueCount() > maxValueCount_)
     {
         GMX_THROW(InvalidInputError("Too many values"));
     }
index bf0d393a4f7b2e33d776e41e33a744aa7e1552de..2c165a9f8e207d2423738aae76ccd8b5af2816dc 100644 (file)
@@ -93,8 +93,8 @@ class AbstractOption
         /*! \cond libapi */
         //! Initializes the name and default values for an option.
         explicit AbstractOption(const char *name)
-            : _minValueCount(1), _maxValueCount(1),
-              _name(name), _descr(NULL)
+            : minValueCount_(1), maxValueCount_(1),
+              name_(name), descr_(NULL)
         { }
 
         /*! \brief
@@ -126,26 +126,26 @@ class AbstractOption
          * description.
          */
         virtual std::string createDescription() const
-        { return _descr ? _descr : ""; }
+        { return descr_ ? descr_ : ""; }
 
         //! Sets the description for the option.
-        void setDescription(const char *descr) { _descr = descr; }
+        void setDescription(const char *descr) { descr_ = descr; }
         //! Sets a flag for the option.
-        void setFlag(OptionFlag flag) { _flags.set(flag); }
+        void setFlag(OptionFlag flag) { flags_.set(flag); }
         //! Clears a flag for the option.
-        void clearFlag(OptionFlag flag) { _flags.clear(flag); }
+        void clearFlag(OptionFlag flag) { flags_.clear(flag); }
         //! Sets or clears a flag for the option.
-        void setFlag(OptionFlag flag, bool bSet) { _flags.set(flag, bSet); }
+        void setFlag(OptionFlag flag, bool bSet) { flags_.set(flag, bSet); }
         //! Returns true if the option is vector-valued.
         bool isVector() const { return hasFlag(efVector); }
         //! Sets the option to be vector-valued.
         void setVector()
         {
             setFlag(efVector);
-            _minValueCount = 1;
-            if (_maxValueCount == 1)
+            minValueCount_ = 1;
+            if (maxValueCount_ == 1)
             {
-                _maxValueCount = 3;
+                maxValueCount_ = 3;
             }
         }
         //! Sets the required number of values for the option.
@@ -153,25 +153,25 @@ class AbstractOption
         {
             if (!hasFlag(efVector))
             {
-                _minValueCount = count;
+                minValueCount_ = count;
             }
-            _maxValueCount = count;
+            maxValueCount_ = count;
         }
 
         //! Minimum number of values required for the option.
-        int                     _minValueCount;
+        int                     minValueCount_;
         //! Maximum number of values allowed for the option.
-        int                     _maxValueCount;
+        int                     maxValueCount_;
         //! \endcond
 
     private:
         //! Returns true if a flag has been set.
-        bool hasFlag(OptionFlag flag) const { return _flags.test(flag); }
+        bool hasFlag(OptionFlag flag) const { return flags_.test(flag); }
 
-        const char             *_name;
+        const char             *name_;
         //! Pointer to description of the option.
-        const char             *_descr;
-        OptionFlags             _flags;
+        const char             *descr_;
+        OptionFlags             flags_;
 
         /*! \brief
          * Needed to initialize an AbstractOptionStorage object from this class
@@ -235,7 +235,7 @@ class OptionTemplate : public AbstractOption
         //! Requires exactly \p count values for the option.
         MyClass &valueCount(int count) { setValueCount(count); return me(); }
         //! Allows any number of values for the option.
-        MyClass &multiValue() { _maxValueCount = -1; return me(); }
+        MyClass &multiValue() { maxValueCount_ = -1; return me(); }
 
         /*! \brief
          * Sets a default value for the option.
@@ -253,7 +253,7 @@ class OptionTemplate : public AbstractOption
          * \p defaultValue is copied when the option is created.
          */
         MyClass &defaultValue(const T &defaultValue)
-        { _defaultValue = &defaultValue; return me(); }
+        { defaultValue_ = &defaultValue; return me(); }
         /*! \brief
          * Sets a default value for the option when it is set.
          *
@@ -266,7 +266,7 @@ class OptionTemplate : public AbstractOption
          * \p defaultValue is copied when the option is created.
          */
         MyClass &defaultValueIfSet(const T &defaultValue)
-        { _defaultValueIfSet = &defaultValue; return me(); }
+        { defaultValueIfSet_ = &defaultValue; return me(); }
         /*! \brief
          * Stores value(s) in memory pointed by \p store.
          *
@@ -284,7 +284,7 @@ class OptionTemplate : public AbstractOption
          * Options object exists.
          */
         MyClass &store(T *store)
-        { setFlag(efExternalStore); _store = store; return me(); }
+        { setFlag(efExternalStore); store_ = store; return me(); }
         /*! \brief
          * Stores number of values in the value pointed by \p countptr.
          *
@@ -297,7 +297,7 @@ class OptionTemplate : public AbstractOption
          * Options object exists.
          */
         MyClass &storeCount(int *countptr)
-        { _countptr = countptr; return me(); }
+        { countptr_ = countptr; return me(); }
         /*! \brief
          * Stores option values in the provided vector.
          *
@@ -312,7 +312,7 @@ class OptionTemplate : public AbstractOption
          * Options object exists.
          */
         MyClass &storeVector(std::vector<T> *store)
-        { setFlag(efExternalValueVector); _storeVector = store; return me(); }
+        { setFlag(efExternalValueVector); storeVector_ = store; return me(); }
 
     protected:
         /*! \cond libapi */
@@ -322,30 +322,30 @@ class OptionTemplate : public AbstractOption
         //! Initializes the name and default values for an option.
         explicit OptionTemplate(const char *name)
             : AbstractOption(name),
-              _defaultValue(NULL), _defaultValueIfSet(NULL), _store(NULL),
-              _countptr(NULL), _storeVector(NULL)
+              defaultValue_(NULL), defaultValueIfSet_(NULL), store_(NULL),
+              countptr_(NULL), storeVector_(NULL)
         { }
 
         /*! \brief
          * Returns a pointer to user-specified default value, or NULL if there
          * is none.
          */
-        const T *defaultValue() const { return _defaultValue; }
+        const T *defaultValue() const { return defaultValue_; }
         /*! \brief
          * Returns a pointer to user-specified default value, or NULL if there
          * is none.
          */
-        const T *defaultValueIfSet() const { return _defaultValueIfSet; }
+        const T *defaultValueIfSet() const { return defaultValueIfSet_; }
         //! Returns \p *this casted into MyClass to reduce typing.
         MyClass &me() { return static_cast<MyClass &>(*this); }
         //! \endcond
 
     private:
-        const T                *_defaultValue;
-        const T                *_defaultValueIfSet;
-        T                      *_store;
-        int                    *_countptr;
-        std::vector<T>         *_storeVector;
+        const T                *defaultValue_;
+        const T                *defaultValueIfSet_;
+        T                      *store_;
+        int                    *countptr_;
+        std::vector<T>         *storeVector_;
 
         /*! \brief
          * Needed to initialize storage from this class without otherwise
index 23e9bf0ffcf5b2ade2446cec80710985636d5ca7..5c102b5a83a0b34f76febe504e2e8b0d3baa7f76 100644 (file)
@@ -99,9 +99,9 @@ class AbstractOptionStorage
         //! Returns true if the option is required.
         bool isRequired() const { return hasFlag(efRequired); }
         //! Returns the name of the option.
-        const std::string &name() const { return _name; }
+        const std::string &name() const { return name_; }
         //! Returns the description of the option.
-        const std::string &description() const { return _descr; }
+        const std::string &description() const { return descr_; }
 
         /*! \brief
          * Returns an option info object corresponding to this option.
@@ -200,16 +200,16 @@ class AbstractOptionStorage
                               OptionFlags staticFlags);
 
         //! Returns true if the given flag is set.
-        bool hasFlag(OptionFlag flag) const { return _flags.test(flag); }
+        bool hasFlag(OptionFlag flag) const { return flags_.test(flag); }
         //! Sets the given flag.
-        void setFlag(OptionFlag flag) { return _flags.set(flag); }
+        void setFlag(OptionFlag flag) { return flags_.set(flag); }
         //! Clears the given flag.
-        void clearFlag(OptionFlag flag) { return _flags.clear(flag); }
+        void clearFlag(OptionFlag flag) { return flags_.clear(flag); }
 
         //! Returns the minimum number of values required in one set.
-        int minValueCount() const { return _minValueCount; }
+        int minValueCount() const { return minValueCount_; }
         //! Returns the maximum allowed number of values in one set (-1 = no limit).
-        int maxValueCount() const { return _maxValueCount; }
+        int maxValueCount() const { return maxValueCount_; }
         /*! \brief
          * Sets a new minimum number of values required in one set.
          *
@@ -291,16 +291,16 @@ class AbstractOptionStorage
         virtual void processAll() = 0;
 
     private:
-        std::string             _name;
-        std::string             _descr;
+        std::string             name_;
+        std::string             descr_;
         //! Flags for the option.
-        OptionFlags             _flags;
+        OptionFlags             flags_;
         //! Minimum number of values required (in one set).
-        int                     _minValueCount;
+        int                     minValueCount_;
         //! Maximum allowed number of values (in one set), or -1 if no limit.
-        int                     _maxValueCount;
+        int                     maxValueCount_;
         //! Whether we are currently assigning values to a set.
-        bool                    _inSet;
+        bool                    inSet_;
 
         GMX_DISALLOW_COPY_AND_ASSIGN(AbstractOptionStorage);
 };
index 2ed66caa3fc5c97184c990e68b04a4ad4e09bf22..42238819d37bbc5aac0bc564c5de8d640cb5f388 100644 (file)
@@ -165,7 +165,7 @@ AbstractOptionStoragePointer IntegerOption::createStorage() const
  */
 
 DoubleOptionStorage::DoubleOptionStorage(const DoubleOption &settings)
-    : MyBase(settings), info_(this), bTime_(settings._bTime), factor_(1.0)
+    : MyBase(settings), info_(this), bTime_(settings.bTime_), factor_(1.0)
 {
 }
 
@@ -263,32 +263,32 @@ AbstractOptionStoragePointer DoubleOption::createStorage() const
  */
 
 StringOptionStorage::StringOptionStorage(const StringOption &settings)
-    : MyBase(settings), _info(this), _enumIndexStore(NULL)
+    : MyBase(settings), info_(this), enumIndexStore_(NULL)
 {
-    if (settings._defaultEnumIndex >= 0 && settings._enumValues == NULL)
+    if (settings.defaultEnumIndex_ >= 0 && settings.enumValues_ == NULL)
     {
         GMX_THROW(APIError("Cannot set default enum index without enum values"));
     }
-    if (settings._enumIndexStore != NULL && settings._enumValues == NULL)
+    if (settings.enumIndexStore_ != NULL && settings.enumValues_ == NULL)
     {
         GMX_THROW(APIError("Cannot set enum index store without enum values"));
     }
-    if (settings._enumIndexStore != NULL && settings._maxValueCount < 0)
+    if (settings.enumIndexStore_ != NULL && settings.maxValueCount_ < 0)
     {
         GMX_THROW(APIError("Cannot set enum index store with arbitrary number of values"));
     }
-    if (settings._enumValues != NULL)
+    if (settings.enumValues_ != NULL)
     {
-        _enumIndexStore = settings._enumIndexStore;
+        enumIndexStore_ = settings.enumIndexStore_;
         const std::string *defaultValue = settings.defaultValue();
         int match = -1;
-        for (int i = 0; settings._enumValues[i] != NULL; ++i)
+        for (int i = 0; settings.enumValues_[i] != NULL; ++i)
         {
-            if (defaultValue != NULL && settings._enumValues[i] == *defaultValue)
+            if (defaultValue != NULL && settings.enumValues_[i] == *defaultValue)
             {
                 match = i;
             }
-            _allowed.push_back(settings._enumValues[i]);
+            allowed_.push_back(settings.enumValues_[i]);
         }
         if (defaultValue != NULL)
         {
@@ -297,27 +297,27 @@ StringOptionStorage::StringOptionStorage(const StringOption &settings)
                 GMX_THROW(APIError("Default value is not one of allowed values"));
             }
         }
-        if (settings._defaultEnumIndex >= 0)
+        if (settings.defaultEnumIndex_ >= 0)
         {
-            if (settings._defaultEnumIndex >= static_cast<int>(_allowed.size()))
+            if (settings.defaultEnumIndex_ >= static_cast<int>(allowed_.size()))
             {
                 GMX_THROW(APIError("Default enumeration index is out of range"));
             }
-            if (defaultValue != NULL && *defaultValue != _allowed[settings._defaultEnumIndex])
+            if (defaultValue != NULL && *defaultValue != allowed_[settings.defaultEnumIndex_])
             {
                 GMX_THROW(APIError("Conflicting default values"));
             }
         }
         // If there is no default value, match is still -1.
-        if (_enumIndexStore != NULL)
+        if (enumIndexStore_ != NULL)
         {
-            *_enumIndexStore = match;
+            *enumIndexStore_ = match;
         }
     }
-    if (settings._defaultEnumIndex >= 0)
+    if (settings.defaultEnumIndex_ >= 0)
     {
         clear();
-        addValue(_allowed[settings._defaultEnumIndex]);
+        addValue(allowed_[settings.defaultEnumIndex_]);
         commitValues();
     }
 }
@@ -329,26 +329,26 @@ std::string StringOptionStorage::formatSingleValue(const std::string &value) con
 
 void StringOptionStorage::convertValue(const std::string &value)
 {
-    if (_allowed.size() == 0)
+    if (allowed_.size() == 0)
     {
         addValue(value);
     }
     else
     {
         ValueList::const_iterator  i;
-        ValueList::const_iterator  match = _allowed.end();
-        for (i = _allowed.begin(); i != _allowed.end(); ++i)
+        ValueList::const_iterator  match = allowed_.end();
+        for (i = allowed_.begin(); i != allowed_.end(); ++i)
         {
             // TODO: Case independence.
             if (i->find(value) == 0)
             {
-                if (match == _allowed.end() || i->size() < match->size())
+                if (match == allowed_.end() || i->size() < match->size())
                 {
                     match = i;
                 }
             }
         }
-        if (match == _allowed.end())
+        if (match == allowed_.end())
         {
             GMX_THROW(InvalidInputError("Invalid value: " + value));
         }
@@ -359,15 +359,15 @@ void StringOptionStorage::convertValue(const std::string &value)
 void StringOptionStorage::refreshValues()
 {
     MyBase::refreshValues();
-    if (_enumIndexStore != NULL)
+    if (enumIndexStore_ != NULL)
     {
         for (size_t i = 0; i < values().size(); ++i)
         {
             ValueList::const_iterator match =
-                std::find(_allowed.begin(), _allowed.end(), values()[i]);
-            GMX_ASSERT(match != _allowed.end(),
+                std::find(allowed_.begin(), allowed_.end(), values()[i]);
+            GMX_ASSERT(match != allowed_.end(),
                        "Enum value not found (internal error)");
-            _enumIndexStore[i] = static_cast<int>(match - _allowed.begin());
+            enumIndexStore_[i] = static_cast<int>(match - allowed_.begin());
         }
     }
 }
@@ -394,15 +394,15 @@ std::string StringOption::createDescription() const
 {
     std::string value(MyBase::createDescription());
 
-    if (_enumValues != NULL)
+    if (enumValues_ != NULL)
     {
         value.append(": ");
-        for (int i = 0; _enumValues[i] != NULL; ++i)
+        for (int i = 0; enumValues_[i] != NULL; ++i)
         {
-            value.append(_enumValues[i]);
-            if (_enumValues[i + 1] != NULL)
+            value.append(enumValues_[i]);
+            if (enumValues_[i + 1] != NULL)
             {
-                value.append(_enumValues[i + 2] != NULL ? ", " : ", or ");
+                value.append(enumValues_[i + 2] != NULL ? ", " : ", or ");
             }
         }
     }
index 7c6e155214dc6c423f05efbc741cd2bf7e0c1874..9307aa6edb00f1acb8d51b8b7aa56b79e40cecc7 100644 (file)
@@ -140,7 +140,7 @@ class DoubleOption : public OptionTemplate<double, DoubleOption>
 {
     public:
         //! Initializes an option with the given name.
-        explicit DoubleOption(const char *name) : MyBase(name), _bTime(false)
+        explicit DoubleOption(const char *name) : MyBase(name), bTime_(false)
         {
         }
 
@@ -158,13 +158,13 @@ class DoubleOption : public OptionTemplate<double, DoubleOption>
          * user-provided values are scaled according to the time unit set in
          * TimeUnitManager.
          */
-        MyClass &timeValue() { _bTime = true; return me(); }
+        MyClass &timeValue() { bTime_ = true; return me(); }
 
     private:
         //! Creates a DoubleOptionStorage object.
         virtual AbstractOptionStoragePointer createStorage() const;
 
-        bool _bTime;
+        bool bTime_;
 
         /*! \brief
          * Needed to initialize DoubleOptionStorage from this class without
@@ -199,8 +199,8 @@ class StringOption : public OptionTemplate<std::string, StringOption>
     public:
         //! Initializes an option with the given name.
         explicit StringOption(const char *name)
-            : MyBase(name), _enumValues(NULL), _defaultEnumIndex(-1),
-              _enumIndexStore(NULL)
+            : MyBase(name), enumValues_(NULL), defaultEnumIndex_(-1),
+              enumIndexStore_(NULL)
         {
         }
 
@@ -221,7 +221,7 @@ class StringOption : public OptionTemplate<std::string, StringOption>
          * The strings are copied once the option is created.
          */
         MyClass &enumValue(const char *const *values)
-        { _enumValues = values; return me(); }
+        { enumValues_ = values; return me(); }
         /*! \brief
          * Sets the default value using an index into the enumeration table.
          *
@@ -230,7 +230,7 @@ class StringOption : public OptionTemplate<std::string, StringOption>
         MyClass &defaultEnumIndex(int index)
         {
             GMX_RELEASE_ASSERT(index >= 0, "Invalid enumeration index");
-            _defaultEnumIndex = index;
+            defaultEnumIndex_ = index;
             return me();
         }
         /*! \brief
@@ -245,16 +245,16 @@ class StringOption : public OptionTemplate<std::string, StringOption>
          * Cannot be specified without enumValue().
          */
         MyClass &storeEnumIndex(int *store)
-        { _enumIndexStore = store; return me(); }
+        { enumIndexStore_ = store; return me(); }
 
     private:
         //! Creates a StringOptionStorage object.
         virtual AbstractOptionStoragePointer createStorage() const;
         virtual std::string createDescription() const;
 
-        const char *const      *_enumValues;
-        int                     _defaultEnumIndex;
-        int                    *_enumIndexStore;
+        const char *const      *enumValues_;
+        int                     defaultEnumIndex_;
+        int                    *enumIndexStore_;
 
         /*! \brief
          * Needed to initialize StringOptionStorage from this class without
index 9c73e9cb255ab924cb3e75cfe0f9e62486d8c354..6f96b008d88c7edbf9d5fac06b47d4e18c238341 100644 (file)
@@ -144,17 +144,17 @@ class StringOptionStorage : public OptionStorageTemplate<std::string>
         //! \copydoc DoubleOptionStorage::DoubleOptionStorage()
         explicit StringOptionStorage(const StringOption &settings);
 
-        virtual OptionInfo &optionInfo() { return _info; }
-        virtual const char *typeString() const { return _allowed.empty() ? "string" : "enum"; }
+        virtual OptionInfo &optionInfo() { return info_; }
+        virtual const char *typeString() const { return allowed_.empty() ? "string" : "enum"; }
         virtual std::string formatSingleValue(const std::string &value) const;
 
     private:
         virtual void convertValue(const std::string &value);
         virtual void refreshValues();
 
-        StringOptionInfo        _info;
-        ValueList               _allowed;
-        int                    *_enumIndexStore;
+        StringOptionInfo        info_;
+        ValueList               allowed_;
+        int                    *enumIndexStore_;
 };
 
 /*!\}*/
index 15e6d925e0d6f24eb5da19929fd599050bf4728a..d4694e015ce913950ae25130bddd9d201e1e6f9f 100644 (file)
@@ -97,27 +97,27 @@ class Options::Impl
         void startSource();
 
         //! Name for the Options object.
-        std::string             _name;
+        std::string             name_;
         //! Description title for the Options object.
-        std::string             _title;
+        std::string             title_;
         //! Full description for the Options object.
-        std::string             _description;
+        std::string             description_;
         /*! \brief
          * List of subsections, in insertion order.
          *
          * This container contains only references to external objects; memory
          * management is performed elsewhere.
          */
-        SubSectionList          _subSections;
+        SubSectionList          subSections_;
         /*! \brief
          * List of options, in insertion order.
          *
          * All objects in this container are owned by this object, and are
          * freed in the destructor.
          */
-        OptionList              _options;
+        OptionList              options_;
         //! Options object that contains this object as a subsection, or NULL.
-        Options                *_parent;
+        Options                *parent_;
 };
 
 } // namespace gmx
index c01c8b4c24f980ff6816525a2651a9c8097699f1..b355a16e607c5188f84bfd55696b82ce43733e30 100644 (file)
@@ -54,8 +54,8 @@ namespace gmx
  */
 
 Options::Impl::Impl(const char *name, const char *title)
-    : _name(name != NULL ? name : ""), _title(title != NULL ? title : ""),
-      _parent(NULL)
+    : name_(name != NULL ? name : ""), title_(title != NULL ? title : ""),
+      parent_(NULL)
 {
 }
 
@@ -66,7 +66,7 @@ Options::Impl::~Impl()
 Options *Options::Impl::findSubSection(const char *name) const
 {
     SubSectionList::const_iterator i;
-    for (i = _subSections.begin(); i != _subSections.end(); ++i)
+    for (i = subSections_.begin(); i != subSections_.end(); ++i)
     {
         if ((*i)->name() == name)
         {
@@ -79,7 +79,7 @@ Options *Options::Impl::findSubSection(const char *name) const
 AbstractOptionStorage *Options::Impl::findOption(const char *name) const
 {
     OptionList::const_iterator i;
-    for (i = _options.begin(); i != _options.end(); ++i)
+    for (i = options_.begin(); i != options_.end(); ++i)
     {
         if ((*i)->name() == name)
         {
@@ -92,16 +92,16 @@ AbstractOptionStorage *Options::Impl::findOption(const char *name) const
 void Options::Impl::startSource()
 {
     OptionList::const_iterator i;
-    for (i = _options.begin(); i != _options.end(); ++i)
+    for (i = options_.begin(); i != options_.end(); ++i)
     {
         AbstractOptionStorage &option = **i;
         option.startSource();
     }
     SubSectionList::const_iterator j;
-    for (j = _subSections.begin(); j != _subSections.end(); ++j)
+    for (j = subSections_.begin(); j != subSections_.end(); ++j)
     {
         Options &section = **j;
-        section._impl->startSource();
+        section.impl_->startSource();
     }
 }
 
@@ -110,7 +110,7 @@ void Options::Impl::startSource()
  */
 
 Options::Options(const char *name, const char *title)
-    : _impl(new Impl(name, title))
+    : impl_(new Impl(name, title))
 {
 }
 
@@ -120,49 +120,49 @@ Options::~Options()
 
 const std::string &Options::name() const
 {
-    return _impl->_name;
+    return impl_->name_;
 }
 
 const std::string &Options::title() const
 {
-    return _impl->_title;
+    return impl_->title_;
 }
 
 const std::string &Options::description() const
 {
-    return _impl->_description;
+    return impl_->description_;
 }
 
 void Options::setDescription(const std::string &desc)
 {
-    _impl->_description = desc;
+    impl_->description_ = desc;
 }
 
 void Options::addSubSection(Options *section)
 {
     // Make sure that section is not already inserted somewhere.
-    GMX_RELEASE_ASSERT(section->_impl->_parent == NULL,
+    GMX_RELEASE_ASSERT(section->impl_->parent_ == NULL,
                        "Cannot add as subsection twice");
     // Make sure that there are no duplicate sections.
-    GMX_RELEASE_ASSERT(_impl->findSubSection(section->name().c_str()) == NULL,
+    GMX_RELEASE_ASSERT(impl_->findSubSection(section->name().c_str()) == NULL,
                        "Duplicate subsection name");
-    _impl->_subSections.push_back(section);
-    section->_impl->_parent = this;
+    impl_->subSections_.push_back(section);
+    section->impl_->parent_ = this;
 }
 
 void Options::addOption(const AbstractOption &settings)
 {
     AbstractOptionStoragePointer option(settings.createStorage());
-    if (_impl->findOption(option->name().c_str()) != NULL)
+    if (impl_->findOption(option->name().c_str()) != NULL)
     {
         GMX_THROW(APIError("Duplicate option: " + option->name()));
     }
-    _impl->_options.push_back(move(option));
+    impl_->options_.push_back(move(option));
 }
 
 bool Options::isSet(const char *name) const
 {
-    AbstractOptionStorage *option = _impl->findOption(name);
+    AbstractOptionStorage *option = impl_->findOption(name);
     return (option != NULL ? option->isSet() : false);
 }
 
@@ -170,7 +170,7 @@ void Options::finish()
 {
     MessageStringCollector errors;
     Impl::OptionList::const_iterator i;
-    for (i = _impl->_options.begin(); i != _impl->_options.end(); ++i)
+    for (i = impl_->options_.begin(); i != impl_->options_.end(); ++i)
     {
         AbstractOptionStorage &option = **i;
         try
@@ -184,7 +184,7 @@ void Options::finish()
         }
     }
     Impl::SubSectionList::const_iterator j;
-    for (j = _impl->_subSections.begin(); j != _impl->_subSections.end(); ++j)
+    for (j = impl_->subSections_.begin(); j != impl_->subSections_.end(); ++j)
     {
         Options &section = **j;
         try
index cc99f57d7d4b16d39207a64fbde7080355a42189..83c9bbd555f9d33573e81d1ab497e75c2a45c108 100644 (file)
@@ -171,7 +171,7 @@ class Options
     private:
         class Impl;
 
-        PrivateImplPointer<Impl> _impl;
+        PrivateImplPointer<Impl> impl_;
 
         //! Needed to be able to extend the interface of this object.
         friend class OptionsAssigner;
index c0e0b55301734ca28c3eab33d7be7cc2ae51e33b..4f117df4acff6dc701540aa536cb282762aab8d1 100644 (file)
@@ -61,26 +61,13 @@ namespace gmx
 class OptionsAssigner::Impl
 {
     public:
-        //! Possible flags for controlling assignment behavior.
-        enum Flag
-        {
-            //! Recognize boolean option "name" also as "noname".
-            efAcceptBooleanNoPrefix     = 1<<0,
-            //! Look for options in all sections, not just the current one.
-            efNoStrictSectioning        = 1<<1,
-        };
         //! Sets the option object to assign to.
-        Impl(Options *options);
-
-        //! Sets or clears the given flag.
-        void setFlag(Flag flag, bool bSet);
+        explicit Impl(Options *options);
 
-        //! Returns true if the given flag is set.
-        bool hasFlag(Flag flag) const { return _flags & flag; }
         //! Returns true if a subsection has been set.
-        bool inSubSection() const { return _sectionStack.size() > 1; }
+        bool inSubSection() const { return sectionStack_.size() > 1; }
         //! Returns the Options object for the current section.
-        Options &currentSection() const { return *_sectionStack.back(); }
+        Options &currentSection() const { return *sectionStack_.back(); }
         /*! \brief
          * Finds an option by the given name.
          *
@@ -94,46 +81,42 @@ class OptionsAssigner::Impl
         AbstractOptionStorage *findOption(const char *name);
 
         //! Options object to assign to.
-        Options                &_options;
-        //! Flags that control assignment behavior.
-        unsigned long           _flags;
+        Options                &options_;
+        //! Recognize boolean option "name" also as "noname".
+        bool                    bAcceptBooleanNoPrefix_;
+        //! Look for options in all sections, not just the current one.
+        bool                    bNoStrictSectioning_;
         /*! \brief
          * List of (sub)sections being assigned to.
          *
-         * The first element always points to \a _options.
+         * The first element always points to \a options_.
          */
-        std::vector<Options *>  _sectionStack;
+        std::vector<Options *>  sectionStack_;
         //! Current option being assigned to, or NULL if none.
-        AbstractOptionStorage  *_currentOption;
-        //! Number of values assigned so far to the current option.
-        int                     _currentValueCount;
+        AbstractOptionStorage  *currentOption_;
+        /*! \brief
+         * Number of values assigned so far to the current option.
+         *
+         * Counts the number of attempted assignments, whether they have been
+         * successful or not.
+         */
+        int                     currentValueCount_;
         //! If true, a "no" prefix was given for the current boolean option.
-        bool                    _reverseBoolean;
+        bool                    reverseBoolean_;
 };
 
 OptionsAssigner::Impl::Impl(Options *options)
-    : _options(*options), _flags(0), _currentOption(NULL),
-      _currentValueCount(0), _reverseBoolean(false)
-{
-    _sectionStack.push_back(&_options);
-}
-
-void OptionsAssigner::Impl::setFlag(OptionsAssigner::Impl::Flag flag, bool bSet)
+    : options_(*options), bAcceptBooleanNoPrefix_(false),
+      bNoStrictSectioning_(false), currentOption_(NULL),
+      currentValueCount_(0), reverseBoolean_(false)
 {
-    if (bSet)
-    {
-        _flags |= flag;
-    }
-    else
-    {
-        _flags &= ~flag;
-    }
+    sectionStack_.push_back(&options_);
 }
 
 AbstractOptionStorage *
 OptionsAssigner::Impl::findOption(const char *name)
 {
-    GMX_RELEASE_ASSERT(_currentOption == NULL,
+    GMX_RELEASE_ASSERT(currentOption_ == NULL,
                        "Cannot search for another option while processing one");
     AbstractOptionStorage *option = NULL;
     Options *section = NULL;
@@ -145,15 +128,15 @@ OptionsAssigner::Impl::findOption(const char *name)
     while (option == NULL && !searchList.empty())
     {
         section = searchList.front();
-        option = section->_impl->findOption(name);
-        if (option == NULL && hasFlag(efAcceptBooleanNoPrefix))
+        option = section->impl_->findOption(name);
+        if (option == NULL && bAcceptBooleanNoPrefix_)
         {
             if (name[0] == 'n' && name[1] == 'o')
             {
-                option = section->_impl->findOption(name + 2);
+                option = section->impl_->findOption(name + 2);
                 if (option != NULL && option->isBoolean())
                 {
-                    _reverseBoolean = true;
+                    reverseBoolean_ = true;
                 }
                 else
                 {
@@ -162,41 +145,41 @@ OptionsAssigner::Impl::findOption(const char *name)
             }
         }
         searchList.pop_front();
-        if (hasFlag(efNoStrictSectioning))
+        if (bNoStrictSectioning_)
         {
             Options::Impl::SubSectionList::const_iterator i;
-            for (i = section->_impl->_subSections.begin();
-                 i != section->_impl->_subSections.end(); ++i)
+            for (i = section->impl_->subSections_.begin();
+                 i != section->impl_->subSections_.end(); ++i)
             {
                 if (*i != oldRoot)
                 {
                     searchList.push_back(*i);
                 }
             }
-            if (searchList.empty() && root != &_options)
+            if (searchList.empty() && root != &options_)
             {
-                root = root->_impl->_parent;
+                root = root->impl_->parent_;
                 ++upcount;
                 searchList.push_back(root);
             }
         }
     }
-    if (hasFlag(efNoStrictSectioning) && option != NULL)
+    if (bNoStrictSectioning_ && option != NULL)
     {
         while (upcount > 0)
         {
-            _sectionStack.pop_back();
+            sectionStack_.pop_back();
             --upcount;
         }
         std::vector<Options *> sections;
         while (section != &currentSection())
         {
             sections.push_back(section);
-            section = section->_impl->_parent;
+            section = section->impl_->parent_;
         }
         while (!sections.empty())
         {
-            _sectionStack.push_back(sections.back());
+            sectionStack_.push_back(sections.back());
             sections.pop_back();
         }
     }
@@ -208,7 +191,7 @@ OptionsAssigner::Impl::findOption(const char *name)
  */
 
 OptionsAssigner::OptionsAssigner(Options *options)
-    : _impl(new Impl(options))
+    : impl_(new Impl(options))
 {
 }
 
@@ -216,74 +199,72 @@ OptionsAssigner::~OptionsAssigner()
 {
 }
 
-void OptionsAssigner::setAcceptBooleanNoPrefix(bool enabled)
+void OptionsAssigner::setAcceptBooleanNoPrefix(bool bEnabled)
 {
-    _impl->setFlag(Impl::efAcceptBooleanNoPrefix, enabled);
+    impl_->bAcceptBooleanNoPrefix_ = bEnabled;
 }
 
-void OptionsAssigner::setNoStrictSectioning(bool enabled)
+void OptionsAssigner::setNoStrictSectioning(bool bEnabled)
 {
-    _impl->setFlag(Impl::efNoStrictSectioning, enabled);
+    impl_->bNoStrictSectioning_ = bEnabled;
 }
 
 void OptionsAssigner::start()
 {
-    _impl->_options._impl->startSource();
+    impl_->options_.impl_->startSource();
 }
 
 void OptionsAssigner::startSubSection(const char *name)
 {
-    Options *section = _impl->currentSection()._impl->findSubSection(name);
+    Options *section = impl_->currentSection().impl_->findSubSection(name);
     if (section == NULL)
     {
         GMX_THROW(InvalidInputError("Unknown subsection"));
     }
-    _impl->_sectionStack.push_back(section);
+    impl_->sectionStack_.push_back(section);
 }
 
 void OptionsAssigner::startOption(const char *name)
 {
-    GMX_RELEASE_ASSERT(_impl->_currentOption == NULL, "finishOption() not called");
-    AbstractOptionStorage *option = _impl->findOption(name);
+    GMX_RELEASE_ASSERT(impl_->currentOption_ == NULL, "finishOption() not called");
+    AbstractOptionStorage *option = impl_->findOption(name);
     if (option == NULL)
     {
         GMX_THROW(InvalidInputError("Unknown option"));
     }
     option->startSet();
-    _impl->_currentOption = option;
-    _impl->_currentValueCount = 0;
+    impl_->currentOption_ = option;
+    impl_->currentValueCount_ = 0;
 }
 
 void OptionsAssigner::appendValue(const std::string &value)
 {
-    AbstractOptionStorage *option = _impl->_currentOption;
+    AbstractOptionStorage *option = impl_->currentOption_;
     GMX_RELEASE_ASSERT(option != NULL, "startOption() not called");
-    // Does not count correctly, but the actual count is not really used.
-    // TODO: Rename the variable to better reflect the usage.
-    ++_impl->_currentValueCount;
+    ++impl_->currentValueCount_;
     option->appendValue(value);
 }
 
 void OptionsAssigner::finishOption()
 {
-    AbstractOptionStorage *option = _impl->_currentOption;
+    AbstractOptionStorage *option = impl_->currentOption_;
     GMX_RELEASE_ASSERT(option != NULL, "startOption() not called");
     bool bBoolReverseValue = false;
     if (option->isBoolean())
     {
-        if (_impl->_currentValueCount == 0)
+        if (impl_->currentValueCount_ == 0)
         {
             // Should not throw, otherwise something is wrong.
             // TODO: Get rid of the hard-coded values.
-            option->appendValue(_impl->_reverseBoolean ? "0" : "1");
+            option->appendValue(impl_->reverseBoolean_ ? "0" : "1");
         }
-        else if (_impl->_reverseBoolean)
+        else if (impl_->reverseBoolean_)
         {
             bBoolReverseValue = true;
         }
     }
-    _impl->_currentOption = NULL;
-    _impl->_reverseBoolean = false;
+    impl_->currentOption_ = NULL;
+    impl_->reverseBoolean_ = false;
     option->finishSet();
     if (bBoolReverseValue)
     {
@@ -294,21 +275,21 @@ void OptionsAssigner::finishOption()
 void OptionsAssigner::finishSubSection()
 {
     // Should only be called if we are in a subsection.
-    GMX_RELEASE_ASSERT(_impl->inSubSection(), "startSubSection() not called");
-    _impl->_sectionStack.pop_back();
+    GMX_RELEASE_ASSERT(impl_->inSubSection(), "startSubSection() not called");
+    impl_->sectionStack_.pop_back();
 }
 
 void OptionsAssigner::finish()
 {
-    GMX_RELEASE_ASSERT(_impl->_currentOption == NULL, "finishOption() not called");
-    if (_impl->hasFlag(Impl::efNoStrictSectioning))
+    GMX_RELEASE_ASSERT(impl_->currentOption_ == NULL, "finishOption() not called");
+    if (impl_->bNoStrictSectioning_)
     {
-        while (_impl->inSubSection())
+        while (impl_->inSubSection())
         {
             finishSubSection();
         }
     }
-    GMX_RELEASE_ASSERT(!_impl->inSubSection(), "finishSubSection() not called");
+    GMX_RELEASE_ASSERT(!impl_->inSubSection(), "finishSubSection() not called");
 }
 
 } // namespace gmx
index e33981d702d8a0cca35fe003b8d37c6323988683..e8d8b0eb0838036c51cc8627a2e0d49ad09bab15 100644 (file)
@@ -86,7 +86,7 @@ class OptionsAssigner
         /*! \brief
          * Creates an object that assigns to the given object.
          */
-        OptionsAssigner(Options *options);
+        explicit OptionsAssigner(Options *options);
         ~OptionsAssigner();
 
         /*! \brief
@@ -104,7 +104,7 @@ class OptionsAssigner
          *
          * Does not throw.
          */
-        void setAcceptBooleanNoPrefix(bool enabled);
+        void setAcceptBooleanNoPrefix(bool bEnabled);
         /*! \brief
          * Sets the assigner to find options in non-active sections.
          *
@@ -120,7 +120,7 @@ class OptionsAssigner
          *
          * Does not throw.
          */
-        void setNoStrictSectioning(bool enabled);
+        void setNoStrictSectioning(bool bEnabled);
 
         /*! \brief
          * Start assigning values.
@@ -202,7 +202,7 @@ class OptionsAssigner
     private:
         class Impl;
 
-        PrivateImplPointer<Impl> _impl;
+        PrivateImplPointer<Impl> impl_;
 };
 
 } // namespace gmx
index 2703e84ab81c9aebd0fbb6d89b5b4ff68a552ecc..5b083d148508f3c347e5d61e766218cdd9373ea0 100644 (file)
@@ -93,7 +93,7 @@ class OptionStorageTemplate : public AbstractOptionStorage
         // No implementation in this class for the pure virtual methods, but
         // the declarations are still included for clarity.
         virtual const char *typeString() const = 0;
-        virtual int valueCount() const { return static_cast<int>(_values->size()); }
+        virtual int valueCount() const { return static_cast<int>(values_->size()); }
         /*! \copydoc AbstractOptionStorage::formatValue()
          *
          * OptionStorageTemplate implements handling of DefaultValueIfSetIndex
@@ -176,7 +176,7 @@ class OptionStorageTemplate : public AbstractOptionStorage
          *
          * Does not throw.
          */
-        void clear() { _values->clear(); }
+        void clear() { values_->clear(); }
         /*! \brief
          * Adds a value to a temporary storage.
          *
@@ -234,15 +234,15 @@ class OptionStorageTemplate : public AbstractOptionStorage
          * derived classes if necessary, and refreshValues() should be called
          * if any changes are made.
          */
-        ValueList &values() { return *_values; }
+        ValueList &values() { return *values_; }
         //! Provides derived classes access to the current list of values.
-        const ValueList &values() const { return *_values; }
+        const ValueList &values() const { return *values_; }
 
     private:
         /*! \brief
          * Vector for temporary storage of values before commitSet() is called.
          */
-        ValueList               _setValues;
+        ValueList               setValues_;
         /*! \brief
          * Vector for primary storage of option values.
          *
@@ -254,11 +254,11 @@ class OptionStorageTemplate : public AbstractOptionStorage
          * and other storage locations are updated only when refreshValues() is
          * called.
          */
-        ValueList              *_values;
-        T                      *_store;
-        int                    *_countptr;
-        boost::scoped_ptr<ValueList> _ownedValues;
-        boost::scoped_ptr<T>    _defaultValueIfSet;
+        ValueList              *values_;
+        T                      *store_;
+        int                    *countptr_;
+        boost::scoped_ptr<ValueList> ownedValues_;
+        boost::scoped_ptr<T>    defaultValueIfSet_;
 
         // Copy and assign disallowed by base.
 };
@@ -269,25 +269,25 @@ template <class U>
 OptionStorageTemplate<T>::OptionStorageTemplate(const OptionTemplate<T, U> &settings,
                                                 OptionFlags staticFlags)
     : AbstractOptionStorage(settings, staticFlags),
-      _values(settings._storeVector),
-      _store(settings._store),
-      _countptr(settings._countptr)
+      values_(settings.storeVector_),
+      store_(settings.store_),
+      countptr_(settings.countptr_)
 {
-    if (_values == NULL)
+    if (values_ == NULL)
     {
         // The flag should be set for proper error checking.
         GMX_RELEASE_ASSERT(!hasFlag(efExternalValueVector),
                            "Internal inconsistency");
-        _ownedValues.reset(new std::vector<T>);
-        _values = _ownedValues.get();
+        ownedValues_.reset(new std::vector<T>);
+        values_ = ownedValues_.get();
     }
     if (hasFlag(efNoDefaultValue)
-        && (settings._defaultValue != NULL
-            || settings._defaultValueIfSet != NULL))
+        && (settings.defaultValue_ != NULL
+            || settings.defaultValueIfSet_ != NULL))
     {
         GMX_THROW(APIError("Option does not support default value, but one is set"));
     }
-    if (_store != NULL && _countptr == NULL && !hasFlag(efVector)
+    if (store_ != NULL && countptr_ == NULL && !hasFlag(efVector)
         && minValueCount() != maxValueCount())
     {
         GMX_THROW(APIError("Count storage is not set, although the number of produced values is not known"));
@@ -295,30 +295,30 @@ OptionStorageTemplate<T>::OptionStorageTemplate(const OptionTemplate<T, U> &sett
     if (!hasFlag(efNoDefaultValue))
     {
         setFlag(efHasDefaultValue);
-        if (settings._defaultValue != NULL)
+        if (settings.defaultValue_ != NULL)
         {
-            _values->clear();
-            addValue(*settings._defaultValue);
+            values_->clear();
+            addValue(*settings.defaultValue_);
             // TODO: This is a bit hairy, as it indirectly calls a virtual function.
             commitValues();
         }
-        else if (_ownedValues.get() != NULL && _store != NULL)
+        else if (ownedValues_.get() != NULL && store_ != NULL)
         {
-            _values->clear();
+            values_->clear();
             int count = (settings.isVector() ?
-                            settings._maxValueCount : settings._minValueCount);
+                            settings.maxValueCount_ : settings.minValueCount_);
             for (int i = 0; i < count; ++i)
             {
-                _values->push_back(_store[i]);
+                values_->push_back(store_[i]);
             }
         }
-        if (settings._defaultValueIfSet != NULL)
+        if (settings.defaultValueIfSet_ != NULL)
         {
             if (hasFlag(efMulti))
             {
                 GMX_THROW(APIError("defaultValueIfSet() is not supported with allowMultiple()"));
             }
-            _defaultValueIfSet.reset(new T(*settings._defaultValueIfSet));
+            defaultValueIfSet_.reset(new T(*settings.defaultValueIfSet_));
         }
     }
     setFlag(efClearOnNextSet);
@@ -338,9 +338,9 @@ std::string OptionStorageTemplate<T>::formatValue(int i) const
                        "Invalid value index");
     if (i == DefaultValueIfSetIndex)
     {
-        if (_defaultValueIfSet.get() != NULL)
+        if (defaultValueIfSet_.get() != NULL)
         {
-            return formatSingleValue(*_defaultValueIfSet);
+            return formatSingleValue(*defaultValueIfSet_);
         }
         return std::string();
     }
@@ -351,17 +351,17 @@ std::string OptionStorageTemplate<T>::formatValue(int i) const
 template <typename T>
 void OptionStorageTemplate<T>::clearSet()
 {
-    _setValues.clear();
+    setValues_.clear();
 }
 
 
 template <typename T>
 void OptionStorageTemplate<T>::processSet()
 {
-    processSetValues(&_setValues);
-    if (_setValues.empty() && _defaultValueIfSet.get() != NULL)
+    processSetValues(&setValues_);
+    if (setValues_.empty() && defaultValueIfSet_.get() != NULL)
     {
-        addValue(*_defaultValueIfSet);
+        addValue(*defaultValueIfSet_);
         setFlag(efHasDefaultValue);
     }
     else
@@ -369,7 +369,7 @@ void OptionStorageTemplate<T>::processSet()
         clearFlag(efHasDefaultValue);
     }
     if (!hasFlag(efDontCheckMinimumCount)
-        && _setValues.size() < static_cast<size_t>(minValueCount()))
+        && setValues_.size() < static_cast<size_t>(minValueCount()))
     {
         clearSet();
         GMX_THROW(InvalidInputError("Too few (valid) values"));
@@ -382,11 +382,11 @@ template <typename T>
 void OptionStorageTemplate<T>::addValue(const T &value)
 {
     if (maxValueCount() >= 0
-        && _setValues.size() >= static_cast<size_t>(maxValueCount()))
+        && setValues_.size() >= static_cast<size_t>(maxValueCount()))
     {
         GMX_THROW(InvalidInputError("Too many values"));
     }
-    _setValues.push_back(value);
+    setValues_.push_back(value);
 }
 
 
@@ -395,12 +395,12 @@ void OptionStorageTemplate<T>::commitValues()
 {
     if (hasFlag(efClearOnNextSet))
     {
-        _values->swap(_setValues);
+        values_->swap(setValues_);
         clearFlag(efClearOnNextSet);
     }
     else
     {
-        _values->insert(_values->end(), _setValues.begin(), _setValues.end());
+        values_->insert(values_->end(), setValues_.begin(), setValues_.end());
     }
     clearSet();
     refreshValues();
@@ -410,15 +410,15 @@ void OptionStorageTemplate<T>::commitValues()
 template <typename T>
 void OptionStorageTemplate<T>::refreshValues()
 {
-    if (_countptr != NULL)
+    if (countptr_ != NULL)
     {
-        *_countptr = static_cast<int>(_values->size());
+        *countptr_ = static_cast<int>(values_->size());
     }
-    if (_store != NULL)
+    if (store_ != NULL)
     {
-        for (size_t i = 0; i < _values->size(); ++i)
+        for (size_t i = 0; i < values_->size(); ++i)
         {
-            _store[i] = (*_values)[i];
+            store_[i] = (*values_)[i];
         }
     }
 }
index b1e8e7223e0a1ba3d5abfb28985917c656754f4b..ef699450a574fc848e862bab6483cfc423c02aaa 100644 (file)
@@ -50,14 +50,14 @@ namespace gmx
  */
 
 OptionsIterator::OptionsIterator(const Options &options)
-    : _options(options)
+    : options_(options)
 {
 }
 
 void OptionsIterator::acceptSubSections(OptionsVisitor *visitor) const
 {
     const Options::Impl::SubSectionList &subSectionList =
-        _options._impl->_subSections;
+        options_.impl_->subSections_;
     Options::Impl::SubSectionList::const_iterator i;
     for (i = subSectionList.begin(); i != subSectionList.end(); ++i)
     {
@@ -68,7 +68,7 @@ void OptionsIterator::acceptSubSections(OptionsVisitor *visitor) const
 void OptionsIterator::acceptOptions(OptionsVisitor *visitor) const
 {
     const Options::Impl::OptionList &optionList =
-        _options._impl->_options;
+        options_.impl_->options_;
     Options::Impl::OptionList::const_iterator i;
     for (i = optionList.begin(); i != optionList.end(); ++i)
     {
@@ -84,14 +84,14 @@ void OptionsIterator::acceptOptions(OptionsVisitor *visitor) const
  */
 
 OptionsModifyingIterator::OptionsModifyingIterator(Options *options)
-    : _options(*options)
+    : options_(*options)
 {
 }
 
 void OptionsModifyingIterator::acceptSubSections(OptionsModifyingVisitor *visitor) const
 {
     const Options::Impl::SubSectionList &subSectionList =
-        _options._impl->_subSections;
+        options_.impl_->subSections_;
     Options::Impl::SubSectionList::const_iterator i;
     for (i = subSectionList.begin(); i != subSectionList.end(); ++i)
     {
@@ -102,7 +102,7 @@ void OptionsModifyingIterator::acceptSubSections(OptionsModifyingVisitor *visito
 void OptionsModifyingIterator::acceptOptions(OptionsModifyingVisitor *visitor) const
 {
     const Options::Impl::OptionList &optionList =
-        _options._impl->_options;
+        options_.impl_->options_;
     Options::Impl::OptionList::const_iterator i;
     for (i = optionList.begin(); i != optionList.end(); ++i)
     {
index 306b0ab44d1824c889a2b9977ec843f0c5074daa..aef9ee38461ff3df9866528c83a4f8eb0c4b8bd1 100644 (file)
@@ -144,7 +144,7 @@ class OptionsIterator
         /*! \brief
          * Creates an object for visiting options in a Options object.
          */
-        OptionsIterator(const Options &options);
+        explicit OptionsIterator(const Options &options);
 
         /*! \brief
          * Visits each subsection in the wrapped Options object.
@@ -157,7 +157,7 @@ class OptionsIterator
 
     private:
         //! The wrapped Options object.
-        const Options          &_options;
+        const Options          &options_;
 
         GMX_DISALLOW_COPY_AND_ASSIGN(OptionsIterator);
 };
@@ -236,7 +236,7 @@ class OptionsModifyingIterator
         /*! \brief
          * Creates an object for visiting options in a Options object.
          */
-        OptionsModifyingIterator(Options *options);
+        explicit OptionsModifyingIterator(Options *options);
 
         /*! \brief
          * Visits each subsection in the wrapped Options object.
@@ -249,7 +249,7 @@ class OptionsModifyingIterator
 
     private:
         //! The wrapped Options object.
-        Options                &_options;
+        Options                &options_;
 
         GMX_DISALLOW_COPY_AND_ASSIGN(OptionsModifyingIterator);
 };
index ba53fcb9f2af098cd6c9e3f278be3b3f22065971..33d997f2eda6d3a1e18654b0479945ac1f82e8a1 100644 (file)
@@ -126,26 +126,26 @@ class MockOption : public gmx::OptionTemplate<std::string, MockOption>
     public:
         //! Initializes an option with the given name.
         explicit MockOption(const char *name)
-            : MyBase(name), _storagePtr(NULL)
+            : MyBase(name), storagePtr_(NULL)
         {
         }
 
         //! Sets an output pointer to give access to the created storage object.
         MyClass &storageObject(MockOptionStorage **storagePtr)
-        { _storagePtr = storagePtr; return me(); }
+        { storagePtr_ = storagePtr; return me(); }
 
     private:
         virtual gmx::AbstractOptionStoragePointer createStorage() const
         {
             MockOptionStorage *storage = new MockOptionStorage(*this);
-            if (_storagePtr != NULL)
+            if (storagePtr_ != NULL)
             {
-                *_storagePtr = storage;
+                *storagePtr_ = storage;
             }
             return gmx::AbstractOptionStoragePointer(storage);
         }
 
-        MockOptionStorage     **_storagePtr;
+        MockOptionStorage     **storagePtr_;
 };
 
 MockOptionStorage::MockOptionStorage(const MockOption &settings)
index 7854426e480a7611b8955ab1df2f7722fb289a4e..86bdf19a2c787ffbdfab2f1f2ee3d55bedb0dfa9 100644 (file)
@@ -61,13 +61,13 @@ namespace gmx
 
 SelectionOptionStorage::SelectionOptionStorage(const SelectionOption &settings)
     : MyBase(settings, OptionFlags() | efNoDefaultValue | efDontCheckMinimumCount),
-      info_(this), manager_(NULL), selectionFlags_(settings._selectionFlags)
+      info_(this), manager_(NULL), selectionFlags_(settings.selectionFlags_)
 {
     GMX_RELEASE_ASSERT(!hasFlag(efMulti),
                        "allowMultiple() is not supported for selection options");
-    if (settings._infoPtr != NULL)
+    if (settings.infoPtr_ != NULL)
     {
-        *settings._infoPtr = &info_;
+        *settings.infoPtr_ = &info_;
     }
 }
 
index dd427dde9dcb52a187fd374c1b227f5c0ce95425..f3b60a71afa8f60ebdbbaf3729be6c06a87587a6 100644 (file)
@@ -62,7 +62,7 @@ class SelectionOption : public OptionTemplate<Selection, SelectionOption>
     public:
         //! Initializes an option with the given name.
         explicit SelectionOption(const char *name)
-            : MyBase(name), _infoPtr(NULL)
+            : MyBase(name), infoPtr_(NULL)
         { }
 
         /*! \brief
@@ -72,7 +72,7 @@ class SelectionOption : public OptionTemplate<Selection, SelectionOption>
          * in which case SelectionPosition::hasVelocity() returns false.
          */
         MyClass &evaluateVelocities()
-        { _selectionFlags.set(efEvaluateVelocities); return me(); }
+        { selectionFlags_.set(efEvaluateVelocities); return me(); }
         /*! \brief
          * Request force evaluation for output positions.
          *
@@ -80,19 +80,19 @@ class SelectionOption : public OptionTemplate<Selection, SelectionOption>
          * in which case SelectionPosition::hasForce() returns false.
          */
         MyClass &evaluateForces()
-        { _selectionFlags.set(efEvaluateForces); return me(); }
+        { selectionFlags_.set(efEvaluateForces); return me(); }
         /*! \brief
          * Only accept selections that evaluate to atom positions.
          *
          * TODO: This option is not yet implemented.
          */
         MyClass &onlyAtoms()
-        { _selectionFlags.set(efOnlyAtoms); return me(); }
+        { selectionFlags_.set(efOnlyAtoms); return me(); }
         /*! \brief
          * Only accept static selections for this option.
          */
         MyClass &onlyStatic()
-        { _selectionFlags.set(efOnlyStatic); return me(); }
+        { selectionFlags_.set(efOnlyStatic); return me(); }
         /*! \brief
          * Handle dynamic selections for this option with position masks.
          *
@@ -100,14 +100,14 @@ class SelectionOption : public OptionTemplate<Selection, SelectionOption>
          * \see SelectionPosition::selected()
          */
         MyClass &dynamicMask()
-        { _selectionFlags.set(efDynamicMask); return me(); }
+        { selectionFlags_.set(efDynamicMask); return me(); }
         /*! \brief
          * Disallow using atom coordinates as the reference positions.
          *
          * TODO: This option is not yet implemented.
          */
         MyClass &dynamicOnlyWhole()
-        { _selectionFlags.set(efDynamicOnlyWhole); return me(); }
+        { selectionFlags_.set(efDynamicOnlyWhole); return me(); }
 
         /*! \brief
          * Get an info object that can be used to alter the option after
@@ -116,7 +116,7 @@ class SelectionOption : public OptionTemplate<Selection, SelectionOption>
          * \see SelectionOptionInfo
          */
         MyClass &getAdjuster(SelectionOptionInfo **infoPtr)
-        { _infoPtr = infoPtr; return me(); }
+        { infoPtr_ = infoPtr; return me(); }
 
     private:
         // Disable possibility to allow multiple occurrences, since it isn't
@@ -129,8 +129,8 @@ class SelectionOption : public OptionTemplate<Selection, SelectionOption>
 
         virtual AbstractOptionStoragePointer createStorage() const;
 
-        SelectionFlags          _selectionFlags;
-        SelectionOptionInfo   **_infoPtr;
+        SelectionFlags          selectionFlags_;
+        SelectionOptionInfo   **infoPtr_;
 
         /*! \brief
          * Needed to initialize SelectionOptionStorage from this class without
index 5ad552cf422115991962d9a3c166359eaf2ad6db..e7f3c21076c6661dcc145eacfbee81df47166355 100644 (file)
@@ -58,18 +58,18 @@ class FlagsTemplate
 {
     public:
         //! Creates a flags object with no flags set.
-        FlagsTemplate() : _flags(0) {}
+        FlagsTemplate() : flags_(0) {}
         //! Creates a flags object from a single flag.
-        FlagsTemplate(T flag) : _flags(flag) {}
+        FlagsTemplate(T flag) : flags_(flag) {}
 
         //! Returns true if the given flag is set.
-        bool test(T flag) const { return _flags & flag; }
+        bool test(T flag) const { return flags_ & flag; }
         //! Clears all flags.
-        void clearAll() { _flags = 0; }
+        void clearAll() { flags_ = 0; }
         //! Sets the given flag.
-        void set(T flag) { _flags |= flag; }
+        void set(T flag) { flags_ |= flag; }
         //! Clears the given flag.
-        void clear(T flag) { _flags &= ~flag; }
+        void clear(T flag) { flags_ &= ~flag; }
         //! Sets or clears the given flag.
         void set(T flag, bool bSet)
         {
@@ -86,30 +86,30 @@ class FlagsTemplate
         //! Combines flags from two flags objects.
         FlagsTemplate<T> operator |(const FlagsTemplate<T> &other) const
         {
-            return FlagsTemplate<T>(_flags | other._flags);
+            return FlagsTemplate<T>(flags_ | other.flags_);
         }
         //! Combines flags from another flag object.
         FlagsTemplate<T> &operator |=(const FlagsTemplate<T> &other)
         {
-            _flags |= other._flags;
+            flags_ |= other.flags_;
             return *this;
         }
         //! Combined flags from two flags objects.
         FlagsTemplate<T> operator &(const FlagsTemplate<T> &other) const
         {
-            return FlagsTemplate<T>(_flags & other._flags);
+            return FlagsTemplate<T>(flags_ & other.flags_);
         }
         //! Returns an object with all flags flipped.
         FlagsTemplate<T> operator ~() const
         {
-            return FlagsTemplate<T>(~_flags);
+            return FlagsTemplate<T>(~flags_);
         }
 
     private:
         //! Creates a flags object with the given flags.
-        explicit FlagsTemplate(unsigned long flags) : _flags(flags) {}
+        explicit FlagsTemplate(unsigned long flags) : flags_(flags) {}
 
-        unsigned long           _flags;
+        unsigned long           flags_;
 };
 
 } // namespace gmx
index 8be151fd968ff116179fe3d63c423d77f6534ecc..45df34aeaa5e552b3881a9cf4d9cdace25dd3897 100644 (file)
@@ -147,22 +147,22 @@ class TestReferenceData::Impl
         ~Impl();
 
         //! Full path of the reference data file.
-        std::string             _fullFilename;
+        std::string             fullFilename_;
         /*! \brief
          * XML document for the reference data.
          *
          * May be NULL if there was an I/O error in initialization.
          */
-        xmlDocPtr               _refDoc;
+        xmlDocPtr               refDoc_;
         /*! \brief
          * Whether the reference data is being written (true) or compared
          * (false).
          */
-        bool                    _bWrite;
+        bool                    bWrite_;
         /*! \brief
          * Whether any reference checkers have been created for this data.
          */
-        bool                    _bInUse;
+        bool                    bInUse_;
 };
 
 const xmlChar * const TestReferenceData::Impl::cXmlVersion =
@@ -176,54 +176,54 @@ const xmlChar * const TestReferenceData::Impl::cRootNodeName =
 
 
 TestReferenceData::Impl::Impl(ReferenceDataMode mode)
-    : _refDoc(NULL), _bWrite(false), _bInUse(false)
+    : refDoc_(NULL), bWrite_(false), bInUse_(false)
 {
     std::string dirname = getReferenceDataPath();
     std::string filename = TestFileManager::getTestSpecificFileName(".xml");
-    _fullFilename = Path::join(dirname, filename);
+    fullFilename_ = Path::join(dirname, filename);
 
-    _bWrite = true;
+    bWrite_ = true;
     if (mode != erefdataUpdateAll)
     {
-        FILE *fp = std::fopen(_fullFilename.c_str(), "r");
+        FILE *fp = std::fopen(fullFilename_.c_str(), "r");
         if (fp != NULL)
         {
-            _bWrite = false;
+            bWrite_ = false;
             fclose(fp);
         }
         else if (mode == erefdataCompare)
         {
-            _bWrite = false;
+            bWrite_ = false;
             return;
         }
     }
-    if (_bWrite)
+    if (bWrite_)
     {
         // TODO: Error checking
-        _refDoc = xmlNewDoc(cXmlVersion);
-        xmlNodePtr rootNode = xmlNewDocNode(_refDoc, NULL, cRootNodeName, NULL);
-        xmlDocSetRootElement(_refDoc, rootNode);
-        xmlNodePtr xslNode = xmlNewDocPI(_refDoc, cXmlStyleSheetNodeName,
+        refDoc_ = xmlNewDoc(cXmlVersion);
+        xmlNodePtr rootNode = xmlNewDocNode(refDoc_, NULL, cRootNodeName, NULL);
+        xmlDocSetRootElement(refDoc_, rootNode);
+        xmlNodePtr xslNode = xmlNewDocPI(refDoc_, cXmlStyleSheetNodeName,
                                          cXmlStyleSheetContent);
         xmlAddPrevSibling(rootNode, xslNode);
     }
     else
     {
-        _refDoc = xmlParseFile(_fullFilename.c_str());
-        if (_refDoc == NULL)
+        refDoc_ = xmlParseFile(fullFilename_.c_str());
+        if (refDoc_ == NULL)
         {
-            GMX_THROW(TestException("Reference data not parsed successfully: " + _fullFilename));
+            GMX_THROW(TestException("Reference data not parsed successfully: " + fullFilename_));
         }
-        xmlNodePtr rootNode = xmlDocGetRootElement(_refDoc);
+        xmlNodePtr rootNode = xmlDocGetRootElement(refDoc_);
         if (rootNode == NULL)
         {
-            xmlFreeDoc(_refDoc);
-            GMX_THROW(TestException("Reference data is empty: " + _fullFilename));
+            xmlFreeDoc(refDoc_);
+            GMX_THROW(TestException("Reference data is empty: " + fullFilename_));
         }
         if (xmlStrcmp(rootNode->name, cRootNodeName) != 0)
         {
-            xmlFreeDoc(_refDoc);
-            GMX_THROW(TestException("Invalid root node type in " + _fullFilename));
+            xmlFreeDoc(refDoc_);
+            GMX_THROW(TestException("Invalid root node type in " + fullFilename_));
         }
     }
 }
@@ -231,7 +231,7 @@ TestReferenceData::Impl::Impl(ReferenceDataMode mode)
 
 TestReferenceData::Impl::~Impl()
 {
-    if (_bWrite && _bInUse && _refDoc != NULL)
+    if (bWrite_ && bInUse_ && refDoc_ != NULL)
     {
         std::string dirname = getReferenceDataPath();
         if (!Directory::exists(dirname))
@@ -241,14 +241,14 @@ TestReferenceData::Impl::~Impl()
                 ADD_FAILURE() << "Creation of reference data directory failed for " << dirname;
             }
         }
-        if (xmlSaveFormatFile(_fullFilename.c_str(), _refDoc, 1) == -1)
+        if (xmlSaveFormatFile(fullFilename_.c_str(), refDoc_, 1) == -1)
         {
-            ADD_FAILURE() << "Saving reference data failed for " + _fullFilename;
+            ADD_FAILURE() << "Saving reference data failed for " + fullFilename_;
         }
     }
-    if (_refDoc != NULL)
+    if (refDoc_ != NULL)
     {
-        xmlFreeDoc(_refDoc);
+        xmlFreeDoc(refDoc_);
     }
 }
 
@@ -368,39 +368,39 @@ class TestReferenceChecker::Impl
          * id of the compound is added.  Used for reporting comparison
          * mismatches.
          */
-        std::string             _path;
+        std::string             path_;
         /*! \brief
          * Current node under which reference data is searched.
          *
-         * Points to either the root of TestReferenceData::Impl::_refDoc, or to
+         * Points to either the root of TestReferenceData::Impl::refDoc_, or to
          * a compound node.
          *
          * Can be NULL, in which case this checker does nothing (doesn't even
          * report errors, see shouldIgnore()).
          */
-        xmlNodePtr              _currNode;
+        xmlNodePtr              currNode_;
         /*! \brief
-         * Points to a child of \a _currNode where the next search should start.
+         * Points to a child of \a currNode_ where the next search should start.
          *
-         * On initialization, points to the first child of \a _currNode.  After
+         * On initialization, points to the first child of \a currNode_.  After
          * every check, is updated to point to the node following the one
          * found, with possible wrapping.
          *
-         * Is NULL if and only if \a _currNode contains no children.
-         * Otherwise, always points to a direct child of \a _currNode.
+         * Is NULL if and only if \a currNode_ contains no children.
+         * Otherwise, always points to a direct child of \a currNode_.
          */
-        xmlNodePtr              _nextSearchNode;
+        xmlNodePtr              nextSearchNode_;
         /*! \brief
          * Whether the reference data is being written (true) or compared
          * (false).
          */
-        bool                    _bWrite;
+        bool                    bWrite_;
         /*! \brief
          * Current number of unnamed elements in a sequence.
          *
          * It is the index of the next added unnamed element.
          */
-        int                     _seqIndex;
+        int                     seqIndex_;
 };
 
 const xmlChar * const TestReferenceChecker::Impl::cBooleanNodeName =
@@ -422,16 +422,16 @@ const char * const TestReferenceChecker::Impl::cSequenceLengthName =
 
 
 TestReferenceChecker::Impl::Impl(bool bWrite)
-    : _currNode(NULL), _nextSearchNode(NULL), _bWrite(bWrite), _seqIndex(0)
+    : currNode_(NULL), nextSearchNode_(NULL), bWrite_(bWrite), seqIndex_(0)
 {
 }
 
 
 TestReferenceChecker::Impl::Impl(const std::string &path, xmlNodePtr rootNode,
                                  bool bWrite)
-    : _path(path + "/"), _currNode(rootNode),
-      _nextSearchNode(rootNode->xmlChildrenNode),
-      _bWrite(bWrite), _seqIndex(0)
+    : path_(path + "/"), currNode_(rootNode),
+      nextSearchNode_(rootNode->xmlChildrenNode),
+      bWrite_(bWrite), seqIndex_(0)
 {
 }
 
@@ -446,8 +446,8 @@ TestReferenceChecker::Impl::traceString(const char *id) const
 std::string
 TestReferenceChecker::Impl::appendPath(const char *id) const
 {
-    std::string printId = (id != NULL) ? id : formatString("[%d]", _seqIndex);
-    return _path + printId;
+    std::string printId = (id != NULL) ? id : formatString("[%d]", seqIndex_);
+    return path_ + printId;
 }
 
 
@@ -455,7 +455,7 @@ xmlNodePtr
 TestReferenceChecker::Impl::findNode(const xmlChar *name, const char *id) const
 {
     const xmlChar *xmlId = reinterpret_cast<const xmlChar *>(id);
-    xmlNodePtr node = _nextSearchNode;
+    xmlNodePtr node = nextSearchNode_;
     if (node == NULL)
     {
         return NULL;
@@ -480,12 +480,12 @@ TestReferenceChecker::Impl::findNode(const xmlChar *name, const char *id) const
             }
         }
         node = node->next;
-        if (node == NULL && _nextSearchNode != _currNode->xmlChildrenNode)
+        if (node == NULL && nextSearchNode_ != currNode_->xmlChildrenNode)
         {
-            node = _currNode->xmlChildrenNode;
+            node = currNode_->xmlChildrenNode;
         }
     }
-    while (node != NULL && node != _nextSearchNode);
+    while (node != NULL && node != nextSearchNode_);
     return NULL;
 }
 
@@ -496,9 +496,9 @@ TestReferenceChecker::Impl::findOrCreateNode(const xmlChar *name, const char *id
     xmlNodePtr node = findNode(name, id);
     if (node == NULL)
     {
-        if (_bWrite)
+        if (bWrite_)
         {
-            node = xmlNewTextChild(_currNode, NULL, name, NULL);
+            node = xmlNewTextChild(currNode_, NULL, name, NULL);
             if (node != NULL && id != NULL)
             {
                 const xmlChar *xmlId = reinterpret_cast<const xmlChar *>(id);
@@ -521,18 +521,18 @@ TestReferenceChecker::Impl::findOrCreateNode(const xmlChar *name, const char *id
     }
     else
     {
-        _nextSearchNode = node->next;
-        if (_nextSearchNode == NULL)
+        nextSearchNode_ = node->next;
+        if (nextSearchNode_ == NULL)
         {
-            _nextSearchNode = _currNode->xmlChildrenNode;
+            nextSearchNode_ = currNode_->xmlChildrenNode;
         }
     }
     if (node == NULL)
     {
-        GMX_RELEASE_ASSERT(!_bWrite, "Node creation failed without exception");
+        GMX_RELEASE_ASSERT(!bWrite_, "Node creation failed without exception");
         ADD_FAILURE() << "Reference data item not found";
     }
-    _seqIndex = (id == NULL) ? _seqIndex+1 : 0;
+    seqIndex_ = (id == NULL) ? seqIndex_+1 : 0;
 
     return node;
 }
@@ -549,7 +549,7 @@ TestReferenceChecker::Impl::processItem(const xmlChar *name, const char *id,
         return std::string();
     }
     *bFound = true;
-    if (_bWrite)
+    if (bWrite_)
     {
         xmlNodeAddContent(node, reinterpret_cast<const xmlChar *>(value));
         return std::string(value);
@@ -575,7 +575,7 @@ TestReferenceChecker::Impl::processItem(const xmlChar *name, const char *id,
 bool
 TestReferenceChecker::Impl::shouldIgnore() const
 {
-    return _currNode == NULL;
+    return currNode_ == NULL;
 }
 
 
@@ -584,13 +584,13 @@ TestReferenceChecker::Impl::shouldIgnore() const
  */
 
 TestReferenceData::TestReferenceData()
-    : _impl(new Impl(getReferenceDataMode()))
+    : impl_(new Impl(getReferenceDataMode()))
 {
 }
 
 
 TestReferenceData::TestReferenceData(ReferenceDataMode mode)
-    : _impl(new Impl(mode))
+    : impl_(new Impl(mode))
 {
 }
 
@@ -602,23 +602,23 @@ TestReferenceData::~TestReferenceData()
 
 bool TestReferenceData::isWriteMode() const
 {
-    return _impl->_bWrite;
+    return impl_->bWrite_;
 }
 
 
 TestReferenceChecker TestReferenceData::rootChecker()
 {
-    if (!isWriteMode() && !_impl->_bInUse && _impl->_refDoc == NULL)
+    if (!isWriteMode() && !impl_->bInUse_ && impl_->refDoc_ == NULL)
     {
         ADD_FAILURE() << "Reference data file not found: "
-                      << _impl->_fullFilename;
+                      << impl_->fullFilename_;
     }
-    _impl->_bInUse = true;
-    if (_impl->_refDoc == NULL)
+    impl_->bInUse_ = true;
+    if (impl_->refDoc_ == NULL)
     {
         return TestReferenceChecker(new TestReferenceChecker::Impl(isWriteMode()));
     }
-    xmlNodePtr rootNode = xmlDocGetRootElement(_impl->_refDoc);
+    xmlNodePtr rootNode = xmlDocGetRootElement(impl_->refDoc_);
     return TestReferenceChecker(
             new TestReferenceChecker::Impl("", rootNode, isWriteMode()));
 }
@@ -629,13 +629,13 @@ TestReferenceChecker TestReferenceData::rootChecker()
  */
 
 TestReferenceChecker::TestReferenceChecker(Impl *impl)
-    : _impl(impl)
+    : impl_(impl)
 {
 }
 
 
 TestReferenceChecker::TestReferenceChecker(const TestReferenceChecker &other)
-    : _impl(new Impl(*other._impl))
+    : impl_(new Impl(*other.impl_))
 {
 }
 
@@ -643,7 +643,7 @@ TestReferenceChecker::TestReferenceChecker(const TestReferenceChecker &other)
 TestReferenceChecker &
 TestReferenceChecker::operator =(const TestReferenceChecker &other)
 {
-    _impl.reset(new Impl(*other._impl));
+    impl_.reset(new Impl(*other.impl_));
     return *this;
 }
 
@@ -655,7 +655,7 @@ TestReferenceChecker::~TestReferenceChecker()
 
 bool TestReferenceChecker::isWriteMode() const
 {
-    return _impl->_bWrite;
+    return impl_->bWrite_;
 }
 
 
@@ -665,18 +665,18 @@ bool TestReferenceChecker::checkPresent(bool bPresent, const char *id)
     {
         return bPresent;
     }
-    xmlNodePtr node = _impl->findNode(NULL, id);
+    xmlNodePtr node = impl_->findNode(NULL, id);
     bool bFound = (node != NULL);
     if (bFound != bPresent)
     {
         ADD_FAILURE() << "Mismatch while checking reference data item'"
-                          << _impl->appendPath(id) << "'\n"
+                          << impl_->appendPath(id) << "'\n"
                       << "Expected: " << (bPresent ? "it is present.\n" : "it is absent.\n")
                       << "  Actual: " << (bFound ? "it is present." : "it is absent.");
     }
     if (bFound && bPresent)
     {
-        _impl->_nextSearchNode = node;
+        impl_->nextSearchNode_ = node;
         return true;
     }
     return false;
@@ -685,33 +685,33 @@ bool TestReferenceChecker::checkPresent(bool bPresent, const char *id)
 
 TestReferenceChecker TestReferenceChecker::checkCompound(const char *type, const char *id)
 {
-    SCOPED_TRACE(_impl->traceString(id));
-    if (_impl->shouldIgnore())
+    SCOPED_TRACE(impl_->traceString(id));
+    if (impl_->shouldIgnore())
     {
         return TestReferenceChecker(new Impl(isWriteMode()));
     }
     const xmlChar *xmlNodeName = reinterpret_cast<const xmlChar *>(type);
-    xmlNodePtr newNode = _impl->findOrCreateNode(xmlNodeName, id);
+    xmlNodePtr newNode = impl_->findOrCreateNode(xmlNodeName, id);
     if (newNode == NULL)
     {
         return TestReferenceChecker(new Impl(isWriteMode()));
     }
     return TestReferenceChecker(
-            new Impl(_impl->appendPath(id), newNode, isWriteMode()));
+            new Impl(impl_->appendPath(id), newNode, isWriteMode()));
 }
 
 
 void TestReferenceChecker::checkBoolean(bool value, const char *id)
 {
-    if (_impl->shouldIgnore())
+    if (impl_->shouldIgnore())
     {
         return;
     }
-    SCOPED_TRACE(_impl->traceString(id));
+    SCOPED_TRACE(impl_->traceString(id));
     bool bFound = false;
     const char *strValue = value ? "true" : "false";
     std::string refStrValue =
-        _impl->processItem(Impl::cBooleanNodeName, id, strValue, &bFound);
+        impl_->processItem(Impl::cBooleanNodeName, id, strValue, &bFound);
     if (bFound)
     {
         EXPECT_EQ(refStrValue, strValue);
@@ -721,14 +721,14 @@ void TestReferenceChecker::checkBoolean(bool value, const char *id)
 
 void TestReferenceChecker::checkString(const char *value, const char *id)
 {
-    if (_impl->shouldIgnore())
+    if (impl_->shouldIgnore())
     {
         return;
     }
-    SCOPED_TRACE(_impl->traceString(id));
+    SCOPED_TRACE(impl_->traceString(id));
     bool bFound = false;
     std::string refStrValue =
-        _impl->processItem(Impl::cStringNodeName, id, value, &bFound);
+        impl_->processItem(Impl::cStringNodeName, id, value, &bFound);
     if (bFound)
     {
         EXPECT_EQ(refStrValue, value);
@@ -745,12 +745,12 @@ void TestReferenceChecker::checkString(const std::string &value, const char *id)
 void TestReferenceChecker::checkStringBlock(const std::string &value,
                                             const char *id)
 {
-    if (_impl->shouldIgnore())
+    if (impl_->shouldIgnore())
     {
         return;
     }
-    SCOPED_TRACE(_impl->traceString(id));
-    xmlNodePtr node = _impl->findOrCreateNode(Impl::cStringNodeName, id);
+    SCOPED_TRACE(impl_->traceString(id));
+    xmlNodePtr node = impl_->findOrCreateNode(Impl::cStringNodeName, id);
     if (node == NULL)
     {
         return;
@@ -798,15 +798,15 @@ void TestReferenceChecker::checkStringBlock(const std::string &value,
 
 void TestReferenceChecker::checkInteger(int value, const char *id)
 {
-    if (_impl->shouldIgnore())
+    if (impl_->shouldIgnore())
     {
         return;
     }
-    SCOPED_TRACE(_impl->traceString(id));
+    SCOPED_TRACE(impl_->traceString(id));
     bool bFound = false;
     std::string strValue = formatString("%d", value);
     std::string refStrValue =
-        _impl->processItem(Impl::cIntegerNodeName, id, strValue, &bFound);
+        impl_->processItem(Impl::cIntegerNodeName, id, strValue, &bFound);
     if (bFound)
     {
         EXPECT_EQ(refStrValue, strValue);
@@ -816,15 +816,15 @@ void TestReferenceChecker::checkInteger(int value, const char *id)
 
 void TestReferenceChecker::checkDouble(double value, const char *id)
 {
-    if (_impl->shouldIgnore())
+    if (impl_->shouldIgnore())
     {
         return;
     }
-    SCOPED_TRACE(_impl->traceString(id));
+    SCOPED_TRACE(impl_->traceString(id));
     bool bFound = false;
     std::string strValue = formatString("%f", value);
     std::string refStrValue =
-        _impl->processItem(Impl::cRealNodeName, id, strValue, &bFound);
+        impl_->processItem(Impl::cRealNodeName, id, strValue, &bFound);
     if (bFound)
     {
         char *endptr;
index 4eace4a38aeab2c89daede58473736d988a2b038..946351fec9397224da5a7658f671a8c9a24642e5 100644 (file)
@@ -195,7 +195,7 @@ class TestReferenceData
     private:
         class Impl;
 
-        PrivateImplPointer<Impl> _impl;
+        PrivateImplPointer<Impl> impl_;
 };
 
 /*! \libinternal \brief
@@ -476,7 +476,7 @@ if (checker.checkPresent(bHaveVelocities, "Velocities"))
          */
         explicit TestReferenceChecker(Impl *impl);
 
-        PrivateImplPointer<Impl> _impl;
+        PrivateImplPointer<Impl> impl_;
 
         /*! \brief
          * Needed to expose the constructor only to TestReferenceData.