我有一个eclipse rcp(版本Indigo 3.7)应用程序(eclipse插件项目).我读了Lars Vogel的教程"Eclipse Commands Advanced"(修订版0.2-2.1,11.04.2009-24.09.2011).
首先,我使用带有菜单和一些命令的menuContribution创建了菜单扩展.
其次,我用一些命令创建了命令扩展.
第三,我定义了处理程序扩展(具有enabledWhen表达式的处理程序).
第四,我用变量编写了服务扩展.
我的plugin.xml看起来像:
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension id="application" point="org.eclipse.core.runtime.applications">
...
</extension>
<extension point="org.eclipse.ui.perspectives">
...
</extension>
<extension id="product" point="org.eclipse.core.runtime.products">
...
</extension>
<extension point="org.eclipse.ui.views">
...
</extension>
<extension point="org.eclipse.ui.menus">
<menuContribution allPopups="false" locationURI="menu:org.eclipse.ui.main.menu">
<menu id="fileMenuItem" label="File" mnemonic="F">
<command commandId="de.falk.rcp37.drawfigures.commands.new" id="newFileMenuItem" label="New" mnemonic="N" style="push">
</command>
<command commandId="de.falk.rcp37.drawfigures.commands.open" id="openFileMenuItem" label="Open..." mnemonic="O" style="push">
</command>
<separator name="de.falk.rcp37.drawfigures.menu.file.separator1" visible="true">
</separator>
<command commandId="de.falk.rcp37.drawfigures.commands.close" id="closeFileMenuItem" label="Close" mnemonic="C" style="push">
</command>
<separator name="de.falk.rcp37.drawfigures.menu.file.separator2" visible="true">
</separator>
<command commandId="de.falk.rcp37.drawfigures.commands.save" id="saveFileMenuItem" label="Save" mnemonic="S" style="push">
</command> …
Run Code Online (Sandbox Code Playgroud) 我曾多次用疙瘩成语来缩短编译时间.为了得到一个"好"的头文件,我返回一个包含QPoint(一个Qt对象)指针的向量指针.
让我们看看我的头文件:
#ifndef CHEXAGON_H
#define CHEXAGON_H
class QPoint;
class QVector;
class CHexagon
{
public:
CHexagon(const unsigned int & PosX, const unsigned int & PosY, const unsigned int & Radius);
QVector * getEdges();
QPoint * getCenter();
private:
class Pimple;
Pimple * pPimple;
};
#endif // CHEXAGON_H
Run Code Online (Sandbox Code Playgroud)
它出什么问题了?
在我的代码中,我尝试使用_stat()获取文件的权限。目前,我想在Windows下运行它。方法如下:
bool CFile::Private::checkPermissions(std::string sFilename, CFile::EOpenmode iOpenmode)
{
std::string sErrMsg = "";
bool bResult = true;
struct _stat buf;
int iResult = 0;
// Get data associated with "crt_stat.c":
iResult = _stat( sFilename.c_str(), &buf );
// Check if statistics are valid:
if( iResult != 0 )
{
switch (errno)
{
case ENOENT:
sErrMsg = "File: " + sFilename + " not found.";
break;
case EINVAL:
sErrMsg = "Invalid parameter to _stat(filename, &buf).";
break;
default:
/* Should never be reached. */
sErrMsg …
Run Code Online (Sandbox Code Playgroud) 例如std::runtime_error
,std::invalid_argument
在大型项目中抛出不同的异常是否有用?或者更好的方法是std::exception
提供一个好的文本参数what()
?什么时候可以从中派生出一些子类std::exception
?
入魔
对不起,我是模板的新手,我搜索了很多,但我找不到解决方法如何声明转发模板(类的).
这是我的代码:
#ifndef CMAP_H
#define CMAP_H
#include "qvector.h"
class CMap
{
public:
CMap(const unsigned int & width, const unsigned int & height, const unsigned int & hexagonRadius);
CMap(const unsigned int & width, const unsigned int & height, const unsigned int & hexagonRadius, const QVector<QVector<unsigned int> > & landType);
~CMap();
private:
class Pimple;
Pimple * d;
};
#endif // CMAP_H
Run Code Online (Sandbox Code Playgroud)
我想要的只是让#include"qvector.h"过时了.