1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
22 #include <cppuhelper/implbase.hxx>
23 #include <cppuhelper/supportsservice.hxx>
24 #include <com/sun/star/lang/XServiceInfo.hpp>
25 #include <com/sun/star/lang/XInitialization.hpp>
26 #include <com/sun/star/rdf/XBlankNode.hpp>
28 #include <com/sun/star/lang/IllegalArgumentException.hpp>
31 /// anonymous implementation namespace
35 public ::cppu::WeakImplHelper
<
36 css::lang::XServiceInfo
,
37 css::lang::XInitialization
,
42 virtual ~CBlankNode() {}
44 // css::lang::XServiceInfo:
45 virtual OUString SAL_CALL
getImplementationName() throw (css::uno::RuntimeException
, std::exception
) override
;
46 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) throw (css::uno::RuntimeException
, std::exception
) override
;
47 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() throw (css::uno::RuntimeException
, std::exception
) override
;
49 // css::lang::XInitialization:
50 virtual void SAL_CALL
initialize(const css::uno::Sequence
< css::uno::Any
> & aArguments
) throw (css::uno::RuntimeException
, css::uno::Exception
, std::exception
) override
;
53 virtual OUString SAL_CALL
getStringValue() throw (css::uno::RuntimeException
, std::exception
) override
;
56 CBlankNode(CBlankNode
const&) = delete;
57 CBlankNode
& operator=(CBlankNode
const&) = delete;
62 CBlankNode::CBlankNode() :
66 // com.sun.star.uno.XServiceInfo:
67 OUString SAL_CALL
CBlankNode::getImplementationName() throw (css::uno::RuntimeException
, std::exception
)
69 return comp_CBlankNode::_getImplementationName();
72 sal_Bool SAL_CALL
CBlankNode::supportsService(OUString
const & serviceName
) throw (css::uno::RuntimeException
, std::exception
)
74 return cppu::supportsService(this, serviceName
);
77 css::uno::Sequence
< OUString
> SAL_CALL
CBlankNode::getSupportedServiceNames() throw (css::uno::RuntimeException
, std::exception
)
79 return comp_CBlankNode::_getSupportedServiceNames();
82 // css::lang::XInitialization:
83 void SAL_CALL
CBlankNode::initialize(const css::uno::Sequence
< css::uno::Any
> & aArguments
) throw (css::uno::RuntimeException
, css::uno::Exception
, std::exception
)
85 if (aArguments
.getLength() != 1) {
86 throw css::lang::IllegalArgumentException(
87 OUString("CBlankNode::initialize: "
88 "must give exactly 1 argument"), *this, 1);
92 if (!(aArguments
[0] >>= arg
)) {
93 throw css::lang::IllegalArgumentException(
94 OUString("CBlankNode::initialize: "
95 "argument must be string"), *this, 0);
98 //FIXME: what is legal?
102 throw css::lang::IllegalArgumentException(
103 OUString("CBlankNode::initialize: "
104 "argument is not valid blank node ID"), *this, 0);
109 OUString SAL_CALL
CBlankNode::getStringValue() throw (css::uno::RuntimeException
, std::exception
)
114 } // closing anonymous implementation namespace
117 // component helper namespace
118 namespace comp_CBlankNode
{
120 OUString SAL_CALL
_getImplementationName() {
121 return OUString( "CBlankNode");
124 css::uno::Sequence
< OUString
> SAL_CALL
_getSupportedServiceNames()
126 css::uno::Sequence
< OUString
> s
{ "com.sun.star.rdf.BlankNode" };
130 css::uno::Reference
< css::uno::XInterface
> SAL_CALL
_create(
131 const css::uno::Reference
< css::uno::XComponentContext
> & )
133 return static_cast< ::cppu::OWeakObject
* >(new CBlankNode
);
136 } // closing component helper namespace
138 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */