<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>numbers.h Source File</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body bgcolor="#ffffff"> <!-- Generated by Doxygen 1.2.10 --> <center> <a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="namespaces.html">Namespace List</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="classes.html">Alphabetical List</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="namespacemembers.html">Namespace Members</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> </center> <hr><h1>numbers.h</h1><a href="numbers_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <font class="comment">// Copyright (C) 1999-2001 Open Source Telecom Corporation.</font> 00002 <font class="comment">// </font> 00003 <font class="comment">// This program is free software; you can redistribute it and/or modify</font> 00004 <font class="comment">// it under the terms of the GNU General Public License as published by</font> 00005 <font class="comment">// the Free Software Foundation; either version 2 of the License, or</font> 00006 <font class="comment">// (at your option) any later version.</font> 00007 <font class="comment">// </font> 00008 <font class="comment">// This program is distributed in the hope that it will be useful,</font> 00009 <font class="comment">// but WITHOUT ANY WARRANTY; without even the implied warranty of</font> 00010 <font class="comment">// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</font> 00011 <font class="comment">// GNU General Public License for more details.</font> 00012 <font class="comment">// </font> 00013 <font class="comment">// You should have received a copy of the GNU General Public License</font> 00014 <font class="comment">// along with this program; if not, write to the Free Software </font> 00015 <font class="comment">// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.</font> 00016 <font class="comment">// </font> 00017 <font class="comment">// As a special exception to the GNU General Public License, permission is </font> 00018 <font class="comment">// granted for additional uses of the text contained in its release </font> 00019 <font class="comment">// of Common C++.</font> 00020 <font class="comment">// </font> 00021 <font class="comment">// The exception is that, if you link the Common C++ library with other</font> 00022 <font class="comment">// files to produce an executable, this does not by itself cause the</font> 00023 <font class="comment">// resulting executable to be covered by the GNU General Public License.</font> 00024 <font class="comment">// Your use of that executable is in no way restricted on account of</font> 00025 <font class="comment">// linking the Common C++ library code into it.</font> 00026 <font class="comment">// </font> 00027 <font class="comment">// This exception does not however invalidate any other reasons why</font> 00028 <font class="comment">// the executable file might be covered by the GNU General Public License.</font> 00029 <font class="comment">// </font> 00030 <font class="comment">// This exception applies only to the code released under the </font> 00031 <font class="comment">// name Common C++. If you copy code from other releases into a copy of</font> 00032 <font class="comment">// Common C++, as the General Public License permits, the exception does</font> 00033 <font class="comment">// not apply to the code that you add in this way. To avoid misleading</font> 00034 <font class="comment">// anyone as to the status of such modified files, you must delete</font> 00035 <font class="comment">// this exception notice from them.</font> 00036 <font class="comment">// </font> 00037 <font class="comment">// If you write modifications of your own for Common C++, it is your choice</font> 00038 <font class="comment">// whether to permit this exception to apply to your modifications.</font> 00039 <font class="comment">// If you do not wish that, delete this exception notice. </font> 00040 00041 <font class="preprocessor">#ifndef CCXX_NUMBERS_H_</font> 00042 <font class="preprocessor"></font><font class="preprocessor">#define CCXX_NUMBERS_H_</font> 00043 <font class="preprocessor"></font> 00044 <font class="preprocessor">#ifndef CCXX_CONFIG_H_</font> 00045 <font class="preprocessor"></font><font class="preprocessor">#include <cc++/config.h></font> 00046 <font class="preprocessor">#endif</font> 00047 <font class="preprocessor"></font> 00048 <font class="preprocessor">#ifndef CCXX_STRCHAR_H_</font> 00049 <font class="preprocessor"></font><font class="preprocessor">#include <<a class="code" href="strchar_8h.html">cc++/strchar.h</a>></font> 00050 <font class="preprocessor">#endif</font> 00051 <font class="preprocessor"></font> 00052 <font class="preprocessor">#include <ctime></font> 00053 00054 <font class="preprocessor">#ifdef CCXX_NAMESPACES</font> 00055 <font class="preprocessor"></font><font class="keyword">namespace </font>ost { 00056 <font class="preprocessor">#ifdef __BORLANDC__</font> 00057 <font class="preprocessor"></font> <font class="keyword">using</font> std::tm; 00058 <font class="keyword">using</font> std::time_t; 00059 <font class="preprocessor">#endif</font> 00060 <font class="preprocessor"></font><font class="preprocessor">#endif</font> 00061 <font class="preprocessor"></font> <a name="l00070"></a><a class="code" href="classost_1_1_number.html">00070</a> <font class="keyword">class </font>CCXX_CLASS_EXPORT Number 00071 { 00072 <font class="keyword">protected</font>: <a name="l00073"></a><a class="code" href="classost_1_1_number.html#n0">00073</a> <font class="keywordtype">char</font> *buffer; <a name="l00074"></a><a class="code" href="classost_1_1_number.html#n1">00074</a> <font class="keywordtype">unsigned</font> size; 00075 00076 <font class="keyword">public</font>: 00082 <a class="code" href="classost_1_1_number.html#a0">Number</a>(<font class="keywordtype">char</font> *buffer, <font class="keywordtype">unsigned</font> size); 00083 00084 <font class="keywordtype">void</font> <a class="code" href="classost_1_1_number.html#a1">setValue</a>(<font class="keywordtype">long</font> value); <a name="l00085"></a><a class="code" href="classost_1_1_number.html#a2">00085</a> <font class="keyword">const</font> <font class="keywordtype">char</font> *<a class="code" href="classost_1_1_number.html#a2">getBuffer</a>()<font class="keyword"></font> 00086 <font class="keyword"> </font>{<font class="keywordflow">return</font> buffer;}; 00087 00088 <font class="keywordtype">long</font> <a class="code" href="classost_1_1_number.html#a3">getValue</a>(); 00089 <a name="l00090"></a><a class="code" href="classost_1_1_number.html#a4">00090</a> <font class="keywordtype">long</font> <a class="code" href="classost_1_1_number.html#a4">operator()</a>()<font class="keyword"></font> 00091 <font class="keyword"> </font>{<font class="keywordflow">return</font> <a class="code" href="classost_1_1_number.html#a3">getValue</a>();}; 00092 <a name="l00093"></a><a class="code" href="classost_1_1_number.html#a5">00093</a> <a class="code" href="classost_1_1_number.html#a5">operator long</a>()<font class="keyword"></font> 00094 <font class="keyword"> </font>{<font class="keywordflow">return</font> <a class="code" href="classost_1_1_number.html#a3">getValue</a>();}; 00095 <a name="l00096"></a><a class="code" href="classost_1_1_number.html#a6">00096</a> <a class="code" href="classost_1_1_number.html#a6">operator char*</a>()<font class="keyword"></font> 00097 <font class="keyword"> </font>{<font class="keywordflow">return</font> buffer;}; 00098 00099 <font class="keywordtype">long</font> <a class="code" href="classost_1_1_number.html#a7">operator=</a>(<font class="keywordtype">long</font> value); 00100 <font class="keywordtype">long</font> <a class="code" href="classost_1_1_number.html#a8">operator+=</a>(<font class="keywordtype">long</font> value); 00101 <font class="keywordtype">long</font> <a class="code" href="classost_1_1_number.html#a9">operator-=</a>(<font class="keywordtype">long</font> value); 00102 <font class="keywordtype">long</font> <a class="code" href="classost_1_1_number.html#a10">operator--</a>(); 00103 <font class="keywordtype">long</font> <a class="code" href="classost_1_1_number.html#a11">operator++</a>(); 00104 <font class="keywordtype">int</font> <a class="code" href="classost_1_1_number.html#a12">operator==</a>(Number &num); 00105 <font class="keywordtype">int</font> <a class="code" href="classost_1_1_number.html#a13">operator!=</a>(Number &num); 00106 <font class="keywordtype">int</font> <a class="code" href="classost_1_1_number.html#a14">operator<</a>(Number &num); 00107 <font class="keywordtype">int</font> <a class="code" href="classost_1_1_number.html#a15">operator<=</a>(Number &num); 00108 <font class="keywordtype">int</font> <a class="code" href="classost_1_1_number.html#a16">operator></a>(Number &num); 00109 <font class="keywordtype">int</font> <a class="code" href="classost_1_1_number.html#a17">operator>=</a>(Number &num); 00110 00111 <font class="keyword">friend</font> <font class="keywordtype">long</font> <a class="code" href="classost_1_1_number.html#l0">operator+</a>(Number &num, <font class="keywordtype">long</font> val); 00112 <font class="keyword">friend</font> <font class="keywordtype">long</font> <a class="code" href="classost_1_1_number.html#l0">operator+</a>(<font class="keywordtype">long</font> val, Number &num); 00113 <font class="keyword">friend</font> <font class="keywordtype">long</font> <a class="code" href="classost_1_1_number.html#l2">operator-</a>(Number &num, <font class="keywordtype">long</font> val); 00114 <font class="keyword">friend</font> <font class="keywordtype">long</font> <a class="code" href="classost_1_1_number.html#l2">operator-</a>(<font class="keywordtype">long</font> val, Number &num); 00115 }; 00116 <a name="l00117"></a><a class="code" href="classost_1_1_z_number.html">00117</a> <font class="keyword">class </font>CCXX_CLASS_EXPORT ZNumber : <font class="keyword">public</font> Number 00118 { 00119 <font class="keyword">public</font>: 00120 <a class="code" href="classost_1_1_z_number.html#a0">ZNumber</a>(<font class="keywordtype">char</font> *buf, <font class="keywordtype">unsigned</font> size); 00121 <font class="keywordtype">void</font> <a class="code" href="classost_1_1_z_number.html#a1">setValue</a>(<font class="keywordtype">long</font> value); 00122 <font class="keywordtype">long</font> <a class="code" href="classost_1_1_z_number.html#a2">operator=</a>(<font class="keywordtype">long</font> value); 00123 }; 00124 <a name="l00133"></a><a class="code" href="classost_1_1_date.html">00133</a> <font class="keyword">class </font>CCXX_CLASS_EXPORT Date 00134 { 00135 <font class="keyword">private</font>: 00136 <font class="keywordtype">long</font> julian; 00137 00138 <font class="keyword">protected</font>: 00139 <font class="keywordtype">void</font> <a class="code" href="classost_1_1_date.html#b0">toJulian</a>(<font class="keywordtype">long</font> year, <font class="keywordtype">long</font> month, <font class="keywordtype">long</font> day); 00140 <font class="keywordtype">void</font> <a class="code" href="classost_1_1_date.html#b1">fromJulian</a>(<font class="keywordtype">char</font> *buf); 00141 <a name="l00146"></a><a class="code" href="classost_1_1_date.html#b2">00146</a> <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="classost_1_1_date.html#b2">Update</a>(<font class="keywordtype">void</font>)<font class="keyword"></font> 00147 <font class="keyword"> </font>{<font class="keywordflow">return</font>;}; 00148 00149 <font class="keyword">public</font>: 00150 00151 <a class="code" href="classost_1_1_date.html#a4">Date</a>(time_t tm); 00152 <a class="code" href="classost_1_1_date.html#a4">Date</a>(tm *dt); 00153 <a class="code" href="classost_1_1_date.html#a4">Date</a>(<font class="keywordtype">char</font> *str, size_t size = 0); 00154 <a class="code" href="classost_1_1_date.html#a4">Date</a>(<font class="keywordtype">int</font> year, <font class="keywordtype">unsigned</font> month, <font class="keywordtype">unsigned</font> day); 00155 <a class="code" href="classost_1_1_date.html#a4">Date</a>(); 00156 00157 <font class="keywordtype">int</font> <a class="code" href="classost_1_1_date.html#a5">getYear</a>(<font class="keywordtype">void</font>); 00158 <font class="keywordtype">unsigned</font> <a class="code" href="classost_1_1_date.html#a6">getMonth</a>(<font class="keywordtype">void</font>); 00159 <font class="keywordtype">unsigned</font> <a class="code" href="classost_1_1_date.html#a7">getDay</a>(<font class="keywordtype">void</font>); 00160 <font class="keywordtype">unsigned</font> <a class="code" href="classost_1_1_date.html#a8">getDayOfWeek</a>(<font class="keywordtype">void</font>); 00161 <font class="keywordtype">char</font> *<a class="code" href="classost_1_1_date.html#a10">getDate</a>(<font class="keywordtype">char</font> *buffer); 00162 time_t <a class="code" href="classost_1_1_date.html#a10">getDate</a>(<font class="keywordtype">void</font>); 00163 <font class="keywordtype">long</font> <a class="code" href="classost_1_1_date.html#a11">getValue</a>(<font class="keywordtype">void</font>); 00164 tm *<a class="code" href="classost_1_1_date.html#a10">getDate</a>(tm *buf); 00165 <font class="keywordtype">bool</font> <a class="code" href="classost_1_1_date.html#a13">is_ok</a>(<font class="keywordtype">void</font>); 00166 00167 <font class="keyword">friend</font> Date <a class="code" href="classost_1_1_date.html#l0">operator+</a>(Date &date, <font class="keywordtype">long</font> val); 00168 <font class="keyword">friend</font> Date <a class="code" href="classost_1_1_date.html#l1">operator-</a>(Date &date, <font class="keywordtype">long</font> val); 00169 <font class="keyword">friend</font> Date <a class="code" href="classost_1_1_date.html#l0">operator+</a>(<font class="keywordtype">long</font> val, Date &date); 00170 <font class="keyword">friend</font> Date <a class="code" href="classost_1_1_date.html#l1">operator-</a>(<font class="keywordtype">long</font> val, Date &date); 00171 <a name="l00172"></a><a class="code" href="classost_1_1_date.html#a14">00172</a> <a class="code" href="classost_1_1_date.html#a14">operator long</a>()<font class="keyword"></font> 00173 <font class="keyword"> </font>{<font class="keywordflow">return</font> <a class="code" href="classost_1_1_date.html#a11">getValue</a>();}; 00174 00175 std::string <a class="code" href="classost_1_1_date.html#a15">operator()</a>(); 00176 Date& <a class="code" href="classost_1_1_date.html#a16">operator++</a>(); 00177 Date& <a class="code" href="classost_1_1_date.html#a17">operator--</a>(); 00178 Date& <a class="code" href="classost_1_1_date.html#a18">operator+=</a>(<font class="keywordtype">long</font> val); 00179 Date& <a class="code" href="classost_1_1_date.html#a19">operator-=</a>(<font class="keywordtype">long</font> val); 00180 <font class="keywordtype">int</font> <a class="code" href="classost_1_1_date.html#a20">operator==</a>(Date &date); 00181 <font class="keywordtype">int</font> <a class="code" href="classost_1_1_date.html#a21">operator!=</a>(Date &date); 00182 <font class="keywordtype">int</font> <a class="code" href="classost_1_1_date.html#a22">operator<</a>(Date &date); 00183 <font class="keywordtype">int</font> <a class="code" href="classost_1_1_date.html#a23">operator<=</a>(Date &date); 00184 <font class="keywordtype">int</font> <a class="code" href="classost_1_1_date.html#a24">operator></a>(Date &date); 00185 <font class="keywordtype">int</font> <a class="code" href="classost_1_1_date.html#a25">operator>=</a>(Date &date); <a name="l00186"></a><a class="code" href="classost_1_1_date.html#a26">00186</a> <font class="keywordtype">bool</font> <a class="code" href="classost_1_1_date.html#a26">operator!</a>()<font class="keyword"></font> 00187 <font class="keyword"> </font>{<font class="keywordflow">return</font> !<a class="code" href="classost_1_1_date.html#a13">is_ok</a>();}; 00188 }; 00189 <a name="l00196"></a><a class="code" href="classost_1_1_date_number.html">00196</a> <font class="keyword">class </font>CCXX_CLASS_EXPORT DateNumber : <font class="keyword">public</font> Number, <font class="keyword">public</font> Date 00197 { 00198 <font class="keyword">protected</font>: <a name="l00199"></a><a class="code" href="classost_1_1_date_number.html#b0">00199</a> <font class="keywordtype">void</font> <a class="code" href="classost_1_1_date_number.html#b0">Update</a>(<font class="keywordtype">void</font>)<font class="keyword"></font> 00200 <font class="keyword"> </font>{<a class="code" href="classost_1_1_date.html#b1">fromJulian</a>(buffer);}; 00201 00202 <font class="keyword">public</font>: 00203 <a class="code" href="classost_1_1_date_number.html#a0">DateNumber</a>(<font class="keywordtype">char</font> *buffer); 00204 }; 00205 00206 <font class="preprocessor">#ifdef CCXX_NAMESPACES</font> 00207 <font class="preprocessor"></font>}; 00208 <font class="preprocessor">#endif</font> 00209 <font class="preprocessor"></font> 00210 <font class="preprocessor">#endif</font> 00211 <font class="preprocessor"></font> </pre></div><hr><address><small>Generated at Fri Jan 4 18:51:45 2002 for CommonC++ by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.gif" alt="doxygen" align="middle" border=0 width=110 height=53></a>1.2.10 written by <a href="mailto:dimitri@stack.nl">Dimitri van Heesch</a>, © 1997-2001</small></address> </body> </html>