root/msg/lexutils.hh

Revision cc0a570a9262613f7046938be649f27646987cb8, 2.0 KB (checked in by Antti-Juhani Kaijanaho <antti-juhani@…>, 2 years ago)

Add support for Atom feeds, and implement a group feed

Partially addresses #8

Signed-off-by: Antti-Juhani Kaijanaho <antti-juhani@…>

  • Property mode set to 100644
Line 
1/*  This file is part of Alue, the multiprotocol Internet discussion daemon
2
3    Copyright © 2009, 2010 Antti-Juhani Kaijanaho
4
5    Alue is free software: you can redistribute it and/or modify it
6    under the terms of the GNU General Public License as published by
7    the Free Software Foundation, either version 3 of the License, or
8    (at your option) any later version.
9
10    Alue is distributed in the hope that it will be useful, but
11    WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    General Public License for more details.
14
15    You should have received a copy of the GNU General Public License
16    along with Alue.  If not, see <http://www.gnu.org/licenses/>.
17
18 */
19
20#ifndef GUARD_MSG_LEXUTILS_HH
21#define GUARD_MSG_LEXUTILS_HH
22
23#include <list>
24#include <string>
25
26namespace msg
27{
28        bool is_atext(char c);
29        void skip_cfws(std::string &);
30        std::string get_atom(std::string &str, bool decode = true, std::string extra_delimeters="");
31        std::string get_word(std::string &, bool decode = true);
32        std::string decode_unstructured(std::string);
33
34        // if there is no message id at the beginning of the string,
35        // returns a null string and shortens the argument string by
36        // an unspecified amount (by erasing an initial substring)
37        std::string get_msgid(std::string &);
38
39        std::list<std::string> parse_newsgroups_list(std::string ngline);
40
41        std::string make_phrase(std::string, bool encode = true);
42
43        std::string encode_unstructured(std::string);
44
45        // note: this assumes that any CR or LF is folding whitespace!
46        // (ie. don't use this for validation, or if you don't have
47        // the field boundary already marked)
48        inline bool is_fwsp(char c)
49        {
50                return c == ' ' || c == '\t' || c == '\r' || c == '\n';
51        }
52
53        bool eat_literal(std::string &, std::string literal,
54                         bool case_sensitive = true);
55}
56
57#endif /* GUARD_MSG_LEXUTILS_HH */
Note: See TracBrowser for help on using the browser.