Back to index

lightning-sunbird  0.9+nobinonly
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Friends
nsSVGEnum Class Reference
Inheritance diagram for nsSVGEnum:
Inheritance graph
[legend]
Collaboration diagram for nsSVGEnum:
Collaboration graph
[legend]

List of all members.

Public Types

enum  modificationType { mod_other = 0, mod_context, mod_die }

Public Member Functions

NS_DECL_ISUPPORTS NS_IMETHOD GetIntegerValue (PRUint16 &value)
NS_IMETHOD SetIntegerValue (PRUint16 value)
NS_IMETHOD SetValueString (const nsAString &aValue)
NS_IMETHOD GetValueString (nsAString &aValue)
NS_IMETHOD AddObserver (nsISVGValueObserver *observer)
NS_IMETHOD RemoveObserver (nsISVGValueObserver *observer)
NS_IMETHOD BeginBatchUpdate ()
NS_IMETHOD EndBatchUpdate ()
typedef NS_STDCALL_FUNCPROTO (nsresult, SVGObserverNotifyFunction, nsISVGValueObserver, DidModifySVGObservable,(nsISVGValue *, nsISVGValue::modificationType))

Protected Member Functions

 nsSVGEnum (PRUint16 value, nsSVGEnumMapping *mapping)
 nsSVGEnum (nsSVGEnumMapping *mapping)
virtual ~nsSVGEnum ()
void WillModify (modificationType aModType=mod_other)
void DidModify (modificationType aModType=mod_other)
void ReleaseObservers ()
void NotifyObservers (SVGObserverNotifyFunction f, modificationType aModType)
PRInt32 GetModifyNestCount ()

Protected Attributes

PRUint16 mValue
nsSVGEnumMappingmMapping

Friends

nsresult NS_NewSVGEnum (nsISVGEnum **result, PRUint16 value, nsSVGEnumMapping *mapping)
nsresult NS_NewSVGEnum (nsISVGEnum **result, const nsAString &value, nsSVGEnumMapping *mapping)
class nsSVGValueAutoNotifier

Detailed Description

Definition at line 48 of file nsSVGEnum.cpp.


Member Enumeration Documentation

Enumerator:
mod_other 
mod_context 
mod_die 

Definition at line 68 of file nsISVGValue.h.


Constructor & Destructor Documentation

nsSVGEnum::nsSVGEnum ( PRUint16  value,
nsSVGEnumMapping mapping 
) [protected]

Definition at line 135 of file nsSVGEnum.cpp.

    : mValue(value), mMapping(mapping)
{
}
nsSVGEnum::nsSVGEnum ( nsSVGEnumMapping mapping) [protected]
nsSVGEnum::~nsSVGEnum ( ) [protected, virtual]

Definition at line 141 of file nsSVGEnum.cpp.

{
}

Member Function Documentation

NS_IMETHODIMP nsSVGValue::AddObserver ( nsISVGValueObserver observer) [virtual, inherited]

Implements nsISVGValue.

Definition at line 97 of file nsSVGValue.cpp.

