WebCFace 3.1.1
Web-based Communication Framework & Dashboard-like UI
Loading...
Searching...
No Matches
arg.h
Go to the documentation of this file.
1#pragma once
2#include <vector>
3#include <optional>
6
7#ifdef min
8// clang-format off
9#pragma message("warning: Disabling macro definition of 'min' and 'max', since they conflicts in webcface/arg.h.")
10// clang-format on
11#undef min
12#undef max
13#endif
14
16
17namespace message {
18struct Arg;
19}
20namespace internal {
21struct FuncInfo;
22}
23
32 std::shared_ptr<message::Arg> msg_data;
33
38 ValType type_ = ValType::none_;
39
44 std::shared_ptr<message::Arg> initMsg();
45
46 public:
47 friend struct internal::FuncInfo;
52 void mergeConfig(const Arg &other);
57 explicit Arg(ValType type = ValType::none_);
62 explicit Arg(const std::shared_ptr<message::Arg> &msg_data);
63
68 explicit Arg(const SharedString &name);
74 Arg(StringInitializer name) : Arg(static_cast<SharedString &>(name)) {}
75
82 StringView name() const;
90 WStringView nameW() const;
95 ValType type() const;
100 Arg &type(ValType type);
107 std::optional<ValAdaptorVector> init() const;
112 template <typename T>
113 Arg &init(const T &init) {
114 return this->init(ValAdaptorVector(init));
115 }
120 return this->init(ValAdaptorVector(std::move(init)));
121 }
122 Arg &init(const ValAdaptorVector &init);
127 std::optional<double> min() const;
136 Arg &min(double min);
141 std::optional<double> max() const;
150 Arg &max(double max);
155 std::vector<ValAdaptor> option() const;
156 Arg &option(std::vector<ValAdaptor> option);
163 template <typename T>
164 Arg &option(std::initializer_list<T> option) {
165 std::vector<ValAdaptor> option_v;
166 for (const auto &v : option) {
167 option_v.emplace_back(ValAdaptor(v));
168 }
169 return this->option(std::move(option_v));
170 }
171};
172WEBCFACE_DLL std::ostream &WEBCFACE_CALL operator<<(std::ostream &os,
173 const Arg &arg);
引数の情報を表す。
Definition arg.h:31
Arg & init(StringInitializer init)
Definition arg.h:119
Arg(StringInitializer name)
引数名を設定する。
Definition arg.h:74
Arg & option(std::initializer_list< T > option)
引数の選択肢を設定する。
Definition arg.h:164
Arg & init(const T &init)
デフォルト値を設定する。
Definition arg.h:113
u8stringとstringとwstringをshared_ptrで持ち共有する
Definition encoding.h:170
SharedString のpublicなコンストラクタインタフェース (入力専用)
Definition encoding.h:235
webcfaceで管理されている文字列を参照するstring_view
Definition encoding.h:71
ValAdaptorのVector.
Definition val_adaptor_vec.h:17
数値、文字列などの値を相互変換するクラス
Definition val_adaptor.h:81
ValType
引数や戻り値の型を表すenum
Definition val_adaptor.h:21
関数1つの情報を表す。関数の実体も持つ
Definition func_internal.h:136
client(member)->server->client func登録
Definition func.h:91
#define WEBCFACE_DLL
Definition webcface-config.h:69
#define WEBCFACE_CALL
Definition webcface-config.h:106
#define WEBCFACE_NS_END
Definition webcface-config.h:113
#define WEBCFACE_NS_BEGIN
Definition webcface-config.h:112