add several new files

This commit is contained in:
ftang%netscape.com 1999-02-23 09:48:43 +00:00
parent c09c0b34f3
commit e392b10497
3 changed files with 165 additions and 0 deletions

View 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__ */

View 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();
}

View 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__ */