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


C++ MemoryBlock::append方法代码示例

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


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

示例1: constructConfirmation

void CtrlrMIDITransaction::constructConfirmation()
{
	MemoryBlock request;

	MemoryBlock prefix 	= getFormulaAsMemoryBlock(getProperty(Ids::transConfFormulaPrefix));
	MemoryBlock data   	= getConfirmationDataAsMemoryBlock();
	MemoryBlock suffix 	= getFormulaAsMemoryBlock(getProperty(Ids::transConfFormulaSuffix));

	if (prefix.getSize() > 0)
	{
		request.append (prefix.getData(), prefix.getSize());
	}

	if (data.getSize() > 0)
	{
		request.append (data.getData(), data.getSize());
	}

	if (suffix.getSize() > 0)
	{
		request.append (suffix.getData(), suffix.getSize());
	}

	setRequest (request);
}
开发者ID:gareth8118,项目名称:ctrlr,代码行数:25,代码来源:CtrlrMIDITransaction.cpp

示例2: constructResponseMask

void CtrlrMIDITransaction::constructResponseMask()
{
	MemoryBlock responseMask;

	MemoryBlock prefix 	= getFormulaAsMemoryBlock(getProperty(Ids::transRespFormulaPrefix));
	MemoryBlock data((int)getProperty(Ids::transRespDataLen), true);
	MemoryBlock suffix 	= getFormulaAsMemoryBlock(getProperty(Ids::transRespFormulaSuffix));
	MemoryBlock name	= getNameAsMemoryBlock();

	if (data.getSize() < name.getSize())
	{
		TRANS("["+getName()+"] CtrlrMIDITransaction::constructResponseMask data block will not fit name");
	}

	if (prefix.getSize() > 0)
	{
		responseMask.append (prefix.getData(), prefix.getSize());
	}

	if (data.getSize() > 0)
	{
		responseMask.append (data.getData(), data.getSize());
	}

	if (suffix.getSize() > 0)
	{
		responseMask.append (suffix.getData(), suffix.getSize());
	}

	setResponseMask (responseMask);
}
开发者ID:gareth8118,项目名称:ctrlr,代码行数:31,代码来源:CtrlrMIDITransaction.cpp

示例3: constructRequest

void CtrlrMIDITransaction::constructRequest()
{
	MemoryBlock request;

	MemoryBlock prefix 	= getFormulaAsMemoryBlock(getProperty(Ids::transReqFormulaPrefix));
	MemoryBlock data   	= getRequestDataAsMemoryBlock();
	MemoryBlock suffix 	= getFormulaAsMemoryBlock(getProperty(Ids::transReqFormulaSuffix));
	MemoryBlock name 	= getNameAsMemoryBlock();

	if (data.getSize() < name.getSize())
	{
		TRANS("["+getName()+"] CtrlrMIDITransaction::constructRequest data block will not fit name");
	}

	if (prefix.getSize() > 0)
	{
		request.append (prefix.getData(), prefix.getSize());
	}

	if (data.getSize() > 0)
	{
		request.append (data.getData(), data.getSize());
	}

	if (suffix.getSize() > 0)
	{
		request.append (suffix.getData(), suffix.getSize());
	}

	setRequest (request);
}
开发者ID:gareth8118,项目名称:ctrlr,代码行数:31,代码来源:CtrlrMIDITransaction.cpp

示例4: getStateInformation

void HelmPlugin::getStateInformation(MemoryBlock& dest_data) {
  var state = LoadSave::stateToVar(&synth_, gui_state_, getCallbackLock());
  String data_string = JSON::toString(state);
  MemoryOutputStream stream;
  stream.writeString(data_string);
  dest_data.append(stream.getData(), stream.getDataSize());
}
开发者ID:grimtraveller,项目名称:helm,代码行数:7,代码来源:helm_plugin.cpp

示例5: getStateInformation

//==============================================================================
void LumaPlug::getStateInformation (MemoryBlock& destData)
{
	/*
    // you can store your parameters as binary data if you want to or if you've got
    // a load of binary to put in there, but if you're not doing anything too heavy,
    // XML is a much cleaner way of doing it - here's an example of how to store your
    // params as XML..

    // create an outer XML element..
    XmlElement xmlState (T("MYPLUGINSETTINGS"));

    // add some attributes to it..
    xmlState.setAttribute (T("pluginVersion"), 1);
    //xmlState.setAttribute (T("gainLevel"), gain);
    xmlState.setAttribute (T("uiWidth"), lastUIWidth);
    xmlState.setAttribute (T("uiHeight"), lastUIHeight);

    // you could also add as many child elements as you need to here..


    // then use this helper function to stuff it into the binary blob and return it..
    copyXmlToBinary (xmlState, destData);
	*/
	
	const char* data = scriptText_.toUTF8();
	if (strlen(data) > 0)
	{
		destData.append(data, strlen(data));
	}
}
开发者ID:georgekrueger,项目名称:Luma,代码行数:31,代码来源:LumaPlug.cpp

示例6: beginRequestHandler

static int beginRequestHandler(struct mg_connection *conn) {
    enum BeginRequestHandlerReturnValues { HANDLED = 1, NOT_HANDLED = 0 };

    struct mg_request_info *info = mg_get_request_info(conn);
    String uri(info->uri);
    if (!uri.endsWithIgnoreCase(".json") && !uri.endsWithIgnoreCase(".wav")) {
        // DBG << "Not handling as audio request" << endl;
        return NOT_HANDLED;
    }

    // DBG << "Handling URI: " << uri << endl;

    var parsed;
    // First try to look in the query string
    String queryString = urldecode(info->query_string);
    // DBG << queryString << endl;
    parsed = JSON::parse(queryString);
    // Otherwise look in the POST data
    if (!parsed) {
        MemoryBlock postDataBlock;
        char postBuffer[1024];
        int didRead;
        while ((didRead = mg_read(conn, postBuffer, sizeof(postBuffer)))) {
            postDataBlock.append(postBuffer, didRead);
        }
        MemoryInputStream postStream(postDataBlock, false);
        parsed = JSON::parse(postStream);
    }

    DBG << "Request JSON: " << JSON::toString(parsed, true) << endl;

    PluginRequestParameters params(parsed);
    if (uri.endsWithIgnoreCase(".json")) {
        params.listParameters = true;
    }

    MemoryBlock block;
    MemoryOutputStream ostream(block, false);

    // DBG << "Rendering plugin request" << endl;
    int64 startTime = Time::currentTimeMillis();
    bool result = handlePluginRequest(params, ostream);
    if (!result) {
        DBG << "-> Unable to handle plugin request!" << endl;
        mg_printf(conn, "HTTP/1.0 500 ERROR\r\n\r\n");
        return HANDLED;
    }
    DBG << "-> Rendered plugin request in " << (Time::currentTimeMillis() - startTime) << "ms" << endl;

    // Note: MemoryOutputStream::getDataSize() is the actual number of bytes written.
    // Do not use MemoryBlock::getSize() since this reports the memory allocated (but not initialized!)
    mg_printf(conn, "HTTP/1.0 200 OK\r\n"
              "Content-Length: %d\r\n"
              "Content-Type: %s\r\n"
              "\r\n",
              (int)ostream.getDataSize(), params.getContentType());
    mg_write(conn, ostream.getData(), ostream.getDataSize());

    return HANDLED;
}
开发者ID:bpartridge,项目名称:jucebouncer,代码行数:60,代码来源:main.cpp

示例7: getRange

LMemoryBlock LMemoryBlock::getRange(const int startingPosition, const int numBytes) const
{
	MemoryBlock bl;

	if (getSize() >= (startingPosition + numBytes))
	{
		bl.append ((uint8 *)getData() + startingPosition, numBytes);
	}
	return (bl);
}
开发者ID:Srikrishna31,项目名称:ctrlr,代码行数:10,代码来源:LMemoryBlock.cpp

示例8: getStateInformation

//==============================================================================
void CfpluginAudioProcessor::getStateInformation (MemoryBlock& destData)
{
	if (!follower_) { return; }

	auto options = OptionsReader();

	std::ostringstream ss;
    boost::archive::text_oarchive oa(ss);
	oa << *options;

	std::string str = ss.str();
	destData.append(str.data(), str.length());
}
开发者ID:sbergen,项目名称:ConductorFollower,代码行数:14,代码来源:PluginProcessor.cpp


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