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


C++ boost::format方法代码示例

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


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

示例1: setupOnlineModeRecording

void MovieRecorderImpl::setupOnlineModeRecording()
{
    timeBarConnections.disconnect();
        
    isBeforeFirstFrameCapture = true;
    nextFrameTime = startTime;
            
    if(timeBar->isDoingPlayback()){
        startOnlineModeRecording();
    } else {
        timeBarConnections.add(
            timeBar->sigPlaybackStarted().connect(
                std::bind(&MovieRecorderImpl::onPlaybackStarted, this, std::placeholders::_1)));
        
        mv->putln(format(_("The online mode recording for %1% is ready.")) % targetView->name());
    }
}
开发者ID:kayusawa,项目名称:choreonoid,代码行数:17,代码来源:MovieRecorder.cpp

示例2: firstExtent

 void firstExtent(const Extent &e) {
     const ExtentType::Ptr type = e.getTypePtr();
     if (type->versionCompatible(0,0) || type->versionCompatible(1,0)) {
         reqtime.setFieldName("packet-at");
         is_request.setFieldName("is-request");
         transaction_id.setFieldName("transaction-id");
         op_id.setFieldName("op-id");
     } else if (type->versionCompatible(2,0)) {
         reqtime.setFieldName("packet_at");
         is_request.setFieldName("is_request");
         transaction_id.setFieldName("transaction_id");
         op_id.setFieldName("op_id");
     } else {
         FATAL_ERROR(format("can only handle v[0,1,2].*; not %d.%d")
                     % type->majorVersion() % type->minorVersion());
     }
 }
开发者ID:dataseries,项目名称:DataSeries,代码行数:17,代码来源:ServerLatency.cpp

示例3: load_relative_module

object require::load_relative_module(std::string id) {

  fs::path module(current_id().substr(sizeof("file://")-1));

  module = io::fs_base::canonicalize( module.parent_path() / (id + ".js") );
  id = module.string();
  fs::path dso_path = make_dsoname(module.string());
  id = "file://" + id;
  std::string const dso_id = "file://" + dso_path.string();


  // If either of the JS or DSO is already cached then just return it
  if (module_cache.has_own_property(id) )
    return module_cache.get_property_object(id);
  else if (module_cache.has_own_property(dso_id) )
    return module_cache.get_property_object(dso_id);

  bool js = false, dso = false;
  security &sec = security::get();
  if (sec.check_path(module.string(), security::READ) && fs::exists(module)) {
    js = true;
  }
  if (sec.check_path(dso_path.string(), security::READ) && fs::exists(dso_path)) {
    dso = true;
  }

  if (!js && !dso)
    throw exception(format(load_error_fmt) % id % "file not found");
  else if (!js)
    id = dso_id;


  ExportsScopeGuard scope_guard(module_cache, id);

  // The object we store in module_cache
  object cache = create_cache_entry(id);

  if (dso)
    load_native_module(dso_path, cache.get_property_object("exports"));
  if (js)
    require_js(module, id, cache);

  scope_guard.exit_cleanly();

  return cache;
}
开发者ID:Flusspferd,项目名称:flusspferd,代码行数:46,代码来源:modules.cpp

示例4: debugMessagesInitial

void LintelLog::debugMessagesInitial() {
    static Category help("help");
    if (wouldDebug(help)) {
	vector<string> debug_names;

	instance->mutex.lock();
	for(HashMap<string, uint32_t>::iterator i = instance->category2id.begin(); 
	    i != instance->category2id.end(); ++i) {
	    debug_names.push_back(i->first);
	}
	instance->mutex.unlock();
	sort(debug_names.begin(), debug_names.end());

	LintelLogDebugLevelVariable(help, 1, format("known debugging options: %s")
                                    % join(", ", debug_names));
    }
}
开发者ID:dataseries,项目名称:Lintel,代码行数:17,代码来源:LintelLog.cpp

示例5: runtime_error

