impress_voice_input/src/utils/string_utils.h
impressionyang 02e100b318 feat: 初始化 Impress Voice Input 项目
基于 ONNX 的实时语音转文本输入法,C++ 跨平台实现。

核心组件:
- Qt 6 跨平台 GUI(实时识别 / 文件转写 / 配置页面)
- ONNX Runtime 推理引擎(异步模型加载)
- PortAudio 音频采集
- dr_libs 音频文件解码
- JSON 配置管理(线程安全,自动持久化)
- 日志系统(控制台 + 文件输出)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-12 15:53:05 +08:00

37 lines
931 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#pragma once
#include <QString>
#include <QStringList>
#include <vector>
namespace impress {
/**
* @brief 字符串工具函数
*/
class StringUtils {
public:
/** @brief 按分隔符分割字符串 */
static QStringList split(const QString& input, const QString& delimiter);
/** @brief 去除两端空白 */
static QString trim(const QString& input);
/** @brief float 向量转 QString逗号分隔 */
static QString joinFloats(const std::vector<float>& values, int precision = 4);
/** @brief QString 转 UTF-8 std::string */
static std::string toUtf8(const QString& input);
/** @brief std::string 转 QString */
static QString fromUtf8(const std::string& input);
/** @brief 格式化文件大小 */
static QString formatFileSize(qint64 bytes);
/** @brief 格式化时长 (mm:ss) */
static QString formatDuration(int totalSeconds);
};
} // namespace impress