9 #include "wvdbusconn.h"
10 #include "wvistreamlist.h"
11 #include "wvlinkerhack.h"
19 WvStringList::Iter i(paths);
20 for (i.rewind(); i.next(); )
22 if (*i == msg.get_path())
24 fprintf(stderr,
"\n * %s\n\n", ((
WvString)msg).cstr());
32 int main(
int argc,
char *argv[])
37 bool sigtest =
false, methtest =
false, wait =
false;
40 args.
add_option(
'm',
"moniker",
"Specify the dbus bus to use",
42 args.
add_option(
'p',
"path",
"Listen on <path>",
44 args.
add_option(
'n',
"name",
"Register as <name>",
49 args.
process(argc, argv, &remaining_args);
52 WvIStreamList::globallist.append(&conn,
false,
"wvdbus conn");
54 conn.add_callback(WvDBusConn::PriNormal, incoming);
56 WvStringList::Iter i(names);
57 for (i.rewind(); i.next(); )
58 conn.request_name(*i);
65 WvDBusMsg(
"ca.nit.MyListener",
"/ca/nit/foo",
66 "ca.nit.foo",
"BarMethod")
70 while (conn.isok() && (wait || !conn.isidle()))
71 WvIStreamList::globallist.
runonce();
void send(WvDBusConn &conn)
A shortcut for sending this message on the given connection.
void add_option(char short_option, WvStringParm long_option, WvStringParm desc, WvStringParm arg_desc, int &val)
Add a switch that takes an integer argument.
void runonce(time_t msec_timeout=-1)
Exactly the same as: if (select(timeout)) callback();.
void add_set_bool_option(char short_option, WvStringParm long_option, WvStringParm desc, bool &val)
Add a boolean option, which, when specified, sets the specified boolean variable to true.
WvDBusMsg & append(const char *s)
The following methods are designed to allow appending various arguments to the message.
WvTCPConn tries to make all outgoing connections asynchronously (in the background).
WvString is an implementation of a simple and efficient printable-string class.
WvArgs - Sane command-line argument processing for WvStreams.
bool process(int argc, char **argv, WvStringList *remaining_args=NULL)
Process the command line arguments passed to main() using the options provided through calls to add_o...
This is a WvList of WvStrings, and is a really handy way to parse strings.