BamWriter::BamWriter(std::string const& path, bam_header_t const* header, bool sam /*= false*/)
    : out_(samopen(path.c_str(), sam ? "wh" : "wb", header))
{
    if (!out_) {
        throw std::runtime_error(str(format(
            "Failed to open output file %1%"
            ) % path));
    }

/*
    if (sam && (fwrite(header->text, 1, header->l_text, out_->x.tamw) != header->l_text)) {
        throw std::runtime_error(str(format(
            "Failed to write sam header to file %1%"
            ) % path));
    }
*/
}
开发者ID:BIGLabHYU,项目名称:breakdancer,代码行数:17,代码来源:BamWriter.cpp

示例6: parse

object base_parser::parse(value source) {
  if (source.is_object()) {
    object o = source.get_object();

    if (is_native<io::stream>(o)) {
      io::stream &s = flusspferd::get_native<io::stream>(o);

      // TODO: Work out if the stream is readable or not!
      std::ifstream stream;
      dynamic_cast<std::ios&>(stream).rdbuf( s.streambuf() );
      sax_source is;
      is.setByteStream(stream);
      return parse_source(is);
    }
    /*else if (is_native<binary>(o)) {
      // Couldn't get this working. Compile errors
      binary &b = flusspferd::get_native<flusspferd::binary>(o);

      call_context c;
      c.arg.push_back(b);
      create<io::binary_stream>(c);
      root_object s(b_s);

      std::ifstream stream;
      dynamic_cast<std::ios&>(stream).rdbuf( b_s.streambuf() );
      sax_source is;
      is.setByteStream(stream);
      return parse_source(is);
    }*/
  }

  std::string str = source.to_std_string();

  security &sec = security::get();
  if (!sec.check_path(str, security::READ)) {
    throw exception(
      format("xml.Parser#parse: could not open file: 'denied by security' (%s)")
             % str
    );
  }

  sax_source is;
  is.setSystemId(str);

  return parse_source(is);
}
开发者ID:Flusspferd,项目名称:flusspferd,代码行数:46,代码来源:parser.cpp

示例7: startOnlineModeRecording

void MovieRecorderImpl::startOnlineModeRecording()
{
    timeBarConnections.disconnect();
    
    timeBarConnections.add(
        timeBar->sigTimeChanged().connect(
            std::bind(&MovieRecorderImpl::onTimeChanged, this, std::placeholders::_1)));

    timeBarConnections.add(
        timeBar->sigPlaybackStopped().connect(
            std::bind(&MovieRecorderImpl::onPlaybackStopped, this, std::placeholders::_2)));

    isRecording = true;
    startImageOutput();

    mv->putln(format(startMessage) % targetView->name() % recordingMode.selectedLabel());
}
开发者ID:kayusawa,项目名称:choreonoid,代码行数:17,代码来源:MovieRecorder.cpp

示例8: uargv

static void WINAPI service_main(DWORD argc, LPWSTR *wargv)
{
	auto status_handle = RegisterServiceCtrlHandlerEx(DESPOOF_WIDE_SERVICE_NAME, control_handler, NULL);
	if(!status_handle) {
		throw_windows_error("RegisterServiceCtrlHandlerEx");
	}

	SERVICE_STATUS status = {0};
	status.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
	status.dwCurrentState = SERVICE_RUNNING;
	status.dwControlsAccepted = 0;
	
	SetServiceStatus(status_handle, &status);

	bool start;
	try {
		utf_argv uargv(argc, wargv);
		if(!despoof::init(argc, uargv.argv(), ctx)) {
			return;
		}
	} catch(exception &ex) {
		// PANIC
		status.dwWin32ExitCode = ERROR_SERVICE_SPECIFIC_ERROR;
		status.dwServiceSpecificExitCode = 1;
		status.dwCurrentState = SERVICE_STOPPED;
		SetServiceStatus(status_handle, &status);
	}

	status.dwControlsAccepted = accepted_controls;
	SetServiceStatus(status_handle, &status);

	try {
		list<adapter_address> addresses = ctx->reload();
		while(keep_running) {
			ctx->iterate(addresses);
		}
	} catch(exception &ex) {
		ctx->log().fail(format("%1%: %2%") % typeid(ex).name() % ex.what());
		status.dwWin32ExitCode = ERROR_SERVICE_SPECIFIC_ERROR;
		status.dwServiceSpecificExitCode = 1;
	}

	status.dwCurrentState = SERVICE_STOPPED;
	SetServiceStatus(status_handle, &status);
}
开发者ID:raphaelr,项目名称:despoof,代码行数:45,代码来源:service_main.cpp

