add new files

This commit is contained in:
ftang%netscape.com 1999-05-04 19:35:20 +00:00
parent f88db81a84
commit 9c00d7d74b
3 changed files with 338 additions and 0 deletions

View File

@ -0,0 +1,221 @@
##
## The contents of this file are subject to the Netscape Public License
## Version 1.0 (the "NPL"); you may not use this file except in
## compliance with the NPL. You may obtain a copy of the NPL at
## http://www.mozilla.org/NPL/
##
## Software distributed under the NPL is distributed on an "AS IS" basis,
## WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
## for the specific language governing rights and limitations under the
## NPL.
##
## The Initial Developer of this code under the NPL is Netscape
## Communications Corporation. Portions created by Netscape are
## Copyright (C) 1999 Netscape Communications Corporation. All Rights
## Reserved.
##
## Rule of this file:
## 1. key should always be in lower case ascii so we can do case insensitive
## comparision in the code faster.
## 2. value should be the one used in unicode converter
## 3. If you want to add more charset, mailto:ftang@netscape.com
##
##
iso-8859-1=ISO-8859-1
iso-8859-2=ISO-8859-2
iso-8859-3=ISO-8859-3
iso-8859-4=ISO-8859-4
iso-8859-5=ISO-8859-5
iso-8859-6=ISO-8859-6
iso-8859-7=ISO-8859-7
iso-8859-8=ISO-8859-8
iso-8859-9=ISO-8859-9
iso-8859-14=ISO-8859-14
iso-8859-15=ISO-8859-15
windows-1250=windows-1250
windows-1251=windows-1251
windows-1252=windows-1252
windows-1253=windows-1253
windows-1254=windows-1254
windows-1255=windows-1255
windows-1256=windows-1256
windows-1257=windows-1257
windows-1258=windows-1258
utf-8=UTF-8
shift_jis=Shift_JIS
euc-jp=EUC-JP
iso-2022-jp=ISO-2022-JP
big5=Big5
euc-kr=EUC-KR
gb2312=GB2312
viscii=VISCII
koi8-r=KOI8-R
koi8-u=KOI8-U
tis-620=tis-620
##
## Netscape private ...
##
x-euc-tw=x-euc-tw
x-mac-roman=x-mac-roman
x-mac-ce=x-mac-ce
x-mac-turkish=x-mac-turkish
x-mac-greek=x-mac-greek
x-mac-icelandic=x-mac-icelandic
x-mac-croatian=x-mac-croatian
x-mac-romanian=x-mac-romanian
x-mac-cyrillic=x-mac-cyrillic
x-mac-ukrainian=x-mac-ukrainian
armscii-8=armscii-8
x-viet-tcvn5712=x-viet-tcvn5712
x-viet-vps=x-viet-vps
##
## Aliases for ISO-8859-1
##
latin1=ISO-8859-1
iso_8859-1=ISO-8859-1
# Currently .properties cannot handle : in key
# iso_8859-1:1987=ISO-8859-1
iso-ir-100=ISO-8859-1
l1=ISO-8859-1
ibm819=ISO-8859-1
cp819=ISO-8859-1
csisolatin1=ISO-8859-1
##
## Aliases for ISO-8859-2
##
latin2=ISO-8859-2
iso_8859-2=ISO-8859-2
# Currently .properties cannot handle : in key
# iso_8859-2:1987=ISO-8859-2
iso-ir-101=ISO-8859-2
l2=ISO-8859-2
csisolatin2=ISO-8859-2
##
## Aliases for ISO-8859-3
##
latin3=ISO-8859-3
iso_8859-3=ISO-8859-3
# Currently .properties cannot handle : in key
#iso_8859-3:1988=ISO-8859-3
iso-ir-109=ISO-8859-3
l3=ISO-8859-3
csisolatin3=ISO-8859-3
##
## Aliases for ISO-8859-4
##
latin4=ISO-8859-4
iso_8859-4=ISO-8859-4
# Currently .properties cannot handle : in key
#iso_8859-4:1988=ISO-8859-4
iso-ir-110=ISO-8859-4
l4=ISO-8859-4
csisolatin4=ISO-8859-4
##
## Aliases for ISO-8859-5
##
cyrillic=ISO-8859-5
iso_8859-5=ISO-8859-5
# Currently .properties cannot handle : in key
#iso_8859-5:1988=ISO-8859-5
iso-ir-144=ISO-8859-5
csisolatincyrillic=ISO-8859-5
##
## Aliases for ISO-8859-6
##
arabic=ISO-8859-6
iso_8859-6=ISO-8859-6
# Currently .properties cannot handle : in key
#iso_8859-6:1987=ISO-8859-6
iso-ir-127=ISO-8859-6
ecma-114=ISO-8859-6
asmo-708=ISO-8859-6
csisolatinarabic=ISO-8859-6
##
## Aliases for ISO-8859-7
##
greek=ISO-8859-7
greek8=ISO-8859-7
iso_8859-7=ISO-8859-7
# Currently .properties cannot handle : in key
#iso_8859-7:1987=ISO-8859-7
iso-ir-126=ISO-8859-7
elot_928=ISO-8859-7
ecma-118=ISO-8859-7
csisolatingreek=ISO-8859-7
##
## Aliases for ISO-8859-8
##
hebrew=ISO-8859-8
iso_8859-8=ISO-8859-8
# Currently .properties cannot handle : in key
#iso_8859-8:1988=ISO-8859-8
iso-ir-138=ISO-8859-8
csisolatinhebrew=ISO-8859-8
##
## Aliases for ISO-8859-9
##
latin5=ISO-8859-9
iso_8859-9=ISO-8859-9
# Currently .properties cannot handle : in key
#iso_8859-9:1989=ISO-8859-9
iso-ir-148=ISO-8859-9
l5=ISO-8859-9
csisolatin5=ISO-8859-9
##
## Aliases for UTF-8
##
unicode-1-1-utf-8=UTF-8
##
## Aliases for Shift_JIS
##
x-sjis=Shift_JIS
ms_kanji=Shift_JIS
csshiftjis=Shift_JIS
windows-31j=Shift_JIS
##
## Aliases for EUC_JP
##
cseucjpkdfmtjapanese=EUC-JP
x-euc-jp=EUC-JP
##
## Aliases for ISO-2022-JP
##
csiso2022jp=ISO-2022-JP
##
## Aliases for Big5
##
csbig5=Big5
# x-x-big5 is not really a alias for Big5, add it only for MS FrontPage
x-x-big5=Big5
##
## Aliases for EUC-KR
##
csueckr=EUC-KR
# The following are really not aliases EUC-KR, add them only for MS FrontPage
ks_c_5601-1987=EUC-KR
iso-ir-149=EUC-KR
ks_c_5601-1989=EUC-KR
ksc_5601=EUC-KR
korean=EUC-KR
csksc56011987=EUC-KR
##
## Aliases for GB2312
##
# The following are really not aliases GB2312, add them only for MS FrontPage
gb_2312-80=GB2312
iso-ir-58=GB2312
chinese=GB2312
csiso58gb231280=GB2312
csgb2312=GB2312
##
## Aliases for windows-125x
##
x-cp1250=windows-1250
x-cp1251=windows-1251
x-cp1252=windows-1252
x-cp1253=windows-1253
x-cp1254=windows-1254
x-cp1255=windows-1255
x-cp1256=windows-1256
x-cp1257=windows-1257
x-cp1258=windows-1258

View File

@ -0,0 +1,79 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "nsURLProperties.h"
#include "nsIServiceManager.h"
#include "nsIComponentManager.h"
#include "nsIURL.h"
#include "nsINetService.h"
static NS_DEFINE_IID(kINetServiceIID, NS_INETSERVICE_IID);
static NS_DEFINE_IID(kIPersistentPropertiesIID, NS_IPERSISTENTPROPERTIES_IID);
static NS_DEFINE_IID(kNetServiceCID, NS_NETSERVICE_CID);
nsURLProperties::nsURLProperties(nsString& aUrl)
{
mDelegate = nsnull;
nsresult res = NS_OK;
nsINetService* pNetService = nsnull;
if(NS_SUCCEEDED(res))
res = nsServiceManager::GetService( kNetServiceCID,
kINetServiceIID,
(nsISupports**) &pNetService);
nsIURL* url = nsnull;
if(NS_SUCCEEDED(res))
res = pNetService->CreateURL(&url, aUrl, nsnull, nsnull, nsnull);
nsIInputStream* in=nsnull;
if(NS_SUCCEEDED(res))
res = pNetService->OpenBlockingStream(url, nsnull, &in);
if(NS_SUCCEEDED(res))
res = nsComponentManager::CreateInstance(kPersistentPropertiesCID, NULL,
kIPersistentPropertiesIID,
(void**)&mDelegate);
if(NS_SUCCEEDED(res))
res = mDelegate->Load(in);
if(NS_FAILED(res)) {
NS_IF_RELEASE(mDelegate);
mDelegate=nsnull;
}
if(pNetService)
res = nsServiceManager::ReleaseService( kNetServiceCID,
pNetService);
NS_IF_RELEASE(in);
}
nsURLProperties::~nsURLProperties()
{
NS_IF_RELEASE(mDelegate);
}
NS_IMETHODIMP nsURLProperties::Get(const nsString& aKey, nsString& oValue)
{
if(mDelegate)
return mDelegate->GetProperty(aKey, oValue);
else
return NS_ERROR_FAILURE;
}

View File

@ -0,0 +1,38 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsURLProperties_h__
#define nsURLProperties_h__
#include "nsIProperties.h"
#include "nsString.h"
class nsURLProperties {
public:
nsURLProperties(nsString& aUrl);
~nsURLProperties();
NS_IMETHOD Get( const nsString& aKey, nsString& value);
private:
nsIPersistentProperties *mDelegate;
};
#endif /* nsURLProperties_h__ */