wex  v21.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/lexers.h>

Public Types

enum class  margin_style_t
 Margin text style type.
 
typedef std::map< std::string, std::string > name_values_t
 Name values type for macros.
 

Public Member Functions

void apply (core::stc *stc) const
 other methods More...
 
void apply_default_style (std::function< void(const std::string &)> back, std::function< void(const std::string &)> fore=nullptr) const
 Applies default style to functions for back and foreground colours.
 
void apply_global_styles (core::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. More...
 
void apply_margin_text_style (core::stc *stc, int line, margin_style_t style, const std::string &text=std::string()) const
 Applies margin text style to stc line. More...
 
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 auto & get_filename () const
 Returns the filename.
 
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. More...
 
bool load_document ()
 Loads all lexers from document. More...
 
bool marker_is_loaded (const marker &marker) const
 Returns true if specified marker is available.
 
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. More...
 
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)
 static interface More...
 
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()

void wex::lexers::apply ( core::stc stc) const

other methods

Applies containers (except global styles) to specified component.

◆ apply_macro()

const std::string wex::lexers::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.

Otherwise the same text is returned.

◆ apply_margin_text_style()

void wex::lexers::apply_margin_text_style ( core::stc stc,
int  line,
margin_style_t  style,
const std::string &  text = std::string() 
) const

Applies margin text style to stc line.

If text is supplied also sets margin text.

Parameters
stcstc component
lineline no
stylestyle type
texttext to be set in the margin

◆ get()

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

static interface

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.