当前位置: 首页>>代码示例>>C++>>正文


C++ Err函数代码示例

本文整理汇总了C++中Err函数的典型用法代码示例。如果您正苦于以下问题:C++ Err函数的具体用法?C++ Err怎么用?C++ Err使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Err函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetChar

char GetChar (DynChar Char)
{
  switch (Char)
  {
    case SPACE: return ' ';
    case DASH: return '-';
    case DOT: return '.';
    case SLASH: return '/';
    case BACKSLASH: return '\\';
    default: throw Err ("Unknown DynChar");
  }
}//GetChar
开发者ID:3dik,项目名称:bkoder,代码行数:12,代码来源:String.cpp

示例2: GetImageDirsFromShapeFile

static void
GetImageDirsFromShapeFile (char sImageDirs[],       // out
                           const char sShapeFile[], // in
                           FILE *pShapeFile)        // in
{
char s[SLEN];
Fgets(s, SLEN-1, pShapeFile);   // this skips blank lines and comments, if any

const char *sWhiteSpace = " \t\n\r";
char *sToken = strtok(s, sWhiteSpace);
if (!sToken || 0 != strcmp(sToken, "Directories"))
    Err("expected \"Directories\" in line %d of %s",
        nGetLineNbr(pShapeFile), sShapeFile);

sToken = strtok(NULL, sWhiteSpace);
if (!sToken)
    Err("can't read image directories in line %d of %s",
        nGetLineNbr(pShapeFile), sShapeFile);

strcpy(sImageDirs, sToken);
}
开发者ID:tbian,项目名称:aov,代码行数:21,代码来源:shapefile.cpp

示例3: EnsureGlContext

void Shader::SetParameter(const std::string& name, CurrentTextureType)
{
    if (myShaderProgram)
    {
        EnsureGlContext();

        // Find the location of the variable in the shader
        myCurrentTexture = glGetUniformLocationARB(myShaderProgram, name.c_str());
        if (myCurrentTexture == -1)
            Err() << "Texture \"" << name << "\" not found in shader" << std::endl;
    }
}
开发者ID:ChrisJansson,项目名称:Graphics,代码行数:12,代码来源:Shader.cpp

示例4: Err

bool Shader::LoadFromStream(InputStream& vertexShaderStream, InputStream& fragmentShaderStream)
{
    // Read the vertex shader code from the stream
    std::vector<char> vertexShader;
    if (!GetStreamContents(vertexShaderStream, vertexShader))
    {
        Err() << "Failed to read vertex shader from stream" << std::endl;
        return false;
    }

    // Read the fragment shader code from the stream
    std::vector<char> fragmentShader;
    if (!GetStreamContents(fragmentShaderStream, fragmentShader))
    {
        Err() << "Failed to read fragment shader from stream" << std::endl;
        return false;
    }

    // Compile the shader program
    return Compile(&vertexShader[0], &fragmentShader[0]);
}
开发者ID:ChrisJansson,项目名称:Graphics,代码行数:21,代码来源:Shader.cpp

示例5: Err

	void Assembler::macro()
	{
		char *sptr, *eptr;
		char nbuf[NAME_MAX+1];
		int idlen, xx;
		Macro *fmac;

		gNargs = 0;
		macrobuf = "";
		idlen = ibuf->getIdentifier(&sptr, &eptr);
		if (idlen == 0)
		{
			//printf("aaa:%.20s|\r\n", sptr);
			Err(E_MACRONAME);
			return;
		}
		if (pass < 2)
		{
			memset(nbuf, '\0', sizeof(nbuf));
			memcpy(nbuf, sptr, min(idlen, NAME_MAX));
			gMacro.setName(nbuf);
			fmac = (Macro *)macroTbl->find(&gMacro);
			if (fmac)
			{
				Err(E_DEFINED, nbuf);
				return;
			}
		}
		// Free parameter list (if not already freed)
		for (xx = 0; xx < MAX_MACRO_PARMS; xx++)
			if (parmlist[xx]) {
				delete parmlist[xx];
				parmlist[xx] = NULL;
			}

		xx = gNargs = ibuf->getParmList(parmlist);
		gMacro.setArgCount(xx);
		gMacro.setFileLine(CurFileNum, File[CurFileNum].LastLine);
		CollectingMacro = true;
	}
