1998-12-21 16:51:10 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
2004-04-17 21:52:36 +00:00
|
|
|
* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
1998-12-21 16:51:10 +00:00
|
|
|
*
|
2004-04-17 21:52:36 +00:00
|
|
|
* 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.
|
1998-12-21 16:51:10 +00:00
|
|
|
*
|
|
|
|
* The Original Code is Mozilla Communicator client code.
|
|
|
|
*
|
2004-04-17 21:52:36 +00:00
|
|
|
* 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.
|
1999-11-06 03:40:37 +00:00
|
|
|
*
|
2004-04-17 21:52:36 +00:00
|
|
|
* ***** END LICENSE BLOCK *****
|
2000-04-05 02:37:25 +00:00
|
|
|
*
|
|
|
|
*
|
|
|
|
* This Original Code has been modified by IBM Corporation.
|
|
|
|
* Modifications made by IBM described herein are
|
|
|
|
* Copyright (c) International Business Machines
|
|
|
|
* Corporation, 2000
|
|
|
|
*
|
|
|
|
* Modifications to Mozilla code or documentation
|
|
|
|
* identified per MPL Section 3.3
|
|
|
|
*
|
|
|
|
* Date Modified by Description of modification
|
|
|
|
* 03/27/2000 IBM Corp. Added PR_CALLBACK for Optlink
|
|
|
|
* use in OS2
|
1998-12-21 16:51:10 +00:00
|
|
|
*/
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 17:42:36 +00:00
|
|
|
#ifndef nsScriptNameSpaceManager_h__
|
|
|
|
#define nsScriptNameSpaceManager_h__
|
1998-12-21 16:51:10 +00:00
|
|
|
|
|
|
|
#include "nsIScriptNameSpaceManager.h"
|
2002-01-17 04:08:14 +00:00
|
|
|
#include "nsString.h"
|
|
|
|
#include "nsID.h"
|
|
|
|
#include "pldhash.h"
|
1998-12-21 16:51:10 +00:00
|
|
|
|
2002-03-04 02:25:08 +00:00
|
|
|
#include "nsDOMClassInfo.h"
|
2002-08-30 08:48:58 +00:00
|
|
|
|
2001-07-11 09:09:30 +00:00
|
|
|
struct nsGlobalNameStruct
|
|
|
|
{
|
2002-08-30 08:48:58 +00:00
|
|
|
struct ConstructorAlias
|
|
|
|
{
|
|
|
|
nsCID mCID;
|
|
|
|
nsString mProtoName;
|
|
|
|
nsGlobalNameStruct* mProto;
|
|
|
|
};
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 17:42:36 +00:00
|
|
|
enum nametype {
|
2002-01-17 04:08:14 +00:00
|
|
|
eTypeNotInitialized,
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 17:42:36 +00:00
|
|
|
eTypeInterface,
|
|
|
|
eTypeProperty,
|
2001-07-11 09:09:30 +00:00
|
|
|
eTypeExternalConstructor,
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 17:42:36 +00:00
|
|
|
eTypeStaticNameSet,
|
2001-07-11 09:09:30 +00:00
|
|
|
eTypeDynamicNameSet,
|
|
|
|
eTypeClassConstructor,
|
2002-03-04 02:25:08 +00:00
|
|
|
eTypeClassProto,
|
|
|
|
eTypeExternalClassInfoCreator,
|
2002-08-30 08:48:58 +00:00
|
|
|
eTypeExternalClassInfo,
|
|
|
|
eTypeExternalConstructorAlias
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 17:42:36 +00:00
|
|
|
} mType;
|
|
|
|
|
2007-06-26 14:44:20 +00:00
|
|
|
PRBool mPrivilegedOnly;
|
|
|
|
|
2001-07-11 09:09:30 +00:00
|
|
|
union {
|
2001-11-22 04:58:09 +00:00
|
|
|
PRInt32 mDOMClassInfoID; // eTypeClassConstructor
|
2003-01-22 03:22:35 +00:00
|
|
|
nsIID mIID; // eTypeInterface, eTypeClassProto
|
2002-03-04 02:25:08 +00:00
|
|
|
nsExternalDOMClassInfoData* mData; // eTypeExternalClassInfo
|
2002-08-30 08:48:58 +00:00
|
|
|
ConstructorAlias* mAlias; // eTypeExternalConstructorAlias
|
2001-11-22 04:58:09 +00:00
|
|
|
nsCID mCID; // All other types...
|
2001-07-11 09:09:30 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
// copy constructor
|
|
|
|
};
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 17:42:36 +00:00
|
|
|
|
|
|
|
|
|
|
|
class nsIScriptContext;
|
|
|
|
class nsICategoryManager;
|
2009-06-03 15:30:18 +00:00
|
|
|
class GlobalNameMapEntry;
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 17:42:36 +00:00
|
|
|
|
|
|
|
|
|
|
|
class nsScriptNameSpaceManager
|
|
|
|
{
|
|
|
|
public:
|
1998-12-21 16:51:10 +00:00
|
|
|
nsScriptNameSpaceManager();
|
|
|
|
virtual ~nsScriptNameSpaceManager();
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 17:42:36 +00:00
|
|
|
nsresult Init();
|
|
|
|
nsresult InitForContext(nsIScriptContext *aContext);
|
|
|
|
|
2002-01-17 04:08:14 +00:00
|
|
|
// Returns a nsGlobalNameStruct for aName, or null if one is not
|
|
|
|
// found. The returned nsGlobalNameStruct is only guaranteed to be
|
|
|
|
// valid until the next call to any of the methods in this class.
|
2003-01-31 12:10:13 +00:00
|
|
|
// It also returns a pointer to the string buffer of the classname
|
|
|
|
// in the nsGlobalNameStruct.
|
2002-01-17 04:08:14 +00:00
|
|
|
nsresult LookupName(const nsAString& aName,
|
2003-01-31 12:10:13 +00:00
|
|
|
const nsGlobalNameStruct **aNameStruct,
|
|
|
|
const PRUnichar **aClassName = nsnull);
|
1998-12-21 16:51:10 +00:00
|
|
|
|
2001-07-11 09:09:30 +00:00
|
|
|
nsresult RegisterClassName(const char *aClassName,
|
2009-06-03 15:30:18 +00:00
|
|
|
PRInt32 aDOMClassInfoID,
|
|
|
|
const PRUnichar **aResult);
|
2001-07-11 09:09:30 +00:00
|
|
|
|
|
|
|
nsresult RegisterClassProto(const char *aClassName,
|
|
|
|
const nsIID *aConstructorProtoIID,
|
|
|
|
PRBool *aFoundOld);
|
|
|
|
|
2002-03-04 02:25:08 +00:00
|
|
|
nsresult RegisterExternalInterfaces(PRBool aAsProto);
|
|
|
|
|
|
|
|
nsresult RegisterExternalClassName(const char *aClassName,
|
|
|
|
nsCID& aCID);
|
|
|
|
|
|
|
|
// Register the info for an external class. aName must be static
|
|
|
|
// data, it will not be deleted by the DOM code.
|
|
|
|
nsresult RegisterDOMCIData(const char *aName,
|
|
|
|
nsDOMClassInfoExternalConstructorFnc aConstructorFptr,
|
|
|
|
const nsIID *aProtoChainInterface,
|
|
|
|
const nsIID **aInterfaces,
|
|
|
|
PRUint32 aScriptableFlags,
|
|
|
|
PRBool aHasClassInterface,
|
|
|
|
const nsCID *aConstructorCID);
|
|
|
|
|
2002-08-30 08:48:58 +00:00
|
|
|
nsGlobalNameStruct* GetConstructorProto(const nsGlobalNameStruct* aStruct);
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 17:42:36 +00:00
|
|
|
protected:
|
2002-01-17 04:08:14 +00:00
|
|
|
// Adds a new entry to the hash and returns the nsGlobalNameStruct
|
|
|
|
// that aKey will be mapped to. If mType in the returned
|
|
|
|
// nsGlobalNameStruct is != eTypeNotInitialized, an entry for aKey
|
|
|
|
// already existed.
|
2009-06-03 15:30:18 +00:00
|
|
|
nsGlobalNameStruct *AddToHash(const char *aKey,
|
|
|
|
const PRUnichar **aClassName = nsnull);
|
2002-01-17 04:08:14 +00:00
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 17:42:36 +00:00
|
|
|
nsresult FillHash(nsICategoryManager *aCategoryManager,
|
|
|
|
const char *aCategory,
|
2007-06-26 14:44:20 +00:00
|
|
|
nsGlobalNameStruct::nametype aType,
|
|
|
|
PRBool aPrivilegedOnly);
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 17:42:36 +00:00
|
|
|
nsresult FillHashWithDOMInterfaces();
|
2003-01-22 03:22:35 +00:00
|
|
|
nsresult RegisterInterface(const char* aIfName,
|
|
|
|
const nsIID *aIfIID,
|
2002-03-04 02:25:08 +00:00
|
|
|
PRBool* aFoundOld);
|
1998-12-21 16:51:10 +00:00
|
|
|
|
2002-01-17 04:08:14 +00:00
|
|
|
// Inline PLDHashTable, init with PL_DHashTableInit() and delete
|
|
|
|
// with PL_DHashTableFinish().
|
|
|
|
PLDHashTable mGlobalNames;
|
|
|
|
|
|
|
|
PRPackedBool mIsInitialized;
|
1998-12-21 16:51:10 +00:00
|
|
|
};
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 17:42:36 +00:00
|
|
|
#endif /* nsScriptNameSpaceManager_h__ */
|