SuperTweet interface driver classes.

Dependents:   SuperTweet_TestProgram StarBoardOrangeExpansion1 GSL_04-Network_Twitter

Files at this revision

API Documentation at this revision

Comitter:
shintamainjp
Date:
Fri Oct 29 23:04:12 2010 +0000
Parent:
1:2d211e591fc8
Commit message:
Modified default value of a callback function to NULL.

Changed in this revision

SuperTweet.h Show annotated file Show diff for this revision Revisions of this file
SuperTweetV1XML.cpp Show annotated file Show diff for this revision Revisions of this file
SuperTweetV1XML.h Show annotated file Show diff for this revision Revisions of this file
--- a/SuperTweet.h	Thu Oct 28 12:02:05 2010 +0000
+++ b/SuperTweet.h	Fri Oct 29 23:04:12 2010 +0000
@@ -40,7 +40,7 @@
      * @param func A pointer to a callback function.
      * @return Result code.
      */
-    virtual HTTPResult getStatusesUserTimeline(void (*func)(char *buf, size_t siz)) = 0;
+    virtual HTTPResult getStatusesUserTimeline(void (*func)(char *buf, size_t siz) = NULL) = 0;
 
     /**
      * Returns the 20 most recent statuses, including retweets if they exist, posted by the authenticating user and the user's they follow.
@@ -48,7 +48,7 @@
      * @param func A pointer to a callback function.
      * @return Result code.
      */
-    virtual HTTPResult getStatusesHomeTimeline(void (*func)(char *buf, size_t siz)) = 0;
+    virtual HTTPResult getStatusesHomeTimeline(void (*func)(char *buf, size_t siz) = NULL) = 0;
 
     /**
      * Updates the authenticating user's status.
@@ -58,7 +58,7 @@
      * @param func A pointer to a callback function.
      * @return Result code.
      */
-    virtual HTTPResult postStatusesUpdate(const std::string datatext, void (*func)(char *buf, size_t siz)) = 0;
+    virtual HTTPResult postStatusesUpdate(const std::string datatext, void (*func)(char *buf, size_t siz) = NULL) = 0;
 
 protected:
     static const std::string URLBASE_V1;
--- a/SuperTweetV1XML.cpp	Thu Oct 28 12:02:05 2010 +0000
+++ b/SuperTweetV1XML.cpp	Fri Oct 29 23:04:12 2010 +0000
@@ -43,7 +43,9 @@
         Net::poll();
         if (stream.readable()) {
             buf[stream.readLen()] = 0;
-            func(buf, stream.readLen());
+            if (func != NULL) {
+                func(buf, stream.readLen());
+            }
             stream.readNext((byte*)buf, sizeof(buf) - 1);
         }
     }
@@ -71,7 +73,9 @@
             Net::poll();
             if (stream.readable()) {
                 buf[stream.readLen()] = 0;
-                func(buf, stream.readLen());
+                if (func != NULL) {
+                    func(buf, stream.readLen());
+                }
                 stream.readNext((byte*)buf, sizeof(buf) - 1);
             }
         }
@@ -102,7 +106,9 @@
         Net::poll();
         if (stream.readable()) {
             buf[stream.readLen()] = 0;
-            func(buf, stream.readLen());
+            if (func != NULL) {
+                func(buf, stream.readLen());
+            }
             stream.readNext((byte*)buf, sizeof(buf) - 1);
         }
     }
--- a/SuperTweetV1XML.h	Thu Oct 28 12:02:05 2010 +0000
+++ b/SuperTweetV1XML.h	Fri Oct 29 23:04:12 2010 +0000
@@ -32,7 +32,7 @@
      * @param func A pointer to a callback function.
      * @return Result code.
      */
-    virtual HTTPResult getStatusesUserTimeline(void (*func)(char *buf, size_t siz));
+    virtual HTTPResult getStatusesUserTimeline(void (*func)(char *buf, size_t siz) = NULL);
 
     /**
      * Returns the 20 most recent statuses, including retweets if they exist, posted by the authenticating user and the user's they follow.
@@ -40,7 +40,7 @@
      * @param func A pointer to a callback function.
      * @return Result code.
      */
-    virtual HTTPResult getStatusesHomeTimeline(void (*func)(char *buf, size_t siz));
+    virtual HTTPResult getStatusesHomeTimeline(void (*func)(char *buf, size_t siz) = NULL);
 
     /**
      * Updates the authenticating user's status.
@@ -50,7 +50,7 @@
      * @param func A pointer to a callback function.
      * @return Result code.
      */
-    virtual HTTPResult postStatusesUpdate(const std::string datatext, void (*func)(char *buf, size_t siz));
+    virtual HTTPResult postStatusesUpdate(const std::string datatext, void (*func)(char *buf, size_t siz) = NULL);
 private:
     HTTPResult result;
     bool completed;