This commit is contained in:
dougt%netscape.com 2003-03-15 01:57:22 +00:00
Родитель 038bafed45
Коммит b23665411c
17 изменённых файлов: 778 добавлений и 38 удалений

Просмотреть файл

@ -27,13 +27,16 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = xpcom_obsolete
LIBRARY_NAME = xpcom_obsolete
LIBRARY_NAME = xpcom_compat
# Do not set EXPORT_LIBRARY as we do not want xpcom in the static libs list
#EXPORT_LIBRARY = 1
EXPORT_LIBRARY = 1
GRE_MODULE = 1
DIRS = component
REQUIRES = xpcom \
mozreg \
libreg \
string \
$(NULL)
@ -44,34 +47,45 @@ endif
CPPSRCS = \
nsFileSpec.cpp \
nsFileSpecImpl.cpp \
nsFileStream.cpp \
nsIFileStream.cpp \
nsFileSpecImpl.cpp \
nsSpecialSystemDirectory.cpp \
$(NULL)
ifeq ($(OS_ARCH),WINNT)
CPPSRCS += dlldeps.cpp
endif
EXPORTS = \
nsFileSpec.h \
nsFileStream.h \
nsIFileStream.h \
nsSpecialSystemDirectory.h \
nsIRegistryUtils.h \
$(NULL)
XPIDLSRCS = nsIFileSpec.idl
LOCAL_INCLUDES = \
-I$(srcdir)/../io \
$(NULL)
XPIDLSRCS = nsIFileSpec.idl \
nsIRegistry.idl \
$(NULL)
# Force use of PIC
FORCE_USE_PIC = 1
FORCE_SHARED_LIB = 1
SHARED_LIBRARY_LIBS = \
$(DIST)/lib/$(LIB_PREFIX)mozreg_s.$(LIB_SUFFIX) \
$(NULL)
include $(topsrcdir)/config/rules.mk
DEFINES += \
-D_IMPL_NS_COM
DEFINES += -D_IMPL_NS_COM
EXTRA_DSO_LDOPTS += $(MOZ_COMPONENT_LIBS)

Просмотреть файл

@ -26,8 +26,8 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = xpobsolete
LIBRARY_NAME = xpobsolete
MODULE = xpcom_compat_c
LIBRARY_NAME = xpcom_compat_c
EXPORT_LIBRARY = 1
IS_COMPONENT = 1
GRE_MODULE = 1
@ -44,10 +44,6 @@ CPPSRCS = \
$(NULL)
EXPORTS = nsIRegistryUtils.h
XPIDLSRCS = nsIRegistry.idl
LOCAL_INCLUDES = \
-I$(srcdir)/../ \
$(NULL)
@ -59,7 +55,7 @@ FORCE_SHARED_LIB = 1
EXTRA_DSO_LDOPTS += $(MOZ_COMPONENT_LIBS) \
$(DIST)/lib/$(LIB_PREFIX)xpcom_obsolete.$(LIB_SUFFIX) \
$(MOZ_XPCOM_OBSOLETE_LIBS) \
$(NULL)

Просмотреть файл

@ -0,0 +1,50 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape 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/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.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 2003
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either 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 NPL, 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 NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
// Force references to all of the symbols that we want exported from
// the dll that are located in the .lib files we link with
#include "nsFileSpec.h"
#include "NSReg.h"
void XXXNeverCalled()
{
nsFileURL(NULL);
nsFileSpec s;
NR_RegSetBufferSize(NULL, 0);
}

Просмотреть файл

@ -0,0 +1,50 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape 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/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.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 2003
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either 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 NPL, 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 NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
// Force references to all of the symbols that we want exported from
// the dll that are located in the .lib files we link with
#include "nsFileSpec.h"
#include "NSReg.h"
void XXXNeverCalled()
{
nsFileURL(NULL);
nsFileSpec s;
NR_RegSetBufferSize(NULL, 0);
}

Просмотреть файл