{
  nsIWeakReference* wr = NS_GetWeakReference(observer);
  if (!wr) return NS_ERROR_FAILURE;
  mObservers.AppendElement((void*)wr);
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHODIMP nsSVGValue::BeginBatchUpdate ( ) [virtual, inherited]

Implements nsISVGValue.

Definition at line 119 of file nsSVGValue.cpp.

{
  WillModify();
  return NS_OK;
}

Here is the call graph for this function:

void nsSVGValue::DidModify ( modificationType  aModType = mod_other) [protected, inherited]

Definition at line 86 of file nsSVGValue.cpp.

{
  NS_ASSERTION(mModifyNestCount>0, "unbalanced Will/DidModify calls");
  if (--mModifyNestCount == 0) {
    OnDidModify();
    NotifyObservers(&nsISVGValueObserver::DidModifySVGObservable, aModType);
  }
}

Here is the call graph for this function:

NS_IMETHODIMP nsSVGValue::EndBatchUpdate ( ) [virtual, inherited]

Implements nsISVGValue.

Definition at line 126 of file nsSVGValue.cpp.

{
  DidModify();
  return NS_OK;
}

Here is the call graph for this function:

Implements nsISVGEnum.

Definition at line 201 of file nsSVGEnum.cpp.

{
  aValue = mValue;
  return NS_OK;
}
PRInt32 nsSVGValue::GetModifyNestCount ( ) [inline, protected, inherited]

Definition at line 79 of file nsSVGValue.h.

{ return mModifyNestCount; }
NS_IMETHODIMP nsSVGEnum::GetValueString ( nsAString &  aValue) [virtual]

Implements nsISVGValue.

Definition at line 182 of file nsSVGEnum.cpp.

{
  nsSVGEnumMapping *tmp = mMapping;

  while (tmp->key) {
    if (mValue == tmp->val) {
      (*tmp->key)->ToString(aValue);
      return NS_OK;
    }
    tmp++;
  }
  NS_ERROR("unknown enumeration value");
  return NS_ERROR_FAILURE;
}

Here is the call graph for this function:

void nsSVGValue::NotifyObservers ( SVGObserverNotifyFunction  f,
modificationType  aModType 
) [protected, inherited]

Definition at line 66 of file nsSVGValue.cpp.

{
  PRInt32 count = mObservers.Count();
  for (PRInt32 i = 0; i < count; ++i) {
    nsIWeakReference* wr = NS_STATIC_CAST(nsIWeakReference*,mObservers.ElementAt(i));
    nsCOMPtr<nsISVGValueObserver> observer = do_QueryReferent(wr);
    if (observer)
       (NS_STATIC_CAST(nsISVGValueObserver*,observer)->*f)(this, aModType);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

typedef nsSVGValue::NS_STDCALL_FUNCPROTO ( nsresult  ,
SVGObserverNotifyFunction  ,
nsISVGValueObserver  ,
DidModifySVGObservable  ,
(nsISVGValue *, nsISVGValue::modificationType  
) [inherited]
void nsSVGValue::ReleaseObservers ( ) [protected, inherited]

Definition at line 53 of file nsSVGValue.cpp.

{
  PRInt32 count = mObservers.Count();
  PRInt32 i;
  for (i = 0; i < count; ++i) {
    nsIWeakReference* wr = NS_STATIC_CAST(nsIWeakReference*,mObservers.ElementAt(i));
    NS_RELEASE(wr);
  }
  while (i)
    mObservers.RemoveElementAt(--i);
}

Here is the caller graph for this function:

NS_IMETHODIMP nsSVGValue::RemoveObserver ( nsISVGValueObserver observer) [virtual, inherited]

Implements nsISVGValue.

Definition at line 106 of file nsSVGValue.cpp.

{
  nsCOMPtr<nsIWeakReference> wr = do_GetWeakReference(observer);
  if (!wr) return NS_ERROR_FAILURE;
  PRInt32 i = mObservers.IndexOf((void*)wr);
  if (i<0) return NS_ERROR_FAILURE;
  nsIWeakReference* wr2 = NS_STATIC_CAST(nsIWeakReference*,mObservers.ElementAt(i));
  NS_RELEASE(wr2);
  mObservers.RemoveElementAt(i);
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Implements nsISVGEnum.

Definition at line 208 of file nsSVGEnum.cpp.

{
  WillModify();
  mValue = aValue;
  DidModify();
  return NS_OK;
}

Here is the call graph for this function:

Implements nsISVGValue.

Definition at line 160 of file nsSVGEnum.cpp.

{
  nsCOMPtr<nsIAtom> valAtom = do_GetAtom(aValue);

  nsSVGEnumMapping *tmp = mMapping;

  while (tmp->key) {
    if (valAtom == *(tmp->key)) {
      WillModify();
      mValue = tmp->val;
      DidModify();
      return NS_OK;
    }
    tmp++;
  }

  // only a warning since authors may mistype attribute values
  NS_WARNING("unknown enumeration key");
  return NS_ERROR_FAILURE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsSVGValue::WillModify ( modificationType  aModType = mod_other) [protected, inherited]

Definition at line 79 of file nsSVGValue.cpp.

Here is the call graph for this function:


Friends And Related Function Documentation

nsresult NS_NewSVGEnum ( nsISVGEnum **  result,
PRUint16  value,
nsSVGEnumMapping mapping 
) [friend]

Definition at line 104 of file nsSVGEnum.cpp.

{
  NS_ASSERTION(mapping, "no mapping");
  nsSVGEnum *pe = new nsSVGEnum(value, mapping);
  if (!pe) return NS_ERROR_OUT_OF_MEMORY;
  NS_ADDREF(pe);
  *result = pe;
  return NS_OK;
}
nsresult NS_NewSVGEnum ( nsISVGEnum **  result,
const nsAString &  value,
nsSVGEnumMapping mapping 
) [friend]

Definition at line 117 of file nsSVGEnum.cpp.

{
  NS_ASSERTION(mapping, "no mapping");
  *result = nsnull;
  nsSVGEnum *pe = new nsSVGEnum(0, mapping);
  if (!pe) return NS_ERROR_OUT_OF_MEMORY;
  NS_ADDREF(pe);
  if (NS_FAILED(pe->SetValueString(value))) {
    NS_RELEASE(pe);
    return NS_ERROR_FAILURE;
  }
  *result = pe;
  return NS_OK;
}  
friend class nsSVGValueAutoNotifier [friend, inherited]

Definition at line 59 of file nsSVGValue.h.


Member Data Documentation

Definition at line 82 of file nsSVGEnum.cpp.

Definition at line 81 of file nsSVGEnum.cpp.


The documentation for this class was generated from the following file: