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 311 of file inja.hpp.

311 {
312 start = std::min(start, view.size());
313 end = std::min(std::max(start, end), view.size());
314 return view.substr(start, end - start);
315 }

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 317 of file inja.hpp.

317 {
318 size_t idx = view.find(Separator);
319 if (idx == std::string_view::npos) {
320 return std::make_pair(view, std::string_view());
321 }
322 return std::make_pair(slice(view, 0, idx), slice(view, idx + 1, std::string_view::npos));
323 }
std::string_view slice(std::string_view view, size_t start, size_t end)
Definition inja.hpp:311

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 325 of file inja.hpp.

325 {
326 return (view.size() >= prefix.size() && view.compare(0, prefix.size(), prefix) == 0);
327 }

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

Here is the caller graph for this function: