Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / connectivity / source / drivers / evoab2 / EApi.h
blob9a2138eb2a266450c0c13881c7bf86155e2901cb
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #pragma once
21 #include <glib-object.h>
23 // Initializes the API below, returns false if not available
24 bool EApiInit();
26 G_BEGIN_DECLS
28 // This header defined all the API methods as
29 // function pointers instead of real functions
30 // this will all evaporate as it is compiled generating
31 // no symbol lookups or relocations, but giving code
32 // clarity.
34 // We attempt to define a minimum API that we use:
36 // e-contact.h
37 #ifdef DECLARE_FN_POINTERS
38 #define EAPI_EXTERN
39 #else
40 #define EAPI_EXTERN extern
41 #endif
44 typedef void EContact;
45 #define E_CONTACT(a) ((EContact *)(a))
46 #define E_TYPE_CONTACT (e_contact_get_type())
47 typedef int EContactField;
49 EAPI_EXTERN const char *(*e_contact_field_name) ( EContactField field_id);
50 EAPI_EXTERN gpointer (*e_contact_get) (EContact *contact, EContactField field_id);
51 EAPI_EXTERN gconstpointer (*e_contact_get_const) (EContact *contact, EContactField field_id);
52 // e-source.h
53 typedef void ESource;
54 #define E_SOURCE(a) ((ESource *)(a))
55 EAPI_EXTERN const char *(*e_source_peek_name) (ESource *source);
56 EAPI_EXTERN const gchar *(*e_source_get_property) (ESource *source,
57 const gchar *property);
59 EAPI_EXTERN GType (*e_contact_get_type) (void);
60 EAPI_EXTERN EContactField (*e_contact_field_id) (const char *field_name);
62 // e-source-list.h
63 typedef void ESourceList;
64 EAPI_EXTERN GSList *(*e_source_list_peek_groups) (ESourceList *list);
66 // e-source-group.h
67 typedef void ESourceGroup;
68 #define E_SOURCE_GROUP(a) ((ESourceGroup *)(a))
70 EAPI_EXTERN GSList *(*e_source_group_peek_sources) (ESourceGroup *group);
71 EAPI_EXTERN const char *(*e_source_group_peek_base_uri) (ESourceGroup *group);
72 // e-book.h
73 typedef enum {
74 E_BOOK_QUERY_IS,
75 E_BOOK_QUERY_CONTAINS,
76 E_BOOK_QUERY_BEGINS_WITH,
77 E_BOOK_QUERY_ENDS_WITH,
78 } EBookQueryTest;
80 typedef void EBook;
81 typedef void EBookQuery;
83 EAPI_EXTERN EBook *(*e_book_new) (ESource *source,
84 GError **error);
86 EAPI_EXTERN gboolean (*e_book_open) (EBook *book,
87 gboolean only_if_exists,
88 GError **error);
90 EAPI_EXTERN const char *(*e_book_get_uri) (EBook *book);
91 EAPI_EXTERN ESource *(*e_book_get_source)(EBook *book);
93 EAPI_EXTERN gboolean (*e_book_get_addressbooks) (ESourceList **addressbook_sources,
94 GError **error);
96 EAPI_EXTERN gboolean (*e_book_get_contacts) (EBook *book,
97 EBookQuery *query,
98 GList **contacts,
99 GError **error);
101 EAPI_EXTERN gboolean (*e_book_authenticate_user) (EBook *book,
102 const char *user,
103 const char *passwd,
104 const char *auth_method,
105 GError **error);
107 // e-book-query.h
108 EAPI_EXTERN EBookQuery* (*e_book_query_field_exists) (EContactField field);
109 EAPI_EXTERN EBookQuery* (*e_book_query_field_test) (EContactField field,
110 EBookQueryTest test,
111 const char *value);
112 EAPI_EXTERN EBookQuery* (*e_book_query_and) (int nqs, EBookQuery **qs, gboolean unref);
113 EAPI_EXTERN EBookQuery* (*e_book_query_or) (int nqs, EBookQuery **qs, gboolean unref);
114 EAPI_EXTERN EBookQuery* (*e_book_query_not) (EBookQuery *q, gboolean unref);
115 EAPI_EXTERN EBookQuery* (*e_book_query_ref) (EBookQuery *q);
116 EAPI_EXTERN void (*e_book_query_unref) (EBookQuery *q);
117 EAPI_EXTERN char* (*e_book_query_to_string) (EBookQuery *q);
118 EAPI_EXTERN EBookQuery* (*e_book_query_from_string) (const char *query_string);
120 typedef struct {
121 char *address_format; /* the two letter country code that
122 determines the format/meaning of the
123 following fields */
124 char *po;
125 char *ext;
126 char *street;
127 char *locality;
128 char *region;
129 char *code;
130 char *country;
131 } EContactAddress;
133 #define E_SOURCE_EXTENSION_ADDRESS_BOOK "Address Book"
134 typedef void ESourceRegistry;
135 typedef void GCancellable;
136 typedef void ESourceBackend;
137 typedef void EClient;
138 typedef EClient EBookClient;
139 EAPI_EXTERN ESourceRegistry* (*e_source_registry_new_sync) (GCancellable *cancellable, GError **error);
140 EAPI_EXTERN GList* (*e_source_registry_list_sources) (ESourceRegistry *registry, const gchar *extension_name);
141 EAPI_EXTERN gboolean (*e_source_has_extension) (ESource *source, const gchar *extension_name);
142 EAPI_EXTERN gpointer (*e_source_get_extension) (ESource *source, const gchar *extension_name);
143 EAPI_EXTERN const gchar* (*e_source_backend_get_backend_name) (ESourceBackend *extension);
144 EAPI_EXTERN const gchar* (*e_source_get_display_name) (ESource *source);
145 EAPI_EXTERN const gchar* (*eds_check_version) (guint required_major, guint required_minor, guint required_micro);
146 EAPI_EXTERN const gchar* (*e_source_get_uid) (ESource *source);
147 EAPI_EXTERN ESource* (*e_source_registry_ref_source) (ESourceRegistry *registry, const gchar *uid);
148 EAPI_EXTERN EBookClient* (*e_book_client_new) (ESource *source, GError **error);
149 EAPI_EXTERN EBookClient* (*e_book_client_connect_direct_sync) (ESourceRegistry *registry, ESource *source, guint32 wait_for_connected_seconds, GCancellable *cancellable, GError **error);
150 EAPI_EXTERN gboolean (*e_client_open_sync) (EClient *client, gboolean only_if_exists, GCancellable *cancellable, GError **error);
151 EAPI_EXTERN ESource* (*e_client_get_source) (EClient *client);
152 EAPI_EXTERN gboolean (*e_book_client_get_contacts_sync) (EBookClient *client, const gchar *sexp, GSList **contacts, GCancellable *cancellable, GError **error);
153 EAPI_EXTERN void (*e_client_util_free_object_slist) (GSList *objects);
155 ESourceRegistry *get_e_source_registry();
156 bool isSourceBackend(ESource *pSource, const char *backendname);
158 G_END_DECLS
160 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */