wex v24.04.0
Public Types | Public Member Functions | Static Public Member Functions | List of all members
wex::lexers Class Reference

Collection of all lexers. More...

#include <wex/syntax/lexers.h>

Public Types

typedef std::unordered_map< std::string, std::string > name_values_t
 Name values type for macros.
 

Public Member Functions

void apply (factory::stc *stc) const
 Applies containers (except global styles) to specified component.
 
void apply_default_style (const std::function< void(const std::string &)> &back, const std::function< void(const std::string &)> &fore=nullptr) const
 Applies default style to functions for back and foreground colours.
 
void apply_global_styles (factory::stc *stc)
 Sets global styles (and colours and indicators) for current theme for specified component.
 
const std::string apply_macro (const std::string &text, const std::string &lexer="global") const
 Applies macro to text: if text is referring to a macro, text is replaced by the macro value.
 
void apply_margin_text_style (factory::stc *stc, const blame *info) const
 Applies margin text style to stc line.
 
void clear_theme ()
 Clears the theme.
 
const lexerfind (const std::string &name) const
 Finds a lexer specified by the (display scintilla) name.
 
const lexerfind_by_filename (const std::string &fullname) const
 Finds a lexer specified by a filename (fullname).
 
const lexerfind_by_text (const std::string &text) const
 Finds a lexer if text starts with some special tokens.
 
const styleget_default_style () const
 Returns the default style.
 
const indicatorget_indicator (const indicator &indicator) const
 Returns indicator from loaded indicators, based on the no of specified indicator.
 
const auto & get_lexers () const
 Returns the lexers.
 
const name_values_tget_macros (const std::string &lexer) const
 Returns the macros for specified lexer.
 
const markerget_marker (const marker &marker) const
 Returns marker from loaded markers, based on the no of specified marker.
 
auto get_themes_size () const
 Returns number of themes (should at least contain empty theme).
 
bool indicator_is_loaded (const indicator &indic) const
 Returns true if specified indicator is available.
 
const std::string & keywords (const std::string &set) const
 Returns the keywords for the specified named set of keywords.
 
bool load_document ()
 Loads all lexers from document.
 
bool marker_is_loaded (const marker &marker) const
 Returns true if specified marker is available.
 
const auto & path () const
 Returns the path.
 
const auto & properties () const
 Returns global properties.
 
void restore_theme ()
 Restores the theme from previous theme.
 
bool show_theme_dialog (wxWindow *parent)
 Shows a dialog with all themes, allowing you to choose one.
 
const auto & theme () const
 Returns the current theme.
 
const name_values_ttheme_macros () const
 Returns the theme macros for the current theme.
 

Static Public Member Functions

static lexersget (bool createOnDemand=true)
 Returns the lexers object.
 
static lexersset (lexers *lexers)
 Sets the object as the current one, returns the pointer to the previous current object (both the parameter and returned value may be nullptr).
 

Detailed Description

Collection of all lexers.

The lexers are loaded from wex-lexers.xml, this is done automatically during the first get call.

Member Function Documentation

◆ apply_margin_text_style()

void wex::lexers::apply_margin_text_style ( factory::stc * stc,
const blame * info ) const

Applies margin text style to stc line.

If text is supplied also sets margin text.

Parameters
stcstc component
infoblame info to use

◆ get()

static lexers * wex::lexers::get ( bool createOnDemand = true)
static

Returns the lexers object.

If this is the first invocation, and createOnDemand is true, it also invokes load_document.

◆ keywords()

const std::string & wex::lexers::keywords ( const std::string & set) const

Returns the keywords for the specified named set of keywords.

Returns empty string if set does not exist.

◆ load_document()

bool wex::lexers::load_document ( )

Loads all lexers from document.

Returns true if the document is loaded.

◆ show_theme_dialog()

bool wex::lexers::show_theme_dialog ( wxWindow * parent)

Shows a dialog with all themes, allowing you to choose one.

Returns true and sets current theme if you select one.