Audacity  2.2.2
Public Member Functions | List of all members
LOFImportPlugin Class Referencefinal

An ImportPlugin for LOF data. More...

Inheritance diagram for LOFImportPlugin:
ImportPlugin

Public Member Functions

 LOFImportPlugin ()
 
 ~LOFImportPlugin ()
 
wxString GetPluginStringID ()
 
wxString GetPluginFormatDescription ()
 
std::unique_ptr< ImportFileHandleOpen (const wxString &Filename) override
 
- Public Member Functions inherited from ImportPlugin
virtual wxArrayString GetSupportedExtensions ()
 
bool SupportsExtension (const wxString &extension)
 
virtual ~ImportPlugin ()
 

Additional Inherited Members

- Protected Member Functions inherited from ImportPlugin
 ImportPlugin (wxArrayString supportedExtensions)
 
- Protected Attributes inherited from ImportPlugin
wxArrayString mExtensions
 

Detailed Description

An ImportPlugin for LOF data.

Definition at line 103 of file ImportLOF.cpp.

Constructor & Destructor Documentation

LOFImportPlugin::LOFImportPlugin ( )
inline

Definition at line 106 of file ImportLOF.cpp.

107  : ImportPlugin(wxArrayString(WXSIZEOF(exts), exts))
108  {
109  }
static const wxChar * exts[]
Definition: ImportLOF.cpp:98
ImportPlugin(wxArrayString supportedExtensions)
Definition: ImportPlugin.h:110
LOFImportPlugin::~LOFImportPlugin ( )
inline

Definition at line 111 of file ImportLOF.cpp.

111 { }

Member Function Documentation

wxString LOFImportPlugin::GetPluginFormatDescription ( )
virtual

Implements ImportPlugin.

Definition at line 177 of file ImportLOF.cpp.

References DESC.

178 {
179  return DESC;
180 }
#define DESC
Definition: ImportLOF.cpp:96
wxString LOFImportPlugin::GetPluginStringID ( )
inlinevirtual

Implements ImportPlugin.

Definition at line 113 of file ImportLOF.cpp.

113 { return wxT("lof"); }
std::unique_ptr< ImportFileHandle > LOFImportPlugin::Open ( const wxString &  Filename)
overridevirtual

Implements ImportPlugin.

Definition at line 182 of file ImportLOF.cpp.

References BINARY_FILE_CHECK_BUFFER_SIZE.

183 {
184  // Check if it is a binary file
185  {
186  wxFile binaryFile;
187  if (!binaryFile.Open(filename))
188  return nullptr; // File not found
189 
191  int count = binaryFile.Read(buf, BINARY_FILE_CHECK_BUFFER_SIZE);
192 
193  for (int i = 0; i < count; i++)
194  {
195  // Check if this char is below the space character, but not a
196  // line feed or carriage return
197  if (buf[i] < 32 && buf[i] != 10 && buf[i] != 13)
198  {
199  // Assume it is a binary file
200  binaryFile.Close();
201  return nullptr;
202  }
203  }
204  }
205 
206  // Now open the file again as text file
207  auto file = std::make_unique<wxTextFile>(filename);
208  file->Open();
209 
210  if (!file->IsOpened())
211  return nullptr;
212 
213  return std::make_unique<LOFImportFileHandle>(filename, std::move(file));
214 }
#define BINARY_FILE_CHECK_BUFFER_SIZE
Definition: ImportLOF.cpp:94

The documentation for this class was generated from the following file: