/tags/rel-1-3-15/SWIG/Examples/test-suite/constover.i

# · Swig · 38 lines · 30 code · 8 blank · 0 comment · 0 complexity · d366286e031eb40d1a1f76ca849592b7 MD5 · raw file

  1. // This test checks SWIG's code generation for C++ functions
  2. // and methods that differ only in constness.
  3. %module constover
  4. %rename(test_pconst) test(const char *);
  5. %rename(test_constm) test(char *) const;
  6. %rename(test_pconstm) test(const char *) const;
  7. %inline %{
  8. char *test(char *x) {
  9. return (char *) "test";
  10. }
  11. char *test(const char *x) {
  12. return (char *) "test_pconst";
  13. }
  14. class Foo {
  15. public:
  16. Foo() { }
  17. char *test(char *x) {
  18. return (char *) "test";
  19. }
  20. char *test(const char *x) {
  21. return (char *) "test_pconst";
  22. }
  23. char *test(char *x) const {
  24. return (char *) "test_constmethod";
  25. }
  26. char *test(const char *x) const {
  27. return (char *) "test_pconstmethod";
  28. }
  29. };
  30. %}