/Tools/modulator/Templates/object_tp_as_mapping

http://unladen-swallow.googlecode.com/ · #! · 29 lines · 23 code · 6 blank · 0 comment · 0 complexity · b2d41d8d4bb120d547fc051e3f578a65 MD5 · raw file

  1. /* Code to access $name$ objects as mappings */
  2. static int
  3. $abbrev$_length($abbrev$object *self)
  4. {
  5. /* XXXX Return the size of the mapping */
  6. }
  7. static PyObject *
  8. $abbrev$_subscript($abbrev$object *self, PyObject *key)
  9. {
  10. /* XXXX Return the item of self indexed by key */
  11. }
  12. static int
  13. $abbrev$_ass_sub($abbrev$object *self, PyObject *v, PyObject *w)
  14. {
  15. /* XXXX Put w in self under key v */
  16. return 0;
  17. }
  18. static PyMappingMethods $abbrev$_as_mapping = {
  19. (inquiry)$abbrev$_length, /*mp_length*/
  20. (binaryfunc)$abbrev$_subscript, /*mp_subscript*/
  21. (objobjargproc)$abbrev$_ass_sub, /*mp_ass_subscript*/
  22. };
  23. /* -------------------------------------------------------- */