[Cmake-commits] [cmake-commits] king committed cmXMLParser.cxx 1.9 1.10 cmXMLParser.h 1.5 1.6

cmake-commits at cmake.org cmake-commits at cmake.org
Tue Feb 24 15:43:51 EST 2009


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv6694/Source

Modified Files:
	cmXMLParser.cxx cmXMLParser.h 
Log Message:
ENH: Added cmXMLParser::FindAttribute method

This method will help subclasses look for element attributes in their
StartElement methods.


Index: cmXMLParser.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmXMLParser.cxx,v
retrieving revision 1.9
retrieving revision 1.10
diff -C 2 -d -r1.9 -r1.10
*** cmXMLParser.cxx	24 Feb 2009 20:43:37 -0000	1.9
--- cmXMLParser.cxx	24 Feb 2009 20:43:49 -0000	1.10
***************
*** 182,185 ****
--- 182,202 ----
  
  //----------------------------------------------------------------------------
+ const char* cmXMLParser::FindAttribute(const char** atts,
+                                        const char* attribute)
+ {
+   if(atts && attribute)
+     {
+     for(const char** a = atts; *a && *(a+1); a += 2)
+       {
+       if(strcmp(*a, attribute) == 0)
+         {
+         return *(a+1);
+         }
+       }
+     }
+   return 0;
+ }
+ 
+ //----------------------------------------------------------------------------
  void cmXMLParserStartElement(void* parser, const char *name,
                                const char **atts)

Index: cmXMLParser.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmXMLParser.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C 2 -d -r1.5 -r1.6
*** cmXMLParser.h	24 Feb 2009 20:43:37 -0000	1.5
--- cmXMLParser.h	24 Feb 2009 20:43:49 -0000	1.6
***************
*** 106,109 ****
--- 106,112 ----
    int ParseBuffer(const char* buffer);
  
+   /** Helps subclasses search for attributes on elements.  */
+   static const char* FindAttribute(const char** atts, const char* attribute);
+ 
    //! Callbacks for the expat
    friend void cmXMLParserStartElement(void*, const char*, const char**);



More information about the Cmake-commits mailing list