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


C++ CScriptArgReader::ReadString方法代码示例

本文整理汇总了C++中CScriptArgReader::ReadString方法的典型用法代码示例。如果您正苦于以下问题:C++ CScriptArgReader::ReadString方法的具体用法?C++ CScriptArgReader::ReadString怎么用?C++ CScriptArgReader::ReadString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CScriptArgReader的用法示例。


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

示例1: argStream

int CLuaCryptDefs::Base64decode ( lua_State* luaVM )
{
    SString str;

    CScriptArgReader argStream ( luaVM );
    argStream.ReadString ( str );

    if ( !argStream.HasErrors () )
    {
        SString result = SharedUtil::Base64decode(str);
        lua_pushlstring ( luaVM, result, result.length () );
        return 1;
    }
    else
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );

    lua_pushboolean ( luaVM, false );
    return 1;
}
开发者ID:qaisjp,项目名称:mtasa-blue,代码行数:19,代码来源:CLuaCryptDefs.cpp

示例2: ReadPregFlags

//
// Read next as preg option flags
//
void ReadPregFlags( CScriptArgReader& argStream, pcrecpp::RE_Options& pOptions )
{
    if ( argStream.NextIsNumber() )
    {
        uint uiFlags = 0;
        argStream.ReadNumber ( uiFlags );
        pOptions.set_caseless ( ( uiFlags & 1 ) != 0 );
        pOptions.set_multiline ( ( uiFlags & 2 ) != 0 );
        pOptions.set_dotall ( ( uiFlags & 4 ) != 0 );
        pOptions.set_extended ( ( uiFlags & 8 ) != 0 );
        pOptions.set_utf8 ( ( uiFlags & 16 ) != 0 );
    }
    else
    if ( argStream.NextIsString() )
    {
        SString strFlags;
        argStream.ReadString ( strFlags );
        for( uint i = 0 ; i < strFlags.length() ; i++ )
        {
            switch ( strFlags[i] )
            {
                case 'i':
                    pOptions.set_caseless ( true );
                    break;
                case 'm':
                    pOptions.set_multiline ( true );
                    break;
                case 'd':
                    pOptions.set_dotall ( true );
                    break;
                case 'e':
                    pOptions.set_extended ( true );
                    break;
                case 'u':
                    pOptions.set_utf8 ( true );
                    break;
                default:
                    argStream.SetCustomError( "Flags all wrong" );
                    return;       
            }
        }
    }
}
开发者ID:StarSoftwareBuilder,项目名称:mtasa-blue,代码行数:46,代码来源:CLuaFunctionParseHelpers.cpp

示例3: argStream

int CLuaFunctionDefs::Base64encode ( lua_State* luaVM )
{
    SString str;

    CScriptArgReader argStream ( luaVM );
    argStream.ReadString ( str );

    if ( !argStream.HasErrors() )
    {
        SString result = Base64::encode ( str );
        lua_pushstring ( luaVM, result );
        return 1;
    }
    else
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );

    lua_pushboolean ( luaVM, false );
    return 1;
}
开发者ID:Bargas,项目名称:mtasa-blue,代码行数:19,代码来源:CLuaFunctionDefs.Util.cpp

示例4: OutputChatBox

int CLuaFunctionDefs::OutputChatBox ( lua_State* luaVM )
{
    // bool outputChatBox ( string text [, element visibleTo=getRootElement(), int r=231, int g=217, int b=176, bool colorCoded=false ] )
    SString ssChat;
    CElement* pElement;
    bool bColorCoded;
    // Default
    unsigned char ucRed = 231;
    unsigned char ucGreen = 217;
    unsigned char ucBlue = 176;

    CScriptArgReader argStream ( luaVM );
    argStream.ReadString ( ssChat );
    argStream.ReadUserData ( pElement, m_pRootElement );

    if ( argStream.NextIsNumber () && argStream.NextIsNumber ( 1 ) && argStream.NextIsNumber ( 2 ) )
    {
        argStream.ReadNumber ( ucRed );
        argStream.ReadNumber ( ucGreen );
        argStream.ReadNumber ( ucBlue );
    }
    else
        argStream.Skip ( 3 );

    argStream.ReadBool ( bColorCoded, false );

    if ( !argStream.HasErrors () )
    {
        CLuaMain* pLuaMain = m_pLuaManager->GetVirtualMachine ( luaVM );
        if ( pLuaMain )
        {
            CStaticFunctionDefinitions::OutputChatBox ( (const char*) ssChat, pElement, ucRed, ucGreen, ucBlue, bColorCoded, pLuaMain );
            lua_pushboolean ( luaVM, true );
            return 1;
        }
    }
    else
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );

    lua_pushboolean ( luaVM, false );
    return 1;
}
开发者ID:Bargas,项目名称:mtasa-blue,代码行数:42,代码来源:CLuaFunctionDefs.Server.cpp

示例5: xmlNodeSetName

int CLuaXMLDefs::xmlNodeSetName ( lua_State* luaVM )
{
    CXMLNode* pNode = nullptr;
    SString strTagName = "";
    CScriptArgReader argStream ( luaVM );
    argStream.ReadUserData ( pNode );
    argStream.ReadString ( strTagName );

    if ( !argStream.HasErrors () )
    {
        pNode->SetTagName ( strTagName );
        lua_pushboolean ( luaVM, true );
        return 1;
    }
    else
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );

    lua_pushboolean ( luaVM, false );
    return 1;
}
开发者ID:qaisjp,项目名称:mtasa-blue,代码行数:20,代码来源:CLuaXMLDefs.cpp

示例6: ExecuteSQLDropTable

int CLuaDatabaseDefs::ExecuteSQLDropTable ( lua_State* luaVM )
{
    SString strTable;

    CScriptArgReader argStream ( luaVM );
    argStream.ReadString ( strTable );

    if ( !argStream.HasErrors () )
    {
        CPerfStatSqliteTiming::GetSingleton ()->SetCurrentResource ( luaVM );
        CStaticFunctionDefinitions::ExecuteSQLDropTable ( strTable );
        lua_pushboolean ( luaVM, true );
        return 1;
    }
    else
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );

    lua_pushboolean ( luaVM, false );
    return 1;
}
开发者ID:ljnx86,项目名称:mtasa-blue,代码行数:20,代码来源:CLuaDatabaseDefs.cpp

示例7: GetWeaponIDFromName

int CLuaFunctionDefs::GetWeaponIDFromName ( lua_State* luaVM )
{
    SString strName = "";
    unsigned char ucID = 0;
    CScriptArgReader argStream ( luaVM );
    argStream.ReadString( strName );
    if ( !argStream.HasErrors ( ) )
    {
        if ( CStaticFunctionDefinitions::GetWeaponIDFromName ( strName, ucID ) )
        {
            lua_pushnumber ( luaVM, ucID );
            return 1;
        }
    }
    else
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage() );

    lua_pushboolean ( luaVM, false );
    return 1;
}
开发者ID:ntauthority,项目名称:openvice,代码行数:20,代码来源:CLuaFunctionDefs.Weapon.cpp

示例8: argStream

int CLuaCryptDefs::Sha256 ( lua_State* luaVM )
{
    //  string sha256 ( string str )
    SString strSourceData;

    CScriptArgReader argStream ( luaVM );
    argStream.ReadString ( strSourceData );

    if ( !argStream.HasErrors () )
    {
        SString strResult = GenerateSha256HexString ( strSourceData );
        lua_pushstring ( luaVM, strResult );
        return 1;
    }
    else
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );

    lua_pushboolean ( luaVM, false );
    return 1;
}
开发者ID:StarSoftwareBuilder,项目名称:mtasa-blue,代码行数:20,代码来源:CLuaCryptDefs.cpp

示例9: ExecuteBrowserJavascript

int CLuaFunctionDefs::ExecuteBrowserJavascript ( lua_State* luaVM )
{
//  bool executeBrowserJavascript ( browser webBrowser, string jsCode )
    CClientWebBrowser* pWebBrowser; SString strJavascriptCode;

    CScriptArgReader argStream ( luaVM );
    argStream.ReadUserData ( pWebBrowser );
    argStream.ReadString ( strJavascriptCode );

    if ( !argStream.HasErrors () )
    {
        lua_pushboolean ( luaVM, pWebBrowser->ExecuteJavascript ( strJavascriptCode ) );
        return 1;
    }
    else
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );

    lua_pushboolean ( luaVM, false );
    return 1;
}
开发者ID:Disinterpreter,项目名称:mtasa-blue,代码行数:20,代码来源:CLuaFunctionDefs.Browser.cpp

示例10: UtfCode

int CLuaFunctionDefs::UtfCode ( lua_State* luaVM )
{
    SString strInput = "";
    CScriptArgReader argStream ( luaVM );
    argStream.ReadString ( strInput );

    if ( !argStream.HasErrors ( ) )
    {
        std::wstring strUTF = MbUTF8ToUTF16(strInput);
        unsigned long ulCode = strUTF.c_str()[0];

        lua_pushnumber ( luaVM, ulCode );
        return 1;
    }
    else
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );

    lua_pushboolean ( luaVM, false );
    return 1;
}
开发者ID:Bargas,项目名称:mtasa-blue,代码行数:20,代码来源:CLuaFunctionDefs.Util.cpp

示例11: AddEventHandler

int CLuaFunctionDefs::AddEventHandler ( lua_State* luaVM )
{
//  bool addEventHandler ( string eventName, element attachedTo, function handlerFunction, [bool getPropagated = true] )
    SString strName; CClientEntity* pEntity; CLuaFunctionRef iLuaFunction; bool bPropagated;

    CScriptArgReader argStream ( luaVM );
    argStream.ReadString ( strName );
    argStream.ReadUserData ( pEntity );
    argStream.ReadFunction ( iLuaFunction );
    argStream.ReadBool ( bPropagated, true );
    argStream.ReadFunctionComplete ();

    if ( !argStream.HasErrors () )
    {
        // Grab our virtual machine
        CLuaMain* pLuaMain = m_pLuaManager->GetVirtualMachine ( luaVM );
        if ( pLuaMain )
        {
            // Check if the handle is in use
            if ( pEntity->GetEventManager()->HandleExists ( pLuaMain, strName, iLuaFunction ) )
            {
                m_pScriptDebugging->LogCustom ( luaVM, 255, 0, 0, "addEventHandler: '%s' with this function is already handled", *strName );
                lua_pushboolean ( luaVM, false );
                return 1;
            }

            // Do it
            if ( CStaticFunctionDefinitions::AddEventHandler ( *pLuaMain, strName, *pEntity, iLuaFunction, bPropagated ) )
            {
                lua_pushboolean ( luaVM, true );
                return 1;
            }
        }
    }
    else
        m_pScriptDebugging->LogCustom ( luaVM, SString ( "Bad argument @ '%s' [%s]", "addEventHandler", *argStream.GetErrorMessage () ) );

    // Failed
    lua_pushboolean ( luaVM, false );
    return 1;
}
开发者ID:EagleShen,项目名称:MTA,代码行数:41,代码来源:CLuaFunctionDefs.Event.cpp

示例12: fileDelete

int CLuaFileDefs::fileDelete ( lua_State* luaVM )
{
//  bool fileDelete ( string filePath )
    SString filePath;

    CScriptArgReader argStream ( luaVM );
    argStream.ReadString ( filePath );

    if ( !argStream.HasErrors () )
    {
        // Grab our lua VM
        CLuaMain* pLuaMain = m_pLuaManager->GetVirtualMachine ( luaVM );
        if ( pLuaMain )
        {
            std::string strPath;
            CResource* pResource = pLuaMain->GetResource ();
            if ( CResourceManager::ParseResourcePathInput ( filePath, pResource, strPath ) )
            {
                // Inform file verifier
                g_pClientGame->GetResourceManager()->FileModifedByScript( strPath );

                if ( FileDelete ( strPath.c_str () ) )
                {
                    // If file removed return success
                    lua_pushboolean ( luaVM, true );
                    return 1;
                }
                else
                {
                    // Output error
                    argStream.SetCustomError( SString( "unable to delete file '%s'", *filePath ) );
                }
            }
        }
    }
    if ( argStream.HasErrors () )
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage() );

    lua_pushboolean ( luaVM, false );
    return 1;
}
开发者ID:F420,项目名称:mtasa-blue,代码行数:41,代码来源:CLuaFileDefs.cpp

示例13: GetTeamFromName

int CLuaTeamDefs::GetTeamFromName ( lua_State* luaVM )
{
    SString strName = "";
    CScriptArgReader argStream ( luaVM );
    argStream.ReadString ( strName );

    if ( !argStream.HasErrors () )
    {
        CClientTeam* pTeam = m_pTeamManager->GetTeam ( strName );
        if ( pTeam )
        {
            lua_pushelement ( luaVM, pTeam );
            return 1;
        }
    }
    else
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );

    lua_pushboolean ( luaVM, false );
    return 1;
}
开发者ID:Jusonex,项目名称:mtasa-blue,代码行数:21,代码来源:CLuaTeamDefs.cpp

示例14: OutputServerLog

int CLuaFunctionDefs::OutputServerLog ( lua_State* luaVM )
{
    SString strMessage;

    CScriptArgReader argStream ( luaVM );
    argStream.ReadString ( strMessage );

    if ( !argStream.HasErrors () )
    {
        // Print it
        CLogger::LogPrintf ( LOGLEVEL_MEDIUM, "%s\n", strMessage.c_str () );
        lua_pushboolean ( luaVM, true );

        return 1;
    }
    else
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );

    lua_pushboolean ( luaVM, false );
    return 1;
}
开发者ID:Bargas,项目名称:mtasa-blue,代码行数:21,代码来源:CLuaFunctionDefs.Server.cpp

示例15: IsControlEnabled

int CLuaFunctionDefs::IsControlEnabled ( lua_State * luaVM )
{
    SString strControlState = "";
    CScriptArgReader argStream ( luaVM );
    argStream.ReadString ( strControlState );

    if ( !argStream.HasErrors ( ) )
    {
        bool bEnabled;
        if ( CStaticFunctionDefinitions::IsControlEnabled ( strControlState, bEnabled ) )
        {
            lua_pushboolean ( luaVM, bEnabled );
            return 1;
        }
    }
    else
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage() );

    lua_pushboolean ( luaVM, false );
    return 1;
}
开发者ID:AdiBoy,项目名称:mtasa-blue,代码行数:21,代码来源:CLuaFunctionDefs.Input.cpp


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