Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => CodeCompletion redesign => Topic started by: ollydbg on February 07, 2012, 07:55:59 am

Title: decouple more things in token.h and tokenstree.h
Post by: ollydbg on February 07, 2012, 07:55:59 am
Would it possible to do more decoupling on the Token class and TokensTree class.
I would like to move some typedef like:
Code
typedef SearchTree<TokenIdxSet>                                  TokenSearchTree;
typedef BasicSearchTree                                          TokenFilenamesMap;
typedef std::map< size_t, TokenIdxSet,       std::less<size_t> > TokenFilesMap;
typedef std::map< size_t, FileParsingStatus, std::less<size_t> > TokenFilesStatus;
from token.h to tokenstree.h.

But I can't move this one:
Code
typedef std::set< size_t, std::less<size_t> >                    TokenFilesSet;
Because Token class use this kind of declaration.
Any ideas?
Title: Re: decouple more things in token.h and tokenstree.h
Post by: ollydbg on February 10, 2012, 03:37:31 pm
What I try to do is:
Code
Index: token.h
===================================================================
--- token.h (revision 7785)
+++ token.h (working copy)
@@ -6,40 +6,18 @@
 #ifndef TOKEN_H
 #define TOKEN_H
 
-#include <wx/arrstr.h>
-#include <wx/dynarray.h> // WX_DEFINE_ARRAY
-#include <wx/string.h>
+#include <wx/arrstr.h>  //wxArrayString
+#include <wx/string.h>  //wxString
 
-#include <deque>
 #include <set>
-#include <vector>
+#include <map>   //template map
 
-#include "searchtree.h"
-
-class wxEvtHandler;
-
 class Token;
 class TokensTree;
 
-enum FileParsingStatus
-{
-    fpsNotParsed = 0,
-    fpsAssigned,
-    fpsBeingParsed,
-    fpsDone
-};
+typedef std::set< int, std::less<int> >           TokenIdxSet;
+typedef std::set< size_t, std::less<size_t> >     TokenFilesSet;
 
-WX_DEFINE_ARRAY(Token*, TokensArray);
-
-typedef std::vector<Token*>                                      TokenList;
-typedef std::deque<int>                                          TokenIdxList;
-typedef std::set< int, std::less<int> >                          TokenIdxSet;
-typedef SearchTree<TokenIdxSet>                                  TokenSearchTree;
-typedef BasicSearchTree                                          TokenFilenamesMap;
-typedef std::map< size_t, TokenIdxSet,       std::less<size_t> > TokenFilesMap;
-typedef std::map< size_t, FileParsingStatus, std::less<size_t> > TokenFilesStatus;
-typedef std::set< size_t, std::less<size_t> >                    TokenFilesSet;
-
 enum TokenScope
 {
     tsUndefined = 0,
Index: tokenstree.h
===================================================================
--- tokenstree.h (revision 7785)
+++ tokenstree.h (working copy)
@@ -8,9 +8,29 @@
 
 #include <wx/string.h>
 #include <wx/thread.h>
+#include <vector>
+#include <deque>
 
 #include "token.h"
+#include "searchtree.h"
 
+enum FileParsingStatus
+{
+    fpsNotParsed = 0,
+    fpsAssigned,
+    fpsBeingParsed,
+    fpsDone
+};
+
+typedef std::deque<int>                                          TokenIdxList;
+typedef std::vector<Token*>                                      TokenList;
+typedef SearchTree<TokenIdxSet>                                  TokenSearchTree;
+typedef BasicSearchTree                                          TokenFilenamesMap;
+typedef std::map< size_t, TokenIdxSet,       std::less<size_t> > TokenFilesMap;
+typedef std::map< size_t, FileParsingStatus, std::less<size_t> > TokenFilesStatus;
+
+
+
 extern wxMutex s_TokensTreeMutex;
 
 class TokensTree


It looks like most typedef should not be in token.h, so I moved to tokenstree.h, any ideas?
Title: Re: decouple more things in token.h and tokenstree.h
Post by: MortenMacFly on February 10, 2012, 08:20:07 pm
What I try to do is:
Go ahead... Looks good to me.
Title: Re: decouple more things in token.h and tokenstree.h
Post by: ollydbg on February 11, 2012, 03:45:08 am
Ok, done in rev 7789.