<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> <title>Class template wrapping_int2</title> <link rel="stylesheet" href="../../boostbook.css" type="text/css"> <meta name="generator" content="DocBook XSL Stylesheets V1.75.2"> <link rel="home" href="../../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset"> <link rel="up" href="../../date_time/doxy.html#header.boost.date_time.wrapping_int_hpp" title="Header <boost/date_time/wrapping_int.hpp>"> <link rel="prev" href="wrapping_int.html" title="Class template wrapping_int"> <link rel="next" href="year_month_day_base.html" title="Struct template year_month_day_base"> </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> <table cellpadding="2" width="100%"><tr> <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td> <td align="center"><a href="../../../../index.html">Home</a></td> <td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td> <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> <td align="center"><a href="../../../../more/index.htm">More</a></td> </tr></table> <hr> <div class="spirit-nav"> <a accesskey="p" href="wrapping_int.html"><img src="../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../date_time/doxy.html#header.boost.date_time.wrapping_int_hpp"><img src="../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="year_month_day_base.html"><img src="../../../../doc/html/images/next.png" alt="Next"></a> </div> <div class="refentry" title="Class template wrapping_int2"> <a name="boost.date_time.wrapping_int2"></a><div class="titlepage"></div> <div class="refnamediv"> <h2><span class="refentrytitle">Class template wrapping_int2</span></h2> <p>boost::date_time::wrapping_int2 — A wrapping integer used to wrap around at the top (WARNING: only instantiate with a signed type). </p> </div> <h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2> <div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="emphasis"><em>// In header: <<a class="link" href="../../date_time/doxy.html#header.boost.date_time.wrapping_int_hpp" title="Header <boost/date_time/wrapping_int.hpp>">boost/date_time/wrapping_int.hpp</a>> </em></span><span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> int_type_, int_type_ wrap_min, int_type_ wrap_max> <span class="bold"><strong>class</strong></span> <a class="link" href="wrapping_int2.html" title="Class template wrapping_int2">wrapping_int2</a> { <span class="bold"><strong>public</strong></span>: <span class="emphasis"><em>// types</em></span> <span class="bold"><strong>typedef</strong></span> int_type_ <a name="boost.date_time.wrapping_int2.int_type"></a>int_type; <span class="emphasis"><em>// <a class="link" href="wrapping_int2.html#boost.date_time.wrapping_int2construct-copy-destruct">construct/copy/destruct</a></em></span> <a class="link" href="wrapping_int2.html#id377143-bb">wrapping_int2</a>(int_type); <span class="emphasis"><em>// <a class="link" href="wrapping_int2.html#id577233-bb">public static functions</a></em></span> <span class="type"><span class="bold"><strong>static</strong></span> int_type</span> <a class="link" href="wrapping_int2.html#id577236-bb">wrap_value</a>() ; <span class="type"><span class="bold"><strong>static</strong></span> int_type</span> <a class="link" href="wrapping_int2.html#id350313-bb">min_value</a>() ; <span class="emphasis"><em>// <a class="link" href="wrapping_int2.html#id350320-bb">public member functions</a></em></span> <span class="type">int_type</span> <a class="link" href="wrapping_int2.html#id350324-bb">as_int</a>() <span class="bold"><strong>const</strong></span>; <a class="link" href="wrapping_int2.html#id350334-bb"><span class="bold"><strong>operator</strong></span> int_type</a>() <span class="bold"><strong>const</strong></span>; <span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> IntT> <span class="type">IntT</span> <a class="link" href="wrapping_int2.html#id350342-bb">add</a>(IntT) ; <span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> IntT> <span class="type">IntT</span> <a class="link" href="wrapping_int2.html#id350368-bb">subtract</a>(IntT) ; <span class="emphasis"><em>// <a class="link" href="wrapping_int2.html#id375915-bb">private member functions</a></em></span> <span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> IntT> <span class="type">IntT</span> <a class="link" href="wrapping_int2.html#id375918-bb">calculate_wrap</a>(IntT) ; };</pre></div> <div class="refsect1" title="Description"> <a name="id834991"></a><h2>Description</h2> <p>Bad name, quick impl to fix a bug -- fix later!! This allows the wrap to restart at a value other than 0. </p> <div class="refsect2" title="wrapping_int2 public construct/copy/destruct"> <a name="id834998"></a><h3> <a name="boost.date_time.wrapping_int2construct-copy-destruct"></a><code class="computeroutput">wrapping_int2</code> public construct/copy/destruct</h3> <div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"> <pre class="literallayout"><a name="id377143-bb"></a>wrapping_int2(int_type v);</pre> <p>If initializing value is out of range of [wrap_min, wrap_max], value will be initialized to closest of min or max </p> </li></ol></div> </div> <div class="refsect2" title="wrapping_int2 public static functions"> <a name="id835036"></a><h3> <a name="id577233-bb"></a><code class="computeroutput">wrapping_int2</code> public static functions</h3> <div class="orderedlist"><ol class="orderedlist" type="1"> <li class="listitem"><pre class="literallayout"><span class="type"><span class="bold"><strong>static</strong></span> int_type</span> <a name="id577236-bb"></a>wrap_value() ;</pre></li> <li class="listitem"><pre class="literallayout"><span class="type"><span class="bold"><strong>static</strong></span> int_type</span> <a name="id350313-bb"></a>min_value() ;</pre></li> </ol></div> </div> <div class="refsect2" title="wrapping_int2 public member functions"> <a name="id835097"></a><h3> <a name="id350320-bb"></a><code class="computeroutput">wrapping_int2</code> public member functions</h3> <div class="orderedlist"><ol class="orderedlist" type="1"> <li class="listitem"> <pre class="literallayout"><span class="type">int_type</span> <a name="id350324-bb"></a>as_int() <span class="bold"><strong>const</strong></span>;</pre>Explicit converion method. </li> <li class="listitem"><pre class="literallayout"><a name="id350334-bb"></a><span class="bold"><strong>operator</strong></span> int_type() <span class="bold"><strong>const</strong></span>;</pre></li> <li class="listitem"> <pre class="literallayout"><span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> IntT> <span class="type">IntT</span> <a name="id350342-bb"></a>add(IntT v) ;</pre>Add, return number of wraps performed. <p>The sign of the returned value will indicate which direction the wraps went. Ex: add a negative number and wrapping under could occur, this would be indicated by a negative return value. If wrapping over took place, a positive value would be returned </p> </li> <li class="listitem"> <pre class="literallayout"><span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> IntT> <span class="type">IntT</span> <a name="id350368-bb"></a>subtract(IntT v) ;</pre>Subtract will return '-d' if wrapping under took place ('d' is the number of wraps). <p>The sign of the returned value will indicate which direction the wraps went. Ex: subtract a negative number and wrapping over could occur, this would be indicated by a positive return value. If wrapping under took place, a negative value would be returned </p> </li> </ol></div> </div> <div class="refsect2" title="wrapping_int2 private member functions"> <a name="id835238"></a><h3> <a name="id375915-bb"></a><code class="computeroutput">wrapping_int2</code> private member functions</h3> <div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><pre class="literallayout"><span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> IntT> <span class="type">IntT</span> <a name="id375918-bb"></a>calculate_wrap(IntT wrap) ;</pre></li></ol></div> </div> </div> </div> <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> <td align="left"></td> <td align="right"><div class="copyright-footer">Copyright © 2001-2005 CrystalClear Software, Inc<p>Subject to the Boost Software License, Version 1.0. (See accompanying file <code class="filename">LICENSE_1_0.txt</code> or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)</p> </div></td> </tr></table> <hr> <div class="spirit-nav"> <a accesskey="p" href="wrapping_int.html"><img src="../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../date_time/doxy.html#header.boost.date_time.wrapping_int_hpp"><img src="../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="year_month_day_base.html"><img src="../../../../doc/html/images/next.png" alt="Next"></a> </div> </body> </html>