本文整理汇总了C++中setErrorMessage函数的典型用法代码示例。如果您正苦于以下问题:C++ setErrorMessage函数的具体用法?C++ setErrorMessage怎么用?C++ setErrorMessage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setErrorMessage函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: direction
int OCCFace::revolve(OCCBase *shape, OCCStruct3d p1, OCCStruct3d p2, double angle)
{
try {
const TopoDS_Shape& shp = shape->getShape();
// Only accept Edge or Wire
TopAbs_ShapeEnum type = shp.ShapeType();
if (type != TopAbs_EDGE && type != TopAbs_WIRE) {
StdFail_NotDone::Raise("Expected Edge or Wire");
}
gp_Dir direction(p2.x - p1.x, p2.y - p1.y, p2.z - p1.z);
gp_Ax1 axisOfRevolution(gp_Pnt(p1.x, p1.y, p1.z), direction);
BRepPrimAPI_MakeRevol MR(shp, axisOfRevolution, angle, Standard_False);
if (!MR.IsDone()) {
StdFail_NotDone::Raise("Failed in revolve operation");;
}
this->setShape(MR.Shape());
// possible fix shape
if (!this->fixShape())
StdFail_NotDone::Raise("Shapes not valid");
} catch(Standard_Failure &err) {
Handle_Standard_Failure e = Standard_Failure::Caught();
const Standard_CString msg = e->GetMessageString();
if (msg != NULL && strlen(msg) > 1) {
setErrorMessage(msg);
} else {
setErrorMessage("Failed to revolve");
}
return 0;
}
return 1;
}
开发者ID:Felipeasg,项目名称:occmodel,代码行数:35,代码来源:OCCFace.cpp
示例2: setErrorMessage
bool QtSkin::convertAttributesToColor(const QString& aName, const QXmlAttributes& theAttributes, QColor& aColor)
{
int redIndex=theAttributes.index("red");
int greenIndex=theAttributes.index("green");
int blueIndex=theAttributes.index("blue");
if(redIndex<0 || greenIndex<0 || blueIndex<0)
{
setErrorMessage("Invalid attributes for color "+aName);
return false;
}
else
{
int red, green, blue;
if(!convertStringToInteger(theAttributes.value(redIndex), red))
{
setErrorMessage("Invalid red: "+theAttributes.value(redIndex)+" for "+aName);
return false;
}
if(!convertStringToInteger(theAttributes.value(greenIndex), green))
{
setErrorMessage("Invalid green: "+theAttributes.value(greenIndex)+" for "+aName);
return false;
}
if(!convertStringToInteger(theAttributes.value(blueIndex), blue))
{
setErrorMessage("Invalid blue: "+theAttributes.value(blueIndex)+" for "+aName);
return false;
}
aColor.setRgb(red, green, blue);
}
return true;
}
开发者ID:BigEd,项目名称:wp34s,代码行数:34,代码来源:QtSkin.cpp
示例3: close
bool ComicModel::open(const QString &fileUrl)
{
if (m_currentFilename != "") {
close();
}
QUrl url(fileUrl);
std::shared_ptr<QuaZip> zip(new QuaZip(url.toLocalFile()));
zip->setFileNameCodec("Shift-JIS");
bool result = zip->open(QuaZip::mdUnzip);
if (result) {
int pageCount;
if (parseZip("", zip, pageCount)) {
setErrorMessage();
addRecentFile(url.toLocalFile());
m_currentFilename = url.toLocalFile();
emit currentFilenameChanged(m_currentFilename);
emit maxPageChanged(m_list.size());
QSettings settings;
QString key = QString(RECENTPAGE_KEY).arg(m_currentFilename);
int page = settings.value(key, 1).toInt();
setCurrentPage(page);
} else {
setErrorMessage("zip file is empty.");
}
} else {
setErrorMessage("open file error.");
}
return result;
}
开发者ID:parhelia512,项目名称:ComicsViewer,代码行数:29,代码来源:comicmodel.cpp
示例4: programFlashTask
void programFlashTask(void* p){
int sector = flashSectorToWrite;
uint32_t size = flashSizeToWrite;
uint8_t* source = (uint8_t*)flashAddressToWrite;
if(sector >= 0 && sector < MAX_USER_PATCHES && size <= 128*1024){
uint32_t addr = getFlashAddress(sector);
eeprom_unlock();
int ret = eeprom_erase(addr);
if(ret == 0)
ret = eeprom_write_block(addr, source, size);
eeprom_lock();
registry.init();
if(ret == 0){
// load and run program
int pc = registry.getNumberOfPatches()-MAX_USER_PATCHES+sector;
program.loadProgram(pc);
// program.loadDynamicProgram(source, size);
program.resetProgram(false);
}else{
setErrorMessage(PROGRAM_ERROR, "Failed to write program to flash");
}
}else if(sector == 0xff && size < MAX_SYSEX_FIRMWARE_SIZE){
flashFirmware(source, size);
}else{
setErrorMessage(PROGRAM_ERROR, "Invalid flash program command");
}
vTaskDelete(NULL);
}
开发者ID:olilarkin,项目名称:OwlWare,代码行数:28,代码来源:ProgramManager.cpp
示例5: file
QImage ComicModel::loadImage(int arg)
{
QImage img;
--arg;
//qDebug() << m_list[arg]->fileName;
if (m_list[arg]->zip->setCurrentFile(m_list[arg]->fileName)) {
QuaZipFile file(m_list[arg]->zip.get());
if (file.open(QIODevice::ReadOnly)) {
QByteArray data = file.readAll();
file.close();
if (img.loadFromData(data)) {
//qDebug() << "load success" << data.size();
setErrorMessage();
} else {
//qDebug() << "loadFromData error.";
setErrorMessage("error: loadFromData()");
}
} else {
//qDebug() << "file open error.";
setErrorMessage("error: file.open()");
}
} else {
//qDebug() << "setCurrentFile failed." << m_zip->getZipError();
setErrorMessage("error: setCurrentFile()");
}
return img;
}
开发者ID:parhelia512,项目名称:ComicsViewer,代码行数:27,代码来源:comicmodel.cpp
示例6: catch
int OCCTools::writeSTEP(const char *filename, std::vector<OCCBase *> shapes)
{
try {
STEPControl_Writer writer;
IFSelect_ReturnStatus status;
Interface_Static::SetCVal("xstep.cascade.unit","M");
Interface_Static::SetIVal("read.step.nonmanifold", 1);
for (unsigned i = 0; i < shapes.size(); i++) {
status = writer.Transfer(shapes[i]->getShape(), STEPControl_AsIs);
if (status != IFSelect_RetDone) {
StdFail_NotDone::Raise("Failed to write STEP file");
}
}
status = writer.Write(filename);
} catch(Standard_Failure &err) {
Handle_Standard_Failure e = Standard_Failure::Caught();
const Standard_CString msg = e->GetMessageString();
//printf("ERROR: %s\n", e->GetMessageString());
if (msg != NULL && strlen(msg) > 1) {
setErrorMessage(msg);
} else {
setErrorMessage("Failed to write STEP file");
}
return 0;
}
return 1;
}
开发者ID:erossignon,项目名称:occmodel,代码行数:29,代码来源:OCCTools.cpp
示例7: setErrorMessage
void CharacteristicsEditor::readCharacteristicValue()
{
if ((m_characteristicProperties & GATT_CHARACTERISTIC_PROP_READ) == 0) {
setErrorMessage("GATT descriptors: Read not permitted");
return;
}
uint8_t *characteristicBuffer = (uint8_t *)alloca(m_characteristicMTU);
if (!characteristicBuffer) {
setErrorMessage("GATT characteristic: Not enough memory");
bt_gatt_disconnect_instance(m_gattInstance);
return;
}
QString descriptorString;
int byteCount = 0;
uint8_t more = 1;
for (int offset = 0; more; offset += byteCount) {
byteCount = bt_gatt_read_value(m_gattInstance, m_characteristicValueHandle.toUShort(), offset, characteristicBuffer, m_characteristicMTU, &more);
if (byteCount < 0) {
setErrorMessage(QString("Unable to read characteristic value: %1 (%2)").arg(errno).arg(strerror(errno)));
break;
}
descriptorString += bufferToString(characteristicBuffer, byteCount);
}
setCharacteristicValue(descriptorString);
setCharacteristicValueText(descriptorString);
}
开发者ID:RobbieDubya,项目名称:Cascades-Samples,代码行数:31,代码来源:CharacteristicsEditor.cpp
示例8: aPnt
int OCCFace::createConstrained(std::vector<OCCEdge *> edges, std::vector<OCCStruct3d> points) {
try {
BRepOffsetAPI_MakeFilling aGenerator;
for (unsigned i = 0; i < edges.size(); i++) {
OCCEdge *edge = edges[i];
aGenerator.Add(edge->edge, GeomAbs_C0);
}
for (unsigned i = 0; i < points.size(); i++) {
gp_Pnt aPnt(points[i].x, points[i].y, points[i].z);
aGenerator.Add(aPnt);
}
aGenerator.Build();
this->setShape(aGenerator.Shape());
// possible fix shape
if (!this->fixShape())
StdFail_NotDone::Raise("Shapes not valid");
} catch(Standard_Failure &err) {
Handle_Standard_Failure e = Standard_Failure::Caught();
const Standard_CString msg = e->GetMessageString();
if (msg != NULL && strlen(msg) > 1) {
setErrorMessage(msg);
} else {
setErrorMessage("Failed to create face");
}
return 0;
}
return 1;
}
开发者ID:Felipeasg,项目名称:occmodel,代码行数:30,代码来源:OCCFace.cpp
示例9: aP1
int OCCEdge::createArc(OCCVertex *start, OCCVertex *end, OCCStruct3d center) {
try {
gp_Pnt aP1(start->X(), start->Y(), start->Z());
gp_Pnt aP2(center.x, center.y, center.z);
gp_Pnt aP3(end->X(), end->Y(), end->Z());
Standard_Real Radius = aP1.Distance(aP2);
gce_MakeCirc MC(aP2,gce_MakePln(aP1, aP2, aP3).Value(), Radius);
const gp_Circ& Circ = MC.Value();
Standard_Real Alpha1 = ElCLib::Parameter(Circ, aP1);
Standard_Real Alpha2 = ElCLib::Parameter(Circ, aP3);
Handle(Geom_Circle) C = new Geom_Circle(Circ);
Handle(Geom_TrimmedCurve) arc = new Geom_TrimmedCurve(C, Alpha1, Alpha2, false);
this->setShape(BRepBuilderAPI_MakeEdge(arc, start->vertex, end->vertex));
} catch(Standard_Failure &err) {
Handle_Standard_Failure e = Standard_Failure::Caught();
const Standard_CString msg = e->GetMessageString();
if (msg != NULL && strlen(msg) > 1) {
setErrorMessage(msg);
} else {
setErrorMessage("Failed to create arc");
}
return 0;
}
return 1;
}
开发者ID:erossignon,项目名称:occmodel,代码行数:28,代码来源:OCCEdge.cpp
示例10: MO
int OCCFace::offset(double offset, double tolerance = 1e-6) {
try {
BRepOffset_MakeOffset MO(this->getShape(), offset, tolerance, BRepOffset_Skin,
Standard_False, Standard_False, GeomAbs_Intersection, Standard_False);
if (!MO.IsDone()) {
StdFail_NotDone::Raise("Failed to offset face");
}
const TopoDS_Shape& tmp = MO.Shape();
BRepCheck_Analyzer aChecker(tmp);
if (tmp.IsNull() || !aChecker.IsValid()) {
StdFail_NotDone::Raise("offset result not valid");
}
this->setShape(tmp);
// possible fix shape
if (!this->fixShape())
StdFail_NotDone::Raise("Shapes not valid");
} catch(Standard_Failure &err) {
Handle_Standard_Failure e = Standard_Failure::Caught();
const Standard_CString msg = e->GetMessageString();
if (msg != NULL && strlen(msg) > 1) {
setErrorMessage(msg);
} else {
setErrorMessage("Failed to offset face");
}
return 0;
}
return 1;
}
开发者ID:Felipeasg,项目名称:occmodel,代码行数:34,代码来源:OCCFace.cpp
示例11: MF
int OCCFace::createPolygonal(std::vector<OCCStruct3d> points)
{
try {
BRepBuilderAPI_MakePolygon MP;
for (unsigned i=0; i<points.size(); i++) {
MP.Add(gp_Pnt(points[i].x, points[i].y, points[i].z));
}
MP.Close();
if (!MP.IsDone()) {
StdFail_NotDone::Raise("failed to create face");;
}
BRepBuilderAPI_MakeFace MF(MP.Wire(), false);
this->setShape(MF.Face());
// possible fix shape
if (!this->fixShape())
StdFail_NotDone::Raise("Shapes not valid");
} catch(Standard_Failure &err) {
Handle_Standard_Failure e = Standard_Failure::Caught();
const Standard_CString msg = e->GetMessageString();
if (msg != NULL && strlen(msg) > 1) {
setErrorMessage(msg);
} else {
setErrorMessage("Failed to create face");
}
return 0;
}
return 1;
}
开发者ID:Felipeasg,项目名称:occmodel,代码行数:30,代码来源:OCCFace.cpp
示例12: setErrorMessage
bool AutoUpdate::softWareBackup()
{
if(sNewPath.isEmpty())
{
setErrorMessage(tr("新程序路径获取失败"));
return false;
}
bool ret=QFile::exists(sOldPath);
if(!ret)
{
setErrorMessage(tr("查找收费软件失败"));
return ret;
}
ret=QFile::exists(sOldPath+"_bak");
if(ret)
{
QFile::remove(sOldPath+"_bak");
}
ret=QFile::rename(sOldPath,sOldPath+"_bak");
if(!ret)
{
setErrorMessage(tr("现有程序备份失败"));
}
return ret;
}
开发者ID:eilin1208,项目名称:QT_Test,代码行数:25,代码来源:autoupdate.cpp
示例13: getNodeType
VarType TypeCheckerVisitor::getOperationResultType(TokenKind tokenKind, AstNode* left, AstNode* right) {
VarType result = VT_INVALID;
VarType leftType = getNodeType(left);
VarType rightType = getNodeType(right);
switch (tokenKind) {
case tOR: case tAND: case tEQ: case tNEQ:
case tGT: case tGE: case tLT: case tLE:
result = VT_INT;
break;
case tADD:
if (leftType == VT_STRING || rightType == VT_STRING) {
result = VT_STRING;
} else if (leftType == VT_DOUBLE || rightType == VT_DOUBLE) {
result = VT_DOUBLE;
} else if (leftType == VT_INT && rightType == VT_INT) {
result = VT_INT;
}
break;
case tSUB: case tMUL: case tDIV: case tMOD:
if (leftType == VT_DOUBLE || rightType == VT_DOUBLE) {
result = VT_DOUBLE;
} else if (leftType == VT_INT && rightType == VT_INT) {
result = VT_INT;
}
break;
case tASSIGN:
if (!(isAssignable(leftType, rightType))) {
setErrorMessage(right, "bad type");
}
result = leftType;
break;
case tDECRSET:
if (!(isAssignable(leftType, rightType)) || (leftType == VT_STRING)) {
setErrorMessage(right, "bad type");
}
result = leftType;
break;
case tINCRSET:
if (leftType == VT_STRING) {
result = VT_STRING;
} else if (leftType == VT_DOUBLE) {
result = VT_DOUBLE;
} else if (leftType == VT_INT && rightType == VT_INT) {
result = VT_INT;
}
break;
default:
assert(0);
}
if (leftType == VT_VOID) {
setErrorMessage(left, "Should not be of type void");
}
if (rightType == VT_VOID) {
setErrorMessage(right, "Should not be of type void");
}
return result;
}
开发者ID:nvmd,项目名称:spbau-mathvm,代码行数:57,代码来源:typechecker.cpp
示例14: setErrorMessage
bool Pumping::initializeSettings(std::shared_ptr<geometry::Geometry> geometry)
{
if (geometry->hasOption("pumping_ts"))
{
this->pumpingTs = geometry->getOrCreateTimeseries(geometry->getOption("pumping_ts"));
}
else
{
if (geometry->hasOption("pumping_rate"))
{
if (!tryParse(geometry->getOption("pumping_rate"), this->pumpingRate))
{
setErrorMessage("Unable to parse pumping_rate option");
return false;
}
}
else
{
return false;
}
if (geometry->hasOption("days_before_pumping"))
{
if (!tryParse(geometry->getOption("days_before_pumping"), this->daysBeforePumping))
{
setErrorMessage("Unable to parse days_before_pumping option");
return false;
}
}
else
{
return false;
}
if (geometry->hasOption("pumping_threshold"))
{
if (!tryParse(geometry->getOption("pumping_threshold"), this->pumpingThreshold))
{
setErrorMessage("Unable to parse pumping_threshold option");
return false;
}
}
else
{
return false;
}
}
// Start out the event-to-pumping interval counter with the correct duration to allow for
// pumping from the start of a simulation.
this->secondsSinceLastInflow = SECS_PER_DAY * this->daysBeforePumping;
return true;
}
开发者ID:obergshavefun,项目名称:icap,代码行数:54,代码来源:pumping.cpp
示例15: Handle
int OCCEdge::createSpline(OCCVertex *start, OCCVertex *end, std::vector<OCCStruct3d> points,
double tolerance)
{
try {
Standard_Boolean periodic = false;
Standard_Real tol = tolerance;
int vertices = 0;
if (start != NULL && end != NULL) {
vertices = 2;
}
int nbControlPoints = points.size();
Handle(TColgp_HArray1OfPnt) ctrlPoints;
ctrlPoints = new TColgp_HArray1OfPnt(1, nbControlPoints + vertices);
int index = 1;
if (vertices) {
ctrlPoints->SetValue(index++, gp_Pnt(start->X(), start->Y(), start->Z()));
}
for (int i = 0; i < nbControlPoints; i++) {
gp_Pnt aP(points[i].x,points[i].y,points[i].z);
ctrlPoints->SetValue(index++, aP);
}
if (vertices) {
ctrlPoints->SetValue(index++, gp_Pnt(end->X(), end->Y(), end->Z()));
}
GeomAPI_Interpolate INT(ctrlPoints, periodic, tol);
INT.Perform();
Handle(Geom_BSplineCurve) curve = INT.Curve();
if (vertices) {
this->setShape(BRepBuilderAPI_MakeEdge(curve, start->vertex, end->vertex));
} else {
this->setShape(BRepBuilderAPI_MakeEdge(curve));
}
} catch(Standard_Failure &err) {
Handle_Standard_Failure e = Standard_Failure::Caught();
const Standard_CString msg = e->GetMessageString();
if (msg != NULL && strlen(msg) > 1) {
setErrorMessage(msg);
} else {
setErrorMessage("Failed to create spline");
}
return 0;
}
return 1;
}
开发者ID:erossignon,项目名称:occmodel,代码行数:52,代码来源:OCCEdge.cpp
示例16: setError
// =========================================================
void pamParser::Read(const std::string &pamfile, seqAlign* pSeqAlign)
{
setError(0);
std::ifstream ipam;
ipam.open(pamfile.c_str());
int end = pamfile.length();
int slash = pamfile.find_last_of("/");
std::string file_name = pamfile.substr(slash+1,(end-slash-5));
if (!ipam) {
std::string errorMessage = " Error, Can't Find " + pamfile;
setErrorMessage(errorMessage);
errorLogger.throwError( "seqAlign::Read", errorMessage, 1);
}
if (pSeqAlign) {
pSeqAlign->setPAMFile(pamfile);
}
else {
std::string errorMessage = " Error ";
setErrorMessage(errorMessage);
errorLogger.throwError( "seqAlign::Read", errorMessage, 1);
}
std::vector<std::string> characters;
int i = -1;
std::string fileline = "";
while (ipam) {
getline(ipam,fileline);
if (fileline.substr(0,1) == "#") {
continue;
}
if (i == -1) { // first line
splitString(fileline, " ", characters, 0);
pSeqAlign->setPAMSize(static_cast<int>(characters.size()));
for (unsigned int i = 0; i < characters.size(); i++) {
pSeqAlign->setPAMType(i, characters[i]);
}
}
else {
std::vector<std::string> words;
splitString(fileline, " ", words, 0);
for (unsigned int j = 1; j < words.size(); j++) {
double v = string2Double(words[j]);
pSeqAlign->setPAMValue(i, j-1, v);
}
}
i++;
}
ipam.close();
}
开发者ID:zhangxiaoyu11,项目名称:mAMBER,代码行数:53,代码来源:pamParser.cpp
示例17: ctrlPoints
int OCCEdge::createBezier(OCCVertex *start, OCCVertex *end, std::vector<OCCStruct3d> points)
{
try {
int nbControlPoints = points.size();
int vertices = 0;
if (start != NULL && end != NULL) {
vertices = 2;
}
TColgp_Array1OfPnt ctrlPoints(1, nbControlPoints + vertices);
int index = 1;
if (vertices) {
ctrlPoints.SetValue(index++, gp_Pnt(start->X(), start->Y(), start->Z()));
}
for (int i = 0; i < nbControlPoints; i++) {
gp_Pnt aP(points[i].x,points[i].y,points[i].z);
ctrlPoints.SetValue(index++, aP);
}
if (vertices)
ctrlPoints.SetValue(index++, gp_Pnt(end->X(), end->Y(), end->Z()));
Handle(Geom_BezierCurve) bezier = new Geom_BezierCurve(ctrlPoints);
if (vertices) {
this->setShape(BRepBuilderAPI_MakeEdge(bezier, start->vertex, end->vertex));
} else {
this->setShape(BRepBuilderAPI_MakeEdge(bezier));
}
if (this->length() <= Precision::Confusion()) {
StdFail_NotDone::Raise("bezier not valid");
}
} catch(Standard_Failure &err) {
Handle_Standard_Failure e = Standard_Failure::Caught();
const Standard_CString msg = e->GetMessageString();
if (msg != NULL && strlen(msg) > 1) {
setErrorMessage(msg);
} else {
setErrorMessage("Failed to create bezier");
}
return 0;
}
return 1;
}
开发者ID:erossignon,项目名称:occmodel,代码行数:48,代码来源:OCCEdge.cpp
示例18: setErrorMessage
void AddMetaItemPage::onDelayedMergeRequest()
{
QString metaId = FMetaTabWindow->metaRoster()->itemMetaContact(FAddWidget->contactJid());
FMergeRequestId = !metaId.isEmpty() ? FMetaTabWindow->metaRoster()->mergeContacts(FMetaTabWindow->metaId(), QList<QString>() << metaId) : QString::null;
if (FMergeRequestId.isEmpty())
setErrorMessage(Qt::escape(tr("Failed to merge contacts.")));
}
开发者ID:RandomWalkEagle,项目名称:Contacts,代码行数:7,代码来源:addmetaitempage.cpp
示例19: setErrorMessage
Devices::Devices()
{
char error[PCAP_ERRBUF_SIZE];
if(pcap_findalldevs(&alldevs,error)==-1) {
setErrorMessage("Error in finding devices: " + QString(error),QMessageBox::Critical);
}
}
开发者ID:jcrohde,项目名称:netObservator,代码行数:7,代码来源:devices.cpp
示例20: throw
/**
* @param curEnv java environment where the exception occurred.
*/
JniCallMethodException::JniCallMethodException(JNIEnv * curEnv) throw() : JniException(curEnv)
{
std::string errorMessage = "Exception when calling Java method : ";
errorMessage += getJavaDescription() + "\n" + getJavaStackTrace();
errorMessage += what();
setErrorMessage(errorMessage);
}
开发者ID:ZhanlinWang,项目名称:scilab,代码行数:10,代码来源:GiwsException.cpp
注:本文中的setErrorMessage函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论