From 75e792b838c4f086ae5f525bb000f4be137e9a94 Mon Sep 17 00:00:00 2001 From: Tomasz Iwanek Date: Fri, 30 Jan 2015 14:21:01 +0100 Subject: [PATCH] Remove utf16 handling This code is not needed. There is no need for utf16 error codes of parser. value.h make no longer assumtions on string encoding - there is no check. Change-Id: I2d22b8683b27a659c237c0fd1bf167e37c15db70 --- src/utils/CMakeLists.txt | 1 - src/utils/string_util.cc | 185 ++++++++++++--------- src/utils/string_util.h | 11 +- src/utils/utf_converter.cc | 124 -------------- src/utils/utf_converter.h | 42 ----- src/utils/values.cc | 88 +--------- src/utils/values.h | 19 +-- src/widget-manifest-parser/application_data.cc | 22 ++- src/widget-manifest-parser/application_data.h | 10 +- .../application_manifest_constants.cc | 22 +-- .../application_manifest_constants.h | 10 +- src/widget-manifest-parser/manifest.cc | 17 -- src/widget-manifest-parser/manifest.h | 1 - src/widget-manifest-parser/manifest_handler.cc | 2 +- src/widget-manifest-parser/manifest_handler.h | 4 +- .../manifest_handlers/permissions_handler.cc | 6 +- .../manifest_handlers/permissions_handler.h | 2 +- .../manifest_handlers/tizen_application_handler.cc | 6 +- .../manifest_handlers/tizen_application_handler.h | 2 +- .../manifest_handlers/widget_handler.cc | 3 +- .../manifest_handlers/widget_handler.h | 2 +- src/widget-manifest-parser/manifest_util.cc | 55 +++--- 22 files changed, 180 insertions(+), 454 deletions(-) delete mode 100644 src/utils/utf_converter.cc delete mode 100644 src/utils/utf_converter.h diff --git a/src/utils/CMakeLists.txt b/src/utils/CMakeLists.txt index eb52ff5..3b985a8 100644 --- a/src/utils/CMakeLists.txt +++ b/src/utils/CMakeLists.txt @@ -1,7 +1,6 @@ # Target - sources SET(SRCS system_locale.cc - utf_converter.cc string_util.cc values.cc ) diff --git a/src/utils/string_util.cc b/src/utils/string_util.cc index bd6fbd8..f11e608 100644 --- a/src/utils/string_util.cc +++ b/src/utils/string_util.cc @@ -7,64 +7,99 @@ #include -namespace common_installer { -namespace utils { +namespace { + +const char kRightToLeftMark[] = u8"\xE2\x80\x8F"; +const char kLeftToRightMark[] = u8"\xE2\x80\x8E"; +const char kLeftToRightEmbeddingMark[] = u8"\xE2\x80\xAA"; +const char kRightToLeftEmbeddingMark[] = u8"\xE2\x80\xAB"; +const char kPopDirectionalFormatting[] = u8"\xE2\x80\xAC"; +const char kLeftToRightOverride[] = u8"\xE2\x80\xAD"; +const char kRightToLeftOverride[] = u8"\xE2\x80\xAE"; -#define WHITESPACE_UNICODE \ - 0x0009, /* CHARACTER TABULATION */ \ - 0x000A, /* LINE FEED (LF) */ \ - 0x000B, /* LINE TABULATION */ \ - 0x000C, /* FORM FEED (FF) */ \ - 0x000D, /* CARRIAGE RETURN (CR) */ \ - 0x0020, /* SPACE */ \ - 0x0085, /* NEXT LINE (NEL) */ \ - 0x00A0, /* NO-BREAK SPACE */ \ - 0x1680, /* OGHAM SPACE MARK */ \ - 0x2000, /* EN QUAD */ \ - 0x2001, /* EM QUAD */ \ - 0x2002, /* EN SPACE */ \ - 0x2003, /* EM SPACE */ \ - 0x2004, /* THREE-PER-EM SPACE */ \ - 0x2005, /* FOUR-PER-EM SPACE */ \ - 0x2006, /* SIX-PER-EM SPACE */ \ - 0x2007, /* FIGURE SPACE */ \ - 0x2008, /* PUNCTUATION SPACE */ \ - 0x2009, /* THIN SPACE */ \ - 0x200A, /* HAIR SPACE */ \ - 0x2028, /* LINE SEPARATOR */ \ - 0x2029, /* PARAGRAPH SEPARATOR */ \ - 0x202F, /* NARROW NO-BREAK SPACE */ \ - 0x205F, /* MEDIUM MATHEMATICAL SPACE */ \ - 0x3000, /* IDEOGRAPHIC SPACE */ \ - 0 - -const char16_t kRightToLeftMark = 0x200F; -const char16_t kLeftToRightMark = 0x200E; -const char16_t kLeftToRightEmbeddingMark = 0x202A; -const char16_t kRightToLeftEmbeddingMark = 0x202B; -const char16_t kPopDirectionalFormatting = 0x202C; -const char16_t kLeftToRightOverride = 0x202D; -const char16_t kRightToLeftOverride = 0x202E; +const unsigned kBidiControlCharacterLength = 3; const char kDirLTRKey[] = "ltr"; const char kDirRTLKey[] = "rtl"; const char kDirLROKey[] = "lro"; const char kDirRLOKey[] = "rlo"; -namespace { -const wchar_t kWhitespaceWide[] = { - WHITESPACE_UNICODE +const char* kWhitespaceSequences[] = { + u8"\x09", /* CHARACTER TABULATION */ + u8"\x0A", /* LINE FEED (LF) */ + u8"\x0B", /* LINE TABULATION */ + u8"\x0C", /* FORM FEED (FF) */ + u8"\x0D", /* CARRIAGE RETURN (CR) */ + u8"\x20", /* SPACE */ + u8"\xc2\x85", /* NEXT LINE (NEL) */ + u8"\xc2\xa0", /* NO-BREAK SPACE */ + u8"\xe1\x9a\x80", /* OGHAM SPACE MARK */ + u8"\xe2\x80\x80", /* EN QUAD */ + u8"\xe2\x80\x81", /* EM QUAD */ + u8"\xe2\x80\x82", /* EN SPACE */ + u8"\xe2\x80\x83", /* EM SPACE */ + u8"\xe2\x80\x84", /* THREE-PER-EM SPACE */ + u8"\xe2\x80\x85", /* FOUR-PER-EM SPACE */ + u8"\xe2\x80\x86", /* SIX-PER-EM SPACE */ + u8"\xe2\x80\x87", /* FIGURE SPACE */ + u8"\xe2\x80\x88", /* PUNCTUATION SPACE */ + u8"\xe2\x80\x89", /* THIN SPACE */ + u8"\xe2\x80\x8A", /* HAIR SPACE */ + u8"\xe2\x80\xa8", /* LINE SEPARATOR */ + u8"\xe2\x80\xa9", /* PARAGRAPH SEPARATOR */ + u8"\xe2\x80\xaf", /* NARROW NO-BREAK SPACE */ + u8"\xe2\x81\x9f", /* MEDIUM MATHEMATICAL SPACE */ + u8"\xe3\x80\x80" /* IDEOGRAPHIC SPACE */ }; +// Calculates length of UTF-8 character by checking first byte only +int UTF8CharLength(const char* character) { + if (character[0] < 0x80) + return 1; + int length = 0; + unsigned char mask = 0x80; + while (character[0] & mask) { + mask >>= 1; + ++length; + } + return length; +} + +// Check string offset against occurance of given UTF-8 character +bool EqualsUTF8Char(const char* str, const char* character) { + unsigned i = 0; + while (character[i]) { + if (!str[i]) { + return false; + } + if (character[i] != str[i]) { + return false; + } + } + return true; +} + // Returns true if it's a whitespace character. -inline bool IsWhitespace(wchar_t c) { - return wcschr(kWhitespaceWide, c) != nullptr; +inline bool IsWhitespaceUTF8(const char* c) { + for (unsigned i = 0; + i < sizeof(kWhitespaceSequences) / sizeof(kWhitespaceSequences[0]); + ++i) { + if (EqualsUTF8Char(c, kWhitespaceSequences[i])) { + return true; + } + } + return false; } -template -STR CollapseWhitespaceT(const STR& text, - bool trim_sequences_with_line_breaks) { - STR result; +} // namespace + +namespace common_installer { +namespace utils { + +std::string CollapseWhitespaceUTF8( + const std::string& text, + bool trim_sequences_with_line_breaks) { + std::string result; result.resize(text.size()); // Set flags to pretend we're already in a trimmed whitespace sequence, so we @@ -73,24 +108,29 @@ STR CollapseWhitespaceT(const STR& text, bool already_trimmed = true; int chars_written = 0; - for (typename STR::const_iterator i(text.begin()); i != text.end(); ++i) { - if (IsWhitespace(*i)) { + for (unsigned i = 0; i < text.length();) { + int length = UTF8CharLength(&text[i]); + if (IsWhitespaceUTF8(&text[i])) { if (!in_whitespace) { // Reduce all whitespace sequences to a single space. in_whitespace = true; - result[chars_written++] = L' '; + result[chars_written++] = ' '; } if (trim_sequences_with_line_breaks && !already_trimmed && - ((*i == '\n') || (*i == '\r'))) { + ((text[i] == '\n') || (text[i] == '\r'))) { // Whitespace sequences containing CR or LF are eliminated entirely. already_trimmed = true; --chars_written; } + // roll through UTF8 character + i += length; } else { // Non-whitespace chracters are copied straight across. in_whitespace = false; already_trimmed = false; - result[chars_written++] = *i; + while (length--) { + result[chars_written++] = text[i++]; + } } } @@ -102,52 +142,41 @@ STR CollapseWhitespaceT(const STR& text, result.resize(chars_written); return result; } -} // namespace - -std::string CollapseWhitespace(const std::string& text, - bool trim_sequences_with_line_breaks) { - return CollapseWhitespaceT(text, trim_sequences_with_line_breaks); -} - -std::u16string CollapseWhitespace(const std::u16string& text, - bool trim_sequences_with_line_breaks) { - return CollapseWhitespaceT(text, trim_sequences_with_line_breaks); -} -std::u16string StripWrappingBidiControlCharacters(const std::u16string& text) { +std::string StripWrappingBidiControlCharactersUTF8(const std::string& text) { if (text.empty()) return text; size_t begin_index = 0; - char16_t begin = text[begin_index]; - if (begin == kLeftToRightEmbeddingMark || - begin == kRightToLeftEmbeddingMark || - begin == kLeftToRightOverride || - begin == kRightToLeftOverride) - ++begin_index; - size_t end_index = text.length() - 1; - if (text[end_index] == kPopDirectionalFormatting) - --end_index; - return text.substr(begin_index, end_index - begin_index + 1); + const char* begin = &text[begin_index]; + if (EqualsUTF8Char(begin, kLeftToRightEmbeddingMark) || + EqualsUTF8Char(begin, kRightToLeftEmbeddingMark) || + EqualsUTF8Char(begin, kLeftToRightOverride) || + EqualsUTF8Char(begin, kRightToLeftOverride)) + begin_index += kBidiControlCharacterLength; + size_t end_index = text.length() - kBidiControlCharacterLength; + if (EqualsUTF8Char(&text[end_index], kPopDirectionalFormatting)) + end_index -= 3; + return text.substr(begin_index, end_index - begin_index + kBidiControlCharacterLength); } -std::u16string GetDirText(const std::u16string& text, const std::string& dir) { +std::string GetDirTextUTF8(const std::string& text, const std::string& dir) { if (dir == kDirLTRKey) - return kLeftToRightEmbeddingMark + return std::string(kLeftToRightEmbeddingMark) + text + kPopDirectionalFormatting; if (dir == kDirRTLKey) - return kRightToLeftEmbeddingMark + return std::string(kRightToLeftEmbeddingMark) + text + kPopDirectionalFormatting; if (dir == kDirLROKey) - return kLeftToRightOverride + return std::string(kLeftToRightOverride) + text + kPopDirectionalFormatting; if (dir == kDirRLOKey) - return kRightToLeftOverride + return std::string(kRightToLeftOverride) + text + kPopDirectionalFormatting; diff --git a/src/utils/string_util.h b/src/utils/string_util.h index ebc0c4b..d0a57fd 100644 --- a/src/utils/string_util.h +++ b/src/utils/string_util.h @@ -11,14 +11,11 @@ namespace common_installer { namespace utils { -std::string CollapseWhitespace(const std::string& text, +std::string CollapseWhitespaceUTF8(const std::string& text, bool trim_sequences_with_line_breaks); -std::u16string CollapseWhitespace(const std::u16string& text, - bool trim_sequences_with_line_breaks); -std::u16string StripWrappingBidiControlCharacters(const std::u16string& text); -std::u16string GetDirText(const std::u16string& text, const std::string& dir); -void WrapStringWithLTRFormatting(std::u16string* text); -bool AdjustStringForLocaleDirection(std::u16string* text); +std::string StripWrappingBidiControlCharactersUTF8(const std::string& text); +std::string GetDirTextUTF8(const std::string& text, const std::string& dir); + } // namespace utils } // namespace common_installer diff --git a/src/utils/utf_converter.cc b/src/utils/utf_converter.cc deleted file mode 100644 index f2ef84d..0000000 --- a/src/utils/utf_converter.cc +++ /dev/null @@ -1,124 +0,0 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. -// Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE-xwalk file. - -#include "utils/utf_converter.h" - -#include - -namespace { - -bool IsAlignedToMachineWord(const void* pointer) { - uintptr_t kMachineWordAlignmentMask = sizeof(uintptr_t) - 1; - return !(reinterpret_cast(pointer) & kMachineWordAlignmentMask); -} - -template inline T* AlignToMachineWord(T* pointer) { - uintptr_t kMachineWordAlignmentMask = sizeof(uintptr_t) - 1; - return reinterpret_cast(reinterpret_cast(pointer) & - ~kMachineWordAlignmentMask); -} - -template struct NonASCIIMask; -template<> struct NonASCIIMask<4, char> { - static inline uint32_t value() { return 0x80808080U; } -}; -template<> struct NonASCIIMask<8, char> { - static inline uint64_t value() { return 0x8080808080808080ULL; } -}; - -} // namespace - -namespace common_installer { -namespace utils { -namespace utf_converter { - -using EncSt = __gnu_cxx::encoding_state; -using codecvt_type16 = std::codecvt; -using codecvt_type8 = std::codecvt; - -bool IsStringUTF8(const std::string& str) { - // TODO(jizydorczyk): - // Implement it. - // We need icu library from chromium to make it possible - // to properly implement this function, so it needs to be - // converted for our needs first. - return true; -} - -bool IsStringASCII(const std::string& str) { - const char* characters = str.c_str(); - size_t length = str.length(); - uintptr_t all_char_bits = 0; - const char* end = characters + length; - - // Prologue: align the input. - while (!IsAlignedToMachineWord(characters) && characters != end) { - all_char_bits |= *characters; - ++characters; - } - - // Compare the values of CPU word size. - const char* word_end = AlignToMachineWord(end); - const size_t loop_increment = sizeof(uintptr_t) / sizeof(char); - while (characters < word_end) { - all_char_bits |= *(reinterpret_cast(characters)); - characters += loop_increment; - } - - // Process the remaining bytes. - while (characters != end) { - all_char_bits |= *characters; - ++characters; - } - - uintptr_t non_ascii_bit_mask = - NonASCIIMask::value(); - return !(all_char_bits & non_ascii_bit_mask); -} - -std::string UTF16ToUTF8(const std::u16string& s) { - std::locale loc(std::locale::classic(), new codecvt_type16); - EncSt state(UTF16::iconvName(), UTF8::iconvName()); - const codecvt_type16& cvt = std::use_facet(loc); - - const char16_t* enx; - - std::string buffer(s.size()*3, '\0'); - char* inx; - - codecvt_type16::result r = - cvt.out(state, &s[0], &s[s.size()], enx, - &buffer[0], &buffer[buffer.size()], inx); - - if (r != codecvt_type16::ok) - return ""; - - buffer.resize(buffer.find("\0", 0, 1)); - return buffer; -} - -std::u16string UTF8ToUTF16(const std::string& s) { - std::locale loc(std::locale::classic(), new codecvt_type8); - EncSt state(UTF8::iconvName(), UTF16::iconvName()); - const codecvt_type8& cvt = std::use_facet(loc); - - const char* enx; - - std::u16string buffer(s.size()*2, '\0'); - char16_t* inx; - codecvt_type8::result r = - cvt.out(state, &s[0], &s[s.size()], enx, - &buffer[0], &buffer[buffer.size()], inx); - - if (r != codecvt_type8::ok) - return std::u16string(); - - buffer.resize(buffer.find(u"\0", 0, 1)); - return buffer; -} - -} // namespace UtfConverter -} // namespace utils -} // namespace common_installer diff --git a/src/utils/utf_converter.h b/src/utils/utf_converter.h deleted file mode 100644 index 81d5086..0000000 --- a/src/utils/utf_converter.h +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. -// Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE-xwalk file. - -#ifndef UTILS_UTF_CONVERTER_H_ -#define UTILS_UTF_CONVERTER_H_ - -// This is an extension to use iconv for dealing with character encodings. -// This header is needed for conversions between various character sets. -#include - -#include - -// With this macro we can determine endianess -#define IS_BIG_ENDIAN (*(uint16_t *)"\0\xff" < 0x100) - -namespace common_installer { -namespace utils { - -struct UTF8 { - static const char* iconvName() { return "UTF-8"; } -}; - -struct UTF16 { - static const char* iconvName() { - return IS_BIG_ENDIAN ? "UTF-16BE" : "UTF-16LE"; - } -}; - -namespace utf_converter { - bool IsStringUTF8(const std::string& str); - bool IsStringASCII(const std::string& str); - - std::string UTF16ToUTF8(const std::u16string& str); - std::u16string UTF8ToUTF16(const std::string& str); -} // namespace UtfConverter - -} // namespace utils -} // namespace common_installer - -#endif // UTILS_UTF_CONVERTER_H_ diff --git a/src/utils/values.cc b/src/utils/values.cc index 5a096db..2c93108 100644 --- a/src/utils/values.cc +++ b/src/utils/values.cc @@ -14,8 +14,6 @@ #include #include -#include "utils/utf_converter.h" - namespace common_installer { namespace utils { @@ -106,10 +104,6 @@ bool Value::GetAsString(std::string* out_value) const { return false; } -bool Value::GetAsString(std::u16string* out_value) const { - return false; -} - bool Value::GetAsString(const StringValue** out_value) const { return false; } @@ -247,12 +241,6 @@ bool FundamentalValue::Equals(const Value* other) const { StringValue::StringValue(const std::string& in_value) : Value(TYPE_STRING), value_(in_value) { - assert(utf_converter::IsStringUTF8(in_value)); -} - -StringValue::StringValue(const std::u16string& in_value) - : Value(TYPE_STRING), - value_(utf_converter::UTF16ToUTF8(in_value)) { } StringValue::~StringValue() { @@ -272,12 +260,6 @@ bool StringValue::GetAsString(std::string* out_value) const { return true; } -bool StringValue::GetAsString(std::u16string* out_value) const { - if (out_value) - *out_value = utf_converter::UTF8ToUTF16(value_); - return true; -} - bool StringValue::GetAsString(const StringValue** out_value) const { if (out_value) *out_value = this; @@ -356,7 +338,6 @@ bool DictionaryValue::GetAsDictionary(const DictionaryValue** out_value) const { } bool DictionaryValue::HasKey(const std::string& key) const { - assert(utf_converter::IsStringUTF8(key)); ValueMap::const_iterator current_entry = dictionary_.find(key); assert((current_entry == dictionary_.end()) || current_entry->second); return current_entry != dictionary_.end(); @@ -373,8 +354,7 @@ void DictionaryValue::Clear() { } void DictionaryValue::Set(const std::string& path, Value* in_value) { - assert(utf_converter::IsStringUTF8(path)); - assert(in_value); + assert(in_value); std::string current_path(path); DictionaryValue* current_dictionary = this; @@ -413,11 +393,6 @@ void DictionaryValue::SetString(const std::string& path, Set(path, new StringValue(in_value)); } -void DictionaryValue::SetString(const std::string& path, - const std::u16string& in_value) { - Set(path, new StringValue(in_value)); -} - void DictionaryValue::SetWithoutPathExpansion(const std::string& key, Value* in_value) { // If there's an existing value here, we need to delete it, because @@ -451,14 +426,8 @@ void DictionaryValue::SetStringWithoutPathExpansion( SetWithoutPathExpansion(path, new StringValue(in_value)); } -void DictionaryValue::SetStringWithoutPathExpansion( - const std::string& path, const std::u16string& in_value) { - SetWithoutPathExpansion(path, new StringValue(in_value)); -} - bool DictionaryValue::Get(const std::string& path, const Value** out_value) const { - assert(utf_converter::IsStringUTF8(path)); std::string current_path(path); const DictionaryValue* current_dictionary = this; for (size_t delimiter_position = current_path.find('.'); @@ -518,30 +487,6 @@ bool DictionaryValue::GetString(const std::string& path, return value->GetAsString(out_value); } -bool DictionaryValue::GetString(const std::string& path, - std::u16string* out_value) const { - const Value* value; - if (!Get(path, &value)) - return false; - - return value->GetAsString(out_value); -} - -bool DictionaryValue::GetStringASCII(const std::string& path, - std::string* out_value) const { - std::string out; - if (!GetString(path, &out)) - return false; - - if (!utf_converter::IsStringASCII(out)) { - std::cerr << "Not reached.\n"; - return false; - } - - out_value->assign(out); - return true; -} - bool DictionaryValue::GetBinary(const std::string& path, const BinaryValue** out_value) const { const Value* value; @@ -603,7 +548,6 @@ bool DictionaryValue::GetList(const std::string& path, ListValue** out_value) { bool DictionaryValue::GetWithoutPathExpansion(const std::string& key, const Value** out_value) const { - assert(utf_converter::IsStringUTF8(key)); ValueMap::const_iterator entry_iterator = dictionary_.find(key); if (entry_iterator == dictionary_.end()) return false; @@ -658,15 +602,6 @@ bool DictionaryValue::GetStringWithoutPathExpansion( return value->GetAsString(out_value); } -bool DictionaryValue::GetStringWithoutPathExpansion(const std::string& key, - std::u16string* out_value) const { - const Value* value; - if (!GetWithoutPathExpansion(key, &value)) - return false; - - return value->GetAsString(out_value); -} - bool DictionaryValue::GetDictionaryWithoutPathExpansion( const std::string& key, const DictionaryValue** out_value) const { @@ -715,7 +650,6 @@ bool DictionaryValue::GetListWithoutPathExpansion(const std::string& key, bool DictionaryValue::Remove(const std::string& path, std::unique_ptr* out_value) { - assert(utf_converter::IsStringUTF8(path)); std::string current_path(path); DictionaryValue* current_dictionary = this; size_t delimiter_position = current_path.rfind('.'); @@ -732,7 +666,6 @@ bool DictionaryValue::Remove(const std::string& path, bool DictionaryValue::RemoveWithoutPathExpansion( const std::string& key, std::unique_ptr* out_value) { - assert(utf_converter::IsStringUTF8(key)); ValueMap::iterator entry_iterator = dictionary_.find(key); if (entry_iterator == dictionary_.end()) return false; @@ -912,14 +845,6 @@ bool ListValue::GetString(size_t index, std::string* out_value) const { return value->GetAsString(out_value); } -bool ListValue::GetString(size_t index, std::u16string* out_value) const { - const Value* value; - if (!Get(index, &value)) - return false; - - return value->GetAsString(out_value); -} - bool ListValue::GetBinary(size_t index, const BinaryValue** out_value) const { const Value* value; bool result = Get(index, &value); @@ -1034,10 +959,6 @@ void ListValue::AppendString(const std::string& in_value) { Append(new StringValue(in_value)); } -void ListValue::AppendString(const std::u16string& in_value) { - Append(new StringValue(in_value)); -} - void ListValue::AppendStrings(const std::vector& in_values) { for (std::vector::const_iterator it = in_values.begin(); it != in_values.end(); ++it) { @@ -1045,13 +966,6 @@ void ListValue::AppendStrings(const std::vector& in_values) { } } -void ListValue::AppendStrings(const std::vector& in_values) { - for (std::vector::const_iterator it = in_values.begin(); - it != in_values.end(); ++it) { - AppendString(*it); - } -} - bool ListValue::AppendIfNotPresent(Value* in_value) { assert(in_value); for (ValueVector::const_iterator i(list_.begin()); i != list_.end(); ++i) { diff --git a/src/utils/values.h b/src/utils/values.h index 47c503e..1f7ee01 100644 --- a/src/utils/values.h +++ b/src/utils/values.h @@ -80,7 +80,6 @@ class Value { virtual bool GetAsInteger(int* out_value) const; virtual bool GetAsDouble(double* out_value) const; virtual bool GetAsString(std::string* out_value) const; - virtual bool GetAsString(std::u16string* out_value) const; virtual bool GetAsString(const StringValue** out_value) const; virtual bool GetAsList(ListValue** out_value); virtual bool GetAsList(const ListValue** out_value) const; @@ -139,12 +138,9 @@ class FundamentalValue : public Value { class StringValue : public Value { public: - // Initializes a StringValue with a UTF-8 narrow character string. + // Initializes a StringValue with a std::string. explicit StringValue(const std::string& in_value); - // Initializes a StringValue with a std::u16string. - explicit StringValue(const std::u16string& in_value); - ~StringValue() override; // Returns |value_| as a pointer or reference. @@ -153,7 +149,6 @@ class StringValue : public Value { // Overridden from Value: bool GetAsString(std::string* out_value) const override; - bool GetAsString(std::u16string* out_value) const override; bool GetAsString(const StringValue** out_value) const override; StringValue* DeepCopy() const override; bool Equals(const Value* other) const override; @@ -195,7 +190,7 @@ class BinaryValue: public Value { // DictionaryValue provides a key-value dictionary with (optional) "path" // parsing for recursive access; see the comment at the top of the file. Keys -// are |std::string|s and should be UTF-8 encoded. +// are |std::string|s. class DictionaryValue : public Value { public: DictionaryValue(); @@ -234,7 +229,6 @@ class DictionaryValue : public Value { void SetInteger(const std::string& path, int in_value); void SetDouble(const std::string& path, double in_value); void SetString(const std::string& path, const std::string& in_value); - void SetString(const std::string& path, const std::u16string& in_value); // Like Set(), but without special treatment of '.'. This allows e.g. URLs to // be used as paths. @@ -246,8 +240,6 @@ class DictionaryValue : public Value { void SetDoubleWithoutPathExpansion(const std::string& path, double in_value); void SetStringWithoutPathExpansion(const std::string& path, const std::string& in_value); - void SetStringWithoutPathExpansion(const std::string& path, - const std::u16string& in_value); // Gets the Value associated with the given path starting from this object. // A path has the form "" or "..[...]", where "." indexes @@ -270,8 +262,6 @@ class DictionaryValue : public Value { // doubles. bool GetDouble(const std::string& path, double* out_value) const; bool GetString(const std::string& path, std::string* out_value) const; - bool GetString(const std::string& path, std::u16string* out_value) const; - bool GetStringASCII(const std::string& path, std::string* out_value) const; bool GetBinary(const std::string& path, const BinaryValue** out_value) const; bool GetBinary(const std::string& path, BinaryValue** out_value); bool GetDictionary(const std::string& path, @@ -293,8 +283,6 @@ class DictionaryValue : public Value { double* out_value) const; bool GetStringWithoutPathExpansion(const std::string& key, std::string* out_value) const; - bool GetStringWithoutPathExpansion(const std::string& key, - std::u16string* out_value) const; bool GetDictionaryWithoutPathExpansion( const std::string& key, const DictionaryValue** out_value) const; @@ -406,7 +394,6 @@ class ListValue : public Value { // doubles. bool GetDouble(size_t index, double* out_value) const; bool GetString(size_t index, std::string* out_value) const; - bool GetString(size_t index, std::u16string* out_value) const; bool GetBinary(size_t index, const BinaryValue** out_value) const; bool GetBinary(size_t index, BinaryValue** out_value); bool GetDictionary(size_t index, const DictionaryValue** out_value) const; @@ -440,9 +427,7 @@ class ListValue : public Value { void AppendInteger(int in_value); void AppendDouble(double in_value); void AppendString(const std::string& in_value); - void AppendString(const std::u16string& in_value); void AppendStrings(const std::vector& in_values); - void AppendStrings(const std::vector& in_values); // Appends a Value if it's not already present. Takes ownership of the // |in_value|. Returns true if successful, or false if the value was already diff --git a/src/widget-manifest-parser/application_data.cc b/src/widget-manifest-parser/application_data.cc index dae0de3..6df4592 100644 --- a/src/widget-manifest-parser/application_data.cc +++ b/src/widget-manifest-parser/application_data.cc @@ -10,7 +10,6 @@ #include #include "utils/logging.h" -#include "utils/utf_converter.h" #include "widget-manifest-parser/application_manifest_constants.h" #include "widget-manifest-parser/manifest.h" #include "widget-manifest-parser/manifest_handler.h" @@ -54,14 +53,14 @@ std::shared_ptr ApplicationData::Create( SourceType source_type, std::unique_ptr manifest, std::string* error_message) { assert(error_message); - std::u16string error; + std::string error; if (!manifest->ValidateManifest(error_message)) return nullptr; std::shared_ptr app_data( new ApplicationData(path, source_type, std::move(manifest))); if (!app_data->Init(explicit_id, &error)) { - *error_message = utils::utf_converter::UTF16ToUTF8(error); + *error_message = error; return nullptr; } @@ -130,7 +129,7 @@ ApplicationData::~ApplicationData() { } bool ApplicationData::Init(const std::string& explicit_id, - std::u16string* error) { + std::string* error) { assert(error); ManifestHandlerRegistry* registry = ManifestHandlerRegistry::GetInstance(manifest_type()); @@ -150,7 +149,7 @@ bool ApplicationData::Init(const std::string& explicit_id, } bool ApplicationData::LoadID(const std::string& explicit_id, - std::u16string* error) { + std::string* error) { std::string application_id; auto iter = manifest_data_.find(widget_keys::kTizenApplicationKey); if (iter == manifest_data_.end()) @@ -170,9 +169,9 @@ bool ApplicationData::LoadID(const std::string& explicit_id, return false; } -bool ApplicationData::LoadName(std::u16string* error) { +bool ApplicationData::LoadName(std::string* error) { assert(error); - std::u16string localized_name; + std::string localized_name; std::string name_key(GetNameKey(manifest_type())); if (!manifest_->GetString(name_key, &localized_name) && @@ -180,16 +179,15 @@ bool ApplicationData::LoadName(std::u16string* error) { *error = errors::kInvalidName; return false; } - non_localized_name_ = common_installer::utils::utf_converter::UTF16ToUTF8( - localized_name); + non_localized_name_ = localized_name; // TODO(jizydorczyk): This needs to be implemented // utils::AdjustStringForLocaleDirection(&localized_name); - name_ = common_installer::utils::utf_converter::UTF16ToUTF8(localized_name); + name_ = localized_name; return true; } -bool ApplicationData::LoadVersion(std::u16string* error) { +bool ApplicationData::LoadVersion(std::string* error) { assert(error); std::string version_str; @@ -206,7 +204,7 @@ bool ApplicationData::LoadVersion(std::u16string* error) { } bool ApplicationData::SetApplicationLocale(const std::string& locale, - std::u16string* error) { + std::string* error) { manifest_->SetSystemLocale(locale); if (!LoadName(error)) return false; diff --git a/src/widget-manifest-parser/application_data.h b/src/widget-manifest-parser/application_data.h index cff8b29..07d24fa 100644 --- a/src/widget-manifest-parser/application_data.h +++ b/src/widget-manifest-parser/application_data.h @@ -101,7 +101,7 @@ class ApplicationData : public std::enable_shared_from_this { // App-related. bool IsHostedApp() const; - bool SetApplicationLocale(const std::string& locale, std::u16string* error); + bool SetApplicationLocale(const std::string& locale, std::string* error); virtual ~ApplicationData(); @@ -110,15 +110,15 @@ class ApplicationData : public std::enable_shared_from_this { SourceType source_type, std::unique_ptr manifest); // Initialize the application from a parsed manifest. - bool Init(const std::string& explicit_id, std::u16string* error); + bool Init(const std::string& explicit_id, std::string* error); // Chooses the application ID for an application based on a variety of // criteria. The chosen ID will be set in |manifest|. - bool LoadID(const std::string& explicit_id, std::u16string* error); + bool LoadID(const std::string& explicit_id, std::string* error); // The following are helpers for InitFromValue to load various features of the // application from the manifest. - bool LoadName(std::u16string* error); - bool LoadVersion(std::u16string* error); + bool LoadName(std::string* error); + bool LoadVersion(std::string* error); // The application's human-readable name. Name is used for display purpose. It // might be wrapped with unicode bidi control characters so that it is diff --git a/src/widget-manifest-parser/application_manifest_constants.cc b/src/widget-manifest-parser/application_manifest_constants.cc index 5f86101..b7f8341 100644 --- a/src/widget-manifest-parser/application_manifest_constants.cc +++ b/src/widget-manifest-parser/application_manifest_constants.cc @@ -150,17 +150,17 @@ const char kTizenNamespacePrefix[] = "http://tizen.org/ns/widgets"; } // namespace application_widget_keys namespace application_manifest_errors { -const char16_t kInvalidDescription[] = - u"Invalid value for 'description'."; -const char16_t kInvalidKey[] = - u"Value 'key' is missing or invalid."; -const char16_t kInvalidName[] = - u"Required value 'name' is missing or invalid."; -const char16_t kInvalidVersion[] = - u"Required value 'version' is missing or invalid. It must be between 1-4 " - u"dot-separated integers each between 0 and 65536."; -const char16_t kManifestParseError[] = - u"Manifest is not valid JSON."; +const char kInvalidDescription[] = + "Invalid value for 'description'."; +const char kInvalidKey[] = + "Value 'key' is missing or invalid."; +const char kInvalidName[] = + "Required value 'name' is missing or invalid."; +const char kInvalidVersion[] = + "Required value 'version' is missing or invalid. It must be between 1-4 " + "dot-separated integers each between 0 and 65536."; +const char kManifestParseError[] = + "Manifest is not valid JSON."; const char kManifestUnreadable[] = "Manifest file is missing or unreadable."; } // namespace application_manifest_errors diff --git a/src/widget-manifest-parser/application_manifest_constants.h b/src/widget-manifest-parser/application_manifest_constants.h index 4587f38..2e1d4d6 100644 --- a/src/widget-manifest-parser/application_manifest_constants.h +++ b/src/widget-manifest-parser/application_manifest_constants.h @@ -133,11 +133,11 @@ extern const char kTizenNamespacePrefix[]; namespace application_manifest_errors { -extern const char16_t kInvalidDescription[]; -extern const char16_t kInvalidKey[]; -extern const char16_t kInvalidName[]; -extern const char16_t kInvalidVersion[]; -extern const char16_t kManifestParseError[]; +extern const char kInvalidDescription[]; +extern const char kInvalidKey[]; +extern const char kInvalidName[]; +extern const char kInvalidVersion[]; +extern const char kManifestParseError[]; // TODO(t.iwanek): fix unicode inconsistent usage extern const char kManifestUnreadable[]; } // namespace application_manifest_errors diff --git a/src/widget-manifest-parser/manifest.cc b/src/widget-manifest-parser/manifest.cc index 36c767e..01ba7e0 100644 --- a/src/widget-manifest-parser/manifest.cc +++ b/src/widget-manifest-parser/manifest.cc @@ -126,23 +126,6 @@ bool Manifest::GetString( return data_->GetString(path, out_value); } -bool Manifest::GetString( - const std::string& path, std::u16string* out_value) const { - if (!CanAccessPath(path)) - return false; - - if (i18n_data_->Get(path, NULL)) { - List::const_iterator it = user_agent_locales_->begin(); - for (; it != user_agent_locales_->end(); ++it) { - if (i18n_data_->GetString(GetLocalizedKey(path, *it), out_value)) - return true; - } - return false; - } - - return data_->GetString(path, out_value); -} - bool Manifest::GetDictionary( const std::string& path, const utils::DictionaryValue** out_value) const { return CanAccessPath(path) && data_->GetDictionary(path, out_value); diff --git a/src/widget-manifest-parser/manifest.h b/src/widget-manifest-parser/manifest.h index e131ad4..8df5553 100644 --- a/src/widget-manifest-parser/manifest.h +++ b/src/widget-manifest-parser/manifest.h @@ -57,7 +57,6 @@ class Manifest { // Auto ("en-us"(tizen is "en-gb") will be considered as a default) // First (the worst case we get the first element) | low bool GetString(const std::string& path, std::string* out_value) const; - bool GetString(const std::string& path, std::u16string* out_value) const; bool GetDictionary(const std::string& path, const utils::DictionaryValue** out_value) const; diff --git a/src/widget-manifest-parser/manifest_handler.cc b/src/widget-manifest-parser/manifest_handler.cc index 124dad1..fd49689 100644 --- a/src/widget-manifest-parser/manifest_handler.cc +++ b/src/widget-manifest-parser/manifest_handler.cc @@ -122,7 +122,7 @@ void ManifestHandlerRegistry::Register(ManifestHandler* handler) { } bool ManifestHandlerRegistry::ParseAppManifest( - std::shared_ptr application, std::u16string* error) { + std::shared_ptr application, std::string* error) { std::map handlers_by_order; for (ManifestHandlerMap::iterator iter = handlers_.begin(); iter != handlers_.end(); ++iter) { diff --git a/src/widget-manifest-parser/manifest_handler.h b/src/widget-manifest-parser/manifest_handler.h index 556eeb2..b0b4ac6 100644 --- a/src/widget-manifest-parser/manifest_handler.h +++ b/src/widget-manifest-parser/manifest_handler.h @@ -24,7 +24,7 @@ class ManifestHandler { // Returns false in case of failure and sets writes error message // in |error| if present. virtual bool Parse(std::shared_ptr application, - std::u16string* error) = 0; + std::string* error) = 0; // Returns false in case of failure and sets writes error message // in |error| if present. @@ -57,7 +57,7 @@ class ManifestHandlerRegistry final { static ManifestHandlerRegistry* GetInstance(Manifest::Type type); bool ParseAppManifest( - std::shared_ptr application, std::u16string* error); + std::shared_ptr application, std::string* error); bool ValidateAppManifest(std::shared_ptr application, std::string* error); diff --git a/src/widget-manifest-parser/manifest_handlers/permissions_handler.cc b/src/widget-manifest-parser/manifest_handlers/permissions_handler.cc index 38578fc..c4ba2c2 100644 --- a/src/widget-manifest-parser/manifest_handlers/permissions_handler.cc +++ b/src/widget-manifest-parser/manifest_handlers/permissions_handler.cc @@ -30,7 +30,7 @@ PermissionsHandler::~PermissionsHandler() { } bool PermissionsHandler::Parse( - std::shared_ptr application, std::u16string* error) { + std::shared_ptr application, std::string* error) { std::shared_ptr permissions_info(new PermissionsInfo); if (!application->GetManifest()->HasPath(keys::kTizenPermissionsKey)) { application->SetManifestData( @@ -40,7 +40,7 @@ bool PermissionsHandler::Parse( utils::Value* value; if (!application->GetManifest()->Get(keys::kTizenPermissionsKey, &value)) { - *error = u"Invalid value of tizen permissions."; + *error = "Invalid value of tizen permissions."; return false; } @@ -56,7 +56,7 @@ bool PermissionsHandler::Parse( } if (!permission_list) { - *error = u"Invalid value of permissions."; + *error = "Invalid value of permissions."; return false; } PermissionSet api_permissions; diff --git a/src/widget-manifest-parser/manifest_handlers/permissions_handler.h b/src/widget-manifest-parser/manifest_handlers/permissions_handler.h index c00c491..7507f39 100644 --- a/src/widget-manifest-parser/manifest_handlers/permissions_handler.h +++ b/src/widget-manifest-parser/manifest_handlers/permissions_handler.h @@ -39,7 +39,7 @@ class PermissionsHandler: public ManifestHandler { virtual ~PermissionsHandler(); bool Parse(std::shared_ptr application, - std::u16string* error) override; + std::string* error) override; bool AlwaysParseForType(Manifest::Type type) const override; std::vector Keys() const override; diff --git a/src/widget-manifest-parser/manifest_handlers/tizen_application_handler.cc b/src/widget-manifest-parser/manifest_handlers/tizen_application_handler.cc index f40ec5b..85e6562 100644 --- a/src/widget-manifest-parser/manifest_handlers/tizen_application_handler.cc +++ b/src/widget-manifest-parser/manifest_handlers/tizen_application_handler.cc @@ -34,7 +34,7 @@ TizenApplicationHandler::TizenApplicationHandler() {} TizenApplicationHandler::~TizenApplicationHandler() {} bool TizenApplicationHandler::Parse( - std::shared_ptr application, std::u16string* error) { + std::shared_ptr application, std::string* error) { std::shared_ptr app_info(new TizenApplicationInfo); const Manifest* manifest = application->GetManifest(); assert(manifest); @@ -63,8 +63,8 @@ bool TizenApplicationHandler::Parse( } if (!find) { - *error = u"Cannot find application element with tizen namespace " - u"or the tizen namespace prefix is incorrect.\n"; + *error = "Cannot find application element with tizen namespace " + "or the tizen namespace prefix is incorrect.\n"; return false; } if (app_dict->GetString(keys::kTizenApplicationIdKey, &value)) diff --git a/src/widget-manifest-parser/manifest_handlers/tizen_application_handler.h b/src/widget-manifest-parser/manifest_handlers/tizen_application_handler.h index 7c2405e..32f8e02 100644 --- a/src/widget-manifest-parser/manifest_handlers/tizen_application_handler.h +++ b/src/widget-manifest-parser/manifest_handlers/tizen_application_handler.h @@ -55,7 +55,7 @@ class TizenApplicationHandler : public ManifestHandler { virtual ~TizenApplicationHandler(); bool Parse(std::shared_ptr application, - std::u16string* error) override; + std::string* error) override; bool Validate(std::shared_ptr application, std::string* error) const override; bool AlwaysParseForType(Manifest::Type type) const override; diff --git a/src/widget-manifest-parser/manifest_handlers/widget_handler.cc b/src/widget-manifest-parser/manifest_handlers/widget_handler.cc index 325529b..63fda6e 100644 --- a/src/widget-manifest-parser/manifest_handlers/widget_handler.cc +++ b/src/widget-manifest-parser/manifest_handlers/widget_handler.cc @@ -12,7 +12,6 @@ #include #include -#include "utils/utf_converter.h" #include "utils/values.h" #include "widget-manifest-parser/application_manifest_constants.h" @@ -120,7 +119,7 @@ WidgetHandler::WidgetHandler() {} WidgetHandler::~WidgetHandler() {} bool WidgetHandler::Parse(std::shared_ptr application, - std::u16string* error) { + std::string* error) { std::shared_ptr widget_info(new WidgetInfo()); const Manifest* manifest = application->GetManifest(); assert(manifest); diff --git a/src/widget-manifest-parser/manifest_handlers/widget_handler.h b/src/widget-manifest-parser/manifest_handlers/widget_handler.h index e86a0ec..556b5df 100644 --- a/src/widget-manifest-parser/manifest_handlers/widget_handler.h +++ b/src/widget-manifest-parser/manifest_handlers/widget_handler.h @@ -45,7 +45,7 @@ class WidgetHandler : public ManifestHandler { virtual ~WidgetHandler(); bool Parse(std::shared_ptr application, - std::u16string* error) override; + std::string* error) override; bool AlwaysParseForType(Manifest::Type type) const override; std::vector Keys() const override; diff --git a/src/widget-manifest-parser/manifest_util.cc b/src/widget-manifest-parser/manifest_util.cc index 02fcae7..abba8d2 100644 --- a/src/widget-manifest-parser/manifest_util.cc +++ b/src/widget-manifest-parser/manifest_util.cc @@ -14,7 +14,6 @@ #include #include "utils/string_util.h" -#include "utils/utf_converter.h" #include "utils/values.h" #include "widget-manifest-parser/application_data.h" #include "widget-manifest-parser/application_manifest_constants.h" @@ -58,19 +57,6 @@ const char* kSingletonElements[] = { "content" }; -inline char* ToCharPointer(void* ptr) { - return reinterpret_cast(ptr); -} - -inline const char* ToConstCharPointer(const void* ptr) { - return reinterpret_cast(ptr); -} - -std::u16string ToSting16(const xmlChar* string_ptr) { - return common_installer::utils::utf_converter::UTF8ToUTF16( - std::string(ToConstCharPointer(string_ptr))); -} - std::string GetNodeDir(xmlNode* node, const std::string& inherit_dir) { assert(node); std::string dir(inherit_dir); @@ -78,7 +64,7 @@ std::string GetNodeDir(xmlNode* node, const std::string& inherit_dir) { xmlAttr* prop = nullptr; for (prop = node->properties; prop; prop = prop->next) { if (xmlStrEqual(prop->name, kDirAttributeKey)) { - char* prop_value = ToCharPointer(xmlNodeListGetString( + char* prop_value = reinterpret_cast(xmlNodeListGetString( node->doc, prop->children, 1)); dir = prop_value; xmlFree(prop_value); @@ -88,24 +74,25 @@ std::string GetNodeDir(xmlNode* node, const std::string& inherit_dir) { return dir; } -std::u16string GetNodeText(xmlNode* root, const std::string& inherit_dir) { +std::string GetNodeText(xmlNode* root, const std::string& inherit_dir) { assert(root); if (root->type != XML_ELEMENT_NODE) - return std::u16string(); + return std::string(); std::string current_dir(GetNodeDir(root, inherit_dir)); - std::u16string text; + std::string text; for (xmlNode* node = root->children; node; node = node->next) { // TODO(jizydorczyk): // i18n support is needed if (node->type == XML_TEXT_NODE || node->type == XML_CDATA_SECTION_NODE) { - text = text + common_installer::utils::StripWrappingBidiControlCharacters( - ToSting16(node->content)); + text = text + + common_installer::utils::StripWrappingBidiControlCharactersUTF8( + std::string(reinterpret_cast(node->content))); } else { text = text + GetNodeText(node, current_dir); } } - return common_installer::utils::GetDirText(text, current_dir); + return common_installer::utils::GetDirTextUTF8(text, current_dir); } // According to widget specification, this two prop need to support dir. @@ -227,8 +214,8 @@ namespace { // } // converting dictionaryvalue to std::map< -// std::u16string*, std::map> or -// std::map> +// std::string*, std::map> or +// std::map> std::unique_ptr LoadXMLNode( xmlNode* root, const std::string& inherit_dir = "") { @@ -241,25 +228,27 @@ std::unique_ptr LoadXMLNode( xmlAttr* prop = nullptr; for (prop = root->properties; prop; prop = prop->next) { xmlChar* value_ptr = xmlNodeListGetString(root->doc, prop->children, 1); - std::u16string prop_value(ToSting16(value_ptr)); + std::string prop_value(reinterpret_cast(value_ptr)); xmlFree(value_ptr); if (IsPropSupportDir(root, prop)) - prop_value = utils::GetDirText(prop_value, current_dir); + prop_value = utils::GetDirTextUTF8(prop_value, current_dir); if (IsTrimRequiredForProp(root, prop)) - prop_value = utils::CollapseWhitespace(prop_value, false); + prop_value = utils::CollapseWhitespaceUTF8(prop_value, false); value->SetString( - std::string(kAttributePrefix) + ToConstCharPointer(prop->name), + std::string(kAttributePrefix) + + reinterpret_cast(prop->name), prop_value); } if (root->ns) - value->SetString(kNamespaceKey, ToConstCharPointer(root->ns->href)); + value->SetString(kNamespaceKey, + reinterpret_cast(root->ns->href)); for (xmlNode* node = root->children; node; node = node->next) { - std::string sub_node_name(ToConstCharPointer(node->name)); + std::string sub_node_name(reinterpret_cast(node->name)); std::unique_ptr sub_value = LoadXMLNode(node, current_dir); if (!sub_value) @@ -304,19 +293,19 @@ std::unique_ptr LoadXMLNode( } } - std::u16string text; + std::string text; if (IsElementSupportSpanAndDir(root)) { text = GetNodeText(root, current_dir); } else { xmlChar* text_ptr = xmlNodeListGetString(root->doc, root->children, 1); if (text_ptr) { - text = ToSting16(text_ptr); + text = reinterpret_cast(text_ptr); xmlFree(text_ptr); } } if (IsTrimRequiredForElement(root)) - text = utils::CollapseWhitespace(text, false); + text = utils::CollapseWhitespaceUTF8(text, false); if (!text.empty()) value->SetString(kTextKey, text); @@ -339,7 +328,7 @@ std::unique_ptr LoadManifest(const std::string& manifest_path, std::unique_ptr dv = LoadXMLNode(root_node); std::unique_ptr result(new utils::DictionaryValue); if (dv) - result->Set(ToConstCharPointer(root_node->name), dv.release()); + result->Set(reinterpret_cast(root_node->name), dv.release()); return std::unique_ptr( new Manifest(std::move(result), Manifest::TYPE_WIDGET)); -- 2.7.4