diff options
-rw-r--r-- | include/LibreOfficeKit/LibreOfficeKit.hxx | 24 | ||||
-rw-r--r-- | smoketest/libtest.cxx | 6 |
2 files changed, 18 insertions, 12 deletions
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx index de8224c4e0b6..c3da4973a83b 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.hxx +++ b/include/LibreOfficeKit/LibreOfficeKit.hxx @@ -18,18 +18,20 @@ * b) allow ABI stability - C++ vtables are not good for that. * c) avoid C++ types as part of the API. */ +namespace lok +{ -class LODocument +class Document { private: LibreOfficeKitDocument* mpDoc; public: - inline LODocument(LibreOfficeKitDocument* pDoc) : + inline Document(LibreOfficeKitDocument* pDoc) : mpDoc(pDoc) {} - inline ~LODocument() + inline ~Document() { mpDoc->destroy(mpDoc); } @@ -50,17 +52,17 @@ public: } }; -class LibLibreOffice +class Office { private: LibreOfficeKit* mpThis; public: - inline LibLibreOffice(LibreOfficeKit* pThis) : + inline Office(LibreOfficeKit* pThis) : mpThis(pThis) {} - inline ~LibLibreOffice() + inline ~Office() { mpThis->destroy(mpThis); } @@ -70,12 +72,12 @@ public: return mpThis->initialize(mpThis, pInstallPath); } - inline LODocument* documentLoad(const char* pUrl) + inline Document* documentLoad(const char* pUrl) { LibreOfficeKitDocument* pDoc = mpThis->documentLoad(mpThis, pUrl); if (pDoc == NULL) return NULL; - return new LODocument(pDoc); + return new Document(pDoc); } // return the last error as a string, free me. @@ -85,12 +87,14 @@ public: } }; -inline LibLibreOffice* lo_cpp_init(const char* pInstallPath) +} + +inline ::lok::Office* lo_cpp_init(const char* pInstallPath) { LibreOfficeKit* pThis = lok_init(pInstallPath); if (pThis == NULL || pThis->nSize == 0) return NULL; - return new LibLibreOffice(pThis); + return new ::lok::Office(pThis); } #endif diff --git a/smoketest/libtest.cxx b/smoketest/libtest.cxx index ca1f89cc25b0..c6211a9ca6e6 100644 --- a/smoketest/libtest.cxx +++ b/smoketest/libtest.cxx @@ -15,6 +15,8 @@ #include <sys/time.h> #include <LibreOfficeKit/LibreOfficeKit.hxx> +using namespace ::lok; + long getTimeMS() { struct timeval t; @@ -44,7 +46,7 @@ int main (int argc, char **argv) return 1; } - LibLibreOffice *pOffice = lo_cpp_init( argv[1] ); + Office *pOffice = lo_cpp_init( argv[1] ); if( !pOffice ) { fprintf( stderr, "Failed to initialize\n" ); @@ -63,7 +65,7 @@ int main (int argc, char **argv) start = end; fprintf( stderr, "start to load document '%s'\n", argv[2] ); - LODocument *pDocument = pOffice->documentLoad( argv[2] ); + Document *pDocument = pOffice->documentLoad( argv[2] ); if( !pDocument ) { char *pError = pOffice->getError(); |