SlHelpers
SlKernCVS::Stanza Class Reference

Stanza (a subsystem) from MAINTAINERS file. More...

#include <Stanza.h>

Public Types

using TranslateEmail = std::function< std::string(std::string_view sv)>
 Callback to translate an e-mail.
 
using Maintainers = std::vector< Person >
 Maintainers are a list of Person.
 

Public Member Functions

 Stanza (std::string name)
 Construct new Stanza called name. More...
 
 Stanza (std::string n, std::string name, std::string email)
 Construct new Stanza called n with one Person (having name and email) More...
 
unsigned match_path (const std::filesystem::path &path) const
 Return weight of path in this Stanza. More...
 
void add_maintainer_and_store (std::string_view maintainer, std::set< std::string > &suse_users, const TranslateEmail &translateEmail)
 Add a maintainer (as Maintainer) and store them into SUSE users set too. More...
 
void add_backporter (const std::string &name, std::string_view email, unsigned cnt, const TranslateEmail &translateEmail)
 Creates a Person and adds it as Maintainer. More...
 
void add_maintainer_if (std::string_view maintainer, const std::set< std::string > &suse_users, const TranslateEmail &translateEmail)
 Add a maintainer (as Upstream) if in suse_users. More...
 
bool add_pattern (std::string pattern)
 Add pattern to this Stanza. More...
 
bool empty () const
 Check if this Stanza has no name, maintainers, and patterns.
 
const Maintainersmaintainers () const
 Obtain a list of Person in this Stanza. More...
 
void new_entry (std::string n)
 Reset Stanza and start from the beginning. More...
 
const std::string & name () const
 Get name/title of this Stanza.
 

Detailed Description

Stanza (a subsystem) from MAINTAINERS file.

It usually contains maintainer(s) (list of Person) and file/pattern(s) (list of Pattern) they maintain.

Constructor & Destructor Documentation

◆ Stanza() [1/2]

SlKernCVS::Stanza::Stanza ( std::string  name)
inline

Construct new Stanza called name.

Parameters
nameName of the Stanza

◆ Stanza() [2/2]

SlKernCVS::Stanza::Stanza ( std::string  n,
std::string  name,
std::string  email 
)
inline

Construct new Stanza called n with one Person (having name and email)

Parameters
nName of the Stanza
nameName of a Person
emailE-mail of a Person

Member Function Documentation

◆ add_backporter()

void SlKernCVS::Stanza::add_backporter ( const std::string &  name,
std::string_view  email,
unsigned  cnt,
const TranslateEmail translateEmail 
)
inline

Creates a Person and adds it as Maintainer.

Parameters
nameName of the Person
emailE-mail of the Person
cntCount of changes
translateEmailCallback to update the Person's e-mail

◆ add_maintainer_and_store()

void SlKernCVS::Stanza::add_maintainer_and_store ( std::string_view  maintainer,
std::set< std::string > &  suse_users,
const TranslateEmail translateEmail 
)
inline

Add a maintainer (as Maintainer) and store them into SUSE users set too.

Parameters
maintainerSUSE maintainer
suse_usersSet to add to
translateEmailCallback to update the Person's e-mail

◆ add_maintainer_if()

void SlKernCVS::Stanza::add_maintainer_if ( std::string_view  maintainer,
const std::set< std::string > &  suse_users,
const TranslateEmail translateEmail 
)
inline

Add a maintainer (as Upstream) if in suse_users.

Parameters
maintainerMaintainer to add
suse_usersSet of SUSE users
translateEmailCallback to update the Person's e-mail

◆ add_pattern()

bool SlKernCVS::Stanza::add_pattern ( std::string  pattern)
inline

Add pattern to this Stanza.

Parameters
patternPattern to add
Returns
true on success.

◆ maintainers()

const Maintainers& SlKernCVS::Stanza::maintainers ( ) const
inline

Obtain a list of Person in this Stanza.

Returns
List of Person classes.

◆ match_path()

unsigned SlKernCVS::Stanza::match_path ( const std::filesystem::path &  path) const
inline

Return weight of path in this Stanza.

Parameters
pathA path to look for
Returns
Maximum weight of path in this Stanza or 0 if not found.

◆ new_entry()

void SlKernCVS::Stanza::new_entry ( std::string  n)
inline

Reset Stanza and start from the beginning.

Parameters
nNew name of Stanza

Called while parsing MAINTAINERS and a new subsystem was parsed.


The documentation for this class was generated from the following file: