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


C++ StringOutputStream类代码示例

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


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

示例1: current_thread

AbstractString * ZeroRankArray::write_to_string()
{
  Thread * thread = current_thread();
  bool print_readably = (thread->symbol_value(S_print_readably) != NIL);
  if (print_readably)
    {
      if (_element_type != T)
        signal_lisp_error(new PrintNotReadable(make_value(this)));
    }
  if (print_readably || thread->symbol_value(S_print_array) != NIL)
    {
      String * s = new String("#0A");
      if (aref(0) == make_value(this) && thread->symbol_value(S_print_circle) != NIL)
        {
          StringOutputStream * stream = new StringOutputStream(S_character);
          thread->execute(the_symbol(S_output_object)->function(), aref(0), make_value(stream));
          s->append(stream->get_string());
        }
      else
        s->append(::write_to_string(aref(0)));
      return s;
    }
  else
    return unreadable_string();
}
开发者ID:bsmr-common-lisp,项目名称:xcl,代码行数:25,代码来源:ZeroRankArray.cpp

示例2: applyConvertTextMode

bool BufferedConnectionWriter::applyConvertTextMode()
{
    if (convertTextModePending) {
        convertTextModePending = false;

        Bottle b;
        StringOutputStream sos;
        for (size_t i = 0; i < lst_used; i++) {
            yarp::os::ManagedBytes& m = *(lst[i]);
            sos.write(m.usedBytes());
        }
        const std::string& str = sos.str();
        b.fromBinary(str.c_str(), (int)str.length());
        std::string replacement = b.toString() + "\n";
        for (auto& i : lst) {
            delete i;
        }
        lst_used = 0;
        target = &lst;
        lst.clear();
        stopPool();
        Bytes data((char*)replacement.c_str(), replacement.length());
        appendBlockCopy(data);
    }
    return true;
}
开发者ID:ale-git,项目名称:yarp,代码行数:26,代码来源:BufferedConnectionWriter.cpp

示例3: testWriteHelp

void CommandLineTestBase::testWriteHelp(ICommandLineModule *module)
{
    StringOutputStream     stream;
    CommandLineHelpContext context(&stream, eHelpOutputFormat_Console, nullptr, "test");
    context.setModuleDisplayName(formatString("%s %s", "test", module->name()));
    module->writeHelp(context);
    TestReferenceChecker   checker(rootChecker());
    checker.checkTextBlock(stream.toString(), "HelpOutput");
}
开发者ID:pjohansson,项目名称:gromacs,代码行数:9,代码来源:cmdlinetest.cpp

示例4: Scene_EntitySetClassname_Selected

void Scene_EntitySetClassname_Selected( const char* classname ){
	if ( GlobalSelectionSystem().countSelected() > 0 ) {
		StringOutputStream command;
		if( string_equal( classname, "worldspawn" ) )
			command << "ungroupSelectedEntities";
		else
			command << "entitySetClass -class " << classname;
		UndoableCommand undo( command.c_str() );
		GlobalSceneGraph().traverse( EntitySetClassnameSelected( classname ) );
	}
}
开发者ID:Garux,项目名称:netradiant-custom,代码行数:11,代码来源:entity.cpp

示例5: composeURL

int HttpUploader::upload(const StringBuffer& luid, InputStream* inputStream) 
{
    int status = 0;

    // safe checks
    if (!inputStream || !inputStream->getTotalSize()) {
        LOG.error("upload error: no data to transfer");
        return 1;
    }
    if (luid.empty() || syncUrl.empty()  || sourceURI.empty()) {
        LOG.error("upload error: some params are not set");
        return 2;
    }
    
    StringBuffer fullUrl = composeURL();
    URL url(fullUrl.c_str());
    HttpConnection* httpConnection = getHttpConnection();
   
    httpConnection->setCompression(false);
    status = httpConnection->open(url, HttpConnection::MethodPost);
    
    if (status) { 
        delete httpConnection;

        return status;
    }

    httpConnection->setKeepAlive(keepalive);
    httpConnection->setRequestChunkSize(maxRequestChunkSize);
   
    // Set headers (use basic auth)
    HttpAuthentication* auth = new BasicAuthentication(username, password);
    httpConnection->setAuthentication(auth);
    setRequestHeaders(luid, *httpConnection, *inputStream);
    
    // Send the HTTP request
    StringOutputStream response;
    status = httpConnection->request(*inputStream, response);
    LOG.debug("response returned = %s", response.getString().c_str());
    
    // Manage response headers
    if (useSessionID) {
        // Server returns the jsessionId in the Set-Cookie header, can be used for 
        // the subsequent calls of upload().
        StringBuffer hdr = httpConnection->getResponseHeader(HTTP_HEADER_SET_COOKIE);
        sessionID = httpConnection->parseJSessionId(hdr);
    }
    
    httpConnection->close();
    
    delete auth;
    delete httpConnection;
    return status;
}
开发者ID:fieldwind,项目名称:syncsdk,代码行数:54,代码来源:HttpUploader.cpp

