PBroadcastRES.cpp
上传用户:popouu88
上传日期:2013-02-11
资源大小:2894k
文件大小:1k
源码类别:

IP电话/视频会议

开发平台:

Visual C++

  1. // PBroadcastRES.cpp: implementation of the PBroadcastRES class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #include "PBroadcastRES.h"
  5. //////////////////////////////////////////////////////////////////////
  6. // Construction/Destruction
  7. //////////////////////////////////////////////////////////////////////
  8. PBroadcastRES::PBroadcastRES()
  9. {
  10. this->Tag = PBroadcastRESTAG;
  11. this->broadcast_id = 0;
  12. this->user_id = 0;
  13. this->success = false;
  14. }
  15. PBroadcastRES::~PBroadcastRES()
  16. {
  17. }
  18. bool PBroadcastRES::assembleData( int broadcast_id , int user_id , bool success )
  19. {
  20. this->buffer.Resize( 5 * INT_SIZE );
  21. char * now = this->buffer.GetBuffer( );
  22. *( int * )now = this->buffer.GetSize( ); now += INT_SIZE;
  23. *( int * )now = this->Tag; now += INT_SIZE;
  24. *( int * )now = broadcast_id; now += INT_SIZE;
  25. *( int * )now = user_id; now += INT_SIZE;
  26. *( int * )now = ( int )success;
  27. return true;
  28. }
  29. bool PBroadcastRES::parseData( CBuffer & buffer )
  30. {
  31. if( ! buffer.GetSize( ) ) return false;
  32. char * now = buffer.GetBuffer( ) + 2 * INT_SIZE;
  33. this->broadcast_id = *( int * )now; now += INT_SIZE;
  34. this->user_id = *( int * )now ; now += INT_SIZE;
  35. this->success = ( bool ) * ( int * )now;
  36. return true;
  37. }