mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-07-20 03:08:28 +08:00
51 lines
1.1 KiB
C++
51 lines
1.1 KiB
C++
#pragma once
|
|
|
|
namespace ASCDocFileFormat
|
|
{
|
|
class PlcBteChpx: public IStreamWriter
|
|
{
|
|
private:
|
|
vector<unsigned int> aFC;
|
|
vector<unsigned int> aPnBteChpx;
|
|
|
|
public:
|
|
PlcBteChpx( const vector<unsigned int>& _aFC, const vector<unsigned int>& _aPnBteChpx ):
|
|
aFC(_aFC), aPnBteChpx(_aPnBteChpx)
|
|
{
|
|
}
|
|
|
|
virtual ~PlcBteChpx()
|
|
{
|
|
}
|
|
|
|
virtual unsigned char* GetBytes( unsigned long* size ) const
|
|
{
|
|
unsigned char* bytes = NULL;
|
|
|
|
if ( size != NULL )
|
|
{
|
|
*size = ( ( sizeof(unsigned int) * this->aFC.size() ) + ( sizeof(unsigned int) * this->aPnBteChpx.size() ) );
|
|
bytes = new unsigned char[*size];
|
|
|
|
if ( bytes != NULL )
|
|
{
|
|
memset( bytes, 0, *size );
|
|
|
|
unsigned int i = 0;
|
|
|
|
for ( i = 0; i < this->aFC.size(); i++ )
|
|
{
|
|
FormatUtils::SetBytes( ( bytes + ( i * sizeof(unsigned int) ) ), (int)this->aFC[i] );
|
|
}
|
|
|
|
for ( i = 0; i < this->aPnBteChpx.size(); i++ )
|
|
{
|
|
FormatUtils::SetBytes( ( bytes + ( sizeof(unsigned int) * this->aFC.size() ) + ( i * sizeof(unsigned int) ) ), (int)this->aPnBteChpx[i] );
|
|
}
|
|
}
|
|
}
|
|
|
|
return bytes;
|
|
}
|
|
};
|
|
} |