Click here to Skip to main content
15,896,606 members
Articles / Mobile Apps

The StateWizard VC++ Add-in and Engine with Source Code

Rate me:
Please Sign up or sign in to vote.
4.73/5 (24 votes)
26 Mar 2009CPOL12 min read 191K   2.8K   132  
A cross-platform state-oriented application framework and a ClassWizard-like round-trip UML dynamic modeling/development tool that runs in popular IDEs. Aims at providing concurrent, distributed, and real-time application development tools for Win32/Linux
// TreeFile.h: interface for the TreeFile class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_TREEFILE_H__F4C69E0C_65C3_4A4B_B597_049D48BCFCC4__INCLUDED_)
#define AFX_TREEFILE_H__F4C69E0C_65C3_4A4B_B597_049D48BCFCC4__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "stdafx.h"
#include "StateTreeCtrl.h"

class SmePair
{

public:
	HTREEITEM first;
	int second;
	SmePair* next;
	SmePair(HTREEITEM f,int s):first(f),second(s),next(NULL){}
	SmePair(){}
	SmePair(SmePair& mypair):first(mypair.first),second(mypair.second),next(NULL){}
};

class SmeStack
{
private:
	SmePair* head,*last;
	int num;
	SmePair* SeekBefore(SmePair* p);
public:
	SmeStack():head(NULL),last(NULL),num(0){}
	void push(SmePair& mypair);
	void pop();
	int size(){return num;}
	SmePair top(){return *last;}
	BOOL empty(){return num == 0 ? TRUE : FALSE;}
	SmePair* GetHead(){return head;}
	~SmeStack();
};



class TreeFile  //use to put a tree struct in to a txt file
{
private:
	SmeStack TreeItem;
	HTREEITEM CurrentItem;
	HTREEITEM rootitem;
	CStateTreeCtrl* m_pStateTree;
public:
	TreeFile(HTREEITEM& selecteditem,CStateTreeCtrl* pTree):CurrentItem(selecteditem),m_pStateTree(pTree),rootitem(selecteditem){}
	BOOL SaveAsTxtFile(CFile& targetfile);
	void writeoneline(CFile& targetfile,SmePair& pairitem);
	BOOL StackPopProcess(CFile& targetfile);
	BOOL TreeCtrlHasValidChild(HTREEITEM item);
	HTREEITEM GetNextValidItem(HTREEITEM item);
	HTREEITEM GetChildItem(HTREEITEM item);
	void WriteEmptyLine(CFile& targetfile);
	 ~TreeFile();

};

#endif // !defined(AFX_TREEFILE_H__F4C69E0C_65C3_4A4B_B597_049D48BCFCC4__INCLUDED_)

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
United States United States
Alex "Question is more important than the answer."

Comments and Discussions