flowcode.h

00001 /***************************************************************************
00002  *   Copyright (C) 2003-2004 by David Saxton                               *
00003  *   david@bluehaze.org                                                    *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  ***************************************************************************/
00010 
00011 #ifndef FLOWCODE_H
00012 #define FLOWCODE_H
00013 
00014 #include "language.h"
00015 
00016 #include <qguardedptr.h>
00017 #include <qobject.h>
00018 #include <qstring.h>
00019 #include <qstringlist.h>
00020 #include <qvaluelist.h>
00021 
00022 class CNItem;
00023 class FlowPart;
00024 class Item;
00025 class MicroSettings;
00026 
00027 typedef QValueList<FlowPart*> FlowPartList;
00028 typedef QValueList<QGuardedPtr<Item> > ItemList;
00029 
00039 class FlowCode : public Language
00040 {
00041 public:
00042         FlowCode( ProcessChain *processChain, KTechlab *parent );
00043 
00044         virtual void processInput( ProcessOptions options );
00045         virtual ProcessOptions::ProcessPath::Path outputPath( ProcessOptions::ProcessPath::Path inputPath ) const;
00046 
00050         void setStartPart( FlowPart *startPart );
00051         ~FlowCode();
00055         void addSubroutine( FlowPart *part );
00059         void addCode( const QString& code );
00066         void addCodeBranch( FlowPart *flowPart );
00071         void addStopPart( FlowPart *part );
00075         void removeStopPart( FlowPart *part );
00080         QString generateMicrobe( const ItemList &itemList, MicroSettings *settings );
00084         bool isValidBranch( FlowPart *flowPart );
00089         static QString genLabel( const QString &id );
00090         
00091 protected:
00095         void tidyCode();
00096 
00097         QStringList m_gotos; // Gotos used
00098         QStringList m_labels; // Labels used
00099         FlowPartList m_subroutines;
00100         FlowPartList m_addedParts;
00101         FlowPartList m_stopParts;
00102         FlowPart *p_startPart;
00103         QString m_code;
00104         int m_curLevel;
00105 };
00106 
00107 #endif

Generated on Tue May 8 17:05:29 2007 for KTechLab by  doxygen 1.5.1