Kaydet (Commit) 51e5e497 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Replace OLEString operators with proper functions, for clarity

Change-Id: I1fa309d034e1ec94f38d07ede07e691f1484a4f5
Reviewed-on: https://gerrit.libreoffice.org/29697Reviewed-by: 's avatarStephan Bergmann <sbergman@redhat.com>
Tested-by: 's avatarStephan Bergmann <sbergman@redhat.com>
üst afd9bf19
...@@ -71,7 +71,7 @@ OConnection::OConnection(ODriver* _pDriver) throw(SQLException, RuntimeExcepti ...@@ -71,7 +71,7 @@ OConnection::OConnection(ODriver* _pDriver) throw(SQLException, RuntimeExcepti
hr = pIUnknown->CreateInstanceLic( pOuter, hr = pIUnknown->CreateInstanceLic( pOuter,
NULL, NULL,
ADOS::IID_ADOCONNECTION_21, ADOS::IID_ADOCONNECTION_21,
ADOS::GetKeyStr(), ADOS::GetKeyStr().asBSTR(),
(void**) &pCon); (void**) &pCon);
if( !FAILED( hr ) ) if( !FAILED( hr ) )
......
...@@ -549,8 +549,8 @@ OUString WpADOCatalog::GetObjectOwner(const OUString& _rName, ObjectTypeEnum _eN ...@@ -549,8 +549,8 @@ OUString WpADOCatalog::GetObjectOwner(const OUString& _rName, ObjectTypeEnum _eN
_rVar.setNoArg(); _rVar.setNoArg();
OLEString aBSTR; OLEString aBSTR;
OLEString sStr1(_rName); OLEString sStr1(_rName);
pInterface->GetObjectOwner(sStr1,_eNum,_rVar,&aBSTR); pInterface->GetObjectOwner(sStr1.asBSTR(),_eNum,_rVar,aBSTR.getAddress());
return aBSTR; return aBSTR.asOUString();
} }
void OAdoTable::fillPropertyValues() void OAdoTable::fillPropertyValues()
......
...@@ -60,7 +60,7 @@ sdbcx::ObjectType OUsers::appendObject( const OUString& _rForName, const Referen ...@@ -60,7 +60,7 @@ sdbcx::ObjectType OUsers::appendObject( const OUString& _rForName, const Referen
m_pCatalog->getConnection()->throwGenericSQLException( STR_INVALID_USER_DESCRIPTOR_ERROR,static_cast<XTypeProvider*>(this) ); m_pCatalog->getConnection()->throwGenericSQLException( STR_INVALID_USER_DESCRIPTOR_ERROR,static_cast<XTypeProvider*>(this) );
ADOUsers* pUsers = (ADOUsers*)m_aCollection; ADOUsers* pUsers = (ADOUsers*)m_aCollection;
pUsers->Append(OLEVariant(pUser->getImpl()),OLEString(pUser->getPassword())); pUsers->Append(OLEVariant(pUser->getImpl()),OLEString(pUser->getPassword()).asBSTR());
return createObject( _rForName ); return createObject( _rForName );
} }
......
...@@ -88,8 +88,8 @@ void OAdoView::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const ...@@ -88,8 +88,8 @@ void OAdoView::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const
{ {
ADOCommand* pCom = (ADOCommand*)aVar.getIDispatch(); ADOCommand* pCom = (ADOCommand*)aVar.getIDispatch();
OLEString aBSTR; OLEString aBSTR;
pCom->get_CommandText(&aBSTR); pCom->get_CommandText(aBSTR.getAddress());
rValue <<= aBSTR.operator OUString(); rValue <<= aBSTR.asOUString();
} }
} }
break; break;
......
...@@ -72,7 +72,7 @@ sdbcx::ObjectType OViews::appendObject( const OUString& _rForName, const Referen ...@@ -72,7 +72,7 @@ sdbcx::ObjectType OViews::appendObject( const OUString& _rForName, const Referen
aCommand.put_Name(sName); aCommand.put_Name(sName);
aCommand.put_CommandText(getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_COMMAND)))); aCommand.put_CommandText(getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_COMMAND))));
ADOViews* pViews = (ADOViews*)m_aCollection; ADOViews* pViews = (ADOViews*)m_aCollection;
if(FAILED(pViews->Append(OLEString(sName),aCommand))) if(FAILED(pViews->Append(OLEString(sName).asBSTR(),aCommand)))
ADOS::ThrowException(*m_pCatalog->getConnection()->getConnection(),static_cast<XTypeProvider*>(this)); ADOS::ThrowException(*m_pCatalog->getConnection()->getConnection(),static_cast<XTypeProvider*>(this));
OTables* pTables = static_cast<OTables*>(static_cast<OCatalog&>(m_rParent).getPrivateTables()); OTables* pTables = static_cast<OTables*>(static_cast<OCatalog&>(m_rParent).getPrivateTables());
......
...@@ -77,15 +77,15 @@ OLEString& OLEString::operator=(const BSTR& _rSrc) ...@@ -77,15 +77,15 @@ OLEString& OLEString::operator=(const BSTR& _rSrc)
m_sStr = _rSrc; m_sStr = _rSrc;
return *this; return *this;
} }
OLEString::operator OUString() const OUString OLEString::asOUString() const
{ {
return (m_sStr != NULL) ? OUString(reinterpret_cast<const sal_Unicode*>(LPCOLESTR(m_sStr)),::SysStringLen(m_sStr)) : OUString(); return (m_sStr != NULL) ? OUString(reinterpret_cast<const sal_Unicode*>(LPCOLESTR(m_sStr)),::SysStringLen(m_sStr)) : OUString();
} }
OLEString::operator BSTR() const BSTR OLEString::asBSTR() const
{ {
return m_sStr; return m_sStr;
} }
BSTR* OLEString::operator &() BSTR* OLEString::getAddress()
{ {
return &m_sStr; return &m_sStr;
} }
...@@ -427,7 +427,7 @@ OLEVariant::operator css::uno::Sequence< sal_Int8 >() const ...@@ -427,7 +427,7 @@ OLEVariant::operator css::uno::Sequence< sal_Int8 >() const
if(V_VT(this) == VT_BSTR) if(V_VT(this) == VT_BSTR)
{ {
OLEString sStr(V_BSTR(this)); OLEString sStr(V_BSTR(this));
aRet = css::uno::Sequence<sal_Int8>(reinterpret_cast<const sal_Int8*>((const wchar_t*)sStr),sizeof(sal_Unicode)*sStr.length()); aRet = css::uno::Sequence<sal_Int8>(reinterpret_cast<const sal_Int8*>(sStr.asBSTR()),sizeof(sal_Unicode)*sStr.length());
} }
else if(!isNull()) else if(!isNull())
{ {
......
...@@ -64,9 +64,9 @@ namespace connectivity ...@@ -64,9 +64,9 @@ namespace connectivity
OLEString& operator=(const OUString& _rSrc); OLEString& operator=(const OUString& _rSrc);
OLEString& operator=(const BSTR& _rSrc); OLEString& operator=(const BSTR& _rSrc);
OLEString& operator=(const OLEString& _rSrc); OLEString& operator=(const OLEString& _rSrc);
operator OUString() const; OUString asOUString() const;
operator BSTR() const; BSTR asBSTR() const;
BSTR* operator &(); BSTR* getAddress();
sal_Int32 length() const; sal_Int32 length() const;
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment