本文整理汇总了C++中Report类的典型用法代码示例。如果您正苦于以下问题:C++ Report类的具体用法?C++ Report怎么用?C++ Report使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Report类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Pdf
String Pdf(Report& report, bool pdfa)
{
return GetDrawingToPdfFn() && report.GetCount() ?
(*GetDrawingToPdfFn())(report.GetPages(), report.GetPage(0).GetSize(),
Nvl(report.GetMargins().x, 200), pdfa)
: String();
}
示例2: updateGeometry
bool LibPartedPartitionTable::updateGeometry(Report& report, const Partition& partition, qint64 sector_start, qint64 sector_end)
{
Q_ASSERT(partition.devicePath() == QString::fromUtf8(pedDevice()->path));
bool rval = false;
PedPartition* pedPartition = (partition.roles().has(PartitionRole::Extended))
? ped_disk_extended_partition(pedDisk())
: ped_disk_get_partition_by_sector(pedDisk(), partition.firstSector());
if (pedPartition) {
if (PedGeometry* pedGeometry = ped_geometry_new(pedDevice(), sector_start, sector_end - sector_start + 1)) {
if (PedConstraint* pedConstraint = ped_constraint_exact(pedGeometry)) {
if (ped_disk_set_partition_geom(pedDisk(), pedPartition, pedConstraint, sector_start, sector_end))
rval = true;
else
report.line() << xi18nc("@info:progress", "Could not set geometry for partition <filename>%1</filename> while trying to resize/move it.", partition.deviceNode());
ped_constraint_destroy(pedConstraint);
} else
report.line() << xi18nc("@info:progress", "Could not get constraint for partition <filename>%1</filename> while trying to resize/move it.", partition.deviceNode());
ped_geometry_destroy(pedGeometry);
} else
report.line() << xi18nc("@info:progress", "Could not get geometry for partition <filename>%1</filename> while trying to resize/move it.", partition.deviceNode());
} else
report.line() << xi18nc("@info:progress", "Could not open partition <filename>%1</filename> while trying to resize/move it.", partition.deviceNode());
return rval;
}
示例3: jobStarted
bool BackupFileSystemJob::run(Report& parent)
{
bool rval = false;
Report* report = jobStarted(parent);
if (sourcePartition().fileSystem().supportBackup() == FileSystem::cmdSupportFileSystem)
rval = sourcePartition().fileSystem().backup(*report, sourceDevice(), sourcePartition().deviceNode(), fileName());
else if (sourcePartition().fileSystem().supportBackup() == FileSystem::cmdSupportCore)
{
CopySourceDevice copySource(sourceDevice(), sourcePartition().fileSystem().firstSector(), sourcePartition().fileSystem().lastSector());
CopyTargetFile copyTarget(fileName(), sourceDevice().logicalSectorSize());
if (!copySource.open())
report->line() << i18nc("@info/plain", "Could not open file system on source partition <filename>%1</filename> for backup.", sourcePartition().deviceNode());
else if (!copyTarget.open())
report->line() << i18nc("@info/plain", "Could not create backup file <filename>%1</filename>.", fileName());
else
rval = copyBlocks(*report, copyTarget, copySource);
}
jobFinished(*report, rval);
return rval;
}
示例4: rightShadow
void ReportView::drawBackground(QPainter *painter, const QRectF &rect)
{
QGraphicsView::drawBackground(painter, rect);
if (!scene())
return;
// Shadow
QRectF sceneRect = this->scene()->sceneRect();
QRectF rightShadow(sceneRect.right(), sceneRect.top() + 5, 5, sceneRect.height());
QRectF bottomShadow(sceneRect.left() + 5, sceneRect.bottom(), sceneRect.width(), 5);
if (rightShadow.intersects(rect) || rightShadow.contains(rect))
painter->fillRect(rightShadow, Qt::darkGray);
if (bottomShadow.intersects(rect) || bottomShadow.contains(rect))
painter->fillRect(bottomShadow, Qt::darkGray);
// Fill
Report *report = (Report*)scene();
QPoint size = mapFromScene(report->gridSize().width(), report->gridSize().height())
- mapFromScene(QPointF());
QPixmap pixmap(size.x(), size.y());
{
pixmap.fill();
QPainter p(&pixmap);
QPen pen(Qt::DotLine);
pen.setColor(Qt::gray);
p.setPen(pen);
p.drawLine(0, 0, size.x(), 0);
p.drawLine(0, 0, 0, size.y());
}
painter->setBrush(pixmap);
painter->drawRect(sceneRect);
}
示例5: createPartitionTable
bool LibPartedDevice::createPartitionTable(Report& report, const PartitionTable& ptable)
{
PedDiskType* pedDiskType = ped_disk_type_get(ptable.typeName().toLatin1().constData());
if (pedDiskType == nullptr) {
report.line() << xi18nc("@info:progress", "Creating partition table failed: Could not retrieve partition table type \"%1\" for <filename>%2</filename>.", ptable.typeName(), deviceNode());
return false;
}
PedDevice* dev = ped_device_get(deviceNode().toLatin1().constData());
if (dev == nullptr) {
report.line() << xi18nc("@info:progress", "Creating partition table failed: Could not open backend device <filename>%1</filename>.", deviceNode());
return false;
}
PedDisk* disk = ped_disk_new_fresh(dev, pedDiskType);
if (disk == nullptr) {
report.line() << xi18nc("@info:progress", "Creating partition table failed: Could not create a new partition table in the backend for device <filename>%1</filename>.", deviceNode());
return false;
}
return LibPartedPartitionTable::commit(disk);
}
示例6: resize
bool luks::resize(Report& report, const QString& deviceNode, qint64 newLength) const
{
Q_ASSERT(m_innerFs);
if (mapperName().isEmpty())
return false;
qint64 payloadLength = newLength - payloadOffset();
if ( newLength - length() * m_logicalSectorSize > 0 )
{
ExternalCommand cryptResizeCmd(report, QStringLiteral("cryptsetup"), { QStringLiteral("resize"), mapperName() });
report.line() << xi18nc("@info:progress", "Resizing LUKS crypt on partition <filename>%1</filename>.", deviceNode);
if (cryptResizeCmd.run(-1) && cryptResizeCmd.exitCode() == 0)
return m_innerFs->resize(report, mapperName(), payloadLength);
}
else if (m_innerFs->resize(report, mapperName(), payloadLength))
{
ExternalCommand cryptResizeCmd(report, QStringLiteral("cryptsetup"),
{ QStringLiteral("--size"), QString::number(payloadLength / m_logicalSectorSize), // LUKS assumes 512 bytes sector
QStringLiteral("resize"), mapperName() });
report.line() << xi18nc("@info:progress", "Resizing LUKS crypt on partition <filename>%1</filename>.", deviceNode);
if (cryptResizeCmd.run(-1) && cryptResizeCmd.exitCode() == 0)
return true;
}
report.line() << xi18nc("@info:progress", "Resizing encrypted file system on partition <filename>%1</filename> failed.", deviceNode);
return false;
}
示例7: resizeFileSystem
bool LibPartedPartitionTable::resizeFileSystem(Report& report, const Partition& partition, qint64 newLength)
{
bool rval = false;
#if defined LIBPARTED_FS_RESIZE_LIBRARY_SUPPORT
if (PedGeometry* originalGeometry = ped_geometry_new(pedDevice(), partition.fileSystem().firstSector(), partition.fileSystem().length())) {
if (PedFileSystem* pedFileSystem = ped_file_system_open(originalGeometry)) {
if (PedGeometry* resizedGeometry = ped_geometry_new(pedDevice(), partition.fileSystem().firstSector(), newLength)) {
PedTimer* pedTimer = ped_timer_new(pedTimerHandler, nullptr);
rval = ped_file_system_resize(pedFileSystem, resizedGeometry, pedTimer);
ped_timer_destroy(pedTimer);
if (!rval)
report.line() << xi18nc("@info:progress", "Could not resize file system on partition <filename>%1</filename>.", partition.deviceNode());
ped_geometry_destroy(resizedGeometry);
} else
report.line() << xi18nc("@info:progress", "Could not get geometry for resized partition <filename>%1</filename> while trying to resize the file system.", partition.deviceNode());
ped_file_system_close(pedFileSystem);
} else
report.line() << xi18nc("@info:progress", "Could not open partition <filename>%1</filename> while trying to resize the file system.", partition.deviceNode());
ped_geometry_destroy(originalGeometry);
} else
report.line() << xi18nc("@info:progress", "Could not read geometry for partition <filename>%1</filename> while trying to resize the file system.", partition.deviceNode());
#else
Q_UNUSED(report);
Q_UNUSED(partition);
Q_UNUSED(newLength);
#endif
return rval;
}
示例8: LOG_DEBUG
void CalDavClient::startSlowSync()
{
FUNCTION_CALL_TRACE;
if (!mManager) {
mManager = new Accounts::Manager(this);
}
Accounts::Account *account = mManager->account(mAccountId);
if (account != NULL) {
mKCal::Notebook::Ptr notebook = mKCal::Notebook::Ptr(new mKCal::Notebook(account->displayName(), ""));
notebook->setAccount(QString::number(mAccountId));
notebook->setPluginName(getPluginName());
notebook->setSyncProfile(getProfileName());
mKCal::ExtendedCalendar::Ptr calendar = mKCal::ExtendedCalendar::Ptr(new mKCal::ExtendedCalendar(KDateTime::Spec::UTC()));
mKCal::ExtendedStorage::Ptr storage = calendar->defaultStorage(calendar);
storage->open();
bool status = storage->addNotebook(notebook);
LOG_DEBUG("NOTEBOOK created " << status << " UUID of NoteBook = " << notebook->uid());
storage->close();
calendar->close();
Report *report = new Report(mNAManager, &mSettings);
mRequests.insert(report);
connect(report, SIGNAL(finished()), this, SLOT(reportRequestFinished()));
report->getAllEvents();
}
}
示例9: processETags
void NotebookSyncAgent::processETags()
{
NOTEBOOK_FUNCTION_CALL_TRACE;
Report *report = qobject_cast<Report*>(sender());
mRequests.remove(report);
report->deleteLater();
if (report->errorCode() == Buteo::SyncResults::NO_ERROR) {
LOG_DEBUG("Process tags for server path" << mServerPath);
QHash<QString, Reader::CalendarResource> map = report->receivedCalendarResources();
// Incidences must be loaded with ExtendedStorage::allIncidences() rather than
// ExtendedCalendar::incidences(), because the latter will load incidences from all
// notebooks, rather than just the one for this report.
// Note that storage incidence references cannot be used with ExtendedCalendar::deleteEvent()
// etc. Those methods only work for references created by ExtendedCalendar.
KCalCore::Incidence::List storageIncidenceList;
if (!mStorage->allIncidences(&storageIncidenceList, mNotebook->uid())) {
emitFinished(Buteo::SyncResults::DATABASE_FAILURE, QString("Unable to load storage incidences for notebook: %1").arg(mNotebook->uid()));
return;
}
KCalCore::Incidence::List deletions;
if (!mStorage->deletedIncidences(&deletions, KDateTime(mChangesSinceDate), mNotebook->uid())) {
LOG_CRITICAL("mKCal::ExtendedStorage::deletedIncidences() failed");
}
QStringList eventIdList;
Q_FOREACH (KCalCore::Incidence::Ptr incidence, storageIncidenceList) {
QString uri = incidence->customProperty("buteo", "uri");
if (uri.isEmpty()) {
//Newly added to Local DB -- Skip this incidence
continue;
}
if (!map.contains(uri)) {
// we have an incidence that's not on the remote server, so delete it
switch (incidence->type()) {
case KCalCore::IncidenceBase::TypeEvent:
case KCalCore::IncidenceBase::TypeTodo:
case KCalCore::IncidenceBase::TypeJournal:
mIncidenceUidsToDelete.append(incidence->uid());
break;
case KCalCore::IncidenceBase::TypeFreeBusy:
case KCalCore::IncidenceBase::TypeUnknown:
break;
}
continue;
} else {
Reader::CalendarResource resource = map.take(uri);
if (mLocalETags.value(incidence->uid()) != resource.etag) {
LOG_DEBUG("Will fetch update for" << resource.href
<< "tag changed from" << mLocalETags.value(incidence->uid())
<< "to" << resource.etag);
eventIdList.append(resource.href);
}
}
}
示例10: clobberFileSystem
bool LibPartedPartitionTable::clobberFileSystem(Report& report, const Partition& partition)
{
bool rval = false;
if (PedPartition* pedPartition = ped_disk_get_partition_by_sector(pedDisk(), partition.firstSector())) {
if (pedPartition->type == PED_PARTITION_NORMAL || pedPartition->type == PED_PARTITION_LOGICAL) {
if (ped_device_open(pedDevice())) {
//reiser4 stores "ReIsEr4" at sector 128 with a sector size of 512 bytes
// We need to use memset instead of = {0} because clang sucks.
const long long zeroes_length = pedDevice()->sector_size*129;
char zeroes[zeroes_length];
memset(zeroes, 0, zeroes_length*sizeof(char));
rval = ped_geometry_write(&pedPartition->geom, zeroes, 0, 129);
if (!rval)
report.line() << xi18nc("@info:progress", "Failed to erase filesystem signature on partition <filename>%1</filename>.", partition.deviceNode());
ped_device_close(pedDevice());
}
} else
rval = true;
} else
report.line() << xi18nc("@info:progress", "Could not delete file system on partition <filename>%1</filename>: Failed to get partition.", partition.deviceNode());
return rval;
}
示例11: resizeFileSystemBackend
bool ResizeFileSystemJob::resizeFileSystemBackend(Report& report)
{
bool rval = false;
CoreBackendDevice* backendDevice = CoreBackendManager::self()->backend()->openDevice(device().deviceNode());
if (backendDevice)
{
CoreBackendPartitionTable* backendPartitionTable = backendDevice->openPartitionTable();
if (backendPartitionTable)
{
connect(CoreBackendManager::self()->backend(), SIGNAL(progress(int)), this, SIGNAL(progress(int)));
rval = backendPartitionTable->resizeFileSystem(report, partition(), newLength());
disconnect(CoreBackendManager::self()->backend(), SIGNAL(progress(int)), this, SIGNAL(progress(int)));
if (rval)
{
report.line() << i18nc("@info/plain", "Successfully resized file system using internal backend functions.");
backendPartitionTable->commit();
}
delete backendPartitionTable;
}
else
report.line() << i18nc("@info/plain", "Could not open partition <filename>%1</filename> while trying to resize the file system.", partition().deviceNode());
delete backendDevice;
}
示例12: _ShowReport
void ReportManager::_ShowReport(Report& report) const
{
this->Log(CLASS "=== Begin results ===");
this->Log(CLASS "Parameters:");
report.DumpParams();
this->Log(CLASS "Results:");
float balance = this->_conf.deposit;
unsigned int profitTrades = 0;
unsigned int profitBuyTrades = 0;
unsigned int profitSellTrades = 0;
unsigned int lossTrades = 0;
unsigned int lossBuyTrades = 0;
unsigned int lossSellTrades = 0;
std::list<Report::Trade> const& trades = report.GetTrades();
std::list<Report::Trade>::const_iterator it = trades.begin();
std::list<Report::Trade>::const_iterator itEnd = trades.end();
for (; it != itEnd; ++it)
{
balance += it->counterCurrencyProfit;
if (it->counterCurrencyProfit > 0)
{
++profitTrades;
if (it->type == Core::Controller::StatusBuy)
++profitBuyTrades;
else
++profitSellTrades;
}
else
{
++lossTrades;
if (it->type == Core::Controller::StatusBuy)
++lossBuyTrades;
else
++lossSellTrades;
}
}
this->Log(CLASS " - Balance: " + this->_conf.counterCurrency + " " + Tools::ToString(balance, 2) + ".");
this->Log(CLASS " - Profit: " + this->_conf.counterCurrency + " " + Tools::ToString(balance - this->_conf.deposit, 2) + ".");
this->Log(CLASS " - Trades:\t\tP\tP%\tL&E\tL&E%");
this->Log(CLASS " - All\t" +
Tools::ToString(profitTrades + lossTrades) + "\t" +
Tools::ToString(profitTrades) + "\t" +
Tools::ToString((profitTrades / static_cast<float>(lossTrades + profitTrades)) * 100., 2) + "\t" +
Tools::ToString(lossTrades) + "\t" +
Tools::ToString((lossTrades / static_cast<float>(lossTrades + profitTrades)) * 100., 2));
this->Log(CLASS " - Buy\t" +
Tools::ToString(profitBuyTrades + lossBuyTrades) + "\t" +
Tools::ToString(profitBuyTrades) + "\t" +
Tools::ToString((profitBuyTrades / static_cast<float>(lossBuyTrades + profitBuyTrades)) * 100., 2) + "\t" +
Tools::ToString(lossBuyTrades) + "\t" +
Tools::ToString((lossBuyTrades / static_cast<float>(lossBuyTrades + profitBuyTrades)) * 100., 2));
this->Log(CLASS " - Sell\t" +
Tools::ToString(profitSellTrades + lossSellTrades) + "\t" +
Tools::ToString(profitSellTrades) + "\t" +
Tools::ToString((profitSellTrades / static_cast<float>(lossSellTrades + profitSellTrades)) * 100., 2) + "\t" +
Tools::ToString(lossSellTrades) + "\t" +
Tools::ToString((lossSellTrades / static_cast<float>(lossSellTrades + profitSellTrades)) * 100., 2));
this->Log(CLASS "=== End results ===");
}
示例13: generateReport
Report generateReport(string reportTitle)
{
Report rpt = Report();
rpt.setReportHeader("Peter Sands\nCISP 430\nSpring 2016\n");
rpt.setReportTitle("\t\t\t" + reportTitle + "\n\n");
return rpt;
}
示例14: main
int main(void)
{
Report report;
report.ReadValidationDetail();
return 0;
}
示例15: createPartition
QString LibPartedPartitionTable::createPartition(Report& report, const Partition& partition)
{
Q_ASSERT(partition.devicePath() == QString::fromUtf8(pedDevice()->path));
QString rval = QString();
// According to libParted docs, PedPartitionType can be "nullptr if unknown". That's obviously wrong,
// it's a typedef for an enum. So let's use something the libparted devs will hopefully never
// use...
PedPartitionType pedType = static_cast<PedPartitionType>(0xffffffff);
if (partition.roles().has(PartitionRole::Extended))
pedType = PED_PARTITION_EXTENDED;
else if (partition.roles().has(PartitionRole::Logical))
pedType = PED_PARTITION_LOGICAL;
else if (partition.roles().has(PartitionRole::Primary))
pedType = PED_PARTITION_NORMAL;
if (pedType == static_cast<int>(0xffffffff)) {
report.line() << xi18nc("@info:progress", "Unknown partition role for new partition <filename>%1</filename> (roles: %2)", partition.deviceNode(), partition.roles().toString());
return QString();
}
PedFileSystemType* pedFsType = (partition.roles().has(PartitionRole::Extended) || partition.fileSystem().type() == FileSystem::Unformatted) ? nullptr : getPedFileSystemType(partition.fileSystem().type());
PedPartition* pedPartition = ped_partition_new(pedDisk(), pedType, pedFsType, partition.firstSector(), partition.lastSector());
if (pedPartition == nullptr) {
report.line() << xi18nc("@info:progress", "Failed to create new partition <filename>%1</filename>.", partition.deviceNode());
return QString();
}
PedConstraint* pedConstraint = nullptr;
PedGeometry* pedGeometry = ped_geometry_new(pedDevice(), partition.firstSector(), partition.length());
if (pedGeometry)
pedConstraint = ped_constraint_exact(pedGeometry);
ped_geometry_destroy(pedGeometry);
if (pedConstraint == nullptr) {
report.line() << i18nc("@info:progress", "Failed to create a new partition: could not get geometry for constraint.");
return QString();
}
if (ped_disk_add_partition(pedDisk(), pedPartition, pedConstraint)) {
char *pedPath = ped_partition_get_path(pedPartition);
rval = QString::fromUtf8(pedPath);
free(pedPath);
}
else {
report.line() << xi18nc("@info:progress", "Failed to add partition <filename>%1</filename> to device <filename>%2</filename>.", partition.deviceNode(), QString::fromUtf8(pedDisk()->dev->path));
report.line() << LibPartedBackend::lastPartedExceptionMessage();
}
ped_constraint_destroy(pedConstraint);
return rval;
}