pclose(fp);
String result = msgbuf.str();
- result.Trim();
- return result;
+ return result.Trim();
}
int ReleaseHelper(std::string &result)
Dictionary::Ptr my_master_endpoint = new Dictionary();
if (tokens.size() > 1) {
- String host = tokens[1];
- host.Trim();
+ String host = tokens[1].Trim();
if (!host.IsEmpty())
my_master_endpoint->Set("host", host);
}
if (tokens.size() > 2) {
- String port = tokens[2];
- port.Trim();
+ String port = tokens[2].Trim();
if (!port.IsEmpty())
my_master_endpoint->Set("port", port);
}
- String cn = tokens[0];
- cn.Trim();
+ String cn = tokens[0].Trim();
my_master_endpoint->Set("__name", cn);
my_master_endpoint->Set("__type", "Endpoint");
answer = Utility::GetFQDN();
String cn = answer;
- cn.Trim();
+ cn = cn.Trim();
std::cout << ConsoleColorTag(Console_Bold) << "Please specifiy the local zone name" << ConsoleColorTag(Console_Normal) << " [" << cn << "]: ";
answer = cn;
String local_zone = answer;
- local_zone.Trim();
+ local_zone = local_zone.Trim();
std::vector<std::string> endpoints;
}
endpoint_buffer = answer;
- endpoint_buffer.Trim();
+ endpoint_buffer = endpoint_buffer.Trim();
std::cout << "Do you want to establish a connection to the master " << ConsoleColorTag(Console_Bold) << "from this node?" << ConsoleColorTag(Console_Normal) << " [Y/n]: ";
}
String tmp = answer;
- tmp.Trim();
+ tmp = tmp.Trim();
+
endpoint_buffer += "," + tmp;
master_endpoint_name = tmp; //store the endpoint name for later
else
tmp = "5665";
- tmp.Trim();
- endpoint_buffer += "," + tmp;
+ endpoint_buffer += "," + tmp.Trim();
}
endpoints.push_back(endpoint_buffer);
goto wizard_master_host;
String master_host = answer;
- master_host.Trim();
+ master_host = master_host.Trim();
std::cout << ConsoleColorTag(Console_Bold) << "Port" << ConsoleColorTag(Console_Normal) << " [5665]: ";
answer = "5665";
String master_port = answer;
- master_port.Trim();
+ master_port = master_port.Trim();
/* workaround for fetching the master cert */
String pki_path = PkiUtility::GetPkiPath();
goto wizard_ticket;
String ticket = answer;
- ticket.Trim();
+ ticket = ticket.Trim();
Log(LogInformation, "cli")
<< "Processing self-signed certificate request. Ticket '" << ticket << "'.\n";
boost::algorithm::to_lower(answer);
String bind_host = answer;
- bind_host.Trim();
+ bind_host = bind_host.Trim();
std::cout << "Bind Port []: ";
boost::algorithm::to_lower(answer);
String bind_port = answer;
- bind_port.Trim();
+ bind_port = bind_port.Trim();
std::cout << ConsoleColorTag(Console_Bold) << "Accept config from master?" << ConsoleColorTag(Console_Normal) << " [y/N]: ";
std::getline(std::cin, answer);
answer = Utility::GetFQDN();
String cn = answer;
- cn.Trim();
+ cn = cn.Trim();
/* check whether the user wants to generate a new certificate or not */
String existing_path = PkiUtility::GetPkiPath() + "/" + cn + ".crt";
boost::algorithm::to_lower(answer);
String bind_host = answer;
- bind_host.Trim();
+ bind_host = bind_host.Trim();
std::cout << ConsoleColorTag(Console_Bold) << "Bind Port" << ConsoleColorTag(Console_Normal) << " []: ";
boost::algorithm::to_lower(answer);
String bind_port = answer;
- bind_port.Trim();
+ bind_port = bind_port.Trim();
/* api feature is always enabled, check above */
String apipath = FeatureUtility::GetFeaturesAvailablePath() + "/api.conf";
size_t pos = def.FindFirstOf('/');
if (pos != String::NPos) {
- String strStride = def.SubStr(pos + 1);
- strStride.Trim();
+ String strStride = def.SubStr(pos + 1).Trim();
*stride = Convert::ToLong(strStride);
/* Remove the stride parameter from the definition. */
pos = def.Find("- ");
if (pos != String::NPos) {
- String first = def.SubStr(0, pos);
- first.Trim();
+ String first = def.SubStr(0, pos).Trim();
- String second = def.SubStr(pos + 1);
- second.Trim();
+ String second = def.SubStr(pos + 1).Trim();
ParseTimeSpec(first, begin, NULL, reference);
size_t colon = text.FindFirstOf(':');
size_t colon_offset = colon - 13;
- String type = String(text.SubStr(13, colon_offset));
- String options = String(text.SubStr(colon + 1));
-
- type.Trim();
- options.Trim();
+ String type = String(text.SubStr(13, colon_offset)).Trim();
+ String options = String(text.SubStr(colon + 1)).Trim();
bag->Set("type", type);
bag->Set("options", options);
//OutputFormat:json or OutputFormat: json
if (line.GetLength() > col_index + 1)
- params = line.SubStr(col_index + 1);
-
- params.Trim();
+ params = line.SubStr(col_index + 1).Trim();
if (header == "ResponseHeader")
m_ResponseHeader = params;
<< pr.ExitStatus << ", output: " << pr.Output;
}
- String output = pr.Output;
- output.Trim();
+ String output = pr.Output.Trim();
+
std::pair<String, String> co = PluginUtility::ParseCheckOutput(output);
cr->SetCommand(commandLine);
cr->SetOutput(co.first);
String stage;
std::getline(fp, stage.GetData());
- stage.Trim();
fp.close();
if (fp.fail())
return "";
- return stage;
+ return stage.Trim();
}
String::SizeType pos = line.FindFirstOf(":");
if (pos == String::NPos)
BOOST_THROW_EXCEPTION(std::invalid_argument("Invalid HTTP request"));
- String key = line.SubStr(0, pos);
- boost::algorithm::to_lower(key);
- key.Trim();
- String value = line.SubStr(pos + 1);
- value.Trim();
+ String key = line.SubStr(0, pos).ToLower().Trim();
+
+ String value = line.SubStr(pos + 1).Trim();
Headers->Set(key, value);
if (key == "x-http-method-override")
BOOST_AUTO_TEST_CASE(trim)
{
String s1 = "hello";
- s1.Trim();
- BOOST_CHECK(s1 == "hello");
+ BOOST_CHECK(s1.Trim() == "hello");
String s2 = " hello";
- s2.Trim();
- BOOST_CHECK(s2 == "hello");
+ BOOST_CHECK(s2.Trim() == "hello");
String s3 = "hello ";
- s3.Trim();
- BOOST_CHECK(s3 == "hello");
+ BOOST_CHECK(s3.Trim() == "hello");
String s4 = " hello ";
- s4.Trim();
- BOOST_CHECK(s4 == "hello");
+ BOOST_CHECK(s4.Trim() == "hello");
}
BOOST_AUTO_TEST_CASE(contains)