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


C++ READ_STRING函数代码示例

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


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

示例1: size

        skeleton::skeleton(std::istream & stream_, const uint32_t lod_count) : size(0) {
            READ_STRING(name);
            if (name.length() > 1) {
                READ_BOOL(inherited);
                stream_.read((char *)&size, sizeof(uint32_t));
                
                for (int x = 0; x < size; x++) {
                    std::string _name, _parent;

                    READ_STRING(_name);
                    READ_STRING(_parent);

                    all_bones.push_back(std::make_shared<bone>(_name, _parent));
                }

                for (auto& tbone : all_bones) {
                    for (auto& child : all_bones) {
                        if (child->parent == tbone->name) {
                            tbone->children.push_back(child->name);
                        }
                    }

                    if (tbone->parent.length() < 1) {
                        root_bones[tbone->name] = tbone;
                    }
                }

                // Skip a byte because!
                //stream_.seekg(1, stream_.cur);
                LOG(DEBUG) << "Skeleton loaded: " << name;
                char junk;
                stream_.read((char *)&junk, sizeof(uint8_t));
            }

        }
开发者ID:AgentRev,项目名称:ACE3,代码行数:35,代码来源:skeleton.cpp

示例2: load_debuginfo

static int load_debuginfo(struct load_state *S, ktap_proto *f)
{
	int i,n;

	f->source = READ_STRING(S);
	n = READ_INT(S);
	f->sizelineinfo = n;
	f->lineinfo = NEW_VECTOR(S, n * sizeof(int));
	READ_VECTOR(S, f->lineinfo, n * sizeof(int));
	n = READ_INT(S);
	f->locvars = NEW_VECTOR(S, n * sizeof(struct ktap_locvar));
	f->sizelocvars = n;
	for (i = 0; i < n; i++)
		f->locvars[i].varname = NULL;
	for (i = 0; i < n; i++) {
		f->locvars[i].varname = READ_STRING(S);
		f->locvars[i].startpc = READ_INT(S);
		f->locvars[i].endpc = READ_INT(S);
	}
	n = READ_INT(S);
	for (i = 0; i < n; i++)
		f->upvalues[i].name = READ_STRING(S);

	return 0;
}
开发者ID:rousya,项目名称:ktap,代码行数:25,代码来源:loader.c

示例3: MsgFunc_ShowMenu

// Message handler for ShowMenu message
// takes four values:
// short: a bitfield of keys that are valid input
// char : the duration, in seconds, the menu should stay up. -1 means is stays until something is chosen.
// byte : a boolean, TRUE if there is more string yet to be received before displaying the menu, FALSE if it's the last string
// string: menu string to display
// if this message is never received, then scores will simply be the combined totals of the players.
int CHudMenu :: MsgFunc_ShowMenu( const char *pszName, int iSize, void *pbuf )
{
	char *temp = NULL;

	BEGIN_READ( pszName, pbuf, iSize );

	m_bitsValidSlots = READ_SHORT();
	int DisplayTime = READ_CHAR();
	int NeedMore = READ_BYTE();

	if( DisplayTime > 0 )
		m_flShutoffTime = DisplayTime + gHUD.m_flTime;
	else
		m_flShutoffTime = -1;

	if( m_bitsValidSlots )
	{
		if( !m_fWaitingForMore )
		{
			// this is the start of a new menu
			Q_strncpy( g_szPrelocalisedMenuString, READ_STRING(), MAX_MENU_STRING );
		}
		else
		{
			// append to the current menu string
			Q_strncat( g_szPrelocalisedMenuString, READ_STRING(), MAX_MENU_STRING - Q_strlen( g_szPrelocalisedMenuString ));
		}
		g_szPrelocalisedMenuString[MAX_MENU_STRING-1] = 0;  // ensure null termination (strncat/strncpy does not)

		if( !NeedMore )
		{
			// we have the whole string, so we can localise it now
			Q_strcpy( g_szMenuString, gHUD.m_TextMessage.BufferedLocaliseTextString( g_szPrelocalisedMenuString ));

			// Swap in characters
			if( KB_ConvertString( g_szMenuString, &temp ))
			{
				Q_strcpy( g_szMenuString, temp );
				free( temp );
			}
		}

		m_fMenuDisplayed = 1;
		m_iFlags |= HUD_ACTIVE;
	}
	else
	{
		m_fMenuDisplayed = 0; // no valid slots means that the menu should be turned off
		m_iFlags &= ~HUD_ACTIVE;
	}

	m_fWaitingForMore = NeedMore;

	END_READ();

	return 1;
}
开发者ID:emileb,项目名称:XashXT,代码行数:64,代码来源:menu.cpp

示例4: READ_DWORD

bool CGuideHintTable::SetTableData(void* pvTable, WCHAR* pwszSheetName, std::wstring* pstrDataName, BSTR bstrData)
{
	if (0 == wcscmp(pwszSheetName, L"Table_Data_KOR"))
	{
		sGUIDE_HINT_TBLDAT* pGuide = (sGUIDE_HINT_TBLDAT*)pvTable;

		if (0 == wcscmp(pstrDataName->c_str(), L"Tblidx"))
		{
			pGuide->tblidx = READ_DWORD( bstrData );
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"Type"))
		{
			pGuide->byType = READ_BYTE( bstrData, pstrDataName->c_str() );
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"WidthPosition"))
		{
			pGuide->byWidthPosition = READ_BYTE( bstrData, pstrDataName->c_str() );
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"HeightPosition"))
		{
			pGuide->byHeightPosition = READ_BYTE( bstrData, pstrDataName->c_str() );
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"WidthSize"))
		{
			pGuide->wWidthSize = READ_WORD( bstrData, pstrDataName->c_str() );
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"HeightSize"))
		{
			pGuide->wHeightSize = READ_WORD( bstrData, pstrDataName->c_str() );
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"Resource"))
		{
			READ_STRING(bstrData, pGuide->szResource, _countof(pGuide->szResource));
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"Note"))
		{
			READ_STRING(bstrData, pGuide->szNote, _countof(pGuide->szNote));
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"Auto_Show"))
		{
			pGuide->bAutoShow = READ_BOOL( bstrData, pstrDataName->c_str() );
		}
		else
		{
			CTable::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str());
			return false;
		}
	}
	else
	{
		return false;
	}

	return true;
}
开发者ID:JunRyuu,项目名称:AKCore,代码行数:55,代码来源:GuideHintTable.cpp

示例5: BEGIN_READ

// Message handler for text messages
// displays a string, looking them up from the titles.txt file, which can be localised
// parameters:
//   byte:   message direction  ( HUD_PRINTCONSOLE, HUD_PRINTNOTIFY, HUD_PRINTCENTER, HUD_PRINTTALK )
//   string: message
// optional parameters:
//   string: message parameter 1
//   string: message parameter 2
//   string: message parameter 3
//   string: message parameter 4
// any string that starts with the character '#' is a message name, and is used to look up the real message in titles.txt
// the next (optional) one to four strings are parameters for that string (which can also be message names if they begin with '#')
int CHudTextMessage::MsgFunc_TextMsg( const char *pszName, int iSize, void *pbuf )
{
	BEGIN_READ( pbuf, iSize );

	int msg_dest = READ_BYTE();

#define MSG_BUF_SIZE 128
	static char szBuf[6][MSG_BUF_SIZE];
	char *msg_text = LookupString( READ_STRING(), &msg_dest );
	msg_text = safe_strcpy( szBuf[0], msg_text , MSG_BUF_SIZE);

	// keep reading strings and using C format strings for subsituting the strings into the localised text string
	char *sstr1 = LookupString( READ_STRING() );
	sstr1 = safe_strcpy( szBuf[1], sstr1 , MSG_BUF_SIZE);
	StripEndNewlineFromString( sstr1 );  // these strings are meant for subsitution into the main strings, so cull the automatic end newlines
	char *sstr2 = LookupString( READ_STRING() );
	sstr2 = safe_strcpy( szBuf[2], sstr2 , MSG_BUF_SIZE);
	StripEndNewlineFromString( sstr2 );
	char *sstr3 = LookupString( READ_STRING() );
	sstr3 = safe_strcpy( szBuf[3], sstr3 , MSG_BUF_SIZE);
	StripEndNewlineFromString( sstr3 );
	char *sstr4 = LookupString( READ_STRING() );
	sstr4 = safe_strcpy( szBuf[4], sstr4 , MSG_BUF_SIZE);
	StripEndNewlineFromString( sstr4 );
	char *psz = szBuf[5];

	if ( gViewPort && gViewPort->AllowedToPrintText() == FALSE )
		return 1;

	switch ( msg_dest )
	{
	case HUD_PRINTCENTER:
		safe_sprintf( psz, MSG_BUF_SIZE, msg_text, sstr1, sstr2, sstr3, sstr4 );
		CenterPrint( ConvertCRtoNL( psz ) );
		break;

	case HUD_PRINTNOTIFY:
		psz[0] = 1;  // mark this message to go into the notify buffer
		safe_sprintf( psz+1, MSG_BUF_SIZE, msg_text, sstr1, sstr2, sstr3, sstr4 );
		ConsolePrint( ConvertCRtoNL( psz ) );
		break;

	case HUD_PRINTTALK:
		safe_sprintf( psz, MSG_BUF_SIZE, msg_text, sstr1, sstr2, sstr3, sstr4 );
		gHUD.m_SayText.SayTextPrint( ConvertCRtoNL( psz ), 128 );
		break;

	case HUD_PRINTCONSOLE:
		safe_sprintf( psz, MSG_BUF_SIZE, msg_text, sstr1, sstr2, sstr3, sstr4 );
		ConsolePrint( ConvertCRtoNL( psz ) );
		break;
	}

	return 1;
}
开发者ID:6779660,项目名称:halflife,代码行数:67,代码来源:text_message.cpp

示例6: READ_STRING

 ext_entry::ext_entry(std::istream &stream_) {
     std::string key, val;
     READ_STRING(key);
     
     while (key != "") {
         READ_STRING(val);
         header[key] = val;
         READ_STRING(key);
     }
     
 }
开发者ID:IDI-Systems,项目名称:acre2,代码行数:11,代码来源:archive.cpp

示例7: loadPoleVectorConstraintNode

static AnimNode::Pointer loadPoleVectorConstraintNode(const QJsonObject& jsonObj, const QString& id, const QUrl& jsonUrl) {
    READ_VEC3(referenceVector, jsonObj, id, jsonUrl, nullptr);
    READ_BOOL(enabled, jsonObj, id, jsonUrl, nullptr);
    READ_STRING(baseJointName, jsonObj, id, jsonUrl, nullptr);
    READ_STRING(midJointName, jsonObj, id, jsonUrl, nullptr);
    READ_STRING(tipJointName, jsonObj, id, jsonUrl, nullptr);
    READ_STRING(enabledVar, jsonObj, id, jsonUrl, nullptr);
    READ_STRING(poleVectorVar, jsonObj, id, jsonUrl, nullptr);

    auto node = std::make_shared<AnimPoleVectorConstraint>(id, enabled, referenceVector,
                                                           baseJointName, midJointName, tipJointName,
                                                           enabledVar, poleVectorVar);
    return node;
}
开发者ID:Nex-Pro,项目名称:hifi,代码行数:14,代码来源:AnimNodeLoader.cpp

示例8: READ_STRING

        ext_entry::ext_entry(std::istream &stream_) {
            READ_STRING(name);
            READ_STRING(data);
            READ_STRING(version);

            std::string temp;
            temp = version;
            
            while (temp != "") {
                extras.push_back(temp);
                READ_STRING(temp);
            }
            
        }
开发者ID:Beastion01,项目名称:ACE3,代码行数:14,代码来源:archive.cpp

示例9: loadManipulatorNode

static AnimNode::Pointer loadManipulatorNode(const QJsonObject& jsonObj, const QString& id, const QUrl& jsonUrl) {

    READ_FLOAT(alpha, jsonObj, id, jsonUrl, nullptr);
    auto node = std::make_shared<AnimManipulator>(id, alpha);

    READ_OPTIONAL_STRING(alphaVar, jsonObj);
    if (!alphaVar.isEmpty()) {
        node->setAlphaVar(alphaVar);
    }

    auto jointsValue = jsonObj.value("joints");
    if (!jointsValue.isArray()) {
        qCCritical(animation) << "AnimNodeLoader, bad array \"joints\" in controller node, id =" << id;
        return nullptr;
    }

    auto jointsArray = jointsValue.toArray();
    for (const auto& jointValue : jointsArray) {
        if (!jointValue.isObject()) {
            qCCritical(animation) << "AnimNodeLoader, bad state object in \"joints\", id =" << id;
            return nullptr;
        }
        auto jointObj = jointValue.toObject();

        READ_STRING(jointName, jointObj, id, jsonUrl, nullptr);
        READ_STRING(rotationType, jointObj, id, jsonUrl, nullptr);
        READ_STRING(translationType, jointObj, id, jsonUrl, nullptr);
        READ_STRING(rotationVar, jointObj, id, jsonUrl, nullptr);
        READ_STRING(translationVar, jointObj, id, jsonUrl, nullptr);

        AnimManipulator::JointVar::Type jointVarRotationType = stringToAnimManipulatorJointVarType(rotationType);
        if (jointVarRotationType == AnimManipulator::JointVar::Type::NumTypes) {
            qCWarning(animation) << "AnimNodeLoader, bad rotationType in \"joints\", id =" << id;
            jointVarRotationType = AnimManipulator::JointVar::Type::Default;
        }

        AnimManipulator::JointVar::Type jointVarTranslationType = stringToAnimManipulatorJointVarType(translationType);
        if (jointVarTranslationType == AnimManipulator::JointVar::Type::NumTypes) {
            qCWarning(animation) << "AnimNodeLoader, bad translationType in \"joints\", id =" << id;
            jointVarTranslationType = AnimManipulator::JointVar::Type::Default;
        }

        AnimManipulator::JointVar jointVar(jointName, jointVarRotationType, jointVarTranslationType, rotationVar, translationVar);
        node->addJointVar(jointVar);
    };

    return node;
}
开发者ID:Nex-Pro,项目名称:hifi,代码行数:48,代码来源:AnimNodeLoader.cpp

示例10: loadOverlayNode

static AnimNode::Pointer loadOverlayNode(const QJsonObject& jsonObj, const QString& id, const QUrl& jsonUrl) {

    READ_STRING(boneSet, jsonObj, id, jsonUrl, nullptr);
    READ_FLOAT(alpha, jsonObj, id, jsonUrl, nullptr);

    auto boneSetEnum = stringToBoneSetEnum(boneSet);
    if (boneSetEnum == AnimOverlay::NumBoneSets) {
        qCCritical(animation) << "AnimNodeLoader, unknown bone set =" << boneSet << ", defaulting to \"fullBody\"";
        boneSetEnum = AnimOverlay::FullBodyBoneSet;
    }

    READ_OPTIONAL_STRING(boneSetVar, jsonObj);
    READ_OPTIONAL_STRING(alphaVar, jsonObj);

    auto node = std::make_shared<AnimOverlay>(id, boneSetEnum, alpha);

    if (!boneSetVar.isEmpty()) {
        node->setBoneSetVar(boneSetVar);
    }
    if (!alphaVar.isEmpty()) {
        node->setAlphaVar(alphaVar);
    }

    return node;
}
开发者ID:Nex-Pro,项目名称:hifi,代码行数:25,代码来源:AnimNodeLoader.cpp

示例11: MsgFunc_MOTD

int CHudMOTD :: MsgFunc_MOTD( const char *pszName, int iSize, void *pbuf )
{
	if( m_iFlags & HUD_ACTIVE )
	{
		Reset(); // clear the current MOTD in prep for this one
	}

	BEGIN_READ( pszName, pbuf, iSize );

	int is_finished = READ_BYTE();
	Q_strcat( m_szMOTD, READ_STRING( ));

	if( is_finished )
	{
		m_iFlags |= HUD_ACTIVE;

		MOTD_DISPLAY_TIME = CVAR_GET_FLOAT( "motd_display_time" );

		m_flActiveTill = gHUD.m_flTime + MOTD_DISPLAY_TIME;

		// count the number of lines in the MOTD
		for( char *sz = m_szMOTD; *sz != 0; sz++ )
			if( *sz == '\n' ) m_iLines++;
	}

	END_READ();

	return 1;
}
开发者ID:XashDev,项目名称:XashXT,代码行数:29,代码来源:motd.cpp

示例12: BEGIN_READ

//
// WeaponList -- Tells the hud about a new weapon type.
//
int CHudAmmo::MsgFunc_WeaponList(const char *pszName, int iSize, void *pbuf)
{
	BEGIN_READ(pbuf, iSize);

	WEAPON Weapon;

	strcpy(Weapon.szName, READ_STRING());
	Weapon.iAmmoType = (int)READ_CHAR();

	Weapon.iMax1 = READ_BYTE();
	if(Weapon.iMax1 == 255)
		Weapon.iMax1 = -1;

	Weapon.iAmmo2Type = READ_CHAR();
	Weapon.iMax2      = READ_BYTE();
	if(Weapon.iMax2 == 255)
		Weapon.iMax2 = -1;

	Weapon.iSlot    = READ_CHAR();
	Weapon.iSlotPos = READ_CHAR();
	Weapon.iId      = READ_CHAR();
	Weapon.iFlags   = READ_BYTE();
	Weapon.iClip    = 0;

	gWR.AddWeapon(&Weapon);

	return 1;
}
开发者ID:Sh1ft0x0EF,项目名称:HLSDKRevamp,代码行数:31,代码来源:ammo.cpp

示例13: BEGIN_READ

// Message handler for Secondary Ammo Value
// accepts one value:
//		string:  sprite name
int CHudAmmoSecondary::MsgFunc_SecAmmoIcon( const char *pszName, int iSize, void *pbuf )
{
	BEGIN_READ( pbuf, iSize );
	m_HUD_ammoicon = gHUD.GetSpriteIndex( READ_STRING() );

	return 1;
}
开发者ID:FWGS,项目名称:hlsdk-xash3d,代码行数:10,代码来源:ammo_secondary.cpp

示例14: BEGIN_READ

/*
====================
MsgCreateSystem

====================
*/
int CParticleEngine::MsgCreateSystem( const char *pszName, int iSize, void *pbuf ) 
{
	BEGIN_READ(pbuf, iSize);

	vec3_t pos;
	pos.x = READ_COORD();
	pos.y = READ_COORD();
	pos.z = READ_COORD();

	vec3_t ang;
	ang.x = READ_COORD();
	ang.y = READ_COORD();
	ang.z = READ_COORD();

	int iType = READ_BYTE();
	char *szPath = READ_STRING();
	int iId = READ_SHORT();

	if(iType == 2)
		RemoveSystem(iId);
	else if(iType == 1)
		CreateCluster(szPath, pos, ang, iId);
	else
		CreateSystem(szPath, pos, ang, iId);

	return 1;
}
开发者ID:RikkaW,项目名称:Trinity-Renderer,代码行数:33,代码来源:particle_engine.cpp

示例15: MsgFunc_PlayMP3

int CHud :: MsgFunc_PlayMP3( const char *pszName, int iSize, void *pbuf ) //AJH -Killar MP3
{
	BEGIN_READ( pbuf, iSize );

	gMP3.PlayMP3( READ_STRING() );

	return 1;
}
开发者ID:Hammermaps-DEV,项目名称:Spirit-of-Half-Life-1.8--VC2010,代码行数:8,代码来源:hud_msg.cpp


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