LibreOffice Module comphelper (master) 1
|
a collection of named values, packed in various formats. More...
#include <namedvaluecollection.hxx>
Public Member Functions | |
NamedValueCollection ()=default | |
NamedValueCollection (const NamedValueCollection &_rCopySource)=default | |
NamedValueCollection (NamedValueCollection &&_rCopySource) noexcept=default | |
NamedValueCollection & | operator= (const NamedValueCollection &i_rCopySource)=default |
NamedValueCollection & | operator= (NamedValueCollection &&i_rCopySource) noexcept=default |
NamedValueCollection (const css::uno::Any &_rElements) | |
constructs a collection More... | |
NamedValueCollection (const css::uno::Sequence< css::uno::Any > &_rArguments) | |
constructs a collection More... | |
NamedValueCollection (const css::uno::Sequence< css::beans::PropertyValue > &_rArguments) | |
constructs a collection More... | |
NamedValueCollection (const css::uno::Sequence< css::beans::NamedValue > &_rArguments) | |
constructs a collection More... | |
void | assign (const css::uno::Sequence< css::uno::Any > &_rArguments) |
void | clear () |
size_t | size () const |
returns the number of elements in the collection More... | |
bool | empty () const |
determines whether the collection is empty More... | |
::std::vector< OUString > | getNames () const |
returns the names of all elements in the collection More... | |
NamedValueCollection & | merge (const NamedValueCollection &_rAdditionalValues, bool _bOverwriteExisting) |
merges the content of another collection into this More... | |
template<typename VALUE_TYPE > | |
bool | get_ensureType (const OUString &_rValueName, VALUE_TYPE &_out_rValue) const |
retrieves a value with a given name from the collection, if it is present More... | |
template<typename VALUE_TYPE > | |
VALUE_TYPE | getOrDefault (const OUString &_rValueName, const VALUE_TYPE &_rDefault) const |
retrieves a value with a given name, or defaults it to a given value, if it's not present in the collection More... | |
const css::uno::Any & | get (const OUString &_rValueName) const |
retrieves a (untyped) value with a given name More... | |
bool | has (const OUString &_rValueName) const |
determines whether a value with a given name is present in the collection More... | |
template<typename VALUE_TYPE > | |
bool | put (const OUString &_rValueName, const VALUE_TYPE &_rValue) |
puts a value into the collection More... | |
bool | put (const OUString &_rValueName, const css::uno::Any &_rValue) |
bool | remove (const OUString &_rValueName) |
removes the value with the given name from the collection More... | |
sal_Int32 | operator>>= (css::uno::Sequence< css::beans::PropertyValue > &_out_rValues) const |
transforms the collection to a sequence of PropertyValues More... | |
sal_Int32 | operator>>= (css::uno::Sequence< css::beans::NamedValue > &_out_rValues) const |
transforms the collection to a sequence of NamedValues More... | |
css::uno::Sequence< css::beans::PropertyValue > | getPropertyValues () const |
transforms the collection into a sequence of PropertyValues More... | |
css::uno::Sequence< css::uno::Any > | getWrappedPropertyValues () const |
returns a Sequence< Any >, containing PropertyValues More... | |
css::uno::Sequence< css::uno::Any > | getWrappedNamedValues () const |
returns a Sequence< Any >, containing NamedValues More... | |
css::uno::Sequence< css::beans::NamedValue > | getNamedValues () const |
transforms the collection into a sequence of NamedValues More... | |
Static Public Member Functions | |
static bool | canExtractFrom (css::uno::Any const &i_value) |
determines whether or not named values can be extracted from the given value More... | |
template<typename VALUE_TYPE > | |
static VALUE_TYPE | getOrDefault (const css::uno::Sequence< css::beans::PropertyValue > &rPropSeq, std::u16string_view _rValueName, const VALUE_TYPE &_rDefault) |
Retrieves a value with a given name, or defaults it to a given value, if it's not present in the collection. More... | |
static const css::uno::Any & | get (const css::uno::Sequence< css::beans::PropertyValue > &rPropSeq, std::u16string_view _rValueName) |
retrieves a (untyped) value with a given name. More... | |
Private Member Functions | |
void | impl_assign (const css::uno::Any &i_rWrappedElements) |
void | impl_assign (const css::uno::Sequence< css::uno::Any > &_rArguments) |
void | impl_assign (const css::uno::Sequence< css::beans::PropertyValue > &_rArguments) |
void | impl_assign (const css::uno::Sequence< css::beans::NamedValue > &_rArguments) |
bool | get_ensureType (const OUString &_rValueName, void *_pValueLocation, const css::uno::Type &_rExpectedValueType) const |
const css::uno::Any & | impl_get (const OUString &_rValueName) const |
bool | impl_has (const OUString &_rValueName) const |
bool | impl_put (const OUString &_rValueName, const css::uno::Any &_rValue) |
bool | impl_remove (const OUString &_rValueName) |
template<class VALUE_TYPE > | |
css::uno::Sequence< css::uno::Any > | impl_wrap () const |
Static Private Member Functions | |
static bool | get_ensureType (const css::uno::Sequence< css::beans::PropertyValue > &rPropSeq, std::u16string_view _rValueName, void *_pValueLocation, const css::uno::Type &_rExpectedValueType) |
Private Attributes | |
std::unordered_map< OUString, css::uno::Any > | maValues |
a collection of named values, packed in various formats.
Definition at line 41 of file namedvaluecollection.hxx.
|
default |
|
default |
|
defaultnoexcept |
comphelper::NamedValueCollection::NamedValueCollection | ( | const css::uno::Any & | _rElements | ) |
constructs a collection
_rElements | the wrapped elements of the collection. The Any might contain a sequence of property values, a sequence of named values, or directly a property value or named value. All other cases are worth an assertion in non-product builds. |
comphelper::NamedValueCollection::NamedValueCollection | ( | const css::uno::Sequence< css::uno::Any > & | _rArguments | ) |
constructs a collection
_rArguments | a sequence of Any's containing either PropertyValue's or NamedValue's. |
comphelper::NamedValueCollection::NamedValueCollection | ( | const css::uno::Sequence< css::beans::PropertyValue > & | _rArguments | ) |
constructs a collection
_rArguments | a sequence of PropertyValues's |
comphelper::NamedValueCollection::NamedValueCollection | ( | const css::uno::Sequence< css::beans::NamedValue > & | _rArguments | ) |
constructs a collection
_rArguments | a sequence of NamedValue's |
|
inline |
Definition at line 79 of file namedvaluecollection.hxx.
|
static |
determines whether or not named values can be extracted from the given value
Any
contains a NamedValue
, a PropertyValue
, or a sequence thereof. Definition at line 71 of file namedvaluecollection.cxx.
References get().
|
inline |
Definition at line 84 of file namedvaluecollection.hxx.
bool comphelper::NamedValueCollection::empty | ( | ) | const |
determines whether the collection is empty
Definition at line 99 of file namedvaluecollection.cxx.
References maValues.
|
static |
retrieves a (untyped) value with a given name.
For when you only need a single value from a Sequence<PropertyValue>.
If the collection does not contain a value with the given name, an empty Any is returned.
Definition at line 235 of file namedvaluecollection.cxx.
References Any.
|
inline |
retrieves a (untyped) value with a given name
If the collection does not contain a value with the given name, an empty Any is returned.
Definition at line 178 of file namedvaluecollection.hxx.
Referenced by canExtractFrom().
|
staticprivate |
|
inline |
retrieves a value with a given name from the collection, if it is present
_pAsciiValueName | the ASCII name of the value to retrieve |
_out_rValue | is the output parameter taking the desired value upon successful return. If a value with the given name is not present in the collection, or if a wrong-typed value is present, then this parameter will not be touched. |
true | if there is a value with the given name, which could successfully be extracted. In this case, _out_rValue will contain the requested value. |
false,if | there is no value with the given name. |
IllegalArgumentException | in case there is a value with the given name, but it cannot legally assigned to _out_rValue. |
Definition at line 144 of file namedvaluecollection.hxx.
|
private |
|
inline |
transforms the collection into a sequence of NamedValues
Definition at line 264 of file namedvaluecollection.hxx.
std::vector< OUString > comphelper::NamedValueCollection::getNames | ( | ) | const |
returns the names of all elements in the collection
Definition at line 105 of file namedvaluecollection.cxx.
|
inlinestatic |
Retrieves a value with a given name, or defaults it to a given value, if it's not present in the collection.
For when you only need a single value from a Sequence<PropertyValue>.
Definition at line 165 of file namedvaluecollection.hxx.
|
inline |
retrieves a value with a given name, or defaults it to a given value, if it's not present in the collection
Definition at line 153 of file namedvaluecollection.hxx.
|
inline |
transforms the collection into a sequence of PropertyValues
Definition at line 238 of file namedvaluecollection.hxx.
|
inline |
returns a Sequence< Any >, containing NamedValues
Definition at line 256 of file namedvaluecollection.hxx.
|
inline |
returns a Sequence< Any >, containing PropertyValues
Definition at line 248 of file namedvaluecollection.hxx.
|
inline |
determines whether a value with a given name is present in the collection
Definition at line 191 of file namedvaluecollection.hxx.
|
private |
|
private |
|
private |
|
private |
|
private |
Definition at line 249 of file namedvaluecollection.cxx.
|
private |
Definition at line 260 of file namedvaluecollection.cxx.
Referenced by impl_put(), and merge().
|
private |
Definition at line 267 of file namedvaluecollection.cxx.
References impl_has(), and maValues.
Referenced by merge().
|
private |
Definition at line 275 of file namedvaluecollection.cxx.
|
inlineprivate |
Definition at line 300 of file namedvaluecollection.hxx.
References i.
NamedValueCollection & comphelper::NamedValueCollection::merge | ( | const NamedValueCollection & | _rAdditionalValues, |
bool | _bOverwriteExisting | ||
) |
merges the content of another collection into this
_rAdditionalValues | the collection whose values are to be merged |
_bOverwriteExisting | defines whether or not elements which are already present in this should be overwritten (true) or preserved (false). |
*this
Definition at line 81 of file namedvaluecollection.cxx.
References impl_has(), impl_put(), maValues, and value.
|
default |
|
defaultnoexcept |
sal_Int32 comphelper::NamedValueCollection::operator>>= | ( | css::uno::Sequence< css::beans::NamedValue > & | _out_rValues | ) | const |
transforms the collection to a sequence of NamedValues
sal_Int32 comphelper::NamedValueCollection::operator>>= | ( | css::uno::Sequence< css::beans::PropertyValue > & | _out_rValues | ) | const |
transforms the collection to a sequence of PropertyValues
|
inline |
Definition at line 207 of file namedvaluecollection.hxx.
|
inline |
puts a value into the collection
Definition at line 202 of file namedvaluecollection.hxx.
|
inline |
removes the value with the given name from the collection
Definition at line 216 of file namedvaluecollection.hxx.
size_t comphelper::NamedValueCollection::size | ( | ) | const |
returns the number of elements in the collection
Definition at line 93 of file namedvaluecollection.cxx.
References maValues.
|
private |
Definition at line 43 of file namedvaluecollection.hxx.
Referenced by empty(), getNames(), impl_get(), impl_has(), impl_put(), impl_remove(), merge(), and size().