dom/xbl/nsXBLProtoImplField.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/xbl/nsXBLProtoImplField.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,63 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#ifndef nsXBLProtoImplField_h__
    1.10 +#define nsXBLProtoImplField_h__
    1.11 +
    1.12 +#include "nsIAtom.h"
    1.13 +#include "nsString.h"
    1.14 +#include "jsapi.h"
    1.15 +#include "nsString.h"
    1.16 +#include "nsXBLProtoImplMember.h"
    1.17 +
    1.18 +class nsIObjectInputStream;
    1.19 +class nsIObjectOutputStream;
    1.20 +class nsIScriptContext;
    1.21 +class nsIURI;
    1.22 +
    1.23 +class nsXBLProtoImplField
    1.24 +{
    1.25 +public:
    1.26 +  nsXBLProtoImplField(const char16_t* aName, const char16_t* aReadOnly);
    1.27 +  nsXBLProtoImplField(const bool aIsReadOnly);
    1.28 +  ~nsXBLProtoImplField();
    1.29 +
    1.30 +  void AppendFieldText(const nsAString& aText);
    1.31 +  void SetLineNumber(uint32_t aLineNumber) {
    1.32 +    mLineNumber = aLineNumber;
    1.33 +  }
    1.34 +  
    1.35 +  nsXBLProtoImplField* GetNext() const { return mNext; }
    1.36 +  void SetNext(nsXBLProtoImplField* aNext) { mNext = aNext; }
    1.37 +
    1.38 +  nsresult InstallField(JS::Handle<JSObject*> aBoundNode,
    1.39 +                        nsIURI* aBindingDocURI,
    1.40 +                        bool* aDidInstall) const;
    1.41 +
    1.42 +  nsresult InstallAccessors(JSContext* aCx,
    1.43 +                            JS::Handle<JSObject*> aTargetClassObject);
    1.44 +
    1.45 +  nsresult Read(nsIObjectInputStream* aStream);
    1.46 +  nsresult Write(nsIObjectOutputStream* aStream);
    1.47 +
    1.48 +  const char16_t* GetName() const { return mName; }
    1.49 +
    1.50 +  unsigned AccessorAttributes() const {
    1.51 +    return JSPROP_SHARED | JSPROP_GETTER | JSPROP_SETTER |
    1.52 +           (mJSAttributes & (JSPROP_ENUMERATE | JSPROP_PERMANENT));
    1.53 +  }
    1.54 +
    1.55 +  bool IsEmpty() const { return mFieldTextLength == 0; }
    1.56 +
    1.57 +protected:
    1.58 +  nsXBLProtoImplField* mNext;
    1.59 +  char16_t* mName;
    1.60 +  char16_t* mFieldText;
    1.61 +  uint32_t mFieldTextLength;
    1.62 +  uint32_t mLineNumber;
    1.63 +  unsigned mJSAttributes;
    1.64 +};
    1.65 +
    1.66 +#endif // nsXBLProtoImplField_h__

mercurial