[cgma-dev] r4723 - cgm/branches/merge-cubit12/geom/OCC

jiangtao_ma at yahoo.com jiangtao_ma at yahoo.com
Thu Apr 7 10:36:31 CDT 2011


Author: janehu
Date: 2011-04-07 10:36:30 -0500 (Thu, 07 Apr 2011)
New Revision: 4723

Added:
   cgm/branches/merge-cubit12/geom/OCC/OCCShapeAttributeSet.cpp_3424
Modified:
   cgm/branches/merge-cubit12/geom/OCC/OCCShapeAttributeSet.cpp
Log:
bug fix for handling attrib's string with space case.

Modified: cgm/branches/merge-cubit12/geom/OCC/OCCShapeAttributeSet.cpp
===================================================================
--- cgm/branches/merge-cubit12/geom/OCC/OCCShapeAttributeSet.cpp	2011-04-07 15:35:11 UTC (rev 4722)
+++ cgm/branches/merge-cubit12/geom/OCC/OCCShapeAttributeSet.cpp	2011-04-07 15:36:30 UTC (rev 4723)
@@ -421,22 +421,15 @@
   DLIList<double> doubles;
   DLIList<int> ints;
   int c_num, length;
-
+  char s;
   do {
     IS >> c_num; //length of name string
-    IS >> buffer; 
-    if(buffer.length() >= c_num)
-      type = buffer.substr( 0, c_num ); //attribute name string
-    else
+    IS.get(); //' '
+    type.clear();
+    for(int j = 0; j < c_num; j ++)
     {
-      c_num -= buffer.length();
-      type.append( buffer );
-      do{
-        IS >> buffer;
-        type.push_back(' ');
-        type.append(buffer.substr( 0, c_num )); 
-        c_num -= (buffer.length() + 1);
-      }while (c_num > 0);
+      IS.get(s);
+      type.push_back(s);
     }
 
     CubitString* string_prt = new CubitString(type.c_str());
@@ -447,19 +440,12 @@
     for(int i =0; i < length; i++)
     { 
       IS >> c_num ; //length of each string
-      IS >> buffer;
-      if(buffer.length() >= c_num)
-        stringdata = buffer.substr( 0, c_num );
-      else
+      IS.get(); //' '
+      stringdata.clear();
+      for(int j = 0; j < c_num; j ++)
       {
-        c_num -= buffer.length();
-        stringdata.append( buffer );
-        do{
-          IS >> buffer;
-          stringdata.push_back(' ');
-          stringdata.append(buffer.substr( 0, c_num ));


More information about the cgma-dev mailing list