@ -776,7 +776,7 @@ NS_IMETHODIMP nsDirectoryIteratorImpl::GetCurrentSpec(nsIFileSpec * *aCurrentSpe
}
//----------------------------------------------------------------------------------------
NS_METHOD nsDirectoryIteratorImpl::Create(nsISupports* outer, const nsIID& aIID, void* *aIFileSpec)
NS_IMETHODIMP nsDirectoryIteratorImpl::Create(nsISupports* outer, const nsIID& aIID, void* *aIFileSpec)
//----------------------------------------------------------------------------------------
{
if (aIFileSpec == NULL)
@ -796,7 +796,7 @@ NS_METHOD nsDirectoryIteratorImpl::Create(nsISupports* outer, const nsIID& aIID,
}
//----------------------------------------------------------------------------------------
NS_METHOD nsFileSpecImpl::Create(nsISupports* outer, const nsIID& aIID, void* *aIFileSpec)
NS_IMETHODIMP nsFileSpecImpl::Create(nsISupports* outer, const nsIID& aIID, void* *aIFileSpec)
//----------------------------------------------------------------------------------------
{
if (aIFileSpec == NULL)

Просмотреть файл

@ -38,11 +38,12 @@
#ifndef _FILESPECIMPL_H_
#define _FILESPECIMPL_H_
#include "nscore.h"
#include "nsIFileSpec.h"
#include "nsFileSpec.h"
//========================================================================================
class nsFileSpecImpl
class NS_COM nsFileSpecImpl
//========================================================================================
: public nsIFileSpec
{
@ -79,7 +80,7 @@ class nsFileSpecImpl
}; // class nsFileSpecImpl
//========================================================================================
class nsDirectoryIteratorImpl
class NS_COM nsDirectoryIteratorImpl
//========================================================================================
: public nsIDirectoryIterator
{

Просмотреть файл

@ -0,0 +1,167 @@
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "MPL"); you may not use this file except in
* compliance with the MPL. You may obtain a copy of the MPL at
* http://www.mozilla.org/MPL/
*
* Software distributed under the MPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the MPL
* for the specific language governing rights and limitations under the
* MPL.
*
* The Initial Developer of this code under the MPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1999 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "nsISupports.idl"
#include "nsIEnumerator.idl"
interface nsIFile;
typedef PRUint32 nsRegistryKey;
typedef long nsWellKnownRegistry;
[scriptable,uuid(5D41A440-8E37-11d2-8059-00600811A9C3)]
interface nsIRegistry : nsISupports
{
const long None = 0;
const long Users = 1;
const long Common = 2;
const long CurrentUser = 3;
const long ApplicationComponentRegistry = 1;
const long ApplicationRegistry = 2;
// Dont use this one. This for internal use only.
const long ApplicationCustomRegistry = -1;
void open(in nsIFile regFile);
void openWellKnownRegistry(in nsWellKnownRegistry regid);
void flush();
boolean isOpen();
nsRegistryKey addKey(in nsRegistryKey baseKey, in wstring keyname);
nsRegistryKey getKey(in nsRegistryKey baseKey, in wstring keyname);
void removeKey(in nsRegistryKey baseKey, in wstring keyname);
wstring getString(in nsRegistryKey baseKey, in wstring valname);
void setString(in nsRegistryKey baseKey, in wstring valname, in wstring value);
string getStringUTF8(in nsRegistryKey baseKey, in string path);
void setStringUTF8(in nsRegistryKey baseKey, in string path, in string value);
void getBytesUTF8(in nsRegistryKey baseKey, in string path, out PRUint32 length, [retval, array, size_is(length)] out PRUint8 valueArray);
void setBytesUTF8(in nsRegistryKey baseKey, in string path, in PRUint32 length, [array, size_is(length)] in PRUint8 valueArray);
PRInt32 getInt(in nsRegistryKey baseKey, in string path);
void setInt(in nsRegistryKey baseKey, in string path, in PRInt32 value);
PRInt64 getLongLong(in nsRegistryKey baseKey, in string path);
void setLongLong(in nsRegistryKey baseKey, in string path, inout PRInt64 value);
/**
* addSubtree() and friends need to be renamed to addKeyUTF8().
* If you are using these forms make sure you pass UTF8 data
*/
nsRegistryKey addSubtree(in nsRegistryKey baseKey, in string path);
void removeSubtree(in nsRegistryKey baseKey, in string path);
nsRegistryKey getSubtree(in nsRegistryKey baseKey, in string path);
nsRegistryKey addSubtreeRaw(in nsRegistryKey baseKey, in string path);
void removeSubtreeRaw(in nsRegistryKey baseKey, in string path);
nsRegistryKey getSubtreeRaw(in nsRegistryKey baseKey, in string path);
nsIEnumerator enumerateSubtrees(in nsRegistryKey baseKey);
nsIEnumerator enumerateAllSubtrees(in nsRegistryKey baseKey);
nsIEnumerator enumerateValues(in nsRegistryKey baseKey);
const unsigned long String = 1;
const unsigned long Int32 = 2;
const unsigned long Bytes = 3;
const unsigned long File = 4;
unsigned long getValueType(in nsRegistryKey baseKey, in string path);
PRUint32 getValueLength(in nsRegistryKey baseKey, in string path);
void deleteValue(in nsRegistryKey baseKey, in string path);
/**
* escapeKey() takes arbitrary binary data and converts it into
* valid ASCII which can be used as registry key or value names
*/
void escapeKey([array, size_is(length)] in PRUint8 key, in PRUint32 terminator, inout PRUint32 length, [retval, array, size_is(length)] out PRUint8 escaped);
void unescapeKey([array, size_is(length)] in PRUint8 escaped, in PRUint32 terminator, inout PRUint32 length, [retval, array, size_is(length)] out PRUint8 key);
attribute string currentUserName;
void pack();
};
[scriptable, uuid(8cecf236-1dd2-11b2-893c-f9848956eaec)]
interface nsIRegistryEnumerator : nsIEnumerator
{
void currentItemInPlaceUTF8(out nsRegistryKey key,
[shared, retval] out string item);
};
[scriptable, uuid(D1B54831-AC07-11d2-805E-00600811A9C3)]
interface nsIRegistryNode : nsISupports
{
readonly attribute string nameUTF8;
readonly attribute wstring name;
readonly attribute nsRegistryKey key;
};
[scriptable,uuid(5316C380-B2F8-11d2-A374-0080C6F80E4B)]
interface nsIRegistryValue : nsISupports
{
readonly attribute wstring name;
readonly attribute string nameUTF8;
readonly attribute unsigned long type;
readonly attribute PRUint32 length;
};
[uuid(3A15FC88-7A61-4Ab4-8E58-31E95fAB3DA8)]
/**
* It sucks that nsIRegistry has to always allocate and return
* strings. nsIRegistryGetter adds in interfaces for non allocating getters
* to registry values.
*/
interface nsIRegistryGetter : nsISupports
{
/**
* Get a string value of attribute valname in widestring or utf8 format
*
* @return
* NS_OK on success.
* buf has the string value copied into it. length is NOT changed.
* NS_ERROR_REG_BUFFER_TOO_SMALL if not enough buffer space.
* length is updated to actual length in chars including
* terminating NULL and buf will be unchanged.
* NS_ERROR_FAILURE if an unknown error happened. state of buf and
* length undefined.
* various failure codes otherwise. buf and length wont be updated.
*/
void getStringUTF8IntoBuffer(in nsRegistryKey baseKey, in string path,
inout char buf, inout PRUint32 length);
/**
* Get a a byte array value of attribute valname
*
* @return
* NS_OK on success. buf has the string value copied into it.
* length is updated to actual number of bytes copied into buf.
* NS_ERROR_REG_BUFFER_TOO_SMALL if not enough buffer space.
* length is updated to actual length in PRUint8s including
* terminating NULL and buf will be unchanged.
* NS_ERROR_FAILURE if an unknown error happened. state of buf and
* length undefined.
* various other failure codes otherwise. buf and length wont be updated.
*/
void getBytesUTF8IntoBuffer(in nsRegistryKey baseKey, in string path,
inout PRUint8 buf, inout PRUint32 length);
};
%{ C++
#include "nsIRegistryUtils.h"
%}

Просмотреть файл

@ -0,0 +1,63 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape 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/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.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 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 NPL, 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 NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef __nsIRegistryUtils_h
#define __nsIRegistryUtils_h
#define NS_REGISTRY_CONTRACTID "@mozilla.org/registry;1"
#define NS_REGISTRY_CLASSNAME "Mozilla Registry"
/* be761f00-a3b0-11d2-996c-0080c7cb1081 */
#define NS_REGISTRY_CID \
{ \
0xbe761f00, \
0xa3b0, \
0x11d2, \
{0x99, 0x6c, 0x00, 0x80, 0xc7, 0xcb, 0x10, 0x81} \
}
/*------------------------------- Error Codes ----------------------------------
------------------------------------------------------------------------------*/
#define NS_ERROR_REG_BADTYPE NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 1 )
#define NS_ERROR_REG_NO_MORE NS_ERROR_GENERATE_SUCCESS( NS_ERROR_MODULE_REG, 2 )
#define NS_ERROR_REG_NOT_FOUND NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 3 )
#define NS_ERROR_REG_NOFILE NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 4 )
#define NS_ERROR_REG_BUFFER_TOO_SMALL NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 5 )
#define NS_ERROR_REG_NAME_TOO_LONG NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 6 )
#define NS_ERROR_REG_NO_PATH NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 7 )
#define NS_ERROR_REG_READ_ONLY NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 8 )
#define NS_ERROR_REG_BAD_UTF8 NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 9 )
#endif

Просмотреть файл

@ -0,0 +1,54 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape 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/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.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 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 NPL, 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 NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsXPCOM.h"
#include "nsIGenericFactory.h"
#include "nsFileSpecImpl.h"
#define COMPONENT(NAME, Ctor) \
{ NS_##NAME##_CLASSNAME, NS_##NAME##_CID, NS_##NAME##_CONTRACTID, Ctor }
static const nsModuleComponentInfo components[] =
{
COMPONENT(FILESPEC, nsFileSpecImpl::Create),
COMPONENT(DIRECTORYITERATOR, nsDirectoryIteratorImpl::Create),
};
NS_IMPL_NSGETMODULE(xpcomObsoleteModule, components)

Просмотреть файл

@ -27,13 +27,16 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = xpcom_obsolete
LIBRARY_NAME = xpcom_obsolete
LIBRARY_NAME = xpcom_compat
# Do not set EXPORT_LIBRARY as we do not want xpcom in the static libs list
#EXPORT_LIBRARY = 1
EXPORT_LIBRARY = 1
GRE_MODULE = 1
DIRS = component
REQUIRES = xpcom \
mozreg \
libreg \
string \
$(NULL)
@ -44,34 +47,45 @@ endif
CPPSRCS = \
nsFileSpec.cpp \
nsFileSpecImpl.cpp \
nsFileStream.cpp \
nsIFileStream.cpp \
nsFileSpecImpl.cpp \
nsSpecialSystemDirectory.cpp \
$(NULL)
ifeq ($(OS_ARCH),WINNT)
CPPSRCS += dlldeps.cpp
endif
EXPORTS = \
nsFileSpec.h \
nsFileStream.h \
nsIFileStream.h \
nsSpecialSystemDirectory.h \
nsIRegistryUtils.h \
$(NULL)
XPIDLSRCS = nsIFileSpec.idl
LOCAL_INCLUDES = \
-I$(srcdir)/../io \
$(NULL)
XPIDLSRCS = nsIFileSpec.idl \
nsIRegistry.idl \
$(NULL)
# Force use of PIC
FORCE_USE_PIC = 1
FORCE_SHARED_LIB = 1
SHARED_LIBRARY_LIBS = \
$(DIST)/lib/$(LIB_PREFIX)mozreg_s.$(LIB_SUFFIX) \
$(NULL)
include $(topsrcdir)/config/rules.mk
DEFINES += \
-D_IMPL_NS_COM
DEFINES += -D_IMPL_NS_COM
EXTRA_DSO_LDOPTS += $(MOZ_COMPONENT_LIBS)

Просмотреть файл

@ -26,8 +26,8 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = xpobsolete
LIBRARY_NAME = xpobsolete
MODULE = xpcom_compat_c
LIBRARY_NAME = xpcom_compat_c
EXPORT_LIBRARY = 1
IS_COMPONENT = 1
GRE_MODULE = 1
@ -44,10 +44,6 @@ CPPSRCS = \
$(NULL)
EXPORTS = nsIRegistryUtils.h
XPIDLSRCS = nsIRegistry.idl
LOCAL_INCLUDES = \
-I$(srcdir)/../ \
$(NULL)
@ -59,7 +55,7 @@ FORCE_SHARED_LIB = 1
EXTRA_DSO_LDOPTS += $(MOZ_COMPONENT_LIBS) \
$(DIST)/lib/$(LIB_PREFIX)xpcom_obsolete.$(LIB_SUFFIX) \
$(MOZ_XPCOM_OBSOLETE_LIBS) \
$(NULL)

Просмотреть файл

@ -0,0 +1,50 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape 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/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.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 2003
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either 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 NPL, 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 NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
// Force references to all of the symbols that we want exported from
// the dll that are located in the .lib files we link with
#include "nsFileSpec.h"
#include "NSReg.h"
void XXXNeverCalled()
{
nsFileURL(NULL);
nsFileSpec s;
NR_RegSetBufferSize(NULL, 0);
}

Просмотреть файл

@ -776,7 +776,7 @@ NS_IMETHODIMP nsDirectoryIteratorImpl::GetCurrentSpec(nsIFileSpec * *aCurrentSpe
}
//----------------------------------------------------------------------------------------
NS_METHOD nsDirectoryIteratorImpl::Create(nsISupports* outer, const nsIID& aIID, void* *aIFileSpec)
NS_IMETHODIMP nsDirectoryIteratorImpl::Create(nsISupports* outer, const nsIID& aIID, void* *aIFileSpec)
//----------------------------------------------------------------------------------------
{
if (aIFileSpec == NULL)
@ -796,7 +796,7 @@ NS_METHOD nsDirectoryIteratorImpl::Create(nsISupports* outer, const nsIID& aIID,
}
//----------------------------------------------------------------------------------------
NS_METHOD nsFileSpecImpl::Create(nsISupports* outer, const nsIID& aIID, void* *aIFileSpec)
NS_IMETHODIMP nsFileSpecImpl::Create(nsISupports* outer, const nsIID& aIID, void* *aIFileSpec)
//----------------------------------------------------------------------------------------
{
if (aIFileSpec == NULL)

Просмотреть файл

@ -38,11 +38,12 @@
#ifndef _FILESPECIMPL_H_
#define _FILESPECIMPL_H_
#include "nscore.h"
#include "nsIFileSpec.h"
#include "nsFileSpec.h"
//========================================================================================
class nsFileSpecImpl
class NS_COM nsFileSpecImpl
//========================================================================================
: public nsIFileSpec
{
@ -79,7 +80,7 @@ class nsFileSpecImpl
}; // class nsFileSpecImpl
//========================================================================================
class nsDirectoryIteratorImpl
class NS_COM nsDirectoryIteratorImpl
//========================================================================================
: public nsIDirectoryIterator
{

Просмотреть файл

@ -0,0 +1,167 @@
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "MPL"); you may not use this file except in
* compliance with the MPL. You may obtain a copy of the MPL at
* http://www.mozilla.org/MPL/
*
* Software distributed under the MPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the MPL
* for the specific language governing rights and limitations under the
* MPL.
*
* The Initial Developer of this code under the MPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1999 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "nsISupports.idl"
#include "nsIEnumerator.idl"
interface nsIFile;
typedef PRUint32 nsRegistryKey;
typedef long nsWellKnownRegistry;
[scriptable,uuid(5D41A440-8E37-11d2-8059-00600811A9C3)]
interface nsIRegistry : nsISupports
{
const long None = 0;
const long Users = 1;
const long Common = 2;
const long CurrentUser = 3;
const long ApplicationComponentRegistry = 1;
const long ApplicationRegistry = 2;
// Dont use this one. This for internal use only.
const long ApplicationCustomRegistry = -1;
void open(in nsIFile regFile);
void openWellKnownRegistry(in nsWellKnownRegistry regid);
void flush();
boolean isOpen();
nsRegistryKey addKey(in nsRegistryKey baseKey, in wstring keyname);
nsRegistryKey getKey(in nsRegistryKey baseKey, in wstring keyname);
void removeKey(in nsRegistryKey baseKey, in wstring keyname);
wstring getString(in nsRegistryKey baseKey, in wstring valname);
void setString(in nsRegistryKey baseKey, in wstring valname, in wstring value);
string getStringUTF8(in nsRegistryKey baseKey, in string path);
void setStringUTF8(in nsRegistryKey baseKey, in string path, in string value);
void getBytesUTF8(in nsRegistryKey baseKey, in string path, out PRUint32 length, [retval, array, size_is(length)] out PRUint8 valueArray);
void setBytesUTF8(in nsRegistryKey baseKey, in string path, in PRUint32 length, [array, size_is(length)] in PRUint8 valueArray);
PRInt32 getInt(in nsRegistryKey baseKey, in string path);
void setInt(in nsRegistryKey baseKey, in string path, in PRInt32 value);
PRInt64 getLongLong(in nsRegistryKey baseKey, in string path);
void setLongLong(in nsRegistryKey baseKey, in string path, inout PRInt64 value);
/**
* addSubtree() and friends need to be renamed to addKeyUTF8().
* If you are using these forms make sure you pass UTF8 data
*/
nsRegistryKey addSubtree(in nsRegistryKey baseKey, in string path);
void removeSubtree(in nsRegistryKey baseKey, in string path);
nsRegistryKey getSubtree(in nsRegistryKey baseKey, in string path);
nsRegistryKey addSubtreeRaw(in nsRegistryKey baseKey, in string path);
void removeSubtreeRaw(in nsRegistryKey baseKey, in string path);
nsRegistryKey getSubtreeRaw(in nsRegistryKey baseKey, in string path);
nsIEnumerator enumerateSubtrees(in nsRegistryKey baseKey);
nsIEnumerator enumerateAllSubtrees(in nsRegistryKey baseKey);
nsIEnumerator enumerateValues(in nsRegistryKey baseKey);
const unsigned long String = 1;
const unsigned long Int32 = 2;
const unsigned long Bytes = 3;
const unsigned long File = 4;
unsigned long getValueType(in nsRegistryKey baseKey, in string path);
PRUint32 getValueLength(in nsRegistryKey baseKey, in string path);
void deleteValue(in nsRegistryKey baseKey, in string path);
/**
* escapeKey() takes arbitrary binary data and converts it into
* valid ASCII which can be used as registry key or value names
*/
void escapeKey([array, size_is(length)] in PRUint8 key, in PRUint32 terminator, inout PRUint32 length, [retval, array, size_is(length)] out PRUint8 escaped);
void unescapeKey([array, size_is(length)] in PRUint8 escaped, in PRUint32 terminator, inout PRUint32 length, [retval, array, size_is(length)] out PRUint8 key);
attribute string currentUserName;
void pack();
};
[scriptable, uuid(8cecf236-1dd2-11b2-893c-f9848956eaec)]
interface nsIRegistryEnumerator : nsIEnumerator
{
void currentItemInPlaceUTF8(out nsRegistryKey key,
[shared, retval] out string item);
};
[scriptable, uuid(D1B54831-AC07-11d2-805E-00600811A9C3)]
interface nsIRegistryNode : nsISupports
{
readonly attribute string nameUTF8;
readonly attribute wstring name;
readonly attribute nsRegistryKey key;
};
[scriptable,uuid(5316C380-B2F8-11d2-A374-0080C6F80E4B)]
interface nsIRegistryValue : nsISupports
{
readonly attribute wstring name;
readonly attribute string nameUTF8;
readonly attribute unsigned long type;
readonly attribute PRUint32 length;
};
[uuid(3A15FC88-7A61-4Ab4-8E58-31E95fAB3DA8)]
/**
* It sucks that nsIRegistry has to always allocate and return
* strings. nsIRegistryGetter adds in interfaces for non allocating getters
* to registry values.
*/
interface nsIRegistryGetter : nsISupports
{
/**
* Get a string value of attribute valname in widestring or utf8 format
*
* @return
* NS_OK on success.
* buf has the string value copied into it. length is NOT changed.
* NS_ERROR_REG_BUFFER_TOO_SMALL if not enough buffer space.
* length is updated to actual length in chars including
* terminating NULL and buf will be unchanged.
* NS_ERROR_FAILURE if an unknown error happened. state of buf and
* length undefined.
* various failure codes otherwise. buf and length wont be updated.
*/
void getStringUTF8IntoBuffer(in nsRegistryKey baseKey, in string path,
inout char buf, inout PRUint32 length);
/**
* Get a a byte array value of attribute valname
*
* @return
* NS_OK on success. buf has the string value copied into it.
* length is updated to actual number of bytes copied into buf.
* NS_ERROR_REG_BUFFER_TOO_SMALL if not enough buffer space.
* length is updated to actual length in PRUint8s including
* terminating NULL and buf will be unchanged.
* NS_ERROR_FAILURE if an unknown error happened. state of buf and
* length undefined.
* various other failure codes otherwise. buf and length wont be updated.
*/
void getBytesUTF8IntoBuffer(in nsRegistryKey baseKey, in string path,
inout PRUint8 buf, inout PRUint32 length);
};
%{ C++
#include "nsIRegistryUtils.h"
%}

Просмотреть файл

@ -0,0 +1,63 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape 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/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.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 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 NPL, 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 NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef __nsIRegistryUtils_h
#define __nsIRegistryUtils_h
#define NS_REGISTRY_CONTRACTID "@mozilla.org/registry;1"
#define NS_REGISTRY_CLASSNAME "Mozilla Registry"
/* be761f00-a3b0-11d2-996c-0080c7cb1081 */
#define NS_REGISTRY_CID \
{ \
0xbe761f00, \
0xa3b0, \
0x11d2, \
{0x99, 0x6c, 0x00, 0x80, 0xc7, 0xcb, 0x10, 0x81} \
}
/*------------------------------- Error Codes ----------------------------------
------------------------------------------------------------------------------*/
#define NS_ERROR_REG_BADTYPE NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 1 )
#define NS_ERROR_REG_NO_MORE NS_ERROR_GENERATE_SUCCESS( NS_ERROR_MODULE_REG, 2 )
#define NS_ERROR_REG_NOT_FOUND NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 3 )
#define NS_ERROR_REG_NOFILE NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 4 )
#define NS_ERROR_REG_BUFFER_TOO_SMALL NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 5 )
#define NS_ERROR_REG_NAME_TOO_LONG NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 6 )
#define NS_ERROR_REG_NO_PATH NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 7 )
#define NS_ERROR_REG_READ_ONLY NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 8 )
#define NS_ERROR_REG_BAD_UTF8 NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 9 )
#endif

Просмотреть файл

@ -0,0 +1,54 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape 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/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.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 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 NPL, 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 NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsXPCOM.h"
#include "nsIGenericFactory.h"
#include "nsFileSpecImpl.h"
#define COMPONENT(NAME, Ctor) \
{ NS_##NAME##_CLASSNAME, NS_##NAME##_CID, NS_##NAME##_CONTRACTID, Ctor }
static const nsModuleComponentInfo components[] =
{
COMPONENT(FILESPEC, nsFileSpecImpl::Create),
COMPONENT(DIRECTORYITERATOR, nsDirectoryIteratorImpl::Create),
};
NS_IMPL_NSGETMODULE(xpcomObsoleteModule, components)