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


C++ Reporter类代码示例

本文整理汇总了C++中Reporter的典型用法代码示例。如果您正苦于以下问题:C++ Reporter类的具体用法?C++ Reporter怎么用?C++ Reporter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Reporter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: TEST

TEST(TestValidate, Simple)
{
    boost::shared_ptr<SimpleTest> n(new SimpleTest());

    {
        Reporter reporter;
        NodeReporter node_reporter(reporter, n);

        ASSERT_EQ(0UL, reporter.num_errors());
        ASSERT_EQ(0UL, reporter.num_warnings());

        n->pre_transform(node_reporter);
        EXPECT_EQ(1UL, reporter.num_errors());
        EXPECT_EQ(3UL, reporter.num_warnings());
        EXPECT_TRUE(n->pre_transform_called);
        EXPECT_FALSE(n->post_transform_called);
    }

    n->add_child(node_p(new Null()));

    {
        Reporter reporter;
        NodeReporter node_reporter(reporter, n);

        ASSERT_EQ(0UL, reporter.num_errors());
        ASSERT_EQ(0UL, reporter.num_warnings());

        n->pre_transform_called = false;
        n->post_transform(node_reporter);
        EXPECT_EQ(0UL, reporter.num_errors());
        EXPECT_EQ(3UL, reporter.num_warnings());
        EXPECT_FALSE(n->pre_transform_called);
        EXPECT_TRUE(n->post_transform_called);
    }
}
开发者ID:,项目名称:,代码行数:35,代码来源:

示例2: printOn

void CardDriverActivity::printOn(Reporter& report) const{
	report.tagValuePair(tr("oldestRecord"), oldestRecord);
	report.tagValuePair(tr("newestRecord"), newestRecord);
	report.writeArray(cardActivityDailyRecords, tr("cardActivityDailyRecords"));
	if(cardActivityDailyRecords.numberOfBlocks() > 0){
		QString tablehead = QString("<table><tr><th></th><th>%1</th><th>%2</th><th>%3</th><th>%4</th></tr>").arg(tr("Driving"), tr("Working"), tr("Rest"), tr("Available"));
		activityVector durationsMonth;
		int currentMonth = cardActivityDailyRecords[0].activityRecordDate.date().month();
		QString table = QString("<ul><li>%1:").arg(tr("Timesheet for %1").arg(QDate::longMonthName(currentMonth))) + tablehead;
		for(int j = 0; j < cardActivityDailyRecords.numberOfBlocks(); ++j){
			if(cardActivityDailyRecords[j].activityRecordDate.date().month() != currentMonth){
				currentMonth = cardActivityDailyRecords[j].activityRecordDate.date().month();
				table += QString("<tr><th>%1</th><th>%2</th><th>%3</th><th>%4</th><th>%5</th></tr>").arg(tr("Summary"), ActivityChangeInfo::formatClock(durationsMonth[ActivityChangeInfo::DRIVING]), ActivityChangeInfo::formatClock(durationsMonth[ActivityChangeInfo::WORK]), ActivityChangeInfo::formatClock(durationsMonth[ActivityChangeInfo::REST] + durationsMonth[ActivityChangeInfo::SHORTREST]), ActivityChangeInfo::formatClock(durationsMonth[ActivityChangeInfo::AVAILABLE]));

				durationsMonth = activityVector();
				table += QString("</table></li><li>%1:").arg(tr("Timesheet for %1").arg(QDate::longMonthName(currentMonth))) + tablehead;
			}
			activityVector durations;
			for(int k = 0; k < cardActivityDailyRecords[j].activityChangeInfos.numberOfBlocks(); ++k){
				durations[cardActivityDailyRecords[j].activityChangeInfos[k].activity] += cardActivityDailyRecords[j].activityChangeInfos[k].duration;
			}
			table += QString("<tr><td>%1</td><td>%2</td><td>%3</td><td>%4</td><td>%5</td></tr>").arg( cardActivityDailyRecords[j].activityRecordDate.toString(), ActivityChangeInfo::formatClock(durations[ActivityChangeInfo::DRIVING]), ActivityChangeInfo::formatClock(durations[ActivityChangeInfo::WORK]), ActivityChangeInfo::formatClock(durations[ActivityChangeInfo::REST] + durations[ActivityChangeInfo::SHORTREST]), ActivityChangeInfo::formatClock(durations[ActivityChangeInfo::AVAILABLE]));
			durationsMonth += durations;
		}
		table += QString("<tr><th>%1</th><th>%2</th><th>%3</th><th>%4</th><th>%4</th></tr>").arg(tr("Summary"), ActivityChangeInfo::formatClock(durationsMonth[ActivityChangeInfo::DRIVING]), ActivityChangeInfo::formatClock(durationsMonth[ActivityChangeInfo::WORK]), ActivityChangeInfo::formatClock(durationsMonth[ActivityChangeInfo::REST] + durationsMonth[ActivityChangeInfo::SHORTREST]), ActivityChangeInfo::formatClock(durationsMonth[ActivityChangeInfo::AVAILABLE]));

		table += "</table></li></ul>";
		report.tagValuePair(tr("Timesheet"), table);
	}
}
开发者ID:roidelapluie,项目名称:readesm,代码行数:30,代码来源:CardDriverActivity.cpp

