mirror of
https://github.com/LibreOffice/online.git
synced 2025-08-10 01:34:37 +00:00
Tool: make members private
Some of the members were not used externally at all, others were just read-only externally. Change-Id: I8fbe5c9c027e7d0adf516b311aafb6b66134776e
This commit is contained in:
@ -45,6 +45,11 @@ class Tool: public Poco::Util::Application
|
|||||||
public:
|
public:
|
||||||
Tool();
|
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;
|
unsigned _numWorkers;
|
||||||
std::string _serverURI;
|
std::string _serverURI;
|
||||||
std::string _destinationFormat;
|
std::string _destinationFormat;
|
||||||
@ -71,9 +76,9 @@ using Poco::Util::OptionSet;
|
|||||||
/// Thread class which performs the conversion.
|
/// Thread class which performs the conversion.
|
||||||
class Worker: public Runnable
|
class Worker: public Runnable
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
Tool& _app;
|
Tool& _app;
|
||||||
std::vector< std::string > _files;
|
std::vector< std::string > _files;
|
||||||
|
public:
|
||||||
Worker(Tool& app, const std::vector< std::string > & files) :
|
Worker(Tool& app, const std::vector< std::string > & files) :
|
||||||
_app(app), _files(files)
|
_app(app), _files(files)
|
||||||
{
|
{
|
||||||
@ -87,10 +92,10 @@ public:
|
|||||||
|
|
||||||
void convertFile(const std::string& document)
|
void convertFile(const std::string& document)
|
||||||
{
|
{
|
||||||
Poco::URI uri(_app._serverURI);
|
Poco::URI uri(_app.getServerURI());
|
||||||
|
|
||||||
Poco::Net::HTTPClientSession *session;
|
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());
|
session = new Poco::Net::HTTPSClientSession(uri.getHost(), uri.getPort());
|
||||||
else
|
else
|
||||||
session = new Poco::Net::HTTPClientSession(uri.getHost(), uri.getPort());
|
session = new Poco::Net::HTTPClientSession(uri.getHost(), uri.getPort());
|
||||||
@ -100,7 +105,7 @@ public:
|
|||||||
try {
|
try {
|
||||||
Poco::Net::HTMLForm form;
|
Poco::Net::HTMLForm form;
|
||||||
form.setEncoding(Poco::Net::HTMLForm::ENCODING_MULTIPART);
|
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.addPart("data", new Poco::Net::FilePartSource(document));
|
||||||
form.prepareSubmit(request);
|
form.prepareSubmit(request);
|
||||||
|
|
||||||
@ -121,7 +126,7 @@ public:
|
|||||||
std::istream& responseStream = session->receiveResponse(response);
|
std::istream& responseStream = session->receiveResponse(response);
|
||||||
|
|
||||||
Poco::Path path(document);
|
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);
|
std::ofstream fileStream(outPath);
|
||||||
|
|
||||||
Poco::StreamCopier::copyStream(responseStream, fileStream);
|
Poco::StreamCopier::copyStream(responseStream, fileStream);
|
||||||
|
Reference in New Issue
Block a user