xpcom/build/Services.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/xpcom/build/Services.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,44 @@
     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 mozilla_Services_h
    1.10 +#define mozilla_Services_h
    1.11 +
    1.12 +#include "nscore.h"
    1.13 +#include "nsCOMPtr.h"
    1.14 +
    1.15 +#define MOZ_USE_NAMESPACE
    1.16 +#define MOZ_SERVICE(NAME, TYPE, SERVICE_CID) class TYPE;
    1.17 +
    1.18 +#include "ServiceList.h"
    1.19 +#undef MOZ_SERVICE
    1.20 +#undef MOZ_USE_NAMESPACE
    1.21 +
    1.22 +namespace mozilla {
    1.23 +namespace services {
    1.24 +
    1.25 +#ifdef MOZILLA_INTERNAL_API
    1.26 +#define MOZ_SERVICE(NAME, TYPE, SERVICE_CID)                        \
    1.27 +    already_AddRefed<TYPE> Get##NAME();                             \
    1.28 +    NS_EXPORT_(already_AddRefed<TYPE>) _external_Get##NAME();
    1.29 +
    1.30 +#include "ServiceList.h"
    1.31 +#undef MOZ_SERVICE
    1.32 +#else
    1.33 +#define MOZ_SERVICE(NAME, TYPE, SERVICE_CID)                        \
    1.34 +    NS_IMPORT_(already_AddRefed<TYPE>) _external_Get##NAME();       \
    1.35 +    inline already_AddRefed<TYPE> Get##NAME()                       \
    1.36 +    {                                                               \
    1.37 +        return _external_Get##NAME();                               \
    1.38 +    }
    1.39 +
    1.40 +#include "ServiceList.h"
    1.41 +#undef MOZ_SERVICE
    1.42 +#endif
    1.43 +
    1.44 +} // namespace services
    1.45 +} // namespace mozilla
    1.46 +
    1.47 +#endif

mercurial