Remove unused OrderIdFormater (sic) code. r=smontagu b=414142 Not part of the build.

This commit is contained in:
dbaron@dbaron.org 2008-01-26 23:55:24 -08:00
parent 10b22b8430
commit dd0f9978b4
9 changed files with 0 additions and 573 deletions

View File

@ -46,7 +46,6 @@ MODULE = unicharutil
EXPORTS = \
nsICaseConversion.h \
nsIOrderIdFormater.h \
nsITextTransform.h \
nsIUGenCategory.h \
nsUnicharUtilCIID.h \

View File

@ -1,65 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsIOrderIdFormater_h__
#define nsIOrderIdFormater_h__
#include "nsISupports.h"
#include "nsString.h"
#include "nscore.h"
// {CCD4D372-CCDC-11d2-B3B1-00805F8A6670}
#define NS_IORDERIDFORMATER_IID \
{ 0xccd4d372, 0xccdc, 0x11d2, \
{ 0xb3, 0xb1, 0x0, 0x80, 0x5f, 0x8a, 0x66, 0x70 } };
class nsIOrderIdFormater : public nsISupports {
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IORDERIDFORMATER_IID)
// Convert one Unicode character into upper case
NS_IMETHOD ToString( PRUint32 aOrder, nsString& aResult) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIOrderIdFormater, NS_IORDERIDFORMATER_IID)
#endif /* nsIOrderIdFormater_h__ */

View File

@ -1,52 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsCharsList_h__
#define nsCharsList_h__
#include "nscore.h"
class nsCharsList {
public:
virtual PRUnichar Get( PRUint32 aIdx) = 0;
virtual PRUint32 Length() = 0;
};
#endif /* nsCharsList_h__ */

View File

@ -1,159 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "pratom.h"
#include "nsUUDll.h"
#include "nsCharsOrderIdFormater.h"
nsCharsOrderIdFormater::nsCharsOrderIdFormater( nsCharsList* aList)
{
mList = aList;
mBase = aList->Length();
}
nsCharsOrderIdFormater::~nsCharsOrderIdFormater()
{
delete mList;
}
NS_IMETHOD ToString( PRUint32 aOrder, nsString& aResult)
{
aResult = "";
PRUint32 current;
PRUint32 remain = aOrder;
do {
current = aOrder % mBase;
remain = aOrder / mBase;
aResult.Insert(mList->Get(current),0);
} while( remain != 0);
return NS_OK;
}
NS_IMPL_ISUPPORTS1(nsCharsOrderIdFormater, nsIOrderIdFormater)
class nsCharsOrderIdFormaterFactory : public nsIFactory {
NS_DECL_ISUPPORTS
public:
nsCharsOrderIdFormaterFactory(const nsCID &aCID) {
mCID = aCID;
};
virtual ~nsCharsOrderIdFormaterFactory() {
};
NS_IMETHOD CreateInstance(nsISupports *aDelegate,
const nsIID &aIID,
void **aResult);
NS_IMETHOD LockFactory(PRBool aLock) {
return NS_OK;
};
private:
nsCID mCID;
}
NS_IMPL_ISUPPORTS1(nsCharsOrderIdFormaterFactory, nsIFactory)
NS_IMETHODIMP nsCharsOrderIdFormaterFactory::CreateInstance(
nsISupports *aDelegate,
const nsIID &aIID,
void **aResult)
{
if(NULL == aResult)
return NS_ERROR_NULL_POINTER;
*aResult = NULL;
nsISupports *inst = nsnull;
if(mCID.Equals(kLowerAToZOrderIdCID)) {
inst = new nsCharOrderIdFormater(new nsRangeCharsList('a', 'z'));
} else if(mCID.Equals(kUpperAToZOrderIdCID)) {
inst = new nsCharOrderIdFormater(new nsRangeCharsList('A', 'Z'));
} else if(mCID.Equals(k0To9OrderIdCID)) {
inst = new nsCharOrderIdFormater(new nsRangeCharsList('0', '9'));
} else if(mCID.Equals(kHeavenlyStemOrderIdCID)) {
static PRUnichar gHeavenlyStemList[] = {
0x7532, 0x4e59, 0x4e19, 0x4e01, 0x620a,
0x5df1, 0x5e9a, 0x8f9b, 0x58ce, 0x7678
};
nsAutoString tmp(gHeavenlyStemList,
sizeof(gHeavenlyStemList)/sizeof(PRUnichar));
inst = new nsCharOrderIdFormater(new nsStringCharsList(tmp));
} else if(mCID.Equals(kEarthlyBranchOrderIdCID)) {
static PRUnichar gEarthlyBranchList[] = {
0x5b50, 0x4e11, 0x5bc5, 0x536f, 0x8fb0, 0x5df3,
0x5348, 0x672a, 0x7533, 0x9149, 0x620c, 0x4ea5
};
nsAutoString tmp(gEarthlyBranchList,
sizeof(gEarthlyBranchList)/sizeof(PRUnichar));
inst = new nsCharOrderIdFormater(new nsStringCharsList(tmp));
} else if(mCID.Equals(kBoPoMoFoOrderIdCID)) {
//
// Note: Although Unicode standard encode 0x312A-0x312C as BoPoMoFo,
// these three are origional designed for Mid China dialet
// and have never been used for Maderine. Therefore, we
// do not use them for order id.
inst = new nsCharOrderIdFormater(new nsRangeCharsList(0x3105, 0x3129));
} else if(mCID.Equals(kKatakanaOrderIdCID)) {
// XXX fake list- need to verify with momoi about the real seq.
static PRUnichar gKatakanaList[] = {
0x3042, 0x3044, 0x3046, 0x3048, 0x304a
};
nsAutoString tmp(gKatakanaClassList, sizeof(gKatakanaList)/sizeof(PRUnichar));
inst = new nsCharOrderIdFormater(new nsStringCharsList(tmp));
} else if(mCID.Equals(kHiraganaOrderIdCID)) {
// XXX fake list- need to verify with momoi about the real seq.
static PRUnichar gHiraganaList[] = {
0x30a2, 0x30a4, 0x30a6, 0x30a8, 0x30aa
};
nsAutoString tmp(gHiraganaList, sizeof(gHiraganaList)/sizeof(PRUnichar));
inst = new nsCharOrderIdFormater(new nsStringCharsList(tmp));
} else {
return NS_ERROR_ILLEGAL_VALUE;
}
if(NULL == inst )
return NS_ERROR_OUT_OF_MEMORY;
nsresult res = inst->QueryInterface(aIID, aResult);
if(NS_FAILED(res)) {
delete inst;
}
return res;
}

