All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
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
< 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 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(""));

Definition at line 40 of file BeginsWithTest.h.

Constructor & Destructor Documentation

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

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: