http://mbed.org/users/shintamainjp/notebook/starboard_expbrd-one_ex1_en/

Dependencies:   mbed RemoteIR SuperTweet ConfigFile EthernetNetIf

Revision:
0:db299c5a18ba
Child:
1:c4cfd136f9c7
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mylib/StreamFilter/StreamFilter.h	Fri Oct 29 23:17:01 2010 +0000
@@ -0,0 +1,57 @@
+
+#include "mbed.h"
+
+/**
+ * Stream filter.
+ */
+class StreamFilter {
+public:
+
+    /**
+     * Create.
+     *
+     * @param headtxt Head of a target.
+     * @param tailtxt Tail of a target.
+     */
+    StreamFilter(const char *headtxt, const char *tailtxt);
+
+    /**
+     * Dispose.
+     */
+    ~StreamFilter();
+
+    /**
+     * Check state of done.
+     *
+     * @return Return true if it done.
+     */
+    bool done();
+
+    /**
+     * Reset state.
+     */
+    void reset();
+
+    /**
+     * Push a data to a internal buffer.
+     *
+     * @param c character.
+     */
+    void push(char c);
+
+    /**
+     * Get a content text.
+     *
+     * @param buf A pointer to a buffer.
+     * @param bufsiz Size of the buffer.
+     *
+     * @return true if it succeed.
+     */
+    bool getContent(char *buf, size_t bufsiz);
+private:
+    int headcnt;
+    int tailcnt;
+    const char * head;
+    const char * tail;
+    char content[1024];
+};