parsing.h 2.0 KB

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