xref: /aoo42x/main/cppu/source/uno/EnvDcp.c (revision acb7242c)
1*acb7242cSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*acb7242cSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*acb7242cSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*acb7242cSAndrew Rist  * distributed with this work for additional information
6*acb7242cSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*acb7242cSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*acb7242cSAndrew Rist  * "License"); you may not use this file except in compliance
9*acb7242cSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*acb7242cSAndrew Rist  *
11*acb7242cSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*acb7242cSAndrew Rist  *
13*acb7242cSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*acb7242cSAndrew Rist  * software distributed under the License is distributed on an
15*acb7242cSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*acb7242cSAndrew Rist  * KIND, either express or implied.  See the License for the
17*acb7242cSAndrew Rist  * specific language governing permissions and limitations
18*acb7242cSAndrew Rist  * under the License.
19*acb7242cSAndrew Rist  *
20*acb7242cSAndrew Rist  *************************************************************/
21*acb7242cSAndrew Rist 
22*acb7242cSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #include "uno/EnvDcp.h"
25cdf0e10cSrcweir 
26cdf0e10cSrcweir 
uno_EnvDcp_getTypeName(rtl_uString const * pEnvDcp,rtl_uString ** ppEnvTypeName)27cdf0e10cSrcweir void uno_EnvDcp_getTypeName(rtl_uString const * pEnvDcp, rtl_uString ** ppEnvTypeName)
28cdf0e10cSrcweir {
29cdf0e10cSrcweir 	sal_Int32 colIdx = rtl_ustr_indexOfChar_WithLength(pEnvDcp->buffer, pEnvDcp->length, ':');
30cdf0e10cSrcweir 	if (colIdx >= 0)
31cdf0e10cSrcweir 		rtl_uString_newFromStr_WithLength(ppEnvTypeName, pEnvDcp->buffer, colIdx);
32cdf0e10cSrcweir 
33cdf0e10cSrcweir 	else
34cdf0e10cSrcweir 		rtl_uString_newFromStr(ppEnvTypeName, pEnvDcp->buffer);
35cdf0e10cSrcweir }
36cdf0e10cSrcweir 
uno_EnvDcp_getPurpose(rtl_uString const * pEnvDcp,rtl_uString ** ppEnvPurpose)37cdf0e10cSrcweir void uno_EnvDcp_getPurpose(rtl_uString const * pEnvDcp, rtl_uString ** ppEnvPurpose)
38cdf0e10cSrcweir {
39cdf0e10cSrcweir 	sal_Int32 colIdx = rtl_ustr_indexOfChar_WithLength(pEnvDcp->buffer, pEnvDcp->length, ':');
40cdf0e10cSrcweir 	if (colIdx >= 0)
41cdf0e10cSrcweir 		rtl_uString_newFromStr_WithLength(ppEnvPurpose, pEnvDcp->buffer + colIdx, pEnvDcp->length - colIdx);
42cdf0e10cSrcweir 
43cdf0e10cSrcweir 	else
44cdf0e10cSrcweir         rtl_uString_new(ppEnvPurpose);
45cdf0e10cSrcweir }
46