59 size_t len = std::vsnprintf(
nullptr, 0, fmt, args);
65 std::vsnprintf((
char*)c_str(), len+1, fmt, args);
72 for (
size_t i = 0; i < size(); i++)
86 if (
pos == string::npos)
88 return substr(
pos + 1);
93 return (((x & 0x00000000000000ffLL) << 56) |
94 ((x & 0x000000000000ff00LL) << 40) |
95 ((x & 0x0000000000ff0000LL) << 24) |
96 ((x & 0x00000000ff000000LL) << 8) |
97 ((x & 0x000000ff00000000LL) >> 8) |
98 ((x & 0x0000ff0000000000LL) >> 24) |
99 ((x & 0x00ff000000000000LL) >> 40) |
100 ((x & 0xff00000000000000LL) >> 56));
106 ((x << 8) & 0x00FF0000) |
107 ((x >> 8) & 0x0000FF00) |
121 for (
size_t i = 0; i < str.size(); i++)
122 s.push_back(std::toupper(str[i], loc));
134 if (!str.empty() && str[str.size() - 1] ==
'"')
135 str.erase(str.size() - 1, 1);
141inline bool compare_str(
const string &str1,
const string &str2,
bool ignore_case)
149uint16_t
str_to_uint16(
const string &str,
bool * conversion_succeeded =
nullptr);
150uint32_t
str_to_uint32(
const string &str,
bool * conversion_succeeded =
nullptr);
151uint64_t
str_to_uint64(
const string &str,
bool * conversion_succeeded =
nullptr);
156 return (x + align - 1) / align * align;
162 return (x + align - 1) / align;
165inline std::string
trim(
const std::string &s)
167 auto wsfront = std::find_if_not(s.begin(), s.end(), [](
int c) {return std::isspace(c); });
168 return std::string(wsfront, std::find_if_not(s.rbegin(), std::string::const_reverse_iterator(wsfront), [](
int c) {return std::isspace(c); }).base());
bmap_mode uuu_get_bmap_mode()
Definition bmap.cpp:11
string get_file_name()
Definition libcomm.h:81
int format(const char *fmt,...)
Definition libcomm.h:55
void replace(char a, char b)
Definition libcomm.h:70
int get_libuuu_debug_level() noexcept
Definition error.cpp:52
uint16_t str_to_uint16(const string &str, bool *conversion_succeeded=nullptr)
Definition cmd.cpp:400
uint64_t EndianSwap(uint64_t x)
Definition libcomm.h:92
std::string trim(const std::string &s)
Definition libcomm.h:165
T round_up(T x, T align)
Definition libcomm.h:154
string remove_quota(string str)
Definition libcomm.h:127
static bool uuu_ignore_bmap()
Definition libcomm.h:175
void call_notify(struct uuu_notify nf)
Definition notify.cpp:62
uint64_t str_to_uint64(const string &str, bool *conversion_succeeded=nullptr)
Definition cmd.cpp:410
static bool uuu_force_bmap()
Definition libcomm.h:171
uint32_t str_to_uint32(const string &str, bool *conversion_succeeded=nullptr)
Definition cmd.cpp:405
T div_round_up(T x, T align)
Definition libcomm.h:160
int get_libusb_debug_level() noexcept
Definition error.cpp:47
bool compare_str(const string &str1, const string &str2, bool ignore_case)
Definition libcomm.h:141
string str_to_upper(const string &str)
Definition libcomm.h:116
@ Force
Definition libuuu.h:170
@ Ignore
Definition libuuu.h:171
auto pos
Definition usbhotplug.cpp:159