int main(int argc, char **argv) { fputs("clean stdout\n", stdout); getchar(); fputs("clean stderr\n", stderr); mystream("stdin", stdin); mystream("stdout", stdout); mystream("stderr", stderr); exit(0); }
void rpcbuf::finish_request() { int length = pptr() - rptr(); if (rptr() && length > 0) { pbump(-length); mystream().width(FIELDWIDTH); mystream() << length; if (_actualWidth != pptr() - rptr()) { error("rpcbuf::finish_request: length field's width changed"); } pbump(length - (pptr() - rptr())); } setr(nil); }
int rpcbuf::start_request() { if (!_mystream || !_opened || allocate() == EOF) { return EOF; } finish_request(); setr(pptr()); const int length = 0; mystream().width(FIELDWIDTH); mystream() << length; _actualWidth = pptr() - rptr(); return 0; }
int rpcbuf::read_request() { if (!_mystream) { return EOF; } if (!_actualWidth) { char* orig = pptr(); const int length = 0; mystream().width(FIELDWIDTH); mystream() << length; _actualWidth = pptr() - orig; pbump(orig - pptr()); } int navail = in_avail(); if (navail < _actualWidth) { return EOF; } char* orig = gptr(); int length = 0; mystream() >> length; gbump(orig - gptr()); if (length <= 0) { error("rpcbuf::read_request: zero or negative length"); return EOF; } if (length > ebuf() - eback() && !expand_g(length * 2)) { error("rpcbuf::read_request: out of memory"); return EOF; } if (navail < length) { return EOF; } else { return 0; } }
QMap<QString,QString> GraphicsWorkflow::extractSvgElements(const QString& xmltext) { QDomDocument doc; QMap<QString,QString> result; bool isopen = doc.setContent(xmltext); if ( !isopen) { SafetYAWL::streamlog << SafetLog::Error << tr("Se presentó un error al tratar de extraer los elementos del archivo de flujo " "de trabajo tipo SVG"); return result; } QDomNodeList list = doc.elementsByTagName("g"); for(int i = 0; i < list.count();i++) { QString nodeid, nodetext; QTextStream mystream(&nodetext); QDomNode node = list.at(i); QDomNamedNodeMap attrs = node.attributes(); nodeid = attrs.namedItem("id").nodeValue().trimmed(); if ( nodeid != "graph0") { node.save(mystream,0); mystream.flush(); // SafetYAWL::streamlog // << SafetLog::Debug // << tr("Grafico SVG nodetext numero \"%2\": \"%1\"") // .arg(nodetext) // .arg(i); QString newdoc = Safet::templateSVGString1.arg(nodetext); //result[nodeid] = localeNormalize(newdoc); result[nodeid] = newdoc; } } return result; }