All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
Public Member Functions | List of all members
hext::ContainsTest Class Referencefinal

Tests whether a string contains a given literal. More...

Inheritance diagram for hext::ContainsTest:
Inheritance graph
[legend]
Collaboration diagram for hext::ContainsTest:
Collaboration graph
[legend]

Public Member Functions

 ContainsTest (std::string literal) noexcept
 Constructs a ContainsTest that succeeds for subjects that contain the given literal. More...
 
bool test (const char *subject) const override
 Return true if subject contains the given literal. More...
 
- Public Member Functions inherited from hext::Cloneable< ContainsTest, ValueTest >
virtual std::unique_ptr
< ValueTest
clone () const
 Clones objects of template type Derived and returns an owning pointer to the newly allocated Base. More...
 
- Public Member Functions inherited from hext::ValueTest
 ValueTest () noexcept=default
 
 ValueTest (const ValueTest &)=default
 
 ValueTest (ValueTest &&) noexcept=default
 
ValueTestoperator= (const ValueTest &)=default
 
ValueTestoperator= (ValueTest &&) noexcept=default
 
virtual ~ValueTest () noexcept=default
 

Detailed Description

Tests whether a string contains a given literal.

Example:
ContainsTest contains("foo");
assert( contains.test("foo"));
assert( contains.test("barfoobar"));
assert(!contains.test("barfo"));

Definition at line 40 of file ContainsTest.h.

Constructor & Destructor Documentation

hext::ContainsTest::ContainsTest ( std::string  literal)
explicitnoexcept

Constructs a ContainsTest that succeeds for subjects that contain the given literal.

Parameters
literalA string that a subject must contain.

Member Function Documentation

bool hext::ContainsTest::test ( const char *  subject) const
overridevirtual

Return true if subject contains the given literal.

Parameters
subjectThe string that is to be tested.

Implements hext::ValueTest.


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