mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[ci] Upgrade to clang-format and clang-tidy 14 (NFC) (#4347)
This commit is contained in:
@@ -22,7 +22,9 @@ class Image {
|
||||
|
||||
public:
|
||||
#ifndef __linux__
|
||||
explicit Image(size_t capacity) { m_data.reserve(capacity); }
|
||||
explicit Image(size_t capacity) {
|
||||
m_data.reserve(capacity);
|
||||
}
|
||||
#else
|
||||
explicit Image(size_t capacity)
|
||||
: m_data{capacity, default_init_allocator<uchar>{}} {
|
||||
@@ -34,20 +36,38 @@ class Image {
|
||||
Image& operator=(const Image&) = delete;
|
||||
|
||||
// Getters
|
||||
operator std::string_view() const { return str(); } // NOLINT
|
||||
std::string_view str() const { return {data(), size()}; }
|
||||
size_t capacity() const { return m_data.capacity(); }
|
||||
operator std::string_view() const { // NOLINT
|
||||
return str();
|
||||
}
|
||||
std::string_view str() const {
|
||||
return {data(), size()};
|
||||
}
|
||||
size_t capacity() const {
|
||||
return m_data.capacity();
|
||||
}
|
||||
const char* data() const {
|
||||
return reinterpret_cast<const char*>(m_data.data());
|
||||
}
|
||||
char* data() { return reinterpret_cast<char*>(m_data.data()); }
|
||||
size_t size() const { return m_data.size(); }
|
||||
char* data() {
|
||||
return reinterpret_cast<char*>(m_data.data());
|
||||
}
|
||||
size_t size() const {
|
||||
return m_data.size();
|
||||
}
|
||||
|
||||
const std::vector<uchar>& vec() const { return m_data; }
|
||||
std::vector<uchar>& vec() { return m_data; }
|
||||
const std::vector<uchar>& vec() const {
|
||||
return m_data;
|
||||
}
|
||||
std::vector<uchar>& vec() {
|
||||
return m_data;
|
||||
}
|
||||
|
||||
void resize(size_t size) { m_data.resize(size); }
|
||||
void SetSize(size_t size) { m_data.resize(size); }
|
||||
void resize(size_t size) {
|
||||
m_data.resize(size);
|
||||
}
|
||||
void SetSize(size_t size) {
|
||||
m_data.resize(size);
|
||||
}
|
||||
|
||||
cv::Mat AsMat() {
|
||||
int type;
|
||||
@@ -68,7 +88,9 @@ class Image {
|
||||
return cv::Mat{height, width, type, m_data.data()};
|
||||
}
|
||||
|
||||
cv::_InputArray AsInputArray() { return cv::_InputArray{m_data}; }
|
||||
cv::_InputArray AsInputArray() {
|
||||
return cv::_InputArray{m_data};
|
||||
}
|
||||
|
||||
bool Is(int width_, int height_) {
|
||||
return width == width_ && height == height_;
|
||||
@@ -90,8 +112,12 @@ class Image {
|
||||
bool IsLarger(const Image& oth) {
|
||||
return width >= oth.width && height >= oth.height;
|
||||
}
|
||||
bool IsSmaller(int width_, int height_) { return !IsLarger(width_, height_); }
|
||||
bool IsSmaller(const Image& oth) { return !IsLarger(oth); }
|
||||
bool IsSmaller(int width_, int height_) {
|
||||
return !IsLarger(width_, height_);
|
||||
}
|
||||
bool IsSmaller(const Image& oth) {
|
||||
return !IsLarger(oth);
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<uchar> m_data;
|
||||
|
||||
Reference in New Issue
Block a user