Class: Wx::FileSystemHandler
- 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.
HTML library provides handlers for local files and HTTP or FTP protocol.
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
Direct Known Subclasses
Class Method Summary collapse
-
.get_mime_type_from_ext(location) ⇒ String
Returns the MIME type based on extension of location.
Instance Method Summary collapse
-
#can_open(location) ⇒ Boolean
(also: #can_open?)
Returns true if the handler is able to open this file.
-
#find_first(wildcard, flags = 0) ⇒ String
Works like find_first_file.
-
#find_next ⇒ String
Returns next filename that matches parameters passed to Wx::FileSystem#find_first.
-
#initialize ⇒ Wx::FileSystemHandler
constructor
Constructor.
-
#open_file(fs, location) ⇒ Wx::FSFile
Opens the file and returns FSFile pointer or NULL if failed.
Methods inherited from Object
#clone, #dup, #is_same_as, #un_share
Constructor Details
#initialize ⇒ Wx::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.)
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.
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.
109 |
# File 'lib/wx/doc/gen/file_system.rb', line 109 def find_first(wildcard, flags=0) end |
#find_next ⇒ String
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.
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.
123 |
# File 'lib/wx/doc/gen/file_system.rb', line 123 def open_file(fs, location) end |