xref: /trunk/main/test/source/cpp/uniquepipename.cxx (revision be9e621a120f4a8772dbe747ae82c74abedc6aa0)
1*be9e621aSdamjan /**************************************************************
2*be9e621aSdamjan  *
3*be9e621aSdamjan  * Licensed to the Apache Software Foundation (ASF) under one
4*be9e621aSdamjan  * or more contributor license agreements.  See the NOTICE file
5*be9e621aSdamjan  * distributed with this work for additional information
6*be9e621aSdamjan  * regarding copyright ownership.  The ASF licenses this file
7*be9e621aSdamjan  * to you under the Apache License, Version 2.0 (the
8*be9e621aSdamjan  * "License"); you may not use this file except in compliance
9*be9e621aSdamjan  * with the License.  You may obtain a copy of the License at
10*be9e621aSdamjan  *
11*be9e621aSdamjan  *   http://www.apache.org/licenses/LICENSE-2.0
12*be9e621aSdamjan  *
13*be9e621aSdamjan  * Unless required by applicable law or agreed to in writing,
14*be9e621aSdamjan  * software distributed under the License is distributed on an
15*be9e621aSdamjan  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*be9e621aSdamjan  * KIND, either express or implied.  See the License for the
17*be9e621aSdamjan  * specific language governing permissions and limitations
18*be9e621aSdamjan  * under the License.
19*be9e621aSdamjan  *
20*be9e621aSdamjan  *************************************************************/
21*be9e621aSdamjan 
22*be9e621aSdamjan 
23*be9e621aSdamjan 
24*be9e621aSdamjan #include "sal/config.h"
25*be9e621aSdamjan 
26*be9e621aSdamjan #include "cppunit/TestAssert.h"
27*be9e621aSdamjan #include "osl/process.h"
28*be9e621aSdamjan #include "rtl/ustring.h"
29*be9e621aSdamjan #include "rtl/ustring.hxx"
30*be9e621aSdamjan #include "sal/types.h"
31*be9e621aSdamjan #include "test/uniquepipename.hxx"
32*be9e621aSdamjan 
33*be9e621aSdamjan namespace test {
34*be9e621aSdamjan 
35*be9e621aSdamjan rtl::OUString uniquePipeName(rtl::OUString const & name) {
36*be9e621aSdamjan     oslProcessInfo info;
37*be9e621aSdamjan     info.Size = sizeof info;
38*be9e621aSdamjan     CPPUNIT_ASSERT_EQUAL(
39*be9e621aSdamjan         osl_Process_E_None,
40*be9e621aSdamjan         osl_getProcessInfo(0, osl_Process_IDENTIFIER, &info));
41*be9e621aSdamjan     return name + rtl::OUString::valueOf(static_cast< sal_Int64 >(info.Ident));
42*be9e621aSdamjan }
43*be9e621aSdamjan 
44*be9e621aSdamjan }
45