[cmake-commits] alex committed cmDocumentation.cxx 1.62 1.63

cmake-commits at cmake.org cmake-commits at cmake.org
Wed Jan 9 16:59:03 EST 2008


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

Modified Files:
	cmDocumentation.cxx 
Log Message:
ENH: sort the module files alphabetically when generating the documentation
of rht modules

Alex


Index: cmDocumentation.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmDocumentation.cxx,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -d -r1.62 -r1.63
--- cmDocumentation.cxx	29 Dec 2007 16:53:36 -0000	1.62
+++ cmDocumentation.cxx	9 Jan 2008 21:59:01 -0000	1.63
@@ -445,14 +445,23 @@
 ::CreateModuleDocsForDir(cmsys::Directory& dir, 
                          cmDocumentationSection &moduleSection)
 {
+  // sort the files alphabetically, so the docs for one module are easier 
+  // to find than if they are in random order
+  std::vector<std::string> sortedFiles;
   for(unsigned int i = 0; i < dir.GetNumberOfFiles(); ++i)
+  {
+    sortedFiles.push_back(dir.GetFile(i));
+  }
+  std::sort(sortedFiles.begin(), sortedFiles.end());
+
+  for(std::vector<std::string>::const_iterator fname = sortedFiles.begin();
+      fname!=sortedFiles.end(); ++fname)
     {
-    std::string fname = dir.GetFile(i);
-    if(fname.length() > 6)
+    if(fname->length() > 6)
       {
-      if(fname.substr(fname.length()-6, 6) == ".cmake")
+      if(fname->substr(fname->length()-6, 6) == ".cmake")
         {
-        std::string moduleName = fname.substr(0, fname.length()-6);
+        std::string moduleName = fname->substr(0, fname->length()-6);
         // this check is to avoid creating documentation for the modules with
         // the same name in multiple directories of CMAKE_MODULE_PATH
         if (this->ModulesFound.find(moduleName) == this->ModulesFound.end())
@@ -460,7 +469,7 @@
           this->ModulesFound.insert(moduleName);
           std::string path = dir.GetPath();
           path += "/";
-          path += fname;
+          path += (*fname);
           this->CreateSingleModule(path.c_str(), moduleName.c_str(), 
                                    moduleSection);
           }



More information about the Cmake-commits mailing list