21#include <osl/diagnose.h>
22#include <com/sun/star/ucb/XContent.hpp>
23#include <com/sun/star/beans/PropertyValue.hpp>
24#include <com/sun/star/beans/XPropertySet.hpp>
61 bool buildFrom(
const Sequence< PropertyValue >& _rValues );
67 bool buildFrom(
const Reference< XPropertySet >& _rValues );
70 static PropertyValue
buildPropertyValue(
const DescriptorValues::const_iterator& _rPos );
76 :m_bSetOutOfDate(true)
77 ,m_bSequenceOutOfDate(true)
82 :m_bSetOutOfDate( _rSource.m_bSetOutOfDate )
83 ,m_bSequenceOutOfDate( _rSource.m_bSequenceOutOfDate )
94 bool bValidPropsOnly =
true;
97 for (
const PropertyValue& rValue : _rValues)
99 MapString2PropertyEntry::const_iterator aPropPos = rProperties.find( rValue.Name );
100 if ( aPropPos != rProperties.end() )
107 bValidPropsOnly =
false;
118 return bValidPropsOnly;
123 Reference< XPropertySetInfo > xPropInfo;
125 xPropInfo = _rxValues->getPropertySetInfo();
128 OSL_FAIL(
"ODADescriptorImpl::buildFrom: invalid property set!");
133 const Sequence< Property >
aProperties = xPropInfo->getProperties();
135 Sequence< PropertyValue > aValues(
aProperties.getLength());
136 PropertyValue*
pValues = aValues.getArray();
140 pValues->Name = rProperty.Name;
141 pValues->Value = _rxValues->getPropertyValue(rProperty.Name);
145 bool bValidPropsOnly =
buildFrom(aValues);
148 return bValidPropsOnly;
178 return s_aProperties;
187 auto loop = std::find_if(rProperties.begin(), rProperties.end(),
188 [&nNeededHandle](
const MapString2PropertyEntry::value_type& rProp) { return nNeededHandle == rProp.second; });
189 if (loop != rProperties.end())
200 PropertyValue aReturn;
201 aReturn.Name = pProperty->first;
202 aReturn.Handle =
static_cast<sal_Int32
>(pProperty->second);
203 aReturn.Value = _rPos->second;
204 aReturn.State = PropertyState_DIRECT_VALUE;
219 for ( DescriptorValues::const_iterator aLoop =
m_aValues.begin();
242 :
m_pImpl(std::move(_rSource.m_pImpl))
248 if (
this != &_rSource)
255 m_pImpl = std::move(_rSource.m_pImpl);
266 :
m_pImpl(new ODADescriptorImpl)
269 Sequence< PropertyValue > aValues;
270 Reference< XPropertySet > xValues;
271 if ( _rValues >>= aValues )
273 else if ( _rValues >>= xValues )
278 :
m_pImpl(new ODADescriptorImpl)
294 OSL_ENSURE(
has(_eWhich),
"ODataAccessDescriptor::erase: invalid call!");
296 m_pImpl->m_aValues.erase(_eWhich);
301 return m_pImpl->m_aValues.find(_eWhich) !=
m_pImpl->m_aValues.end();
308 OSL_FAIL(
"ODataAccessDescriptor::operator[]: invalid accessor!");
309 static const Any aDummy;
313 return m_pImpl->m_aValues[_eWhich];
318 m_pImpl->invalidateExternRepresentations();
319 return m_pImpl->m_aValues[_eWhich];
336 OUString sDataSourceName;
341 return sDataSourceName;
346 if ( !_sDataSourceNameOrLocation.isEmpty() )
const PropertyValue * pValues
PropertiesInfo aProperties
::std::map< DataAccessDescriptorProperty, Any > DescriptorValues
bool m_bSequenceOutOfDate
void invalidateExternRepresentations()
DescriptorValues m_aValues
static PropertyValue buildPropertyValue(const DescriptorValues::const_iterator &_rPos)
bool buildFrom(const Sequence< PropertyValue > &_rValues)
builds the descriptor from a property value sequence
static const MapString2PropertyEntry & getPropertyMap()
Sequence< PropertyValue > m_aAsSequence
::std::map< OUString, DataAccessDescriptorProperty > MapString2PropertyEntry
static PropertyMapEntry const * getPropertyMapEntry(const DescriptorValues::const_iterator &_rPos)
class encapsulating the css::sdb::DataAccessDescriptor service.
void initializeFrom(const css::uno::Sequence< css::beans::PropertyValue > &_rValues)
initialized the descriptor from the property values given The descriptor will clear all its current s...
css::uno::Sequence< css::beans::PropertyValue > const & createPropertyValueSequence()
returns the descriptor as property value sequence
bool has(DataAccessDescriptorProperty _eWhich) const
checks whether or not a given property is present in the descriptor
OUString getDataSource() const
returns either the data source name if given or the database location
std::unique_ptr< ODADescriptorImpl > m_pImpl
void clear()
empties the descriptor
ODataAccessDescriptor & operator=(const ODataAccessDescriptor &_rSource)
const css::uno::Any & operator[](DataAccessDescriptorProperty _eWhich) const
return the value of a given property
void setDataSource(const OUString &_sDataSourceNameOrLocation)
set the data source name, if it is not file URL
void erase(DataAccessDescriptorProperty _eWhich)
erases the given property from the descriptor
DataAccessDescriptorProperty
@ BookmarkSelection
selection (sequence< any >)
@ ConnectionResource
database file URL (string)
@ ColumnObject
column name (string)
@ Component
selection are bookmarks? (boolean)
@ Selection
column object (XPropertySet)
@ ColumnName
the cursor (XResultSet)
@ Cursor
additional filter (string)
@ EscapeProcessing
command type (long)
@ DatabaseLocation
data source name (string)
@ Connection
database driver URL (string)
@ Filter
escape processing (boolean)
@ CommandType
command (string)
@ Command
connection (XConnection)
std::pair< OUString const, DataAccessDescriptorProperty > PropertyMapEntry