instagram_task.hpp 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. #ifndef __INSTAGRAM_TASK_HPP__
  2. #define __INSTAGRAM_TASK_HPP__
  3. #include <include/task/task.hpp>
  4. #include <type_traits>
  5. namespace Scheduler {
  6. namespace Args {
  7. const QString HEADER_TYPE = "header";
  8. const QString FILE_TYPE = "files";
  9. const QString DESCRIPTION_TYPE = "description";
  10. const QString HASHTAG_TYPE = "hashtags";
  11. const QString PROMOTE_TYPE = "promote_share";
  12. const QString LINK_BIO_TYPE = "link_in_bio";
  13. const QString REQUESTED_BY_TYPE = "requested_by";
  14. const QString REQUESTED_BY_PHRASE = "requested_by_phrase";
  15. } // namespace Args
  16. static constexpr const char* INSTAGRAM_NAME = "Instagram";
  17. namespace TaskCode {
  18. static constexpr int IGTASKBYTE = 0xFF;
  19. }
  20. } // namespace Scheduler
  21. /**
  22. * @brief The InstagramTask class
  23. *
  24. * Class to organize and transport data necessary to perform an Instagram Task.
  25. */
  26. class InstagramTask : public Scheduler::Task {
  27. public:
  28. /**
  29. * @constructor
  30. */
  31. InstagramTask();
  32. /**
  33. * Overrides @abstract Task::defineTaskArguments
  34. *
  35. * Useful for avoiding repetitive input of data.
  36. */
  37. virtual void defineTaskArguments() override;
  38. /**
  39. * Overrides @abstract Task::getTaskArguments
  40. *
  41. * Use this method to take over ownership of the task's arguments.
  42. */
  43. virtual const Scheduler::TaskArguments&& getTaskArguments() override;
  44. /**
  45. * Overrides @abstract Task::getTaskArgument
  46. *
  47. * Easy access to an argument.
  48. */
  49. virtual Scheduler::TaskArgument&& getTaskArgument(QString name) override;
  50. /**
  51. * Overrides @abstract Task::getTaskArgumentValue
  52. *
  53. * Easy access to an argument's value.
  54. */
  55. virtual const Scheduler::TypeVariant getTaskArgumentValue(QString name) override;
  56. /**
  57. * Overrides @abstract Task::getArgumentValues
  58. *
  59. * Easy access to all of the arguments that can be represented as a string.
  60. */
  61. virtual Scheduler::ArgumentValues getArgumentValues() override;
  62. /**
  63. * Overrides @abstract Task::getArgumentNames
  64. *
  65. * Provides the names of the arguments.
  66. */
  67. virtual QVector<QString> getArgumentNames() override;
  68. /**
  69. * Overrides @abstract Task::getFiles
  70. *
  71. * Easy access to the task's files.
  72. */
  73. virtual const QVector<Scheduler::KFileData> getFiles() override;
  74. /**
  75. * Overrides @abstract Task::getType
  76. *
  77. * Informs the caller of the task's type.
  78. */
  79. virtual Scheduler::TaskType getType() override;
  80. /**
  81. * Overrides @abstract Task::getTaskCode
  82. *
  83. * Returns the task's byte code.
  84. */
  85. virtual uint32_t getTaskCode() override;
  86. /**
  87. * Overrides @abstract Task::setArgument
  88. *
  89. * Set the value of an existing argument.
  90. */
  91. virtual void setArgument(QString name, Scheduler::TypeVariant arg) override;
  92. /**
  93. * Overrides @abstract Task::addArgument
  94. *
  95. * Add an additional value to a file container argument.
  96. */
  97. virtual void addArgument(QString name, Scheduler::KFileData file) override;
  98. /**
  99. * Overrides @abstract Task::addArgument
  100. *
  101. * Add an additional value to a string container argument.
  102. */
  103. virtual void addArgument(QString name, QString string) override;
  104. /**
  105. * Overrides @abstract Task::removeArgument
  106. *
  107. * Remove a value from a container argument.
  108. */
  109. virtual void removeArgument(QString name, Scheduler::TypeVariant arg) override;
  110. /**
  111. * Overrides @abstract Task::hasFiles
  112. *
  113. * Tells the caller if the task has files.
  114. */
  115. virtual bool hasFiles() override;
  116. /**
  117. * Overrides @abstract Task::isReady
  118. *
  119. * Informs the caller if the prerequisite arguments have values.
  120. */
  121. virtual bool isReady() override;
  122. /**
  123. * Overrides @abstract Task::clear
  124. *
  125. * Clears the values of all arguments, without removing the arguments.
  126. */
  127. virtual void clear() override;
  128. /**
  129. * Overrides @abstract Task::setDefaultValues
  130. *
  131. * Set default values for the arguments.
  132. */
  133. virtual void setDefaultValues() override;
  134. /**
  135. * Overrides @abstract Task::~Task
  136. * @destructor
  137. */
  138. virtual ~InstagramTask() override;
  139. private:
  140. /**
  141. * @brief m_arguments
  142. *
  143. * A container storing the task's arguments
  144. */
  145. Scheduler::TaskArguments m_arguments;
  146. };
  147. #endif // __INSTAGRAM_TASK_HPP