diff options
author | Richard Linden <none@none> | 2010-09-22 14:48:18 -0700 |
---|---|---|
committer | Richard Linden <none@none> | 2010-09-22 14:48:18 -0700 |
commit | 0edb695ea86d7997ae3952e155ed5b4922c799f8 (patch) | |
tree | 795467705b5289f973ed937efa014900486f66b1 /indra | |
parent | 325f16d0b4c8fc9de694121d770a4931a7b98529 (diff) |
instead of exposing mutable container in LLInitParam::Multiple, just expose access functions, begin(), end(), etc.
this allows mutation of param block contents, without being able to change number of elements
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llui/llcombobox.cpp | 4 | ||||
-rw-r--r-- | indra/llui/llmultislider.cpp | 4 | ||||
-rw-r--r-- | indra/llui/llnotifications.cpp | 14 | ||||
-rw-r--r-- | indra/llui/llpanel.cpp | 4 | ||||
-rw-r--r-- | indra/llui/llradiogroup.cpp | 4 | ||||
-rw-r--r-- | indra/llui/llscrolllistctrl.cpp | 14 | ||||
-rw-r--r-- | indra/llui/lltooltip.cpp | 4 | ||||
-rw-r--r-- | indra/llui/llui.cpp | 8 | ||||
-rw-r--r-- | indra/llui/lluicolortable.cpp | 4 | ||||
-rw-r--r-- | indra/llxuixml/llinitparam.h | 36 | ||||
-rw-r--r-- | indra/llxuixml/lltrans.cpp | 8 | ||||
-rw-r--r-- | indra/newview/llsplitbutton.cpp | 4 | ||||
-rw-r--r-- | indra/newview/llviewertexturelist.cpp | 4 | ||||
-rw-r--r-- | indra/newview/llviewerwindow.cpp | 2 |
14 files changed, 62 insertions, 52 deletions
diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp index 910bab9a97..edd2cd340b 100644 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -139,8 +139,8 @@ LLComboBox::LLComboBox(const LLComboBox::Params& p) // Grab the mouse-up event and make sure the button state is correct mList->setMouseUpCallback(boost::bind(&LLComboBox::onListMouseUp, this)); - for (LLInitParam::ParamIterator<ItemParams>::const_iterator it = p.items().begin(); - it != p.items().end(); + for (LLInitParam::ParamIterator<ItemParams>::const_iterator it = p.items.begin(); + it != p.items.end(); ++it) { LLScrollListItem::Params item_params = *it; diff --git a/indra/llui/llmultislider.cpp b/indra/llui/llmultislider.cpp index 1f6fa12969..d4e6091ee0 100644 --- a/indra/llui/llmultislider.cpp +++ b/indra/llui/llmultislider.cpp @@ -101,8 +101,8 @@ LLMultiSlider::LLMultiSlider(const LLMultiSlider::Params& p) setMouseUpCallback(initCommitCallback(p.mouse_up_callback)); } - for (LLInitParam::ParamIterator<SliderParams>::const_iterator it = p.sliders().begin(); - it != p.sliders().end(); + for (LLInitParam::ParamIterator<SliderParams>::const_iterator it = p.sliders.begin(); + it != p.sliders.end(); ++it) { if (it->name.isProvided()) diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index ab9bd12b85..67b3c5cfce 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -395,8 +395,8 @@ LLNotificationTemplate::LLNotificationTemplate(const LLNotificationTemplate::Par mSoundEffect = LLUUID(LLUI::sSettingGroups["config"]->getString(p.sound)); } - for(LLInitParam::ParamIterator<LLNotificationTemplate::UniquenessContext>::const_iterator it = p.unique.contexts().begin(), - end_it = p.unique.contexts().end(); + for(LLInitParam::ParamIterator<LLNotificationTemplate::UniquenessContext>::const_iterator it = p.unique.contexts.begin(), + end_it = p.unique.contexts.end(); it != end_it; ++it) { @@ -1313,8 +1313,8 @@ void replaceFormText(LLNotificationForm::Params& form, const std::string& patter { form.ignore.text = replace; } - for (LLInitParam::ParamIterator<LLNotificationForm::FormElement>::iterator it = form.form_elements.elements().begin(), - end_it = form.form_elements.elements().end(); + for (LLInitParam::ParamIterator<LLNotificationForm::FormElement>::iterator it = form.form_elements.elements.begin(), + end_it = form.form_elements.elements.end(); it != end_it; ++it) { @@ -1345,7 +1345,7 @@ bool LLNotifications::loadTemplates() mTemplates.clear(); - for(LLInitParam::ParamIterator<LLNotificationTemplate::GlobalString>::const_iterator it = params.strings().begin(), end_it = params.strings().end(); + for(LLInitParam::ParamIterator<LLNotificationTemplate::GlobalString>::const_iterator it = params.strings.begin(), end_it = params.strings.end(); it != end_it; ++it) { @@ -1354,14 +1354,14 @@ bool LLNotifications::loadTemplates() std::map<std::string, LLNotificationForm::Params> form_templates; - for(LLInitParam::ParamIterator<LLNotificationTemplate::Template>::const_iterator it = params.templates().begin(), end_it = params.templates().end(); + for(LLInitParam::ParamIterator<LLNotificationTemplate::Template>::const_iterator it = params.templates.begin(), end_it = params.templates.end(); it != end_it; ++it) { form_templates[it->name] = it->form; } - for(LLInitParam::ParamIterator<LLNotificationTemplate::Params>::iterator it = params.notifications().begin(), end_it = params.notifications().end(); + for(LLInitParam::ParamIterator<LLNotificationTemplate::Params>::iterator it = params.notifications.begin(), end_it = params.notifications.end(); it != end_it; ++it) { diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index 2f5dabf23c..c8e56630f1 100644 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -446,8 +446,8 @@ void LLPanel::initFromParams(const LLPanel::Params& p) setVisibleCallback(initCommitCallback(p.visible_callback)); } - for (LLInitParam::ParamIterator<LocalizedString>::const_iterator it = p.strings().begin(); - it != p.strings().end(); + for (LLInitParam::ParamIterator<LocalizedString>::const_iterator it = p.strings.begin(); + it != p.strings.end(); ++it) { mUIStrings[it->name] = it->value; diff --git a/indra/llui/llradiogroup.cpp b/indra/llui/llradiogroup.cpp index 83c42a5ab8..cc348fdc63 100644 --- a/indra/llui/llradiogroup.cpp +++ b/indra/llui/llradiogroup.cpp @@ -100,8 +100,8 @@ LLRadioGroup::LLRadioGroup(const LLRadioGroup::Params& p) void LLRadioGroup::initFromParams(const Params& p) { - for (LLInitParam::ParamIterator<ItemParams>::const_iterator it = p.items().begin(); - it != p.items().end(); + for (LLInitParam::ParamIterator<ItemParams>::const_iterator it = p.items.begin(); + it != p.items.end(); ++it) { LLRadioGroup::ItemParams item_params(*it); diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index bfc77e77ad..7df7c13dc0 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -259,15 +259,15 @@ LLScrollListCtrl::LLScrollListCtrl(const LLScrollListCtrl::Params& p) } - for (LLInitParam::ParamIterator<LLScrollListColumn::Params>::const_iterator row_it = p.contents.columns().begin(); - row_it != p.contents.columns().end(); + for (LLInitParam::ParamIterator<LLScrollListColumn::Params>::const_iterator row_it = p.contents.columns.begin(); + row_it != p.contents.columns.end(); ++row_it) { addColumn(*row_it); } - for (LLInitParam::ParamIterator<LLScrollListItem::Params>::const_iterator row_it = p.contents.rows().begin(); - row_it != p.contents.rows().end(); + for (LLInitParam::ParamIterator<LLScrollListItem::Params>::const_iterator row_it = p.contents.rows.begin(); + row_it != p.contents.rows.end(); ++row_it) { addRow(*row_it); @@ -2776,8 +2776,8 @@ LLScrollListItem* LLScrollListCtrl::addRow(LLScrollListItem *new_item, const LLS // Add any columns we don't already have S32 col_index = 0; - for(LLInitParam::ParamIterator<LLScrollListCell::Params>::const_iterator itor = item_p.columns().begin(); - itor != item_p.columns().end(); + for(LLInitParam::ParamIterator<LLScrollListCell::Params>::const_iterator itor = item_p.columns.begin(); + itor != item_p.columns.end(); ++itor) { LLScrollListCell::Params cell_p = *itor; @@ -2828,7 +2828,7 @@ LLScrollListItem* LLScrollListCtrl::addRow(LLScrollListItem *new_item, const LLS col_index++; } - if (item_p.columns().empty()) + if (item_p.columns.empty()) { if (mColumns.empty()) { diff --git a/indra/llui/lltooltip.cpp b/indra/llui/lltooltip.cpp index 2c44b91749..6390039794 100644 --- a/indra/llui/lltooltip.cpp +++ b/indra/llui/lltooltip.cpp @@ -276,8 +276,8 @@ void LLToolTip::initFromParams(const LLToolTip::Params& p) if (p.styled_message.isProvided()) { - for (LLInitParam::ParamIterator<LLToolTip::StyledText>::const_iterator text_it = p.styled_message().begin(); - text_it != p.styled_message().end(); + for (LLInitParam::ParamIterator<LLToolTip::StyledText>::const_iterator text_it = p.styled_message.begin(); + text_it != p.styled_message.end(); ++text_it) { mTextBox->appendText(text_it->text(), false, text_it->style); diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index b673d81c2b..ff9af21e54 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -1806,14 +1806,14 @@ void LLUI::setupPaths() LLStringUtil::format_map_t path_args; path_args["[LANGUAGE]"] = LLUI::getLanguage(); - for (LLInitParam::ParamIterator<Directory>::const_iterator it = paths.directories().begin(), - end_it = paths.directories().end(); + for (LLInitParam::ParamIterator<Directory>::const_iterator it = paths.directories.begin(), + end_it = paths.directories.end(); it != end_it; ++it) { std::string path_val_ui; - for (LLInitParam::ParamIterator<SubDir>::const_iterator subdir_it = it->subdirs().begin(), - subdir_end_it = it->subdirs().end(); + for (LLInitParam::ParamIterator<SubDir>::const_iterator subdir_it = it->subdirs.begin(), + subdir_end_it = it->subdirs.end(); subdir_it != subdir_end_it;) { path_val_ui += subdir_it->value(); diff --git a/indra/llui/lluicolortable.cpp b/indra/llui/lluicolortable.cpp index 219c70500a..0641f6d175 100644 --- a/indra/llui/lluicolortable.cpp +++ b/indra/llui/lluicolortable.cpp @@ -56,8 +56,8 @@ void LLUIColorTable::insertFromParams(const Params& p, string_color_map_t& table typedef std::map<std::string, std::string> string_string_map_t; string_string_map_t unresolved_refs; - for(LLInitParam::ParamIterator<ColorEntryParams>::const_iterator it = p.color_entries().begin(); - it != p.color_entries().end(); + for(LLInitParam::ParamIterator<ColorEntryParams>::const_iterator it = p.color_entries.begin(); + it != p.color_entries.end(); ++it) { ColorEntryParams color_entry = *it; diff --git a/indra/llxuixml/llinitparam.h b/indra/llxuixml/llinitparam.h index 24ce891880..83b27f5396 100644 --- a/indra/llxuixml/llinitparam.h +++ b/indra/llxuixml/llinitparam.h @@ -958,7 +958,7 @@ namespace LLInitParam const self_t& typed_param = static_cast<const self_t&>(param); if (!typed_param.isProvided() || name_stack.empty()) return; - typename container_t::const_iterator it = typed_param.mValues.begin(); + typename const_iterator it = typed_param.mValues.begin(); for (typename std::vector<key_cache_t>::const_iterator key_it = typed_param.mCachedKeys.begin(); it != typed_param.mValues.end(); ++key_it, ++it) @@ -1025,9 +1025,15 @@ namespace LLInitParam // implicit conversion operator value_assignment_t() const { return self_t::get(); } - // explicit conversion - value_assignment_t operator()() const { return get(); } - container_t& operator()() { return mValues; } + + typedef typename container_t::iterator iterator; + typedef typename container_t::const_iterator const_iterator; + iterator begin() { return mValues.begin(); } + iterator end() { return mValues.end(); } + const_iterator begin() const { return mValues.begin(); } + const_iterator end() const { return mValues.end(); } + bool empty() const { return mValues.empty(); } + size_t size() const { return mValues.size(); } U32 numValidElements() const { @@ -1160,7 +1166,7 @@ namespace LLInitParam const self_t& typed_param = static_cast<const self_t&>(param); if (!typed_param.isProvided() || name_stack.empty()) return; - typename container_t::const_iterator it = typed_param.mValues.begin(); + const_iterator it = typed_param.mValues.begin(); for (typename std::vector<Data>::const_iterator key_it = typed_param.mCachedKeys.begin(); it != typed_param.mValues.end(); ++key_it, ++it) @@ -1224,14 +1230,20 @@ namespace LLInitParam // implicit conversion operator value_assignment_t() const { return self_t::get(); } - // explicit conversion - value_assignment_t operator()() const { return get(); } - container_t& operator()() { return mValues; } + + typedef typename container_t::iterator iterator; + typedef typename container_t::const_iterator const_iterator; + iterator begin() { return mValues.begin(); } + iterator end() { return mValues.end(); } + const_iterator begin() const { return mValues.begin(); } + const_iterator end() const { return mValues.end(); } + bool empty() const { return mValues.empty(); } + size_t size() const { return mValues.size(); } U32 numValidElements() const { U32 count = 0; - for (typename container_t::const_iterator it = mValues.begin(); + for (const_iterator it = mValues.begin(); it != mValues.end(); ++it) { @@ -1518,15 +1530,13 @@ namespace LLInitParam typedef Multiple<T, RANGE, NAME_VALUE_LOOKUP> self_t; typedef typename super_t::container_t container_t; typedef typename super_t::value_assignment_t value_assignment_t; - typedef typename container_t::iterator iterator; - typedef typename container_t::const_iterator const_iterator; + typedef typename super_t::iterator iterator; + typedef typename super_t::const_iterator const_iterator; explicit Multiple(const char* name = "", value_assignment_t val = DefaultInitializer<container_t>::get()) : super_t(DERIVED_BLOCK::selfBlockDescriptor(), name, val, &validate, RANGE::minCount(), RANGE::maxCount()) {} - using super_t::operator(); - Multiple& operator=(value_assignment_t val) { set(val); diff --git a/indra/llxuixml/lltrans.cpp b/indra/llxuixml/lltrans.cpp index bf56461bac..11127a53f5 100644 --- a/indra/llxuixml/lltrans.cpp +++ b/indra/llxuixml/lltrans.cpp @@ -78,8 +78,8 @@ bool LLTrans::parseStrings(LLXMLNodePtr &root, const std::set<std::string>& defa sStringTemplates.clear(); sDefaultArgs.clear(); - for(LLInitParam::ParamIterator<StringDef>::const_iterator it = string_table.strings().begin(); - it != string_table.strings().end(); + for(LLInitParam::ParamIterator<StringDef>::const_iterator it = string_table.strings.begin(); + it != string_table.strings.end(); ++it) { LLTransTemplate xml_template(it->name, it->value); @@ -119,8 +119,8 @@ bool LLTrans::parseLanguageStrings(LLXMLNodePtr &root) return false; } - for(LLInitParam::ParamIterator<StringDef>::const_iterator it = string_table.strings().begin(); - it != string_table.strings().end(); + for(LLInitParam::ParamIterator<StringDef>::const_iterator it = string_table.strings.begin(); + it != string_table.strings.end(); ++it) { // share the same map with parseStrings() so we can search the strings using the same getString() function.- angela diff --git a/indra/newview/llsplitbutton.cpp b/indra/newview/llsplitbutton.cpp index 7db42214e1..790305103d 100644 --- a/indra/newview/llsplitbutton.cpp +++ b/indra/newview/llsplitbutton.cpp @@ -220,7 +220,7 @@ LLSplitButton::LLSplitButton(const LLSplitButton::Params& p) addChild(mItemsPanel); - LLInitParam::ParamIterator<ItemParams>::const_iterator it = p.items().begin(); + LLInitParam::ParamIterator<ItemParams>::const_iterator it = p.items.begin(); //processing shown item button mShownItem = prepareItemButton(*it); @@ -231,7 +231,7 @@ LLSplitButton::LLSplitButton(const LLSplitButton::Params& p) //processing hidden item buttons S32 item_top = mItemsPanel->getRect().getHeight(); - for (++it; it != p.items().end(); ++it) + for (++it; it != p.items.end(); ++it) { LLButton* hidden_button = prepareItemButton(*it); hidden_button->setRect(LLRect(btn_left, item_top, btn_right, item_top - rc.getHeight())); diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index abe75a1224..bbf7c8e60e 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -1558,8 +1558,8 @@ bool LLUIImageList::initFromFile() for (S32 cur_pass = PASS_DECODE_NOW; cur_pass < NUM_PASSES; cur_pass++) { - for (LLInitParam::ParamIterator<UIImageDeclaration>::const_iterator image_it = images.textures().begin(); - image_it != images.textures().end(); + for (LLInitParam::ParamIterator<UIImageDeclaration>::const_iterator image_it = images.textures.begin(); + image_it != images.textures.end(); ++image_it) { std::string file_name = image_it->file_name.isProvided() ? image_it->file_name() : image_it->name(); diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 7f8b7fba9f..b2ff39bbd2 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -2393,7 +2393,7 @@ void append_xui_tooltip(LLView* viewp, LLToolTip::Params& params) { if (viewp) { - if (!params.styled_message().empty()) + if (!params.styled_message.empty()) { params.styled_message.add().text("\n---------\n"); } |