dom/xslt/base/txNamespaceMap.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/xslt/base/txNamespaceMap.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,43 @@
     1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     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 TRANSFRMX_TXNAMESPACEMAP_H
    1.10 +#define TRANSFRMX_TXNAMESPACEMAP_H
    1.11 +
    1.12 +#include "nsIAtom.h"
    1.13 +#include "nsCOMArray.h"
    1.14 +#include "nsTArray.h"
    1.15 +
    1.16 +class txNamespaceMap
    1.17 +{
    1.18 +public:
    1.19 +    txNamespaceMap();
    1.20 +    txNamespaceMap(const txNamespaceMap& aOther);
    1.21 +
    1.22 +    nsrefcnt AddRef()
    1.23 +    {
    1.24 +        return ++mRefCnt;
    1.25 +    }
    1.26 +    nsrefcnt Release()
    1.27 +    {
    1.28 +        if (--mRefCnt == 0) {
    1.29 +            mRefCnt = 1; //stabilize
    1.30 +            delete this;
    1.31 +            return 0;
    1.32 +        }
    1.33 +        return mRefCnt;
    1.34 +    }
    1.35 +
    1.36 +    nsresult mapNamespace(nsIAtom* aPrefix, const nsAString& aNamespaceURI);
    1.37 +    int32_t lookupNamespace(nsIAtom* aPrefix);
    1.38 +    int32_t lookupNamespaceWithDefault(const nsAString& aPrefix);
    1.39 +
    1.40 +private:
    1.41 +    nsAutoRefCnt mRefCnt;
    1.42 +    nsCOMArray<nsIAtom> mPrefixes;
    1.43 +    nsTArray<int32_t> mNamespaces;
    1.44 +};
    1.45 +
    1.46 +#endif //TRANSFRMX_TXNAMESPACEMAP_H

mercurial