cpp.srt 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. ;;; cpp.srt --- SRecode templates for c++-mode
  2. ;; Copyright (C) 2007-2016 Free Software Foundation, Inc.
  3. ;; Author: Eric M. Ludlam <eric@siege-engine.com>
  4. ;; This file is part of GNU Emacs.
  5. ;; GNU Emacs 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 3 of the License, or
  8. ;; (at your option) any later version.
  9. ;; GNU Emacs 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 GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
  15. set mode "c++-mode"
  16. set comment_start "/**"
  17. set comment_end " */"
  18. set comment_prefix " *"
  19. context declaration
  20. template class :indent :blank
  21. "Insert a C++ class. For use by user insertion.
  22. Override this template to change contents of a class.
  23. Override `class-tag' to override the outer structure of the class."
  24. ----
  25. {{<A:class-tag}}
  26. public:
  27. {{>CONSTRUCTOR:classdecl:constructor-tag}}
  28. {{>DESTRUCTOR:classdecl:destructor-tag}}
  29. private:
  30. {{^}}
  31. {{/A}}
  32. ----
  33. template subclass :indent :blank
  34. "Insert a C++ subclass of some other class."
  35. sectiondictionary "PARENTS"
  36. set NAME "?PARENTNAME"
  37. ----
  38. {{>A:class}}
  39. ----
  40. template class-tag :indent :blank
  41. "Insert a C++ class with the expectation of it being used by a tag inserter.
  42. Override this to affect applications, or the outer class structure for
  43. the user-facing template."
  44. ----
  45. class {{?NAME}} {{#PARENTS}}{{#FIRST}}: {{/FIRST}}public {{NAME}}{{/PARENTS}}
  46. {
  47. {{^}}
  48. };
  49. ----
  50. bind "c"
  51. template method :indent :blank
  52. "Method belonging to some class, declared externally."
  53. ----
  54. {{?TYPE}} {{?PARENT}}::{{?NAME}}{{>:misc:arglist}}
  55. {{#INITIALIZERS}}{{>B:initializers}}{{/INITIALIZERS}}
  56. {
  57. {{^}}
  58. }
  59. ----
  60. context classdecl
  61. template constructor-tag :indent :blank
  62. ----
  63. {{?NAME}}{{>:misc:arglist}}
  64. { {{^}} }
  65. ----
  66. ;; This one really sucks. How can I finish it?
  67. template initializers :indent
  68. ----
  69. {{#FIRST}}:
  70. {{/FIRST}}{{INITNAME}}(){{#NOTLAST}},{{/NOTLAST}}
  71. ----
  72. template destructor-tag :indent :blank
  73. ----
  74. ~{{?NAME}}{{>:misc:arglist}}
  75. { {{^}} }
  76. ----
  77. ;;; Base Comment functions for overriding.
  78. context classdecl
  79. template comment-function-group-start :indent :blank
  80. "Used for putting comments in front of a functional group of declarations.
  81. Override this with your own preference to avoid using doxygen."
  82. ----
  83. {{>A:classdecl:doxygen-function-group-start}}
  84. ----
  85. template comment-function-group-end :indent :blank
  86. "Used for putting comments in front of a functional group of declarations.
  87. Override this with your own preference to avoid using doxygen."
  88. ----
  89. {{>A:classdecl:doxygen-function-group-end}}
  90. ----
  91. ;;; DOXYGEN FEATURES
  92. ;;
  93. ;;
  94. context classdecl
  95. prompt GROUPNAME "Name of declaration group: "
  96. template doxygen-function-group-start :indent :blank
  97. ----
  98. /**
  99. * {{?GROUPNAME}}
  100. * @{
  101. */
  102. ----
  103. template doxygen-function-group-end :indent :blank
  104. ----
  105. /**
  106. * @}
  107. */
  108. ----
  109. ;; end