Go to the documentation of this file.00001 #include "plugin_howto.h"
00002
00003 #include <QtPlugin>
00004
00005 void PluginHowtoAlgorithm::setAutomataCreator(const QSharedPointer<IAutomataCreator> &creator)
00006 {
00007 m_creator = creator;
00008 }
00009
00010 bool PluginHowtoAlgorithm::run(const IAutomaton::TAutomataList &input,
00011 QSharedPointer<IAutomaton> &result, QString *report) const
00012 {
00013 Q_UNUSED(input) Q_UNUSED(report)
00014
00015 result = m_creator->createAutomaton
00016 (ITransition::TCharSet() << "p" << "l" << "u" << "g" << "i" << "n", "A", "\\varepsilon");
00017
00018 result->createState("Q0", "", true, false);
00019 result->createState("Q1", "", false, false);
00020 result->createState("Q2", "", false, false);
00021 result->createState("Q3", "", false, false);
00022 result->createState("Q4", "", false, false);
00023 result->createState("Q5", "", false, false);
00024 result->createState("Q6", "", false, true);
00025
00026 result->createTransition("Q0", "Q1", ITransition::TCharSet() << "p");
00027 result->createTransition("Q1", "Q2", ITransition::TCharSet() << "l");
00028 result->createTransition("Q2", "Q3", ITransition::TCharSet() << "u");
00029 result->createTransition("Q3", "Q4", ITransition::TCharSet() << "g");
00030 result->createTransition("Q4", "Q5", ITransition::TCharSet() << "i");
00031 result->createTransition("Q5", "Q6", ITransition::TCharSet() << "n");
00032
00033 return true;
00034 }
00035
00036
00037
00038 PluginHowtoHolder::PluginHowtoHolder()
00039 {}
00040
00041 PluginHowtoHolder::~PluginHowtoHolder()
00042 {}
00043
00044 IAlgorithm::TAlgorithmList PluginHowtoHolder::getAlgorithms() const
00045 {
00046 IAlgorithm::TAlgorithmList algorithmList;
00047
00048 algorithmList << QSharedPointer<IAlgorithm>(new PluginHowtoAlgorithm());
00049
00050 return algorithmList;
00051 }
00052
00053
00054 Q_EXPORT_PLUGIN2(plugin_howto, PluginHowtoHolder)