mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 16:58:40 -04:00
Jon Parise adds $[join]
This commit is contained in:
parent
4c0ae9793d
commit
c273c065f5
@ -1047,6 +1047,8 @@ r_expand_variable(const string &str, size_t &vp,
|
||||
return expand_filter(params);
|
||||
} else if (funcname == "filter_out" || funcname == "filter-out") {
|
||||
return expand_filter_out(params);
|
||||
} else if (funcname == "join") {
|
||||
return expand_join(params);
|
||||
} else if (funcname == "sort") {
|
||||
return expand_sort(params);
|
||||
} else if (funcname == "unique") {
|
||||
@ -2390,6 +2392,32 @@ expand_wordsubst(const string ¶ms) {
|
||||
return result;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: PPScope::expand_join
|
||||
// Access: Private
|
||||
// Description: Expands the "join" function variable: joins the list
|
||||
// of words using the specified separator.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
string PPScope::
|
||||
expand_join(const string ¶ms) {
|
||||
// Split the string up into tokens based on the spaces.
|
||||
vector<string> words;
|
||||
tokenize_whitespace(expand_string(params), words);
|
||||
|
||||
if (words.size() < 2) {
|
||||
cerr << "joins requires at least two parameters.\n";
|
||||
return string();
|
||||
}
|
||||
|
||||
const string sep(words[0]);
|
||||
|
||||
// Remove the first word in the list (which we use as the separator).
|
||||
words.erase(words.begin());
|
||||
|
||||
string result = repaste(words, sep);
|
||||
return result;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: PPScope::expand_sort
|
||||
// Access: Private
|
||||
|
@ -113,6 +113,7 @@ private:
|
||||
string expand_filter_out(const string ¶ms);
|
||||
string expand_wordsubst(const string ¶ms);
|
||||
string expand_subst(const string ¶ms);
|
||||
string expand_join(const string ¶ms);
|
||||
string expand_sort(const string ¶ms);
|
||||
string expand_unique(const string ¶ms);
|
||||
string expand_matrix(const string ¶ms);
|
||||
|
Loading…
x
Reference in New Issue
Block a user