From f88e32ba324d356e1d97cea35be635a53cb89725 Mon Sep 17 00:00:00 2001 From: Andreas Volz Date: Sun, 29 Mar 2009 13:52:24 +0200 Subject: [PATCH] some header and include changes --- tools/Makefile.am | 2 +- tools/generate_adaptor.cpp | 25 +++++++++++++++++ tools/generate_adaptor.h | 23 ++++++++++++++++ tools/generate_proxy.cpp | 2 ++ tools/generate_proxy.h | 23 ++++++++++++++++ tools/generator_utils.cpp | 56 +++++++++++++++++++++++++++----------- tools/generator_utils.h | 23 ++++++++++++++++ 7 files changed, 137 insertions(+), 17 deletions(-) diff --git a/tools/Makefile.am b/tools/Makefile.am index b2e595e..e89f048 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -18,7 +18,7 @@ endif bin_PROGRAMS = dbusxx-xml2cpp dbusxx-introspect dbusxx_xml2cpp_SOURCES = xml.h xml.cpp xml2cpp.h xml2cpp.cpp \ - generate_adaptor.cpp generate_proxy.cpp generate_adaptor.h\ + generate_adaptor.cpp generate_adaptor.h generate_proxy.cpp\ generate_proxy.h generator_utils.cpp generator_utils.h dbusxx_xml2cpp_LDADD = $(libdbus_cxx_la) $(xml_LIBS) diff --git a/tools/generate_adaptor.cpp b/tools/generate_adaptor.cpp index ce62b37..92f252b 100644 --- a/tools/generate_adaptor.cpp +++ b/tools/generate_adaptor.cpp @@ -1,5 +1,30 @@ +/* + * + * D-Bus++ - C++ bindings for D-Bus + * + * Copyright (C) 2005-2007 Paolo Durante + * + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + #include #include +#include +#include #include "generator_utils.h" #include "generate_adaptor.h" diff --git a/tools/generate_adaptor.h b/tools/generate_adaptor.h index dd7738d..fd888f0 100644 --- a/tools/generate_adaptor.h +++ b/tools/generate_adaptor.h @@ -1,3 +1,26 @@ +/* + * + * D-Bus++ - C++ bindings for D-Bus + * + * Copyright (C) 2005-2007 Paolo Durante + * + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + #ifndef __DBUSXX_TOOLS_GENERATE_ADAPTOR_H #define __DBUSXX_TOOLS_GENERATE_ADAPTOR_H diff --git a/tools/generate_proxy.cpp b/tools/generate_proxy.cpp index f35ef2c..386a62e 100644 --- a/tools/generate_proxy.cpp +++ b/tools/generate_proxy.cpp @@ -1,5 +1,7 @@ #include #include +#include +#include #include "generator_utils.h" #include "generate_proxy.h" diff --git a/tools/generate_proxy.h b/tools/generate_proxy.h index bdf07d0..0224f4d 100644 --- a/tools/generate_proxy.h +++ b/tools/generate_proxy.h @@ -1,3 +1,26 @@ +/* + * + * D-Bus++ - C++ bindings for D-Bus + * + * Copyright (C) 2005-2007 Paolo Durante + * + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + #ifndef __DBUSXX_TOOLS_GENERATE_PROXY_H #define __DBUSXX_TOOLS_GENERATE_PROXY_H diff --git a/tools/generator_utils.cpp b/tools/generator_utils.cpp index e033d5a..cb87f69 100644 --- a/tools/generator_utils.cpp +++ b/tools/generator_utils.cpp @@ -1,6 +1,30 @@ -#include "generator_utils.h" +/* + * + * D-Bus++ - C++ bindings for D-Bus + * + * Copyright (C) 2005-2007 Paolo Durante + * + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ #include +#include + +#include "generator_utils.h" using namespace std; @@ -19,6 +43,21 @@ const char *dbus_includes = "\n\ \n\ "; +void underscorize(string &str) +{ + for (unsigned int i = 0; i < str.length(); ++i) + { + if (!isalpha(str[i]) && !isdigit(str[i])) str[i] = '_'; + } +} + +string stub_name(string name) +{ + underscorize(name); + + return "_" + name + "_stub"; +} + const char *atomic_type_to_string(char t) { static struct { char type; const char *name; } atos[] = @@ -47,13 +86,6 @@ const char *atomic_type_to_string(char t) return atos[i].name; } -string stub_name(string name) -{ - underscorize(name); - - return "_" + name + "_stub"; -} - void _parse_signature(const string &signature, string &type, unsigned int &i) { for (; i < signature.length(); ++i) @@ -133,11 +165,3 @@ string signature_to_type(const string &signature) _parse_signature(signature, type, i); return type; } - -void underscorize(string &str) -{ - for (unsigned int i = 0; i < str.length(); ++i) - { - if (!isalpha(str[i]) && !isdigit(str[i])) str[i] = '_'; - } -} diff --git a/tools/generator_utils.h b/tools/generator_utils.h index 281affa..b232b56 100644 --- a/tools/generator_utils.h +++ b/tools/generator_utils.h @@ -1,3 +1,26 @@ +/* + * + * D-Bus++ - C++ bindings for D-Bus + * + * Copyright (C) 2005-2007 Paolo Durante + * + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + #ifndef __DBUSXX_TOOLS_GENERATOR_UTILS_H #define __DBUSXX_TOOLS_GENERATOR_UTILS_H