Move PackageWriterListener to separate file
This commit is contained in:
@@ -8,6 +8,7 @@ BinCommand package :
|
|||||||
command_extract.cpp
|
command_extract.cpp
|
||||||
command_list.cpp
|
command_list.cpp
|
||||||
package.cpp
|
package.cpp
|
||||||
|
PackageWriterListener.cpp
|
||||||
StandardErrorOutput.cpp
|
StandardErrorOutput.cpp
|
||||||
|
|
||||||
:
|
:
|
||||||
|
|||||||
@@ -0,0 +1,87 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2009-2011, Ingo Weinhold, [email protected].
|
||||||
|
* Copyright 2011, Oliver Tappe <[email protected]>
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "PackageWriterListener.h"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
||||||
|
using BPackageKit::BHPKG::BPackageWriterListener;
|
||||||
|
using BPackageKit::BHPKG::BPackageWriter;
|
||||||
|
|
||||||
|
|
||||||
|
PackageWriterListener::PackageWriterListener(bool verbose, bool quiet)
|
||||||
|
:
|
||||||
|
fVerbose(verbose), fQuiet(quiet)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
PackageWriterListener::PrintErrorVarArgs(const char* format, va_list args)
|
||||||
|
{
|
||||||
|
vfprintf(stderr, format, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
PackageWriterListener::OnEntryAdded(const char* path)
|
||||||
|
{
|
||||||
|
if (fQuiet || !fVerbose)
|
||||||
|
return;
|
||||||
|
|
||||||
|
printf("\t%s\n", path);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
PackageWriterListener::OnTOCSizeInfo(uint64 uncompressedStringsSize,
|
||||||
|
uint64 uncompressedMainSize, uint64 uncompressedTOCSize)
|
||||||
|
{
|
||||||
|
if (fQuiet || !fVerbose)
|
||||||
|
return;
|
||||||
|
|
||||||
|
printf("----- TOC Info -----------------------------------\n");
|
||||||
|
printf("cached strings size: %10" B_PRIu64 " (uncompressed)\n",
|
||||||
|
uncompressedStringsSize);
|
||||||
|
printf("TOC main size: %10" B_PRIu64 " (uncompressed)\n",
|
||||||
|
uncompressedMainSize);
|
||||||
|
printf("total TOC size: %10" B_PRIu64 " (uncompressed)\n",
|
||||||
|
uncompressedTOCSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
PackageWriterListener::OnPackageAttributesSizeInfo(uint32 stringCount,
|
||||||
|
uint32 uncompressedSize)
|
||||||
|
{
|
||||||
|
if (fQuiet || !fVerbose)
|
||||||
|
return;
|
||||||
|
|
||||||
|
printf("----- Package Attribute Info ---------------------\n");
|
||||||
|
printf("string count: %10" B_PRIu32 "\n", stringCount);
|
||||||
|
printf("package attributes size: %10" B_PRIu32 " (uncompressed)\n",
|
||||||
|
uncompressedSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
PackageWriterListener::OnPackageSizeInfo(uint32 headerSize, uint64 heapSize,
|
||||||
|
uint64 tocSize, uint32 packageAttributesSize, uint64 totalSize)
|
||||||
|
{
|
||||||
|
if (fQuiet)
|
||||||
|
return;
|
||||||
|
|
||||||
|
printf("----- Package Info ----------------\n");
|
||||||
|
printf("header size: %10" B_PRIu32 "\n", headerSize);
|
||||||
|
printf("heap size: %10" B_PRIu64 "\n", heapSize);
|
||||||
|
printf("TOC size: %10" B_PRIu64 "\n", tocSize);
|
||||||
|
printf("package attributes size: %10" B_PRIu32 "\n",
|
||||||
|
packageAttributesSize);
|
||||||
|
printf("total size: %10" B_PRIu64 "\n", totalSize);
|
||||||
|
printf("-----------------------------------\n");
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2009-2011, Ingo Weinhold, [email protected].
|
||||||
|
* Copyright 2011, Oliver Tappe <[email protected]>
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
#ifndef PACKAGE_WRITER_LISTENER_H
|
||||||
|
#define PACKAGE_WRITER_LISTENER_H
|
||||||
|
|
||||||
|
|
||||||
|
#include <package/hpkg/PackageWriter.h>
|
||||||
|
|
||||||
|
|
||||||
|
using BPackageKit::BHPKG::BPackageWriterListener;
|
||||||
|
using BPackageKit::BHPKG::BPackageWriter;
|
||||||
|
|
||||||
|
|
||||||
|
class PackageWriterListener : public BPackageWriterListener {
|
||||||
|
public:
|
||||||
|
PackageWriterListener(bool verbose, bool quiet);
|
||||||
|
|
||||||
|
virtual void PrintErrorVarArgs(const char* format,
|
||||||
|
va_list args);
|
||||||
|
|
||||||
|
virtual void OnEntryAdded(const char* path);
|
||||||
|
virtual void OnTOCSizeInfo(uint64 uncompressedStringsSize,
|
||||||
|
uint64 uncompressedMainSize,
|
||||||
|
uint64 uncompressedTOCSize);
|
||||||
|
virtual void OnPackageAttributesSizeInfo(uint32 stringCount,
|
||||||
|
uint32 uncompressedSize);
|
||||||
|
virtual void OnPackageSizeInfo(uint32 headerSize,
|
||||||
|
uint64 heapSize, uint64 tocSize,
|
||||||
|
uint32 packageAttributesSize,
|
||||||
|
uint64 totalSize);
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool fVerbose;
|
||||||
|
bool fQuiet;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif // PACKAGE_WRITER_LISTENER_H
|
||||||
@@ -21,6 +21,7 @@
|
|||||||
#include <package/hpkg/PackageWriter.h>
|
#include <package/hpkg/PackageWriter.h>
|
||||||
|
|
||||||
#include "package.h"
|
#include "package.h"
|
||||||
|
#include "PackageWriterListener.h"
|
||||||
#include "StandardErrorOutput.h"
|
#include "StandardErrorOutput.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -28,75 +29,6 @@ using BPackageKit::BHPKG::BPackageWriterListener;
|
|||||||
using BPackageKit::BHPKG::BPackageWriter;
|
using BPackageKit::BHPKG::BPackageWriter;
|
||||||
|
|
||||||
|
|
||||||
class PackageWriterListener : public BPackageWriterListener {
|
|
||||||
public:
|
|
||||||
PackageWriterListener(bool verbose, bool quiet)
|
|
||||||
: fVerbose(verbose), fQuiet(quiet)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void PrintErrorVarArgs(const char* format, va_list args)
|
|
||||||
{
|
|
||||||
vfprintf(stderr, format, args);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void OnEntryAdded(const char* path)
|
|
||||||
{
|
|
||||||
if (fQuiet || !fVerbose)
|
|
||||||
return;
|
|
||||||
|
|
||||||
printf("\t%s\n", path);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void OnTOCSizeInfo(uint64 uncompressedStringsSize,
|
|
||||||
uint64 uncompressedMainSize, uint64 uncompressedTOCSize)
|
|
||||||
{
|
|
||||||
if (fQuiet || !fVerbose)
|
|
||||||
return;
|
|
||||||
|
|
||||||
printf("----- TOC Info -----------------------------------\n");
|
|
||||||
printf("cached strings size: %10" B_PRIu64 " (uncompressed)\n",
|
|
||||||
uncompressedStringsSize);
|
|
||||||
printf("TOC main size: %10" B_PRIu64 " (uncompressed)\n",
|
|
||||||
uncompressedMainSize);
|
|
||||||
printf("total TOC size: %10" B_PRIu64 " (uncompressed)\n",
|
|
||||||
uncompressedTOCSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void OnPackageAttributesSizeInfo(uint32 stringCount,
|
|
||||||
uint32 uncompressedSize)
|
|
||||||
{
|
|
||||||
if (fQuiet || !fVerbose)
|
|
||||||
return;
|
|
||||||
|
|
||||||
printf("----- Package Attribute Info ---------------------\n");
|
|
||||||
printf("string count: %10" B_PRIu32 "\n", stringCount);
|
|
||||||
printf("package attributes size: %10" B_PRIu32 " (uncompressed)\n",
|
|
||||||
uncompressedSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void OnPackageSizeInfo(uint32 headerSize, uint64 heapSize,
|
|
||||||
uint64 tocSize, uint32 packageAttributesSize, uint64 totalSize)
|
|
||||||
{
|
|
||||||
if (fQuiet)
|
|
||||||
return;
|
|
||||||
|
|
||||||
printf("----- Package Info ----------------\n");
|
|
||||||
printf("header size: %10" B_PRIu32 "\n", headerSize);
|
|
||||||
printf("heap size: %10" B_PRIu64 "\n", heapSize);
|
|
||||||
printf("TOC size: %10" B_PRIu64 "\n", tocSize);
|
|
||||||
printf("package attributes size: %10" B_PRIu32 "\n",
|
|
||||||
packageAttributesSize);
|
|
||||||
printf("total size: %10" B_PRIu64 "\n", totalSize);
|
|
||||||
printf("-----------------------------------\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
bool fVerbose;
|
|
||||||
bool fQuiet;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
command_create(int argc, const char* const* argv)
|
command_create(int argc, const char* const* argv)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ BuildPlatformMain <build>package :
|
|||||||
command_extract.cpp
|
command_extract.cpp
|
||||||
command_list.cpp
|
command_list.cpp
|
||||||
package.cpp
|
package.cpp
|
||||||
|
PackageWriterListener.cpp
|
||||||
StandardErrorOutput.cpp
|
StandardErrorOutput.cpp
|
||||||
|
|
||||||
:
|
:
|
||||||
|
|||||||
Reference in New Issue
Block a user