Example #1
0
void smart_ptr::update_string(int i, const char* buf, int size)
{
  handler* x = _get_component(i);

  x -> operator->(); // this will bring the its_oid field up-to-date

  switch ( x -> its_oid().ccode() ) {
     case STRING_CODE:
       (*(pstring_handler*)x) -> update(buf, size);
       break;

     case COMPRESSED_STRING_CODE:
       (*(compressed_pstring_handler*)x) -> _asciiIn(buf, size);
       break;

     default:
       throw(stringException("invalid node data class code"));
  }
  delete x;
}
Example #2
0
void smart_ptr::update_string(int i, istream& in)
{
  handler* x = _get_component(i);

  x -> operator->(); // this will bring the its_oid field up-to-date

  io_status ok;
  switch ( x -> its_oid().ccode() ) {
     case STRING_CODE:
       ok = (*(pstring_handler*)x) -> asciiIn(in); 
       break;

     case COMPRESSED_STRING_CODE:
       ok = (*(compressed_pstring_handler*)x) -> _asciiIn(in); 
       break;

     default:
       throw(stringException("invalid node data class code"));
  }
  delete x;
}
Example #3
0
int smart_ptr::get_string_size(int i)
{
  handler* x = _get_component(i);
  x -> operator->(); // this will bring the its_oid field up-to-date

  int y ;

  switch ( x -> its_oid().ccode() ) {
     case STRING_CODE:
       y = (*(pstring_handler*)x) -> size();
       break;

     case COMPRESSED_STRING_CODE:
       y = (*(compressed_pstring_handler*)x) -> size();
       break;

     default:
       throw(stringException("invalid node data class code"));
  }

  delete x;

  return y;
}