• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ readString函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: readString

Error WasmObjectFile::parseUserSection(wasm::WasmSection &Sec,
                                       const uint8_t *Ptr, size_t Length) {
  Sec.Name = readString(Ptr);
  return Error::success();
}
开发者ID:AstroVPK,项目名称:LLVM-4.0.0,代码行数:5,代码来源:WasmObjectFile.cpp


示例2: readUInt32

std::string BinaryInput::readString32() {
    int len = readUInt32();
    return readString(len);
}
开发者ID:Blumfield,项目名称:ptc,代码行数:4,代码来源:BinaryInput.cpp


示例3: waitForSearchResult

int waitForSearchResult(int sock){

	// Get result of search from server
	int sizeOfResult;
	if(readInt(sock, &sizeOfResult) < 0){
		puts("Failed to receive size of result");
		return -1;
	}

	// Get Result and Display
	char result[sizeOfResult];
	if(readString(sock, sizeOfResult, &result[0]) < 0){
		puts("Failed to receive result array.");
		return -1;
	}

	printf("Result is:\n %s\n",result);

	// Select which file you want from the result
	char c;

	// Ask user if any file is to be retrieved
	printf("Do you want to retrieve a file (Y/N)? ");
	char input[2];
	fgets(input, sizeof(input), stdin);

	if(input[0] == 'N' || input[0] == 'n'){
		// Exit
		if(sendInt(sock, -1) < 0){
			puts("Failed to send retrieval status");
			return -1;
		}
		//flushing input stream
		while((c = getchar()) != '\n' && c != EOF);

		return 1;
	}else if(input[0] == 'Y' || input[0] == 'y'){
		// Continue to retrieval
		if(sendInt(sock, 1) < 0){
			puts("Failed to send retrieval status");
			return -1;
		}
	}else{
		// Invalid input exit
		// Exit
		if(sendInt(sock, -1) < 0){
			puts("Failed to send retrieval status");
			return -1;
		}

		//flushing input stream
		while((c = getchar()) != '\n' && c != EOF);

		return 1;
	}

	//flushing input stream
	while((c = getchar()) != '\n' && c != EOF);

	char answer[100];
	printf("Which File do you want to retrieve: ");
	fgets(answer, sizeof(answer), stdin);

	int index;
	for(index = 0; index < 100; index++){
		if(answer[index] == '\n'){
			answer[index] = '\0';
			break;
		}
	}

	// Send the file to retrieve
	if(sendString(sock, 100, &answer[0]) < 0){
		puts("Sending Retrieve request failed.");
		return -1;
	}

	// Wait for response if the file was found
	int fileFound;
	if(readInt(sock, &fileFound) < 0){
		puts("Receiving file found status from server failed");
		return -1;
	}

	if(fileFound < 0){
		puts("File requested was not found | Please check file name");
		return 1;
	}

	// Receive the file size
	int fileSize = 0;
	// Get the file size
	if(readInt(sock, &fileSize) < 0){
		puts("Receiving file size from server failed.");
		return -1;
	}

	printf("File Size = %d\n",fileSize);

	// Initialize file
//.........这里部分代码省略.........
开发者ID:bhavinmodi,项目名称:OS-Project-2,代码行数:101,代码来源:client.c


示例4: readMesh

void readMesh(IOReadBase* pRead, iModelData* pModelData)
{
	bool skeletallyAnimated;
	pRead->Read(&skeletallyAnimated,sizeof(bool));
	// Find all substreams
	if (!pRead->IsEof())
	{
		CSubMesh sharedSubMesh;
		unsigned short streamID;
		unsigned int uLength;
		pRead->Read(&streamID,sizeof(unsigned short));
		pRead->Read(&uLength,sizeof(unsigned int));

		while(!pRead->IsEof() &&
			(streamID == M_GEOMETRY ||
			streamID == M_SUBMESH ||
			streamID == M_MESH_SKELETON_LINK ||
			streamID == M_MESH_BONE_ASSIGNMENT ||
			streamID == M_MESH_LOD ||
			streamID == M_MESH_BOUNDS ||
			streamID == M_SUBMESH_NAME_TABLE ||
			streamID == M_EDGE_LISTS ||
			streamID == M_POSES ||
			streamID == M_ANIMATIONS ||
			streamID == M_TABLE_EXTREMES))
		{
			switch(streamID)
			{
			case M_GEOMETRY:
				{
					//MessageBoxW(NULL, L"M_GEOMETRY",	L"readMesh",0);
					readGeometry(pRead, sharedSubMesh);
				}
				break;
			case M_SUBMESH:
				readSubMesh(pRead, pModelData, sharedSubMesh);
				break;
			case M_MESH_SKELETON_LINK:
				{
					std::string skelName = readString(pRead);

					// 				if(listener)
					// 					listener->processSkeletonName(pMesh, &skelName);
					// 
					// 				pMesh->setSkeletonName(skelName);
					//readSkeletonLink(stream, pMesh, listener);
				}
				break;
			case M_MESH_BONE_ASSIGNMENT:
				//readMeshBoneAssignment(stream, pMesh);
				{
					VertexBoneAssignment assign;

					// unsigned int vertexIndex;
					pRead->Read(&(assign.vertexIndex),sizeof(unsigned int));
					// unsigned short boneIndex;
					pRead->Read(&(assign.boneIndex),sizeof(unsigned short));
					// float weight;
					pRead->Read(&(assign.weight),sizeof(float));

					//sub->addBoneAssignment(assign);
				}
				break;
			case M_MESH_LOD:
				MessageBoxW(NULL,L"M_MESH_LOD",0,0);
				//readMeshLodInfo(stream, pMesh);
				break;
			case M_MESH_BOUNDS:
				//readBoundsInfo(stream, pMesh);
				{
					Vec3D min, max;
					// float minx, miny, minz
					pRead->Read(&min,sizeof(Vec3D));
					// float maxx, maxy, maxz
					pRead->Read(&max,sizeof(Vec3D));
					//AxisAlignedBox box(min, max);
					//pMesh->_setBounds(box, true);
					// float radius
					float radius;
					pRead->Read(&radius,sizeof(float));
					//pMesh->_setBoundingSphereRadius(radius);
				}
				break;
			case M_SUBMESH_NAME_TABLE:
				MessageBoxW(NULL,L"M_SUBMESH_NAME_TABLE",0,0);
				//readSubMeshNameTable(stream, pMesh);
				break;
			case M_EDGE_LISTS:
				MessageBoxW(NULL,L"M_EDGE_LISTS",0,0);
				//readEdgeList(stream, pMesh);
				break;
			case M_POSES:
				MessageBoxW(NULL,L"M_POSES",0,0);
				//readPoses(stream, pMesh);
				break;
			case M_ANIMATIONS:
				MessageBoxW(NULL,L"M_ANIMATIONS",0,0);
				//readAnimations(stream, pMesh);
				break;
			case M_TABLE_EXTREMES:
//.........这里部分代码省略.........
开发者ID:50059021,项目名称:wodegongjubao,代码行数:101,代码来源:MyPlug.cpp


示例5: UJSON_parse

int UJSON_parse(PT_uJson pJson)
{
    int c;
    T_UJSON_State state = UJSON_ST_NONE;

    if (!pJson || !pJson->getChar || !pJson->pPair || !pJson->pValue)
        return -1;

    while (1)
    {
        // read next character
        c = getChar(pJson);
        if (c < 0)
            break;

        // skip spaces
        if (isspace(c))
            continue;

        switch (c)
        {
            // start of object
            case '{':
                state = UJSON_ST_NONE;
                pJson->objectDepth++;
                if (pJson->startObject)
                    pJson->startObject(pJson);
                break;

            // end of object
            case '}':
                pJson->objectDepth--;
                if (pJson->endObject)
                    pJson->endObject(pJson);
                break;

            // start of array
            case '[':
                state = UJSON_ST_ARRAY;
                if (pJson->startArray)
                    pJson->startArray(pJson);
                break;

            // end of array
            case ']':
                if (pJson->endArray)
                    pJson->endArray(pJson);
                state = UJSON_ST_NONE;
                break;

            // start of a pair or value
            case '"':
                if (state == UJSON_ST_NONE)
                {
                    // start of pair
                    c = readString(pJson, pJson->pPair, pJson->pairSize);
                    if (pJson->startPair)
                        pJson->startPair(pJson, pJson->pPair);
                }
                else if (state == UJSON_ST_VALUE || state == UJSON_ST_ARRAY)
                {
                    // start of value
                    c = readString(pJson, pJson->pValue, pJson->valueSize);
                    if (pJson->value)
                        pJson->value(pJson, pJson->pPair, pJson->pValue);
                    // if we are in an array there may be more values coming
                    if (state != UJSON_ST_ARRAY)
                        state = UJSON_ST_NONE;
                }
                break;

            // value coming
            case ':':
                state = UJSON_ST_VALUE;
                break;

            // next value inside an array coming
            case ',':
                if (state != UJSON_ST_ARRAY)
                    state = UJSON_ST_NONE;
                break;

            default:
                if (state == UJSON_ST_VALUE || state == UJSON_ST_ARRAY)
                {
                    c = readValue(pJson, pJson->pValue, pJson->valueSize, c);
                    if (pJson->value)
                        pJson->value(pJson, pJson->pPair, pJson->pValue);
                }
                break;
        }

        if (c < 0)
            break;
    }

    return 0;
}
开发者ID:BourgeoisLab,项目名称:OSC-webgate,代码行数:98,代码来源:ujsonpars.c


示例6: readString

long long IniParser::readInt64(const string &sectStr, const string &keyStr)
{
	string str = readString(sectStr, keyStr);
	return atoll(str.c_str());
}
开发者ID:borneq,项目名称:IniParser,代码行数:5,代码来源:IniParser.cpp


示例7: readText

 int readText(const char* context, const char* key, string* pvalue=nullptr, time_t* pexpiration=nullptr, int version=0) {
   return readString(context, key, pvalue, pexpiration, version);
 }
开发者ID:svn2github,项目名称:cpp-sp,代码行数:3,代码来源:memcache-store.cpp


示例8: js_read

OBJ
js_read(OBJ inStream){

	OBJ retVal;
	prompt_off();
	char ch = skipWhiteSpace(inStream);

	if( ch == -1){
		retVal = js_eof;
		unreadChar(inStream, ch);
	}
	else if(ch == '('){
		retVal = readList(inStream);
	}
	else if(ch =='\''){
		OBJ expr = js_read(inStream);

		// (quote (expr* (nil))) -> expr must be a cons
		return newCons(symbolTableGetOrAdd("quote"), 
				newCons(expr, js_nil));
	}
	else if(ch == '"'){
		retVal = readString(inStream);
	}
	else if(isDigit(ch)){
		retVal = readNumber(inStream, ch, 0);
	
	}else if(ch == '-'){
		/*
		 * TO-DO refactor: implement proper read ahead solution
		 */
		// simple read ahead to catch negative numbers
		char nextCh = nextChar(inStream);
		if(isDigit(nextCh)){
			retVal = readNumber(inStream, nextCh, 1);	
		}else{
			unreadChar(inStream, nextCh);
			retVal = readSymbol(inStream, ch);
		}
	}
#ifdef DEBUG
	else if(ch == '%'){
		ch = nextChar(inStream);
		OBJ debugOption;
		if(ch == '\n' ){
		       	unreadChar(inStream, ch);
			debugOption = newSymbol("");
		}else{
			debugOption = readSymbol(inStream, ch);
		}
		switchDebugOptions( debugOption );
		retVal = js_void;
	}
#endif
	else {
		retVal = readSymbol(inStream, ch);
	}
	
	if(thisIsTheEnd(inStream)){
		prompt_on();
	};

	return retVal;
}
开发者ID:JohannesTheo,项目名称:JScheme,代码行数:64,代码来源:reader.c


示例9: OSG_OGRE_LOG

void
OgreMeshReader::readSubMesh(SubMeshStore       &subMeshInfo,
                            VertexElementStore &sharedVertexElements,
                            bool                skelAnim             )
{
    OSG_OGRE_LOG(("OgreMeshReader::readSubMesh\n"));

    subMeshInfo.push_back((SubMeshInfo()));
    SubMeshInfo &smInfo = subMeshInfo.back();

    smInfo.matName       = readString(_is);
    smInfo.sharedVertex  = readBool  (_is);
    UInt32      idxCount = readUInt32(_is);
    bool        idx32Bit = readBool  (_is);

    OSG_OGRE_LOG(("OgreMeshReader::readSubMesh: matName '%s' sharedVert '%d' "
                  "idxCount '%d' idx32Bit '%d'\n",
                  smInfo.matName.c_str(), smInfo.sharedVertex, idxCount, idx32Bit));

    smInfo.skelAnim = skelAnim;
    smInfo.meshOp   = SMO_TRIANGLE_LIST;

    if(idx32Bit == true)
    {
        GeoUInt32PropertyUnrecPtr pi = GeoUInt32Property::create();
        pi->resize(idxCount);

        _is.read(reinterpret_cast<Char8 *>(&pi->editField().front()),
                 idxCount * sizeof(UInt32));

        smInfo.propIdx = pi;
    }
    else
    {
        GeoUInt16PropertyUnrecPtr pi = GeoUInt16Property::create();
        pi->resize(idxCount);

        _is.read(reinterpret_cast<Char8 *>(&pi->editField().front()),
                 idxCount * sizeof(UInt16));

        smInfo.propIdx = pi;
    }

    Int16 boneIdxVE    = -1;
    Int16 boneWeightVE = -1;
    bool  stop         = false;

    while(_is)
    {
        readChunkHeader(_is);

        switch(_header.chunkId)
        {
        case CHUNK_GEOMETRY:
            readGeometry(smInfo.vertexElements);
            break;

        case CHUNK_SUBMESH_OPERATION:
            readSubMeshOperation(smInfo);
            break;

        case CHUNK_SUBMESH_BONE_ASSIGNMENT:
            readSubMeshBoneAssignment(smInfo, boneIdxVE, boneWeightVE);
            break;

        case CHUNK_SUBMESH_TEXTURE_ALIAS:
            readSubMeshTextureAlias();
            break;

        default:
            OSG_OGRE_LOG(("OgreMeshReader::readSubMesh: Unknown chunkId '0x%x'\n",
                          _header.chunkId));
            stop = true;
            break;
        };

        if(stop == true)
        {
            skip(_is, -_chunkHeaderSize);
            break;
        }
    }

    if(boneIdxVE >= 0 || boneWeightVE >= 0)
    {
        verifyBoneAssignment(smInfo.vertexElements, boneIdxVE, boneWeightVE);
    }
}
开发者ID:jondo2010,项目名称:OpenSG,代码行数:88,代码来源:OSGOgreMeshReader.cpp


示例10: readString

std::string NewickTreeReader::readName(std::istream &in) const
{
  return readString(in);
}
开发者ID:Cactusolo,项目名称:bamm,代码行数:4,代码来源:NewickTreeReader.cpp


示例11: atof

double NewickTreeReader::readNumber(std::istream &in) const
{
  return atof(readString(in).c_str());
}
开发者ID:Cactusolo,项目名称:bamm,代码行数:4,代码来源:NewickTreeReader.cpp


示例12: getText

 void getText(T& val) const { readString(text_, val);}
开发者ID:andrescodas,项目名称:casadi,代码行数:1,代码来源:xml_node.hpp


示例13: readMaterial

int readMaterial()
{
	printInt(8);
	printInt(2);

	//Placeholder for length
	printBytes("\xFF\xFF\xFF\xFF", 4);

	int beginningOffset = ftell(output);

	readNothing("*MATERIAL");

	openBracket();

	int matRefNo = readInt("*MATERIAL_REF_NO");
	char* matName = readString("*MATERIAL_NAME");
	char* matClass = readString("*MATERIAL_CLASS");
	char* matAmbient = readRGB("*MATERIAL_AMBIENT");
	char* matDiffuse = readRGB("*MATERIAL_DIFFUSE");
	char* matSpecular = readRGB("*MATERIAL_SPECULAR");
	float matShine = readFloat("*MATERIAL_SHINE");
	float matShineStrength = readFloat("*MATERIAL_SHINESTRENGTH");
	float matTransparency = readFloat("*MATERIAL_TRANSPARENCY");
	/*float matTransparency;
	bracketize();
	char* buffer = (char*) malloc(sizeof(char)* 24);
	int offset = ftell(input);*/
	float matWireSize = readFloat("*MATERIAL_WIRESIZE");
	char* matShading = readString("*MATERIAL_SHADING");
	float matXPFallof = readFloat("*MATERIAL_XP_FALLOF");
	float matSelfIllum = readFloat("*MATERIAL_SELFILLUM");
	char* matFallof = readString("*MATERIAL_FALLOF");
	char* matXPType = readString("*MATERIAL_XP_TYPE");

	printInt(matRefNo);
	printString(matName);
	printString(matClass);
	printBytes(matAmbient, 4);
	printBytes(matDiffuse, 4);
	printBytes(matSpecular, 4);
	printFloat(matShine);
	printFloat(matShineStrength);
	printFloat(matTransparency);
	printFloat(matWireSize);

	if(!strncmp(matShading, "Blinn", 5))
		printInt(12);
	else
		printInt(0);

	printFloat(matXPFallof);
	printFloat(matSelfIllum);

	if(!strncmp(matFallof, "In", 2))
		printInt(1);
	else
		printInt(0);

	if(!strncmp(matXPType, "Filter", 6))
		printInt(1);
	else
		printInt(0);

	char* nextType = (char*)malloc(sizeof(char)*32);

	int numMaterials = 0;
	int numTextures = 0;

	int tParsed = 0;
	int mParsed = 0;

	while(1)
	{
		int currentOffset = ftell(input);
		fscanf(input, "%s\n", nextType);
		if(!strncmp(nextType, "*TEXTURE_LIST", 14) && tParsed == 0)
		{
			//Placeholder for number of textures
			int numTexturesOffset = ftell(output);
			printBytes("\xDE\xAD\xBE\xEF", 4);

			numTextures += readTextureList();

			int afterTextureList = ftell(output);
			fseek(output, numTexturesOffset, 0);
			printInt(numTextures);
			fseek(output, afterTextureList, 0);
			mParsed = 1;
		}
		else if(tParsed == 0)
		{
			tParsed = 1;
			printInt(0);
		}

		if(!strncmp(nextType, "*MATERIAL_LIST", 14) && mParsed == 0)
		{
			//Placeholder for number of textures
			int numMaterialsOffset = ftell(output);
			printBytes("\xDE\xAD\xBE\xEF", 4);
//.........这里部分代码省略.........
开发者ID:Shima33,项目名称:gmftoolkit,代码行数:101,代码来源:comMaterialFunctions.cpp


示例14: readTexture

int readTexture()
{
	printInt(15);
	printInt(4);
	printBytes("\xFF\xFF\xFF\xFF", 4);
	int beginningOffset = ftell(output);


	readNothing("*TEXTURE");
	openBracket();
	char* mapName = readString("*MAP_NAME");
	char* mapClass = readString("*MAP_CLASS");
	char* mapBitmap = readString("*BITMAP");
	float mapAmount = readFloat("*MAP_AMOUNT");	
	char* mapStyle = (char*)malloc(sizeof(char)*32);
	bracketize(); fscanf(input, "%s\n", mapStyle);
	char* mapType = readString("*MAP_TYPE");
	float mapUO = readFloat("*UVW_U_OFFSET");
	float mapVO = readFloat("*UVW_V_OFFSET");
	float mapUT = readFloat("*UVW_U_TILING");
	float mapVT = readFloat("*UVW_V_TILING");
	float mapAngle = readFloat("*UVW_ANGLE");
	float mapBlur = readFloat("*UVW_BLUR");
	float mapBlurOffset = readFloat("*UVW_BLUR_OFFSET");
	float mapNoiseAmount = readFloat("*UVW_NOISE_AMT");
	float mapNoiseSize = readFloat("*UVW_NOISE_SIZE");
	int mapNoiseLevel = readInt("*UVW_NOISE_LEVEL");
	float mapNoisePhase = readFloat("*UVW_NOISE_PHASE");
	char* mapBitmapFilter = readString("*BITMAP_FILTER");
	int mapBitmapMapChannel = readInt("*BITMAP_MAP_CHANNEL");

	printString(mapName);
	printString(mapClass);
	printString(mapBitmap);
	printFloat(mapAmount);
	if (!strncmp(mapStyle, "*MAP_DIFFUSE", 12))
		printInt(1);
	else if (!strncmp(mapStyle, "*MAP_SELFILLUM", 14))
		printInt(5);
	else if (!strncmp(mapStyle, "*MAP_OPACITY", 12))
		printInt(6);
	else
		printInt(1);

	if (!strncmp(mapType, "Screen", 6))
		printInt(4);
	else
		printInt(0);
	printFloat(mapUO);
	printFloat(mapVO);
	printFloat(mapUT);
	printFloat(mapVT);
	printFloat(mapAngle);
	printFloat(mapBlur);
	printFloat(mapBlurOffset);
	printFloat(mapNoiseAmount);
	printFloat(mapNoiseSize);
	printInt(mapNoiseLevel);
	printFloat(mapNoisePhase);
	if (!strncmp(mapBitmapFilter, "SAT", 3))
	{
		printInt(0);
		printInt(0);
		printInt(1);
	}
	else
	{
		printInt(0);
		printInt(0);
		printInt(0);
	}
	printInt(mapBitmapMapChannel);
	printInt(0);

	closeBracket();


	int endOffset = ftell(output);
	int size = endOffset - beginningOffset;
	fseek(output, beginningOffset - 4, 0);	
	printInt(size);
	fseek(output, endOffset, 0);
	return 0;
}
开发者ID:Shima33,项目名称:gmftoolkit,代码行数:84,代码来源:comMaterialFunctions.cpp


示例15: writeOpcode

std::string
RemotePluginClient::getMaker()
{
    writeOpcode(m_controlRequestFd, RemotePluginGetMaker);
    return readString(m_controlResponseFd);
}
开发者ID:GomesMarcos,项目名称:dssi-vst,代码行数:6,代码来源:remotepluginclient.cpp


示例16: addPhase

bool WalkingEngineKick::load(const char* filePath, char* buf)
{
  initialized = false;

  int lineNumber = 0;
  bool error = false;

  for(int i = 0; i < numOfTracks; ++i)
  {
    tracks[i].clear();
    addPhase(Track(i), 0);
  }

  while(*buf)
  {
    ++lineNumber;

    try
    {
      while(*buf == ' ' || *buf == '\t')
        ++buf;

      if(*buf != '#' && *buf != ';' && *buf != '\r' && *buf != '\n')
      {
        String str = readString(buf);
        if(str == "setType")
        {
          String str = readString(buf);
          if(str == "standing")
            standKick = true;
          else if(str == "walking")
            standKick = false;
          else
            throw ParseException("expected 'standing' or 'walking'");
        }
        else if(str == "setPreStepSize")
        {
          preStepSizeXValue = readValue(buf);
          preStepSizeYValue = readValue(buf);
          preStepSizeZValue = readValue(buf);
          readValue(buf);
          readValue(buf);
          preStepSizeRValue = readValue(buf);
        }
        else if(str == "setStepSize")
        {
          stepSizeXValue = readValue(buf);
          stepSizeYValue = readValue(buf);
          stepSizeZValue = readValue(buf);
          readValue(buf);
          readValue(buf);
          stepSizeRValue = readValue(buf);
        }
        else if(str == "setDuration")
        {
          durationValue = readValue(buf);
        }
        else if(str == "setRefX")
        {
          refXValue = readValue(buf);
        }
        else if(str == "proceed")
        {
          Value* value = readValue(buf);
          for(int i = 0; i < numOfTracks; ++i)
          {
            Phase& lastPhase = tracks[i].back();
            if(!lastPhase.lengthValue)
              lastPhase.lengthValue = value;
            else
              lastPhase.lengthValue = new PlusExpression(*lastPhase.lengthValue, *value, *this);
          }
        }
        else if(str == "setLeg")
        {
          addPhase(footTranslationX, readValue(buf));
          addPhase(footTranslationY, readValue(buf));
          addPhase(footTranslationZ, readValue(buf));
          addPhase(footRotationX, readValue(buf));
          addPhase(footRotationY, readValue(buf));
          addPhase(footRotationZ, readValue(buf));
        }
        else if(str == "setArms")
        {
          addPhase(lShoulderPitch, readValue(buf));
          addPhase(lShoulderRoll, readValue(buf));
          addPhase(lElbowYaw, readValue(buf));
          addPhase(lElbowRoll, readValue(buf));
          addPhase(rShoulderPitch, readValue(buf));
          addPhase(rShoulderRoll, readValue(buf));
          addPhase(rElbowYaw, readValue(buf));
          addPhase(rElbowRoll, readValue(buf));
        }
        else if(str == "setHead")
        {
          addPhase(headYaw, readValue(buf));
          addPhase(headPitch, readValue(buf));
        }
        else
          throw ParseException("expected keyword");
//.........这里部分代码省略.........
开发者ID:MisterSquishy,项目名称:nbites,代码行数:101,代码来源:WalkingEngineKick.cpp


示例17: setOrderStreet

void setOrderStreet(Order *orders, int pos) {
    readString(orders[pos].address.street, O_STREET_LENGTH, O_MSG_STREET);
}
开发者ID:vsctiago,项目名称:LP_EpR,代码行数:3,代码来源:Order.c


示例18: setOrderCity

void setOrderCity(Order *orders, int pos) {
    readString(orders[pos].address.city, O_CITY_LENGTH, O_MSG_CITY);
}
开发者ID:vsctiago,项目名称:LP_EpR,代码行数:3,代码来源:Order.c


示例19: switch


//.........这里部分代码省略.........
  case '|':
    currentToken.add(lastRead);
    readChar();
    if (lastRead == '=') {
      currentToken.add(lastRead);
      readChar();
      currentToken.type = Token::DASHMATCH;
    } else
      currentToken.type = Token::OTHER;
    break;
    
  case '/':
    currentToken.add(lastRead);
    readChar();
    if (readComment()) 
      currentToken.type = Token::COMMENT;
    else
      currentToken.type = Token::OTHER;
    break;
    
  case ';':
    currentToken.type = Token::DELIMITER;
    currentToken.add(lastRead);
    readChar();
    break;
  case ':':
    currentToken.type = Token::COLON;
    currentToken.add(lastRead);
    readChar();
    break;
  case '{':
    currentToken.type = Token::BRACKET_OPEN;
    currentToken.add(lastRead);
    readChar();
    break;
  case '}':
    currentToken.type = Token::BRACKET_CLOSED;
    currentToken.add(lastRead);
    readChar();
    break;
  case '(':
    currentToken.type = Token::PAREN_OPEN;
    currentToken.add(lastRead);
    readChar();
    break;
  case ')':
    currentToken.type = Token::PAREN_CLOSED;
    currentToken.add(lastRead);
    readChar();
    break;
  case '[':
    currentToken.type = Token::BRACE_OPEN;
    currentToken.add(lastRead);
    readChar();
    break;
  case ']':
    currentToken.type = Token::BRACE_CLOSED;
    currentToken.add(lastRead);
    readChar();
    break;
    
  case '.':
    currentToken.add(lastRead);
    readChar();
    if (readNum(false)) {
      currentToken.type = Token::NUMBER;
      readNumSuffix();
    } 
    break;

  default:
    if (readString()) 
      currentToken.type = Token::STRING;
    else if (readNum(true)) {
      currentToken.type = Token::NUMBER;
      readNumSuffix();

    } else if (readIdent()) {
      currentToken.type = Token::IDENTIFIER;

      if (currentToken.str == "url" && readUrl())
        currentToken.type = Token::URL;
      else if (currentToken.str == "u" && lastReadEq('+')) {
        currentToken.add(lastRead);
        readChar();
        currentToken.type = Token::UNICODE_RANGE;
        readUnicodeRange();
      }
    } else if (readWhitespace()) {
      currentToken.type = Token::WHITESPACE;
      while (readWhitespace()) {};
    } else {
      currentToken.add(lastRead);
      readChar();
    }
    break;
  }

  return currentToken.type;
}
开发者ID:smalyshev,项目名称:clessc,代码行数:101,代码来源:CssTokenizer.cpp


示例20: openAndReadCompanyFile

int openAndReadCompanyFile(char * path, company ** cmp, int index, graph * map) {

	FILE * file = fopen(path, "r");
	char * num = NULL;
	int airplaneQty = 0;
	int counter = 0;
	cmp[index] = NULL;
	char * str = NULL;

	if (file == NULL)
		return parserError(NULL, cmp[index], FILE_ERROR, file);

	num = readString(file, '\n');
	if (!isdigit(*num)) {
		free(num);
		return parserError(NULL, cmp[index], FILE_ERROR, file);
	}
	airplaneQty = atoi(num);
	cmp[index] = malloc(sizeof(company));

	if (cmp[index] == NULL)
		return parserError(NULL, cmp[index], MALLOC_ERROR, file);

	if (initializeCompany(cmp[index], airplaneQty) != EXIT_SUCCESS)
		return parserError(NULL, cmp[index], MALLOC_ERROR, file);

	if (readBlankLine(file) != EXIT_SUCCESS)
		return parserError(NULL, cmp[index], FILE_ERROR, file);

	for (counter = 0; counter < airplaneQty; counter++) {

		medList * list = NULL;

		int read = 0;

		str = readString(file, '\n');

		if (str == NULL)
			return parserError(NULL, cmp[index], FILE_ERROR, file);
		if (existsCity(str, map) == -1)
			return parserError(NULL, cmp[index], FILE_ERROR, file);

		if (addActualCity(cmp[index], str, counter) != EXIT_SUCCESS)
			return parserError(NULL, cmp[index], FILE_ERROR, file);

		list = createList();

		while ((read = fgetc(file)) != '\n' && read != EOF) {
			if (read != '\r') {
				char * medName = NULL;
				char * amount = NULL;

				fseek(file, -1, SEEK_CUR);

				medName = readString(file, ' ');
				amount = readString(file, '\n');

				if (medName == NULL || amount == NULL || !isdigit(*amount)) {
					if (amount != NULL)
						free(amount);
					if (medName != NULL)
						free(medName);
					if (list != NULL)
						freeMedList(list);
					return parserError(NULL, cmp[index], FILE_ERROR, file);
				}

				addMed(medName, atoi(amount), list);
				free(amount);
			}
		}
		addMedListToCompany(cmp[index], list, counter);
	}

	fclose(file);
	free(num);
	return EXIT_SUCCESS;
}
开发者ID:epintos,项目名称:os-p1,代码行数:78,代码来源:companyReader.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ readToken函数代码示例发布时间:2022-05-30
下一篇:
C++ readSocket函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap