00001
00005 #ifndef OSCL_UUID_UTILS_H_INCLUDED
00006 #define OSCL_UUID_UTILS_H_INCLUDED
00007
00008 #ifndef OSCL_STRING_UTILS_H
00009 #include "oscl_string_utils.h"
00010 #endif
00011
00012 #ifndef OSCL_STDSTRING_H_INCLUDED
00013 #include "oscl_stdstring.h"
00014 #endif
00015
00016 const char PV_CHAR_CLOSE_BRACKET = ')';
00017 const char PV_CHAR_COMMA = ',';
00018 static void SetOsclUuid(OsclUuid& uuid, const char* aUuidString)
00019 {
00020
00021 uuid.data1 = uuid.data2 = uuid.data3 = 0;
00022
00023 for (int ii = 0; ii < 8; ++ii)
00024 {
00025 uuid.data4[ii] = 0;
00026 }
00027
00028 if (!aUuidString)
00029 {
00030 return;
00031 }
00032 int uuidStrLen = oscl_strlen(aUuidString);
00033
00034 if (uuidStrLen != 0)
00035 {
00036 const char* sptr = NULL, *eptr = NULL;
00037 int commaval = 0;
00038 sptr = aUuidString;
00039 ++sptr;
00040 eptr = sptr;
00041 for (int i = 0; i < uuidStrLen - 1 ; ++i)
00042 {
00043 if ((*eptr != PV_CHAR_COMMA) && (*eptr != PV_CHAR_CLOSE_BRACKET))
00044 {
00045 ++eptr;
00046 }
00047 else
00048 {
00049 sptr = sptr + 2;
00050 ++commaval;
00051 switch (commaval)
00052 {
00053 case 1:
00054 {
00055 PV_atoi(sptr , 'x', eptr - sptr, uuid.data1);
00056 break;
00057 }
00058 case 2:
00059 {
00060 uint32 tempdata2 = 0;
00061 PV_atoi(sptr , 'x', (eptr - sptr), tempdata2);
00062 uuid.data2 = (uint16)tempdata2;
00063 break;
00064 }
00065 case 3:
00066 {
00067 uint32 tempdata3 = 0;
00068 PV_atoi(sptr , 'x', (eptr - sptr), tempdata3);
00069 uuid.data3 = (uint16)tempdata3;
00070 break;
00071 }
00072 case 4:
00073 {
00074 uint32 tempdata4_0 = 0;
00075 PV_atoi(sptr , 'x', (eptr - sptr), tempdata4_0);
00076 uuid.data4[0] = (uint8)tempdata4_0;
00077 break;
00078 }
00079 case 5:
00080 {
00081 uint32 tempdata4_1 = 0;
00082 PV_atoi(sptr , 'x', (eptr - sptr), tempdata4_1);
00083 uuid.data4[1] = (uint8)tempdata4_1;
00084 break;
00085 }
00086 case 6:
00087 {
00088 uint32 tempdata4_2 = 0;
00089 PV_atoi(sptr , 'x', (eptr - sptr), tempdata4_2);
00090 uuid.data4[2] = (uint8)tempdata4_2;
00091 break;
00092 }
00093 case 7:
00094 {
00095 uint32 tempdata4_3 = 0;
00096 PV_atoi(sptr , 'x', (eptr - sptr), tempdata4_3);
00097 uuid.data4[3] = (uint8)tempdata4_3;
00098 break;
00099 }
00100 case 8:
00101 {
00102 uint32 tempdata4_4 = 0;
00103 PV_atoi(sptr , 'x', (eptr - sptr), tempdata4_4);
00104 uuid.data4[4] = (uint8)tempdata4_4;
00105 break;
00106 }
00107 case 9:
00108 {
00109 uint32 tempdata4_5 = 0;
00110 PV_atoi(sptr , 'x', (eptr - sptr), tempdata4_5);
00111 uuid.data4[5] = (uint8)tempdata4_5;
00112 break;
00113 }
00114 case 10:
00115 {
00116 uint32 tempdata4_6 = 0;
00117 PV_atoi(sptr , 'x', (eptr - sptr), tempdata4_6);
00118 uuid.data4[6] = (uint8)tempdata4_6;
00119 break;
00120 }
00121 case 11:
00122 {
00123 uint32 tempdata4_7 = 0;
00124 PV_atoi(sptr, 'x', (eptr - sptr), tempdata4_7);
00125 uuid.data4[7] = (uint8)tempdata4_7;
00126 break;
00127 }
00128 }
00129 if (*eptr == PV_CHAR_CLOSE_BRACKET)
00130 {
00131 break;
00132 }
00133 ++eptr;
00134 sptr = eptr;
00135 }
00136 }
00137 }
00138 }
00139 #endif
00140
00141