Added nsIString interface.

This commit is contained in:
waterson%netscape.com 1999-03-23 00:43:54 +00:00
parent 13a9895d1d
commit 7c8125c3cc
5 changed files with 137 additions and 0 deletions

View File

@ -6,6 +6,7 @@ nsAutoLock.h
nsISizeOfHandler.h
nsFileStream.h
nsIFileStream.h
nsIString.h
nsIStringStream.h
nsFileSpec.h
nsRepeater.h

View File

@ -28,6 +28,7 @@ EXPORTS = \
nsAutoLock.h \
nsIProperties.h \
nsISizeOfHandler.h \
nsIString.h \
nsCaretProperties.h \
nsEscape.h \
nsFileSpec.h \

View File

@ -29,6 +29,7 @@ EXPORTS = \
nsFileSpec.h \
nsFileStream.h \
nsIFileStream.h \
nsIString.h \
nsIStringStream.h \
nsSpecialSystemDirectory.h \
$(NULL)

67
base/public/nsIString.h Normal file
View File

@ -0,0 +1,67 @@
/* -*- 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 "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.
*/
/*
A reference-counted XPCOM wrapper for the nsStr structure. Allows for
efficient passing of string objects through multiple layers.
*/
#ifndef nsIString_h__
#define nsIString_h__
#include "nsISupports.h"
struct nsStr;
// {4C541410-E0B9-11d2-BDB3-000064657374}
#define NS_ISTRING_IID \
{ 0x4c541410, 0xe0b9, 0x11d2, { 0xbd, 0xb3, 0x0, 0x0, 0x64, 0x65, 0x73, 0x74 } }
class nsIString : public nsISupports
{
public:
static const nsID& GetIID() { static nsIID iid = NS_ISTRING_IID; return iid; }
/**
* Copy the caller's nsStr into the object's internal nsStr. The copy is "deep";
* that is, it duplicates the contents of "aStr.mStr" as well.
*/
NS_IMETHOD SetStr(nsStr* aStr) = 0;
/**
* Copy the object's internal nsStr into the caller's nsStr struct. The copy is
* "deep"; that is, it duplicates the nsStr::mStr member, as well.
*/
NS_IMETHOD GetStr(nsStr* aStr) = 0
/**
* Return a pointer to the nsIString object's _actual_ string buffer. The caller
* must treat this struct as an immutable object (hence the "const" qualifier)
* The pointer will become invalid as soon as the nsIString interface is released.
*/
NS_IMETHOD GetImmutableStr(const nsStr** aStr) = 0;
};
PR_EXTERN(nsresult)
NS_NewString(nsIString** aString);
#endif // nsIString_h__

67
xpcom/ds/nsIString.h Normal file
View File

@ -0,0 +1,67 @@
/* -*- 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 "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.
*/
/*
A reference-counted XPCOM wrapper for the nsStr structure. Allows for
efficient passing of string objects through multiple layers.
*/
#ifndef nsIString_h__
#define nsIString_h__
#include "nsISupports.h"
struct nsStr;
// {4C541410-E0B9-11d2-BDB3-000064657374}
#define NS_ISTRING_IID \
{ 0x4c541410, 0xe0b9, 0x11d2, { 0xbd, 0xb3, 0x0, 0x0, 0x64, 0x65, 0x73, 0x74 } }
class nsIString : public nsISupports
{
public:
static const nsID& GetIID() { static nsIID iid = NS_ISTRING_IID; return iid; }
/**
* Copy the caller's nsStr into the object's internal nsStr. The copy is "deep";
* that is, it duplicates the contents of "aStr.mStr" as well.
*/
NS_IMETHOD SetStr(nsStr* aStr) = 0;
/**
* Copy the object's internal nsStr into the caller's nsStr struct. The copy is
* "deep"; that is, it duplicates the nsStr::mStr member, as well.
*/
NS_IMETHOD GetStr(nsStr* aStr) = 0
/**
* Return a pointer to the nsIString object's _actual_ string buffer. The caller
* must treat this struct as an immutable object (hence the "const" qualifier)
* The pointer will become invalid as soon as the nsIString interface is released.
*/
NS_IMETHOD GetImmutableStr(const nsStr** aStr) = 0;
};
PR_EXTERN(nsresult)
NS_NewString(nsIString** aString);
#endif // nsIString_h__