aboutsummaryrefslogtreecommitdiff
path: root/doc/api/index.html.part
blob: bdd0f72b88bd8f1df97cd9a604c06739588caea3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
<!-- vim: set tw=120 ft=html sw=4 sts=4 et : -->

<h1>API</h1>

<ul>
    <li>There are <a href="#examples">examples of how to use the API and bindings</a>.</li>
    <li>The core library code is written in <a href="cplusplus/index.html">C++</a>.</li>
    <li>
        <p>Bindings are available for:</p>
        <ul>
            <li><a href="ruby/index.html">Ruby</a></li>
            <li><a href="python/index.html">Python</a></li>
        </ul>
    </li>
</ul>

<h2 id="compiling">Compiling C++ Code</h2>

<p>You will need to specify various compiler flags when compiling C++ code. The usual way to do this is via
<code>pkg-config</code>:</p>

<pre>
$ g++ -c `pkg-config --cflags paludis` -o example_command_line.o example_command_line.cc
$ g++ -c `pkg-config --cflags paludis` -o example_action.o example_action.cc
$ g++ `pkg-config --libs paludis` -o example_action example_command_line.o example_action.o
</pre>

<p>If you are using autotools, consider using <code>PKG_CHECK_MODULES</code> rather than calling <code>pkg-config</code>
by hand.</p>

<h2 id="examples">Examples</h2>

<p>There are examples showing how to use various classes. Many examples are available in more than one language, showing
how concepts map on to different language bindings.</p>

<table summary="Examples, in different languages">
    <tr>
        <th>Example</th>
        <th colspan="3">Language</th>
        <th>Description</th>
    </tr>

    <tr>
        <td>example_command_line</td>
        <td>C++:
            <a href="cplusplus/example__command__line_8hh_source.html">hh</a>
            <a href="cplusplus/example__command__line_8cc.html">cc</a>
        </td>
        <td><a href="ruby/example_command_line.html">Ruby</a></td>
        <td><a href="python/example_command_line.html">Python</a></td>
        <td>Common command line code (not a standalone example)</td>
    </tr>
    <tr>
        <td>example_about</td>
        <td><a href="cplusplus/examples.html">C++</a></td>
        <td><a href="ruby/example_about.html">Ruby</a></td>
        <td><a href="python/example_about.html">Python</a></td>
        <td>How to use Paludis version macros</td>
    </tr>
    <tr>
        <td>example_action</td>
        <td><a href="cplusplus/examples.html">C++</a></td>
        <td><a href="ruby/example_action.html">Ruby</a></td>
        <td></td>
        <td>How to use actions</td>
    </tr>
    <tr>
        <td>example_contents</td>
        <td><a href="cplusplus/examples.html">C++</a></td>
        <td><a href="ruby/example_contents.html">Ruby</a></td>
        <td></td>
        <td>How to use contents</td>
    </tr>
    <tr>
        <td>example_dep_label</td>
        <td><a href="cplusplus/examples.html">C++</a></td>
        <td></td>
        <td></td>
        <td>How to handle dependency labels</td>
    </tr>
    <tr>
        <td>example_dep_spec</td>
        <td><a href="cplusplus/examples.html">C++</a></td>
        <td><a href="ruby/example_dep_spec.html">Ruby</a></td>
        <td></td>
        <td>How to handle dependency specs</td>
    </tr>
    <tr>
        <td>example_dep_spec_flattener</td>
        <td><a href="cplusplus/examples.html">C++</a></td>
        <td></td>
        <td></td>
        <td>How to use DepSpecFlattener</td>
    </tr>
    <tr>
        <td>example_dep_tag</td>
        <td><a href="cplusplus/examples.html">C++</a></td>
        <td></td>
        <td></td>
        <td>How to handle dependency tags</td>
    </tr>
    <tr>
        <td>example_dep_tree</td>
        <td><a href="cplusplus/examples.html">C++</a></td>
        <td><a href="ruby/example_dep_tree.html">Ruby</a></td>
        <td></td>
        <td>How to handle dependency specs</td>
    </tr>
    <tr>
        <td>example_environment</td>
        <td><a href="cplusplus/examples.html">C++</a></td>
        <td><a href="ruby/example_environment.html">Ruby</a></td>
        <td></td>
        <td>How to use EnvironmentFactory and the resultant Environment</td>
    </tr>
    <tr>
        <td>example_formatter</td>
        <td><a href="cplusplus/examples.html">C++</a></td>
        <td></td>
        <td></td>
        <td>How to create a formatter</td>
    </tr>
    <tr>
        <td>example_mask</td>
        <td><a href="cplusplus/examples.html">C++</a></td>
        <td><a href="ruby/example_mask.html">Ruby</a></td>
        <td></td>
        <td>How to use Mask</td>
    </tr>
    <tr>
        <td>example_match_package</td>
        <td><a href="cplusplus/examples.html">C++</a></td>
        <td><a href="ruby/example_match_package.html">Ruby</a></td>
        <td></td>
        <td>How to use paludis::match_package and paludis::match_package_in_set</td>
    </tr>
    <tr>
        <td>example_metadata_key</td>
        <td><a href="cplusplus/examples.html">C++</a></td>
        <td></td>
        <td></td>
        <td>How to use MetadataKey</td>
    </tr>
    <tr>
        <td>example_name</td>
        <td><a href="cplusplus/examples.html">C++</a></td>
        <td></td>
        <td></td>
        <td>How to use name classes</td>
    </tr>
    <tr>
        <td>example_package_database</td>
        <td><a href="cplusplus/examples.html">C++</a></td>
        <td><a href="ruby/example_package_database.html">Ruby</a></td>
        <td></td>
        <td>How to use PackageDatabase</td>
    </tr>
    <tr>
        <td>example_package_id</td>
        <td><a href="cplusplus/examples.html">C++</a></td>
        <td><a href="ruby/example_package_id.html">Ruby</a></td>
        <td></td>
        <td>How to use PackageID</td>
    </tr>
    <tr>
        <td>example_repository</td>
        <td><a href="cplusplus/examples.html">C++</a></td>
        <td><a href="ruby/example_repository.html">Ruby</a></td>
        <td></td>
        <td>How to use Repository</td>
    </tr>
    <tr>
        <td>example_selection</td>
        <td><a href="cplusplus/examples.html">C++</a></td>
        <td><a href="ruby/example_selection.html">Ruby</a></td>
        <td></td>
        <td>How to use the standard Selection, Generator and Filter classes</td>
    </tr>
    <tr>
        <td>example_stringify_formatter</td>
        <td><a href="cplusplus/examples.html">C++</a></td>
        <td></td>
        <td></td>
        <td>How to use StringifyFormatter</td>
    </tr>
    <tr>
        <td>example_version_operator</td>
        <td><a href="cplusplus/examples.html">C++</a></td>
        <td><a href="ruby/example_version_operator.html">Ruby</a></td>
        <td></td>
        <td>How to use VersionOperator</td>
    </tr>
    <tr>
        <td>example_version_spec</td>
        <td><a href="cplusplus/examples.html">C++</a></td>
        <td><a href="ruby/example_version_spec.html">Ruby</a></td>
        <td><a href="python/example_version_spec.html">Python</a></td>
        <td>How to use VersionSpec</td>
    </tr>
</table>