libhext: C++ Library Documentation  1.0.12-3ea013c
Public Member Functions | List of all members
hext::EndsWithTest Class Referencefinal

Tests whether a string ends with a given literal. More...

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

Public Member Functions

 EndsWithTest (std::string literal) noexcept
 Constructs an EndsWithTest that succeeds for subjects that end with the given literal. More...
 
bool test (const char *subject) const override
 Returns true if subject ends with the given literal. More...
 
- Public Member Functions inherited from hext::Cloneable< EndsWithTest, ValueTest >
virtual std::unique_ptr< ValueTestclone () const override
 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 ends with a given literal.

Example:
EndsWithTest ends("baz");
assert( ends.test("foobaz"));
assert( ends.test("baz"));
assert(!ends.test("foo"));
EndsWithTest(std::string literal) noexcept
Constructs an EndsWithTest that succeeds for subjects that end with the given literal.

Definition at line 41 of file EndsWithTest.h.

Constructor & Destructor Documentation

◆ EndsWithTest()

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

Constructs an EndsWithTest that succeeds for subjects that end with the given literal.

Parameters
literalA string that a subject must end with.

Member Function Documentation

◆ test()

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

Returns true if subject ends with 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: