• [问题求助] Restful接口拉取实况清流,这里这个TCP连接怎么建立,能举个例子吗
    Restful接口拉取实况清流,这里这个TCP连接怎么建立,能举个例子吗
  • [热门活动] 【提问有奖】DTSE Tech Talk 技术直播 NO.30专家坐堂答疑:看直播提问题赢华为云定制长袖卫衣、华为云定制Polo衫等好礼!
    直播简介【直播主题】新一代iPaaS “积木”式组装集成,超联接更智能【直播时间】2023年5月31日 17:00-18:30【直播专家】徐静珠 华为云PaaS DTSE技术布道师【直播简介】本期直播由华为云PaaS DTSE技术布道师徐静珠讲解华为云新一代iPaaS全域融合集成平台ROMA Connect融入低代码技术和组装式交付理念,降低集成开发技术门槛,以及组合应用Composed Application、资产目录Catalog、连接器Connector,能够帮助开发者更简单集成、更高效开发、更轻量部署维护。直播链接:cid:link_1活动介绍【互动方式】直播前您可以在本帖留下您疑惑的问题,专家会在直播时为您解答。直播后您可以继续在本帖留言,与专家互动交流。我们会在全部活动结束后对参与互动的用户进行评选。【活动时间】即日起—2023年5月31日【奖励说明】评奖规则:活动1:直播期间在直播间提出与直播内容相关的问题,对专家评选为优质问题的开发者进行奖励。奖品:华为云定制长袖卫衣活动2:在本帖提出与直播内容相关的问题,由专家在所有互动贴中选出最优问题贴的开发者进行奖励。奖品:华为云定制Polo衫更多直播活动直播互动有礼:官网直播间发口令“华为云 DTSE”抽华为云定制棒球帽、填写问卷抽华为云定制双肩包等好礼。分享问卷有礼 :邀请5位朋友以上完成问卷即可获得华为云定制钢笔礼盒。戳我填问卷》》老观众专属福利:连续报名并观看DTT直播3期以上抽送华为云DTT定制T恤。【注意事项】1、所有参与活动的问题,如发现为复用他人内容,则取消获奖资格。2、为保证您顺利领取活动奖品,请您在活动公示奖项后2个工作日内私信提前填写奖品收货信息,如您没有填写,视为自动放弃奖励。3、活动奖项公示时间截止2023年6月1日,如未反馈邮寄信息视为弃奖。本次活动奖品将于奖项公示后30个工作日内统一发出,请您耐心等待。4、活动期间同类子活动每个ID(同一姓名/电话/收货地址)只能获奖一次,若重复则中奖资格顺延至下一位合格开发者,仅一次顺延。5、如活动奖品出现没有库存的情况,华为云工作人员将会替换等价值的奖品,获奖者不同意此规则视为放弃奖品。6、其他事宜请参考【华为云社区常规活动规则】。
  • [使用说明] CodeArts IDE for C/C++ CMake Project Support
    CodeArts IDE for C/C++ provides comprehensive, convenient, and powerful workflows based on CMake projects, allowing users to easily configure, build, and debug CMake projects.Loading CMake ProjectWhen CodeArts IDE for C/C++ detects that the opened project is a CMake project, the following operations are automatically performed:1. Generate the cmake-build-debug directory, which contains the compile_commands.json, .cmake, CMakeFiles directory, and CMakeCache.txt and other files.2. Generate and import the compile_commands.json. The CMake project obtains the code detection and prompt functions of the Huawei C/C++ extension.3. Generate tasks.json and launch.json.tasks.json is used to configure the build task.launch.json is the configuration file of the startup program. The configurations in the file are displayed in the Run and Debug select box.During the process, the status bar will display the loading process. You can click to view the detailed loading logs.Multiple Build TypesCMake projects have four build types: Debug, MimSizeRel, Release and RelWithDebInfo. After the project is built, select the required build type and then the corresponding directory will be generated.Debug: Disable optimization and includes debugging information.Release: Include optimization but no debugging information.MinRelSize: Specifie the optimized size. No debugging information.RelWithDebInfo: Optimize the speed and contains debugging information.Debugging CMake ProjectOpen the cpp file, add a breakpoint, and click the Debug button.Running CMake ProjectYou can run it in the following ways:Run the launch.jsonRight-click to run the executable fileEnter the path of the file to be run on the consoleBuilding CMake ProjectCan be built from any of the following channels:Open the command panel and run command——CMake Build Tool: CMake TargetsClick the Build menuClick the build button on debugging toolbarClick the build button on Build panelAfter the build, the build log is displayed on the right of the build panelMultiple Generator TypesCodeArts IDE for C/C++ provides two generator types for CMake projects: ninja and make. When the IDE builds a project, the ninja generator is used by default.
  • [使用说明] CodeArts IDE for C/C++ CMake工程支持
    CodeArts IDE for C/C++中基于CMake工程提供了功能齐全、方便和强大的工作流,让用户可以轻松配置、构建和调试CMake工程。CMake工程加载CodeArts IDE for C/C++识别到打开的工程为CMake工程时,将自动完成以下操作:1. 生成cmake-build-debug目录,该目录中有compile_commands.json 文件,.cmake目录,CMakeFiles目录和CMakeCache.txt等文件。2. 生成compile_commands.json文件并导入,CMake工程获得Huawei C/C++ 插件的代码检测与提示的功能。3. 生成tasks.json和launch.json文件。tasks.json是配置构建任务的文件launch.json是启动程序的配置文件,该文件中的configurations会在运行和调试下拉框展示     在此过程中,状态栏显示加载过程,点击可以查看具体的加载日志多种构建类型CMake工程一共有四种构建类型,分别是 Debug, MimSizeRel, Release, RelWithDebInfo。选择需要的构建类型,工程构建之后, 生成对应的目录。Debug:禁用优化并包含调试信息。Release:包括优化但没有调试信息。MinRelSize:优化大小。没有调试信息。RelWithDebInfo:优化速度并包含调试信息。CMake工程调试打开cpp文件,选择所需断点,然后点击调试图标。CMake工程运行可通过以下几种方式运行:执行launch.json文件右键运行可执行文件控制台输入需要运行的文件路径CMake工程构建可从以下任一渠道构建:打开命令面板并运行CMake Build Tool: CMake Targets命令点击Build菜单​点击build图标​​​​​​​​​​​​​​​​​​​​​Build面板构建后,构建日志展示在build面板右侧​​​​​​​​多种生成器类型CodeArts IDE for C/C++为CMake工程提供了两种生成器类型:ninja和make。IDE构建项目时,默认使用ninja生成器。
  • [使用说明] CodeArts IDE for C/C++ Common Settings
    1. Exclude or include certain foldersIn Tag or Hybrid mode:Exclude some directories: Search for huawei-cpp.wecodeDb.excludePaths in the settings. The default value is:**/.mm/****/.git/****/build/****/output/**Include some directories: Search for huawei-cpp.wecodeDb.includeFolders in the settings and enter the absolute path of the folder.In Compiler mode:Exclude some directories: Search for huawei-cpp.codebase.generator.pathsExclude in the settings, use the Glob wildcard to exclude some directories, and generate compile_commands.json again.2. Enable or disable the diagnostic information in the problem windowSearch for huawei-cpp.clangd.ignoreDiagnostics in the settings.none: Display all diagnostic informationall: Hide all diagnostic informationnot_indexed: Display diagnostic information only when the current file has compilation options or has been indexed3. Modify the system header file providerBy default, Huawei C/C++ extracts system header file from the compiler in compile_commands.json. If the system header file cannot be extracted, use the built-in RTOS header files. You can modify the configuration to change the default rule. Search for huawei-cpp.codebase.systemHeaderProvider in the settings.Compiler: Extract system header file only from compile_commands.json.None: Obtain the system header file from the environment variable.4. Enable inline prompt, highlight inactive code, and enable/disable/modify semantic highlight colorTurn on or off inline prompting: huawei-cpp.clangd.enableInlayHintsEnable or disable highlighted inactive code: huawei-cpp.syntaxColor.enableInactiveCodeEnable or disable semantic highlight: huawei-cpp.syntaxColor.enable5. Path of the CMake project build toolCodeArts IDE for C/C++ provides tools required for building and debugging CMake projects. You can directly build and debug CMake projects without manually configuring environment variables.The CMake, MinGW, and Ninja tools are built in the .codearts directory of the user directory. By default, the CMake Build Tool extension will read the built-in tool path first.cpp-build-tool.CMakeBuildTool.CMake.value: Path for obtaining the CMake Toolcpp-build-tool.CMakeBuildTool.debugger.value: Path for obtaining the MinGW Toolcpp-build-tool.CMakeBuildTool.buildTool.value: Path for obtaining the Ninja Tool
  • [使用说明] CodeArts IDE for C/C++ 常用设置项
    1. 排除或包含某些文件夹Tag 或 Hybrid 模式下:排除某些目录 设置项中搜索huawei-cpp.wecodeDb.excludePaths,默认值为:**/.mm/** **/.git/** **/build/** **/output/**复制包含文件夹 设置项中搜索huawei-cpp.wecodeDb.includeFolders,将文件夹绝对路径填入即可。Compiler 模式下:排除某些目录: 设置项搜索:huawei-cpp.codebase.generator.pathsExclude,使用 Glob 通配符排除一些路径,然后重新生成 compile_commands.json 才会生效2. 开启/关闭问题窗口中的诊断信息设置项中搜索huawei-cpp.clangd.ignoreDiagnostics:none: 显示所有诊断信息all: 隐藏所有诊断信息not_indexed:仅当当前文件有编译选项或已经索引时显示诊断信息3. 修改系统头文件提供方Huawei C/C++默认从 compile_commands.json 中的编译器提取系统头文件,如果无法提取则使用自带的 RTOS 头文件,可通过修改设置项改变默认规则: 设置项中搜索huawei-cpp.codebase.systemHeaderProvider:Compiler: 仅根据 compile_commands.json 中提取系统头文件None: 从环境变量中获取系统头文件4. 开启内联提示/高亮不活跃代码,开启/关闭/修改语义高亮颜色开启或关闭内联提示: huawei-cpp.clangd.enableInlayHints开启或关闭高亮不活跃代码: huawei-cpp.syntaxColor.enableInactiveCode开启或关闭语义高亮: huawei-cpp.syntaxColor.enable5. cmake工程构建工具的路径CodeArts IDE for C/C++提供了CMake工程构建、调试所需要的相关工具, 用户可以直接构建、调试CMake工程, 不必手动配置相关环境变量。用户目录下.codearts下面内置了cmake、MinGW、ninja工具CMake Build Tool插件默认先读取内置工具路径。cpp-build-tool.CMakeBuildTool.CMake 获取cmake工具的路径cpp-build-tool.CMakeBuildTool.debugger 获取MinGW工具的路径cpp-build-tool.CMakeBuildTool.buildTool 获取ninja工具的路径
  • [使用说明] CodeArts IDE for C/C++ 常见问题
    一、登录激活常见问题1. CodeArts IDE 登录失败问题请参阅:CodeArts IDE登录失败网络连接检查指南_CodeArts IDE_CodeArts_华为云论坛 (huaweicloud.com)二、Huawei C/C++组件激活失败常见问题1.输出窗口可获得更多日志信息该错误表明CMake项目配置失败,并将错误的信息日志打印输出到输出窗口,点击“是”,以切换到输出窗口获取更多详细信息。此外,可以通过下拉菜单进行手动切换。2.Error: Unable to open check cache file for write该错误表明CodeArts IDE在此工作区文件夹无写入权限,需用户自行确认此文件夹的读写权限。3.Error: command ‘clangd.applyFix’ already exists该错误表明命令 clangd.applyFix 被重复注册了,原因是插件冲突,目前已知的冲突插件包括clangd, 5G-clangd, VSCode C/C++ Plugin, Nextcode Reference,出现此类错误时,请在插件列表中卸载以上插件。4.Error: wecode-db port file has no content. Make sure there is space available for the folder “/tmp”该错误表明WeCode-DB无法创建端口文件,可检查下当前的磁盘使用情况,确认磁盘空间占用是否已满,清理部分空间后重新尝试。5.WeCode-DB is unable to watch for file changes in this large workspace该警告表明 WeCode-DB 的文件监视程序已经耗尽文件句柄,文件句柄通常由操作系统决定,可通过cat /proc/sys/fs/inotify/max_user_watches查看,这种情况通常发生在工程非常大,包含的目录非常多的情况下,有以下两种方法解决:在CodeArts IDE的设置中搜索excludepaths,尽可能的将较大的文件夹排除,如output,build目录,例如:增加操作系统的可监控文件句柄数量,执行以下两条命令,将数量增加至 524288,该操作最高将会多消耗约 540MB 的内存:sudo sh -c "echo fs.inotify.max_user_watches=524288 >> /etc/sysctl.conf" sudo sysctl -p三、外部terminal配置方法首先编辑调试配置项。配置后,运行时,在外部terminal输入字符串,回车后,terminal自动关闭。如果需要在外部terminal里查阅输出,在代码里面添加以下代码:四、CMake Build Tool插件运行调试时中文乱码的问题现象:1. 文件运行在内部终端的乱码main.cpp文件中有中文文字构建生成可执行文件,右键点击运行运行结果出现中文乱码:2.运行调试使用外部 终端出现乱码文件里面有输入输出,配置外部terminal, 在terminal中打印出来的中文乱码解决办法1.方法一点击编码类型,选择 Reopen with Encoding, 选择 GB 2312编码类型(或选择 gbk 、 GB 18030类型编码)选择之后,文件里面的中文乱码将乱码文字改为简体中文,重新构建,生成可执行文件,运行后2.方法二修改cwd的默认编码格式,将其改为utf-8,修改方法如下:1、在开始菜单中搜索“区域与语言设置”2.选择管理语言设置3.在弹出的对话框中的管理选项卡中点击“更改系统区域设置”4.勾选Unicode UTF_8 并点击确定和应用重启系统,并验证:运行结果五、启动报错如启动时遇到此类弹窗报错:请清理任务管理器中CodeArtsIDE进程,并在资源管理器中清理codearts关联的句柄后卸载重新安装CodeArts IDE。六、技术支持如果您有任何其他疑问,请在华为云论坛_云计算论坛_开发者论坛_技术论坛-华为云 (huaweicloud.com) CodeArts IDE版块提出问题求助。
  • [问题求助] 如何用python把【北向接口】获取空间热度图统计数据转换成热度图像
    如何用python把【北向接口】获取的空间热度图统计数据转换成热度图像我尝试了很多,结果都不尽如意请求大神帮助!感谢!
  • [使用说明] Getting Started with CodeArts IDE for C/C++
    1. Creating a C/C++ ProjectCodeArts IDE for C/C++ provides the ability to create C or C++ projects. Follow the steps below to create a project:1. Click on the top menu File -> New -> Project...2. Select C/C++3. Fill out the form and click the create button4. Wait for the project to be created and open the project2. C/C++ Code Writing2.1 Basic Coding OperationsCodeArts IDE for C/C++ includes built-in syntax highlighting, definition preview, jump to definition, class inheritance diagram, call relationship diagram, and other basic coding features.Syntax Highlighting - This feature can highlight functions, types, local variables, global variables, macros, enums, member variables, and more.Jump to Definition - Ctrl+click or F12 will jump to the definition, or use Ctrl+Alt+click to open the definition next to it.Definition Preview - When the cursor moves to the symbol, there will be a hover preview of the symbol definition, or you can use the shortcut key alt+F12 to preview the symbol within the file.Find All References - When the cursor clicks or selects the symbol to be searched, right-click menu->Find All References or use the shortcut key Shift+Alt+F12 to open the definition on the left side of the page.Call Hierarchy - When the cursor clicks or selects the function that needs to call the hierarchy diagram, right-click menu->Call Hierarchy, or use the shortcut key Shift+Alt+H to call it out. In the relationship diagram, you can also click on the function you want to view and navigate to that function, and you can also view subclasses and base classes.Symbol Outline - Left tool->upper right corner three dots->outline can open the symbol outline, or use the shortcut key Ctrl+Shift+B to open the toolbar. After opening the outline, double-click the function to reach the function definition position, and the current symbol outline can follow the cursor movement (this function needs to open the follow cursor option in the outline menu bar).2.2 Code Writing OperationsCodeArts IDE for C/C++ includes advanced code writing features such as built-in symbol renaming, extraction refactoring, code completion/suggestion, and real-time syntax checking.Symbol RenamingOne of the most basic refactorings, but the readability of variable or method names is crucial. After selecting a variable or method with the cursor, right-click to bring up the editor context menu and choose "Rename Symbol" or simply press F2 to rename all instances of that name used throughout the entire C/C++ project.Extraction RefactoringCodeArts IDE for C/C++ supports extracting fields, methods, and parameters into new classes, providing different types of refactoring depending on the extracted content.Available C/C++ refactoring types include:Extract Method - Extract selected statements or expressions into a new method or function in a file.After selecting the "Extract Method" refactoring, enter the name of the extracted method/function.Extract Subexpression to Variable - Extract selected expressions into a new variable in a file.Code Completion/HintingCodeArts IDE for C/C++ includes various code editing features, such as code completion, quick information, member list, and parameter information. When you type a character, code completion will automatically pop up the member list if it knows possible completion options. If you continue typing, the member list (variables, methods, etc.) will be filtered to only include members that match the characters you have typed. You can insert the selected member name by clicking the cursor or pressing Enter or Tab. This feature provides various prompt information to help you edit code more conveniently and quickly.Global Symbol SearchPress Ctrl+T to bring up the search box, enter the symbol you want to find, and the page will display all files in the current folder that contain this symbol. Click on the file to jump to it, or use the up and down arrows to navigate to the location you want and press Enter.Real-time Compilation Error Checking (This feature depends on compile_commands.js)Real-time checking of compilation errors is a recommended editing solution for resolving coding errors, including automatic completion and real-time syntax checking.When a compilation error occurs, a wavy line will appear at the location of the error. Moving the cursor or clicking on the C/C++ code error will display a yellow light bulb, indicating that quick fixes are available. Clicking on the light bulb or pressing Ctrl+. will display a list of available quick fixes and refactoring options.Compile_commands.json management featureThe Compiler mode feature is comprehensive, but it requires the compile_commands.json file compilation database to function properly. There are three ways to obtain this file:1. Use the built-in CMake Build Tool plugin (recommended). When building a CMake project, the cmake-build-debug/compile_commands.json file will be automatically generated, and the plugin will automatically import this file into the .arts folder.2. Use CMake to generate the file. If the current project is a CMake project, the compile_commands.json file can be generated by adding the parameter -DCMAKE_EXPORT_COMPILE_COMMANDS=1, and then importing it using the "Import Compilation Database File" command under Help -> Show All Commands -> Huawei C/C++.3. Use the Generate command provided by Huawei C/C++. This method analyzes header files to generate the corresponding compilation database. To use this method, go to Help -> Show All Commands -> Huawei C/C++ and select "Generate Compilation Database File", then choose the folder where the source files are stored.Huawei C/C++ also supports the following features:Importing compile_commands.json files via command or API (Help -> Show All Commands -> Huawei C/C++: Import Compilation Database File)Merging multiple compile_commands.json files - Removing duplicate commands from compile_command.json files - Providing additional parameter settings for clangd during importUpdating the index1.Synchronizing project index (Help -> Show All Commands -> Huawei C/C++: Synchronize Project Index)2.Synchronizing folder index (Explorer right-click menu -> Huawei C/C++: Synchronize Folder Index)3.Synchronizing file index (Explorer right-click menu -> Huawei C/C++: Synchronize Current File Index)4.Resetting project index (Help -> Show All Commands -> Huawei C/C++: Rebuild Full Project Index)5.Editing compilation options for source files and refreshing the index (right-click menu -> Edit Compilation Parameters)All of the above commands and features are available in both Compiler mode and Hybrid mode.2.3 Refactoring OperationsRefactoring is the process of improving the reusability and maintainability of code by changing its structure without altering its functionality or purpose. CodeArts IDE supports refactoring operations and provides various important types of refactoring to modify the codebase in the editor. CodeArts IDE for C/C++ has built-in support for C/C++ refactoring, and in this topic, we will demonstrate the refactoring support for the C/C++ language service.Define ConstructorWhen creating a class, the constructor of the class can be automatically defined and the members can be initialized. When clicking or selecting the class name, the option to define the constructor can be selected from the yellow light bulb on the left.Sort Functions to DeclarationsThe order of the current defined functions/methods can be sorted according to the declaration order in the header file. When clicking or selecting the current function/method definition, the refactoring option is available.Add definition to implementation fileAdd the definition of the header file to the implementation file. When the current function/method is clicked or selected, the refactoring option is available.Swap if branchesIf the current condition only has if and else branches, selecting the code snippet and choosing "Swap if branches" will automatically swap the if and else branches.Inline variableThis feature can replace all references with the corresponding value, assuming that the calculated value always produces the same result. Select the content to be replaced and the refactoring option is available.Inline functionThis feature attempts to inline all function usages with appropriate code. It can only handle simple functions and does not support inline methods, function templates, main functions, and functions declared in system header files. This feature can inline all function references.Generate getter and setterEncapsulate selected class properties by generating their getter and setter. You can also choose to generate only the getter or setter option.Declare implicit membersThis option declares implicit members of a class in the class itself. Refactoring options are available when the class name is selected.Populate switch statementThis feature automatically populates a switch statement. Select any switch field, click on the yellow light bulb, and choose to populate the switch statement.Remove using namespaceThe remove using namespace feature automatically removes all used namespaces. Refactoring options are available when the cursor clicks or selects the namespace keyword.Move function body to out-of-lineMove the function/method definition to where it is declared.Add definition in-placeGenerate function definition within the current function/method and inside the class. When the cursor is on the function/method, click on the yellow light bulb and select the refactoring option.Add definition out-of-placeGenerate function definition outside the class for the current function/method. When the cursor is on the function/method, click on the yellow light bulb and select the refactoring option.Expand macroAdd an expanded macro on the page to provide content in expandable/collapsible sections.Expand auto typeExpand the variable type hidden by auto type.Move function body to declarationThis feature moves the function/method definition to the location of the declaration.Move function body to out-of-lineThis feature moves the definition of a function/method to the corresponding file.Convert to raw stringThis method converts an escaped string to a raw string. When the current string is clicked or selected, the "Refactor" option is available by clicking the yellow light bulb.Quick fixesQuick fixes are suggested edits for simple coding errors, including auto-completion and real-time syntax checking. When the cursor is moved or clicked on a C/C++ code error, a yellow light bulb is displayed indicating that quick fixes are available. Clicking the light bulb or pressing Ctrl+. will display a list of available quick fixes and refactorings.
  • [使用说明] CodeArts IDE for C/C++ +开发指南
    简介CodeArts IDE是一个集成开发环境(IDE),它提供了开发语言和调试服务。本文主要介绍CodeArts IDE for C/C++的基本功能。1.下载安装CodeArts IDE for C/C++ 已开放公测,下载获取免费体验2.新建C/C++工程CodeArts IDE for C/C++ 提供了创建C或C++工程的能力,可参考以下步骤进行创建:1. 点击顶部菜单 File -> New -> Project...2. 选择 C/C++3. 填写表单并点击创建按钮4. 等待工程创建完成并打开项目3.C/C++代码编写3.1编码基础操作CodeArts IDE for C/C++ 包含了内置的语法着色,定义预览,跳转定义,类继承关系图,调用关系图等一些编码基础功能。语法着色 - 该功能可对函数,类型,局部变量,全部变量,宏,枚举,成员变量等上色。跳转定义 - Ctrl+点击或者F12跳转到定义,或者使用Ctrl+Alt+点击会打开定义到旁边。定义预览 - 当光标移至符号处,则会有符号定义的悬停预览,也可以用alt+F12的快捷键进行文件内的符号预览。查找所有引用 - 当光标点击或者选择到需要查找的符号,右键菜单->查找所有引用或者使用快捷键Shift+Alt+F12会打开定义在页面左侧。调用关系图 - 当光标点击或选中需要调用关系图的函数时,右键菜单->调用关系图,或可以使用快捷键Shift+Alt+H调出。在关系图中,也可以点击需要查看的函数并导航到该函数,同时也能够查看子类和基类。符号大纲 - 左侧工具->右上角三个点->大纲即可打开符号大纲,或者使用快捷键Ctrl+Shift+B打开工具栏。打开大纲后,双击函数即可到达函数定义的位置,并且当前符号大纲可跟随光标移动(此功能需要在大纲菜单栏中打开跟随光标选项)。3.2 代码编写操作CodeArts IDE for C/C++ 包含了内置的符号重命名,提取重构,代码补全/提示,实时语法检查等一些高级代码编写功能。符号重命名(Rename symbol)最基础的重构之一,但是变量或方法名字的可读性非常重要。在光标选中某个变量或方法后,右键单击以调出编辑器上下文菜单并且选择重命名符号或直接按F2,来重命名整个 C/C++ 项目中所有用到该命名的地方。提取重构(Extraction refactoring)CodeArts IDE for C/C++ 支持将字段,方法和参数提取到新类中,根据提取的内容会提供不同的重构类型。可用的 C/C++ 重构类型包括:提取函数/方法(Extract method)- 将选定的语句或表达式提取到文件中的新方法或新函数。在选择提取方法(Extract method)重构后,输入提取的的方法/函数的名称。提取表达式到变量(Extract subexpression to variable)- 将选定的表达式提取为文件中的新变量。代码补全/提示(Code Completion/Hinting)CodeArts IDE for C/C++ 代码补全包含了各种代码编辑功能,包括:代码完成,快速信息,成员列表以及参数信息。当您输入字符时,代码补全若知道可能的补全选项,则会自动弹出成员列表。如果您继续输入字符,成员列表(变量,方法等)将被过滤为仅包含您输入字符的成员。您可通过光标点击或者按Enter或Tab键插入选定的成员名称。该功能会提供各种提示信息帮助您更加方便快速的编辑代码。全局符号搜索(Global Symbol Search)Ctrl+T导出搜索框,输入需要查找的符号,页面会显示出当前文件夹所有包含此符号的文件,点击即可跳转。或者按向上或向下选择并按Enter导航到您想要的位置。实时检查编译错误(该功能依赖compile_commands.json文件)实时检查编译错误是解决编码错误的建议编辑,包括自动补全,实时语法检查等。当编译错误时,会在错误处出现波浪线。可将光标移动或点击到C/C++的代码错误上时,会显示黄色灯泡,表示可以使用快速修复。点击灯泡或按Ctrl+。会显示可用的快速修复和重构列表。Compile_commands.json 管理功能Compiler 模式功能全面,但需要compile_commands.json文件编译数据库才能正常工作,可使用三种方式获取该文件。使用内置 CMake Build Tool 插件(推荐)。构建 CMake 项目,会自动生成cmake-build-debug/compile_commands.json文件, 并且插件会自动将该文件导入到 .arts文件夹。使用 CMake 生成。 如果当前工程是 CMake 工程,可以通过添加参数-DCMAKE_EXPORT_COMPILE_COMMANDS=1生成 compile_commands.json,并通过帮助->显示所有命令->Huawei C/C++:导入编译数据库文件命令导入。使用 Huawei C/C++ 提供的Generate命令。可通过帮助->显示所有命令->Huawei C/C++:生成编译数据库文件,并选择存放源文件的文件夹,该方法分析头文件生成对应的编译数据库。同时 Huawei C/C++也支持以下功能:通过命令或 API 导入compile_commands.json文件(帮助->显示所有命令->Huawei C/C++:导入编译数据库文件)合并多个 compile_commands.json 文件.移除 compile_command.json 文件中重复的命令.导入时为 clangd 提供额外的参数设置.索引更新命令同步工程索引(帮助->显示所有命令->Huawei C/C++:同步工程索引)同步文件夹索引(资源管理器右键菜单->Huawei C/C++:同步文件夹索引)同步文件索引(资源管理器右键菜单->Huawei C/C++:同步当前文件索引)重置工程索引(帮助->显示所有命令->Huawei C/C++:重建全项目索引)编辑源文件的编译选项并刷新索引(右键菜单->编辑编译参数)以上命令和功能在 Compiler 模式或 Hybrid 模式均有效。3.3 代码重构操作重构是通过改变现有程序结构而不改变其功能和用途来提高代码的可重用性和可维护性。CodeArts IDE 支持重构操作,提供了多种重要的重构类型,来改变编辑器中的代码库。CodeArts IDE for C/C++ 内置了对 C/C++ 重构的支持,在本专题中,我们将展示 C/C++ 语言服务的重构支持。定义构造函数(Define constructor)在每次创建类时,可以自动定义类的构造函数,并且初始化成员。当点击或选中类名时,可以点击左侧黄色灯泡选择定义构造函数。根据声明顺序排序函数(Sort functions to declarations)根据头文件中的声明顺序,排序当前定义函数/方法的顺序。当点击或选中当前函数/方法定义时,重构选项可用。将定义添加到实现文件(Add definition to implementation file)将头文件的定义添加到实现文件中。当点击或选中当前函数/方法时,重构选项可用。交换 if 分支(Swap if branches)若当前条件只有if和else分支,选中代码片段后,选择交换 if 分支(Swap if branches),可自动交换if和else分支。内联变量(Inline variable)该功能可以用相应的值替换所有引用。假设计算值总是产生相同的结果。选中需要替换的内容,重构选项可用。内联函数(Inline function)该功能尝试使用适当的代码内联所有函数用法。它只能处理简单的功能,不支持内联方法、函数模板、主函数和在系统头文件中声明的函数。该功能可以内联所有函数引用。生成 getter 和 setter(Generate getter and setter)通过为其生成getter和setter(Generate getter and setter)来封装选定的类属性。同时也可以选择只生成getter(Generate getter)或者生成setter(Generate setter)选项。声明隐式成员(Declare implicit members)此选项会将类的隐式成员在类中声明,当选中类名时,重构选项可用。填充 switch 语句(Populate switch)该功能可以自动填充switch语句。选中任意switch字段,并且点击黄色灯泡,选择填充switch语句。移除 namespace(Remove using namespace)移除namespace功能,会自动移除所有使用到的namespace。当光标点击或选中namesapace关键字时,重构选项可用。移动函数体到声明处(Move function body to out-of-line)将函数/方法定义移动到它声明的位置。在内部添加定义(Add definition in-place)在当前函数/方法并且在类内部生成函数定义。当光标移动到函数/方法时,点击黄色灯泡,重构选项可用。在外部添加定义(Add definition out-of-place)在类外部生成当前函数/方法的函数定义。当光标移动到函数/方法时,点击黄色灯泡,重构选项可用。展开宏(Expand macro)在页面上添加展开宏(Expand macro),以便在可扩展/可折叠的部分提供内容。展开 auto(Expand auto type)展开 auto type所隐藏的变量类型。函数定义外移(Move function body to declaration)该功能会将函数/方法的定义移动到声明的位置。函数定义内移(Move function body to out-of-line)该功能会将函数/方法的定义移动到对应的文件中。转为原始字符串(Convert to raw string)此方法可以将转义后的字符串转换为原始的字符串。当点击或选择了当前字符串,点击黄色灯泡,重构选项可用。快速修复(Quick fixes)快速修复是解决简单编码错误的建议编辑,包括自动补全,实时语法检查等。当光标移动或点击到C/C++的代码错误上时,会显示黄色灯泡,表示可以使用快速修复。点击灯泡或按Ctrl+.会显示可用的快速修复和重构列表。
  • [技术干货] CodeArts IDE for C/C++ FAQs
    1. Common issues with login activationFor details about the CodeArts IDE login failure, see:CodeArts IDE Network Check for Login Failure_CodeArts IDE_CodeArts_华为云论坛 (huaweicloud.com)2. Common issues with Huawei C/C++ extension activation1. More log information can be obtained from the output window.This error indicates that the CMake project configuration has failed and the error message log is printed to the output window. Click "Yes" to switch to the output window to obtain more detailed information. In addition, manual switching can be done through the drop-down menu.2. Error: Unable to open check cache file for write.This error indicates that CodeArts IDE does not have write permission for this workspace folder. Users need to confirm the read and write permissions of this folder on their own.3.Error: command ‘clangd.applyFix’ already existsThis error indicates that the clangd.applyFix command is registered repeatedly because of plug-in conflicts. The known plug-in conflicts include clangd, 5G-clangd, VSCode C/C++ Plugin, Nextcode Reference. If this error occurs, uninstall the preceding plug-ins from the plug-in list.4.Error: wecode-db port file has no content. Make sure there is space available for the folder “/tmp”This error indicates that the WeCode-DB cannot create a port file. Check the current disk usage to check whether the disk space is full. If yes, clear some space and try again.5.WeCode-DB is unable to watch for file changes in this large workspaceThis alarm indicates that the file monitor program of the WeCode-DB has used up file handles. The file handles are usually determined by the operating system and can be viewed by running the cat /proc/sys/fs/inotify/max_user_watches command. This problem usually occurs when the project is large and contains a large number of directories. You can use either of the following methods to solve this problem:Search for excludepaths in the CodeArts IDE settings and exclude large folders, such as output and build. For example:Run the following commands to increase the number of file handles that can be monitored by the operating system to 524288. This operation consumes about 540 MB more memory:sudo sh -c "echo fs.inotify.max_user_watches=524288 >> /etc/sysctl.conf" sudo sysctl -p3.External Terminal Configuration MethodFirst, edit the debug configuration item.After configuration, when running, input the string in the external terminal, and the terminal will automatically close after pressing enter. If you need to check the output in the external terminal, add the following code in the code:4.SupportIf you have any other questions, please raise them in the 华为云论坛_云计算论坛_开发者论坛_技术论坛-华为云 (huaweicloud.com) for help.
  • [问题求助] 创建工单方案流程校验失败
    ABC平台创建工单流程,流程校验成功:但是创建工单方案时,又流程校验失败;保存之后,激活提示找不到租户账号:ncec1234
  • [问题求助] 编译失败,Device _queryDeviceFromDBOrES是资产的定制版本,不能继续在资产包中发布。
    环境信息:20.3环境问题一句话总结:在代码中调用了基线BO后,再进行编译发布,提示编译失败。问题现象截图:操作步骤:租户账号: ncec1234项目名称: 天津国展项目
  • [公告] 【获奖公示】4.19号直播:开源小白入门-手把手教你参与一个开源项目
    <获奖名单>账号名 奖项名称 奖品名称hw073890293 视频号抽奖 开发者定制鼠标垫hw040600567 视频号抽奖 开发者定制鼠标垫hw62960078 视频号抽奖 开发者定制鼠标垫hid_7c_vqxwcev4ad95 视频号抽奖 开发者定制鼠标垫hid_y_w9dg_leuhuf8o 老观众专属开发者定制礼盒2(10000mh充电宝+游戏机)fight_king 报名转发有礼开发者定制短袖-T恤白色xj120141121 优质提问HDC开发者定制长袖圆领卫衣hw81541353 优质提问HDC开发者定制长袖圆领卫衣/ 官网抽奖开发者定制礼盒2(10000mh充电宝+游戏机)hid_2bljdd3wrtjse3w 官网抽奖 开发者定制棒球帽zhanghaopeng 官网抽奖 开发者定制棒球帽/ 官网抽奖 开发者定制棒球帽hw051404110 问卷抽奖开发者定制礼盒2(10000mh充电宝+游戏机)hid_8ks6_tl5c4nhz9b 问卷分享有礼开发者定制礼盒1(笔记本套装,含钢笔和笔记本)hid_a0211e-bd-x__sw 问卷分享有礼开发者定制礼盒2(笔记本套装,含钢笔和笔记本)chenweikai30032217 问卷分享有礼开发者定制礼盒3(笔记本套装,含钢笔和笔记本)hid_2vqj3h4096rrai1 问卷分享有礼开发者定制礼盒4(笔记本套装,含钢笔和笔记本)lovelydong1 问卷分享有礼开发者定制礼盒5(笔记本套装,含钢笔和笔记本)
  • [问题求助] 【AICC产品】 【CC-Gateway】电话拨打到座席,没有AgentOther_PhoneAlerting事件,却收到AgentOther_PhoneBusy事件
    问题来源】【必填】湖北农信【问题简要】【必填】电话拨打到座席,没有AgentOther_PhoneAlerting事件,却收到AgentOther_PhoneBusy事件【问题类别】【必填】CC-Gateway【AICC解决方案版本】【必填】AICC版本 AICC 8.15.0CTI版本 ICDV300R008C23话机型号 7950【期望解决时间】【选填】尽快解决【问题现象描述】【必填】转人工通话分配到座席,没有AgentOther_PhoneAlerting事件,却收到AgentOther_PhoneBusy事件,日志截图如下,详细日志和话单见附件,可根据callid(1681367159-478107)定位问题日志大概位置。该问题非必现,偶发现象