26 StringSet::const_iterator found = translatedLabels.find(label);
27 if (found != translatedLabels.end()) {
28 return GBS_global_string(
"Encountered duplicated label '%s' in tree.", label.c_str());
30 translatedLabels.insert(label);
47 string translated = translation.
getValue();
48 if (translated != tree->
name) {
49 freedup(tree->
name, translated.c_str());
57 error = translate_unlinked_labels_in_tree(tree->get_leftson(), report);
58 if (!error) error = translate_unlinked_labels_in_tree(tree->get_rightson(), report);
64 return strchr(species_list,
',') !=
NULp;
68 StringMap::const_iterator found = identifier2shortname.find(label);
69 if (found != identifier2shortname.end()) {
70 const char *species_id = found->second.c_str();
101 if (!identifier[0]) {
102 error =
GBS_global_string(
"empty identifier generated (for species '%s')", shortname);
105 StringMap::const_iterator found = identifier2shortname.find(identifier);
106 if (found != identifier2shortname.end()) {
107 const string& prev_shortnames = found->second;
108 identifier2shortname[identifier] = prev_shortnames+
','+shortname;
111 identifier2shortname[identifier] = shortname;
119 error = ta.
close(error);
GB_ERROR notify_translate_label(string label)
ErrorOr< std::string > ErrorOrLabel
const char * GBS_global_string(const char *templat,...)
GB_ERROR GB_await_error()
virtual GB_ERROR generate_species_identifiers(GBDATA *gb_main) const =0
static void error(const char *msg)
bool generated_by_multiple_species(const char *species_list)
GB_ERROR generate_species_identifiers(GBDATA *gb_main) const OVERRIDE
GB_ERROR TREE_translate_labels(GBDATA *gb_main, TreeNode *tree, const LabelTranslator &translator)
GB_ERROR close(GB_ERROR error)
GBDATA * GBT_first_species(GBDATA *gb_main)
GBDATA * GBT_next_species(GBDATA *gb_species)
const char * GBT_get_name(GBDATA *gb_item)
NOT4PERL char * GB_command_interpreter_in_env(const char *str, const char *commands, const GBL_call_env &callEnv)
ARB_ERROR getError() const
GB_transaction ta(gb_var)
arb_unordered_set< string > StringSet
GB_ERROR translate_unlinked_labels_in_tree(TreeNode *tree, TranslationReport &report) const