parsing.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. ktigcc - TIGCC IDE for KDE
  3. Copyright (C) 2006 Kevin Kofler
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2, or (at your option)
  7. any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software Foundation,
  14. Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  15. */
  16. #pragma once
  17. #include <qstring.h>
  18. #include <qvaluevector.h>
  19. #include <qstringlist.h>
  20. #include "completion.h"
  21. struct SourceFileFunction {
  22. SourceFileFunction() : name(), prototypeLine(-1), implementationLine(-1) {}
  23. SourceFileFunction(const QString &n) :
  24. name(n), prototypeLine(-1), implementationLine(-1) {}
  25. SourceFileFunction(const QString &n, int p, int i) :
  26. name(n), prototypeLine(p), implementationLine(i) {}
  27. bool operator==(const SourceFileFunction &other) const
  28. {return name==other.name;}
  29. bool operator!=(const SourceFileFunction &other) const
  30. {return name!=other.name;}
  31. QString name;
  32. int prototypeLine;
  33. int implementationLine;
  34. };
  35. class SourceFileFunctions : public QValueVector<SourceFileFunction> {
  36. public:
  37. iterator find(const SourceFileFunction &item) {
  38. return qFind(begin(),end(),item);
  39. }
  40. };
  41. SourceFileFunctions getCFunctions(const QString &text);
  42. SourceFileFunctions getASMFunctions(const QString &text);
  43. #define getFunctions(text,isasm) (((isasm)?getASMFunctions:getCFunctions)((text)))
  44. CompletionInfo parseFileCompletion(const QString &fileText,
  45. const QString &pathInProject,
  46. CompletionInfo existing=CompletionInfo());