MQTTSuite
Loading...
Searching...
No Matches
inja::string_view Namespace Reference

Functions

std::string_view slice (std::string_view view, size_t start, size_t end)
std::pair< std::string_view, std::string_view > split (std::string_view view, char Separator)
bool starts_with (std::string_view view, std::string_view prefix)

Function Documentation

◆ slice()

std::string_view inja::string_view::slice ( std::string_view view,
size_t start,
size_t end )
inline

Definition at line 338 of file inja.hpp.

338 {
339 start = std::min(start, view.size());
340 end = std::min(std::max(start, end), view.size());
341 return view.substr(start, end - start);
342 }

Referenced by inja::get_source_location(), inja::Lexer::make_token(), inja::Lexer::scan(), and split().

Here is the caller graph for this function:

◆ split()

std::pair< std::string_view, std::string_view > inja::string_view::split ( std::string_view view,
char Separator )
inline

Definition at line 344 of file inja.hpp.

344 {
345 const size_t idx = view.find(Separator);
346 if (idx == std::string_view::npos) {
347 return std::make_pair(view, std::string_view());
348 }
349 return std::make_pair(slice(view, 0, idx), slice(view, idx + 1, std::string_view::npos));
350 }
std::string_view slice(std::string_view view, size_t start, size_t end)
Definition inja.hpp:338

References slice().

Referenced by inja::DataNode::convert_dot_to_ptr().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ starts_with()

bool inja::string_view::starts_with ( std::string_view view,
std::string_view prefix )
inline

Definition at line 352 of file inja.hpp.

352 {
353 return (view.size() >= prefix.size() && view.compare(0, prefix.size(), prefix) == 0);
354 }

Referenced by inja::Lexer::scan(), inja::Lexer::scan_body(), and inja::Lexer::start().

Here is the caller graph for this function: