#ifndef DALI_SCENE_LOADER_GLTF2_ASSET_H_
#define DALI_SCENE_LOADER_GLTF2_ASSET_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.
*/
// INTERNAL INCLUDES
-#include "dali-scene-loader/public-api/index.h"
#include "dali-scene-loader/internal/json-reader.h"
+#include "dali-scene-loader/public-api/index.h"
// EXTERNAL INCLUDES
-#include "dali/public-api/math/vector4.h"
-#include "dali/public-api/math/quaternion.h"
-#include "dali/public-api/common/vector-wrapper.h"
-#include "dali/devel-api/common/map-wrapper.h"
#include <cstdint>
#include <memory>
+#include "dali/devel-api/common/map-wrapper.h"
+#include "dali/public-api/common/vector-wrapper.h"
+#include "dali/public-api/math/quaternion.h"
+#include "dali/public-api/math/vector4.h"
namespace gltf2
{
-
using Index = Dali::SceneLoader::Index;
-template <typename T>
+template<typename T>
class Ref
{
public:
Ref(std::vector<T>& v, Index i)
: mVector(&v),
mIndex(i)
- {}
+ {
+ }
/**
* @return The index of the object into the vector.
* @note It is client code responsibility to ensure that the vector is unambiguous. It should be in
* a glTF document, since there's one vector for each type.
*/
- Index GetIndex() const { return mIndex; }
+ Index GetIndex() const
+ {
+ return mIndex;
+ }
/**
* @brief There may be scenarios in which the object, whose vector we're populating, changes, e.g.
mVector = &v;
}
- operator bool() const { return mVector != nullptr; }
- T* operator->() const { return &(*mVector)[mIndex]; }
- T& operator*() const { return (*mVector)[mIndex]; }
+ operator bool() const
+ {
+ return mVector != nullptr;
+ }
+ T* operator->() const
+ {
+ return &(*mVector)[mIndex];
+ }
+ T& operator*() const
+ {
+ return (*mVector)[mIndex];
+ }
bool operator==(const Ref<T>& other) const
{
private:
std::vector<T>* mVector = nullptr;
- Index mIndex = Dali::SceneLoader::INVALID_INDEX;
+ Index mIndex = Dali::SceneLoader::INVALID_INDEX;
};
struct Asset
{
enum Type
{
- BYTE = 5120,
- UNSIGNED_BYTE = 5121,
- SHORT = 5122,
+ BYTE = 5120,
+ UNSIGNED_BYTE = 5121,
+ SHORT = 5122,
UNSIGNED_SHORT = 5123,
- UNSIGNED_INT = 5125,
- FLOAT = 5126,
- INVALID = -1
+ UNSIGNED_INT = 5125,
+ FLOAT = 5126,
+ INVALID = -1
};
- static bool IsUnsigned(Type t);
+ static bool IsUnsigned(Type t);
static uint32_t Size(Type t);
Component() = delete;
struct Buffer
{
- uint32_t mByteLength;
+ uint32_t mByteLength;
std::string_view mUri;
//TODO: extensions
//TODO: extras
enum Type
{
NONE,
- ARRAY_BUFFER = 34962,
+ ARRAY_BUFFER = 34962,
ELEMENT_ARRAY_BUFFER = 34963
};
};
Ref<Buffer> mBuffer;
- uint32_t mByteOffset = 0;
- uint32_t mByteLength;
- uint32_t mByteStride = 0; // if 0 after reading, it needs to be calculated
- uint32_t mTarget;
+ uint32_t mByteOffset = 0;
+ uint32_t mByteLength;
+ uint32_t mByteStride = 0; // if 0 after reading, it needs to be calculated
+ uint32_t mTarget;
//TODO: extensions
//TODO: extras
};
struct BufferViewClient
{
Ref<BufferView> mBufferView;
- uint32_t mByteOffset = 0;
+ uint32_t mByteOffset = 0;
};
struct ComponentTypedBufferViewClient : BufferViewClient
{
struct Sparse
{
- uint32_t mCount;
+ uint32_t mCount;
ComponentTypedBufferViewClient mIndices;
- BufferViewClient mValues;
+ BufferViewClient mValues;
//TODO: extensions
//TODO: extras
};
- uint32_t mCount;
- bool mNormalized = false;
- AccessorType::Type mType = AccessorType::INVALID;
- std::vector<float> mMin;
- std::vector<float> mMax;
+ uint32_t mCount;
+ bool mNormalized = false;
+ AccessorType::Type mType = AccessorType::INVALID;
+ std::vector<float> mMin;
+ std::vector<float> mMax;
std::unique_ptr<Sparse> mSparse;
//TODO: extensions
//TODO: extras
}
};
-struct Image: Named
+struct Image : Named
{
std::string_view mUri;
std::string_view mMimeType;
- Ref<BufferView> mBufferView;
+ Ref<BufferView> mBufferView;
//TODO: extensions
//TODO: extras
};
{
enum Type
{
- NEAREST = 9728,
- LINEAR = 9729,
+ NEAREST = 9728,
+ LINEAR = 9729,
NEAREST_MIPMAP_NEAREST = 9984,
- NEAREST_MIPMAP_LINEAR = 9985,
- LINEAR_MIPMAP_NEAREST = 9986,
- LINEAR_MIPMAP_LINEAR = 9987,
+ NEAREST_MIPMAP_LINEAR = 9985,
+ LINEAR_MIPMAP_NEAREST = 9986,
+ LINEAR_MIPMAP_LINEAR = 9987,
};
Filter() = delete;
{
enum Type
{
- REPEAT = 10497,
- CLAMP_TO_EDGE = 33071,
+ REPEAT = 10497,
+ CLAMP_TO_EDGE = 33071,
MIRRORED_REPEAT = 33648,
};
{
Filter::Type mMinFilter = Filter::LINEAR;
Filter::Type mMagFilter = Filter::LINEAR;
- Wrap::Type mWrapS = Wrap::CLAMP_TO_EDGE;
- Wrap::Type mWrapT = Wrap::CLAMP_TO_EDGE;
+ Wrap::Type mWrapS = Wrap::CLAMP_TO_EDGE;
+ Wrap::Type mWrapT = Wrap::CLAMP_TO_EDGE;
//TODO: extensions
//TODO: extras
};
struct Texture
{
- Ref<Image> mSource;
+ Ref<Image> mSource;
Ref<Sampler> mSampler;
};
struct TextureInfo
{
Ref<gltf2::Texture> mTexture;
- uint32_t mTexCoord = 0;
- float mScale = 1.f;
+ uint32_t mTexCoord = 0;
+ float mScale = 1.f;
operator bool() const
{
}
};
-struct Material: Named
+struct Material : Named
{
- struct Pbr//MetallicRoughness
+ struct Pbr //MetallicRoughness
{
Dali::Vector4 mBaseColorFactor = Dali::Vector4::ONE;
- TextureInfo mBaseColorTexture;
- float mMetallicFactor = 1.f;
- float mRoughnessFactor = 1.f;
- TextureInfo mMetallicRoughnessTexture;
+ TextureInfo mBaseColorTexture;
+ float mMetallicFactor = 1.f;
+ float mRoughnessFactor = 1.f;
+ TextureInfo mMetallicRoughnessTexture;
//TODO: extensions
//TODO: extras
};
- Pbr mPbrMetallicRoughness;
- TextureInfo mNormalTexture;
- TextureInfo mOcclusionTexture;
- TextureInfo mEmissiveTexture;
- Dali::Vector3 mEmissiveFactor;
- AlphaMode::Type mAlphaMode = AlphaMode::OPAQUE;
- float mAlphaCutoff = .5f;
- bool mDoubleSided = false;
+ Pbr mPbrMetallicRoughness;
+ TextureInfo mNormalTexture;
+ TextureInfo mOcclusionTexture;
+ TextureInfo mEmissiveTexture;
+ Dali::Vector3 mEmissiveFactor;
+ AlphaMode::Type mAlphaMode = AlphaMode::OPAQUE;
+ float mAlphaCutoff = .5f;
+ bool mDoubleSided = false;
//TODO: extensions
//TODO: extras
};
-struct Mesh: Named
+struct Mesh : Named
{
struct Primitive
{
INVALID
};
- std::map<Attribute::Type, Ref<Accessor>> mAttributes;
+ std::map<Attribute::Type, Ref<Accessor>> mAttributes;
std::vector<std::map<Attribute::Type, Ref<Accessor>>> mTargets;
- Ref<Accessor> mIndices;
- Ref<Material> mMaterial;
- Mode mMode = TRIANGLES;
+ Ref<Accessor> mIndices;
+ Ref<Material> mMaterial;
+ Mode mMode = TRIANGLES;
//TODO: [morph] targets
//TODO: extras
};
std::vector<Primitive> mPrimitives;
- std::vector<float> mWeights;
+ std::vector<float> mWeights;
//TODO: extras
//TODO: extensions
};
struct Skin : Named
{
- Ref<Accessor> mInverseBindMatrices;
- Ref<Node> mSkeleton;
+ Ref<Accessor> mInverseBindMatrices;
+ Ref<Node> mSkeleton;
std::vector<Ref<Node>> mJoints;
//TODO: extras
//TODO: extensions
};
-struct Camera: Named
+struct Camera : Named
{
struct Perspective
{
};
std::string_view mType;
- Perspective mPerspective;
- Orthographic mOrthographic;
+ Perspective mPerspective;
+ Orthographic mOrthographic;
//TODO: extras
//TODO: extensions
};
-struct Node: Named
+struct Node : Named
{
- Dali::Vector3 mTranslation = Dali::Vector3::ZERO;
- Dali::Quaternion mRotation = Dali::Quaternion::IDENTITY;
- Dali::Vector3 mScale = Dali::Vector3::ONE;
+ Dali::Vector3 mTranslation = Dali::Vector3::ZERO;
+ Dali::Quaternion mRotation = Dali::Quaternion::IDENTITY;
+ Dali::Vector3 mScale = Dali::Vector3::ONE;
- Ref<Camera> mCamera;
+ Ref<Camera> mCamera;
std::vector<Ref<Node>> mChildren;
- Ref<Mesh> mMesh;
+ Ref<Mesh> mMesh;
Ref<Skin> mSkin;
//TODO: [morph] weights
static Type FromString(const char* s, size_t len);
};
- Ref<Accessor> mInput;
- Ref<Accessor> mOutput;
+ Ref<Accessor> mInput;
+ Ref<Accessor> mOutput;
Interpolation::Type mInterpolation;
//TODO: extras
static Type FromString(const char* s, size_t len);
Ref<Node> mNode;
- Type mPath;
+ Type mPath;
};
Ref<Sampler> mSampler;
- Target mTarget;
+ Target mTarget;
//TODO: extras
//TODO: extensions
};
std::vector<Channel> mChannels;
};
-struct Scene: Named
+struct Scene : Named
{
std::vector<Ref<Node>> mNodes;
};
{
Asset mAsset;
- std::vector<Buffer> mBuffers;
+ std::vector<Buffer> mBuffers;
std::vector<BufferView> mBufferViews;
- std::vector<Accessor> mAccessors;
+ std::vector<Accessor> mAccessors;
- std::vector<Image> mImages;
- std::vector<Sampler> mSamplers;
- std::vector<Texture> mTextures;
+ std::vector<Image> mImages;
+ std::vector<Sampler> mSamplers;
+ std::vector<Texture> mTextures;
std::vector<Material> mMaterials;
std::vector<Mesh> mMeshes;
std::vector<Skin> mSkins;
std::vector<Camera> mCameras;
- std::vector<Node> mNodes;
+ std::vector<Node> mNodes;
std::vector<Animation> mAnimations;
std::vector<Scene> mScenes;
- Ref<Scene> mScene;
+ Ref<Scene> mScene;
- Document() = default;
+ Document() = default;
Document(const Document&) = delete;
- Document(Document&&) = default;
+ Document(Document&&) = default;
Document& operator=(const Document&) = delete;
Document& operator=(Document&&) = default;
* @brief Provides a json::Property<T>::ReadFn for interpreting unsigned integers
* as a Ref<U> into a std::vector<U> data member of a type T.
*/
-template <typename T>
+template<typename T>
struct RefReader
{
static T* sObject;
- template <typename U, std::vector<U> T::* V>
+ template<typename U, std::vector<U> T::*V>
static Ref<U> Read(const json_value_s& j)
{
uint32_t index = json::Read::Number<uint32_t>(j);
}
};
-template <typename T>
+template<typename T>
T* RefReader<T>::sObject = nullptr;
/**
* @brief Convenience method to set the object for RefReader.
*/
-template <typename T>
+template<typename T>
void SetRefReaderObject(T& object)
{
RefReader<T>::sObject = &object;
* @note The enum must: 1, be called Type, nested to T, 2, provide a FromString static method taking a const char*
* (string data) and a size_t (string length) and returning T::Type.
*/
-template <typename T> // T must have a nested enum called Type and a static Type FromString(const char*) method.
+template<typename T> // T must have a nested enum called Type and a static Type FromString(const char*) method.
typename T::Type ReadStringEnum(const json_value_s& j)
{
auto str = json::Read::StringView(j);
* @note T must provide an AsFloat() member method returning the non-const array of its
* float components.
*/
-template <typename T>
-inline
-T ReadDaliVector(const json_value_s& j)
+template<typename T>
+inline T ReadDaliVector(const json_value_s& j)
{
std::vector<float> floats = json::Read::Array<float, json::Read::Number<float>>(j);
- T result;
+ T result;
std::copy(floats.begin(), std::min(floats.end(), floats.begin() + sizeof(T) / sizeof(float)), result.AsFloat());
return result;
}
*/
Dali::Quaternion ReadQuaternion(const json_value_s& j);
-}
+} // namespace gltf2
#endif //DALI_SCENE_LOADER_GLTF2_ASSET_H_
#ifndef DALI_SCENE_LOADER_HASH_H_
#define DALI_SCENE_LOADER_HASH_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.
*
*/
-#include <string>
-#include <cstring>
#include <cstdint>
+#include <cstring>
+#include <string>
namespace Dali
{
namespace SceneLoader
{
-
/**
* @brief Rudimentary hash generator that follows a builder pattern.
*/
* @brief Applies the bytes of an object @a value, to the hash.
* @return Its updated self.
*/
- template <typename T>
+ template<typename T>
Hash& AddObjectBytes(const T& value);
operator uint64_t() const;
uint64_t Concatenate(uint64_t value);
};
-
template<typename T>
-Hash& Hash::AddObjectBytes(const T & value)
+Hash& Hash::AddObjectBytes(const T& value)
{
auto i0 = reinterpret_cast<const uint8_t*>(&value);
auto i1 = i0 + sizeof(T);
- while (i0 != i1)
+ while(i0 != i1)
{
mValue = Concatenate(*i0);
++i0;
return *this;
}
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif // DALI_SCENE_LOADER_HASH_H_
#ifndef DALI_SCENE_LOADER_JSON_READER_H_
#define DALI_SCENE_LOADER_JSON_READER_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.
#include "dali-scene-loader/third-party/json.h"
// EXTERNAL INCLUDES
-#include "dali/public-api/common/vector-wrapper.h"
#include <algorithm>
-#include <map>
-#include <string_view>
-#include <sstream>
#include <cstring>
+#include <map>
#include <memory>
+#include <sstream>
+#include <string_view>
+#include "dali/public-api/common/vector-wrapper.h"
namespace json
{
-
/**
* @brief Helper for freeing the memory allocated by json_parse()
*/
* @brief Convenience function to compare json_string_s and other supported string type,
* in swapped order.
*/
-template <typename String>
-inline
-int StrCmp(String& s, const json_string_s& js)
+template<typename String>
+inline int StrCmp(String& s, const json_string_s& js)
{
return -StrCmp(js, s);
}
/**
* @brief Compile-time type-enum mapping.
*/
-template <typename T>
+template<typename T>
struct Type2Enum
-{};
-
-#define TYPE2ENUM(x) template<> struct Type2Enum<json_## x ##_s>\
-{\
- enum { VALUE = json_type_## x };\
+{
};
+#define TYPE2ENUM(x) \
+ template<> \
+ struct Type2Enum<json_##x##_s> \
+ { \
+ enum \
+ { \
+ VALUE = json_type_##x \
+ }; \
+ };
+
TYPE2ENUM(object)
TYPE2ENUM(array)
TYPE2ENUM(string)
TYPE2ENUM(number)
#undef TYPE2ENUM
-}
+} // namespace detail
/**
* @brief Casts the payload of a json_value_s to the given type.
*/
-template <typename Out>
-inline
-const Out& Cast(const json_value_s& j)
+template<typename Out>
+inline const Out& Cast(const json_value_s& j)
{
Validate(j, static_cast<json_type_e>(detail::Type2Enum<typename std::decay<Out>::type>::VALUE));
return *static_cast<const Out*>(j.payload);
* @brief Casts the payload of a json_value_s to the given type.
* @note std::runtime_error is thrown if the value is not the given type.
*/
-template <typename Out>
-inline
-Out& Cast(json_value_s& j)
+template<typename Out>
+inline Out& Cast(json_value_s& j)
{
Validate(j, static_cast<json_type_e>(detail::Type2Enum<typename std::decay<Out>::type>::VALUE));
return *static_cast<Out*>(j.payload);
{
static bool Boolean(const json_value_s& j)
{
- if (j.type == json_type_true)
+ if(j.type == json_type_true)
{
return true;
}
- else if (j.type == json_type_false)
+ else if(j.type == json_type_false)
{
return false;
}
}
}
- template <typename T>
+ template<typename T>
static T Number(const json_value_s& j)
{
- auto& jn = Cast<const json_number_s>(j);
+ auto& jn = Cast<const json_number_s>(j);
std::stringstream ss;
- for (auto i0 = jn.number, i1 = i0 + jn.number_size; i0 != i1; ++i0)
+ for(auto i0 = jn.number, i1 = i0 + jn.number_size; i0 != i1; ++i0)
{
ss.put(*i0);
}
T result;
- if (ss >> result)
+ if(ss >> result)
{
return result;
}
throw std::runtime_error("Failed to convert value to number");
}
- template <typename E>
+ template<typename E>
static E Enum(const json_value_s& j)
{
size_t number = Number<size_t>(j);
return std::string(js.string, js.string_size);
}
- template <typename T, T(*readElement)(const json_value_s&)>
+ template<typename T, T (*readElement)(const json_value_s&)>
static std::vector<T> Array(const json_value_s& j)
{
- auto& ja = Cast<const json_array_s>(j);
+ auto& ja = Cast<const json_array_s>(j);
std::vector<T> result;
result.reserve(ja.length);
auto i = ja.start;
- while (i)
+ while(i)
{
result.push_back(std::move(readElement(*i->value)));
i = i->next;
protected:
explicit PropertyCore(const std::string& key)
: mKey(key)
- {}
+ {
+ }
- const std::string& GetKey() const { return mKey; }
+ const std::string& GetKey() const
+ {
+ return mKey;
+ }
private:
std::string mKey;
/**
* @brief Base class for the properties of a type T.
*/
-template <typename T>
+template<typename T>
struct PropertyBase : PropertyCore
{
using PropertyCore::GetKey;
explicit PropertyBase(const std::string& key)
: PropertyCore(key)
- {}
+ {
+ }
virtual ~PropertyBase()
- {}
+ {
+ }
virtual void Read(const json_value_s& j, T& obj) = 0;
};
/**
* @brief Concrete property of an object to read into from JSON with a given function.
*/
-template <class T, typename U>
+template<class T, typename U>
struct Property : PropertyBase<T>
{
- using ReadFn = U(*)(const json_value_s&);
- using MemberPtr = U T::*;
+ using ReadFn = U (*)(const json_value_s&);
+ using MemberPtr = U T::*;
using SetterArgType = typename std::conditional<sizeof(U) <= sizeof(uintptr_t), U, const U&>::type;
- using Setter = void (T::*)(SetterArgType);
+ using Setter = void (T::*)(SetterArgType);
Property(const std::string& key, ReadFn read, MemberPtr ptr)
: PropertyBase<T>(key),
mRead(read),
mAccessor(new DirectAccessor(ptr))
- {}
+ {
+ }
Property(const std::string& key, ReadFn read, Setter setter)
: PropertyBase<T>(key),
mRead(read),
mAccessor(new SetterAccessor(setter))
- {}
+ {
+ }
~Property()
- {}
+ {
+ }
void Read(const json_value_s& j, T& obj) override
{
struct AccessorBase
{
virtual ~AccessorBase()
- {}
+ {
+ }
virtual void Set(U value, T& obj) const = 0;
};
{
DirectAccessor(MemberPtr ptr)
: mPointer(ptr)
- {}
+ {
+ }
void Set(U value, T& obj) const override
{
{
SetterAccessor(Setter setter)
: mSetter(setter)
- {}
+ {
+ }
void Set(U value, T& obj) const override
{
Setter mSetter;
};
- ReadFn mRead;
+ ReadFn mRead;
std::unique_ptr<AccessorBase> mAccessor;
};
/**
* @brief Helper function to make a Property for a member of type U, of object of type T.
*/
-template <class T, typename U>
-Property<T, U>* MakeProperty(const std::string& key, typename Property<T, U>::ReadFn readFn,
- U T::* ptr)
+template<class T, typename U>
+Property<T, U>* MakeProperty(const std::string& key, typename Property<T, U>::ReadFn readFn, U T::*ptr)
{
return new Property<T, U>(key, readFn, ptr);
}
* @brief Object Reader template for reading into an object of a given type,
* with properties registered for the various members.
*/
-template <typename T>
+template<typename T>
class Reader : protected ReaderCore
{
public:
~Reader()
{
- for (auto& p : mProperties)
+ for(auto& p : mProperties)
{
delete Cast(p);
}
Reader<T>& Register(PropertyBase<T>& prop)
{
- auto iInsert = std::lower_bound(mProperties.begin(), mProperties.end(), &prop,
- SortPredicate);
- if (iInsert == mProperties.end() || Cast(*iInsert)->GetKey() != prop.GetKey())
+ auto iInsert = std::lower_bound(mProperties.begin(), mProperties.end(), &prop, SortPredicate);
+ if(iInsert == mProperties.end() || Cast(*iInsert)->GetKey() != prop.GetKey())
{
mProperties.insert(iInsert, &prop);
}
void Read(const json_object_s& jo, T& obj) const
{
auto i = jo.start;
- while (i)
+ while(i)
{
- auto iFind = std::lower_bound(mProperties.begin(), mProperties.end(),
- *i->name, FindPredicate);
- if (iFind != mProperties.end())
+ auto iFind = std::lower_bound(mProperties.begin(), mProperties.end(), *i->name, FindPredicate);
+ if(iFind != mProperties.end())
{
auto prop = Cast(*iFind);
- if (0 == StrCmp(*i->name, prop->GetKey()))
+ if(0 == StrCmp(*i->name, prop->GetKey()))
{
prop->Read(*i->value, obj);
}
* @brief Wraps a Reader<T> in a function usable as a Property<T>::ReadFn, i.e. to facilitate
* deserializing structures of nested objects.
*/
-template <typename T>
+template<typename T>
struct ObjectReader
{
static const Reader<T>* sReader;
static T Read(const json_value_s& j)
{
- T result;
+ T result;
auto& jo = Cast<json_object_s>(j);
sReader->Read(jo, result);
return result;
}
};
-template <typename T>
+template<typename T>
const Reader<T>* ObjectReader<T>::sReader = nullptr;
-template <typename T>
+template<typename T>
void SetObjectReader(const Reader<T>& r)
{
ObjectReader<T>::sReader = &r;
}
-} // json
+} // namespace json
#endif //DALI_SCENE_LOADER_JSON_READER_H_
#ifndef DALI_SCENE_LOADER_JSON_UTIL_H_
#define DALI_SCENE_LOADER_JSON_UTIL_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.
#include "dali-scene-loader/public-api/index.h"
// EXTERNAL INCLUDES
-#include "dali/public-api/common/vector-wrapper.h"
+#include "dali-toolkit/devel-api/builder/tree-node.h"
#include "dali/public-api/animation/time-period.h"
-#include "dali/public-api/object/property.h"
+#include "dali/public-api/common/vector-wrapper.h"
#include "dali/public-api/math/vector4.h"
-#include "dali-toolkit/devel-api/builder/tree-node.h"
+#include "dali/public-api/object/property.h"
namespace Dali
{
namespace SceneLoader
{
-
bool ReadBool(const Toolkit::TreeNode* node, bool& num);
bool ReadInt(const Toolkit::TreeNode* node, int& num);
*/
Property::Value ReadPropertyValue(const Toolkit::TreeNode& tn);
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif //DALI_SCENE_LOADER_JSON_UTIL_H_
#ifndef DALI_SCENE_LOADER_ALPHA_FUNCTION_HELPER_H_
#define DALI_SCENE_LOADER_ALPHA_FUNCTION_HELPER_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.
#include "dali-scene-loader/public-api/api.h"
-#include "dali/public-api/animation/alpha-function.h"
#include <string>
+#include "dali/public-api/animation/alpha-function.h"
namespace Dali
{
namespace SceneLoader
{
-
/**
* @return Given a name, provide a AlphaFunction; if the name was not
* recognised, get the default one.
*/
void DALI_SCENE_LOADER_API RegisterAlphaFunction(const std::string& name, AlphaFunction alphaFn) noexcept(false);
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif //DALI_SCENE_LOADER_ALPHA_FUNCTION_HELPER_H_
#ifndef DALI_SCENE_LOADER_ANIMATED_PROPERTY_H
#define DALI_SCENE_LOADER_ANIMATED_PROPERTY_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.
#include "dali-scene-loader/public-api/api.h"
// EXTERNAL INCLUDES
+#include <functional>
+#include <memory>
#include "dali/public-api/actors/actor.h"
#include "dali/public-api/animation/animation.h"
#include "dali/public-api/object/property.h"
-#include <memory>
-#include <functional>
namespace Dali
{
namespace SceneLoader
{
-
/**
* @brief Intermediate representation for a property that's given to
* a Animation to animate. Since there is no getting an
struct Value
{
Property::Value mValue;
- bool mIsRelative;
+ bool mIsRelative;
};
std::string mNodeName;
std::string mPropertyName;
- KeyFrames mKeyFrames;
+ KeyFrames mKeyFrames;
std::unique_ptr<Value> mValue;
AlphaFunction mAlphaFunction = AlphaFunction::DEFAULT;
- TimePeriod mTimePeriod = TimePeriod(0.f);
+ TimePeriod mTimePeriod = TimePeriod(0.f);
};
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif //DALI_SCENE_LOADER_ANIMATED_PROPERTY_H
#ifndef DALI_SCENE_LOADER_ANIMATION_DEFINITION_H
#define DALI_SCENE_LOADER_ANIMATION_DEFINITION_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.
*
*/
-#include "dali-scene-loader/public-api/api.h"
#include "dali-scene-loader/public-api/animated-property.h"
+#include "dali-scene-loader/public-api/api.h"
#include "dali/public-api/common/vector-wrapper.h"
namespace Dali
{
namespace SceneLoader
{
-
/**
* @brief Animation handle + name + definition of properties.
*/
public: // DATA
std::string mName;
- float mDuration = DEFAULT_DURATION_SECONDS;
- int mLoopCount = 1;
+ float mDuration = DEFAULT_DURATION_SECONDS;
+ int mLoopCount = 1;
Animation::EndAction mDisconnectAction = Animation::BAKE_FINAL;
- Animation::EndAction mEndAction = Animation::BAKE;
- float mSpeedFactor = 1.f;
- Vector2 mPlayRange = Vector2{ 0.f, 1.f };
+ Animation::EndAction mEndAction = Animation::BAKE;
+ float mSpeedFactor = 1.f;
+ Vector2 mPlayRange = Vector2{0.f, 1.f};
std::vector<AnimatedProperty> mProperties;
};
struct AnimationGroupDefinition
{
- std::string mName;
+ std::string mName;
std::vector<std::string> mAnimations;
};
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif //DALI_SCENE_LOADER_ANIMATION_DEFINITION_H
#ifndef DALI_SCENE_LOADER_API_H
#define DALI_SCENE_LOADER_API_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.
#elif defined(WIN32)
#ifdef BUILDING_DALI_SCENE_LOADER
-#define DALI_SCENE_LOADER_API __declspec(dllexport)
+#define DALI_SCENE_LOADER_API __declspec(dllexport)
#else
-#define DALI_SCENE_LOADER_API __declspec(dllimport)
-#endif // BUILDING_DALI_SCENE_LOADER
+#define DALI_SCENE_LOADER_API __declspec(dllimport)
+#endif // BUILDING_DALI_SCENE_LOADER
#endif
#ifndef DALI_SCENE_LOADER_BLEND_SHAPE_DETAILS_H
#define DALI_SCENE_LOADER_BLEND_SHAPE_DETAILS_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.
#include "dali-scene-loader/public-api/api.h"
// EXTERNAL INCLUDES
-#include "dali/public-api/rendering/shader.h"
-#include "dali/public-api/actors/actor.h"
#include <string>
+#include "dali/public-api/actors/actor.h"
+#include "dali/public-api/rendering/shader.h"
namespace Dali
{
namespace SceneLoader
{
-
struct MeshDefinition;
struct MeshGeometry;
enum
{
POSITIONS = 0x1,
- NORMALS = 0x2,
- TANGENTS = 0x4
+ NORMALS = 0x2,
+ TANGENTS = 0x4
};
};
// shader properties - animatable (uniforms)
- static const std::string NUMBER_OF_BLEND_SHAPES; ///< Integer number of blend shapes loaded.
- static const std::string UNNORMALIZE_FACTOR; ///< Scalar(s) for position components of blend shapes; Version 1.0: float array (1 per blend shape); Version 2.0: single float.
- static const std::string COMPONENT_SIZE; ///< Integer offset from one component (positions / normals / tangents) of a blend shape to the next.
+ static const std::string NUMBER_OF_BLEND_SHAPES; ///< Integer number of blend shapes loaded.
+ static const std::string UNNORMALIZE_FACTOR; ///< Scalar(s) for position components of blend shapes; Version 1.0: float array (1 per blend shape); Version 2.0: single float.
+ static const std::string COMPONENT_SIZE; ///< Integer offset from one component (positions / normals / tangents) of a blend shape to the next.
// shader properties - read-only (not available as uniforms)
- static const std::string COMPONENTS; ///< Integer bitmask of the blend shape components that the shader uses; refer to the Components enum.
+ static const std::string COMPONENTS; ///< Integer bitmask of the blend shape components that the shader uses; refer to the Components enum.
// actor property (instance) - animatable (uniforms)
- static const std::string WEIGHTS_UNIFORM; ///< The weight of each blend shape in a float array
+ static const std::string WEIGHTS_UNIFORM; ///< The weight of each blend shape in a float array
/**
* @brief Registers properties based on the mesh definition (and geometry) and identified by the above string constants,
BlendShapes() = delete;
};
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif // DALI_SCENE_LOADER_BLEND_SHAPE_DETAILS_H
#ifndef DALI_SCENE_LOADER_CAMERA_PARAMETERS_H
#define DALI_SCENE_LOADER_CAMERA_PARAMETERS_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.
*
*/
- // INTERNAL INCLUDES
+// INTERNAL INCLUDES
#include "dali-scene-loader/public-api/api.h"
#include "dali-scene-loader/public-api/view-projection.h"
namespace Dali
{
-
class CameraActor;
namespace SceneLoader
{
-
struct DALI_SCENE_LOADER_API CameraParameters
{
- Matrix matrix = Matrix::IDENTITY;
- Vector4 orthographicSize = Vector4{ -1.f, 1.f, 1.f, -1.f };
- float yFov = 60.f;
- float zNear = 0.1f;
- float zFar = 1000.f;
- bool isPerspective = true;
+ Matrix matrix = Matrix::IDENTITY;
+ Vector4 orthographicSize = Vector4{-1.f, 1.f, 1.f, -1.f};
+ float yFov = 60.f;
+ float zNear = 0.1f;
+ float zFar = 1000.f;
+ bool isPerspective = true;
/**
* @return The view-projection matrix of the camera.
void ConfigureCamera(CameraActor& camera) const;
};
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif // DALI_SCENE_LOADER_CAMERA_PARAMETERS_H
#ifndef DALI_SCENE_LOADER_CUSTOMIZATION_STATE_H_
#define DALI_SCENE_LOADER_CUSTOMIZATION_STATE_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.
*
*/
- // INTERNAL INCLUDES
+// INTERNAL INCLUDES
#include "dali-scene-loader/public-api/api.h"
// EXTERNAL INCLUDES
-#include "dali/public-api/common/vector-wrapper.h"
-#include <string>
#include <memory>
+#include <string>
+#include "dali/public-api/common/vector-wrapper.h"
namespace Dali
{
namespace SceneLoader
{
-
/**
* @brief Offers a description of an aspect of the scene that can be customized:
* the number of options, and the name of the nodes that are registered
*/
struct DALI_SCENE_LOADER_API Customization
{
- using Tag = std::string;
+ using Tag = std::string;
using OptionType = uint32_t;
/**
static const OptionType NONE = OptionType(-1);
- OptionType numOptions = 0;
- std::vector<std::string> nodes; // to apply option to.
+ OptionType numOptions = 0;
+ std::vector<std::string> nodes; // to apply option to.
};
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif //DALI_SCENE_LOADER_CUSTOMIZATION_STATE_H_
#ifndef DALI_SCENE_LOADER_DLI_LOADER_H
#define DALI_SCENE_LOADER_DLI_LOADER_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.
*
*/
- // INTERNAL INCLUDES
-#include "dali-scene-loader/public-api/api.h"
+// INTERNAL INCLUDES
#include "dali-scene-loader/public-api/animation-definition.h"
+#include "dali-scene-loader/public-api/api.h"
#include "dali-scene-loader/public-api/customization.h"
-#include "dali-scene-loader/public-api/string-callback.h"
#include "dali-scene-loader/public-api/index.h"
+#include "dali-scene-loader/public-api/string-callback.h"
// EXTERNAL INCLUDES
#include "dali/public-api/common/vector-wrapper.h"
class DALI_SCENE_LOADER_API DliLoader
{
public:
- using ConvertFontCode = void(*)(const std::string& code, std::string& fontFamily, std::string& slant, std::string& weight, float& size);
- using ConvertColorCode = Vector4(*)(const std::string& code);
+ using ConvertFontCode = void (*)(const std::string& code, std::string& fontFamily, std::string& slant, std::string& weight, float& size);
+ using ConvertColorCode = Vector4 (*)(const std::string& code);
- using CategoryProcessor = std::function<void(Property::Array&& categoryData, StringCallback onError)>;
+ using CategoryProcessor = std::function<void(Property::Array&& categoryData, StringCallback onError)>;
using CategoryProcessorVector = std::vector<std::pair<std::string /*name*/, CategoryProcessor>>;
using NodeProcessor = std::function<void(const NodeDefinition& nodeDef,
- Property::Map&& nodeData, StringCallback onError)>;
+ Property::Map&& nodeData,
+ StringCallback onError)>;
using AnimationProcessor = std::function<void(const AnimationDefinition& animDef,
- Property::Map&& animData, StringCallback onError)>;
+ Property::Map&& animData,
+ StringCallback onError)>;
struct InputParams
{
struct LoadParams
{
InputParams const& input;
- LoadResult& output;
+ LoadResult& output;
};
DliLoader();
const std::unique_ptr<Impl> mImpl;
};
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif // DALI_SCENE_LOADER_DLI_LOADER_H
#ifndef DALI_SCENE_LOADER_ENVIRONMENT_DEFINITION_H
#define DALI_SCENE_LOADER_ENVIRONMENT_DEFINITION_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.
*
*/
- // INTERNAL INCLUDES
+// INTERNAL INCLUDES
#include "dali-scene-loader/public-api/api.h"
#include "dali-scene-loader/public-api/ktx-loader.h"
// EXTERNAL INCLUDES
-#include "dali/public-api/rendering/texture.h"
#include "dali/public-api/math/quaternion.h"
+#include "dali/public-api/rendering/texture.h"
namespace Dali
{
namespace SceneLoader
{
-
/**
* @brief Defines an environment map with either or both of radiance
* and irradiance maps.
struct Textures
{
Texture mDiffuse; // irradiance
- Texture mSpecular; // radiance
+ Texture mSpecular; // radiance
bool IsLoaded() const
{
};
using EnvironmentData = std::pair<EnvironmentDefinition, Textures>;
- using Vector = std::vector<EnvironmentData>;
+ using Vector = std::vector<EnvironmentData>;
EnvironmentDefinition() = default;
public: // DATA
std::string mDiffuseMapPath;
std::string mSpecularMapPath;
- Quaternion mCubeOrientation = Quaternion::IDENTITY;
- float mIblIntensity = 1.0f;
+ Quaternion mCubeOrientation = Quaternion::IDENTITY;
+ float mIblIntensity = 1.0f;
};
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif //DALI_SCENE_LOADER_ENVIRONMENT_DEFINITION_H
#ifndef DALI_SCENE_LOADER_GLTF2_LOADER_H
#define DALI_SCENE_LOADER_GLTF2_LOADER_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.
*
*/
- // INTERNAL INCLUDES
+// INTERNAL INCLUDES
#include "dali-scene-loader/public-api/api.h"
// EXTERNAL INCLUDES
*/
DALI_SCENE_LOADER_API void LoadGltfScene(const std::string& url, ShaderDefinitionFactory& shaderFactory, LoadResult& params);
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif //DALI_SCENE_LOADER_GLTF2_LOADER_H
#ifndef DALI_SCENE_LOADER_INDEX_H_
#define DALI_SCENE_LOADER_INDEX_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 SceneLoader
{
-
using Index = uint32_t;
constexpr Index INVALID_INDEX = static_cast<Index>(-1);
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif //DALI_SCENE_LOADER_INDEX_H_
#ifndef DALI_SCENE_LOADER_KTX_LOADER_H
#define DALI_SCENE_LOADER_KTX_LOADER_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 SceneLoader
{
-
/**
* @brief Stores the pixel data objects for each face of the cube texture and their mipmaps.
*/
struct DALI_SCENE_LOADER_API CubeData
{
- std::vector< std::vector<PixelData> > data;
+ std::vector<std::vector<PixelData> > data;
Texture CreateTexture() const;
};
*/
DALI_SCENE_LOADER_API bool LoadCubeMapData(const std::string& path, CubeData& cubedata);
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif // DALI_SCENE_LOADER_KTX_LOADER_H
#ifndef DALI_SCENE_LOADER_LIGHT_PARAMETERS_H
#define DALI_SCENE_LOADER_LIGHT_PARAMETERS_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.
#include "dali-scene-loader/public-api/api.h"
// EXTERNAL INCLUDES
+#include <stdint.h>
#include "dali/public-api/math/matrix.h"
#include "dali/public-api/math/vector3.h"
-#include <stdint.h>
namespace Dali
{
namespace SceneLoader
{
-
struct DALI_SCENE_LOADER_API LightParameters
{
Matrix transform;
- Vector3 color;
- float intensity;
- float shadowIntensity;
+ Vector3 color;
+ float intensity;
+ float shadowIntensity;
uint32_t shadowMapSize;
- float orthographicSize;
+ float orthographicSize;
};
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif // DALI_SCENE_LOADER_LIGHT_PARAMETERS_H
#ifndef DALI_SCENE_LOADER_OUTPUT_H
#define DALI_SCENE_LOADER_OUTPUT_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.
*/
// INTERNAL INCLUDES
-#include "dali-scene-loader/public-api/api.h"
#include "dali-scene-loader/public-api/animation-definition.h"
-#include "dali-scene-loader/public-api/light-parameters.h"
+#include "dali-scene-loader/public-api/api.h"
#include "dali-scene-loader/public-api/camera-parameters.h"
+#include "dali-scene-loader/public-api/light-parameters.h"
namespace Dali
{
namespace SceneLoader
{
-
class ResourceBundle;
class SceneDefinition;
std::vector<LightParameters>& mLightParameters;
};
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif //DALI_SCENE_LOADER_OUTPUT_H
#ifndef DALI_SCENE_LOADER_MATERIAL_DEFINITION_H
#define DALI_SCENE_LOADER_MATERIAL_DEFINITION_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.
#include "dali-scene-loader/public-api/utils.h"
// EXTERNAL INCLUDES
-#include "dali/public-api/math/vector4.h"
-#include "dali/public-api/common/vector-wrapper.h"
#include <cmath>
+#include "dali/public-api/common/vector-wrapper.h"
+#include "dali/public-api/math/vector4.h"
namespace Dali
{
namespace SceneLoader
{
-
/**
* @brief Helper enum for encoding and decoding sampler states.
*/
enum Values : Type
{
// Filter - 3 bits
- FILTER_NEAREST = 0,
- FILTER_LINEAR = NthBit(0),
+ FILTER_NEAREST = 0,
+ FILTER_LINEAR = NthBit(0),
FILTER_MIPMAP_NEAREST = NthBit(1),
- FILTER_MIPMAP_LINEAR = NthBit(2),
+ FILTER_MIPMAP_LINEAR = NthBit(2),
// Wrap - 2 bits
WRAP_REPEAT = 0,
- WRAP_CLAMP = NthBit(0),
+ WRAP_CLAMP = NthBit(0),
WRAP_MIRROR = NthBit(1),
// Layout - apply shift, then mask
FILTER_MIN_BITS = 3,
FILTER_MIN_MASK = NthBit(FILTER_MIN_BITS) - 1,
- FILTER_MAG_BITS = 1,
+ FILTER_MAG_BITS = 1,
FILTER_MAG_SHIFT = FILTER_MIN_BITS,
- FILTER_MAG_MASK = NthBit(FILTER_MAG_BITS) - 1,
+ FILTER_MAG_MASK = NthBit(FILTER_MAG_BITS) - 1,
- WRAP_S_BITS = 2,
+ WRAP_S_BITS = 2,
WRAP_S_SHIFT = FILTER_MAG_SHIFT + FILTER_MAG_BITS,
- WRAP_S_MASK = NthBit(WRAP_S_BITS) - 1,
+ WRAP_S_MASK = NthBit(WRAP_S_BITS) - 1,
- WRAP_T_BITS = 2,
+ WRAP_T_BITS = 2,
WRAP_T_SHIFT = WRAP_S_SHIFT + WRAP_S_BITS,
- WRAP_T_MASK = NthBit(WRAP_T_BITS) - 1,
+ WRAP_T_MASK = NthBit(WRAP_T_BITS) - 1,
// Diagnostics
MIPMAP_MASK = FILTER_MIPMAP_LINEAR | FILTER_MIPMAP_NEAREST,
// Default
- DEFAULT = FILTER_LINEAR | (FILTER_LINEAR << FILTER_MAG_SHIFT) | (WRAP_REPEAT << WRAP_S_SHIFT) | (WRAP_REPEAT << WRAP_T_SHIFT), // LINEAR filters, REPEAT wraps
+ DEFAULT = FILTER_LINEAR | (FILTER_LINEAR << FILTER_MAG_SHIFT) | (WRAP_REPEAT << WRAP_S_SHIFT) | (WRAP_REPEAT << WRAP_T_SHIFT), // LINEAR filters, REPEAT wraps
};
/**
* @return SamplerFlags bit pattern calculated from the given Dali Sampler settings.
*/
- static Type Encode(FilterMode::Type minFilter, FilterMode::Type magFilter,
- WrapMode::Type wrapS, WrapMode::Type wrapT);
+ static Type Encode(FilterMode::Type minFilter, FilterMode::Type magFilter, WrapMode::Type wrapS, WrapMode::Type wrapT);
/**
* @brief Decodes the minification filter patter of @a flags into the corresponding FilterMode.
*/
- static FilterMode::Type GetMinFilter(Type flags);
+ static FilterMode::Type GetMinFilter(Type flags);
/**
* @brief Decodes the magnification filter patter of @a flags into the corresponding FilterMode.
*/
- static FilterMode::Type GetMagFilter(Type flags);
+ static FilterMode::Type GetMagFilter(Type flags);
/**
* @brief Decodes the horizontal wrap pattern of @a flags into the corresponding WrapMode.
*/
struct DALI_SCENE_LOADER_API TextureDefinition
{
- std::string mImageUri;
+ std::string mImageUri;
SamplerFlags::Type mSamplerFlags;
TextureDefinition(const std::string& imageUri = "", SamplerFlags::Type samplerFlags = SamplerFlags::DEFAULT);
enum Flags : uint32_t
{
// Texture semantics
- ALBEDO = NthBit(0),
- METALLIC = NthBit(1),
- ROUGHNESS = NthBit(2),
- NORMAL = NthBit(3),
- EMISSIVE = NthBit(4), // TODO: support
- OCCLUSION = NthBit(5), // TODO: support
- SUBSURFACE = NthBit(6), // Note: dli-only
+ ALBEDO = NthBit(0),
+ METALLIC = NthBit(1),
+ ROUGHNESS = NthBit(2),
+ NORMAL = NthBit(3),
+ EMISSIVE = NthBit(4), // TODO: support
+ OCCLUSION = NthBit(5), // TODO: support
+ SUBSURFACE = NthBit(6), // Note: dli-only
// Other binary options
- TRANSPARENCY = NthBit(20),
- GLTF_CHANNELS = NthBit(21), // https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#pbrmetallicroughnessmetallicroughnesstexture
+ TRANSPARENCY = NthBit(20),
+ GLTF_CHANNELS = NthBit(21), // https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#pbrmetallicroughnessmetallicroughnesstexture
// Alpha cutoff - reserved from the 24th bit
- ALPHA_CUTOFF_BITS = 8,
+ ALPHA_CUTOFF_BITS = 8,
ALPHA_CUTOFF_SHIFT = sizeof(uint32_t) * 8 - ALPHA_CUTOFF_BITS,
- ALPHA_CUTOFF_MASK = (1 << ALPHA_CUTOFF_BITS) - 1,
+ ALPHA_CUTOFF_MASK = (1 << ALPHA_CUTOFF_BITS) - 1,
};
/**
*/
struct TextureStage
{
- uint32_t mSemantic;
+ uint32_t mSemantic;
TextureDefinition mTexture;
};
{
struct TextureData
{
- PixelData mPixels;
+ PixelData mPixels;
SamplerFlags::Type mSamplerFlags;
};
public: // DATA
uint32_t mFlags = 0x0;
- Index mEnvironmentIdx = 0;
- Vector4 mColor = Color::WHITE;
- float mMetallic = 1.f;
- float mRoughness = 1.f;
+ Index mEnvironmentIdx = 0;
+ Vector4 mColor = Color::WHITE;
+ float mMetallic = 1.f;
+ float mRoughness = 1.f;
std::vector<TextureStage> mTextureStages;
};
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif //DALI_SCENE_LOADER_MATERIAL_DEFINITION_H
#ifndef DALI_SCENE_LOADER_MATRIX_STACK_H_
#define DALI_SCENE_LOADER_MATRIX_STACK_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.
#include "dali-scene-loader/public-api/api.h"
// EXTERNAL INCLUDES
-#include "dali/public-api/math/matrix.h"
#include "dali/public-api/common/vector-wrapper.h"
+#include "dali/public-api/math/matrix.h"
namespace Dali
{
namespace SceneLoader
{
-
/**
* @brief A stack of matrices whereby each newly pushed matrix is stored
* after being multiplied by the previous one (if any).
public:
MatrixStack();
- bool IsEmpty() const;
- void Push(const Matrix& model);
+ bool IsEmpty() const;
+ void Push(const Matrix& model);
const Matrix& Top() const;
- void Pop();
- void PopAll(); // clears the stack, but retains the storage.
+ void Pop();
+ void PopAll(); // clears the stack, but retains the storage.
private:
std::vector<Matrix> mStack;
};
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif //DALI_SCENE_LOADER_MATRIX_STACK_H_
#ifndef DALI_SCENE_LOADER_MESH_DEFINITION_H
#define DALI_SCENE_LOADER_MESH_DEFINITION_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.
// INTERNAL INCLUDES
#include "dali-scene-loader/public-api/api.h"
-#include "dali-scene-loader/public-api/mesh-geometry.h"
#include "dali-scene-loader/public-api/blend-shape-details.h"
-#include "dali-scene-loader/public-api/utils.h"
#include "dali-scene-loader/public-api/index.h"
+#include "dali-scene-loader/public-api/mesh-geometry.h"
+#include "dali-scene-loader/public-api/utils.h"
// EXTERNAL INCLUDES
-#include "dali/public-api/common/vector-wrapper.h"
#include <memory>
+#include "dali/public-api/common/vector-wrapper.h"
namespace Dali
{
namespace SceneLoader
{
-
/**
* @brief Defines a mesh with its attributes, the primitive type to render it as,
* and the file to load it from with the offset and length information for the
{
using Vector = std::vector<std::pair<MeshDefinition, MeshGeometry>>;
- enum : uint32_t { INVALID = std::numeric_limits<uint32_t>::max() };
+ enum : uint32_t
+ {
+ INVALID = std::numeric_limits<uint32_t>::max()
+ };
enum Flags : uint16_t
{
FLIP_UVS_VERTICAL = NthBit(0),
- U32_INDICES = NthBit(1), // default is unsigned short
- U16_JOINT_IDS = NthBit(2), // default is floats
+ U32_INDICES = NthBit(1), // default is unsigned short
+ U16_JOINT_IDS = NthBit(2), // default is floats
};
enum Attributes
{
- INDICES = NthBit(0),
- POSITIONS = NthBit(1),
- NORMALS = NthBit(2),
- TEX_COORDS = NthBit(3),
- TANGENTS = NthBit(4),
- LEGACY_BITANGENTS = NthBit(5), // these are ignored; we're calculating them in the (PBR) shader.
- JOINTS_0 = NthBit(6),
- WEIGHTS_0 = NthBit(7),
+ INDICES = NthBit(0),
+ POSITIONS = NthBit(1),
+ NORMALS = NthBit(2),
+ TEX_COORDS = NthBit(3),
+ TANGENTS = NthBit(4),
+ LEGACY_BITANGENTS = NthBit(5), // these are ignored; we're calculating them in the (PBR) shader.
+ JOINTS_0 = NthBit(6),
+ WEIGHTS_0 = NthBit(7),
};
/**
*/
struct Blob
{
- uint32_t mOffset = INVALID; // the default means that the blob is undefined.
- uint32_t mLength = 0; // if the blob is undefined, its data may still be generated. This is enabled by setting length to some non-0 value. Refer to MeshDefinition for details.
- uint16_t mStride = 0; // ignore if 0
- uint16_t mElementSizeHint = 0; // ignore if 0 or stride == 0
+ uint32_t mOffset = INVALID; // the default means that the blob is undefined.
+ uint32_t mLength = 0; // if the blob is undefined, its data may still be generated. This is enabled by setting length to some non-0 value. Refer to MeshDefinition for details.
+ uint16_t mStride = 0; // ignore if 0
+ uint16_t mElementSizeHint = 0; // ignore if 0 or stride == 0
std::vector<float> mMin;
std::vector<float> mMax;
Blob() = default;
- Blob(uint32_t offset, uint32_t length, uint16_t stride = 0, uint16_t elementSizeHint = 0,
- const std::vector<float>& min = {}, const std::vector<float>& max = {});
+ Blob(uint32_t offset, uint32_t length, uint16_t stride = 0, uint16_t elementSizeHint = 0, const std::vector<float>& min = {}, const std::vector<float>& max = {});
/**
* @brief Calculates the size of a tightly-packed buffer for the elements from the blob.
SparseBlob(const Blob& indices, const Blob& values, uint32_t count);
- Blob mIndices;
- Blob mValues;
+ Blob mIndices;
+ Blob mValues;
uint32_t mCount = 0u;
};
struct Accessor
{
- Blob mBlob;
+ Blob mBlob;
std::unique_ptr<SparseBlob> mSparse;
Accessor() = default;
Accessor(Accessor&&) = default;
Accessor& operator=(Accessor&&) = default;
- Accessor(const MeshDefinition::Blob& blob,
- const MeshDefinition::SparseBlob& sparse);
+ Accessor(const MeshDefinition::Blob& blob,
+ const MeshDefinition::SparseBlob& sparse);
bool IsDefined() const
{
struct BlendShape
{
std::string name;
- Accessor deltas;
- Accessor normals;
- Accessor tangents;
- float weight = 0.f;
+ Accessor deltas;
+ Accessor normals;
+ Accessor tangents;
+ float weight = 0.f;
};
struct RawData
{
struct Attrib
{
- std::string mName;
- Property::Type mType;
- uint32_t mNumElements;
+ std::string mName;
+ Property::Type mType;
+ uint32_t mNumElements;
std::vector<uint8_t> mData;
void AttachBuffer(Geometry& g) const;
};
std::vector<uint16_t> mIndices;
- std::vector<Attrib> mAttribs;
+ std::vector<Attrib> mAttribs;
- unsigned int mBlendShapeBufferOffset;
+ unsigned int mBlendShapeBufferOffset;
Dali::Vector<float> mBlendShapeUnnormalizeFactor;
- PixelData mBlendShapeData;
+ PixelData mBlendShapeData;
};
MeshDefinition() = default;
MeshGeometry Load(RawData&& raw) const;
public: // DATA
- uint32_t mFlags = 0x0;
+ uint32_t mFlags = 0x0;
Geometry::Type mPrimitiveType = Geometry::TRIANGLES;
- std::string mUri;
- Accessor mIndices;
- Accessor mPositions;
- Accessor mNormals; // data can be generated based on positions
- Accessor mTexCoords;
- Accessor mTangents; // data can be generated based on normals and texCoords (the latter isn't mandatory; the results will be better if available)
- Accessor mJoints0;
- Accessor mWeights0;
-
- Blob mBlendShapeHeader;
+ std::string mUri;
+ Accessor mIndices;
+ Accessor mPositions;
+ Accessor mNormals; // data can be generated based on positions
+ Accessor mTexCoords;
+ Accessor mTangents; // data can be generated based on normals and texCoords (the latter isn't mandatory; the results will be better if available)
+ Accessor mJoints0;
+ Accessor mWeights0;
+
+ Blob mBlendShapeHeader;
std::vector<BlendShape> mBlendShapes;
- BlendShapes::Version mBlendShapeVersion = BlendShapes::Version::INVALID;
+ BlendShapes::Version mBlendShapeVersion = BlendShapes::Version::INVALID;
Index mSkeletonIdx = INVALID_INDEX;
};
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif //DALI_SCENE_LOADER_MESH_DEFINITION_H
#ifndef DALI_SCENE_LOADER_MESH_GEOMETRY_H
#define DALI_SCENE_LOADER_MESH_GEOMETRY_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 SceneLoader
{
-
struct DALI_SCENE_LOADER_API MeshGeometry
{
- Geometry geometry; ///< The array of vertices.
- Texture blendShapeGeometry; ///< The array of vertices of the different blend shapes encoded inside a texture with power of two dimensions.
+ Geometry geometry; ///< The array of vertices.
+ Texture blendShapeGeometry; ///< The array of vertices of the different blend shapes encoded inside a texture with power of two dimensions.
Vector<float> blendShapeUnnormalizeFactor; ///< Factor used to unnormalize the geometry of the blend shape.
- unsigned int blendShapeBufferOffset; ///< Offset used to calculate the start of each blend shape.
+ unsigned int blendShapeBufferOffset; ///< Offset used to calculate the start of each blend shape.
};
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif // DALI_SCENE_LOADER_MESH_GEOMETRY_H
#ifndef DALI_SCENE_LOADER_NODE_DEFINITION_H_
#define DALI_SCENE_LOADER_NODE_DEFINITION_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.
#include "dali-scene-loader/public-api/resource-bundle.h"
// EXTERNAL INCLUDES
-#include "dali/public-api/math/quaternion.h"
+#include <functional>
+#include <memory>
+#include <string>
+#include "dali/public-api/actors/actor.h"
#include "dali/public-api/math/matrix.h"
+#include "dali/public-api/math/quaternion.h"
#include "dali/public-api/math/vector4.h"
-#include "dali/public-api/actors/actor.h"
-#include <string>
-#include <memory>
-#include <functional>
namespace Dali
{
namespace SceneLoader
{
-
class ViewProjection;
/**
struct DALI_SCENE_LOADER_API ConstraintDefinition
{
std::string mProperty; ///< name of the property to constrain.
- Index mSourceIdx; ///< index of the node to serve as the source of the constraint.
+ Index mSourceIdx; ///< index of the node to serve as the source of the constraint.
bool operator<(const ConstraintDefinition& other) const
{
struct DALI_SCENE_LOADER_API Transforms
{
- MatrixStack modelStack;
+ MatrixStack modelStack;
const ViewProjection& viewProjection;
};
*/
struct DALI_SCENE_LOADER_API SkinningShaderConfigurationRequest
{
- Index mSkeletonIdx;
+ Index mSkeletonIdx;
Shader mShader;
bool operator<(const SkinningShaderConfigurationRequest& other) const
struct DALI_SCENE_LOADER_API BlendshapeShaderConfigurationRequest
{
std::string mNodeName;
- Index mMeshIdx;
- Shader mShader;
+ Index mMeshIdx;
+ Shader mShader;
bool operator<(const BlendshapeShaderConfigurationRequest& other) const
{
*/
struct DALI_SCENE_LOADER_API ConstraintRequest
{
- const ConstraintDefinition* const mConstraint; ///< Definition of the constraint to create.
- Actor mTarget; ///< Target of the constraint.
+ const ConstraintDefinition* const mConstraint; ///< Definition of the constraint to create.
+ Actor mTarget; ///< Target of the constraint.
};
/**
*/
struct DALI_SCENE_LOADER_API NodeDefinition
{
-public: // TYPES
+public: // TYPES
using Vector = std::vector<NodeDefinition>;
struct CreateParams
{
public: // input
const ResourceBundle& mResources;
- Transforms& mXforms;
+ Transforms& mXforms;
public: // output
- std::vector<ConstraintRequest> mConstrainables;
- std::vector<SkinningShaderConfigurationRequest> mSkinnables;
+ std::vector<ConstraintRequest> mConstrainables;
+ std::vector<SkinningShaderConfigurationRequest> mSkinnables;
std::vector<BlendshapeShaderConfigurationRequest> mBlendshapeRequests;
};
{
auto choice = choices.Get(mTag);
return std::min(choice != Customization::NONE ? choice : 0,
- static_cast<Index>(node.mChildren.size() - 1));
+ static_cast<Index>(node.mChildren.size() - 1));
}
};
class IVisitor
{
public:
- virtual void Start(NodeDefinition& n) = 0;
+ virtual void Start(NodeDefinition& n) = 0;
virtual void Finish(NodeDefinition& n) = 0;
protected:
class IConstVisitor
{
public:
- virtual void Start(const NodeDefinition& n) = 0;
+ virtual void Start(const NodeDefinition& n) = 0;
virtual void Finish(const NodeDefinition& n) = 0;
protected:
struct Extra
{
- std::string mKey;
+ std::string mKey;
Property::Value mValue;
bool operator<(const Extra& other) const
}
};
-public: // METHODS
+public: // METHODS
/**
* @brief Creates a DALi Actor from this definition only.
* @note Not recursive.
std::string mName;
- Vector3 mPosition = Vector3::ZERO;
+ Vector3 mPosition = Vector3::ZERO;
Quaternion mOrientation = Quaternion::IDENTITY;
- Vector3 mScale = Vector3::ONE;
- Vector3 mSize = Vector3::ONE;
+ Vector3 mScale = Vector3::ONE;
+ Vector3 mSize = Vector3::ONE;
bool mIsVisible = true;
- std::unique_ptr<Renderable> mRenderable;
+ std::unique_ptr<Renderable> mRenderable;
std::unique_ptr<CustomizationDefinition> mCustomization;
- std::vector<Extra> mExtras;
- std::vector<ConstraintDefinition> mConstraints;
+ std::vector<Extra> mExtras;
+ std::vector<ConstraintDefinition> mConstraints;
std::vector<Index> mChildren;
- Index mParentIdx = INVALID_INDEX;
+ Index mParentIdx = INVALID_INDEX;
};
class DALI_SCENE_LOADER_API ModelNode : public NodeDefinition::Renderable
{
public: // DATA
- Vector4 mColor = Color::WHITE;
- Index mMeshIdx = INVALID_INDEX;
- Index mMaterialIdx = INVALID_INDEX;
+ Vector4 mColor = Color::WHITE;
+ Index mMeshIdx = INVALID_INDEX;
+ Index mMaterialIdx = INVALID_INDEX;
public: // METHODS
void RegisterResources(IResourceReceiver& receiver) const override;
class DALI_SCENE_LOADER_API ArcNode : public ModelNode
{
public: // DATA
- bool mAntiAliasing = true;
- int mArcCaps = 0;
+ bool mAntiAliasing = true;
+ int mArcCaps = 0;
float mStartAngleDegrees = .0f;
- float mEndAngleDegrees = .0f;
- float mRadius = .0f;
+ float mEndAngleDegrees = .0f;
+ float mRadius = .0f;
public: // METHODS
static void GetEndVectorWithDiffAngle(float startAngle, float endAngle, Vector2& endVector);
void OnCreate(const NodeDefinition& node, NodeDefinition::CreateParams& params, Actor& actor) const override;
};
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif //DALI_SCENE_LOADER_NODE_DEFINITION_H_
#ifndef DALI_SCENE_LOADER_INTERPRET_RENDERER_STATE_H
#define DALI_SCENE_LOADER_INTERPRET_RENDERER_STATE_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 RendererState
{
-
/*
* @brief Attempts to interpret a string for renderer states, which can be a combination of the following
* (using '|' as a delimiter, if multiple specified):<br/>
*/
DALI_SCENE_LOADER_API Type Parse(const char* string, size_t length = 0, StringCallback onError = DefaultErrorCallback);
-}
-}
-}
+} // namespace RendererState
+} // namespace SceneLoader
+} // namespace Dali
#endif //DALI_SCENE_LOADER_INTERPRET_RENDERER_STATE_H
#ifndef DALI_SCENE_LOADER_RENDERER_STATE_H
#define DALI_SCENE_LOADER_RENDERER_STATE_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 SceneLoader
{
-
/*
* @brief Contains values for comparison functions used in depth and stencil testing.
* @note Relative order of members must match DepthFunction::Type and StencilFunction::Type.
{
enum Type
{
- OMIT, // not specified; will not be set.
+ OMIT, // not specified; will not be set.
NEVER,
ALWAYS,
LESS,
{
enum Type
{
- OMIT, // not specified - will not be updated
+ OMIT, // not specified - will not be updated
ZERO,
- ONE, // default for source alpha
+ ONE, // default for source alpha
SRC_COLOR,
ONE_MINUS_SRC_COLOR,
- SRC_ALPHA, // default for source RGB
- ONE_MINUS_SRC_ALPHA, // default for destination RGB and destination alpha
+ SRC_ALPHA, // default for source RGB
+ ONE_MINUS_SRC_ALPHA, // default for destination RGB and destination alpha
DST_ALPHA,
ONE_MINUS_DST_ALPHA,
DST_COLOR,
{
enum Type
{
- OMIT, ///< not specified - will not be updated
- NONE, ///< Don’t write to either color or stencil buffer (But will potentially render to depth buffer).
- AUTO, ///< Writes are managed by the Actor Clipping API. This is DALi's default.
- COLOR, ///< Ignore stencil properties. Write to the color buffer.
- STENCIL, ///< Use the stencil properties. Do not write to the color buffer.
- COLOR_STENCIL ///< Use the stencil properties AND Write to the color buffer.
+ OMIT, ///< not specified - will not be updated
+ NONE, ///< Don’t write to either color or stencil buffer (But will potentially render to depth buffer).
+ AUTO, ///< Writes are managed by the Actor Clipping API. This is DALi's default.
+ COLOR, ///< Ignore stencil properties. Write to the color buffer.
+ STENCIL, ///< Use the stencil properties. Do not write to the color buffer.
+ COLOR_STENCIL ///< Use the stencil properties AND Write to the color buffer.
};
BufferMode() = delete;
*/
namespace RendererState
{
-
-using Type = uint32_t; // 8 bits reserved for flags, 4 * 4 bit for blend factors, 4 bits for depth function
+using Type = uint32_t; // 8 bits reserved for flags, 4 * 4 bit for blend factors, 4 bits for depth function
enum DALI_SCENE_LOADER_API Value : Type
{
NONE = 0x0,
DEPTH_WRITE = 0x01,
- DEPTH_TEST = 0x02,
+ DEPTH_TEST = 0x02,
CULL_FRONT = 0x04,
- CULL_BACK = 0x08,
+ CULL_BACK = 0x08,
ALPHA_BLEND = 0x10,
DEPTH_FUNCTION_SHIFT = 6,
- DEPTH_FUNCTION_BITS = 4,
- DEPTH_FUNCTION_MASK = ((1 << DEPTH_FUNCTION_BITS) - 1) << DEPTH_FUNCTION_SHIFT,
+ DEPTH_FUNCTION_BITS = 4,
+ DEPTH_FUNCTION_MASK = ((1 << DEPTH_FUNCTION_BITS) - 1) << DEPTH_FUNCTION_SHIFT,
BLEND_FACTOR_BASE_SHIFT = DEPTH_FUNCTION_SHIFT + DEPTH_FUNCTION_BITS,
- BLEND_FACTOR_ITEM_BITS = 4,
- BLEND_FACTOR_ITEMS = 4,
- BLEND_FACTOR_BITS = BLEND_FACTOR_ITEM_BITS * BLEND_FACTOR_ITEMS,
- BLEND_FACTOR_MASK = ((1 << BLEND_FACTOR_BITS) - 1) << BLEND_FACTOR_BASE_SHIFT,
- BLEND_FACTOR_ITEM_MASK = (1 << BLEND_FACTOR_ITEM_BITS) - 1, // after rshifting by BLEND_FACTOR_BASE_SHIFT
+ BLEND_FACTOR_ITEM_BITS = 4,
+ BLEND_FACTOR_ITEMS = 4,
+ BLEND_FACTOR_BITS = BLEND_FACTOR_ITEM_BITS * BLEND_FACTOR_ITEMS,
+ BLEND_FACTOR_MASK = ((1 << BLEND_FACTOR_BITS) - 1) << BLEND_FACTOR_BASE_SHIFT,
+ BLEND_FACTOR_ITEM_MASK = (1 << BLEND_FACTOR_ITEM_BITS) - 1, // after rshifting by BLEND_FACTOR_BASE_SHIFT
// Buffer mode is DALi's RenderMode, just to avoid too much conflation.
- BUFFER_MODE_BITS = 3u,
- BUFFER_MODE_SHIFT = 32u - BUFFER_MODE_BITS, // from end
- BUFFER_MODE_MASK = ((1u << BUFFER_MODE_BITS) - 1u) << BUFFER_MODE_SHIFT,
+ BUFFER_MODE_BITS = 3u,
+ BUFFER_MODE_SHIFT = 32u - BUFFER_MODE_BITS, // from end
+ BUFFER_MODE_MASK = ((1u << BUFFER_MODE_BITS) - 1u) << BUFFER_MODE_SHIFT,
DEFAULT = DEPTH_WRITE | DEPTH_TEST | CULL_BACK | (Comparison::LESS_EQUAL << DEPTH_FUNCTION_SHIFT),
};
* @brief Encodes the given blend factors into a RenderMode value, maskable into other options,
* passable into ApplyRenderMode().
*/
-inline
-DALI_SCENE_LOADER_API constexpr uint32_t FromBlendFactors(BlendFactor::Type srcRgb, BlendFactor::Type destRgb,
- BlendFactor::Type srcAlpha, BlendFactor::Type destAlpha)
+inline DALI_SCENE_LOADER_API constexpr uint32_t FromBlendFactors(BlendFactor::Type srcRgb, BlendFactor::Type destRgb, BlendFactor::Type srcAlpha, BlendFactor::Type destAlpha)
{
return (srcRgb | (destRgb << BLEND_FACTOR_ITEM_BITS) | (srcAlpha << (BLEND_FACTOR_ITEM_BITS * 2)) |
- (destAlpha << (BLEND_FACTOR_ITEM_BITS * 3))) << BLEND_FACTOR_BASE_SHIFT;
+ (destAlpha << (BLEND_FACTOR_ITEM_BITS * 3)))
+ << BLEND_FACTOR_BASE_SHIFT;
}
/*
*/
DALI_SCENE_LOADER_API void Apply(Type rendererState, Renderer& renderer);
-} // RendererState
+} // namespace RendererState
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif //DALI_SCENE_LOADER_RENDERER_STATE_H
#ifndef DALI_SCENE_LOADER_RESOURCE_BUNDLE_H_
#define DALI_SCENE_LOADER_RESOURCE_BUNDLE_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.
*/
// INTERNAL
-#include "dali-scene-loader/public-api/mesh-definition.h"
-#include "dali-scene-loader/public-api/material-definition.h"
#include "dali-scene-loader/public-api/environment-definition.h"
+#include "dali-scene-loader/public-api/material-definition.h"
+#include "dali-scene-loader/public-api/mesh-definition.h"
#include "dali-scene-loader/public-api/shader-definition.h"
#include "dali-scene-loader/public-api/skeleton-definition.h"
// EXTERNAL
+#include <functional>
+#include <memory>
#include "dali/public-api/common/vector-wrapper.h"
#include "dali/public-api/rendering/shader.h"
#include "dali/public-api/rendering/texture-set.h"
-#include <memory>
-#include <functional>
namespace Dali
{
namespace SceneLoader
{
-
/*
* @brief The types of resources that .dli may define.
*/
enum Value : Type
{
- None = 0,
- ForceReload = NthBit(0), ///< Load resources [again] even if they were already loaded.
- KeepUnused = NthBit(1) ///<s Don't reset handles to resources that had a 0 reference count.
+ None = 0,
+ ForceReload = NthBit(0), ///< Load resources [again] even if they were already loaded.
+ KeepUnused = NthBit(1) ///<s Don't reset handles to resources that had a 0 reference count.
};
};
* UNLESS the KeepUnused option was specified.
*/
void LoadResources(const ResourceRefCounts& refCounts,
- PathProvider pathProvider,
- Options::Type options = Options::None);
+ PathProvider pathProvider,
+ Options::Type options = Options::None);
public: // DATA
EnvironmentDefinition::Vector mEnvironmentMaps;
- ShaderDefinition::Vector mShaders;
- MeshDefinition::Vector mMeshes;
- MaterialDefinition::Vector mMaterials;
+ ShaderDefinition::Vector mShaders;
+ MeshDefinition::Vector mMeshes;
+ MaterialDefinition::Vector mMaterials;
SkeletonDefinition::Vector mSkeletons;
};
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif //DALI_SCENE_LOADER_RESOURCE_BUNDLE_H_
#ifndef DALI_SCENE_LOADER_SCENE_DEFINITION_H_
#define DALI_SCENE_LOADER_SCENE_DEFINITION_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.
// INTERNAL INCLUDES
#include "dali-scene-loader/public-api/customization.h"
-#include "dali-scene-loader/public-api/utils.h"
#include "dali-scene-loader/public-api/node-definition.h"
#include "dali-scene-loader/public-api/string-callback.h"
+#include "dali-scene-loader/public-api/utils.h"
// EXTERNAL INCLUDES
-#include "dali/public-api/math/quaternion.h"
+#include <memory>
+#include <string>
+#include "dali/public-api/actors/actor.h"
#include "dali/public-api/math/matrix.h"
+#include "dali/public-api/math/quaternion.h"
#include "dali/public-api/math/vector4.h"
-#include "dali/public-api/actors/actor.h"
-#include <string>
-#include <memory>
namespace Dali
{
namespace SceneLoader
{
-
class MatrixStack;
/*
*/
class DALI_SCENE_LOADER_API SceneDefinition
{
-public: // TYPES
- using NodePredicate = std::function<bool(const NodeDefinition&)>;
- using NodeConsumer = std::function<void(NodeDefinition&)>;
+public: // TYPES
+ using NodePredicate = std::function<bool(const NodeDefinition&)>;
+ using NodeConsumer = std::function<void(NodeDefinition&)>;
using ConstNodeConsumer = std::function<void(const NodeDefinition&)>;
public: // METHODS
* from node definitions.
* @return Handle to the root actor.
*/
- Actor CreateNodes(Index iNode, const Customization::Choices& choices,
- NodeDefinition::CreateParams& params) const;
+ Actor CreateNodes(Index iNode, const Customization::Choices& choices, NodeDefinition::CreateParams& params) const;
/*
* @brief Creates / update a registry of mappings from customization tags to
* choice of 0.
*/
void GetCustomizationOptions(const Customization::Choices& choices,
- Customization::Map& outCustomizationOptions,
- Customization::Choices* outMissingChoices) const;
+ Customization::Map& outCustomizationOptions,
+ Customization::Choices* outMissingChoices) const;
/*
* @brief Attempts to add @a nodeDef to the end of nodes, and its index to the end of
/*
* @brief Applies constraints from the given requests.
*/
- void ApplyConstraints(Actor& root,
- std::vector<ConstraintRequest>&& constrainables,
- StringCallback onError = DefaultErrorCallback) const;
+ void ApplyConstraints(Actor& root,
+ std::vector<ConstraintRequest>&& constrainables,
+ StringCallback onError = DefaultErrorCallback) const;
/*
* @brief Sets up joint matrix properties and constraints on actors that are involved in skeletal
* of separate instances need to be declared in the .dli to avoid clashing uniform
* definitions and constraints.
*/
- void ConfigureSkinningShaders(const ResourceBundle& resources,
- Actor root, std::vector<SkinningShaderConfigurationRequest>&& requests) const;
+ void ConfigureSkinningShaders(const ResourceBundle& resources,
+ Actor root,
+ std::vector<SkinningShaderConfigurationRequest>&& requests) const;
/*
* @brief Ensures there is no two meshes with blend shapes sharing the same shader.
* @param[in] resources The resources bundle. Meshes need to be accessed to configure the blend shapes.
* @param[in] onError The error callback.
*/
- bool ConfigureBlendshapeShaders(const ResourceBundle& resources,
- Actor root, std::vector<BlendshapeShaderConfigurationRequest>&& requests,
- StringCallback onError = DefaultErrorCallback) const;
+ bool ConfigureBlendshapeShaders(const ResourceBundle& resources,
+ Actor root,
+ std::vector<BlendshapeShaderConfigurationRequest>&& requests,
+ StringCallback onError = DefaultErrorCallback) const;
SceneDefinition& operator=(SceneDefinition&& other);
private: // METHODS
bool FindNode(const std::string& name, std::unique_ptr<NodeDefinition>** result);
-private: // DATA
- std::vector<std::unique_ptr<NodeDefinition>> mNodes; // size unknown up front (may discard nodes).
- std::vector<Index> mRootNodeIds;
+private: // DATA
+ std::vector<std::unique_ptr<NodeDefinition>> mNodes; // size unknown up front (may discard nodes).
+ std::vector<Index> mRootNodeIds;
};
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif //DALI_SCENE_LOADER_SCENE_DEFINITION_H_
#ifndef DALI_SCENE_LOADER_SHADER_DEFINITION_FACTORY_H_
#define DALI_SCENE_LOADER_SHADER_DEFINITION_FACTORY_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.
*/
// INTERNAL INCLUDES
-#include "dali-scene-loader/public-api/index.h"
#include "dali-scene-loader/public-api/api.h"
+#include "dali-scene-loader/public-api/index.h"
// EXTERNAL INCLUDER
#include <memory>
{
namespace SceneLoader
{
-
struct NodeDefinition;
class ResourceBundle;
const std::unique_ptr<Impl> mImpl;
};
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif //DALI_SCENE_LOADER_SHADER_DEFINITION_FACTORY_H_
#ifndef DALI_SCENE_LOADER_SHADER_DEFINITION_H
#define DALI_SCENE_LOADER_SHADER_DEFINITION_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.
#include "dali-scene-loader/public-api/renderer-state.h"
// EXTERNAL INCLUDES
+#include <memory>
#include "dali/public-api/common/vector-wrapper.h"
#include "dali/public-api/rendering/shader.h"
-#include <memory>
namespace Dali
{
namespace SceneLoader
{
-
/*
* @brief Defines a shader with paths to the files which define its
* vertex and fragment components, and a mapping of uniform names (which are
public: // DATA
RendererState::Type mRendererState = RendererState::NONE;
- std::string mVertexShaderPath;
- std::string mFragmentShaderPath;
+ std::string mVertexShaderPath;
+ std::string mFragmentShaderPath;
std::vector<std::string> mDefines;
std::vector<std::string> mHints;
Property::Map mUniforms;
};
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif //DALI_SCENE_LOADER_SHADER_DEFINITION_H
#ifndef DALI_SCENE_LOADER_SKELETON_H
#define DALI_SCENE_LOADER_SKELETON_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 SceneLoader
{
-
/*
* @brief A set of joints (stored as node indices), and an optional root node index.
* @note The list of joints must not be empty and must not contain INVALID_INDEX.
{
struct Joint
{
- Index mNodeIdx;
+ Index mNodeIdx;
Matrix mInverseBindMatrix;
};
using Vector = std::vector<SkeletonDefinition>;
- Index mRootNodeIdx = INVALID_INDEX;
+ Index mRootNodeIdx = INVALID_INDEX;
std::vector<Joint> mJoints;
};
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif //DALI_SCENE_LOADER_SKELETON_H
#ifndef DALI_SCENE_LOADER_SKINNING_DETAILS_H_
#define DALI_SCENE_LOADER_SKINNING_DETAILS_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.
#include "dali-scene-loader/public-api/api.h"
// EXTERNAL INCLUDES
-#include "dali/public-api/rendering/shader.h"
#include <string>
+#include "dali/public-api/rendering/shader.h"
namespace Dali
{
Skinning() = delete;
};
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif // DALI_SCENE_LOADER_SKINNING_DETAILS_H_
#ifndef DALI_SCENE_LOADER_STRING_CALLBACK_H
#define DALI_SCENE_LOADER_STRING_CALLBACK_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 SceneLoader
{
-
/*
* @brief A callback to post strings to.
*/
*/
DALI_SCENE_LOADER_API void DefaultErrorCallback(const std::string& message);
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif //DALI_SCENE_LOADER_STRING_CALLBACK_H
#ifndef DALI_SCENE_LOADER_UTILS_H_
#define DALI_SCENE_LOADER_UTILS_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.
#include "dali-scene-loader/public-api/api.h"
// EXTERNAL INCLUDES
+#include <cctype>
+#include <sstream>
#include "dali/public-api/actors/actor.h"
-#include "dali/public-api/rendering/renderer.h"
#include "dali/public-api/common/dali-common.h"
-#include <sstream>
-#include <cctype>
+#include "dali/public-api/rendering/renderer.h"
namespace Dali
{
namespace SceneLoader
{
-
/*
* @brief Fixed size backing buffer to use with std::ostreams where control over
* allocations (which this does not make), is required.
class DALI_SCENE_LOADER_API ExceptionFlinger
{
public:
- enum { MESSAGE_BUFFER_SIZE = 512 };
+ enum
+ {
+ MESSAGE_BUFFER_SIZE = 512
+ };
ExceptionFlinger(const char* location) noexcept(true);
- [[noreturn]]
- ~ExceptionFlinger() noexcept(false);
+ [[noreturn]] ~ExceptionFlinger() noexcept(false);
- template <typename T>
+ template<typename T>
ExceptionFlinger& operator<<(const T& rhs) noexcept(true)
{
mStream << rhs;
{
const char* mLocation;
- [[noreturn]]
- ~Impl() noexcept(false);
+ [[noreturn]] ~Impl() noexcept(false);
};
static char* GetMessageBuffer() noexcept(true);
- Impl mImpl;
+ Impl mImpl;
StreamBuffer mStreamBuffer;
std::ostream mStream;
};
/*
* @return The @n th bit in a bitmask.
*/
-DALI_SCENE_LOADER_API constexpr size_t NthBit(size_t n) { return 1 << n; }
+DALI_SCENE_LOADER_API constexpr size_t NthBit(size_t n)
+{
+ return 1 << n;
+}
/*
* @return Whether all of @a mask 's bits are set on @a value.
*/
-inline
-DALI_SCENE_LOADER_API bool MaskMatch(uint32_t value, uint32_t mask)
+inline DALI_SCENE_LOADER_API bool MaskMatch(uint32_t value, uint32_t mask)
{
return (value & mask) == mask;
}
/*
* @brief Convert a four-letter(, null-terminated) string literal into a uint32_t.
*/
-inline
-DALI_SCENE_LOADER_API constexpr uint32_t FourCC(const char(&fourCC)[5])
+inline DALI_SCENE_LOADER_API constexpr uint32_t FourCC(const char (&fourCC)[5])
{
return (fourCC[3] << 24) | (fourCC[2] << 16) | (fourCC[1] << 8) | fourCC[0];
}
* @param[in] b, compare string
* @return true if strings are equal
*/
-inline
-DALI_SCENE_LOADER_API bool CaseInsensitiveCharacterCompare( unsigned char a, unsigned char b )
+inline DALI_SCENE_LOADER_API bool CaseInsensitiveCharacterCompare(unsigned char a, unsigned char b)
{
// Converts to lower case in the current locale.
- return std::tolower( a ) == std::tolower( b );
+ return std::tolower(a) == std::tolower(b);
}
/*
* @param[in] a, compare string
* @param[in] b, compare string
*/
-inline
-DALI_SCENE_LOADER_API bool CaseInsensitiveStringCompare( const std::string& a, const std::string& b )
+inline DALI_SCENE_LOADER_API bool CaseInsensitiveStringCompare(const std::string& a, const std::string& b)
{
bool result = false;
- if( a.length() == b.length() )
+ if(a.length() == b.length())
{
- result = std::equal( a.begin(), a.end(), b.begin(), &CaseInsensitiveCharacterCompare );
+ result = std::equal(a.begin(), a.end(), b.begin(), &CaseInsensitiveCharacterCompare);
}
return result;
}
* @note Use of a @a fn that is itself recursing in @a is also discouraged
* for performance and stability reasons.
*/
-template <typename Func>
-inline
-DALI_SCENE_LOADER_API void VisitActor(Actor a, Func fn)
+template<typename Func>
+inline DALI_SCENE_LOADER_API void VisitActor(Actor a, Func fn)
{
fn(a);
* @brief Convenience function to set the given actor @a 's anchor point
* and parent origin to center.
*/
-inline
-DALI_SCENE_LOADER_API void SetActorCentered(Actor a)
+inline DALI_SCENE_LOADER_API void SetActorCentered(Actor a)
{
a.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
a.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
enum DALI_SCENE_LOADER_API Values : Type
{
- NONE = 0x00,
+ NONE = 0x00,
FLIP_VERTICAL = 0x01,
};
-}
+} // namespace TexturedQuadOptions
/*
* @brief Makes... geometry for a textured quad.
* @brief Fixes the path of a file. Replaces the '\\' separator by the '/' one.
* @param[in,out] path The path to be fixed.
*/
-DALI_SCENE_LOADER_API void ToUnixFileSeparators( std::string& path );
+DALI_SCENE_LOADER_API void ToUnixFileSeparators(std::string& path);
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif /* DALI_SCENE_LOADER_UTILS_H_ */
#ifndef DALI_SCENE_LOADER_VIEW_PROJECTION_H_
#define DALI_SCENE_LOADER_VIEW_PROJECTION_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 SceneLoader
{
-
/**
* @brief Contains view and projection matrices, also caching the view-projection
* and inverse projection matrices.
class ViewProjection
{
public:
- Matrix& GetView() { return mView; }
- Matrix& GetProjection() { return mProjection; }
+ Matrix& GetView()
+ {
+ return mView;
+ }
+ Matrix& GetProjection()
+ {
+ return mProjection;
+ }
/*
* @brief Updates the cached view projection and inverse projection matrices.
*/
void Update();
- const Matrix& GetView() const { return mView; }
- const Matrix& GetProjection() const { return mProjection; }
- const Matrix& GetInverseProjection() const { return mInvProjection; }
- const Matrix& GetViewProjection() const { return mViewProjection; }
+ const Matrix& GetView() const
+ {
+ return mView;
+ }
+ const Matrix& GetProjection() const
+ {
+ return mProjection;
+ }
+ const Matrix& GetInverseProjection() const
+ {
+ return mInvProjection;
+ }
+ const Matrix& GetViewProjection() const
+ {
+ return mViewProjection;
+ }
private:
Matrix mView;
Matrix mViewProjection;
};
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif //DALI_SCENE_LOADER_VIEW_PROJECTION_H_
--- /dev/null
+---
+Language: Cpp
+DisableFormat: true
+SortIncludes: false
+...
#define DALI_TOOLKIT_CONTROL_DEVEL_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 DevelControl
{
/// @brief AccessibilityActivate signal type.
-typedef Signal< void ( ) > AccessibilityActivateSignalType;
+typedef Signal<void()> AccessibilityActivateSignalType;
/// @brief AccessibilityReadingSkipped signal type.
-typedef Signal< void ( ) > AccessibilityReadingSkippedSignalType;
+typedef Signal<void()> AccessibilityReadingSkippedSignalType;
/// @brief AccessibilityReadingPaused signal type.
-typedef Signal< void ( ) > AccessibilityReadingPausedSignalType;
+typedef Signal<void()> AccessibilityReadingPausedSignalType;
/// @brief AccessibilityReadingResumed signal type.
-typedef Signal< void ( ) > AccessibilityReadingResumedSignalType;
+typedef Signal<void()> AccessibilityReadingResumedSignalType;
/// @brief AccessibilityReadingCancelled signal type.
-typedef Signal< void ( ) > AccessibilityReadingCancelledSignalType;
+typedef Signal<void()> AccessibilityReadingCancelledSignalType;
/// @brief AccessibilityReadingStopped signal type.
-typedef Signal< void ( ) > AccessibilityReadingStoppedSignalType;
+typedef Signal<void()> AccessibilityReadingStoppedSignalType;
/// @brief AccessibilityGetName signal type.
-typedef Signal< void ( std::string& ) > AccessibilityGetNameSignalType;
+typedef Signal<void(std::string&)> AccessibilityGetNameSignalType;
/// @brief AccessibilityGetDescription signal type.
-typedef Signal< void ( std::string& ) > AccessibilityGetDescriptionSignalType;
+typedef Signal<void(std::string&)> AccessibilityGetDescriptionSignalType;
/// @brief AccessibilityDoGesture signal type.
-typedef Signal< void ( std::pair<Dali::Accessibility::GestureInfo, bool>& ) > AccessibilityDoGestureSignalType;
+typedef Signal<void(std::pair<Dali::Accessibility::GestureInfo, bool>&)> AccessibilityDoGestureSignalType;
enum State
{
* @brief The signal is emmited as a succession of "activate" signal send by accessibility client.
* @return The signal to connect to
*/
-DALI_TOOLKIT_API AccessibilityActivateSignalType &AccessibilityActivateSignal( Toolkit::Control control );
+DALI_TOOLKIT_API AccessibilityActivateSignalType& AccessibilityActivateSignal(Toolkit::Control control);
/**
* @brief The signal is emmited when text send via Dali::Accessibility::Bridge::Say
*
* @return The signal to connect to
*/
-DALI_TOOLKIT_API AccessibilityReadingSkippedSignalType &AccessibilityReadingSkippedSignal( Toolkit::Control control );
+DALI_TOOLKIT_API AccessibilityReadingSkippedSignalType& AccessibilityReadingSkippedSignal(Toolkit::Control control);
/**
* @brief
*
* @return The signal to connect to
*/
-DALI_TOOLKIT_API AccessibilityReadingPausedSignalType &AccessibilityReadingPausedSignal( Toolkit::Control control );
+DALI_TOOLKIT_API AccessibilityReadingPausedSignalType& AccessibilityReadingPausedSignal(Toolkit::Control control);
/**
* @brief
*
* @return The signal to connect to
*/
-DALI_TOOLKIT_API AccessibilityReadingResumedSignalType &AccessibilityReadingResumedSignal( Toolkit::Control control );
+DALI_TOOLKIT_API AccessibilityReadingResumedSignalType& AccessibilityReadingResumedSignal(Toolkit::Control control);
/**
* @brief The signal is emmited when text send via Dali::Accessibility::Bridge::Say
*
* @return The signal to connect to
*/
-DALI_TOOLKIT_API AccessibilityReadingCancelledSignalType &AccessibilityReadingCancelledSignal( Toolkit::Control control );
+DALI_TOOLKIT_API AccessibilityReadingCancelledSignalType& AccessibilityReadingCancelledSignal(Toolkit::Control control);
/**
* @brief The signal is emmited when text send via Dali::Accessibility::Bridge::Say
*
* @return The signal to connect to
*/
-DALI_TOOLKIT_API AccessibilityReadingStoppedSignalType &AccessibilityReadingStoppedSignal( Toolkit::Control control );
+DALI_TOOLKIT_API AccessibilityReadingStoppedSignalType& AccessibilityReadingStoppedSignal(Toolkit::Control control);
/**
* @brief The signal is emmited when accessibility client asks for object's name.
* Priority is as above. If none is used, default implementation is provided.
* @return [description]
*/
-DALI_TOOLKIT_API AccessibilityGetNameSignalType &AccessibilityGetNameSignal( Toolkit::Control control );
+DALI_TOOLKIT_API AccessibilityGetNameSignalType& AccessibilityGetNameSignal(Toolkit::Control control);
/**
* @brief The signal is emmited when accessibility client asks for object's description.
* Priority is as above. If none is used, default implementation is provided.
* @return signal handler
*/
-DALI_TOOLKIT_API AccessibilityGetDescriptionSignalType &AccessibilityGetDescriptionSignal( Toolkit::Control control );
+DALI_TOOLKIT_API AccessibilityGetDescriptionSignalType& AccessibilityGetDescriptionSignal(Toolkit::Control control);
/**
* @brief The signal is emitted when accessibility client call "DoGesture" method via IPC mechanism.
* This signal allows developers to serve incoming gesture in specific way.
* @return signal handler
*/
-DALI_TOOLKIT_API AccessibilityDoGestureSignalType &AccessibilityDoGestureSignal( Toolkit::Control control );
+DALI_TOOLKIT_API AccessibilityDoGestureSignalType& AccessibilityDoGestureSignal(Toolkit::Control control);
/**
* @brief The method allows connection with other actor with usage of concrete accessibility relation type.
* @param destination Actor object
* @param relation enumerated value describing relation
*/
-DALI_TOOLKIT_API void AppendAccessibilityRelation( Dali::Actor control, Actor destination, Dali::Accessibility::RelationType relation );
+DALI_TOOLKIT_API void AppendAccessibilityRelation(Dali::Actor control, Actor destination, Dali::Accessibility::RelationType relation);
/**
* @brief The method allows removing relation
* @param destination Actor object
* @param relation enumerated value describing relation
*/
-DALI_TOOLKIT_API void RemoveAccessibilityRelation( Dali::Actor control, Actor destination, Dali::Accessibility::RelationType relation );
+DALI_TOOLKIT_API void RemoveAccessibilityRelation(Dali::Actor control, Actor destination, Dali::Accessibility::RelationType relation);
/**
* @brief The method returns collection accessibility addresses representing objects connected with current object
* @param control object to append attribute to
* @return std::vector, where index is casted value of Accessibility::RelationType and value is std::vector of type Accessibility::Address
*/
-DALI_TOOLKIT_API std::vector<std::vector<Accessibility::Address>> GetAccessibilityRelations( Dali::Actor control );
+DALI_TOOLKIT_API std::vector<std::vector<Accessibility::Address>> GetAccessibilityRelations(Dali::Actor control);
/**
* @brief The method removes all previously appended relations
*
* @param control object to append attribute to
*/
-DALI_TOOLKIT_API void ClearAccessibilityRelations( Dali::Actor control );
+DALI_TOOLKIT_API void ClearAccessibilityRelations(Dali::Actor control);
/**
* @brief The method allows to add or modify value matched with given key.
* @param key std::string value
* @param value std::string value
*/
-DALI_TOOLKIT_API void AppendAccessibilityAttribute( Dali::Actor control, const std::string& key, const std::string value );
+DALI_TOOLKIT_API void AppendAccessibilityAttribute(Dali::Actor control, const std::string& key, const std::string value);
/**
* @brief The method erases key with its value from accessibility attributes
* @param control object to append attribute to
* @param key std::string value
*/
-DALI_TOOLKIT_API void RemoveAccessibilityAttribute( Dali::Actor control, const std::string& key );
+DALI_TOOLKIT_API void RemoveAccessibilityAttribute(Dali::Actor control, const std::string& key);
/**
* @brief The method clears accessibility attributes
*
* @param control object to append attribute to
*/
-DALI_TOOLKIT_API void ClearAccessibilityAttributes( Dali::Actor control );
+DALI_TOOLKIT_API void ClearAccessibilityAttributes(Dali::Actor control);
/**
* @brief The method inserts reading information of an accessible object into attributes
* @param control object to append attribute to
* @param types Reading information types
*/
-DALI_TOOLKIT_API void SetAccessibilityReadingInfoType( Dali::Actor control, const Dali::Accessibility::ReadingInfoTypes types );
+DALI_TOOLKIT_API void SetAccessibilityReadingInfoType(Dali::Actor control, const Dali::Accessibility::ReadingInfoTypes types);
/**
* @brief The method returns reading information of an accessible object
* @param control object to append attribute to
* @return Reading information types
*/
-DALI_TOOLKIT_API Dali::Accessibility::ReadingInfoTypes GetAccessibilityReadingInfoType( Dali::Actor control );
+DALI_TOOLKIT_API Dali::Accessibility::ReadingInfoTypes GetAccessibilityReadingInfoType(Dali::Actor control);
/**
* @brief The method erases highlight.
* @param control object to append attribute to
* @return bool value, false when it is not possible or something went wrong, at the other way true.
*/
-DALI_TOOLKIT_API bool ClearAccessibilityHighlight( Dali::Actor control );
+DALI_TOOLKIT_API bool ClearAccessibilityHighlight(Dali::Actor control);
/**
* @brief The method grabs highlight.
* @param control object to append attribute to
* @return bool value, false when it is not possible or something went wrong, at the other way true.
*/
-DALI_TOOLKIT_API bool GrabAccessibilityHighlight( Dali::Actor control );
+DALI_TOOLKIT_API bool GrabAccessibilityHighlight(Dali::Actor control);
/**
* @brief The metod presents bitset of control's states.
* @param control object to append attribute to
* @return Dali::Accessibility::States is vector of enumerated State.
*/
-DALI_TOOLKIT_API Dali::Accessibility::States GetAccessibilityStates( Dali::Actor control );
+DALI_TOOLKIT_API Dali::Accessibility::States GetAccessibilityStates(Dali::Actor control);
/**
* @brief The method force sending notifications about current states to accessibility clients
* @param states mask with states expected to broadcast
* @param doRecursive flag pointing if notifications of children's state would be sent
*/
-DALI_TOOLKIT_API void NotifyAccessibilityStateChange( Dali::Actor control, Dali::Accessibility::States states, bool doRecursive );
+DALI_TOOLKIT_API void NotifyAccessibilityStateChange(Dali::Actor control, Dali::Accessibility::States states, bool doRecursive);
/**
* The method allows to set specific constructor for creating accessibility structure
*
* param constructor callback creating Accessible object
*/
-DALI_TOOLKIT_API void SetAccessibilityConstructor( Dali::Actor control, std::function<std::unique_ptr<Dali::Accessibility::Accessible>(Dali::Actor)> constructor);
+DALI_TOOLKIT_API void SetAccessibilityConstructor(Dali::Actor control, std::function<std::unique_ptr<Dali::Accessibility::Accessible>(Dali::Actor)> constructor);
/**
* Returns accessibility object bound to actor, if any
*
* This method won't bound new accessibility object. Use Dali::Accessibility::Accessible::Get in that case.
*/
-DALI_TOOLKIT_API Dali::Accessibility::Accessible *GetBoundAccessibilityObject( Dali::Actor control );
+DALI_TOOLKIT_API Dali::Accessibility::Accessible* GetBoundAccessibilityObject(Dali::Actor control);
} // namespace DevelControl
namespace Dali
{
-
class WebEngineBackForwardListItem;
namespace Toolkit
{
-
/**
* @addtogroup dali_toolkit_controls_web_view
* @{
/**
* @brief Creates a WebBackForwardListItem.
*/
- WebBackForwardListItem( const Dali::WebEngineBackForwardListItem* item );
+ WebBackForwardListItem(const Dali::WebEngineBackForwardListItem* item);
/**
* @brief Destructor.
std::string GetOriginalUrl() const;
private:
-
const Dali::WebEngineBackForwardListItem* mWebEngineBackForwardListItem;
};
#define DALI_TOOLKIT_WEB_BACK_FORWARD_LIST_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 Dali
{
-
class WebEngineBackForwardList;
namespace Toolkit
/**
* @brief Creates a WebBackForwardList.
*/
- WebBackForwardList( const Dali::WebEngineBackForwardList& list );
+ WebBackForwardList(const Dali::WebEngineBackForwardList& list);
/**
* @brief Destructor.
uint32_t GetItemCount() const;
private:
- const Dali::WebEngineBackForwardList& mWebEngineBackForwardList;
+ const Dali::WebEngineBackForwardList& mWebEngineBackForwardList;
Dali::Toolkit::WebBackForwardListItem mWebBackForwardListItem;
-
};
/**
#define DALI_TOOLKIT_WEB_CONTEXT_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.
*/
// EXTERNAL INCLUDES
-#include <string>
#include <dali/devel-api/adaptor-framework/web-engine-context.h>
+#include <string>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/dali-toolkit-common.h>
namespace Dali
{
-
namespace Toolkit
{
-
/**
* @addtogroup dali_toolkit_controls_web_view
* @{
class DALI_TOOLKIT_API WebContext
{
public:
-
/**
* @brief Creates a WebContext.
*
* @param[in] context The context of web engine.
*/
- WebContext( Dali::WebEngineContext& context );
+ WebContext(Dali::WebEngineContext& context);
/**
* @brief Destructor.
*
* @param[in] cacheModel The cache model
*/
- void SetCacheModel(Dali::WebEngineContext::CacheModel cacheModel );
+ void SetCacheModel(Dali::WebEngineContext::CacheModel cacheModel);
/**
* @brief Sets the given proxy URI to network backend of specific context.
*
* @param[in] uri The proxy URI to set
*/
- void SetProxyUri( const std::string& uri );
+ void SetProxyUri(const std::string& uri);
/**
* Adds CA certificates to persistent NSS certificate database
*
* @param[in] certificatePath path to a CA certificate file(s), see above for details
*/
- void SetCertificateFilePath( const std::string& certificatePath );
+ void SetCertificateFilePath(const std::string& certificatePath);
/**
* Toggles the cache to be enabled or disabled
*
* @param[in] cacheDisabled enable or disable cache
*/
- void DisableCache( bool cacheDisabled );
+ void DisableCache(bool cacheDisabled);
/**
* @brief Sets a proxy auth credential to network backend of specific context.
* @param[in] username username to set
* @param[in] password password to set
*/
- void SetDefaultProxyAuth( const std::string& username, const std::string& password );
+ void SetDefaultProxyAuth(const std::string& username, const std::string& password);
/**
* Requests for deleting all web databases.
void ClearCache();
private:
-
- Dali::WebEngineContext& mWebEngineContext;
+ Dali::WebEngineContext& mWebEngineContext;
};
/**
#define DALI_TOOLKIT_WEB_COOKIE_MANAGER_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.
*/
// EXTERNAL INCLUDES
-#include <string>
#include <dali/devel-api/adaptor-framework/web-engine-cookie-manager.h>
+#include <string>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/dali-toolkit-common.h>
namespace Toolkit
{
-
/**
* @addtogroup dali_toolkit_controls_web_view
* @{
class DALI_TOOLKIT_API WebCookieManager
{
public:
-
/**
* @brief Creates a WebCookieManager.
* @param[in] manager A #Dali::WebEngineCookieManager
*/
- WebCookieManager( Dali::WebEngineCookieManager& manager );
+ WebCookieManager(Dali::WebEngineCookieManager& manager);
/**
* @brief Destructor.
*
* @param[in] policy A #Dali::WebEngineCookieManager::CookieAcceptPolicy
*/
- void SetCookieAcceptPolicy(Dali::WebEngineCookieManager::CookieAcceptPolicy policy );
+ void SetCookieAcceptPolicy(Dali::WebEngineCookieManager::CookieAcceptPolicy policy);
/**
* @brief Gets the cookie acceptance policy. The default is Toolkit::WebCookieManager::CookieAcceptPolicy::NO_THIRD_PARTY.
* @param[in] path The path where to read/write Cookies
* @param[in] storage The type of storage
*/
- void SetPersistentStorage( const std::string& path, Dali::WebEngineCookieManager::CookiePersistentStorage storage );
+ void SetPersistentStorage(const std::string& path, Dali::WebEngineCookieManager::CookiePersistentStorage storage);
private:
-
- Dali::WebEngineCookieManager& mWebEngineCookieManager;
+ Dali::WebEngineCookieManager& mWebEngineCookieManager;
};
/**
#define DALI_TOOLKIT_WEB_SETTINGS_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 Toolkit
{
-
/**
* @addtogroup dali_toolkit_controls_web_view
* @{
*
* @param[in] settings A settings of web engine.
*/
- WebSettings( Dali::WebEngineSettings& settings );
+ WebSettings(Dali::WebEngineSettings& settings);
/**
* @brief Destructor.
* @param[in] allowed if true, allow to run mixed contents,
* otherwise not allow
*/
- void AllowMixedContents( bool allowed );
+ void AllowMixedContents(bool allowed);
/**
* @brief Enable the spatial navigation or not.
* @param[in] enabled if true, use spatial navigation,
* otherwise to disable
*/
- void EnableSpatialNavigation( bool enabled );
+ void EnableSpatialNavigation(bool enabled);
/**
* @brief Returns the default font size in pixel. The default value is 16.
*
* @param[in] defaultFontSize A new default font size to set
*/
- void SetDefaultFontSize( int defaultFontSize );
+ void SetDefaultFontSize(int defaultFontSize);
/**
* @brief Enables/disables web security.
* @param[in] enabled if true, to enable the web security
* otherwise to disable
*/
- void EnableWebSecurity( bool enabled );
+ void EnableWebSecurity(bool enabled);
/**
* @brief Allow/Disallow file access from external url
* @param[in] allowed if true, to allow file access from external url
* otherwise to disallow
*/
- void AllowFileAccessFromExternalUrl( bool allowed );
+ void AllowFileAccessFromExternalUrl(bool allowed);
/**
* @brief Returns whether JavaScript can be executable. The default is true.
*
* @param[in] enabled True if JavaScript executing is enabled, false otherwise
*/
- void EnableJavaScript( bool enabled );
+ void EnableJavaScript(bool enabled);
/**
* @brief Allow if the scripts can open new windows.
* @param[in] allowed if true, the scripts can open new windows,
* otherwise not
*/
- void AllowScriptsOpenWindows( bool allowed );
+ void AllowScriptsOpenWindows(bool allowed);
/**
* @brief Returns whether images can be loaded automatically. The default is true.
*
* @param[in] automatic True if images are loaded automatically, false otherwise
*/
- void AllowImagesLoadAutomatically( bool automatic );
+ void AllowImagesLoadAutomatically(bool automatic);
/**
* @brief Gets the default text encoding name (e.g. UTF-8).
*
* @param[in] defaultTextEncodingName The default text encoding name
*/
- void SetDefaultTextEncodingName( const std::string& defaultTextEncodingName );
+ void SetDefaultTextEncodingName(const std::string& defaultTextEncodingName);
private:
Dali::WebEngineSettings& mWebEngineSettings;
#define DALI_TOOLKIT_WEB_VIEW_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.
#include <functional>
// INTERNAL INCLUDES
-#include <dali/devel-api/adaptor-framework/web-engine-plugin.h>
#include <dali-toolkit/public-api/controls/control.h>
+#include <dali/devel-api/adaptor-framework/web-engine-plugin.h>
namespace Dali
{
class DALI_TOOLKIT_API WebView : public Control
{
public:
-
/**
* @brief Enumeration for the start and end property ranges for this control.
*/
*/
enum class LoadErrorCode
{
- UNKNOWN = 0, ///< Unknown.
- CANCELED, ///< User canceled.
- CANT_SUPPORT_MIMETYPE, ///< Can't show the page for this MIME type.
- FAILED_FILE_IO, ///< File IO error.
- CANT_CONNECT, ///< Cannot connect to the network.
- CANT_LOOKUP_HOST, ///< Fail to look up host from the DNS.
- FAILED_TLS_HANDSHAKE, ///< Fail to SSL/TLS handshake.
- INVALID_CERTIFICATE, ///< Received certificate is invalid.
- REQUEST_TIMEOUT, ///< Connection timeout.
- TOO_MANY_REDIRECTS, ///< Too many redirects.
- TOO_MANY_REQUESTS, ///< Too many requests during this load.
- BAD_URL, ///< Malformed URL.
- UNSUPPORTED_SCHEME, ///< Unsupported scheme.
- AUTHENTICATION, ///< User authentication failed on the server.
- INTERNAL_SERVER ///< Web server has an internal server error.
+ UNKNOWN = 0, ///< Unknown.
+ CANCELED, ///< User canceled.
+ CANT_SUPPORT_MIMETYPE, ///< Can't show the page for this MIME type.
+ FAILED_FILE_IO, ///< File IO error.
+ CANT_CONNECT, ///< Cannot connect to the network.
+ CANT_LOOKUP_HOST, ///< Fail to look up host from the DNS.
+ FAILED_TLS_HANDSHAKE, ///< Fail to SSL/TLS handshake.
+ INVALID_CERTIFICATE, ///< Received certificate is invalid.
+ REQUEST_TIMEOUT, ///< Connection timeout.
+ TOO_MANY_REDIRECTS, ///< Too many redirects.
+ TOO_MANY_REQUESTS, ///< Too many requests during this load.
+ BAD_URL, ///< Malformed URL.
+ UNSUPPORTED_SCHEME, ///< Unsupported scheme.
+ AUTHENTICATION, ///< User authentication failed on the server.
+ INTERNAL_SERVER ///< Web server has an internal server error.
};
/**
* @brief WebView signal type related with page loading.
*/
- using WebViewPageLoadSignalType = Signal< void( WebView, const std::string& ) >;
+ using WebViewPageLoadSignalType = Signal<void(WebView, const std::string&)>;
/**
* @brief WebView signal type related with page loading error.
*/
- using WebViewPageLoadErrorSignalType = Signal< void( WebView, const std::string&, LoadErrorCode ) >;
+ using WebViewPageLoadErrorSignalType = Signal<void(WebView, const std::string&, LoadErrorCode)>;
/**
* @brief WebView signal type related with scroll edge reached.
*/
- using WebViewScrollEdgeReachedSignalType = Signal< void( WebView, Dali::WebEnginePlugin::ScrollEdge ) >;
+ using WebViewScrollEdgeReachedSignalType = Signal<void(WebView, Dali::WebEnginePlugin::ScrollEdge)>;
public:
/**
* @param [in] argc The count of arguments of Applications
* @param [in] argv The string array of arguments of Applications
*/
- static WebView New( int argc, char** argv );
+ static WebView New(int argc, char** argv);
/**
* @brief Creates an uninitialized WebView.
* @param[in] deltaX The delta x of scroll
* @param[in] deltaY The delta y of scroll
*/
- void ScrollBy( int deltaX, int deltaY );
+ void ScrollBy(int deltaX, int deltaY);
/**
* @brief Returns whether forward is possible.
#define DALI_TOOLKIT_LAYOUTING_FLEX_NODE_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.
* @note int, height measure specification mode
* @note SizeTuple, return value
*/
-using MeasureCallback = void (*)(Dali::Actor, float , int , float , int, SizeTuple *);
+using MeasureCallback = void (*)(Dali::Actor, float, int, float, int, SizeTuple*);
/**
* This class provides the API for calling into the Flex layout implementation.
*/
// EXTERNAL INCLUDES
-#include <string.h>
#include <dali/public-api/actors/actor.h>
#include <dali/public-api/math/vector2.h>
#include <dali/public-api/object/property-map.h>
+#include <string.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/dali-toolkit-common.h>
* @param[in] displacement The direction of the central line
* @param[in] initialProgress The normalised initial progress of the shader
*/
-DALI_TOOLKIT_API void DissolveEffectSetCentralLine( Actor& actor, const Vector2& position, const Vector2& displacement, float initialProgress );
+DALI_TOOLKIT_API void DissolveEffectSetCentralLine(Actor& actor, const Vector2& position, const Vector2& displacement, float initialProgress);
/**
* @brief Create a new Dissolve effect
* @return The newly created Property::Map with the dissolve effect
*/
-DALI_TOOLKIT_API Property::Map CreateDissolveEffect( bool useHighPrecision = true);
+DALI_TOOLKIT_API Property::Map CreateDissolveEffect(bool useHighPrecision = true);
} // namespace Toolkit
* @param[in] actor The actor that registers the uniform properties
* @param[in] numBlurSamples Number of samples used by the shader
*/
-DALI_TOOLKIT_API void SetMotionBlurProperties( Actor& actor, unsigned int numBlurSamples = 8 );
+DALI_TOOLKIT_API void SetMotionBlurProperties(Actor& actor, unsigned int numBlurSamples = 8);
/**
* @brief Create a new MotionBlurEffect
/**
* @brief Set the properties for the motion stretch
*/
-DALI_TOOLKIT_API void SetMotionStretchProperties( Actor& actor );
+DALI_TOOLKIT_API void SetMotionStretchProperties(Actor& actor);
/**
* @brief Creates a new MotionStretchEffect
#define DALI_TOOLKIT_TEXT_UTILS_DEVEL_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.
//
float minLineSize; ///< The line's minimum size (in points).
- Extents padding; ///< The padding of the boundaries where the text is going to be laid-out.
+ Extents padding; ///< The padding of the boundaries where the text is going to be laid-out.
};
/**
#define DALI_TOOLKIT_INTERNAL_ACCESSIBILITY_MANAGER_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.
*/
// EXTERNAL INCLUDES
+#include <dali/public-api/object/base-object.h>
#include <string>
#include <vector>
-#include <dali/public-api/object/base-object.h>
// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/accessibility-manager/accessibility-manager.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
class AccessibilityManager;
/**
class AccessibilityManager : public Dali::BaseObject, public Dali::ConnectionTracker
{
public:
-
typedef Dali::Toolkit::AccessibilityManager::AccessibilityActionSignalType AccessibilityActionSignalType;
typedef Dali::Toolkit::AccessibilityManager::AccessibilityActionScrollSignalType AccessibilityActionScrollSignalType;
Actor GetFocusIndicatorActor();
public:
-
/**
* @copydoc Toolkit::AccessibilityManager::FocusChangedSignal()
*/
*/
Toolkit::AccessibilityManager::FocusedActorActivatedSignalType& FocusedActorActivatedSignal();
-public: // Signals
-
+public: // Signals
/**
* @copydoc Dali::Toolkit::AccessibilityManager::StatusChangedSignal
*/
}
protected:
-
/**
* Destructor
*/
virtual ~AccessibilityManager();
private:
-
// Undefined
AccessibilityManager(const AccessibilityManager&);
AccessibilityManager& operator=(const AccessibilityManager& rhs);
private:
-
std::vector<Actor> mFocusOrder;
- Toolkit::AccessibilityManager::FocusChangedSignalType mFocusChangedSignal; ///< The signal to notify the focus change
- Toolkit::AccessibilityManager::FocusOvershotSignalType mFocusOvershotSignal; ///< The signal to notify the focus overshooted
+ Toolkit::AccessibilityManager::FocusChangedSignalType mFocusChangedSignal; ///< The signal to notify the focus change
+ Toolkit::AccessibilityManager::FocusOvershotSignalType mFocusOvershotSignal; ///< The signal to notify the focus overshooted
Toolkit::AccessibilityManager::FocusedActorActivatedSignalType mFocusedActorActivatedSignal; ///< The signal to notify the activation of focused actor
// Action signals.
#define DALI_TOOLKIT_BUILDER_DECLARATIONS_H
/*
- * Copyright (c) 2019 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.
// EXTERNAL INCLUDES
#include <dali/public-api/common/extents.h>
+#include <dali/public-api/math/matrix.h>
+#include <dali/public-api/math/matrix3.h>
#include <dali/public-api/math/rect.h>
#include <dali/public-api/math/vector2.h>
#include <dali/public-api/math/vector3.h>
#include <dali/public-api/math/vector4.h>
-#include <dali/public-api/math/matrix.h>
-#include <dali/public-api/math/matrix3.h>
// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/builder/tree-node.h>
typedef Dali::Toolkit::TreeNode TreeNode;
typedef TreeNode::ConstIterator TreeConstIter;
-typedef OptionalValue<const TreeNode&> OptionalChild;
-typedef OptionalValue<std::string> OptionalString;
-typedef OptionalValue<float> OptionalFloat;
-typedef OptionalValue<int> OptionalInteger;
-typedef OptionalValue<unsigned int> OptionalUnsignedInt;
-typedef OptionalValue<bool> OptionalBoolean;
-typedef OptionalValue<Dali::Vector2> OptionalVector2;
-typedef OptionalValue<Dali::Vector3> OptionalVector3;
-typedef OptionalValue<Dali::Vector4> OptionalVector4;
-typedef OptionalValue<std::string> OptionalString;
-typedef OptionalValue<Dali::Matrix> OptionalMatrix;
-typedef OptionalValue<Dali::Matrix3> OptionalMatrix3;
+typedef OptionalValue<const TreeNode&> OptionalChild;
+typedef OptionalValue<std::string> OptionalString;
+typedef OptionalValue<float> OptionalFloat;
+typedef OptionalValue<int> OptionalInteger;
+typedef OptionalValue<unsigned int> OptionalUnsignedInt;
+typedef OptionalValue<bool> OptionalBoolean;
+typedef OptionalValue<Dali::Vector2> OptionalVector2;
+typedef OptionalValue<Dali::Vector3> OptionalVector3;
+typedef OptionalValue<Dali::Vector4> OptionalVector4;
+typedef OptionalValue<std::string> OptionalString;
+typedef OptionalValue<Dali::Matrix> OptionalMatrix;
+typedef OptionalValue<Dali::Matrix3> OptionalMatrix3;
typedef OptionalValue<Dali::Rect<int> > OptionalRect;
-typedef OptionalValue<Dali::Extents> OptionalExtents;
+typedef OptionalValue<Dali::Extents> OptionalExtents;
#endif // DALI_TOOLKIT_BUILDER_DECLARATIONS_H
#define DALI_TOOLKIT_INTERNAL_BUILDER_FILESYSTEM_H
/*
- * Copyright (c) 2019 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.
*/
// EXTERNAL INCLUDES
-#include <string>
#include <fstream>
#include <sstream>
+#include <string>
#include <stdio.h>
#include <dali/devel-api/adaptor-framework/file-loader.h>
-inline std::string GetFileContents(const std::string &fn)
+inline std::string GetFileContents(const std::string& fn)
{
- std::streampos bufferSize = 0;
+ std::streampos bufferSize = 0;
Dali::Vector<char> fileBuffer;
- if( !Dali::FileLoader::ReadFile( fn, bufferSize, fileBuffer, Dali::FileLoader::FileType::BINARY ) )
+ if(!Dali::FileLoader::ReadFile(fn, bufferSize, fileBuffer, Dali::FileLoader::FileType::BINARY))
{
- return std::string();
+ return std::string();
}
- return std::string( &fileBuffer[0], bufferSize );
+ return std::string(&fileBuffer[0], bufferSize);
}
#endif // DALI_TOOLKIT_INTERNAL_BUILDER_FILESYSTEM_H
#define DALI_TOOLKIT_INTERNAL_BUILDER_GET_IS_INL
/*
- * Copyright (c) 2019 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.
inline OptionalChild IsChild(const TreeNode* node, const std::string& childName)
{
- if( node )
+ if(node)
{
const TreeNode* c = node->GetChild(childName);
- if( NULL != c )
+ if(NULL != c)
{
- return OptionalChild( *c );
+ return OptionalChild(*c);
}
else
{
inline OptionalChild IsChildIgnoreCase(const TreeNode* node, const std::string& childName)
{
- if( node )
+ if(node)
{
const TreeNode* c = node->GetChildIgnoreCase(childName);
- if( NULL != c )
+ if(NULL != c)
{
- return OptionalChild( *c );
+ return OptionalChild(*c);
}
else
{
inline OptionalString IsString(const OptionalChild& node)
{
- if( node && (*node).GetType() == TreeNode::STRING )
+ if(node && (*node).GetType() == TreeNode::STRING)
{
return OptionalString((*node).GetString());
}
{
OptionalFloat ret;
- if( node )
+ if(node)
{
- if( (*node).GetType() == TreeNode::FLOAT )
+ if((*node).GetType() == TreeNode::FLOAT)
{
ret = (*node).GetFloat();
}
- else if( (*node).GetType() == TreeNode::INTEGER )
+ else if((*node).GetType() == TreeNode::INTEGER)
{
// JSON has number not float/int but JsonParser discriminates.
// Here we don't care so we allow coercion
- ret = static_cast<float>( (*node).GetInteger() );
+ ret = static_cast<float>((*node).GetInteger());
}
}
return ret;
}
-inline OptionalInteger IsInteger(const OptionalChild &node)
+inline OptionalInteger IsInteger(const OptionalChild& node)
{
OptionalInteger ret;
- if( node )
+ if(node)
{
- if( (*node).GetType() == TreeNode::INTEGER )
+ if((*node).GetType() == TreeNode::INTEGER)
{
ret = (*node).GetInteger();
}
- else if( (*node).GetType() == TreeNode::FLOAT )
+ else if((*node).GetType() == TreeNode::FLOAT)
{
- ret = static_cast<int>( (*node).GetFloat() );
+ ret = static_cast<int>((*node).GetFloat());
}
}
inline OptionalBoolean IsBoolean(const OptionalChild& node)
{
- if( node && (*node).GetType() == TreeNode::BOOLEAN )
+ if(node && (*node).GetType() == TreeNode::BOOLEAN)
{
return OptionalBoolean(1 == (*node).GetInteger());
}
}
}
-
// copy N Numbers
-template <typename T>
+template<typename T>
inline bool CopyNumbers(TreeNode::ConstIterator iter, int N, T& vector)
{
for(int i = 0; i < N; ++i)
{
- if( (*iter).second.GetType() == TreeNode::FLOAT)
+ if((*iter).second.GetType() == TreeNode::FLOAT)
{
vector[i] = (*iter).second.GetFloat();
}
- else if( (*iter).second.GetType() == TreeNode::INTEGER )
+ else if((*iter).second.GetType() == TreeNode::INTEGER)
{
vector[i] = static_cast<float>((*iter).second.GetInteger());
}
{
OptionalVector4 ret;
- if( node && (TreeNode::ARRAY == (*node).GetType()) && (*node).Size() >= 4 )
+ if(node && (TreeNode::ARRAY == (*node).GetType()) && (*node).Size() >= 4)
{
Dali::Vector4 v;
- if( CopyNumbers((*node).CBegin(), 4, v) )
+ if(CopyNumbers((*node).CBegin(), 4, v))
{
ret = OptionalVector4(v);
}
{
OptionalVector3 ret;
- if( node && (TreeNode::ARRAY == (*node).GetType()) && (*node).Size() >= 3 )
+ if(node && (TreeNode::ARRAY == (*node).GetType()) && (*node).Size() >= 3)
{
Dali::Vector3 v;
- if( CopyNumbers((*node).CBegin(), 3, v) )
+ if(CopyNumbers((*node).CBegin(), 3, v))
{
ret = OptionalVector3(v);
}
{
OptionalVector2 ret;
- if( node && (TreeNode::ARRAY == (*node).GetType()) && (*node).Size() >= 2 )
+ if(node && (TreeNode::ARRAY == (*node).GetType()) && (*node).Size() >= 2)
{
Dali::Vector2 v;
- if( CopyNumbers((*node).CBegin(), 2, v) )
+ if(CopyNumbers((*node).CBegin(), 2, v))
{
ret = OptionalVector2(v);
}
return ret;
}
-inline OptionalMatrix IsMatrix(const OptionalChild &node)
+inline OptionalMatrix IsMatrix(const OptionalChild& node)
{
OptionalMatrix ret;
- if( node && (TreeNode::ARRAY == (*node).GetType()) && (*node).Size() >= 16 )
+ if(node && (TreeNode::ARRAY == (*node).GetType()) && (*node).Size() >= 16)
{
float v[16];
- if( CopyNumbers((*node).CBegin(), 16, v) )
+ if(CopyNumbers((*node).CBegin(), 16, v))
{
ret = OptionalMatrix(Dali::Matrix(v));
}
{
OptionalMatrix3 ret;
- if( node && (TreeNode::ARRAY == (*node).GetType()) && (*node).Size() >= 9 )
+ if(node && (TreeNode::ARRAY == (*node).GetType()) && (*node).Size() >= 9)
{
float v[9];
- if( CopyNumbers((*node).CBegin(), 9, v) )
+ if(CopyNumbers((*node).CBegin(), 9, v))
{
- ret = OptionalMatrix3(Dali::Matrix3(v[0], v[1], v[2],
- v[3], v[4], v[5],
- v[6], v[7], v[8] ));
+ ret = OptionalMatrix3(Dali::Matrix3(v[0], v[1], v[2], v[3], v[4], v[5], v[6], v[7], v[8]));
}
}
if((*node).Size() >= 4)
{
TreeNode::ConstIterator iter((*node).CBegin());
- int v[4];
- if( CopyNumbers((*node).CBegin(), 4, v) )
+ int v[4];
+ if(CopyNumbers((*node).CBegin(), 4, v))
{
ret = OptionalRect(Dali::Rect<int>(v[0], v[1], v[2], v[3]));
}
if((*node).Size() >= 4)
{
TreeNode::ConstIterator iter((*node).CBegin());
- int v[4];
- if( CopyNumbers((*node).CBegin(), 4, v) )
+ int v[4];
+ if(CopyNumbers((*node).CBegin(), 4, v))
{
extents = OptionalExtents(Dali::Extents(v[0], v[1], v[2], v[3]));
}
//
//
//
-inline OptionalString IsString( const TreeNode& parent, const std::string& childName)
+inline OptionalString IsString(const TreeNode& parent, const std::string& childName)
{
- return IsString( IsChild(&parent, childName) );
+ return IsString(IsChild(&parent, childName));
}
-inline OptionalFloat IsFloat( const TreeNode& parent, const std::string& childName)
+inline OptionalFloat IsFloat(const TreeNode& parent, const std::string& childName)
{
- return IsFloat( IsChild(&parent, childName) );
+ return IsFloat(IsChild(&parent, childName));
}
-inline OptionalInteger IsInteger( const TreeNode& parent, const std::string& childName)
+inline OptionalInteger IsInteger(const TreeNode& parent, const std::string& childName)
{
- return IsInteger( IsChild(&parent, childName) );
+ return IsInteger(IsChild(&parent, childName));
}
-inline OptionalBoolean IsBoolean( const TreeNode& parent, const std::string& childName)
+inline OptionalBoolean IsBoolean(const TreeNode& parent, const std::string& childName)
{
- return IsBoolean( IsChild(parent, childName) );
+ return IsBoolean(IsChild(parent, childName));
}
-inline OptionalVector4 IsVector4(const TreeNode &parent, const std::string& childName)
+inline OptionalVector4 IsVector4(const TreeNode& parent, const std::string& childName)
{
- return IsVector4( IsChild(parent, childName) );
+ return IsVector4(IsChild(parent, childName));
}
-inline OptionalVector3 IsVector3(const TreeNode &parent, const std::string& childName)
+inline OptionalVector3 IsVector3(const TreeNode& parent, const std::string& childName)
{
- return IsVector3( IsChild(parent, childName) );
+ return IsVector3(IsChild(parent, childName));
}
-inline OptionalVector2 IsVector2(const TreeNode &parent, const std::string& childName)
+inline OptionalVector2 IsVector2(const TreeNode& parent, const std::string& childName)
{
- return IsVector2( IsChild(parent, childName) );
+ return IsVector2(IsChild(parent, childName));
}
-inline OptionalMatrix IsMatrix(const TreeNode &parent, const std::string& childName)
+inline OptionalMatrix IsMatrix(const TreeNode& parent, const std::string& childName)
{
- return IsMatrix( IsChild(parent, childName) );
+ return IsMatrix(IsChild(parent, childName));
}
-inline OptionalMatrix3 IsMatrix3(const TreeNode &parent, const std::string& childName)
+inline OptionalMatrix3 IsMatrix3(const TreeNode& parent, const std::string& childName)
{
- return IsMatrix3( IsChild(&parent, childName) );
+ return IsMatrix3(IsChild(&parent, childName));
}
-inline OptionalRect IsRect(const TreeNode &parent, const std::string& childName)
+inline OptionalRect IsRect(const TreeNode& parent, const std::string& childName)
{
- return IsRect( IsChild(&parent, childName) );
+ return IsRect(IsChild(&parent, childName));
}
-inline OptionalExtents IsExtents(const TreeNode &parent, const std::string& childName)
+inline OptionalExtents IsExtents(const TreeNode& parent, const std::string& childName)
{
- return IsExtents( IsChild(&parent, childName) );
+ return IsExtents(IsChild(&parent, childName));
}
//
//
//
-inline OptionalString IsString( const TreeNode& node )
+inline OptionalString IsString(const TreeNode& node)
{
- return IsString( OptionalChild( node ) );
+ return IsString(OptionalChild(node));
}
-inline OptionalFloat IsFloat( const TreeNode& node )
+inline OptionalFloat IsFloat(const TreeNode& node)
{
- return IsFloat( OptionalChild( node ) );
+ return IsFloat(OptionalChild(node));
}
-inline OptionalInteger IsInteger( const TreeNode& node )
+inline OptionalInteger IsInteger(const TreeNode& node)
{
- return IsInteger( OptionalChild( node ) );
+ return IsInteger(OptionalChild(node));
}
-inline OptionalBoolean IsBoolean( const TreeNode& node )
+inline OptionalBoolean IsBoolean(const TreeNode& node)
{
- return IsBoolean( OptionalChild( node ) );
+ return IsBoolean(OptionalChild(node));
}
-inline OptionalVector4 IsVector4(const TreeNode &node )
+inline OptionalVector4 IsVector4(const TreeNode& node)
{
- return IsVector4( OptionalChild( node ) );
+ return IsVector4(OptionalChild(node));
}
-inline OptionalVector3 IsVector3(const TreeNode &node )
+inline OptionalVector3 IsVector3(const TreeNode& node)
{
- return IsVector3( OptionalChild( node ) );
+ return IsVector3(OptionalChild(node));
}
-inline OptionalVector2 IsVector2(const TreeNode &node )
+inline OptionalVector2 IsVector2(const TreeNode& node)
{
- return IsVector2( OptionalChild( node ) );
+ return IsVector2(OptionalChild(node));
}
-inline OptionalMatrix IsMatrix(const TreeNode &node )
+inline OptionalMatrix IsMatrix(const TreeNode& node)
{
- return IsMatrix( OptionalChild( node ) );
+ return IsMatrix(OptionalChild(node));
}
-inline OptionalMatrix3 IsMatrix3(const TreeNode &node )
+inline OptionalMatrix3 IsMatrix3(const TreeNode& node)
{
- return IsMatrix3( OptionalChild( node ) );
+ return IsMatrix3(OptionalChild(node));
}
-inline OptionalRect IsRect(const TreeNode &node )
+inline OptionalRect IsRect(const TreeNode& node)
{
- return IsRect( OptionalChild( node ) );
+ return IsRect(OptionalChild(node));
}
-inline OptionalExtents IsExtents(const TreeNode &node )
+inline OptionalExtents IsExtents(const TreeNode& node)
{
- return IsExtents( OptionalChild( node ) );
+ return IsExtents(OptionalChild(node));
}
//
//
//
-inline Dali::Vector4 GetVector4(const TreeNode &child)
+inline Dali::Vector4 GetVector4(const TreeNode& child)
{
- OptionalVector4 v( IsVector4( OptionalChild( child ) ) );
+ OptionalVector4 v(IsVector4(OptionalChild(child)));
DALI_ASSERT_ALWAYS(v);
return *v;
}
-inline Dali::Vector3 GetVector3(const TreeNode &child)
+inline Dali::Vector3 GetVector3(const TreeNode& child)
{
- OptionalVector3 v( IsVector3( OptionalChild( child ) ) );
+ OptionalVector3 v(IsVector3(OptionalChild(child)));
DALI_ASSERT_ALWAYS(v);
return *v;
}
-inline Dali::Vector2 GetVector2(const TreeNode &child)
+inline Dali::Vector2 GetVector2(const TreeNode& child)
{
- OptionalVector2 v( IsVector2( OptionalChild( child ) ) );
+ OptionalVector2 v(IsVector2(OptionalChild(child)));
DALI_ASSERT_ALWAYS(v);
return *v;
}
-inline float GetFloat(const TreeNode &child)
+inline float GetFloat(const TreeNode& child)
{
- OptionalFloat v( IsFloat( OptionalChild( child ) ) );
+ OptionalFloat v(IsFloat(OptionalChild(child)));
DALI_ASSERT_ALWAYS(v);
return *v;
}
-inline bool GetBoolean(const TreeNode &child)
+inline bool GetBoolean(const TreeNode& child)
{
- OptionalBoolean v( IsBoolean( OptionalChild( child ) ) );
+ OptionalBoolean v(IsBoolean(OptionalChild(child)));
DALI_ASSERT_ALWAYS(v);
return *v;
}
-inline int GetInteger(const TreeNode &child)
+inline int GetInteger(const TreeNode& child)
{
- OptionalInteger v( IsInteger( OptionalChild( child ) ) );
+ OptionalInteger v(IsInteger(OptionalChild(child)));
DALI_ASSERT_ALWAYS(v);
return *v;
}
-
-
#endif // DALI_TOOLKIT_INTERNAL_BUILDER_GET_IS_INL
#define DALI_TOOLKIT_INTERNAL_BUILDER_IMPL_DEBUG_H
/*
- * Copyright (c) 2016 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.
* limitations under the License.
*/
-#include <dali/integration-api/debug.h>
#include <dali-toolkit/devel-api/builder/json-parser.h>
+#include <dali/integration-api/debug.h>
-#if defined( DEBUG_ENABLED )
+#if defined(DEBUG_ENABLED)
namespace Dali
{
{
namespace Internal
{
-
-#define DUMP_PARSE_TREE(parser) LogTree(parser)
-#define DUMP_TEST_MAPPINGS(parser) \
- OptionalChild mappings = IsChild( parser.GetRoot(), KEYNAME_MAPPINGS ); \
- if( mappings ) \
- { \
- std::ostringstream oss; \
- oss << "Mappings: {" << std::endl; \
- for( TreeNode::ConstIterator iter = (*mappings).CBegin(); iter != (*mappings).CEnd(); ++iter ) \
- { \
- Property::Value value; \
- bool converted = GetPropertyMap(*mappings, (*iter).first, Property::NONE, value ); \
- if( converted ) \
- { \
- oss << " " << (*iter).first << ":" << value << std::endl; \
- } \
- } \
- oss << "}" << std::endl; \
- DALI_LOG_INFO( gFilterScript, Debug::Verbose, oss.str().c_str() ); \
+#define DUMP_PARSE_TREE(parser) LogTree(parser)
+#define DUMP_TEST_MAPPINGS(parser) \
+ OptionalChild mappings = IsChild(parser.GetRoot(), KEYNAME_MAPPINGS); \
+ if(mappings) \
+ { \
+ std::ostringstream oss; \
+ oss << "Mappings: {" << std::endl; \
+ for(TreeNode::ConstIterator iter = (*mappings).CBegin(); iter != (*mappings).CEnd(); ++iter) \
+ { \
+ Property::Value value; \
+ bool converted = GetPropertyMap(*mappings, (*iter).first, Property::NONE, value); \
+ if(converted) \
+ { \
+ oss << " " << (*iter).first << ":" << value << std::endl; \
+ } \
+ } \
+ oss << "}" << std::endl; \
+ DALI_LOG_INFO(gFilterScript, Debug::Verbose, oss.str().c_str()); \
}
+void LogTree(const Toolkit::JsonParser& mParser);
-void LogTree( const Toolkit::JsonParser& mParser );
-
-std::string PropertyValueToString( const Property::Value& value );
-
+std::string PropertyValueToString(const Property::Value& value);
-} // Internal
-} // Toolkit
-} // Dali
+} // namespace Internal
+} // namespace Toolkit
+} // namespace Dali
#else
#define DALI_TOOLKIT_INTERNAL_BUILDER_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.
*/
// EXTERNAL INCLUDES
-#include <string>
-#include <list>
-#include <map>
-#include <dali/public-api/common/vector-wrapper.h>
+#include <dali/integration-api/debug.h>
#include <dali/public-api/actors/actor.h>
+#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/object/base-object.h>
#include <dali/public-api/object/property-map.h>
#include <dali/public-api/render-tasks/render-task.h>
-#include <dali/integration-api/debug.h>
+#include <list>
+#include <map>
+#include <string>
// INTERNAL INCLUDES
-#include <dali-toolkit/devel-api/builder/json-parser.h>
#include <dali-toolkit/devel-api/builder/builder.h>
+#include <dali-toolkit/devel-api/builder/json-parser.h>
#include <dali-toolkit/internal/builder/builder-declarations.h>
#include <dali-toolkit/internal/builder/style.h>
// Warning messages usually displayed
#define DALI_SCRIPT_WARNING(format, ...) \
- DALI_LOG_WARNING("Script:" format, ## __VA_ARGS__)
+ DALI_LOG_WARNING("Script:" format, ##__VA_ARGS__)
// Info messages are usually debug build
#define DALI_SCRIPT_INFO(format, ...) \
- DALI_LOG_INFO(Dali::Toolkit::Internal::gFilterScript, Debug::General, "Script:" format, ## __VA_ARGS__)
+ DALI_LOG_INFO(Dali::Toolkit::Internal::gFilterScript, Debug::General, "Script:" format, ##__VA_ARGS__)
// Info Verbose need to be swiched on in gFilterScript filter constructor (by default set to General)
#define DALI_SCRIPT_VERBOSE(format, ...) \
- DALI_LOG_INFO(Dali::Toolkit::Internal::gFilterScript, Debug::Verbose, "Script:" format, ## __VA_ARGS__)
+ DALI_LOG_INFO(Dali::Toolkit::Internal::gFilterScript, Debug::Verbose, "Script:" format, ##__VA_ARGS__)
namespace Dali
{
-
namespace Toolkit
{
- class TreeNode;
+class TreeNode;
}
namespace Toolkit
{
-
namespace Internal
{
-
#if defined(DEBUG_ENABLED)
extern Dali::Integration::Log::Filter* gFilterScript;
#endif
class Builder : public Dali::BaseObject
{
public:
-
Builder();
/**
* @copydoc Toolkit::Builder::LoadFromString
*/
- void LoadFromString( const std::string &data,
- Dali::Toolkit::Builder::UIFormat rep = Dali::Toolkit::Builder::JSON );
+ void LoadFromString(const std::string& data,
+ Dali::Toolkit::Builder::UIFormat rep = Dali::Toolkit::Builder::JSON);
/**
* @copydoc Toolkit::Builder::AddConstants
*/
- void AddConstants( const Property::Map& map );
+ void AddConstants(const Property::Map& map);
/**
* @copydoc Toolkit::Builder::AddConstant
*/
- void AddConstant( const std::string& key, const Property::Value& value );
+ void AddConstant(const std::string& key, const Property::Value& value);
/**
* @copydoc Toolkit::Builder::GetConfigurations
/**
* @copydoc Toolkit::Builder::GetConstant
*/
- const Property::Value& GetConstant( const std::string& key ) const;
+ const Property::Value& GetConstant(const std::string& key) const;
/**
* @copydoc Toolkit::Builder::CreateAnimation( const std::string& animationName );
*/
- Animation CreateAnimation( const std::string& animationName );
+ Animation CreateAnimation(const std::string& animationName);
/**
* @copydoc Toolkit::Builder::CreateAnimation( const std::string& animationName, const Property::Map& map );
*/
- Animation CreateAnimation( const std::string& animationName, const Property::Map& map );
+ Animation CreateAnimation(const std::string& animationName, const Property::Map& map);
/**
* @copydoc Toolkit::Builder::CreateAnimation( const std::string&,Dali::Actor);
*/
- Animation CreateAnimation( const std::string& animationName, Dali::Actor sourceActor );
+ Animation CreateAnimation(const std::string& animationName, Dali::Actor sourceActor);
/**
* @copydoc Toolkit::Builder::CreateAnimation( const std::string&,const Property::Map&, Dali::Actor);
*/
- Animation CreateAnimation( const std::string& animationName, const Property::Map& map, Dali::Actor sourceActor );
+ Animation CreateAnimation(const std::string& animationName, const Property::Map& map, Dali::Actor sourceActor);
/**
* @copydoc Toolkit::Builder::Create( const std::string& templateName );
*/
- BaseHandle Create( const std::string& templateName );
+ BaseHandle Create(const std::string& templateName);
/**
* @copydoc Toolkit::Builder::Create( const std::string& templateName, const Property::Map& map );
*/
- BaseHandle Create( const std::string& templateName, const Property::Map& map );
+ BaseHandle Create(const std::string& templateName, const Property::Map& map);
/**
* @copydoc Toolkit::Builder::CreateFromJson( const std::string& json );
*/
- BaseHandle CreateFromJson( const std::string& json );
+ BaseHandle CreateFromJson(const std::string& json);
/**
* @copydoc Toolkit::Builder::ApplyFromJson( Handle& handle, const std::string& json );
*/
- bool ApplyFromJson( Handle& handle, const std::string& json );
+ bool ApplyFromJson(Handle& handle, const std::string& json);
/**
* @copydoc Toolkit::Builder::ApplyStyle
*/
- bool ApplyStyle( const std::string& styleName, Handle& handle );
+ bool ApplyStyle(const std::string& styleName, Handle& handle);
/**
* Lookup the stylename in builder. If it's found in the parse tree,
* @param[in] styleName The style name to search for
* @return true if the stylename exists
*/
- bool LookupStyleName( const std::string& styleName );
+ bool LookupStyleName(const std::string& styleName);
/**
* Lookup the stylename in the recorded Styles - if it exists,
* @param[in] styleName The stylename to search for
* @return A const pointer to the style object
*/
- const StylePtr GetStyle( const std::string& styleName );
+ const StylePtr GetStyle(const std::string& styleName);
/**
* @copydoc Toolkit::Builder::AddActors
*/
- void AddActors( Actor toActor );
+ void AddActors(Actor toActor);
/**
* @copydoc Toolkit::Builder::AddActors
*/
- void AddActors( const std::string §ionName, Actor toActor );
+ void AddActors(const std::string& sectionName, Actor toActor);
/**
* @copydoc Toolkit::Builder::CreateRenderTask
*/
- void CreateRenderTask( const std::string &name );
+ void CreateRenderTask(const std::string& name);
/**
* @copydoc Toolkit::Builder::GetPath
*/
- Path GetPath( const std::string &name );
+ Path GetPath(const std::string& name);
/**
* @copydoc Toolkit::Builder::GetPathConstrainer
*/
- Dali::PathConstrainer GetPathConstrainer( const std::string& name );
+ Dali::PathConstrainer GetPathConstrainer(const std::string& name);
/*
* Check if a given constrainer is of type PathConstrainer
* @return True if constainer is of type PathConstrainer, False otherwise
*
*/
- bool IsPathConstrainer( const std::string& name );
+ bool IsPathConstrainer(const std::string& name);
/**
* @copydoc Toolkit::Builder::GetLinearConstrainer
*/
- Dali::LinearConstrainer GetLinearConstrainer( const std::string& name );
+ Dali::LinearConstrainer GetLinearConstrainer(const std::string& name);
/*
* Check if a given constrainer is of type LinearConstrainer
* @return True if constainer is of type LinearConstrainer, False otherwise
*
*/
- bool IsLinearConstrainer( const std::string& name );
+ bool IsLinearConstrainer(const std::string& name);
/**
* @copydoc Toolkit::Builder::QuitSignal
*/
void EmitQuitSignal();
-
protected:
-
~Builder() override;
private:
- typedef std::vector<const char*> KeyStack;
- typedef std::vector< TreeNode::KeyNodePair > MappingsLut;
- typedef struct{ std::string name; Dali::LinearConstrainer linearConstrainer; } LinearConstrainerEntry;
+ typedef std::vector<const char*> KeyStack;
+ typedef std::vector<TreeNode::KeyNodePair> MappingsLut;
+ typedef struct
+ {
+ std::string name;
+ Dali::LinearConstrainer linearConstrainer;
+ } LinearConstrainerEntry;
typedef std::vector<LinearConstrainerEntry> LinearConstrainerLut;
- typedef struct{ std::string name; Dali::PathConstrainer pathConstrainer; } PathConstrainerEntry;
+ typedef struct
+ {
+ std::string name;
+ Dali::PathConstrainer pathConstrainer;
+ } PathConstrainerEntry;
typedef std::vector<PathConstrainerEntry> PathConstrainerLut;
typedef std::map<const std::string, Path> PathLut;
// Undefined
Builder& operator=(const Builder& rhs);
- void LoadConstants( const TreeNode& root, Property::Map& intoMap );
-
- void LoadConfiguration( const TreeNode& root, Property::Map& intoMap );
+ void LoadConstants(const TreeNode& root, Property::Map& intoMap);
- Animation CreateAnimation( const std::string& animationName,
- const Replacement& replacement,
- Dali::Actor sourceActor );
+ void LoadConfiguration(const TreeNode& root, Property::Map& intoMap);
- BaseHandle Create( const std::string& templateName,
- const Replacement& constant );
+ Animation CreateAnimation(const std::string& animationName,
+ const Replacement& replacement,
+ Dali::Actor sourceActor);
- BaseHandle DoCreate( const TreeNode& root,
- const TreeNode& node,
- Actor parent,
- const Replacement& replacements );
+ BaseHandle Create(const std::string& templateName,
+ const Replacement& constant);
- void SetupTask( RenderTask& task,
- const Toolkit::TreeNode& node,
- const Replacement& replacement );
+ BaseHandle DoCreate(const TreeNode& root,
+ const TreeNode& node,
+ Actor parent,
+ const Replacement& replacements);
- bool ApplyStyle( const std::string& styleName,
- Handle& handle,
- const Replacement& replacement);
+ void SetupTask(RenderTask& task,
+ const Toolkit::TreeNode& node,
+ const Replacement& replacement);
- void ApplyAllStyleProperties( const TreeNode& root,
- const TreeNode& node,
- Dali::Handle& handle,
- const Replacement& constant );
+ bool ApplyStyle(const std::string& styleName,
+ Handle& handle,
+ const Replacement& replacement);
- void RecordStyles( const char* styleName,
- const TreeNode& node,
- Dali::Handle& handle,
- const Replacement& replacements );
+ void ApplyAllStyleProperties(const TreeNode& root,
+ const TreeNode& node,
+ Dali::Handle& handle,
+ const Replacement& constant);
- void RecordStyle( StylePtr style,
+ void RecordStyles(const char* styleName,
const TreeNode& node,
Dali::Handle& handle,
- const Replacement& replacements );
+ const Replacement& replacements);
- void RecordTransitions( const TreeNode::KeyNodePair& keyValue,
- Property::Array& transitions,
- const Replacement& replacements );
+ void RecordStyle(StylePtr style,
+ const TreeNode& node,
+ Dali::Handle& handle,
+ const Replacement& replacements);
- void RecordTransitionData( const TreeNode::KeyNodePair& keyNode,
- Toolkit::TransitionData& transitionData,
- const Replacement& replacements );
+ void RecordTransitions(const TreeNode::KeyNodePair& keyValue,
+ Property::Array& transitions,
+ const Replacement& replacements);
- void ApplyProperties( const TreeNode& root,
- const TreeNode& node,
- Dali::Handle& handle,
- const Replacement& constant );
+ void RecordTransitionData(const TreeNode::KeyNodePair& keyNode,
+ Toolkit::TransitionData& transitionData,
+ const Replacement& replacements);
- void ApplySignals( const TreeNode& root,
- const TreeNode& node,
- Dali::Handle& handle );
+ void ApplyProperties(const TreeNode& root,
+ const TreeNode& node,
+ Dali::Handle& handle,
+ const Replacement& constant);
- void ApplyStylesByActor( const TreeNode& root,
- const TreeNode& node,
- Dali::Handle& handle,
- const Replacement& constant );
+ void ApplySignals(const TreeNode& root,
+ const TreeNode& node,
+ Dali::Handle& handle);
- void SetProperties( const TreeNode& node,
- Handle& handle,
- const Replacement& constant );
+ void ApplyStylesByActor(const TreeNode& root,
+ const TreeNode& node,
+ Dali::Handle& handle,
+ const Replacement& constant);
- bool MapToTargetProperty( Handle& propertyObject,
- const std::string& key,
- const TreeNode& node,
- const Replacement& constant,
- Property::Index& index,
- Property::Value& value );
+ void SetProperties(const TreeNode& node,
+ Handle& handle,
+ const Replacement& constant);
+
+ bool MapToTargetProperty(Handle& propertyObject,
+ const std::string& key,
+ const TreeNode& node,
+ const Replacement& constant,
+ Property::Index& index,
+ Property::Value& value);
/**
* Find the key in the mapping table, if it's present, then generate
* @param[in] propertyType The property type if known, or NONE
* @param[in,out] value The string value to test and write back to.
*/
- bool GetPropertyMap( const TreeNode& mappingRoot,
- const char* theKey,
- Property::Type propertyType,
- Property::Value& value );
+ bool GetPropertyMap(const TreeNode& mappingRoot,
+ const char* theKey,
+ Property::Type propertyType,
+ Property::Value& value);
- void SetCustomProperties( const TreeNode& node,
- Handle& handle,
- const Replacement& constant,
- const std::string& childName,
- Property::AccessMode accessMode );
+ void SetCustomProperties(const TreeNode& node,
+ Handle& handle,
+ const Replacement& constant,
+ const std::string& childName,
+ Property::AccessMode accessMode);
/**
* Find the key in the mapping table, if it's present, then generate
* @param[in] propertyType The property type if known, or NONE
* @param[in,out] value The string value to test and write back to.
*/
- bool RecursePropertyMap( const TreeNode& mappingRoot,
- KeyStack& keyStack,
- const char* theKey,
- Property::Type propertyType,
- Property::Value& value );
-
+ bool RecursePropertyMap(const TreeNode& mappingRoot,
+ KeyStack& keyStack,
+ const char* theKey,
+ Property::Type propertyType,
+ Property::Value& value);
/**
* Tests if the value is a string delimited by <>. If it is, then it attempts to
* @param[in,out] value The string value to test and write back to.
* @return true if the value was converted, false otherwise.
*/
- bool ConvertChildValue( const TreeNode& mappingRoot,
- KeyStack& keyStack,
- Property::Value& value );
+ bool ConvertChildValue(const TreeNode& mappingRoot,
+ KeyStack& keyStack,
+ Property::Value& value);
private:
Toolkit::JsonParser mParser;
#define DALI_TOOLKIT_INTERNAL_BUILDER_SET_PROPERTY_H
/*
- * Copyright (c) 2016 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
{
-
/**
* Set a property value from a tree node.
* This function determines the type of the property from the format of the string in the node.
* @param node The node string to convert from
* @param value The property value to set
*/
-void DeterminePropertyFromNode( const TreeNode& node,
- Property::Value& value );
+void DeterminePropertyFromNode(const TreeNode& node,
+ Property::Value& value);
/**
* Set a property value from a tree node as DeterminePropertyFromNode() above
* @param value The property value to set
* @param replacement The overriding replacement map (if any)
*/
-void DeterminePropertyFromNode( const TreeNode& node,
- Property::Value& value,
- const Replacement& replacement );
+void DeterminePropertyFromNode(const TreeNode& node,
+ Property::Value& value,
+ const Replacement& replacement);
/**
* Set a property value as the given type from a tree node.
* @param value The property value to set
* @return true if the string could be converted to the correct type.
*/
-bool DeterminePropertyFromNode( const TreeNode& node,
- Property::Type type,
- Property::Value& value );
+bool DeterminePropertyFromNode(const TreeNode& node,
+ Property::Type type,
+ Property::Value& value);
/**
* Set a property value as the given type from a tree node as DeterminePropertyFromNode() above
* @param replacement The overriding replacement map (if any)
* @return true if the string could be converted to the correct type.
*/
-bool DeterminePropertyFromNode( const TreeNode& node,
- Property::Type type,
- Property::Value& value,
- const Replacement& replacement );
-
+bool DeterminePropertyFromNode(const TreeNode& node,
+ Property::Type type,
+ Property::Value& value,
+ const Replacement& replacement);
-} // Internal namespace
-} // Toolkit namespace
-} // Dali namespace
+} // namespace Internal
+} // namespace Toolkit
+} // namespace Dali
#endif //DALI_TOOLKIT_INTERNAL_BUILDER_SET_PROPERTY_H
#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
#define DALI_JSON_PARSER_IMPL_H
/*
- * Copyright (c) 2019 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.
*/
// EXTERNAL INCLUDES
-#include <string>
-#include <list>
#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/object/base-object.h>
+#include <list>
+#include <string>
// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/builder/json-parser.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
/*
* Parses JSON
*/
void Write(std::ostream& output, int indent) const;
private:
- typedef std::vector<char> VectorChar;
+ typedef std::vector<char> VectorChar;
typedef VectorChar::iterator VectorCharIter;
- typedef std::list<VectorChar> SourceContainer;
+ typedef std::list<VectorChar> SourceContainer;
typedef std::list<VectorChar>::iterator SourceContainerIter;
- JsonParser(JsonParser &);
+ JsonParser(JsonParser&);
JsonParser& operator=(const JsonParser&);
- SourceContainer mSources; ///< List of strings from Parse() merge operations
-
- TreeNode* mRoot; ///< Tree root
+ SourceContainer mSources; ///< List of strings from Parse() merge operations
- const char *mErrorDescription; ///< Last parse error description
- int mErrorPosition; ///< Last parse error position
- int mErrorLine; ///< Last parse error line
- int mErrorColumn; ///< Last parse error column
+ TreeNode* mRoot; ///< Tree root
- int mNumberOfChars; ///< The size of string data for all nodes
- int mNumberOfNodes; ///< Node count
+ const char* mErrorDescription; ///< Last parse error description
+ int mErrorPosition; ///< Last parse error position
+ int mErrorLine; ///< Last parse error line
+ int mErrorColumn; ///< Last parse error column
+ int mNumberOfChars; ///< The size of string data for all nodes
+ int mNumberOfNodes; ///< Node count
};
} // namespace Internal
-
inline const Internal::JsonParser& GetImplementation(const Toolkit::JsonParser& parser)
{
- DALI_ASSERT_ALWAYS( parser && "JsonParser handle is empty" );
+ DALI_ASSERT_ALWAYS(parser && "JsonParser handle is empty");
const BaseObject& handle = parser.GetBaseObject();
return static_cast<const Internal::JsonParser&>(handle);
}
-
inline Internal::JsonParser& GetImplementation(Toolkit::JsonParser& parser)
{
- DALI_ASSERT_ALWAYS( parser && "JsonParser handle is empty" );
+ DALI_ASSERT_ALWAYS(parser && "JsonParser handle is empty");
BaseObject& handle = parser.GetBaseObject();
} // namespace Dali
-
#endif // DALI_JSON_PARSER_IMPL_H
#define DALI_JSON_PARSE_STATE_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 Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
/**
* A safer std::advance()
*/
-template <typename IteratorType,typename EndIteratorType>
+template<typename IteratorType, typename EndIteratorType>
inline int AdvanceIter(IteratorType& iter, EndIteratorType& end, int n)
{
- for(int i =0; i < n; ++i)
+ for(int i = 0; i < n; ++i)
{
if(iter == end)
{
* Get the error description of the last parse
* @return The error description or NULL if no error
*/
- const char* GetErrorDescription() { return mErrorDescription; }
+ const char* GetErrorDescription()
+ {
+ return mErrorDescription;
+ }
/**
* Get the error line number
* @return The line number of the error
*/
- int GetErrorLineNumber() { return mErrorNewLine; }
+ int GetErrorLineNumber()
+ {
+ return mErrorNewLine;
+ }
/**
* Get the error column
* @return The error column
*/
- int GetErrorColumn() { return mErrorColumn; }
+ int GetErrorColumn()
+ {
+ return mErrorColumn;
+ }
/**
* Get the error position
* @return The error position
*/
- int GetErrorPosition() { return mErrorPosition; }
+ int GetErrorPosition()
+ {
+ return mErrorPosition;
+ }
/**
* Get the size of the string data that has been parsed
* @return The size of string data
*/
- int GetParsedStringSize() { return mNumberOfParsedChars; };
+ int GetParsedStringSize()
+ {
+ return mNumberOfParsedChars;
+ };
/**
* Get the number of nodes created
* @return The number of nodes
*/
- int GetCreatedNodeCount() { return mNumberOfCreatedNodes; };
+ int GetCreatedNodeCount()
+ {
+ return mNumberOfCreatedNodes;
+ };
private:
- VectorCharIter mIter; ///< Current position
- VectorCharIter mStart; ///< Start position
- VectorCharIter mEnd; ///< End of buffer being parsed
- TreeNode* mRoot; ///< Root node created
- TreeNodeManipulator mCurrent; ///< The Current modifiable node
- const char* mErrorDescription; ///< The error description if set
- int mErrorNewLine; ///< The error line number
- int mErrorColumn; ///< The error column
- int mErrorPosition; ///< The error position
- int mNumberOfParsedChars; ///< The size of string data
- int mNumberOfCreatedNodes; ///< The number of nodes created
- bool mFirstParse; ///< Flag if first parse
+ VectorCharIter mIter; ///< Current position
+ VectorCharIter mStart; ///< Start position
+ VectorCharIter mEnd; ///< End of buffer being parsed
+ TreeNode* mRoot; ///< Root node created
+ TreeNodeManipulator mCurrent; ///< The Current modifiable node
+ const char* mErrorDescription; ///< The error description if set
+ int mErrorNewLine; ///< The error line number
+ int mErrorColumn; ///< The error column
+ int mErrorPosition; ///< The error position
+ int mNumberOfParsedChars; ///< The size of string data
+ int mNumberOfCreatedNodes; ///< The number of nodes created
+ bool mFirstParse; ///< Flag if first parse
/**
* The current parse state
{
return Error("Attempt to walk up above root");
}
- mCurrent = TreeNodeManipulator( mCurrent.GetParent() );
+ mCurrent = TreeNodeManipulator(mCurrent.GetParent());
return true;
}
{
int c = AdvanceIter(mIter, mEnd, n);
mErrorPosition += c;
- mErrorColumn += c;
+ mErrorColumn += c;
}
/**
{
int c = AdvanceIter(mIter, mEnd, n);
mErrorPosition += c;
- mErrorColumn += c;
+ mErrorColumn += c;
return mEnd == mIter;
}
{
int c = AdvanceIter(mIter, mEnd, n);
mErrorPosition += c;
- mErrorColumn += c;
- static_cast<void>( ParseWhiteSpace() );
+ mErrorColumn += c;
+ static_cast<void>(ParseWhiteSpace());
}
/**
bool HandleCharacterComma(const char* name);
};
-
} // namespace Internal
} // namespace Toolkit
#define DALI_TOOLKIT_INTERNAL_BUILDER_OPTIONAL_H
/*
- * Copyright (c) 2019 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.
*
*/
-template <typename T>
+template<typename T>
struct OptionalTypes
{
- typedef T ValueType;
- typedef const T& ReturnType;
- static ReturnType Get(const ValueType& v) { return v; }
- static ValueType Set(const ReturnType v) { return v; }
- static bool Ok(const ValueType& v) { return true; }
+ typedef T ValueType;
+ typedef const T& ReturnType;
+ static ReturnType Get(const ValueType& v)
+ {
+ return v;
+ }
+ static ValueType Set(const ReturnType v)
+ {
+ return v;
+ }
+ static bool Ok(const ValueType& v)
+ {
+ return true;
+ }
};
-template <typename T>
+template<typename T>
struct OptionalTypes<T*>
{
- typedef T* ValueType;
- typedef const T* ReturnType;
- static ReturnType Get(const ValueType v) { return v; }
- static ValueType Set(const ReturnType v) { return v; }
- static bool Ok(const ReturnType v) { return NULL != v; }
+ typedef T* ValueType;
+ typedef const T* ReturnType;
+ static ReturnType Get(const ValueType v)
+ {
+ return v;
+ }
+ static ValueType Set(const ReturnType v)
+ {
+ return v;
+ }
+ static bool Ok(const ReturnType v)
+ {
+ return NULL != v;
+ }
};
-template <typename T>
+template<typename T>
struct OptionalTypes<T&>
{
- typedef T* ValueType;
- typedef const T& ReturnType;
- static ReturnType Get(const ValueType v) { return *v; }
- static ValueType Set(const ReturnType v) { return &v; }
- static bool Ok(const ReturnType v) { return true; }
+ typedef T* ValueType;
+ typedef const T& ReturnType;
+ static ReturnType Get(const ValueType v)
+ {
+ return *v;
+ }
+ static ValueType Set(const ReturnType v)
+ {
+ return &v;
+ }
+ static bool Ok(const ReturnType v)
+ {
+ return true;
+ }
};
-template <typename T>
+template<typename T>
class OptionalValue
{
public:
- typedef void ( OptionalValue::*bool_type )() const;
+ typedef void (OptionalValue::*bool_type)() const;
typedef typename OptionalTypes<T>::ReturnType ReturnType;
- typedef typename OptionalTypes<T>::ValueType ValueType;
+ typedef typename OptionalTypes<T>::ValueType ValueType;
- OptionalValue(): mOk(false), mValue() {}
- OptionalValue( T value ): mOk(OptionalTypes<T>::Ok(value)), mValue(OptionalTypes<T>::Set(value)) {}
- OptionalValue( bool b, T value ): mOk(b), mValue(OptionalTypes<T>::Set(value)) {}
+ OptionalValue()
+ : mOk(false),
+ mValue()
+ {
+ }
+ OptionalValue(T value)
+ : mOk(OptionalTypes<T>::Ok(value)),
+ mValue(OptionalTypes<T>::Set(value))
+ {
+ }
+ OptionalValue(bool b, T value)
+ : mOk(b),
+ mValue(OptionalTypes<T>::Set(value))
+ {
+ }
- ReturnType operator *() const { return OptionalTypes<T>::Get(mValue); }
+ ReturnType operator*() const
+ {
+ return OptionalTypes<T>::Get(mValue);
+ }
// safe bool idiom
- operator bool_type() const {
+ operator bool_type() const
+ {
return mOk == true ? &OptionalValue::this_type_does_not_support_comparisons : 0;
}
private:
- bool mOk;
+ bool mOk;
ValueType mValue;
- void this_type_does_not_support_comparisons() const {}
+ void this_type_does_not_support_comparisons() const
+ {
+ }
};
-template <typename T, typename U>
-bool operator==( const OptionalValue<T>& lhs, const OptionalValue<U>& rhs )
+template<typename T, typename U>
+bool operator==(const OptionalValue<T>& lhs, const OptionalValue<U>& rhs)
{
lhs.this_type_does_not_support_comparisons();
return false;
}
-template <typename T, typename U>
-bool operator!=( const OptionalValue<T>& lhs, const OptionalValue<U>& rhs )
+template<typename T, typename U>
+bool operator!=(const OptionalValue<T>& lhs, const OptionalValue<U>& rhs)
{
lhs.this_type_does_not_support_comparisons();
return false;
#define DALI_TOOLKIT_INTERNAL_BUILDER_REPLACEMENT_H
/*
- * Copyright (c) 2019 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 Dali
{
-
namespace Toolkit
{
- class TreeNode;
+class TreeNode;
}
namespace Toolkit
{
-
namespace Internal
{
-
/*
* Supports template replacement functionality
*
class Replacement
{
public:
-
/*
* Constructor
*/
* @param overrideMap The user overriding map
* @param defaultMap The default map to use
*/
- Replacement( const Property::Map& overrideMap, const Property::Map& defaultMap );
+ Replacement(const Property::Map& overrideMap, const Property::Map& defaultMap);
/*
* Constructor with default map
* Make a deep copy of the tree.
* @param overrideMap The user overriding map
*/
- Replacement( const Property::Map& defaultMap );
+ Replacement(const Property::Map& defaultMap);
/* @brief Check node for a type
*
* @param node The TreeNode to check
* @return Optional value
*/
- OptionalString IsString( const TreeNode& node ) const;
+ OptionalString IsString(const TreeNode& node) const;
/* @brief Check node for a type
*
* @param node The TreeNode to check
* @return Optional value
*/
- OptionalBoolean IsBoolean( const TreeNode & node ) const;
+ OptionalBoolean IsBoolean(const TreeNode& node) const;
/* @brief Check node for a type
*
* @param node The TreeNode to check
* @return Optional value
*/
- OptionalFloat IsFloat( const TreeNode & node ) const;
+ OptionalFloat IsFloat(const TreeNode& node) const;
/* @brief Check node for a type
*
* @param node The TreeNode to check
* @return Optional value
*/
- OptionalInteger IsInteger( const TreeNode & node ) const;
+ OptionalInteger IsInteger(const TreeNode& node) const;
/* @brief Check node for a type
*
* @param node The TreeNode to check
* @return Optional value
*/
- OptionalVector2 IsVector2( const TreeNode & node ) const;
+ OptionalVector2 IsVector2(const TreeNode& node) const;
/* @brief Check node for a type
*
* @param node The TreeNode to check
* @return Optional value
*/
- OptionalVector3 IsVector3( const TreeNode & node ) const;
+ OptionalVector3 IsVector3(const TreeNode& node) const;
/* @brief Check node for a type
*
* @param node The TreeNode to check
* @return Optional value
*/
- OptionalVector4 IsVector4( const TreeNode & node ) const;
+ OptionalVector4 I