fgerlits commented on code in PR #1589: URL: https://github.com/apache/nifi-minifi-cpp/pull/1589#discussion_r1259936865
########## libminifi/include/core/PropertyDefinition.h: ########## @@ -0,0 +1,78 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#pragma once + +#include <array> +#include <optional> +#include <string_view> +#include <utility> + +#include "core/PropertyType.h" +#include "utils/gsl.h" + +namespace org::apache::nifi::minifi::core { + +template<size_t NumAllowedValues = 0, size_t NumAllowedTypes = 0, size_t NumDependentProperties = 0, size_t NumExclusiveOfProperties = 0> +struct PropertyDefinition { + std::string_view name; + std::string_view display_name; + std::string_view description; + bool is_required = false; + std::string_view valid_regex; + std::array<std::string_view, NumAllowedValues> allowed_values; + std::array<std::string_view, NumAllowedTypes> allowed_types; + std::array<std::string_view, NumDependentProperties> dependent_properties; + std::array<std::pair<std::string_view, std::string_view>, NumExclusiveOfProperties> exclusive_of_properties; + std::optional<std::string_view> default_value; + gsl::not_null<const PropertyType*> type = gsl::make_not_null(&StandardPropertyTypes::VALID_TYPE); + bool supports_expression_language = false; +}; + +struct PropertyReference { + std::string_view name; + std::string_view display_name; + std::string_view description; + bool is_required = false; + std::string_view valid_regex; + gsl::span<const std::string_view> allowed_values; + gsl::span<const std::string_view> allowed_types; + gsl::span<const std::string_view> dependent_properties; + gsl::span<const std::pair<std::string_view, std::string_view>> exclusive_of_properties; + std::optional<std::string_view> default_value; + const PropertyType* type; Review Comment: Good point; I've changed it to `gsl::not_null<const PropertyType*>` in 7e27458d3c2e7ed7ee089bcdde61b93c9d6afc68. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
