foobar2000 SDK  2015-01-14
commandline.h
Go to the documentation of this file.
1 class NOVTABLE commandline_handler : public service_base
2 {
3 public:
4  enum result
5  {
6  RESULT_NOT_OURS,//not our command
7  RESULT_PROCESSED,//command processed
8  RESULT_PROCESSED_EXPECT_FILES,//command processed, we want to takeover file urls after this command
9  };
10  virtual result on_token(const char * token)=0;
11  virtual void on_file(const char * url) {};//optional
12  virtual void on_files_done() {};//optional
13  virtual bool want_directories() {return false;}
14 
15  FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(commandline_handler);
16 };
17 
19 {
20 protected:
21  virtual void on_file(const char * url);
22  virtual bool want_directories() {return true;}
23 public:
24  virtual result on_token(const char * token)=0;
25  virtual void on_files_done() {};
26 
27  virtual void on_file(const metadb_handle_ptr & ptr)=0;
28 };
29 
30 /*
31 
32 how commandline_handler is used:
33 
34  scenario #1:
35  creation => on_token() => deletion
36  scenario #2:
37  creation => on_token() returning RESULT_PROCESSED_EXPECT_FILES => on_file(), on_file().... => on_files_done() => deletion
38 */
39 
40 template<typename T>
virtual void on_file(const char *url)
Definition: commandline.h:11
Base class for all service classes. Provides interfaces for reference counter and querying for differ...
Definition: service.h:333
virtual result on_token(const char *token)=0
virtual void on_file(const char *url)
Definition: commandline.cpp:3
virtual bool want_directories()
Definition: commandline.h:13
virtual void on_files_done()
Definition: commandline.h:12