MCPcopy Create free account
hub / github.com/DreamSourceLab/DSView / getter

Method getter

DSView/pv/prop/binding/decoderoptions.cpp:117–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

115}
116
117GVariant* DecoderOptions::getter(const char *id)
118{
119 GVariant *val = NULL;
120
121 assert(_decoder);
122
123 // Get the value from the hash table if it is already present
124 const map<string, GVariant*>& options = _decoder->options();
125 auto iter = options.find(id);
126
127 if (iter != options.end())
128 val = (*iter).second;
129 else
130 {
131 assert(_decoder->decoder());
132
133 // Get the default value if not
134 for (GSList *l = _decoder->decoder()->options; l; l = l->next)
135 {
136 const srd_decoder_option *const opt =
137 (srd_decoder_option*)l->data;
138 if (strcmp(opt->id, id) == 0) {
139 val = opt->def;
140 break;
141 }
142 }
143 }
144
145 if (val)
146 g_variant_ref(val);
147
148 return val;
149}
150
151void DecoderOptions::setter(const char *id, GVariant *value)
152{

Callers 1

gen_decoders_jsonMethod · 0.80

Calls 2

endMethod · 0.45
decoderMethod · 0.45

Tested by

no test coverage detected