Remove trailing whitespace (#3668)

This commit is contained in:
John Vandenberg
2022-07-07 17:18:20 +08:00
committed by GitHub
parent 0af9524e16
commit 0e6e16645c
1330 changed files with 23570 additions and 23571 deletions

View File

@@ -33,8 +33,8 @@ public:
TweetApp()
{
}
protected:
protected:
void defineOptions(OptionSet& options)
{
Application::defineOptions(options);
@@ -51,14 +51,14 @@ protected:
.repeatable(false)
.argument("message")
.callback(OptionCallback<TweetApp>(this, &TweetApp::handleMessage)));
options.addOption(
Option("ckey", "c", "Specify the Twitter consumer key.")
.required(true)
.repeatable(false)
.argument("consumer key")
.callback(OptionCallback<TweetApp>(this, &TweetApp::handleConsumerKey)));
options.addOption(
Option("csecret", "s", "Specify the Twitter consumer secret.")
.required(true)
@@ -80,18 +80,18 @@ protected:
.argument("access token secret")
.callback(OptionCallback<TweetApp>(this, &TweetApp::handleAccessTokenSecret)));
}
void handleHelp(const std::string& name, const std::string& value)
{
displayHelp();
stopOptionsProcessing();
}
void handleConsumerKey(const std::string& name, const std::string& value)
{
_consumerKey = value;
}
void handleConsumerSecret(const std::string& name, const std::string& value)
{
_consumerSecret = value;
@@ -106,12 +106,12 @@ protected:
{
_accessTokenSecret = value;
}
void handleMessage(const std::string& name, const std::string& value)
{
_message = value;
}
void displayHelp()
{
HelpFormatter helpFormatter(options());
@@ -120,7 +120,7 @@ protected:
helpFormatter.setHeader("A simple Twitter command line client for posting status updates.");
helpFormatter.format(std::cout);
}
int main(const std::vector<std::string>& args)
{
try

View File

@@ -29,13 +29,13 @@ Twitter::Twitter():
{
}
Twitter::Twitter(const std::string& twitterURI):
_uri(twitterURI)
{
}
Twitter::~Twitter()
{
}
@@ -49,7 +49,7 @@ void Twitter::login(const std::string& consumerKey, const std::string& consumerS
_tokenSecret = tokenSecret;
}
Poco::Int64 Twitter::update(const std::string& status)
{
Poco::Net::HTMLForm form;
@@ -64,23 +64,23 @@ Poco::AutoPtr<Poco::Util::AbstractConfiguration> Twitter::invoke(const std::stri
// Create the request URI.
// We use the JSON version of the Twitter API.
Poco::URI uri(_uri + twitterMethod + ".json");
Poco::Net::HTTPSClientSession session(uri.getHost(), uri.getPort());
Poco::Net::HTTPRequest req(httpMethod, uri.getPath(), Poco::Net::HTTPMessage::HTTP_1_1);
// Sign request
Poco::Net::OAuth10Credentials creds(_consumerKey, _consumerSecret, _token, _tokenSecret);
creds.authenticate(req, uri, form);
// Send the request.
form.prepareSubmit(req);
std::ostream& ostr = session.sendRequest(req);
form.write(ostr);
// Receive the response.
Poco::Net::HTTPResponse res;
std::istream& rs = session.receiveResponse(res);
Poco::AutoPtr<Poco::Util::JSONConfiguration> pResult = new Poco::Util::JSONConfiguration(rs);
// If everything went fine, return the JSON document.

View File

@@ -23,23 +23,23 @@
class Twitter
/// A simple implementation of a Twitter API client
/// (see <http://dev.twitter.com> for more information).
///
///
/// Currently, only the update message is supported.
{
public:
Twitter();
/// Creates the Twitter object, using
/// the default Twitter API URI (<http://api.twitter.com/1.1/statuses/>).
Twitter(const std::string& twitterURI);
/// Creates the Twitter object using the given Twitter API URI.
~Twitter();
/// Destroys the Twitter object.
void login(const std::string& consumerKey, const std::string& consumerSecret, const std::string& token, const std::string& tokenSecret);
/// Specifies the OAuth authentication information used in all API calls.
Poco::Int64 update(const std::string& status);
/// Updates the user's status.
///
@@ -53,13 +53,13 @@ public:
/// Returns a Poco::Util::JSONConfiguration with the server's response if the
/// server's HTTP response status code is 200 (OK).
/// Otherwise, throws a Poco::ApplicationException.
static const std::string TWITTER_URI;
private:
Twitter(const Twitter&);
Twitter& operator = (const Twitter&);
std::string _uri;
std::string _consumerKey;
std::string _consumerSecret;