ember.cpp 0.1.0
C++ inference engine for Llama-family and paperkiln models (CPU, CUDA, WebAssembly)
Loading...
Searching...
No Matches
ember::ReplyStream Class Reference

#include <utf8_text.h>

Collaboration diagram for ember::ReplyStream:
Collaboration graph

Public Member Functions

std::string next (const std::string &full, bool end)
 

Private Attributes

size_t sent_ = std::string::npos
 

Detailed Description

Definition at line 114 of file utf8_text.h.

Member Function Documentation

◆ next()

std::string ember::ReplyStream::next ( const std::string &  full,
bool  end 
)
inline

Definition at line 116 of file utf8_text.h.

116 {
117 static const char* ws = " \t\n\v\f\r";
118 const size_t first = full.find_first_not_of(ws);
119 if (first == std::string::npos) return std::string();
120 if (sent_ == std::string::npos) sent_ = first;
121 size_t limit = full.find_last_not_of(ws) + 1;
122 if (!end) limit = std::min(limit, utf8_settled(full, sent_));
123 if (limit <= sent_) return std::string();
124 std::string out = utf8_valid(full.substr(sent_, limit - sent_));
125 sent_ = limit;
126 return out;
127 }
node out
size_t j
size_t utf8_settled(const std::string &s, size_t from)
Definition utf8_text.h:95
std::string utf8_valid(const std::string &s)
Definition utf8_text.h:74

References j, out, sent_, ember::utf8_settled(), and ember::utf8_valid().

Member Data Documentation

◆ sent_

size_t ember::ReplyStream::sent_ = std::string::npos
private

Definition at line 130 of file utf8_text.h.

Referenced by next().


The documentation for this class was generated from the following file: