• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • dcop
 

dcop

  • dcop
  • dcopidl2cpp
dcopidl2cpp/main.cpp
1/*****************************************************************
2Copyright (c) 1999 Torben Weis <weis@kde.org>
3Copyright (c) 2000 Matthias Ettrich <ettrich@kde.org>
4
5Permission is hereby granted, free of charge, to any person obtaining a copy
6of this software and associated documentation files (the "Software"), to deal
7in the Software without restriction, including without limitation the rights
8to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9copies of the Software, and to permit persons to whom the Software is
10furnished to do so, subject to the following conditions:
11
12The above copyright notice and this permission notice shall be included in
13all copies or substantial portions of the Software.
14
15THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
19AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22******************************************************************/
23#include <tqdom.h>
24#include <tqfile.h>
25#include <tqtextstream.h>
26#include <tqstring.h>
27
28#include <string.h>
29#include <stdlib.h>
30#include <stdio.h>
31#include <unistd.h>
32#include "main.h"
33
34
35
36void usage()
37{
38 fprintf( stderr, "[dcopidl2cpp] Usage: dcopidl2cpp [ --no-skel | --no-stub ] [--c++-suffix <suffix>] file\n" );
39}
40
41int main( int argc, char** argv )
42{
43
44 if ( *tqVersion() == '1' ) {
45 fprintf( stderr, "[dcopidl2cpp] dcopidl2cpp appears to be linked to Qt 1 instead of Qt >= 2 ! Aborting.\n" );
46 exit(1);
47 }
48 if ( argc < 2 ) {
49 usage();
50 return 1;
51 }
52 int argpos = 1;
53 bool generate_skel = true;
54 bool generate_stub = true;
55
56 TQString suffix = "cpp";
57
58 while (argc > 2) {
59
60 if ( strcmp( argv[argpos], "--no-skel" ) == 0 )
61 {
62 generate_skel = false;
63 for (int i = argpos; i < argc - 1; i++) argv[i] = argv[i+1];
64 argc--;
65 }
66 else if ( strcmp( argv[argpos], "--no-stub" ) == 0 )
67 {
68 generate_stub = false;
69 for (int i = argpos; i < argc - 1; i++) argv[i] = argv[i+1];
70 argc--;
71 }
72 else if ( strcmp( argv[argpos], "--no-signals" ) == 0 )
73 {
74 // Obsolete: Signal stubs are now always generated.
75 // Leave this command line argument intact, so old Makefiles won't break.
76 for (int i = argpos; i < argc - 1; i++) argv[i] = argv[i+1];
77 argc--;
78 }
79 else if ( strcmp( argv[argpos], "--c++-suffix" ) == 0)
80 {
81 if (argc - 1 < argpos) {
82 usage();
83 exit(1);
84 }
85 suffix = argv[argpos+1];
86 for (int i = argpos; i < argc - 2; i++) argv[i] = argv[i+2];
87 argc -= 2;
88 } else {
89 usage();
90 exit(1);
91 }
92 }
93
94 TQFile in( TQFile::decodeName(argv[argpos]) );
95 if ( !in.open( IO_ReadOnly ) )
96 tqFatal("Could not read %s", argv[argpos] );
97
98 TQDomDocument doc;
99 doc.setContent( &in );
100
101 TQDomElement de = doc.documentElement();
102 Q_ASSERT( de.tagName() == "DCOP-IDL" );
103
104 TQString base( argv[argpos] );
105 TQString idl = base;
106
107 int pos = base.findRev( '.' );
108 if ( pos != -1 )
109 base = base.left( pos );
110
111 pos = idl.findRev('/');
112 if ( pos != -1 )
113 idl = idl.mid( pos+1 );
114
115 if ( generate_skel )
116 generateSkel( idl, base + "_skel." + suffix, de );
117
118 if ( generate_stub ) {
119 TQString header = base;
120 generateStub( idl, header + "_stub.h", de );
121 pos = header.findRev('/');
122 if ( pos != -1 )
123 header = header.mid( pos+1 );
124 generateStubImpl( idl, header + "_stub.h", base+".h", base + "_stub." + suffix, de);
125 }
126
127 return 0;
128}

dcop

Skip menu "dcop"
  • Main Page
  • Modules
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

dcop

Skip menu "dcop"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for dcop by doxygen 1.9.4
This website is maintained by Timothy Pearson.