PageRenderTime 38ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/trunk/Examples/test-suite/operator_pointer_ref.i

#
Swig | 21 lines | 16 code | 5 blank | 0 comment | 0 complexity | f74f3f5910b155506bb32edf9e3c5e5c MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. %module operator_pointer_ref
  2. %rename(AsCharStarRef) operator char*&;
  3. %inline %{
  4. class MyClass {
  5. public:
  6. MyClass (const char *s_ = "")
  7. : s(strdup(s_ ? s_ : ""))
  8. { }
  9. ~MyClass ()
  10. { free(s); }
  11. operator char*&()
  12. { return s; }
  13. private:
  14. char *s;
  15. };
  16. %}