paragui-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[paragui-cvs] CVS: paragui/src/widgets pglayout.cpp,1.2.6.4,1.2.6.5


From: Alexander Pipelka <address@hidden>
Subject: [paragui-cvs] CVS: paragui/src/widgets pglayout.cpp,1.2.6.4,1.2.6.5
Date: Mon, 17 Jun 2002 09:20:06 -0400

Update of /cvsroot/paragui/paragui/src/widgets
In directory subversions:/tmp/cvs-serv20033/src/widgets

Modified Files:
      Tag: devel-1-0
        pglayout.cpp 
Log Message:
fixed PG_XMLTag to fit current api



Index: pglayout.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/widgets/pglayout.cpp,v
retrieving revision 1.2.6.4
retrieving revision 1.2.6.5
diff -C2 -r1.2.6.4 -r1.2.6.5
*** pglayout.cpp        17 Jun 2002 11:32:59 -0000      1.2.6.4
--- pglayout.cpp        17 Jun 2002 13:20:03 -0000      1.2.6.5
***************
*** 1089,1101 ****
        if(XMLParser->Section & XML_SECTION_HEAD) {
                // create tag description
!               PG_XMLTag* n = new PG_XMLTag;
!               
!               // fill in data
!               n->name = name;
!               const char** a = atts;
!               while(*a != NULL) {
!                       n->atts.push_back(std::string(*a));
!                       a++;
!               }
                PG_Application::GetApp()->SendMessage(NULL, MSG_XMLTAG, 0, 
(MSG_DATA)n);
        }
--- 1089,1093 ----
        if(XMLParser->Section & XML_SECTION_HEAD) {
                // create tag description
!               PG_XMLTag* n = new PG_XMLTag(name, atts);
                PG_Application::GetApp()->SendMessage(NULL, MSG_XMLTAG, 0, 
(MSG_DATA)n);
        }
***************
*** 1227,1229 ****
--- 1219,1269 ----
  
        return true;
+ }
+ 
+ PG_XMLTag::PG_XMLTag(const char* n, const char** a) {
+       // fill in name
+       name = strdup(name);
+       
+       if(a == NULL) {
+               atts = NULL;
+               return;
+       }
+       
+       // get size of arry
+       const char** a0 = a;
+       int s=0;
+       while((*a0) != NULL) {
+               a0++;
+               s++;
+       }
+       
+       // alloc array of pointers
+       atts = (const char**)malloc((s+1)*sizeof(char*));
+       a0 = atts;
+       
+       // copy strings to new array
+       while(*a != NULL) {
+               *a0 = strdup(*a);
+               a0++;
+               a++;
+       }
+       *a0 = NULL;
+ }
+ 
+ PG_XMLTag::~PG_XMLTag() {
+       if(name != NULL) {
+               free((void*)name);
+       }
+       
+       if(atts == NULL) {
+               return;
+       }
+       
+       const char** a = atts;
+       while(*a) {
+               free((void*)*a);
+               a++;
+       }
+       
+       free((void*)atts);
  }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]