示例9: exception

void
Neurons::set(size_t n, unsigned nargs, const float args[])
{
	using boost::format;

	if(nargs != m_param.size() + m_state.size()) {
		throw nemo::exception(NEMO_INVALID_INPUT,
				str(format("Unexpected number of parameters/state variables when modifying neuron. Expected %u, found %u")
						% (m_param.size() + m_state.size()) % nargs));
	}

	for(unsigned i=0; i < m_param.size(); ++i) {
		m_param[i][n] = *args++;
	}
	for(unsigned i=0; i < m_state.size(); ++i) {
		m_state[i][n] = *args++;
	}
}
开发者ID:MogeiWang,项目名称:nemosim,代码行数:18,代码来源:Neurons.cpp

示例10: printResult

 virtual void printResult() {
     cout << format("Begin-%s\n") % __PRETTY_FUNCTION__;
     cout << "common bytes:";
     for (int i=0;i<max_seen_fh_size;++i) {
         if (commonbytes[i]) {
             cout << format("%d ") % i;
         }
     }
     cout << "\n";
     for (int i=0;i<max_seen_fh_size/4;++i) {
         cout << format("quad %d: ") % i;
         if (used_ints[i].size() >= max_used_count) {
             cout << format("> %d used\n") % used_ints[i].size();
         } else {
             cout << format("%d used: ") % used_ints[i].size();
             if (used_ints[i].size() < 50) {
                 for (map<uint32_t,bool>::iterator j = used_ints[i].begin();
                     j != used_ints[i].end();++j) {
                     cout << format("%08x, ") % j->first;
                 }
             }
             cout << "\n";
         }
     }
     cout << format("%d mount entries\n") % fh2mount.size();
     for (fh2mountT::iterator i = fh2mount.begin();
         i != fh2mount.end();++i) {
         if (i->common_bytes_seen_count > 0) {
             INVARIANT(i->fullfh.size() >= 32,("unhandled"));
             const ExtentType::int32 *v = (const ExtentType::int32 *)i->fullfh.data();
             cout << format("mount %13s:%s seen %4d times; quads(0,1,6,7): %08x %08x  %08x %08x\n")
                     % ipv4tostring(i->server) % maybehexstring(i->pathname)
                     % i->common_bytes_seen_count % v[0] % v[1] % v[6] % v[7];
         }
     }
     cout << format("End-%s\n") % __PRETTY_FUNCTION__;
 }
开发者ID:dataseries,项目名称:DataSeries,代码行数:37,代码来源:mod3.cpp

示例11: PrintScopeVariableInfo

std::string& PrintScopeVariableInfo(const D3D10_SHADER_DEBUG_INFO* pDebugInfo, UINT nVariable, std::string& strVariableInfo)
{
    if (nVariable >= pDebugInfo->Variables)
    {
        strVariableInfo = "";
        return strVariableInfo;
    }

    char* pszDebugInfo = (char*) pDebugInfo;
    char* pszDebugDataOffset = pszDebugInfo + pDebugInfo->Size;
    //   char* pszStringTable = pszDebugDataOffset +  pDebugInfo->StringOffset;
    D3D10_SHADER_DEBUG_SCOPEVAR_INFO* pVariableInfo = (D3D10_SHADER_DEBUG_SCOPEVAR_INFO*)(pszDebugDataOffset + pDebugInfo->ScopeVariableInfo + (nVariable * sizeof(D3D10_SHADER_DEBUG_SCOPEVAR_INFO)));

    std::string strTokenInfo;
    strVariableInfo = str(format("%s (%s, %s)") % PrintTokenInfo(pDebugInfo, pVariableInfo->TokenId, strTokenInfo) % pszDebugVarType[pVariableInfo->VarType] % pszVarClass[pVariableInfo->Class]);

    return strVariableInfo;
}
开发者ID:davidlee80,项目名称:amd-codexl-analyzer,代码行数:18,代码来源:D3D10ShaderInfo.cpp

