Back to index

lightning-sunbird  0.9+nobinonly
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Friends
nsSVGLengthList Class Reference
Inheritance diagram for nsSVGLengthList:
Inheritance graph
[legend]
Collaboration diagram for nsSVGLengthList:
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_DECL_NSIDOMSVGLENGTHLIST
NS_IMETHOD 
SetContext (nsSVGCoordCtx *context)
NS_IMETHOD SetValueString (const nsAString &aValue)
NS_IMETHOD GetValueString (nsAString &aValue)
NS_IMETHOD WillModifySVGObservable (nsISVGValue *observable, modificationType aModType)
NS_IMETHOD DidModifySVGObservable (nsISVGValue *observable, modificationType aModType)
void clear ()
nsIDOMSVGLength initialize (in nsIDOMSVGLength newItem)
nsIDOMSVGLength getItem (in unsigned long index)
nsIDOMSVGLength insertItemBefore (in nsIDOMSVGLength newItem, in unsigned long index)
nsIDOMSVGLength replaceItem (in nsIDOMSVGLength newItem, in unsigned long index)
nsIDOMSVGLength removeItem (in unsigned long index)
nsIDOMSVGLength appendItem (in nsIDOMSVGLength newItem)
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))

Static Public Member Functions

static const nsIIDGetIID ()

Public Attributes

readonly attribute unsigned long numberOfItems

Protected Member Functions

 nsSVGLengthList ()
 ~nsSVGLengthList ()
nsISVGLengthElementAt (PRInt32 index)
void AppendElement (nsISVGLength *aElement)
void RemoveElementAt (PRInt32 index)
void InsertElementAt (nsISVGLength *aElement, PRInt32 index)
void ReleaseLengths ()
void WillModify (modificationType aModType=mod_other)
void DidModify (modificationType aModType=mod_other)
void ReleaseObservers ()
void NotifyObservers (SVGObserverNotifyFunction f, modificationType aModType)
PRInt32 GetModifyNestCount ()

Protected Attributes

nsAutoVoidArray mLengths
nsRefPtr< nsSVGCoordCtxmContext

Friends

nsresult NS_NewSVGLengthList (nsISVGLengthList **result)
class nsSVGValueAutoNotifier

Detailed Description

Definition at line 54 of file nsSVGLengthList.cpp.


Member Enumeration Documentation

Enumerator:
mod_other 
mod_context 
mod_die 

Definition at line 68 of file nsISVGValue.h.


Constructor & Destructor Documentation

Definition at line 106 of file nsSVGLengthList.cpp.

{
}

Definition at line 110 of file nsSVGLengthList.cpp.

Here is the call graph for this function:


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:

void nsSVGLengthList::AppendElement ( nsISVGLength aElement) [protected]

Definition at line 358 of file nsSVGLengthList.cpp.

{
  WillModify();
  NS_ADDREF(aElement);
  
  // The SVG specs state that 'if newItem is already in a list, it
  // is removed from its previous list before it is inserted into this
  // list':
  //  aElement->SetListOwner(this);
  
  aElement->SetContext(mContext);
  mLengths.AppendElement((void*)aElement);
  NS_ADD_SVGVALUE_OBSERVER(aElement);
  DidModify();
}

Here is the call 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:

Implements nsISVGValueObserver.

Definition at line 326 of file nsSVGLengthList.cpp.

{
  DidModify(aModType);
  return NS_OK;
}

Here is the call graph for this function:

Definition at line 352 of file nsSVGLengthList.cpp.

{
  return (nsISVGLength*)mLengths.ElementAt(index);
}

Here is the caller 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:

static const nsIID& nsISVGLengthList::GetIID ( ) [inline, static, inherited]

Definition at line 57 of file nsISVGLengthList.h.

{ static nsIID iid = NS_ISVGLENGTHLIST_IID; return iid; }

Here is the caller graph for this function:

nsIDOMSVGLength nsIDOMSVGLengthList::getItem ( in unsigned long  index) [inherited]
PRInt32 nsSVGValue::GetModifyNestCount ( ) [inline, protected, inherited]

Definition at line 79 of file nsSVGValue.h.

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

Implements nsISVGValue.

Definition at line 167 of file nsSVGLengthList.cpp.

{
  aValue.Truncate();

  PRInt32 count = mLengths.Count();

  if (count<=0) return NS_OK;

  PRInt32 i = 0;
  
  while (1) {
    nsISVGLength* length = ElementAt(i);
    nsCOMPtr<nsISVGValue> val = do_QueryInterface(length);
    NS_ASSERTION(val, "length doesn't implement required interface");
    if (!val) continue;
    nsAutoString str;
    val->GetValueString(str);
    aValue.Append(str);

    if (++i >= count) break;

    aValue.AppendLiteral(" ");
  }
  
  return NS_OK;
}

Here is the call graph for this function:

void nsSVGLengthList::InsertElementAt ( nsISVGLength aElement,
PRInt32  index 
) [protected]

Definition at line 387 of file nsSVGLengthList.cpp.

{
  WillModify();
  NS_ADDREF(aElement);

  // The SVG specs state that 'if newItem is already in a list, it
  // is removed from its previous list before it is inserted into this
  // list':
  //  aElement->SetListOwner(this);
  
  aElement->SetContext(mContext);
  
  mLengths.InsertElementAt((void*)aElement, index);
  NS_ADD_SVGVALUE_OBSERVER(aElement);
  DidModify();
}

Here is the call graph for this function:

nsIDOMSVGLength nsIDOMSVGLengthList::insertItemBefore ( in nsIDOMSVGLength  newItem,
in unsigned long  index 
) [inherited]
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]

Definition at line 337 of file nsSVGLengthList.cpp.

{
  WillModify();
  PRInt32 count = mLengths.Count();
  for (PRInt32 i = 0; i < count; ++i) {
    nsISVGLength* length = ElementAt(i);
    length->SetContext(nsnull);
    NS_REMOVE_SVGVALUE_OBSERVER(length);
    NS_RELEASE(length);
  }
  mLengths.Clear();
  DidModify();
}

Here is the call graph for this function:

Here is the caller graph for this function:

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:

Definition at line 375 of file nsSVGLengthList.cpp.

{
  WillModify();
  nsISVGLength* length = ElementAt(index);
  NS_ASSERTION(length, "null length");
  NS_REMOVE_SVGVALUE_OBSERVER(length);
  mLengths.RemoveElementAt(index);
  NS_RELEASE(length);
  DidModify();
}

Here is the call graph for this function:

nsIDOMSVGLength nsIDOMSVGLengthList::removeItem ( in unsigned long  index) [inherited]
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:

nsIDOMSVGLength nsIDOMSVGLengthList::replaceItem ( in nsIDOMSVGLength  newItem,
in unsigned long  index 
) [inherited]

Implements nsISVGLengthList.

Definition at line 302 of file nsSVGLengthList.cpp.

{
  mContext = context;

  PRInt32 count = mLengths.Count();
  for (PRInt32 i = 0; i < count; ++i) {
    nsISVGLength* length = ElementAt(i);
    length->SetContext(mContext);
  }
  return NS_OK;
}

Here is the call graph for this function:

Implements nsISVGValue.

Definition at line 135 of file nsSVGLengthList.cpp.

{
  WillModify();
  
  ReleaseLengths();

  nsresult rv = NS_OK;

  char* str;
  str = ToNewCString(aValue);

  char* rest = str;
  char* token;
  const char* delimiters = ",\x20\x9\xD\xA";

  while ((token = nsCRT::strtok(rest, delimiters, &rest))) {
    nsCOMPtr<nsISVGLength> length;
    NS_NewSVGLength(getter_AddRefs(length), NS_ConvertASCIItoUCS2(token));
    if (!length) {
      rv = NS_ERROR_FAILURE;
      break;
    }
    AppendElement(length);
  }
  
  nsMemory::Free(str);
  
  DidModify();
  return rv;
}

Here is the call 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:

Implements nsISVGValueObserver.

Definition at line 318 of file nsSVGLengthList.cpp.

{
  WillModify(aModType);
  return NS_OK;
}

Here is the call graph for this function:


Friends And Related Function Documentation

Definition at line 409 of file nsSVGLengthList.cpp.

{
  *result = nsnull;
  
  nsSVGLengthList* lengthList = new nsSVGLengthList();
  if (!lengthList) return NS_ERROR_OUT_OF_MEMORY;
  NS_ADDREF(lengthList);

  *result = lengthList;
  
  return NS_OK;
}
friend class nsSVGValueAutoNotifier [friend, inherited]

Definition at line 59 of file nsSVGValue.h.


Member Data Documentation

Definition at line 99 of file nsSVGLengthList.cpp.

nsAutoVoidArray nsSVGLengthList::mLengths [protected]

Definition at line 98 of file nsSVGLengthList.cpp.

readonly attribute unsigned long nsIDOMSVGLengthList::numberOfItems [inherited]

Definition at line 46 of file nsIDOMSVGLengthList.idl.


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