summaryrefslogtreecommitdiff
path: root/common/parser.hh
diff options
context:
space:
mode:
Diffstat (limited to 'common/parser.hh')
-rw-r--r--common/parser.hh47
1 files changed, 47 insertions, 0 deletions
diff --git a/common/parser.hh b/common/parser.hh
new file mode 100644
index 0000000..30cf02d
--- /dev/null
+++ b/common/parser.hh
@@ -0,0 +1,47 @@
+#ifndef __COMMON_PARSER_HH__
+#define __COMMON_PARSER_HH__
+
+#include "lines.hh"
+
+namespace rtfl {
+
+namespace tools {
+
+struct CommonLineInfo
+{
+ char *fileName;
+ int lineNo;
+ int processId;
+ char *completeLine;
+};
+
+class Parser: public LinesSink
+{
+private:
+ char **splitEscaped (char *txt);
+ void scanSplit (char *txt, int *numParts, char **parts);
+ static void unquote (char *txt);
+ void freeSplitEscaped (char **parts);
+
+protected:
+ char **split (char *txt, int maxNum);
+ void freeSplit (char **parts);
+
+ virtual void processCommand (CommonLineInfo *info, char *cmd, char *args)
+ = 0;
+ virtual void processVCommand (CommonLineInfo *info, const char *module,
+ int majorVersion, int minorVersion,
+ const char *cmd, char **args) = 0;
+
+public:
+ void setLinesSource (LinesSource *source);
+ void processLine (char *line);
+ void finish ();
+ void timeout (int type);
+};
+
+} // namespace common
+
+} // namespace rtfl
+
+#endif // __COMMON_PARSER_HH__