}
}
-void DictionaryValue::SetBooleanWithoutPathExpansion(
- const std::string& path, bool in_value) {
- SetWithoutPathExpansion(path, new FundamentalValue(in_value));
-}
-
-void DictionaryValue::SetIntegerWithoutPathExpansion(
- const std::string& path, int in_value) {
- SetWithoutPathExpansion(path, new FundamentalValue(in_value));
-}
-
-void DictionaryValue::SetDoubleWithoutPathExpansion(
- const std::string& path, double in_value) {
- SetWithoutPathExpansion(path, new FundamentalValue(in_value));
-}
-
-void DictionaryValue::SetStringWithoutPathExpansion(
- const std::string& path, const std::string& in_value) {
- SetWithoutPathExpansion(path, new StringValue(in_value));
-}
-
bool DictionaryValue::Get(const std::string& path,
const Value** out_value) const {
std::string current_path(path);
}
}
-void DictionaryValue::Swap(DictionaryValue* other) {
- dictionary_.swap(other->dictionary_);
-}
-
DictionaryValue::Iterator::Iterator(const DictionaryValue& target)
: target_(target),
it_(target.dictionary_.begin()) {}
list_.push_back(in_value);
}
-void ListValue::AppendBoolean(bool in_value) {
- Append(new FundamentalValue(in_value));
-}
-
-void ListValue::AppendInteger(int in_value) {
- Append(new FundamentalValue(in_value));
-}
-
-void ListValue::AppendDouble(double in_value) {
- Append(new FundamentalValue(in_value));
-}
-
-void ListValue::AppendString(const std::string& in_value) {
- Append(new StringValue(in_value));
-}
-
-void ListValue::AppendStrings(const std::vector<std::string>& in_values) {
- for (std::vector<std::string>::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) {
- if ((*i)->Equals(in_value)) {
- delete in_value;
- return false;
- }
- }
- list_.push_back(in_value);
- return true;
-}
-
-bool ListValue::Insert(size_t index, Value* in_value) {
- assert(in_value);
- if (index > list_.size())
- return false;
-
- list_.insert(list_.begin() + index, in_value);
- return true;
-}
-
ListValue::const_iterator ListValue::Find(const Value& value) const {
return std::find_if(list_.begin(), list_.end(), ValueEquals(&value));
}
-void ListValue::Swap(ListValue* other) {
- list_.swap(other->list_);
-}
-
bool ListValue::GetAsList(ListValue** out_value) {
if (out_value)
*out_value = this;
// be used as paths.
void SetWithoutPathExpansion(const std::string& key, Value* in_value);
- // Convenience forms of SetWithoutPathExpansion().
- void SetBooleanWithoutPathExpansion(const std::string& path, bool in_value);
- void SetIntegerWithoutPathExpansion(const std::string& path, int in_value);
- void SetDoubleWithoutPathExpansion(const std::string& path, double in_value);
- void SetStringWithoutPathExpansion(const std::string& path,
- const std::string& in_value);
-
// Gets the Value associated with the given path starting from this object.
// A path has the form "<key>" or "<key>.<key>.[...]", where "." indexes
// into the next DictionaryValue down. If the path can be resolved
// be freed any time after this call.
void MergeDictionary(const DictionaryValue* dictionary);
- // Swaps contents with the |other| dictionary.
- virtual void Swap(DictionaryValue* other);
-
// This class provides an iterator over both keys and values in the
// dictionary. It can't be used to modify the dictionary.
class Iterator {
// Appends a Value to the end of the list.
void Append(Value* in_value);
- // Convenience forms of Append.
- void AppendBoolean(bool in_value);
- void AppendInteger(int in_value);
- void AppendDouble(double in_value);
- void AppendString(const std::string& in_value);
- void AppendStrings(const std::vector<std::string>& 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
- // present. If the value was already present the |in_value| is deleted.
- bool AppendIfNotPresent(Value* in_value);
-
- // Insert a Value at index.
- // Returns true if successful, or false if the index was out of range.
- bool Insert(size_t index, Value* in_value);
-
// Searches for the first instance of |value| in the list using the Equals
// method of the Value type.
// Returns a const_iterator to the found item or to end() if none exists.
const_iterator Find(const Value& value) const;
- // Swaps contents with the |other| list.
- virtual void Swap(ListValue* other);
-
// Iteration.
iterator begin() { return list_.begin(); }
iterator end() { return list_.end(); }
// manifest
const char kManifestKey[] = "manifest";
-bool IsBooleanString(const std::string& value) {
- return ba::iequals(value, "true") || ba::iequals(value, "false");
-}
-
} // namespace
template<>
return path_;
}
-void ApplicationIcon::set_width(int width) {
- if (width >= 0)
- width_ = width;
-}
-
-void ApplicationIcon::set_height(int height) {
- if (height >= 0)
- height_ = height;
-}
-
std::string ApplicationIconsInfo::Key() {
return kIconsKey;
}
}
std::string ApplicationIconsHandler::Key() const {
- return wgt::application_manifest_keys::kIconsKey;
+ return wgt::application_widget_keys::kIconsKey;
}
} // namespace parse
* @return string to the path
*/
const std::string& path() const;
- /**
- * @brief set_width sets width
- * @param width
- */
- void set_width(int width);
- /**
- * @brief set_height sets height
- * @param height
- */
- void set_height(int height);
private:
std::string path_;
namespace wgt {
-namespace application_manifest_keys {
-
-// TODO(p.sikorski): below key should be removed, when nwrt and app-installer
-// will stop use it. Now, it is just copied.
-const char kIconsKey[] = "icons";
-
-} // namespace application_manifest_keys
-
// manifest keys for widget applications.
namespace application_widget_keys {
// Keys used in JSON representation of applications.
namespace wgt {
-namespace application_manifest_keys {
-
-// TODO(p.sikorski): below key should be removed, when nwrt and app-installer
-// will stop use it. Now, it is just copied.
-extern const char kIconsKey[];
-
-} // namespace application_manifest_keys
namespace application_widget_keys {
bool WidgetConfigParser::CheckWidgetIcons() {
std::shared_ptr<ApplicationIconsInfo> icons_info =
std::static_pointer_cast<ApplicationIconsInfo>(
- parser_->AccessManifestData(application_manifest_keys::kIconsKey));
+ parser_->AccessManifestData(application_widget_keys::kIconsKey));
if (!icons_info) {
error_ = "Failed to get icon info";
return false;