This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  cf1a414cfb2917588a6eff20cc8cdda4c98264d9 (commit)
       via  c50fefc0ff7680922390879cbdb4fbb9b9c88a7d (commit)
      from  634c78061295a4633b7cdd651cbf6eed98642c84 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cf1a414cfb2917588a6eff20cc8cdda4c98264d9
commit cf1a414cfb2917588a6eff20cc8cdda4c98264d9
Merge: 634c780 c50fefc
Author:     Gregor Jasny <gja...@googlemail.com>
AuthorDate: Sun Feb 21 12:54:52 2016 -0500
Commit:     CMake Topic Stage <kwro...@kitware.com>
CommitDate: Sun Feb 21 12:54:52 2016 -0500

    Merge topic 'xcode-refactor-xcodeobject' into next
    
    c50fefc0 Refactor XCode block writes to allow any number of nesting.


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c50fefc0ff7680922390879cbdb4fbb9b9c88a7d
commit c50fefc0ff7680922390879cbdb4fbb9b9c88a7d
Author:     Robert Goulet <robert.gou...@autodesk.com>
AuthorDate: Fri Feb 19 14:00:19 2016 -0500
Commit:     Gregor Jasny <gja...@googlemail.com>
CommitDate: Sun Feb 21 17:13:26 2016 +0100

    Refactor XCode block writes to allow any number of nesting.

diff --git a/Source/cmXCodeObject.cxx b/Source/cmXCodeObject.cxx
index 5bc34c1..911e154 100644
--- a/Source/cmXCodeObject.cxx
+++ b/Source/cmXCodeObject.cxx
@@ -111,102 +111,102 @@ void cmXCodeObject::Print(std::ostream& out)
   for(i = this->ObjectAttributes.begin();
       i != this->ObjectAttributes.end(); ++i)
     {
-    cmXCodeObject* object = i->second;
-    if(i->first != "isa")
-      {
-      cmXCodeObject::Indent(3*indentFactor, out);
-      }
-    else
-      {
+    if(i->first == "isa")
       continue;
-      }
-    if(object->TypeValue == OBJECT_LIST)
-      {
-      out << i->first << " = (" << separator;
-      for(unsigned int k = 0; k < i->second->List.size(); k++)
-        {
-        cmXCodeObject::Indent(4*indentFactor, out);
-        out << i->second->List[k]->Id;
-        i->second->List[k]->PrintComment(out);
-        out << "," << separator;
-        }
-      cmXCodeObject::Indent(3*indentFactor, out);
-      out << ");" << separator;
-      }
-    else if(object->TypeValue == ATTRIBUTE_GROUP)
+
+    PrintAttribute(out, 3, separator, indentFactor, i->first, i->second, this);
+    }
+  cmXCodeObject::Indent(2*indentFactor, out);
+  out << "};\n";
+}
+
+void cmXCodeObject::PrintAttribute(std::ostream& out, const int level,
+                                   const std::string separator,
+                                   const int factor, const std::string& name,
+                                   const cmXCodeObject* object,
+                                   const cmXCodeObject* parent)
+{
+  cmXCodeObject::Indent(level * factor, out);
+  switch(object->TypeValue)
+    {
+    case OBJECT_LIST:
       {
-      std::map<std::string, cmXCodeObject*>::iterator j;
-      out << i->first << " = {";
-      if(separator == "\n")
+      out << name << " = (";
+      if(parent->TypeValue != ATTRIBUTE_GROUP)
         {
         out << separator;
         }
-      for(j = object->ObjectAttributes.begin(); j !=
-            object->ObjectAttributes.end(); ++j)
+      for(unsigned int i = 0; i < object->List.size(); ++i)
         {
-        cmXCodeObject::Indent(4 *indentFactor, out);
-
-        if(j->second->TypeValue == STRING)
-          {
-          cmXCodeObject::PrintString(out,j->first);
-          out << " = ";
-          j->second->PrintString(out);
-          out << ";";
-          }
-        else if(j->second->TypeValue == OBJECT_LIST)
+        if(object->List[i]->TypeValue == STRING)
           {
-          cmXCodeObject::PrintString(out,j->first);
-          out << " = (";
-          for(unsigned int k = 0; k < j->second->List.size(); k++)
+          object->List[i]->PrintString(out);
+          if(i+1 < object->List.size())
             {
-            if(j->second->List[k]->TypeValue == STRING)
-              {
-              j->second->List[k]->PrintString(out);
-              out << ", ";
-              }
-            else
-              {
-              out << "List_" << k << "_TypeValue_IS_NOT_STRING, ";
-              }
+            out << ",";
             }
-          out << ");";
           }
         else
           {
-          cmXCodeObject::PrintString(out,j->first);
-          out << " = error_unexpected_TypeValue_" <<
-            j->second->TypeValue << ";";
+          cmXCodeObject::Indent((level + 1) * factor, out);
+          out << object->List[i]->Id;
+          object->List[i]->PrintComment(out);
+          out << "," << separator;
           }
+        }
+      if(parent->TypeValue != ATTRIBUTE_GROUP)
+        {
+        cmXCodeObject::Indent(level * factor, out);
+        }
+      out << ");" << separator;
+      }
+      break;
 
+    case ATTRIBUTE_GROUP:
+      {
+      out << name << " = {";
+      if(separator == "\n")
+        {
         out << separator;
         }
-      cmXCodeObject::Indent(3 *indentFactor, out);
+      std::map<std::string, cmXCodeObject*>::const_iterator i;
+      for(i = object->ObjectAttributes.begin();
+          i != object->ObjectAttributes.end(); ++i)
+        {
+        PrintAttribute(out, (level + 1) * factor, separator, factor,
+                       i->first, i->second, object);
+        }
+      cmXCodeObject::Indent(level * factor, out);
       out << "};" << separator;
       }
-    else if(object->TypeValue == OBJECT_REF)
+      break;
+
+    case OBJECT_REF:
       {
-      cmXCodeObject::PrintString(out,i->first);
+      cmXCodeObject::PrintString(out, name);
       out << " = " << object->Object->Id;
-      if(object->Object->HasComment() && i->first != "remoteGlobalIDString")
+      if(object->Object->HasComment() && name != "remoteGlobalIDString")
         {
         object->Object->PrintComment(out);
         }
       out << ";" << separator;
       }
-    else if(object->TypeValue == STRING)
+      break;
+
+    case STRING:
       {
-      cmXCodeObject::PrintString(out,i->first);
+      cmXCodeObject::PrintString(out, name);
       out << " = ";
       object->PrintString(out);
       out << ";" << separator;
       }
-    else
+      break;
+
+    default:
       {
-      out << "what is this?? " << i->first << "\n";
+      break;
       }
     }
-  cmXCodeObject::Indent(2*indentFactor, out);
-  out << "};\n";
 }
 
 //----------------------------------------------------------------------------
diff --git a/Source/cmXCodeObject.h b/Source/cmXCodeObject.h
index bd0f43f..2d876da 100644
--- a/Source/cmXCodeObject.h
+++ b/Source/cmXCodeObject.h
@@ -75,6 +75,10 @@ public:
   }
   static void Indent(int level, std::ostream& out);
   void Print(std::ostream& out);
+  void PrintAttribute(std::ostream& out, const int level,
+                      const std::string separator, const int factor,
+                      const std::string& name, const cmXCodeObject* object,
+                      const cmXCodeObject* parent);
   virtual void PrintComment(std::ostream&) {}
 
   static void PrintList(std::vector<cmXCodeObject*> const&,

-----------------------------------------------------------------------

Summary of changes:
 Source/cmXCodeObject.cxx |  126 +++++++++++++++++++++++-----------------------
 Source/cmXCodeObject.h   |    4 ++
 2 files changed, 67 insertions(+), 63 deletions(-)


hooks/post-receive
-- 
CMake
_______________________________________________
Cmake-commits mailing list
Cmake-commits@cmake.org
http://public.kitware.com/mailman/listinfo/cmake-commits

Reply via email to