Line data Source code
1 : // Copyright (c) 2011-2022 Made to Order Software Corp. All Rights Reserved
2 : //
3 : // https://snapwebsites.org/project/edhttp
4 : // contact@m2osw.com
5 : //
6 : // This program is free software: you can redistribute it and/or modify
7 : // it under the terms of the GNU General Public License as published by
8 : // the Free Software Foundation, either version 3 of the License, or
9 : // (at your option) any later version.
10 : //
11 : // This program is distributed in the hope that it will be useful,
12 : // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 : // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 : // GNU General Public License for more details.
15 : //
16 : // You should have received a copy of the GNU General Public License
17 : // along with this program. If not, see <https://www.gnu.org/licenses/>.
18 : #pragma once
19 :
20 : /** \file
21 : * \brief Declaration of a URI validator to verify a parameter is a URI.
22 : *
23 : * The advgetopt library offers a validation system to verify command line
24 : * parameters. This addition allows to verify that a parameter is considered
25 : * a valid URI.
26 : */
27 :
28 : // self
29 : //
30 : #include <advgetopt/validator.h>
31 :
32 :
33 :
34 : namespace edhttp
35 : {
36 :
37 :
38 :
39 9 : class validator_uri
40 : : public advgetopt::validator
41 : {
42 : public:
43 : validator_uri(advgetopt::string_list_t const & data);
44 :
45 : // validator implementation
46 : //
47 : virtual std::string name() const override;
48 : virtual bool validate(std::string const & value) const override;
49 :
50 : private:
51 : bool f_accept_ip = false;
52 : bool f_accept_path = false;
53 : };
54 :
55 :
56 :
57 : } // namespace edhttp
58 : // vim: ts=4 sw=4 et
|