Merge remote-tracking branch 'origin/master' into refactor-reading
This commit is contained in:
@ -25,34 +25,34 @@
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
#define TOKENIZER_DEFAULT_SEPERATORS " \t\r\n\f"
|
||||
#define TOKENIZER_DEFAULT_SEPARATORS " \t\r\n\f"
|
||||
|
||||
class Tokenizer {
|
||||
std::vector<std::string> tokens;
|
||||
std::string text;
|
||||
std::string separators;
|
||||
size_t start;
|
||||
size_t ntokens;
|
||||
public:
|
||||
typedef std::vector<std::string>::iterator iterator;
|
||||
typedef std::vector<std::string>::const_iterator const_iterator;
|
||||
|
||||
Tokenizer(const std::string & str, const std::string & seperators = TOKENIZER_DEFAULT_SEPERATORS);
|
||||
Tokenizer(const std::string & str, const std::string & separators = TOKENIZER_DEFAULT_SEPARATORS);
|
||||
Tokenizer(Tokenizer &&);
|
||||
Tokenizer(const Tokenizer &);
|
||||
Tokenizer& operator=(const Tokenizer&) = default;
|
||||
Tokenizer& operator=(Tokenizer&&) = default;
|
||||
|
||||
iterator begin();
|
||||
iterator end();
|
||||
const_iterator cbegin() const;
|
||||
const_iterator cend() const;
|
||||
void reset();
|
||||
void skip(int n);
|
||||
bool has_next() const;
|
||||
bool contains(const std::string & str) const;
|
||||
std::string next();
|
||||
|
||||
std::string & operator[](size_t index);
|
||||
size_t count() const;
|
||||
size_t count();
|
||||
std::vector<std::string> as_vector();
|
||||
};
|
||||
|
||||
class TokenizerException : public std::exception {
|
||||
std::string message;
|
||||
public:
|
||||
TokenizerException(const std::string & msg, const std::string & token) : message(msg + ": '" + token + "'") {
|
||||
}
|
||||
TokenizerException(const std::string & msg, const std::string & token);
|
||||
|
||||
~TokenizerException() throw() {
|
||||
}
|
||||
@ -76,9 +76,8 @@ public:
|
||||
|
||||
class ValueTokenizer {
|
||||
Tokenizer tokens;
|
||||
Tokenizer::const_iterator current;
|
||||
public:
|
||||
ValueTokenizer(const std::string & str, const std::string & seperators = TOKENIZER_DEFAULT_SEPERATORS);
|
||||
ValueTokenizer(const std::string & str, const std::string & separators = TOKENIZER_DEFAULT_SEPARATORS);
|
||||
ValueTokenizer(const ValueTokenizer &);
|
||||
ValueTokenizer(ValueTokenizer &&);
|
||||
ValueTokenizer& operator=(const ValueTokenizer&) = default;
|
||||
@ -94,7 +93,7 @@ public:
|
||||
bool contains(const std::string & value) const;
|
||||
void skip(int ntokens);
|
||||
|
||||
size_t count() const;
|
||||
size_t count();
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user