MCPcopy Create free account
hub / github.com/OpenFodder/openfodder / merge

Method merge

Source/Utils/ini.hpp:515–536  ·  view source on GitHub ↗

Alows another INI's contents to be insert into another, with the ability to retain the original values

Source from the content-addressed store, hash-verified

513
514 //Alows another INI's contents to be insert into another, with the ability to retain the original values
515 void merge(ini_t& other, bool retainValues = true)
516 {
517 for (typename INI::sectionsit_t i = other.sections.begin(); i != other.sections.end(); i++)
518 {
519 if (!select(i->first)) //Create and insert all key values into a missing section
520 {
521 keys_t* keys = new keys_t(*i->second);
522 sections.insert(std::make_pair(i->first, keys));
523 }
524 else
525 {
526 for (typename INI::keysit_t j = i->second->begin(); j != i->second->end(); j++)
527 {
528 keysit_t it = current->find(j->first);
529 if (it == current->end())
530 current->insert(std::make_pair(j->first, j->second));
531 else if (!retainValues)
532 it->second = j->second;
533 }
534 }
535 }
536 }
537
538private:
539 ///Functions

Callers

nothing calls this directly

Calls 4

insertMethod · 0.80
findMethod · 0.80
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected