NCBI C++ ToolKit
file_auto_loader.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 #ifndef GUI_CORE___FILE_AUTO_LOADER__HPP
2 #define GUI_CORE___FILE_AUTO_LOADER__HPP
3 
4 /* $Id: file_auto_loader.hpp 38477 2017-05-15 21:10:59Z evgeniev $
5 * ===========================================================================
6 *
7 * PUBLIC DOMAIN NOTICE
8 * National Center for Biotechnology Information
9 *
10 * This software/database is a "United States Government Work" under the
11 * terms of the United States Copyright Act. It was written as part of
12 * the author's official duties as a United States Government employee and
13 * thus cannot be copyrighted. This software/database is freely available
14 * to the public for use. The National Library of Medicine and the U.S.
15 * Government have not placed any restriction on its use or reproduction.
16 *
17 * Although all reasonable efforts have been taken to ensure the accuracy
18 * and reliability of the software and data, the NLM and the U.S.
19 * Government do not and cannot warrant the performance or results that
20 * may be obtained by using this software or data. The NLM and the U.S.
21 * Government disclaim all warranties, express or implied, including
22 * warranties of performance, merchantability or fitness for any particular
23 * purpose.
24 *
25 * Please cite the author in any work or product based on this material.
26 *
27 * ===========================================================================
28 *
29 * Authors: Roman Katargin
30 *
31 * File Description:
32 *
33 */
34 
35 #include <corelib/ncbistl.hpp>
36 #include <corelib/ncbiobj.hpp>
37 
39 #include <gui/utils/extension.hpp>
40 
41 
43 
44 
45 ///////////////////////////////////////////////////////////////////////////////
46 /// CFileAutoLoader
48  public CObject,
50  public IExtension
51 {
52 public:
54 
55  /// @name IUILoadManager interface implementation
56  /// @{
57  virtual void SetServiceLocator(IServiceLocator* srv_locator);
58  virtual void SetParentWindow(wxWindow* parent);
59  virtual const IUIObject& GetDescriptor() const;
60  virtual void InitUI();
61  virtual void CleanUI();
62  virtual wxPanel* GetCurrentPanel();
63  virtual bool CanDo(EAction action);
64  virtual bool IsFinalState();
65  virtual bool IsCompletedState();
66  virtual bool DoTransition(EAction action);
67  virtual IAppTask* GetTask();
68  virtual IExecuteUnit* GetExecuteUnit();
69  /// @}
70 
71  /// @{ IFileFormatLoaderManager - additional members
72  /// @{
73  virtual string GetFileLoaderId() const { return "file_loader_auto"; }
74  virtual wxString GetFormatWildcard();
75  virtual bool ValidateFilenames(const vector<wxString>& filenames);
76  virtual void SetFilenames(const vector<wxString>& filenames);
77  virtual void GetFilenames(vector<wxString>& filenames) const;
78  virtual bool IsInitialState();
79  virtual bool RecognizeFormat(const wxString& filename);
80  virtual bool RecognizeFormat(CFormatGuess::EFormat) { return false; }
81  virtual bool SingleFileLoader() const { return false; }
82  /// @}
83 
84  /// @name IExtension interface implementation
85  /// @{
86  virtual string GetExtensionIdentifier() const;
87  virtual string GetExtensionLabel() const;
88  /// @}
89 
92 
93  CFormatGuess::EFormat SetFormatManager(const vector<wxString>& filenames);
94 
95 protected:
98 };
99 
101 
102 
103 #endif // GUI_CORE___FILE_AUTO_LOADER__HPP
CFileAutoLoader.
virtual bool IsCompletedState()
Manager goes into "Complete" state when "Finish" button is pressed and all input data is gatherred an...
virtual bool IsFinalState()
True if Tool Manager has reached its final state, i.e.
virtual IExecuteUnit * GetExecuteUnit()
virtual void SetServiceLocator(IServiceLocator *srv_locator)
Sets / unsets Service Locator.
virtual bool CanDo(EAction action)
Indicates whether given transition is possible in the current state.
virtual string GetExtensionIdentifier() const
returns the unique human-readable identifier for the extension the id should use lowercase letters se...
virtual wxPanel * GetCurrentPanel()
Return the panel corresponding to the current state of Tool Manager.
virtual bool IsInitialState()
return true if the current state of the loader UI is the first valid state (first step in a wizard-li...
virtual void CleanUI()
CleanUI() is called after the host finished using the manager.
virtual IAppTask * GetTask()
Once parameters are gathered and validated this function is called to produce the final Task object t...
virtual bool RecognizeFormat(CFormatGuess::EFormat)
return true if the given file format is supported by this manager
CFileAutoLoader()
CFileAutoLoader.
virtual bool RecognizeFormat(const wxString &filename)
return true if the given file format is supported by this manager
IFileFormatLoaderManager * GetCurrentManager()
virtual const IUIObject & GetDescriptor() const
Returns the object describing this tool (UI meta data).
virtual bool SingleFileLoader() const
returns true if loader can handle only one file
virtual string GetFileLoaderId() const
virtual string GetExtensionLabel() const
returns a displayable label for this extension ( please capitalize the key words - "My Extension" )
virtual bool ValidateFilenames(const vector< wxString > &filenames)
checks given filenames and returns true if the manager can handle them, otherwise - shows an error me...
CFormatGuess::EFormat SetFormatManager(const vector< wxString > &filenames)
virtual bool DoTransition(EAction action)
Performs transition if possible and returns true, otherwise the function shall warn the user about th...
virtual void GetFilenames(vector< wxString > &filenames) const
get actual filenames that will be opened
virtual void InitUI()
Initializes the Manager before using it in UI.
CIRef< IFileFormatLoaderManager > m_FormatManager
virtual void SetFilenames(const vector< wxString > &filenames)
initilize the manager with the given filenames
virtual void SetParentWindow(wxWindow *parent)
virtual wxString GetFormatWildcard()
return file wildcard for the format (example - "*.txt;*.tab" )
EFormat
The formats are checked in the same order as declared here.
CObject –.
Definition: ncbiobj.hpp:180
CUIObject - default mix-in implementation of IUIObject.
Definition: ui_object.hpp:81
IAppTask.
Definition: app_task.hpp:83
IExtension IExtension interface represents an abstract pluggable component.
Definition: extension.hpp:57
IFileFormatLoaderManager.
IServiceLocator - an abstract mechanism for locating services.
Definition: service.hpp:71
IUIObject - object that provides basic properties often required in a UI object.
Definition: ui_object.hpp:63
void Reset(void)
Reset reference object.
Definition: ncbiobj.hpp:773
TObjectType * GetPointerOrNull(void) THROWS_NONE
Get pointer value.
Definition: ncbiobj.hpp:986
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.
The NCBI C++/STL use hints.
static int filenames
Definition: pcregrep.c:172
Modified on Sat Mar 02 10:55:17 2024 by modify_doxy.py rev. 669887