MT5APIComment.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. //+------------------------------------------------------------------+
  2. //| MetaTrader 5 API |
  3. //| Copyright 2000-2019, MetaQuotes Software Corp. |
  4. //| http://www.metaquotes.net |
  5. //+------------------------------------------------------------------+
  6. #pragma once
  7. //+------------------------------------------------------------------+
  8. //| Comment record interface |
  9. //+------------------------------------------------------------------+
  10. class IMTComment
  11. {
  12. public:
  13. //--- comment flags
  14. enum EnCommentFlags
  15. {
  16. COMMENT_FLAG_DELETED =0x1, // deleted
  17. COMMENT_FLAG_IMPORTANT =0x2, // important
  18. //--- enumeration borders
  19. COMMENT_FLAG_NONE =0,
  20. COMMENT_FLAG_ALL =COMMENT_FLAG_DELETED|COMMENT_FLAG_IMPORTANT,
  21. };
  22. //--- comment types
  23. enum EnCommentType
  24. {
  25. COMMENT_TYPE_UNDEFINED =0, // undefined
  26. COMMENT_TYPE_LOGRECORD =1, // log record
  27. COMMENT_TYPE_CALLRECORD =2, // call record
  28. COMMENT_TYPE_ROBOTRECORD =3, // robot record
  29. //--- enumeration borders
  30. COMMENT_TYPE_FIRST =COMMENT_TYPE_UNDEFINED,
  31. COMMENT_TYPE_LAST =COMMENT_TYPE_ROBOTRECORD,
  32. };
  33. //--- comment results
  34. enum EnCommentResult
  35. {
  36. COMMENT_RESULT_UNDEFINED =0, // undefined
  37. COMMENT_RESULT_CALL_NO_ANSWER =1, // call no answer
  38. COMMENT_RESULT_CALL_WRONG_NUMBER =2, // call wrong number
  39. COMMENT_RESULT_CALL_NOT_INTERESTED =3, // call not interested
  40. COMMENT_RESULT_CALL_SUCCESSFUL =4, // call successful
  41. //--- enumeration borders
  42. COMMENT_RESULT_FIRST =COMMENT_RESULT_UNDEFINED,
  43. COMMENT_RESULT_LAST =COMMENT_RESULT_CALL_SUCCESSFUL,
  44. };
  45. //--- common methods
  46. virtual void Release(void)=0;
  47. virtual MTAPIRES Assign(const IMTComment* comment)=0;
  48. virtual MTAPIRES Clear(void)=0;
  49. //--- record id
  50. virtual UINT64 RecordID(void) const=0;
  51. virtual MTAPIRES RecordID(const UINT64 record_id)=0;
  52. //--- related client
  53. virtual UINT64 RelatedClient(void) const=0;
  54. virtual MTAPIRES RelatedClient(const UINT64 record_id)=0;
  55. //--- related document
  56. virtual UINT64 RelatedDocument(void) const=0;
  57. virtual MTAPIRES RelatedDocument(const UINT64 record_id)=0;
  58. //--- flags
  59. virtual UINT Flags(void) const=0;
  60. virtual MTAPIRES Flags(const UINT flags)=0;
  61. //--- extra
  62. virtual LPCWSTR Extra(void) const=0;
  63. virtual MTAPIRES Extra(LPCWSTR extra)=0;
  64. //--- text
  65. virtual LPCWSTR Text(void) const=0;
  66. virtual MTAPIRES Text(LPCWSTR text)=0;
  67. //--- comment type
  68. virtual UINT CommentType(void) const=0;
  69. virtual MTAPIRES CommentType(const UINT type)=0;
  70. //--- comment result
  71. virtual UINT CommentResult(void) const=0;
  72. virtual MTAPIRES CommentResult(const UINT result)=0;
  73. //--- attachments
  74. virtual MTAPIRES AttachmentsAdd(const IMTAttachment *attachment)=0;
  75. virtual MTAPIRES AttachmentsClear(void)=0;
  76. virtual UINT AttachmentsTotal(void) const=0;
  77. virtual MTAPIRES AttachmentsNext(const UINT pos,UINT64& attachment_id,MTAPISTR& attachment_name,UINT& attachment_size) const=0;
  78. };
  79. //+------------------------------------------------------------------+
  80. //| Comment array interface |
  81. //+------------------------------------------------------------------+
  82. class IMTCommentArray
  83. {
  84. public:
  85. //--- common methods
  86. virtual void Release(void)=0;
  87. virtual MTAPIRES Assign(const IMTCommentArray* array)=0;
  88. virtual MTAPIRES Clear(void)=0;
  89. //--- add
  90. virtual MTAPIRES Add(IMTComment* comment)=0;
  91. virtual MTAPIRES AddCopy(const IMTComment* comment)=0;
  92. virtual MTAPIRES Add(IMTCommentArray* array)=0;
  93. virtual MTAPIRES AddCopy(const IMTCommentArray* array)=0;
  94. //--- delete & detach
  95. virtual MTAPIRES Delete(const UINT pos)=0;
  96. virtual IMTComment *Detach(const UINT pos)=0;
  97. //--- update
  98. virtual MTAPIRES Update(const UINT pos,IMTComment* comment)=0;
  99. virtual MTAPIRES UpdateCopy(const UINT pos,const IMTComment* comment)=0;
  100. virtual MTAPIRES Shift(const UINT pos,const int shift)=0;
  101. //--- data access
  102. virtual UINT Total(void) const=0;
  103. virtual IMTComment*Next(const UINT index) const=0;
  104. //--- sorting and search
  105. virtual MTAPIRES Sort(MTSortFunctionPtr sort_function)=0;
  106. virtual int Search(const void *key,MTSortFunctionPtr sort_function) const=0;
  107. virtual int SearchGreatOrEq(const void *key,MTSortFunctionPtr sort_function) const=0;
  108. virtual int SearchGreater(const void *key,MTSortFunctionPtr sort_function) const=0;
  109. virtual int SearchLessOrEq(const void *key,MTSortFunctionPtr sort_function) const=0;
  110. virtual int SearchLess(const void *key,MTSortFunctionPtr sort_function) const=0;
  111. virtual int SearchLeft(const void *key,MTSortFunctionPtr sort_function) const=0;
  112. virtual int SearchRight(const void *key,MTSortFunctionPtr sort_function) const=0;
  113. };
  114. //+------------------------------------------------------------------+
  115. //| Comment records notification interface |
  116. //+------------------------------------------------------------------+
  117. class IMTCommentSink
  118. {
  119. public:
  120. //--- events
  121. virtual void OnCommentAdd(const IMTComment* /*comment*/) { }
  122. virtual void OnCommentUpdate(const IMTComment* /*comment*/) { }
  123. virtual void OnCommentDelete(const IMTComment* /*comment*/) { }
  124. };
  125. //+------------------------------------------------------------------+