Home | Products | Download | Purchase | Support 


Download Evaluation
Pricing & Purchase?
E-XD++Visual C++/ MFC Products
Overview
Features Tour 
Electronic Form Solution
Visualization & HMI Solution
Power system HMI Solution
CAD Drawing and Printing Solution

Bar code labeling Solution
Workflow Solution

Coal industry HMI Solution
Instrumentation Gauge Solution

Report Printing Solution
Graphical modeling Solution
GIS mapping solution

Visio graphics solution
Industrial control SCADA &HMI Solution
BPM business process Solution

Industrial monitoring Solution
Flowchart and diagramming Solution
Organization Diagram Solution

Graphic editor Source Code
UML drawing editor Source Code
Map Diagramming Solution

Architectural Graphic Drawing Solution
Request Evaluation
Purchase
ActiveX COM Products
Overview
Download
Purchase
Technical Support
  General Q & A
Discussion Board
Contact Us

Links

Get Ready to Unleash the Power of UCanCode .NET

   

CodeWizard--A visual tool to automatically generate C++ code files!

-- CObject


Free Products List:

Introduction

CodeWizard Version 1.0 includes a serial of tools that let's you visually create functionality on-screen and automatically generate C++ code files! Currently it only includes a tool that can generate source code from CObject class, but this is not the end, I will add many new code wizards that will help you generate many other source codes. To make you known how it works, all the source code is included within the zip files, you can modify it freely. if you have any good ideas about this tool, please let me known.

Below is the CObject code generator:

To use the code generator:

1. Select "Main Tools|&1 Generate Source Code based on CObject..." menu item, a setting dialog will appear.

2. Enter a correct class name at the first edit box, then you can enter the author name and the description of this class.

3. Click "Add" button to add as many variables as you want, all the variables will be list within the list box.

4. Double click on the select item of the list box, an edit dialog box will appear, you can now enter the new basic variable name (Tips: Only the basic name of the variable name is needed, for example: if the basic name is Text, it should be converted to m_strText,ID_PROPERTY_TEXT, GetText and SetText by system, and you cann't enter any empty char within the name). Currently it only support below types:

enum FO_VALUETYPE
{
V_EMPTY = -1,
V_BOOL, // BOOL value type.
V_STRING, // String value type
V_INT, // int value type
V_FLOAT, // float value type
V_DOUBLE, // double value type
V_DWORD, // DWORD value type
V_DATETIME, // COleDateTime value type
V_COLOR // COLORREF value type.
};

5. Click the "Generate Code" button to generate the source file and header file.

Below is the details of the source code header file:

#if !defined(FO_MYOBJECT_H__8F58549C_BAD3_4FE7_AE14_8C07BCD16A98__INCLUDED_)
#define UFC_MYOBJECT_H__8F58549C_BAD3_4FE7_AE14_8C07BCD16A98__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

//------------------------------------------------------
// Description
// Author: Author name.
//------------------------------------------------------

#include "FO_VALUE.h"

/////////////////////////////////////////////////////////////
// Property IDs define.

#define ID_PROP_TITLE                              7000
#define ID_PROP_NUMBER                             7001
#define ID_PROP_MATH                               7002
#define ID_PROP_GEO                                7003
#define ID_PROP_UNDER60                            7004
#define ID_PROP_MEMO                               7005
#define ID_PROP_STARTTIME                          7006

class CMyObject : public CObject
{
	DECLARE_SERIAL(CMyObject)

// Construction/Destruction
public:

	// Constructor with ID.
	CMyObject();
	
	// Copy constructor. 
	CMyObject(const CMyObject& newObject);
	
	// Destructor. 
	virtual ~CMyObject();

	// Put value.
	virtual BOOL PutValue(const int &nPropId,const FO_VALUE &Value);
	
	// Get value.
	virtual BOOL GetValue(FO_VALUE &Value,const int &nPropId);

	// Create a copy of current object.
	virtual CObject* Copy();

public:
	
	// Return Title value.
	CString GetTitle() const { return m_strTitle;}

	// Change Title value.
	void SetTitle( const CString &strValue ) {m_strTitle = strValue; }

	// Return Number value.
	int GetNumber() const { return m_nNumber;}

	// Change Number value.
	void SetNumber( const int &nValue ) {m_nNumber = nValue; }

	// Return Math value.
	float GetMath() const { return m_fMath;}

	// Change Math value.
	void SetMath( const float &fValue ) {m_fMath = fValue; }

	// Return Geo value.
	float GetGeo() const { return m_fGeo;}

	// Change Geo value.
	void SetGeo( const float &fValue ) {m_fGeo = fValue; }

	// Return Under60 value.
	BOOL GetUnder60() const { return m_bUnder60;}

	// Change Under60 value.
	void SetUnder60( const BOOL &bValue ) {m_bUnder60 = bValue; }

	// Return Memo value.
	CString GetMemo() const { return m_strMemo;}

	// Change Memo value.
	void SetMemo( const CString &strValue ) {m_strMemo = strValue; }

	// Return StartTime value.
	COleDateTime GetStartTime() const { return m_dtStartTime;}

	// Change StartTime value.
	void SetStartTime( const COleDateTime &dtValue ) {m_dtStartTime = dtValue; }

// Attributes
protected:
	// FODO:Add your properties items below.
	// Title value.
	CString                           m_strTitle;

	// Number value.
	int                               m_nNumber;

	// Math value.
	float                             m_fMath;

	// Geo value.
	float                             m_fGeo;

	// Under60 value.
	BOOL                              m_bUnder60;

	// Memo value.
	CString                           m_strMemo;

	// StartTime value.
	COleDateTime                      m_dtStartTime;


public:
	
	// Sets this set of font properties equal to another. 
	CMyObject& operator=(const CMyObject& newObject);

	// Is equal.
	virtual BOOL IsEqual(CObject* prop);

	// Determines if another set of fill properties is equal to this one. 
	BOOL operator==(const CMyObject newObject) const;

	// Serialize data to file. 
	virtual void Serialize(CArchive& ar);

// Implementation
public:

#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

};

inline CObject* CMyObject::Copy()
{
	return new CMyObject(*this);
}


#endif // !defined(UFC_MYOBJECT_H__8F58549C_BAD3_4FE7_AE14_8C07BCD16A98__INCLUDED_)

Below is the source code of source code file:

// MyObject.cpp : Defines the class behaviors for the application.
//

#include "stdafx.h"
#include "MyObject.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

/////////////////////////////////////////////////////////////////////////////
// CMyObject construction/destruction

IMPLEMENT_SERIAL(CMyObject, CObject,1)

// CMyObject | CMyObject | Constructor.

CMyObject::CMyObject() : CObject()
{
	m_strTitle                        = _T("");
	m_nNumber                         = 0;
	m_fMath                           = 0.0f;
	m_fGeo                            = 0.0f;
	m_bUnder60                        = TRUE;
	m_strMemo                         = _T("");
	m_dtStartTime                     = COleDateTime::GetCurrentTime();
}

CMyObject::CMyObject(const CMyObject& newObject) 
{
	m_strTitle                        = newObject.m_strTitle;
	m_nNumber                         = newObject.m_nNumber;
	m_fMath                           = newObject.m_fMath;
	m_fGeo                            = newObject.m_fGeo;
	m_bUnder60                        = newObject.m_bUnder60;
	m_strMemo                         = newObject.m_strMemo;
	m_dtStartTime                     = newObject.m_dtStartTime;
}

// Destructor.
CMyObject::~CMyObject()
{
}

//The property to copy.
CMyObject& CMyObject::operator=(const CMyObject& newObject)
{
	m_strTitle                        = newObject.m_strTitle;
	m_nNumber                         = newObject.m_nNumber;
	m_fMath                           = newObject.m_fMath;
	m_fGeo                            = newObject.m_fGeo;
	m_bUnder60                        = newObject.m_bUnder60;
	m_strMemo                         = newObject.m_strMemo;
	m_dtStartTime                     = newObject.m_dtStartTime;
	
	return *this;
}

BOOL CMyObject::IsEqual(CObject* prop)
{
	CMyObject* pProp = (CMyObject*)prop;

	if (pProp)
		return (*this == *pProp);

	return FALSE;
}

BOOL CMyObject::operator==(const CMyObject newObject) const
{
	if(
	GetTitle()                        == newObject.GetTitle() && 
	GetNumber()                       == newObject.GetNumber() && 
	GetMath()                         == newObject.GetMath() && 
	GetGeo()                          == newObject.GetGeo() && 
	GetUnder60()                      == newObject.GetUnder60() && 
	GetMemo()                         == newObject.GetMemo() && 
	GetStartTime()                    == newObject.GetStartTime() )
	{
		return TRUE;
	}
	return FALSE;
}

////////////////////////////////////////////////////////////////////////////
// CMyObject serialization
void CMyObject::Serialize(CArchive& ar)
{
	CObject::Serialize(ar);

	if (ar.IsStoring())
	{
		ar << m_strTitle;
		ar << m_nNumber;
		ar << m_fMath;
		ar << m_fGeo;
		ar << m_bUnder60;
		ar << m_strMemo;
		ar << m_dtStartTime;
		
	}
	else
	{
		ar >> m_strTitle;
		ar >> m_nNumber;
		ar >> m_fMath;
		ar >> m_fGeo;
		ar >> m_bUnder60;
		ar >> m_strMemo;
		ar >> m_dtStartTime;
		
	}
}


/////////////////////////////////////////////////////////////////////////////
// CMyObject diagnostics

#ifdef _DEBUG
void CMyObject::AssertValid() const
{
	CObject::AssertValid();
}

void CMyObject::Dump(CDumpContext& dc) const
{
	CObject::Dump(dc);
}
#endif //_DEBUG

BOOL CMyObject::PutValue(const int &nPropId,const FO_VALUE &value)
{
	BOOL bReturn = TRUE;
	switch(nPropId)
	{
	case ID_PROP_TITLE:
		{
			SetTitle(value.m_strValue);
		}
		break;

	case ID_PROP_NUMBER:
		{
			SetNumber(value.m_nValue);
		}
		break;

	case ID_PROP_MATH:
		{
			SetMath(value.m_fValue);
		}
		break;

	case ID_PROP_GEO:
		{
			SetGeo(value.m_fValue);
		}
		break;

	case ID_PROP_UNDER60:
		{
			SetUnder60(value.m_bValue);
		}
		break;

	case ID_PROP_MEMO:
		{
			SetMemo(value.m_strValue);
		}
		break;

	case ID_PROP_STARTTIME:
		{
			SetStartTime(value.m_dtValue);
		}
		break;

	default:
		{
			bReturn = FALSE;
		}
		break;
		
	}

	return bReturn;
}

BOOL CMyObject::GetValue(FO_VALUE &value,const int &nPropId)
{
	BOOL bReturn = TRUE;
	switch(nPropId)
	{
	case ID_PROP_TITLE:
		{
			value.m_nValueType = V_STRING;
			value.m_strValue = GetTitle();
		}
		break;

	case ID_PROP_NUMBER:
		{
			value.m_nValueType = V_INT;
			value.m_nValue = GetNumber();
		}
		break;

	case ID_PROP_MATH:
		{
			value.m_nValueType = V_FLOAT;
			value.m_fValue = GetMath();
		}
		break;

	case ID_PROP_GEO:
		{
			value.m_nValueType = V_FLOAT;
			value.m_fValue = GetGeo();
		}
		break;

	case ID_PROP_UNDER60:
		{
			value.m_nValueType = V_BOOL;
			value.m_bValue = GetUnder60();
		}
		break;

	case ID_PROP_MEMO:
		{
			value.m_nValueType = V_STRING;
			value.m_strValue = GetMemo();
		}
		break;

	case ID_PROP_STARTTIME:
		{
			value.m_nValueType = V_DATETIME;
			value.m_dtValue = GetStartTime();
		}
		break;

	default:
		{
			bReturn = FALSE;
		}
		break;
		
	}

	return bReturn;
}

That's all, all the source code of this tool is included within the zip files.

To find new version of this tool, click here!



[ Home | Products | Download Area | Purchase | SupportContact us ]


Copyright ?1998-2024 UCanCode.Net Software, all rights reserved.
Other product and company names herein may be the trademarks of their respective owners.

Please direct your questions or comments to webmaster@ucancode.net