mirror of
https://github.com/xenia-project/elemental-forms.git
synced 2026-01-31 01:25:17 +01:00
clang fixes.
This commit is contained in:
@@ -113,7 +113,7 @@ void AnimationManager::StartAnimation(Animation* obj,
|
||||
}
|
||||
obj->adjust_start_time = animation_time == AnimationTime::kFirstUpdate;
|
||||
obj->animation_start_time = util::GetTimeMS();
|
||||
obj->animation_duration = std::max(animation_duration, 0ull);
|
||||
obj->animation_duration = std::max(animation_duration, uint64_t(0));
|
||||
obj->animation_curve = animation_curve;
|
||||
animating_objects.AddLast(obj);
|
||||
obj->InvokeOnAnimationStart();
|
||||
|
||||
@@ -607,7 +607,7 @@ int TextBox::TextBoxContentFactory::GetContent(const char* text) {
|
||||
text::TextFragmentContent*
|
||||
TextBox::TextBoxContentFactory::CreateFragmentContent(const char* text,
|
||||
size_t text_len) {
|
||||
if (strncmp(text, "<element ", std::min(text_len, 8ull)) == 0) {
|
||||
if (strncmp(text, "<element ", std::min(text_len, size_t(8))) == 0) {
|
||||
// Create a wrapper for the generated element.
|
||||
// Its size will adapt to the content.
|
||||
auto element = new Element();
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#include "el/graphics/bitmap_fragment_map.h"
|
||||
#include "el/graphics/renderer.h"
|
||||
#include "el/util/math.h"
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
|
||||
#include "el/io/memory_file_system.h"
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include <cstring>
|
||||
#include <locale>
|
||||
|
||||
#include "el/io/win32_res_file_system.h"
|
||||
#include "el/io/win32_res_file_system_win.h"
|
||||
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
@@ -7,8 +7,8 @@
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef EL_IO_WIN32_RES_FILE_SYSTEM_H_
|
||||
#define EL_IO_WIN32_RES_FILE_SYSTEM_H_
|
||||
#ifndef EL_IO_WIN32_RES_FILE_SYSTEM_WIN_H_
|
||||
#define EL_IO_WIN32_RES_FILE_SYSTEM_WIN_H_
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
@@ -31,4 +31,4 @@ class Win32ResFileSystem : public FileSystem {
|
||||
} // namespace io
|
||||
} // namespace el
|
||||
|
||||
#endif // EL_IO_WIN32_RES_FILE_SYSTEM_H_
|
||||
#endif // EL_IO_WIN32_RES_FILE_SYSTEM_WIN_H_
|
||||
@@ -257,7 +257,7 @@ struct ItemListElementNode : public ElementNode<T> {
|
||||
auto items_node = Node::GetOrCreateNode("items");
|
||||
auto node = ParseNode::Create("item");
|
||||
auto text_node = ParseNode::Create("text");
|
||||
text_node->TakeValue(el::Value(text.c_str()));
|
||||
text_node->EmplaceValue(el::Value(text.c_str()));
|
||||
node->Add(text_node);
|
||||
items_node->Add(node);
|
||||
return *reinterpret_cast<T*>(this);
|
||||
@@ -267,10 +267,10 @@ struct ItemListElementNode : public ElementNode<T> {
|
||||
auto items_node = Node::GetOrCreateNode("items");
|
||||
auto node = ParseNode::Create("item");
|
||||
auto id_node = ParseNode::Create("id");
|
||||
id_node->TakeValue(el::Value(id.c_str()));
|
||||
id_node->EmplaceValue(el::Value(id.c_str()));
|
||||
node->Add(id_node);
|
||||
auto text_node = ParseNode::Create("text");
|
||||
text_node->TakeValue(el::Value(text.c_str()));
|
||||
text_node->EmplaceValue(el::Value(text.c_str()));
|
||||
node->Add(text_node);
|
||||
items_node->Add(node);
|
||||
return *reinterpret_cast<T*>(this);
|
||||
@@ -280,10 +280,10 @@ struct ItemListElementNode : public ElementNode<T> {
|
||||
auto items_node = Node::GetOrCreateNode("items");
|
||||
auto node = ParseNode::Create("item");
|
||||
auto id_node = ParseNode::Create("id");
|
||||
id_node->TakeValue(el::Value(id));
|
||||
id_node->EmplaceValue(el::Value(id));
|
||||
node->Add(id_node);
|
||||
auto text_node = ParseNode::Create("text");
|
||||
text_node->TakeValue(el::Value(text.c_str()));
|
||||
text_node->EmplaceValue(el::Value(text.c_str()));
|
||||
node->Add(text_node);
|
||||
items_node->Add(node);
|
||||
return *reinterpret_cast<T*>(this);
|
||||
@@ -294,7 +294,7 @@ struct ItemListElementNode : public ElementNode<T> {
|
||||
for (auto& item : items) {
|
||||
auto node = ParseNode::Create("item");
|
||||
auto text_node = ParseNode::Create("text");
|
||||
text_node->TakeValue(el::Value(item.c_str()));
|
||||
text_node->EmplaceValue(el::Value(item.c_str()));
|
||||
node->Add(text_node);
|
||||
items_node->Add(node);
|
||||
}
|
||||
@@ -306,10 +306,10 @@ struct ItemListElementNode : public ElementNode<T> {
|
||||
for (auto& item : items) {
|
||||
auto node = ParseNode::Create("item");
|
||||
auto id_node = ParseNode::Create("id");
|
||||
id_node->TakeValue(el::Value(item.first));
|
||||
id_node->EmplaceValue(el::Value(item.first));
|
||||
node->Add(id_node);
|
||||
auto text_node = ParseNode::Create("text");
|
||||
text_node->TakeValue(el::Value(item.second.c_str()));
|
||||
text_node->EmplaceValue(el::Value(item.second.c_str()));
|
||||
node->Add(text_node);
|
||||
items_node->Add(node);
|
||||
}
|
||||
@@ -321,10 +321,10 @@ struct ItemListElementNode : public ElementNode<T> {
|
||||
for (auto& item : items) {
|
||||
auto node = ParseNode::Create("item");
|
||||
auto id_node = ParseNode::Create("id");
|
||||
id_node->TakeValue(el::Value(item.id.c_str()));
|
||||
id_node->EmplaceValue(el::Value(item.id.c_str()));
|
||||
node->Add(id_node);
|
||||
auto text_node = ParseNode::Create("text");
|
||||
text_node->TakeValue(el::Value(item.text.c_str()));
|
||||
text_node->EmplaceValue(el::Value(item.text.c_str()));
|
||||
node->Add(text_node);
|
||||
items_node->Add(node);
|
||||
}
|
||||
|
||||
@@ -231,6 +231,8 @@ class ParseNodeTarget : public TextParserTarget {
|
||||
|
||||
void ParseNode::TakeValue(Value& value) { m_value.TakeOver(value); }
|
||||
|
||||
void ParseNode::EmplaceValue(Value value) { m_value.TakeOver(value); }
|
||||
|
||||
bool ParseNode::ReadFile(const std::string& filename, ReadFlags flags) {
|
||||
if (!any(flags & ReadFlags::kAppend)) {
|
||||
Clear();
|
||||
|
||||
@@ -42,6 +42,7 @@ class ParseNode : public util::IntrusiveListEntry<ParseNode> {
|
||||
static ParseNode* Create(const char* name);
|
||||
|
||||
void TakeValue(Value& value);
|
||||
void EmplaceValue(Value value);
|
||||
|
||||
// Reads a tree of nodes from file into this node.
|
||||
// Returns true on success.
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#include "el/io/file_manager.h"
|
||||
#include "el/parsing/text_parser_stream.h"
|
||||
|
||||
|
||||
@@ -118,13 +118,10 @@ bool Caret::Place(TextBlock* block, size_t ofs, bool allow_snap,
|
||||
ofs -= block->str_len;
|
||||
block = block->GetNext();
|
||||
}
|
||||
while (block->prev && ofs < 0ull) {
|
||||
while (block->prev) {
|
||||
block = block->GetPrev();
|
||||
ofs += block->str_len;
|
||||
}
|
||||
if (ofs < 0ull) {
|
||||
ofs = 0;
|
||||
}
|
||||
if (ofs > block->str_len) {
|
||||
ofs = block->str_len;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
|
||||
#include "el/text/font_face.h"
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
/**
|
||||
******************************************************************************
|
||||
* Elemental Forms : a lightweight user interface framework *
|
||||
******************************************************************************
|
||||
* <EFBFBD>2015 Ben Vanik. All rights reserved. Released under the BSD license. *
|
||||
* Portions <EFBFBD>2011-2015 Emil Seger<EFBFBD>s: https://github.com/fruxo/turbobadger *
|
||||
* ©2015 Ben Vanik. All rights reserved. Released under the BSD license. *
|
||||
* Portions ©2011-2015 Emil Segerås: https://github.com/fruxo/turbobadger *
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
@@ -27,11 +27,11 @@ namespace text {
|
||||
|
||||
const int TAB_SPACE = 4;
|
||||
|
||||
const char* special_char_newln = "<EFBFBD>"; // 00B6 PILCROW SIGN
|
||||
const char* special_char_space = "<EFBFBD>"; // 00B7 MIDDLE DOT
|
||||
const char* special_char_newln = "¶"; // 00B6 PILCROW SIGN
|
||||
const char* special_char_space = "·"; // 00B7 MIDDLE DOT
|
||||
const char* special_char_tab =
|
||||
"<EFBFBD>"; // 00BB RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
|
||||
const char* special_char_password = "<EFBFBD>"; // 2022 BULLET
|
||||
"»"; // 00BB RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
|
||||
const char* special_char_password = "•"; // 2022 BULLET
|
||||
|
||||
// Checks if no line wrapping is allowed before the character at the given
|
||||
// offset. The string must be null terminated.
|
||||
|
||||
@@ -32,11 +32,11 @@ TextFragmentContent* TextFragmentContentFactory::CreateFragmentContent(
|
||||
return new TextFragmentContentHR(100, 2);
|
||||
} else if (strncmp(text, "<u>", text_len) == 0) {
|
||||
return new TextFragmentContentUnderline();
|
||||
} else if (strncmp(text, "<color ", std::min(text_len, 7ull)) == 0) {
|
||||
} else if (strncmp(text, "<color ", std::min(text_len, size_t(7))) == 0) {
|
||||
Color color;
|
||||
color.reset(text + 7, text_len - 8);
|
||||
return new TextFragmentContentTextColor(color);
|
||||
} else if (strncmp(text, "</", std::min(text_len, 2ull)) == 0) {
|
||||
} else if (strncmp(text, "</", std::min(text_len, size_t(2))) == 0) {
|
||||
return new TextFragmentContentStylePop();
|
||||
}
|
||||
return nullptr;
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "el/io/file_manager.h"
|
||||
#include "el/io/memory_file_system.h"
|
||||
#include "el/io/posix_file_system.h"
|
||||
#include "el/io/win32_res_file_system.h"
|
||||
#include "el/io/win32_res_file_system_win.h"
|
||||
#include "el/parsing/parse_node.h"
|
||||
#include "el/text/font_manager.h"
|
||||
#include "el/text/font_renderer.h"
|
||||
|
||||
Reference in New Issue
Block a user