26#include <com/sun/star/uno/Reference.hxx>
27#include <com/sun/star/util/XStringWidth.hpp>
29#include <osl/diagnose.h>
30#include <osl/file.hxx>
31#include <rtl/character.hxx>
32#include <rtl/string.h>
33#include <rtl/textenc.h>
34#include <rtl/ustring.hxx>
46#include <com/sun/star/uno/Sequence.hxx>
234 std::u16string_view rSubString)
236 sal_Int32 nDelta = rSubString.size() -
m_nLength;
239 rString.insert(m_nBegin, rSubString);
246 std::u16string_view rSubString)
248 sal_Int32 nDelta = rSubString.size() -
m_nLength;
250 rString = OUString::Concat(rString.subView(0, m_nBegin)) +
251 rSubString + rString.subView(m_nBegin +
m_nLength);
258 std::u16string_view rSubString,
261 m_nBegin = nTheBegin;
262 return set(rString, rSubString);
268 m_nBegin = m_nBegin + nDelta;
272 OUStringBuffer
const & rThisString,
273 OUStringBuffer
const & rOtherString)
const
276 sal_Unicode const * p1 = rThisString.getStr() + m_nBegin;
282 }
else if (*p1 > *p2) {
321 static constexpr OUStringLiteral
EMPTY =
u"";
322 static constexpr OUStringLiteral FTP =
u"ftp";
323 static constexpr OUStringLiteral HTTP =
u"http";
324 static constexpr OUStringLiteral FILE1 =
u"file";
325 static constexpr OUStringLiteral MAILTO =
u"mailto";
326 static constexpr OUStringLiteral VND_WEBDAV =
u"vnd.sun.star.webdav";
327 static constexpr OUStringLiteral
PRIVATE =
u"private";
328 static constexpr OUStringLiteral VND_HELP =
u"vnd.sun.star.help";
329 static constexpr OUStringLiteral HTTPS =
u"https";
330 static constexpr OUStringLiteral
SLOT =
u"slot";
331 static constexpr OUStringLiteral MACRO =
u"macro";
332 static constexpr OUStringLiteral
JAVASCRIPT =
u"javascript";
333 static constexpr OUStringLiteral
DATA =
u"data";
334 static constexpr OUStringLiteral CID =
u"cid";
335 static constexpr OUStringLiteral VND_HIER =
u"vnd.sun.star.hier";
336 static constexpr OUStringLiteral
UNO =
u".uno";
337 static constexpr OUStringLiteral COMPONENT =
u".component";
338 static constexpr OUStringLiteral VND_PKG =
u"vnd.sun.star.pkg";
339 static constexpr OUStringLiteral LDAP =
u"ldap";
340 static constexpr OUStringLiteral DB =
u"db";
341 static constexpr OUStringLiteral VND_CMD =
u"vnd.sun.star.cmd";
342 static constexpr OUStringLiteral TELNET =
u"telnet";
343 static constexpr OUStringLiteral VND_EXPAND =
u"vnd.sun.star.expand";
344 static constexpr OUStringLiteral VND_TDOC =
u"vnd.sun.star.tdoc";
345 static constexpr OUStringLiteral SMB =
u"smb";
346 static constexpr OUStringLiteral HID =
u"hid";
347 static constexpr OUStringLiteral SFTP =
u"sftp";
348 static constexpr OUStringLiteral VND_CMIS =
u"vnd.libreoffice.cmis";
353 EMPTY,
"",
false,
false,
false,
false,
false,
false,
false,
false},
355 FTP,
"ftp://",
true,
true,
false,
true,
true,
true,
true,
358 HTTP,
"http://",
true,
false,
false,
false,
true,
true,
true,
361 FILE1,
"file://",
true,
false,
false,
false,
true,
false,
true,
364 MAILTO,
"mailto:",
false,
false,
false,
false,
false,
false,
367 VND_WEBDAV,
"vnd.sun.star.webdav://",
true,
false,
368 false,
false,
true,
true,
true,
true},
370 PRIVATE,
"private:",
false,
false,
false,
false,
false,
false,
373 VND_HELP,
"vnd.sun.star.help://",
true,
false,
false,
374 false,
false,
false,
true,
true},
376 HTTPS,
"https://",
true,
false,
false,
false,
true,
true,
379 SLOT,
"slot:",
false,
false,
false,
false,
false,
false,
false,
382 MACRO,
"macro:",
false,
false,
false,
false,
false,
false,
385 JAVASCRIPT,
"javascript:",
false,
false,
false,
false,
false,
386 false,
false,
false},
388 DATA,
"data:",
false,
false,
false,
false,
false,
false,
false,
391 CID,
"cid:",
false,
false,
false,
false,
false,
false,
false,
394 VND_HIER,
"vnd.sun.star.hier:",
true,
false,
false,
395 false,
false,
false,
true,
false},
397 UNO,
".uno:",
false,
false,
false,
false,
false,
false,
false,
400 COMPONENT,
".component:",
false,
false,
false,
false,
false,
403 VND_PKG,
"vnd.sun.star.pkg://",
true,
false,
false,
404 false,
false,
false,
true,
true},
406 LDAP,
"ldap://",
true,
false,
false,
false,
true,
true,
409 DB,
"db:",
false,
false,
false,
false,
false,
false,
false,
412 VND_CMD,
"vnd.sun.star.cmd:",
false,
false,
false,
413 false,
false,
false,
false,
false},
415 TELNET,
"telnet://",
true,
true,
false,
true,
true,
true,
418 VND_EXPAND,
"vnd.sun.star.expand:",
false,
false,
419 false,
false,
false,
false,
false,
false},
421 VND_TDOC,
"vnd.sun.star.tdoc:",
false,
false,
false,
422 false,
false,
false,
true,
false},
424 EMPTY,
"",
false,
false,
false,
false,
true,
true,
true,
false },
426 SMB,
"smb://",
true,
true,
false,
true,
true,
true,
true,
429 HID,
"hid:",
false,
false,
false,
false,
false,
false,
false,
432 SFTP,
"sftp://",
true,
true,
false,
true,
true,
true,
true,
435 VND_CMIS,
"vnd.libreoffice.cmis://",
true,
true,
436 false,
false,
true,
false,
true,
true} };
437 return map[eTheScheme];
449 assert(nWeight < 16);
451 = {
'0',
'1',
'2',
'3',
'4',
'5',
'6',
'7',
'8',
'9',
'A',
'B',
'C',
453 return aDigits[nWeight];
462 rTheText.append(
'%' );
463 rTheText.append( getHexDigit(nOctet >> 4) );
464 rTheText.append( getHexDigit(nOctet & 15) );
489sal_uInt32
const aMustEncodeMap[128]
490 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
491 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
493 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
496 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
498 PA +PD+PE+PF+PG+PH+PI +PK+PL+PM+
PN+PO +PQ+PR,
499 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
500 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
501 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
502 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
503 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO +PQ+PR,
504 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN +PQ+PR,
505 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
506 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
507 +PD +PG+PH+PI+PJ+PK +PM+
PN+PO,
508 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
509 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
510 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
511 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
512 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
513 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
514 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
515 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
516 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
517 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
518 +PD+PE +PG+PH+PI+PJ+PK+PL+PM+
PN+PO +PQ+PR,
519 PA +PE+PF+PG+PH+PI+PJ+PK +PM +PQ+PR,
521 PA +PD+PE+PF+PG+PH +PK+PL+PM+
PN +PQ+PR,
524 +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
525 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
526 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
527 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
528 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
529 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
530 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
531 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
532 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
533 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
534 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
535 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
536 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
537 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
538 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
539 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
540 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
541 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
542 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
543 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
544 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
545 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
546 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
547 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
548 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
549 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
550 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
555 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
557 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
558 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
559 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
560 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
561 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
562 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
563 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
564 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
565 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
566 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
567 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
568 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
569 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
570 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
571 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
572 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
573 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
574 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
575 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
576 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
577 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
578 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
579 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
580 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
581 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
582 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ+PR,
586 PA +PD+PE+PF+PG+PH+PI+PJ+PK+PL+PM+
PN+PO+PP+PQ,
591 return !rtl::isAscii(nUTF32) || !(aMustEncodeMap[nUTF32] & ePart);
612std::unique_ptr<SvMemoryStream> memoryStream(
613 void const * data, sal_Int32 length)
615 std::unique_ptr<char[]> b(
617 memcpy(b.get(), data, length);
618 std::unique_ptr<SvMemoryStream> s(
620 s->ObjectOwnsMemory(
true);
637 sal_Int32 nCharactersSkipped = pSkippedMediatype ==
nullptr
638 ? 0 : pSkippedMediatype-sURLPath.getStr();
639 if (sURLPath.match(
",", nCharactersSkipped))
641 nCharactersSkipped += strlen(
",");
642 OString sURLEncodedData(
643 sURLPath.getStr() + nCharactersSkipped,
644 sURLPath.getLength() - nCharactersSkipped,
645 RTL_TEXTENCODING_ISO_8859_1, OUSTRING_TO_OSTRING_CVTFLAGS);
647 sURLEncodedData.getStr(), sURLEncodedData.getLength());
649 else if (sURLPath.matchIgnoreAsciiCase(
";base64,", nCharactersSkipped))
651 nCharactersSkipped += strlen(
";base64,");
652 std::u16string_view sBase64Data = sURLPath.subView( nCharactersSkipped );
653 css::uno::Sequence< sal_Int8 > aDecodedData;
655 == sBase64Data.size())
658 aDecodedData.getArray(), aDecodedData.getLength());
673 "guessFSysStyleByCounting(): Bad style");
674 DBG_ASSERT(std::numeric_limits< sal_Int32 >::min() < pBegin - pEnd
675 && pEnd - pBegin <= std::numeric_limits< sal_Int32 >::max(),
676 "guessFSysStyleByCounting(): Too big");
677 sal_Int32 nSlashCount
679 0 : std::numeric_limits< sal_Int32 >::min();
680 sal_Int32 nBackslashCount
682 0 : std::numeric_limits< sal_Int32 >::min();
683 while (pBegin != pEnd)
694 return nSlashCount >= nBackslashCount ?
700 sal_uInt32 fragmentDelimiter)
703 if (p != end && rtl::isAsciiAlpha(*p)) {
707 && (rtl::isAsciiAlphanumeric(*p) || *p ==
'+' || *p ==
'-'
711 if (end - p > 1 && p[0] ==
':' && p[1] != fragmentDelimiter
715 OUString(*begin, p - *begin).toAsciiLowerCase());
727 rtl_TextEncoding eCharset,
732 sal_Unicode const * pEnd = pPos + rTheAbsURIRef.size();
736 sal_uInt32 nFragmentDelimiter =
'#';
804 && rtl::isAsciiAlpha(p1[0])
806 && (pEnd - p1 == 2 || p1[2] ==
'/' || p1[2] ==
'\\'))
810 nFragmentDelimiter = 0x80000000;
812 else if (pEnd - p1 >= 2 && p1[0] ==
'/' && p1[1] ==
'/')
816 && (p1 == pEnd || *p1 ==
'/'))
819 else if (p1 != pEnd && *p1 ==
'/')
823 nFragmentDelimiter = 0x80000000;
831 sal_Int32
n = rtl_ustr_indexOfChar_WithLength(
832 p1, pEnd - p1,
'\\');
843 nFragmentDelimiter = 0x80000000;
849 sal_uInt32 nLabels =
scanDomain(pDomainEnd, pEnd);
850 if (nLabels > 0 && pDomainEnd != pEnd && *pDomainEnd ==
'@')
854 && pDomainEnd == pEnd)
857 else if (nLabels >= 3
858 && (pDomainEnd == pEnd || *pDomainEnd ==
'/'))
860 = pDomainEnd - p1 >= 4
861 && (p1[0] ==
'f' || p1[0] ==
'F')
862 && (p1[1] ==
't' || p1[1] ==
'T')
863 && (p1[2] ==
'p' || p1[2] ==
'P')
872 aSynScheme = parseScheme(&p1, pEnd, nFragmentDelimiter);
873 if (!aSynScheme.isEmpty())
891 while (p2 != pEnd && rtl::isAsciiDigit(*p2))
893 if (p2 == pEnd || *p2 ==
'/' || *p2 ==
'?' || *p2 ==
'#')
907 && *pPos != nFragmentDelimiter)
925 sal_uInt32 nSegmentDelimiter =
'/';
926 sal_uInt32 nAltSegmentDelimiter = 0x80000000;
927 bool bSkippedInitialSlash =
false;
943 if (pEnd - pPos < 2 || *pPos++ !=
'/' || *pPos++ !=
'/')
949 OUStringBuffer aSynAuthority;
951 && *pPos !=
'/' && *pPos !=
'?'
952 && *pPos != nFragmentDelimiter)
955 sal_uInt32 nUTF32 =
getUTF32(pPos, pEnd,
957 eCharset, eEscapeType);
958 appendUCS4(aSynAuthority, nUTF32, eEscapeType,
970 if (pEnd - pPos >= 2 && pPos[0] ==
'/' && pPos[1] ==
'/')
974 OUStringBuffer aSynAuthority;
976 && *pPos !=
'/' && *pPos !=
'?'
977 && *pPos != nFragmentDelimiter)
992 if (aSynAuthority.isEmpty())
1008 if (pEnd - pPos < 2 || *pPos++ !=
'/' || *pPos++ !=
'/')
1014 OUStringBuffer aSynUser(128);
1016 bool bHasUser =
false;
1017 while (pPos < pEnd && *pPos !=
'@'
1018 && *pPos !=
'/' && *pPos !=
'?'
1019 && *pPos != nFragmentDelimiter)
1022 sal_uInt32 nUTF32 =
getUTF32(pPos, pEnd,
1024 eCharset, eEscapeType);
1028 bHasUser = *pPos ==
'@';
1031 OUStringBuffer aSynAuthority(64);
1034 aSynAuthority = aSynUser;
1045 && *pPos !=
'/' && *pPos !=
'?'
1046 && *pPos != nFragmentDelimiter)
1049 sal_uInt32 nUTF32 =
getUTF32(pPos, pEnd,
1051 eCharset, eEscapeType);
1052 appendUCS4(aSynAuthority, nUTF32, eEscapeType,
1056 if (aSynAuthority.isEmpty())
1094 if (pEnd - pPos >= 2 && pPos[0] ==
'/' && pPos[1] ==
'/')
1097 while (p1 != pEnd && *p1 !=
'/' &&
1098 *p1 != nFragmentDelimiter)
1104 RTL_TEXTENCODING_DONTKNOW,
true,
nullptr))
1107 pHostPortBegin = pPos + 2;
1128 if (pEnd - pPos >= 2 && pPos[0] ==
'/' && pPos[1] ==
'/')
1132 bSkippedInitialSlash =
true;
1135 && rtl::isAsciiAlpha(pPos[0])
1137 && (pEnd - pPos == 2
1138 || pPos[2] ==
'/' || pPos[2] ==
'\\'))
1139 nAltSegmentDelimiter =
'\\';
1147 if (pPos < pEnd && *pPos ==
'/')
1165 while (pe < pEnd && *pe !=
'\\' &&
1166 *pe != nFragmentDelimiter)
1173 RTL_TEXTENCODING_DONTKNOW,
true,
nullptr) ||
1178 pHostPortBegin = pPos + 2;
1181 nSegmentDelimiter =
'\\';
1198 && rtl::isAsciiAlpha(pPos[0])
1200 && (pEnd - pPos == 2
1202 || pPos[2] ==
'\\'))
1205 nAltSegmentDelimiter =
'\\';
1206 bSkippedInitialSlash =
true;
1227 switch (guessFSysStyleByCounting(pPos, pEnd, eStyle))
1230 nSegmentDelimiter =
'/';
1234 nSegmentDelimiter =
'\\';
1239 "INetURLObject::setAbsURIRef():"
1240 " Bad guessFSysStyleByCounting");
1243 bSkippedInitialSlash
1244 = pPos != pEnd && *pPos != nSegmentDelimiter;
1255 if (pEnd - pPos >= 2 && pPos[0] ==
'/' && pPos[1] ==
'/')
1259 && pPos != pEnd && *pPos ==
'/'))
1268 while (pPos < pEnd && *pPos !=
'/' && *pPos != c
1269 && *pPos != nFragmentDelimiter)
1275 while (p1 < pPos && *p1 !=
'@')
1279 pHostPortBegin = pAuthority;
1280 pHostPortEnd = pPos;
1284 pUserInfoBegin = pAuthority;
1286 pHostPortBegin = p1 + 1;
1287 pHostPortEnd = pPos;
1292 pUserInfoBegin = pAuthority;
1293 pUserInfoEnd = pPos;
1297 pHostPortBegin = pAuthority;
1298 pHostPortEnd = pPos;
1300 else if (pPos != pAuthority)
1315 bool bHasAuth =
false;
1316 OUStringBuffer aSynUser;
1318 while (p1 < pUserInfoEnd)
1321 sal_uInt32 nUTF32 =
getUTF32(p1, pUserInfoEnd,
1322 eMechanism, eCharset, eEscapeType);
1325 if (nUTF32 ==
':' && bSupportsPassword)
1330 else if (nUTF32 ==
';' && bSupportsAuth
1331 && pUserInfoEnd - p1
1332 > RTL_CONSTASCII_LENGTH(
"auth=")
1335 p1 + RTL_CONSTASCII_LENGTH(
"auth="),
1338 p1 += RTL_CONSTASCII_LENGTH(
"auth=");
1343 appendUCS4(aSynUser, nUTF32, eEscapeType, ePart,
1349 if (bSupportsPassword)
1352 OUStringBuffer aSynAuth;
1353 while (p1 < pUserInfoEnd)
1356 sal_uInt32 nUTF32 =
getUTF32(p1, pUserInfoEnd,
1357 eMechanism, eCharset,
1360 ePart, eCharset,
false);
1367 OUStringBuffer aSynAuth;
1368 while (p1 < pUserInfoEnd)
1371 sal_uInt32 nUTF32 =
getUTF32(p1, pUserInfoEnd,
1372 eMechanism, eCharset,
1380 ePart, eCharset,
false);
1392 if (
getSchemeInfo().m_bPort && pHostPortBegin < pHostPortEnd )
1395 while (p1 > pHostPortBegin && rtl::isAsciiDigit(*p1))
1400 bool bNetBiosName =
false;
1408 pHostPortBegin = pPort;
1409 bNetBiosName =
true;
1414 if (pHostPortBegin == pPort && pPort != pHostPortEnd)
1421 if (pHostPortBegin == pPort)
1430 pHostPortBegin, pPort, eMechanism, eCharset,
1437 if (pPort != pHostPortEnd)
1441 std::u16string_view{pPort + 1,
static_cast<size_t>(pHostPortEnd - (pPort + 1))},
1448 sal_Int32 nBeforePathLength =
m_aAbsURIRef.getLength();
1450 bSkippedInitialSlash, nSegmentDelimiter,
1451 nAltSegmentDelimiter,
1461 if (
getSchemeInfo().m_bQuery && pPos < pEnd && *pPos ==
'?')
1464 OUStringBuffer aSynQuery;
1465 for (++pPos; pPos < pEnd && *pPos != nFragmentDelimiter;)
1468 sal_uInt32 nUTF32 =
getUTF32(pPos, pEnd,
1469 eMechanism, eCharset, eEscapeType);
1477 if (pPos < pEnd && *pPos == nFragmentDelimiter)
1480 OUStringBuffer aSynFragment;
1481 for (++pPos; pPos < pEnd;)
1484 sal_uInt32 nUTF32 =
getUTF32(pPos, pEnd,
1485 eMechanism, eCharset, eEscapeType);
1502 sal_Int32 oldSchemeLen = 0;
1507 oldSchemeLen = rOldSchemeName.getLength();
1510 sal_Int32 newSchemeLen = rNewSchemeName.getLength();
1513 sal_Int32 delta=newSchemeLen-oldSchemeLen;
1525 bool & rWasAbsolute,
1527 rtl_TextEncoding eCharset,
1528 bool bIgnoreFragment,
bool bSmart,
1529 bool bRelativeNonURIs,
FSysStyle eStyle)
1533 sal_Unicode const * pEnd =
p + rTheRelURIRef.getLength();
1537 bool hasScheme = pPrefix !=
nullptr;
1540 hasScheme = !parseScheme(&pPrefixBegin, pEnd,
'#').isEmpty();
1543 sal_uInt32 nSegmentDelimiter =
'/';
1544 sal_uInt32 nQueryDelimiter
1546 sal_uInt32 nFragmentDelimiter =
'#';
1549 if (!hasScheme && bSmart)
1575 && rtl::isAsciiAlpha(q[0])
1577 && (pEnd - q == 2 || q[2] ==
'/' || q[2] ==
'\\'))
1579 else if (pEnd - q >= 2 && q[0] ==
'\\' && q[1] ==
'\\')
1582 sal_Int32
n = rtl_ustr_indexOfChar_WithLength(
1596 eCharset,
true, eStyle);
1599 rTheAbsURIRef = aNewURI;
1600 rWasAbsolute =
true;
1610 switch (guessFSysStyleByCounting(
p, pEnd, eStyle))
1613 nSegmentDelimiter =
'/';
1617 nSegmentDelimiter =
'\\';
1618 bRelativeNonURIs =
true;
1622 OSL_FAIL(
"INetURLObject::convertRelToAbs():"
1623 " Bad guessFSysStyleByCounting");
1627 if (bRelativeNonURIs)
1630 nQueryDelimiter = 0x80000000;
1631 nFragmentDelimiter = 0x80000000;
1644 while (
p != pEnd && *
p++ !=
':') ;
1646 rWasAbsolute = hasScheme;
1654 rWasAbsolute =
false;
1658 if (bIgnoreFragment)
1660 rTheAbsURIRef = aNewURI;
1664 enum State { STATE_AUTH, STATE_ABS_PATH, STATE_REL_PATH, STATE_FRAGMENT,
1667 OUStringBuffer aSynAbsURIRef(128);
1679 while (pSchemeEnd[0] !=
':')
1683 aSynAbsURIRef.append(pSchemeBegin, pSchemeEnd - pSchemeBegin);
1685 aSynAbsURIRef.append(
':');
1687 State eState = STATE_AUTH;
1688 bool bSameDoc =
true;
1692 if (pEnd -
p >= 2 &&
p[0] ==
'/' &&
p[1] ==
'/')
1694 aSynAbsURIRef.append(
"//");
1696 eState = STATE_ABS_PATH;
1703 eCharset, eEscapeType);
1706 if (nUTF32 == nSegmentDelimiter)
1708 else if (nUTF32 == nFragmentDelimiter)
1710 eState = STATE_FRAGMENT;
1714 appendUCS4(aSynAbsURIRef, nUTF32, eEscapeType,
1727 if (eState == STATE_AUTH)
1730 eState = STATE_DONE;
1731 else if (*
p == nFragmentDelimiter)
1734 eState = STATE_FRAGMENT;
1736 else if (*
p == nSegmentDelimiter)
1739 eState = STATE_ABS_PATH;
1744 eState = STATE_REL_PATH;
1749 if (eState == STATE_ABS_PATH)
1751 aSynAbsURIRef.append(
'/');
1752 eState = STATE_DONE;
1757 =
getUTF32(
p, pEnd, eMechanism, eCharset, eEscapeType);
1760 if (nUTF32 == nFragmentDelimiter)
1762 eState = STATE_FRAGMENT;
1765 else if (nUTF32 == nSegmentDelimiter)
1768 appendUCS4(aSynAbsURIRef, nUTF32, eEscapeType, ePart,
1772 else if (eState == STATE_REL_PATH)
1781 "cannot make <" << rTheRelURIRef
1782 <<
"> absolute against broken base <"
1784 rWasAbsolute =
false;
1792 while (pBasePathEnd != pBasePathBegin)
1793 if (*(--pBasePathEnd) ==
'/')
1799 sal_Int32 nPathBegin = aSynAbsURIRef.getLength();
1800 aSynAbsURIRef.append(pBasePathBegin, pBasePathEnd - pBasePathBegin);
1801 DBG_ASSERT(aSynAbsURIRef.getLength() > nPathBegin
1802 && aSynAbsURIRef[aSynAbsURIRef.getLength() - 1] ==
'/',
1803 "INetURLObject::convertRelToAbs(): Bad base path");
1805 while (
p != pEnd && *
p != nQueryDelimiter && *
p != nFragmentDelimiter)
1810 ||
p[1] == nSegmentDelimiter
1811 ||
p[1] == nQueryDelimiter
1812 ||
p[1] == nFragmentDelimiter)
1815 if (
p != pEnd && *
p == nSegmentDelimiter)
1819 else if (pEnd -
p >= 2
1822 ||
p[2] == nSegmentDelimiter
1823 ||
p[2] == nQueryDelimiter
1824 ||
p[2] == nFragmentDelimiter)
1825 && aSynAbsURIRef.getLength() - nPathBegin > 1)
1828 if (
p != pEnd && *
p == nSegmentDelimiter)
1831 sal_Int32
i = aSynAbsURIRef.getLength() - 2;
1832 while (
i > nPathBegin && aSynAbsURIRef[
i] !=
'/')
1834 aSynAbsURIRef.setLength(
i + 1);
1836 aSynAbsURIRef.getLength() > nPathBegin
1837 && aSynAbsURIRef[aSynAbsURIRef.getLength() - 1] ==
'/',
1838 "INetURLObject::convertRelToAbs(): Bad base path");
1844 && *
p != nSegmentDelimiter
1845 && *
p != nQueryDelimiter
1846 && *
p != nFragmentDelimiter)
1851 eCharset, eEscapeType);
1852 appendUCS4(aSynAbsURIRef, nUTF32, eEscapeType, ePart,
1855 if (
p != pEnd && *
p == nSegmentDelimiter)
1857 aSynAbsURIRef.append(
'/');
1862 while (
p != pEnd && *
p != nFragmentDelimiter)
1866 =
getUTF32(
p, pEnd, eMechanism, eCharset, eEscapeType);
1867 appendUCS4(aSynAbsURIRef, nUTF32, eEscapeType, ePart,
1872 eState = STATE_DONE;
1876 eState = STATE_FRAGMENT;
1889 if (eState == STATE_FRAGMENT && !bIgnoreFragment)
1891 aSynAbsURIRef.append(
'#');
1896 =
getUTF32(
p, pEnd, eMechanism, eCharset, eEscapeType);
1897 appendUCS4(aSynAbsURIRef, nUTF32, eEscapeType,
1910 "cannot make <" << rTheRelURIRef
1913 rWasAbsolute =
false;
1917 rTheAbsURIRef = aNewURI;
1922 OUString & rTheRelURIRef,
1925 rtl_TextEncoding eCharset,
1931 rTheRelURIRef =
decode(rTheAbsURIRef, eDecodeMechanism, eCharset);
1940 eEncodeMechanism, eCharset,
false,
false,
false,
1943 rTheRelURIRef =
decode(rTheAbsURIRef, eDecodeMechanism, eCharset);
1964 rTheRelURIRef = aSubject.
GetMainURL(eDecodeMechanism, eCharset);
1983 if (p1 == pBasePathEnd || p2 == pSubjectPathEnd)
1985 if (p1 == pBasePathEnd && p2 == pSubjectPathEnd)
1999 rTheRelURIRef = aSubject.
GetMainURL(eDecodeMechanism, eCharset);
2002 sal_Int32 nMatch = pSlash - pBasePathBegin;
2012 rTheRelURIRef = aSubject.
GetMainURL(eDecodeMechanism, eCharset);
2021 OUStringBuffer aSynRelURIRef;
2022 for (
sal_Unicode const *
p = pBasePathBegin + nMatch;
p != pBasePathEnd;
2026 aSynRelURIRef.append(
"../");
2034 if (aSynRelURIRef.isEmpty())
2036 if (pSubjectPathEnd - pSubjectPathBegin >= nMatch + 2
2037 && pSubjectPathBegin[nMatch] ==
'/'
2038 && pSubjectPathBegin[nMatch + 1] ==
'/')
2040 aSynRelURIRef.append(
"./");
2044 for (
sal_Unicode const *
p = pSubjectPathBegin + nMatch;
2045 p != pSubjectPathEnd && *
p !=
'/'; ++
p)
2049 aSynRelURIRef.append(
"./");
2058 aSynRelURIRef.append(
decode(pSubjectPathBegin + nMatch, pSubjectPathEnd,
2059 eDecodeMechanism, eCharset));
2065 aSynRelURIRef.append(
"?"
2066 + aSubject.
decode(aSubject.
m_aQuery, eDecodeMechanism, eCharset));
2070 aSynRelURIRef.append(
"#"
2074 rTheRelURIRef = aSynRelURIRef.makeStringAndClear();
2080 OUString & rTheExtURIRef,
2082 rtl_TextEncoding eCharset)
2084 OUStringBuffer aSynExtURIRef(256);
2087 sal_Unicode const * pBegin = aSynExtURIRef.getStr();
2088 sal_Unicode const * pEnd = pBegin + aSynExtURIRef.getLength();
2097 rTheExtURIRef =
decode(aSynExtURIRef, eDecodeMechanism, eCharset);
2103 OUString & rTheIntURIRef,
2105 rtl_TextEncoding eCharset)
2107 OUStringBuffer aSynIntURIRef(256);
2110 sal_Unicode const * pBegin = aSynIntURIRef.getStr();
2111 sal_Unicode const * pEnd = pBegin + aSynIntURIRef.getLength();
2120 rTheIntURIRef =
decode(aSynIntURIRef, eDecodeMechanism, eCharset);
2151 {
"private:factory/",
"staroffice.factory:",
2157 {
"private:searchfolder:",
"staroffice.searchfolder:",
2159 {
"private:trashcan:",
"staroffice.trashcan:",
2168 {
"staroffice.factory:",
"private:factory/",
2180 {
"staroffice.searchfolder:",
"private:searchfolder:",
2184 {
"staroffice.trashcan:",
"private:trashcan:",
2215 for (; pFirst < pLast; ++
i)
2224 sal_uInt32 nChar = rtl::toAsciiLowerCase(*
p++);
2225 while (pFirst <= pLast &&
static_cast<unsigned char>(pFirst->
m_pPrefix[
i]) < nChar)
2227 while (pFirst <= pLast &&
static_cast<unsigned char>(pLast->
m_pPrefix[
i]) > nChar)
2230 if (pFirst == pLast)
2233 while (
p < pEnd && *q !=
'\0'
2234 && rtl::toAsciiLowerCase(*
p) ==
static_cast<unsigned char>(*q))
2252 "INetURLObject::getAuthority(): Bad scheme");
2260 nBegin -= RTL_CONSTASCII_LENGTH(
"//");
2262 "INetURLObject::getAuthority(): Bad authority");
2273 nBegin + RTL_CONSTASCII_LENGTH(
"//");
2274 return SubString(nBegin, nEnd - nBegin);
2278 rtl_TextEncoding eCharset)
2287 OUStringBuffer aNewUser;
2313 void lcl_Erase(OUStringBuffer &rBuf, sal_Int32 index, sal_Int32 count)
2315 OUString sTemp(rBuf.makeStringAndClear());
2316 rBuf.append(sTemp.replaceAt(index, count, u
""));
2339 rtl_TextEncoding eCharset)
2343 OUStringBuffer aNewAuth;
2381 OUStringBuffer* pCanonic)
2387 enum State { STATE_INITIAL, STATE_LABEL, STATE_LABEL_HYPHEN,
2388 STATE_LABEL_DOT, STATE_TOPLABEL, STATE_TOPLABEL_HYPHEN,
2389 STATE_TOPLABEL_DOT, STATE_IP4, STATE_IP4_DOT, STATE_IP6,
2390 STATE_IP6_COLON, STATE_IP6_2COLON, STATE_IP6_3COLON,
2391 STATE_IP6_HEXSEQ1, STATE_IP6_HEXSEQ1_COLON,
2392 STATE_IP6_HEXSEQ1_MAYBE_IP4, STATE_IP6_HEXSEQ2,
2393 STATE_IP6_HEXSEQ2_COLON, STATE_IP6_HEXSEQ2_MAYBE_IP4,
2394 STATE_IP6_IP4, STATE_IP6_IP4_DOT, STATE_IP6_DONE };
2395 sal_uInt32 nNumber = 0;
2398 State eState = STATE_INITIAL;
2400 sal_Int32 nOriginalCanonicLength = pCanonic ? pCanonic->getLength() : 0;
2401 for (;
p != pEnd; ++
p)
2408 pCanonic->append(
'[');
2411 else if (rtl::isAsciiAlpha(*
p) || *
p ==
'_')
2412 eState = STATE_TOPLABEL;
2413 else if (rtl::isAsciiDigit(*
p))
2426 eState = STATE_LABEL_DOT;
2428 eState = STATE_LABEL_HYPHEN;
2429 else if (!rtl::isAsciiAlphanumeric(*
p) && *
p !=
'_')
2433 case STATE_LABEL_HYPHEN:
2434 if (rtl::isAsciiAlphanumeric(*
p) || *
p ==
'_')
2435 eState = STATE_LABEL;
2440 case STATE_LABEL_DOT:
2441 if (rtl::isAsciiAlpha(*
p) || *
p ==
'_')
2442 eState = STATE_TOPLABEL;
2443 else if (rtl::isAsciiDigit(*
p))
2444 eState = STATE_LABEL;
2449 case STATE_TOPLABEL:
2451 eState = STATE_TOPLABEL_DOT;
2453 eState = STATE_TOPLABEL_HYPHEN;
2454 else if (!rtl::isAsciiAlphanumeric(*
p) && *
p !=
'_')
2458 case STATE_TOPLABEL_HYPHEN:
2459 if (rtl::isAsciiAlphanumeric(*
p) || *
p ==
'_')
2460 eState = STATE_TOPLABEL;
2465 case STATE_TOPLABEL_DOT:
2466 if (rtl::isAsciiAlpha(*
p) || *
p ==
'_')
2467 eState = STATE_TOPLABEL;
2468 else if (rtl::isAsciiDigit(*
p))
2469 eState = STATE_LABEL;
2480 pCanonic->append(
static_cast<sal_Int64
>(nNumber));
2481 pCanonic->append(
'.' );
2484 eState = STATE_IP4_DOT;
2487 eState = STATE_LABEL_DOT;
2489 eState = STATE_LABEL_HYPHEN;
2490 else if (rtl::isAsciiAlpha(*
p) || *
p ==
'_')
2491 eState = STATE_LABEL;
2492 else if (rtl::isAsciiDigit(*
p))
2499 eState = STATE_LABEL;
2505 if (rtl::isAsciiAlpha(*
p) || *
p ==
'_')
2506 eState = STATE_TOPLABEL;
2507 else if (rtl::isAsciiDigit(*
p))
2519 eState = STATE_IP6_COLON;
2520 else if (rtl::isAsciiHexDigit(*
p))
2524 eState = STATE_IP6_HEXSEQ1;
2530 case STATE_IP6_COLON:
2534 pCanonic->append(
"::");
2535 eState = STATE_IP6_2COLON;
2541 case STATE_IP6_2COLON:
2543 eState = STATE_IP6_DONE;
2547 pCanonic->append(
':');
2548 eState = STATE_IP6_3COLON;
2550 else if (rtl::isAsciiDigit(*
p))
2554 eState = STATE_IP6_HEXSEQ2_MAYBE_IP4;
2556 else if (rtl::isAsciiHexDigit(*
p))
2560 eState = STATE_IP6_HEXSEQ2;
2566 case STATE_IP6_3COLON:
2567 if (rtl::isAsciiDigit(*
p))
2572 eState = STATE_IP6_IP4;
2578 case STATE_IP6_HEXSEQ1:
2583 OUString::number(nNumber, 16));
2584 eState = STATE_IP6_DONE;
2591 OUString::number(nNumber, 16));
2592 pCanonic->append(
':');
2594 eState = STATE_IP6_HEXSEQ1_COLON;
2596 else if (rtl::isAsciiHexDigit(*
p) && nDigits < 4)
2605 case STATE_IP6_HEXSEQ1_COLON:
2609 pCanonic->append(
':');
2610 eState = STATE_IP6_2COLON;
2612 else if (rtl::isAsciiDigit(*
p))
2616 eState = STATE_IP6_HEXSEQ1_MAYBE_IP4;
2618 else if (rtl::isAsciiHexDigit(*
p))
2622 eState = STATE_IP6_HEXSEQ1;
2628 case STATE_IP6_HEXSEQ1_MAYBE_IP4:
2633 OUString::number(nNumber, 16));
2634 eState = STATE_IP6_DONE;
2641 OUString::number(nNumber, 16));
2642 pCanonic->append(
':');
2644 eState = STATE_IP6_HEXSEQ1_COLON;
2648 nNumber = 100 * (nNumber >> 8) + 10 * (nNumber >> 4 & 15)
2653 OUString::number(nNumber));
2654 pCanonic->append(
'.');
2657 eState = STATE_IP6_IP4_DOT;
2659 else if (rtl::isAsciiDigit(*
p) && nDigits < 3)
2664 else if (rtl::isAsciiHexDigit(*
p) && nDigits < 4)
2668 eState = STATE_IP6_HEXSEQ1;
2674 case STATE_IP6_HEXSEQ2:
2679 OUString::number(nNumber, 16));
2680 eState = STATE_IP6_DONE;
2687 OUString::number(nNumber, 16));
2688 pCanonic->append(
':');
2690 eState = STATE_IP6_HEXSEQ2_COLON;
2692 else if (rtl::isAsciiHexDigit(*
p) && nDigits < 4)
2701 case STATE_IP6_HEXSEQ2_COLON:
2702 if (rtl::isAsciiDigit(*
p))
2706 eState = STATE_IP6_HEXSEQ2_MAYBE_IP4;
2708 else if (rtl::isAsciiHexDigit(*
p))
2712 eState = STATE_IP6_HEXSEQ2;
2718 case STATE_IP6_HEXSEQ2_MAYBE_IP4:
2723 OUString::number(nNumber, 16));
2724 eState = STATE_IP6_DONE;
2731 OUString::number(nNumber, 16));
2732 pCanonic->append(
':');
2734 eState = STATE_IP6_HEXSEQ2_COLON;
2738 nNumber = 100 * (nNumber >> 8) + 10 * (nNumber >> 4 & 15)
2743 OUString::number(nNumber));
2744 pCanonic->append(
'.');
2747 eState = STATE_IP6_IP4_DOT;
2749 else if (rtl::isAsciiDigit(*
p) && nDigits < 3)
2754 else if (rtl::isAsciiHexDigit(*
p) && nDigits < 4)
2758 eState = STATE_IP6_HEXSEQ2;
2770 OUString::number(nNumber));
2771 eState = STATE_IP6_DONE;
2781 OUString::number(nNumber));
2782 pCanonic->append(
'.');
2785 eState = STATE_IP6_IP4_DOT;
2789 else if (rtl::isAsciiDigit(*
p) && nDigits < 3)
2798 case STATE_IP6_IP4_DOT:
2799 if (rtl::isAsciiDigit(*
p))
2803 eState = STATE_IP6_IP4;
2809 case STATE_IP6_DONE:
2816 case STATE_TOPLABEL:
2817 case STATE_TOPLABEL_DOT:
2820 pCanonic->setLength(nOriginalCanonicLength);
2821 pCanonic->append(rBegin,
p - rBegin);
2831 OUString::number(nNumber));
2836 pCanonic->setLength(nOriginalCanonicLength);
2839 case STATE_IP6_DONE:
2841 pCanonic->append(
']');
2847 pCanonic->setLength(nOriginalCanonicLength);
2855 EncodeMechanism eMechanism, rtl_TextEncoding eCharset,
bool bNetBiosName,
2856 OUStringBuffer* pCanonic)
2860 sal_Int32 nOriginalCanonicLength = pCanonic ? pCanonic->getLength() : 0;
2864 pCanonic->setLength(nOriginalCanonicLength);
2867 while (pBegin < pEnd)
2870 switch (sal_uInt32 nUTF32 =
getUTF32(pBegin, pEnd, eMechanism, eCharset, eEscapeType))
2897 pCanonic->setLength(nOriginalCanonicLength);
2905 rtl_TextEncoding eCharset)
2909 OUStringBuffer aSynHost(rTheHost);
2910 bool bNetBiosName =
false;
2917 aSynHost.setLength(0);
2919 bNetBiosName =
true;
2928 if (aSynHost.isEmpty())
2933 aSynHost.getStr(), aSynHost.getStr() + aSynHost.getLength(),
2949 rtl_TextEncoding eCharset,
2950 bool bSkippedInitialSlash,
2951 sal_uInt32 nSegmentDelimiter,
2952 sal_uInt32 nAltSegmentDelimiter,
2953 sal_uInt32 nQueryDelimiter,
2954 sal_uInt32 nFragmentDelimiter,
2955 OUStringBuffer &rSynPath)
2957 DBG_ASSERT(pBegin,
"INetURLObject::parsePath(): Null output param");
2960 const sal_Int32 nSynPathBeforeLen = rSynPath.getLength();
2967 if (pPos < pEnd && *pPos !=
'/' && *pPos != nFragmentDelimiter)
2969 while (pPos < pEnd && *pPos != nFragmentDelimiter)
2972 sal_uInt32 nUTF32 =
getUTF32(pPos, pEnd, eMechanism,
2973 eCharset, eEscapeType);
2977 if (rSynPath.getLength() - nSynPathBeforeLen == 0)
2978 rSynPath.append(
'/');
2986 if (pPos < pEnd && *pPos !=
'/' && *pPos != nQueryDelimiter
2987 && *pPos != nFragmentDelimiter)
2989 while (pPos < pEnd && *pPos != nQueryDelimiter
2990 && *pPos != nFragmentDelimiter)
2993 sal_uInt32 nUTF32 =
getUTF32(pPos, pEnd, eMechanism,
2994 eCharset, eEscapeType);
2998 if (rSynPath.getLength() - nSynPathBeforeLen == 0)
2999 rSynPath.append(
'/');
3004 if (bSkippedInitialSlash)
3005 rSynPath.append(
'/');
3006 else if (pPos < pEnd
3007 && *pPos != nSegmentDelimiter
3008 && *pPos != nAltSegmentDelimiter)
3010 while (pPos < pEnd && *pPos != nFragmentDelimiter)
3013 sal_uInt32 nUTF32 =
getUTF32(pPos, pEnd, eMechanism,
3014 eCharset, eEscapeType);
3017 if (nUTF32 == nSegmentDelimiter
3018 || nUTF32 == nAltSegmentDelimiter)
3020 rSynPath.append(
'/');
3023 else if (nUTF32 ==
'|'
3025 || *pPos == nFragmentDelimiter
3026 || *pPos == nSegmentDelimiter
3027 || *pPos == nAltSegmentDelimiter)
3028 && rSynPath.getLength() - nSynPathBeforeLen == 2
3029 && rtl::isAsciiAlpha(rSynPath[nSynPathBeforeLen + 1]))
3033 rSynPath.append(
':');
3040 if (rSynPath.getLength() - nSynPathBeforeLen == 0)
3041 rSynPath.append(
'/');
3046 while (pPos < pEnd && *pPos != nQueryDelimiter
3047 && *pPos != nFragmentDelimiter)
3050 sal_uInt32 nUTF32 =
getUTF32(pPos, pEnd, eMechanism,
3051 eCharset, eEscapeType);
3065 while (pPos < pEnd && *pPos != nQueryDelimiter
3066 && *pPos != nFragmentDelimiter)
3069 sal_uInt32 nUTF32 =
getUTF32(pPos, pEnd, eMechanism,
3070 eCharset, eEscapeType);
3078 || *pPos == nQueryDelimiter
3079 || *pPos == nFragmentDelimiter)
3080 rSynPath.append(
'/');
3085 while (pPos < pEnd && *pPos != nQueryDelimiter
3086 && *pPos != nFragmentDelimiter)
3089 sal_uInt32 nUTF32 =
getUTF32(pPos, pEnd,
3091 eCharset, eEscapeType);
3102 while (pPos < pEnd && *pPos != nFragmentDelimiter)
3105 sal_uInt32 nUTF32 =
getUTF32(pPos, pEnd, eMechanism,
3106 eCharset, eEscapeType);
3114 if (pPos < pEnd && *pPos !=
'/'
3115 && *pPos != nQueryDelimiter && *pPos != nFragmentDelimiter)
3117 while (pPos < pEnd && *pPos != nQueryDelimiter
3118 && *pPos != nFragmentDelimiter)
3121 sal_uInt32 nUTF32 =
getUTF32(pPos, pEnd, eMechanism,
3122 eCharset, eEscapeType);
3124 rSynPath.append(
'/');
3129 if (rSynPath.getLength() - nSynPathBeforeLen == 0)
3130 rSynPath.append(
'/');
3136 if (pPos == pEnd || *pPos == nFragmentDelimiter)
3139 while (pPos != pEnd && *pPos != nFragmentDelimiter)
3142 sal_uInt32 nUTF32 =
getUTF32(pPos, pEnd, eMechanism,
3143 eCharset, eEscapeType);
3144 appendUCS4(rSynPath, nUTF32, eEscapeType, ePart,
3154 if (*pPos !=
'/' || pEnd - pPos > 1)
3158 rSynPath.append(
'/');
3162 if (pPos == pEnd || *pPos !=
'/')
3164 while (pPos < pEnd && *pPos != nFragmentDelimiter)
3167 sal_uInt32 nUTF32 =
getUTF32(pPos, pEnd, eMechanism,
3168 eCharset, eEscapeType);
3170 rSynPath.append(
'/');
3179 while (pPos < pEnd && *pPos != nFragmentDelimiter)
3182 sal_uInt32 nUTF32 =
getUTF32(pPos, pEnd, eMechanism,
3183 eCharset, eEscapeType);
3187 if (rSynPath.isEmpty())
3198 rSynPath.setLength(nSynPathBeforeLen);
3204 rtl_TextEncoding eCharset)
3206 OUStringBuffer aSynPath(256);
3210 '/', 0x80000000, 0x80000000, 0x80000000, aSynPath)
3222 "INetURLObject::checkHierarchical vnd.sun.star.expand");
3231 rtl_TextEncoding eCharset)
3237 bool bIgnoreFinalSlash)
3241 "INetURLObject::getSegment(): Bad index");
3254 if (bIgnoreFinalSlash && pSegEnd > pPathBegin && pSegEnd[-1] ==
'/')
3256 if (pSegEnd <= pPathBegin)
3258 pSegBegin = pSegEnd - 1;
3259 while (pSegBegin > pPathBegin && *pSegBegin !=
'/')
3264 pSegBegin = pPathBegin;
3269 if (pSegBegin >= pPathEnd)
3272 while (*pSegBegin !=
'/');
3273 pSegEnd = pSegBegin + 1;
3274 while (pSegEnd < pPathEnd && *pSegEnd !=
'/')
3279 pSegEnd - pSegBegin);
3283 bool bAppendFinalSlash, sal_Int32 nIndex,
3285 rtl_TextEncoding eCharset)
3288 "INetURLObject::insertName(): Bad index");
3301 pPrefixEnd = pPathEnd;
3302 if (pPrefixEnd > pPathBegin &&
3303 pPrefixEnd[-1] ==
'/')
3307 bInsertSlash = bAppendFinalSlash;
3308 pSuffixBegin = pPathEnd;
3312 pPrefixEnd = pPathBegin;
3314 (pPathBegin < pPathEnd && *pPathBegin !=
'/') ||
3315 (pPathBegin == pPathEnd && bAppendFinalSlash);
3317 (pPathEnd - pPathBegin == 1 && *pPathBegin ==
'/' &&
3319 ? pPathEnd : pPathBegin;
3323 pPrefixEnd = pPathBegin;
3325 if (pEnd > pPathBegin && pEnd[-1] ==
'/')
3327 bool bSkip = pPrefixEnd < pEnd && *pPrefixEnd ==
'/';
3328 bInsertSlash =
false;
3329 pSuffixBegin = pPathEnd;
3336 if (pPrefixEnd >= pEnd)
3340 bInsertSlash = bAppendFinalSlash;
3346 if (*pPrefixEnd ==
'/')
3348 pSuffixBegin = pPrefixEnd;
3354 OUStringBuffer aNewPath(256);
3356 OUString::Concat(std::u16string_view(pPathBegin, pPrefixEnd - pPathBegin))
3359 eMechanism, eCharset,
true);
3361 aNewPath.append(
'/');
3363 aNewPath.append(pSuffixBegin, pPathEnd - pSuffixBegin);
3366 RTL_TEXTENCODING_UTF8);
3383 rtl_TextEncoding eCharset)
3387 OUStringBuffer aNewQuery;
3389 eMechanism, eCharset,
true);
3417 rtl_TextEncoding eCharset)
3421 OUStringBuffer aNewFragment;
3423 eMechanism, eCharset,
true);
3440 && rtl::isAsciiAlpha(
p[1])
3450 rtl_TextEncoding eCharset,
3451 bool bKeepVisibleEscapes)
3453 while (pBegin < pEnd)
3456 sal_uInt32 nUTF32 =
getUTF32(pBegin, pEnd,
3457 eMechanism, eCharset, eEscapeType);
3458 appendUCS4(rOutputBuffer, nUTF32, eEscapeType, ePart,
3459 eCharset, bKeepVisibleEscapes);
3467 rtl_TextEncoding eCharset)
3472 return OUString(pBegin, pEnd - pBegin);
3475 eCharset = RTL_TEXTENCODING_UTF8;
3481 OUStringBuffer aResult(
static_cast<int>(pEnd-pBegin));
3482 while (pBegin < pEnd)
3485 sal_uInt32 nUTF32 =
getUTF32(pBegin, pEnd,
3487 switch (eEscapeType)
3490 aResult.appendUtf32(nUTF32);
3499 rtl::isAscii(nUTF32) &&
3512 aResult.appendUtf32(nUTF32);
3516 return aResult.makeStringAndClear();
3520 rtl_TextEncoding eCharset)
const
3524 return aTemp.
GetMainURL(eMechanism, eCharset);
3528 rtl_TextEncoding eCharset)
const
3532 return aTemp.
GetMainURL(eMechanism, eCharset);
3537 uno::Reference< util::XStringWidth >
const & rStringWidth,
3540 rtl_TextEncoding eCharset)
3543 OSL_ENSURE(rStringWidth.is(),
"specification violation");
3559 while (pSchemeEnd[0] !=
':')
3563 aBuffer.append(pSchemeBegin, pSchemeEnd - pSchemeBegin);
3573 bool bSegment =
false;
3581 OUStringBuffer aTrailer;
3586 bool bPrefix =
true;
3587 bool bSuffix =
true;
3593 if (pSuffixEnd == pCoreEnd && *
p ==
'/')
3597 if (bAuthority &&
p == pCoreBegin + 1)
3600 aSegment(
decode(
p + (
p == pBegin && pBegin != pCoreBegin ?
3606 OUStringBuffer aResult(
aBuffer);
3607 if (pSuffixEnd != pBegin)
3608 aResult.append(
"...");
3609 aResult.append(aSegment + aTrailer + aRest);
3611 queryStringWidth(aResult.makeStringAndClear())
3614 aTrailer.insert(0, aSegment);
3620 if (pPrefixBegin > pSuffixEnd)
3621 pPrefixBegin = pSuffixEnd;
3629 + (bAuthority && pPrefixBegin == pCoreBegin ? 2 :
3631 OSL_ASSERT(
p <= pEnd);
3632 while (
p < pEnd && *
p !=
'/')
3634 if (
p == pCoreEnd - 1 && *
p ==
'/')
3637 aSegment(
decode(pPrefixBegin
3638 + (pPrefixBegin == pCoreBegin ? 0 :
3640 p == pEnd ?
p :
p + 1,
3644 OUStringBuffer aResult(
aBuffer + aSegment);
3645 if (pPrefixBegin != pEnd)
3646 aResult.append(
"...");
3647 aResult.append(aTrailer + aRest);
3649 queryStringWidth(aResult.makeStringAndClear())
3654 pBegin = pPrefixBegin;
3658 if (pPrefixBegin > pSuffixEnd)
3659 pSuffixEnd = pPrefixBegin;
3664 while (bPrefix || bSuffix);
3667 if (pPrefixBegin != pBegin || pSuffixEnd != pEnd)
3687 OUStringBuffer aResult(
aBuffer);
3688 if (rStringWidth->queryStringWidth(aResult.makeStringAndClear())
3690 for (sal_Int32
i =
aBuffer.getLength();;)
3705 queryStringWidth(aResult.makeStringAndClear())
3710 return aBuffer.makeStringAndClear();
3739 sal_Int32
nLength = aPath1.getLength();
3740 switch (
nLength - aPath2.getLength())
3758 return aPath1.compareTo(aPath2,
nLength) == 0;
3762 return aPath1 == aPath2;
3767 std::u16string_view rTheUser,
3768 std::u16string_view rThePassword,
3769 std::u16string_view rTheHost,
3770 sal_uInt32 nThePort,
3771 std::u16string_view rThePath)
3783 bool bUserInfo =
false;
3786 if (!rTheUser.empty())
3788 OUStringBuffer aNewUser;
3795 else if (!rTheUser.empty())
3800 if (!rThePassword.empty())
3805 OUStringBuffer aNewAuth;
3821 OUStringBuffer aSynHost(rTheHost);
3822 bool bNetBiosName =
false;
3829 aSynHost.setLength(0);
3831 bNetBiosName =
true;
3836 if (aSynHost.isEmpty() && nThePort != 0)
3844 if (aSynHost.isEmpty())
3852 aSynHost.getStr(), aSynHost.getStr() + aSynHost.getLength(),
3865 OUString::number(nThePort),
3875 else if (!rTheHost.empty() || nThePort != 0)
3881 OUStringBuffer aSynPath(256);
3885 0x80000000, 0x80000000, 0x80000000, aSynPath)
3897 OUString
const & rTheRelURIRef,
3900 rtl_TextEncoding eCharset)
3903 if (rTheRelURIRef.isEmpty() || rTheRelURIRef[0] ==
'#')
3904 return rTheRelURIRef;
3908 return INetURLObject(rTheBaseURIRef, eEncodeMechanism, eCharset).
3910 bWasAbsolute, eEncodeMechanism,
3911 eCharset,
false,
false,
3915 || eCharset != RTL_TEXTENCODING_UTF8 ?
3916 aTheAbsURIRef.
GetMainURL(eDecodeMechanism, eCharset) :
3922 OUString aTheExtURIRef;
3925 return aTheExtURIRef;
3930 && (rtl_ustr_compareIgnoreAsciiCase_WithLength(
3931 scheme.data(), scheme.size(),
3949 return OUString::createFromAscii(
getSchemeInfo(eTheScheme).m_pPrefix);
3967 rtl_TextEncoding eCharset)
const
3973 OUStringBuffer aHostPort(
decode(
m_aHost, eMechanism, eCharset));
3976 aHostPort.append(
":" +
decode(
m_aPort, eMechanism, eCharset));
3978 return aHostPort.makeStringAndClear();
3987 sal_uInt32 nThePort;
4022 if (bIgnoreFinalSlash && pEnd >
p && pEnd[-1] ==
'/')
4024 sal_Int32
n =
p == pEnd || *
p ==
'/' ? 0 : 1;
4041 aNewPath.append(
'/');
4045 if (aNewPath.isEmpty() && !aSegment.
isEmpty() &&
4048 aNewPath.append(
'/');
4052 RTL_TEXTENCODING_UTF8);
4057 rtl_TextEncoding eCharset)
const
4067 if (pSegBegin < pSegEnd && *pSegBegin ==
'/')
4070 while (
p != pSegEnd && *
p !=
';')
4073 return decode(pSegBegin,
p, eMechanism, eCharset);
4077 rtl_TextEncoding eCharset)
4090 if (pSegBegin < pSegEnd && *pSegBegin ==
'/')
4093 while (
p != pSegEnd && *
p !=
';')
4096 OUStringBuffer aNewPath(256);
4097 aNewPath.append(std::u16string_view(pPathBegin, pSegBegin - pPathBegin));
4099 aNewPath.append(std::u16string_view(
p, pPathEnd -
p));
4114 if (pSegBegin < pSegEnd && *pSegBegin ==
'/')
4116 for (
sal_Unicode const *
p = pSegBegin;
p != pSegEnd && *
p !=
';'; ++
p)
4117 if (*
p ==
'.' &&
p != pSegBegin)
4124 rtl_TextEncoding eCharset)
const
4134 if (pSegBegin < pSegEnd && *pSegBegin ==
'/')
4138 for (;
p != pSegEnd && *
p !=
';'; ++
p)
4139 if (*
p ==
'.' &&
p != pSegBegin)
4144 return decode(pSegBegin, pExtension, eMechanism, eCharset);
4149 rtl_TextEncoding eCharset)
4162 if (pSegBegin < pSegEnd && *pSegBegin ==
'/')
4166 for (;
p != pSegEnd && *
p !=
';'; ++
p)
4167 if (*
p ==
'.' &&
p != pSegBegin)
4172 OUStringBuffer aNewPath(256);
4173 aNewPath.append(std::u16string_view(pPathBegin, pSegBegin - pPathBegin));
4175 aNewPath.append(std::u16string_view(pExtension, pPathEnd - pExtension));
4180 bool bIgnoreFinalSlash,
4182 rtl_TextEncoding eCharset)
const
4192 if (pSegBegin < pSegEnd && *pSegBegin ==
'/')
4196 for (;
p != pSegEnd && *
p !=
';'; ++
p)
4197 if (*
p ==
'.' &&
p != pSegBegin)
4203 return decode(pExtension + 1,
p, eMechanism, eCharset);
4207 sal_Int32 nIndex,
bool bIgnoreFinalSlash,
4208 rtl_TextEncoding eCharset)
4221 if (pSegBegin < pSegEnd && *pSegBegin ==
'/')
4225 for (;
p != pSegEnd && *
p !=
';'; ++
p)
4226 if (*
p ==
'.' &&
p != pSegBegin)
4231 OUStringBuffer aNewPath(256);
4232 aNewPath.append(OUString::Concat(std::u16string_view(pPathBegin, pExtension - pPathBegin)) +
".");
4234 aNewPath.append(std::u16string_view(
p, pPathEnd -
p));
4251 if (pSegBegin < pSegEnd && *pSegBegin ==
'/')
4255 for (;
p != pSegEnd && *
p !=
';'; ++
p)
4256 if (*
p ==
'.' &&
p != pSegBegin)
4262 OUString::Concat(std::u16string_view(pPathBegin, pExtension - pPathBegin)) +
4263 std::u16string_view(
p, pPathEnd -
p);
4276 return pPathEnd > pPathBegin && pPathEnd[-1] ==
'/';
4287 if (pPathEnd > pPathBegin && pPathEnd[-1] ==
'/')
4291 = OUString::Concat(std::u16string_view(pPathBegin, pPathEnd - pPathBegin)) +
"/";
4304 if (pPathEnd <= pPathBegin || pPathEnd[-1] !=
'/')
4308 if (pPathEnd == pPathBegin && *pPathBegin ==
'/')
4310 OUString aNewPath(pPathBegin, pPathEnd - pPathBegin);
4357 OUStringBuffer aSynFSysPath(
"//");
4360 RTL_TEXTENCODING_UTF8));
4362 aSynFSysPath.append(
'.');
4364 RTL_TEXTENCODING_UTF8));
4365 return aSynFSysPath.makeStringAndClear();
4384 OUStringBuffer aSynFSysPath(64);
4387 aSynFSysPath.append(
"\\\\"
4395 "INetURLObject::getFSysPath(): Bad path");
4401 RTL_TEXTENCODING_UTF8,
4404 aSynFSysPath.append(
'\\');
4406 aSynFSysPath.appendUtf32(nUTF32);
4408 return aSynFSysPath.makeStringAndClear();
4421 "INetURLObject::appendUCS4Escape(): Bad char");
4424 else if (nUCS4 < 0x800)
4429 else if (nUCS4 < 0x10000)
4435 else if (nUCS4 < 0x200000)
4442 else if (nUCS4 < 0x4000000)
4464 Part ePart, rtl_TextEncoding eCharset,
4465 bool bKeepVisibleEscapes)
4468 rtl_TextEncoding eTargetCharset = RTL_TEXTENCODING_DONTKNOW;
4469 switch (eEscapeType)
4472 if (mustEncode(nUCS4, ePart))
4475 eTargetCharset = RTL_TEXTENCODING_UTF8;
4483 eTargetCharset = RTL_TEXTENCODING_ISO_8859_1;
4487 if (mustEncode(nUCS4, ePart))
4490 eTargetCharset = eCharset;
4495 eTargetCharset = RTL_TEXTENCODING_ASCII_US;
4506 switch (eTargetCharset)
4509 OSL_FAIL(
"INetURLObject::appendUCS4(): Unsupported charset");
4511 case RTL_TEXTENCODING_ASCII_US:
4512 case RTL_TEXTENCODING_ISO_8859_1:
4515 case RTL_TEXTENCODING_UTF8:
4528 rtl_TextEncoding eCharset,
4531 DBG_ASSERT(rBegin < pEnd,
"INetURLObject::getUTF32(): Bad sequence");
4543 if (nUTF32 ==
static_cast<unsigned char>(
'%') && rBegin + 1 < pEnd
4548 nUTF32 = nWeight1 << 4 | nWeight2;
4553 "INetURLObject::getUTF32(): Unsupported charset");
4555 case RTL_TEXTENCODING_ASCII_US:
4556 rEscapeType = rtl::isAscii(nUTF32) ?
4560 case RTL_TEXTENCODING_ISO_8859_1:
4564 case RTL_TEXTENCODING_UTF8:
4565 if (rtl::isAscii(nUTF32))
4569 if (nUTF32 >= 0xC0 && nUTF32 <= 0xF4)
4571 sal_uInt32 nEncoded;
4576 nEncoded = (nUTF32 & 0x1F) << 6;
4580 else if (nUTF32 <= 0xEF)
4582 nEncoded = (nUTF32 & 0x0F) << 12;
4588 nEncoded = (nUTF32 & 0x07) << 18;
4611 |= ((nWeight1 & 3) << 4 | nWeight2)
4617 if (bUTF8 && rtl::isUnicodeScalarValue(nEncoded)
4618 && nEncoded >= nMin)
4640 if (nUTF32 ==
static_cast<unsigned char>(
'%') && rBegin + 1 < pEnd
4645 nUTF32 = nWeight1 << 4 | nWeight2;
4661 enum State { STATE_DOT, STATE_LABEL, STATE_HYPHEN };
4662 State eState = STATE_DOT;
4663 sal_Int32 nLabels = 0;
4669 if (
p != pEnd && (rtl::isAsciiAlphanumeric(*
p) || *
p ==
'_'))
4672 eState = STATE_LABEL;
4675 if (bEager || nLabels == 0)
4683 if (rtl::isAsciiAlphanumeric(*
p) || *
p ==
'_')
4692 pLastAlphanumeric =
p;
4693 eState = STATE_HYPHEN;
4703 if (rtl::isAsciiAlphanumeric(*
p) || *
p ==
'_')
4705 eState = STATE_LABEL;
4713 rBegin = pLastAlphanumeric;
4722 if (rBegin != pEnd && *rBegin ==
'[') {
4725 while (
p != pEnd && (rtl::isAsciiHexDigit(*
p) || *
p ==
':' || *
p ==
'.'))
4729 if (
p != pEnd && *
p ==
']') {
4751 rtl_TextEncoding eCharset)
const
4775 OUString aSystemPath;
4776 if (osl::FileBase::getSystemPathFromFileURL(
4781 != osl::FileBase::E_None)
4820 ? aTheExtension : OUString();
const sal_Int32 m_nLength
static bool isVisible(sal_uInt32 nChar)
Check for US-ASCII visible character.
static sal_uInt32 getUTF32Character(const sal_Unicode *&rBegin, const sal_Unicode *pEnd)
Get the UTF-32 character at the head of a UTF-16 encoded string.
static bool equalIgnoreCase(const sal_Unicode *pBegin1, const sal_Unicode *pEnd1, const char *pString2)
Check two US-ASCII strings for equality, ignoring case.
static int getHexWeight(sal_uInt32 nChar)
Get the hexadecimal digit weight of a US-ASCII character.
static int getWeight(sal_uInt32 nChar)
Get the digit weight of a US-ASCII character.
static bool isIMAPAtomChar(sal_uInt32 nChar)
Check whether some character is valid within an RFC 2060 <atom>.
static sal_Unicode const * scanContentType(std::u16string_view rStr, OUString *pType=nullptr, OUString *pSubType=nullptr, INetContentTypeParameterList *pParameters=nullptr)
Parse the body of an RFC 2045 Content-Type header field.
static bool scanUnsigned(const sal_Unicode *&rBegin, const sal_Unicode *pEnd, bool bLeadingZeroes, sal_uInt32 &rValue)
sal_Int32 set(OUStringBuffer &rString, std::u16string_view rSubString, sal_Int32 nTheBegin)
sal_Int32 getLength() const
int compare(SubString const &rOther, OUStringBuffer const &rThisString, OUStringBuffer const &rOtherString) const
void operator+=(sal_Int32 nDelta)
sal_Int32 getBegin() const
OUString GetHostPort(DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
OUString getExternalURL() const
OUString getName(sal_Int32 nIndex=LAST_SEGMENT, bool bIgnoreFinalSlash=true, DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
Get the name of a segment of the hierarchical path.
static OUString decode(std::u16string_view rText, DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
Decode some text.
bool isAnyKnownWebDAVScheme() const
Check if the scheme is one of the WebDAV scheme we know about.
sal_uInt32 GetPort() const
static OUString GetScheme(INetProtocol eTheScheme)
Return the URL 'prefix' for a given scheme.
bool hasExtension() const
Determine whether the name of the last segment has an extension.
std::unique_ptr< SvMemoryStream > getData() const
bool removeExtension(sal_Int32 nIndex=LAST_SEGMENT, bool bIgnoreFinalSlash=true)
Remove the extension of the name of a segment.
void SetExtension(std::u16string_view rTheExtension)
DecodeMechanism
The way strings that represent (parts of) URIs are returned from get- methods.
@ WithCharset
All (sequences of) escape sequences that represent characters from the specified character set,...
@ Unambiguous
All (sequences of) escape sequences that represent characters from the specified character set,...
@ ToIUri
All sequences of escape sequences that represent UTF-8 coded UTF-32 characters with a numerical value...
@ NONE
The (part of the) URI is returned unchanged.
static TOOLS_DLLPRIVATE void appendEscape(OUStringBuffer &rTheText, sal_uInt32 nOctet)
INetProtocol m_eSmartScheme
static TOOLS_DLLPRIVATE PrefixInfo const * getPrefix(sal_Unicode const *&rBegin, sal_Unicode const *pEnd)
bool setAbsURIRef(std::u16string_view rTheAbsURIRef, EncodeMechanism eMechanism, rtl_TextEncoding eCharset, bool bSmart, FSysStyle eStyle)
void changeScheme(INetProtocol eTargetScheme)
bool setPath(std::u16string_view rThePath, EncodeMechanism eMechanism, rtl_TextEncoding eCharset)
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
static const OUString & GetSchemeName(INetProtocol eTheScheme)
Return the human-readable name for a given scheme.
bool SetPort(sal_uInt32 nThePort)
bool removeFinalSlash()
Remove a final slash from the hierarchical path.
bool setPassword(std::u16string_view rThePassword, rtl_TextEncoding eCharset)
OUString GetFileExtension() const
Get the 'extension' of the last segment in the path.
OUString getExtension(sal_Int32 nIndex=LAST_SEGMENT, bool bIgnoreFinalSlash=true, DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
Get the extension of the name of a segment.
static sal_uInt32 getUTF32(sal_Unicode const *&rBegin, sal_Unicode const *pEnd, EncodeMechanism eMechanism, rtl_TextEncoding eCharset, EscapeType &rEscapeType)
static bool translateToExternal(std::u16string_view rTheIntURIRef, OUString &rTheExtURIRef, DecodeMechanism eDecodeMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
TOOLS_DLLPRIVATE bool checkHierarchical() const
void SetBase(std::u16string_view rTheBase)
static TOOLS_DLLPRIVATE bool parseHostOrNetBiosName(sal_Unicode const *pBegin, sal_Unicode const *pEnd, EncodeMechanism eMechanism, rtl_TextEncoding eCharset, bool bNetBiosName, OUStringBuffer *pCanonic)
static bool convertIntToExt(std::u16string_view rTheIntURIRef, OUString &rTheExtURIRef, DecodeMechanism eDecodeMechanism, rtl_TextEncoding eCharset)
static bool convertExtToInt(std::u16string_view rTheExtURIRef, OUString &rTheIntURIRef, DecodeMechanism eDecodeMechanism, rtl_TextEncoding eCharset)
bool convertRelToAbs(OUString const &rTheRelURIRef, INetURLObject &rTheAbsURIRef, bool &rWasAbsolute, EncodeMechanism eMechanism, rtl_TextEncoding eCharset, bool bIgnoreFragment, bool bSmart, bool bRelativeNonURIs, FSysStyle eStyle) const
bool removeSegment(sal_Int32 nIndex=LAST_SEGMENT, bool bIgnoreFinalSlash=true)
Remove a segment from the hierarchical path.
bool setUser(std::u16string_view rTheUser, rtl_TextEncoding eCharset)
OUStringBuffer m_aAbsURIRef
TOOLS_DLLPRIVATE bool hasDosVolume(FSysStyle eStyle) const
bool setFinalSlash()
Make the hierarchical path end in a final slash (if it does not already do so).
OUString GetPass(DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
OUString GetURLNoMark(DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
static void appendUCS4(OUStringBuffer &rTheText, sal_uInt32 nUCS4, EscapeType eEscapeType, Part ePart, rtl_TextEncoding eCharset, bool bKeepVisibleEscapes)
OUString getBase(sal_Int32 nIndex=LAST_SEGMENT, bool bIgnoreFinalSlash=true, DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
Get the base of the name of a segment.
TOOLS_DLLPRIVATE void setInvalid()
OUString GetLastName(DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
Get the last segment in the path.
bool ConcatData(INetProtocol eTheScheme, std::u16string_view rTheUser, std::u16string_view rThePassword, std::u16string_view rTheHost, sal_uInt32 nThePort, std::u16string_view rThePath)
static INetProtocol CompareProtocolScheme(std::u16string_view aTheAbsURIRef)
static void encodeText(OUStringBuffer &rOutputBuffer, sal_Unicode const *pBegin, sal_Unicode const *pEnd, Part ePart, EncodeMechanism eMechanism, rtl_TextEncoding eCharset, bool bKeepVisibleEscapes)
OUString GetUser(DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
static sal_uInt32 scanDomain(sal_Unicode const *&rBegin, sal_Unicode const *pEnd, bool bEager=true)
bool setBase(std::u16string_view rTheBase, sal_Int32 nIndex=LAST_SEGMENT, EncodeMechanism eMechanism=EncodeMechanism::WasEncoded, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
Set the base of the name of a segment (preserving the extension).
bool operator==(INetURLObject const &rObject) const
OUString GetPartBeforeLastName() const
sal_Int32 getSegmentCount(bool bIgnoreFinalSlash=true) const
The number of segments in the hierarchical path.
TOOLS_DLLPRIVATE sal_Int32 getAuthorityBegin() const
static TOOLS_DLLPRIVATE bool scanIPv6reference(sal_Unicode const *&rBegin, sal_Unicode const *pEnd)
OUString GetURLPath(DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
bool setFragment(std::u16string_view rTheMark, EncodeMechanism eMechanism, rtl_TextEncoding eCharset)
bool insertName(std::u16string_view rTheName, bool bAppendFinalSlash=false, sal_Int32 nIndex=LAST_SEGMENT, EncodeMechanism eMechanism=EncodeMechanism::WasEncoded, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
Insert a new segment into the hierarchical path.
bool setHost(std::u16string_view rTheHost, rtl_TextEncoding eCharset)
OUString GetParam(rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
static TOOLS_DLLPRIVATE bool parseHost(sal_Unicode const *&rBegin, sal_Unicode const *pEnd, OUStringBuffer *pCanonic)
bool setName(std::u16string_view rTheName, EncodeMechanism eMechanism=EncodeMechanism::WasEncoded, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
Set the name of the last segment (preserving any parameters and any query or fragment part).
OUString PathToFileName() const
bool hasFinalSlash() const
Determine whether the hierarchical path ends in a final slash.
@ PART_VISIBLE_NONSPECIAL
OUString GetHost(DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
static OUString GetAbsURL(std::u16string_view rTheBaseURIRef, OUString const &rTheRelURIRef, EncodeMechanism eEncodeMechanism=EncodeMechanism::WasEncoded, DecodeMechanism eDecodeMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
@descr If rTheRelURIRef cannot be converted to an absolute URL (because of syntactic reasons),...
bool convertAbsToRel(OUString const &rTheAbsURIRef, OUString &rTheRelURIRef, EncodeMechanism eEncodeMechanism, DecodeMechanism eDecodeMechanism, rtl_TextEncoding eCharset, FSysStyle eStyle) const
static void appendUCS4Escape(OUStringBuffer &rTheText, sal_uInt32 nUCS4)
INetProtocol GetProtocol() const
TOOLS_DLLPRIVATE SubString getSegment(sal_Int32 nIndex, bool bIgnoreFinalSlash) const
bool setQuery(std::u16string_view rTheQuery, EncodeMechanism eMechanism, rtl_TextEncoding eCharset)
bool setExtension(std::u16string_view rTheExtension, sal_Int32 nIndex=LAST_SEGMENT, bool bIgnoreFinalSlash=true, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
Set the extension of the name of a segment (replacing an already existing extension).
OUString getFSysPath(FSysStyle eStyle, sal_Unicode *pDelimiter=nullptr) const
Return the file system path represented by a file URL (ignoring any fragment part).
bool Append(std::u16string_view rTheSegment, EncodeMechanism eMechanism=EncodeMechanism::WasEncoded, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
static TOOLS_DLLPRIVATE bool parsePath(INetProtocol eScheme, sal_Unicode const **pBegin, sal_Unicode const *pEnd, EncodeMechanism eMechanism, rtl_TextEncoding eCharset, bool bSkippedInitialSlash, sal_uInt32 nSegmentDelimiter, sal_uInt32 nAltSegmentDelimiter, sal_uInt32 nQueryDelimiter, sal_uInt32 nFragmentDelimiter, OUStringBuffer &rSynPath)
TOOLS_DLLPRIVATE SchemeInfo const & getSchemeInfo() const
EncodeMechanism
The way input strings that represent (parts of) URIs are interpreted in set-methods.
@ WasEncoded
Sequences of escape sequences, that represent characters from the specified character set and that ca...
@ NotCanonical
All escape sequences that are already present are copied verbatim (but using upper case hex digits).
@ All
All escape sequences that are already present are ignored, and are interpreted as literal sequences o...
OUString GetURLNoPass(DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
TOOLS_DLLPRIVATE SubString getAuthority() const
bool isSchemeEqualTo(INetProtocol scheme) const
OUString getAbbreviated(css::uno::Reference< css::util::XStringWidth > const &rStringWidth, sal_Int32 nWidth, DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
static std::size_t decodeSomeChars(css::uno::Sequence< sal_Int8 > &aPass, std::u16string_view sBuffer)
#define DBG_ASSERT(sCon, aError)
#define SAL_WARN_IF(condition, area, stream)
void set(css::uno::UnoInterfaceReference const &value)
void replaceAt(OUStringBuffer &rIn, sal_Int32 nIndex, sal_Int32 nCount, std::u16string_view newStr)
bool equalsIgnoreAsciiCase(std::u16string_view s1, std::u16string_view s2)
enumrange< T >::Iterator begin(enumrange< T >)
constexpr OUStringLiteral EMPTY
HashMap_OWString_Interface aMap
std::map< OUString, rtl::Reference< Entity > > map
@ READ
allow read accesses
char const * m_pTranslatedPrefix
rtl::OUStringConstExpr m_sScheme
FSysStyle
The supported notations for file system paths.
@ Detect
Detect the used notation.
@ Unix
Unix notation (e.g., "/dir/file").
@ Dos
DOS notation (e.g., "a:\dir\file" and "\\server\dir\file").
@ Vos
VOS notation (e.g., "//server/dir/file").
std::unique_ptr< char[]> aBuffer