SIP4 python bindings for TQt
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 

113 lignes
2.4 KiB

  1. // This is the SIP interface definition for TQSemaphore.
  2. //
  3. // Copyright (c) 2007
  4. // Riverbank Computing Limited <info@riverbankcomputing.co.uk>
  5. //
  6. // This file is part of PyTQt.
  7. //
  8. // This copy of PyTQt is free software; you can redistribute it and/or modify it
  9. // under the terms of the GNU General Public License as published by the Free
  10. // Software Foundation; either version 2, or (at your option) any later
  11. // version.
  12. //
  13. // PyTQt is supplied in the hope that it will be useful, but WITHOUT ANY
  14. // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  15. // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  16. // details.
  17. //
  18. // You should have received a copy of the GNU General Public License along with
  19. // PyTQt; see the file LICENSE. If not, write to the Free Software Foundation,
  20. // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  21. %ExportedDoc
  22. <Sect2><Title>TQSemaphore (TQt v2.2+)</Title>
  23. <Para>
  24. <Literal>TQSemaphore</Literal> is fully implemented. The <Literal>+=</Literal>
  25. and <Literal>-=</Literal> operators have also been implemented, but require
  26. Python v2.0 or later.
  27. </Para>
  28. </Sect2>
  29. %End
  30. %If (TQt_THREAD_SUPPORT)
  31. %If (TQt_3_0_0 -)
  32. class TQSemaphore
  33. {
  34. %TypeHeaderCode
  35. #include <qsemaphore.h>
  36. %End
  37. public:
  38. TQSemaphore(int);
  39. int available() const;
  40. int total() const;
  41. TQSemaphore &operator+=(int);
  42. %MethodCode
  43. // Some versions of TQt v3 under Windows have a bug where the +=
  44. // operator doesn't work properly (but ++ does). This way we
  45. // make sure that the most common value of n (ie. 1) works
  46. // properly with the buggy version.
  47. Py_BEGIN_ALLOW_THREADS
  48. if (a0 == 1)
  49. (*sipCpp)++;
  50. else
  51. (*sipCpp) += a0;
  52. Py_END_ALLOW_THREADS
  53. %End
  54. TQSemaphore &operator-=(int);
  55. %MethodCode
  56. // Some versions of TQt v3 under Windows have a bug where the -=
  57. // operator doesn't work properly (but -- does). This way we
  58. // make sure that the most common value of n (ie. 1) works
  59. // properly with the buggy version.
  60. Py_BEGIN_ALLOW_THREADS
  61. if (a0 == 1)
  62. (*sipCpp)--;
  63. else
  64. (*sipCpp) -= a0;
  65. Py_END_ALLOW_THREADS
  66. %End
  67. bool tryAccess(int);
  68. private:
  69. TQSemaphore(const TQSemaphore &);
  70. };
  71. %End
  72. %If (TQt_2_2_0 - TQt_3_0_0)
  73. class TQSemaphore : TQt
  74. {
  75. %TypeHeaderCode
  76. #include <qthread.h>
  77. %End
  78. public:
  79. TQSemaphore(int);
  80. int available() const;
  81. int total() const;
  82. TQSemaphore &operator+=(int);
  83. TQSemaphore &operator-=(int);
  84. private:
  85. TQSemaphore(const TQSemaphore &);
  86. };
  87. %End
  88. %End