PageRenderTime 44ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 0ms

/DICK.B1/IronPython/Runtime/Interfaces.cs

https://bitbucket.org/williamybs/uidipythontool
C# | 76 lines | 22 code | 9 blank | 45 comment | 0 complexity | 93f06b89bf7e3fca955019b930626d4f MD5 | raw file
  1. /* ****************************************************************************
  2. *
  3. * Copyright (c) Microsoft Corporation.
  4. *
  5. * This source code is subject to terms and conditions of the Microsoft Public License. A
  6. * copy of the license can be found in the License.html file at the root of this distribution. If
  7. * you cannot locate the Microsoft Public License, please send an email to
  8. * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound
  9. * by the terms of the Microsoft Public License.
  10. *
  11. * You must not remove this notice, or any other, from this software.
  12. *
  13. *
  14. * ***************************************************************************/
  15. using System.Collections;
  16. using System.Collections.Generic;
  17. using Microsoft.Scripting.Runtime;
  18. namespace IronPython.Runtime {
  19. public interface ICodeFormattable {
  20. string/*!*/ __repr__(CodeContext/*!*/ context);
  21. }
  22. /// <summary>
  23. /// Defines the internal interface used for accessing weak references and adding finalizers
  24. /// to user-defined types.
  25. /// </summary>
  26. public interface IWeakReferenceable {
  27. /// <summary>
  28. /// Gets the current WeakRefTracker for an object that can be used to
  29. /// append additional weak references.
  30. /// </summary>
  31. WeakRefTracker GetWeakRef();
  32. /// <summary>
  33. /// Attempts to set the WeakRefTracker for an object. Used on the first
  34. /// addition of a weak ref tracker to an object. If the object doesn't
  35. /// support adding weak references then it returns false.
  36. /// </summary>
  37. bool SetWeakRef(WeakRefTracker value);
  38. /// <summary>
  39. /// Sets a WeakRefTracker on an object for the purposes of supporting finalization.
  40. /// All user types (new-style and old-style) support finalization even if they don't
  41. /// support weak-references, and therefore this function always succeeds. Note the
  42. /// slot used to store the WeakRefTracker is still shared between SetWeakRef and
  43. /// SetFinalizer if a type supports both.
  44. /// </summary>
  45. /// <param name="value"></param>
  46. void SetFinalizer(WeakRefTracker value);
  47. }
  48. public interface IProxyObject {
  49. object Target { get; }
  50. }
  51. public interface IReversible {
  52. IEnumerator __reversed__();
  53. }
  54. /// <summary>
  55. /// Provides a list of all the members of an instance. ie. all the keys in the
  56. /// dictionary of the object. Note that it can contain objects that are not strings.
  57. ///
  58. /// Such keys can be added in IronPython using syntax like:
  59. /// obj.__dict__[100] = someOtherObject
  60. ///
  61. /// This Python specific version also supports filtering based upon the show cls
  62. /// flag by flowing in the code context.
  63. /// </summary>
  64. public interface IPythonMembersList : IMembersList {
  65. IList<object> GetMemberNames(CodeContext context);
  66. }
  67. }