From 2af95167f5be66ed9ae76fb29d01347d90316652 Mon Sep 17 00:00:00 2001 From: =?utf8?q?W=C5=82odzimierz=20Skiba?= Date: Thu, 2 Jun 2005 09:44:45 +0000 Subject: [PATCH] More warning and error fixes (work in progress with Tinderbox). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34519 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- utils/HelpGen/src/cjparser.cpp | 28 ++-- utils/HelpGen/src/cjparser.h | 10 +- utils/HelpGen/src/docripper.cpp | 44 +++---- utils/HelpGen/src/docripper.h | 2 +- utils/HelpGen/src/scriptbinder.cpp | 194 ++++++++++++++-------------- utils/HelpGen/src/scriptbinder.h | 75 +++++------ utils/HelpGen/src/sourcepainter.cpp | 2 +- utils/HelpGen/src/sourcepainter.h | 9 +- utils/HelpGen/src/srcparser.cpp | 32 ++--- utils/HelpGen/src/srcparser.h | 31 ++--- utils/HelpGen/src/wxstlac.h | 76 +++++------ utils/HelpGen/src/wxstllst.h | 112 ++++++++-------- 12 files changed, 297 insertions(+), 318 deletions(-) diff --git a/utils/HelpGen/src/cjparser.cpp b/utils/HelpGen/src/cjparser.cpp index c503415749..a4b19aab92 100644 --- a/utils/HelpGen/src/cjparser.cpp +++ b/utils/HelpGen/src/cjparser.cpp @@ -644,9 +644,9 @@ static inline void skip_next_token_back( char*& cur ) ++cur; // position after the trailing charcter of the prev token } -static string get_token_str( char* cur ) +static wxString get_token_str( char* cur ) { - return string( cur, get_token_len( cur ) ); + return wxString( cur, get_token_len( cur ) ); } // skips token or whole expression which may have @@ -1327,7 +1327,7 @@ void CJSourceParser::AddMacroNode( wxChar*& cur ) skip_token( cur ); get_next_token( cur ); - string condition = get_token_str( cur ); + wxString condition = get_token_str( cur ); // currently, everything except '0' is true if ( condition == _T("0") ) { @@ -1595,7 +1595,7 @@ bool CJSourceParser::ParseNameAndRetVal( char*& cur, bool& isAMacro ) skip_next_token_back( cur ); skip_token_back( cur ); - string lastToken = get_token_str( cur ); + wxString lastToken = get_token_str( cur ); if ( lastToken == "operator" ) { lastToken += pOp->m_Name; pOp->m_Name = lastToken; @@ -1608,7 +1608,7 @@ bool CJSourceParser::ParseNameAndRetVal( char*& cur, bool& isAMacro ) else if ( pOp->m_Name == "operator" ) { skip_token( cur ); get_next_token( cur ); - string oper = get_token_str( cur ); + wxString oper = get_token_str( cur ); pOp->m_Name += oper; } @@ -1618,11 +1618,11 @@ bool CJSourceParser::ParseNameAndRetVal( char*& cur, bool& isAMacro ) if ( cur >= start ) { - string rettype = string( start, size_t( cur-start ) ); + wxString rettype = wxString( start, size_t( cur-start ) ); // FIXME just for now... - string::size_type pos = 0; - string toerase("WXDLLEXPORT "); - while((pos = rettype.find(toerase, pos)) != string::npos) + wxString::size_type pos = 0; + wxString toerase("WXDLLEXPORT "); + while((pos = rettype.find(toerase, pos)) != wxString::npos) rettype.erase(pos, toerase.length()); pOp->m_RetType = rettype; } @@ -1744,14 +1744,14 @@ bool CJSourceParser::ParseArguments( char*& cur ) AttachComments( *pPar, blocks[nameBlock] ); // retrieve argument name - pPar->m_Name = string( blocks[nameBlock], blockSizes[nameBlock] ); + pPar->m_Name = wxString( blocks[nameBlock], blockSizes[nameBlock] ); // retreive argument type size_t len = blockSizes[ typeBlock ]; len = size_t ( (blocks[ typeBlock ] + len) - blocks[ 0 ] ); - pPar->m_Type = string( blocks[0], len ); + pPar->m_Type = wxString( blocks[0], len ); arrange_indirection_tokens_between( pPar->m_Type, pPar->m_Name ); @@ -1834,7 +1834,7 @@ void CJSourceParser::ParseMemberVar( char*& cur ) bool firstMember = true; - string type; + wxString type; // jump to the end of statement // and start collecting same-type varibles @@ -2026,7 +2026,7 @@ void CJSourceParser::AddClassNode( char*& cur ) { char* ctxStart = cur; - string classkeyword = get_token_str( cur ); + wxString classkeyword = get_token_str( cur ); skip_token( cur ); // skip 'class' keyword if ( !get_next_token( cur ) ) return; @@ -2156,7 +2156,7 @@ void CJSourceParser::AddClassNode( char*& cur ) if ( *tok != ':' && *cur != ':' ) - pClass->m_SuperClassNames.push_back( string( cur, len ) ); + pClass->m_SuperClassNames.push_back( wxString( cur, len ) ); } while(1); diff --git a/utils/HelpGen/src/cjparser.h b/utils/HelpGen/src/cjparser.h index 6310684d1c..0151775c43 100644 --- a/utils/HelpGen/src/cjparser.h +++ b/utils/HelpGen/src/cjparser.h @@ -75,7 +75,7 @@ protected: void AddEnumNode( char*& cur ); void AddTypeDefNode( char*& cur ); - void DumpOperationInfo( spOperation& info, const string& tab, wxSTD ostream& os ); + void DumpOperationInfo( spOperation& info, const wxString& tab, wxSTD ostream& os ); void DumpClassHeader( spClass& info, wxSTD ostream& os ); void DumpClassBody( spClass& info, wxSTD ostream& os ); @@ -114,17 +114,17 @@ static inline void skip_tempalate_statement( char*& cur ); static inline void skip_statement( char*& cur ); static inline void skip_token_back( char*& cur ); static inline void skip_next_token_back( char*& cur ); -static string get_token_str( char* cur ); +static wxString get_token_str( char* cur ); static size_t skip_block( char*& cur ); static inline bool skip_imp_block( char*& cur ); static bool is_class_token( char*& cur ); inline static bool is_forward_decl( char* cur ); inline static bool is_function( char* cur, bool& isAMacro ); static inline void skip_scope_block( char*& cur ); -static void arrange_indirection_tokens_between( string& type, string& identifier ); +static void arrange_indirection_tokens_between( wxString& type, wxString& identifier ); static bool is_keyword( char* cur ); -static inline void get_string_between( char* start, char* end, string* pStr ); -static char* set_comment_text( string& text, char* start ); +static inline void get_string_between( char* start, char* end, wxString* pStr ); +static char* set_comment_text( wxString& text, char* start ); */ #endif diff --git a/utils/HelpGen/src/docripper.cpp b/utils/HelpGen/src/docripper.cpp index afc6aefd36..bcb0e5d180 100644 --- a/utils/HelpGen/src/docripper.cpp +++ b/utils/HelpGen/src/docripper.cpp @@ -149,7 +149,7 @@ RipperDocGen::RipperDocGen() mpFileBinderCtx = new spFile(); // the default script is HTML - mTags = get_HTML_markup_tags(); + m_Tags = get_HTML_markup_tags(); mpParser = 0; // no default parser! } @@ -170,8 +170,8 @@ void RipperDocGen::AppendComments( spContext& fromContext, wxString& str ) size_t start = str.length(); - str += mTags[TAG_BOLD].end; - str += mTags[TAG_PARAGRAPH].start; + str += m_Tags[TAG_BOLD].end; + str += m_Tags[TAG_PARAGRAPH].start; MCommentListT& lst = fromContext.GetCommentList(); @@ -182,7 +182,7 @@ void RipperDocGen::AppendComments( spContext& fromContext, wxString& str ) if ( lst[i]->StartsParagraph() ) { - str += mTags[TAG_PARAGRAPH].start; + str += m_Tags[TAG_PARAGRAPH].start; } str += lst[i]->m_Text; @@ -212,14 +212,14 @@ void RipperDocGen::AppendComments( spContext& fromContext, wxString& str ) } str[n] = _T(' '); } - str += mTags[TAG_PARAGRAPH].end; + str += m_Tags[TAG_PARAGRAPH].end; } void RipperDocGen::AppendMulitilineStr( wxString& st, wxString& mlStr ) { - st = mTags[TAG_FIXED_FONT].start; + st = m_Tags[TAG_FIXED_FONT].start; st += mlStr; - st += mTags[TAG_FIXED_FONT].end; + st += m_Tags[TAG_FIXED_FONT].end; } void RipperDocGen::AppendHighlightedSource( wxString& st, wxString source ) @@ -235,7 +235,7 @@ void RipperDocGen::AppendHighlightedSource( wxString& st, wxString source ) // highlight things mSrcPainter.Init(); mSrcPainter.ProcessSource( buf, strlen(buf) ); - mSrcPainter.GetResultString( st, mTags ); + mSrcPainter.GetResultString( st, m_Tags ); } bool RipperDocGen::CheckIfUncommented( spContext& ctx, ScriptSection& toSect ) @@ -269,7 +269,7 @@ wxString RipperDocGen::GetScopedName( spContext& ofCtx ) void RipperDocGen::AddToCurrentClass( ScriptSection* pSection, spContext& ctx, const char* subSectionName ) { - string sName; + wxString sName; if ( ctx.mVisibility == SP_VIS_PROTECTED ) sName = "Protected members/"; @@ -372,11 +372,11 @@ void RipperDocGen::VisitEnumeration( spEnumeration& en ) return; wxString body; - body += mTags[TAG_BOLD].start; + body += m_Tags[TAG_BOLD].start; AppendMulitilineStr( body, en.m_EnumContent ); - body += mTags[TAG_BOLD].end; + body += m_Tags[TAG_BOLD].end; wxString line; AppendHighlightedSource( line, body ); @@ -395,17 +395,17 @@ void RipperDocGen::VisitTypeDef( spTypeDef& td ) return; wxString body; - body += mTags[TAG_BOLD].start; + body += m_Tags[TAG_BOLD].start; body += "typdef "; - body += mTags[TAG_BOLD].end; + body += m_Tags[TAG_BOLD].end; AppendMulitilineStr( body, td.m_OriginalType ); body += td.m_OriginalType; body += ' '; - body += mTags[TAG_BOLD].start; + body += m_Tags[TAG_BOLD].start; body += td.GetName(); - body += mTags[TAG_BOLD].end; + body += m_Tags[TAG_BOLD].end; wxString line; AppendHighlightedSource( line, body ); @@ -427,14 +427,14 @@ void RipperDocGen::VisitPreprocessorLine( spPreprocessorLine& pd ) return; wxString body; - body += mTags[TAG_FIXED_FONT].start; + body += m_Tags[TAG_FIXED_FONT].start; wxString coloredLine = pd.m_Line; AppendHighlightedSource( coloredLine, pd.m_Line ); AppendMulitilineStr( body, coloredLine ); - body += mTags[TAG_FIXED_FONT].end; + body += m_Tags[TAG_FIXED_FONT].end; AppendComments( pd, body ); @@ -492,14 +492,14 @@ void RipperDocGen::VisitClass( spClass& cl ) void RipperDocGen::VisitAttribute( spAttribute& attr ) { wxString body; - body += mTags[TAG_BOLD].start; + body += m_Tags[TAG_BOLD].start; body += attr.m_Type; - body += mTags[TAG_BOLD].end; + body += m_Tags[TAG_BOLD].end; - body += mTags[TAG_ITALIC].start; + body += m_Tags[TAG_ITALIC].start; body += ' '; body += attr.GetName(); - body += mTags[TAG_ITALIC].end; + body += m_Tags[TAG_ITALIC].end; wxString line; AppendHighlightedSource( line, body ); @@ -527,7 +527,7 @@ void RipperDocGen::VisitOperation( spOperation& op ) { wxString body; - AppendHighlightedSource( body, op.GetFullName(mTags) ); + AppendHighlightedSource( body, op.GetFullName(m_Tags) ); AppendComments( op, body ); diff --git a/utils/HelpGen/src/docripper.h b/utils/HelpGen/src/docripper.h index 0cba6c0be7..36bb95d0dd 100644 --- a/utils/HelpGen/src/docripper.h +++ b/utils/HelpGen/src/docripper.h @@ -80,7 +80,7 @@ protected: spContext* mpFileBinderCtx; // script tags set up from usesr code - MarkupTagsT mTags; + MarkupTagsT m_Tags; protected: // helpers diff --git a/utils/HelpGen/src/scriptbinder.cpp b/utils/HelpGen/src/scriptbinder.cpp index 6559328e8d..eb769b7461 100644 --- a/utils/HelpGen/src/scriptbinder.cpp +++ b/utils/HelpGen/src/scriptbinder.cpp @@ -48,14 +48,14 @@ static size_t log2(size_t nr) /***** Implementation for class ScriptStream *****/ ScriptStream::ScriptStream() - : mpBuf(0), - mSize(0), - mCapacity(0) + : m_pBuf(0), + m_Size(0), + m_Capacity(0) {} ScriptStream::~ScriptStream() { - if ( mpBuf ) delete mpBuf; + if ( m_pBuf ) delete m_pBuf; } void ScriptStream::WriteBytes( const void* srcBuf, size_t count ) @@ -63,28 +63,28 @@ void ScriptStream::WriteBytes( const void* srcBuf, size_t count ) if ( !count ) return; // increase the capacity if necessary - if ( mSize + count > mCapacity ) + if ( m_Size + count > m_Capacity ) { - mCapacity = - ( 0x2 << (log2( mSize + count ) + 1 ) ); + m_Capacity = + ( 0x2 << (log2( m_Size + count ) + 1 ) ); - if ( mCapacity < 128 ) mCapacity = 128; + if ( m_Capacity < 128 ) m_Capacity = 128; - char* oldBuf = mpBuf; + char* oldBuf = m_pBuf; - mpBuf = new char[mCapacity]; + m_pBuf = new char[m_Capacity]; if ( oldBuf ) { - memcpy( mpBuf, oldBuf, mSize ); + memcpy( m_pBuf, oldBuf, m_Size ); delete oldBuf; } } // append new data - memcpy( &mpBuf[mSize], srcBuf, count ); + memcpy( &m_pBuf[m_Size], srcBuf, count ); - mSize += count; + m_Size += count; } ScriptStream& ScriptStream::operator<<( const char* str ) @@ -94,7 +94,7 @@ ScriptStream& ScriptStream::operator<<( const char* str ) return *this; } -ScriptStream& ScriptStream::operator<<( const string& str ) +ScriptStream& ScriptStream::operator<<( const wxString& str ) { if ( str.length() < 512 ) { @@ -127,29 +127,29 @@ void ScriptStream::endl() /***** Implementation for class ScriptTemplate *****/ -ScriptTemplate::ScriptTemplate( const string& templateText ) +ScriptTemplate::ScriptTemplate( const wxString& templateText ) { - string tmp = templateText; + wxString tmp = templateText; - mTText = (char*)malloc( tmp.length() + 1 ); + m_TText = (char*)malloc( tmp.length() + 1 ); - strcpy( mTText, tmp.c_str() ); + strcpy( m_TText, tmp.c_str() ); } ScriptTemplate::~ScriptTemplate() { - for( size_t i = 0; i != mVars.size(); ++i ) + for( size_t i = 0; i != m_Vars.size(); ++i ) - delete mVars[i]; + delete m_Vars[i]; - free( mTText ); + free( m_TText ); } bool ScriptTemplate::HasVar( const char* name ) { - for( size_t i = 0; i != mVars.size(); ++i ) + for( size_t i = 0; i != m_Vars.size(); ++i ) - if ( strcmp( mVars[i]->m_Name, name ) == 0 ) + if ( strcmp( m_Vars[i]->m_Name, name ) == 0 ) return 1; @@ -158,17 +158,17 @@ bool ScriptTemplate::HasVar( const char* name ) void ScriptTemplate::AddStringVar ( const char* name, int ofs ) { - mVars.push_back( new TVarInfo( name, ofs, TVAR_STRING ) ); + m_Vars.push_back( new TVarInfo( name, ofs, TVAR_STRING ) ); } void ScriptTemplate::AddIntegerVar( const char* name, int ofs ) { - mVars.push_back( new TVarInfo( name, ofs, TVAR_INTEGER ) ); + m_Vars.push_back( new TVarInfo( name, ofs, TVAR_INTEGER ) ); } void ScriptTemplate::AddDoubleVar ( const char* name, int ofs ) { - mVars.push_back( new TVarInfo( name, ofs, TVAR_DOUBLE ) ); + m_Vars.push_back( new TVarInfo( name, ofs, TVAR_DOUBLE ) ); } void ScriptTemplate::AddObjectRefArray( const char* name, @@ -179,11 +179,11 @@ void ScriptTemplate::AddObjectRefArray( const char* name, { TArrayInfo* pInfo = new TArrayInfo( name ); - mVars.push_back( pInfo ); + m_Vars.push_back( pInfo ); - pInfo->mRefOfs = ofsRefToFirstObj; - pInfo->mSizeIntOfs = ofsObjSizeInt; - pInfo->mObjRefTemplOfs = ofsObjRefTempl; + pInfo->m_RefOfs = ofsRefToFirstObj; + pInfo->m_SizeIntOfs = ofsObjSizeInt; + pInfo->m_ObjRefTemplOfs = ofsObjRefTempl; } inline void ScriptTemplate::PrintVar( TVarInfo* pInfo, @@ -196,7 +196,7 @@ inline void ScriptTemplate::PrintVar( TVarInfo* pInfo, { case TVAR_INTEGER : { - sprintf(buf, "%d",*( (int*) ((char*)dataObj + pInfo->mOfs) ) ); + sprintf(buf, "%d",*( (int*) ((char*)dataObj + pInfo->m_Ofs) ) ); stm.WriteBytes( buf, strlen(buf ) ); break; @@ -204,15 +204,15 @@ inline void ScriptTemplate::PrintVar( TVarInfo* pInfo, case TVAR_STRING : { - string& str = *( (string*) ((char*)dataObj+pInfo->mOfs) ); + wxString& str = *( (wxString*) ((char*)dataObj+pInfo->m_Ofs) ); const char* cs = str.c_str(); #ifdef DEBUG_WEIRED_OFFSETS cout << "DBG:: cs address is " << (int)cs << endl; cout << "DBG:: str address is " << (int)(&str) << endl; cout << "DBG:: dataObj points to " << (int)dataObj << endl; - cout << "DBG:: pInfo->mOfs value is " << (int)pInfo->mOfs << endl; - cout << "DBG:: d+pInfo->mOfs is " << (int)((char*)dataObj + pInfo->mOfs) << endl; + cout << "DBG:: pInfo->m_Ofs value is " << (int)pInfo->m_Ofs << endl; + cout << "DBG:: d+pInfo->m_Ofs is " << (int)((char*)dataObj + pInfo->m_Ofs) << endl; cout << "DBG:: pInfo->m_Name is " << pInfo->m_Name << endl; cout << "DBG:: pInfo->m_Type is " << pInfo->m_Type << endl; cout << "DBG:: end of dump. " << endl; @@ -226,7 +226,7 @@ inline void ScriptTemplate::PrintVar( TVarInfo* pInfo, case TVAR_DOUBLE : { sprintf( buf, "%f", - *( (double*)( (char*)dataObj+pInfo->mOfs) ) ); + *( (double*)( (char*)dataObj+pInfo->m_Ofs) ) ); stm.WriteBytes( buf, strlen(buf ) ); break; @@ -236,7 +236,7 @@ inline void ScriptTemplate::PrintVar( TVarInfo* pInfo, { TArrayInfo& info = *((TArrayInfo*)pInfo); - int sz = *((int*) ( (char*)dataObj+info.mSizeIntOfs )); + int sz = *((int*) ( (char*)dataObj+info.m_SizeIntOfs )); if ( !sz ) { // DBG:: @@ -245,14 +245,14 @@ inline void ScriptTemplate::PrintVar( TVarInfo* pInfo, break; } - int* array = *((int**)( (char*)dataObj+info.mRefOfs )); + int* array = *((int**)( (char*)dataObj+info.m_RefOfs )); ScriptTemplate* pRefTempl; for( int i = 0; i != sz; ++i ) { pRefTempl = - *((ScriptTemplate**)((char*)(array[i])+info.mObjRefTemplOfs)); + *((ScriptTemplate**)((char*)(array[i])+info.m_ObjRefTemplOfs)); pRefTempl->PrintScript( (void*)array[i], stm ); } @@ -266,7 +266,7 @@ inline void ScriptTemplate::PrintVar( TVarInfo* pInfo, void ScriptTemplate::PrintScript( void* dataObj, ScriptStream& stm ) { - char* cur = mTText; + char* cur = m_TText; // template parsing loop do @@ -292,14 +292,14 @@ void ScriptTemplate::PrintScript( void* dataObj, ScriptStream& stm ) // look up variable - size_t sz = mVars.size(); + size_t sz = m_Vars.size(); // bool found = false; for( size_t i = 0; i != sz; ++i ) { - if ( strcmp( mVars[i]->m_Name, start ) == 0 ) + if ( strcmp( m_Vars[i]->m_Name, start ) == 0 ) { - PrintVar( mVars[i], dataObj, stm ); + PrintVar( m_Vars[i], dataObj, stm ); *cur = ')'; // remove terminating zero ++cur; @@ -317,7 +317,7 @@ void ScriptTemplate::PrintScript( void* dataObj, ScriptStream& stm ) /***** implementation for class ScriptSection *****/ -int ScriptSection::mIdCounter = 0; +int ScriptSection::m_IdCounter = 0; ScriptSection::ScriptSection( const wxString& name, const wxString& body, @@ -326,54 +326,54 @@ ScriptSection::ScriptSection( const wxString& name, bool autoHide, bool sorted ) - : mpParent ( NULL ), + : m_pParent ( NULL ), - m_Name ( name ), - mBody ( body ), + m_Name ( name ), + m_Body ( body ), - mAutoHide( autoHide ), - mSortOn ( sorted ), + m_AutoHide ( autoHide ), + m_SortOn ( sorted ), - mpSectTempl( pSectionTemplate ), - mpRefTempl ( pReferenceTemplate ), + m_pSectTempl( pSectionTemplate ), + m_pRefTempl ( pReferenceTemplate ), - mRefCount( 0 ), - mArrSize( 0 ) + m_RefCount( 0 ), + m_ArrSize( 0 ) { // generate GUID wxChar buf[32]; - wxSprintf( buf, _T("%d"), ++mIdCounter ); - mId = buf; + wxSprintf( buf, _T("%d"), ++m_IdCounter ); + m_Id = buf; } ScriptSection::~ScriptSection() { - SectListT lst = mSubsections; + SectListT lst = m_Subsections; - while( mSubsections.size() ) + while( m_Subsections.size() ) - mSubsections[0]->RemoveRef(); + m_Subsections[0]->RemoveRef(); - for( size_t i = 0; i != mReferences.size(); ++i ) + for( size_t i = 0; i != m_References.size(); ++i ) - mReferences[i]->RemoveRef(); + m_References[i]->RemoveRef(); } void ScriptSection::AddRef() { - ++mRefCount; + ++m_RefCount; } void ScriptSection::RemoveRef() { - if ( !mRefCount || !(--mRefCount) ) + if ( !m_RefCount || !(--m_RefCount) ) { - if (mpParent) + if (m_pParent) { // remove ourselves from parent's list - SectListT& lst = mpParent->mSubsections; + SectListT& lst = m_pParent->m_Subsections; for( size_t i = 0; i != lst.size(); ++i ) if ( lst[i] == this ) @@ -404,21 +404,21 @@ ScriptSection* ScriptSection::GetSubsection( const char* name ) buf[cur] = '\0'; - size_t sz = mSubsections.size(); + size_t sz = m_Subsections.size(); for( size_t i = 0; i != sz; ++i ) { // DBG:: - //ScriptSection& sect = *mSubsections[i]; + //ScriptSection& sect = *m_Subsections[i]; - if ( mSubsections[i]->m_Name == buf ) + if ( m_Subsections[i]->m_Name == buf ) { if ( name[cur] == '/' ) // search recursivelly - return mSubsections[i]->GetSubsection( &name[cur+1] ); + return m_Subsections[i]->GetSubsection( &name[cur+1] ); else - return mSubsections[i]; + return m_Subsections[i]; } } @@ -429,14 +429,14 @@ void ScriptSection::AddSection( ScriptSection* pSection, bool addToReferencesToo ) { - mSubsections.push_back( pSection ); + m_Subsections.push_back( pSection ); pSection->AddRef(); // can add section to multiple containers - // ASSERT( pSection->mpParent == 0 ); + // ASSERT( pSection->m_pParent == 0 ); - pSection->mpParent = this; + pSection->m_pParent = this; if ( addToReferencesToo ) @@ -445,19 +445,19 @@ void ScriptSection::AddSection( ScriptSection* pSection, void ScriptSection::AddReference( ScriptSection* pReferredSection ) { - mReferences.push_back( pReferredSection ); + m_References.push_back( pReferredSection ); pReferredSection->AddRef(); // set up mandatory fields used by ScriptTemplate - mArrSize = mReferences.size(); - if ( mArrSize ) - mRefFirst = (void*)&mReferences[0]; + m_ArrSize = m_References.size(); + if ( m_ArrSize ) + m_RefFirst = (void*)&m_References[0]; } SectListT& ScriptSection::GetSubsections() { - return mSubsections; + return m_Subsections; } // static method: @@ -469,12 +469,12 @@ void ScriptSection::RegisterTemplate( ScriptTemplate& sectionTempalte ) // obtaining offsets of member vars GET_VAR_OFS( ScriptSection, m_Name, &nameOfs ) - GET_VAR_OFS( ScriptSection, mBody, &bodyOfs ) - GET_VAR_OFS( ScriptSection, mId, &idOfs ) - GET_VAR_OFS( ScriptSection, mRefFirst, &arrRefOfs ) - GET_VAR_OFS( ScriptSection, mArrSize, &arrSizeOfs ) + GET_VAR_OFS( ScriptSection, m_Body, &bodyOfs ) + GET_VAR_OFS( ScriptSection, m_Id, &idOfs ) + GET_VAR_OFS( ScriptSection, m_RefFirst,&arrRefOfs ) + GET_VAR_OFS( ScriptSection, m_ArrSize, &arrSizeOfs ) - GET_VAR_OFS( ScriptSection, mpRefTempl, &refTemplOfs ) + GET_VAR_OFS( ScriptSection, m_pRefTempl, &refTemplOfs ) // registering member variables with given script template @@ -491,28 +491,28 @@ void ScriptSection::Print( ScriptStream& stm ) // TBD:: sorting // print out this content first - if ( mpSectTempl ) + if ( m_pSectTempl ) - mpSectTempl->PrintScript( this, stm ); + m_pSectTempl->PrintScript( this, stm ); // attach contents subsections at the end of this content - for( size_t i = 0; i != mSubsections.size(); ++i ) + for( size_t i = 0; i != m_Subsections.size(); ++i ) - mSubsections[i]->Print( stm ); + m_Subsections[i]->Print( stm ); } void ScriptSection::DoRemoveEmptySections(int& nRemoved, SectListT& removedLst) { - for( size_t i = 0; i != mSubsections.size(); ++i ) + for( size_t i = 0; i != m_Subsections.size(); ++i ) { - ScriptSection& sect = *mSubsections[i]; + ScriptSection& sect = *m_Subsections[i]; sect.DoRemoveEmptySections( nRemoved, removedLst ); - if (sect.mAutoHide ) + if (sect.m_AutoHide ) - if ( sect.mReferences.size() == 0 ) + if ( sect.m_References.size() == 0 ) { bool found = false; for( size_t k = 0; k != removedLst.size(); ++k ) @@ -539,24 +539,24 @@ void ScriptSection::DoRemoveDeadLinks( SectListT& removedLst) { size_t dsz = removedLst.size(); - for( size_t i = 0; i != mSubsections.size(); ++i ) + for( size_t i = 0; i != m_Subsections.size(); ++i ) { - mSubsections[i]->DoRemoveDeadLinks( removedLst ); + m_Subsections[i]->DoRemoveDeadLinks( removedLst ); } - for( size_t n = 0; n != mReferences.size(); ++n ) + for( size_t n = 0; n != m_References.size(); ++n ) { for( size_t k = 0; k != dsz; ++k ) - if ( removedLst[k] == mReferences[n] ) + if ( removedLst[k] == m_References[n] ) { - mReferences.erase( &mReferences[n] ); + m_References.erase( &m_References[n] ); --n; // set up mandatory fields used by ScriptTemplate - mArrSize = mReferences.size(); - if ( mArrSize ) - mRefFirst = (void*)&mReferences[0]; + m_ArrSize = m_References.size(); + if ( m_ArrSize ) + m_RefFirst = (void*)&m_References[0]; break; } diff --git a/utils/HelpGen/src/scriptbinder.h b/utils/HelpGen/src/scriptbinder.h index e062c8fbbe..32cfcef642 100644 --- a/utils/HelpGen/src/scriptbinder.h +++ b/utils/HelpGen/src/scriptbinder.h @@ -28,13 +28,6 @@ #include "wxstlvec.h" #include "wx/string.h" - #if wxUSE_STD_STRING - using std::string; - #else - // FIXME:: dirty! - typedef wxString string; - #endif - #endif #ifndef ASSERT @@ -49,9 +42,9 @@ class ScriptStream { protected: - char* mpBuf; - size_t mSize; - size_t mCapacity; + char* m_pBuf; + size_t m_Size; + size_t m_Capacity; public: ScriptStream(); ~ScriptStream(); @@ -59,16 +52,16 @@ public: void WriteBytes( const void* srcBuf, size_t count ); ScriptStream& operator<<( const char* str ); - ScriptStream& operator<<( const string& str ); + ScriptStream& operator<<( const wxString& str ); ScriptStream& operator<<( char ch ); void endl(); - inline char* GetBuf() { return mpBuf; } - inline size_t GetBufSize() { return mSize; } + inline char* GetBuf() { return m_pBuf; } + inline size_t GetBufSize() { return m_Size; } // clears current contents of the stream - void Reset() { mSize = 0; } + void Reset() { m_Size = 0; } }; @@ -91,21 +84,21 @@ struct TVarInfo public: const char* m_Name; int m_Type; - int mOfs; + int m_Ofs; TVarInfo( const char* name, int ofs, int varType ) : m_Name(name), m_Type( varType ), - mOfs( ofs ) + m_Ofs( ofs ) {} }; struct TArrayInfo : public TVarInfo { public: - int mRefOfs; - int mSizeIntOfs; - int mObjRefTemplOfs; + int m_RefOfs; + int m_SizeIntOfs; + int m_ObjRefTemplOfs; TArrayInfo( const char* name ) : TVarInfo( name, 0, TVAR_REF_ARRAY ) @@ -163,18 +156,18 @@ class ScriptSection; class ScriptTemplate { protected: - // do not use string object here - parsing of + // do not use wxString object here - parsing of // C string can be much faster (in debug v.) - char* mTText; + char* m_TText; - TVarListT mVars; + TVarListT m_Vars; inline void PrintVar( TVarInfo* pInfo, void* dataObj, ScriptStream& stm ); public: - ScriptTemplate( const string& templateText ); + ScriptTemplate( const wxString& templateText ); virtual ~ScriptTemplate(); bool HasVar( const char* name ); @@ -215,34 +208,34 @@ protected: // the below there members are registered to ScriptTemplate, // GUID within the section tree (numeric) - ScriptSection* mpParent; - string mId; // $(ID) - string m_Name;// $(NAME) - string mBody; // $(BODY) + ScriptSection* m_pParent; + wxString m_Id; // $(ID) + wxString m_Name;// $(NAME) + wxString m_Body; // $(BODY) // NULL, if this section is not aggregated anywhere - SectListT mSubsections; // aggregated sectons - SectListT mReferences; // registered as $(REFLIST) + SectListT m_Subsections; // aggregated sectons + SectListT m_References; // registered as $(REFLIST) - bool mAutoHide; // see autoHide arg, in constructor - bool mSortOn; // true, if sort subsectons by naem + bool m_AutoHide; // see autoHide arg, in constructor + bool m_SortOn; // true, if sort subsectons by naem // tempalte for this section - ScriptTemplate* mpSectTempl; + ScriptTemplate* m_pSectTempl; // template used for links (or references) to this section - ScriptTemplate* mpRefTempl; + ScriptTemplate* m_pRefTempl; // do not call destructor of this object, // call RemoveRef() instead - int mRefCount; + int m_RefCount; - static int mIdCounter; // generator of GUIDs + static int m_IdCounter; // generator of GUIDs // fields registered and used by ScriptTemplate object - void* mRefFirst; - int mArrSize; + void* m_RefFirst; + int m_ArrSize; protected: virtual void AddRef(); @@ -320,7 +313,7 @@ public: class DocGeneratorBase { protected: - MarkupTagsT mTags; + MarkupTagsT m_Tags; // override this method to do some post processing // after generation of document, or even write some @@ -343,14 +336,14 @@ protected: public: DocGeneratorBase() - : mTags(0) // no defaul script + : m_Tags(0) // no defaul script {} // dectrouctors of polymorphic classes SHOULD be virtual virtual ~DocGeneratorBase() {} // returns tags, being used for specific target script - MarkupTagsT GetScriptMarkupTags() { return mTags; } + MarkupTagsT GetScriptMarkupTags() { return m_Tags; } // sets tag array for specific script @@ -361,7 +354,7 @@ public: // to generator's tamplates, to match the specific script virtual void SetScriptMarkupTags( MarkupTagsT tags ) - { mTags = tags; } + { m_Tags = tags; } // seves document to file starting from the root-node of // the document (provided by GetTopSection() method), diff --git a/utils/HelpGen/src/sourcepainter.cpp b/utils/HelpGen/src/sourcepainter.cpp index 336582328e..621077a2d3 100644 --- a/utils/HelpGen/src/sourcepainter.cpp +++ b/utils/HelpGen/src/sourcepainter.cpp @@ -606,7 +606,7 @@ void SourcePainter::ProcessSource( char* src, int srcLen ) if ( mCollectResultsOn ) - mResultStr += string( src, srcLen ); + mResultStr += wxString( src, srcLen ); } void SourcePainter::SetState( bool isInComment, diff --git a/utils/HelpGen/src/sourcepainter.h b/utils/HelpGen/src/sourcepainter.h index 48284157e1..4b6b238d2b 100644 --- a/utils/HelpGen/src/sourcepainter.h +++ b/utils/HelpGen/src/sourcepainter.h @@ -32,13 +32,6 @@ #include "wxstlvec.h" #include "wx/string.h" - #if wxUSE_STD_STRING - using std::string; - #else - // FIXME:: dirty! - #define string wxString - #endif - typedef WXSTL_VECTOR_SHALLOW_COPY(int) SPBlockListT; #endif @@ -63,7 +56,7 @@ class SourcePainter { protected: - string mResultStr; + wxString mResultStr; SPBlockListT mBlocks; bool mCollectResultsOn; diff --git a/utils/HelpGen/src/srcparser.cpp b/utils/HelpGen/src/srcparser.cpp index 22959ba056..3b0f1c922d 100644 --- a/utils/HelpGen/src/srcparser.cpp +++ b/utils/HelpGen/src/srcparser.cpp @@ -123,7 +123,7 @@ wxString spComment::GetText() const spContext::spContext() - : mpParent ( NULL ), + : m_pParent ( NULL ), mpFirstOccurence( NULL ), mAlreadySorted ( false ), @@ -231,14 +231,14 @@ bool spContext::VitualContextHasChildren() return mVirtualContextHasChildren; } -string spContext::GetVirtualContextBody() +wxString spContext::GetVirtualContextBody() { wxASSERT( mIsVirtualContext ); return mVirtualContextBody; } -string spContext::GetFooterOfVirtualContextBody() +wxString spContext::GetFooterOfVirtualContextBody() { wxASSERT( mIsVirtualContext ); @@ -246,9 +246,9 @@ string spContext::GetFooterOfVirtualContextBody() } -void spContext::SetVirtualContextBody( const string& body, - bool hasChildren, - const string& footer ) +void spContext::SetVirtualContextBody( const wxString& body, + bool hasChildren, + const wxString& footer ) { mVirtualContextHasChildren = hasChildren; @@ -297,7 +297,7 @@ void spContext::AddMember( spContext* pMember ) { mMembers.push_back( pMember ); - pMember->mpParent = this; + pMember->m_pParent = this; } void spContext::AddComment( spComment* pComment ) @@ -310,7 +310,7 @@ MMemberListT& spContext::GetMembers() return mMembers; } -spContext* spContext::FindContext( const string& identifier, +spContext* spContext::FindContext( const wxString& identifier, int contextType, bool searchSubMembers ) @@ -339,8 +339,8 @@ spContext* spContext::FindContext( const string& identifier, void spContext::RemoveThisContext() { - if ( mpParent ) - mpParent->RemoveChild( this ); + if ( m_pParent ) + m_pParent->RemoveChild( this ); else // context should have a parent wxFAIL_MSG("Context should have a parent"); @@ -348,12 +348,12 @@ void spContext::RemoveThisContext() spContext* spContext::GetOutterContext() { - return mpParent; + return m_pParent; } bool spContext::HasOutterContext() { - return ( mpParent != 0 ); + return ( m_pParent != 0 ); } bool spContext::IsInFile() @@ -379,25 +379,25 @@ bool spContext::IsInOperation() spClass& spContext::GetClass() { wxASSERT( GetOutterContext()->GetType() == SP_CTX_CLASS ); - return *((spClass*)mpParent ); + return *((spClass*)m_pParent ); } spFile& spContext::GetFile() { wxASSERT( GetOutterContext()->GetType() == SP_CTX_FILE ); - return *((spFile*)mpParent ); + return *((spFile*)m_pParent ); } spNameSpace& spContext::GetNameSpace() { wxASSERT( GetOutterContext()->GetType() == SP_CTX_NAMESPACE ); - return *((spNameSpace*)mpParent ); + return *((spNameSpace*)m_pParent ); } spOperation& spContext::GetOperation() { wxASSERT( GetOutterContext()->GetType() == SP_CTX_OPERATION ); - return *((spOperation*)mpParent ); + return *((spOperation*)m_pParent ); } /***** Implementation for class spClass *****/ diff --git a/utils/HelpGen/src/srcparser.h b/utils/HelpGen/src/srcparser.h index 33b59ec2af..fda07320e0 100644 --- a/utils/HelpGen/src/srcparser.h +++ b/utils/HelpGen/src/srcparser.h @@ -30,13 +30,6 @@ #include "wx/string.h" #include "wxstlvec.h" - #if wxUSE_STD_STRING - using std::string; - #else - // FOR NOW:: quick n' dirty: - #define string wxString - #endif - #endif #include "markup.h" // markup tags used in spOperator::GetFullName() @@ -132,7 +125,7 @@ class spComment; typedef vector MCommentListT; // list of parameters typedef vector MParamListT; - // string list + // wxString list typedef vector StrListT; #else @@ -266,7 +259,7 @@ protected: MMemberListT mMembers; // NULL, if this is top-most context - spContext* mpParent; + spContext* m_pParent; // points to context object, where the this context // was originally declared, meaning that this object @@ -318,8 +311,8 @@ public: bool mVirtualContextHasChildren; // body of the context in case (mIsVirtual == true) - string mVirtualContextBody; - string mVittualContextFooter; + wxString mVirtualContextBody; + wxString mVittualContextFooter; // e.g. can be used by documentation generator to store // reference to section object @@ -359,12 +352,12 @@ public: bool VitualContextHasChildren(); - void SetVirtualContextBody( const string& body, + void SetVirtualContextBody( const wxString& body, bool hasChildren = false, - const string& footer = wxEmptyString ); + const wxString& footer = wxEmptyString ); - string GetVirtualContextBody(); - string GetFooterOfVirtualContextBody(); + wxString GetVirtualContextBody(); + wxString GetFooterOfVirtualContextBody(); // can be overriden by top-level context classes // to find-out ot the source-fragment of this @@ -398,7 +391,7 @@ public: spContext* GetOutterContext(); // perhaps more intuitive alias for `GetOutterContext()' - inline spContext* GetParent() { return mpParent; } + inline spContext* GetParent() { return m_pParent; } bool HasOutterContext(); @@ -415,7 +408,7 @@ public: // and it's children. Children's children are not // searched recursivelly if searchSubMembers is false - spContext* FindContext( const string& identifier, + spContext* FindContext( const wxString& identifier, int contextType = SP_CTX_ANY, bool searchSubMembers = true ); @@ -560,7 +553,7 @@ public: // scope if any (e.g. MyClass::MyFunction(), scope stirng is "MyClass" ) // usually found along with implementation of the method, which is now skipped - string mScope; + wxString mScope; public: spOperation(); @@ -632,7 +625,7 @@ public: int mInheritanceType; // valid if mClassSubType is SP_CLTYPE_TEMPLATE_CLASS - string mTemplateTypes; + wxString mTemplateTypes; // true, if it's and interface of abstract base class bool mIsAbstract; diff --git a/utils/HelpGen/src/wxstlac.h b/utils/HelpGen/src/wxstlac.h index e567c6e58a..86fa8d0e6c 100644 --- a/utils/HelpGen/src/wxstlac.h +++ b/utils/HelpGen/src/wxstlac.h @@ -6,7 +6,7 @@ // Created: 27/09/98 // RCS-ID: $Id$ // Copyright: (c) Aleskandars Gluchovas -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef __WXSTLAC_G__ @@ -28,18 +28,18 @@ // arguments: // -// ARG_IS_UNIQUE -// ASSOC_CONT_CLASS_NAME +// ARG_IS_UNIQUE +// ASSOC_CONT_CLASS_NAME // -// ARG_VALUE_TYPE +// ARG_VALUE_TYPE // ARG_KEY_TYPE // ARG_ACTUAL_VALUE_TYPE -// +// // _KEY_NAME // _VALUE_NAME // -// _X_KEY_NAME -// _X_VALUE_NAME +// _X_KEY_NAME +// _X_VALUE_NAME // // _INSERT_METHOD_DEFINITION @@ -60,9 +60,9 @@ ASSOC_CONT_CLASS_NAME\ protected:\ \ public:\ - typedef ARG_VALUE_TYPE value_type;\ - typedef ARG_KEY_TYPE key_type;\ - typedef ARG_ACTUAL_VALUE_TYPE actual_value_type;\ + typedef ARG_VALUE_TYPE value_type;\ + typedef ARG_KEY_TYPE key_type;\ + typedef ARG_ACTUAL_VALUE_TYPE actual_value_type;\ \ typedef value_type* pointer;\ typedef value_type& reference;\ @@ -76,7 +76,7 @@ protected:\ \ struct tree_node \ {\ - tree_node* mpParent;\ + tree_node* m_pParent;\ tree_node* mpLeft;\ tree_node* mpRight;\ \ @@ -109,16 +109,16 @@ public:\ return pNode;\ }\ else\ - if ( pNode->mpParent )\ + if ( pNode->m_pParent )\ {\ - if ( pNode == pNode->mpParent->mpLeft )\ + if ( pNode == pNode->m_pParent->mpLeft )\ \ - return pNode->mpParent;\ + return pNode->m_pParent;\ \ - pNode = pNode->mpParent;\ + pNode = pNode->m_pParent;\ \ node_ref_type prevNode = pNode;\ - pNode = pNode->mpParent;\ + pNode = pNode->m_pParent;\ \ while(pNode)\ {\ @@ -127,7 +127,7 @@ public:\ ) return pNode;\ \ prevNode = pNode;\ - pNode= pNode->mpParent;\ + pNode= pNode->m_pParent;\ }\ \ return 0;\ @@ -147,15 +147,15 @@ public:\ return pNode;\ }\ else\ - if ( pNode->mpParent )\ + if ( pNode->m_pParent )\ {\ - if ( pNode == pNode->mpParent->mpRight )\ - return pNode->mpParent;\ + if ( pNode == pNode->m_pParent->mpRight )\ + return pNode->m_pParent;\ \ - pNode = pNode->mpParent;\ + pNode = pNode->m_pParent;\ \ node_ref_type prevNode = pNode;\ - pNode = pNode->mpParent;\ + pNode = pNode->m_pParent;\ \ while(pNode)\ {\ @@ -164,7 +164,7 @@ public:\ ) return pNode;\ \ prevNode = pNode;\ - pNode= pNode->mpParent;\ + pNode= pNode->m_pParent;\ }\ \ return 0;\ @@ -233,7 +233,7 @@ protected:\ {\ node_ref_type pNewNode = AllocNode();\ \ - pNewNode->mpParent = \ + pNewNode->m_pParent = \ pNewNode->mpLeft =\ pNewNode->mpRight = 0;\ \ @@ -255,7 +255,7 @@ protected:\ : pCurrent->mpRight;\ }\ \ - pNewNode->mpParent = pParent;\ + pNewNode->m_pParent = pParent;\ \ if(pParent)\ \ @@ -546,15 +546,15 @@ public:\ else\ pX = pY->mpRight;\ \ - if ( pX ) pX->mpParent = pY->mpParent;\ + if ( pX ) pX->m_pParent = pY->m_pParent;\ \ - if (pY->mpParent)\ + if (pY->m_pParent)\ \ - if (pY == pY->mpParent->mpLeft )\ + if (pY == pY->m_pParent->mpLeft )\ \ - pY->mpParent->mpLeft = pX;\ + pY->m_pParent->mpLeft = pX;\ else\ - pY->mpParent->mpRight = pX;\ + pY->m_pParent->mpRight = pX;\ else\ mpRoot = pX;\ \ @@ -564,23 +564,23 @@ public:\ \ pY->mpLeft = pZ->mpLeft;\ \ - if (pY->mpLeft) pY->mpLeft->mpParent = pY;\ + if (pY->mpLeft) pY->mpLeft->m_pParent = pY;\ \ pY->mpRight = pZ->mpRight;\ \ if ( pY->mpRight ) \ \ - pY->mpRight->mpParent = pY;\ + pY->mpRight->m_pParent = pY;\ \ - pY->mpParent = pZ->mpParent;\ + pY->m_pParent = pZ->m_pParent;\ \ - if (pZ->mpParent)\ + if (pZ->m_pParent)\ \ - if (pZ == pZ->mpParent->mpLeft)\ + if (pZ == pZ->m_pParent->mpLeft)\ \ - pZ->mpParent->mpLeft = pY;\ + pZ->m_pParent->mpLeft = pY;\ else\ - pZ->mpParent->mpRight = pY;\ + pZ->m_pParent->mpRight = pY;\ else\ mpRoot = pY;\ \ @@ -662,7 +662,7 @@ inline insert_result_iterator insert( const value_type& x )\ #define GREATER_THEN_FUNCTOR(TYPE) struct \ { inline int operator()(const TYPE& x, const TYPE& y ) const { return x > y; } } -// functor argument should be created using the two above macros +// functor argument should be created using the two above macros // or passing own class with method "operator()(const TYPE&,cosnt TYPE&)" defined in it #define WXSTL_MAP( KEY_TYPE, VALUE_TYPE, FUNCTOR ) __DEFINE_MAP( 1 ,KEY_TYPE, VALUE_TYPE, FUNCTOR) diff --git a/utils/HelpGen/src/wxstllst.h b/utils/HelpGen/src/wxstllst.h index 2ca899dce1..471df3e6f9 100644 --- a/utils/HelpGen/src/wxstllst.h +++ b/utils/HelpGen/src/wxstllst.h @@ -6,7 +6,7 @@ // Created: 27/09/98 // RCS-ID: $Id$ // Copyright: (c) Aleskandars Gluchovas -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef __WXSTLLST_G__ @@ -27,7 +27,7 @@ // VERSION:: 0.2 (copy-constructor/assign-op added) // FOR NOW:: class-member operators "new" and "delete" -// are ignored by list class, memory allocated +// are ignored by list class, memory allocated // and freed using global operators typedef int Type; @@ -40,50 +40,50 @@ typedef int Type; {\ public:\ \ - typedef Type value_type;\ - typedef value_type* pointer;\ - typedef const value_type* const_pointer;\ - typedef value_type& reference;\ - typedef const value_type& const_reference;\ - typedef size_t size_type;\ - typedef ptrdiff_t difference_type;\ + typedef Type value_type;\ + typedef value_type* pointer;\ + typedef const value_type* const_pointer;\ + typedef value_type& reference;\ + typedef const value_type& const_reference;\ + typedef size_t size_type;\ + typedef ptrdiff_t difference_type;\ \ protected:\ - struct list_node\ - {\ - list_node* mpNext;\ - list_node* mpPrev;\ - value_type mData;\ - };\ -\ - typedef list_node* node_ref_type;\ -\ - node_ref_type mpFreeListHead;\ - node_ref_type mpTerminator;\ - size_type mSize;\ -\ - inline node_ref_type AllocNode() \ - { \ - if ( mpFreeListHead ) \ - {\ - node_ref_type pFreeNode = mpFreeListHead;\ - mpFreeListHead = mpFreeListHead->mpPrev;\ -\ - return pFreeNode;\ - }\ - else\ - {\ - char* pHeapBlock = new char[sizeof(list_node)];\ -\ - return (node_ref_type)pHeapBlock;\ - }\ - }\ -\ - inline void DestroyFreeList()\ - {\ - while ( mpFreeListHead )\ - {\ - node_ref_type tmp = mpFreeListHead;\ + struct list_node\ + {\ + list_node* mpNext;\ + list_node* mpPrev;\ + value_type mData;\ + };\ +\ + typedef list_node* node_ref_type;\ +\ + node_ref_type mpFreeListHead;\ + node_ref_type mpTerminator;\ + size_type m_Size;\ +\ + inline node_ref_type AllocNode() \ + { \ + if ( mpFreeListHead ) \ + {\ + node_ref_type pFreeNode = mpFreeListHead;\ + mpFreeListHead = mpFreeListHead->mpPrev;\ +\ + return pFreeNode;\ + }\ + else\ + {\ + char* pHeapBlock = new char[sizeof(list_node)];\ +\ + return (node_ref_type)pHeapBlock;\ + }\ + }\ +\ + inline void DestroyFreeList()\ + {\ + while ( mpFreeListHead )\ + {\ + node_ref_type tmp = mpFreeListHead;\ mpFreeListHead = mpFreeListHead->mpPrev;\ \ delete [](char*)tmp;\ @@ -318,7 +318,7 @@ public:\ \ inline listClass()\ : mpFreeListHead( 0 ),\ - mSize(0)\ + m_Size(0)\ {\ mpTerminator = AllocNode();\ mpTerminator->mpPrev = mpTerminator->mpNext = mpTerminator;\ @@ -347,7 +347,7 @@ public:\ \ inline listClass(const_iterator first, const_iterator last)\ : mpFreeListHead( 0 ),\ - mSize(0)\ + m_Size(0)\ \ { while( first != last ) push_back( *first++ ); }\ \ @@ -384,9 +384,9 @@ public:\ inline const_reverse_iterator rend() const\ { return const_reverse_iterator(mpTerminator); }\ \ - inline int empty() const { return (mSize == 0); }\ + inline int empty() const { return (m_Size == 0); }\ \ - inline size_type size() const { return mSize; }\ + inline size_type size() const { return m_Size; }\ \ inline size_type max_size() const { return UINT_MAX/sizeof(list_node); }\ \ @@ -415,7 +415,7 @@ public:\ \ new (&pNew->mData) value_type(x);\ \ - ++mSize;\ + ++m_Size;\ \ return iterator(pNew);\ }\ @@ -441,8 +441,8 @@ public:\ other.mpTerminator->mpNext = \ other.mpTerminator->mpPrev = other.mpTerminator;\ \ - mSize += other.mSize;\ - other.mSize = 0;\ + m_Size += other.m_Size;\ + other.m_Size = 0;\ }\ \ inline void splice( iterator position, listClass& other, iterator first, iterator last )\ @@ -457,8 +457,8 @@ public:\ ++sz;\ }\ \ - mSize += sz;\ - other.mSize -= sz;\ + m_Size += sz;\ + other.m_Size -= sz;\ \ node_ref_type pPos = position.mpNode;\ node_ref_type pFirst = first.mpNode;\ @@ -502,7 +502,7 @@ public:\ \ firstNode = next;\ \ - --mSize;\ + --m_Size;\ }\ }\ \ @@ -518,13 +518,13 @@ public:\ \ void sort()\ {\ - if ( mSize < 2 ) return;\ + if ( m_Size < 2 ) return;\ \ iterator from = begin();\ iterator other_end = end();\ --other_end;\ \ - for( size_type i = 0; i != mSize; ++i )\ + for( size_type i = 0; i != m_Size; ++i )\ {\ size_type nSwaps = 0;\ \ -- 2.47.2