Update to m13
[ooovba.git] / package / inc / ImplValidCharacters.hxx
blob682e9cdb2ddcccf66146ec1e802b778b8d51122a
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ImplValidCharacters.hxx,v $
10 * $Revision: 1.5 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _IMPL_VALID_CHARACTERS_HXX_
31 #define _IMPL_VALID_CHARACTERS_HXX_
33 #include <sal/types.h>
35 static sal_Bool Impl_IsValidChar ( const sal_Unicode *pChar, sal_Int16 nLength, sal_Bool bSlashAllowed )
37 for ( sal_Int16 i = 0 ; i < nLength ; i++ )
39 switch ( pChar[i] )
41 case '\\':
42 case '?':
43 case '<':
44 case '>':
45 case '\"':
46 case '|':
47 case ':':
48 return sal_False;
49 case '/':
50 if ( !bSlashAllowed )
51 return sal_False;
52 break;
53 default:
54 if ( pChar[i] < 32 || pChar[i] > 127 )
55 return sal_False;
58 return sal_True;
60 #endif