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

Method update_end

lib_acl_cpp/src/stdlib/pipe_stream.cpp:154–202  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

152}
153
154bool pipe_manager::update_end(pipe_stream* out /* = NULL */)
155{
156 if (m_streams.empty()) {
157 return true;
158 }
159
160 std::list<pipe_stream*>::iterator it = m_streams.begin();
161
162 string* pBuf = m_pBuf2;
163 pBuf->clear();
164
165 if ((*it)->pop_end(pBuf, 0) == -1) {
166 return false;
167 }
168
169 string* pLast = pBuf;
170 const char* ptr = pLast->c_str();
171 size_t len = pLast->length();
172
173 pBuf = m_pBuf1;
174 pBuf->clear();
175
176 ++it;
177 for (; it != m_streams.end(); ++it) {
178 if (len > 0 && (*it)->push_pop(ptr, len, pBuf, 0) == -1) {
179 return false;
180 }
181 if ((*it)->pop_end(pBuf, 0) == -1) {
182 return false;
183 }
184
185 pLast = pBuf;
186 ptr = pLast->c_str();
187 len = pLast->length();
188
189 if (pBuf == m_pBuf1) {
190 pBuf = m_pBuf2;
191 } else {
192 pBuf = m_pBuf1;
193 }
194 pBuf->clear();
195 }
196
197 if (!pLast->empty() && out != NULL) {
198 return out->push_pop(pLast->c_str(),
199 pLast->length(), NULL, 0) != -1;
200 }
201 return true;
202}
203
204pipe_manager& pipe_manager::operator<<(const acl::string& s)
205{

Callers

nothing calls this directly

Calls 8

beginMethod · 0.80
emptyMethod · 0.45
clearMethod · 0.45
pop_endMethod · 0.45
c_strMethod · 0.45
lengthMethod · 0.45
endMethod · 0.45
push_popMethod · 0.45

Tested by

no test coverage detected