first part of fix for bug 112209, making nsStr private by switching nsStaticNameTable over to nsAFlatString. r=dbaron, sr=blake

This commit is contained in:
alecf%netscape.com 2001-11-27 21:13:53 +00:00
parent 2997b1ffa6
commit 8e1f300899
24 changed files with 119 additions and 108 deletions

View File

@ -4244,7 +4244,7 @@ PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, const ns
} }
} }
else { else {
const nsCString& name = nsCSSProps::LookupPropertyValue(aProperty, aValue.GetIntValue()); const nsAFlatCString& name = nsCSSProps::LookupPropertyValue(aProperty, aValue.GetIntValue());
aResult.Append(NS_ConvertASCIItoUCS2(name)); aResult.Append(NS_ConvertASCIItoUCS2(name));
} }
} }

View File

@ -4244,7 +4244,7 @@ PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, const ns
} }
} }
else { else {
const nsCString& name = nsCSSProps::LookupPropertyValue(aProperty, aValue.GetIntValue()); const nsAFlatCString& name = nsCSSProps::LookupPropertyValue(aProperty, aValue.GetIntValue());
aResult.Append(NS_ConvertASCIItoUCS2(name)); aResult.Append(NS_ConvertASCIItoUCS2(name));
} }
} }

View File

@ -691,7 +691,7 @@ nsComputedDOMStyle::GetCssFloat(nsIFrame *aFrame,
GetStyleData(eStyleStruct_Display,(const nsStyleStruct*&)display,aFrame); GetStyleData(eStyleStruct_Display,(const nsStyleStruct*&)display,aFrame);
if(display) { if(display) {
const nsCString& cssFloat = const nsAFlatCString& cssFloat =
nsCSSProps::SearchKeywordTable(display->mFloats, nsCSSProps::SearchKeywordTable(display->mFloats,
nsCSSProps::kFloatKTable); nsCSSProps::kFloatKTable);
val->SetString(cssFloat.get()); val->SetString(cssFloat.get());
@ -951,7 +951,7 @@ nsComputedDOMStyle::GetFontStyle(nsIFrame *aFrame,
GetStyleData(eStyleStruct_Font, (const nsStyleStruct*&)font, aFrame); GetStyleData(eStyleStruct_Font, (const nsStyleStruct*&)font, aFrame);
if(font) { if(font) {
const nsCString& style= const nsAFlatCString& style=
nsCSSProps::SearchKeywordTable(font->mFont.style, nsCSSProps::SearchKeywordTable(font->mFont.style,
nsCSSProps::kFontStyleKTable); nsCSSProps::kFontStyleKTable);
val->SetString(style.get()); val->SetString(style.get());
@ -975,7 +975,7 @@ nsComputedDOMStyle::GetFontWeight(nsIFrame *aFrame,
GetStyleData(eStyleStruct_Font, (const nsStyleStruct*&)font, aFrame); GetStyleData(eStyleStruct_Font, (const nsStyleStruct*&)font, aFrame);
if(font) { if(font) {
const nsCString& str_weight= const nsAFlatCString& str_weight=
nsCSSProps::SearchKeywordTable(font->mFont.weight, nsCSSProps::SearchKeywordTable(font->mFont.weight,
nsCSSProps::kFontWeightKTable); nsCSSProps::kFontWeightKTable);
if(str_weight.Length()>0) { if(str_weight.Length()>0) {
@ -1006,7 +1006,7 @@ nsComputedDOMStyle::GetFontVariant(nsIFrame *aFrame,
GetStyleData(eStyleStruct_Font, (const nsStyleStruct*&)font, aFrame); GetStyleData(eStyleStruct_Font, (const nsStyleStruct*&)font, aFrame);
if(font) { if(font) {
const nsCString& variant= const nsAFlatCString& variant=
nsCSSProps::SearchKeywordTable(font->mFont.variant, nsCSSProps::SearchKeywordTable(font->mFont.variant,
nsCSSProps::kFontVariantKTable); nsCSSProps::kFontVariantKTable);
val->SetString(variant.get()); val->SetString(variant.get());
@ -1032,7 +1032,7 @@ nsComputedDOMStyle::GetBackgroundColor(nsIFrame *aFrame,
if(color) { if(color) {
if ((color->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT) && if ((color->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT) &&
!(color->mBackgroundFlags & NS_STYLE_BG_PROPAGATED_TO_PARENT)) { !(color->mBackgroundFlags & NS_STYLE_BG_PROPAGATED_TO_PARENT)) {
const nsCString& backgroundColor = const nsAFlatCString& backgroundColor =
nsCSSProps::SearchKeywordTable(NS_STYLE_BG_COLOR_TRANSPARENT, nsCSSProps::SearchKeywordTable(NS_STYLE_BG_COLOR_TRANSPARENT,
nsCSSProps::kBackgroundColorKTable); nsCSSProps::kBackgroundColorKTable);
val->SetString(backgroundColor.get()); val->SetString(backgroundColor.get());
@ -1119,7 +1119,7 @@ nsComputedDOMStyle::GetBorderCollapse(nsIFrame *aFrame,
GetStyleData(eStyleStruct_TableBorder, (const nsStyleStruct*&)table, aFrame); GetStyleData(eStyleStruct_TableBorder, (const nsStyleStruct*&)table, aFrame);
if(table) { if(table) {
const nsCString& ident= const nsAFlatCString& ident=
nsCSSProps::SearchKeywordTable(table->mBorderCollapse, nsCSSProps::SearchKeywordTable(table->mBorderCollapse,
nsCSSProps::kBorderCollapseKTable); nsCSSProps::kBorderCollapseKTable);
val->SetString(ident.get()); val->SetString(ident.get());
@ -1325,7 +1325,7 @@ nsComputedDOMStyle::GetOutlineStyle(nsIFrame *aFrame,
GetStyleData(eStyleStruct_Outline, (const nsStyleStruct*&)outline, aFrame); GetStyleData(eStyleStruct_Outline, (const nsStyleStruct*&)outline, aFrame);
if(outline) { if(outline) {
const nsCString& style= const nsAFlatCString& style=
nsCSSProps::SearchKeywordTable(outline->GetOutlineStyle(), nsCSSProps::SearchKeywordTable(outline->GetOutlineStyle(),
nsCSSProps::kBorderStyleKTable); nsCSSProps::kBorderStyleKTable);
val->SetString(style.get()); val->SetString(style.get());
@ -1429,7 +1429,7 @@ nsComputedDOMStyle::GetTextAlign(nsIFrame *aFrame,
GetStyleData(eStyleStruct_Text, (const nsStyleStruct*&)text, aFrame); GetStyleData(eStyleStruct_Text, (const nsStyleStruct*&)text, aFrame);
if(text) { if(text) {
const nsCString& align= const nsAFlatCString& align=
nsCSSProps::SearchKeywordTable(text->mTextAlign, nsCSSProps::SearchKeywordTable(text->mTextAlign,
nsCSSProps::kTextAlignKTable); nsCSSProps::kTextAlignKTable);
val->SetString(align.get()); val->SetString(align.get());
@ -1453,7 +1453,7 @@ nsComputedDOMStyle::GetTextDecoration(nsIFrame *aFrame,
GetStyleData(eStyleStruct_TextReset,(const nsStyleStruct*&)text,aFrame); GetStyleData(eStyleStruct_TextReset,(const nsStyleStruct*&)text,aFrame);
if(text) { if(text) {
const nsCString& decoration= const nsAFlatCString& decoration=
nsCSSProps::SearchKeywordTable(text->mTextDecoration, nsCSSProps::SearchKeywordTable(text->mTextDecoration,
nsCSSProps::kTextDecorationKTable); nsCSSProps::kTextDecorationKTable);
val->SetString(decoration.get()); val->SetString(decoration.get());
@ -1477,7 +1477,7 @@ nsComputedDOMStyle::GetVisibility(nsIFrame *aFrame,
GetStyleData(eStyleStruct_Visibility,(const nsStyleStruct*&)visibility,aFrame); GetStyleData(eStyleStruct_Visibility,(const nsStyleStruct*&)visibility,aFrame);
if(visibility) { if(visibility) {
const nsCString& value= const nsAFlatCString& value=
nsCSSProps::SearchKeywordTable(visibility->mVisible, nsCSSProps::SearchKeywordTable(visibility->mVisible,
nsCSSProps::kVisibilityKTable); nsCSSProps::kVisibilityKTable);
val->SetString(value.get()); val->SetString(value.get());
@ -2610,7 +2610,7 @@ nsComputedDOMStyle::GetBorderWidthFor(PRUint8 aSide,
case eStyleUnit_Enumerated: case eStyleUnit_Enumerated:
case eStyleUnit_Chars: case eStyleUnit_Chars:
{ {
const nsCString& width= const nsAFlatCString& width=
nsCSSProps::SearchKeywordTable(coord.GetIntValue(), nsCSSProps::SearchKeywordTable(coord.GetIntValue(),
nsCSSProps::kBorderWidthKTable); nsCSSProps::kBorderWidthKTable);
val->SetString(width.get()); break; val->SetString(width.get()); break;
@ -2718,7 +2718,7 @@ nsComputedDOMStyle::GetBorderStyleFor(PRUint8 aSide,
GetStyleData(eStyleStruct_Border, (const nsStyleStruct*&)border, aFrame); GetStyleData(eStyleStruct_Border, (const nsStyleStruct*&)border, aFrame);
if(border) { if(border) {
const nsCString& style= const nsAFlatCString& style=
nsCSSProps::SearchKeywordTable(border->GetBorderStyle(aSide), nsCSSProps::SearchKeywordTable(border->GetBorderStyle(aSide),
nsCSSProps::kBorderStyleKTable); nsCSSProps::kBorderStyleKTable);
val->SetString(style.get()); val->SetString(style.get());

View File

@ -38,8 +38,9 @@
#ifndef nsCSSKeywords_h___ #ifndef nsCSSKeywords_h___
#define nsCSSKeywords_h___ #define nsCSSKeywords_h___
class nsString; class nsAString;
class nsCString; class nsACString;
class nsAFlatCString;
/* /*
Declare the enum list using the magic of preprocessing Declare the enum list using the magic of preprocessing
@ -63,11 +64,11 @@ public:
static void ReleaseTable(void); static void ReleaseTable(void);
// Given a keyword string, return the enum value // Given a keyword string, return the enum value
static nsCSSKeyword LookupKeyword(const nsCString& aKeyword); static nsCSSKeyword LookupKeyword(const nsACString& aKeyword);
static nsCSSKeyword LookupKeyword(const nsString& aKeyword); static nsCSSKeyword LookupKeyword(const nsAString& aKeyword);
// Given a keyword enum, get the string value // Given a keyword enum, get the string value
static const nsCString& GetStringValue(nsCSSKeyword aKeyword); static const nsAFlatCString& GetStringValue(nsCSSKeyword aKeyword);
}; };
#endif /* nsCSSKeywords_h___ */ #endif /* nsCSSKeywords_h___ */

View File

@ -63,22 +63,22 @@ public:
// Given a property string, return the enum value // Given a property string, return the enum value
static nsCSSProperty LookupProperty(const nsAReadableString& aProperty); static nsCSSProperty LookupProperty(const nsAReadableString& aProperty);
static nsCSSProperty LookupProperty(const nsCString& aProperty); static nsCSSProperty LookupProperty(const nsACString& aProperty);
// Given a property enum, get the string value // Given a property enum, get the string value
static const nsCString& GetStringValue(nsCSSProperty aProperty); static const nsAFlatCString& GetStringValue(nsCSSProperty aProperty);
// Given a CSS Property and a Property Enum Value // Given a CSS Property and a Property Enum Value
// Return back a const nsString& representation of the // Return back a const nsString& representation of the
// value. Return back nullstr if no value is found // value. Return back nullstr if no value is found
static const nsCString& LookupPropertyValue(nsCSSProperty aProperty, PRInt32 aValue); static const nsAFlatCString& LookupPropertyValue(nsCSSProperty aProperty, PRInt32 aValue);
// Get a color name for a predefined color value like buttonhighlight or activeborder // Get a color name for a predefined color value like buttonhighlight or activeborder
// Sets the aStr param to the name of the propertyID // Sets the aStr param to the name of the propertyID
static PRBool GetColorName(PRInt32 aPropID, nsCString &aStr); static PRBool GetColorName(PRInt32 aPropID, nsCString &aStr);
static PRInt32 SearchKeywordTableInt(PRInt32 aValue, const PRInt32 aTable[]); static PRInt32 SearchKeywordTableInt(PRInt32 aValue, const PRInt32 aTable[]);
static const nsCString& SearchKeywordTable(PRInt32 aValue, const PRInt32 aTable[]); static const nsAFlatCString& SearchKeywordTable(PRInt32 aValue, const PRInt32 aTable[]);
static const PRInt32 kHintTable[]; static const PRInt32 kHintTable[];

View File

@ -86,7 +86,7 @@ nsCSSKeywords::ReleaseTable(void)
} }
nsCSSKeyword nsCSSKeyword
nsCSSKeywords::LookupKeyword(const nsCString& aKeyword) nsCSSKeywords::LookupKeyword(const nsACString& aKeyword)
{ {
NS_ASSERTION(gKeywordTable, "no lookup table, needs addref"); NS_ASSERTION(gKeywordTable, "no lookup table, needs addref");
if (gKeywordTable) { if (gKeywordTable) {
@ -96,7 +96,7 @@ nsCSSKeywords::LookupKeyword(const nsCString& aKeyword)
} }
nsCSSKeyword nsCSSKeyword
nsCSSKeywords::LookupKeyword(const nsString& aKeyword) nsCSSKeywords::LookupKeyword(const nsAString& aKeyword)
{ {
NS_ASSERTION(gKeywordTable, "no lookup table, needs addref"); NS_ASSERTION(gKeywordTable, "no lookup table, needs addref");
if (gKeywordTable) { if (gKeywordTable) {
@ -105,14 +105,14 @@ nsCSSKeywords::LookupKeyword(const nsString& aKeyword)
return eCSSKeyword_UNKNOWN; return eCSSKeyword_UNKNOWN;
} }
const nsCString& const nsAFlatCString&
nsCSSKeywords::GetStringValue(nsCSSKeyword aKeyword) nsCSSKeywords::GetStringValue(nsCSSKeyword aKeyword)
{ {
NS_ASSERTION(gKeywordTable, "no lookup table, needs addref"); NS_ASSERTION(gKeywordTable, "no lookup table, needs addref");
if (gKeywordTable) { if (gKeywordTable) {
return gKeywordTable->GetStringValue(PRInt32(aKeyword)); return gKeywordTable->GetStringValue(PRInt32(aKeyword));
} else { } else {
static nsCString kNullStr; static nsDependentCString kNullStr("");
return kNullStr; return kNullStr;
} }
} }

View File

@ -92,7 +92,7 @@ nsCSSProps::ReleaseTable(void)
} }
nsCSSProperty nsCSSProperty
nsCSSProps::LookupProperty(const nsCString& aProperty) nsCSSProps::LookupProperty(const nsACString& aProperty)
{ {
NS_ASSERTION(gPropertyTable, "no lookup table, needs addref"); NS_ASSERTION(gPropertyTable, "no lookup table, needs addref");
if (gPropertyTable) { if (gPropertyTable) {
@ -107,14 +107,14 @@ nsCSSProps::LookupProperty(const nsAReadableString& aProperty) {
return LookupProperty(theProp); return LookupProperty(theProp);
} }
const nsCString& const nsAFlatCString&
nsCSSProps::GetStringValue(nsCSSProperty aProperty) nsCSSProps::GetStringValue(nsCSSProperty aProperty)
{ {
NS_ASSERTION(gPropertyTable, "no lookup table, needs addref"); NS_ASSERTION(gPropertyTable, "no lookup table, needs addref");
if (gPropertyTable) { if (gPropertyTable) {
return gPropertyTable->GetStringValue(PRInt32(aProperty)); return gPropertyTable->GetStringValue(PRInt32(aProperty));
} else { } else {
static nsCString sNullStr; static nsDependentCString sNullStr("");
return sNullStr; return sNullStr;
} }
} }
@ -754,19 +754,19 @@ nsCSSProps::SearchKeywordTableInt(PRInt32 aValue, const PRInt32 aTable[])
return -1; return -1;
} }
const nsCString& const nsAFlatCString&
nsCSSProps::SearchKeywordTable(PRInt32 aValue, const PRInt32 aTable[]) nsCSSProps::SearchKeywordTable(PRInt32 aValue, const PRInt32 aTable[])
{ {
PRInt32 i = SearchKeywordTableInt(aValue, aTable); PRInt32 i = SearchKeywordTableInt(aValue, aTable);
if (i < 0) { if (i < 0) {
static nsCString sNullStr; static nsDependentCString sNullStr("");
return sNullStr; return sNullStr;
} else { } else {
return nsCSSKeywords::GetStringValue(nsCSSKeyword(i)); return nsCSSKeywords::GetStringValue(nsCSSKeyword(i));
} }
} }
const nsCString& const nsAFlatCString&
nsCSSProps::LookupPropertyValue(nsCSSProperty aProp, PRInt32 aValue) nsCSSProps::LookupPropertyValue(nsCSSProperty aProp, PRInt32 aValue)
{ {
static const PRInt32 kBackgroundXPositionKTable[] = { static const PRInt32 kBackgroundXPositionKTable[] = {
@ -1128,7 +1128,7 @@ static const PRInt32 kBackgroundYPositionKTable[] = {
NS_ERROR("invalid property"); NS_ERROR("invalid property");
break; break;
} }
static nsCString sNullStr; static nsDependentCString sNullStr("");
return sNullStr; return sNullStr;
} }

View File

@ -42,9 +42,9 @@
#include "nsColor.h" #include "nsColor.h"
struct nsStr; struct nsStr;
class nsCString; class nsAFlatCString;
class nsACString;
class nsAString; class nsAString;
class nsACString;
/* /*
Declare the enum list using the magic of preprocessing Declare the enum list using the magic of preprocessing
@ -71,7 +71,7 @@ public:
static nsColorName LookupName(const nsAString& aName); static nsColorName LookupName(const nsAString& aName);
static nsColorName LookupName(const nsACString& aName); static nsColorName LookupName(const nsACString& aName);
static const nsCString& GetStringValue(nsColorName aColorName); static const nsAFlatCString& GetStringValue(nsColorName aColorName);
// Color id to rgb value table // Color id to rgb value table
static const nscolor kColors[]; static const nscolor kColors[];

View File

@ -112,14 +112,14 @@ nsColorNames::LookupName(const nsAString& aColor)
return eColorName_UNKNOWN; return eColorName_UNKNOWN;
} }
const nsCString& const nsAFlatCString&
nsColorNames::GetStringValue(nsColorName aColor) nsColorNames::GetStringValue(nsColorName aColor)
{ {
NS_ASSERTION(gColorTable, "no lookup table, needs addref"); NS_ASSERTION(gColorTable, "no lookup table, needs addref");
if (gColorTable) { if (gColorTable) {
return gColorTable->GetStringValue(PRInt32(aColor)); return gColorTable->GetStringValue(PRInt32(aColor));
} else { } else {
static nsCString kNullStr; static nsDependentCString kNullStr("");
return kNullStr; return kNullStr;
} }
} }

View File

@ -39,8 +39,9 @@
#ifndef nsHTMLTags_h___ #ifndef nsHTMLTags_h___
#define nsHTMLTags_h___ #define nsHTMLTags_h___
class nsString; class nsAString;
class nsCString; class nsACString;
class nsAFlatCString;
/* /*
Declare the enum list using the magic of preprocessing Declare the enum list using the magic of preprocessing
@ -71,9 +72,9 @@ public:
static void AddRefTable(void); static void AddRefTable(void);
static void ReleaseTable(void); static void ReleaseTable(void);
static nsHTMLTag LookupTag(const nsString& aTag); static nsHTMLTag LookupTag(const nsAString& aTag);
static nsHTMLTag LookupTag(const nsCString& aTag); static nsHTMLTag LookupTag(const nsACString& aTag);
static const nsCString& GetStringValue(nsHTMLTag aEnum); static const nsAFlatCString& GetStringValue(nsHTMLTag aEnum);
static const char* GetCStringValue(nsHTMLTag aEnum); static const char* GetCStringValue(nsHTMLTag aEnum);
}; };

View File

@ -86,7 +86,7 @@ nsHTMLTags::ReleaseTable(void)
} }
nsHTMLTag nsHTMLTag
nsHTMLTags::LookupTag(const nsCString& aTag) nsHTMLTags::LookupTag(const nsACString& aTag)
{ {
NS_ASSERTION(gTagTable, "no lookup table, needs addref"); NS_ASSERTION(gTagTable, "no lookup table, needs addref");
if (gTagTable) { if (gTagTable) {
@ -111,7 +111,7 @@ nsHTMLTags::LookupTag(const nsCString& aTag)
} }
nsHTMLTag nsHTMLTag
nsHTMLTags::LookupTag(const nsString& aTag) nsHTMLTags::LookupTag(const nsAString& aTag)
{ {
NS_ASSERTION(gTagTable, "no lookup table, needs addref"); NS_ASSERTION(gTagTable, "no lookup table, needs addref");
if (gTagTable) { if (gTagTable) {
@ -140,7 +140,7 @@ nsHTMLTags::LookupTag(const nsString& aTag)
return eHTMLTag_userdefined; return eHTMLTag_userdefined;
} }
const nsCString& const nsAFlatCString&
nsHTMLTags::GetStringValue(nsHTMLTag aTag) nsHTMLTags::GetStringValue(nsHTMLTag aTag)
{ {
NS_ASSERTION(gTagTable, "no lookup table, needs addref"); NS_ASSERTION(gTagTable, "no lookup table, needs addref");
@ -148,7 +148,7 @@ nsHTMLTags::GetStringValue(nsHTMLTag aTag)
// table is zero based, but tags are one based // table is zero based, but tags are one based
return gTagTable->GetStringValue(PRInt32(aTag)-1); return gTagTable->GetStringValue(PRInt32(aTag)-1);
} else { } else {
static nsCString kNullStr; static nsDependentCString kNullStr("");
return kNullStr; return kNullStr;
} }
} }

View File

@ -2267,7 +2267,8 @@ const nsAReadableString& CStyleToken::GetStringValue(void)
* @return * @return
*/ */
const char* GetTagName(PRInt32 aTag) { const char* GetTagName(PRInt32 aTag) {
const nsCString& result = nsHTMLTags::GetStringValue((nsHTMLTag) aTag); const nsAFlatCString& result =
nsHTMLTags::GetStringValue((nsHTMLTag) aTag);
if (0 == result.Length()) { if (0 == result.Length()) {
if(aTag>=eHTMLTag_userdefined) if(aTag>=eHTMLTag_userdefined)
return gUserdefined; return gUserdefined;

View File

@ -4244,7 +4244,7 @@ PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, const ns
} }
} }
else { else {
const nsCString& name = nsCSSProps::LookupPropertyValue(aProperty, aValue.GetIntValue()); const nsAFlatCString& name = nsCSSProps::LookupPropertyValue(aProperty, aValue.GetIntValue());
aResult.Append(NS_ConvertASCIItoUCS2(name)); aResult.Append(NS_ConvertASCIItoUCS2(name));
} }
} }

View File

@ -86,7 +86,7 @@ nsCSSKeywords::ReleaseTable(void)
} }
nsCSSKeyword nsCSSKeyword
nsCSSKeywords::LookupKeyword(const nsCString& aKeyword) nsCSSKeywords::LookupKeyword(const nsACString& aKeyword)
{ {
NS_ASSERTION(gKeywordTable, "no lookup table, needs addref"); NS_ASSERTION(gKeywordTable, "no lookup table, needs addref");
if (gKeywordTable) { if (gKeywordTable) {
@ -96,7 +96,7 @@ nsCSSKeywords::LookupKeyword(const nsCString& aKeyword)
} }
nsCSSKeyword nsCSSKeyword
nsCSSKeywords::LookupKeyword(const nsString& aKeyword) nsCSSKeywords::LookupKeyword(const nsAString& aKeyword)
{ {
NS_ASSERTION(gKeywordTable, "no lookup table, needs addref"); NS_ASSERTION(gKeywordTable, "no lookup table, needs addref");
if (gKeywordTable) { if (gKeywordTable) {
@ -105,14 +105,14 @@ nsCSSKeywords::LookupKeyword(const nsString& aKeyword)
return eCSSKeyword_UNKNOWN; return eCSSKeyword_UNKNOWN;
} }
const nsCString& const nsAFlatCString&
nsCSSKeywords::GetStringValue(nsCSSKeyword aKeyword) nsCSSKeywords::GetStringValue(nsCSSKeyword aKeyword)
{ {
NS_ASSERTION(gKeywordTable, "no lookup table, needs addref"); NS_ASSERTION(gKeywordTable, "no lookup table, needs addref");
if (gKeywordTable) { if (gKeywordTable) {
return gKeywordTable->GetStringValue(PRInt32(aKeyword)); return gKeywordTable->GetStringValue(PRInt32(aKeyword));
} else { } else {
static nsCString kNullStr; static nsDependentCString kNullStr("");
return kNullStr; return kNullStr;
} }
} }

View File

@ -38,8 +38,9 @@
#ifndef nsCSSKeywords_h___ #ifndef nsCSSKeywords_h___
#define nsCSSKeywords_h___ #define nsCSSKeywords_h___
class nsString; class nsAString;
class nsCString; class nsACString;
class nsAFlatCString;
/* /*
Declare the enum list using the magic of preprocessing Declare the enum list using the magic of preprocessing
@ -63,11 +64,11 @@ public:
static void ReleaseTable(void); static void ReleaseTable(void);
// Given a keyword string, return the enum value // Given a keyword string, return the enum value
static nsCSSKeyword LookupKeyword(const nsCString& aKeyword); static nsCSSKeyword LookupKeyword(const nsACString& aKeyword);
static nsCSSKeyword LookupKeyword(const nsString& aKeyword); static nsCSSKeyword LookupKeyword(const nsAString& aKeyword);
// Given a keyword enum, get the string value // Given a keyword enum, get the string value
static const nsCString& GetStringValue(nsCSSKeyword aKeyword); static const nsAFlatCString& GetStringValue(nsCSSKeyword aKeyword);
}; };
#endif /* nsCSSKeywords_h___ */ #endif /* nsCSSKeywords_h___ */

View File

@ -92,7 +92,7 @@ nsCSSProps::ReleaseTable(void)
} }
nsCSSProperty nsCSSProperty
nsCSSProps::LookupProperty(const nsCString& aProperty) nsCSSProps::LookupProperty(const nsACString& aProperty)
{ {
NS_ASSERTION(gPropertyTable, "no lookup table, needs addref"); NS_ASSERTION(gPropertyTable, "no lookup table, needs addref");
if (gPropertyTable) { if (gPropertyTable) {
@ -107,14 +107,14 @@ nsCSSProps::LookupProperty(const nsAReadableString& aProperty) {
return LookupProperty(theProp); return LookupProperty(theProp);
} }
const nsCString& const nsAFlatCString&
nsCSSProps::GetStringValue(nsCSSProperty aProperty) nsCSSProps::GetStringValue(nsCSSProperty aProperty)
{ {
NS_ASSERTION(gPropertyTable, "no lookup table, needs addref"); NS_ASSERTION(gPropertyTable, "no lookup table, needs addref");
if (gPropertyTable) { if (gPropertyTable) {
return gPropertyTable->GetStringValue(PRInt32(aProperty)); return gPropertyTable->GetStringValue(PRInt32(aProperty));
} else { } else {
static nsCString sNullStr; static nsDependentCString sNullStr("");
return sNullStr; return sNullStr;
} }
} }
@ -754,19 +754,19 @@ nsCSSProps::SearchKeywordTableInt(PRInt32 aValue, const PRInt32 aTable[])
return -1; return -1;
} }
const nsCString& const nsAFlatCString&
nsCSSProps::SearchKeywordTable(PRInt32 aValue, const PRInt32 aTable[]) nsCSSProps::SearchKeywordTable(PRInt32 aValue, const PRInt32 aTable[])
{ {
PRInt32 i = SearchKeywordTableInt(aValue, aTable); PRInt32 i = SearchKeywordTableInt(aValue, aTable);
if (i < 0) { if (i < 0) {
static nsCString sNullStr; static nsDependentCString sNullStr("");
return sNullStr; return sNullStr;
} else { } else {
return nsCSSKeywords::GetStringValue(nsCSSKeyword(i)); return nsCSSKeywords::GetStringValue(nsCSSKeyword(i));
} }
} }
const nsCString& const nsAFlatCString&
nsCSSProps::LookupPropertyValue(nsCSSProperty aProp, PRInt32 aValue) nsCSSProps::LookupPropertyValue(nsCSSProperty aProp, PRInt32 aValue)
{ {
static const PRInt32 kBackgroundXPositionKTable[] = { static const PRInt32 kBackgroundXPositionKTable[] = {
@ -1128,7 +1128,7 @@ static const PRInt32 kBackgroundYPositionKTable[] = {
NS_ERROR("invalid property"); NS_ERROR("invalid property");
break; break;
} }
static nsCString sNullStr; static nsDependentCString sNullStr("");
return sNullStr; return sNullStr;
} }

View File

@ -63,22 +63,22 @@ public:
// Given a property string, return the enum value // Given a property string, return the enum value
static nsCSSProperty LookupProperty(const nsAReadableString& aProperty); static nsCSSProperty LookupProperty(const nsAReadableString& aProperty);
static nsCSSProperty LookupProperty(const nsCString& aProperty); static nsCSSProperty LookupProperty(const nsACString& aProperty);
// Given a property enum, get the string value // Given a property enum, get the string value
static const nsCString& GetStringValue(nsCSSProperty aProperty); static const nsAFlatCString& GetStringValue(nsCSSProperty aProperty);
// Given a CSS Property and a Property Enum Value // Given a CSS Property and a Property Enum Value
// Return back a const nsString& representation of the // Return back a const nsString& representation of the
// value. Return back nullstr if no value is found // value. Return back nullstr if no value is found
static const nsCString& LookupPropertyValue(nsCSSProperty aProperty, PRInt32 aValue); static const nsAFlatCString& LookupPropertyValue(nsCSSProperty aProperty, PRInt32 aValue);
// Get a color name for a predefined color value like buttonhighlight or activeborder // Get a color name for a predefined color value like buttonhighlight or activeborder
// Sets the aStr param to the name of the propertyID // Sets the aStr param to the name of the propertyID
static PRBool GetColorName(PRInt32 aPropID, nsCString &aStr); static PRBool GetColorName(PRInt32 aPropID, nsCString &aStr);
static PRInt32 SearchKeywordTableInt(PRInt32 aValue, const PRInt32 aTable[]); static PRInt32 SearchKeywordTableInt(PRInt32 aValue, const PRInt32 aTable[]);
static const nsCString& SearchKeywordTable(PRInt32 aValue, const PRInt32 aTable[]); static const nsAFlatCString& SearchKeywordTable(PRInt32 aValue, const PRInt32 aTable[]);
static const PRInt32 kHintTable[]; static const PRInt32 kHintTable[];

View File

@ -4244,7 +4244,7 @@ PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, const ns
} }
} }
else { else {
const nsCString& name = nsCSSProps::LookupPropertyValue(aProperty, aValue.GetIntValue()); const nsAFlatCString& name = nsCSSProps::LookupPropertyValue(aProperty, aValue.GetIntValue());
aResult.Append(NS_ConvertASCIItoUCS2(name)); aResult.Append(NS_ConvertASCIItoUCS2(name));
} }
} }

View File

@ -691,7 +691,7 @@ nsComputedDOMStyle::GetCssFloat(nsIFrame *aFrame,
GetStyleData(eStyleStruct_Display,(const nsStyleStruct*&)display,aFrame); GetStyleData(eStyleStruct_Display,(const nsStyleStruct*&)display,aFrame);
if(display) { if(display) {
const nsCString& cssFloat = const nsAFlatCString& cssFloat =
nsCSSProps::SearchKeywordTable(display->mFloats, nsCSSProps::SearchKeywordTable(display->mFloats,
nsCSSProps::kFloatKTable); nsCSSProps::kFloatKTable);
val->SetString(cssFloat.get()); val->SetString(cssFloat.get());
@ -951,7 +951,7 @@ nsComputedDOMStyle::GetFontStyle(nsIFrame *aFrame,
GetStyleData(eStyleStruct_Font, (const nsStyleStruct*&)font, aFrame); GetStyleData(eStyleStruct_Font, (const nsStyleStruct*&)font, aFrame);
if(font) { if(font) {
const nsCString& style= const nsAFlatCString& style=
nsCSSProps::SearchKeywordTable(font->mFont.style, nsCSSProps::SearchKeywordTable(font->mFont.style,
nsCSSProps::kFontStyleKTable); nsCSSProps::kFontStyleKTable);
val->SetString(style.get()); val->SetString(style.get());
@ -975,7 +975,7 @@ nsComputedDOMStyle::GetFontWeight(nsIFrame *aFrame,
GetStyleData(eStyleStruct_Font, (const nsStyleStruct*&)font, aFrame); GetStyleData(eStyleStruct_Font, (const nsStyleStruct*&)font, aFrame);
if(font) { if(font) {
const nsCString& str_weight= const nsAFlatCString& str_weight=
nsCSSProps::SearchKeywordTable(font->mFont.weight, nsCSSProps::SearchKeywordTable(font->mFont.weight,
nsCSSProps::kFontWeightKTable); nsCSSProps::kFontWeightKTable);
if(str_weight.Length()>0) { if(str_weight.Length()>0) {
@ -1006,7 +1006,7 @@ nsComputedDOMStyle::GetFontVariant(nsIFrame *aFrame,
GetStyleData(eStyleStruct_Font, (const nsStyleStruct*&)font, aFrame); GetStyleData(eStyleStruct_Font, (const nsStyleStruct*&)font, aFrame);
if(font) { if(font) {
const nsCString& variant= const nsAFlatCString& variant=
nsCSSProps::SearchKeywordTable(font->mFont.variant, nsCSSProps::SearchKeywordTable(font->mFont.variant,
nsCSSProps::kFontVariantKTable); nsCSSProps::kFontVariantKTable);
val->SetString(variant.get()); val->SetString(variant.get());
@ -1032,7 +1032,7 @@ nsComputedDOMStyle::GetBackgroundColor(nsIFrame *aFrame,
if(color) { if(color) {
if ((color->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT) && if ((color->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT) &&
!(color->mBackgroundFlags & NS_STYLE_BG_PROPAGATED_TO_PARENT)) { !(color->mBackgroundFlags & NS_STYLE_BG_PROPAGATED_TO_PARENT)) {
const nsCString& backgroundColor = const nsAFlatCString& backgroundColor =
nsCSSProps::SearchKeywordTable(NS_STYLE_BG_COLOR_TRANSPARENT, nsCSSProps::SearchKeywordTable(NS_STYLE_BG_COLOR_TRANSPARENT,
nsCSSProps::kBackgroundColorKTable); nsCSSProps::kBackgroundColorKTable);
val->SetString(backgroundColor.get()); val->SetString(backgroundColor.get());
@ -1119,7 +1119,7 @@ nsComputedDOMStyle::GetBorderCollapse(nsIFrame *aFrame,
GetStyleData(eStyleStruct_TableBorder, (const nsStyleStruct*&)table, aFrame); GetStyleData(eStyleStruct_TableBorder, (const nsStyleStruct*&)table, aFrame);
if(table) { if(table) {
const nsCString& ident= const nsAFlatCString& ident=
nsCSSProps::SearchKeywordTable(table->mBorderCollapse, nsCSSProps::SearchKeywordTable(table->mBorderCollapse,
nsCSSProps::kBorderCollapseKTable); nsCSSProps::kBorderCollapseKTable);
val->SetString(ident.get()); val->SetString(ident.get());
@ -1325,7 +1325,7 @@ nsComputedDOMStyle::GetOutlineStyle(nsIFrame *aFrame,
GetStyleData(eStyleStruct_Outline, (const nsStyleStruct*&)outline, aFrame); GetStyleData(eStyleStruct_Outline, (const nsStyleStruct*&)outline, aFrame);
if(outline) { if(outline) {
const nsCString& style= const nsAFlatCString& style=
nsCSSProps::SearchKeywordTable(outline->GetOutlineStyle(), nsCSSProps::SearchKeywordTable(outline->GetOutlineStyle(),
nsCSSProps::kBorderStyleKTable); nsCSSProps::kBorderStyleKTable);
val->SetString(style.get()); val->SetString(style.get());
@ -1429,7 +1429,7 @@ nsComputedDOMStyle::GetTextAlign(nsIFrame *aFrame,
GetStyleData(eStyleStruct_Text, (const nsStyleStruct*&)text, aFrame); GetStyleData(eStyleStruct_Text, (const nsStyleStruct*&)text, aFrame);
if(text) { if(text) {
const nsCString& align= const nsAFlatCString& align=
nsCSSProps::SearchKeywordTable(text->mTextAlign, nsCSSProps::SearchKeywordTable(text->mTextAlign,
nsCSSProps::kTextAlignKTable); nsCSSProps::kTextAlignKTable);
val->SetString(align.get()); val->SetString(align.get());
@ -1453,7 +1453,7 @@ nsComputedDOMStyle::GetTextDecoration(nsIFrame *aFrame,
GetStyleData(eStyleStruct_TextReset,(const nsStyleStruct*&)text,aFrame); GetStyleData(eStyleStruct_TextReset,(const nsStyleStruct*&)text,aFrame);
if(text) { if(text) {
const nsCString& decoration= const nsAFlatCString& decoration=
nsCSSProps::SearchKeywordTable(text->mTextDecoration, nsCSSProps::SearchKeywordTable(text->mTextDecoration,
nsCSSProps::kTextDecorationKTable); nsCSSProps::kTextDecorationKTable);
val->SetString(decoration.get()); val->SetString(decoration.get());
@ -1477,7 +1477,7 @@ nsComputedDOMStyle::GetVisibility(nsIFrame *aFrame,
GetStyleData(eStyleStruct_Visibility,(const nsStyleStruct*&)visibility,aFrame); GetStyleData(eStyleStruct_Visibility,(const nsStyleStruct*&)visibility,aFrame);
if(visibility) { if(visibility) {
const nsCString& value= const nsAFlatCString& value=
nsCSSProps::SearchKeywordTable(visibility->mVisible, nsCSSProps::SearchKeywordTable(visibility->mVisible,
nsCSSProps::kVisibilityKTable); nsCSSProps::kVisibilityKTable);
val->SetString(value.get()); val->SetString(value.get());
@ -2610,7 +2610,7 @@ nsComputedDOMStyle::GetBorderWidthFor(PRUint8 aSide,
case eStyleUnit_Enumerated: case eStyleUnit_Enumerated:
case eStyleUnit_Chars: case eStyleUnit_Chars:
{ {
const nsCString& width= const nsAFlatCString& width=
nsCSSProps::SearchKeywordTable(coord.GetIntValue(), nsCSSProps::SearchKeywordTable(coord.GetIntValue(),
nsCSSProps::kBorderWidthKTable); nsCSSProps::kBorderWidthKTable);
val->SetString(width.get()); break; val->SetString(width.get()); break;
@ -2718,7 +2718,7 @@ nsComputedDOMStyle::GetBorderStyleFor(PRUint8 aSide,
GetStyleData(eStyleStruct_Border, (const nsStyleStruct*&)border, aFrame); GetStyleData(eStyleStruct_Border, (const nsStyleStruct*&)border, aFrame);
if(border) { if(border) {
const nsCString& style= const nsAFlatCString& style=
nsCSSProps::SearchKeywordTable(border->GetBorderStyle(aSide), nsCSSProps::SearchKeywordTable(border->GetBorderStyle(aSide),
nsCSSProps::kBorderStyleKTable); nsCSSProps::kBorderStyleKTable);
val->SetString(style.get()); val->SetString(style.get());

View File

@ -39,8 +39,9 @@
#ifndef nsHTMLTags_h___ #ifndef nsHTMLTags_h___
#define nsHTMLTags_h___ #define nsHTMLTags_h___
class nsString; class nsAString;
class nsCString; class nsACString;
class nsAFlatCString;
/* /*
Declare the enum list using the magic of preprocessing Declare the enum list using the magic of preprocessing
@ -71,9 +72,9 @@ public:
static void AddRefTable(void); static void AddRefTable(void);
static void ReleaseTable(void); static void ReleaseTable(void);
static nsHTMLTag LookupTag(const nsString& aTag); static nsHTMLTag LookupTag(const nsAString& aTag);
static nsHTMLTag LookupTag(const nsCString& aTag); static nsHTMLTag LookupTag(const nsACString& aTag);
static const nsCString& GetStringValue(nsHTMLTag aEnum); static const nsAFlatCString& GetStringValue(nsHTMLTag aEnum);
static const char* GetCStringValue(nsHTMLTag aEnum); static const char* GetCStringValue(nsHTMLTag aEnum);
}; };

View File

@ -86,7 +86,7 @@ nsHTMLTags::ReleaseTable(void)
} }
nsHTMLTag nsHTMLTag
nsHTMLTags::LookupTag(const nsCString& aTag) nsHTMLTags::LookupTag(const nsACString& aTag)
{ {
NS_ASSERTION(gTagTable, "no lookup table, needs addref"); NS_ASSERTION(gTagTable, "no lookup table, needs addref");
if (gTagTable) { if (gTagTable) {
@ -111,7 +111,7 @@ nsHTMLTags::LookupTag(const nsCString& aTag)
} }
nsHTMLTag nsHTMLTag
nsHTMLTags::LookupTag(const nsString& aTag) nsHTMLTags::LookupTag(const nsAString& aTag)
{ {
NS_ASSERTION(gTagTable, "no lookup table, needs addref"); NS_ASSERTION(gTagTable, "no lookup table, needs addref");
if (gTagTable) { if (gTagTable) {
@ -140,7 +140,7 @@ nsHTMLTags::LookupTag(const nsString& aTag)
return eHTMLTag_userdefined; return eHTMLTag_userdefined;
} }
const nsCString& const nsAFlatCString&
nsHTMLTags::GetStringValue(nsHTMLTag aTag) nsHTMLTags::GetStringValue(nsHTMLTag aTag)
{ {
NS_ASSERTION(gTagTable, "no lookup table, needs addref"); NS_ASSERTION(gTagTable, "no lookup table, needs addref");
@ -148,7 +148,7 @@ nsHTMLTags::GetStringValue(nsHTMLTag aTag)
// table is zero based, but tags are one based // table is zero based, but tags are one based
return gTagTable->GetStringValue(PRInt32(aTag)-1); return gTagTable->GetStringValue(PRInt32(aTag)-1);
} else { } else {
static nsCString kNullStr; static nsDependentCString kNullStr("");
return kNullStr; return kNullStr;
} }
} }

View File

@ -2267,7 +2267,8 @@ const nsAReadableString& CStyleToken::GetStringValue(void)
* @return * @return
*/ */
const char* GetTagName(PRInt32 aTag) { const char* GetTagName(PRInt32 aTag) {
const nsCString& result = nsHTMLTags::GetStringValue((nsHTMLTag) aTag); const nsAFlatCString& result =
nsHTMLTags::GetStringValue((nsHTMLTag) aTag);
if (0 == result.Length()) { if (0 == result.Length()) {
if(aTag>=eHTMLTag_userdefined) if(aTag>=eHTMLTag_userdefined)
return gUserdefined; return gUserdefined;

View File

@ -37,16 +37,21 @@
#include "nscore.h" #include "nscore.h"
#include "nsString.h" #include "nsString.h"
#include "nsStaticNameTable.h" #include "nsStaticNameTable.h"
#include "nsReadableUtils.h"
nsStaticCaseInsensitiveNameTable::nsStaticCaseInsensitiveNameTable() nsStaticCaseInsensitiveNameTable::nsStaticCaseInsensitiveNameTable()
: mNameArray(nsnull), mNameTable(nsnull), mCount(0) : mNameArray(nsnull), mNameTable(nsnull), mCount(0), mNullStr("")
{ {
MOZ_COUNT_CTOR(nsStaticCaseInsensitiveNameTable); MOZ_COUNT_CTOR(nsStaticCaseInsensitiveNameTable);
} }
nsStaticCaseInsensitiveNameTable::~nsStaticCaseInsensitiveNameTable() nsStaticCaseInsensitiveNameTable::~nsStaticCaseInsensitiveNameTable()
{ {
delete [] mNameArray; // manually call the destructor on placement-new'ed objects
for (PRInt32 index = 0; index < mCount; index++) {
mNameArray[index].~nsDependentCString();
}
nsMemory::Free((void*)mNameArray);
delete mNameTable; delete mNameTable;
MOZ_COUNT_DTOR(nsStaticCaseInsensitiveNameTable); MOZ_COUNT_DTOR(nsStaticCaseInsensitiveNameTable);
} }
@ -60,7 +65,7 @@ nsStaticCaseInsensitiveNameTable::Init(const char* Names[], PRInt32 Count)
NS_ASSERTION(Count, "0 count"); NS_ASSERTION(Count, "0 count");
mCount = Count; mCount = Count;
mNameArray = new nsCString[Count]; mNameArray = (nsDependentCString*)nsMemory::Alloc(Count * sizeof(nsDependentCString));
// XXX best bucket count heuristic? // XXX best bucket count heuristic?
mNameTable = new nsHashtable(Count<16 ? Count : Count<128 ? Count/4 : 128); mNameTable = new nsHashtable(Count<16 ? Count : Count<128 ? Count/4 : 128);
if (!mNameArray || !mNameTable) { if (!mNameArray || !mNameTable) {
@ -70,17 +75,18 @@ nsStaticCaseInsensitiveNameTable::Init(const char* Names[], PRInt32 Count)
for (PRInt32 index = 0; index < Count; ++index) { for (PRInt32 index = 0; index < Count; ++index) {
char* raw = (char*) Names[index]; char* raw = (char*) Names[index];
PRUint32 len = nsCRT::strlen(raw); PRUint32 len = nsCRT::strlen(raw);
nsStr* str = NS_STATIC_CAST(nsStr*, &mNameArray[index]);
#ifdef DEBUG #ifdef DEBUG
{ {
// verify invarients of contents // verify invarients of contents
nsCAutoString temp1(raw); nsCAutoString temp1(raw);
nsCAutoString temp2(raw); nsDependentCString temp2(raw);
temp1.ToLowerCase(); temp1.ToLowerCase();
NS_ASSERTION(temp1.Equals(temp2), "upper case char in table"); NS_ASSERTION(temp1.Equals(temp2), "upper case char in table");
} }
#endif #endif
nsStr::Initialize(*str, raw, len, len, eOneByte, PR_FALSE); // use placement-new to initialize the string object
nsDependentCString *str =
new (&mNameArray[index]) nsDependentCString(raw);
nsCStringKey key(raw, len, nsCStringKey::NEVER_OWN); nsCStringKey key(raw, len, nsCStringKey::NEVER_OWN);
mNameTable->Put(&key, (void*)(index+1)); // to make 0 != nsnull mNameTable->Put(&key, (void*)(index+1)); // to make 0 != nsnull
} }
@ -88,7 +94,7 @@ nsStaticCaseInsensitiveNameTable::Init(const char* Names[], PRInt32 Count)
} }
inline PRInt32 inline PRInt32
LookupLowercasedKeyword(const nsCString& aLowercasedKeyword, LookupLowercasedKeyword(const nsACString& aLowercasedKeyword,
nsHashtable* aTable) nsHashtable* aTable)
{ {
nsCStringKey key(aLowercasedKeyword); nsCStringKey key(aLowercasedKeyword);
@ -105,7 +111,7 @@ nsStaticCaseInsensitiveNameTable::Lookup(const nsACString& aName)
NS_ASSERTION(mCount, "not inited"); NS_ASSERTION(mCount, "not inited");
nsCAutoString strLower(aName); nsCAutoString strLower(aName);
strLower.ToLowerCase(); ToLowerCase(strLower);
return LookupLowercasedKeyword(strLower, mNameTable); return LookupLowercasedKeyword(strLower, mNameTable);
} }
@ -118,11 +124,11 @@ nsStaticCaseInsensitiveNameTable::Lookup(const nsAString& aName)
nsCAutoString strLower; nsCAutoString strLower;
strLower.AssignWithConversion(aName); strLower.AssignWithConversion(aName);
strLower.ToLowerCase(); ToLowerCase(strLower);
return LookupLowercasedKeyword(strLower, mNameTable); return LookupLowercasedKeyword(strLower, mNameTable);
} }
const nsCString& const nsAFlatCString&
nsStaticCaseInsensitiveNameTable::GetStringValue(PRInt32 index) nsStaticCaseInsensitiveNameTable::GetStringValue(PRInt32 index)
{ {
NS_ASSERTION(mNameArray, "not inited"); NS_ASSERTION(mNameArray, "not inited");

View File

@ -63,17 +63,16 @@ public:
PRBool Init(const char* Names[], PRInt32 Count); PRBool Init(const char* Names[], PRInt32 Count);
PRInt32 Lookup(const nsACString& aName); PRInt32 Lookup(const nsACString& aName);
PRInt32 Lookup(const nsAString& aName); PRInt32 Lookup(const nsAString& aName);
const nsCString& GetStringValue(PRInt32 index); const nsAFlatCString& GetStringValue(PRInt32 index);
PRBool IsNullString(const nsCString& s) {return s == mNullStr;}
nsStaticCaseInsensitiveNameTable(); nsStaticCaseInsensitiveNameTable();
~nsStaticCaseInsensitiveNameTable(); ~nsStaticCaseInsensitiveNameTable();
private: private:
nsCString* mNameArray; nsDependentCString* mNameArray;
nsHashtable* mNameTable; nsHashtable* mNameTable;
PRInt32 mCount; PRInt32 mCount;
nsCString mNullStr; nsDependentCString mNullStr;
}; };
#endif /* nsStaticNameTable_h___ */ #endif /* nsStaticNameTable_h___ */