Electroneum
tools::Notify Class Reference

#include <notify.h>

Public Member Functions

 Notify (const char *spec)
 
int notify (const char *tag, const char *s,...)
 

Detailed Description

Definition at line 37 of file notify.h.

Constructor & Destructor Documentation

◆ Notify()

tools::Notify::Notify ( const char *  spec)

Definition at line 47 of file notify.cpp.

48 {
49  CHECK_AND_ASSERT_THROW_MES(spec, "Null spec");
50 
51  boost::split(args, spec, boost::is_any_of(" \t"), boost::token_compress_on);
52  CHECK_AND_ASSERT_THROW_MES(args.size() > 0, "Failed to parse spec");
53  if (strchr(spec, '\'') || strchr(spec, '\"') || strchr(spec, '\\'))
54  MWARNING("A notification spec contains a quote or backslash: note that these are handled verbatim, which may not be the intent");
55  filename = args[0];
56  CHECK_AND_ASSERT_THROW_MES(epee::file_io_utils::is_file_exist(filename), "File not found: " << filename);
57 }
#define CHECK_AND_ASSERT_THROW_MES(expr, message)
Definition: misc_log_ex.h:173
bool is_file_exist(const std::string &path)
Definition: file_io_utils.h:66
#define MWARNING(x)
Definition: misc_log_ex.h:74
Here is the call graph for this function:

Member Function Documentation

◆ notify()

int tools::Notify::notify ( const char *  tag,
const char *  s,
  ... 
)

Definition at line 65 of file notify.cpp.

66 {
67  std::vector<std::string> margs = args;
68 
69  replace(margs, tag, s);
70 
71  va_list ap;
72  va_start(ap, s);
73  while ((tag = va_arg(ap, const char*)))
74  {
75  s = va_arg(ap, const char*);
76  replace(margs, tag, s);
77  }
78  va_end(ap);
79 
80  return tools::spawn(filename.c_str(), margs, false);
81 }
int spawn(const char *filename, const std::vector< std::string > &args, bool wait)
Definition: spawn.cpp:51
Here is the call graph for this function:

The documentation for this class was generated from the following files: