15.04.2014 - Version 0.3.8_beta, last version of 0.3.8 branch. Too much added and fixed...
This commit is contained in:
80
picode.h
Normal file
80
picode.h
Normal file
@@ -0,0 +1,80 @@
|
||||
/*! \file pipacketextractor.h
|
||||
* \brief Packets extractor
|
||||
*/
|
||||
/*
|
||||
PIP - Platform Independent Primitives
|
||||
Packets extractor
|
||||
Copyright (C) 2013 Ivan Pelipenko peri4ko@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef CODE_H
|
||||
#define CODE_H
|
||||
|
||||
#include "pifile.h"
|
||||
|
||||
inline bool _isCChar(const PIChar & c) {return (c.isAlpha() || (c == '_'));}
|
||||
inline bool _isCChar(const PIString & c) {if (c.isEmpty()) return false; return _isCChar(c[0]);}
|
||||
|
||||
class CodeParser {
|
||||
public:
|
||||
CodeParser();
|
||||
|
||||
bool parseFile(const PIString & file);
|
||||
|
||||
private:
|
||||
void clear();
|
||||
bool parseFileContent(PIString & fc);
|
||||
bool parseDirective(PIString d);
|
||||
|
||||
enum Visibility {Global, Public, Protected, Private};
|
||||
typedef PIPair<PIString, PIString> Define;
|
||||
typedef PIPair<PIString, PIString> Typedef;
|
||||
struct Macro {
|
||||
Macro(const PIString & n = PIString(), const PIString & v = PIString(), const PIStringList & a = PIStringList()) {
|
||||
name = n;
|
||||
value = v;
|
||||
args = a;
|
||||
}
|
||||
PIString expand(const PIStringList & arg_vals, bool * ok = 0) const;
|
||||
PIString name;
|
||||
PIString value;
|
||||
PIStringList args;
|
||||
};
|
||||
struct Entity {
|
||||
Entity() {
|
||||
visibility = Global;
|
||||
size = 0;
|
||||
parent = 0;
|
||||
}
|
||||
PIString type;
|
||||
PIString name;
|
||||
PIString file;
|
||||
Visibility visibility;
|
||||
int size;
|
||||
Entity * parent;
|
||||
PIVector<Entity * > children;
|
||||
};
|
||||
|
||||
PIVector<Define> defines;
|
||||
PIVector<Macro> macros;
|
||||
PIVector<Typedef> typedefs;
|
||||
PIVector<Entity> entities;
|
||||
PIVector<Entity * > tree;
|
||||
|
||||
};
|
||||
|
||||
#endif // PIPACKETEXTRACTOR_H
|
||||
Reference in New Issue
Block a user