mirror of
https://github.com/textmate/textmate.git
synced 2026-01-20 04:08:04 -05:00
Retire compiler workaround
Previously we could get a compiler error when using std::map<std::string, std::string>() as a default argument.
This commit is contained in:
@@ -269,7 +269,7 @@ NSString* const FFFindWasTriggeredByEnter = @"FFFindWasTriggeredByEnter";
|
||||
{ "No more matches for “${found}”.", "Found one match for “${found}”${line:+ at line ${line}, column ${column}}.", "${count} matches for “${found}”." },
|
||||
};
|
||||
|
||||
format_string::string_map_t variables;
|
||||
std::map<std::string, std::string> variables;
|
||||
variables["count"] = std::to_string(aNumber);
|
||||
variables["found"] = to_s(aFindString);
|
||||
variables["line"] = aPosition ? std::to_string(aPosition.line + 1) : NULL_STR;
|
||||
|
||||
@@ -10,8 +10,7 @@ namespace bundles
|
||||
struct item_t;
|
||||
typedef std::shared_ptr<item_t> item_ptr;
|
||||
|
||||
typedef std::map<std::string, std::string> string_map_t; // kludge to support empty map as a default argument
|
||||
PUBLIC std::map<std::string, std::string> environment (scope::context_t const& scope, std::map<std::string, std::string> const& base = string_map_t());
|
||||
PUBLIC std::map<std::string, std::string> environment (scope::context_t const& scope, std::map<std::string, std::string> const& base = std::map<std::string, std::string>());
|
||||
PUBLIC plist::any_t value_for_setting (std::string const& setting, scope::context_t const& scope, item_ptr* match = NULL);
|
||||
|
||||
PUBLIC std::vector<item_ptr> grammars_for_path (std::string const& path);
|
||||
|
||||
@@ -268,7 +268,7 @@ namespace format_string
|
||||
nodes.reset(new parser::nodes_t(n));
|
||||
}
|
||||
|
||||
std::string format_string_t::expand (string_map_t const& variables) const
|
||||
std::string format_string_t::expand (std::map<std::string, std::string> const& variables) const
|
||||
{
|
||||
expand_visitor v(variables, NULL);
|
||||
v.traverse(*nodes);
|
||||
@@ -280,7 +280,7 @@ namespace format_string
|
||||
// = API =
|
||||
// =======
|
||||
|
||||
std::string replace (std::string const& src, regexp::pattern_t const& ptrn, format_string_t const& format, bool repeat, string_map_t const& variables)
|
||||
std::string replace (std::string const& src, regexp::pattern_t const& ptrn, format_string_t const& format, bool repeat, std::map<std::string, std::string> const& variables)
|
||||
{
|
||||
D(DBF_FormatString, bug("%s\n", src.c_str()););
|
||||
|
||||
@@ -291,7 +291,7 @@ namespace format_string
|
||||
|
||||
}
|
||||
|
||||
std::string expand (std::string const& format, string_map_t const& variables)
|
||||
std::string expand (std::string const& format, std::map<std::string, std::string> const& variables)
|
||||
{
|
||||
return format_string_t(format).expand(variables);
|
||||
}
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
|
||||
namespace format_string
|
||||
{
|
||||
typedef std::map<std::string, std::string> string_map_t;
|
||||
|
||||
struct PUBLIC format_string_t
|
||||
{
|
||||
WATCH_LEAKS(format_string::format_string_t);
|
||||
@@ -17,18 +15,18 @@ namespace format_string
|
||||
format_string_t (std::string const& str) { init(str); }
|
||||
|
||||
format_string_t (parser::nodes_t const& nodes);
|
||||
std::string expand (string_map_t const& variables) const;
|
||||
std::string expand (std::map<std::string, std::string> const& variables) const;
|
||||
|
||||
private:
|
||||
friend std::string replace (std::string const& src, regexp::pattern_t const& ptrn, format_string_t const& format, bool repeat, string_map_t const& variables);
|
||||
friend std::string replace (std::string const& src, regexp::pattern_t const& ptrn, format_string_t const& format, bool repeat, std::map<std::string, std::string> const& variables);
|
||||
friend std::set<std::string> get_variables (format_string_t const&);
|
||||
|
||||
void init (std::string const& str);
|
||||
std::shared_ptr<parser::nodes_t> nodes;
|
||||
};
|
||||
|
||||
PUBLIC std::string replace (std::string const& src, regexp::pattern_t const& ptrn, format_string_t const& format, bool repeat = true, string_map_t const& variables = string_map_t());
|
||||
PUBLIC std::string expand (std::string const& format, string_map_t const& variables = string_map_t());
|
||||
PUBLIC std::string replace (std::string const& src, regexp::pattern_t const& ptrn, format_string_t const& format, bool repeat = true, std::map<std::string, std::string> const& variables = std::map<std::string, std::string>());
|
||||
PUBLIC std::string expand (std::string const& format, std::map<std::string, std::string> const& variables = std::map<std::string, std::string>());
|
||||
PUBLIC std::string escape (std::string const& format);
|
||||
|
||||
} /* format_string */
|
||||
|
||||
Reference in New Issue
Block a user