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

Offers ctags handling. More...

#include <wex/ctags/ctags.h>

Public Member Functions

 ctags (factory::stc *stc, bool open=true)
 Constructor.
 
const std::string auto_complete (const std::string &text, const ctags_entry &filter=ctags_entry())
 Tries to auto_complete text using the tags file.
 
int separator () const
 Separator used by auto_complete.
 

Static Public Member Functions

static bool close ()
 Closes ctags file.
 
static bool find (const std::string &tag, factory::stc *stc=nullptr)
 Find the tags matching ‘tag’, and fills the matches container.
 
static bool find (const std::string &tag, ctags_entry &filter)
 Finds the tag matching 'tag' and uses it to fill the supplied entries.
 
static bool next ()
 Jumps to next match from a previous find.
 
static bool open (const std::string &filename=DEFAULT_TAGFILE)
 Opens ctags file.
 
static bool previous ()
 Jumps to previous match from a previous find.
 

Static Public Attributes

static std::string DEFAULT_TAGFILE = "tags"
 Default tagfile.
 

Detailed Description

Offers ctags handling.

Constructor & Destructor Documentation

◆ ctags()

wex::ctags::ctags ( factory::stc * stc,
bool open = true )
explicit

Constructor.

Uses stc component for presenting ctags results, and opens default tag file, if tag file is not yet opened.

Member Function Documentation

◆ auto_complete()

const std::string wex::ctags::auto_complete ( const std::string & text,
const ctags_entry & filter = ctags_entry() )

Tries to auto_complete text using the tags file.

Returns a string with matches separated by the separator character, or empty string if no match is found.

Parameters
texttext to be completed
filterfilter on ctags extension entry, default no filter

◆ close()

static bool wex::ctags::close ( )
static

Closes ctags file.

Returns false if file was not opened.

◆ find() [1/2]

static bool wex::ctags::find ( const std::string & tag,
ctags_entry & filter )
static

Finds the tag matching 'tag' and uses it to fill the supplied entries.

Returns false if ctags file not yet opened. Returns true if a matching tag is found, and can be used as a master.

Parameters
tagtag
filtertag filter to be filled

◆ find() [2/2]

static bool wex::ctags::find ( const std::string & tag,
factory::stc * stc = nullptr )
static

Find the tags matching ‘tag’, and fills the matches container.

Returns true if a matching tag is found, and calls frame open_file if name matches and there is no next match in another file. If the name is empty, next is invoked. Returns false if dialog was cancelled or ctags file not yet open.

Parameters
tagtag to find
stca possible active stc

◆ open()

static bool wex::ctags::open ( const std::string & filename = DEFAULT_TAGFILE)
static

Opens ctags file.

Default uses standard ctags file, but you can choose your own name. This file is searched for in the current dir, and if not found in the config dir. You can also specify an absolute filename. Returns false if no ctags file is opened.