-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrandomcodemenudialog.cpp
More file actions
92 lines (78 loc) · 2.08 KB
/
randomcodemenudialog.cpp
File metadata and controls
92 lines (78 loc) · 2.08 KB
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
#include "randomcode.h"
#include <cassert>
#include <ctime>
#include <iostream>
#include <iterator>
#include "randomcodemenudialog.h"
int ribi::RandomCodeMenuDialog::ExecuteSpecific(const std::vector<std::string>& /*argv*/) noexcept
{
#ifndef NDEBUG
Test();
#endif
//From http://www.richelbilderbeek.nl/CppRandomizeTimer.htm
std::srand(std::time(0));
//Create the random code
const std::vector<std::string> v
= RandomCode::CreateRandomCode();
//Display the random code
std::copy(
v.begin(),
v.end(),
std::ostream_iterator<std::string>(std::cout,"\n")
);
return 0;
}
ribi::About ribi::RandomCodeMenuDialog::GetAbout() const noexcept
{
About a(
"Richel Bilderbeek",
"RandomCode",
"tool to generate random C++ code",
"the 24th of February 2014",
"2007-2015",
"http://www.richelbilderbeek.nl/ToolRandomCode.htm",
GetVersion(),
GetVersionHistory());
a.AddLibrary("RandomCode version: " + RandomCode::GetVersion());
return a;
}
ribi::Help ribi::RandomCodeMenuDialog::GetHelp() const noexcept
{
return Help(
this->GetAbout().GetFileTitle(),
this->GetAbout().GetFileDescription(),
{
},
{
}
);
}
std::string ribi::RandomCodeMenuDialog::GetVersion() const noexcept
{
return "5.0";
}
std::vector<std::string> ribi::RandomCodeMenuDialog::GetVersionHistory() const noexcept
{
return {
"2007-xx-xx: version 1.0: initial version in C++ Builder",
"2010-12-03: version 2.0: port to Qt Creator",
"2011-01-07: version 3.0: added menu, reworked file architecture",
"2011-04-24: version 4.0: major architectural change, created web version",
"2011-08-31: version 4.1: added Welcome picture for web version",
"2012-12-25: version 4.2: added menu for desktop version",
"2014-02-24: version 4.3: added command-line version",
"2015-11-21: version 5.0: moved to own GitHub",
};
}
#ifndef NDEBUG
void ribi::RandomCodeMenuDialog::Test() noexcept
{
{
static bool is_tested{false};
if (is_tested) return;
is_tested = true;
}
RandomCodeMenuDialog d;
d.Execute( { "RandomCode" } );
}
#endif