2024-05-15 08:34:54 +08:00
|
|
|
#include "MainWidget.h"
|
2024-05-15 23:06:48 +08:00
|
|
|
#include <QClipboard>
|
2024-05-16 08:04:55 +08:00
|
|
|
#include <QSettings>
|
2024-05-16 08:48:12 +08:00
|
|
|
#include <QFile>
|
2024-05-15 08:34:54 +08:00
|
|
|
#include "./ui_MainWidget.h"
|
|
|
|
|
2024-05-15 23:06:48 +08:00
|
|
|
constexpr std::size_t g_OnePage = 100;
|
|
|
|
|
2024-05-15 10:59:43 +08:00
|
|
|
MainWidget::MainWidget(QWidget* parent) : QWidget(parent), ui(new Ui::MainWidget)
|
2024-05-15 08:34:54 +08:00
|
|
|
{
|
|
|
|
ui->setupUi(this);
|
2024-05-15 10:59:43 +08:00
|
|
|
|
2024-05-16 08:41:20 +08:00
|
|
|
setWindowTitle(u8"OneLevelXmlOpr v1.2.1");
|
2024-05-15 12:10:32 +08:00
|
|
|
setWindowIcon(QIcon("://resource/xml.ico"));
|
2024-05-15 11:51:30 +08:00
|
|
|
|
2024-05-15 23:06:48 +08:00
|
|
|
setMinimumWidth(900);
|
|
|
|
setMinimumHeight(800);
|
|
|
|
|
2024-05-15 10:59:43 +08:00
|
|
|
width_.push_back(280);
|
|
|
|
for (int i = 0; i < 30; ++i) {
|
|
|
|
width_.push_back(160);
|
|
|
|
}
|
|
|
|
|
2024-05-15 23:06:48 +08:00
|
|
|
attri_edit_ = new CAttributeEdit();
|
|
|
|
|
2024-05-15 13:17:24 +08:00
|
|
|
ui->edStatus->setEnabled(false);
|
|
|
|
ui->btnSave->setEnabled(false);
|
2024-05-15 17:34:07 +08:00
|
|
|
ui->btnCopySelectLine->setEnabled(false);
|
|
|
|
ui->btnDelSelectLine->setEnabled(false);
|
2024-05-15 23:06:48 +08:00
|
|
|
ui->edAllPage->setEnabled(false);
|
2024-05-16 08:41:20 +08:00
|
|
|
ui->cbCaseSensitive->setChecked(true);
|
2024-05-15 13:17:24 +08:00
|
|
|
|
2024-05-15 10:59:43 +08:00
|
|
|
connect(ui->btnRead, &QPushButton::clicked, this, [&]() { read(); });
|
|
|
|
connect(ui->btnSearch, &QPushButton::clicked, this, [&]() { search(); });
|
2024-05-15 13:17:24 +08:00
|
|
|
connect(ui->btnSave, &QPushButton::clicked, this, [&]() { save(); });
|
2024-05-15 17:34:07 +08:00
|
|
|
connect(ui->btnCopySelectLine, &QPushButton::clicked, this, [&]() { copy_select_line(); });
|
|
|
|
connect(ui->btnDelSelectLine, &QPushButton::clicked, this, [&]() { del_select_line(); });
|
2024-05-15 23:55:11 +08:00
|
|
|
connect(ui->btnExit, &QPushButton::clicked, this, [&]() { QApplication::exit(0); });
|
2024-05-15 23:06:48 +08:00
|
|
|
connect(ui->btnReset, &QPushButton::clicked, this, &MainWidget::reset);
|
2024-05-16 00:09:26 +08:00
|
|
|
connect(ui->btnEditProperty, &QPushButton::clicked, this, &MainWidget::edit_property);
|
2024-05-15 23:06:48 +08:00
|
|
|
connect(ui->btnPagePre, &QPushButton::clicked, this, [&]() {
|
|
|
|
unsigned int cur = ui->edCurPage->text().toUInt();
|
|
|
|
push_content(current_, cur - 1);
|
|
|
|
});
|
|
|
|
connect(ui->btnPageNext, &QPushButton::clicked, this, [&]() {
|
|
|
|
unsigned int cur = ui->edCurPage->text().toUInt();
|
|
|
|
push_content(current_, cur + 1);
|
|
|
|
});
|
|
|
|
connect(ui->btnJump, &QPushButton::clicked, this, [&]() {
|
|
|
|
unsigned int cur = ui->edCurPage->text().toUInt();
|
|
|
|
push_content(current_, cur);
|
|
|
|
});
|
|
|
|
connect(ui->btnCopyKey, &QPushButton::clicked, this, &MainWidget::copy_key);
|
2024-05-16 08:04:55 +08:00
|
|
|
|
|
|
|
QSettings settings;
|
|
|
|
settings.beginGroup("xmlopr");
|
|
|
|
restoreGeometry(settings.value("geometry").toByteArray());
|
|
|
|
settings.endGroup();
|
2024-05-16 08:48:12 +08:00
|
|
|
|
|
|
|
QFile qss_file("://qss/flatgray.css");
|
|
|
|
if (qss_file.open(QFile::ReadOnly)) {
|
|
|
|
qApp->setStyleSheet(qss_file.readAll());
|
|
|
|
}
|
2024-05-15 23:06:48 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void MainWidget::copy_key()
|
|
|
|
{
|
|
|
|
Element_t* target = get_current_select_key();
|
|
|
|
if (target == nullptr) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
QClipboard* clip = QApplication::clipboard();
|
|
|
|
clip->setText(QString(target->Attribute(keys_[0].c_str())));
|
|
|
|
CUtil::msg(this, u8"已复制");
|
2024-05-15 08:34:54 +08:00
|
|
|
}
|
|
|
|
|
2024-05-16 00:09:26 +08:00
|
|
|
void MainWidget::edit_property()
|
|
|
|
{
|
|
|
|
Element_t* target = get_current_select_key();
|
|
|
|
if (target == nullptr) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
Property_t property;
|
|
|
|
xml_.get_key_value(target, property);
|
|
|
|
attri_edit_->set_attribute(property, false);
|
|
|
|
attri_edit_->exec();
|
|
|
|
|
|
|
|
if (!attri_edit_->is_ok_) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
attri_edit_->get_attribute(property);
|
|
|
|
xml_.key_value_to_element(target, property);
|
|
|
|
}
|
|
|
|
|
2024-05-16 08:04:55 +08:00
|
|
|
void MainWidget::closeEvent(QCloseEvent* event)
|
|
|
|
{
|
|
|
|
QSettings settings;
|
|
|
|
settings.beginGroup("xmlopr");
|
|
|
|
settings.setValue("geometry", saveGeometry());
|
|
|
|
settings.endGroup();
|
|
|
|
QWidget::closeEvent(event);
|
|
|
|
}
|
|
|
|
|
2024-05-15 08:34:54 +08:00
|
|
|
MainWidget::~MainWidget()
|
|
|
|
{
|
2024-05-15 23:06:48 +08:00
|
|
|
delete attri_edit_;
|
2024-05-15 08:34:54 +08:00
|
|
|
delete ui;
|
|
|
|
}
|
2024-05-15 10:59:43 +08:00
|
|
|
|
|
|
|
void MainWidget::set_work_exe(char* path)
|
|
|
|
{
|
|
|
|
exe_path_.clear();
|
|
|
|
exe_path_.append(path);
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWidget::generate_table_widget()
|
|
|
|
{
|
|
|
|
tab_widget_ = new QTableWidget();
|
2024-05-15 13:17:24 +08:00
|
|
|
connect(tab_widget_, &QTableWidget::itemChanged, this, [&](QTableWidgetItem* item) { item_changed_handle(item); });
|
|
|
|
|
2024-05-15 10:59:43 +08:00
|
|
|
auto config = ini_.get_config();
|
|
|
|
auto keys = splitString(config.purpose, ",");
|
|
|
|
keys_.clear();
|
|
|
|
QStringList list;
|
|
|
|
for (const auto& item : keys) {
|
|
|
|
if (item.empty()) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
keys_.push_back(item);
|
|
|
|
list.append(QString::fromStdString(item));
|
|
|
|
}
|
|
|
|
|
|
|
|
tab_widget_->setColumnCount(list.size());
|
|
|
|
tab_widget_->setHorizontalHeaderLabels(list);
|
2024-05-15 17:34:07 +08:00
|
|
|
tab_widget_->setSelectionBehavior(QAbstractItemView::SelectRows);
|
|
|
|
tab_widget_->setSelectionMode(QAbstractItemView::SelectionMode::SingleSelection);
|
2024-05-15 10:59:43 +08:00
|
|
|
|
|
|
|
for (auto i = 0; i < keys.size(); ++i) {
|
|
|
|
tab_widget_->setColumnWidth(i, width_[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
QHBoxLayout* lay = new QHBoxLayout();
|
|
|
|
lay->addWidget(tab_widget_);
|
|
|
|
ui->widget->setLayout(lay);
|
|
|
|
}
|
|
|
|
|
2024-05-15 23:06:48 +08:00
|
|
|
void MainWidget::push_content(const std::vector<tinyxml2::XMLElement*>& eles, std::size_t page)
|
2024-05-15 10:59:43 +08:00
|
|
|
{
|
2024-05-15 23:06:48 +08:00
|
|
|
if (tab_widget_ == nullptr || page == 0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::size_t all_size = eles.size();
|
|
|
|
std::size_t max_show = g_OnePage * page;
|
|
|
|
all_page_ = all_size / 100;
|
|
|
|
|
|
|
|
if (all_size % 100 != 0) {
|
|
|
|
++all_page_;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (page < 1 || page > all_page_) {
|
2024-05-16 08:41:20 +08:00
|
|
|
if (eles.size() > 0) {
|
|
|
|
CUtil::msg(this, u8"页码不在范围内");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
tab_widget_->clearContents();
|
|
|
|
tab_widget_->setRowCount(0);
|
|
|
|
cur_page_ = 0;
|
2024-05-15 23:06:48 +08:00
|
|
|
ui->edCurPage->setText(QString::number(cur_page_));
|
2024-05-16 08:41:20 +08:00
|
|
|
ui->edAllPage->setText(QString::number(all_page_));
|
2024-05-15 23:06:48 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2024-05-15 10:59:43 +08:00
|
|
|
tab_widget_->clearContents();
|
|
|
|
tab_widget_->setRowCount(0);
|
2024-05-15 23:06:48 +08:00
|
|
|
|
|
|
|
for (auto p = (page - 1) * g_OnePage; p < all_size && p < max_show; ++p) {
|
2024-05-15 10:59:43 +08:00
|
|
|
int row_cnt = tab_widget_->rowCount();
|
|
|
|
tab_widget_->insertRow(row_cnt);
|
2024-05-15 23:55:11 +08:00
|
|
|
insert_one_line(eles[p], row_cnt);
|
2024-05-15 10:59:43 +08:00
|
|
|
}
|
2024-05-15 23:06:48 +08:00
|
|
|
ui->edCurPage->setText(QString::number(page));
|
|
|
|
cur_page_ = page;
|
|
|
|
ui->edAllPage->setText(QString::number(all_page_));
|
|
|
|
judge_btn_page();
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWidget::judge_btn_page()
|
|
|
|
{
|
|
|
|
int cur = ui->edCurPage->text().trimmed().toUInt();
|
|
|
|
if (cur <= 1) {
|
|
|
|
ui->btnPagePre->setEnabled(false);
|
|
|
|
} else {
|
|
|
|
ui->btnPagePre->setEnabled(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cur >= all_page_) {
|
|
|
|
ui->btnPageNext->setEnabled(false);
|
|
|
|
} else {
|
|
|
|
ui->btnPageNext->setEnabled(true);
|
|
|
|
}
|
2024-05-15 10:59:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void MainWidget::read()
|
|
|
|
{
|
|
|
|
if (!ini_.set_work_exe(exe_path_)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
OprBase base = ini_.get_config();
|
|
|
|
if (!xml_.open(base.xml_path)) {
|
2024-05-15 13:17:24 +08:00
|
|
|
QString status = u8"Open【" + QString::fromStdString(base.xml_path.c_str()) + u8"】Failed.";
|
2024-05-15 10:59:43 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
xml_.set_baseinfo(base);
|
|
|
|
if (!xml_.parse_xml(vec_)) {
|
2024-05-15 13:17:24 +08:00
|
|
|
QString status = u8"parse_xml【" + QString::fromStdString(base.xml_path.c_str()) + u8"】Failed.";
|
2024-05-15 10:59:43 +08:00
|
|
|
return;
|
|
|
|
}
|
2024-05-15 13:17:24 +08:00
|
|
|
|
|
|
|
auto_add_ = true;
|
2024-05-15 10:59:43 +08:00
|
|
|
generate_table_widget();
|
|
|
|
push_content(vec_);
|
2024-05-15 13:17:24 +08:00
|
|
|
current_ = vec_;
|
|
|
|
auto_add_ = false;
|
2024-05-15 11:51:30 +08:00
|
|
|
|
2024-05-15 13:17:24 +08:00
|
|
|
QString status = u8"Open And Parse【" + QString::fromLocal8Bit(base.xml_path.c_str()) + u8"】Success.";
|
2024-05-15 11:51:30 +08:00
|
|
|
ui->edStatus->setText(status);
|
2024-05-15 13:17:24 +08:00
|
|
|
|
|
|
|
ui->btnRead->setEnabled(false);
|
|
|
|
ui->btnSave->setEnabled(true);
|
2024-05-15 17:34:07 +08:00
|
|
|
ui->btnCopySelectLine->setEnabled(true);
|
|
|
|
ui->btnDelSelectLine->setEnabled(true);
|
2024-05-15 10:59:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void MainWidget::search()
|
|
|
|
{
|
|
|
|
QString key = ui->edSearchKey->text().trimmed();
|
|
|
|
if (key.isEmpty()) {
|
2024-05-15 23:55:11 +08:00
|
|
|
current_ = vec_;
|
|
|
|
push_content(current_);
|
2024-05-15 10:59:43 +08:00
|
|
|
return;
|
|
|
|
}
|
2024-05-15 13:17:24 +08:00
|
|
|
if (tab_widget_ == nullptr) {
|
|
|
|
return;
|
|
|
|
}
|
2024-05-16 08:41:20 +08:00
|
|
|
|
|
|
|
if (!ui->cbCaseSensitive->isChecked()) {
|
|
|
|
key = key.toUpper();
|
|
|
|
}
|
|
|
|
|
2024-05-15 13:17:24 +08:00
|
|
|
current_.clear();
|
2024-05-15 10:59:43 +08:00
|
|
|
for (const auto& item : vec_) {
|
|
|
|
for (auto i = 0; i < keys_.size(); ++i) {
|
2024-05-15 13:17:24 +08:00
|
|
|
const char* data = item->Attribute(keys_[i].c_str());
|
|
|
|
QString qdata(data);
|
2024-05-16 08:41:20 +08:00
|
|
|
if (!ui->cbCaseSensitive->isChecked()) {
|
|
|
|
qdata = qdata.toUpper();
|
|
|
|
}
|
2024-05-15 10:59:43 +08:00
|
|
|
if (!qdata.contains(key)) {
|
|
|
|
continue;
|
|
|
|
}
|
2024-05-15 13:17:24 +08:00
|
|
|
current_.push_back(item);
|
2024-05-15 10:59:43 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2024-05-15 13:17:24 +08:00
|
|
|
push_content(current_);
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWidget::item_changed_handle(QTableWidgetItem* item)
|
|
|
|
{
|
|
|
|
if (auto_add_) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (item == nullptr) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
int row = item->row();
|
|
|
|
int col = item->column();
|
|
|
|
|
2024-05-15 23:06:48 +08:00
|
|
|
QString xml_key = tab_widget_->item(row, 0)->text();
|
|
|
|
Element_t* result = get_element_bykey(xml_key);
|
2024-05-15 17:34:07 +08:00
|
|
|
if (result == nullptr) {
|
|
|
|
return;
|
2024-05-15 13:17:24 +08:00
|
|
|
}
|
2024-05-15 17:34:07 +08:00
|
|
|
result->SetAttribute(keys_[col].c_str(), item->text().toLocal8Bit().constData());
|
2024-05-15 13:17:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void MainWidget::save()
|
|
|
|
{
|
|
|
|
if (xml_.save()) {
|
2024-05-15 17:34:07 +08:00
|
|
|
CUtil::msg(this, u8"保存成功");
|
|
|
|
} else {
|
|
|
|
CUtil::msg(this, u8"保存失败");
|
2024-05-15 13:17:24 +08:00
|
|
|
}
|
2024-05-15 17:34:07 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void MainWidget::copy_select_line()
|
|
|
|
{
|
2024-05-15 23:06:48 +08:00
|
|
|
if (!CUtil::affirm(this, u8"确认", u8"确认复制吗?")) {
|
|
|
|
return;
|
|
|
|
}
|
2024-05-15 23:55:11 +08:00
|
|
|
|
|
|
|
QTableWidgetItem* cur_item = get_current_select_item();
|
|
|
|
if (cur_item == nullptr) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
Element_t* target = get_element_bykey(cur_item->text());
|
2024-05-15 17:34:07 +08:00
|
|
|
if (target == nullptr) {
|
|
|
|
return;
|
|
|
|
}
|
2024-05-15 23:06:48 +08:00
|
|
|
Element_t* newer = xml_.copy_element(target);
|
|
|
|
|
|
|
|
Property_t property;
|
|
|
|
xml_.get_key_value(newer, property);
|
|
|
|
|
|
|
|
attri_edit_->set_attribute(property);
|
|
|
|
attri_edit_->exec();
|
|
|
|
|
|
|
|
if (!attri_edit_->is_ok_) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
attri_edit_->get_attribute(property);
|
|
|
|
xml_.key_value_to_element(newer, property);
|
2024-05-15 17:34:07 +08:00
|
|
|
xml_.insert_brother_node(target, newer);
|
|
|
|
|
2024-05-15 23:55:11 +08:00
|
|
|
tab_widget_->insertRow(cur_item->row() + 1);
|
|
|
|
insert_one_line(newer, cur_item->row() + 1);
|
|
|
|
|
|
|
|
std::vector<Element_t*>::iterator it;
|
|
|
|
for (it = vec_.begin(); it != vec_.end(); ++it) {
|
|
|
|
if (*it == target) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
int df = it - vec_.begin() + 1;
|
|
|
|
vec_.insert(vec_.begin() + df, newer);
|
|
|
|
search();
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWidget::insert_one_line(Element_t* ele, int row)
|
|
|
|
{
|
|
|
|
if (ele == nullptr) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
for (auto i = 0; i < keys_.size(); ++i) {
|
|
|
|
const char* data = ele->Attribute(keys_[i].c_str());
|
|
|
|
QTableWidgetItem* wgItem = new QTableWidgetItem();
|
|
|
|
|
|
|
|
if (i == 0) {
|
|
|
|
wgItem->setFlags(wgItem->flags() & ~Qt::ItemIsEditable);
|
|
|
|
}
|
|
|
|
|
|
|
|
wgItem->setText(QString(data));
|
|
|
|
tab_widget_->setItem(row, i, wgItem);
|
|
|
|
}
|
2024-05-15 17:34:07 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void MainWidget::del_select_line()
|
|
|
|
{
|
2024-05-15 23:06:48 +08:00
|
|
|
if (!CUtil::affirm(this, u8"确认", u8"确认删除吗?")) {
|
|
|
|
return;
|
|
|
|
}
|
2024-05-15 23:55:11 +08:00
|
|
|
QTableWidgetItem* item = get_current_select_item();
|
|
|
|
if (item == nullptr) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
Element_t* target = get_element_bykey(item->text());
|
2024-05-15 17:34:07 +08:00
|
|
|
if (target == nullptr) {
|
|
|
|
return;
|
|
|
|
}
|
2024-05-15 23:06:48 +08:00
|
|
|
xml_.del_element(target);
|
|
|
|
|
|
|
|
// TODO: 添加到界面
|
2024-05-15 23:55:11 +08:00
|
|
|
tab_widget_->removeRow(item->row());
|
|
|
|
|
|
|
|
std::vector<Element_t*>::iterator it;
|
|
|
|
for (it = vec_.begin(); it != vec_.end(); ++it) {
|
|
|
|
if (*it == target) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
vec_.erase(it);
|
|
|
|
search();
|
2024-05-15 17:34:07 +08:00
|
|
|
}
|
|
|
|
|
2024-05-15 23:06:48 +08:00
|
|
|
Element_t* MainWidget::get_current_select_key()
|
2024-05-15 17:34:07 +08:00
|
|
|
{
|
2024-05-15 23:55:11 +08:00
|
|
|
Element_t* ret = nullptr;
|
|
|
|
QTableWidgetItem* item = get_current_select_item();
|
|
|
|
if (item == nullptr) {
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
ret = get_element_bykey(item->text());
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
QTableWidgetItem* MainWidget::get_current_select_item()
|
|
|
|
{
|
|
|
|
QTableWidgetItem* ret = nullptr;
|
2024-05-15 17:34:07 +08:00
|
|
|
if (tab_widget_ == nullptr) {
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
QList<QTableWidgetItem*> selectedItems = tab_widget_->selectedItems();
|
|
|
|
if (selectedItems.size() < 1) {
|
|
|
|
CUtil::msg(this, u8"没有选中数据");
|
|
|
|
return ret;
|
|
|
|
}
|
2024-05-15 23:55:11 +08:00
|
|
|
ret = selectedItems[0];
|
2024-05-15 17:34:07 +08:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2024-05-15 23:06:48 +08:00
|
|
|
void MainWidget::reset()
|
|
|
|
{
|
|
|
|
current_.clear();
|
|
|
|
current_ = vec_;
|
|
|
|
push_content(current_);
|
|
|
|
}
|
|
|
|
|
2024-05-15 17:34:07 +08:00
|
|
|
tinyxml2::XMLElement* MainWidget::get_element_bykey(const QString& key)
|
|
|
|
{
|
2024-05-15 23:06:48 +08:00
|
|
|
Element_t* ret = nullptr;
|
2024-05-15 17:34:07 +08:00
|
|
|
for (const auto& ele : current_) {
|
|
|
|
const char* data = ele->Attribute(keys_[0].c_str());
|
|
|
|
QString qdata(data);
|
|
|
|
if (qdata != key) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
ret = ele;
|
|
|
|
break;
|
2024-05-15 13:17:24 +08:00
|
|
|
}
|
2024-05-15 17:34:07 +08:00
|
|
|
return ret;
|
2024-05-15 10:59:43 +08:00
|
|
|
}
|