Esempio n. 1
0
  /// Copy constructor   
c4_Bytes::c4_Bytes (const c4_Bytes& src_)
  : _size (src_._size), _copy (src_._copy)
{
  _contents  = src_._contents; // moved out of intializers for DEC CXX 5.7
  if (_copy || _contents == src_._buffer)
    _MakeCopy();
}
Esempio n. 2
0
  /// Construct an object with contents, optionally as a copy
c4_Bytes::c4_Bytes (const void* buf_, int len_, bool copy_)
  : _size (len_), _copy (copy_)
{
  _contents = (t4_byte*) buf_; // moved out of intializers for DEC CXX 5.7
  if (_copy)
    _MakeCopy();
}
/// Assignment, this may make a private copy of contents
c4_Bytes &c4_Bytes::operator = (const c4_Bytes &src_) {
  if (&src_ != this) {
    _LoseCopy();

    _contents = src_._contents;
    _size = src_._size;
    _copy = src_._copy;

    if (_copy || _contents == src_._buffer)
      _MakeCopy();
  }

  return  *this;
}