-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCodeSnap-Converter.cpp.html
More file actions
102 lines (89 loc) · 3.66 KB
/
CodeSnap-Converter.cpp.html
File metadata and controls
102 lines (89 loc) · 3.66 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
93
94
95
96
97
98
99
100
101
102
<!----------------------------------------------------------------------------
CodeSnap-Converter.h.htm
Published 19 Mar 2017
Jim Fawcett, CSE687 : Object Oriented Design, Summer 2017
Note:
- Markup characters in the text part, enclosed in <pre>...</pre> have to be
replaced with escape sequences, e.g., < becomes < and > becomes >
- Be careful that you don't replace genuine markup characters with escape
sequences, e.g., everything outside of the <pre>...</pre> section.
----------------------------------------------------------------------------->
<html>
<head>
<script src="js/ScriptsUtilities.js"></script>
<script src="js/ScriptsTemplate.js"></script>
<script src="js/ScriptsKeyboard.js"></script>
<script src="js/ScriptsMenuCpp.js"></script>
<link rel="stylesheet" href="css/StylesTemplate.css" />
<link rel="stylesheet" href="css/StylesMenu.css" />
<style>
h3 {
font-weight: normal;
}
</style>
</head>
<body id="github" onload="initializeMenu()">
<nav>
<div id="navbar"></div>
</nav>
<a id="Next" href="CodeSnap-Converter.txt.html">N</a>
<a id="Prev" href="CodeSnap-Converter.h.html">P</a>
<navKeys-Container>
<nav-Key id="sKey" onclick="toggleSwipeEvents()">S</nav-Key>
<nav-Key id="rKey" onclick="location.reload()">R</nav-Key>
<nav-Key id="tKey" onclick="scrollPageTop()">T</nav-Key>
<nav-Key id="bKey" onclick="scrollPageBottom()">B</nav-Key>
<nav-Key id="hKey" onclick="helpWin()">H</nav-Key>
<nav-Key id="pKey" onclick="loadPrev()">P</nav-Key>
<nav-Key id="nKey" onclick="loadNext()">N</nav-Key>
</navKeys-Container>
<h3>
<a href="CodeSnap-Converter.h.html">Converter.h</a>,
<a href="CodeSnap-Converter.cpp.html">Converter.cpp</a>,
<a href="CodeSnap-Converter.txt.html">Converter.txt</a>,
<a href="https://github.com/JimFawcett/CppUtilities">Code Folder</a>
</h3>
<div class="indent">
Illustrates a useful conversion utilitiy.
</div>
<hr />
<pre class="codeSnap">
///////////////////////////////////////////////////////////////////////
// CodeUtilities.cpp - small, generally useful, helper classes //
// ver 1.0 //
// Language: C++, Visual Studio 2017 //
// Application: Most Projects, CSE687 - Object Oriented Design //
// Author: Jim Fawcett, Syracuse University, CST 4-187 //
// jfawcett@twcny.rr.com //
///////////////////////////////////////////////////////////////////////
#include "CodeUtilities.h"
#include "../StringUtilities/StringUtilities.h"
#include <string>
#include <iostream>
#ifdef TEST_CODEUTILITIES
using namespace Utilities;
int main()
{
title("test std::string Converter<T>::toString(T)");
std::string conv1 = Converter<double>::toString(3.1415927);
std::string conv2 = Converter<int>::toString(73);
std::string conv3 = Converter<std::string>::toString("a_test_string plus more");
std::cout << "\n Converting from values to strings: ";
std::cout << conv1 << ", " << conv2 << ", " << conv3;
putline();
title("test T Converter<T>::toValue(std::string)");
std::cout << "\n Converting from strings to values: ";
std::cout << Converter<double>::toValue(conv1) << ", ";
std::cout << Converter<int>::toValue(conv2) << ", ";
std::cout << Converter<std::string>::toValue(conv3);
putline(2);
return 0;
}
#endif
</pre>
<!--<div class="photo">
<img src="pictures/CSTstrip.jpg" width="100%" />
</div>-->
<info-bar></info-bar>
</body>
</html>