added DebugDump() to nsString classes for terminal output. Also slightly improved documentation. r=buster

git-svn-id: svn://10.0.0.236/trunk@53985 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
rickg%netscape.com
1999-11-19 08:05:30 +00:00
parent bfced5ecee
commit 1eaa6d5152
12 changed files with 222 additions and 96 deletions

View File

@@ -765,6 +765,9 @@ nsCString& nsCString::Assign(const nsStr& aString,PRInt32 aCount) {
* assign given char* to this string
* @update gess 01/04/99
* @param aCString: buffer to be assigned to this
* @param aCount -- length of given buffer or -1 if you want me to compute length.
* NOTE: IFF you pass -1 as aCount, then your buffer must be null terminated.
*
* @return this
*/
nsCString& nsCString::Assign(const char* aCString,PRInt32 aCount) {
@@ -779,6 +782,9 @@ nsCString& nsCString::Assign(const char* aCString,PRInt32 aCount) {
* assign given unichar* to this string
* @update gess 01/04/99
* @param aCString: buffer to be assigned to this
* @param aCount -- length of given buffer or -1 if you want me to compute length.
* NOTE: IFF you pass -1 as aCount, then your buffer must be null terminated.
*
* @return this
*/
nsCString& nsCString::Assign(const PRUnichar* aString,PRInt32 aCount) {
@@ -888,6 +894,8 @@ nsCString& nsCString::Append(const nsStr& aString,PRInt32 aCount) {
* @update gess 01/04/99
* @param aString : string to be appended to this
* @param aCount: #of chars to be copied; -1 means to copy the whole thing
* NOTE: IFF you pass -1 as aCount, then your buffer must be null terminated.
*
* @return this
*/
nsCString& nsCString::Append(const char* aCString,PRInt32 aCount) {
@@ -1660,18 +1668,6 @@ void nsCString::Recycle(nsCString* aString){
}
#if 0
/**
*
* @update gess 01/04/99
* @param
* @return
*/
void nsCString::DebugDump(ostream& aStream) const {
for(PRUint32 i=0;i<mLength;i++) {
aStream <<mStr[i];
}
aStream << endl;
}
/**
*
@@ -1726,6 +1722,17 @@ NS_COM int fputs(const nsCString& aString, FILE* out)
}
return (int) len;
}
/**
* Dumps the contents of the string to stdout
* @update gess 11/15/99
*/
void nsCString::DebugDump(void) const {
if(mStr && (eOneByte==mCharSize)) {
printf("\n%s",mStr);
}
}
/***********************************************************************

View File

@@ -364,8 +364,9 @@ public:
/**
* assign given string to this string
* @param aStr: buffer to be assigned to this
* @param alength is the length of the given str (or -1)
if you want me to determine its length
* @param aCount is the length of the given str (or -1) if you want me to determine its length
* NOTE: IFF you pass -1 as aCount, then your buffer must be null terminated.
*
* @return this
*/
nsCString& Assign(const nsStr& aString,PRInt32 aCount=-1);
@@ -417,6 +418,8 @@ public:
*
* @param aString is the source to be appended to this
* @param aCount -- number of chars to copy; -1 tells us to compute the strlen for you
* NOTE: IFF you pass -1 as aCount, then your buffer must be null terminated.
*
* @return number of chars copied
*/
nsCString& Append(const nsCString& aString,PRInt32 aCount);
@@ -468,6 +471,8 @@ public:
* @param aCopy -- String to be inserted into this
* @param anOffset -- insertion position within this str
* @param aCount -- number of chars to be copied from aCopy
* NOTE: IFF you pass -1 as aCount, then your buffer must be null terminated.
*
* @return number of chars inserted into this.
*/
nsCString& Insert(const nsCString& aCopy,PRUint32 anOffset,PRInt32 aCount=-1);
@@ -675,6 +680,8 @@ public:
PRBool EqualsIgnoreCase(const char* aString,PRInt32 aCount=-1) const;
PRBool EqualsIgnoreCase(const PRUnichar* aString,PRInt32 aCount=-1) const;
void DebugDump(void) const;
static void Recycle(nsCString* aString);
static nsCString* CreateString(void);

View File

@@ -924,6 +924,9 @@ nsString& nsString::Assign(const nsStr& aString,PRInt32 aCount) {
* assign given char* to this string
* @update gess 01/04/99
* @param aCString: buffer to be assigned to this
* @param aCount -- length of given buffer or -1 if you want me to compute length.
* NOTE: IFF you pass -1 as aCount, then your buffer must be null terminated.
*
* @return this
*/
nsString& nsString::Assign(const char* aCString,PRInt32 aCount) {
@@ -938,6 +941,9 @@ nsString& nsString::Assign(const char* aCString,PRInt32 aCount) {
* assign given unichar* to this string
* @update gess 01/04/99
* @param aString: buffer to be assigned to this
* @param aCount -- length of given buffer or -1 if you want me to compute length.
* NOTE: IFF you pass -1 as aCount, then your buffer must be null terminated.
*
* @return this
*/
nsString& nsString::Assign(const PRUnichar* aString,PRInt32 aCount) {
@@ -1028,7 +1034,9 @@ nsString& nsString::Append(const nsString& aString,PRInt32 aCount) {
* append given c-string to this string
* @update gess 01/04/99
* @param aString : string to be appended to this
* @param aCount -- number of chars to copy; -1 tells us to compute the strlen for you
* @param aCount -- length of given buffer or -1 if you want me to compute length.
* NOTE: IFF you pass -1 as aCount, then your buffer must be null terminated.
*
* @return this
*/
nsString& nsString::Append(const char* aCString,PRInt32 aCount) {
@@ -1061,7 +1069,9 @@ nsString& nsString::Append(const char* aCString,PRInt32 aCount) {
* append given unicode string to this
* @update gess 01/04/99
* @param aString : string to be appended to this
* @param aCount -- number of chars to copy; -1 tells us to compute the strlen for you
* @param aCount -- length of given buffer or -1 if you want me to compute length.
* NOTE: IFF you pass -1 as aCount, then your buffer must be null terminated.
*
* @return this
*/
nsString& nsString::Append(const PRUnichar* aString,PRInt32 aCount) {
@@ -1251,7 +1261,9 @@ nsString& nsString::Insert(const nsString& aCopy,PRUint32 anOffset,PRInt32 aCoun
* @update gess4/22/98
* @param char* aCString to be inserted into this string
* @param anOffset is insert pos in str
* @param aCounttells us how many chars to insert
* @param aCount -- length of given buffer or -1 if you want me to compute length.
* NOTE: IFF you pass -1 as aCount, then your buffer must be null terminated.
*
* @return this
*/
nsString& nsString::Insert(const char* aCString,PRUint32 anOffset,PRInt32 aCount){
@@ -1287,6 +1299,9 @@ nsString& nsString::Insert(const char* aCString,PRUint32 anOffset,PRInt32 aCount
* @update gess4/22/98
* @param aChar char to be inserted into this string
* @param anOffset is insert pos in str
* @param aCount -- length of given buffer or -1 if you want me to compute length.
* NOTE: IFF you pass -1 as aCount, then your buffer must be null terminated.
*
* @return this
*/
nsString& nsString::Insert(const PRUnichar* aString,PRUint32 anOffset,PRInt32 aCount){
@@ -2062,18 +2077,6 @@ void nsString::Recycle(nsString* aString){
}
#if 0
/**
*
* @update gess 01/04/99
* @param
* @return
*/
void nsString::DebugDump(ostream& aStream) const {
for(PRUint32 i=0;i<mLength;i++) {
aStream <<mStr[i];
}
aStream << endl;
}
/**
*
@@ -2105,6 +2108,7 @@ ostream& operator<<(ostream& aStream,const nsString& aString){
}
#endif
/**
*
* @update gess 01/04/99
@@ -2129,6 +2133,26 @@ NS_COM int fputs(const nsString& aString, FILE* out)
return (int) len;
}
/**
* Dumps the contents of the string to stdout
* @update gess 11/15/99
*/
void nsString::DebugDump(void) const {
const char* theBuffer=mStr;
nsCAutoString temp;
if(eTwoByte==mCharSize) {
temp.Assign(*this);
theBuffer=temp.GetBuffer();
}
if(theBuffer) {
printf("\n%s",theBuffer);
}
}
/***********************************************************************
IMPLEMENTATION NOTES: AUTOSTRING...

View File

@@ -407,8 +407,9 @@ public:
/**
* assign given string to this string
* @param aStr: buffer to be assigned to this
* @param alength is the length of the given str (or -1)
if you want me to determine its length
* @param aCount is the length of the given str (or -1) if you want me to determine its length
* NOTE: IFF you pass -1 as aCount, then your buffer must be null terminated.
* @return this
*/
nsString& Assign(const nsStr& aString,PRInt32 aCount=-1);
@@ -466,6 +467,7 @@ public:
*
* @param aString is the source to be appended to this
* @param aCount -- number of chars to copy; -1 tells us to compute the strlen for you
* NOTE: IFF you pass -1 as aCount, then your buffer must be null terminated.
* @return number of chars copied
*/
nsString& Append(const nsStr& aString,PRInt32 aCount);
@@ -518,6 +520,8 @@ public:
* @param aCopy -- String to be inserted into this
* @param anOffset -- insertion position within this str
* @param aCount -- number of chars to be copied from aCopy
* NOTE: IFF you pass -1 as aCount, then your buffer must be null terminated.
*
* @return number of chars inserted into this.
*/
nsString& Insert(const nsString& aCopy,PRUint32 anOffset,PRInt32 aCount=-1);
@@ -748,6 +752,7 @@ public:
*/
PRBool IsASCII(const PRUnichar* aBuffer=0);
void DebugDump(void) const;
/**
* Determine if given char is a valid space character
@@ -782,7 +787,6 @@ extern NS_COM int fputs(const nsString& aString, FILE* out);
//ostream& operator<<(ostream& aStream,const nsString& aString);
//virtual void DebugDump(ostream& aStream) const;
/**************************************************************
Here comes the AutoString class which uses internal memory
(typically found on the stack) for its default buffer.

View File

@@ -765,6 +765,9 @@ nsCString& nsCString::Assign(const nsStr& aString,PRInt32 aCount) {
* assign given char* to this string
* @update gess 01/04/99
* @param aCString: buffer to be assigned to this
* @param aCount -- length of given buffer or -1 if you want me to compute length.
* NOTE: IFF you pass -1 as aCount, then your buffer must be null terminated.
*
* @return this
*/
nsCString& nsCString::Assign(const char* aCString,PRInt32 aCount) {
@@ -779,6 +782,9 @@ nsCString& nsCString::Assign(const char* aCString,PRInt32 aCount) {
* assign given unichar* to this string
* @update gess 01/04/99
* @param aCString: buffer to be assigned to this
* @param aCount -- length of given buffer or -1 if you want me to compute length.
* NOTE: IFF you pass -1 as aCount, then your buffer must be null terminated.
*
* @return this
*/
nsCString& nsCString::Assign(const PRUnichar* aString,PRInt32 aCount) {
@@ -888,6 +894,8 @@ nsCString& nsCString::Append(const nsStr& aString,PRInt32 aCount) {
* @update gess 01/04/99
* @param aString : string to be appended to this
* @param aCount: #of chars to be copied; -1 means to copy the whole thing
* NOTE: IFF you pass -1 as aCount, then your buffer must be null terminated.
*
* @return this
*/
nsCString& nsCString::Append(const char* aCString,PRInt32 aCount) {
@@ -1660,18 +1668,6 @@ void nsCString::Recycle(nsCString* aString){
}
#if 0
/**
*
* @update gess 01/04/99
* @param
* @return
*/
void nsCString::DebugDump(ostream& aStream) const {
for(PRUint32 i=0;i<mLength;i++) {
aStream <<mStr[i];
}
aStream << endl;
}
/**
*
@@ -1726,6 +1722,17 @@ NS_COM int fputs(const nsCString& aString, FILE* out)
}
return (int) len;
}
/**
* Dumps the contents of the string to stdout
* @update gess 11/15/99
*/
void nsCString::DebugDump(void) const {
if(mStr && (eOneByte==mCharSize)) {
printf("\n%s",mStr);
}
}
/***********************************************************************

View File

@@ -364,8 +364,9 @@ public:
/**
* assign given string to this string
* @param aStr: buffer to be assigned to this
* @param alength is the length of the given str (or -1)
if you want me to determine its length
* @param aCount is the length of the given str (or -1) if you want me to determine its length
* NOTE: IFF you pass -1 as aCount, then your buffer must be null terminated.
*
* @return this
*/
nsCString& Assign(const nsStr& aString,PRInt32 aCount=-1);
@@ -417,6 +418,8 @@ public:
*
* @param aString is the source to be appended to this
* @param aCount -- number of chars to copy; -1 tells us to compute the strlen for you
* NOTE: IFF you pass -1 as aCount, then your buffer must be null terminated.
*
* @return number of chars copied
*/
nsCString& Append(const nsCString& aString,PRInt32 aCount);
@@ -468,6 +471,8 @@ public:
* @param aCopy -- String to be inserted into this
* @param anOffset -- insertion position within this str
* @param aCount -- number of chars to be copied from aCopy
* NOTE: IFF you pass -1 as aCount, then your buffer must be null terminated.
*
* @return number of chars inserted into this.
*/
nsCString& Insert(const nsCString& aCopy,PRUint32 anOffset,PRInt32 aCount=-1);
@@ -675,6 +680,8 @@ public:
PRBool EqualsIgnoreCase(const char* aString,PRInt32 aCount=-1) const;
PRBool EqualsIgnoreCase(const PRUnichar* aString,PRInt32 aCount=-1) const;
void DebugDump(void) const;
static void Recycle(nsCString* aString);
static nsCString* CreateString(void);

View File

@@ -924,6 +924,9 @@ nsString& nsString::Assign(const nsStr& aString,PRInt32 aCount) {
* assign given char* to this string
* @update gess 01/04/99
* @param aCString: buffer to be assigned to this
* @param aCount -- length of given buffer or -1 if you want me to compute length.
* NOTE: IFF you pass -1 as aCount, then your buffer must be null terminated.
*
* @return this
*/
nsString& nsString::Assign(const char* aCString,PRInt32 aCount) {
@@ -938,6 +941,9 @@ nsString& nsString::Assign(const char* aCString,PRInt32 aCount) {
* assign given unichar* to this string
* @update gess 01/04/99
* @param aString: buffer to be assigned to this
* @param aCount -- length of given buffer or -1 if you want me to compute length.
* NOTE: IFF you pass -1 as aCount, then your buffer must be null terminated.
*
* @return this
*/
nsString& nsString::Assign(const PRUnichar* aString,PRInt32 aCount) {
@@ -1028,7 +1034,9 @@ nsString& nsString::Append(const nsString& aString,PRInt32 aCount) {
* append given c-string to this string
* @update gess 01/04/99
* @param aString : string to be appended to this
* @param aCount -- number of chars to copy; -1 tells us to compute the strlen for you
* @param aCount -- length of given buffer or -1 if you want me to compute length.
* NOTE: IFF you pass -1 as aCount, then your buffer must be null terminated.
*
* @return this
*/
nsString& nsString::Append(const char* aCString,PRInt32 aCount) {
@@ -1061,7 +1069,9 @@ nsString& nsString::Append(const char* aCString,PRInt32 aCount) {
* append given unicode string to this
* @update gess 01/04/99
* @param aString : string to be appended to this
* @param aCount -- number of chars to copy; -1 tells us to compute the strlen for you
* @param aCount -- length of given buffer or -1 if you want me to compute length.
* NOTE: IFF you pass -1 as aCount, then your buffer must be null terminated.
*
* @return this
*/
nsString& nsString::Append(const PRUnichar* aString,PRInt32 aCount) {
@@ -1251,7 +1261,9 @@ nsString& nsString::Insert(const nsString& aCopy,PRUint32 anOffset,PRInt32 aCoun
* @update gess4/22/98
* @param char* aCString to be inserted into this string
* @param anOffset is insert pos in str
* @param aCounttells us how many chars to insert
* @param aCount -- length of given buffer or -1 if you want me to compute length.
* NOTE: IFF you pass -1 as aCount, then your buffer must be null terminated.
*
* @return this
*/
nsString& nsString::Insert(const char* aCString,PRUint32 anOffset,PRInt32 aCount){
@@ -1287,6 +1299,9 @@ nsString& nsString::Insert(const char* aCString,PRUint32 anOffset,PRInt32 aCount
* @update gess4/22/98
* @param aChar char to be inserted into this string
* @param anOffset is insert pos in str
* @param aCount -- length of given buffer or -1 if you want me to compute length.
* NOTE: IFF you pass -1 as aCount, then your buffer must be null terminated.
*
* @return this
*/
nsString& nsString::Insert(const PRUnichar* aString,PRUint32 anOffset,PRInt32 aCount){
@@ -2062,18 +2077,6 @@ void nsString::Recycle(nsString* aString){
}
#if 0
/**
*
* @update gess 01/04/99
* @param
* @return
*/
void nsString::DebugDump(ostream& aStream) const {
for(PRUint32 i=0;i<mLength;i++) {
aStream <<mStr[i];
}
aStream << endl;
}
/**
*
@@ -2105,6 +2108,7 @@ ostream& operator<<(ostream& aStream,const nsString& aString){
}
#endif
/**
*
* @update gess 01/04/99
@@ -2129,6 +2133,26 @@ NS_COM int fputs(const nsString& aString, FILE* out)
return (int) len;
}
/**
* Dumps the contents of the string to stdout
* @update gess 11/15/99
*/
void nsString::DebugDump(void) const {
const char* theBuffer=mStr;
nsCAutoString temp;
if(eTwoByte==mCharSize) {
temp.Assign(*this);
theBuffer=temp.GetBuffer();
}
if(theBuffer) {
printf("\n%s",theBuffer);
}
}
/***********************************************************************
IMPLEMENTATION NOTES: AUTOSTRING...

View File

@@ -407,8 +407,9 @@ public:
/**
* assign given string to this string
* @param aStr: buffer to be assigned to this
* @param alength is the length of the given str (or -1)
if you want me to determine its length
* @param aCount is the length of the given str (or -1) if you want me to determine its length
* NOTE: IFF you pass -1 as aCount, then your buffer must be null terminated.
* @return this
*/
nsString& Assign(const nsStr& aString,PRInt32 aCount=-1);
@@ -466,6 +467,7 @@ public:
*
* @param aString is the source to be appended to this
* @param aCount -- number of chars to copy; -1 tells us to compute the strlen for you
* NOTE: IFF you pass -1 as aCount, then your buffer must be null terminated.
* @return number of chars copied
*/
nsString& Append(const nsStr& aString,PRInt32 aCount);
@@ -518,6 +520,8 @@ public:
* @param aCopy -- String to be inserted into this
* @param anOffset -- insertion position within this str
* @param aCount -- number of chars to be copied from aCopy
* NOTE: IFF you pass -1 as aCount, then your buffer must be null terminated.
*
* @return number of chars inserted into this.
*/
nsString& Insert(const nsString& aCopy,PRUint32 anOffset,PRInt32 aCount=-1);
@@ -748,6 +752,7 @@ public:
*/
PRBool IsASCII(const PRUnichar* aBuffer=0);
void DebugDump(void) const;
/**
* Determine if given char is a valid space character
@@ -782,7 +787,6 @@ extern NS_COM int fputs(const nsString& aString, FILE* out);
//ostream& operator<<(ostream& aStream,const nsString& aString);
//virtual void DebugDump(ostream& aStream) const;
/**************************************************************
Here comes the AutoString class which uses internal memory
(typically found on the stack) for its default buffer.

View File

@@ -765,6 +765,9 @@ nsCString& nsCString::Assign(const nsStr& aString,PRInt32 aCount) {
* assign given char* to this string
* @update gess 01/04/99
* @param aCString: buffer to be assigned to this
* @param aCount -- length of given buffer or -1 if you want me to compute length.
* NOTE: IFF you pass -1 as aCount, then your buffer must be null terminated.
*
* @return this
*/
nsCString& nsCString::Assign(const char* aCString,PRInt32 aCount) {
@@ -779,6 +782,9 @@ nsCString& nsCString::Assign(const char* aCString,PRInt32 aCount) {
* assign given unichar* to this string
* @update gess 01/04/99
* @param aCString: buffer to be assigned to this
* @param aCount -- length of given buffer or -1 if you want me to compute length.
* NOTE: IFF you pass -1 as aCount, then your buffer must be null terminated.
*
* @return this
*/
nsCString& nsCString::Assign(const PRUnichar* aString,PRInt32 aCount) {
@@ -888,6 +894,8 @@ nsCString& nsCString::Append(const nsStr& aString,PRInt32 aCount) {
* @update gess 01/04/99
* @param aString : string to be appended to this
* @param aCount: #of chars to be copied; -1 means to copy the whole thing
* NOTE: IFF you pass -1 as aCount, then your buffer must be null terminated.
*
* @return this
*/
nsCString& nsCString::Append(const char* aCString,PRInt32 aCount) {
@@ -1660,18 +1668,6 @@ void nsCString::Recycle(nsCString* aString){
}
#if 0
/**
*
* @update gess 01/04/99
* @param
* @return
*/
void nsCString::DebugDump(ostream& aStream) const {
for(PRUint32 i=0;i<mLength;i++) {
aStream <<mStr[i];
}
aStream << endl;
}
/**
*
@@ -1726,6 +1722,17 @@ NS_COM int fputs(const nsCString& aString, FILE* out)
}
return (int) len;
}
/**
* Dumps the contents of the string to stdout
* @update gess 11/15/99
*/
void nsCString::DebugDump(void) const {
if(mStr && (eOneByte==mCharSize)) {
printf("\n%s",mStr);
}
}
/***********************************************************************

View File

@@ -364,8 +364,9 @@ public:
/**
* assign given string to this string
* @param aStr: buffer to be assigned to this
* @param alength is the length of the given str (or -1)
if you want me to determine its length
* @param aCount is the length of the given str (or -1) if you want me to determine its length
* NOTE: IFF you pass -1 as aCount, then your buffer must be null terminated.
*
* @return this
*/
nsCString& Assign(const nsStr& aString,PRInt32 aCount=-1);
@@ -417,6 +418,8 @@ public:
*
* @param aString is the source to be appended to this
* @param aCount -- number of chars to copy; -1 tells us to compute the strlen for you
* NOTE: IFF you pass -1 as aCount, then your buffer must be null terminated.
*
* @return number of chars copied
*/
nsCString& Append(const nsCString& aString,PRInt32 aCount);
@@ -468,6 +471,8 @@ public:
* @param aCopy -- String to be inserted into this
* @param anOffset -- insertion position within this str
* @param aCount -- number of chars to be copied from aCopy
* NOTE: IFF you pass -1 as aCount, then your buffer must be null terminated.
*
* @return number of chars inserted into this.
*/
nsCString& Insert(const nsCString& aCopy,PRUint32 anOffset,PRInt32 aCount=-1);
@@ -675,6 +680,8 @@ public:
PRBool EqualsIgnoreCase(const char* aString,PRInt32 aCount=-1) const;
PRBool EqualsIgnoreCase(const PRUnichar* aString,PRInt32 aCount=-1) const;
void DebugDump(void) const;
static void Recycle(nsCString* aString);
static nsCString* CreateString(void);

View File

@@ -924,6 +924,9 @@ nsString& nsString::Assign(const nsStr& aString,PRInt32 aCount) {
* assign given char* to this string
* @update gess 01/04/99
* @param aCString: buffer to be assigned to this
* @param aCount -- length of given buffer or -1 if you want me to compute length.
* NOTE: IFF you pass -1 as aCount, then your buffer must be null terminated.
*
* @return this
*/
nsString& nsString::Assign(const char* aCString,PRInt32 aCount) {
@@ -938,6 +941,9 @@ nsString& nsString::Assign(const char* aCString,PRInt32 aCount) {
* assign given unichar* to this string
* @update gess 01/04/99
* @param aString: buffer to be assigned to this
* @param aCount -- length of given buffer or -1 if you want me to compute length.
* NOTE: IFF you pass -1 as aCount, then your buffer must be null terminated.
*
* @return this
*/
nsString& nsString::Assign(const PRUnichar* aString,PRInt32 aCount) {
@@ -1028,7 +1034,9 @@ nsString& nsString::Append(const nsString& aString,PRInt32 aCount) {
* append given c-string to this string
* @update gess 01/04/99
* @param aString : string to be appended to this
* @param aCount -- number of chars to copy; -1 tells us to compute the strlen for you
* @param aCount -- length of given buffer or -1 if you want me to compute length.
* NOTE: IFF you pass -1 as aCount, then your buffer must be null terminated.
*
* @return this
*/
nsString& nsString::Append(const char* aCString,PRInt32 aCount) {
@@ -1061,7 +1069,9 @@ nsString& nsString::Append(const char* aCString,PRInt32 aCount) {
* append given unicode string to this
* @update gess 01/04/99
* @param aString : string to be appended to this
* @param aCount -- number of chars to copy; -1 tells us to compute the strlen for you
* @param aCount -- length of given buffer or -1 if you want me to compute length.
* NOTE: IFF you pass -1 as aCount, then your buffer must be null terminated.
*
* @return this
*/
nsString& nsString::Append(const PRUnichar* aString,PRInt32 aCount) {
@@ -1251,7 +1261,9 @@ nsString& nsString::Insert(const nsString& aCopy,PRUint32 anOffset,PRInt32 aCoun
* @update gess4/22/98
* @param char* aCString to be inserted into this string
* @param anOffset is insert pos in str
* @param aCounttells us how many chars to insert
* @param aCount -- length of given buffer or -1 if you want me to compute length.
* NOTE: IFF you pass -1 as aCount, then your buffer must be null terminated.
*
* @return this
*/
nsString& nsString::Insert(const char* aCString,PRUint32 anOffset,PRInt32 aCount){
@@ -1287,6 +1299,9 @@ nsString& nsString::Insert(const char* aCString,PRUint32 anOffset,PRInt32 aCount
* @update gess4/22/98
* @param aChar char to be inserted into this string
* @param anOffset is insert pos in str
* @param aCount -- length of given buffer or -1 if you want me to compute length.
* NOTE: IFF you pass -1 as aCount, then your buffer must be null terminated.
*
* @return this
*/
nsString& nsString::Insert(const PRUnichar* aString,PRUint32 anOffset,PRInt32 aCount){
@@ -2062,18 +2077,6 @@ void nsString::Recycle(nsString* aString){
}
#if 0
/**
*
* @update gess 01/04/99
* @param
* @return
*/
void nsString::DebugDump(ostream& aStream) const {
for(PRUint32 i=0;i<mLength;i++) {
aStream <<mStr[i];
}
aStream << endl;
}
/**
*
@@ -2105,6 +2108,7 @@ ostream& operator<<(ostream& aStream,const nsString& aString){
}
#endif
/**
*
* @update gess 01/04/99
@@ -2129,6 +2133,26 @@ NS_COM int fputs(const nsString& aString, FILE* out)
return (int) len;
}
/**
* Dumps the contents of the string to stdout
* @update gess 11/15/99
*/
void nsString::DebugDump(void) const {
const char* theBuffer=mStr;
nsCAutoString temp;
if(eTwoByte==mCharSize) {
temp.Assign(*this);
theBuffer=temp.GetBuffer();
}
if(theBuffer) {
printf("\n%s",theBuffer);
}
}
/***********************************************************************
IMPLEMENTATION NOTES: AUTOSTRING...

View File

@@ -407,8 +407,9 @@ public:
/**
* assign given string to this string
* @param aStr: buffer to be assigned to this
* @param alength is the length of the given str (or -1)
if you want me to determine its length
* @param aCount is the length of the given str (or -1) if you want me to determine its length
* NOTE: IFF you pass -1 as aCount, then your buffer must be null terminated.
* @return this
*/
nsString& Assign(const nsStr& aString,PRInt32 aCount=-1);
@@ -466,6 +467,7 @@ public:
*
* @param aString is the source to be appended to this
* @param aCount -- number of chars to copy; -1 tells us to compute the strlen for you
* NOTE: IFF you pass -1 as aCount, then your buffer must be null terminated.
* @return number of chars copied
*/
nsString& Append(const nsStr& aString,PRInt32 aCount);
@@ -518,6 +520,8 @@ public:
* @param aCopy -- String to be inserted into this
* @param anOffset -- insertion position within this str
* @param aCount -- number of chars to be copied from aCopy
* NOTE: IFF you pass -1 as aCount, then your buffer must be null terminated.
*
* @return number of chars inserted into this.
*/
nsString& Insert(const nsString& aCopy,PRUint32 anOffset,PRInt32 aCount=-1);
@@ -748,6 +752,7 @@ public:
*/
PRBool IsASCII(const PRUnichar* aBuffer=0);
void DebugDump(void) const;
/**
* Determine if given char is a valid space character
@@ -782,7 +787,6 @@ extern NS_COM int fputs(const nsString& aString, FILE* out);
//ostream& operator<<(ostream& aStream,const nsString& aString);
//virtual void DebugDump(ostream& aStream) const;
/**************************************************************
Here comes the AutoString class which uses internal memory
(typically found on the stack) for its default buffer.