wip
This commit is contained in:
@@ -17,7 +17,6 @@ class ImportBase
|
|||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
Parts *prts; ///< Pointer to the Parts object.
|
Parts *prts; ///< Pointer to the Parts object.
|
||||||
Signals *sigs; ///< Pointer to the Signals object.
|
|
||||||
std::fstream file_lines; ///< File stream for reading the input file.
|
std::fstream file_lines; ///< File stream for reading the input file.
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -31,7 +30,6 @@ public:
|
|||||||
ImportBase(std::string file_name) : file_lines(std::fstream(file_name))
|
ImportBase(std::string file_name) : file_lines(std::fstream(file_name))
|
||||||
{
|
{
|
||||||
prts = new Parts();
|
prts = new Parts();
|
||||||
sigs = new Signals();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -52,15 +50,6 @@ public:
|
|||||||
return prts;
|
return prts;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Retrieves the Signals object.
|
|
||||||
* @return Pointer to the Signals object.
|
|
||||||
*/
|
|
||||||
Signals * signals()
|
|
||||||
{
|
|
||||||
return sigs;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Virtual destructor for ImportBase.
|
* @brief Virtual destructor for ImportBase.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -22,25 +22,26 @@ void System::Load(std::string module_name, std::string file_name, ImportType typ
|
|||||||
ImportBase *imp;
|
ImportBase *imp;
|
||||||
Module *mod = nullptr;
|
Module *mod = nullptr;
|
||||||
Parts *prts = nullptr;
|
Parts *prts = nullptr;
|
||||||
if (!mods->exists(module_name))
|
|
||||||
|
// Creation or retrieval of the module.
|
||||||
|
mod = mods->merge(module_name);
|
||||||
|
|
||||||
|
// Parsing of the file based on the import type.
|
||||||
|
if (type == ImportType::IMPORT_MENTOR)
|
||||||
{
|
{
|
||||||
mod = new Module(module_name);
|
imp = new ImportMentor(file_name);
|
||||||
mods->add(mod);
|
} else if (type == ImportType::IMPORT_ALTIUM)
|
||||||
|
{
|
||||||
|
// imp = new ImportAltium(file_name);
|
||||||
|
} else if (type == ImportType::IMPORT_ODS)
|
||||||
|
{
|
||||||
|
// imp = new ImportOds(file_name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mod = mods->get(module_name);
|
throw std::runtime_error("Unknown import type");
|
||||||
}
|
|
||||||
switch (type)
|
|
||||||
{
|
|
||||||
case ImportType::IMPORT_MENTOR:
|
|
||||||
imp = new ImportMentor(file_name);
|
|
||||||
imp->parse(mod->signals);
|
|
||||||
prts = imp->parts();
|
|
||||||
mod->add(prts);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
imp->parse(mod->signals);
|
||||||
|
prts = imp->parts();
|
||||||
|
mod->add(prts);
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user