示例6: testWrite

 void testWrite() {
     report(0,"testing writing...");
     StringOutputStream sos;
     char txt[] = "Hello my friend";
     Bytes b(txt,ACE_OS::strlen(txt));
     sos.write(b);
     checkEqual(txt,sos.toString(),"single write");
     StringOutputStream sos2;
     sos2.write('y');
     sos2.write('o');
     checkEqual("yo",sos2.toString(),"multiple writes");
 }
开发者ID:AbuMussabRaja,项目名称:yarp,代码行数:12,代码来源:StringOutputStreamTest.cpp

示例7: Selection_SnapToGrid

void Selection_SnapToGrid (void)
{
	StringOutputStream command;
	command << "snapSelected -grid " << GlobalGrid().getGridSize();
	UndoableCommand undo(command.toString());

	if (GlobalSelectionSystem().Mode() == SelectionSystem::eComponent) {
		GlobalSceneGraph().traverse(ComponentSnappableSnapToGridSelected(GlobalGrid().getGridSize()));
	} else {
		GlobalSceneGraph().traverse(SnappableSnapToGridSelected(GlobalGrid().getGridSize()));
	}
}
开发者ID:ptitSeb,项目名称:UFO--AI-OpenPandora,代码行数:12,代码来源:commands.cpp

示例8: Sys_SetTitle

void Sys_SetTitle(const char *text, bool modified)
{
  StringOutputStream title;
  title << ConvertLocaleToUTF8(text);

  if(modified)
  {
    title << " *";
  }

  gtk_window_set_title(MainFrame_getWindow(), title.c_str());
}
开发者ID:raynorpat,项目名称:cake,代码行数:12,代码来源:qe3.cpp

示例9: GlobalTexturePrefix_get

std::string MaterialSystem::getBlock (const std::string& texture)
{
	if (texture.empty())
		return "";

	const std::string textureDir = GlobalTexturePrefix_get();
	std::string skippedTextureDirectory = texture.substr(textureDir.length());

	if (skippedTextureDirectory.empty())
		return "";

	MaterialBlockMap::iterator i = _blocks.find(skippedTextureDirectory);
	if (i != _blocks.end())
		return i->second;

	if (!_materialLoaded)
		loadMaterials();

	if (!_materialLoaded)
		return "";

	StringOutputStream outputStream;

	StringInputStream inputStream(_material);
	AutoPtr<Tokeniser> tokeniser(GlobalScriptLibrary().createSimpleTokeniser(inputStream));
	int depth = 0;
	bool found = false;
	std::string token = tokeniser->getToken();
	while (token.length()) {
		if (token == "{") {
			depth++;
		} else if (token == "}") {
			depth--;
		}
		if (depth >= 1) {
			if (depth == 1 && token == "material") {
				token = tokeniser->getToken();
				if (token == skippedTextureDirectory) {
					found = true;
					outputStream << "{ material ";
				}
			}
			if (found)
				outputStream << token << " ";
		} else if (found) {
			outputStream << "}";
			break;
		}
		token = tokeniser->getToken();
	}
	return outputStream.toString();
}
开发者ID:chrisglass,项目名称:ufoai,代码行数:52,代码来源:MaterialSystem.cpp

示例10: current_thread

AbstractString * StandardObject::write_to_string()
{
  if (CL_fboundp(S_print_object) != NIL)
    {
      Thread * const thread = current_thread();
      StringOutputStream * stream = new StringOutputStream(S_character);
      thread->execute(the_symbol(S_print_object)->function(),
                      make_value(this),
                      make_value(stream));
      AbstractString * s = stream->get_string();
      return s;
    }
  else
    return unreadable_string();
}
开发者ID:bsmr-common-lisp,项目名称:xcl,代码行数:15,代码来源:StandardObject.cpp

示例11: visit

          void visit(const char* name, Accelerator& accelerator)
          {
            StringOutputStream modifiers;
            modifiers << accelerator;

            {
              GtkTreeIter iter;
              gtk_list_store_append(m_store, &iter);
              gtk_list_store_set(m_store, &iter, 0, name, 1, modifiers.c_str(), -1);
            }
 
            if(!m_commandList.failed())
            {
              m_commandList << makeLeftJustified(name, 25) << " " << modifiers.c_str() << '\n';
            }
          }
开发者ID:raynorpat,项目名称:cake,代码行数:16,代码来源:commands.cpp

示例12: Entity_moveSelectedPrimitives

