Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
Catch::TagAliasRegistry Class Reference

#include <catch_tag_alias_registry.h>

Inheritance diagram for Catch::TagAliasRegistry:
Collaboration diagram for Catch::TagAliasRegistry:

Public Member Functions

 ~TagAliasRegistry () override
 
TagAlias const * find (std::string const &alias) const override
 
std::string expandAliases (std::string const &unexpandedTestSpec) const override
 
void add (std::string const &alias, std::string const &tag, SourceLineInfo const &lineInfo)
 
- Public Member Functions inherited from Catch::ITagAliasRegistry
virtual ~ITagAliasRegistry ()
 

Additional Inherited Members

- Static Public Member Functions inherited from Catch::ITagAliasRegistry
static ITagAliasRegistry const & get ()
 

Detailed Description

Definition at line 18 of file catch_tag_alias_registry.h.

Constructor & Destructor Documentation

◆ ~TagAliasRegistry()

Catch::TagAliasRegistry::~TagAliasRegistry ( )
override

Definition at line 19 of file catch_tag_alias_registry.cpp.

19{}

Member Function Documentation

◆ add()

void Catch::TagAliasRegistry::add ( std::string const & alias,
std::string const & tag,
SourceLineInfo const & lineInfo )

Definition at line 42 of file catch_tag_alias_registry.cpp.

42 {
43 CATCH_ENFORCE( startsWith(alias, "[@") && endsWith(alias, ']'),
44 "error: tag alias, '" << alias << "' is not of the form [@alias name].\n" << lineInfo );
45
46 CATCH_ENFORCE( m_registry.insert(std::make_pair(alias, TagAlias(tag, lineInfo))).second,
47 "error: tag alias, '" << alias << "' already registered.\n"
48 << "\tFirst seen at: " << find(alias)->lineInfo << "\n"
49 << "\tRedefined at: " << lineInfo );
50 }
#define CATCH_ENFORCE(condition, msg)
TagAlias const * find(std::string const &alias) const override
bool startsWith(std::string const &s, std::string const &prefix)
bool endsWith(std::string const &s, std::string const &suffix)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ expandAliases()

std::string Catch::TagAliasRegistry::expandAliases ( std::string const & unexpandedTestSpec) const
overridevirtual

Implements Catch::ITagAliasRegistry.

Definition at line 29 of file catch_tag_alias_registry.cpp.

29 {
30 std::string expandedTestSpec = unexpandedTestSpec;
31 for( auto const& registryKvp : m_registry ) {
32 std::size_t pos = expandedTestSpec.find( registryKvp.first );
33 if( pos != std::string::npos ) {
34 expandedTestSpec = expandedTestSpec.substr( 0, pos ) +
35 registryKvp.second.tag +
36 expandedTestSpec.substr( pos + registryKvp.first.size() );
37 }
38 }
39 return expandedTestSpec;
40 }

◆ find()

TagAlias const * Catch::TagAliasRegistry::find ( std::string const & alias) const
overridevirtual

Implements Catch::ITagAliasRegistry.

Definition at line 21 of file catch_tag_alias_registry.cpp.

21 {
22 auto it = m_registry.find( alias );
23 if( it != m_registry.end() )
24 return &(it->second);
25 else
26 return nullptr;
27 }
Here is the caller graph for this function:

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