Class: Wx::FileSystemHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/wx/doc/gen/file_system.rb

Overview

Classes derived from FileSystemHandler are used to access virtual file systems.

Its public interface consists of two methods: #can_open and #open_file. It provides additional protected methods to simplify the process of opening the file: get_protocol, get_left_location, get_right_location, get_anchor, FileSystemHandler.get_mime_type_from_ext. Please have a look at overview (see FileSystem) if you don’t know how locations are constructed. Also consult the list of available handlers. Note that the handlers are shared by all instances of FileSystem.

Remark:

HTML library provides handlers for local files and HTTP or FTP protocol.

Note:

The location parameter passed to #open_file or #can_open methods is always an absolute path. You don't need to check the FS's current path.

Category: Virtual File System

See Also:

Requires:

  • USE_FILESYSTEM

Direct Known Subclasses

ArchiveFSHandler, MemoryFSHandler

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Object

#clone, #dup, #is_same_as, #un_share

Constructor Details

#initializeWx::FileSystemHandler

Constructor.



90
# File 'lib/wx/doc/gen/file_system.rb', line 90

def initialize; end

Class Method Details

.get_mime_type_from_ext(location) ⇒ String

Returns the MIME type based on extension of location.

(While Wx::FSFile#get_mime_type returns real MIME type - either extension-based or queried from HTTP.)

Parameters:

  • location (String)

Returns:

  • (String)


130
# File 'lib/wx/doc/gen/file_system.rb', line 130

def self.get_mime_type_from_ext(location) end

Instance Method Details

#can_open(location) ⇒ Boolean Also known as: can_open?

Returns true if the handler is able to open this file.

This function doesn’t check whether the file exists or not, it only checks if it knows the protocol.

Must be overridden in derived handlers.

Parameters:

  • location (String)

Returns:

  • (Boolean)


99
# File 'lib/wx/doc/gen/file_system.rb', line 99

def can_open(location) end

#find_first(wildcard, flags = 0) ⇒ String

Works like find_first_file.

Returns the name of the first filename (within filesystem’s current path) that matches wildcard. flags may be one of Wx::FILE (only files), DIR (only directories) or 0 (both). This method is only called if #can_open returns true.

Parameters:

  • wildcard (String)
  • flags (Integer) (defaults to: 0)

Returns:

  • (String)


109
# File 'lib/wx/doc/gen/file_system.rb', line 109

def find_first(wildcard, flags=0) end

#find_nextString

Returns next filename that matches parameters passed to Wx::FileSystem#find_first.

This method is only called if #can_open returns true and #find_first returned a non-empty string.

Returns:

  • (String)


115
# File 'lib/wx/doc/gen/file_system.rb', line 115

def find_next; end

#open_file(fs, location) ⇒ Wx::FSFile

Opens the file and returns Wx::FSFile pointer or NULL if failed.

Must be overridden in derived handlers.

Parameters:

  • fs (Wx::FileSystem)

    Parent FS (the FS from that OpenFile was called). See the ZIP handler for details of how to use it.

  • location (String)

    The absolute location of file.

Returns:



123
# File 'lib/wx/doc/gen/file_system.rb', line 123

def open_file(fs, location) end