1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> 2 <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> 3 <title>oscl_namestring.h Source File</title> 4 <link href="doxygen.css" rel="stylesheet" type="text/css"> 5 </head><body> 6 <!-- Generated by Doxygen 1.2.18 --> 7 <center> 8 <a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="modules.html">Modules</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="annotated.html">Data Structures</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Data Fields</a> <a class="qindex" href="globals.html">Globals</a> </center> 9 <hr><h1>oscl_namestring.h</h1><a href="oscl__namestring_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">// -*- c++ -*-</span> 10 00002 <span class="comment">// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =</span> 11 00003 12 00004 <span class="comment">// O S C L _ N A M E S T R I N G</span> 13 00005 14 00006 <span class="comment">// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =</span> 15 00007 16 00018 <span class="preprocessor">#ifndef OSCL_NAMESTRING_H_INCLUDED</span> 17 00019 <span class="preprocessor"></span><span class="preprocessor">#define OSCL_NAMESTRING_H_INCLUDED</span> 18 00020 <span class="preprocessor"></span> 19 00021 <span class="preprocessor">#ifndef OSCL_BASE_H_INCLUDED</span> 20 00022 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="oscl__base_8h.html">oscl_base.h</a>"</span> 21 00023 <span class="preprocessor">#endif</span> 22 00024 <span class="preprocessor"></span> 23 00031 <span class="keyword">template</span><<span class="keywordtype">int</span> __len> 24 <a name="l00032"></a><a class="code" href="classOsclNameString.html">00032</a> <span class="keyword">class </span><a class="code" href="classOsclNameString.html">OsclNameString</a> 25 00033 { 26 00034 <span class="keyword">public</span>: 27 <a name="l00035"></a><a class="code" href="classOsclNameString.html#a0">00035</a> <a class="code" href="classOsclNameString.html#a0">OsclNameString</a>() 28 00036 { 29 00037 <a class="code" href="classOsclNameString.html#a3">Set</a>(<span class="stringliteral">""</span>); 30 00038 } 31 00039 32 <a name="l00040"></a><a class="code" href="classOsclNameString.html#a1">00040</a> <a class="code" href="classOsclNameString.html#a0">OsclNameString</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> a[]) 33 00041 { 34 00042 <a class="code" href="classOsclNameString.html#a3">Set</a>((uint8*)a); 35 00043 } 36 00044 37 <a name="l00045"></a><a class="code" href="classOsclNameString.html#a2">00045</a> <a class="code" href="classOsclNameString.html#a0">OsclNameString</a>(uint8* a) 38 00046 { 39 00047 <a class="code" href="classOsclNameString.html#a3">Set</a>(a); 40 00048 } 41 00049 42 <a name="l00058"></a><a class="code" href="classOsclNameString.html#a3">00058</a> <span class="keywordtype">void</span> <a class="code" href="classOsclNameString.html#a3">Set</a>(uint8* a) 43 00059 { 44 00060 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0;i < __len;i++) 45 00061 iStr[i] = <span class="charliteral">'\0'</span>; 46 00062 <span class="keywordflow">if</span> (a) 47 00063 { 48 00064 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0;i < __len - 1;i++) 49 00065 { 50 00066 iStr[i] = a[i]; 51 00067 <span class="keywordflow">if</span> (a[i] == <span class="charliteral">'\0'</span>) 52 00068 <span class="keywordflow">return</span>; 53 00069 } 54 00070 } 55 00071 } 56 00072 57 <a name="l00073"></a><a class="code" href="classOsclNameString.html#a4">00073</a> <span class="keywordtype">void</span> <a class="code" href="classOsclNameString.html#a3">Set</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> a[]) 58 00074 { 59 00075 <a class="code" href="classOsclNameString.html#a3">Set</a>((uint8*)a); 60 00076 } 61 00077 62 <a name="l00078"></a><a class="code" href="classOsclNameString.html#a5">00078</a> uint8* <a class="code" href="classOsclNameString.html#a5">Str</a>()<span class="keyword">const</span> 63 00079 { 64 00080 <span class="keywordflow">return</span> (uint8*)&iStr[0]; 65 00081 } 66 00082 67 <a name="l00083"></a><a class="code" href="classOsclNameString.html#a6">00083</a> int32 <a class="code" href="classOsclNameString.html#a6">MaxLen</a>()<span class="keyword">const</span> 68 00084 { 69 00085 <span class="keywordflow">return</span> __len; 70 00086 } 71 00087 72 00088 <span class="keyword">private</span>: 73 00089 uint8 iStr[__len]; 74 00090 }; 75 00091 <span class="preprocessor">#endif</span> 76 00092 <span class="preprocessor"></span> 77 </pre></div><hr size="1"><img src="pvlogo_small.jpg"><address style="align: right;"><small>OSCL API</small> 78 <address style="align: left;"><small>Posting Version: OPENCORE_20090310 </small> 79 </small></address> 80 </body> 81 </html> 82