#define DALI_TOOLKIT_INTERNAL_BUILDER_DICTIONARY_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
{
namespace Internal
{
-
/**
* The Dictionary template class enables a means of storing key-value
* pairs where the keys are strings and the value can be a complex
using DictionaryKeys = std::vector<std::string>;
-inline void Merge( DictionaryKeys& toDict, const DictionaryKeys& fromDict )
+inline void Merge(DictionaryKeys& toDict, const DictionaryKeys& fromDict)
{
for(const auto& element : fromDict)
{
}
}
-
template<typename EntryType>
class Dictionary
{
struct Element
{
std::string key;
- EntryType entry;
+ EntryType entry;
Element(std::string name, EntryType entry)
: key(std::move(name)),
entry(std::move(entry))
auto FindElement(std::string_view key)
{
- return std::find_if(container.begin(), container.end(), [key](auto& e){
- return bool(key == e.key);
- });
+ return std::find_if(container.begin(), container.end(), [key](auto& e) {
+ return bool(key == e.key);
+ });
}
public:
if(iter != End())
{
- container.erase( iter );
+ container.erase(iter);
}
}
}
- void Merge( const Dictionary<EntryType>& dictionary )
+ void Merge(const Dictionary<EntryType>& dictionary)
{
for(const auto& element : dictionary.container)
{
*/
const EntryType* FindConst(std::string_view key) const
{
- if( ! key.empty() )
+ if(!key.empty())
{
auto iter = FindElementCaseInsensitive(key);
*/
EntryType* Find(std::string_view key) const
{
- if( ! key.empty() )
+ if(!key.empty())
{
auto iter = FindElementCaseInsensitive(key);
return container.cend();
}
- void GetKeys( DictionaryKeys& keys ) const
+ void GetKeys(DictionaryKeys& keys) const
{
keys.clear();
for(const auto& element : container)
}
};
-
-
-}//Internal
-}//Toolkit
-}//Dali
+} // namespace Internal
+} // namespace Toolkit
+} // namespace Dali
#endif // DALI_TOOLKIT_INTERNAL_BUILDER_DICTIONARY_H