(file) Return to CharSet.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

  1 martin 1.8 //%LICENSE////////////////////////////////////////////////////////////////
  2 martin 1.9 //
  3 martin 1.8 // Licensed to The Open Group (TOG) under one or more contributor license
  4            // agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with
  5            // this work for additional information regarding copyright ownership.
  6            // Each contributor licenses this file to you under the OpenPegasus Open
  7            // Source License; you may not use this file except in compliance with the
  8            // License.
  9 martin 1.9 //
 10 martin 1.8 // Permission is hereby granted, free of charge, to any person obtaining a
 11            // copy of this software and associated documentation files (the "Software"),
 12            // to deal in the Software without restriction, including without limitation
 13            // the rights to use, copy, modify, merge, publish, distribute, sublicense,
 14            // and/or sell copies of the Software, and to permit persons to whom the
 15            // Software is furnished to do so, subject to the following conditions:
 16 martin 1.9 //
 17 martin 1.8 // The above copyright notice and this permission notice shall be included
 18            // in all copies or substantial portions of the Software.
 19 martin 1.9 //
 20 martin 1.8 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 21 martin 1.9 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 22 martin 1.8 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 23            // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 24            // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 25            // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 26            // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 27 martin 1.9 //
 28 martin 1.8 //////////////////////////////////////////////////////////////////////////
 29 mike   1.2 //
 30            //%/////////////////////////////////////////////////////////////////////////////
 31            
 32            #include <cctype>
 33            #include <cstring>
 34            #include "CharSet.h"
 35            
 36            PEGASUS_NAMESPACE_BEGIN
 37            
 38            //
 39 kumpf  1.6 // Note: These definitions are specifically for ASCII.
 40 mike   1.2 //
 41            
 42 kumpf  1.5 const Uint8 CharSet::_isAlphaUnder[256] =
 43 mike   1.2 {
 44                0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 45                0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 46                0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,
 47                0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,
 48                0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 49                0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 50                0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 51                0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 52            };
 53            
 54 kumpf  1.5 const Uint8 CharSet::_isAlNumUnder[256] =
 55 mike   1.2 {
 56                0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 57                0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,
 58                0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,
 59                0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,
 60                0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 61                0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 62                0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 63                0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 64            };
 65            
 66 kumpf  1.5 const Uint8 CharSet::_isSpace[256] =
 67 mike   1.2 {
 68                0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 69                1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 70                0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 71                0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 72                0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 73                0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 74                0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 75                0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 76            };
 77            
 78 kumpf  1.5 const Uint8 CharSet::_isXmlWhiteSpace[256] =
 79 kumpf  1.3 {
 80                0,0,0,0,0,0,0,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 81                1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 82                0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 83                0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 84                0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 85                0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 86                0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 87                0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 88            };
 89            
 90 kumpf  1.5 const Uint8 CharSet::_toUpper[256] =
 91 mike   1.2 {
 92                0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
 93                0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,
 94                0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,
 95                0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F,
 96                0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,
 97                0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F,
 98                0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,
 99                0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F,
100                0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,
101                0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F,
102                0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,
103                0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F,
104                0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,
105                0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F,
106                0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,
107                0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F,
108                0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,
109                0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,
110                0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,
111                0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F,
112 mike   1.2     0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,
113                0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,
114                0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,
115                0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF,
116                0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,
117                0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,
118                0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,
119                0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF,
120                0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,
121                0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,
122                0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,
123                0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF,
124            };
125            
126 kumpf  1.5 const Uint8 CharSet::_toLower[256] =
127 mike   1.2 {
128                0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
129                0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,
130                0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,
131                0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F,
132                0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,
133                0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F,
134                0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,
135                0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F,
136                0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,
137                0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F,
138                0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,
139                0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F,
140                0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,
141                0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F,
142                0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,
143                0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F,
144                0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,
145                0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,
146                0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,
147                0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F,
148 mike   1.2     0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,
149                0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,
150                0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,
151                0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF,
152                0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,
153                0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,
154                0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,
155                0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF,
156                0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,
157                0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,
158                0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,
159                0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF,
160            };
161            
162            const Uint8 CharSet::_isNotSpaceNorTerm[] =
163            {
164                0,1,1,1,1,1,1,1,1,0,0,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
165                0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
166                1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
167                1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
168                1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
169 mike   1.2     1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
170                1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
171                1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
172            };
173            
174 marek  1.7 // Single hex character to byte translation
175            // right bit used, left bit 0 padding
176            // 0 = 00, 1 = 01, 2 = 04, 3 = 05
177            // 4 = 10, 5 = 11, 6 = 14, 7 = 15
178            // 8 = 40, 9 = 41, A = 44, B = 45
179            // C = 50, D = 51, E = 54, F = 55
180            
181            // The following table is used to stretch a byte characters bit-wise
182            // to the length of 2 bytes
183            // This is used by the OrderedSet implementation to generate a hash
184            // out of the first and last character of a CIMName
185            const Uint16 CharSet::_toUpperHash[256] =
186            {
187                0x0000,0x0001,0x0004,0x0005,0x0010,0x0011,0x0014,0x0015, 
188                0x0040,0x0041,0x0044,0x0045,0x0050,0x0051,0x0054,0x0055,
189                0x0100,0x0101,0x0104,0x0105,0x0110,0x0111,0x0114,0x0115, 
190                0x0140,0x0141,0x0144,0x0145,0x0150,0x0151,0x0154,0x0155,
191                0x0400,0x0401,0x0404,0x0405,0x0410,0x0411,0x0414,0x0415, 
192                0x0440,0x0441,0x0444,0x0445,0x0450,0x0451,0x0454,0x0455,
193                0x0500,0x0501,0x0504,0x0505,0x0510,0x0511,0x0514,0x0515, 
194                0x0540,0x0541,0x0544,0x0545,0x0550,0x0551,0x0554,0x0555,
195 marek  1.7     0x1000,0x1001,0x1004,0x1005,0x1010,0x1011,0x1014,0x1015, 
196                0x1040,0x1041,0x1044,0x1045,0x1050,0x1051,0x1054,0x1055,
197                0x1100,0x1101,0x1104,0x1105,0x1110,0x1111,0x1114,0x1115, 
198                0x1140,0x1141,0x1144,0x1145,0x1150,0x1151,0x1154,0x1155,
199                0x1400,0x1001,0x1004,0x1005,0x1010,0x1011,0x1014,0x1015, 
200                0x1040,0x1041,0x1044,0x1045,0x1050,0x1051,0x1054,0x1055,
201                0x1100,0x1101,0x1104,0x1105,0x1110,0x1111,0x1114,0x1115,
202                0x1140,0x1141,0x1144,0x1545,0x1550,0x1551,0x1554,0x1555,
203                0x4000,0x4001,0x4004,0x4005,0x4010,0x4011,0x4014,0x4015,
204                0x4040,0x4041,0x4044,0x4045,0x4050,0x4051,0x4054,0x4055,
205                0x4100,0x4101,0x4104,0x4105,0x4110,0x4111,0x4114,0x4115,
206                0x4140,0x4141,0x4144,0x4145,0x4150,0x4151,0x4154,0x4155,
207                0x4400,0x4401,0x4404,0x4405,0x4410,0x4411,0x4414,0x4415,
208                0x4440,0x4441,0x4444,0x4445,0x4450,0x4451,0x4454,0x4455,
209                0x4500,0x4501,0x4504,0x4505,0x4510,0x4511,0x4514,0x4515,
210                0x4540,0x4541,0x4544,0x4545,0x4550,0x4551,0x4554,0x4555, 
211                0x5000,0x5001,0x5004,0x5005,0x5010,0x5011,0x5014,0x5015,
212                0x5040,0x5041,0x5044,0x5045,0x5050,0x5051,0x5054,0x5055, 
213                0x5100,0x5101,0x5104,0x5105,0x5110,0x5111,0x5114,0x5115,
214                0x5140,0x5141,0x5144,0x5145,0x5150,0x5151,0x5154,0x5155, 
215                0x5400,0x5401,0x5404,0x5405,0x5410,0x5411,0x5414,0x5415,
216 marek  1.7     0x5440,0x5441,0x5444,0x5445,0x5450,0x5451,0x5454,0x5455, 
217                0x5500,0x5501,0x5504,0x5505,0x5510,0x5511,0x5514,0x5515,
218                0x5540,0x5541,0x5544,0x5545,0x5550,0x5551,0x5554,0x5555,
219            };
220            
221            
222 mike   1.2 PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2