getset-cpp.srt 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. ;;; getset-cpp.srt --- SRecode templates for C++ class getter/setters.
  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 application "getset"
  17. context declaration
  18. template getset-in-class :tag :indent :blank
  19. ----
  20. {{>A:classdecl:comment-function-group-start}}
  21. {{TYPE}} get{{NICENAME}}() const {
  22. return {{NAME}};
  23. }
  24. void set{{NICENAME}}({{TYPE}} {{NICENAME}}) {
  25. {{NAME}} = {{NICENAME}};
  26. }
  27. {{>A:classdecl:comment-function-group-end}}
  28. ----
  29. template getset-field :blank :indent
  30. ----
  31. {{?TYPE}} f{{?NAME}};
  32. ----
  33. template getset-initializer :indent
  34. ----
  35. f{{NAME}}(){{#NOTLAST}},{{/NOTLAST}}
  36. ----
  37. ;; end