mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Add ValidatorsUtilities common code
This commit is contained in:
@@ -62,6 +62,8 @@ namespace ripple
|
||||
# include "test/ConfigType.h"
|
||||
#include "test/TestOverlay.cpp"
|
||||
|
||||
# include "validator/ValidatorsUtilities.h"
|
||||
#include "validator/ValidatorsUtilities.cpp"
|
||||
# include "validator/ValidatorSourceStrings.h"
|
||||
# include "validator/ValidatorSourceTrustedUri.h"
|
||||
# include "validator/ValidatorsImp.h" // private
|
||||
|
||||
6
modules/ripple_core/validator/ValidatorsUtilities.cpp
Normal file
6
modules/ripple_core/validator/ValidatorsUtilities.cpp
Normal file
@@ -0,0 +1,6 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (c) 2011-2013, OpenCoin, Inc.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
35
modules/ripple_core/validator/ValidatorsUtilities.h
Normal file
35
modules/ripple_core/validator/ValidatorsUtilities.h
Normal file
@@ -0,0 +1,35 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (c) 2011-2013, OpenCoin, Inc.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_CORE_VALIDATORSUTILITIES_H_INCLUDED
|
||||
#define RIPPLE_CORE_VALIDATORSUTILITIES_H_INCLUDED
|
||||
|
||||
/** Common code for Validators classes.
|
||||
*/
|
||||
class ValidatorsUtilities
|
||||
{
|
||||
public:
|
||||
typedef std::vector <std::string> Strings;
|
||||
|
||||
/** Turn a linear buffer of newline delimited text into strings.
|
||||
This can be called incrementally, i.e. successive calls with
|
||||
multiple buffer segments.
|
||||
*/
|
||||
static void parseLines (Strings& lines, char const* buf, std::size_t bytes);
|
||||
|
||||
/** Parse a ConstBufferSequence of newline delimited text into strings.
|
||||
This works incrementally.
|
||||
*/
|
||||
template <typename ConstBufferSequence>
|
||||
static void parseLines (Strings& lines, ConstBufferSequence const& buffers)
|
||||
{
|
||||
for (typename ConstBufferSequence::const_iterator iter = buffers.begin ();
|
||||
iter != buffers.end (); ++iter)
|
||||
parserLines (lines, *iter);
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user