1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024
|
// Copyright (c) 1998-2007 Peter Karlsson
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include <config.h>
#ifdef HAVE_FSTREAM
# include <fstream>
#else
# include <fstream.h>
#endif
#include <limits.h>
#include <time.h>
#include <ios>
#include <iomanip>
#include <sstream>
#include "statview.h"
#include "statengine.h"
#include "utility.h"
#include "version.h"
#include "template.h"
#include "lexer.h"
#include "output.h"
static const char *days[] =
{ "Monday ",
"Tuesday ",
"Wednesday",
"Thursday ",
"Friday ",
"Saturday ",
"Sunday " };
StatView::StatView()
{
// Initialize all values
quoters = false;
topwritten = false;
topreceived = false;
toporiginal = false;
topnets = false;
topsubjects = false;
topprograms = false;
topdomains = false;
weekstats = false;
daystats = false;
showversions = false;
showallnums = false;
maxnumber = 15;
m_template = NULL;
}
bool StatView::CreateReport(StatEngine *engine, string filename)
{
// If we give 0 as maximum entries, we want unlimited (=UINT_MAX...)
if (0 == maxnumber) maxnumber = UINT_MAX;
// Create a report file
fstream report(filename.c_str(), ios::out);
if (!(report.is_open())) return false;
// Create an output text encoder
Encoder *encoder_p = Encoder::GetEncoderByName(charset.c_str());
// Include data as given from the statistics engine
bool news = engine->IsNewsArea();
// Loop over template, outputting the requested sections
const Template *current_line_p = m_template;
bool include_section = false;
bool quit_after_section = false;
bool area_is_empty = 0 == engine->GetTotalNumber();
Section::sectiontype current_section = Section::Common;
// Default to English day names
for (int i = 0; i < 7; ++ i)
{
m_dayname[i] = days[i];
}
// Remember toplist position, non-zero for looped lines
unsigned int place = 0;
unsigned int toplist_length = 0;
stringstream reportline;
while (current_line_p)
{
StatEngine::persstat_s current_person;
StatEngine::netstat_s current_net;
StatEngine::domainstat_s current_domain;
StatEngine::subjstat_s current_subject;
StatEngine::progstat_s current_program;
unsigned int current_day_or_hour = UINT_MAX;
unsigned int maxposts = 1; // Max posts for week/daystat bars
// Possibly repeat the current line
do
{
bool have_linebreak = false;
// Loop over the tokens on this line
const Token *current_token_p = current_line_p->Line();
while (current_token_p)
{
if (current_token_p->IsSection())
{
// Stop processing if requested
if (quit_after_section)
{
current_line_p = NULL;
break;
}
// Get section number
const Section *section_p =
static_cast<const Section *>(current_token_p);
current_section = section_p->GetSection();
// If area is empty, we quit after the first non-"Common",
// non-"IfEmpty" section.
if (area_is_empty &&
(current_section != Section::Common &&
current_section != Section::IfEmpty))
{
quit_after_section = true;
}
// Check if we should include this section or not. We always
// include Common sections.
switch (current_section)
{
case Section::Common: include_section = true; break;
case Section::IfEmpty: include_section = area_is_empty; break;
case Section::IfNotNews: include_section = !news; break;
case Section::IfNews: include_section = news; break;
case Section::Original: include_section = toporiginal; break;
case Section::Quoters: include_section = quoters; break;
case Section::Writers: include_section = topwritten; break;
case Section::TopNets: include_section = topnets && !news; break;
case Section::TopDomains: include_section = topdomains && (news || engine->GetTotalDomains()); break;
case Section::Received: include_section = topreceived && !news; break;
case Section::Subjects: include_section = topsubjects; break;
case Section::Programs: include_section = topprograms; break;
case Section::Week: include_section = weekstats; break;
case Section::Day: include_section = daystats; break;
case Section::Localization: include_section = true; break;
default:
// Unknown section.
TDisplay::GetOutputObject()->InternalErrorQuit(TDisplay::program_halted, 1);
}
}
else if (include_section && !current_token_p->IsSection())
{
// This line contains information we should output.
if (current_token_p->IsLiteral())
{
// Get literal string
const Literal *literal_p =
static_cast<const Literal *>(current_token_p);
reportline << literal_p->GetLiteral();
if (literal_p->HasLineBreak())
{
have_linebreak = true;
}
}
else if (current_token_p->IsVariable())
{
// If we encounter a "place" variable, we start
// counting the toplist position. If place is
// non-zero, we will continue outputting this
// line until we have output enough entries.
// Most of the other variables depend on the
// current section context.
const Variable *variable_p =
static_cast<const Variable *>(current_token_p);
// Default to unknown data, left justification and given width
stringstream data;
bool known_data = false;
// Default to entry not being identical to last
bool identical_entry = false;
reportline << left;
streamsize width = variable_p->GetWidth();
if (width > 0)
{
reportline << setw(width);
}
// Extract data.
bool end_iteration = false; // End iteration now.
bool next_iteration = false; // Skip to next iteration.
switch (variable_p->GetType())
{
case Variable::Version:
known_data = true;
data << version;
break;
case Variable::Copyright:
known_data = true;
data << copyright;
break;
case Variable::IfReceived:
if (!engine->HasArrivalTime())
{
// Break out of current line if there is no
// arrival time information available.
current_token_p = NULL;
data << "";
}
known_data = true;
break;
case Variable::IfAreas:
if (engine->GetTotalAreas() <= 1)
{
// Break out of current line if there is
// only one (or no) areas scanned.
current_token_p = NULL;
data << "";
}
known_data = true;
break;
case Variable::Place:
// Start counting the top-list position.
// Triggers repetition.
++ place;
data << place << '.';
reportline << right;
toplist_length = maxnumber;
known_data = true;
// Fetch the appropriate data record
switch (current_section)
{
case Section::Original:
{
// Cache
unsigned long bytesoriginal =
static_cast<unsigned long>(-1);
unsigned long messageswritten =
static_cast<unsigned long>(-1);
bool first = 1 == place;
if (!first)
{
bytesoriginal =
current_person.byteswritten -
current_person.bytesquoted;
messageswritten =
current_person.messageswritten;
}
// Constraint: Only people having posted
// at least three messages are considered.
do
{
end_iteration =
!engine->GetTopOriginalPerMsg(first, current_person);
first = false;
} while (!end_iteration && current_person.messageswritten < 3);
// Compare ratio (bytesoriginal / messageswritten)
identical_entry =
(bytesoriginal * current_person.messageswritten) ==
(current_person.byteswritten - current_person.bytesquoted) * messageswritten;
}
break;
case Section::Quoters:
{
// Cache
unsigned long bytesquoted =
static_cast<unsigned long>(-1);
unsigned long byteswritten =
static_cast<unsigned long>(-1);
bool first = 1 == place;
if (!first)
{
bytesquoted =
current_person.bytesquoted;
byteswritten =
current_person.byteswritten;
}
// Constraint: Only people having quoted
// and having posted at least three
// messages are listed.
do
{
end_iteration =
!engine->GetTopQuoters(first, current_person);
first = false;
} while (!end_iteration &&
(current_person.messageswritten < 3 || current_person.bytesquoted <= 0));
// Compare ratio (bytesquoted / byteswritten)
identical_entry =
(bytesquoted * current_person.byteswritten) ==
(current_person.bytesquoted * byteswritten);
}
break;
case Section::Writers:
{
// Cache
unsigned long messageswritten =
static_cast<unsigned long>(-1);
bool first = 1 == place;
if (!first)
{
messageswritten =
current_person.messageswritten;
}
// Constraint: Must have written at least
// one message.
do
{
end_iteration =
!engine->GetTopWriters(first, current_person);
first = false;
} while (!end_iteration && current_person.messageswritten == 0);
// Compare messages written
identical_entry =
messageswritten == current_person.messageswritten;
}
break;
case Section::TopNets:
{
unsigned long messages =
static_cast<unsigned long>(-1);
bool first = 1 == place;
if (!first)
{
messages = current_net.messages;
}
end_iteration =
!engine->GetTopNets(first, current_net);
identical_entry =
messages == current_net.messages;
}
break;
case Section::TopDomains:
{
unsigned long messages =
static_cast<unsigned long>(-1);
bool first = 1 == place;
if (!first)
{
messages = current_domain.messages;
}
end_iteration =
!engine->GetTopDomains(first, current_domain);
identical_entry =
messages == current_domain.messages;
}
break;
case Section::Received:
{
unsigned long messagesreceived =
static_cast<unsigned long>(-1);
bool first = 1 == place;
if (!first)
{
messagesreceived =
current_person.messagesreceived;
}
end_iteration =
!engine->GetTopReceivers(first, current_person);
identical_entry =
messagesreceived == current_person.messagesreceived;
}
break;
case Section::Subjects:
{
unsigned long count =
static_cast<unsigned long>(-1);
bool first = 1 == place;
if (!first)
{
count = current_subject.count;
}
end_iteration =
!engine->GetTopSubjects(first, current_subject);
identical_entry =
count == current_subject.count;
}
break;
case Section::Programs:
// FIXME: In the old format, this toplist
// included version information. This is not
// in the templatized form. See below.
{
unsigned long count =
static_cast<unsigned long>(-1);
bool first = 1 == place;
if (!first)
{
count = current_program.count;
}
end_iteration =
!engine->GetTopPrograms(1 == place, current_program);
identical_entry =
count == current_program.count;
}
break;
case Section::Week:
// This toplist is always seven entries
toplist_length = 7;
reportline << left;
// Replace place number with name of day
data.str(string());
data << m_dayname[place - 1];
current_day_or_hour =
engine->GetDayMsgs(place % 7);
// Find max width
if (1 == place)
{
maxposts = engine->GetDayMsgs(0);
for (int i = 1; i < 7; ++ i)
{
unsigned int posts = engine->GetDayMsgs(i);
if (posts > maxposts)
{
maxposts = posts;
}
}
}
if (!showallnums && !current_day_or_hour)
{
next_iteration = true;
}
break;
case Section::Day:
// This toplist is always 24 entries
toplist_length = 24;
reportline << left;
// Replace place number with hour string
data.str(string());
data << setfill('0') << setw(2) << (place - 1)
<< "00-" << setw(2) << (place - 1) << "59";
current_day_or_hour =
engine->GetHourMsgs(place - 1);
// Find max width
if (1 == place)
{
maxposts = current_day_or_hour;
for (int i = 1; i < 24; ++ i)
{
unsigned int posts = engine->GetHourMsgs(i);
if (posts > maxposts)
{
maxposts = posts;
}
}
}
if (!showallnums && !current_day_or_hour)
{
next_iteration = true;
}
break;
default:
// Section without a toplist.
end_iteration = true;
break;
}
// Clear token if entry is identical to last
if (identical_entry && !showallnums && place > 1)
{
data.str(string());
}
break;
case Variable::Name:
// Name of person.
if (current_person.name.length())
{
string name =
encoder_p->Encode(current_person.name);
if (name != current_person.address &&
current_section != Section::Received)
{
data << name << " <" <<
current_person.address << ">";
}
else
{
data << name;
}
}
known_data = true;
break;
case Variable::Written:
// Number of messages written.
switch (current_section)
{
case Section::Original:
case Section::Quoters:
case Section::Writers:
case Section::Received:
data << current_person.messageswritten;
known_data = true;
break;
case Section::TopNets:
data << current_net.messages;
known_data = true;
break;
case Section::TopDomains:
data << current_domain.messages;
known_data = true;
break;
case Section::Subjects:
data << current_subject.count;
known_data = true;
break;
case Section::Programs:
data << current_program.count;
known_data = true;
break;
case Section::Week:
case Section::Day:
if (current_day_or_hour != UINT_MAX)
{
data << current_day_or_hour;
}
known_data = true;
break;
default:
// No top-list, return totals
data << engine->GetTotalNumber();
known_data = true;
break;
}
reportline << right;
break;
case Variable::BytesWritten:
// Number of bytes written.
switch (current_section)
{
case Section::Original:
case Section::Quoters:
case Section::Writers:
case Section::Received:
data << current_person.byteswritten;
known_data = true;
break;
case Section::TopNets:
data << current_net.bytes;
known_data = true;
break;
case Section::TopDomains:
data << current_domain.bytes;
known_data = true;
break;
case Section::Subjects:
data << current_subject.bytes;
known_data = true;
break;
default:
break;
}
reportline << right;
break;
case Variable::Ratio:
// Ratio between bytes written and bytes quoted.
{
// Total bytes written (person or total)
unsigned long long totalwrittenbytes =
(place > 0)
? current_person.byteswritten
: engine->GetTotalBytes();
// Total bytes quoted (person or total)
unsigned long long totalquotedbytes =
(place > 0)
? current_person.bytesquoted
: engine->GetTotalQBytes();
if (totalquotedbytes)
{
// Percent x 1000
unsigned long long percentquotes =
totalwrittenbytes
? ((100000 * totalquotedbytes) / totalwrittenbytes)
: 0;
// Calculate integer and fraction percent
unsigned long long integ = percentquotes / 1000;
unsigned long long fract =
(percentquotes - integ * 1000 + 5) / 10;
if (100 == fract)
{
fract = 0;
integ ++;
}
// Percent string
data << integ << '.'
<< setfill('0') << setw(2) << fract << '%';
}
else
{
data << "";
}
}
reportline << right;
known_data = true;
break;
case Variable::BytesTotal:
if (place > 0)
{
data << current_person.byteswritten;
}
else
{
data << engine->GetTotalBytes();
}
known_data = true;
break;
case Variable::BytesQuoted:
if (place > 0)
{
data << current_person.bytesquoted;
}
else
{
data << engine->GetTotalQBytes();
}
known_data = true;
break;
case Variable::TotalAreas:
data << engine->GetTotalAreas();
known_data = true;
break;
case Variable::TotalPeople:
data << engine->GetTotalPeople();
known_data = true;
break;
case Variable::TotalNets:
data << engine->GetTotalNets();
known_data = true;
break;
case Variable::TotalDomains:
data << engine->GetTotalDomains();
known_data = true;
break;
case Variable::TotalSubjects:
data << engine->GetTotalSubjects();
known_data = true;
break;
case Variable::TotalPrograms:
data << engine->GetTotalPrograms();
known_data = true;
break;
case Variable::EarliestReceived:
case Variable::LastReceived:
case Variable::EarliestWritten:
case Variable::LastWritten:
// Timestamp, formatted according to the supplied
// options.
{
// Get the appropriate timestamp
time_t timestamp = static_cast<time_t>(-1);
switch (variable_p->GetType())
{
case Variable::EarliestReceived:
timestamp = engine->GetEarliestReceived();
break;
case Variable::LastReceived:
timestamp = engine->GetLastReceived();
break;
case Variable::EarliestWritten:
timestamp = engine->GetEarliestWritten();
break;
case Variable::LastWritten:
timestamp = engine->GetLastWritten();
break;
default:
break;
}
if (timestamp != static_cast<time_t>(-1))
{
// Format the timestamp accoding to the locale
struct tm *p1 = gmtime(×tamp);
char date[64];
#if defined(HAVE_LOCALE_H) || defined(HAVE_OS2_COUNTRYINFO) || defined(HAVE_WIN32_LOCALEINFO)
if (uselocale)
localetimestring(p1, 64, date);
else
#endif
strftime(date, 64, "%Y-%m-%d %H:%M:%S", p1);
data << date;
known_data = true;
}
}
break;
case Variable::BytesOriginal:
data <<
current_person.byteswritten -
current_person.bytesquoted;
reportline << right;
known_data = true;
break;
case Variable::PerMessage:
data <<
(current_person.byteswritten - current_person.bytesquoted)
/ current_person.messageswritten;
reportline << right;
known_data = true;
break;
case Variable::Fidonet:
// This variable is special, the width defines
// the right-aligned zone and the left-aligned
// network field. We output the first part here,
// and put the rest in data.
reportline << right << current_net.zone << ':';
reportline << setw(width) << left;
data << current_net.net;
known_data = true;
break;
case Variable::TopDomain:
data << current_domain.topdomain;
known_data = true;
break;
case Variable::Received:
reportline << right;
data << current_person.messagesreceived;
known_data = true;
break;
case Variable::ReceiveRatio:
reportline << right;
if (current_person.messageswritten)
{
data <<
(100 * current_person.messagesreceived) /
current_person.messageswritten << "%";
}
else if (showallnums)
{
data << "N/A";
}
known_data = true;
break;
case Variable::Subject:
{
string subject = encoder_p->Encode(current_subject.subject);
if (subject != "")
{
data << subject;
}
else
{
data << "(none)";
}
known_data = true;
}
case Variable::Program:
{
string program = encoder_p->Encode(current_program.program);
data << program;
known_data = true;
}
break;
case Variable::Bar:
{
unsigned int len = width;
if (maxposts)
{
len = (60 * current_day_or_hour) / maxposts;
}
for (unsigned int i = 0; i < len; i ++)
{
data << '*';
}
known_data = true;
}
break;
}
if (end_iteration)
{
// No more data to output, either not a top-list
// section, or we ran out of data early.
toplist_length = place - 1;
current_token_p = NULL;
}
else if (next_iteration)
{
// No data to show for this iteration (a day or
// hour without postings).
current_token_p = NULL;
}
else
{
string s(known_data ? data.str() : "?");
if (width && static_cast<streamsize>(data.str().length()) > width)
{
s.erase(width);
}
reportline << s;
}
}
else if (current_token_p->IsSetting())
{
const Setting *setting_p =
static_cast<const Setting *>(current_token_p);
int idx = 0;
switch (setting_p->GetType())
{
case Setting::Sunday:
++ idx;
case Setting::Saturday:
++ idx;
case Setting::Friday:
++ idx;
case Setting::Thursday:
++ idx;
case Setting::Wednesday:
++ idx;
case Setting::Tuesday:
++ idx;
case Setting::Monday:
m_dayname[idx] = setting_p->GetValue();
break;
default:
// This cannot happen, there are no more settings types.
TDisplay::GetOutputObject()->InternalErrorQuit(TDisplay::program_halted, 1);
break;
}
}
else
{
// This cannot happen, there are no more token types.
TDisplay::GetOutputObject()->InternalErrorQuit(TDisplay::program_halted, 1);
}
}
// Advance to next token
if (current_token_p)
{
current_token_p = current_token_p->Next();
}
}
if (have_linebreak)
{
// Remove any trailing spaces from the report line
string::size_type lastnonspace = reportline.str().find_last_not_of(" ");
if (lastnonspace != string::npos)
{
report << reportline.str().substr(0, lastnonspace + 1);
}
report << endl;
// Clear line
reportline.str(string());
}
// Repeat the current line if in a toplist.
} while (place > 0 && place < toplist_length);
if (place > 0)
{
// Reset
place = 0;
// Close the iterator
switch (current_section)
{
case Section::Original:
case Section::Quoters:
case Section::Writers:
case Section::Received:
engine->DoneTopPeople();
break;
case Section::TopNets:
engine->DoneTopNets();
break;
case Section::TopDomains:
engine->DoneTopDomains();
break;
case Section::Subjects:
engine->DoneTopSubjects();
break;
case Section::Programs:
engine->DoneTopPrograms();
break;
case Section::Week:
case Section::Day:
// Nothing to do
break;
default:
// Section without a toplist.
break;
}
}
// Advance to the next line
current_line_p = current_line_p->Next();
}
#if 0
// Old code to handle versions in the top list of programs:
if (showversions)
{
bool restartv = true;
StatEngine::verstat_s vdata;
while (engine->GetProgramVersions(restartv, vdata))
{
if (restartv)
{
restartv = false;
report << " ";
}
string version = encoder_p->Encode(vdata.version);
report << ' ' << version << ':' << vdata.count;
}
if (!restartv) report << endl;
}
#endif
report.close();
delete encoder_p;
return true;
}
|