Blender  V3.3
node_fn_string_length.cc
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 #include "BLI_string_utf8.h"
4 
5 #include <iomanip>
6 
7 #include "node_function_util.hh"
8 
10 
12 {
13  b.add_input<decl::String>(N_("String"));
14  b.add_output<decl::Int>(N_("Length"));
15 }
16 
18 {
19  static fn::CustomMF_SI_SO<std::string, int> str_len_fn{
20  "String Length", [](const std::string &a) { return BLI_strlen_utf8(a.c_str()); }};
21  builder.set_matching_fn(&str_len_fn);
22 }
23 
24 } // namespace blender::nodes::node_fn_string_length_cc
25 
27 {
28  namespace file_ns = blender::nodes::node_fn_string_length_cc;
29 
30  static bNodeType ntype;
31 
35  nodeRegisterType(&ntype);
36 }
#define NODE_CLASS_CONVERTER
Definition: BKE_node.h:351
void nodeRegisterType(struct bNodeType *ntype)
Definition: node.cc:1357
#define FN_NODE_STRING_LENGTH
Definition: BKE_node.h:1526
size_t BLI_strlen_utf8(const char *strc) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
Definition: string_utf8.c:317
void set_matching_fn(const MultiFunction *fn)
static unsigned a[3]
Definition: RandGen.cpp:78
static void fn_node_string_length_declare(NodeDeclarationBuilder &b)
static void fn_node_string_length_build_multi_function(NodeMultiFunctionBuilder &builder)
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
void register_node_type_fn_string_length()
void fn_node_type_base(bNodeType *ntype, int type, const char *name, short nclass)
Defines a node type.
Definition: BKE_node.h:226
NodeMultiFunctionBuildFunction build_multi_function
Definition: BKE_node.h:313
NodeDeclareFunction declare
Definition: BKE_node.h:324
#define N_(msgid)