MCPcopy Index your code
hub / github.com/DreamSourceLab/DSView / get_lang_text

Method get_lang_text

DSView/pv/ui/langresource.cpp:199–254  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

197}
198
199const char* LangResource::get_lang_text(int page_id, const char *str_id, const char *default_str)
200{
201 assert(str_id);
202 assert(default_str);
203
204 std::lock_guard<std::mutex> lock(_mutex);
205
206 if (*str_id == '\0' || *default_str == '\0'){
207 dsv_err("LangResource::get_lang_text(), param is empty.");
208 assert(false);
209 }
210
211 if (_current_page == NULL || _current_page->_id != page_id){
212 _current_page = NULL;
213 for (Lang_resource_page *p : _pages){
214 if (p->_id == page_id){
215 _current_page = p;
216 break;
217 }
218 }
219 }
220
221 if (_current_page == NULL){
222 if (_cur_lang != LAN_EN)
223 dsv_warn("Warning:Can't find language source page:%d", page_id);
224 return default_str;
225 }
226
227 if (_current_page->_loaded == false){
228 load_page(*_current_page);
229 }
230
231 std::string key(str_id);
232
233 if (_current_page->_released){
234 auto it = _current_page->_res_history.find(key);
235 if (it != _current_page->_res_history.end()){
236 return (*it).second.c_str();
237 }
238 }
239 else{
240 auto it = _current_page->_res.find(key);
241 if (it != _current_page->_res.end()){
242 if (_current_page->_is_dynamic){
243 _current_page->_res_history[key] = (*it).second; //Save to history list.
244 }
245 return (*it).second.c_str();
246 }
247 }
248
249 if(_cur_lang != LAN_EN){
250 dsv_warn("Warning:Can't get language text:%s", str_id);
251 }
252
253 return default_str;
254}
255
256bool LangResource::is_new_decoder(const char *decoder_id)

Callers 8

bind_boolMethod · 0.80
bind_bandwidthsMethod · 0.80
bind_listMethod · 0.80
ProbeOptionsMethod · 0.80
DecoderOptionsMethod · 0.80
get_property_formMethod · 0.80
logic_probesMethod · 0.80
create_decoder_formMethod · 0.80

Calls 1

endMethod · 0.45

Tested by

no test coverage detected