Documentation for 8b1eab204b

This commit is contained in:
realstealthninja
2024-11-04 12:43:05 +00:00
parent 4fb6e622e9
commit a7bccf7d01
6732 changed files with 153919 additions and 365711 deletions

View File

@@ -1,3 +1,4 @@
<!-- HTML header for doxygen 1.12.0-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
@@ -5,10 +6,15 @@
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.12.0"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Algorithms_in_C++: ciphers/morse_code.cpp File Reference</title>
<title>TheAlgorithms/C++: ciphers/morse_code.cpp File Reference</title>
<link rel="icon" href="../../favicon.svg" type="image/x-icon" />
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../jquery.js"></script>
<script type="text/javascript" src="../../dynsections.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@xpack-3rd-party/doxygen-awesome-css@2.2.0-1/doxygen-awesome-darkmode-toggle.js"></script>
<script type="text/javascript">
DoxygenAwesomeDarkModeToggle.init()
</script>
<script type="text/javascript" src="../../clipboard.js"></script>
<link href="../../navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../navtreedata.js"></script>
@@ -18,14 +24,24 @@
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../search/searchdata.js"></script>
<script type="text/javascript" src="../../search/search.js"></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
jax: ["input/TeX","output/HTML-CSS"],
});
<script type="text/javascript">
window.MathJax = {
options: {
ignoreHtmlClass: 'tex2jax_ignore',
processHtmlClass: 'tex2jax_process'
},
loader: {
load: ['[tex]/ams']
},
tex: {
macros: {},
packages: ['base','configmacros','ams']
}
};
</script>
<script type="text/javascript" async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML/MathJax.js"></script>
<script type="text/javascript" id="MathJax-script" async="async" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js"></script>
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
<link href="../../doxygen-awesome.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
@@ -33,10 +49,11 @@ MathJax.Hub.Config({
<table cellspacing="0" cellpadding="0">
<tbody>
<tr id="projectrow">
<td id="projectlogo"><img alt="Logo" src="../../project_logo.png"/></td>
<td id="projectalign">
<div id="projectname">Algorithms_in_C++<span id="projectnumber">&#160;1.0.0</span>
<div id="projectname">TheAlgorithms/C++<span id="projectnumber">&#160;1.0.0</span>
</div>
<div id="projectbrief">Set of algorithms implemented in C++.</div>
<div id="projectbrief">All the algorithms implemented in C++</div>
</td>
</tr>
</tbody>
@@ -122,7 +139,9 @@ Include dependency graph for morse_code.cpp:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="../../db/d93/morse__code_8cpp__incl.svg" width="331" height="111"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
</div>
</div><table class="memberdecls">
</div>
<p><a href="../../d8/d76/morse__code_8cpp_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="namespaces" name="namespaces"></a>
Namespaces</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">namespace &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d6/d4e/namespaceciphers.html">ciphers</a></td></tr>
@@ -134,13 +153,13 @@ Namespaces</h2></td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ab31773fd11555d21f70d6914138d9535" id="r_ab31773fd11555d21f70d6914138d9535"><td class="memItemLeft" align="right" valign="top"><a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#ab31773fd11555d21f70d6914138d9535">ciphers::morse::char_to_morse</a> (const char &amp;c)</td></tr>
<tr class="memitem:ab31773fd11555d21f70d6914138d9535" id="r_ab31773fd11555d21f70d6914138d9535"><td class="memItemLeft" align="right" valign="top">std::string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#ab31773fd11555d21f70d6914138d9535">ciphers::morse::char_to_morse</a> (const char &amp;c)</td></tr>
<tr class="separator:ab31773fd11555d21f70d6914138d9535"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac9f294b0dec08a4a11d477a32f9bd829" id="r_ac9f294b0dec08a4a11d477a32f9bd829"><td class="memItemLeft" align="right" valign="top">char&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#ac9f294b0dec08a4a11d477a32f9bd829">ciphers::morse::morse_to_char</a> (const <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> &amp;s)</td></tr>
<tr class="memitem:ac9f294b0dec08a4a11d477a32f9bd829" id="r_ac9f294b0dec08a4a11d477a32f9bd829"><td class="memItemLeft" align="right" valign="top">char&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#ac9f294b0dec08a4a11d477a32f9bd829">ciphers::morse::morse_to_char</a> (const std::string &amp;s)</td></tr>
<tr class="separator:ac9f294b0dec08a4a11d477a32f9bd829"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0242e458904de8a242fcdaffe9e3ba1a" id="r_a0242e458904de8a242fcdaffe9e3ba1a"><td class="memItemLeft" align="right" valign="top"><a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a0242e458904de8a242fcdaffe9e3ba1a">ciphers::morse::encrypt</a> (const <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> &amp;text)</td></tr>
<tr class="memitem:a0242e458904de8a242fcdaffe9e3ba1a" id="r_a0242e458904de8a242fcdaffe9e3ba1a"><td class="memItemLeft" align="right" valign="top">std::string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a0242e458904de8a242fcdaffe9e3ba1a">ciphers::morse::encrypt</a> (const std::string &amp;text)</td></tr>
<tr class="separator:a0242e458904de8a242fcdaffe9e3ba1a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a15c66ec8cf4cef0a35c50cbab86965dc" id="r_a15c66ec8cf4cef0a35c50cbab86965dc"><td class="memItemLeft" align="right" valign="top"><a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a15c66ec8cf4cef0a35c50cbab86965dc">ciphers::morse::decrypt</a> (const <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> &amp;text)</td></tr>
<tr class="memitem:a15c66ec8cf4cef0a35c50cbab86965dc" id="r_a15c66ec8cf4cef0a35c50cbab86965dc"><td class="memItemLeft" align="right" valign="top">std::string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a15c66ec8cf4cef0a35c50cbab86965dc">ciphers::morse::decrypt</a> (const std::string &amp;text)</td></tr>
<tr class="separator:a15c66ec8cf4cef0a35c50cbab86965dc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa8dca7b867074164d5f45b0f3851269d" id="r_aa8dca7b867074164d5f45b0f3851269d"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#aa8dca7b867074164d5f45b0f3851269d">test</a> ()</td></tr>
<tr class="memdesc:aa8dca7b867074164d5f45b0f3851269d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Function to test above algorithm. <br /></td></tr>
@@ -153,6 +172,8 @@ Functions</h2></td></tr>
<div class="textblock"><p>Implementation of [Morse Code] (<a href="https://en.wikipedia.org/wiki/Morse_code">https://en.wikipedia.org/wiki/Morse_code</a>). </p>
<dl class="section author"><dt>Author</dt><dd><a href="https://github.com/imdeep2905" target="_blank">Deep Raval</a></dd></dl>
<p>Morse code is a method used in telecommunication to encode text characters as standardized sequences of two different signal durations, called dots and dashes or dits and dahs. Morse code is named after Samuel Morse, an inventor of the telegraph. </p>
<p class="definition">Definition in file <a class="el" href="../../d8/d76/morse__code_8cpp_source.html">morse_code.cpp</a>.</p>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="ab31773fd11555d21f70d6914138d9535" name="ab31773fd11555d21f70d6914138d9535"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab31773fd11555d21f70d6914138d9535">&#9670;&#160;</a></span>char_to_morse()</h2>
@@ -161,7 +182,7 @@ Functions</h2></td></tr>
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> ciphers::morse::char_to_morse </td>
<td class="memname">std::string ciphers::morse::char_to_morse </td>
<td>(</td>
<td class="paramtype">const char &amp;</td> <td class="paramname"><span class="paramname"><em>c</em></span></td><td>)</td>
<td></td>
@@ -175,6 +196,8 @@ Functions</h2></td></tr>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>morse representation string of character </dd></dl>
<p class="definition">Definition at line <a class="el" href="../../d8/d76/morse__code_8cpp_source.html#l00033">33</a> of file <a class="el" href="../../d8/d76/morse__code_8cpp_source.html">morse_code.cpp</a>.</p>
<div class="fragment"><div class="line"><span class="lineno"> 33</span> {</div>
<div class="line"><span class="lineno"> 34</span> <span class="comment">// return corresponding morse code</span></div>
<div class="line"><span class="lineno"> 35</span> <span class="keywordflow">switch</span> (c) {</div>
@@ -251,19 +274,11 @@ Functions</h2></td></tr>
<div class="line"><span class="lineno"> 106</span> <span class="keywordflow">case</span> <span class="charliteral">&#39;0&#39;</span>:</div>
<div class="line"><span class="lineno"> 107</span> <span class="keywordflow">return</span> <span class="stringliteral">&quot;-----&quot;</span>;</div>
<div class="line"><span class="lineno"> 108</span> <span class="keywordflow">default</span>:</div>
<div class="line"><span class="lineno"> 109</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cerr</a> &lt;&lt; <span class="stringliteral">&quot;Found invalid character: &quot;</span> &lt;&lt; c &lt;&lt; <span class="charliteral">&#39; &#39;</span> &lt;&lt; <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
<div class="line"><span class="lineno"> 110</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/utility/program/exit.html">std::exit</a>(0);</div>
<div class="line"><span class="lineno"> 109</span> std::cerr &lt;&lt; <span class="stringliteral">&quot;Found invalid character: &quot;</span> &lt;&lt; c &lt;&lt; <span class="charliteral">&#39; &#39;</span> &lt;&lt; std::endl;</div>
<div class="line"><span class="lineno"> 110</span> std::exit(0);</div>
<div class="line"><span class="lineno"> 111</span> }</div>
<div class="line"><span class="lineno"> 112</span>}</div>
<div class="ttc" id="abasic_ostream_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cerr</a></div></div>
<div class="ttc" id="aendl_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a></div><div class="ttdeci">T endl(T... args)</div></div>
<div class="ttc" id="aexit_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/utility/program/exit.html">std::exit</a></div><div class="ttdeci">T exit(T... args)</div></div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d8/d76/morse__code_8cpp_ab31773fd11555d21f70d6914138d9535_cgraph.svg" width="271" height="92"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
</div>
</div><!-- fragment -->
</div>
</div>
<a id="a15c66ec8cf4cef0a35c50cbab86965dc" name="a15c66ec8cf4cef0a35c50cbab86965dc"></a>
@@ -273,9 +288,9 @@ Here is the call graph for this function:</div>
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> ciphers::morse::decrypt </td>
<td class="memname">std::string ciphers::morse::decrypt </td>
<td>(</td>
<td class="paramtype">const <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> &amp;</td> <td class="paramname"><span class="paramname"><em>text</em></span></td><td>)</td>
<td class="paramtype">const std::string &amp;</td> <td class="paramname"><span class="paramname"><em>text</em></span></td><td>)</td>
<td></td>
</tr>
</table>
@@ -287,41 +302,32 @@ Here is the call graph for this function:</div>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>new decrypted text </dd></dl>
<p class="definition">Definition at line <a class="el" href="../../d8/d76/morse__code_8cpp_source.html#l00216">216</a> of file <a class="el" href="../../d8/d76/morse__code_8cpp_source.html">morse_code.cpp</a>.</p>
<div class="fragment"><div class="line"><span class="lineno"> 216</span> {</div>
<div class="line"><span class="lineno"> 217</span> <span class="comment">// Going through each character of text and converting it</span></div>
<div class="line"><span class="lineno"> 218</span> <span class="comment">// back to normal representation.</span></div>
<div class="line"><span class="lineno"> 219</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> decrypted_text = <span class="stringliteral">&quot;&quot;</span>; <span class="comment">// Empty string to store decrypted text</span></div>
<div class="line"><span class="lineno"> 219</span> std::string decrypted_text = <span class="stringliteral">&quot;&quot;</span>; <span class="comment">// Empty string to store decrypted text</span></div>
<div class="line"><span class="lineno"> 220</span> <span class="comment">// Spliting string (with delimiter = &quot; &quot;) and storing it</span></div>
<div class="line"><span class="lineno"> 221</span> <span class="comment">// in vector</span></div>
<div class="line"><span class="lineno"> 222</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/types/size_t.html">std::size_t</a> pos_start = 0, pos_end = 0, delim_len = 1;</div>
<div class="line"><span class="lineno"> 223</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector&lt;std::string&gt;</a> splits;</div>
<div class="line"><span class="lineno"> 224</span> <span class="keywordflow">while</span> ((pos_end = text.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string/find.html">find</a>(<span class="charliteral">&#39; &#39;</span>, pos_start)) != std::string::npos) {</div>
<div class="line"><span class="lineno"> 225</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> token = text.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string/substr.html">substr</a>(pos_start, pos_end - pos_start);</div>
<div class="line"><span class="lineno"> 222</span> std::size_t pos_start = 0, pos_end = 0, delim_len = 1;</div>
<div class="line"><span class="lineno"> 223</span> std::vector&lt;std::string&gt; splits;</div>
<div class="line"><span class="lineno"> 224</span> <span class="keywordflow">while</span> ((pos_end = text.find(<span class="charliteral">&#39; &#39;</span>, pos_start)) != std::string::npos) {</div>
<div class="line"><span class="lineno"> 225</span> std::string token = text.substr(pos_start, pos_end - pos_start);</div>
<div class="line"><span class="lineno"> 226</span> pos_start = pos_end + delim_len;</div>
<div class="line"><span class="lineno"> 227</span> splits.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/push_back.html">push_back</a>(token);</div>
<div class="line"><span class="lineno"> 227</span> splits.push_back(token);</div>
<div class="line"><span class="lineno"> 228</span> }</div>
<div class="line"><span class="lineno"> 229</span> </div>
<div class="line"><span class="lineno"> 230</span> <span class="comment">// Traversing through each morse code string</span></div>
<div class="line"><span class="lineno"> 231</span> <span class="keywordflow">for</span> (<span class="keyword">const</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> &amp;s : splits) {</div>
<div class="line"><span class="lineno"> 231</span> <span class="keywordflow">for</span> (<span class="keyword">const</span> std::string &amp;s : splits) {</div>
<div class="line"><span class="lineno"> 232</span> <span class="comment">// Add corresponding character</span></div>
<div class="line"><span class="lineno"> 233</span> decrypted_text += <a class="code hl_function" href="#ac9f294b0dec08a4a11d477a32f9bd829">ciphers::morse::morse_to_char</a>(s);</div>
<div class="line"><span class="lineno"> 234</span> }</div>
<div class="line"><span class="lineno"> 235</span> </div>
<div class="line"><span class="lineno"> 236</span> <span class="keywordflow">return</span> decrypted_text; <span class="comment">// Returning decrypted text</span></div>
<div class="line"><span class="lineno"> 237</span>}</div>
<div class="ttc" id="abasic_string_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a></div></div>
<div class="ttc" id="afind_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/string/basic_string/find.html">std::string::find</a></div><div class="ttdeci">T find(T... args)</div></div>
<div class="ttc" id="amorse__code_8cpp_html_ac9f294b0dec08a4a11d477a32f9bd829"><div class="ttname"><a href="#ac9f294b0dec08a4a11d477a32f9bd829">ciphers::morse::morse_to_char</a></div><div class="ttdeci">char morse_to_char(const std::string &amp;s)</div><div class="ttdef"><b>Definition</b> morse_code.cpp:118</div></div>
<div class="ttc" id="apush_back_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/container/vector/push_back.html">std::vector::push_back</a></div><div class="ttdeci">T push_back(T... args)</div></div>
<div class="ttc" id="asize_t_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/types/size_t.html">std::size_t</a></div></div>
<div class="ttc" id="asubstr_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/string/basic_string/substr.html">std::string::substr</a></div><div class="ttdeci">T substr(T... args)</div></div>
<div class="ttc" id="avector_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a></div></div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d8/d76/morse__code_8cpp_a15c66ec8cf4cef0a35c50cbab86965dc_cgraph.svg" width="491" height="224"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
</div>
<div class="ttc" id="amorse__code_8cpp_html_ac9f294b0dec08a4a11d477a32f9bd829"><div class="ttname"><a href="#ac9f294b0dec08a4a11d477a32f9bd829">ciphers::morse::morse_to_char</a></div><div class="ttdeci">char morse_to_char(const std::string &amp;s)</div><div class="ttdef"><b>Definition</b> <a href="../../d8/d76/morse__code_8cpp_source.html#l00118">morse_code.cpp:118</a></div></div>
</div><!-- fragment -->
</div>
</div>
<a id="a0242e458904de8a242fcdaffe9e3ba1a" name="a0242e458904de8a242fcdaffe9e3ba1a"></a>
@@ -331,9 +337,9 @@ Here is the call graph for this function:</div>
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> ciphers::morse::encrypt </td>
<td class="memname">std::string ciphers::morse::encrypt </td>
<td>(</td>
<td class="paramtype">const <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> &amp;</td> <td class="paramname"><span class="paramname"><em>text</em></span></td><td>)</td>
<td class="paramtype">const std::string &amp;</td> <td class="paramname"><span class="paramname"><em>text</em></span></td><td>)</td>
<td></td>
</tr>
</table>
@@ -345,8 +351,10 @@ Here is the call graph for this function:</div>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>new encrypted text </dd></dl>
<p class="definition">Definition at line <a class="el" href="../../d8/d76/morse__code_8cpp_source.html#l00202">202</a> of file <a class="el" href="../../d8/d76/morse__code_8cpp_source.html">morse_code.cpp</a>.</p>
<div class="fragment"><div class="line"><span class="lineno"> 202</span> {</div>
<div class="line"><span class="lineno"> 203</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> encrypted_text = <span class="stringliteral">&quot;&quot;</span>; <span class="comment">// Empty string to store encrypted text</span></div>
<div class="line"><span class="lineno"> 203</span> std::string encrypted_text = <span class="stringliteral">&quot;&quot;</span>; <span class="comment">// Empty string to store encrypted text</span></div>
<div class="line"><span class="lineno"> 204</span> <span class="comment">// Going through each character of text and converting it</span></div>
<div class="line"><span class="lineno"> 205</span> <span class="comment">// to morse representation</span></div>
<div class="line"><span class="lineno"> 206</span> <span class="keywordflow">for</span> (<span class="keyword">const</span> <span class="keywordtype">char</span> &amp;c : text) {</div>
@@ -354,13 +362,8 @@ Here is the call graph for this function:</div>
<div class="line"><span class="lineno"> 208</span> }</div>
<div class="line"><span class="lineno"> 209</span> <span class="keywordflow">return</span> encrypted_text; <span class="comment">// Returning encrypted text</span></div>
<div class="line"><span class="lineno"> 210</span>}</div>
<div class="ttc" id="amorse__code_8cpp_html_ab31773fd11555d21f70d6914138d9535"><div class="ttname"><a href="#ab31773fd11555d21f70d6914138d9535">ciphers::morse::char_to_morse</a></div><div class="ttdeci">std::string char_to_morse(const char &amp;c)</div><div class="ttdef"><b>Definition</b> morse_code.cpp:33</div></div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d8/d76/morse__code_8cpp_a0242e458904de8a242fcdaffe9e3ba1a_cgraph.svg" width="478" height="92"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
</div>
<div class="ttc" id="amorse__code_8cpp_html_ab31773fd11555d21f70d6914138d9535"><div class="ttname"><a href="#ab31773fd11555d21f70d6914138d9535">ciphers::morse::char_to_morse</a></div><div class="ttdeci">std::string char_to_morse(const char &amp;c)</div><div class="ttdef"><b>Definition</b> <a href="../../d8/d76/morse__code_8cpp_source.html#l00033">morse_code.cpp:33</a></div></div>
</div><!-- fragment -->
</div>
</div>
<a id="ae66f6b31b5ad750f1fe042a706a4e3d4" name="ae66f6b31b5ad750f1fe042a706a4e3d4"></a>
@@ -380,18 +383,15 @@ Here is the call graph for this function:</div>
<p>Main function. </p>
<dl class="section return"><dt>Returns</dt><dd>0 on exit </dd></dl>
<p class="definition">Definition at line <a class="el" href="../../d8/d76/morse__code_8cpp_source.html#l00268">268</a> of file <a class="el" href="../../d8/d76/morse__code_8cpp_source.html">morse_code.cpp</a>.</p>
<div class="fragment"><div class="line"><span class="lineno"> 268</span> {</div>
<div class="line"><span class="lineno"> 269</span> <span class="comment">// Testing</span></div>
<div class="line"><span class="lineno"> 270</span> <a class="code hl_function" href="#aa8dca7b867074164d5f45b0f3851269d">test</a>();</div>
<div class="line"><span class="lineno"> 271</span> <span class="keywordflow">return</span> 0;</div>
<div class="line"><span class="lineno"> 272</span>}</div>
<div class="ttc" id="amorse__code_8cpp_html_aa8dca7b867074164d5f45b0f3851269d"><div class="ttname"><a href="#aa8dca7b867074164d5f45b0f3851269d">test</a></div><div class="ttdeci">static void test()</div><div class="ttdoc">Function to test above algorithm.</div><div class="ttdef"><b>Definition</b> morse_code.cpp:245</div></div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d8/d76/morse__code_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg" width="271" height="36"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
</div>
<div class="ttc" id="amorse__code_8cpp_html_aa8dca7b867074164d5f45b0f3851269d"><div class="ttname"><a href="#aa8dca7b867074164d5f45b0f3851269d">test</a></div><div class="ttdeci">static void test()</div><div class="ttdoc">Function to test above algorithm.</div><div class="ttdef"><b>Definition</b> <a href="../../d8/d76/morse__code_8cpp_source.html#l00245">morse_code.cpp:245</a></div></div>
</div><!-- fragment -->
</div>
</div>
<a id="ac9f294b0dec08a4a11d477a32f9bd829" name="ac9f294b0dec08a4a11d477a32f9bd829"></a>
@@ -403,7 +403,7 @@ Here is the call graph for this function:</div>
<tr>
<td class="memname">char ciphers::morse::morse_to_char </td>
<td>(</td>
<td class="paramtype">const <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> &amp;</td> <td class="paramname"><span class="paramname"><em>s</em></span></td><td>)</td>
<td class="paramtype">const std::string &amp;</td> <td class="paramname"><span class="paramname"><em>s</em></span></td><td>)</td>
<td></td>
</tr>
</table>
@@ -415,6 +415,8 @@ Here is the call graph for this function:</div>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>corresponding character </dd></dl>
<p class="definition">Definition at line <a class="el" href="../../d8/d76/morse__code_8cpp_source.html#l00118">118</a> of file <a class="el" href="../../d8/d76/morse__code_8cpp_source.html">morse_code.cpp</a>.</p>
<div class="fragment"><div class="line"><span class="lineno"> 118</span> {</div>
<div class="line"><span class="lineno"> 119</span> <span class="comment">// return corresponding character</span></div>
<div class="line"><span class="lineno"> 120</span> <span class="keywordflow">if</span> (s == <span class="stringliteral">&quot;.-&quot;</span>) {</div>
@@ -490,16 +492,11 @@ Here is the call graph for this function:</div>
<div class="line"><span class="lineno"> 190</span> } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (s == <span class="stringliteral">&quot;-----&quot;</span>) {</div>
<div class="line"><span class="lineno"> 191</span> <span class="keywordflow">return</span> <span class="charliteral">&#39;0&#39;</span>;</div>
<div class="line"><span class="lineno"> 192</span> } <span class="keywordflow">else</span> {</div>
<div class="line"><span class="lineno"> 193</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cerr</a> &lt;&lt; <span class="stringliteral">&quot;Found invalid Morse code: &quot;</span> &lt;&lt; s &lt;&lt; <span class="charliteral">&#39; &#39;</span> &lt;&lt; <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
<div class="line"><span class="lineno"> 194</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/utility/program/exit.html">std::exit</a>(0);</div>
<div class="line"><span class="lineno"> 193</span> std::cerr &lt;&lt; <span class="stringliteral">&quot;Found invalid Morse code: &quot;</span> &lt;&lt; s &lt;&lt; <span class="charliteral">&#39; &#39;</span> &lt;&lt; std::endl;</div>
<div class="line"><span class="lineno"> 194</span> std::exit(0);</div>
<div class="line"><span class="lineno"> 195</span> }</div>
<div class="line"><span class="lineno"> 196</span>}</div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d8/d76/morse__code_8cpp_ac9f294b0dec08a4a11d477a32f9bd829_cgraph.svg" width="282" height="92"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
</div>
</div><!-- fragment -->
</div>
</div>
<a id="aa8dca7b867074164d5f45b0f3851269d" name="aa8dca7b867074164d5f45b0f3851269d"></a>
@@ -527,32 +524,29 @@ Here is the call graph for this function:</div>
<p>Function to test above algorithm. </p>
<dl class="section return"><dt>Returns</dt><dd>void </dd></dl>
<p class="definition">Definition at line <a class="el" href="../../d8/d76/morse__code_8cpp_source.html#l00245">245</a> of file <a class="el" href="../../d8/d76/morse__code_8cpp_source.html">morse_code.cpp</a>.</p>
<div class="fragment"><div class="line"><span class="lineno"> 245</span> {</div>
<div class="line"><span class="lineno"> 246</span> <span class="comment">// Test 1</span></div>
<div class="line"><span class="lineno"> 247</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> text1 = <span class="stringliteral">&quot;01234567890&quot;</span>;</div>
<div class="line"><span class="lineno"> 248</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> encrypted1 = <a class="code hl_function" href="#a0242e458904de8a242fcdaffe9e3ba1a">ciphers::morse::encrypt</a>(text1);</div>
<div class="line"><span class="lineno"> 249</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> decrypted1 = <a class="code hl_function" href="#a15c66ec8cf4cef0a35c50cbab86965dc">ciphers::morse::decrypt</a>(encrypted1);</div>
<div class="line"><span class="lineno"> 247</span> std::string text1 = <span class="stringliteral">&quot;01234567890&quot;</span>;</div>
<div class="line"><span class="lineno"> 248</span> std::string encrypted1 = <a class="code hl_function" href="#a0242e458904de8a242fcdaffe9e3ba1a">ciphers::morse::encrypt</a>(text1);</div>
<div class="line"><span class="lineno"> 249</span> std::string decrypted1 = <a class="code hl_function" href="#a15c66ec8cf4cef0a35c50cbab86965dc">ciphers::morse::decrypt</a>(encrypted1);</div>
<div class="line"><span class="lineno"> 250</span> assert(text1 == decrypted1);</div>
<div class="line"><span class="lineno"> 251</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;Original text : &quot;</span> &lt;&lt; text1 &lt;&lt; <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
<div class="line"><span class="lineno"> 252</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;Encrypted text : &quot;</span> &lt;&lt; encrypted1 &lt;&lt; <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
<div class="line"><span class="lineno"> 253</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;Decrypted text : &quot;</span> &lt;&lt; decrypted1 &lt;&lt; <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
<div class="line"><span class="lineno"> 251</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Original text : &quot;</span> &lt;&lt; text1 &lt;&lt; std::endl;</div>
<div class="line"><span class="lineno"> 252</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Encrypted text : &quot;</span> &lt;&lt; encrypted1 &lt;&lt; std::endl;</div>
<div class="line"><span class="lineno"> 253</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Decrypted text : &quot;</span> &lt;&lt; decrypted1 &lt;&lt; std::endl;</div>
<div class="line"><span class="lineno"> 254</span> <span class="comment">// Test 2</span></div>
<div class="line"><span class="lineno"> 255</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> text2 = <span class="stringliteral">&quot;abcdefghijklmnopqrstuvwxyz&quot;</span>;</div>
<div class="line"><span class="lineno"> 256</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> encrypted2 = <a class="code hl_function" href="#a0242e458904de8a242fcdaffe9e3ba1a">ciphers::morse::encrypt</a>(text2);</div>
<div class="line"><span class="lineno"> 257</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> decrypted2 = <a class="code hl_function" href="#a15c66ec8cf4cef0a35c50cbab86965dc">ciphers::morse::decrypt</a>(encrypted2);</div>
<div class="line"><span class="lineno"> 255</span> std::string text2 = <span class="stringliteral">&quot;abcdefghijklmnopqrstuvwxyz&quot;</span>;</div>
<div class="line"><span class="lineno"> 256</span> std::string encrypted2 = <a class="code hl_function" href="#a0242e458904de8a242fcdaffe9e3ba1a">ciphers::morse::encrypt</a>(text2);</div>
<div class="line"><span class="lineno"> 257</span> std::string decrypted2 = <a class="code hl_function" href="#a15c66ec8cf4cef0a35c50cbab86965dc">ciphers::morse::decrypt</a>(encrypted2);</div>
<div class="line"><span class="lineno"> 258</span> assert(text2 == decrypted2);</div>
<div class="line"><span class="lineno"> 259</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;Original text : &quot;</span> &lt;&lt; text2 &lt;&lt; <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
<div class="line"><span class="lineno"> 260</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;Encrypted text : &quot;</span> &lt;&lt; encrypted2 &lt;&lt; <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
<div class="line"><span class="lineno"> 261</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;Decrypted text : &quot;</span> &lt;&lt; decrypted2 &lt;&lt; <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
<div class="line"><span class="lineno"> 259</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Original text : &quot;</span> &lt;&lt; text2 &lt;&lt; std::endl;</div>
<div class="line"><span class="lineno"> 260</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Encrypted text : &quot;</span> &lt;&lt; encrypted2 &lt;&lt; std::endl;</div>
<div class="line"><span class="lineno"> 261</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Decrypted text : &quot;</span> &lt;&lt; decrypted2 &lt;&lt; std::endl;</div>
<div class="line"><span class="lineno"> 262</span>}</div>
<div class="ttc" id="amorse__code_8cpp_html_a0242e458904de8a242fcdaffe9e3ba1a"><div class="ttname"><a href="#a0242e458904de8a242fcdaffe9e3ba1a">ciphers::morse::encrypt</a></div><div class="ttdeci">std::string encrypt(const std::string &amp;text)</div><div class="ttdef"><b>Definition</b> morse_code.cpp:202</div></div>
<div class="ttc" id="amorse__code_8cpp_html_a15c66ec8cf4cef0a35c50cbab86965dc"><div class="ttname"><a href="#a15c66ec8cf4cef0a35c50cbab86965dc">ciphers::morse::decrypt</a></div><div class="ttdeci">std::string decrypt(const std::string &amp;text)</div><div class="ttdef"><b>Definition</b> morse_code.cpp:216</div></div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d8/d76/morse__code_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.svg" width="174" height="36"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
</div>
<div class="ttc" id="amorse__code_8cpp_html_a0242e458904de8a242fcdaffe9e3ba1a"><div class="ttname"><a href="#a0242e458904de8a242fcdaffe9e3ba1a">ciphers::morse::encrypt</a></div><div class="ttdeci">std::string encrypt(const std::string &amp;text)</div><div class="ttdef"><b>Definition</b> <a href="../../d8/d76/morse__code_8cpp_source.html#l00202">morse_code.cpp:202</a></div></div>
<div class="ttc" id="amorse__code_8cpp_html_a15c66ec8cf4cef0a35c50cbab86965dc"><div class="ttname"><a href="#a15c66ec8cf4cef0a35c50cbab86965dc">ciphers::morse::decrypt</a></div><div class="ttdeci">std::string decrypt(const std::string &amp;text)</div><div class="ttdef"><b>Definition</b> <a href="../../d8/d76/morse__code_8cpp_source.html#l00216">morse_code.cpp:216</a></div></div>
</div><!-- fragment -->
</div>
</div>
</div><!-- contents -->