/// moves selected primitives to entity, which is or its primitive is ultimateSelected() or firstSelected()
void Entity_moveSelectedPrimitives( bool toLast ){
	if ( GlobalSelectionSystem().countSelected() < 2 ) {
		globalErrorStream() << "Source and target entity primitives should be selected!\n";
		return;
	}

	const scene::Path& path = toLast? GlobalSelectionSystem().ultimateSelected().path() : GlobalSelectionSystem().firstSelected().path();
	scene::Node& node = ( !Node_isEntity( path.top() ) && path.size() > 1 )? path.parent() : path.top();

	if ( Node_isEntity( node ) && node_is_group( node ) ) {
		StringOutputStream command;
		command << "movePrimitivesToEntity " << makeQuoted( Node_getEntity( node )->getEntityClass().name() );
		UndoableCommand undo( command.c_str() );
		Scene_parentSelectedBrushesToEntity( GlobalSceneGraph(), node );
	}
}
开发者ID:Garux,项目名称:netradiant-custom,代码行数:17,代码来源:entity.cpp

示例13: visit

	void visit( const char* name, Accelerator& accelerator ){
		if ( !strcmp( name, commandName ) ) {
			return;
		}
		if ( !allow ) {
			return;
		}
		if ( accelerator.key == 0 ) {
			return;
		}
		if ( accelerator == newAccel ) {
			StringOutputStream msg;
			msg << "The command " << name << " is already assigned to the key " << accelerator << ".\n\n"
				<< "Do you want to unassign " << name << " first?";
			EMessageBoxReturn r = gtk_MessageBox( widget, msg.c_str(), "Key already used", eMB_YESNOCANCEL );
			if ( r == eIDYES ) {
				// clear the ACTUAL accelerator too!
				disconnect_accelerator( name );
				// delete the modifier
				accelerator = accelerator_null();
				// empty the cell of the key binds dialog
				GtkTreeIter i;
				if ( gtk_tree_model_get_iter_first( GTK_TREE_MODEL( model ), &i ) ) {
					for (;; )
					{
						GValue val;
						memset( &val, 0, sizeof( val ) );
						gtk_tree_model_get_value( GTK_TREE_MODEL( model ), &i, 0, &val );
						const char *thisName = g_value_get_string( &val );;
						if ( !strcmp( thisName, name ) ) {
							gtk_list_store_set( GTK_LIST_STORE( model ), &i, 1, "", -1 );
						}
						g_value_unset( &val );
						if ( !gtk_tree_model_iter_next( GTK_TREE_MODEL( model ), &i ) ) {
							break;
						}
					}
				}
			}
			else if ( r == eIDCANCEL ) {
				// aborted
				allow = false;
			}
		}
	}
开发者ID:Triang3l,项目名称:netradiant,代码行数:45,代码来源:commands.cpp

示例14: testGET

    /**
     * Tests a GET on a specific URL, prints the response.
     */
    void testGET(const URL& testURL) 
    {
        LOG.debug("test GET on %s", testURL.fullURL);
        int ret = httpConnection.open(testURL, HttpConnection::MethodGet);
        LOG.debug("open, ret = %d", ret);
        
        BufferInputStream inputStream("");
        StringOutputStream outputStream;
        
        httpConnection.setRequestHeader(HTTP_HEADER_ACCEPT,          "*/*");
        httpConnection.setRequestHeader(HTTP_HEADER_CONTENT_LENGTH,  0);

        ret = httpConnection.request(inputStream, outputStream);
        LOG.debug("request, ret = %d", ret);
        LOG.debug("response = \n%s", outputStream.getString().c_str());
        
        httpConnection.close();
    }
开发者ID:fieldwind,项目名称:syncsdk,代码行数:21,代码来源:HttpUploader.cpp

示例15: freezeTransforms

// End the move, this freezes the current transforms
void RadiantSelectionSystem::endMove() {
	freezeTransforms();

	// greebo: Deselect all faces if we are in brush and drag mode
	if (Mode() == ePrimitive) {
		if (ManipulatorMode() == eDrag) {
			GlobalSceneGraph().traverse(SelectAllComponentWalker(false, SelectionSystem::eFace));
			//Scene_SelectAll_Component(false, SelectionSystem::eFace);
		}
	}

	// Remove all degenerated brushes from the scene graph (should emit a warning)
	GlobalSceneGraph().traverse(RemoveDegenerateBrushWalker());

	_pivotMoving = false;
	pivotChanged();

	// Update the views
	SceneChangeNotify();

	// If we started an undoable operation, end it now and tell the console what happened
	if (_undoBegun) {
		StringOutputStream command;

		if (ManipulatorMode() == eTranslate) {
			command << "translateTool";
			outputTranslation(command);
		}
		else if (ManipulatorMode() == eRotate) {
			command << "rotateTool";
			outputRotation(command);
		}
		else if (ManipulatorMode() == eScale) {
			command << "scaleTool";
			outputScale(command);
		}
		else if (ManipulatorMode() == eDrag) {
			command << "dragTool";
		}

		// Finish the undo move
		GlobalUndoSystem().finish(command.toString());
	}
}
开发者ID:AresAndy,项目名称:ufoai,代码行数:45,代码来源:RadiantSelectionSystem.cpp


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