19#include <config_fuzzers.h>
33 void lcl_convert(
const uno::Sequence< OUString >& _aSource,
uno::Any& _rDest)
35 uno::Sequence<uno::Any> aRet(_aSource.getLength());
37 const OUString* pIter = _aSource.getConstArray();
38 const OUString* pEnd = pIter + _aSource.getLength();
39 for (;pIter != pEnd ; ++pIter,++pAny)
47 const ::utl::OConfigurationNode aPropertiesNode = _aURLPatternNode.openNode(_sNode);
48 if ( !aPropertiesNode.isValid() )
51 uno::Sequence< OUString > aStringSeq;
52 const uno::Sequence< OUString >
aProperties = aPropertiesNode.getNodeNames();
53 const OUString* pPropertiesIter =
aProperties.getConstArray();
54 const OUString* pPropertiesEnd = pPropertiesIter +
aProperties.getLength();
55 for (;pPropertiesIter != pPropertiesEnd ; ++pPropertiesIter)
57 uno::Any aValue = aPropertiesNode.getNodeValue(*pPropertiesIter +
"/Value");
58 if ( aValue >>= aStringSeq )
60 lcl_convert(aStringSeq,aValue);
62 _rValues.
put(*pPropertiesIter,aValue);
65 void lcl_readURLPatternNode(const ::utl::OConfigurationTreeRoot& _aInstalled,
const OUString& _sEntry,
TInstalledDriver& _rInstalledDriver)
67 const ::utl::OConfigurationNode aURLPatternNode = _aInstalled.openNode(_sEntry);
68 if ( !aURLPatternNode.isValid() )
71 OUString sParentURLPattern;
72 aURLPatternNode.getNodeValue(
"ParentURLPattern") >>= sParentURLPattern;
73 if ( !sParentURLPattern.isEmpty() )
74 lcl_readURLPatternNode(_aInstalled,sParentURLPattern,_rInstalledDriver);
76 OUString sDriverFactory;
77 aURLPatternNode.getNodeValue(
"Driver") >>= sDriverFactory;
78 if ( !sDriverFactory.isEmpty() )
81 OUString sDriverTypeDisplayName;
82 aURLPatternNode.getNodeValue(
"DriverTypeDisplayName") >>= sDriverTypeDisplayName;
83 OSL_ENSURE(!sDriverTypeDisplayName.isEmpty(),
"No valid DriverTypeDisplayName property!");
84 if ( !sDriverTypeDisplayName.isEmpty() )
87 lcl_fillValues(aURLPatternNode,
"Properties",_rInstalledDriver.
aProperties);
88 lcl_fillValues(aURLPatternNode,
"Features",_rInstalledDriver.
aFeatures);
89 lcl_fillValues(aURLPatternNode,
"MetaData",_rInstalledDriver.
aMetaData);
93DriversConfigImpl::DriversConfigImpl()
109 const uno::Sequence< OUString > aURLPatterns =
m_aInstalled.getNodeNames();
110 const OUString* pPatternIter = aURLPatterns.getConstArray();
111 const OUString* pPatternEnd = pPatternIter + aURLPatterns.getLength();
112 for (;pPatternIter != pPatternEnd ; ++pPatternIter)
115 lcl_readURLPatternNode(
m_aInstalled,*pPatternIter,aInstalledDriver);
117 m_aDrivers.emplace(*pPatternIter,aInstalledDriver);
125:m_xORB(
std::move(_xORB))
155 return "com.sun.star.comp.sdbc.dbase.ODriver";
160 OUString sOldPattern;
161 for(
const auto& [rPattern, rDriver] : rDrivers)
164 if ( sOldPattern.getLength() < rPattern.getLength() && aWildCard.
Matches(_sURL) )
166 sRet = rDriver.sDriverFactory;
167 sOldPattern = rPattern;
178 OUString sOldPattern;
179 for(
const auto& [rPattern, rDriver] : rDrivers)
182 if ( sOldPattern.getLength() < rPattern.getLength() && aWildCard.
Matches(_sURL) )
184 sRet = rDriver.sDriverTypeDisplayName;
185 sOldPattern = rPattern;
213 const ::comphelper::NamedValueCollection* pRet =
nullptr;
214 OUString sOldPattern;
215 for(
const auto& [rPattern, rDriver] : rDrivers)
218 if ( sOldPattern.getLength() < rPattern.getLength() && aWildCard.
Matches(_sURL) )
223 pRet = &rDriver.aFeatures;
226 pRet = &rDriver.aProperties;
229 pRet = &rDriver.aMetaData;
232 sOldPattern = rPattern;
235 if ( pRet ==
nullptr )
237 static const ::comphelper::NamedValueCollection s_sEmpty;
PropertiesInfo aProperties
bool Matches(std::u16string_view rStr) const
bool put(const OUString &_rValueName, const VALUE_TYPE &_rValue)
const TInstalledDrivers & getInstalledDrivers(const css::uno::Reference< css::uno::XComponentContext > &_rxORB) const
TInstalledDrivers m_aDrivers
mutable::utl::OConfigurationTreeRoot m_aInstalled
OUString getDriverTypeDisplayName(std::u16string_view _sUrl) const
DriversConfig(css::uno::Reference< css::uno::XComponentContext > _xORB)
const ::comphelper::NamedValueCollection & getFeatures(std::u16string_view _sURL) const
css::uno::Sequence< OUString > getURLs() const
DriversConfig & operator=(const DriversConfig &)
OUString getDriverFactoryName(std::u16string_view _sUrl) const
const ::comphelper::NamedValueCollection & impl_get(std::u16string_view _sURL, sal_Int32 _nProps) const
const ::comphelper::NamedValueCollection & getProperties(std::u16string_view _sURL) const
const ::comphelper::NamedValueCollection & getMetaData(std::u16string_view _sURL) const
OSharedConfigNode m_aNode
css::uno::Reference< css::uno::XComponentContext > m_xORB
static OConfigurationTreeRoot createWithComponentContext(const css::uno::Reference< css::uno::XComponentContext > &_rxContext, const OUString &_rPath, sal_Int32 _nDepth=-1, CREATION_MODE _eMode=CM_UPDATABLE)
css::uno::Sequence< typename M::key_type > mapKeysToSequence(M const &map)
std::map< OUString, TInstalledDriver > TInstalledDrivers
constexpr bool starts_with(std::basic_string_view< charT, traits > sv, std::basic_string_view< charT, traits > x) noexcept
::comphelper::NamedValueCollection aMetaData
::comphelper::NamedValueCollection aProperties
::comphelper::NamedValueCollection aFeatures
OUString sDriverTypeDisplayName