mirror of
https://github.com/wfjm/w11.git
synced 2026-05-04 15:16:59 +00:00
use auto; use emplace,make_pair
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
// $Id: RlogFileCatalog.cpp 983 2018-01-02 20:35:59Z mueller $
|
||||
// $Id: RlogFileCatalog.cpp 1066 2018-11-10 11:21:53Z mueller $
|
||||
//
|
||||
// Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
//
|
||||
// This program is free software; you may redistribute and/or modify it under
|
||||
// the terms of the GNU General Public License as published by the Free
|
||||
@@ -13,6 +13,7 @@
|
||||
//
|
||||
// Revision History:
|
||||
// Date Rev Version Comment
|
||||
// 2018-11-09 1066 1.0.1 use auto; use make_pair,emplace
|
||||
// 2013-02-22 491 1.0 Initial version
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
@@ -50,13 +51,13 @@ RlogFileCatalog& RlogFileCatalog::Obj()
|
||||
const boost::shared_ptr<RlogFile>&
|
||||
RlogFileCatalog::FindOrCreate(const std::string& name)
|
||||
{
|
||||
map_cit_t it = fMap.find(name);
|
||||
auto it = fMap.find(name);
|
||||
if (it != fMap.end()) return it->second;
|
||||
|
||||
boost::shared_ptr<RlogFile> sptr(new RlogFile());
|
||||
it = fMap.insert(fMap.begin(), map_val_t(name, sptr));
|
||||
auto pitb = fMap.emplace(make_pair(name, sptr));
|
||||
|
||||
return it->second;
|
||||
return pitb.first->second;
|
||||
}
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// $Id: RlogFileCatalog.hpp 983 2018-01-02 20:35:59Z mueller $
|
||||
// $Id: RlogFileCatalog.hpp 1066 2018-11-10 11:21:53Z mueller $
|
||||
//
|
||||
// Copyright 2011-2013 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
//
|
||||
@@ -47,9 +47,6 @@ namespace Retro {
|
||||
|
||||
protected:
|
||||
typedef std::map<std::string, boost::shared_ptr<RlogFile>> map_t;
|
||||
typedef map_t::iterator map_it_t;
|
||||
typedef map_t::const_iterator map_cit_t;
|
||||
typedef map_t::value_type map_val_t;
|
||||
|
||||
map_t fMap; //!< name->rlogfile map
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// $Id: RparseUrl.cpp 983 2018-01-02 20:35:59Z mueller $
|
||||
// $Id: RparseUrl.cpp 1066 2018-11-10 11:21:53Z mueller $
|
||||
//
|
||||
// Copyright 2013-2017 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
//
|
||||
// This program is free software; you may redistribute and/or modify it under
|
||||
// the terms of the GNU General Public License as published by the Free
|
||||
@@ -13,6 +13,7 @@
|
||||
//
|
||||
// Revision History:
|
||||
// Date Rev Version Comment
|
||||
// 2018-11-09 1066 1.1.1 use auto; use emplace,make_pair
|
||||
// 2017-04-15 875 1.1 add Set() with default scheme handling
|
||||
// 2015-06-04 686 1.0.2 Set(): add check that optlist is enclosed by '|'
|
||||
// 2013-02-23 492 1.0.1 add static FindScheme(); allow no or empty scheme
|
||||
@@ -163,7 +164,7 @@ void RparseUrl::Clear()
|
||||
|
||||
bool RparseUrl::FindOpt(const std::string& name) const
|
||||
{
|
||||
omap_cit_t it = fOptMap.find(name);
|
||||
auto it = fOptMap.find(name);
|
||||
if (it == fOptMap.end()) return false;
|
||||
return true;
|
||||
}
|
||||
@@ -173,7 +174,7 @@ bool RparseUrl::FindOpt(const std::string& name) const
|
||||
|
||||
bool RparseUrl::FindOpt(const std::string& name, std::string& value) const
|
||||
{
|
||||
omap_cit_t it = fOptMap.find(name);
|
||||
auto it = fOptMap.find(name);
|
||||
if (it == fOptMap.end()) return false;
|
||||
|
||||
value = it->second;
|
||||
@@ -193,7 +194,7 @@ void RparseUrl::Dump(std::ostream& os, int ind, const char* text) const
|
||||
os << bl << " fScheme: " << fScheme << endl;
|
||||
os << bl << " fPath: " << fPath << endl;
|
||||
os << bl << " fOptMap: " << endl;
|
||||
for (omap_cit_t it=fOptMap.begin(); it!=fOptMap.end(); it++) {
|
||||
for (auto it=fOptMap.begin(); it!=fOptMap.end(); it++) {
|
||||
os << bl << " " << RosPrintf((it->first).c_str(), "-s",8)
|
||||
<< " : " << it->second << endl;
|
||||
}
|
||||
@@ -236,7 +237,7 @@ bool RparseUrl::AddOpt(const std::string& key, const std::string& val,
|
||||
return false;
|
||||
}
|
||||
|
||||
fOptMap.insert(omap_val_t(key, hasval ? val : "1"));
|
||||
fOptMap.emplace(make_pair(key, hasval ? val : "1"));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// $Id: RparseUrl.hpp 983 2018-01-02 20:35:59Z mueller $
|
||||
// $Id: RparseUrl.hpp 1066 2018-11-10 11:21:53Z mueller $
|
||||
//
|
||||
// Copyright 2013-2017 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
//
|
||||
@@ -36,9 +36,6 @@ namespace Retro {
|
||||
class RparseUrl {
|
||||
public:
|
||||
typedef std::map<std::string, std::string> omap_t;
|
||||
typedef omap_t::iterator omap_it_t;
|
||||
typedef omap_t::const_iterator omap_cit_t;
|
||||
typedef omap_t::value_type omap_val_t;
|
||||
|
||||
RparseUrl();
|
||||
virtual ~RparseUrl();
|
||||
|
||||
Reference in New Issue
Block a user