projects
/
platform
/
core
/
uifw
/
dali-toolkit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Call SetCurrentFocusActor()
[platform/core/uifw/dali-toolkit.git]
/
dali-scene-loader
/
public-api
/
utils.h
diff --git
a/dali-scene-loader/public-api/utils.h
b/dali-scene-loader/public-api/utils.h
index
09c30e1
..
f9213e1
100644
(file)
--- a/
dali-scene-loader/public-api/utils.h
+++ b/
dali-scene-loader/public-api/utils.h
@@
-1,7
+1,7
@@
#ifndef DALI_SCENE_LOADER_UTILS_H_
#define DALI_SCENE_LOADER_UTILS_H_
/*
#ifndef DALI_SCENE_LOADER_UTILS_H_
#define DALI_SCENE_LOADER_UTILS_H_
/*
- * Copyright (c) 202
0
Samsung Electronics Co., Ltd.
+ * Copyright (c) 202
1
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.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@
-21,17
+21,16
@@
#include "dali-scene-loader/public-api/api.h"
// EXTERNAL INCLUDES
#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/actors/actor.h"
-#include "dali/public-api/rendering/renderer.h"
#include "dali/public-api/common/dali-common.h"
#include "dali/public-api/common/dali-common.h"
-#include <sstream>
-#include <cctype>
+#include "dali/public-api/rendering/renderer.h"
namespace Dali
{
namespace SceneLoader
{
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.
/*
* @brief Fixed size backing buffer to use with std::ostreams where control over
* allocations (which this does not make), is required.
@@
-41,10
+40,7
@@
namespace SceneLoader
class DALI_SCENE_LOADER_API StreamBuffer : public std::basic_streambuf<char>
{
public:
class DALI_SCENE_LOADER_API StreamBuffer : public std::basic_streambuf<char>
{
public:
- StreamBuffer(char* buffer, size_t size)
- {
- setp(buffer, buffer + size);
- }
+ StreamBuffer(char* buffer, size_t size) noexcept(true);
};
/*
};
/*
@@
-55,31
+51,33
@@
public:
class DALI_SCENE_LOADER_API ExceptionFlinger
{
public:
class DALI_SCENE_LOADER_API ExceptionFlinger
{
public:
- enum { MESSAGE_BUFFER_SIZE = 512 };
+ enum
+ {
+ MESSAGE_BUFFER_SIZE = 512
+ };
- ExceptionFlinger(const char* location)
- : mLocation(location),
- mStreamBuffer(GetMessageBuffer(), MESSAGE_BUFFER_SIZE - 1),
- mStream(&mStreamBuffer)
- {}
+ ExceptionFlinger(const char* location) noexcept(true);
- ~ExceptionFlinger() noexcept(false)
- {
- operator<<('\0');
- throw DaliException(mLocation, GetMessageBuffer());
- }
+ [[noreturn]] ~ExceptionFlinger() noexcept(false);
- template
<typename T>
- ExceptionFlinger& operator<<(const T& rhs)
+ template<typename T>
+ ExceptionFlinger& operator<<(const T& rhs)
noexcept(true)
{
mStream << rhs;
return *this;
}
private:
{
mStream << rhs;
return *this;
}
private:
- static char* GetMessageBuffer();
+ struct Impl
+ {
+ const char* mLocation;
+
+ [[noreturn]] ~Impl() noexcept(false);
+ };
+
+ static char* GetMessageBuffer() noexcept(true);
-
const char* mLocation
;
+
Impl mImpl
;
StreamBuffer mStreamBuffer;
std::ostream mStream;
};
StreamBuffer mStreamBuffer;
std::ostream mStream;
};
@@
-92,13
+90,15
@@
DALI_SCENE_LOADER_API std::string FormatString(const char* format, ...);
/*
* @return The @n th bit in a bitmask.
*/
/*
* @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.
*/
/*
* @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;
}
{
return (value & mask) == mask;
}
@@
-106,8
+106,7
@@
DALI_SCENE_LOADER_API bool MaskMatch(uint32_t value, uint32_t mask)
/*
* @brief Convert a four-letter(, null-terminated) string literal into a uint32_t.
*/
/*
* @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];
}
{
return (fourCC[3] << 24) | (fourCC[2] << 16) | (fourCC[1] << 8) | fourCC[0];
}
@@
-118,11
+117,10
@@
DALI_SCENE_LOADER_API constexpr uint32_t FourCC(const char(&fourCC)[5])
* @param[in] b, compare string
* @return true if strings are equal
*/
* @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.
{
// Converts to lower case in the current locale.
- return std::tolower(
a ) == std::tolower( b
);
+ return std::tolower(
a) == std::tolower(b
);
}
/*
}
/*
@@
-130,13
+128,12
@@
DALI_SCENE_LOADER_API bool CaseInsensitiveCharacterCompare( unsigned char a, uns
* @param[in] a, compare string
* @param[in] b, compare string
*/
* @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;
{
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;
}
}
return result;
}
@@
-156,9
+153,8
@@
DALI_SCENE_LOADER_API std::string LoadTextFile(const char* path, bool* fail = nu
* @note Use of a @a fn that is itself recursing in @a is also discouraged
* for performance and stability reasons.
*/
* @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);
{
fn(a);
@@
-173,8
+169,7
@@
DALI_SCENE_LOADER_API void VisitActor(Actor a, Func fn)
* @brief Convenience function to set the given actor @a 's anchor point
* and parent origin to center.
*/
* @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);
{
a.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
a.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
@@
-186,10
+181,10
@@
using Type = uint32_t;
enum DALI_SCENE_LOADER_API Values : Type
{
enum DALI_SCENE_LOADER_API Values : Type
{
- NONE = 0x00,
+ NONE
= 0x00,
FLIP_VERTICAL = 0x01,
};
FLIP_VERTICAL = 0x01,
};
-}
+}
// namespace TexturedQuadOptions
/*
* @brief Makes... geometry for a textured quad.
/*
* @brief Makes... geometry for a textured quad.
@@
-200,9
+195,9
@@
DALI_SCENE_LOADER_API Geometry MakeTexturedQuadGeometry(TexturedQuadOptions::Typ
* @brief Fixes the path of a file. Replaces the '\\' separator by the '/' one.
* @param[in,out] path The path to be fixed.
*/
* @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_ */
#endif /* DALI_SCENE_LOADER_UTILS_H_ */