Commit c67ba8bd authored by coppro's avatar coppro

Rename 'cannocial_name_form' to 'canonical_name_form'

parent b0598130
...@@ -50,7 +50,7 @@ IMPLEMENT_REFLECTION(Field) { ...@@ -50,7 +50,7 @@ IMPLEMENT_REFLECTION(Field) {
REFLECT(type); REFLECT(type);
} }
REFLECT(name); REFLECT(name);
REFLECT_IF_READING name = cannocial_name_form(name); REFLECT_IF_READING name = canonical_name_form(name);
REFLECT(description); REFLECT(description);
REFLECT_N("icon", icon_filename); REFLECT_N("icon", icon_filename);
REFLECT(editable); REFLECT(editable);
......
...@@ -46,7 +46,7 @@ ChoiceThumbnailRequest::ChoiceThumbnailRequest(ValueViewer* viewer, int id, bool ...@@ -46,7 +46,7 @@ ChoiceThumbnailRequest::ChoiceThumbnailRequest(ValueViewer* viewer, int id, bool
Image ChoiceThumbnailRequest::generate() { Image ChoiceThumbnailRequest::generate() {
ChoiceStyle& s = style(); ChoiceStyle& s = style();
String name = cannocial_name_form(s.field().choices->choiceName(id)); String name = canonical_name_form(s.field().choices->choiceName(id));
ScriptableImage& img = s.choice_images[name]; ScriptableImage& img = s.choice_images[name];
return img.isReady() return img.isReady()
? img.generate(GeneratedImage::Options(16,16, &viewer().getStylePackage(), &viewer().getLocalPackage(), ASPECT_BORDER, true)) ? img.generate(GeneratedImage::Options(16,16, &viewer().getStylePackage(), &viewer().getLocalPackage(), ASPECT_BORDER, true))
...@@ -181,7 +181,7 @@ void DropDownChoiceListBase::generateThumbnailImages() { ...@@ -181,7 +181,7 @@ void DropDownChoiceListBase::generateThumbnailImages() {
if (style().choice_images.empty() && style().image.isScripted()) { if (style().choice_images.empty() && style().image.isScripted()) {
for (int i = 0 ; i < end ; ++i) { for (int i = 0 ; i < end ; ++i) {
try { try {
String name = cannocial_name_form(field().choices->choiceName(i)); String name = canonical_name_form(field().choices->choiceName(i));
ctx.setVariable(_("input"), to_script(name)); ctx.setVariable(_("input"), to_script(name));
GeneratedImageP img = image_from_script(style().image.getValidScriptP()->eval(ctx)); GeneratedImageP img = image_from_script(style().image.getValidScriptP()->eval(ctx));
style().choice_images.insert(make_pair(name, ScriptableImage(img))); style().choice_images.insert(make_pair(name, ScriptableImage(img)));
...@@ -197,7 +197,7 @@ void DropDownChoiceListBase::generateThumbnailImages() { ...@@ -197,7 +197,7 @@ void DropDownChoiceListBase::generateThumbnailImages() {
if (i >= image_count || status != THUMB_OK) { if (i >= image_count || status != THUMB_OK) {
// update image // update image
ChoiceStyle& s = style(); ChoiceStyle& s = style();
String name = cannocial_name_form(s.field().choices->choiceName(i)); String name = canonical_name_form(s.field().choices->choiceName(i));
ScriptableImage& img = s.choice_images[name]; ScriptableImage& img = s.choice_images[name];
if (!img.update(ctx) && status == THUMB_CHANGED) { if (!img.update(ctx) && status == THUMB_CHANGED) {
status = THUMB_OK; // no need to rebuild status = THUMB_OK; // no need to rebuild
......
...@@ -58,7 +58,7 @@ void MultipleChoiceValueViewer::drawChoice(RotatedDC& dc, RealPoint& pos, const ...@@ -58,7 +58,7 @@ void MultipleChoiceValueViewer::drawChoice(RotatedDC& dc, RealPoint& pos, const
size = add_horizontal(size, RealSize(14,16)); size = add_horizontal(size, RealSize(14,16));
} }
if (style().render_style & RENDER_IMAGE) { if (style().render_style & RENDER_IMAGE) {
map<String,ScriptableImage>::iterator it = style().choice_images.find(cannocial_name_form(choice)); map<String,ScriptableImage>::iterator it = style().choice_images.find(canonical_name_form(choice));
if (it != style().choice_images.end() && it->second.isReady()) { if (it != style().choice_images.end() && it->second.isReady()) {
// TODO: caching // TODO: caching
GeneratedImage::Options options(0,0, &getStylePackage(), &getLocalPackage()); GeneratedImage::Options options(0,0, &getStylePackage(), &getLocalPackage());
......
...@@ -59,12 +59,12 @@ String get_export_full_path(String& rel_name) { ...@@ -59,12 +59,12 @@ String get_export_full_path(String& rel_name) {
// ----------------------------------------------------------------------------- : HTML // ----------------------------------------------------------------------------- : HTML
// An HTML tag // An HTML tag
struct Tag { struct Tag {
Tag(const Char* open_tag, const Char* close_tag) Tag(const Char* open_tag, const Char* close_tag)
: open_tag(open_tag), close_tag(close_tag), opened(0) : open_tag(open_tag), close_tag(close_tag), opened(0)
{} {}
const Char* open_tag; ///< The tags to insert in HTML "<tag>" const Char* open_tag; ///< The tags to insert in HTML "<tag>"
const Char* close_tag; ///< The tags to insert in HTML "</tag>" const Char* close_tag; ///< The tags to insert in HTML "</tag>"
int opened; ///< How often is the tag opened in the input? int opened; ///< How often is the tag opened in the input?
/// Write an open or close tag to a string if needed /// Write an open or close tag to a string if needed
...@@ -80,198 +80,198 @@ struct Tag { ...@@ -80,198 +80,198 @@ struct Tag {
} }
} }
}; };
// A tag, or a close tag // A tag, or a close tag
struct NegTag { struct NegTag {
Tag* tag; Tag* tag;
bool neg; // a close tag instead of an open tag bool neg; // a close tag instead of an open tag
NegTag(Tag* tag, bool neg) : tag(tag), neg(neg) {} NegTag(Tag* tag, bool neg) : tag(tag), neg(neg) {}
}; };
DECLARE_TYPEOF_COLLECTION(NegTag); DECLARE_TYPEOF_COLLECTION(NegTag);
/// A stack of opened HTML tags /// A stack of opened HTML tags
class TagStack { class TagStack {
public: public:
void open(String& ret, Tag& tag) { void open(String& ret, Tag& tag) {
add(ret, NegTag(&tag, false)); add(ret, NegTag(&tag, false));
} }
void close(String& ret, Tag& tag) { void close(String& ret, Tag& tag) {
add(ret, NegTag(&tag, true)); add(ret, NegTag(&tag, true));
} }
// Close all tags, should be called at end of input // Close all tags, should be called at end of input
void close_all(String& ret) { void close_all(String& ret) {
// cancel out tags with pending tags // cancel out tags with pending tags
write_pending_tags(ret); write_pending_tags(ret);
// close all open tags // close all open tags
while (!tags.empty()) { while (!tags.empty()) {
tags.back()->write(ret, true); tags.back()->write(ret, true);
tags.pop_back(); tags.pop_back();
} }
} }
// Write all pending tags, should be called before non-tag output // Write all pending tags, should be called before non-tag output
void write_pending_tags(String& ret) { void write_pending_tags(String& ret) {
FOR_EACH(t, pending_tags) { FOR_EACH(t, pending_tags) {
t.tag->write(ret, t.neg); t.tag->write(ret, t.neg);
if (!t.neg) tags.push_back(t.tag); if (!t.neg) tags.push_back(t.tag);
} }
pending_tags.clear(); pending_tags.clear();
} }
private: private:
vector<Tag*> tags; ///< Tags opened in the html output vector<Tag*> tags; ///< Tags opened in the html output
vector<NegTag> pending_tags; ///< Tags opened in the tagged string, but not (yet) in the output vector<NegTag> pending_tags; ///< Tags opened in the tagged string, but not (yet) in the output
void add(String& ret, const NegTag& tag) { void add(String& ret, const NegTag& tag) {
// Cancel out with pending tag? // Cancel out with pending tag?
for (int i = (int)pending_tags.size() - 1 ; i >= 0 ; --i) { for (int i = (int)pending_tags.size() - 1 ; i >= 0 ; --i) {
if (pending_tags[i].tag == tag.tag) { if (pending_tags[i].tag == tag.tag) {
if (pending_tags[i].neg != tag.neg) { if (pending_tags[i].neg != tag.neg) {
pending_tags.erase(pending_tags.begin() + i); pending_tags.erase(pending_tags.begin() + i);
return; return;
} else { } else {
break; // look no further break; // look no further
} }
} }
} }
// Cancel out with existing tag? // Cancel out with existing tag?
if (tag.neg) { if (tag.neg) {
for (int i = (int)tags.size() - 1 ; i >= 0 ; --i) { for (int i = (int)tags.size() - 1 ; i >= 0 ; --i) {
if (tags[i] == tag.tag) { if (tags[i] == tag.tag) {
// cancel out with existing tag i, e.g. <b>: // cancel out with existing tag i, e.g. <b>:
// situation was <a><b><c>text // situation was <a><b><c>text
// situation will become <a><b><c>text</c></b><c> // situation will become <a><b><c>text</c></b><c>
vector<NegTag> reopen; vector<NegTag> reopen;
for (int j = (int)tags.size() - 1 ; j > i ; --j) { for (int j = (int)tags.size() - 1 ; j > i ; --j) {
pending_tags.push_back(NegTag(tags[j], true)); // close tag, top down pending_tags.push_back(NegTag(tags[j], true)); // close tag, top down
tags.pop_back(); tags.pop_back();
} }
pending_tags.push_back(tag); // now close tag i pending_tags.push_back(tag); // now close tag i
for (int j = i + 1 ; j < (int)tags.size() ; ++j) { for (int j = i + 1 ; j < (int)tags.size() ; ++j) {
pending_tags.push_back(NegTag(tags[j], false)); // reopen later, bottom up pending_tags.push_back(NegTag(tags[j], false)); // reopen later, bottom up
tags.pop_back(); tags.pop_back();
} }
tags.resize(i); tags.resize(i);
return; return;
} }
} }
} }
// Just insert normally // Just insert normally
pending_tags.push_back(tag); pending_tags.push_back(tag);
} }
}; };
// html-escape a string // html-escape a string
String html_escape(const String& str) { String html_escape(const String& str) {
String ret; String ret;
FOR_EACH_CONST(c, str) { FOR_EACH_CONST(c, str) {
if (c == _('\1') || c == _('<')) { // escape < if (c == _('\1') || c == _('<')) { // escape <
ret += _("&lt;"); ret += _("&lt;");
} else if (c == _('>')) { // escape > } else if (c == _('>')) { // escape >
ret += _("&gt;"); ret += _("&gt;");
} else if (c == _('&')) { // escape & } else if (c == _('&')) { // escape &
ret += _("&amp;"); ret += _("&amp;");
} else if (c == _('\'')) { // escape ' } else if (c == _('\'')) { // escape '
ret += _("&#39;"); ret += _("&#39;");
} else if (c == _('\"')) { // escape " } else if (c == _('\"')) { // escape "
ret += _("&quot;"); ret += _("&quot;");
} else if (c >= 0x80) { // escape non ascii } else if (c >= 0x80) { // escape non ascii
ret += String(_("&#")) << (int)c << _(';'); ret += String(_("&#")) << (int)c << _(';');
} else { } else {
ret += c; ret += c;
} }
} }
return ret; return ret;
} }
// write symbols to html // write symbols to html
String symbols_to_html(const String& str, SymbolFont& symbol_font, double size) { String symbols_to_html(const String& str, SymbolFont& symbol_font, double size) {
guard_export_info(_("symbols_to_html")); guard_export_info(_("symbols_to_html"));
ExportInfo& ei = *export_info(); ExportInfo& ei = *export_info();
vector<SymbolFont::DrawableSymbol> symbols; vector<SymbolFont::DrawableSymbol> symbols;
symbol_font.split(str, symbols); symbol_font.split(str, symbols);
String html; String html;
FOR_EACH(sym, symbols) { FOR_EACH(sym, symbols) {
String filename = symbol_font.name() + _("-") + clean_filename(sym.text) + _(".png"); String filename = symbol_font.name() + _("-") + clean_filename(sym.text) + _(".png");
map<String,wxSize>::iterator it = ei.exported_images.find(filename); map<String,wxSize>::iterator it = ei.exported_images.find(filename);
if (it == ei.exported_images.end()) { if (it == ei.exported_images.end()) {
// save symbol image // save symbol image
Image img = symbol_font.getImage(size, sym); Image img = symbol_font.getImage(size, sym);
wxFileName fn; wxFileName fn;
fn.SetPath(ei.directory_absolute); fn.SetPath(ei.directory_absolute);
fn.SetFullName(filename); fn.SetFullName(filename);
img.SaveFile(fn.GetFullPath()); img.SaveFile(fn.GetFullPath());
it = ei.exported_images.insert(make_pair(filename, wxSize(img.GetWidth(), img.GetHeight()))).first; it = ei.exported_images.insert(make_pair(filename, wxSize(img.GetWidth(), img.GetHeight()))).first;
} }
html += _("<img src='") + filename + _("' alt='") + html_escape(sym.text) html += _("<img src='") + filename + _("' alt='") + html_escape(sym.text)
+ _("' width='") + (String() << it->second.x) + _("' width='") + (String() << it->second.x)
+ _("' height='") + (String() << it->second.y) + _("'>"); + _("' height='") + (String() << it->second.y) + _("'>");
} }
return html; return html;
} }
String to_html(const String& str_in, const SymbolFontP& symbol_font, double symbol_size) { String to_html(const String& str_in, const SymbolFontP& symbol_font, double symbol_size) {
String str = remove_tag_contents(str_in,_("<sep-soft")); String str = remove_tag_contents(str_in,_("<sep-soft"));
String ret; String ret;
Tag bold (_("<b>"), _("</b>")), Tag bold (_("<b>"), _("</b>")),
italic(_("<i>"), _("</i>")), italic(_("<i>"), _("</i>")),
symbol(_("<span class=\"symbol\">"), _("</span>")); symbol(_("<span class=\"symbol\">"), _("</span>"));
TagStack tags; TagStack tags;
String symbols; String symbols;
for (size_t i = 0 ; i < str.size() ; ) { for (size_t i = 0 ; i < str.size() ; ) {
Char c = str.GetChar(i); Char c = str.GetChar(i);
if (c == _('<')) { if (c == _('<')) {
++i; ++i;
if (is_substr(str, i, _("b"))) { if (is_substr(str, i, _("b"))) {
tags.open (ret, bold); tags.open (ret, bold);
} else if (is_substr(str, i, _("/b"))) { } else if (is_substr(str, i, _("/b"))) {
tags.close(ret, bold); tags.close(ret, bold);
} else if (is_substr(str, i, _("i"))) { } else if (is_substr(str, i, _("i"))) {
tags.open (ret, italic); tags.open (ret, italic);
} else if (is_substr(str, i, _("/i"))) { } else if (is_substr(str, i, _("/i"))) {
tags.close(ret, italic); tags.close(ret, italic);
} else if (is_substr(str, i, _("sym"))) { } else if (is_substr(str, i, _("sym"))) {
tags.open (ret, symbol); tags.open (ret, symbol);
} else if (is_substr(str, i, _("/sym"))) { } else if (is_substr(str, i, _("/sym"))) {
if (!symbols.empty()) { if (!symbols.empty()) {
// write symbols in a special way // write symbols in a special way
tags.write_pending_tags(ret); tags.write_pending_tags(ret);
ret += symbols_to_html(symbols, *symbol_font, symbol_size); ret += symbols_to_html(symbols, *symbol_font, symbol_size);
symbols.clear(); symbols.clear();
} }
tags.close(ret, symbol); tags.close(ret, symbol);
} }
i = skip_tag(str, i-1); i = skip_tag(str, i-1);
} else { } else {
// normal character // normal character
tags.write_pending_tags(ret); tags.write_pending_tags(ret);
++i; ++i;
if (symbol.opened > 0 && symbol_font) { if (symbol.opened > 0 && symbol_font) {
symbols += c; // write as symbols instead symbols += c; // write as symbols instead
} else { } else {
c = untag_char(c); c = untag_char(c);
if (c == _('<')) { // escape < if (c == _('<')) { // escape <
ret += _("&lt;"); ret += _("&lt;");
} else if (c == _('&')) { // escape & } else if (c == _('&')) { // escape &
ret += _("&amp;"); ret += _("&amp;");
} else if (c >= 0x80) { // escape non ascii } else if (c >= 0x80) { // escape non ascii
ret += String(_("&#")) << (int)c << _(';'); ret += String(_("&#")) << (int)c << _(';');
} else if (c == _('\n')) { } else if (c == _('\n')) {
ret += _("<br>\n"); ret += _("<br>\n");
} else { } else {
ret += c; ret += c;
} }
} }
} }
} }
// end of input // end of input
if (!symbols.empty()) { if (!symbols.empty()) {
tags.write_pending_tags(ret); tags.write_pending_tags(ret);
ret += symbols_to_html(symbols, *symbol_font, symbol_size); ret += symbols_to_html(symbols, *symbol_font, symbol_size);
symbols.clear(); symbols.clear();
} }
tags.close_all(ret); tags.close_all(ret);
return ret; return ret;
} }
// convert a tagged string to html // convert a tagged string to html
...@@ -300,57 +300,57 @@ SCRIPT_FUNCTION(symbols_to_html) { ...@@ -300,57 +300,57 @@ SCRIPT_FUNCTION(symbols_to_html) {
} }
// ----------------------------------------------------------------------------- : BB Code // ----------------------------------------------------------------------------- : BB Code
String to_bbcode(const String& str_in) { String to_bbcode(const String& str_in) {
String str = remove_tag_contents(str_in,_("<sep-soft")); String str = remove_tag_contents(str_in,_("<sep-soft"));
String ret; String ret;
Tag bold (_("[b]"), _("[/b]")), Tag bold (_("[b]"), _("[/b]")),
italic(_("[i]"), _("[/i]")); italic(_("[i]"), _("[/i]"));
TagStack tags; TagStack tags;
String symbols; String symbols;
for (size_t i = 0 ; i < str.size() ; ) { for (size_t i = 0 ; i < str.size() ; ) {
Char c = str.GetChar(i); Char c = str.GetChar(i);
if (c == _('<')) { if (c == _('<')) {
++i; ++i;
if (is_substr(str, i, _("b"))) { if (is_substr(str, i, _("b"))) {
tags.open (ret, bold); tags.open (ret, bold);
} else if (is_substr(str, i, _("/b"))) { } else if (is_substr(str, i, _("/b"))) {
tags.close(ret, bold); tags.close(ret, bold);
} else if (is_substr(str, i, _("i"))) { } else if (is_substr(str, i, _("i"))) {
tags.open (ret, italic); tags.open (ret, italic);
} else if (is_substr(str, i, _("/i"))) { } else if (is_substr(str, i, _("/i"))) {
tags.close(ret, italic); tags.close(ret, italic);
} /*else if (is_substr(str, i, _("sym"))) { } /*else if (is_substr(str, i, _("sym"))) {
tags.open (ret, symbol); tags.open (ret, symbol);
} else if (is_substr(str, i, _("/sym"))) { } else if (is_substr(str, i, _("/sym"))) {
if (!symbols.empty()) { if (!symbols.empty()) {
// write symbols in a special way // write symbols in a special way
tags.write_pending_tags(ret); tags.write_pending_tags(ret);
ret += symbols_to_html(symbols, symbol_font); ret += symbols_to_html(symbols, symbol_font);
symbols.clear(); symbols.clear();
} }
tags.close(ret, symbol); tags.close(ret, symbol);
}*/ }*/
i = skip_tag(str, i-1); i = skip_tag(str, i-1);
} else { } else {
// normal character // normal character
tags.write_pending_tags(ret); tags.write_pending_tags(ret);
++i; ++i;
// if (symbol.opened > 0 && symbol_font) { // if (symbol.opened > 0 && symbol_font) {
// symbols += c; // write as symbols instead // symbols += c; // write as symbols instead
// } else { // } else {
ret += untag_char(c); ret += untag_char(c);
// } // }
} }
} }
// end of input // end of input
/* if (!symbols.empty()) { /* if (!symbols.empty()) {
tags.write_pending_tags(ret); tags.write_pending_tags(ret);
ret += symbols_to_html(symbols, symbol_font); ret += symbols_to_html(symbols, symbol_font);
symbols.clear(); symbols.clear();
}*/ }*/
tags.close_all(ret); tags.close_all(ret);
return ret; return ret;
} }
// convert a tagged string to BBCode // convert a tagged string to BBCode
...@@ -443,6 +443,12 @@ SCRIPT_FUNCTION(write_set_file) { ...@@ -443,6 +443,12 @@ SCRIPT_FUNCTION(write_set_file) {
} }
SCRIPT_FUNCTION(sanitize) {
SCRIPT_PARAM_C(String, input);
//TODO
SCRIPT_RETURN(input);
}
// ----------------------------------------------------------------------------- : Init // ----------------------------------------------------------------------------- : Init
void init_script_export_functions(Context& ctx) { void init_script_export_functions(Context& ctx) {
...@@ -453,4 +459,5 @@ void init_script_export_functions(Context& ctx) { ...@@ -453,4 +459,5 @@ void init_script_export_functions(Context& ctx) {
ctx.setVariable(_("write text file"), script_write_text_file); ctx.setVariable(_("write text file"), script_write_text_file);
ctx.setVariable(_("write image file"), script_write_image_file); ctx.setVariable(_("write image file"), script_write_image_file);
ctx.setVariable(_("write set file"), script_write_set_file); ctx.setVariable(_("write set file"), script_write_set_file);
ctx.setVariable(_("sanitize"), script_sanitize);
} }
...@@ -210,7 +210,7 @@ void TokenIterator::readToken() { ...@@ -210,7 +210,7 @@ void TokenIterator::readToken() {
// name, or a number after a . token, as in array.0 // name, or a number after a . token, as in array.0
size_t start = pos - 1; size_t start = pos - 1;
while (pos < input.size() && isAlnum_(input.GetChar(pos))) ++pos; while (pos < input.size() && isAlnum_(input.GetChar(pos))) ++pos;
addToken(TOK_NAME, cannocial_name_form(input.substr(start, pos-start)), start); // convert name to cannocial form addToken(TOK_NAME, canonical_name_form(input.substr(start, pos-start)), start); // convert name to cannocial form
} else if (isDigit(c)) { } else if (isDigit(c)) {
// number // number
size_t start = pos - 1; size_t start = pos - 1;
......
...@@ -27,7 +27,7 @@ Variable string_to_variable(const String& s) { ...@@ -27,7 +27,7 @@ Variable string_to_variable(const String& s) {
if (it == variables.end()) { if (it == variables.end()) {
#ifdef _DEBUG #ifdef _DEBUG
variable_names.push_back(s); variable_names.push_back(s);
assert(s == cannocial_name_form(s)); // only use cannocial names assert(s == canonical_name_form(s)); // only use cannocial names
#endif #endif
Variable v = (Variable)variables.size(); Variable v = (Variable)variables.size();
variables.insert(make_pair(s,v)); variables.insert(make_pair(s,v));
......
...@@ -257,7 +257,7 @@ void Reader::readLine(bool in_string) { ...@@ -257,7 +257,7 @@ void Reader::readLine(bool in_string) {
indent += 1; indent += 1;
} }
} }
key = cannocial_name_form(trim(key)); key = canonical_name_form(trim(key));
value = pos == String::npos ? _("") : trim_left(line.substr(pos+1)); value = pos == String::npos ? _("") : trim_left(line.substr(pos+1));
if (key.empty() && pos!=String::npos) key = _(" "); // we don't want an empty key if there was a colon if (key.empty() && pos!=String::npos) key = _(" "); // we don't want an empty key if there was a colon
} }
......
...@@ -51,7 +51,7 @@ void Writer::writePending() { ...@@ -51,7 +51,7 @@ void Writer::writePending() {
} }
indentation += 1; indentation += 1;
writeIndentation(); writeIndentation();
writeUTF8(stream, cannocial_name_form(pending_opened[i])); writeUTF8(stream, canonical_name_form(pending_opened[i]));
} }
pending_opened.clear(); pending_opened.clear();
} }
......
...@@ -178,7 +178,7 @@ String capitalize_sentence(const String& s) { ...@@ -178,7 +178,7 @@ String capitalize_sentence(const String& s) {
return ret; return ret;
} }
String cannocial_name_form(const String& str) { String canonical_name_form(const String& str) {
String ret; String ret;
ret.reserve(str.size()); ret.reserve(str.size());
bool leading = true; bool leading = true;
......
...@@ -152,12 +152,12 @@ String capitalize(const String&); ...@@ -152,12 +152,12 @@ String capitalize(const String&);
/** for use in dialogs */ /** for use in dialogs */
String capitalize_sentence(const String&); String capitalize_sentence(const String&);
/// Convert a field name to cannocial form /// Convert a field name to canonical form
/** - lower case and ' ' instead of '_'. /** - lower case and ' ' instead of '_'.
* - non alphanumeric characters are droped * - non alphanumeric characters are droped
* - "camalCase" is converted to words "camel case" (TODO) * - "camalCase" is converted to words "camel case" (TODO)
*/ */
String cannocial_name_form(const String&); String canonical_name_form(const String&);
/// Returns the singular form of a string /// Returns the singular form of a string
/** Used for reflection, for example "vector<T> apples" is written with keys /** Used for reflection, for example "vector<T> apples" is written with keys
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment