20#include <rtl/ustrbuf.hxx>
26enum ElementType { ELEMENT_START, ELEMENT_DELIM, ELEMENT_ITEM, ELEMENT_END };
36 ParsedAddrSpec() { reset(); }
38 bool isPoorlyValid()
const {
return m_eLastElem >= ELEMENT_ITEM; }
40 bool isValid()
const {
return isPoorlyValid() && m_bAtFound; }
47void ParsedAddrSpec::reset()
51 m_eLastElem = ELEMENT_START;
56void ParsedAddrSpec::finish()
59 m_eLastElem = ELEMENT_END;
128 bool bEscaped =
false;
138 else if (cChar ==
'"')
143 else if (cChar ==
'\\')
151 bool bEscaped =
false;
159 else if (cChar ==
']')
164 else if (cChar ==
'\\')
172 bool bEscaped =
false;
183 else if (cChar ==
'(')
187 else if (cChar ==
')')
194 else if (cChar ==
'\\')
209 if (cChar >
' ' && cChar != 0x7F)
213 if (cChar ==
'"' || cChar ==
'(' || cChar ==
')' || cChar ==
','
214 || cChar ==
'.' || cChar ==
':' || cChar ==
';'
215 || cChar ==
'<' || cChar ==
'>' || cChar ==
'@'
216 || cChar ==
'[' || cChar ==
'\\' || cChar ==
']')
231 if (cChar <=
' ' || cChar ==
'"' || cChar ==
'('
232 || cChar ==
')' || cChar ==
',' || cChar ==
'.'
233 || cChar ==
':' || cChar ==
';' || cChar ==
'<'
234 || cChar ==
'>' || cChar ==
'@' || cChar ==
'['
235 || cChar ==
'\\' || cChar ==
']'
250 OUStringBuffer aResult;
252 bool bEscaped =
false;
254 while (pBegin < pEnd)
262 aResult.append(cChar);
265 else if (cChar ==
'"')
267 aResult.append(cChar);
270 else if (cChar ==
'\\')
272 aResult.append(cChar);
276 aResult.append(cChar);
282 aResult.append(cChar);
285 else if (cChar ==
']')
287 aResult.append(cChar);
290 else if (cChar ==
'\\')
292 aResult.append(cChar);
296 aResult.append(cChar);
302 else if (cChar ==
'(')
304 else if (cChar ==
')')
309 else if (cChar ==
'\\')
314 if (cChar <=
' ' || cChar == 0x7F)
317 else if (cChar ==
'(')
325 aResult.append(cChar);
328 else if (cChar ==
'[')
330 aResult.append(cChar);
334 aResult.append(cChar);
339 return aResult.makeStringAndClear();
343 const OUString& rInput)
344 : m_pCurTokenBegin(nullptr)
345 , m_pCurTokenEnd(nullptr)
487 OUString aTheAddrSpec;
493 if (nLen == rInput.getLength())
494 aTheAddrSpec = rInput;
496 aTheAddrSpec = rInput.copy( (
m_pAddrSpec->m_pBegin - rInput.getStr()),
static OUString reparse(sal_Unicode const *pBegin, sal_Unicode const *pEnd)
ParsedAddrSpec m_aOuterAddrSpec
sal_Unicode const * m_pInputPos
sal_Unicode const * m_pCurTokenBegin
ParsedAddrSpec m_aInnerAddrSpec
void addTokenToAddrSpec(ElementType eTokenElem)
SvAddressParser_Impl(SvAddressParser *pParser, const OUString &rIn)
sal_Unicode const * m_pCurTokenEnd
sal_Unicode const * m_pInputEnd
ParsedAddrSpec * m_pAddrSpec
SvAddressParser(const OUString &rInput)
::std::vector< OUString > m_vAddresses