2
* This file is part of wxSmith plugin for Code::Blocks Studio
3
* Copyright (C) 2007 Bartlomiej Swiecki
5
* wxSmith is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 3 of the License, or
8
* (at your option) any later version.
10
* wxSmith is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with wxSmith. If not, see <http://www.gnu.org/licenses/>.
19
* $Id: wxscodercontext.h 8251 2012-08-28 02:31:00Z ollydbg $
20
* $HeadURL: http://svn.code.sf.net/p/codeblocks/code/branches/release-16.xx/src/plugins/contrib/wxSmith/wxwidgets/wxscodercontext.h $
23
#ifndef WXSCODERCONTEXT_H
24
#define WXSCODERCONTEXT_H
26
#include <wx/string.h>
27
#include <wx/arrstr.h>
28
#include <wx/hashmap.h>
29
#include <wx/hashset.h>
30
#include "../wxscodinglang.h"
32
/** \brief This struct is responsible for keeping current code context while generating resource
34
* This struct keeps information needed to properly generate and store source code.
35
* It contains code built so far, lists of include files, declarations etc.
36
* It may also contain other data stored between generation of code in different items
37
* in form of wxString->wxString map.
39
struct wxsCoderContext
41
WX_DECLARE_STRING_HASH_MAP(wxString,ExtraMap);
42
WX_DECLARE_HASH_SET(wxString,wxStringHash,wxStringEqual,wxStringSet);
44
wxsCodingLang m_Language; ///< \brief Language in which code should be generated
45
long m_Flags; ///< \brief Flags used to generate code
46
wxString m_WindowParent; ///< \brief Parent window name
48
wxStringSet m_LocalHeaders; ///< \brief List of headers included inside .cpp file which are included inside pch file
49
wxStringSet m_LocalHeadersNonPCH; ///< \brief List of headers included inside .cpp file which are not included in pch file
50
wxStringSet m_GlobalHeaders; ///< \brief List of headers containing declarations of resource's items included inside pch file
51
wxStringSet m_GlobalHeadersNonPCH; ///< \brief List of headers containing declarations of resource's items not included inside pch file
52
wxStringSet m_ForwardDeclarations; ///< \brief List of forward declarations of resource's items
53
wxStringSet m_ForwardDeclarationsNonPCH;///< \brief List of forward declarations of resource's items
54
wxStringSet m_LocalDeclarations; ///< \brief List of declarations of local items (not visible in resource's class)
55
wxStringSet m_GlobalDeclarations; ///< \brief List of declarations of global items (which are being members of resource's class)
56
wxArrayString m_IdEnumerations; ///< \brief Code used to create list of identifiers as members of resource class
57
wxArrayString m_IdInitializions; ///< \brief Code used to initialize list of identifiers
58
wxString m_XRCFetchingCode; ///< \brief Code which will fetch items from XRC file after it's loaded (through querying with IDs)
59
wxString m_BuildingCode; ///< \brief Code which builds resource's items manually (when not using XRC file)
60
wxString m_EventsConnectingCode; ///< \brief Code used to connect events
62
ExtraMap m_Extra; ///< \brief Extra data used to exchange information between items while they generate code
64
/** \brief Adding header file into current context */
65
void AddHeader(const wxString& Header,const wxString& DeclaredClass,long HeaderFlags=0);
67
/*** \brief Adding forward declaration of item's class */
68
void AddDeclaration(const wxString& Declaration);
70
/** \brief Adding XRC fetching code */
71
void AddXRCFetchingCode(const wxString& Code);
73
/** \brief Adding Manually building code */
74
void AddBuildingCode(const wxString& Code);
76
/** \brief Adding event connecting code */
77
void AddEventCode(const wxString& Code);
79
/** \brief Adding id-generating code */
80
void AddIdCode(const wxString& Enumeration,const wxString& Initialization);
82
/** \brief Generate Unique name with given prefix
84
* The name is generated by adding number of declarations with this name so far.
85
* The counter is stored as length of m_Extra map member
87
wxString GetUniqueName(const wxString& Prefix);