1/////////////////////////////////////////////////////////////////////////////
2// Name:        No names yet.
3// Purpose:     Contrib. demo
4// Author:      Aleksandras Gluchovas
5// Modified by:
6// Created:     27/12/98
7// RCS-ID:      $Id: ifcontext.h 41020 2006-09-05 20:47:48Z VZ $
8// Copyright:   (c) Aleskandars Gluchovas
9// Licence:     wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef __IFCONTEXT_G__
13#define __IFCONTEXT_G__
14
15#include "srcparser.h"
16#include "cjparser.h"
17
18class spBookmark
19{
20public:
21    size_t mFrom;
22    size_t mLen;
23    size_t mFileNo;
24
25    inline spBookmark() {}
26
27    inline spBookmark( int from, int len, int fileNo )
28        : mFrom( from ), mLen( len ), mFileNo( fileNo )
29    {}
30};
31
32#if defined( wxUSE_TEMPLATE_STL )
33
34    typedef vector<spBookmark) BookmarkListT
35
36#else
37
38    typedef WXSTL_VECTOR_SHALLOW_COPY(spBookmark) BookmarkListT;
39
40#endif
41
42
43class spInterFileContext : public spContext
44{
45protected:
46
47    BookmarkListT  mDeletionMarks;
48
49    BookmarkListT  mFiltered;
50
51    size_t         mCurFileNo;
52
53    CJSourceParser mParser;
54
55protected:
56
57    size_t GetFileNoOfContext( spContext& ctx );
58    size_t GetFileNo( const wxString& fname );
59
60    void InsertBookmarkSorted( BookmarkListT& lst, spBookmark& mark );
61
62    void DoAppendSourceFragment( wxString& source,
63                                 wxString& result,
64                                 size_t    pos,
65                                 size_t len );
66
67    void GenerateContextBody( spContext& ctx,
68                              wxString&  source,
69                              wxString&  result,
70                              size_t&    lastSavedPos,
71                              size_t&    lastKnownPos );
72
73public:
74
75    StrListT       m_Files;
76    StrListT       m_Contents;
77
78public:
79
80    spInterFileContext();
81    virtual ~spInterFileContext();
82
83    void AddFile( const wxString& fname, const wxString& content );
84
85    void RemoveContext( spContext& ctx );
86
87    void GenrateContents();
88
89    void ParseContents( SourceParserPlugin* pPlugin = NULL );
90
91    void WriteToFiles();
92
93    // overriden method of the base class (finds out the source fragment)
94
95    virtual wxString GetBody( spContext* pCtx = NULL );
96
97    virtual wxString GetHeader( spContext* pCtx = NULL );
98};
99
100
101#endif
102