Main Page   Modules   Class Hierarchy   Data Structures   File List   Data Fields   Globals  

oscl_namestring.h

Go to the documentation of this file.
00001 // -*- c++ -*-
00002 // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
00003 
00004 //                     O S C L _ N A M E S T R I N G
00005 
00006 // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
00007 
00018 #ifndef OSCL_NAMESTRING_H_INCLUDED
00019 #define OSCL_NAMESTRING_H_INCLUDED
00020 
00021 #ifndef OSCL_BASE_H_INCLUDED
00022 #include "oscl_base.h"
00023 #endif
00024 
00031 template<int __len>
00032 class OsclNameString
00033 {
00034     public:
00035         OsclNameString()
00036         {
00037             Set("");
00038         }
00039 
00040         OsclNameString(const char a[])
00041         {
00042             Set((uint8*)a);
00043         }
00044 
00045         OsclNameString(uint8* a)
00046         {
00047             Set(a);
00048         }
00049 
00058         void Set(uint8* a)
00059         {
00060             for (int i = 0;i < __len;i++)
00061                 iStr[i] = '\0';
00062             if (a)
00063             {
00064                 for (int i = 0;i < __len - 1;i++)
00065                 {
00066                     iStr[i] = a[i];
00067                     if (a[i] == '\0')
00068                         return;
00069                 }
00070             }
00071         }
00072 
00073         void Set(const char a[])
00074         {
00075             Set((uint8*)a);
00076         }
00077 
00078         uint8* Str()const
00079         {
00080             return (uint8*)&iStr[0];
00081         }
00082 
00083         int32 MaxLen()const
00084         {
00085             return __len;
00086         }
00087 
00088     private:
00089         uint8 iStr[__len];
00090 };
00091 #endif
00092 

OSCL API
Posting Version: OPENCORE_20090310