A helper base class that assists in pretty-printing various objects.
More...
#include <pretty_matchers.hpp>
|
std::string | name (const std::string &name) const |
|
std::string | name_to_sentence (const std::string &name) const |
|
template<typename O> |
std::string | inspect_object (const O &o) |
| Generate a string of the class and data of an object.
|
|
|
static std::string | split_words (const std::string &sym) |
|
static std::string | underscore (const std::string &camel_cased_word) |
|
static std::string | last (const std::string &s, char delim) |
|
static std::string | improve_hash_formatting (const std::string &inspect_string) |
|
template<Util::is_streamable T> |
static std::string | to_word (const T &item) |
| Formats an object as a string when operator<< is available.
|
|
template<typename T> |
static std::string | to_word (const T &item) |
|
template<typename T> |
static std::string | to_word_type (const T &item) |
|
template<typename A, typename E> |
static std::string | to_word (const Matchers::MatcherBase< A, E > &matcher) |
|
template<class T> |
static std::string | to_sentence (const T &item) |
| Take a single object and format it as a sentance.
|
|
template<class T> |
static std::string | to_sentence (const std::vector< T > &words) |
|
template<typename T> |
static std::string | inspect_object (const T &object) |
|
template<> |
std::string | to_word (const bool &item) |
|
template<> |
std::string | inspect_object (const char *const &o) |
| Specialization for C-style strings.
|
|
A helper base class that assists in pretty-printing various objects.
This class provides helper string manipulation functions that are used to generate human-readable information and output.
◆ inspect_object() [1/2]
template<>
std::string CppSpec::Pretty::inspect_object |
( |
const char *const & | o | ) |
|
|
inlinestatic |
Specialization for C-style strings.
- Parameters
-
- Returns
- the generated string
◆ inspect_object() [2/2]
template<typename O>
std::string CppSpec::Pretty::inspect_object |
( |
const O & | o | ) |
|
|
inline |
Generate a string of the class and data of an object.
- Parameters
-
- Returns
- the generated string
◆ to_sentence() [1/2]
template<typename T>
std::string CppSpec::Pretty::to_sentence |
( |
const std::vector< T > & | objects | ) |
|
|
inlinestatic |
Takes a vector of objects and formats them as an English style list (i.e. "a, b, and c")
- Parameters
-
words | the collection of objects to be processed |
- Returns
- a human-readable comma-delimited list
◆ to_sentence() [2/2]
template<typename T>
std::string CppSpec::Pretty::to_sentence |
( |
const T & | item | ) |
|
|
inlinestatic |
Take a single object and format it as a sentance.
- Parameters
-
item | the object to be processed |
- Returns
- a human-readable representation of the object (as a list)
◆ to_word() [1/2]
template<typename A, typename E>
Formats a Matcher as a string
Unlike the generic to_word(), this is specialized for Matchers, which have a custom description associated with them for better information.
- Parameters
-
matcher | the matcher to process |
- Returns
- a string representation of the Matcher
◆ to_word() [2/2]
template<typename T>
std::string CppSpec::Pretty::to_word |
( |
const T & | item | ) |
|
|
inlinestatic |
Formats an object as a string when operator<< is available.
Formats an object as a string when there is no operator<<.
In reality, this uses the <<
operator, simply providing a way to convert the object to a string without having to deal with stringstreams.
- Parameters
-
item | the object to be processed |
- Returns
- the string representation
- Parameters
-
item | the object to be processed |
- Returns
- the string representation
The documentation for this class was generated from the following file: