WebCFace 2.5.2
Web-based Communication Framework & Dashboard-like UI
Loading...
Searching...
No Matches
Variant Class Reference

文字列、数値などの型を送受信するクラス More...

#include <webcface/text.h>

Inheritance diagram for Variant:
[legend]
Collaboration diagram for Variant:
[legend]

Public Member Functions

 Variant ()=default
 
 Variant (const Field &base)
 
 Variant (const Field &base, const SharedString &field)
 
const VariantonChange (std::function< void(Variant)> callback) const
 値が変化したときに呼び出されるコールバックを設定
 
template<typename F , typename std::enable_if_t< std::is_invocable_v< F >, std::nullptr_t > = nullptr>
const VariantonChange (F callback) const
 値が変化したときに呼び出されるコールバックを設定
 
template<typename T >
void appendListener (T &&callback) const
 
const Variantrequest () const
 値をリクエストする
 
std::optional< ValAdaptortryGet () const
 値を取得する
 
const ValAdaptorget () const
 値を取得する
 
template<typename T , typename std::enable_if_t< std::is_convertible_v< ValAdaptor, T >, std::nullptr_t > = nullptr>
 operator T () const
 
bool empty () const
 値が空かどうか調べる
 
const std::string & asStringRef () const
 文字列として返す
 
const std::wstring & asWStringRef () const
 文字列として返す (wstring)
 
std::string asString () const
 文字列として返す(コピー)
 
std::wstring asWString () const
 文字列として返す(コピー) (wstring)
 
double asDouble () const
 実数として返す
 
int asInt () const
 int型の整数として返す
 
long long asLLong () const
 long long型の整数として返す
 
bool asBool () const
 bool値を返す
 
template<typename T , typename std::enable_if_t< std::is_constructible_v< ValAdaptor, T >, std::nullptr_t > = nullptr>
bool operator== (const T &other) const
 
template<typename T , typename std::enable_if_t< std::is_constructible_v< ValAdaptor, T >, std::nullptr_t > = nullptr>
bool operator!= (const T &other) const
 
template<typename T , typename std::enable_if_t< std::is_same_v< T, Variant >, std::nullptr_t > = nullptr>
bool operator== (const T &other) const
 
template<typename T , typename std::enable_if_t< std::is_same_v< T, Variant >, std::nullptr_t > = nullptr>
bool operator!= (const T &other) const
 
bool operator< (const Variant &) const =delete
 
bool operator<= (const Variant &) const =delete
 
bool operator> (const Variant &) const =delete
 
bool operator>= (const Variant &) const =delete
 

Protected Member Functions

const Variantset (const ValAdaptor &v) const
 値をセットする
 
std::shared_ptr< internal::ClientDatadataLock () const
 data_wをlockし、失敗したらruntime_errorを投げる
 
std::shared_ptr< internal::ClientDatasetCheck () const
 data_wをlockし、memberがselfではなければinvalid_argumentを投げる
 
bool expired () const
 
Member member () const
 Memberを返す
 
const std::string & name () const
 field名を返す
 
const std::wstring & nameW () const
 field名を返す (wstring)
 
SharedString lastName8 () const
 
Field child (const SharedString &field) const
 
Field child (std::string_view field) const
 「(thisの名前).(追加の名前)」を新しい名前とするField
 
Field child (std::wstring_view field) const
 「(thisの名前).(追加の名前)」を新しい名前とするField (wstring)
 
Field child (int index) const
 「(thisの名前).(index)」を新しい名前とするField
 
std::string lastName () const
 nameのうちピリオドで区切られた最後の部分を取り出す
 
std::wstring lastNameW () const
 nameのうちピリオドで区切られた最後の部分を取り出す (wstring)
 
Field parent () const
 nameの最後のピリオドの前までを新しい名前とするField
 
Field operator[] (std::string_view field) const
 「(thisの名前).(追加の名前)」を新しい名前とするField
 
Field operator[] (std::wstring_view field) const
 「(thisの名前).(追加の名前)」を新しい名前とするField (wstring)
 
Field operator[] (int index) const
 「(thisの名前).(index)」を新しい名前とするField
 
Value value (std::string_view field="") const
 
Value value (std::wstring_view field) const
 
Text text (std::string_view field="") const
 
Text text (std::wstring_view field) const
 
RobotModel robotModel (std::string_view field="") const
 
RobotModel robotModel (std::wstring_view field) const
 
Image image (std::string_view field="") const
 
Image image (std::wstring_view field) const
 
Func func (std::string_view field="") const
 
Func func (std::wstring_view field) const
 
FuncListener funcListener (std::string_view field) const
 
FuncListener funcListener (std::wstring_view field) const
 
View view (std::string_view field="") const
 
View view (std::wstring_view field) const
 
Canvas3D canvas3D (std::string_view field="") const
 
Canvas3D canvas3D (std::wstring_view field) const
 
Canvas2D canvas2D (std::string_view field="") const
 
Canvas2D canvas2D (std::wstring_view field) const
 
Log log (std::string_view field="") const
 
Log log (std::wstring_view field) const
 
std::vector< ValuevalueEntries () const
 
std::vector< TexttextEntries () const
 
std::vector< RobotModelrobotModelEntries () const
 
std::vector< FuncfuncEntries () const
 
std::vector< ViewviewEntries () const
 
std::vector< Canvas3Dcanvas3DEntries () const
 
std::vector< Canvas2Dcanvas2DEntries () const
 
std::vector< ImageimageEntries () const
 
std::vector< LoglogEntries () const
 
bool isSelf () const
 memberがselfならtrue
 
bool operator== (const Field &other) const
 
bool operator== (const FieldBase &rhs) const
 
bool operator!= (const Field &other) const
 
bool operator!= (const FieldBase &rhs) const
 

Protected Attributes

std::weak_ptr< internal::ClientDatadata_w
 ClientDataの参照
 
SharedString member_
 メンバー名
 
SharedString field_
 フィールド名
 

Friends

class InputRef
 
struct InputRefState
 
class TemporalViewComponent
 

Detailed Description

文字列、数値などの型を送受信するクラス

Since
ver2.0
  • ver1.11までTextにあった機能をVariantとTextに分離し、TextとInputRefのベースになるクラス
  • Textと同じメッセージで送受信するが、数値型も受け付ける

Constructor & Destructor Documentation

◆ Variant() [1/3]

Variant ( )
default

◆ Variant() [2/3]

Variant ( const Field base)

◆ Variant() [3/3]

Variant ( const Field base,
const SharedString field 
)
inline

Member Function Documentation

◆ appendListener()

template<typename T >
void appendListener ( T &&  callback) const
inline
Deprecated:
ver1.11まではEventTarget::appendListener()でコールバックを追加できたが、 ver2.0からコールバックは1個のみになった。 互換性のため残しているがonChange()と同じ

◆ asBool()

bool asBool ( ) const
inline

bool値を返す

◆ asDouble()

double asDouble ( ) const
inline

実数として返す

◆ asInt()

int asInt ( ) const
inline

int型の整数として返す

◆ asLLong()

long long asLLong ( ) const
inline

long long型の整数として返す

◆ asString()

std::string asString ( ) const
inline

文字列として返す(コピー)

◆ asStringRef()

const std::string & asStringRef ( ) const
inline

文字列として返す

std::stringのconst参照を返す。 参照は少なくとも次のClient::sync()までは有効

◆ asWString()

std::wstring asWString ( ) const
inline

文字列として返す(コピー) (wstring)

◆ asWStringRef()

const std::wstring & asWStringRef ( ) const
inline

文字列として返す (wstring)

See also
asStringRef()

◆ canvas2D() [1/2]

Canvas2D canvas2D ( std::string_view  field = "") const
inherited

◆ canvas2D() [2/2]

Canvas2D canvas2D ( std::wstring_view  field) const
inherited

◆ canvas2DEntries()

std::vector< Canvas2D > canvas2DEntries ( ) const
inherited

◆ canvas3D() [1/2]

Canvas3D canvas3D ( std::string_view  field = "") const
inherited

◆ canvas3D() [2/2]

Canvas3D canvas3D ( std::wstring_view  field) const
inherited

◆ canvas3DEntries()

std::vector< Canvas3D > canvas3DEntries ( ) const
inherited

◆ child() [1/4]

Field child ( const SharedString field) const
inherited

◆ child() [2/4]

Field child ( int  index) const
inlineinherited

「(thisの名前).(index)」を新しい名前とするField

Since
ver1.11

◆ child() [3/4]

Field child ( std::string_view  field) const
inlineinherited

「(thisの名前).(追加の名前)」を新しい名前とするField

Since
ver1.11

◆ child() [4/4]

Field child ( std::wstring_view  field) const
inlineinherited

「(thisの名前).(追加の名前)」を新しい名前とするField (wstring)

Since
ver2.0

◆ dataLock()

std::shared_ptr< internal::ClientData > dataLock ( ) const
inherited

data_wをlockし、失敗したらruntime_errorを投げる

◆ empty()

bool empty ( ) const
inline

値が空かどうか調べる

◆ expired()

bool expired ( ) const
inherited

◆ func() [1/2]

Func func ( std::string_view  field = "") const
inherited

◆ func() [2/2]

Func func ( std::wstring_view  field) const
inherited

◆ funcEntries()

std::vector< Func > funcEntries ( ) const
inherited

◆ funcListener() [1/2]

FuncListener funcListener ( std::string_view  field) const
inherited

◆ funcListener() [2/2]

FuncListener funcListener ( std::wstring_view  field) const
inherited

◆ get()

const ValAdaptor & get ( ) const

値を取得する

参照は少なくとも次のClient::sync()までは有効

◆ image() [1/2]

Image image ( std::string_view  field = "") const
inherited

◆ image() [2/2]

Image image ( std::wstring_view  field) const
inherited

◆ imageEntries()

std::vector< Image > imageEntries ( ) const
inherited

◆ isSelf()

bool isSelf ( ) const
inherited

memberがselfならtrue

data_wがlockできなければruntime_errorを投げる

◆ lastName()

std::string lastName ( ) const
inlineinherited

nameのうちピリオドで区切られた最後の部分を取り出す

Since
ver1.11

◆ lastName8()

SharedString lastName8 ( ) const
protectedinherited

◆ lastNameW()

std::wstring lastNameW ( ) const
inlineinherited

nameのうちピリオドで区切られた最後の部分を取り出す (wstring)

Since
ver2.0

◆ log() [1/2]

Log log ( std::string_view  field = "") const
inherited
Since
ver2.4

◆ log() [2/2]

Log log ( std::wstring_view  field) const
inherited
Since
ver2.4

◆ logEntries()

std::vector< Log > logEntries ( ) const
inherited
Since
ver2.4

◆ member()

Member member ( ) const
inherited

Memberを返す

◆ name()

const std::string & name ( ) const
inlineinherited

field名を返す

◆ nameW()

const std::wstring & nameW ( ) const
inlineinherited

field名を返す (wstring)

Since
ver2.0

◆ onChange() [1/2]

template<typename F , typename std::enable_if_t< std::is_invocable_v< F >, std::nullptr_t > = nullptr>
const Variant & onChange ( callback) const
inline

値が変化したときに呼び出されるコールバックを設定

Parameters
callback引数をとらない関数

◆ onChange() [2/2]

const Variant & onChange ( std::function< void(Variant)>  callback) const

値が変化したときに呼び出されるコールバックを設定

Parameters
callbackVariant型の引数(thisが渡される)を1つ取る関数

◆ operator T()

template<typename T , typename std::enable_if_t< std::is_convertible_v< ValAdaptor, T >, std::nullptr_t > = nullptr>
operator T ( ) const
inline

◆ operator!=() [1/4]

bool operator!= ( const Field other) const
inlineinherited

◆ operator!=() [2/4]

bool operator!= ( const FieldBase rhs) const
inlineinherited

◆ operator!=() [3/4]

template<typename T , typename std::enable_if_t< std::is_constructible_v< ValAdaptor, T >, std::nullptr_t > = nullptr>
bool operator!= ( const T &  other) const
inline

◆ operator!=() [4/4]

template<typename T , typename std::enable_if_t< std::is_same_v< T, Variant >, std::nullptr_t > = nullptr>
bool operator!= ( const T &  other) const
inline

◆ operator<()

bool operator< ( const Variant ) const
delete

◆ operator<=()

bool operator<= ( const Variant ) const
delete

◆ operator==() [1/4]

bool operator== ( const Field other) const
inherited

◆ operator==() [2/4]

bool operator== ( const FieldBase rhs) const
inlineinherited

◆ operator==() [3/4]

template<typename T , typename std::enable_if_t< std::is_constructible_v< ValAdaptor, T >, std::nullptr_t > = nullptr>
bool operator== ( const T &  other) const
inline

◆ operator==() [4/4]

template<typename T , typename std::enable_if_t< std::is_same_v< T, Variant >, std::nullptr_t > = nullptr>
bool operator== ( const T &  other) const
inline

◆ operator>()

bool operator> ( const Variant ) const
delete

◆ operator>=()

bool operator>= ( const Variant ) const
delete

◆ operator[]() [1/3]

Field operator[] ( int  index) const
inlineinherited

「(thisの名前).(index)」を新しい名前とするField

Since
ver1.11

◆ operator[]() [2/3]

Field operator[] ( std::string_view  field) const
inlineinherited

「(thisの名前).(追加の名前)」を新しい名前とするField

Since
ver1.11

◆ operator[]() [3/3]

Field operator[] ( std::wstring_view  field) const
inlineinherited

「(thisの名前).(追加の名前)」を新しい名前とするField (wstring)

Since
ver2.0

◆ parent()

Field parent ( ) const
inherited

nameの最後のピリオドの前までを新しい名前とするField

Since
ver1.11

◆ request()

const Variant & request ( ) const

値をリクエストする

◆ robotModel() [1/2]

RobotModel robotModel ( std::string_view  field = "") const
inherited

◆ robotModel() [2/2]

RobotModel robotModel ( std::wstring_view  field) const
inherited

◆ robotModelEntries()

std::vector< RobotModel > robotModelEntries ( ) const
inherited

◆ set()

const Variant & set ( const ValAdaptor v) const
protected

値をセットする

Since
ver1.10

◆ setCheck()

std::shared_ptr< internal::ClientData > setCheck ( ) const
inherited

data_wをlockし、memberがselfではなければinvalid_argumentを投げる

◆ text() [1/2]

Text text ( std::string_view  field = "") const
inherited

◆ text() [2/2]

Text text ( std::wstring_view  field) const
inherited

◆ textEntries()

std::vector< Text > textEntries ( ) const
inherited

◆ tryGet()

std::optional< ValAdaptor > tryGet ( ) const

値を取得する

◆ value() [1/2]

Value value ( std::string_view  field = "") const
inherited

◆ value() [2/2]

Value value ( std::wstring_view  field) const
inherited

◆ valueEntries()

std::vector< Value > valueEntries ( ) const
inherited

◆ view() [1/2]

View view ( std::string_view  field = "") const
inherited

◆ view() [2/2]

View view ( std::wstring_view  field) const
inherited

◆ viewEntries()

std::vector< View > viewEntries ( ) const
inherited

Friends And Related Symbol Documentation

◆ InputRef

friend class InputRef
friend

◆ InputRefState

friend struct InputRefState
friend

◆ TemporalViewComponent

friend class TemporalViewComponent
friend

Member Data Documentation

◆ data_w

std::weak_ptr<internal::ClientData> data_w
inherited

ClientDataの参照

ClientData内に保持するクラスもあるので循環参照を避けるためweak_ptr

◆ field_

SharedString field_
inherited

フィールド名

Memberなどフィールド名が不要なクラスでは使用しない

◆ member_

SharedString member_
inherited

メンバー名


The documentation for this class was generated from the following files: