]> git.saurik.com Git - wxWidgets.git/blobdiff - utils/HelpGen/src/HelpGen.cpp
added wxRTTI macros to wxPopupComboWindow and wxPopupTransientWindow
[wxWidgets.git] / utils / HelpGen / src / HelpGen.cpp
index 41b7dd7a2d5145d7b3e4f98e0586194e33f7904d..1cada46acb4152aac99bb1a46a34d834bca9db6f 100644 (file)
@@ -64,6 +64,7 @@
 
 #include "wx/file.h"
 #include "wx/regex.h"
 
 #include "wx/file.h"
 #include "wx/regex.h"
+#include "wx/hash.h"
 
 // C++ parsing classes
 #include "cjparser.h"
 
 // C++ parsing classes
 #include "cjparser.h"
@@ -92,7 +93,7 @@ public:
     virtual int OnRun();
 };
 
     virtual int OnRun();
 };
 
-IMPLEMENT_APP(HelpGenApp);
+// IMPLEMENT_APP(HelpGenApp);
 
 // -----------------------------------------------------------------------------
 // private functions
 
 // -----------------------------------------------------------------------------
 // private functions
@@ -787,6 +788,21 @@ int HelpGenApp::OnRun()
     return 0;
 }
 
     return 0;
 }
 
+int main(int argc, char **argv)
+{
+    wxInitializer initializer;
+    if ( !initializer )
+    {
+        fprintf(stderr, "Failed to initialize the wxWindows library, aborting.");
+
+        return -1;
+    }
+       HelpGenApp app;
+       app.argc = argc;
+       app.argv = argv;
+       return app.OnRun();
+}
+
 // -----------------------------------------------------------------------------
 // HelpGenVisitor implementation
 // -----------------------------------------------------------------------------
 // -----------------------------------------------------------------------------
 // HelpGenVisitor implementation
 // -----------------------------------------------------------------------------
@@ -894,6 +910,7 @@ void HelpGenVisitor::CloseClass()
         m_inClass = FALSE;
         m_classname.clear();
     }
         m_inClass = FALSE;
         m_classname.clear();
     }
+       m_file.FlushAll();
 }
 
 void HelpGenVisitor::EndVisit()
 }
 
 void HelpGenVisitor::EndVisit()
@@ -905,6 +922,11 @@ void HelpGenVisitor::EndVisit()
     m_fileHeader.Empty();
 
     m_file.FlushAll();
     m_fileHeader.Empty();
 
     m_file.FlushAll();
+       if (m_file.IsOpened())
+       {
+               m_file.Flush();
+               m_file.Close();
+       }
 
     wxLogVerbose("%s: finished generating for the current file.",
                  GetCurrentTime("%H:%M:%S"));
 
     wxLogVerbose("%s: finished generating for the current file.",
                  GetCurrentTime("%H:%M:%S"));
@@ -921,6 +943,12 @@ void HelpGenVisitor::VisitClass( spClass& cl )
 {
     CloseClass();
 
 {
     CloseClass();
 
+       if (m_file.IsOpened())
+       {
+               m_file.Flush();
+               m_file.Close();
+       }
+
     wxString name = cl.GetName();
 
     if ( m_ignoreNames.IgnoreClass(name) ) {
     wxString name = cl.GetName();
 
     if ( m_ignoreNames.IgnoreClass(name) ) {
@@ -1089,6 +1117,8 @@ void HelpGenVisitor::VisitClass( spClass& cl )
     InsertDataStructuresHeader();
     InsertTypedefDocs();
     InsertEnumDocs();
     InsertDataStructuresHeader();
     InsertTypedefDocs();
     InsertEnumDocs();
+
+       m_file.Flush();
 }
 
 void HelpGenVisitor::VisitEnumeration( spEnumeration& en )
 }
 
 void HelpGenVisitor::VisitEnumeration( spEnumeration& en )
@@ -1235,16 +1265,28 @@ void HelpGenVisitor::VisitOperation( spOperation& op )
         funcname = dtor;
     }
 
         funcname = dtor;
     }
 
-    m_textFunc.Printf("\n"
-                      "\\membersection{%s::%s}\\label{%s}\n"
-                      "\n"
-                      "\\%sfunc{%s%s}{%s}{",
+       static wxHashTable sg_MemberSectionsDone(wxKEY_STRING);
+       wxString memberSectionName;
+       memberSectionName.Printf("%s::%s", m_classname.c_str(), funcname.c_str());
+
+       m_textFunc = wxEmptyString;
+       if (!sg_MemberSectionsDone.Get(memberSectionName))
+       {
+               m_textFunc.Printf("\n"
+                      "\\membersection{%s::%s}\\label{%s}\n",
                       m_classname.c_str(), funcname.c_str(),
                       m_classname.c_str(), funcname.c_str(),
-                      MakeLabel(m_classname, funcname).c_str(),
+                      MakeLabel(m_classname, funcname).c_str());
+               sg_MemberSectionsDone.Put(memberSectionName, (wxObject*) & sg_MemberSectionsDone);
+       }
+
+       wxString func;
+       func.Printf("\n"
+                      "\\%sfunc{%s%s}{%s}{",
                       op.mIsConstant ? "const" : "",
                       op.mIsVirtual ? "virtual " : "",
                       op.mRetType.c_str(),
                       funcname.c_str());
                       op.mIsConstant ? "const" : "",
                       op.mIsVirtual ? "virtual " : "",
                       op.mRetType.c_str(),
                       funcname.c_str());
+       m_textFunc += func;
 }
 
 void HelpGenVisitor::VisitParameter( spParameter& param )
 }
 
 void HelpGenVisitor::VisitParameter( spParameter& param )
@@ -2134,6 +2176,16 @@ static const wxString GetVersionString()
 
 /*
    $Log$
 
 /*
    $Log$
+   Revision 1.20  2002/01/03 14:23:33  JS
+   Added code to make it not duplicate membersections for overloaded functions
+
+   Revision 1.19  2002/01/03 13:34:12  JS
+   Added FlushAll to CloseClass, otherwise text was only flushed right at the end,
+   and appeared in one file.
+
+   Revision 1.18  2002/01/03 12:02:47  JS
+   Added main() and corrected VC++ project settings
+
    Revision 1.17  2001/11/30 21:43:35  VZ
    now the methods are sorted in the correct order in the generated docs
 
    Revision 1.17  2001/11/30 21:43:35  VZ
    now the methods are sorted in the correct order in the generated docs