1//
2// Validator.h
3//
4// Library: Util
5// Package: Options
6// Module: Validator
7//
8// Definition of the Validator class.
9//
10// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
11// and Contributors.
12//
13// SPDX-License-Identifier: BSL-1.0
14//
15
16
17#ifndef Util_Validator_INCLUDED
18#define Util_Validator_INCLUDED
19
20
21#include "Poco/Util/Util.h"
22#include "Poco/RefCountedObject.h"
23
24
25namespace Poco {
26namespace Util {
27
28
29class Option;
30
31
32class Util_API Validator: public Poco::RefCountedObject
33 /// Validator specifies the interface for option validators.
34 ///
35 /// Option validators provide a simple way for the automatic
36 /// validation of command line argument values.
37{
38public:
39 virtual void validate(const Option& option, const std::string& value) = 0;
40 /// Validates the value for the given option.
41 /// Does nothing if the value is valid.
42 ///
43 /// Throws an OptionException otherwise.
44
45protected:
46 Validator();
47 /// Creates the Validator.
48
49 virtual ~Validator();
50 /// Destroys the Validator.
51};
52
53
54} } // namespace Poco::Util
55
56
57#endif // Util_Validator_INCLUDED
58