Back to index

lightning-sunbird  0.9+nobinonly
ImportCharSet.cpp
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1998
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *
00024  * Alternatively, the contents of this file may be used under the terms of
00025  * either of the GNU General Public License Version 2 or later (the "GPL"),
00026  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00027  * in which case the provisions of the GPL or the LGPL are applicable instead
00028  * of those above. If you wish to allow use of your version of this file only
00029  * under the terms of either the GPL or the LGPL, and not to allow others to
00030  * use your version of this file under the terms of the MPL, indicate your
00031  * decision by deleting the provisions above and replace them with the notice
00032  * and other provisions required by the GPL or the LGPL. If you do not delete
00033  * the provisions above, a recipient may use your version of this file under
00034  * the terms of any one of the MPL, the GPL or the LGPL.
00035  *
00036  * ***** END LICENSE BLOCK ***** */
00037 
00038 
00039 #include "ImportCharSet.h"
00040 
00041 char ImportCharSet::m_upperCaseMap[256];
00042 char ImportCharSet::m_Ascii[256] = {0}; // the initialiser makes it strong
00043 
00044 class UInitMaps {
00045 public:
00046        UInitMaps();
00047 };
00048 
00049 UInitMaps     gInitMaps;
00050 
00051 UInitMaps::UInitMaps()
00052 {
00053        int    i;
00054 
00055        for (i = 0; i < 256; i++)
00056               ImportCharSet::m_upperCaseMap[i] = i;
00057        for (i = 'a'; i <= 'z'; i++)
00058               ImportCharSet::m_upperCaseMap[i] = i - 'a' + 'A';
00059 
00060        for (i = 0; i < 256; i++)
00061               ImportCharSet::m_Ascii[i] = 0;
00062 
00063        for (i = ImportCharSet::cUpperAChar; i <= ImportCharSet::cUpperZChar; i++)
00064               ImportCharSet::m_Ascii[i] |= (ImportCharSet::cAlphaNumChar | ImportCharSet::cAlphaChar);
00065        for (i = ImportCharSet::cLowerAChar; i <= ImportCharSet::cLowerZChar; i++)
00066               ImportCharSet::m_Ascii[i] |= (ImportCharSet::cAlphaNumChar | ImportCharSet::cAlphaChar);
00067        for (i = ImportCharSet::cZeroChar; i <= ImportCharSet::cNineChar; i++)
00068               ImportCharSet::m_Ascii[i] |= (ImportCharSet::cAlphaNumChar | ImportCharSet::cDigitChar);
00069 
00070        ImportCharSet::m_Ascii[ImportCharSet::cTabChar] |= ImportCharSet::cWhiteSpaceChar;
00071        ImportCharSet::m_Ascii[ImportCharSet::cCRChar] |= ImportCharSet::cWhiteSpaceChar;
00072        ImportCharSet::m_Ascii[ImportCharSet::cLinefeedChar] |= ImportCharSet::cWhiteSpaceChar;
00073        ImportCharSet::m_Ascii[ImportCharSet::cSpaceChar] |= ImportCharSet::cWhiteSpaceChar;
00074 
00075        ImportCharSet::m_Ascii['('] |= ImportCharSet::c822SpecialChar;
00076        ImportCharSet::m_Ascii[')'] |= ImportCharSet::c822SpecialChar;
00077        ImportCharSet::m_Ascii['<'] |= ImportCharSet::c822SpecialChar;
00078        ImportCharSet::m_Ascii['>'] |= ImportCharSet::c822SpecialChar;
00079        ImportCharSet::m_Ascii['@'] |= ImportCharSet::c822SpecialChar;
00080        ImportCharSet::m_Ascii[','] |= ImportCharSet::c822SpecialChar;
00081        ImportCharSet::m_Ascii[';'] |= ImportCharSet::c822SpecialChar;
00082        ImportCharSet::m_Ascii[':'] |= ImportCharSet::c822SpecialChar;
00083        ImportCharSet::m_Ascii['\\'] |= ImportCharSet::c822SpecialChar;
00084        ImportCharSet::m_Ascii['"'] |= ImportCharSet::c822SpecialChar;
00085        ImportCharSet::m_Ascii['.'] |= ImportCharSet::c822SpecialChar;
00086        ImportCharSet::m_Ascii['['] |= ImportCharSet::c822SpecialChar;
00087        ImportCharSet::m_Ascii[']'] |= ImportCharSet::c822SpecialChar;
00088 
00089 
00090 }