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(); });
64 onChange(std::forward<T>(callback));
84 std::optional<ValAdaptor> tryGet()
const;
95 typename std::enable_if_t<std::is_convertible_v<ValAdaptor, T>,
96 std::nullptr_t> =
nullptr>
98 return static_cast<T
>(
get());
114 [[deprecated(
"(ver2.10〜) use asStringView() or asString() instead")]]
125 [[deprecated(
"(ver2.10〜) use asWStringView() or asWString() instead")]]
170 template <
typename T,
171 typename std::enable_if_t<std::is_constructible_v<ValAdaptor, T>,
172 std::nullptr_t> =
nullptr>
174 return get() == other;
176 template <
typename T,
177 typename std::enable_if_t<std::is_constructible_v<ValAdaptor, T>,
178 std::nullptr_t> =
nullptr>
180 return get() != other;
183 template <
typename T,
typename std::enable_if_t<std::is_same_v<T, Variant>,
184 std::
nullptr_t> =
nullptr>
186 return static_cast<Field>(*this) ==
static_cast<Field>(other);
188 template <
typename T,
typename std::enable_if_t<std::is_same_v<T, Variant>,
189 std::
nullptr_t> =
nullptr>
191 return static_cast<Field>(*this) !=
static_cast<Field>(other);
213 using Field::lastName;
242 return child(std::move(field));
260 template <
typename CharT, std::size_t N,
261 typename std::enable_if_t<std::is_same_v<CharT, char> ||
262 std::is_same_v<CharT, wchar_t>,
263 std::nullptr_t> =
nullptr>
275 return child(std::to_string(index));
289 template <
typename F,
290 typename std::enable_if_t<std::is_invocable_v<F, Text>,
291 std::nullptr_t> =
nullptr>
294 [callback = std::move(callback)](
const Variant &base) {
295 callback(
Text(base));
305 template <
typename F,
typename std::enable_if_t<std::is_invocable_v<F>,
306 std::
nullptr_t> =
nullptr>
309 [callback = std::move(callback)](
const auto &) { callback(); });
319 template <
typename T>
322 onChange(std::forward<T>(callback));
343 this->set(std::move(v));
365 std::optional<StringView> tryGet()
const;
374 std::optional<WStringView> tryGetW()
const;
401 operator std::string_view()
const {
return get(); }
407 operator std::wstring_view()
const {
return getW(); }
424 std::chrono::system_clock::time_point time()
const;
430 const Text &free()
const;
434 bool operator==(std::wstring_view rhs)
const {
return this->getW() == rhs; }
435 bool operator!=(std::wstring_view rhs)
const {
return this->getW() != rhs; }
445 template <
typename T,
typename std::enable_if_t<std::is_same_v<T, Text>,
446 std::
nullptr_t> =
nullptr>
448 return static_cast<Field>(*this) ==
static_cast<Field>(other);
450 template <
typename T,
typename std::enable_if_t<std::is_same_v<T, Text>,
451 std::
nullptr_t> =
nullptr>
453 return static_cast<Field>(*this) !=
static_cast<Field>(other);
487 std::shared_ptr<internal::InputRefState> state;
489 void lockTo(
const Variant &target);
521 template <
typename T,
522 typename std::enable_if_t<std::is_convertible_v<ValAdaptor, T>,
523 std::nullptr_t> =
nullptr>
525 return static_cast<T
>(
get());
547 [[deprecated(
"(ver2.10〜) use asStringView() or asString() instead")]]
560 [[deprecated(
"(ver2.10〜) use asWStringView() or asWString() instead")]]
609 template <
typename T>
610 [[deprecated(
"use asDouble(), asInt() or asLLong() instead")]]
612 return get().as<T>();
621 template <
typename T,
622 typename std::enable_if_t<std::is_constructible_v<ValAdaptor, T>,
623 std::nullptr_t> =
nullptr>
625 return get() == other;
627 template <
typename T,
628 typename std::enable_if_t<std::is_constructible_v<ValAdaptor, T>,
629 std::nullptr_t> =
nullptr>
631 return get() != other;
636 typename std::enable_if_t<std::is_constructible_v<ValAdaptor, T>,
637 std::nullptr_t> =
nullptr>
639 return ref.
get() == other;
642 typename std::enable_if_t<std::is_constructible_v<ValAdaptor, T>,
643 std::nullptr_t> =
nullptr>
645 return ref.
get() != other;
648 return os << ref.
get();
u8stringとstringとwstringをshared_ptrで持ち共有する
Definition encoding.h:159
SharedString のpublicなコンストラクタインタフェース (入力専用)
Definition encoding.h:215
webcfaceで管理されている文字列を参照するstring_view
Definition encoding.h:60
Viewを構築するときに使う一時的なViewComponent.
Definition component_view.h:292
文字列の送受信データを表すクラス
Definition text.h:206
bool operator==(const T &other) const
Textの参照先を比較
Definition text.h:447
Text operator[](const char *field) const
Definition text.h:251
bool operator!=(std::string_view rhs) const
Definition text.h:433
Text child(StringInitializer field) const
「(thisの名前).(追加の名前)」を新しい名前とするField
Definition text.h:223
Text operator[](const CharT(&static_str)[N])
Definition text.h:264
bool operator>(const Text &) const =delete
const Text & request() const
文字列をリクエストする
Definition text.h:352
const Text & operator=(StringInitializer v) const
文字列をセットする
Definition text.h:342
bool operator>=(const Text &) const =delete
Text child(int index) const
Definition text.h:231
Text parent() const
nameの最後のピリオドの前までを新しい名前とするField
Definition text.h:281
bool operator==(std::wstring_view rhs) const
Definition text.h:434
bool operator!=(const T &other) const
Definition text.h:452
bool operator==(std::string_view rhs) const
Definition text.h:432
Text(const Field &base, const SharedString &field)
Definition text.h:210
Text operator[](int index) const
Definition text.h:274
void appendListener(T &&callback) const
Definition text.h:321
bool operator<=(const Text &) const =delete
const Text & onChange(F callback) const
値が変化したときに呼び出されるコールバックを設定
Definition text.h:292
Text(const Field &base)
Definition text.h:209
bool operator<(const Text &) const =delete
Text operator[](const wchar_t *field) const
Definition text.h:255
const Text & set(StringInitializer v) const
文字列をセットする
Definition text.h:331
Text operator[](StringInitializer field) const
Definition text.h:241
bool operator!=(std::wstring_view rhs) const
Definition text.h:435
数値、文字列などの値を相互変換するクラス
Definition val_adaptor.h:81
文字列、数値などの型を送受信するクラス
Definition text.h:25
bool operator<=(const Variant &) const =delete
bool operator==(const T &other) const
Definition text.h:173
std::string asString() const
文字列として返す(コピー)
Definition text.h:143
const Variant & request() const
値をリクエストする
Definition text.cc:40
std::string asStringRef() const
文字列として返す
Definition text.h:115
StringView asStringView() const
null終端の文字列の参照として返す
Definition text.h:133
bool empty() const
値が空かどうか調べる
Definition text.h:104
std::wstring asWStringRef() const
文字列として返す (wstring)
Definition text.h:126
long long asLLong() const
long long型の整数として返す
Definition text.h:163
const Variant & onChange(std::function< void(Variant)> callback) const
値が変化したときに呼び出されるコールバックを設定
Definition text.cc:61
bool operator!=(const T &other) const
Definition text.h:179
void appendListener(T &&callback) const
Definition text.h:63
bool asBool() const
bool値を返す
Definition text.h:168
int asInt() const
int型の整数として返す
Definition text.h:158
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:153
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:148
bool operator<(const Variant &) const =delete
WStringView asWStringView() const
null終端の文字列の参照として返す (wstring)
Definition text.h:138
std::ostream & operator<<(std::ostream &os, const Arg &arg)
Definition func_info.cc:98
bool operator==(const T &other, const InputRef &ref)
Definition text.h:638
const auto & get(const AxisAngle &aa)
Definition transform.h:231
bool operator!=(const T &other, const InputRef &ref)
Definition text.h:644
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:113
#define WEBCFACE_NS_BEGIN
Definition webcface-config.h:112
#define WEBCFACE_CALL_FP
Definition webcface-config.h:107