Bug 13058: Make global enum a public member.

This commit is contained in:
pollmann%netscape.com 1999-09-15 02:30:39 +00:00
parent dabdaaa2e9
commit 73c3c9952a
8 changed files with 84 additions and 84 deletions

View File

@ -644,7 +644,7 @@ FrameManager::CaptureFrameState(nsIFrame* aFrame, nsILayoutHistoryState* aState)
PRUint32 ID;
rv = content->GetContentID(&ID);
if (NS_SUCCEEDED(rv) && ID) { // Must have ID (don't do anonymous content)
StateType type = eNoType;
nsIStatefulFrame::StateType type = nsIStatefulFrame::eNoType;
rv = statefulFrame->GetStateType(&type);
if (NS_SUCCEEDED(rv)) {
nsISupports* frameState;
@ -696,7 +696,7 @@ FrameManager::RestoreFrameState(nsIFrame* aFrame, nsILayoutHistoryState* aState)
PRUint32 ID;
rv = content->GetContentID(&ID);
if (NS_SUCCEEDED(rv) && ID) { // Must have ID (don't do anonymous content)
StateType type = eNoType;
nsIStatefulFrame::StateType type = nsIStatefulFrame::eNoType;
rv = statefulFrame->GetStateType(&type);
if (NS_SUCCEEDED(rv)) {
nsISupports* frameState = nsnull;

View File

@ -14,8 +14,8 @@ class nsILayoutHistoryState : public nsISupports {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ILAYOUTHISTORYSTATE_IID)
NS_IMETHOD AddState(PRUint32 aContentID, nsISupports* aState, StateType aStateType) = 0;
NS_IMETHOD GetState(PRUint32 aContentID, nsISupports** aState, StateType aStateType) = 0;
NS_IMETHOD AddState(PRUint32 aContentID, nsISupports* aState, nsIStatefulFrame::StateType aStateType) = 0;
NS_IMETHOD GetState(PRUint32 aContentID, nsISupports** aState, nsIStatefulFrame::StateType aStateType) = 0;
};
nsresult

View File

@ -25,8 +25,8 @@ class HistoryKey: public nsHashKey {
PRUint32 itsHash;
public:
HistoryKey(PRUint32 aContentID, StateType aStateType) {
itsHash = aContentID*eNumStateTypes + aStateType;
HistoryKey(PRUint32 aContentID, nsIStatefulFrame::StateType aStateType) {
itsHash = aContentID * nsIStatefulFrame::eNumStateTypes + aStateType;
}
HistoryKey(PRUint32 aKey) {
@ -57,10 +57,10 @@ public:
// nsILayoutHistoryState
NS_IMETHOD AddState(PRUint32 aContentID,
nsISupports* aState,
StateType aStateType = eNoType);
nsIStatefulFrame::StateType aStateType = nsIStatefulFrame::eNoType);
NS_IMETHOD GetState(PRUint32 aContentID,
nsISupports** aState,
StateType aStateType = eNoType);
nsIStatefulFrame::StateType aStateType = nsIStatefulFrame::eNoType);
private:
nsSupportsHashtable mStates;
@ -99,41 +99,41 @@ NS_IMPL_ISUPPORTS(nsLayoutHistoryState,
NS_IMETHODIMP
nsLayoutHistoryState::AddState(PRUint32 aContentID,
nsISupports* aState,
StateType aStateType)
nsIStatefulFrame::StateType aStateType)
{
HistoryKey key(aContentID, aStateType);
void * res = mStates.Put(&key, (void *) aState);
/* nsHashTable seems to return null when it actually added
* the element in to the table. If another element was already
* present in the table for the key, it seems to return the
* element that was already present. Not sure if that was
* the intended behavior
*/
if (!res)
printf("nsLayoutHistoryState::AddState State successfully added to the hash table\n");
else
printf("nsLayoutHistoryState::AddState OOPS!. There was already a state in the hash table for the key\n");
nsresult rv = NS_OK;
HistoryKey key(aContentID, aStateType);
void * res = mStates.Put(&key, (void *) aState);
/* nsHashTable seems to return null when it actually added
* the element in to the table. If another element was already
* present in the table for the key, it seems to return the
* element that was already present. Not sure if that was
* the intended behavior
*/
if (res) {
printf("nsLayoutHistoryState::AddState OOPS!. There was already a state in the hash table for the key\n");
rv = NS_ERROR_UNEXPECTED;
}
return NS_OK;
return rv;
}
NS_IMETHODIMP
nsLayoutHistoryState::GetState(PRUint32 aContentID,
nsISupports** aState,
StateType aStateType)
nsIStatefulFrame::StateType aStateType)
{
nsresult rv = NS_OK;
HistoryKey key(aContentID, aStateType);
void * state = nsnull;
state = mStates.Get(&key);
if (state) {
printf("nsLayoutHistoryState::GetState, Got the History state for the key\n");
*aState = (nsISupports *)state;
}
else {
printf("nsLayoutHistoryState::GetState, ERROR getting History state for the key\n");
*aState = nsnull;
rv = NS_ERROR_NULL_POINTER;
}
nsresult rv = NS_OK;
HistoryKey key(aContentID, aStateType);
void * state = nsnull;
state = mStates.Get(&key);
if (state) {
*aState = (nsISupports *)state;
}
else {
printf("nsLayoutHistoryState::GetState, ERROR getting History state for the key\n");
*aState = nsnull;
rv = NS_ERROR_NULL_POINTER;
}
return rv;
}

View File

@ -14,8 +14,8 @@ class nsILayoutHistoryState : public nsISupports {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ILAYOUTHISTORYSTATE_IID)
NS_IMETHOD AddState(PRUint32 aContentID, nsISupports* aState, StateType aStateType) = 0;
NS_IMETHOD GetState(PRUint32 aContentID, nsISupports** aState, StateType aStateType) = 0;
NS_IMETHOD AddState(PRUint32 aContentID, nsISupports* aState, nsIStatefulFrame::StateType aStateType) = 0;
NS_IMETHOD GetState(PRUint32 aContentID, nsISupports** aState, nsIStatefulFrame::StateType aStateType) = 0;
};
nsresult

View File

@ -9,16 +9,16 @@
{0x306c8ca0, 0x5f0c, 0x11d3, \
{0xa9, 0xfb, 0x00, 0x00, 0x64, 0x65, 0x73, 0x74}}
// If you implement nsIStatefulFrame, add an entry to this enum and use it
// in your GetStateType method to prevent collisions.
enum StateType {eNoType=-1, eCheckboxType, eFileType, eRadioType, eSelectType,
eTextType, eNumStateTypes};
class nsIStatefulFrame : public nsISupports {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ISTATEFULFRAME_IID)
NS_IMETHOD GetStateType(StateType* aStateType) = 0;
// If you implement nsIStatefulFrame, add an entry to this enum and use it
// in your GetStateType method to prevent collisions.
enum StateType {eNoType=-1, eCheckboxType, eFileType, eRadioType, eSelectType,
eTextType, eNumStateTypes};
NS_IMETHOD GetStateType(nsIStatefulFrame::StateType* aStateType) = 0;
NS_IMETHOD SaveState(nsISupports** aState) = 0;
NS_IMETHOD RestoreState(nsISupports* aState) = 0;

View File

@ -25,8 +25,8 @@ class HistoryKey: public nsHashKey {
PRUint32 itsHash;
public:
HistoryKey(PRUint32 aContentID, StateType aStateType) {
itsHash = aContentID*eNumStateTypes + aStateType;
HistoryKey(PRUint32 aContentID, nsIStatefulFrame::StateType aStateType) {
itsHash = aContentID * nsIStatefulFrame::eNumStateTypes + aStateType;
}
HistoryKey(PRUint32 aKey) {
@ -57,10 +57,10 @@ public:
// nsILayoutHistoryState
NS_IMETHOD AddState(PRUint32 aContentID,
nsISupports* aState,
StateType aStateType = eNoType);
nsIStatefulFrame::StateType aStateType = nsIStatefulFrame::eNoType);
NS_IMETHOD GetState(PRUint32 aContentID,
nsISupports** aState,
StateType aStateType = eNoType);
nsIStatefulFrame::StateType aStateType = nsIStatefulFrame::eNoType);
private:
nsSupportsHashtable mStates;
@ -99,41 +99,41 @@ NS_IMPL_ISUPPORTS(nsLayoutHistoryState,
NS_IMETHODIMP
nsLayoutHistoryState::AddState(PRUint32 aContentID,
nsISupports* aState,
StateType aStateType)
nsIStatefulFrame::StateType aStateType)
{
HistoryKey key(aContentID, aStateType);
void * res = mStates.Put(&key, (void *) aState);
/* nsHashTable seems to return null when it actually added
* the element in to the table. If another element was already
* present in the table for the key, it seems to return the
* element that was already present. Not sure if that was
* the intended behavior
*/
if (!res)
printf("nsLayoutHistoryState::AddState State successfully added to the hash table\n");
else
printf("nsLayoutHistoryState::AddState OOPS!. There was already a state in the hash table for the key\n");
nsresult rv = NS_OK;
HistoryKey key(aContentID, aStateType);
void * res = mStates.Put(&key, (void *) aState);
/* nsHashTable seems to return null when it actually added
* the element in to the table. If another element was already
* present in the table for the key, it seems to return the
* element that was already present. Not sure if that was
* the intended behavior
*/
if (res) {
printf("nsLayoutHistoryState::AddState OOPS!. There was already a state in the hash table for the key\n");
rv = NS_ERROR_UNEXPECTED;
}
return NS_OK;
return rv;
}
NS_IMETHODIMP
nsLayoutHistoryState::GetState(PRUint32 aContentID,
nsISupports** aState,
StateType aStateType)
nsIStatefulFrame::StateType aStateType)
{
nsresult rv = NS_OK;
HistoryKey key(aContentID, aStateType);
void * state = nsnull;
state = mStates.Get(&key);
if (state) {
printf("nsLayoutHistoryState::GetState, Got the History state for the key\n");
*aState = (nsISupports *)state;
}
else {
printf("nsLayoutHistoryState::GetState, ERROR getting History state for the key\n");
*aState = nsnull;
rv = NS_ERROR_NULL_POINTER;
}
nsresult rv = NS_OK;
HistoryKey key(aContentID, aStateType);
void * state = nsnull;
state = mStates.Get(&key);
if (state) {
*aState = (nsISupports *)state;
}
else {
printf("nsLayoutHistoryState::GetState, ERROR getting History state for the key\n");
*aState = nsnull;
rv = NS_ERROR_NULL_POINTER;
}
return rv;
}

View File

@ -9,16 +9,16 @@
{0x306c8ca0, 0x5f0c, 0x11d3, \
{0xa9, 0xfb, 0x00, 0x00, 0x64, 0x65, 0x73, 0x74}}
// If you implement nsIStatefulFrame, add an entry to this enum and use it
// in your GetStateType method to prevent collisions.
enum StateType {eNoType=-1, eCheckboxType, eFileType, eRadioType, eSelectType,
eTextType, eNumStateTypes};
class nsIStatefulFrame : public nsISupports {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ISTATEFULFRAME_IID)
NS_IMETHOD GetStateType(StateType* aStateType) = 0;
// If you implement nsIStatefulFrame, add an entry to this enum and use it
// in your GetStateType method to prevent collisions.
enum StateType {eNoType=-1, eCheckboxType, eFileType, eRadioType, eSelectType,
eTextType, eNumStateTypes};
NS_IMETHOD GetStateType(nsIStatefulFrame::StateType* aStateType) = 0;
NS_IMETHOD SaveState(nsISupports** aState) = 0;
NS_IMETHOD RestoreState(nsISupports* aState) = 0;

View File

@ -644,7 +644,7 @@ FrameManager::CaptureFrameState(nsIFrame* aFrame, nsILayoutHistoryState* aState)
PRUint32 ID;
rv = content->GetContentID(&ID);
if (NS_SUCCEEDED(rv) && ID) { // Must have ID (don't do anonymous content)
StateType type = eNoType;
nsIStatefulFrame::StateType type = nsIStatefulFrame::eNoType;
rv = statefulFrame->GetStateType(&type);
if (NS_SUCCEEDED(rv)) {
nsISupports* frameState;
@ -696,7 +696,7 @@ FrameManager::RestoreFrameState(nsIFrame* aFrame, nsILayoutHistoryState* aState)
PRUint32 ID;
rv = content->GetContentID(&ID);
if (NS_SUCCEEDED(rv) && ID) { // Must have ID (don't do anonymous content)
StateType type = eNoType;
nsIStatefulFrame::StateType type = nsIStatefulFrame::eNoType;
rv = statefulFrame->GetStateType(&type);
if (NS_SUCCEEDED(rv)) {
nsISupports* frameState = nsnull;