Author Topic: CC design flaw?  (Read 9680 times)

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6025
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
CC design flaw?
« on: July 26, 2013, 09:29:51 am »
Code
#define PARSER_IMG_NONE              -2
#define PARSER_IMG_CLASS_FOLDER       0
#define PARSER_IMG_CLASS              1
#define PARSER_IMG_CLASS_PRIVATE      2
#define PARSER_IMG_CLASS_PROTECTED    3
#define PARSER_IMG_CLASS_PUBLIC       4
#define PARSER_IMG_CTOR_PRIVATE       5
#define PARSER_IMG_CTOR_PROTECTED     6
#define PARSER_IMG_CTOR_PUBLIC        7
#define PARSER_IMG_DTOR_PRIVATE       8
#define PARSER_IMG_DTOR_PROTECTED     9
#define PARSER_IMG_DTOR_PUBLIC        10
#define PARSER_IMG_FUNC_PRIVATE       11
#define PARSER_IMG_FUNC_PROTECTED     12
#define PARSER_IMG_FUNC_PUBLIC        13
#define PARSER_IMG_VAR_PRIVATE        14
#define PARSER_IMG_VAR_PROTECTED      15
#define PARSER_IMG_VAR_PUBLIC         16
#define PARSER_IMG_PREPROCESSOR       17
#define PARSER_IMG_ENUM               18
#define PARSER_IMG_ENUM_PRIVATE       19
#define PARSER_IMG_ENUM_PROTECTED     20
#define PARSER_IMG_ENUM_PUBLIC        21
#define PARSER_IMG_ENUMERATOR         22
#define PARSER_IMG_NAMESPACE          23
#define PARSER_IMG_TYPEDEF            24
#define PARSER_IMG_TYPEDEF_PRIVATE    25
#define PARSER_IMG_TYPEDEF_PROTECTED  26
#define PARSER_IMG_TYPEDEF_PUBLIC     27
#define PARSER_IMG_SYMBOLS_FOLDER     28
#define PARSER_IMG_VARS_FOLDER        29
#define PARSER_IMG_FUNCS_FOLDER       30
#define PARSER_IMG_ENUMS_FOLDER       31
#define PARSER_IMG_PREPROC_FOLDER     32
#define PARSER_IMG_OTHERS_FOLDER      33
#define PARSER_IMG_TYPEDEF_FOLDER     34
#define PARSER_IMG_MACRO              35
#define PARSER_IMG_MACRO_PRIVATE      36
#define PARSER_IMG_MACRO_PROTECTED    37
#define PARSER_IMG_MACRO_PUBLIC       38
#define PARSER_IMG_MACRO_FOLDER       39

#define PARSER_IMG_MIN PARSER_IMG_CLASS_FOLDER
#define PARSER_IMG_MAX PARSER_IMG_MACRO_FOLDER

typedef std::set<wxString>  StringSet;
typedef std::list<wxString> StringList;

/** Tree data associate with the symbol tree item */
class ClassTreeData : public wxTreeItemData
{
public:
    ClassTreeData(Token* token)   { m_Token = token; }
    Token* GetToken()             { return m_Token;  }
    void   SetToken(Token* token) { m_Token = token; }
private:
    Token* m_Token;
};
Those code was put in parser.h, but we never used in parser.cpp. What's the reason?

Edit: use the git blame, I found that those code was here since
Code
Revision: 1f58ae3afa01a4a906cadc170a702897ac499cde
Author: Yiannis Mandravellos <mandrav@codeblocks.org>
Date: 2004-5-9 19:51:42
Message:
Initial import of project
git-svn-id: svn://svn.berlios.de/codeblocks/trunk@5 98b59c6a-2706-0410-b7d6-d2fa1a1880c9
----
...
« Last Edit: July 26, 2013, 09:31:35 am by ollydbg »
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.