Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _UCB_REGEXP_HXX_
30 : : #define _UCB_REGEXP_HXX_
31 : :
32 : : #include <rtl/ustring.hxx>
33 : :
34 : : //============================================================================
35 : : namespace ucb_impl {
36 : :
37 : 23076 : class Regexp
38 : : {
39 : : public:
40 : : enum Kind
41 : : {
42 : : KIND_PREFIX,
43 : : KIND_AUTHORITY,
44 : : KIND_DOMAIN
45 : : };
46 : :
47 : : inline bool operator ==(Regexp const & rOther) const;
48 : :
49 : 8342 : inline bool isDefault() const
50 [ + - ][ + + ]: 8342 : { return m_eKind == KIND_PREFIX && m_aPrefix.isEmpty(); }
51 : :
52 : 9128 : inline Kind getKind() const { return m_eKind; }
53 : :
54 : : bool matches(rtl::OUString const & rString, rtl::OUString * pTranslation,
55 : : bool * pTranslated) const;
56 : :
57 : : rtl::OUString getRegexp(bool bReverse) const;
58 : :
59 : : static Regexp parse(rtl::OUString const & rRegexp);
60 : :
61 : : private:
62 : : Kind m_eKind;
63 : : rtl::OUString m_aPrefix;
64 : : rtl::OUString m_aInfix;
65 : : rtl::OUString m_aReversePrefix;
66 : : bool m_bEmptyDomain;
67 : : bool m_bTranslation;
68 : :
69 : : inline Regexp(Kind eTheKind, rtl::OUString const & rThePrefix,
70 : : bool bTheEmptyDomain, rtl::OUString const & rTheInfix,
71 : : bool bTheTranslation,
72 : : rtl::OUString const & rTheReversePrefix);
73 : : };
74 : :
75 : 56844 : inline bool Regexp::operator ==(Regexp const & rOther) const
76 : : {
77 : : return m_eKind == rOther.m_eKind
78 : 56844 : && m_aPrefix == rOther.m_aPrefix
79 [ + - + + ]: 113688 : && m_aInfix == rOther.m_aInfix;
[ + - ]
80 : : }
81 : :
82 : : }
83 : :
84 : : #endif // _UCB_REGEXP_HXX_
85 : :
86 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|