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(); });
72 std::optional<ValAdaptor> tryGet()
const;
83 typename std::enable_if_t<std::is_convertible_v<ValAdaptor, T>,
84 std::nullptr_t> =
nullptr>
86 return static_cast<T
>(
get());
102 [[deprecated(
"(ver3.0〜) use asStringView() or asString() instead")]]
113 [[deprecated(
"(ver3.0〜) use asWStringView() or asWString() instead")]]
158 template <
typename T,
159 typename std::enable_if_t<std::is_constructible_v<ValAdaptor, T>,
160 std::nullptr_t> =
nullptr>
162 return get() == other;
164 template <
typename T,
165 typename std::enable_if_t<std::is_constructible_v<ValAdaptor, T>,
166 std::nullptr_t> =
nullptr>
168 return get() != other;
171 template <
typename T,
typename std::enable_if_t<std::is_same_v<T, Variant>,
172 std::
nullptr_t> =
nullptr>
174 return static_cast<Field>(*this) ==
static_cast<Field>(other);
176 template <
typename T,
typename std::enable_if_t<std::is_same_v<T, Variant>,
177 std::
nullptr_t> =
nullptr>
179 return static_cast<Field>(*this) !=
static_cast<Field>(other);
201 using Field::lastName;
202 using Field::lastNameW;
231 return child(std::move(field));
249 template <
typename CharT, std::size_t N,
250 typename std::enable_if_t<std::is_same_v<CharT, char> ||
251 std::is_same_v<CharT, wchar_t>,
252 std::nullptr_t> =
nullptr>
264 return child(std::to_string(index));
278 template <
typename F,
279 typename std::enable_if_t<std::is_invocable_v<F, Text>,
280 std::nullptr_t> =
nullptr>
283 [callback = std::move(callback)](
const Variant &base) {
284 callback(
Text(base));
294 template <
typename F,
typename std::enable_if_t<std::is_invocable_v<F>,
295 std::
nullptr_t> =
nullptr>
298 [callback = std::move(callback)](
const auto &) { callback(); });
320 this->set(std::move(v));
342 std::optional<StringView> tryGet()
const;
351 std::optional<WStringView> tryGetW()
const;
378 operator std::string_view()
const {
return get(); }
384 operator std::wstring_view()
const {
return getW(); }
400 const Text &free()
const;
404 bool operator==(std::wstring_view rhs)
const {
return this->getW() == rhs; }
405 bool operator!=(std::wstring_view rhs)
const {
return this->getW() != rhs; }
415 template <
typename T,
typename std::enable_if_t<std::is_same_v<T, Text>,
416 std::
nullptr_t> =
nullptr>
418 return static_cast<Field>(*this) ==
static_cast<Field>(other);
420 template <
typename T,
typename std::enable_if_t<std::is_same_v<T, Text>,
421 std::
nullptr_t> =
nullptr>
423 return static_cast<Field>(*this) !=
static_cast<Field>(other);
457 std::shared_ptr<internal::InputRefState> state;
459 void lockTo(
const Variant &target);
491 template <
typename T,
492 typename std::enable_if_t<std::is_convertible_v<ValAdaptor, T>,
493 std::nullptr_t> =
nullptr>
495 return static_cast<T
>(
get());
517 [[deprecated(
"(ver3.0〜) use asStringView() or asString() instead")]]
530 [[deprecated(
"(ver3.0〜) use asWStringView() or asWString() instead")]]
579 template <
typename T>
580 [[deprecated(
"use asDouble(), asInt() or asLLong() instead")]]
582 return get().as<T>();
591 template <
typename T,
592 typename std::enable_if_t<std::is_constructible_v<ValAdaptor, T>,
593 std::nullptr_t> =
nullptr>
595 return get() == other;
597 template <
typename T,
598 typename std::enable_if_t<std::is_constructible_v<ValAdaptor, T>,
599 std::nullptr_t> =
nullptr>
601 return get() != other;
606 typename std::enable_if_t<std::is_constructible_v<ValAdaptor, T>,
607 std::nullptr_t> =
nullptr>
609 return ref.
get() == other;
612 typename std::enable_if_t<std::is_constructible_v<ValAdaptor, T>,
613 std::nullptr_t> =
nullptr>
615 return ref.
get() != other;
618 return os << ref.
get();
u8stringとstringとwstringをshared_ptrで持ち共有する
Definition encoding.h:170
SharedString のpublicなコンストラクタインタフェース (入力専用)
Definition encoding.h:235
webcfaceで管理されている文字列を参照するstring_view
Definition encoding.h:71
Viewを構築するときに使う一時的なViewComponent.
Definition component_view.h:292
文字列の送受信データを表すクラス
Definition text.h:194
bool operator==(const T &other) const
Textの参照先を比較
Definition text.h:417
Text operator[](const char *field) const
Definition text.h:240
bool operator!=(std::string_view rhs) const
Definition text.h:403
Text child(StringInitializer field) const
「(thisの名前).(追加の名前)」を新しい名前とするField
Definition text.h:212
Text operator[](const CharT(&static_str)[N])
Definition text.h:253
bool operator>(const Text &) const =delete
const Text & request() const
文字列をリクエストする
Definition text.h:329
const Text & operator=(StringInitializer v) const
文字列をセットする
Definition text.h:319
bool operator>=(const Text &) const =delete
Text child(int index) const
Definition text.h:220
Text parent() const
nameの最後のピリオドの前までを新しい名前とするField
Definition text.h:270
bool operator==(std::wstring_view rhs) const
Definition text.h:404
bool operator!=(const T &other) const
Definition text.h:422
bool operator==(std::string_view rhs) const
Definition text.h:402
Text(const Field &base, const SharedString &field)
Definition text.h:198
Text operator[](int index) const
Definition text.h:263
bool operator<=(const Text &) const =delete
const Text & onChange(F callback) const
値が変化したときに呼び出されるコールバックを設定
Definition text.h:281
Text(const Field &base)
Definition text.h:197
bool operator<(const Text &) const =delete
Text operator[](const wchar_t *field) const
Definition text.h:244
const Text & set(StringInitializer v) const
文字列をセットする
Definition text.h:308
Text operator[](StringInitializer field) const
Definition text.h:230
bool operator!=(std::wstring_view rhs) const
Definition text.h:405
数値、文字列などの値を相互変換するクラス
Definition val_adaptor.h:81
文字列、数値などの型を送受信するクラス
Definition text.h:25
bool operator<=(const Variant &) const =delete
bool operator==(const T &other) const
Definition text.h:161
std::string asString() const
文字列として返す(コピー)
Definition text.h:131
const Variant & request() const
値をリクエストする
Definition text.cc:40
std::string asStringRef() const
文字列として返す
Definition text.h:103
StringView asStringView() const
null終端の文字列の参照として返す
Definition text.h:121
bool empty() const
値が空かどうか調べる
Definition text.h:92
std::wstring asWStringRef() const
文字列として返す (wstring)
Definition text.h:114
long long asLLong() const
long long型の整数として返す
Definition text.h:151
const Variant & onChange(std::function< void(Variant)> callback) const
値が変化したときに呼び出されるコールバックを設定
Definition text.cc:61
bool operator!=(const T &other) const
Definition text.h:167
bool asBool() const
bool値を返す
Definition text.h:156
int asInt() const
int型の整数として返す
Definition text.h:146
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:141
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:136
bool operator<(const Variant &) const =delete
WStringView asWStringView() const
null終端の文字列の参照として返す (wstring)
Definition text.h:126
std::ostream & operator<<(std::ostream &os, const Arg &arg)
Definition func_info.cc:99
bool operator==(const T &other, const InputRef &ref)
Definition text.h:608
const auto & get(const AxisAngle &aa)
Definition transform.h:227
bool operator!=(const T &other, const InputRef &ref)
Definition text.h:614
ClientDataの参照とメンバ名とデータ名を持つクラス
Definition field.h:68
Field parent() const
nameの最後のピリオドの前までを新しい名前とするField
Definition field.cc:39
Field child(const SharedString &field) const
Definition field.cc:48
#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