Commit 55dd8372 authored by Anonymous's avatar Anonymous

Clang-tidy modification

parent 499cdd91
......@@ -9,7 +9,7 @@ find_package(Boost COMPONENTS program_options)
if(Boost_FOUND)
SET( CMAKE_CXX_FLAGS "-std=c++0x")
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
# SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
......
......@@ -43,7 +43,7 @@ Chronicle::str (vector<string> events) const {
std::string
Chronicle::json(const std::vector<std::string> &events) const {
return json(events,NULL);
return json(events, nullptr);
}
std::string
......@@ -66,7 +66,7 @@ Chronicle::txt (
for (int j = i+1; j < nb_e; j++) {
const TCIterator tc = getConstraint(str_indice(i,j));
os << i << ", " << j << ": (";
if (disc != NULL) {
if (disc != nullptr) {
if ((*disc)[str_indice(i, j)].first) os << tc->getStart();
else os << "-inf";
os << ", ";
......@@ -84,12 +84,12 @@ Chronicle::txt (
else
os << "f: " << frequency << "/" << ofrequency << std::endl;
if (tid_list_pos.size() > 0) {
if (!tid_list_pos.empty()) {
os << "positives: [" << tid_list_pos[0];
for (unsigned i = 1; i < tid_list_pos.size(); i++) os << ", " << tid_list_pos[i];
os << "]" << std::endl;
}
if (tid_list_neg.size() > 0) {
if (!tid_list_neg.empty()) {
os << "negatives: [" << tid_list_neg[0];
for (unsigned i = 1; i < tid_list_neg.size(); i++) os << ", " << tid_list_neg[i];
os << "]" << std::endl;
......@@ -107,11 +107,11 @@ Chronicle::json (
std::stringstream os;
int nb_e = size();
os << "{ \"id\" : \"" << id << "\", ";
os << R"({ "id" : ")" << id << "\", ";
os << "\"nodes\": [";
for (int i = 0; i < nb_e; i++) {
int e = getElement(i);
os << "{\"id\": \"" << i <<"\", \"label\": \""<< events[e] << "\"}";
os << R"({"id": ")" << i << R"(", "label": ")" << events[e] << "\"}";
if (i+1 < nb_e) os << ",";
}
......@@ -121,29 +121,29 @@ Chronicle::json (
for (int i = 0; i < nb_e; i++) {
for (int j = i+1; j < nb_e; j++) {
const TCIterator tc = getConstraint(str_indice(i,j));
os << "{\"source\": \"" << i << "\", \"target\": \"" << j << "\", ";
os << "\"inf\": \"" << tc->getStart() << "\", \"sup\": \"" << tc->getEnd() << "\", ";
if (disc != NULL)
os << "\"inf_dis\": \"" << (*disc)[str_indice(i,j)].first << "\", \"sup_dis\": \"" << (*disc)[str_indice(i,j)].second << "}";
os << R"({"source": ")" << i << R"(", "target": ")" << j << "\", ";
os << R"("inf": ")" << tc->getStart() << R"(", "sup": ")" << tc->getEnd() << "\", ";
if (disc != nullptr)
os << R"("inf_dis": ")" << (*disc)[str_indice(i,j)].first << R"(", "sup_dis": ")" << (*disc)[str_indice(i,j)].second << "}";
if (i+2 < nb_e || j+1 < nb_e) os << ",";
}
}
os << "],";
if (tid_list_pos.size() > 0) {
os << "\"positives\": [\"" << tid_list_pos[0] << "\"";
if (!tid_list_pos.empty()) {
os << R"("positives": [")" << tid_list_pos[0] << "\"";
for (unsigned i = 1; i < tid_list_pos.size(); i++) os << ", \"" << tid_list_pos[i] << "\"";
os << "]," << std::endl;
}
if (tid_list_neg.size() > 0) {
os << "\"negatives\": [\"" << tid_list_neg[0] << "\"";
if (!tid_list_neg.empty()) {
os << R"("negatives": [")" << tid_list_neg[0] << "\"";
for (unsigned i = 1; i < tid_list_neg.size(); i++) os << ", \"" << tid_list_neg[i] << "\"";
os << "]," << std::endl;
}
if (ofrequency == -1)
os << "\"frequency\": \"" << frequency << "\"}" << std::endl;
os << R"("frequency": ")" << frequency << "\"}" << std::endl;
else
os << "\"frequency\": \"" << frequency << "/" << ofrequency << "\"}" << std::endl;
os << R"("frequency": ")" << frequency << "/" << ofrequency << "\"}" << std::endl;
return os.str();
}
......
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