1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>Design Notes</title> 5<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css"> 6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> 7<link rel="home" href="../index.html" title="Chapter 1. Boost.Convert 2.0"> 8<link rel="up" href="../index.html" title="Chapter 1. Boost.Convert 2.0"> 9<link rel="prev" href="converters_detail/strtol_converter/supported_string_types/custom_string_types.html" title="Custom String Types"> 10<link rel="next" href="design_notes/converter_signature.html" title="Converter Signature"> 11</head> 12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> 13<table cellpadding="2" width="100%"><tr> 14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td> 15<td align="center"><a href="../../../../../index.html">Home</a></td> 16<td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td> 17<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> 18<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> 19<td align="center"><a href="../../../../../more/index.htm">More</a></td> 20</tr></table> 21<hr> 22<div class="spirit-nav"> 23<a accesskey="p" href="converters_detail/strtol_converter/supported_string_types/custom_string_types.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="design_notes/converter_signature.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a> 24</div> 25<div class="section"> 26<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 27<a name="boost_convert.design_notes"></a><a name="quickbook.ref.design_notes"></a><a class="link" href="design_notes.html" title="Design Notes">Design 28 Notes</a> 29</h2></div></div></div> 30<div class="toc"><dl class="toc"> 31<dt><span class="section"><a href="design_notes.html#boost_convert.design_notes.requirements">Requirements</a></span></dt> 32<dt><span class="section"><a href="design_notes/converter_signature.html">Converter 33 Signature</a></span></dt> 34<dt><span class="section"><a href="design_notes/user_interface_signature.html">User 35 Interface Signature</a></span></dt> 36</dl></div> 37<div class="blockquote"><blockquote class="blockquote"><p> 38 <span class="bold"><strong><span class="emphasis"><em>"The art of simplicity is a puzzle of 39 complexity” Doug Horton</em></span></strong></span> 40 </p></blockquote></div> 41<p> 42 Feel free to skip this section. It is here to document the process and the 43 decisions made during design to be able to review and to reevaluate and to 44 ensure the relevancy and the correctness of those decisions and ultimately 45 the design. Still, this section might be useful for understanding why and how 46 certain decisions have been made and why <span class="emphasis"><em>Boost.Convert</em></span> 47 is the way it is. 48 </p> 49<div class="section"> 50<div class="titlepage"><div><div><h3 class="title"> 51<a name="boost_convert.design_notes.requirements"></a><a class="link" href="design_notes.html#boost_convert.design_notes.requirements" title="Requirements">Requirements</a> 52</h3></div></div></div> 53<p> 54 <span class="emphasis"><em>Boost.Convert</em></span> has been designed to satisfy the following 55 user requirements: 56 </p> 57<div class="orderedlist"><ol class="orderedlist" type="1"> 58<li class="listitem"> 59 <span class="emphasis"><em>(R1)</em></span> <span class="emphasis"><em>Boost.Convert</em></span> shall provide 60 a mechanism and an interface that take a value of type <span class="emphasis"><em>TypeIn</em></span> 61 and yield a value of type <span class="emphasis"><em>TypeOut</em></span> using an algorithm 62 of type <span class="emphasis"><em>Converter</em></span>; 63 </li> 64<li class="listitem"> 65 <span class="emphasis"><em>(R2)</em></span> <span class="emphasis"><em>Boost.Convert</em></span> shall provide 66 a mechanism and an interface to indicate success or failure of the requested 67 conversion; 68 </li> 69<li class="listitem"> 70 <span class="emphasis"><em>(R3)</em></span> <span class="emphasis"><em>Boost.Convert</em></span> shall provide 71 fully-functional interfaces for two different program flows where 72 <div class="orderedlist"><ol class="orderedlist" type="a"> 73<li class="listitem"> 74 <span class="emphasis"><em>(R3a)</em></span> error-processing is orthogonal to the 75 normal program flow (exception-throwing interface); 76 </li> 77<li class="listitem"> 78 <span class="emphasis"><em>(R3b)</em></span> normal and error-processing flows are 79 part of the same program flow (non-throwing interface); 80 </li> 81</ol></div> 82 </li> 83<li class="listitem"> 84 <span class="emphasis"><em>(R4)</em></span> The throwing interface shall return the result 85 of successful conversion or shall throw an exception; 86 </li> 87<li class="listitem"> 88 <span class="emphasis"><em>(R5)</em></span> The non-throwing interface shall return the 89 result and/or some indication of conversion success or failure; 90 <div class="orderedlist"><ol class="orderedlist" type="a"> 91<li class="listitem"> 92 <span class="emphasis"><em>(R5a)</em></span> there shall be means to distinguish 93 success from failure; 94 </li> 95<li class="listitem"> 96 <span class="emphasis"><em>(R5b)</em></span> the result of conversion shall only 97 be available when conversion succeeds; 98 </li> 99<li class="listitem"> 100 <span class="emphasis"><em>(R5c)</em></span> when conversion fails, an optional fallback 101 value shall be returned instead if supplied; 102 </li> 103<li class="listitem"> 104 <span class="emphasis"><em>(R5d)</em></span> in the case of failure (with no fallback 105 provided) an attempt to retrieve the result shall result in an 106 exception thrown; 107 </li> 108</ol></div> 109 </li> 110<li class="listitem"> 111 <span class="emphasis"><em>(R6)</em></span> <span class="emphasis"><em>Boost.Convert</em></span> shall provide 112 a uniform interface suitable for generic programming; 113 </li> 114<li class="listitem"> 115 <span class="emphasis"><em>(R7)</em></span> <span class="emphasis"><em>Boost.Convert</em></span> shall not 116 interfere with or intercept any exceptions that are not part of the official 117 converter interface (i.e. exceptions caused by malfunction, etc.); 118 </li> 119<li class="listitem"> 120 <span class="emphasis"><em>(R8)</em></span> Converters shall be independent of and shall 121 not rely on the <span class="emphasis"><em>Boost.Convert</em></span> infrastructure. 122 </li> 123</ol></div> 124</div> 125</div> 126<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 127<td align="left"></td> 128<td align="right"><div class="copyright-footer">Copyright © 2009-2016 Vladimir Batov<p> 129 Distributed under the Boost Software License, Version 1.0. See copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>. 130 </p> 131</div></td> 132</tr></table> 133<hr> 134<div class="spirit-nav"> 135<a accesskey="p" href="converters_detail/strtol_converter/supported_string_types/custom_string_types.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="design_notes/converter_signature.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a> 136</div> 137</body> 138</html> 139