当前位置: 首页>>代码示例>>C++>>正文


C++ Compressor类代码示例

本文整理汇总了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;
}
开发者ID:adhistac,项目名称:ee-client-2-0,代码行数:35,代码来源:zipArchive.cpp

示例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;
}
开发者ID:awainer,项目名称:datos2014,代码行数:26,代码来源:main.cpp

示例3: ManageCompressor

	void ManageCompressor () {
		if (m_compressor->GetPressureSwitchValue()) {
			m_compressor->Stop();
		} else {
			m_compressor->Start();
		}
	}
开发者ID:hal7df,项目名称:further-suggestions,代码行数:7,代码来源:BuiltinDefaultCode.cpp

示例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;
}
开发者ID:m-o-s-t-a-f-a,项目名称:dana,代码行数:27,代码来源:deck.cpp

示例5: toggleCompressor

void RobotDemo::toggleCompressor(){
	if(compressor->Enabled()){
		compressor->Stop();
	}
	else{
		compressor->Start();
	}
}
开发者ID:Iron-Panthers,项目名称:Iron-Panthers,代码行数:8,代码来源:robotTemplate.cpp

示例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(&params, 0, sizeof(params));
  if (unpack) {
    fread(&os, 4, 1, fptr);
    fread(&params.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(&params, &data[size - 4], out, os);
    fwrite(out, os, 1, ofptr);
  } else {
    Compressor* comp = new Compressor();
    os = 65528;
    comp->Compress(&params, data, size, out, &os);
    Invert(out, os);

    fwrite(&size, 4, 1, ofptr);
    fwrite(&params.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;
}
开发者ID:19fever,项目名称:elfling,代码行数:58,代码来源:packer.cpp

示例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);
}
开发者ID:cyborgize,项目名称:love,代码行数:9,代码来源:MathModule.cpp

示例8: decompress

//------------------------------------------------------------------------------
void Compressor::decompress(std::istream &source, std::ostream &sink)
{
  Compressor cmp;
  
  cmp.istream_ = &source;
  
  cmp.startDecompression();
  
  copy(*cmp.uncompressedIstream_, sink);
}
开发者ID:Tails8521,项目名称:genieutils,代码行数:11,代码来源:Compressor.cpp

示例9: toggleCompressor

	void toggleCompressor(bool start, bool stop)
	{
		if(start)
		{
			comp599->Start();		
		}
		else if(stop)
		{
			comp599->Stop();
		}
	}
开发者ID:Robodox-599,项目名称:2014_Anesthesiologist,代码行数:11,代码来源:Anesthesiologist.cpp

示例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;
}
开发者ID:AMDmi3,项目名称:DevIL,代码行数:55,代码来源:il_nvidia.cpp

示例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 );
}
开发者ID:ClxS,项目名称:fastbuild,代码行数:33,代码来源:TestCompressor.cpp

示例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();
}
开发者ID:do-pomian,项目名称:dfd,代码行数:50,代码来源:main.cpp

示例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;
}
开发者ID:znoraka,项目名称:master1,代码行数:14,代码来源:main.cpp

示例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();
		}
	}
开发者ID:Robodox-599,项目名称:2013_Medic,代码行数:15,代码来源:Medic.cpp

示例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);
        }
    }
开发者ID:spanut01,项目名称:FRCTeam1967,代码行数:26,代码来源:JankyActuatorTest.cpp


注:本文中的Compressor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。