2 * Copyright 2009-2011, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Copyright 2011, Oliver Tappe <zooey@hirschkaefer.de>
4 * Distributed under the terms of the MIT License.
8 #include "PackageWriterListener.h"
13 using BPackageKit::BHPKG::BPackageWriterListener
;
14 using BPackageKit::BHPKG::BPackageWriter
;
17 PackageWriterListener::PackageWriterListener(bool verbose
, bool quiet
)
19 fVerbose(verbose
), fQuiet(quiet
)
25 PackageWriterListener::PrintErrorVarArgs(const char* format
, va_list args
)
27 vfprintf(stderr
, format
, args
);
32 PackageWriterListener::OnEntryAdded(const char* path
)
34 if (fQuiet
|| !fVerbose
)
37 printf("\t%s\n", path
);
42 PackageWriterListener::OnTOCSizeInfo(uint64 uncompressedStringsSize
,
43 uint64 uncompressedMainSize
, uint64 uncompressedTOCSize
)
45 if (fQuiet
|| !fVerbose
)
48 printf("----- TOC Info -----------------------------------\n");
49 printf("cached strings size: %10" B_PRIu64
" (uncompressed)\n",
50 uncompressedStringsSize
);
51 printf("TOC main size: %10" B_PRIu64
" (uncompressed)\n",
52 uncompressedMainSize
);
53 printf("total TOC size: %10" B_PRIu64
" (uncompressed)\n",
59 PackageWriterListener::OnPackageAttributesSizeInfo(uint32 stringCount
,
60 uint32 uncompressedSize
)
62 if (fQuiet
|| !fVerbose
)
65 printf("----- Package Attribute Info ---------------------\n");
66 printf("string count: %10" B_PRIu32
"\n", stringCount
);
67 printf("package attributes size: %10" B_PRIu32
" (uncompressed)\n",
73 PackageWriterListener::OnPackageSizeInfo(uint32 headerSize
, uint64 heapSize
,
74 uint64 tocSize
, uint32 packageAttributesSize
, uint64 totalSize
)
79 printf("----- Package Info ----------------\n");
80 printf("header size: %10" B_PRIu32
"\n", headerSize
);
81 printf("heap size: %10" B_PRIu64
"\n", heapSize
);
82 printf("TOC size: %10" B_PRIu64
"\n", tocSize
);
83 printf("package attributes size: %10" B_PRIu32
"\n",
84 packageAttributesSize
);
85 printf("total size: %10" B_PRIu64
"\n", totalSize
);
86 printf("-----------------------------------\n");