diff options
author | Jacek Antonelli | 2008-08-15 23:45:34 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:34 -0500 |
commit | cd17687f01420952712a500107e0f93e7ab8d5f8 (patch) | |
tree | ce48c2b706f2c1176290e39fb555fbdf6648ce01 /linden/indra/llxml/llcontrol.cpp | |
parent | Second Life viewer sources 1.19.0.5 (diff) | |
download | meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.zip meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.gz meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.bz2 meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.xz |
Second Life viewer sources 1.19.1.0
Diffstat (limited to '')
-rw-r--r-- | linden/indra/llxml/llcontrol.cpp | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/linden/indra/llxml/llcontrol.cpp b/linden/indra/llxml/llcontrol.cpp index d185987..5504a10 100644 --- a/linden/indra/llxml/llcontrol.cpp +++ b/linden/indra/llxml/llcontrol.cpp | |||
@@ -69,8 +69,6 @@ std::set<LLControlBase*> LLControlBase::mChangedControls; | |||
69 | 69 | ||
70 | const S32 CURRENT_VERSION = 101; | 70 | const S32 CURRENT_VERSION = 101; |
71 | 71 | ||
72 | BOOL control_insert_before( LLControlBase* first, LLControlBase* second ); | ||
73 | |||
74 | BOOL LLControl::llsd_compare(const LLSD& a, const LLSD & b) | 72 | BOOL LLControl::llsd_compare(const LLSD& a, const LLSD & b) |
75 | { | 73 | { |
76 | switch (mType) | 74 | switch (mType) |
@@ -1033,6 +1031,13 @@ U32 LLControlGroup::loadFromFile(const LLString& filename, BOOL require_declarat | |||
1033 | return validitems; | 1031 | return validitems; |
1034 | } | 1032 | } |
1035 | 1033 | ||
1034 | struct compare_controls | ||
1035 | { | ||
1036 | bool operator() (const LLControlBase* const a, const LLControlBase* const b) const | ||
1037 | { | ||
1038 | return a->getName() < b->getName(); | ||
1039 | } | ||
1040 | }; | ||
1036 | 1041 | ||
1037 | U32 LLControlGroup::saveToFile(const LLString& filename, BOOL nondefault_only) | 1042 | U32 LLControlGroup::saveToFile(const LLString& filename, BOOL nondefault_only) |
1038 | { | 1043 | { |
@@ -1042,13 +1047,14 @@ U32 LLControlGroup::saveToFile(const LLString& filename, BOOL nondefault_only) | |||
1042 | 1047 | ||
1043 | // place the objects in a temporary container that enforces a sort | 1048 | // place the objects in a temporary container that enforces a sort |
1044 | // order to ease manual editing of the file | 1049 | // order to ease manual editing of the file |
1045 | LLLinkedList< LLControlBase > controls; | 1050 | |
1046 | controls.setInsertBefore( &control_insert_before ); | 1051 | typedef std::set< LLControlBase*, compare_controls > control_list_t; |
1047 | LLString name; | 1052 | control_list_t controls; |
1053 | |||
1048 | for (ctrl_name_table_t::iterator iter = mNameTable.begin(); | 1054 | for (ctrl_name_table_t::iterator iter = mNameTable.begin(); |
1049 | iter != mNameTable.end(); iter++) | 1055 | iter != mNameTable.end(); iter++) |
1050 | { | 1056 | { |
1051 | name = iter->first; | 1057 | LLString name = iter->first; |
1052 | if (name.empty()) | 1058 | if (name.empty()) |
1053 | { | 1059 | { |
1054 | CONTROL_ERRS << "Control with no name found!!!" << llendl; | 1060 | CONTROL_ERRS << "Control with no name found!!!" << llendl; |
@@ -1065,7 +1071,7 @@ U32 LLControlGroup::saveToFile(const LLString& filename, BOOL nondefault_only) | |||
1065 | { | 1071 | { |
1066 | if (!(nondefault_only && (control->mIsDefault))) | 1072 | if (!(nondefault_only && (control->mIsDefault))) |
1067 | { | 1073 | { |
1068 | controls.addDataSorted( control ); | 1074 | controls.insert( control ); |
1069 | } | 1075 | } |
1070 | else | 1076 | else |
1071 | { | 1077 | { |
@@ -1088,12 +1094,12 @@ U32 LLControlGroup::saveToFile(const LLString& filename, BOOL nondefault_only) | |||
1088 | // Write file version | 1094 | // Write file version |
1089 | file << "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>\n"; | 1095 | file << "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>\n"; |
1090 | file << "<settings version = \"" << CURRENT_VERSION << "\">\n"; | 1096 | file << "<settings version = \"" << CURRENT_VERSION << "\">\n"; |
1091 | for( LLControlBase* control = controls.getFirstData(); | 1097 | for (control_list_t::iterator iter = controls.begin(); |
1092 | control != NULL; | 1098 | iter != controls.end(); ++iter) |
1093 | control = controls.getNextData() ) | ||
1094 | { | 1099 | { |
1100 | LLControlBase* control = *iter; | ||
1095 | file << "\t<!--" << control->comment() << "-->" << ENDL; | 1101 | file << "\t<!--" << control->comment() << "-->" << ENDL; |
1096 | name = control->name(); | 1102 | LLString name = control->getName(); |
1097 | switch (control->type()) | 1103 | switch (control->type()) |
1098 | { | 1104 | { |
1099 | case TYPE_U32: | 1105 | case TYPE_U32: |
@@ -1165,7 +1171,7 @@ U32 LLControlGroup::saveToFile(const LLString& filename, BOOL nondefault_only) | |||
1165 | file << "</settings>\n"; | 1171 | file << "</settings>\n"; |
1166 | file.close(); | 1172 | file.close(); |
1167 | 1173 | ||
1168 | return controls.getLength(); | 1174 | return controls.size(); |
1169 | } | 1175 | } |
1170 | 1176 | ||
1171 | void LLControlGroup::applyOverrides(const std::map<std::string, std::string>& overrides) | 1177 | void LLControlGroup::applyOverrides(const std::map<std::string, std::string>& overrides) |
@@ -1435,8 +1441,3 @@ void main() | |||
1435 | } | 1441 | } |
1436 | #endif | 1442 | #endif |
1437 | 1443 | ||
1438 | BOOL control_insert_before( LLControlBase* first, LLControlBase* second ) | ||
1439 | { | ||
1440 | return ( first->getName().compare(second->getName()) < 0 ); | ||
1441 | } | ||
1442 | |||