I have an interface for file parser. This parser can be configured, then saved to the file. New parsers for new file types can be added using .dll
plugins.
class FileParserInterface {
public:
QString toString() const = 0;
QString constructorName() const {return "FileParserInterface";}
SomeDataStruct getData() = 0;
}
Therefore I need some way to save those instances by name (can be name of the constructor). I would then have some method to get instance by string, eg:
static std::shared_ptr<FileParserInterface> fileParserFromString(const QString& name, const QString& parameters);
I have no idea how to thread-safely implement this. I am using boost and Qt libraries. I prefer to use stdlib and Qt when possible.