示例12: main

int main( ) {
  try {
    format f("There are %1% ways %2% %3% %4%");
    f % 3;
    f % "to" % "do" % "this.";
    cout << f << endl;
    f.clear( ); // Clear buffers to format something else
    f.parse("Those cost $%d.");
    f % 50;
    cout << f << endl;
    int x = 11256099;
    string strx = str(format("%x") % x);
    cout << strx << endl;
  }
  catch (format_error &e) {
    cout << e.what( ) << endl;
  }
}
开发者ID:jervisfm,项目名称:ExampleCode,代码行数:18,代码来源:3-4.cpp

示例13: rotate_stores

  void rotate_stores()
		{
			std::cout << "Rotating store " << store_file << "..." << std::endl;
			std::cout << "Rotating store call flush " << store_file << "..." << std::endl;
      fflush(stdout);
			try {
        store->flush(true);
			} catch (klio::StoreException const& ex) {
				std::cout << "Failed to flush the buffers : " << ex.what() << std::endl;
      }
      std::cout << "Rotating store flushed " << store_file << "..." << std::endl;
      fflush(stdout);

			std::cout << "Reopening store" << std::endl;

      const boost::posix_time::ptime now = boost::posix_time::second_clock::local_time();

      std::string s;
      s= str( format("%04d%02d%02d-%02d%02d")        % now.date().year_month_day().year
              % now.date().year_month_day().month.as_number()
              % now.date().year_month_day().day.as_number()
              % now.time_of_day().hours()
              % now.time_of_day().minutes());

      std::string name(store_file.string());
      name+=".";
      name+=s;
      
      bfs::path dbname(name);
      std::cout << "===> renaming to: "<< name<<std::endl;
      fflush(stdout);
			try {
        store->rotate(dbname);
			} catch (klio::StoreException const& ex) {
				std::cout << "Failed to rotate the klio-databse : " << ex.what() << std::endl;
      }
      

#if KLIO_AUTOCOMMIT
      store->start_transaction();
#endif

			std::cout << "Rotation done" << std::endl;
		}
开发者ID:florian-asche,项目名称:hexabus,代码行数:44,代码来源:hexalog.cpp

示例14: loadSubProject

bool SubProjectItemImpl::loadSubProject(const std::string& filename)
{
    if(projectFilesBeingLoaded.find(filename) != projectFilesBeingLoaded.end()){
        MessageView::instance()->putln(
            format(_("Sub projects to load \"%1%\" are recursively specified."))
            % filename, MessageView::ERROR);
        return false;
    }

    if(self->isConnectedToRoot()){
        doLoadSubProject(filename);
        return true;
    } else {
        projectFileToLoad = filename;
        return true;
    }

    return false;
}
开发者ID:kindsenior,项目名称:choreonoid,代码行数:19,代码来源:SubProjectItem.cpp

示例15: updateDuplicateRequest

 void updateDuplicateRequest(TidData *t) {
     // this check is here in case we are somehow getting duplicate
     // packets delivered by the monitoring process, and we want to
     // catch this and not think that we have realy lots of
     // duplicate requests.  Tried 50ms, but found a case about 5ms
     // apart, so dropped to 2ms
     // inter arrival time
     int64_t request_iat = reqtime.valRaw() - t->last_reqtime_raw; 
     if (request_iat < duplicate_request_min_retry_raw) {
         cerr << format("warning: duplicate requests unexpectedly close together %s - %s = %s >= %s\n")
                 % reqtime.valStrSecNano() 
                 % reqtime.rawToStrSecNano(t->last_reqtime_raw)
                 % reqtime.rawToStrSecNano(request_iat)
                 % reqtime.rawToStrSecNano(duplicate_request_min_retry_raw);
     }
     ++t->duplicate_count;
     duplicate_request_delay.add(request_iat/(1000.0*1000.0));
     t->last_reqtime_raw = reqtime.valRaw();
 }
开发者ID:dataseries,项目名称:DataSeries,代码行数:19,代码来源:ServerLatency.cpp


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