branches/kdevelop/3.4/languages/cpp

David Nolden david.nolden at art-master.de
Mon May 22 19:11:22 UTC 2006


Am Montag, 22. Mai 2006 20:10 schrieb Andras Mantia:
> On Monday 22 May 2006 18:12, David Nolden wrote:
> > I think that my code generally could be used as a starting-point in
> > KDevelop-4. Because of it's design, it is extensible. All that would
> > need to be done is changing a few classes that interface to the
> > code-model and repository.
>
> I started to clean this up. Sorry, but you were right, this is a huge
> job. In random order the following things can be found in that file:
> - class declarations
> - forward declaration of classes
> - namespace definitions
> - using namespace XXX statements
> - methods that do not belong to any class
> - data structure definitions
>
> Yeah, the original one had also some classes inside, but in a clean(er)
> way:
> 1. include statements
> 2. class SimpleVariable
> 3. class SimpleContext
> 4. struct RecoveryPoint
> 5. struct CppCodeCompletionData
> 6. 4 functions belonging to nowhere (this is the ugliest part)
> 7. implementation of CppCodeCompletion class.
> 
> Just to help myself, here is the structure of the current file:
> 1. includes
> 2. 1 global variable and a typedef
> 3. class CodeCompletionEntry
> 4. struct SafetyCounter
> 5. namespace CompletionDebug
> 5.1. template <class StreamType> class KDDebugState
> 5.2. some methods of the above implemented non-inline
> 5.3. typedefs and global variables
> 5.4. class Debug
> 5.5. two functions outside of any class
> 6. using namespace CompletionDebug;
> 7. global variable
> 8. namespace StringHelpers
> 8.1. functions without a class
> 8.2. class ParamIterator
> 9. using namespace StringHelpers;
> 10. one function without a class
> 11. namespace BitHelpers
> 12. using namespace BitHelpers;
> 13. forward declaration of class SimpleTypeImpl;
> 14. a typedef
> 15. class TypeDecoration
> 16. a global variable
> 17. forward declaration of class TypeDesc and TypeDescShared
> 18. a typedef
> 19. a German comment
> 20. class TypeDesc
> 21. class TypeDescShared
> 22. 29 method of TypeDesc implemented non-inline (I have no idea when
> they are implemented inline and when they are not. It seems random.)
> 23. global variable
> 24. 2 functions without a class
> 25. forward declaration of class SimpleTypeImpl
> 26. enum Repository
> 27. class SimpleType
> 28. 3 global variables
> 29. class ConfigureSimpleTypes
> 30. struct CppCodeCompletion::ExpressionInfo (why no namespace
> CppCodeCompletion { } here??)
> 31. class CppCodeCompletion::EvaluationResult
> 32. namespace CppEvaluation
> 32.1. forward declaration of class Operator;
> 32.2. struct OperatorIdentification
> 32.3. class Operator
> 32.4. class OperatorSet
> 32.5. template <class OperatorType> class RegisterOperator
> 32.6. global variable
> 32.7. class UnaryOperator
> 32.8. class NestedTypeOperator
> 32.9. class DotOperator
> 33. forward declaration of class SimpleTypeFunctionInterface
> 34. using namespace CppEvaluation;
> 35. class SimpleTypeImpl
> 36. class SimpleTypeFunctionInterface
> 37. template <class Base> class SimpleTypeCacheBinder
> 38. 3 forward declarations and 6 typedefs
> 39. class SimpleTypeCodeModel
> 40. template <class Base=SimpleTypeImpl> class SimpleTypeFunction
> 41. forward decl. of class SimpleTypeCodeModelFunction;
> 42. a typedef (just to rename a class...)
> 43. class SimpleTypeCodeModelFunction
> 44. implementation of 1 SimpleType method (see #27)
> 45. a function without a class
> 46. implementation of 3 SimpleTypeImpl methods (#35)
> 47. class SimpleTypeCatalog
> 48. forward decl. of class SimpleTypeCatalogFunction and the usual
> rename with typedef
> 49. class SimpleTypeCatalogFunction
> 50. implementation of 1 SimpleTypeCatalog method (#47)
> 51. implementation of 5 SimpleType method, including init and a ctor!
> (#27)
> 52. implementation of 1 Operator method (#32.3, in a namespace!)
> 53. class SimpleTypeNamespace
> 54. implementation of 1 SimpleType method (#27, again)
> 55. template<class To, class From> QValueList<To> convertLis
> 56. namespace CppEvaluation
> 56.1. class ArrowOperator
> 56.2. global var
> 56.3. class StarOperator
> 56.4. global var
> 56.5. class AddressOperator
> 56.6. global var
> 56.7. class UnaryParenOperator
> 56.8. class IndexOperator
> 56.9. global var
> 56.10. class ParenOperator
> 56.11. global var
> 56.12. class NeutralParenOperator
> 56.13. global var
> 57. a function without class belonging the just closed namespace (#56)
> 58. class SimpleVariable
> 59. a function without a class
> --- from here it is the old code ---
> 60. class SimpleContext
> 61. struct RecoveryPoint
> 62. struct CppCodeCompletionData
> 63. 5 functions without a class
> 64. implementation of CppCodeCompletion
> -- new code again ---
> 65. a typedef (too hard to use CppCodeCompletion::ExpressionInfo ...)
> 66. namespace CppEvaluation
> 66.1. class ExpressionEvaluation
> 67. implementation of CppCodeCompletion continues
> 68. 2 functions without a class
> 69.  implementation of CppCodeCompletion continues (again)
> 70. a function without a class
> 71. struct PopupFillerHelpStruc
> 72. struct PopupClassViewFillerHelpStruct
> 73. template <class HelpStruct> class PopupFiller
> 74. implementation of CppCodeCompletion continues (3rd time)
> 75. function without a class
> 76. template <class HelpStruct> class PopupFiller
> 77. implementation of CppCodeCompletion continues (4th time)
> 78. class ComputeRecoveryPoints
> 80. implementation of CppCodeCompletion continues (5th time)
>
> If somebody could read and follow, congratulation for him.
> If you ask me, this is not acceptable at all. I better live with worse
> code completion.
>
> And if you think I am a nitpicker, you are wrong. I think this is the
> first type I react this way, and this is because:
> - I care of KDevelop
> - I had to touch the code
>
> And I don't find this "easier to modify" or extensible.
>
> Andras

You are right! I never said that this code did not need a cleanup.

But that cleanup would be much simpler than splitting everything to different 
files, it would just need some copy&pasting around in the file and maybe 
namespacing. That's something that I am willing and was planning to do, 
nothing to get upset of.

David




More information about the KDevelop-devel mailing list