Exporter.h

Go to the documentation of this file.
00001 /*
00002  * The information in this file is
00003  * Copyright(c) 2007 Ball Aerospace & Technologies Corporation
00004  * and is subject to the terms and conditions of the
00005  * GNU Lesser General Public License Version 2.1
00006  * The license text is available from   
00007  * http://www.gnu.org/licenses/lgpl.html
00008  */
00009 
00010 #ifndef EXPORTER_H
00011 #define EXPORTER_H
00012 
00013 #include "TypesFile.h"
00014 #include <string>
00015 
00016 class DataDescriptor;
00017 class PlugInArgList;
00018 class QWidget;
00019 
00020 /**
00021  *  Interface specific to exporter plug-ins.
00022  *
00023  *  Defines the exporter specific interface to all exporter plug-ins.
00024  *  This interface contains all exporter specific operations.
00025  */
00026 class Exporter
00027 {
00028 public:
00029    /**
00030     *  The name for an export item argument.
00031     *
00032     *  Input arguments with this name will be automatically populated with a
00033     *  SessionItem pointer when the plug-in is executed with an ExportAgent.
00034     *  Arguments with this name should be of the type SessionItem or one of its
00035     *  subclasses.
00036     *
00037     *  @see     ExportAgent::execute()
00038     */
00039    static std::string ExportItemArg() { return "Export Item"; }
00040 
00041    /**
00042     *  The name for an export file descriptor argument.
00043     *
00044     *  Input arguments with this name will be automatically populated with the
00045     *  FileDescriptor to use for export when the plug-in is executed with an
00046     *  ExportAgent.  Arguments with this name should be of the type
00047     *  FileDescriptor or one of its subclasses.
00048     *
00049     *  @see     ExportAgent::execute()
00050     */
00051    static std::string ExportDescriptorArg() { return "Export Descriptor"; }
00052 
00053    /**
00054     *  Returns the default file extensions recognized by the exporter.
00055     *
00056     *  @return  The file extensions recognized by the exporter as a string.
00057     *           The string consists of a description followed by one or more
00058     *           file extensions separated by a space.  Multiple file
00059     *           types may be specified with a double semicolon.  Examples
00060     *           include "ENVI Header Files (*.hdr)", "TIFF Files (*.tif *.tiff)",
00061     *           and "Source Files (*.c*);;Header Files (*.h)".
00062     */
00063    virtual std::string getDefaultExtensions() const = 0;
00064 
00065    /**
00066     *  Queries whether a given argument list can be successfully saved by
00067     *  the exporter.
00068     *
00069     *  This method is called for the exporter to parse the current settings in
00070     *  the plug-in argument list to see if it supports saving the data as currently
00071     *  specified.  This allows exporters that do not support certain combinations 
00072     *  of values and options to indicate as such.  This method is called each time
00073     *  the user changes a value in the export options dialog.
00074     *
00075     *  @param   pArgList
00076     *           The plug-in argument list as requested in getInputSpecification.
00077     *           This is populated as it would be in a call to execute.
00078     *  @param   errorMessage
00079     *           An error message that is populated with the reason why the
00080     *           exporter cannot save the given data descriptor. This message
00081     *           will be displayed to the user. When returning
00082     *           ValidationResultType::VALIDATE_INFO, a non-empty \em errorMessage
00083     *           is required.
00084     *
00085     *  @return  Returns a result based on the level of validation success.
00086     *           Either complete success, complete failure, a success with a caveat
00087     *           which will be reported to the user, or a potential success with
00088     *           additional input from the user.
00089     *
00090     *  @see     ValidationResultType
00091     */
00092    virtual ValidationResultType validate(const PlugInArgList* pArgList, std::string& errorMessage) const = 0;
00093 
00094    /**
00095     *  Returns a widget to display custom export option values.
00096     *
00097     *  This method provides an interface for which specialized export options
00098     *  can be displayed to the user.  The method returns a Qt widget that is
00099     *  added to the default export options dialog.  The exporter should create
00100     *  the widget with a \b NULL parent, and should destroy the widget when the
00101     *  exporter itself is destroyed.
00102     *
00103     *  Exporters should call QWidget::setWindowTitle() on the widget that is
00104     *  returned to set the name that appears on the tab in the export options
00105     *  dialog.  If the window title is not set, the exporter name is displayed.
00106     *  If the returned widget is the only widget to display, a tab widget is
00107     *  not used in the dialog.
00108     *
00109     *  @param   pInArgList
00110     *           The input argument list specified by
00111     *           Executable::getInputSpecification() and populated as if being
00112     *           passed to Executable::execute().
00113     *
00114     *  @return  A QWidget that will be displayed as an additional tab in the
00115     *           default export options dialog.  \b NULL should be returned if
00116     *           the exporter does not have custom options to display to the
00117     *           user.
00118     */
00119    virtual QWidget* getExportOptionsWidget(const PlugInArgList* pInArgList)= 0;
00120 
00121 protected:
00122    /**
00123     *  Since the Exporter interface is usually used in conjunction with the
00124     *  PlugIn and Executable interfaces, this should be destroyed by casting to
00125     *  the PlugIn interface and calling PlugInManagerServices::destroyPlugIn().
00126     */
00127    virtual ~Exporter() {}
00128 };
00129 
00130 #endif

Software Development Kit - Opticks 4.9.0 Build 16218