Giter VIP home page Giter VIP logo

-'s Introduction

11111 #include #include #include <android/log.h>

#define TAG_LOGI(tag, fmt, ...) __android_log_print(ANDROID_LOG_INFO, tag, "xql: " fmt, ##VA_ARGS) #define TAG_LOGW(tag, fmt, ...) __android_log_print(ANDROID_LOG_WARN, tag, "xql: " fmt, ##VA_ARGS)

enum class AceLogTag { ACE_KEYBOARD, ACE_FOCUS, // 其他标签... };

// 假设有一个函数将 AceLogTag 转换为字符串 const char* GetTagString(AceLogTag tag) { switch (tag) { case AceLogTag::ACE_KEYBOARD: return "ACE_KEYBOARD"; case AceLogTag::ACE_FOCUS: return "ACE_FOCUS"; // 其他标签... default: return "UNKNOWN_TAG"; } }

// 假设 OffsetF 和 RectF 类已经定义 class OffsetF { public: OffsetF(float x = 0, float y = 0) : x_(x), y_(y) {} float GetX() const { return x_; } float GetY() const { return y_; } std::string ToString() const { return "(" + std::to_string(x_) + ", " + std::to_string(y_) + ")"; } private: float x_; float y_; };

class RectF { public: RectF(OffsetF offset = OffsetF(), float width = 0, float height = 0) : offset_(offset), width_(width), height_(height) {} OffsetF Center() const { return OffsetF(offset_.GetX() + width_ / 2, offset_.GetY() + height_ / 2); } OffsetF GetOffset() const { return offset_; } private: OffsetF offset_; float width_; float height_; };

int main() { // 示例变量 OffsetF childRectCenter(10, 20); OffsetF rectCenter(5, 15); RectF childRect(childRectCenter, 100, 200); RectF rect(rectCenter, 50, 100); OffsetF vec = childRect.Center() - rect.Center(); double minVal = 100.0; double val = (vec.GetX() * vec.GetX()) + (vec.GetY() * vec.GetY()); auto it = 42; // 示例迭代器 auto itNewFocusNode = it; OffsetF offset;

// 记录 vec 的值
TAG_LOGI(GetTagString(AceLogTag::ACE_FOCUS), "vec: (%{public}s).", vec.ToString().c_str());

// 记录 val 的值
TAG_LOGI(GetTagString(AceLogTag::ACE_FOCUS), "val: %{public}f.", val);

// 记录 minVal 的值
TAG_LOGI(GetTagString(AceLogTag::ACE_FOCUS), "minVal: %{public}f.", minVal);

// 记录 itNewFocusNode 的值
TAG_LOGI(GetTagString(AceLogTag::ACE_FOCUS), "itNewFocusNode: %{public}d.", itNewFocusNode);

// 记录 offset 的值
TAG_LOGI(GetTagString(AceLogTag::ACE_FOCUS), "offset: (%{public}s).", offset.ToString().c_str());

// 示例代码逻辑
if (minVal > val) {
    minVal = val;
    itNewFocusNode = it;
    offset = childRect.GetOffset();
}

return 0;

}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.