void PSXMLProtocol::encode(Document * in) { unsigned int s = _encoder_residual.size(); Glib::ustring out = in->write_to_string(); _encoder_residual.resize(s+out.bytes()+sizeof(__psxml_header_t)); __psxml_header_t h = { "psxml",htonl(out.bytes()) }; memcpy(&_encoder_residual[0]+s,&h,sizeof(__psxml_header_t)); memcpy(&_encoder_residual[0]+s+sizeof(__psxml_header_t), out.data(),out.bytes()); }
/* Implementation of Glib::ustring conversion for libxml++. * We implement them in the source file to not pollute the header with glib.h */ tiny_string::tiny_string(const Glib::ustring& r):buf(_buf_static),stringSize(r.bytes()+1),type(STATIC) { if(stringSize > STATIC_SIZE) createBuffer(stringSize); memcpy(buf,r.c_str(),stringSize); init(); }
void RelaxNGSchema::parse_memory(const Glib::ustring& contents) { parse_context(xmlRelaxNGNewMemParserCtxt(contents.c_str(), contents.bytes())); }
void SaxParser::parse_chunk(const Glib::ustring& chunk) { parse_chunk_raw((const unsigned char*)chunk.c_str(), chunk.bytes()); }
void SaxParser::parse_memory(const Glib::ustring& contents) { parse_memory_raw((const unsigned char*)contents.c_str(), contents.bytes()); }