code.inline.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #ifndef AFUN_CODE_INLINE_H
  2. #define AFUN_CODE_INLINE_H
  3. #include "code.h"
  4. namespace aFuncore {
  5. inline Code *Code::create(aFuntool::FileLine line, aFuntool::ConstFilePath file) {
  6. return new Code(line, file);
  7. }
  8. inline Code *Code::create(const std::string &element,
  9. aFuntool::FileLine line, aFuntool::ConstFilePath file, char prefix) {
  10. return new Code(element, line, file, prefix);
  11. }
  12. inline Code *Code::create(BlockType block_type, Code *son,
  13. aFuntool::FileLine line, aFuntool::ConstFilePath file, char prefix) {
  14. return new Code(block_type, son, line, file);
  15. }
  16. inline Code::CodeType Code::getType() const {
  17. return type;
  18. }
  19. inline char Code::getPrefix() const {
  20. return prefix;
  21. }
  22. inline const char *Code::getElement() const {
  23. if (type != code_element)
  24. return "";
  25. return element;
  26. }
  27. inline Code::BlockType Code::getBlockType() const {
  28. if (type != code_block)
  29. return block_p;
  30. return block_type;
  31. }
  32. inline Code *Code::getSon() const {
  33. if (type != code_block)
  34. return nullptr;
  35. return son;
  36. }
  37. inline Code *Code::toNext() const {
  38. return next;
  39. }
  40. inline Code *Code::toPrev() const {
  41. return prev;
  42. }
  43. inline Code *Code::toFather() const {
  44. return father;
  45. }
  46. inline aFuntool::FileLine Code::getFileLine() const {
  47. return line;
  48. }
  49. inline aFuntool::FilePath Code::getFilePath() const {
  50. return file;
  51. }
  52. }
  53. #endif //AFUN_CODE_INLINE_H