1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: adrparse.hxx,v $
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 ************************************************************************/
35 #include <tools/list.hxx>
38 #include <tools/string.hxx>
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 //============================================================================
61 friend class SvAddressParser_Impl
;
63 SvAddressEntry_Impl m_aFirst
;
64 SvAddressList_Impl m_aRest
;
68 SvAddressParser(UniString
const & rInput
);
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
)
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