开发者ID:BigEd,项目名称:Cores,代码行数:40,代码来源:a_all.cpp

示例6: WriteShapeMod

static void WriteShapeMod(  // write a shape model to a .mh file as C++ code
    const char*  modname,   // in
    const Shape& meanshape, // in: n x 2
    const VEC&   eigvals,   // in: 2n x 1
    const MAT&   eigvecs,   // in: 2n x 2n, inverse of eigs of cov mat
    const char*  outdir,    // in: output directory
    const char*  comment)   // in
{
    char path[SLEN];
    sprintf(path, "%s/mh/%s_shapemodel.mh", outdir, modname);
    lprintf("Generating %s\n", path);
    FILE *file = fopen(path, "wb");
    if (!file)
        Err("Cannot open %s", path);
    char s[SLEN];
    Fprintf(file, "// %s.mh: machine generated shape model\n", path);
    Fprintf(file, "//\n");
    Fprintf(file, "// Command: %s\n//\n\n", comment);
    char path1[SLEN]; sprintf(path1, "stasm_%s_shapemodel_mh", modname);
    ToUpper(path1);
    Fprintf(file, "#ifndef %s\n", path1);
    Fprintf(file, "#define %s\n\n", path1);
    Fprintf(file, "namespace stasm {\n\n");

    sprintf(s, "%s_meanshapedata", modname);
    WriteMatAsArray(meanshape, s, "mean shape", file);

    Fprintf(file,
        "\nstatic const cv::Mat %s_meanshape(%d, %d, CV_64FC1, "
        "(double *)%s_meanshapedata);\n\n",
        modname, meanshape.rows, meanshape.cols, modname);

    sprintf(s, "%s_eigvalsdata", modname);
    WriteMatAsArray(eigvals, s, "eigen values", file);

    Fprintf(file,
        "\nstatic const cv::Mat %s_eigvals(%d, %d, CV_64FC1, "
        "(double *)%s_eigvalsdata);\n\n",
        modname, eigvals.rows, eigvals.cols, modname);

    sprintf(s, "%s_eigvecsdata", modname);
    WriteMatAsArray(eigvecs, s, "eigen vectors", file);

    Fprintf(file,
        "\nstatic const cv::Mat %s_eigvecs(%d, %d, CV_64FC1, "
        "(double *)%s_eigvecsdata);\n\n",
        modname, eigvecs.rows, eigvecs.cols, modname);

    Fprintf(file, "} // namespace stasm\n", path1);
    Fprintf(file, "#endif // %s\n", path1);
    fclose(file);
}
开发者ID:GianpaoloR,项目名称:polyphemus,代码行数:52,代码来源:tasmshapemod.cpp

示例7: reader

Result<Ok, nsresult>
SinfParser::ParseSchm(Box& aBox)
{
  BoxReader reader(aBox);

  if (reader->Remaining() < 8) {
    return Err(NS_ERROR_FAILURE);
  }

  MOZ_TRY(reader->ReadU32()); // flags -- ignore
  MOZ_TRY_VAR(mSinf.mDefaultEncryptionType, reader->ReadU32());
  return Ok();
}
开发者ID:fitzgen,项目名称:gecko-dev,代码行数:13,代码来源:SinfParser.cpp

示例8: Err

/* 
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/
void CExPolicy_ServerSession::KillProcessL(const RMessage2& aMessage)
{        
	TInt Err(KErrNone);

	TBuf8<255> Hjelpper;
	
//	TRAP(Err,
	aMessage.ReadL(0,Hjelpper,0);
	
	Server().KillProcess(Hjelpper);
	
    aMessage.Complete(Err);		
}
开发者ID:DrJukka,项目名称:Symbian_Codes,代码行数:17,代码来源:MainSession.cpp

示例9: json_object

// input/output operators for options
std::ostream & operator<< (std::ostream & s, const Opts & o){
  json_error_t e;
  json_t *J = json_object();
  for (auto i: o){
    json_object_set(J, i.first.c_str(), json_string(i.second.c_str()));
  }
  char *ret = json_dumps(J, JSON_SORT_KEYS);
  json_decref(J);
  if (!ret) throw Err() << "can't write Opts";
  s<<ret;
  free(ret);
  return s;
}
开发者ID:ushakov,项目名称:mapsoft,代码行数:14,代码来源:opts.cpp

示例10: if

//////////////////////////////
//	FromString
//	check the string ...Is it cash we are talking about?
//	if so exchange.  Take from this monehy add add to other
//	The remove functions through a CError if not enough cash.
//	written by: Demetrius Comes
void sMoney::FromString(CString & strMoney, sMoney & ToAdd, int nCoins)
{
	if(strMoney.Compare(m_strPlat.Left(strMoney.GetLength())))
	{
		ToAdd.AddPlat(RemovePlat(nCoins));
		throw "platinum";
	}
	else if(strMoney.Compare(m_strGold.Left(strMoney.GetLength())))
	{
		ToAdd.AddGold(RemoveGold(nCoins));
		throw "gold";
	}
	else if(strMoney.Compare(m_strSilver.Left(strMoney.GetLength())))
	{
		ToAdd.AddSilver(RemoveSilver(nCoins));
		throw "silver";
	}
	else if(strMoney.Compare(m_strCopper.Left(strMoney.GetLength())))
	{
		ToAdd.AddCopper(RemoveCopper(nCoins));
		throw "copper";
	}
	else if(strMoney.Compare("coins"))
	{
		if(nCoins!=-1 && nCoins!=1)
		{
			CError Err(MESSAGE_ONLY,"You can't specify coins without type!\r\n");
			throw &Err;
		}
		if(IsEmpty())
		{
			CError Err(MESSAGE_ONLY,"You can't find any coins.\r\n");
			throw &Err;
		}
		ToAdd+=*this;
		*this=0;
		throw "coins";
	}
}
开发者ID:cmdc0de,项目名称:WolfshadeMud,代码行数:45,代码来源:money.cpp

示例11: GetCurrentProcess

Result<Ok, nsresult> MemMapSnapshot::Freeze(AutoMemMap& aMem) {
  auto orig = mFile.ref().ClonePlatformHandle();
  mFile.reset();

  HANDLE handle;
  if (!::DuplicateHandle(
          GetCurrentProcess(), orig.release(), GetCurrentProcess(), &handle,
          GENERIC_READ | FILE_MAP_READ, false, DUPLICATE_CLOSE_SOURCE)) {
    return Err(NS_ERROR_FAILURE);
  }

  return aMem.initWithHandle(FileDescriptor(handle), mMem.size());
}
开发者ID:Noctem,项目名称:gecko-dev,代码行数:13,代码来源:MemMapSnapshot.cpp

示例12: Err

void LSH::WordHashing(TQuoteBase* QuoteBase, THashSet<TMd5Sig>& Shingles) {
  Err("Hashing shingles using words...\n");
  TIntV QuoteIds;
  QuoteBase->GetAllQuoteIds(QuoteIds);
  for (int qt = 0; qt < QuoteIds.Len(); qt++) {
    if (qt % 1000 == 0) {
      Err("%d out of %d completed\n", qt, QuoteIds.Len());
    }
    TQuote Q;
    QuoteBase->GetQuote(QuoteIds[qt], Q);

    TStrV Content;
    Q.GetParsedContent(Content);

    int ContentLen = Content.Len();
    for (int i = 0; i < ContentLen; i++) {
      const TMd5Sig ShingleMd5(Content[i]);
      Shingles.AddKey(ShingleMd5);
    }
  }
  Err("Done with word hashing! Number of shingles: %d\n", Shingles.Len());
}
开发者ID:snap-stanford,项目名称:curis-2012,代码行数:22,代码来源:lsh.cpp

示例13: FilePatchError

void FilePatchError( int format, ... )
{
    va_list     args;
    int         err;

    va_start( args, format );
    err = errno;
    Err( format, args );
    printf( ": %s\n", strerror( err ) );
    va_end( args );
    MsgFini();
    exit( EXIT_FAILURE );
}
开发者ID:Ukusbobra,项目名称:open-watcom-v2,代码行数:13,代码来源:wpatch.c

示例14: LogToFile

static void LogToFile(int16_t x, int16_t y, int16_t z) {
  uint8_t write_buf[48];
  UINT bw;
  TIMEREC time;

  /* open file */
  if (FAT1_open(&fp, "./log.txt", FA_OPEN_ALWAYS|FA_WRITE)!=FR_OK) {
    Err();
  }
  /* move to the end of the file */
  if (FAT1_lseek(&fp, fp.fsize) != FR_OK || fp.fptr != fp.fsize) {
    Err();
  }
  /* get time */
  if (TmDt1_GetTime(&time)!=ERR_OK) {
    Err();
  }
  /* write data */
  write_buf[0] = '\0';
  UTIL1_strcatNum8u(write_buf, sizeof(write_buf), time.Hour);
  UTIL1_chcat(write_buf, sizeof(write_buf), ':');
  UTIL1_strcatNum8u(write_buf, sizeof(write_buf), time.Min);
  UTIL1_chcat(write_buf, sizeof(write_buf), ':');
  UTIL1_strcatNum8u(write_buf, sizeof(write_buf), time.Sec);
  UTIL1_chcat(write_buf, sizeof(write_buf), '\t');

  UTIL1_strcatNum16s(write_buf, sizeof(write_buf), x);
  UTIL1_chcat(write_buf, sizeof(write_buf), '\t');
  UTIL1_strcatNum16s(write_buf, sizeof(write_buf), y);
  UTIL1_chcat(write_buf, sizeof(write_buf), '\t');
  UTIL1_strcatNum16s(write_buf, sizeof(write_buf), z);
  UTIL1_strcat(write_buf, sizeof(write_buf), (unsigned char*)"\r\n");
  if (FAT1_write(&fp, write_buf, UTIL1_strlen((char*)write_buf), &bw)!=FR_OK) {
    (void)FAT1_close(&fp);
    Err();
  }
  /* closing file */
  (void)FAT1_close(&fp);
}
开发者ID:dansog56,项目名称:mcuoneclipse,代码行数:39,代码来源:Application.c

示例15: ImgDirs

static void ImgDirs(
    char*       dirs,       // out
    const char* shapepath,  // in: shape file path
    FILE*       file)       // in
{
    char s[SLEN];
    Fgets(s, SLEN-1, file); // will skip blank lines and comments, if any

    static const char* const whitespace = " \t\n\r";
    char* token = strtok(s, whitespace);
    if (!token || 0 != strcmp(token, "Directories"))
        Err("Expected \"Directories\" in line %d of %s",
            LineNbr(file), shapepath);

    token = strtok(NULL, whitespace);
    if (!token)
        Err("Cannot read image directories in line %d of %s",
            LineNbr(file), shapepath);

    strncpy_(dirs, token, SLEN);
    ConvertBackslashesToForwardAndStripFinalSlash(dirs);
}
开发者ID:apprisi,项目名称:stasm4,代码行数:22,代码来源:shapefile.cpp


注:本文中的Err函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。