X-Git-Url: http://git.tdb.fi/?p=libs%2Fdatafile.git;a=blobdiff_plain;f=tool%2Fcompiler.h;fp=tool%2Fcompiler.h;h=f77f04bdab2569ded7a82ba9520ac46e861f195d;hp=0000000000000000000000000000000000000000;hb=52e6bd3e02522f68166c70f83d2ef3d7cf0c15ff;hpb=db9c49893c2a9475cb5efa4a53bc481a5f66231f diff --git a/tool/compiler.h b/tool/compiler.h new file mode 100644 index 0000000..f77f04b --- /dev/null +++ b/tool/compiler.h @@ -0,0 +1,70 @@ +/* $Id$ + +This file is part of libmspdatafile +Copyright © 2008 Mikko Rasa, Mikkosoft Productions +Distributed under the LGPL +*/ + +#ifndef TOOL_COMPILER_H_ +#define TOOL_COMPILER_H_ + +#include +#include +#include +#include + +class Compiler: public Msp::DataFile::Loader +{ + friend class File; + friend class ForEach; + +private: + Msp::DataFile::Writer &writer; + +public: + Compiler(Msp::DataFile::Writer &); +private: + void file(const std::string &); + void for_each(const std::vector &); + void write(const Msp::DataFile::Statement &); + + bool process_statement(const Msp::FS::Path &, Msp::DataFile::Statement &); + void process_file(const Msp::FS::Path &, const std::list &); + void process_file(const Msp::FS::Path &); +}; + +class File: public Msp::DataFile::Loader +{ +private: + Compiler &compiler; + Msp::FS::Path filename; + std::list write_st; + +public: + File(Compiler &, const Msp::FS::Path &); +private: + virtual void finish(); + + void write(const Msp::DataFile::Statement &); +}; + +class ForEach: public Msp::DataFile::Loader +{ +private: + Compiler &compiler; + Msp::FS::Path base; + std::list patterns; + std::list excludes; + std::list write_st; + +public: + ForEach(Compiler &, const Msp::FS::Path &, const std::list &); +private: + virtual void finish(); + + void exclude(const std::string &); + void pattern(const std::string &); + void write(const Msp::DataFile::Statement &); +}; + +#endif