X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a5a0dd06b67fecd5e571bd9d4221101393d5561b..d77836e48cf1a0f7575cd1ce66f59f5bc07e5b56:/utils/HelpGen/src/docripper.cpp diff --git a/utils/HelpGen/src/docripper.cpp b/utils/HelpGen/src/docripper.cpp index 9599d61920..bcb0e5d180 100644 --- a/utils/HelpGen/src/docripper.cpp +++ b/utils/HelpGen/src/docripper.cpp @@ -6,7 +6,7 @@ // Created: 22/09/98 // RCS-ID: $Id$ // Copyright: (c) Aleskandars Gluchovas -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// // For compilers that support precompilation, includes "wx/wx.h". @@ -22,13 +22,17 @@ #include "docripper.h" -#include +#if wxUSE_IOSTREAMH + #include +#else + #include +#endif // script templates // ***** currently only HTML versions of variouse templates available ***** // -static const char* HTM_TopTempl = +static const char* HTM_TopTempl = "\n\ \n\n\n\n\n\ @@ -38,7 +42,7 @@ $(REFLIST)\

\n\n\ "; -static const char* HTM_ContentIdxTempl = +static const char* HTM_ContentIdxTempl = "\ \n\ @@ -49,7 +53,7 @@ $(REFLIST)\

