formatting

main
mandlm 2018-05-09 08:56:43 +02:00
parent a0ac1a7975
commit b7c3c4c042
4 changed files with 100 additions and 98 deletions

View File

@ -16,7 +16,8 @@ class DokuWiki
};
public:
DokuWiki(const std::string &url, const std::string &username, const std::string &password);
DokuWiki(const std::string &url, const std::string &username,
const std::string &password);
~DokuWiki();
std::string getVersion();
@ -35,4 +36,3 @@ class DokuWiki
class impl;
std::unique_ptr<impl> pimpl;
};

View File

@ -5,7 +5,8 @@
#include <iostream>
DokuWiki::DokuWiki(const std::string &url, const std::string &username, const std::string &password)
DokuWiki::DokuWiki(const std::string &url, const std::string &username,
const std::string &password)
: pimpl{std::make_unique<impl>(url, username, password)}
{
}
@ -52,7 +53,8 @@ void DokuWiki::addPage(const std::string &pageName, const std::string &content)
pimpl->addPage(pageName, content);
}
void DokuWiki::appendToPage(const std::string &pageName, const std::string &content)
void DokuWiki::appendToPage(
const std::string &pageName, const std::string &content)
{
pimpl->appendToPage(pageName, content);
}

View File

@ -30,14 +30,14 @@ xmlrpc_c::value DokuWiki::impl::executeCommand(const std::string &command,
}
template <>
xmlrpc_c::value_struct DokuWiki::impl::executeCommand(const std::string &command,
const std::list<std::string> &params,
xmlrpc_c::value_struct DokuWiki::impl::executeCommand(
const std::string &command, const std::list<std::string> &params,
const std::map<std::string, xmlrpc_c::value> &attributes)
{
try
{
return xmlrpc_c::value_struct(executeCommand<xmlrpc_c::value>(
command, params, attributes));
return xmlrpc_c::value_struct(
executeCommand<xmlrpc_c::value>(command, params, attributes));
}
catch (girerr::error &e)
{
@ -52,8 +52,8 @@ std::string DokuWiki::impl::executeCommand(const std::string &command,
{
try
{
return xmlrpc_c::value_string(executeCommand<xmlrpc_c::value>(
command, params, attributes));
return xmlrpc_c::value_string(
executeCommand<xmlrpc_c::value>(command, params, attributes));
}
catch (girerr::error &e)
{
@ -68,8 +68,8 @@ int DokuWiki::impl::executeCommand(const std::string &command,
{
try
{
return xmlrpc_c::value_int(executeCommand<xmlrpc_c::value>(
command, params, attributes));
return xmlrpc_c::value_int(
executeCommand<xmlrpc_c::value>(command, params, attributes));
}
catch (girerr::error &e)
{
@ -84,8 +84,8 @@ bool DokuWiki::impl::executeCommand(const std::string &command,
{
try
{
return xmlrpc_c::value_boolean(executeCommand<xmlrpc_c::value>(
command, params, attributes));
return xmlrpc_c::value_boolean(
executeCommand<xmlrpc_c::value>(command, params, attributes));
}
catch (girerr::error &e)
{
@ -100,7 +100,8 @@ DokuWiki::impl::impl(const std::string &url, const std::string &username,
login(username, password);
}
void DokuWiki::impl::login(const std::string &username, const std::string &password)
void DokuWiki::impl::login(
const std::string &username, const std::string &password)
{
if (executeCommand<bool>("dokuwiki.login", {username, password}) == false)
{
@ -137,12 +138,9 @@ DokuWiki::PageInfo DokuWiki::impl::getPageInfo(const std::string &pageName)
std::time_t modificationTime = xmlrpc_c::value_int(values["version"]);
DokuWiki::PageInfo pageInfo =
{
xmlrpc_c::value_string(values["name"]),
DokuWiki::PageInfo pageInfo = {xmlrpc_c::value_string(values["name"]),
xmlrpc_c::value_string(values["author"]),
std::asctime(std::localtime(&modificationTime))
};
std::asctime(std::localtime(&modificationTime))};
return pageInfo;
}
@ -160,7 +158,8 @@ bool DokuWiki::impl::pageExists(const std::string &pageName)
}
}
void DokuWiki::impl::putPage(const std::string &pageName, const std::string &content)
void DokuWiki::impl::putPage(
const std::string &pageName, const std::string &content)
{
if (!executeCommand<bool>("wiki.putPage", {pageName, content},
{{"sum", xmlrpc_c::value_string("Added automatically")},
@ -170,7 +169,8 @@ void DokuWiki::impl::putPage(const std::string &pageName, const std::string &con
}
}
void DokuWiki::impl::addPage(const std::string &pageName, const std::string &content)
void DokuWiki::impl::addPage(
const std::string &pageName, const std::string &content)
{
if (pageExists(pageName))
{
@ -180,7 +180,8 @@ void DokuWiki::impl::addPage(const std::string &pageName, const std::string &con
putPage(pageName, content);
}
void DokuWiki::impl::appendToPage(const std::string &pageName, const std::string &content)
void DokuWiki::impl::appendToPage(
const std::string &pageName, const std::string &content)
{
if (!executeCommand<bool>("dokuwiki.appendPage", {pageName, content},
{{"sum", xmlrpc_c::value_string("Added automatically")},
@ -189,4 +190,3 @@ void DokuWiki::impl::appendToPage(const std::string &pageName, const std::string
throw std::runtime_error("failed to append to page");
}
}

View File

@ -14,7 +14,8 @@ class DokuWiki::impl
xmlrpc_c::clientXmlTransport_curl m_clientTransport;
public:
impl(const std::string &url, const std::string &username, const std::string &password);
impl(const std::string &url, const std::string &username,
const std::string &password);
void login(const std::string &username, const std::string &password);
std::string getVersion();
@ -35,4 +36,3 @@ class DokuWiki::impl
const std::list<std::string> &params = {},
const std::map<std::string, xmlrpc_c::value> &attributes = {});
};