View File

@ -1,63 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsCharsOrderIdFormater_h__
#define nsCharsOrderIdFormater_h__
#include "nsIOrderIdFormater.h"
#include "nsCharsList.h"
class nsCharsOrderIdFormater : public nsIOrderIdFormater {
NS_DECL_ISUPPORTS
public:
nsCharsOrderIdFormater( nsCharsList* aList);
virtual nsCharsOrderIdFormater();
// Convert one Unicode character into upper case
NS_IMETHOD ToString( PRUint32 aOrder, nsString& aResult) = 0;
private:
nsCharsList *mList;
PRUint32 mBase;
};
#endif /* nsCharsOrderIdFormater_h__ */

View File

@ -1,59 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsRangeCharsList.h"
nsRangeCharsList::nsRangeCharsList(PRUnichar aStart, PRUnichar aEnd)
{
mStart = aStart;
mEnd = aEnd;
}
nsRangeCharsList::~nsRangeCharsList()
{
}
PRUnichar nsRangeCharsList::Get( PRUint32 aIdx)
{
return mStart + aIdx;
}
PRUint32 nsRangeCharsList::Length()
{
return mEnd - mStart + 1;
}

View File

@ -1,58 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsRangeCharsList_h__
#define nsRangeCharsList_h__
#include "nsCharsList.h"
class nsRangeCharsList : public nsCharsList {
public:
nsRangeCharsList(PRUnichar aStart, PRUnichar aEnd);
virtual ~nsRangeCharsList();
virtual PRUnichar Get( PRUint32 aIdx) ;
virtual PRUint32 Length() ;
private:
PRUnichar mStart;
PRUnichar mEnd;
};
#endif /* nsRangeCharsList_h__ */

View File

@ -1,57 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsStringCharsList.h"
nsStringCharsList::nsStringCharsList(nsString& aList)
: mList(aList)
{
}
nsStringCharsList::~nsStringCharsList()
{
}
PRUnichar nsStringCharsList::Get( PRUint32 aIdx)
{
return (PRUnichar)mList(aIdx);
}
PRUint32 nsStringCharsList::Length()
{
return mList.Length();
}

View File

@ -1,59 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsStringCharsList_h__
#define nsStringCharsList_h__
#include "nscore.h"
#include "nsString.h"
#include "nsCharsList.h"
class nsStringCharsList : public nsCharsList {
public:
nsStringCharsList(nsString& aList);
virtual ~nsStringCharsList();
virtual PRUnichar Get( PRUint32 aIdx) ;
virtual PRUint32 Length() ;
private:
nsString mList;
};
#endif /* nsStringCharsList_h__ */