Abdelrazak Younes wrote:
Ozgur Ugras BARAN wrote:
variable that we compare with empty string is of type const char, not
string.. A possible way of doing it would be:
!string(listings_param_table[idx].name).empty()
Ah... OK, I didn't get the thing.
Why don't you use string in the first place (in listings_param_table) ?
Like this.
Index: InsetListingsParams.cpp
===================================================================
--- InsetListingsParams.cpp (revision 18515)
+++ InsetListingsParams.cpp (working copy)
@@ -55,9 +55,9 @@
*/
struct listings_param_info {
/// name of the parameter
- char const * name;
+ string name;
/// default value
- char const * value;
+ string value;
// for option with value "true", "false",
// if onoff is true,
// "true": option
@@ -80,9 +80,9 @@
// (e.g. floatplacement can be one or more of *tbph)
param_type type;
/// parameter info, meaning depending on parameter type
- char const * info;
+ string info;
/// a help message that is displayed in the gui
- char const * hint;
+ string hint;
};
@@ -302,7 +302,7 @@
while (listings_param_table[idx].name != name &&
listings_param_table[idx].name != string())
++idx;
// found the name
- if (listings_param_table[idx].name != "") {
+ if (!listings_param_table[idx].name.empty()) {
info = &listings_param_table[idx];
return;
}
@@ -342,7 +342,7 @@
switch (info->type) {
case ALL:
if (par2.empty() && !info->onoff) {
- if (info->hint != "")
+ if (!info->hint.empty())
throw invalidParam(from_utf8(info->hint));
else
throw invalidParam(_("A value is expected"));
@@ -352,7 +352,7 @@
return;
case TRUEFALSE: {
if (par2.empty() && !info->onoff) {
- if (info->hint != "")
+ if (!info->hint.empty())
throw invalidParam(from_utf8(info->hint));
else
throw invalidParam(_("Please specify true or
false"));
@@ -366,7 +366,7 @@
}
case INTEGER: {
if (!isStrInt(par2)) {
- if (info->hint != "")
+ if (!info->hint.empty())
throw invalidParam(from_utf8(info->hint));
else
throw invalidParam(_("Please specify an integer
value"));
@@ -380,7 +380,7 @@
}
case LENGTH: {
if (par2.empty() && !info->onoff) {
- if (info->hint != "")
+ if (!info->hint.empty())
throw invalidParam(from_utf8(info->hint));
else
throw invalidParam(_("Please specify a latex
length expression"));
@@ -394,7 +394,7 @@
}
case ONEOF: {
if (par2.empty() && !info->onoff) {
- if (info->hint != "")
+ if (!info->hint.empty())
throw invalidParam(from_utf8(info->hint));
else
throw invalidParam(bformat(_("Please specify
one of %1$s"),
@@ -440,7 +440,7 @@
}
case SUBSETOF: {
if (par2.empty() && !info->onoff) {
- if (info->hint != "")
+ if (!info->hint.empty())
throw invalidParam(from_utf8(info->hint));
else
throw invalidParam(bformat(_("Please specify
one or more of '%1$s'"),