src/tools/uic/cpp/cppwriteinitialization.cpp
branchRCL_3
changeset 5 d3bac044e0f0
parent 4 3b1da2848fc7
child 7 3f74d0d4af4c
equal deleted inserted replaced
4:3b1da2848fc7 5:d3bac044e0f0
  2785 {
  2785 {
  2786     if (directives.isEmpty())
  2786     if (directives.isEmpty())
  2787         return;
  2787         return;
  2788 
  2788 
  2789     QMap<QString, bool> map; // bool is dummy. The idea is to sort that (always generate in the same order) by putting a set into a map
  2789     QMap<QString, bool> map; // bool is dummy. The idea is to sort that (always generate in the same order) by putting a set into a map
  2790     foreach (QString str, directives)
  2790     foreach (const QString &str, directives)
  2791         map[str] = true;
  2791         map.insert(str, true);
  2792 
  2792 
  2793     if (map.size() == 1) {
  2793     if (map.size() == 1) {
  2794         outputStream << "#ifndef " << map.constBegin().key() << endl;
  2794         outputStream << "#ifndef " << map.constBegin().key() << endl;
  2795         return;
  2795         return;
  2796     }
  2796     }
  2797 
  2797 
  2798     outputStream << "#if";
  2798     outputStream << "#if";
  2799     bool doOr = false;
  2799     bool doOr = false;
  2800     foreach (QString str, map.keys()) {
  2800     foreach (const QString &str, map.keys()) {
  2801         if (doOr)
  2801         if (doOr)
  2802             outputStream << " ||";
  2802             outputStream << " ||";
  2803         outputStream << " !defined(" << str << ')';
  2803         outputStream << " !defined(" << str << ')';
  2804         doOr = true;
  2804         doOr = true;
  2805     }
  2805     }