sync master with lastest vba changes
[ooovba.git] / binfilter / inc / bf_svtools / adrparse.hxx
blob1428d1985eb397ffc762d71a345325ce9f72a1ab
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: adrparse.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 _ADRPARSE_HXX
32 #define _ADRPARSE_HXX
34 #ifndef _LIST_HXX
35 #include <tools/list.hxx>
36 #endif
37 #ifndef _STRING_HXX
38 #include <tools/string.hxx>
39 #endif
41 namespace binfilter {
43 //============================================================================
44 struct SvAddressEntry_Impl
46 UniString m_aAddrSpec;
47 UniString m_aRealName;
49 SvAddressEntry_Impl() {};
50 SvAddressEntry_Impl(UniString const & rTheAddrSpec,
51 UniString const & rTheRealName):
52 m_aAddrSpec(rTheAddrSpec), m_aRealName(rTheRealName) {}
55 //============================================================================
56 DECLARE_LIST(SvAddressList_Impl, SvAddressEntry_Impl *)
58 //============================================================================
59 class SvAddressParser
61 friend class SvAddressParser_Impl;
63 SvAddressEntry_Impl m_aFirst;
64 SvAddressList_Impl m_aRest;
65 bool m_bHasFirst;
67 public:
68 SvAddressParser(UniString const & rInput);
70 ~SvAddressParser();
72 sal_Int32 Count() const { return m_bHasFirst ? m_aRest.Count() + 1 : 0; }
74 inline UniString const & GetEmailAddress(sal_Int32 nIndex) const;
76 inline UniString const &GetRealName(sal_Int32 nIndex) const;
79 inline UniString const & SvAddressParser::GetEmailAddress(sal_Int32 nIndex)
80 const
82 return nIndex == 0 ? m_aFirst.m_aAddrSpec :
83 m_aRest.GetObject(nIndex - 1)->m_aAddrSpec;
86 inline UniString const & SvAddressParser::GetRealName(sal_Int32 nIndex) const
88 return nIndex == 0 ? m_aFirst.m_aRealName :
89 m_aRest.GetObject(nIndex - 1)->m_aRealName;
94 #endif // _ADRPARSE_HXX