示例3: main

int main(int argc, char * argv[])
{
    if (argc < 2)
    {
        printf("Usage at_command <command> ...\n");
        return -1;
    }

    QApplication app(argc, argv);

    ModemMap mm;
    SerialPort sp(mm.signalChannel().toAscii());
    Reporter * reporter = 0;
    if (mm.provider() == "ZTE")
    {
        reporter = new ZTEReport(mm);
    }
    else
    {
        reporter = new HuaWeiReport(mm);
    }
    QByteArray data;
    data.append(argv[1]);
    if (!data.endsWith('\r'))
    {
        data.append('\r');
    }
    reporter->sendCommand(sp, data, 5000);
    qDebug("Result:");
    qDebug() << data;

    return 0;
}
开发者ID:chenhbzl,项目名称:BooxApp,代码行数:33,代码来源:at_command.cpp

示例4: Forth_test_stdwords

void Forth_test_stdwords(bool verbose) {
    ForthEnv env;
    Reporter reporter;

    for (size_t i = 0; i < SK_ARRAY_COUNT(gRecs); i++) {
        ForthEngine engine(NULL);
        
        ForthWord* word = env.findWord(gRecs[i].fName);
        if (NULL == word) {
            SkString str;
            str.printf("--- can't find stdword %d", gRecs[i].fName);
            reporter.reportFailure(str.c_str());
        } else {
            if (verbose) {
                SkDebugf("--- testing %s %p\n", gRecs[i].fName, word);
            }
            gRecs[i].fProc(word, &engine, &reporter);
        }
    }
    
    if (0 == reporter.fFailureCount) {
        SkDebugf("--- success!\n");
    } else {
        SkDebugf("--- %d failures\n", reporter.fFailureCount);
    }
}
开发者ID:AliFarahnak,项目名称:XobotOS,代码行数:26,代码来源:ForthTests.cpp

示例5: while

/**
Function to get an executable's Offset location.
1. Traverse through all the image entries available in the iImgVsExeStatus container.
2. Get the executable Offset.

@internalComponent
@released

@param aExeName - Executable's name.

@return - returns 0 upon failure to find the Executable.
        - otherwise returns the Offset.
*/
const unsigned int SidChecker::GetExecutableOffset(const String& aExeName)
{
    Reporter* reporter = Reporter::Instance(iCmdLine->ReportFlag());
    ImgVsExeStatus& aImgVsExeStatus = reporter->GetContainerReference();

    ImgVsExeStatus::iterator imgBegin = aImgVsExeStatus.begin();
    ImgVsExeStatus::iterator imgEnd = aImgVsExeStatus.end();

    ExeVsMetaData::iterator exeBegin;
    ExeVsMetaData::iterator exeEnd;

    while(imgBegin != imgEnd)
    {
        ExeVsMetaData& exeVsMetaData = imgBegin->second;
        exeBegin = exeVsMetaData.begin();
        exeEnd = exeVsMetaData.end();

        while(exeBegin != exeEnd)
        {
            if(aExeName == (exeBegin->second).iExeName)
            {
                return (exeBegin->second).iIdData->iFileOffset;
            }
            ++exeBegin;
        }
        ++imgBegin;
    }
    return 0;
}
开发者ID:fedor4ever,项目名称:linux_build,代码行数:42,代码来源:sidchecker.cpp

示例6: printOn

void EncryptedCertificate::printOn(Reporter& report) const {
	if(decryptedCertificate){
		decryptedCertificate->printOn(report);
		report.writeBlock(certificateAuthorityReference, tr("Certificate verified from:"));
	} else {
		report.writeBlock(certificateAuthorityReference, tr("Unverified certificate, needs verification from:"));
	}
}
开发者ID:roidelapluie,项目名称:readesm,代码行数:8,代码来源:EncryptedCertificate.cpp

示例7: ProgressCallback

static void ProgressCallback(Object *object, const EventObject &event, void *clientdata)
{
    ProcessObject *process = dynamic_cast<ProcessObject *>(object);
    Reporter *reporter = reinterpret_cast<Reporter *>(clientdata);
    if (process && reporter) {
        float progress = process->GetProgress();
        reporter->report(int(progress * 100.f));
    }
}
开发者ID:salisbury-robotics,项目名称:jks-ros-pkg,代码行数:9,代码来源:LabelsVolumeGenerator.cpp

示例8: check_elapsed

void check_elapsed(bool check=true)
{
  Reporter sw;
  ex::sleep_for<typename Reporter::clock>(milliseconds(100));
  typename Reporter::duration d=sw.elapsed();
  std::cout << d << std::endl;
  if (check)
    BOOST_TEST(d >= milliseconds(100));
}
开发者ID:AbhinavJain13,项目名称:turicreate,代码行数:9,代码来源:simple_stopwatch_reporter_pass.cpp

示例9: ReportPhase

void Launcher::ReportPhase(Reporter& reporter, const PhaseCore& phase, const std::string& name) const
{
    reporter.ReportPhaseHeader();
    reporter.ReportPhase(phase, phase.metrics());
    reporter.ReportPhaseFooter();
    for (auto& child : phase._child)
    {
        std::string child_name = name + "." + child->name();
        ReportPhase(reporter, *child, child_name);
    }
}
开发者ID:chronoxor,项目名称:CppBenchmark,代码行数:11,代码来源:launcher.cpp

示例10: main

		/**
		 * @brief Main function 
		 */
		static void main()
		{
			string ip;

			cout << "----------------------------------------------------------------------------" << endl;
			cout << "	REPOTER" << endl;
			cout << "----------------------------------------------------------------------------" << endl;
			cout << endl;

			Reporter reporter;
			reporter.open();
		};
开发者ID:leedabin,项目名称:framework,代码行数:15,代码来源:Reporter.hpp

示例11: run

    void run(Reporter& reporter)
    {
        reporter.run();

        for (auto it = suites_.begin(); it != suites_.end(); ++it)
        {
            reporter.runTestSuite(it->second->number(), it->second->name());
            it->second->runTests(reporter);
            reporter.finishTestSuite();
        }

        reporter.finish();
    }
开发者ID:rozz666,项目名称:SLCC,代码行数:13,代码来源:Runner.hpp

示例12: reduce

  /**
   * \brief Reduce down the values from another aggregate UDF instance, and copy in to this aggregate instance
   */
  void reduce(const AggregateUDF* otherAgg, Reporter& reporter) {
    try {
      // loop through other's values and add to our equivalent value (if exists)
      // if doesn't exist in our values, add to our values
      const GroupAndAggregateUDF* other = (const GroupAndAggregateUDF*)otherAgg;
      for(auto ivi=other->interimValues.begin(); ivi!=other->interimValues.end(); ++ivi) {
        std::string groupBy(ivi->first);

        auto it = interimValues.find(groupBy);
        if (it == interimValues.end()) {
          // new
          IInterimResult* newInterim = resultTypeRef();
          newInterim->groupByValue = groupBy;
          newInterim->merge(ivi->second);
          interimValues.insert(std::pair<std::string,IInterimResult*>(groupBy,newInterim));
        } else {
          IInterimResult* interim = interimValues.at(groupBy);
          // merge
          interim->merge(ivi->second);
        }
      } // end for
    } catch (std::exception& ex) {
      reporter.error(("Exception in reduce(): " + std::string(ex.what())).c_str());
    }
  } // end reduce
开发者ID:adamfowleruk,项目名称:mlcplusplus,代码行数:28,代码来源:groupandaggregateudf.cpp

示例13: map

  /**
   * \brief Get the values we need for the aggregate and cache them
   *
   * Assume the first column (index 0) is the group by field (with LOW cardinality)
   */
  void map(TupleIterator& values, Reporter& reporter) {
    try {
      for (; !values.done(); values.next()) {
        std::string groupBy;
        String tempString;
        values.value(0,tempString);
        groupBy = std::string(tempString);

        auto it = interimValues.find(groupBy);
        if (it == interimValues.end()) {
          // new
          IInterimResult* newInterim = resultTypeRef();
          newInterim->groupByValue = groupBy;
          newInterim->add(values);
          interimValues.insert(std::pair<std::string,IInterimResult*>(groupBy,newInterim));
        } else {
          IInterimResult* interim = interimValues.at(groupBy);
          // merge
          interim->add(values);
        }
      }
    } catch (std::exception& ex) {
      reporter.error(("Exception in map(): " + std::string(ex.what())).c_str());
    }
  }
开发者ID:adamfowleruk,项目名称:mlcplusplus,代码行数:30,代码来源:groupandaggregateudf.cpp

示例14: finish

 /**
  * \brief Return the final result from the remaining aggregate UDF instance
  */
 void finish(OutputSequence& os, Reporter& reporter) {
   try {
     // Take Interim Values and merge results
     for (auto ivi = interimValues.begin();ivi != interimValues.end();++ivi) {
       ivi->second->writeToMap(os);
     }
   } catch (std::exception& ex) {
     reporter.error(("Exception in finish(): " + std::string(ex.what())).c_str());
   }
 }
开发者ID:adamfowleruk,项目名称:mlcplusplus,代码行数:13,代码来源:groupandaggregateudf.cpp

示例15: encode

  /**
   * \brief Encode to XDQP stream
   */
  void encode(Encoder& e, Reporter& reporter) {
    try {
      // TODO consider gzip compression at this top level, and using a std::ostringstream to collate values (optional setting at aggregate level)

      // no need to encode resultTypeRef as that's handled in the start() or clone() function
      // do need to encode count though
      e.encode((int)interimValues.size());
      for (auto ivi = interimValues.begin();ivi != interimValues.end();++ivi) {
        ivi->second->encode(e,reporter);
      }
    } catch (std::exception& ex) {
      reporter.error(("Exception in encode(): " + std::string(ex.what())).c_str());
    }
  }
开发者ID:adamfowleruk,项目名称:mlcplusplus,代码行数:17,代码来源:groupandaggregateudf.cpp


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