GPU-Calc: remove Alloc_Host_Ptr for clmem of NAN vector
[LibreOffice.git] / desktop / inc / liblibreoffice.hxx
blob9cac41b26bac1d33781bf65a9b02a023ec649e27
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/.
8 */
10 #ifndef INCLUDED_DESKTOP_INC_LIBLIBREOFFICE_HXX
11 #define INCLUDED_DESKTOP_INC_LIBLIBREOFFICE_HXX
13 #include <liblibreoffice.h>
16 * The reasons this C++ code is not as pretty as it could be are:
17 * a) provide a pure C API - that's useful for some people
18 * b) allow ABI stability - C++ vtables are not good for that.
19 * c) avoid C++ types as part of the API.
22 class LODocument
24 LibreOfficeDocument *mpDoc;
25 public:
26 inline LODocument( LibreOfficeDocument *pDoc ) : mpDoc( pDoc ) {}
27 inline ~LODocument() { mpDoc->destroy( mpDoc ); }
29 // Save as the given format, if format is NULL sniff from ext'n
30 inline bool saveAs( const char *url, const char *format = NULL )
32 return mpDoc->saveAs( mpDoc, url, format );
36 class LibLibreOffice
38 LibreOffice *mpThis;
39 public:
40 inline LibLibreOffice( LibreOffice *pThis ) : mpThis( pThis ) {}
41 inline ~LibLibreOffice() { mpThis->destroy( mpThis ); };
43 inline bool initialize( const char *installPath )
45 return mpThis->initialize( mpThis, installPath );
48 inline LODocument *documentLoad( const char *url )
50 LibreOfficeDocument *pDoc = mpThis->documentLoad( mpThis, url );
51 if( !pDoc )
52 return NULL;
53 return new LODocument( pDoc );
56 // return the last error as a string, free me.
57 inline char *getError() { return mpThis->getError( mpThis ); }
60 inline LibLibreOffice *lo_cpp_init( const char *install_path )
62 LibreOffice *pThis = lo_init( install_path );
63 if( !pThis || pThis->nSize == 0 )
64 return NULL;
65 return new LibLibreOffice( pThis );
68 #endif
69 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */