MCPcopy Create free account
hub / github.com/acl-dev/acl / push_pop

Method push_pop

lib_acl_cpp/src/stdlib/pipe_stream.cpp:28–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26}
27
28int pipe_string::push_pop(const char* in, size_t len, string* out, size_t max)
29{
30 if (in && len > 0) {
31 m_pBuf->append(in, len);
32 }
33
34 if (out == NULL) {
35 return 0;
36 }
37
38 len = m_pBuf->length();
39 acl_assert(len >= m_pos);
40 len -= m_pos;
41
42 if (len == 0) {
43 return 0;
44 }
45
46 size_t n;
47 if (max > 0) {
48 n = max > len ? len : max;
49 } else {
50 n = len;
51 }
52
53 out->append(m_pBuf->c_str() + m_pos, n);
54 m_pos += n;
55 return (int) n;
56}
57
58int pipe_string::pop_end(string* out, size_t max /* = 0 */)
59{

Callers 2

updateMethod · 0.45
update_endMethod · 0.45

Calls 3

appendMethod · 0.45
lengthMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected