acell.cpp

来自「一个长度信息管理系统。主要包含了界面编程和对文件操作。」· C++ 代码 · 共 100 行

CPP
100
字号
// 结构设计
// 数据单元的结构基类
/*
#ifndef _CELL_STRUCT
#define _CELL_STRUCT

#include "afxtempl.h"

class  CCellBase
{
public:
	CCellBase ()
	{
		m_CellType = 1;
		m_No = 0;
	}
	// 
	bool  InValid(){return true;}
	long  m_CellType;	//   单元类型 1 : 长度 2 :点
	long  m_No;				//序号
	
};
typedef 	CCellBase*	LPCCellBase;
typedef 	CArray<CCellBase*, CCellBase*>	CCellBaseArray;
typedef 	CCellBaseArray*	 LPCCellBaseArray;


//长度数据单元的结构
class  CLength : public CCellBase
{
public: 
	CLength() 
	{
		m_Length = 0;
	}
	double    m_Length;		// 长度
};

// 数据容器
class  CCellArray
{
	
public:
	CCellArray();
	bool   Add(LPCCellBase pCellBase);
	bool   Remove(LPCCellBase pCellBase);
	
private:
	CCellBaseArray  m_CellArray;
};

bool  CCellArray::Add(LPCCellBase pCellBase)
{
	if(pCellBase == NULL||!pCellBase->InValid())
		return false;
	else
		m_CellArray.Add(pCellBase);
	
	return true;
}

bool  CCellArray::Remove (LPCCellBase pCellBase)
{
	if(pCellBase == NULL)
		return false;
	else
	{   
		int n=m_CellArray.GetSize();
		bool Is_Exsit=false;
		for(int i=0;i<n;i++)
		{
			if(m_CellArray[i]==pCellBase)
			{
				    Is_Exsit=true;
					m_CellArray.RemoveAt(i);
					return true;
			}
		}
		if(!Is_Exsit)
		{
			return false;
		}
	}
}

typedef CCellArray*		LPCCellArray;
class SysApplication 
{
public:
	SysApplication();
	LPCCellArray	GetCellArray();
private:
	CCellArray	 m_DataArray;
};
LPCCellArray  SysApplication::GetCellArray()
{
	return &m_DataArray;
}
#endif
*/

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?