correct document name processing

This commit is contained in:
Alexey Fedoseev
2024-04-14 11:29:46 +03:00
parent 9dec356d64
commit f2a84f403a
2 changed files with 10 additions and 2 deletions

View File

@@ -1382,6 +1382,12 @@ void Document::import_edges(ElementCollection* collection, CyberiadaEdge* edges)
}
}
void Document::set_name(const Name& _name)
{
Element::set_name(_name);
metainfo.name = _name;
}
void Document::load(const String& path, DocumentFormat f)
{
reset();
@@ -1416,7 +1422,7 @@ void Document::load(const String& path, DocumentFormat f)
metainfo.target_system = doc.meta_info->target_system;
}
if (doc.meta_info->name) {
metainfo.name = doc.meta_info->name;
set_name(doc.meta_info->name);
}
if (doc.meta_info->author) {
metainfo.author = doc.meta_info->author;

View File

@@ -75,7 +75,7 @@ namespace Cyberiada {
bool has_name() const { return name_is_set; }
const Name& get_name() const { return name; }
void set_name(const Name& name);
virtual void set_name(const Name& name);
bool has_qualified_name() const;
QualifiedName qualified_name() const;
@@ -533,9 +533,11 @@ namespace Cyberiada {
void reset();
StateMachine* new_state_machine(const String& sm_nam, const Rect& r = Rect());
StateMachine* new_state_machine(const ID& id, const String& sm_name, const Rect& r = Rect());
void load(const String& path, DocumentFormat f = formatDetect);
void save(const String& path, DocumentFormat f = formatCyberiada10) const;
virtual void set_name(const Name& name);
const DocumentMetainformation& meta() const { return metainfo; }
DocumentMetainformation& meta() { return metainfo; }