| 115 | } |
| 116 | |
| 117 | GVariant* 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 | |
| 151 | void DecoderOptions::setter(const char *id, GVariant *value) |
| 152 | { |
no test coverage detected