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

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

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

Public Member Functions

 BeginsWithTest (std::string literal) noexcept
 Constructs a BeginsWithTest that succeeds for subjects that begin with the given literal. More...
 
bool test (const char *subject) const override
 Return true if subject begins with the given literal. More...
 
- Public Member Functions inherited from hext::Cloneable< BeginsWithTest, 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 begins with a given literal.

Example:
BeginsWithTest begins("Start");
assert( begins.test("Startles your sleeping ears to hear"));
assert(!begins.test("startles your sleeping ears to hear"));
assert(!begins.test(""));
BeginsWithTest(std::string literal) noexcept
Constructs a BeginsWithTest that succeeds for subjects that begin with the given literal.

Definition at line 41 of file BeginsWithTest.h.

Constructor & Destructor Documentation

◆ BeginsWithTest()

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

Constructs a BeginsWithTest that succeeds for subjects that begin with the given literal.

Parameters
literalA string that a subject must begin with.

Member Function Documentation

◆ test()

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

Return true if subject begins 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: