szaszm commented on code in PR #1589:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1589#discussion_r1259363743
##########
libminifi/test/unit/ArrayUtilsTests.cpp:
##########
Review Comment:
These tests could be done using `static_assert`s. I think that would be
better: earlier failure, with more diagnostics, and doesn't depend on Catch2.
##########
libminifi/test/unit/CoreTests.cpp:
##########
Review Comment:
same here
##########
libminifi/include/agent/agent_docs.h:
##########
@@ -61,9 +63,12 @@ struct Components {
};
namespace detail {
-template<typename Container>
-auto toVector(const Container& container) {
- return std::vector<typename Container::value_type>(container.begin(),
container.end());
+inline auto toVector(std::span<const core::PropertyReference> properties) {
+ return std::vector<core::Property>(properties.begin(), properties.end());
+}
+
+inline auto toVector(std::span<const core::RelationshipDefinition>
relationships) {
+ return std::vector<core::Relationship>(relationships.begin(),
relationships.end());
Review Comment:
I'd use `span_to` here, instead of the local helpers. Before #1584, it's in
utils/gsl.h, afterwards in utils/span.h
##########
libminifi/include/core/OutputAttributeDefinition.h:
##########
@@ -0,0 +1,55 @@
+/**
+ * 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 <string_view>
+
+#include "utils/gsl.h"
+#include "RelationshipDefinition.h"
+
+namespace org::apache::nifi::minifi::core {
+
+template<size_t NumRelationships = 1>
+struct OutputAttributeDefinition {
+ constexpr OutputAttributeDefinition(std::string_view name,
std::array<RelationshipDefinition, NumRelationships> relationships,
std::string_view description)
+ : name(name),
+ relationships(relationships),
+ description(description) {
+ }
+
+ std::string_view name;
+ std::array<RelationshipDefinition, NumRelationships> relationships;
+ std::string_view description;
+};
+
+struct OutputAttributeReference {
+ constexpr OutputAttributeReference() = default; // TODO(fgerlits): is this
needed?
Review Comment:
Is it needed?
##########
libminifi/test/unit/EnumTests.cpp:
##########
Review Comment:
same here
##########
libminifi/include/core/Core.h:
##########
@@ -95,6 +98,62 @@ static inline std::string getClassName() {
#endif
}
+constexpr std::string_view removeStructOrClassPrefix(std::string_view input) {
+ constexpr std::string_view STRUCT = "struct "; // should be static
constexpr, but that is only allowed inside a constexpr function with std >=
c++23
+ constexpr std::string_view CLASS = "class ";
Review Comment:
Would `constinit const` work to circumvent the limitation?
--
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]