Logo Search packages:      
Sourcecode: sam2p version File versions

SimBuffer::B & SimBuffer::B::appendDumpC ( const Flat other,
bool  dq = false 
)

Appends as a C (double-quoted) string.

Definition at line 944 of file gensi.cpp.

References SimBuffer::Flat::beg, SimBuffer::Flat::len, and vi_grow2().

                                                                         {
  slen_t rlen=dq?2:0;
  register char c; register char const*p;
  char const *pend; char *dst;
  for (p=other.beg,pend=p+other.len; p!=pend; p++) rlen+=is_safe_c(*p)?1:4;
  vi_grow2(0, rlen, 0, &dst);
  if (dq) *dst++='"';
  for (p=other.beg,pend=p+other.len; p!=pend; p++) {
    if (is_safe_c(c=*p)) {
      *dst++=c;
    } else {
      *dst++='\\';
      *dst++=('0'+((c>>6)&3));
      *dst++=('0'+((c>>3)&7));
      *dst++=('0'+(c&7));
    }
  }
  if (dq) *dst++='"';
  assert(dst==end_());
  return*this;
}


Generated by  Doxygen 1.6.0   Back to index