PSendFileRES.cpp
资源名称:视频会议系统.rar [点击查看]
上传用户:popouu88
上传日期:2013-02-11
资源大小:2894k
文件大小:1k
源码类别:
IP电话/视频会议
开发平台:
Visual C++
- // PSendFileRES.cpp: implementation of the PSendFileRES class.
- //
- //////////////////////////////////////////////////////////////////////
- #include "stdafx.h"
- #include "PSendFileRES.h"
- #ifdef _DEBUG
- #undef THIS_FILE
- static char THIS_FILE[]=__FILE__;
- #define new DEBUG_NEW
- #endif
- //////////////////////////////////////////////////////////////////////
- // Construction/Destruction
- //////////////////////////////////////////////////////////////////////
- PSendFileRES::PSendFileRES()
- {
- this->Tag = PSendFileRESTAG;
- this->send_id = 0;
- this->recv_id = 0;
- this->accept = false;
- }
- PSendFileRES::~PSendFileRES()
- {
- }
- bool PSendFileRES::assembleData( int send_id , int recv_id , bool accept )
- {
- this->buffer.Resize( 4 * sizeof( int ) );
- char * now = this->buffer.GetBuffer( );
- *( int * )now = this->Tag; now += sizeof( int );
- *( int * )now = send_id; now += sizeof( int );
- *( int * )now = recv_id; now += sizeof( int );
- *( bool * )now = accept;
- return true;
- }
- bool PSendFileRES::parseData( char * buffer , int size )
- {
- if( *( int * )buffer != this->Tag )
- return false;
- buffer += sizeof( int );
- this->send_id = *( int * )buffer; buffer += sizeof( int );
- this->recv_id = *( int * )buffer; buffer += sizeof( int );
- this->accept = * ( bool * )buffer;
- return true;
- }