Add ValidatorsUtilities common code

This commit is contained in:
Vinnie Falco
2013-09-08 09:32:05 -07:00
parent e1f80ef6a6
commit bbc9e886dd
5 changed files with 56 additions and 0 deletions

View File

@@ -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

View File

@@ -0,0 +1,6 @@
//------------------------------------------------------------------------------
/*
Copyright (c) 2011-2013, OpenCoin, Inc.
*/
//==============================================================================

View 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