本文整理汇总了C++中Compressor类的典型用法代码示例。如果您正苦于以下问题:C++ Compressor类的具体用法?C++ Compressor怎么用?C++ Compressor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Compressor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: copyFileToNewZip
bool ZipArchive::copyFileToNewZip(CentralDir *cdir, Stream *newZipStream)
{
// [tom, 1/24/2007] Using the stored compressor allows us to copy the raw
// data regardless of compression method without having to re-compress it.
Compressor *comp = Compressor::findCompressor(Stored);
if(comp == NULL)
return false;
if(! mStream->setPosition(cdir->mLocalHeadOffset))
return false;
// Copy file header
// FIXME [tom, 1/24/2007] This will currently not copy the extra fields
FileHeader fh;
if(! fh.read(mStream))
return false;
cdir->mLocalHeadOffset = newZipStream->getPosition();
if(! fh.write(newZipStream))
return false;
// Copy file data
Stream *readS = comp->createReadStream(cdir, mStream);
if(readS == NULL)
return false;
bool ret = newZipStream->copyFrom(readS);
// [tom, 1/24/2007] closeFile() just frees the relevant filters and
// thus it is safe to call from here.
closeFile(readS);
return ret;
}
示例2: main
int main(int argc, char **argv) {
//::testing::InitGoogleTest(&argc, argv);
//return RUN_ALL_TESTS();
if(argc != 3){
cout << "Uso: " << endl;
cout << argv[0] << " -c archivoAComprimir"<< endl;
cout << argv[0] << " -d archivoADescomprimir"<< endl;
exit(1);
}
string path=argv[2];
if(!strcmp(argv[1],"-c")){
Compressor * comp = new Compressor();
comp->compress(path);
//remove(path.c_str());
delete comp;
}
if(!strcmp(argv[1],"-d")){
Decompressor * decomp = new Decompressor();
decomp->decompress(path);
delete decomp;
}
return 0;
}
示例3: ManageCompressor
void ManageCompressor () {
if (m_compressor->GetPressureSwitchValue()) {
m_compressor->Stop();
} else {
m_compressor->Start();
}
}
示例4: fi
bool Deck::importDana(QString fileName)
{
QFileInfo fi(fileName);
QString baseName = fi.baseName().toLower();
QString tempFolder = utils::combinePaths(tempPath(), baseName);
QString deckPath = utils::combinePaths(tempFolder, "deck.xml");
QString iconPath = utils::combinePaths(tempFolder, "icon.png");
utils::createDirectory(tempFolder);
Compressor c;
if(!c.decompressFolder(fileName, tempFolder)) {
return false;
}
///
importFromXml(deckPath);
utils::removeFile(deckPath);
utils::copyDirectory(getDeckPath(), tempFolder);
/// load icon pixmap
loadPixmap( iconPath );
return true;
}
示例5: toggleCompressor
void RobotDemo::toggleCompressor(){
if(compressor->Enabled()){
compressor->Stop();
}
else{
compressor->Start();
}
}
示例6: main
int main(int argc, char*argv[]) {
if (argc < 2) { return 1; }
bool unpack = strstr(argv[1], ".pack") != nullptr;
FILE* fptr = fopen(argv[1], "rb");
if (!fptr) { printf("Could not open %s\n", argv[1]); return 1; }
fseek(fptr, 0, SEEK_END);
u32 size = ftell(fptr);
fseek(fptr, 0, SEEK_SET);
int os = 0;
CompressionParameters params;
memset(¶ms, 0, sizeof(params));
if (unpack) {
fread(&os, 4, 1, fptr);
fread(¶ms.contextCount, 1, 1, fptr);
fread(params.weights, params.contextCount, 1, fptr);
fread(params.contexts, params.contextCount, 1, fptr);
size -= ftell(fptr);
}
u8* data = (u8*)malloc(size + 10);
memset(data, 0, size + 10);
data += 10; // Ugly, but we can ensure we have a few zero bytes at the beginning of the input.
fread(data, 1, size, fptr);
fclose(fptr);
char ofn[256];
strcpy(ofn, argv[1]);
if (unpack) {
*strrchr(ofn, '.') = 0;
strcat(ofn, ".unpack");
} else {
strcat(ofn, ".pack");
}
u8* out = (u8*)malloc(65536);
memset(out, 0, 65536);
out += 10; // Ugly, but we can ensure we have a few zero bytes at the beginning of the output.
FILE* ofptr = fopen(ofn, "wb");
if (!ofptr) { printf("Could not open %s\n", argv[1]); return 1; }
if (unpack) {
Compressor* comp = new Compressor();
comp->Decompress(¶ms, &data[size - 4], out, os);
fwrite(out, os, 1, ofptr);
} else {
Compressor* comp = new Compressor();
os = 65528;
comp->Compress(¶ms, data, size, out, &os);
Invert(out, os);
fwrite(&size, 4, 1, ofptr);
fwrite(¶ms.contextCount, 1, 1, ofptr);
fwrite(params.weights, params.contextCount, 1, ofptr);
fwrite(params.contexts, params.contextCount, 1, ofptr);
fwrite(out, os, 1, ofptr);
}
fclose(ofptr);
return 0;
}
示例7: Exception
char *Math::decompress(Compressor::Format format, const char *cbytes, size_t compressedsize, size_t &rawsize)
{
Compressor *compressor = Compressor::getCompressor(format);
if (compressor == nullptr)
throw love::Exception("Invalid compression format.");
return compressor->decompress(format, cbytes, compressedsize, rawsize);
}
示例8: decompress
//------------------------------------------------------------------------------
void Compressor::decompress(std::istream &source, std::ostream &sink)
{
Compressor cmp;
cmp.istream_ = &source;
cmp.startDecompression();
copy(*cmp.uncompressedIstream_, sink);
}
示例9: toggleCompressor
void toggleCompressor(bool start, bool stop)
{
if(start)
{
comp599->Start();
}
else if(stop)
{
comp599->Stop();
}
}
示例10: ilNVidiaCompressDXT
//! Compresses data to a DXT format using nVidia's Texture Tools library.
// The data must be in unsigned byte RGBA format. The alpha channel will be ignored if DxtType is IL_DXT1.
// DxtSize is used to return the size in bytes of the DXTC data returned.
ILAPI ILubyte* ILAPIENTRY ilNVidiaCompressDXT(ILubyte *Data, ILuint Width, ILuint Height, ILuint Depth, ILenum DxtFormat, ILuint *DxtSize)
{
if (Data == NULL) { // We cannot operate on a null pointer.
ilSetError(IL_INVALID_PARAM);
return NULL;
}
// The nVidia Texture Tools library does not support volume textures yet.
if (Depth != 1) {
ilSetError(IL_INVALID_PARAM);
return NULL;
}
InputOptions inputOptions;
inputOptions.setTextureLayout(TextureType_2D, Width, Height);
inputOptions.setMipmapData(Data, Width, Height);
inputOptions.setMipmapGeneration(false, -1); //@TODO: Use this in certain cases.
OutputOptions outputOptions;
ilOutputHandlerMem outputHandler(Width, Height, DxtFormat);
outputOptions.setOutputHeader(false);
outputOptions.setOutputHandler(&outputHandler);
if (outputHandler.NewData == NULL)
return NULL;
CompressionOptions compressionOptions;
switch (DxtFormat)
{
case IL_DXT1:
compressionOptions.setFormat(Format_DXT1);
break;
case IL_DXT1A:
compressionOptions.setFormat(Format_DXT1a);
break;
case IL_DXT3:
compressionOptions.setFormat(Format_DXT1);
break;
case IL_DXT5:
compressionOptions.setFormat(Format_DXT5);
break;
default: // Does not support DXT2 or DXT4.
ilSetError(IL_INVALID_PARAM);
break;
}
Compressor compressor;
compressor.process(inputOptions, compressionOptions, outputOptions);
*DxtSize = outputHandler.Size;
return outputHandler.NewData;
}
示例11: FNEW
// CompressSimpleHelper
//------------------------------------------------------------------------------
void TestCompressor::CompressSimpleHelper( const char * data,
size_t size,
size_t expectedCompressedSize,
bool shouldCompress ) const
{
// raw input strings may not be aligned on Linux/OSX, so copy
// them to achieve our required alignment
char * alignedData = FNEW( char[ size ] );
memcpy( alignedData, data, size );
data = alignedData;
// compress
Compressor c;
const bool compressed = c.Compress( data, size );
TEST_ASSERT( compressed == shouldCompress );
const size_t compressedSize = c.GetResultSize();
if ( expectedCompressedSize > 0 )
{
TEST_ASSERT( compressedSize == expectedCompressedSize );
}
void const * compressedMem = c.GetResult();
// decompress
Compressor d;
d.Decompress( compressedMem );
const size_t decompressedSize = d.GetResultSize();
TEST_ASSERT( decompressedSize == size );
TEST_ASSERT( memcmp( data, d.GetResult(), size ) == 0 );
FDELETE_ARRAY( alignedData );
}
示例12: main
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
if (argc < 2)
{
qDebug("insufficient arguments...");
usage();
exit (0);
}
QString option = argv[1];
Compressor *c = new Compressor ();
if (option == "--help" || option == "/?")
{
usage();
exit(0);
}
else if (argc < 4)
{
qDebug() << "insufficient arguments...";
usage();
exit(0);
}
if (option == "-c")
{
c->compress(argv[2], argv[3]);
}
else if (option == "-d")
{
c->decompress(argv[2], argv[3]);
}
else
{
qDebug("unknown option!");
usage();
exit (0);
}
delete c;
qDebug("Done!");
exit (1);
return a.exec();
}
示例13: main
int main()
{
Compressor c;
//cout << "compressing" << endl;
// c.compress("/auto_home/nlephilippe/Téléchargements/test1.txt", "/auto_home/nlephilippe/Téléchargements/compc");
c.compress("/home/noe/Téléchargements/test1.txt", "/home/noe/Téléchargements/compc");
// cout << endl;
Decompressor d;
//cout << "decompressing" << endl;
//d.decompress("/auto_home/nlephilippe/Téléchargements/compc", "/auto_home/nlephilippe/Téléchargements/outc.bin");
d.decompress("/home/noe/Téléchargements/compc", "/home/noe/Téléchargements/outc.txt");
cout << endl;
return 0;
}
示例14: teleDrive
void teleDrive()
{
drive->setLinVelocity(-oi->getDriveJoystick()->GetY(Joystick::kRightHand));
drive->setTurnSpeed(oi->getDriveJoystick()->GetX(Joystick::kRightHand), oi->getDriveJoystickButton(1));
drive->drive();
drive->shift(oi->getDriveJoystickButton(8), oi->getDriveJoystickButton(9));
if(oi->getDriveJoystickButton(6))
{
comp599->Start();
}
else if(oi->getDriveJoystickButton(7))
{
comp599->Stop();
}
}
示例15: OperatorControl
void OperatorControl(void)
{
OperatorControlInit();
compressor.Start();
testActuator.Start();
while (IsOperatorControl())
{
ProgramIsAlive();
//No need to do waits because ProgramIsAlive function does a wait. //Wait(0.005);
bool isButtonPressed = stick.GetRawButton(3);
SmartDashboard::PutNumber("Actuator Button Status",isButtonPressed);
if (isButtonPressed)
{
testActuator.Go();
}
float leftYaxis = stick.GetY();
float rightYaxis = stick.GetRawAxis(5); //RawAxis(5);
TankDrive(leftYaxis,rightYaxis); // drive with arcade style (use right stick)for joystick 1
SmartDashboard::PutNumber("Left Axis",leftYaxis);
SmartDashboard::PutNumber("Right Axis",rightYaxis);
}
}