ctkCmdLineModuleManager.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*=============================================================================
  2. Library: CTK
  3. Copyright (c) German Cancer Research Center,
  4. Division of Medical and Biological Informatics
  5. Licensed under the Apache License, Version 2.0 (the "License");
  6. you may not use this file except in compliance with the License.
  7. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. =============================================================================*/
  15. #ifndef CTKCMDLINEMODULEMANAGER_H
  16. #define CTKCMDLINEMODULEMANAGER_H
  17. #include <ctkCommandLineModulesCoreExport.h>
  18. #include <QStringList>
  19. #include <QString>
  20. struct ctkCmdLineModuleInstanceFactory;
  21. class ctkCmdLineModuleInstance;
  22. class ctkCmdLineModuleReference;
  23. class ctkCmdLineModuleManagerPrivate;
  24. /**
  25. * \ingroup CommandLineModulesCore
  26. */
  27. class CTK_CMDLINEMODULECORE_EXPORT ctkCmdLineModuleManager
  28. {
  29. public:
  30. enum ValidationMode {
  31. /** registerModule() will throw an exception if the XML is invalid */
  32. STRICT_VALIDATION,
  33. /** no XML schema validation at all */
  34. SKIP_VALIDATION,
  35. /**
  36. * registerModule() will validate the XML description but proceed with
  37. * registration on validation error.
  38. */
  39. WEAK_VALIDATION
  40. };
  41. ctkCmdLineModuleManager(ctkCmdLineModuleInstanceFactory* descriptionFactory,
  42. ValidationMode = STRICT_VALIDATION);
  43. ~ctkCmdLineModuleManager();
  44. ctkCmdLineModuleReference registerModule(const QString& location);
  45. void unregisterModule(const ctkCmdLineModuleReference& moduleRef);
  46. ctkCmdLineModuleReference moduleReference(const QString& location) const;
  47. QList<ctkCmdLineModuleReference> moduleReferences() const;
  48. ctkCmdLineModuleInstance* createModuleInstance(const ctkCmdLineModuleReference& moduleRef);
  49. QList<ctkCmdLineModuleInstance*> moduleInstances(const ctkCmdLineModuleReference& moduleRef) const;
  50. private:
  51. QScopedPointer<ctkCmdLineModuleManagerPrivate> d;
  52. Q_DISABLE_COPY(ctkCmdLineModuleManager)
  53. };
  54. #endif // CTKCMDLINEMODULEMANAGER_H