You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
989 B
38 lines
989 B
#ifndef _SMTPD_TOKEN_
|
|
#define _SMTPD_TOKEN_
|
|
|
|
#include <smtpd/types.hpp>
|
|
|
|
#include <vector>
|
|
#include <map>
|
|
#include <string>
|
|
#include <iostream>
|
|
#include <memory>
|
|
|
|
namespace smtpd {
|
|
using Token = String;
|
|
using TokenVector = std::vector<Token>;
|
|
|
|
TokenVector toTokenVector(String input, size_t maxTokens = -1);
|
|
String toString(TokenVector tokenVector);
|
|
class TokenPattern;
|
|
String toString(TokenPattern pattern);
|
|
|
|
class TokenPattern : public std::map<size_t, Token> {
|
|
private:
|
|
bool wildcard;
|
|
|
|
public:
|
|
TokenPattern();
|
|
TokenPattern(TokenVector tokens, bool wildcard = false);
|
|
TokenPattern(String input, bool wildcard = true);
|
|
|
|
TokenVector toTokens() const;
|
|
|
|
friend std::ostream& operator<<(std::ostream & out, const TokenPattern& pattern);
|
|
friend bool operator<(const TokenPattern& l, const TokenPattern& r);
|
|
friend bool operator==(const TokenPattern& l, const TokenPattern& r);
|
|
};
|
|
}
|
|
|
|
#endif |