\n\n\ "; -static const char* HTM_SuperContentTempl = +static const char* HTM_SuperContentTempl = "\ \n\ @@ -58,7 +62,7 @@ static const char* HTM_SuperContentTempl = $(BODY)\n\ "; -static const char* HTM_SubContentTempl = +static const char* HTM_SubContentTempl = "\ \n\ @@ -100,469 +104,456 @@ static const char* HTM_DeadRefTempl = RipperDocGen::RipperDocGen() - : mTopTempl ( HTM_TopTempl ), - mContentIdxTempl ( HTM_ContentIdxTempl ), - mSuperContentTempl( HTM_SuperContentTempl ), - mSubContentTempl ( HTM_SubContentTempl ), - mOutLineTempl ( HTM_OutLineTempl ), - mOutLine1Templ ( HTM_OutLine1Templ ), - - mRefTempl ( HTM_RefTempl ), - mDeadRefTempl ( HTM_DeadRefTempl ), - - mpCurClassSect(0) -{ // topIndex is not referenced - mpTopIdx = new ScriptSection( "Source Code Contents" , "", &mTopTempl , 0 ); - mpClassIdx = new ScriptSection( "Classes Reference" , "", &mContentIdxTempl, &mRefTempl ); - mpEnumIdx = new ScriptSection( "Enumerations Reference" , "", &mContentIdxTempl, &mRefTempl ); - mpTypeDefIdx = new ScriptSection( "Type Definitions Reference" , "", &mContentIdxTempl, &mRefTempl ); - mpMacroIdx = new ScriptSection( "Macros Reference" , "", &mContentIdxTempl, &mRefTempl ); - mpGlobalVarsIdx = new ScriptSection( "Global Variables Reference" , "", &mContentIdxTempl, &mRefTempl ); - mpGlobalFuncIdx = new ScriptSection( "Global Functions Reference", "", &mContentIdxTempl, &mRefTempl ); - mpConstIdx = new ScriptSection( "Constants Reference" , "", &mContentIdxTempl, &mRefTempl ); - - // assemble top index - mpTopIdx->AddSection( mpClassIdx , 1 ); - mpTopIdx->AddSection( mpEnumIdx , 1 ); - mpTopIdx->AddSection( mpTypeDefIdx , 1 ); - mpTopIdx->AddSection( mpMacroIdx , 1 ); - mpTopIdx->AddSection( mpGlobalVarsIdx, 1 ); - mpTopIdx->AddSection( mpGlobalFuncIdx, 1 ); - mpTopIdx->AddSection( mpConstIdx , 1 ); - - // register reserved variables for index and description templates - ScriptSection::RegisterTemplate( mTopTempl ); - ScriptSection::RegisterTemplate( mContentIdxTempl ); - ScriptSection::RegisterTemplate( mSuperContentTempl ); - ScriptSection::RegisterTemplate( mSubContentTempl ); - ScriptSection::RegisterTemplate( mOutLineTempl ); - ScriptSection::RegisterTemplate( mOutLine1Templ ); - ScriptSection::RegisterTemplate( mRefTempl ); - ScriptSection::RegisterTemplate( mDeadRefTempl ); - - // create the top-most (interfile) context - mpFileBinderCtx = new spFile(); - - // the default script is HTML - mTags = get_HTML_markup_tags(); - - mpParser = 0; // no default parser! + : mTopTempl ( HTM_TopTempl ), + mContentIdxTempl ( HTM_ContentIdxTempl ), + mSuperContentTempl( HTM_SuperContentTempl ), + mSubContentTempl ( HTM_SubContentTempl ), + mOutLineTempl ( HTM_OutLineTempl ), + mOutLine1Templ ( HTM_OutLine1Templ ), + + mRefTempl ( HTM_RefTempl ), + mDeadRefTempl ( HTM_DeadRefTempl ), + + mpCurClassSect(0) +{ + // topIndex is not referenced + mpTopIdx = new ScriptSection( "Source Code Contents" , wxEmptyString, &mTopTempl , 0 ); + mpClassIdx = new ScriptSection( "Classes Reference" , wxEmptyString, &mContentIdxTempl, &mRefTempl ); + mpEnumIdx = new ScriptSection( "Enumerations Reference" , wxEmptyString, &mContentIdxTempl, &mRefTempl ); + mpTypeDefIdx = new ScriptSection( "Type Definitions Reference" , wxEmptyString, &mContentIdxTempl, &mRefTempl ); + mpMacroIdx = new ScriptSection( "Macros Reference" , wxEmptyString, &mContentIdxTempl, &mRefTempl ); + mpGlobalVarsIdx = new ScriptSection( "Global Variables Reference" , wxEmptyString, &mContentIdxTempl, &mRefTempl ); + mpGlobalFuncIdx = new ScriptSection( "Global Functions Reference", wxEmptyString, &mContentIdxTempl, &mRefTempl ); + mpConstIdx = new ScriptSection( "Constants Reference" , wxEmptyString, &mContentIdxTempl, &mRefTempl ); + + // assemble top index + mpTopIdx->AddSection( mpClassIdx , 1 ); + mpTopIdx->AddSection( mpEnumIdx , 1 ); + mpTopIdx->AddSection( mpTypeDefIdx , 1 ); + mpTopIdx->AddSection( mpMacroIdx , 1 ); + mpTopIdx->AddSection( mpGlobalVarsIdx, 1 ); + mpTopIdx->AddSection( mpGlobalFuncIdx, 1 ); + mpTopIdx->AddSection( mpConstIdx , 1 ); + + // register reserved variables for index and description templates + ScriptSection::RegisterTemplate( mTopTempl ); + ScriptSection::RegisterTemplate( mContentIdxTempl ); + ScriptSection::RegisterTemplate( mSuperContentTempl ); + ScriptSection::RegisterTemplate( mSubContentTempl ); + ScriptSection::RegisterTemplate( mOutLineTempl ); + ScriptSection::RegisterTemplate( mOutLine1Templ ); + ScriptSection::RegisterTemplate( mRefTempl ); + ScriptSection::RegisterTemplate( mDeadRefTempl ); + + // create the top-most (interfile) context + mpFileBinderCtx = new spFile(); + + // the default script is HTML + m_Tags = get_HTML_markup_tags(); + + mpParser = 0; // no default parser! } void RipperDocGen::Init( SourceParserBase* pParser ) { - mpParser = pParser; + mpParser = pParser; } RipperDocGen::~RipperDocGen() { - delete mpFileBinderCtx; + delete mpFileBinderCtx; } -void RipperDocGen::AppendComments( spContext& fromContext, string& str ) +void RipperDocGen::AppendComments( spContext& fromContext, wxString& str ) { - if ( !fromContext.HasComments() ) return; - - size_t start = str.length(); - - str += mTags[TAG_BOLD].end; - str += mTags[TAG_PARAGRAPH].start; - - MCommentListT& lst = fromContext.GetCommentList(); - - for( size_t i = 0; i != lst.size(); ++i ) - { - - if ( i != 0 ) - - if ( lst[i]->StartsParagraph() ) - { - str += mTags[TAG_PARAGRAPH].start; - } - - str += lst[i]->mText; - } - - // remove new lines, and insert paragraph breaks - // if empty lines found - - size_t len = str.length(); - - for( size_t n = start; n != len; ++n ) - - if ( str[n] == 10 || - str[n] == 13 ) - { - if ( n + 2 < len ) - { - if ( ( str[n] == 13 && str[n+1] == 10 && // FIXME:: quick-hack - str[n+2] == 13 ) || - ( str[n] == 10 && str[n+1] == 10 ) - ) - { - str.insert( n + 1, "

" ); // FIXME:: quick-hack - len += 3; - } - } - - str[n] = ' '; - } - - str += mTags[TAG_PARAGRAPH].end; + if ( !fromContext.HasComments() ) return; + + size_t start = str.length(); + + str += m_Tags[TAG_BOLD].end; + str += m_Tags[TAG_PARAGRAPH].start; + + MCommentListT& lst = fromContext.GetCommentList(); + + for( size_t i = 0; i != lst.size(); ++i ) + { + + if ( i != 0 ) + + if ( lst[i]->StartsParagraph() ) + { + str += m_Tags[TAG_PARAGRAPH].start; + } + + str += lst[i]->m_Text; + } + + // remove new lines, and insert paragraph breaks + + // if empty lines found + + size_t len = str.length(); + + for( size_t n = start; n != len; ++n ) + + if ( str[n] == 10 || + str[n] == 13 ) + { + if ( n + 2 < len ) + { + if ( ( str[n] == 13 && str[n+1] == 10 && // FIXME:: quick-hack + str[n+2] == 13 ) || + ( str[n] == 10 && str[n+1] == 10 ) + ) + { + str.insert( n + 1, _T("

") ); // FIXME:: quick-hack + len += 3; + } + } + str[n] = _T(' '); + } + str += m_Tags[TAG_PARAGRAPH].end; } -void RipperDocGen::AppendMulitilineStr( string& st, string& mlStr ) +void RipperDocGen::AppendMulitilineStr( wxString& st, wxString& mlStr ) { - st = mTags[TAG_FIXED_FONT].start; - st += mlStr; - st += mTags[TAG_FIXED_FONT].end; + st = m_Tags[TAG_FIXED_FONT].start; + st += mlStr; + st += m_Tags[TAG_FIXED_FONT].end; } -void RipperDocGen::AppendHighlightedSource( string& st, string source ) +void RipperDocGen::AppendHighlightedSource( wxString& st, wxString source ) { - // FIXME:: below should not be fixed :) - char buf[1024*32]; - - // DBG::: -// ASSERT( source.length() + 1 < sizeof(buf) ); - - strcpy( buf, source.c_str() ); - - // highlight things - mSrcPainter.Init(); - mSrcPainter.ProcessSource( buf, strlen(buf) ); - mSrcPainter.GetResultString( st, mTags ); + // FIXME:: below should not be fixed :) + wxChar buf[1024*32]; + + // DBG::: +// ASSERT( source.length() + 1 < sizeof(buf) ); + + wxStrcpy( buf, source.c_str() ); + + // highlight things + mSrcPainter.Init(); + mSrcPainter.ProcessSource( buf, strlen(buf) ); + mSrcPainter.GetResultString( st, m_Tags ); } bool RipperDocGen::CheckIfUncommented( spContext& ctx, ScriptSection& toSect ) { - if ( ctx.HasComments() ) return 0; + if ( ctx.HasComments() ) return 0; - toSect.AddReference( - new ScriptSection( GetScopedName( ctx ), "", 0, &mDeadRefTempl ) - ); + toSect.AddReference( + new ScriptSection( GetScopedName( ctx ), wxEmptyString, 0, &mDeadRefTempl ) + ); - return 1; + return 1; } ScriptTemplate* RipperDocGen::GetRefTemplFor( spContext& ctx ) { - if ( ctx.HasComments() ) - - return &mRefTempl; - else - return &mDeadRefTempl; + if ( ctx.HasComments() ) + return &mRefTempl; + else + return &mDeadRefTempl; } -string RipperDocGen::GetScopedName( spContext& ofCtx ) +wxString RipperDocGen::GetScopedName( spContext& ofCtx ) { - if ( ofCtx.IsInFile() ) return ofCtx.GetName(); - else - return ofCtx.GetOutterContext()->GetName() + - "::" + ofCtx.GetName(); + if ( ofCtx.IsInFile() ) + return ofCtx.GetName(); + else + return ofCtx.GetOutterContext()->GetName() + + _T("::") + ofCtx.GetName(); } -void RipperDocGen::AddToCurrentClass( ScriptSection* pSection, spContext& ctx, - const char* subSectionName ) +void RipperDocGen::AddToCurrentClass( ScriptSection* pSection, spContext& ctx, + const char* subSectionName ) { - string sName; - - if ( ctx.mVisibility == SP_VIS_PROTECTED ) + wxString sName; - sName = "Protected members/"; - else - if ( ctx.mVisibility == SP_VIS_PRIVATE ) + if ( ctx.mVisibility == SP_VIS_PROTECTED ) + sName = "Protected members/"; + else + if ( ctx.mVisibility == SP_VIS_PRIVATE ) + sName = "Private members/"; + else + sName = "Public members/"; - sName = "Private members/"; - else - sName = "Public members/"; + sName += subSectionName; - sName += subSectionName; + ScriptSection* pSect = mpCurClassSect->GetSubsection( sName.c_str() ); - ScriptSection* pSect = mpCurClassSect->GetSubsection( sName.c_str() ); + if ( CheckIfUncommented( ctx, *pSect ) ) + { + delete pSection; + return; + } - if ( CheckIfUncommented( ctx, *pSect ) ) - { - delete pSection; - return; - } + pSect->AddReference( pSection ); - pSect->AddReference( pSection ); - - mpCurClassSect->AddSection( pSection ); + mpCurClassSect->AddSection( pSection ); } void RipperDocGen::LinkSuperClassRefs() { - MMemberListT clLst; - - // collect all classes in the context tree - mpFileBinderCtx->GetContextList( clLst, SP_CTX_CLASS ); - - for( size_t i = 0; i != clLst.size(); ++i ) - { - spClass& cl = *((spClass*)clLst[i]); - - // FIXME:: why sometimes GetUserData() returns NULL? - if ( !cl.GetUserData() ) - continue; - - ScriptSection* pClSect = (ScriptSection*)cl.GetUserData(); - ScriptSection* pSuperSect = pClSect->GetSubsection("Derived from"); - - for( size_t n = 0; n != cl.mSuperClassNames.size(); ++n ) - { - string& superClName = cl.mSuperClassNames[n]; - - spClass* pFound = NULL; - - string* name; - - for( size_t k = 0; k != clLst.size(); ++k ) - { - name = &clLst[k]->GetName(); - - if ( clLst[k]->GetName() == superClName ) - { - pFound = (spClass*)clLst[k]; - break; - } - } - - if ( !pFound ) - { - ScriptSection* pNotFound = - new ScriptSection( superClName, "", 0, &mDeadRefTempl ); - - pSuperSect->AddReference( pNotFound ); - } - else - if ( pFound->GetUserData() ) - - pSuperSect->AddReference( - (ScriptSection*)pFound->GetUserData() ); - } - } + MMemberListT clLst; + + // collect all classes in the context tree + mpFileBinderCtx->GetContextList( clLst, SP_CTX_CLASS ); + + for( size_t i = 0; i != clLst.size(); ++i ) + { + spClass& cl = *((spClass*)clLst[i]); + + // FIXME:: why sometimes GetUserData() returns NULL? + if ( !cl.GetUserData() ) + continue; + + ScriptSection* pClSect = (ScriptSection*)cl.GetUserData(); + ScriptSection* pSuperSect = pClSect->GetSubsection("Derived from"); + + for( size_t n = 0; n != cl.m_SuperClassNames.size(); ++n ) + { + wxString& superClName = cl.m_SuperClassNames[n]; + + spClass* pFound = NULL; + + for( size_t k = 0; k != clLst.size(); ++k ) + { + if ( clLst[k]->GetName() == superClName ) + { + pFound = (spClass*)clLst[k]; + break; + } + } + + if ( !pFound ) + { + ScriptSection* pNotFound = + new ScriptSection( superClName, wxEmptyString, 0, &mDeadRefTempl ); + + pSuperSect->AddReference( pNotFound ); + } + else + if ( pFound->GetUserData() ) + + pSuperSect->AddReference( + (ScriptSection*)pFound->GetUserData() ); + } + } } void RipperDocGen::ProcessFile( const char* sourceFile ) { - cout << "Processing file " << sourceFile << "..." << endl; + wxSTD cout << "Processing file " << sourceFile << "..." << wxSTD endl; - spFile* pCtx = mpParser->ParseFile( sourceFile ); + spFile* pCtx = mpParser->ParseFile( sourceFile ); - if ( pCtx == NULL ) - { - cout << "Cannot open file " << sourceFile << ", skipped..." << endl; + if ( pCtx == NULL ) + { + wxSTD cout << "Cannot open file " << sourceFile << ", skipped..." << wxSTD endl; - return; - } + return; + } - VisitAll( *pCtx, TRUE ); + VisitAll( *pCtx, true ); - mpFileBinderCtx->AddMember( pCtx ); + mpFileBinderCtx->AddMember( pCtx ); } // implementations of "visiting procedures" void RipperDocGen::VisitEnumeration( spEnumeration& en ) { - // FOR NOW:: do not reference "nameless" enums - if ( en.GetName() == "" ) return; + // FOR NOW:: do not reference "nameless" enums + if ( en.GetName().empty() ) return; - if ( CheckIfUncommented( en, *mpEnumIdx ) ) - return; + if ( CheckIfUncommented( en, *mpEnumIdx ) ) + return; - string body; - body += mTags[TAG_BOLD].start; + wxString body; + body += m_Tags[TAG_BOLD].start; - AppendMulitilineStr( body, en.mEnumContent ); + AppendMulitilineStr( body, en.m_EnumContent ); - body += mTags[TAG_BOLD].end; + body += m_Tags[TAG_BOLD].end; - string line; - AppendHighlightedSource( line, body ); - AppendComments( en, line ); + wxString line; + AppendHighlightedSource( line, body ); + AppendComments( en, line ); - mpEnumIdx->AddSection( - new ScriptSection( en.GetName(), line, - &mSubContentTempl, - GetRefTemplFor( en ) ), 1 - ); + mpEnumIdx->AddSection( + new ScriptSection( en.GetName(), line, + &mSubContentTempl, + GetRefTemplFor( en ) ), 1 + ); } void RipperDocGen::VisitTypeDef( spTypeDef& td ) { - if ( CheckIfUncommented( td, *mpTypeDefIdx ) ) - return; - - string body; - body += mTags[TAG_BOLD].start; - body += "typdef "; - body += mTags[TAG_BOLD].end; - - AppendMulitilineStr( body, td.mOriginalType ); - body += td.mOriginalType; - body += ' '; - - body += mTags[TAG_BOLD].start; - body += td.GetName(); - body += mTags[TAG_BOLD].end; - - string line; - AppendHighlightedSource( line, body ); - AppendComments( td, line ); - - mpTypeDefIdx->AddSection( - new ScriptSection( td.GetName(), line, - &mSubContentTempl, - GetRefTemplFor( td ) ), TRUE - ); + if ( CheckIfUncommented( td, *mpTypeDefIdx ) ) + return; + + wxString body; + body += m_Tags[TAG_BOLD].start; + body += "typdef "; + body += m_Tags[TAG_BOLD].end; + + AppendMulitilineStr( body, td.m_OriginalType ); + body += td.m_OriginalType; + body += ' '; + + body += m_Tags[TAG_BOLD].start; + body += td.GetName(); + body += m_Tags[TAG_BOLD].end; + + wxString line; + AppendHighlightedSource( line, body ); + AppendComments( td, line ); + + mpTypeDefIdx->AddSection( + new ScriptSection( td.GetName(), line, + &mSubContentTempl, + GetRefTemplFor( td ) ), true + ); } void RipperDocGen::VisitPreprocessorLine( spPreprocessorLine& pd ) { - if ( pd.mDefType != SP_PREP_DEF_REDEFINE_SYMBOL ) - - return; + if ( pd.mDefType != SP_PREP_DEF_REDEFINE_SYMBOL ) + return; - if ( CheckIfUncommented( pd, *mpMacroIdx ) ) - return; + if ( CheckIfUncommented( pd, *mpMacroIdx ) ) + return; - string body; - body += mTags[TAG_FIXED_FONT].start; + wxString body; + body += m_Tags[TAG_FIXED_FONT].start; - string coloredLine = pd.mLine; - AppendHighlightedSource( coloredLine, pd.mLine ); + wxString coloredLine = pd.m_Line; + AppendHighlightedSource( coloredLine, pd.m_Line ); - AppendMulitilineStr( body, coloredLine ); + AppendMulitilineStr( body, coloredLine ); - body += mTags[TAG_FIXED_FONT].end; + body += m_Tags[TAG_FIXED_FONT].end; - AppendComments( pd, body ); + AppendComments( pd, body ); - mpMacroIdx->AddSection( - new ScriptSection( pd.GetName(), body, - &mSubContentTempl, - GetRefTemplFor( pd ) ), TRUE - ); + mpMacroIdx->AddSection( + new ScriptSection( pd.GetName(), body, + &mSubContentTempl, + GetRefTemplFor( pd ) ), true + ); } void RipperDocGen::VisitClass( spClass& cl ) { - // FOR NOW:: do not document nested classes - - // nicier visiting method yet needed - - if ( cl.IsInClass() ) - { - SkipChildren(); // spVisitor's method - return; - } - - string body; - AppendComments( cl, body ); + // FOR NOW:: do not document nested classes - + // nicier visiting method yet needed - mpCurClassSect = - new ScriptSection( cl.GetName(), body, &mSuperContentTempl, &mRefTempl ); + if ( cl.IsInClass() ) + { + SkipChildren(); // spVisitor's method + return; + } - // set up reference in the class context, pointing back - // to the section where this class is represented - cl.SetUserData( mpCurClassSect ); + wxString body; + AppendComments( cl, body ); - ScriptSection* pSuper = new ScriptSection( "Derived from" ,"", &mOutLine1Templ,0, 1 ); + mpCurClassSect = + new ScriptSection( cl.GetName(), body, &mSuperContentTempl, &mRefTempl ); - ScriptSection* pPublic = new ScriptSection( "Public members" ,"", &mOutLineTempl,0, 1 ); - ScriptSection* pProtected = new ScriptSection( "Protected members" ,"", &mOutLineTempl,0, 1 ); - ScriptSection* pPrivate = new ScriptSection( "Private members" ,"", &mOutLineTempl,0, 1 ); + // set up reference in the class context, pointing back + // to the section where this class is represented + cl.SetUserData( mpCurClassSect ); - pPublic->AddSection( new ScriptSection( "Operations", "", &mOutLine1Templ, 0, 1 ) ); - pPublic->AddSection( new ScriptSection( "Attributes", "", &mOutLine1Templ, 0, 1 ) ); + ScriptSection* pSuper = new ScriptSection( "Derived from" ,wxEmptyString, &mOutLine1Templ,0, 1 ); + ScriptSection* pPublic = new ScriptSection( "Public members" ,wxEmptyString, &mOutLineTempl,0, 1 ); + ScriptSection* pProtected = new ScriptSection( "Protected members" ,wxEmptyString, &mOutLineTempl,0, 1 ); + ScriptSection* pPrivate = new ScriptSection( "Private members" ,wxEmptyString, &mOutLineTempl,0, 1 ); - pProtected->AddSection( new ScriptSection( "Operations", "", &mOutLine1Templ, 0, 1 ) ); - pProtected->AddSection( new ScriptSection( "Attributes", "", &mOutLine1Templ, 0, 1 ) ); + pPublic->AddSection( new ScriptSection( "Operations", wxEmptyString, &mOutLine1Templ, 0, 1 ) ); + pPublic->AddSection( new ScriptSection( "Attributes", wxEmptyString, &mOutLine1Templ, 0, 1 ) ); + pProtected->AddSection( new ScriptSection( "Operations", wxEmptyString, &mOutLine1Templ, 0, 1 ) ); + pProtected->AddSection( new ScriptSection( "Attributes", wxEmptyString, &mOutLine1Templ, 0, 1 ) ); - pPrivate->AddSection( new ScriptSection( "Operations", "", &mOutLine1Templ, 0, 1 ) ); - pPrivate->AddSection( new ScriptSection( "Attributes", "", &mOutLine1Templ, 0, 1 ) ); + pPrivate->AddSection( new ScriptSection( "Operations", wxEmptyString, &mOutLine1Templ, 0, 1 ) ); + pPrivate->AddSection( new ScriptSection( "Attributes", wxEmptyString, &mOutLine1Templ, 0, 1 ) ); - mpCurClassSect->AddSection( pSuper ); - mpCurClassSect->AddSection( pPublic ); - mpCurClassSect->AddSection( pProtected ); - mpCurClassSect->AddSection( pPrivate ); + mpCurClassSect->AddSection( pSuper ); + mpCurClassSect->AddSection( pPublic ); + mpCurClassSect->AddSection( pProtected ); + mpCurClassSect->AddSection( pPrivate ); - mpClassIdx->AddSection( mpCurClassSect, TRUE ); + mpClassIdx->AddSection( mpCurClassSect, true ); } void RipperDocGen::VisitAttribute( spAttribute& attr ) { - string body; - body += mTags[TAG_BOLD].start; - body += attr.mType; - body += mTags[TAG_BOLD].end; - - body += mTags[TAG_ITALIC].start; - body += ' '; - body += attr.GetName(); - body += mTags[TAG_ITALIC].end; - - string line; - AppendHighlightedSource( line, body ); - AppendComments( attr, line ); - - ScriptSection* pSection = - new ScriptSection( GetScopedName( attr ), line, - &mSubContentTempl, - GetRefTemplFor( attr ) ); - - if ( attr.mIsConstant ) - - mpConstIdx->AddSection( pSection, TRUE ); - - else - if ( !attr.IsInClass() ) - { - if ( CheckIfUncommented( attr, *mpGlobalVarsIdx ) ) - return; - - mpGlobalVarsIdx->AddSection( pSection, TRUE ); - } - else - - AddToCurrentClass( pSection, attr, "Attributes" ); + wxString body; + body += m_Tags[TAG_BOLD].start; + body += attr.m_Type; + body += m_Tags[TAG_BOLD].end; + + body += m_Tags[TAG_ITALIC].start; + body += ' '; + body += attr.GetName(); + body += m_Tags[TAG_ITALIC].end; + + wxString line; + AppendHighlightedSource( line, body ); + AppendComments( attr, line ); + + ScriptSection* pSection = + new ScriptSection( GetScopedName( attr ), line, + &mSubContentTempl, + GetRefTemplFor( attr ) ); + + if ( attr.mIsConstant ) + mpConstIdx->AddSection( pSection, true ); + else + if ( !attr.IsInClass() ) + { + if ( CheckIfUncommented( attr, *mpGlobalVarsIdx ) ) + return; + mpGlobalVarsIdx->AddSection( pSection, true ); + } + else + AddToCurrentClass( pSection, attr, "Attributes" ); } void RipperDocGen::VisitOperation( spOperation& op ) { - string body; + wxString body; - AppendHighlightedSource( body, op.GetFullName(mTags) ); + AppendHighlightedSource( body, op.GetFullName(m_Tags) ); - AppendComments( op, body ); + AppendComments( op, body ); - ScriptSection* pSection = - new ScriptSection( GetScopedName( op ), body, - &mSubContentTempl, - GetRefTemplFor( op ) ); + ScriptSection* pSection = + new ScriptSection( GetScopedName( op ), body, + &mSubContentTempl, + GetRefTemplFor( op ) ); - if ( !op.IsInClass() ) - { - if ( CheckIfUncommented( op, *mpGlobalFuncIdx ) ) - return; + if ( !op.IsInClass() ) + { + if ( CheckIfUncommented( op, *mpGlobalFuncIdx ) ) + return; - mpGlobalFuncIdx->AddSection( pSection, 1 ); - } - else - AddToCurrentClass( pSection, op, "Operations" ); + mpGlobalFuncIdx->AddSection( pSection, 1 ); + } + else + AddToCurrentClass( pSection, op, "Operations" ); } -bool RipperDocGen::OnSaveDocument( ScriptStream& stm ) +bool RipperDocGen::OnSaveDocument( ScriptStream& WXUNUSED(stm) ) { - LinkSuperClassRefs(); + LinkSuperClassRefs(); - // FOR NOW:: doesn't work yet - //mpTopIdx->RemoveEmptySections(); + // FOR NOW:: doesn't work yet + //mpTopIdx->RemoveEmptySections(); - return 1; // saving can proceed now + return 1; // saving can proceed now }