23 #ifndef DCCLDYNAMICCONDITIONALS20220214H
24 #define DCCLDYNAMICCONDITIONALS20220214H
26 #include <google/protobuf/descriptor.h>
27 #include <google/protobuf/message.h>
30 #include "option_extensions.pb.h"
45 void set_field(
const google::protobuf::FieldDescriptor* field_desc)
47 field_desc_ = field_desc;
50 void set_repeated_index(
int index) { index_ = index; }
52 void regenerate(
const google::protobuf::Message* this_msg,
53 const google::protobuf::Message* root_msg,
int repeated_index = -1);
55 const dccl::DCCLFieldOptions::Conditions& conditions();
57 bool has_required_if() {
return conditions().has_required_if() || conditions().has_only_if(); }
58 bool has_omit_if() {
return conditions().has_omit_if() || conditions().has_only_if(); }
59 bool has_only_if() {
return conditions().has_only_if(); }
60 bool has_min() {
return conditions().has_min(); }
61 bool has_max() {
return conditions().has_max(); }
72 std::string return_prefix(
const std::string& script)
74 if (script.find(
"return") == std::string::npos)
75 return "return " + script;
80 bool is_initialized() {
return root_msg_ && this_msg_ && field_desc_; }
81 const google::protobuf::FieldDescriptor* field_desc_{
nullptr};
82 const google::protobuf::Message* this_msg_{
nullptr};
83 const google::protobuf::Message* root_msg_{
nullptr};
87 sol::state* lua_{
nullptr};
Dynamic Compact Control Language namespace.