merge the formfield patch from ooo-build
[ooovba.git] / ucb / source / inc / regexp.hxx
blobc1f985d14919a58737f1fe3ab18e092957a674bb
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: regexp.hxx,v $
10 * $Revision: 1.4 $
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 ************************************************************************/
31 #ifndef _UCB_REGEXP_HXX_
32 #define _UCB_REGEXP_HXX_
34 #include <rtl/ustring.hxx>
36 //============================================================================
37 namespace ucb_impl {
39 class Regexp
41 public:
42 enum Kind
44 KIND_PREFIX,
45 KIND_AUTHORITY,
46 KIND_DOMAIN
49 inline bool operator ==(Regexp const & rOther) const;
51 inline bool isDefault() const
52 { return m_eKind == KIND_PREFIX && m_aPrefix.getLength() == 0; }
54 inline Kind getKind() const { return m_eKind; }
56 bool matches(rtl::OUString const & rString, rtl::OUString * pTranslation,
57 bool * pTranslated) const;
59 rtl::OUString getRegexp(bool bReverse) const;
61 static Regexp parse(rtl::OUString const & rRegexp);
63 private:
64 Kind m_eKind;
65 rtl::OUString m_aPrefix;
66 rtl::OUString m_aInfix;
67 rtl::OUString m_aReversePrefix;
68 bool m_bEmptyDomain;
69 bool m_bTranslation;
71 inline Regexp(Kind eTheKind, rtl::OUString const & rThePrefix,
72 bool bTheEmptyDomain, rtl::OUString const & rTheInfix,
73 bool bTheTranslation,
74 rtl::OUString const & rTheReversePrefix);
77 inline bool Regexp::operator ==(Regexp const & rOther) const
79 return m_eKind == rOther.m_eKind
80 && m_aPrefix == rOther.m_aPrefix
81 && m_aInfix == rOther.m_aInfix;
86 #endif // _UCB_REGEXP_HXX_