mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-13 18:27:35 +00:00
add several new files
This commit is contained in:
parent
c09c0b34f3
commit
e392b10497
28
intl/uconv/src/nsPlatformCharsetFactory.h
Normal file
28
intl/uconv/src/nsPlatformCharsetFactory.h
Normal file
@ -0,0 +1,28 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (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/NPL/
|
||||
*
|
||||
* 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 Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are Copyright (C) 1998
|
||||
* Netscape Communications Corporation. All Rights Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsPlatformCharsetFactory_h__
|
||||
#define nsPlatformCharsetFactory_h__
|
||||
|
||||
|
||||
#include "nsIFactory.h"
|
||||
|
||||
nsIFactory* NEW_PLATFORMCHARSETFACTORY();
|
||||
|
||||
#endif /* nsPlatformCharsetFactory_h__ */
|
99
intl/uconv/src/nsWinCharset.cpp
Normal file
99
intl/uconv/src/nsWinCharset.cpp
Normal file
@ -0,0 +1,99 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (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/NPL/
|
||||
*
|
||||
* 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 Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are Copyright (C) 1998
|
||||
* Netscape Communications Corporation. All Rights Reserved.
|
||||
*/
|
||||
|
||||
|
||||
#define NS_IMPL_IDS
|
||||
|
||||
#include "nsWinCharset.h"
|
||||
#include "nsPlatformCharsetFactory.h"
|
||||
#include "pratom.h"
|
||||
|
||||
#include "nsUConvDll.h"
|
||||
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsWinCharset, kIPlatformCharsetIID);
|
||||
|
||||
nsWinCharset::nsWinCharset()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
PR_AtomicIncrement(&g_InstanceCount);
|
||||
}
|
||||
nsWinCharset::~nsWinCharset()
|
||||
{
|
||||
PR_AtomicDecrement(&g_InstanceCount);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWinCharset::GetCharset(nsPlatformCharsetSel selector, nsString& oResult)
|
||||
{
|
||||
oResult = "ISO-8859-1"; // XXX- hack to be implement
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
class nsWinCharsetFactory : public nsIFactory {
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
public:
|
||||
nsWinCharsetFactory() {
|
||||
}
|
||||
~nsWinCharsetFactory() {
|
||||
}
|
||||
|
||||
NS_IMETHOD CreateInstance(nsISupports* aDelegate, const nsIID& aIID, void** aResult);
|
||||
NS_IMETHOD LockFactory(PRBool aLock);
|
||||
|
||||
};
|
||||
|
||||
NS_DEFINE_IID( kIFactoryIID, NS_IFACTORY_IID);
|
||||
NS_IMPL_ISUPPORTS( nsWinCharsetFactory , NS_IFACTORY_IID);
|
||||
|
||||
NS_IMETHODIMP nsWinCharsetFactory::CreateInstance(
|
||||
nsISupports* aDelegate, const nsIID &aIID, void** aResult)
|
||||
{
|
||||
if(NULL == aResult)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
if(NULL != aDelegate)
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
|
||||
*aResult = NULL;
|
||||
nsISupports *inst = new nsWinCharset();
|
||||
if(NULL == inst) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
nsresult res =inst->QueryInterface(aIID, aResult);
|
||||
if(NS_FAILED(res)) {
|
||||
delete inst;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
NS_IMETHODIMP nsWinCharsetFactory::LockFactory(PRBool aLock)
|
||||
{
|
||||
if(aLock)
|
||||
PR_AtomicIncrement( &g_LockCount );
|
||||
else
|
||||
PR_AtomicDecrement( &g_LockCount );
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIFactory* NEW_PLATFORMCHARSETFACTORY()
|
||||
{
|
||||
return new nsWinCharsetFactory();
|
||||
}
|
||||
|
38
intl/uconv/src/nsWinCharset.h
Normal file
38
intl/uconv/src/nsWinCharset.h
Normal file
@ -0,0 +1,38 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (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/NPL/
|
||||
*
|
||||
* 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 Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are Copyright (C) 1998
|
||||
* Netscape Communications Corporation. All Rights Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsWinCharset_h__
|
||||
#define nsWinCharset_h__
|
||||
|
||||
#include "nsIPlatformCharset.h"
|
||||
|
||||
class nsWinCharset : public nsIPlatformCharset
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
public:
|
||||
|
||||
nsWinCharset();
|
||||
~nsWinCharset();
|
||||
|
||||
NS_IMETHOD GetCharset(nsPlatformCharsetSel selector, nsString& oResult);
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsWinCharset_h__ */
|
Loading…
Reference in New Issue
Block a user