1//
2// Configurable.h
3//
4// Library: Foundation
5// Package: Logging
6// Module: Configurable
7//
8// Definition of the Configurable class.
9//
10// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
11// and Contributors.
12//
13// SPDX-License-Identifier: BSL-1.0
14//
15
16
17#ifndef Foundation_Configurable_INCLUDED
18#define Foundation_Configurable_INCLUDED
19
20
21#include "Poco/Foundation.h"
22
23
24namespace Poco {
25
26
27class Foundation_API Configurable
28 /// A simple interface that defines
29 /// getProperty() and setProperty() methods.
30 ///
31 /// This interface is implemented by Formatter and
32 /// Channel and is used to configure arbitrary
33 /// channels and formatters.
34 ///
35 /// A property is basically a name-value pair. For
36 /// simplicity, both names and values are strings.
37 /// Every property controls a certain aspect of a
38 /// Formatter or Channel. For example, the PatternFormatter's
39 /// formatting pattern is set via a property.
40 ///
41 /// NOTE: The following property names are use internally
42 /// by the logging framework and must not be used by
43 /// channels or formatters:
44 /// - class
45 /// - pattern (Channel)
46 /// - formatter (Channel)
47{
48public:
49 Configurable();
50 /// Creates the Configurable.
51
52 virtual ~Configurable();
53 /// Destroys the Configurable.
54
55 virtual void setProperty(const std::string& name, const std::string& value) = 0;
56 /// Sets the property with the given name to the given value.
57 /// If a property with the given name is not supported, a
58 /// PropertyNotSupportedException is thrown.
59
60 virtual std::string getProperty(const std::string& name) const = 0;
61 /// Returns the value of the property with the given name.
62 /// If a property with the given name is not supported, a
63 /// PropertyNotSupportedException is thrown.
64};
65
66
67} // namespace Poco
68
69
70#endif // Foundation_Configurable_INCLUDED
71