11#include "webcface/common/webcface-config.h"
33 friend struct InputRefState;
48 template <
typename F,
typename std::enable_if_t<std::is_invocable_v<F>,
49 std::
nullptr_t> =
nullptr>
52 [callback = std::move(callback)](
const auto &) { callback(); });
63 onChange(std::forward<T>(callback));
83 std::optional<ValAdaptor> tryGet()
const;
93 typename std::enable_if_t<std::is_convertible_v<ValAdaptor, T>,
94 std::nullptr_t> =
nullptr>
96 return static_cast<T
>(
get());
147 template <
typename T,
148 typename std::enable_if_t<std::is_constructible_v<ValAdaptor, T>,
149 std::nullptr_t> =
nullptr>
151 return get() == other;
153 template <
typename T,
154 typename std::enable_if_t<std::is_constructible_v<ValAdaptor, T>,
155 std::nullptr_t> =
nullptr>
157 return get() != other;
160 template <
typename T,
typename std::enable_if_t<std::is_same_v<T, Variant>,
161 std::
nullptr_t> =
nullptr>
163 return static_cast<Field>(*this) ==
static_cast<Field>(other);
165 template <
typename T,
typename std::enable_if_t<std::is_same_v<T, Variant>,
166 std::
nullptr_t> =
nullptr>
168 return static_cast<Field>(*this) !=
static_cast<Field>(other);
190 using Field::lastName;
242 return child(std::to_string(index));
256 template <
typename F,
257 typename std::enable_if_t<std::is_invocable_v<F, Text>,
258 std::nullptr_t> =
nullptr>
261 [callback = std::move(callback)](
const Variant &base) {
262 callback(
Text(base));
272 template <
typename F,
typename std::enable_if_t<std::is_invocable_v<F>,
273 std::
nullptr_t> =
nullptr>
276 [callback = std::move(callback)](
const auto &) { callback(); });
286 template <
typename T>
288 onChange(std::forward<T>(callback));
343 std::optional<std::string> tryGet()
const;
348 std::optional<std::wstring> tryGetW()
const;
358 const std::string &
get()
const;
366 const std::wstring &getW()
const;
368 operator const std::string &()
const {
return get(); }
369 operator const std::wstring &()
const {
return getW(); }
385 [[deprecated]] std::chrono::system_clock::time_point time()
const;
391 const Text &free()
const;
395 bool operator==(std::wstring_view rhs)
const {
return this->getW() == rhs; }
396 bool operator!=(std::wstring_view rhs)
const {
return this->getW() != rhs; }
406 template <
typename T,
typename std::enable_if_t<std::is_same_v<T, Text>,
407 std::
nullptr_t> =
nullptr>
409 return static_cast<Field>(*this) ==
static_cast<Field>(other);
411 template <
typename T,
typename std::enable_if_t<std::is_same_v<T, Text>,
412 std::
nullptr_t> =
nullptr>
414 return static_cast<Field>(*this) !=
static_cast<Field>(other);
448 std::shared_ptr<internal::InputRefState> state;
450 void lockTo(
const Variant &target);
481 template <
typename T,
482 typename std::enable_if_t<std::is_convertible_v<ValAdaptor, T>,
483 std::nullptr_t> =
nullptr>
485 return static_cast<T
>(
get());
545 template <
typename T>
546 [[deprecated(
"use asDouble(), asInt() or asLLong() instead")]]
548 return get().as<T>();
557 template <
typename T,
558 typename std::enable_if_t<std::is_constructible_v<ValAdaptor, T>,
559 std::nullptr_t> =
nullptr>
561 return get() == other;
563 template <
typename T,
564 typename std::enable_if_t<std::is_constructible_v<ValAdaptor, T>,
565 std::nullptr_t> =
nullptr>
567 return get() != other;
572 typename std::enable_if_t<std::is_constructible_v<ValAdaptor, T>,
573 std::nullptr_t> =
nullptr>
575 return ref.
get() == other;
578 typename std::enable_if_t<std::is_constructible_v<ValAdaptor, T>,
579 std::nullptr_t> =
nullptr>
581 return ref.
get() != other;
584 return os << ref.
get();
u8stringとstringとwstringをshared_ptrで持ち共有する
Definition encoding.h:67
Viewを構築するときに使う一時的なViewComponent.
Definition component_view.h:286
文字列の送受信データを表すクラス
Definition text.h:183
const Text & operator=(std::wstring_view v) const
文字列をセットする (wstring)
Definition text.h:322
bool operator==(const T &other) const
Textの参照先を比較
Definition text.h:408
Text operator[](const char *field) const
Definition text.h:230
bool operator!=(std::string_view rhs) const
Definition text.h:394
const Text & set(std::wstring_view v) const
文字列をセットする (wstring)
Definition text.h:305
bool operator>(const Text &) const =delete
const Text & request() const
文字列をリクエストする
Definition text.h:332
Text child(std::string_view field) const
「(thisの名前).(追加の名前)」を新しい名前とするField
Definition text.h:198
Text operator[](std::wstring_view field) const
Definition text.h:225
bool operator>=(const Text &) const =delete
const Text & operator=(std::string_view v) const
文字列をセットする
Definition text.h:314
Text child(std::wstring_view field) const
「(thisの名前).(追加の名前)」を新しい名前とするField (wstring)
Definition text.h:205
Text child(int index) const
Definition text.h:213
Text parent() const
nameの最後のピリオドの前までを新しい名前とするField
Definition text.h:248
bool operator==(std::wstring_view rhs) const
Definition text.h:395
const Text & set(std::string_view v) const
文字列をセットする
Definition text.h:297
bool operator!=(const T &other) const
Definition text.h:413
bool operator==(std::string_view rhs) const
Definition text.h:393
Text(const Field &base, const SharedString &field)
Definition text.h:187
Text operator[](int index) const
Definition text.h:241
void appendListener(T &&callback) const
Definition text.h:287
bool operator<=(const Text &) const =delete
const Text & onChange(F callback) const
値が変化したときに呼び出されるコールバックを設定
Definition text.h:259
Text(const Field &base)
Definition text.h:186
bool operator<(const Text &) const =delete
Text operator[](const wchar_t *field) const
Definition text.h:234
Text operator[](std::string_view field) const
Definition text.h:220
bool operator!=(std::wstring_view rhs) const
Definition text.h:396
数値、文字列などの値を相互変換するクラス
Definition val_adaptor.h:87
文字列、数値などの型を送受信するクラス
Definition text.h:25
bool operator<=(const Variant &) const =delete
bool operator==(const T &other) const
Definition text.h:150
std::string asString() const
文字列として返す(コピー)
Definition text.h:120
const Variant & request() const
値をリクエストする
Definition text.cc:40
const std::wstring & asWStringRef() const
文字列として返す (wstring)
Definition text.h:115
bool empty() const
値が空かどうか調べる
Definition text.h:102
const std::string & asStringRef() const
文字列として返す
Definition text.h:110
long long asLLong() const
long long型の整数として返す
Definition text.h:140
const Variant & onChange(std::function< void(Variant)> callback) const
値が変化したときに呼び出されるコールバックを設定
Definition text.cc:61
bool operator!=(const T &other) const
Definition text.h:156
void appendListener(T &&callback) const
Definition text.h:62
bool asBool() const
bool値を返す
Definition text.h:145
int asInt() const
int型の整数として返す
Definition text.h:135
const Variant & onChange(F callback) const
値が変化したときに呼び出されるコールバックを設定
Definition text.h:50
const Variant & set(const ValAdaptor &v) const
値をセットする
Definition text.cc:50
double asDouble() const
実数として返す
Definition text.h:130
bool operator>(const Variant &) const =delete
Variant(const Field &base, const SharedString &field)
Definition text.h:29
bool operator>=(const Variant &) const =delete
std::wstring asWString() const
文字列として返す(コピー) (wstring)
Definition text.h:125
bool operator<(const Variant &) const =delete
std::ostream & operator<<(std::ostream &os, const Arg &arg)
Definition func_info.cc:100
bool operator==(const T &other, const InputRef &ref)
Definition text.h:574
const auto & get(const AxisAngle &aa)
Definition transform.h:231
bool operator!=(const T &other, const InputRef &ref)
Definition text.h:580
ClientDataの参照とメンバ名とデータ名を持つクラス
Definition field.h:71
Field parent() const
nameの最後のピリオドの前までを新しい名前とするField
Definition field.cc:33
Field child(const SharedString &field) const
Definition field.cc:42
#define WEBCFACE_DLL
Definition webcface-config.h:69
#define WEBCFACE_CALL
Definition webcface-config.h:106
#define WEBCFACE_NS_END
Definition webcface-config.h:118
#define WEBCFACE_NS_BEGIN
Definition webcface-config.h:117
#define WEBCFACE_CALL_FP
Definition webcface-config.h:107