Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5068 in orxonox.OLD for orxonox/trunk/src/util/shell.h


Ignore:
Timestamp:
Aug 18, 2005, 3:51:43 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: added Shell Class to the utils.
This class should enable us to print all the output from orxonox directly onto the screen.
Also it should allow inputting some little Commands, so that we have more force over our little project :)

Also added a new Function to tList, removeLast, that is very quick in deleting the last element, as this is used inside of the Shell (deleting the Last Element is a major issue)

File:
1 copied

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/util/shell.h

    r5065 r5068  
    11/*!
    2  * @file proto_class.h
    3  * @brief Definition of ...
     2 * @file shell.h
     3 * Definition of a on-screen-shell
    44*/
    55
    6 #ifndef _PROTO_CLASS_H
    7 #define _PROTO_CLASS_H
     6#ifndef _SHELL_H
     7#define _SHELL_H
    88
    9 #include "base_object.h"
     9#include "element_2d.h"
     10
     11#include <stdio.h>
     12#include <stdarg.h>
     13
    1014
    1115// FORWARD DECLARATION
     16class Text;
     17template<class T> class tList;
     18
     19//! A class that is able to redirect all output to a openGL-Shell, and that one can use to input some commands
     20/**
     21 * the major idea is, that all the Output can be redirected to the Shell,
     22 * and does not have to be displayed to the opening Shell, this is good,
     23 * for developers using Windows, where all output is otherwise redirected
     24 * to stdout.txt
     25 *
     26 * Furthermore the Shell should enable us, to input some simple commands
     27 * Each Class can tell check itself in to the Shell, and listen for commands.
     28 *
     29 * @todo implement what is written above :/
     30 */
     31class Shell : public Element2D {
     32
     33  public:
     34    virtual ~Shell();
     35    /** @returns a Pointer to the only object of this Class */
     36    inline static Shell* getInstance(void) { if (!Shell::singletonRef) Shell::singletonRef = new Shell();  return Shell::singletonRef; };
    1237
    1338
     39    void setBufferSize(unsigned int bufferSize) { this->bufferSize = bufferSize; };
    1440
    15 //! A class for ...
    16 class ProtoClass : public BaseObject {
     41    void setBufferDisplaySize(unsigned int bufferDisplaySize);
    1742
    18  public:
    19   ProtoClass();
    20   virtual ~ProtoClass();
     43    // BUFFER //
     44    void flushBuffers();
     45    void addBufferLine(const char* Line, va_list args);
     46    void moveBuffer(int lineCount);
     47    const char* getBufferLine(unsigned int lineNumber);
     48
     49  // inputLine
     50    void flushInputLine();
     51    void addCharacter(char character);
     52    void addCharacters(const char* characters);
     53    void removeCharacters(unsigned int characterCount = 1);
    2154
    2255
    23  private:
     56    // Element2D-functions
     57    void tick(float dt);
     58    virtual void draw() const;
    2459
     60    void debug() const;
     61
     62  private:
     63    bool autoComplete();
     64
     65
     66  private:
     67    Shell();
     68    static Shell*          singletonRef;
     69
     70    unsigned int           bufferSize;
     71    unsigned int           bufferDisplaySize;
     72
     73    char*                  inputLine;
     74
     75    tList<const char>*     buffer;
     76
     77    tList<Text>*           bufferText;             //!< A list of sored bufferLines of the Shell
     78    Text*                  inputLineText;          //!< The inputLine of the Shell
    2579};
    2680
    27 #endif /* _PROTO_CLASS_H */
     81#endif /* _SHELL_H */
Note: See TracChangeset for help on using the changeset viewer.