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

Offers a blame class for some vcs. More...

#include <wex/syntax/blame.h>

Public Types

enum class  margin_style_t {
  UNKNOWN , DAY , WEEK , MONTH ,
  YEAR , OTHER
}
 Margin text style type. More...
 

Public Member Functions

 blame (const pugi::xml_node &node=pugi::xml_node())
 Default constructor using xml node.
 
const auto & caption () const
 Returns the suitable blame caption.
 
void caption (const std::string &text)
 Sets a suitable blame caption.
 
const std::string info () const
 Returns blame info will contain id, author, date depending on settings in the config.
 
const auto line_no () const
 Returns line number (starting with line 0).
 
void line_no (int no)
 Sets line number, to override the one from parsed text.
 
const auto & line_text () const
 Returns rest of line text (without blame).
 
bool parse (const path &p, const std::string &line)
 Parses blame text and returns false if there was an error.
 
void skip_info (bool rhs)
 Sets the skip info member, until next parse.
 
bool skip_info () const
 Returns current skip info value.
 
bool use () const
 Returns true if blame is on.
 
margin_style_t style () const
 Style for blame margin based on commit date.
 
const auto & vcs_name () const
 Returns vcs name for which this blaming is done.
 

Static Public Member Functions

static std::string margin_renamed (const factory::stc *stc)
 Returns a renamed path present in the stc margin, or empty string if no rename present.
 

Detailed Description

Offers a blame class for some vcs.

The vcs used is configured using the xml_node constructor (see wex-menus.xml), the kind of info returned after parse is configurable using blame_get_author, blame_get_id, blame_get_date.

dot_inline_dotgraph_1.png

Member Enumeration Documentation

◆ margin_style_t

enum class wex::blame::margin_style_t
strong

Margin text style type.

Enumerator
UNKNOWN 

no style

DAY 

within a day

WEEK 

within a week

MONTH 

within a month

YEAR 

within a year

OTHER 

more than a year

Member Function Documentation

◆ info()

const std::string wex::blame::info ( ) const

Returns blame info will contain id, author, date depending on settings in the config.

Also adds a renamed path if a changed path is present.

◆ parse()

bool wex::blame::parse ( const path & p,
const std::string & line )

Parses blame text and returns false if there was an error.

Parameters
poriginal path
lineline to parse