## wxRichTextFileHandler

This is the base class for file handlers, for loading and/or saving content associated with a wxRichTextBuffer.

Derived from

wxObject

Include files

<wx/richtext/richtextbuffer.h>

Data structures

Members

wxRichTextFileHandler::wxRichTextFileHandler
wxRichTextFileHandler::CanHandle
wxRichTextFileHandler::CanLoad
wxRichTextFileHandler::CanSave
wxRichTextFileHandler::DoLoadFile
wxRichTextFileHandler::DoSaveFile
wxRichTextFileHandler::GetEncoding
wxRichTextFileHandler::GetExtension
wxRichTextFileHandler::GetFlags
wxRichTextFileHandler::GetName
wxRichTextFileHandler::GetType
wxRichTextFileHandler::IsVisible
wxRichTextFileHandler::LoadFile
wxRichTextFileHandler::SaveFile
wxRichTextFileHandler::SetEncoding
wxRichTextFileHandler::SetExtension
wxRichTextFileHandler::SetFlags
wxRichTextFileHandler::SetName
wxRichTextFileHandler::SetType
wxRichTextFileHandler::SetVisible

### wxRichTextFileHandler::wxRichTextFileHandler

wxRichTextFileHandler(const wxString& name = wxEmptyString, const wxString& ext = wxEmptyString, int type = 0)

Constructor.

### wxRichTextFileHandler::CanHandle

bool CanHandle(const wxString& filename) const

Override this function and return `true` if this handler can we handle filename. By default, this function checks the extension.

### wxRichTextFileHandler::CanLoad

bool CanLoad() const

Override and return `true` if this handler can load content.

### wxRichTextFileHandler::CanSave

bool CanSave() const

Override and return `true` if this handler can save content.

### wxRichTextFileHandler::DoLoadFile

bool DoLoadFile(wxRichTextBuffer* buffer, wxInputStream& stream)

Override to load content from stream into buffer.

### wxRichTextFileHandler::DoSaveFile

bool DoSaveFile(wxRichTextBuffer* buffer, wxOutputStream& stream)

Override to save content to stream from buffer.

### wxRichTextFileHandler::GetEncoding

const wxString& GetEncoding() const

Returns the encoding associated with the handler (if any).

### wxRichTextFileHandler::GetExtension

wxString GetExtension() const

Returns the extension associated with the handler.

### wxRichTextFileHandler::GetFlags

int GetFlags() const

Returns flags that change the behaviour of loading or saving. See the documentation for each handler class to see what flags are relevant for each handler.

### wxRichTextFileHandler::GetName

wxString GetName() const

Returns the name of the handler.

### wxRichTextFileHandler::GetType

int GetType() const

Returns the type of the handler.

### wxRichTextFileHandler::IsVisible

bool IsVisible() const

Returns `true` if this handler should be visible to the user.

### wxRichTextFileHandler::LoadFile

bool LoadFile(wxRichTextBuffer* buffer, wxInputStream& stream)

bool LoadFile(wxRichTextBuffer* buffer, const wxString& filename)

Loads content from a stream or file. Not all handlers will implement file loading.

### wxRichTextFileHandler::SaveFile

bool SaveFile(wxRichTextBuffer* buffer, wxOutputStream& stream)

bool SaveFile(wxRichTextBuffer* buffer, const wxString& filename)

Saves content to a stream or file. Not all handlers will implement file saving.

### wxRichTextFileHandler::SetEncoding

void SetEncoding(const wxString& encoding)

Sets the encoding to use when saving a file. If empty, a suitable encoding is chosen.

### wxRichTextFileHandler::SetExtension

void SetExtension(const wxString& ext)

Sets the default extension to recognise.

### wxRichTextFileHandler::SetFlags

void SetFlags(int flags)

Sets flags that change the behaviour of loading or saving. See the documentation for each handler class to see what flags are relevant for each handler.

You call this function directly if you are using a file handler explicitly (without going through the text control or buffer LoadFile/SaveFile API). Or, you can call the control or buffer's SetHandlerFlags function to set the flags that will be used for subsequent load and save operations.

### wxRichTextFileHandler::SetName

void SetName(const wxString& name)

Sets the name of the handler.

### wxRichTextFileHandler::SetType

void SetType(int type)

Sets the handler type.

### wxRichTextFileHandler::SetVisible

void SetVisible(bool visible)

Sets whether the handler should be visible to the user (via the application's load and save dialogs).