[Libreoffice-commits] online.git: tools/Tool.cpp

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Jan 3 08:05:55 UTC 2019


 tools/Tool.cpp |   15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

New commits:
commit f204ff23330d8032b0f3d8b849299c061ebc70b2
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Thu Jan 3 09:05:18 2019 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Thu Jan 3 09:05:36 2019 +0100

    Tool: make members private
    
    Some of the members were not used externally at all, others were just
    read-only externally.
    
    Change-Id: I8fbe5c9c027e7d0adf516b311aafb6b66134776e

diff --git a/tools/Tool.cpp b/tools/Tool.cpp
index a36ead2e2..8957f6acc 100644
--- a/tools/Tool.cpp
+++ b/tools/Tool.cpp
@@ -45,6 +45,11 @@ class Tool: public Poco::Util::Application
 public:
     Tool();
 
+    const std::string& getServerURI() const { return _serverURI; }
+    const std::string& getDestinationFormat() const { return _destinationFormat; }
+    const std::string& getDestinationDir() const { return _destinationDir; }
+
+private:
     unsigned    _numWorkers;
     std::string _serverURI;
     std::string _destinationFormat;
@@ -71,9 +76,9 @@ using Poco::Util::OptionSet;
 /// Thread class which performs the conversion.
 class Worker: public Runnable
 {
-public:
     Tool& _app;
     std::vector< std::string > _files;
+public:
     Worker(Tool& app, const std::vector< std::string > & files) :
         _app(app), _files(files)
     {
@@ -87,10 +92,10 @@ public:
 
     void convertFile(const std::string& document)
     {
-        Poco::URI uri(_app._serverURI);
+        Poco::URI uri(_app.getServerURI());
 
         Poco::Net::HTTPClientSession *session;
-        if (_app._serverURI.compare(0, 5, "https") == 0)
+        if (_app.getServerURI().compare(0, 5, "https") == 0)
             session = new Poco::Net::HTTPSClientSession(uri.getHost(), uri.getPort());
         else
             session = new Poco::Net::HTTPClientSession(uri.getHost(), uri.getPort());
@@ -100,7 +105,7 @@ public:
         try {
             Poco::Net::HTMLForm form;
             form.setEncoding(Poco::Net::HTMLForm::ENCODING_MULTIPART);
-            form.set("format", _app._destinationFormat);
+            form.set("format", _app.getDestinationFormat());
             form.addPart("data", new Poco::Net::FilePartSource(document));
             form.prepareSubmit(request);
 
@@ -121,7 +126,7 @@ public:
             std::istream& responseStream = session->receiveResponse(response);
 
             Poco::Path path(document);
-            std::string outPath = _app._destinationDir + "/" + path.getBaseName() + "." + _app._destinationFormat;
+            std::string outPath = _app.getDestinationDir() + "/" + path.getBaseName() + "." + _app.getDestinationFormat();
             std::ofstream fileStream(outPath);
 
             Poco::StreamCopier::copyStream(responseStream, fileStream);


More information about the Libreoffice-commits mailing list