<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><head><meta name="robots" content="noindex"> <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>strchar.h Source File</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body bgcolor="#ffffff"> <!-- Generated by Doxygen 1.2.5 on Thu Oct 4 15:32:58 2001 --> <center> <a class="qindex" href="index.html">Main Page</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="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> </center> <hr><h1>strchar.h</h1><a href="strchar_h.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_STRCHAR_H__</font> 00042 <font class="preprocessor"></font><font class="preprocessor">#define __CCXX_STRCHAR_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++/<a class="code" href="config_h.html">config.h</a>></font> 00046 <font class="preprocessor">#endif</font> 00047 <font class="preprocessor"></font> 00048 <font class="preprocessor">#include <cstring></font> 00049 <font class="preprocessor">#include <cctype></font> 00050 <font class="preprocessor">#include <string></font> 00051 <a name="l00052"></a><a class="code" href="class_keystring.html">00052</a> <font class="keyword">class </font><a class="code" href="class_keystring.html">keystring</a> 00053 { 00054 <font class="keyword">private</font>: 00055 <font class="keyword">const</font> <font class="keywordtype">char</font> *c_str; 00056 00057 <font class="keyword">public</font>: <a name="l00058"></a><a class="code" href="class_keystring.html#a0">00058</a> <font class="keyword">inline</font> <a class="code" href="class_keystring.html#a1">keystring</a>(<font class="keyword">const</font> <font class="keywordtype">char</font> *s)<font class="keyword"></font> 00059 <font class="keyword"> </font>{c_str = s;} 00060 <a name="l00061"></a><a class="code" href="class_keystring.html#a1">00061</a> <font class="keyword">inline</font> <a class="code" href="class_keystring.html#a1">keystring</a>()<font class="keyword"></font> 00062 <font class="keyword"> </font>{c_str = NULL;}; 00063 <a name="l00064"></a><a class="code" href="class_keystring.html#a2">00064</a> <font class="keyword">virtual</font> <font class="keywordtype">int</font> <a class="code" href="class_keystring.html#a2">compare</a>(<font class="keyword">const</font> <font class="keywordtype">char</font> *s2)<font class="keyword"></font> 00065 <font class="keyword"> </font>{<font class="keywordflow">return</font> stricmp(c_str, s2);}; 00066 <a name="l00067"></a><a class="code" href="class_keystring.html#a3">00067</a> <font class="keyword">inline</font> <font class="keyword">const</font> <font class="keywordtype">char</font> *<a class="code" href="class_keystring.html#a3">operator=</a>(<font class="keyword">const</font> <font class="keywordtype">char</font> *c)<font class="keyword"></font> 00068 <font class="keyword"> </font>{<font class="keywordflow">return</font> c_str = c;}; 00069 <a name="l00070"></a><a class="code" href="class_keystring.html#l0">00070</a> <font class="keyword">friend</font> <font class="keyword">inline</font> <font class="keywordtype">int</font> <a class="code" href="class_keystring.html#l0">operator==</a>(<a class="code" href="class_keystring.html">keystring</a> k1, <a class="code" href="class_keystring.html">keystring</a> k2)<font class="keyword"></font> 00071 <font class="keyword"> </font>{<font class="keywordflow">return</font> (k1.<a class="code" href="class_keystring.html#a2">compare</a>(k2) == 0);}; 00072 <a name="l00073"></a><a class="code" href="class_keystring.html#l1">00073</a> <font class="keyword">friend</font> <font class="keyword">inline</font> <font class="keywordtype">int</font> <a class="code" href="class_keystring.html#l1">operator!=</a>(<a class="code" href="class_keystring.html">keystring</a> k1, <a class="code" href="class_keystring.html">keystring</a> k2)<font class="keyword"></font> 00074 <font class="keyword"> </font>{<font class="keywordflow">return</font> (k1.<a class="code" href="class_keystring.html#a2">compare</a>(k2) != 0);}; 00075 <a name="l00076"></a><a class="code" href="class_keystring.html#l2">00076</a> <font class="keyword">friend</font> <font class="keyword">inline</font> <font class="keywordtype">int</font> <a class="code" href="class_keystring.html#l2">operator<</a>(<a class="code" href="class_keystring.html">keystring</a> k1, <a class="code" href="class_keystring.html">keystring</a> k2)<font class="keyword"></font> 00077 <font class="keyword"> </font>{<font class="keywordflow">return</font> (k1.<a class="code" href="class_keystring.html#a2">compare</a>(k2) < 0);}; 00078 <a name="l00079"></a><a class="code" href="class_keystring.html#l3">00079</a> <font class="keyword">friend</font> <font class="keyword">inline</font> <font class="keywordtype">int</font> <a class="code" href="class_keystring.html#l3">operator></a>(<a class="code" href="class_keystring.html">keystring</a> k1, <a class="code" href="class_keystring.html">keystring</a> k2)<font class="keyword"></font> 00080 <font class="keyword"> </font>{<font class="keywordflow">return</font> (k1.<a class="code" href="class_keystring.html#a2">compare</a>(k2) > 0);}; 00081 <a name="l00082"></a><a class="code" href="class_keystring.html#l4">00082</a> <font class="keyword">friend</font> <font class="keyword">inline</font> <font class="keywordtype">int</font> <a class="code" href="class_keystring.html#l4">operator<=</a>(<a class="code" href="class_keystring.html">keystring</a> k1, <a class="code" href="class_keystring.html">keystring</a> k2)<font class="keyword"></font> 00083 <font class="keyword"> </font>{<font class="keywordflow">return</font> (k1.<a class="code" href="class_keystring.html#a2">compare</a>(k2) <= 0);}; 00084 <a name="l00085"></a><a class="code" href="class_keystring.html#l5">00085</a> <font class="keyword">friend</font> <font class="keyword">inline</font> <font class="keywordtype">int</font> <a class="code" href="class_keystring.html#l5">operator>=</a>(<a class="code" href="class_keystring.html">keystring</a> k1, <a class="code" href="class_keystring.html">keystring</a> k2)<font class="keyword"></font> 00086 <font class="keyword"> </font>{<font class="keywordflow">return</font> (k1.<a class="code" href="class_keystring.html#a2">compare</a>(k2) >= 0);}; 00087 <a name="l00088"></a><a class="code" href="class_keystring.html#l6">00088</a> <font class="keyword">friend</font> <font class="keyword">inline</font> <font class="keywordtype">int</font> <a class="code" href="class_keystring.html#l6">operator!</a>(<a class="code" href="class_keystring.html">keystring</a> k1)<font class="keyword"></font> 00089 <font class="keyword"> </font>{<font class="keywordflow">return</font> k1.c_str == NULL;}; 00090 <a name="l00091"></a><a class="code" href="class_keystring.html#l7">00091</a> <font class="keyword">friend</font> <font class="keyword">inline</font> <font class="keywordtype">int</font> <a class="code" href="class_keystring.html#l7">length</a>(<a class="code" href="class_keystring.html">keystring</a> k1)<font class="keyword"></font> 00092 <font class="keyword"> </font>{<font class="keywordflow">return</font> strlen(k1.c_str);}; 00093 <a name="l00094"></a><a class="code" href="class_keystring.html#l8">00094</a> <font class="keyword">friend</font> <font class="keyword">inline</font> <font class="keyword">const</font> <font class="keywordtype">char</font> *<a class="code" href="class_keystring.html#l8">text</a>(<a class="code" href="class_keystring.html">keystring</a> k1)<font class="keyword"></font> 00095 <font class="keyword"> </font>{<font class="keywordflow">return</font> k1.c_str;}; 00096 <a name="l00097"></a><a class="code" href="class_keystring.html#a4">00097</a> <font class="keyword">inline</font> <font class="keyword">const</font> <font class="keywordtype">char</font> *<a class="code" href="class_keystring.html#a4">operator ()</a>()<font class="keyword"></font> 00098 <font class="keyword"> </font>{<font class="keywordflow">return</font> c_str;}; 00099 <a name="l00100"></a><a class="code" href="class_keystring.html#a5">00100</a> <font class="keyword">inline</font> <a class="code" href="class_keystring.html#a5">operator const char *</a>()<font class="keyword"></font> 00101 <font class="keyword"> </font>{<font class="keywordflow">return</font> c_str;}; 00102 }; 00103 00104 <font class="preprocessor">#endif</font> </font></div></pre><hr><address><small>Generated at Thu Oct 4 15:32:58 2001 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.5 written by <a href="mailto:dimitri@stack.nl">Dimitri van Heesch</a>, © 1997-2001</small></address> </body> </html>