~ubuntu-branches/ubuntu/hoary/kdemultimedia/hoary

« back to all changes in this revision

Viewing changes to mpeglib/example/yaf/yafcore/inputInterface.h

  • Committer: Bazaar Package Importer
  • Author(s): Martin Schulze
  • Date: 2003-01-22 15:00:51 UTC
  • Revision ID: james.westby@ubuntu.com-20030122150051-uihwkdoxf15mi1tn
Tags: upstream-2.2.2
ImportĀ upstreamĀ versionĀ 2.2.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
  This class can wait for an input by the user
 
3
  Copyright (C) 1998  Martin Vogt
 
4
 
 
5
  This program is free software; you can redistribute it and/or modify
 
6
  it under the terms of the GNU Library General Public License as published by
 
7
  the Free Software Foundation.
 
8
 
 
9
  For more information look at the file COPYRIGHT in this package
 
10
 
 
11
 */
 
12
 
 
13
 
 
14
 
 
15
#ifndef __INPUTINTERFACE_H
 
16
#define __INPUTINTERFACE_H
 
17
 
 
18
 
 
19
#include "buffer.h"
 
20
#include <fstream.h>
 
21
 
 
22
extern "C" {
 
23
#include <unistd.h>
 
24
#include <fcntl.h>
 
25
#include <sys/time.h>
 
26
#include <errno.h>
 
27
#include <sys/stat.h>
 
28
#include <stdio.h>
 
29
}
 
30
 
 
31
// uncomment this for debugging the input stream
 
32
// (written to file instream.dbg)
 
33
//#define _DEBUG_INPUT
 
34
 
 
35
#define _TIMEOUT_MS   2000
 
36
 
 
37
class MultiReader;
 
38
 
 
39
class InputInterface {
 
40
 
 
41
  int currentCommandNumber;
 
42
 
 
43
  int protocolSyntax;
 
44
  Buffer* currentLine;
 
45
  Buffer* rawLine;
 
46
  MultiReader* multiReader;
 
47
  Buffer* loopback;
 
48
  Buffer* yafScript;
 
49
  ifstream* yafInput;
 
50
 
 
51
 
 
52
 public:
 
53
 
 
54
  InputInterface();
 
55
  ~InputInterface();
 
56
 
 
57
  int addFileDescriptor(int fd);
 
58
  void removeFileDescriptor(int fd);
 
59
  int write(int fd,const char* txt);
 
60
 
 
61
  /**
 
62
     waits until a complete Line is entered 
 
63
  */
 
64
  void waitForLine();
 
65
 
 
66
  /**
 
67
    returns true if a complete new InputLine is avaiable
 
68
  */
 
69
 
 
70
  int hasLine();
 
71
 
 
72
  int getCurrentCommandNumber();
 
73
 
 
74
  void increaseCurrentCommandNumber();
 
75
 
 
76
  /**
 
77
     clears the input Line
 
78
  */
 
79
  void clearLine();
 
80
  
 
81
 
 
82
  /**
 
83
     returns the new Line
 
84
  */
 
85
  char* getLine();
 
86
 
 
87
 
 
88
  void setProtocolSyntax(int proto);
 
89
  void addInputLine(struct Buffer* buffer);
 
90
 
 
91
 private:
 
92
  void makeValidLine(char* line);
 
93
  void insertYafScript(ifstream* stream);
 
94
 
 
95
  
 
96
};
 
97
 
 
98
#endif
 
99
 
 
100
 
 
101