Line data Source code
1 : // Copyright (c) 2006-2022 Made to Order Software Corp. All Rights Reserved
2 : //
3 : // https://snapwebsites.org/project/advgetopt
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 2 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 along
17 : // with this program; if not, write to the Free Software Foundation, Inc.,
18 : // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 : #pragma once
20 :
21 : /** \file
22 : * \brief Declaration of a validator handling multiple sub-validators.
23 : *
24 : * The library offers a way to validate the parameters passed on the command
25 : * line or in configuration files.
26 : *
27 : * At times, a parameter can be set to several different types. This
28 : * validator gives the library this ability.
29 : */
30 :
31 : // self
32 : //
33 : #include <advgetopt/validator.h>
34 :
35 :
36 :
37 : namespace advgetopt
38 : {
39 :
40 :
41 :
42 2 : class validator_list
43 : : public validator
44 : {
45 : public:
46 : typedef std::shared_ptr<validator_list> pointer_t;
47 :
48 : validator_list(string_list_t const & data);
49 :
50 : void add_validator(validator::pointer_t v);
51 :
52 : // validator implementation
53 : //
54 : virtual std::string name() const override;
55 : virtual bool validate(std::string const & value) const override;
56 :
57 : private:
58 : validator::vector_t f_validators = validator::vector_t();
59 : };
60 :
61 :
62 :
63 : } // namespace advgetopt
64 : // vim: ts=4 sw=4 et
|