Loading services/vr/performanced/performance_service_tests.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -12,16 +12,16 @@ #include <thread> #include <utility> #include <android-base/strings.h> #include <android-base/unique_fd.h> #include <dvr/performance_client_api.h> #include <gtest/gtest.h> #include <private/android_filesystem_config.h> #include "stdio_filebuf.h" #include "string_trim.h" #include "unique_file.h" using android::dvr::Trim; using android::base::Trim; using android::dvr::UniqueFile; using android::dvr::stdio_filebuf; Loading services/vr/performanced/string_trim.hdeleted 100644 → 0 +0 −46 Original line number Diff line number Diff line #ifndef ANDROID_DVR_PERFORMANCED_STRING_TRIM_H_ #define ANDROID_DVR_PERFORMANCED_STRING_TRIM_H_ #include <functional> #include <locale> #include <string> namespace android { namespace dvr { // Trims whitespace from the left side of |subject| and returns the result as a // new string. inline std::string LeftTrim(std::string subject) { subject.erase(subject.begin(), std::find_if(subject.begin(), subject.end(), std::not1(std::ptr_fun<int, int>(std::isspace)))); return subject; } // Trims whitespace from the right side of |subject| and returns the result as a // new string. inline std::string RightTrim(std::string subject) { subject.erase(std::find_if(subject.rbegin(), subject.rend(), std::not1(std::ptr_fun<int, int>(std::isspace))) .base(), subject.end()); return subject; } // Trims whitespace from the both sides of |subject| and returns the result as a // new string. inline std::string Trim(std::string subject) { subject.erase(subject.begin(), std::find_if(subject.begin(), subject.end(), std::not1(std::ptr_fun<int, int>(std::isspace)))); subject.erase(std::find_if(subject.rbegin(), subject.rend(), std::not1(std::ptr_fun<int, int>(std::isspace))) .base(), subject.end()); return subject; } } // namespace dvr } // namespace android #endif // ANDROID_DVR_PERFORMANCED_STRING_TRIM_H_ services/vr/performanced/task.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -10,10 +10,10 @@ #include <memory> #include <sstream> #include <android-base/strings.h> #include <android-base/unique_fd.h> #include "stdio_filebuf.h" #include "string_trim.h" namespace { Loading Loading @@ -102,7 +102,7 @@ std::string Task::GetStatusField(const std::string& field) const { // The status file has lines with the format <field>:<value>. Extract the // value after the colon. return Trim(line.substr(offset + field.size() + 1)); return android::base::Trim(line.substr(offset + field.size() + 1)); } } Loading @@ -123,7 +123,7 @@ void Task::ReadStatusFields() { } std::string key = line.substr(0, offset); std::string value = Trim(line.substr(offset + 1)); std::string value = android::base::Trim(line.substr(offset + 1)); ALOGD_IF(TRACE, "Task::ReadStatusFields: key=\"%s\" value=\"%s\"", key.c_str(), value.c_str()); Loading Loading @@ -156,7 +156,7 @@ std::string Task::GetCpuSetPath() const { std::string line = ""; std::getline(file_stream, line); return Trim(line); return android::base::Trim(line); } else { return ""; } Loading Loading
services/vr/performanced/performance_service_tests.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -12,16 +12,16 @@ #include <thread> #include <utility> #include <android-base/strings.h> #include <android-base/unique_fd.h> #include <dvr/performance_client_api.h> #include <gtest/gtest.h> #include <private/android_filesystem_config.h> #include "stdio_filebuf.h" #include "string_trim.h" #include "unique_file.h" using android::dvr::Trim; using android::base::Trim; using android::dvr::UniqueFile; using android::dvr::stdio_filebuf; Loading
services/vr/performanced/string_trim.hdeleted 100644 → 0 +0 −46 Original line number Diff line number Diff line #ifndef ANDROID_DVR_PERFORMANCED_STRING_TRIM_H_ #define ANDROID_DVR_PERFORMANCED_STRING_TRIM_H_ #include <functional> #include <locale> #include <string> namespace android { namespace dvr { // Trims whitespace from the left side of |subject| and returns the result as a // new string. inline std::string LeftTrim(std::string subject) { subject.erase(subject.begin(), std::find_if(subject.begin(), subject.end(), std::not1(std::ptr_fun<int, int>(std::isspace)))); return subject; } // Trims whitespace from the right side of |subject| and returns the result as a // new string. inline std::string RightTrim(std::string subject) { subject.erase(std::find_if(subject.rbegin(), subject.rend(), std::not1(std::ptr_fun<int, int>(std::isspace))) .base(), subject.end()); return subject; } // Trims whitespace from the both sides of |subject| and returns the result as a // new string. inline std::string Trim(std::string subject) { subject.erase(subject.begin(), std::find_if(subject.begin(), subject.end(), std::not1(std::ptr_fun<int, int>(std::isspace)))); subject.erase(std::find_if(subject.rbegin(), subject.rend(), std::not1(std::ptr_fun<int, int>(std::isspace))) .base(), subject.end()); return subject; } } // namespace dvr } // namespace android #endif // ANDROID_DVR_PERFORMANCED_STRING_TRIM_H_
services/vr/performanced/task.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -10,10 +10,10 @@ #include <memory> #include <sstream> #include <android-base/strings.h> #include <android-base/unique_fd.h> #include "stdio_filebuf.h" #include "string_trim.h" namespace { Loading Loading @@ -102,7 +102,7 @@ std::string Task::GetStatusField(const std::string& field) const { // The status file has lines with the format <field>:<value>. Extract the // value after the colon. return Trim(line.substr(offset + field.size() + 1)); return android::base::Trim(line.substr(offset + field.size() + 1)); } } Loading @@ -123,7 +123,7 @@ void Task::ReadStatusFields() { } std::string key = line.substr(0, offset); std::string value = Trim(line.substr(offset + 1)); std::string value = android::base::Trim(line.substr(offset + 1)); ALOGD_IF(TRACE, "Task::ReadStatusFields: key=\"%s\" value=\"%s\"", key.c_str(), value.c_str()); Loading Loading @@ -156,7 +156,7 @@ std::string Task::GetCpuSetPath() const { std::string line = ""; std::getline(file_stream, line); return Trim(line); return android::base::Trim(line); } else { return ""; } Loading