1 /* 2 * This file is part of the FortranProject plugin for Code::Blocks IDE 3 * and licensed under the GNU General Public License, version 3 4 * http://www.gnu.org/licenses/gpl-3.0.html 5 */ 6 7 #ifndef TOKENF_H 8 #define TOKENF_H 9 10 #include <sdk.h> 11 #ifndef CB_PRECOMP 12 #include <wx/string.h> 13 #include <wx/dynarray.h> 14 #include <wx/thread.h> 15 #include <wx/arrstr.h> 16 #endif 17 #include <list> 18 19 WX_DEFINE_ARRAY_SIZE_T(size_t, ArrOfSizeT); 20 21 extern wxCriticalSection s_CritSect; 22 23 class TokenF; 24 WX_DEFINE_ARRAY(TokenF*, TokensArrayF); 25 26 class TokenFlat; 27 WX_DEFINE_ARRAY(TokenFlat*, TokensArrayFlat); 28 29 30 enum TokenKindF 31 { 32 tkUse = 0x0001, 33 tkModule = 0x0002, 34 tkSubroutine = 0x0004, 35 tkFunction = 0x0008, 36 tkProgram = 0x00010, 37 tkBlockData = 0x00020, 38 tkType = 0x00040, 39 tkInclude = 0x00080, 40 tkCommonblock = 0x00100, 41 tkPreprocessor = 0x00200, 42 tkFile = 0x00400, 43 tkVariable = 0x00800, 44 tkOther = 0x01000, 45 //tkInterfaceSubroutine = 0x02000, 46 //tkInterfaceFunction = 0x04000, 47 tkInterface = 0x08000, 48 tkInterfaceExplicit = 0x10000, 49 tkProcedure = 0x20000, 50 tkAccessList = 0x40000, 51 tkBlockConstruct = 0x80000, 52 tkAssociateConstruct = 0x100000, 53 tkSubmodule = 0x200000, 54 tkSelectTypeChild = 0x400000, 55 tkSelectTypeDefault = 0x800000, 56 tkProcedureFinal = 0x1000000, 57 tkBindTo = 0x2000000, 58 tkCallSubroutine = 0x4000000, 59 tkCallFunction = 0x8000000, 60 tkMacroDefine = 0x10000000, 61 }; 62 63 enum TokenAccessKind 64 { 65 taPublic = 1, 66 taPrivate, 67 taProtected 68 }; 69 70 71 class TokenF 72 { 73 public: 74 TokenF(); 75 TokenF(const wxString& name, const wxString& filename, unsigned int line); 76 virtual ~TokenF(); 77 78 void Clear(); 79 void AddChild(TokenF* child); 80 wxString GetTokenKindString(); 81 void AddLineEnd(int end); 82 AddPartFirst(wxString & str)83 void AddPartFirst(wxString& str){ m_PartFirst = str;}; AddPartLast(wxString & str)84 void AddPartLast(wxString& str){ m_PartLast = str;}; AddResultVariable(wxString & str)85 void AddResultVariable(wxString& str){ m_ResultVariable = str;}; 86 87 wxString m_Name; 88 wxString m_DisplayName; 89 wxString m_Args; 90 wxString m_Filename; 91 wxString m_TypeDefinition; 92 unsigned int m_LineStart; 93 unsigned int m_LineEnd; 94 unsigned int m_DefinitionLength; 95 TokenKindF m_TokenKind; 96 TokenAccessKind m_TokenAccess; 97 98 wxString m_PartFirst; // type of variable or function 99 //For function only 100 wxString m_ResultVariable; 101 wxString m_PartLast; 102 103 //For tkType only 104 wxString m_ExtendsType; 105 106 //For tkProcedure 107 bool m_Pass; 108 bool m_IsAbstract; // is abstract procedure or procedure pointer, or type 109 110 TokenF* m_pParent; 111 TokensArrayF m_Children; 112 113 wxString m_DocString; 114 115 protected: 116 private: 117 }; 118 119 class TokensArrayClass 120 { 121 public: 122 TokensArrayClass(); 123 ~TokensArrayClass(); GetTokens()124 TokensArrayF* GetTokens(){return &m_Tokens;}; 125 protected: 126 private: 127 TokensArrayF m_Tokens; 128 }; 129 130 class TokenFlat : public TokenF 131 { 132 public: 133 TokenFlat(); 134 TokenFlat(const TokenF* tok); 135 TokenFlat(const TokenFlat* tok); 136 ~TokenFlat(); 137 void Rename(const wxString& newName); 138 void ChangeDisplayName(const wxString& newName); 139 140 wxString m_ParentName; 141 wxString m_ParentDisplayName; 142 TokenKindF m_ParentTokenKind; 143 144 wxString m_Rename; // rename through use association 145 bool m_HostAssociated; 146 }; 147 148 class TokensArrayFlatClass 149 { 150 public: 151 TokensArrayFlatClass(); 152 ~TokensArrayFlatClass(); 153 void Clear(); GetTokens()154 TokensArrayFlat* GetTokens(){return &m_Tokens;}; 155 TokensArrayFlat m_Tokens; 156 bool HasTokensWithName(const wxString&, ArrOfSizeT&); 157 void DelTokensWithName(const wxString&); 158 protected: 159 private: 160 }; 161 162 class FileTokenF : public TokenF 163 { 164 public: FileTokenF()165 FileTokenF(){}; ~FileTokenF()166 virtual ~FileTokenF(){}; 167 168 wxString m_ProjectFilename; 169 private: 170 }; 171 172 #endif // TOKENF_H 173