/
githubmirror
/
cmssw
Обзор
Документация
Войти
/
githubmirror
/
cmssw
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
FWCore/MessageService/test/UnitTestClient_C.cc
45 строк
2 KB
Chris Jones
Move from fmt:: to std::
07 окт 2025, 00:42
07 окт 2025, 00:42
3b732c2
Код
Авторство
О чём код?
#include <cmath> #include <iomanip> #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/Framework/interface/global/EDAnalyzer.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/Utilities/interface/StreamID.h" namespace edmtest { class UnitTestClient_C : public edm::global::EDAnalyzer<> { public: explicit UnitTestClient_C(edm::ParameterSet const&) {} void analyze(edm::StreamID, edm::Event const&, edm::EventSetup const&) const override; }; void UnitTestClient_C::analyze(edm::StreamID, edm::Event const&, edm::EventSetup const&) const { int i = 145; edm::LogWarning("cat_A") << "Test of std::hex: " << i << std::hex << " in hex is " << i; edm::LogWarning("cat_A") << "Test of std::setw(n) and std::setfill('c'): " << "The following should read ++abcdefg $$$12: " << std::setfill('+') << std::setw(9) << "abcdefg" << std::setw(5) << std::setfill('$') << 12; double d = M_PI; edm::LogWarning("cat_A") << "Test of std::setprecision(p): " << "Pi with precision 12 is " << std::setprecision(12) << d; edm::LogWarning("cat_A") << "Test of spacing: " << "The following should read a b c dd: " << "a" << std::setfill('+') << "b" << std::hex << "c" << std::setw(2) << "dd"; edm::LogWarning("cat_A").format("Test of format hex: {0} in hex is {0:x}", i); edm::LogWarning("cat_A") .format("Test of format fill and width: ") .format("The following should read ++abcdefg $$$12: {:+>9} {:$>5}", "abcdefg", 12); edm::LogWarning("cat_A").vformat(std::string("Test of format precision: Pi with precision 12 is {:.12g}"), std::make_format_args(d)); edm::LogWarning("cat_A").vformat("Test of format spacing: The following should read a b cc: {} {:+>} {:>2}", std::make_format_args("a", "b", "cc")); } } // namespace edmtest using edmtest::UnitTestClient_C; DEFINE_FWK_MODULE(UnitTestClient_C);