summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-04-09 09:37:17 +0200
committerFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-04-09 09:37:17 +0200
commit5d5e24f5bc71d413f051746063573a72db65ab7d (patch)
treeaaad06c8859ffd54160a928ab8b753a9d4d1faca /tools
parent0768a7d2726ce4f0772b52d95eeb23143336655c (diff)
parentbc05d94bb339e0f25bb329ad0c6b27d779d3e664 (diff)
slidecopy: merge CWS wth MWS-m76
Diffstat (limited to 'tools')
-rw-r--r--tools/inc/tools/diagnose_ex.h18
-rw-r--r--tools/inc/tools/gen.hxx15
-rw-r--r--tools/inc/tools/urlobj.hxx31
-rw-r--r--tools/source/fsys/urlobj.cxx64
-rw-r--r--tools/workben/urltest.cxx14
5 files changed, 101 insertions, 41 deletions
diff --git a/tools/inc/tools/diagnose_ex.h b/tools/inc/tools/diagnose_ex.h
index fac739b32583..6833fd6632ce 100644
--- a/tools/inc/tools/diagnose_ex.h
+++ b/tools/inc/tools/diagnose_ex.h
@@ -141,6 +141,24 @@
return; \
}
+/** asserts a given condition (in debug mode), and continues the most-inner
+ loop if the condition is not met
+*/
+#define ENSURE_OR_CONTINUE( c, m ) \
+ if ( !(c) ) \
+ { \
+ OSL_ENSURE( false, m ); \
+ continue; \
+ }
+/** asserts a given condition (in debug mode), and continues the most-inner
+ loop if the condition is not met
+*/
+#define ENSURE_OR_BREAK( c, m ) \
+ if ( !(c) ) \
+ { \
+ OSL_ENSURE( false, m ); \
+ break; \
+ }
#endif // TOOLS_DIAGNOSE_EX_H
diff --git a/tools/inc/tools/gen.hxx b/tools/inc/tools/gen.hxx
index 85da22126b77..308cc02165ce 100644
--- a/tools/inc/tools/gen.hxx
+++ b/tools/inc/tools/gen.hxx
@@ -420,6 +420,7 @@ public:
Point Center() const;
void Move( long nHorzMove, long nVertMove );
+ inline void Transpose();
inline void SetPos( const Point& rPoint );
void SetSize( const Size& rSize );
inline Size GetSize() const;
@@ -578,6 +579,20 @@ inline void Rectangle::Move( long nHorzMove, long nVertMove )
nBottom += nVertMove;
}
+void Rectangle::Transpose()
+{
+ if ( !IsEmpty() )
+ {
+ long swap( nLeft );
+ nLeft = nTop;
+ nTop = swap;
+
+ swap = nRight;
+ nRight = nBottom;
+ nBottom = swap;
+ }
+}
+
inline void Rectangle::SetPos( const Point& rPoint )
{
if ( nRight != RECT_EMPTY )
diff --git a/tools/inc/tools/urlobj.hxx b/tools/inc/tools/urlobj.hxx
index 86a8114ab0b8..17d52432e206 100644
--- a/tools/inc/tools/urlobj.hxx
+++ b/tools/inc/tools/urlobj.hxx
@@ -125,22 +125,21 @@ enum INetProtocol
INET_PROT_DATA = 15,
INET_PROT_CID = 16,
INET_PROT_OUT = 17,
- INET_PROT_VND_SUN_STAR_WFS = 18,
- INET_PROT_VND_SUN_STAR_HIER = 19,
- INET_PROT_VIM = 20,
- INET_PROT_UNO = 21,
- INET_PROT_COMPONENT = 22,
- INET_PROT_VND_SUN_STAR_PKG = 23,
- INET_PROT_LDAP = 24,
- INET_PROT_DB = 25,
- INET_PROT_VND_SUN_STAR_CMD = 26,
- INET_PROT_VND_SUN_STAR_ODMA = 27,
- INET_PROT_TELNET = 28,
- INET_PROT_VND_SUN_STAR_EXPAND = 29,
- INET_PROT_VND_SUN_STAR_TDOC = 30,
- INET_PROT_GENERIC = 31,
- INET_PROT_SMB = 32,
- INET_PROT_END = 33
+ INET_PROT_VND_SUN_STAR_HIER = 18,
+ INET_PROT_VIM = 19,
+ INET_PROT_UNO = 20,
+ INET_PROT_COMPONENT = 21,
+ INET_PROT_VND_SUN_STAR_PKG = 22,
+ INET_PROT_LDAP = 23,
+ INET_PROT_DB = 24,
+ INET_PROT_VND_SUN_STAR_CMD = 25,
+ INET_PROT_VND_SUN_STAR_ODMA = 26,
+ INET_PROT_TELNET = 27,
+ INET_PROT_VND_SUN_STAR_EXPAND = 28,
+ INET_PROT_VND_SUN_STAR_TDOC = 29,
+ INET_PROT_GENERIC = 30,
+ INET_PROT_SMB = 31,
+ INET_PROT_END = 32
};
//============================================================================
diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx
index 07c532e60dd7..a6d7bc6fd04e 100644
--- a/tools/source/fsys/urlobj.cxx
+++ b/tools/source/fsys/urlobj.cxx
@@ -191,11 +191,6 @@ using namespace com::sun;
name = *(escaped / alphanum / "!" / "$" / "'" / "(" / ")" / "*" / "+" / "," / "-" / "." / ":" / ";" / "=" / "?" / "@" / "_" / "~"
- ; prvate (see RFC 1738, RFC 2396)
- vnd-sun-star-wfs-url = "VND.SUN.STAR.WFS://" [host / "LOCALHOST"] ["/" segment *("/" segment)]
- segment = *pchar
-
-
; private
vnd-sun-star-hier-url = "VND.SUN.STAR.HIER:" ["//"reg_name] *("/" *pchar)
reg_name = 1*(escaped / alphanum / "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / "-" / "." / ":" / ";" / "=" / "@" / "_" / "~")
@@ -403,8 +398,6 @@ static INetURLObject::SchemeInfo const aSchemeInfoMap[INET_PROT_END]
false, false },
{ "out", "out://", 0, true, false, false, false, false, false,
false, false },
- { "vnd.sun.star.wfs", "vnd.sun.star.wfs://", 0, true, false, false,
- false, true, true, true, false },
{ "vnd.sun.star.hier", "vnd.sun.star.hier:", 0, true, false, false,
false, false, false, true, false },
{ "vim", "vim://", 0, true, true, false, true, false, false, true,
@@ -429,7 +422,7 @@ static INetURLObject::SchemeInfo const aSchemeInfoMap[INET_PROT_END]
false, false, false, false, false },
{ "vnd.sun.star.tdoc", "vnd.sun.star.tdoc:", 0, false, false, false,
false, false, false, true, false },
- { "", "", 0, false, false, false, false, false, false, false, false },
+ { "", "", 0, false, false, false, false, true, true, true, false },
{ "smb", "smb://", 139, true, true, false, true, true, true, true,
true } };
@@ -1338,7 +1331,7 @@ bool INetURLObject::setAbsURIRef(rtl::OUString const & rTheAbsURIRef,
if (pHostPortBegin)
{
sal_Unicode const * pPort = pHostPortEnd;
- if (getSchemeInfo().m_bPort && pHostPortBegin < pHostPortEnd)
+ if ( getSchemeInfo().m_bPort && pHostPortBegin < pHostPortEnd )
{
sal_Unicode const * p1 = pHostPortEnd - 1;
while (p1 > pHostPortBegin && INetMIME::isDigit(*p1))
@@ -1350,7 +1343,6 @@ bool INetURLObject::setAbsURIRef(rtl::OUString const & rTheAbsURIRef,
switch (m_eScheme)
{
case INET_PROT_FILE:
- case INET_PROT_VND_SUN_STAR_WFS:
// If the host equals "LOCALHOST" (unencoded and ignoring
// case), turn it into an empty host:
if (INetMIME::equalIgnoreCase(pHostPortBegin, pPort,
@@ -1367,7 +1359,6 @@ bool INetURLObject::setAbsURIRef(rtl::OUString const & rTheAbsURIRef,
return false;
}
break;
-
default:
if (pHostPortBegin == pPort)
{
@@ -1609,7 +1600,23 @@ bool INetURLObject::convertRelToAbs(rtl::OUString const & rTheRelURIRef,
STATE_DONE };
rtl::OUStringBuffer aSynAbsURIRef;
- aSynAbsURIRef.appendAscii(getSchemeInfo().m_pScheme);
+ // make sure that the scheme is copied for generic schemes: getSchemeInfo().m_pScheme
+ // is empty ("") in that case, so take the scheme from m_aAbsURIRef
+ if (m_eScheme != INET_PROT_GENERIC)
+ {
+ aSynAbsURIRef.appendAscii(getSchemeInfo().m_pScheme);
+ }
+ else
+ {
+ sal_Unicode const * pSchemeBegin
+ = m_aAbsURIRef.getStr();
+ sal_Unicode const * pSchemeEnd = pSchemeBegin;
+ while (pSchemeEnd[0] != ':')
+ {
+ ++pSchemeEnd;
+ }
+ aSynAbsURIRef.append(pSchemeBegin, pSchemeEnd - pSchemeBegin);
+ }
aSynAbsURIRef.append(sal_Unicode(':'));
sal_Char cEscapePrefix = getEscapePrefix();
@@ -2162,11 +2169,7 @@ INetURLObject::getPrefix(sal_Unicode const *& rBegin,
{ "vnd.sun.star.tdoc:", 0, INET_PROT_VND_SUN_STAR_TDOC,
PrefixInfo::OFFICIAL },
{ "vnd.sun.star.webdav:", 0, INET_PROT_VND_SUN_STAR_WEBDAV,
- PrefixInfo::OFFICIAL },
- { "vnd.sun.star.wfs:", 0, INET_PROT_VND_SUN_STAR_WFS,
- PrefixInfo::OFFICIAL },
- { "wfs:", "vnd.sun.star.wfs:", INET_PROT_VND_SUN_STAR_WFS,
- PrefixInfo::ALIAS } };
+ PrefixInfo::OFFICIAL } };
PrefixInfo const * pFirst = aMap + 1;
PrefixInfo const * pLast = aMap + sizeof aMap / sizeof (PrefixInfo) - 1;
PrefixInfo const * pMatch = 0;
@@ -2889,7 +2892,6 @@ bool INetURLObject::setHost(rtl::OUString const & rTheHost, bool bOctets,
switch (m_eScheme)
{
case INET_PROT_FILE:
- case INET_PROT_VND_SUN_STAR_WFS:
{
rtl::OUString sTemp(aSynHost);
if (sTemp.equalsIgnoreAsciiCaseAsciiL(
@@ -2985,7 +2987,6 @@ bool INetURLObject::parsePath(INetProtocol eScheme,
break;
case INET_PROT_FILE:
- case INET_PROT_VND_SUN_STAR_WFS:
{
if (bSkippedInitialSlash)
aTheSynPath.append(sal_Unicode('/'));
@@ -3398,7 +3399,6 @@ bool INetURLObject::parsePath(INetProtocol eScheme,
if (aTheSynPath.getLength() == 0)
return false;
break;
-
default:
OSL_ASSERT(false);
break;
@@ -3825,7 +3825,27 @@ INetURLObject::getAbbreviated(
OSL_ENSURE(rStringWidth.is(), "specification violation");
sal_Char cEscapePrefix = getEscapePrefix();
rtl::OUStringBuffer aBuffer;
- aBuffer.appendAscii(getSchemeInfo().m_pScheme);
+ // make sure that the scheme is copied for generic schemes: getSchemeInfo().m_pScheme
+ // is empty ("") in that case, so take the scheme from m_aAbsURIRef
+ if (m_eScheme != INET_PROT_GENERIC)
+ {
+ aBuffer.appendAscii(getSchemeInfo().m_pScheme);
+ }
+ else
+ {
+ if (m_aAbsURIRef)
+ {
+ sal_Unicode const * pSchemeBegin
+ = m_aAbsURIRef.getStr();
+ sal_Unicode const * pSchemeEnd = pSchemeBegin;
+
+ while (pSchemeEnd[0] != ':')
+ {
+ ++pSchemeEnd;
+ }
+ aBuffer.append(pSchemeBegin, pSchemeEnd - pSchemeBegin);
+ }
+ }
aBuffer.append(static_cast< sal_Unicode >(':'));
bool bAuthority = getSchemeInfo().m_bAuthority;
sal_Unicode const * pCoreBegin
@@ -4007,7 +4027,6 @@ bool INetURLObject::operator ==(INetURLObject const & rObject) const
switch (m_eScheme)
{
case INET_PROT_FILE:
- case INET_PROT_VND_SUN_STAR_WFS:
{
// If the URL paths of two file URLs only differ in that one has a
// final '/' and the other has not, take the two paths as
@@ -4162,7 +4181,6 @@ bool INetURLObject::ConcatData(INetProtocol eTheScheme,
switch (m_eScheme)
{
case INET_PROT_FILE:
- case INET_PROT_VND_SUN_STAR_WFS:
{
rtl::OUString sTemp(aSynHost);
if (sTemp.equalsIgnoreAsciiCaseAsciiL(
diff --git a/tools/workben/urltest.cxx b/tools/workben/urltest.cxx
index 694698297680..0930dfcc5239 100644
--- a/tools/workben/urltest.cxx
+++ b/tools/workben/urltest.cxx
@@ -523,6 +523,8 @@ main()
/*TODO "vnd.sun.star.wfs:///c|/xyz/",*/
/*TODO "vnd.sun.star.wfs://xxx/yyy?zzz",*/
"vnd.sun.star.wfs:///x/y/z",
+ "vnd.sun.star.generic:///x/y/z",
+ "vnd.sun.star.generic://host:34/x/y/z"
/*TODO "wfs://",*/
/*TODO "wfs://LocalHost",*/
/*TODO "wfs:///c|/xyz/",*/
@@ -533,13 +535,21 @@ main()
INetURLObject aUrl(aTest[i]);
if (aUrl.HasError())
printf("BAD %s\n", aTest[i]);
- else if (aUrl.GetMainURL(INetURLObject::DECODE_TO_IURI).
- equalsAscii(aTest[i]) != sal_True)
+ else
{
+ if (aUrl.GetProtocol() != INET_PROT_GENERIC) {
+ printf("BAD PROTOCOL %i -> %i\n",
+ aUrl.GetProtocol(),
+ INET_PROT_GENERIC);
+ }
+ if (aUrl.GetMainURL(INetURLObject::DECODE_TO_IURI).
+ equalsAscii(aTest[i]) != sal_True)
+ {
String sTest(aUrl.GetMainURL(INetURLObject::DECODE_TO_IURI));
printf("BAD %s -> %s\n",
aTest[i],
ByteString(sTest, RTL_TEXTENCODING_ASCII_US).GetBuffer());
+ }
}
}
}