Boost logo

Boost :

Subject: Re: [boost] Getting started with Boost( GSOC)
From: Antony Polukhin (antoshkka_at_[hidden])
Date: 2014-03-05 02:28:03


2014-03-05 8:59 GMT+04:00 M. Lalit <lalit.hilmarsh_at_[hidden]>:

> I've attached the main.cpp file here. It loads test.odt using LIbreOffice
> SDK.It was a good learning experience for me as initially I had lot of
> problems in installing and using LibreOffice SDK.Thanks a lot :) .
>

You've found a LibreOffice SDK example. You are able to make it work and
google for solutions - that's not bad.

Now it's time to check your C++ knowledge:
Let's make that main.cpp vendor independent and hide all the LibreOffice
stuff:
* make class boost::document::engine and hide in it all the connection
establishment and helper stuff in it
* make class boost::document::document and hide XComponent stuff in it.
* report errors using exceptions (do not use prinf + exit), provide your
own exceptions hierarchy:
std::exception -> boost::document::exception ->
(boost::document::connection_error, other_exceptions)

Make sure that all the LibreOffice stuff is hidden (boost::document::engine
and boost::document::document must have no LibreOffice classes in it). All
the LibreOffice includes and classes must be in a separate
implementation.cpp file.

I'd love to see something like this in main.cpp:

namespace boost { namespace document {

class document {
    <...> pimpl_;
    document(); // private;
public:
    ~document();
      // ...
};

class engine {
 <...> pimpl_;
public:
   engine();
   connect(const std::string& params);
   document load_document();
   document create_document(const std::string& doc_name);
   ~engine();
   // ...
};

}}

int main() {
   boost::document::engine e;

e.connect("uno:socket,host=localhost,port=2083;urp;StarOffice.ServiceManager");
   boost::document::document d = e.create_document("hello_word.odt");
}

-- 
Best regards,
Antony Polukhin

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk