< prev index next >
src/jdk.incubator.jpackage/share/native/libapplauncher/OrderedMap.h
Print this page
*** 87,106 ****
--- 87,111 ----
FAllowDuplicates = false;
}
OrderedMap(const OrderedMap<key_type, mapped_type> &Value) {
Append(Value);
+ FAllowDuplicates = Value.GetAllowDuplicates();
}
~OrderedMap() {
Clear();
}
void SetAllowDuplicates(bool Value) {
FAllowDuplicates = Value;
}
+ bool GetAllowDuplicates() const {
+ return FAllowDuplicates;
+ }
+
iterator begin() {
return FList.begin();
}
const_iterator begin() const {
*** 212,221 ****
--- 217,252 ----
}
return result;
}
+ bool GetKey(int index, key_type &Value) {
+ if (index < 0 || index >= (int)FList.size()) {
+ return false;
+ }
+ container_type *item = FList.at(index);
+ if (item != NULL) {
+ Value = item->first;
+ return true;
+ }
+
+ return false;
+ }
+
+ bool GetValue(int index, mapped_type &Value) {
+ if (index < 0 || index >= (int)FList.size()) {
+ return false;
+ }
+ container_type *item = FList.at(index);
+ if (item != NULL) {
+ Value = item->second;
+ return true;
+ }
+
+ return false;
+ }
+
mapped_type &operator[](key_type Key) {
container_type* item = FMap[Key];
assert(item != NULL);
if (item != NULL) {
*** 225,234 ****
--- 256,266 ----
throw std::invalid_argument("Key not found");
}
OrderedMap& operator= (OrderedMap &Value) {
Clear();
+ FAllowDuplicates = Value.GetAllowDuplicates();
Append(Value);
return *this;
}
size_t Count() {
< prev index next >