File indexing completed on 2024-05-05 03:54:29

0001 /* vi: ts=8 sts=4 sw=4
0002 
0003     This file is part of the KDE project, module kdesu.
0004     SPDX-FileCopyrightText: 1999, 2000 Geert Jansen <jansen@kde.org>
0005 */
0006 
0007 #ifndef __Lexer_h_included__
0008 #define __Lexer_h_included__
0009 
0010 #include <QByteArray>
0011 
0012 /**
0013  * This is a lexer for the kdesud protocol.
0014  */
0015 
0016 class Lexer
0017 {
0018 public:
0019     Lexer(const QByteArray &input);
0020     ~Lexer();
0021 
0022     Lexer(const Lexer &) = delete;
0023     Lexer &operator=(const Lexer &) = delete;
0024 
0025     /** Read next token. */
0026     int lex();
0027 
0028     /** Return the token's value. */
0029     QByteArray &lval();
0030 
0031     enum Tokens {
0032         Tok_none,
0033         Tok_exec = 256,
0034         Tok_pass,
0035         Tok_delCmd,
0036         Tok_ping,
0037         Tok_str,
0038         Tok_num,
0039         Tok_stop,
0040         Tok_set,
0041         Tok_get,
0042         Tok_delVar,
0043         Tok_delGroup,
0044         Tok_host,
0045         Tok_prio,
0046         Tok_sched,
0047         Tok_getKeys,
0048         Tok_chkGroup,
0049         Tok_delSpecialKey,
0050         Tok_exit,
0051     };
0052 
0053 private:
0054     QByteArray m_Input;
0055     QByteArray m_Output;
0056 
0057     int in;
0058 };
0059 
0060 #endif