pax_global_header00006660000000000000000000000064147547312250014524gustar00rootroot0000000000000052 comment=517ecdaaf4663a942411aa8b3373bc1377aef34e iptux-0.9.4/000077500000000000000000000000001475473122500127075ustar00rootroot00000000000000iptux-0.9.4/.clang-format000066400000000000000000000004541475473122500152650ustar00rootroot00000000000000--- Language: Cpp BasedOnStyle: Chromium IncludeCategories: - Regex: '^"config\.h"' Priority: -1 # The main header for a source file automatically gets category 0 - Regex: '.*' Priority: 1 - Regex: '^<.*\.h>' Priority: 2 iptux-0.9.4/.editorconfig000066400000000000000000000004261475473122500153660ustar00rootroot00000000000000# top-most EditorConfig file root = true # Unix-style newlines with a newline ending every file [*] end_of_line = lf insert_final_newline = true trim_trailing_whitespace = true indent_style = space indent_size = 2 charset = utf-8 [Makefile] indent_style = tab indent_size = 4 iptux-0.9.4/.github/000077500000000000000000000000001475473122500142475ustar00rootroot00000000000000iptux-0.9.4/.github/workflows/000077500000000000000000000000001475473122500163045ustar00rootroot00000000000000iptux-0.9.4/.github/workflows/ci.yml000066400000000000000000000151761475473122500174340ustar00rootroot00000000000000name: CI on: push: branches: [master] pull_request: branches: [master] env: DEB_PKGS: >- g++ meson appstream gettext libgoogle-glog-dev libgtk-3-dev libglib2.0-dev libjsoncpp-dev libsigc++-2.0-dev libayatana-appindicator3-dev DEB_TEST_PKGS: xvfb MAC_PKGS: >- meson appstream gettext glog gtk+3 jsoncpp gtk-mac-integration libsigc++@2 jobs: build-on-mac: strategy: matrix: runs-on: [macos-latest] runs-on: ${{ matrix.runs-on }} steps: - uses: actions/checkout@v2 - name: Configure Homebrew cache uses: actions/cache@v2 with: path: | ~/Library/Caches/Homebrew key: ${{ runner.os }}-v1 - name: brew install run: >- brew install --display-times ${{ env.MAC_PKGS }} - name: meson run: meson setup build - name: build run: meson compile -C build - name: install run: meson install -C build - name: test run: | sudo ifconfig lo0 alias 127.0.0.2 up sudo ifconfig lo0 alias 127.0.0.3 up sudo ifconfig lo0 alias 127.0.0.4 up meson test -C build --verbose --no-stdsplit build-on-linux: strategy: matrix: runs-on: [ubuntu-20.04, ubuntu-22.04, ubuntu-latest] compiler: [g++, clang++] runs-on: ${{ matrix.runs-on }} steps: - uses: actions/checkout@v2 - name: apt install run: >- sudo apt update && sudo apt install libunwind-dev && sudo apt install -y ${{ env.DEB_PKGS }} ${{ env.DEB_TEST_PKGS }} - name: meson run: | meson --version meson setup build env: CXX: ${{ matrix.compiler }} - name: build run: ninja -v -C build - name: install run: sudo meson install -C build - name: test run: | xvfb-run -a meson test -C build --verbose --no-stdsplit codecov: runs-on: ubuntu-latest permissions: checks: write pull-requests: write steps: - uses: actions/checkout@v2 - name: apt install run: >- sudo apt update && sudo apt install libunwind-dev && sudo apt install -y lcov ${{ env.DEB_PKGS }} ${{ env.DEB_TEST_PKGS }} - name: meson run: meson setup -D b_coverage=true build - name: build run: ninja -v -C build - name: install run: sudo meson install -C build - name: test run: | xvfb-run -a meson test -C build --verbose --no-stdsplit - name: lcov run: | lcov --ignore-errors mismatch --directory . --capture --output-file coverage.info; # capture coverage info lcov --remove coverage.info '/usr/*' --output-file coverage.info; # filter out system lcov --remove coverage.info '*Test*' --output-file coverage.info; # filter out system lcov --remove coverage.info '*gtest*' --output-file coverage.info; # filter out system lcov --list coverage.info; #debug info # https://docs.codecov.com/docs/quick-start - name: "Upload coverage reports to Codecov" uses: codecov/codecov-action@v5 env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} with: fail_ci_if_error: true # optional (default = false) verbose: false # optional (default = false) - name: "Publish Test Results" uses: EnricoMi/publish-unit-test-result-action@v2 if: always() with: files: build/meson-logs/testlog.junit.xml build_job: # The host should always be linux runs-on: ubuntu-20.04 name: Build on ${{ matrix.distro }} ${{ matrix.arch }} # Run steps on a matrix of 3 arch/distro combinations strategy: matrix: include: - arch: aarch64 distro: ubuntu22.04 - arch: ppc64le distro: ubuntu22.04 #- arch: s390x # distro: ubuntu20.04 - arch: armv7 distro: ubuntu22.04 #- arch: armv7 # distro: bookworm steps: - uses: actions/checkout@v2.1.0 - uses: uraimo/run-on-arch-action@v2 name: Build artifact id: build with: arch: ${{ matrix.arch }} distro: ${{ matrix.distro }} # Not required, but speeds up builds githubToken: ${{ github.token }} # Create an artifacts directory setup: | mkdir -p "${PWD}/artifacts" # Mount the artifacts directory as /artifacts in the container dockerRunArgs: | --volume "${PWD}/artifacts:/artifacts" # Pass some environment variables to the container env: | # YAML, but pipe character is necessary artifact_name: git-${{ matrix.distro }}_${{ matrix.arch }} # The shell to run commands with in the container shell: /bin/sh # Install some dependencies in the container. This speeds up builds if # you are also using githubToken. Any dependencies installed here will # be part of the container image that gets cached, so subsequent # builds don't have to re-install them. The image layer is cached # publicly in your project's package repository, so it is vital that # no secrets are present in the container state or logs. install: | apt-get update -q -y apt-get install -q -y ${{ env.DEB_PKGS }} ${{ env.DEB_TEST_PKGS }} # Produce a binary artifact and place it in the mounted volume run: | meson setup build ninja -C build meson install -C build xvfb-run -a meson test -C build --verbose --no-stdsplit # - name: Show the artifact # # Items placed in /artifacts in the container will be in # # ${PWD}/artifacts on the host. # run: | # ls -al "${PWD}/artifacts" build-santize-address: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: apt install run: >- sudo apt update && sudo apt install libunwind-dev && sudo apt install -y ${{ env.DEB_PKGS }} ${{ env.DEB_TEST_PKGS }} - name: meson run: | meson --version meson setup build -Dsanitize-address=true env: CXX: g++ - name: build run: ninja -v -C build - name: install run: sudo meson install -C build - name: test run: | if ! xvfb-run -a meson test -C build --verbose --no-stdsplit; then echo "::warning title=test-failed::test failed" fi continue-on-error: true iptux-0.9.4/.github/workflows/codeql.yml000066400000000000000000000071501475473122500203010ustar00rootroot00000000000000# For most projects, this workflow file will not need changing; you simply need # to commit it to your repository. # # You may wish to alter this file to override the set of languages analyzed, # or to provide custom queries or build logic. # # ******** NOTE ******** # We have attempted to detect the languages in your repository. Please check # the `language` matrix defined below to confirm you have the correct set of # supported CodeQL languages. # name: "CodeQL" on: push: branches: [ "master" ] pull_request: branches: [ "master" ] schedule: - cron: '33 11 * * 6' jobs: analyze: name: Analyze # Runner size impacts CodeQL analysis time. To learn more, please see: # - https://gh.io/recommended-hardware-resources-for-running-codeql # - https://gh.io/supported-runners-and-hardware-resources # - https://gh.io/using-larger-runners # Consider using larger runners for possible analysis time improvements. runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-20.04' }} timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }} permissions: # required for all workflows security-events: write # only required for workflows in private repositories actions: read contents: read strategy: fail-fast: false matrix: language: [ 'c-cpp' ] # CodeQL supports [ 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' ] # Use only 'java-kotlin' to analyze code written in Java, Kotlin or both # Use only 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support steps: - name: Checkout repository uses: actions/checkout@v4 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL uses: github/codeql-action/init@v3 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. # By default, queries listed here will override any specified in a config file. # Prefix the list here with "+" to use these queries and those in the config file. # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs # queries: security-extended,security-and-quality # Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift). # If this step fails, then you should remove it and run the build manually (see below) #- name: Autobuild # uses: github/codeql-action/autobuild@v3 # ℹ️ Command-line programs to run using the OS shell. # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun # If the Autobuild fails above, remove it and uncomment the following three lines. # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. - run: >- sudo apt-get update -q -y && sudo apt-get install -q -y git libgoogle-glog-dev libgtk-3-dev libglib2.0-dev libjsoncpp-dev g++ meson xvfb libsigc++-2.0-dev appstream gettext && meson --version && meson setup build && ninja -v -C build - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v3 with: category: "/language:${{matrix.language}}" iptux-0.9.4/.gitignore000066400000000000000000000030101475473122500146710ustar00rootroot00000000000000# # NOTE! Don't add files that are generated in specific # subdirectories here. Add them in the ".gitignore" file # in that subdirectory instead. # # NOTE! Please use 'git ls-files -i --exclude-standard' # command after changing this file, to see if there are # any tracked files which get ignored after the change. # # Normal rules # .idea .vscode/ipch *.o *.o.* *.a *.s *.ko *.so *.so.dbg *.mod.c *.i *.lst *.symtypes *.order modules.builtin *.elf *.bin *.gz *.bz2 *.lzma *.gcno # # Top-level generic files # /tags /TAGS /linux /vmlinux /vmlinuz /System.map /Module.markers /Module.symvers # # git files that we don't want to ignore even it they are dot-files # !.gitignore !.mailmap # # Generated include files # include/config include/linux/version.h include/generated # stgit generated dirs patches-* # cscope files cscope.* ncscope.* # gnu global files GPATH GRTAGS GSYMS GTAGS *.orig *~ \#*# Makefile config.h config.log config.status src/main/iptux stamp-h1 autom4te.cache *.gmo *.mo po/Makefile.in cmake_install.cmake CMakeCache.txt CMakeFiles install_manifest.txt build test/googletest-prefix CTestTestfile.cmake src/googletest-download/CMakeLists.txt src/googletest-download/googletest-prefix src/googletest-src src/Test src/Testing Testing src/iptux/libiptux_test *.cbp src/iptux/IptuxResource.c src/iptux/IptuxResource.h src/iptux/IptuxResource.cpp cmake-build-debug builddir builddir-linux coverage.info .vscode/settings.json .vscode/launch.json /vs .vscode/tasks.json .DS_Store meson-cmake-wrapper.log .cache iptux-0.9.4/.vscode/000077500000000000000000000000001475473122500142505ustar00rootroot00000000000000iptux-0.9.4/.vscode/c_cpp_properties.json000066400000000000000000000153721475473122500205130ustar00rootroot00000000000000{ "configurations": [ { "name": "Mac", "includePath": [ "${workspaceFolder}/src", "${workspaceFolder}/builddir/src", "${workspaceFolder}/src/googletest/include", "/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1", "/Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include", "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include", "/Library/Developer/CommandLineTools/usr/include", "/opt/homebrew/opt/atk/include/atk-1.0", "/opt/homebrew/Cellar/cairo/1.16.0_5/include/cairo", "/opt/homebrew/Cellar/cairo/1.16.0_5/include/cairo", "/opt/homebrew/Cellar/fontconfig/2.13.1/include", "/opt/homebrew/Cellar/fribidi/1.0.10/include/fribidi", "/opt/homebrew/Cellar/glog/0.4.0/include", "/opt/homebrew/Cellar/graphite2/1.3.14/include", "/opt/homebrew/Cellar/gtk-mac-integration/3.0.0/include/", "/opt/homebrew/Cellar/jsoncpp/1.9.4_1/include", "/opt/homebrew/Cellar/libepoxy/1.5.5_1/include", "/opt/homebrew/Cellar/libffi/3.3_2/include", "/opt/homebrew/Cellar/libpng/1.6.37/include/libpng16", "/opt/homebrew/Cellar/libx11/1.7.0/include", "/opt/homebrew/Cellar/libxau/1.0.9/include", "/opt/homebrew/Cellar/libxcb/1.14_1/include", "/opt/homebrew/Cellar/libxcb/1.14_1/include", "/opt/homebrew/Cellar/libxdmcp/1.1.3/include", "/opt/homebrew/Cellar/libxext/1.3.4/include", "/opt/homebrew/Cellar/libxrender/0.9.10/include", "/opt/homebrew/Cellar/pcre/8.44/include", "/opt/homebrew/Cellar/pixman/0.40.0/include/pixman-1", "/opt/homebrew/Cellar/xorgproto/2021.3/include", "/opt/homebrew/opt/freetype/include/freetype2", "/opt/homebrew/opt/gdk-pixbuf/include/gdk-pixbuf-2.0", "/opt/homebrew/opt/gettext/include", "/opt/homebrew/opt/glib/include", "/opt/homebrew/opt/glib/include/gio-unix-2.0", "/opt/homebrew/opt/glib/include/glib-2.0", "/opt/homebrew/opt/glib/lib/glib-2.0/include", "/opt/homebrew/opt/gtk+3/include/gtk-3.0", "/opt/homebrew/opt/harfbuzz/include/harfbuzz", "/opt/homebrew/opt/libsigc++@2/include/sigc++-2.0", "/opt/homebrew/opt/pango/include/pango-1.0" ], "defines": [], "macFrameworkPath": [ "/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk/System/Library/Frameworks" ], "compilerPath": "/usr/bin/clang", "cStandard": "c11", "cppStandard": "c++14", "intelliSenseMode": "macos-clang-x64", "compileCommands": "${workspaceFolder}/build/compile_commands.json" }, { "name": "Mac-arm", "includePath": [ "${workspaceFolder}/src", "${workspaceFolder}/builddir/src", "${workspaceFolder}/src/googletest/include", "/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1", "/Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include", "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include", "/Library/Developer/CommandLineTools/usr/include", "/opt/homebrew/opt/atk/include/atk-1.0", "/opt/homebrew/Cellar/cairo/1.16.0_5/include/cairo", "/opt/homebrew/opt/fontconfig/include", "/opt/homebrew/opt/fribidi/include/fribidi", "/opt/homebrew/opt/glog/include", "/opt/homebrew/Cellar/graphite2/1.3.14/include", "/opt/homebrew/opt/gtk-mac-integration/include/", "/opt/homebrew/opt/jsoncpp/include", "/opt/homebrew/opt/libepoxy/include", "/opt/homebrew/opt/libffi/include", "/opt/homebrew/opt/libpng/include/libpng16", "/opt/homebrew/opt/libx11/include", "/opt/homebrew/opt/libxau/include", "/opt/homebrew/opt/libxcb/include", "/opt/homebrew/opt/libxdmcp/include", "/opt/homebrew/opt/libxext/include", "/opt/homebrew/Cellar/libxrender/0.9.10/include", "/opt/homebrew/opt/pcre/include", "/opt/homebrew/Cellar/pixman/0.40.0/include/pixman-1", "/opt/homebrew/opt/xorgproto/include", "/opt/homebrew/opt/freetype/include/freetype2", "/opt/homebrew/opt/gdk-pixbuf/include/gdk-pixbuf-2.0", "/opt/homebrew/opt/gettext/include", "/opt/homebrew/opt/glib/include", "/opt/homebrew/opt/glib/include/gio-unix-2.0", "/opt/homebrew/opt/glib/include/glib-2.0", "/opt/homebrew/opt/glib/lib/glib-2.0/include", "/opt/homebrew/opt/gtk+3/include/gtk-3.0", "/opt/homebrew/opt/harfbuzz/include/harfbuzz", "/opt/homebrew/opt/libsigc++@2/include/sigc++-2.0", "/opt/homebrew/opt/pango/include/pango-1.0" ], "defines": [], "macFrameworkPath": [ "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks" ], "compilerPath": "/usr/bin/clang", "cStandard": "c11", "cppStandard": "c++14", "intelliSenseMode": "macos-clang-arm64", "compileCommands": "${workspaceFolder}/builddir/compile_commands.json" }, { "name": "Win32", "includePath": [ "${workspaceFolder}/**", "C:/msys64/mingw64/x86_64-w64-mingw32/include", "C:/msys64/mingw64/include/c++/10.2.0", "C:/msys64/mingw64/include/c++/10.2.0/tr1", "C:/msys64/mingw64/include/c++/10.2.0/x86_64-w64-mingw32", "C:/msys64/mingw64/include", "C:/msys64/mingw64/include/atk-1.0", "C:/msys64/mingw64/include/cairo", "C:/msys64/mingw64/include/freetype2", "C:/msys64/mingw64/include/fribidi", "C:/msys64/mingw64/include/gdk-pixbuf-2.0", "C:/msys64/mingw64/include/glib-2.0", "C:/msys64/mingw64/include/gtk-3.0", "C:/msys64/mingw64/include/harfbuzz", "C:/msys64/mingw64/include/harfbuzz", "C:/msys64/mingw64/include/libpng16", "C:/msys64/mingw64/include/libpng16", "C:/msys64/mingw64/include/lzo", "C:/msys64/mingw64/include/pango-1.0", "C:/msys64/mingw64/include/pango-1.0", "C:/msys64/mingw64/include/pixman-1", "C:/msys64/mingw64/lib/glib-2.0/include" ], "defines": [ "_DEBUG", "UNICODE", "_UNICODE" ], "compilerPath": "C:\\msys64\\usr\\bin\\g++.exe", "cStandard": "c17", "cppStandard": "c++14", "intelliSenseMode": "windows-gcc-x64", "compileCommands": "${workspaceFolder}/builddir/compile_commands.json" }, { "name": "Linux", "includePath": [ "${workspaceFolder}/**", "/usr/include/jsoncpp" ], "defines": [], "compilerPath": "/usr/bin/c++", "cStandard": "c17", "cppStandard": "gnu++17", "intelliSenseMode": "linux-gcc-x64", "compileCommands": "build/compile_commands.json" } ], "version": 4 } iptux-0.9.4/.vscode/extensions.json000066400000000000000000000002411475473122500173370ustar00rootroot00000000000000{ "recommendations": [ "editorconfig.editorconfig", "ms-vscode.cpptools", "eamodio.gitlens", "mesonbuild.mesonbuild" ] } iptux-0.9.4/.vscode/tasks.json000066400000000000000000000040631475473122500162730ustar00rootroot00000000000000{ // See https://go.microsoft.com/fwlink/?LinkId=733558 // for the documentation about the tasks.json format "version": "2.0.0", "tasks": [ { "type": "shell", "label": "clang build active file", "command": "/usr/local/opt/ccache/libexec/clang", "args": [ "-g", "${file}", "-o", "${fileDirname}/${fileBasenameNoExtension}" ], "options": { "cwd": "/usr/local/opt/ccache/libexec" }, "problemMatcher": [ "$gcc" ] }, { "type": "shell", "label": "ninja", "command": "ninja", "args": [], "options": { "cwd": "/Users/lidaobing/workspace/lidaobing/iptux/builddir" }, "problemMatcher": { "owner": "cpp", "fileLocation": [ "relative", "${workspaceFolder}/builddir" ], "pattern": { "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$", "file": 1, "line": 2, "column": 3, "severity": 4, "message": 5 } }, "group": { "kind": "build", "isDefault": true } }, { "type": "shell", "label": "ninja clean", "command": "ninja", "args": [ "clean" ], "options": { "cwd": "/Users/lidaobing/workspace/lidaobing/iptux/builddir" }, "problemMatcher": [] }, { "type": "shell", "label": "Meson: Build Project", "options": { "cwd": "/Users/lidaobing/workspace/lidaobing/iptux/builddir" }, "command": "meson compile" } ] } iptux-0.9.4/ChangeLog000066400000000000000000000062241475473122500144650ustar00rootroot000000000000002011-12-24 改进了如下问题 -资源文件不存在是程序异常退出 -广播网段过大时,启动时界面不响应 -正在文件传输过程中终止文件传输时程序异常退出 -在没有任务栏的系统中点主窗口的X按钮后主窗口无法调出 -与windows版,adroid版信鸽发送单个文件时对方不能接收 -往adroid版信鸽发多个文件时对方不能接收 -改进了接收文件夹时的协议,与原版飞鸽一致,接收与发送时加入了文件时间信息(飞鸽类软件都有这一项),改正了接收文件夹时的一个逻辑错误(这个错误会导致文件已经接收完,但是还不断去tcp连接中读取数据,这样界面上一直会显示没有正常结束) 2010-06-19 - issue 71: iptux crash when shared dir does not exist. 2009-10-07 -在alick的帮助下完成翻译修正工作 2009-10-02 -完成底层代码的大量整改工作 2009-07-11 -图片资源改由GTK+帮助管理 2009-04-16 -底层代码的少量修改 2009-03-09 -修正选择自定义声音路径无效的问题 2009-02-26 -文件已存在时自动重命令文件以防覆盖 -加入音量控制功能 2009-02-21 -实现面板上的来消息提示 2009-02-20 -完成反安装程序 2009-02-19 -更人性化的文件保存路径选择 2009-02-18 -完美处理文件的拖拽操作 2009-02-17 -加入声音提示、日志记录功能 2009-02-16 -完成声音模块 -添加从群发界面直接跳入单好友聊天模式功能 -为共享文件设置密码保护 2009-02-14 -取消背景变更 -更换程序logo 2009-02-13 -修正strpbrk()函数引发的编译出错 2009-02-09 -修正自定义头像不能被正确显示的错误 -实现文字与图像同步传输 2009-02-07 -取消友元类编码方法 -为某些命令增设标志位,用于识别更多种情形 -分离部分底层与界面代码 2009-01-14 -修正初始化丢失引发的段错误 -采用一套可选择的方案解决运行效率太低的问题 2009-01-12 -重新调整底层架构 2009-01-09 -解决缓冲区太小引发的诸多问题 2008-12-26 -使用Enter键直接发送消息 -组功能支持 2008-12-25 -新增网段描述表功能 2008-12-23 -新增64位大文件处理能力 2008-12-22 -增加排序功能 -调整配置文件存放路径 2008-12-21 -端口绑定出错则程序强制退出 2008-12-19 -修正端口绑定出错 2008-12-15 -最后一次处理图片传输,但是无法完成 -取消IP段自动添加功能 2008-12-13 -更新协议文档 2008-12-12 -完成形象照片传输,同时也为传输图片打好了基础 2008-12-11 -搞定个性签名 2008-12-10 -修正接收UDP数据时,缓冲区可能存在的溢出问题 -利用兼容特性减少网络数据发送量 -重制界面 2008-12-07 -更多错误提示 -修正遍历文件链表时释放内存出错 2008-12-05 -新增搜索功能 2008-12-03 -修正文件发送、接收兼容问题 2008-11-25 -修正接收文件时发生的内存泄漏 2008-11-22 -改善配置文件的读取与存储 -修正群发消息时的内存泄漏 2008-11-19 -修正与飞秋(FeiQ)之间的兼容性 -修正自动回复失效的错误 -修正不能接收文件的错误 iptux-0.9.4/LICENSE000066400000000000000000000432541475473122500137240ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. iptux-0.9.4/NEWS000066400000000000000000000050221475473122500134050ustar00rootroot00000000000000Version 0.9.4 ~~~~~~~~~~~~~ Released: 2025-02-17 Features: * [#667] Add insert image for the popup menu of the chat input area. * [#664, #666] port snapcraft from core20 to core24. * [#665] introduce soversion for iptux-core library. * [#657] improve log * [#625] support flatpak * [#642] add a new option to hide taskbar when main window iconified. Bugfixes: * [#658] after close dialog and reopen, the image no longer exists. * [#656] fix iptux stackoverflow when receiving directory. * [#645] check exist preference dialog before open a new one. * [#628] fix wrap mode of chat dialog. * [#614] no extra \U0001 when sending image. Version 0.9.3 ~~~~~~~~~~~~~ Released: 2024-06-22 Features: * [#593, #595, #601, #604] support paste image into chatbox, support copy/save image in chat history. * [#586] add keywords to metainfo and desktop file. Bugfixes: * [#584] fix compile failed under armhf. Version 0.9.1 ~~~~~~~~~~~~~ Released: 2024-05-12 Bugfixes: * [#577] fix UT timeout when run without browser and a new meson version. Translation: * [#576] update Spanish translation. Thanks to gallegonovato. * [#579] update Traditional Chinese translation. Thanks to xiao sheng wen. Version 0.9.0 ~~~~~~~~~~~~~ Released: 2024-05-09 Features: * [#524] add more sort methods and view methods. * [#517] add system tray icon / appindicator. * [#559] support change port in the Preferences dialog. Bugfixes: * [#536]: don't show headerbar and menu at the same time; support headerbar for peer/group dialog Translation: * Spanish translation. Thanks to gallegonovato. Version 0.8.5 ~~~~~~~~~~~~~ Released: 2024-04-14 Bugfixes: * [#516] Fix typo in the Preferences dialog. * [#520] Fix window resize behavior. * [#531, #533] Improve crash handler. * [#536] Fix bug in menu. Translation: * New Portuguese translation. Thanks to inkhorn. * New Ukrainian translation. Thanks to Сергій. * Polish translation. Thanks to Eryk Michalak. Version 0.8.4 ~~~~~~~~~~~~~ Released: 2023-06-16 Features: * [#482] add "What's New" in the menu. * [#485] `W` can close all kinds of windows. Bugfixes: * [#481] chatbox can remember the unsent text. * [#492, #495] improve meson config, Thanks to @r-value for the patch. * [#497] update Preferences dialog. * [#514] show quit and preference menu when no appmenu. Translation: * Portuguese (Brazil) - Thanks to inkhorn Version 0.8.3 ~~~~~~~~~~~~~ Released: 2021-10-07 Features: * [#476] open chat when clicking the new message notification, only works under Linux. iptux-0.9.4/NEWS.md000066400000000000000000000161051475473122500140100ustar00rootroot00000000000000# NEWS the NEWS after version 0.8.2 had been moved to [NEWS](https://github.com/iptux-src/iptux/blob/master/NEWS). ## [0.8.2] (2021-06-21) * [#473] iconify main window when delete. * Translation updated: * Norwegian Bokmål - Thanks to Allan Nordhøy * German, French, Italy - Thanks to J. Lavoie ## [0.8.1] (2021-05-03) * [#442] fix unittest fail under 32-bit system. * [#439] try to fix compile problem under Hurd. * [#447] fix bug: user defined icon no longer works. * [#422] fix bug: request shared resource no longer works. * [#441] use `GtkHeaderBar` under Linux. * [#462] when recv file, if file exist, save to `foo (1).ext` (was `1_foo.ext`). * Translation updated * Simplified Chinese * Russian - Thanks to @KovalevArtem ## [0.8.0] (2021-04-11) ### Features * migrate to GTK+3, and use `GtkApplication`. * switch from `GtkStatusIcon` to `GNotification`. * for macOS, we use `terminal-notifier`. * split non-UI part to libiptux-core, now you can write a bot for iptux, check `examples`. * add a config option `bind_ip` to specify binding ip. * add icon for macOS. * switch from `cmake` to `meson`. * Translation Updated: * New language: Norwegian Bokmål - Thanks to @comradekingu. * German - Thanks to @comradekingu. * Simplified Chinese. ### Bugs * [#114] fix icon size. * [#119] check the return code of `setsockopt`. * [#125] fix crash on UdpData::SomeoneSendmsg. * [#140] fix crash on TransWindow::TerminateTransTask. * [#132] fix file accepted when cancel the directory chooser dialog. * [#154] fix sound system. * [#52] fix bind problem. * [#144] crash on drag text. ### refactor * [#123] don't use `obtain_pixbuf_from_stock`. * [#136] the binding failed dialog should be a child of the main window. ## [0.7.6] (2018-12-29) * [#219] fix compatible with FeiQ. thanks to caowai. ## [0.7.5] (2018-05-28) * [#114] fix icon size. * [#119] check the return code of `setsockopt`. * [#207] fix crash when config the `Network`. ## [0.7.4] (2018-01-24) * [#?] fix bug in save share management. * [#97] don't download googletest if already installed. ## [0.7.3] (2018-01-20) * [#98] fix typo, thanks to @hosiet. * [#100] fix crash on the context menu of statusicon. ## [0.7.2] (2018-01-16) * [?] fix crash when clicking on the popup menu of the mainwindow. * [?] introduce gtest. * [?] support specify config from command line. * [#92] clean the icon namespace. * [?] update po/iptux.pot, update `zh_CN` translation. ## [0.7.1] (2018-01-14) * [?] fix build guide in `README.md` and homebrew. * [#80] honor the default `CMAKE_C_FLAGS` and `CMAKE_CXX_FLAGS`, thanks to @hosiet. * [#81] fix crash on status icon click. ## [0.7.0] (2018-01-10) * [#33] refactor src/AnalogFS.cpp to make the bug log has more information. * [#61] switch from autotools to cmake. * [#67] improve compile under MacOS, thanks to @jiegec. * [#70] switch config system from gconf to jsoncpp1. * [#74] fix critial warning on peer window. ## [0.6.4] (2017-08-22) * [#58] fix compile problem under gcc 7. ## [0.6.3] (2015-09-29) * [#44] Add "Keywords" entries to iptux.desktop, etc. * [#43] Remove deprecated "Encoding" in group "Desktop Entry". * [#45] Upgrade to GStreamer from 0.10 to 1.0. ## [0.6.2] (2014-02-06) * [#26] iptux --version should work without DISPLAY env. * [#28] code.google.com -> github.com ## [0.6.1] (2013-12-14) * [#20] fix compile problem under MacOSX 10.9 ## 0.6.0 (2013-06-05) * [#8] fix autoreconf warning * [#6] add travis support * [#4] buildable under Linux * [#1] buildable under Mac OSX ## OLD RELEASES * 2012-2-29 把文件接收发送界面放在了聊天窗口内,根据此功能需要底层数据结构作相应改动 * 2011-12-24 改进了如下问题 1.资源文件不存在是程序异常退出 2.广播网段过大时,启动时界面不响应 3.正在文件传输过程中终止文件传输时程序异常退出 4.在没有任务栏的系统中点主窗口的X按钮后主窗口无法调出 5.与windows版,adroid版信鸽发送单个文件时对方不能接收 6.往adroid版信鸽发多个文件时对方不能接收 7.改进了接收文件夹时的协议,与原版飞鸽一致,接收与发送时加入了文件时间信息(飞鸽类软件都有这一项),改正了接收文件夹时的一个逻辑错误(这个错误会导致文件已经接收完,但是还不断去tcp连接中读取数据,这样界面上一直会显示没有正常结束) * 2009-11-20 源码包不能安装,更新 * 2009-11-19 修正已发现的致命错误,并更新源码包 * 2009-11-01 发布最新版iptux-0.5.1源码包 * 2009-10-10 貌似0.5.0这个版本中的问题很多啊,这几天我都在不停的改版本号。 * 2009-10-09 降低iptux对`Gtk+`高版本库的依赖,现在iptux需要的`Gtk+`库的最低版本为2.12.0,如果还低于此版本,那我只能表示很抱歉了。 * 2009-10-08 发布最新版iptux-0.5.0源码包。另,鉴于很多哥们的库版本比较低,所以这一次除了发布一个正规的版本(0.5.0)外,顺便也发布了一个对库文件要求较低的版本(0.5.0-lv),所以下载的时候请参考自己的实际情形选择下载。 * 2009-09-30 郁闷,有些人加入了项目之后都不做事,这算什么嘛?我决定清理成员了 * 2009-05-12 继续0.4.6版开发,加入聊天窗口中对http://等url的识别和链接功能 * 2009-03-09 鉴于0.4.5版中存在一个严重错误,所以建议尽快更新为0.4.5-1版 * 2009-03-02 发布最新iptux-0.4.5源码包 * 2009-01-17 发布最新iptux-0.4.4源码包 * 2008-12-31 新加入项目成员 pentie@gmail.com ,PT * 2008-12-24 发布iptux-0.4.3 .rpm包,由网友 liangsuilong 提供 * 2008-12-17 发布iptux-0.4.3 .deb及二进制包,由网友 mdjhu@sina.com 提供 * 2008-12-16 发布最新iptux-0.4.3源码包 * 2008-12-07 发布最新iptux-0.4.2相关包,二进制包由网友 mdjhu@sina.com 提供 * 2008-12-04 新上传三个二进制包,由网友 mdjhu@sina.com 提供 [unreleased]: https://github.com/iptux-src/iptux/compare/v0.8.4...HEAD [0.8.4]: https://github.com/iptux-src/iptux/compare/v0.8.3...v0.8.4 [0.8.3]: https://github.com/iptux-src/iptux/compare/v0.8.2...v0.8.3 [0.8.2]: https://github.com/iptux-src/iptux/compare/v0.8.1...v0.8.2 [0.8.1]: https://github.com/iptux-src/iptux/compare/v0.8.0...v0.8.1 [0.8.0]: https://github.com/iptux-src/iptux/compare/v0.7.6...v0.8.0 [0.7.6]: https://github.com/iptux-src/iptux/compare/v0.7.5...v0.7.6 [0.7.5]: https://github.com/iptux-src/iptux/compare/v0.7.4...v0.7.5 [0.7.4]: https://github.com/iptux-src/iptux/compare/v0.7.3...v0.7.4 [0.7.3]: https://github.com/iptux-src/iptux/compare/v0.7.2...v0.7.3 [0.7.2]: https://github.com/iptux-src/iptux/compare/v0.7.1...v0.7.2 [0.7.1]: https://github.com/iptux-src/iptux/compare/v0.7.0...v0.7.1 [0.7.0]: https://github.com/iptux-src/iptux/compare/v0.6.4...v0.7.0 [0.6.4]: https://github.com/iptux-src/iptux/compare/v0.6.3...v0.6.4 [0.6.3]: https://github.com/iptux-src/iptux/compare/v0.6.2...v0.6.3 [0.6.2]: https://github.com/iptux-src/iptux/compare/v0.6.1...v0.6.2 [0.6.1]: https://github.com/iptux-src/iptux/compare/v0.6.0...v0.6.1 iptux-0.9.4/README.md000066400000000000000000000060421475473122500141700ustar00rootroot00000000000000# iptux: LAN communication software [![Snapcraft](https://snapcraft.io/iptux/badge.svg)](https://snapcraft.io/iptux) [![CI](https://github.com/iptux-src/iptux/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/iptux-src/iptux/actions/workflows/ci.yml?query=branch%3Amaster) [![CodeFactor](https://www.codefactor.io/repository/github/iptux-src/iptux/badge)](https://www.codefactor.io/repository/github/iptux-src/iptux) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/0d2720ebbf474c02ac5ebc1036849889)](https://app.codacy.com/gh/iptux-src/iptux/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade) [![codecov](https://codecov.io/gh/iptux-src/iptux/branch/master/graph/badge.svg)](https://codecov.io/gh/iptux-src/iptux/branch/master) [![CodeQL](https://github.com/iptux-src/iptux/actions/workflows/codeql.yml/badge.svg)](https://github.com/iptux-src/iptux/actions/workflows/codeql.yml) [![Weblate Translation Status](https://hosted.weblate.org/widgets/iptux/-/iptux/svg-badge.svg)](https://hosted.weblate.org/engage/iptux/) ## Install ### Linux

Get it from the Snap Store Get it on Flathub

### Mac OS X ``` brew tap iptux-src/iptux brew install iptux ``` ## Build from source ### Linux (Debian and Ubuntu) ```sh sudo apt-get install git libgoogle-glog-dev libgtk-3-dev libglib2.0-dev libjsoncpp-dev g++ meson libsigc++-2.0-dev libayatana-appindicator3-dev appstream gettext git clone git://github.com/iptux-src/iptux.git cd iptux meson setup build meson compile -C build # or "ninja -C build" if meson version < 0.54 sudo meson install -C build iptux ``` ### Mac OS X ```sh brew install meson gettext gtk+3 jsoncpp glog gtk-mac-integration libsigc++@2 appstream git clone git://github.com/iptux-src/iptux.git cd iptux meson setup build meson install -C build iptux ``` ## Usage * adjust firewall to allow use the TCP/UDP 2425 port. * then run `iptux`. ### Compatible list check https://github.com/iptux-src/iptux/wiki/Compatible-List ## Develop * use `meson setup -Ddev=true build` to build an iptux which can use resource in source directory. * start 2 iptux on one machine for test * It's a known bug that you can not send file between 127.0.0.2 and 127.0.0.3 ```sh iptux -b 127.0.0.2 & iptux -b 127.0.0.3 & ``` ## Contributing * Help improve [translation](https://hosted.weblate.org/projects/iptux/#languages), we are using weblate for translation * Test the [compatibility](https://github.com/iptux-src/iptux/wiki/Compatible-List), * Fix [bugs](https://github.com/iptux-src/iptux/issues). ### How to update `po/iptux.pot` ``` meson setup build meson compile update-po -C build ``` ## Stats ![Alt](https://repobeats.axiom.co/api/embed/8944a2744839c5ea58b0ea10f46a1d31c7fefa07.svg "Repobeats analytics image") iptux-0.9.4/codecov.yml000066400000000000000000000003571475473122500150610ustar00rootroot00000000000000coverage: ignore: - "^src/iptux-core/Test.*" - "^src/iptux-core/.*Test.cpp$" - "^src/iptux-utils/Test.*" - "^src/iptux-utils/.*Test.cpp$" - "^src/iptux/Test.*" - "^src/iptux/.*Test.cpp$" - "^src/googletest.*" iptux-0.9.4/examples/000077500000000000000000000000001475473122500145255ustar00rootroot00000000000000iptux-0.9.4/examples/count-bot/000077500000000000000000000000001475473122500164375ustar00rootroot00000000000000iptux-0.9.4/examples/count-bot/main.cpp000066400000000000000000000035231475473122500200720ustar00rootroot00000000000000#include #include #include #include #include #include #include using namespace std; using namespace iptux; void usage(const char* progname) { printf("Usage:\n"); printf(" %s [IP] -- run robot on IP(default: 0.0.0.0)\n", progname); printf(" %s -h -- print help\n", progname); } void processNewMessageEvent(shared_ptr ct, const NewMessageEvent* event) { auto para = event->getMsgPara(); LOG(INFO) << "New Message Event: " << endl; LOG(INFO) << " From: " << para.getPal()->GetKey().ToString() << endl; for (auto& chip : para.dtlist) { LOG(INFO) << " Message: " << chip.ToString() << endl; ostringstream oss; oss << "your message has " << chip.data.size() << " bytes."; ct->SendMessage(para.getPal(), oss.str()); } } void processEvent(shared_ptr ct, shared_ptr event) { cout << "Event: " << int(event->getType()) << endl; if (event->getType() == EventType::NEW_MESSAGE) { processNewMessageEvent(ct, dynamic_cast(event.get())); } } int runBot(const string& bindIp) { auto config = IptuxConfig::newFromString("{}"); config->SetString("bind_ip", bindIp); auto progdt = make_shared(config); auto thread = make_shared(progdt); thread->start(); thread->signalEvent.connect( [=](shared_ptr event) { processEvent(thread, event); }); while (true) { sleep(10); } } int main(int argc, char* argv[]) { if (argc == 2 && string("-h") == argv[1]) { usage(argv[0]); return 0; } if (argc > 2) { usage(argv[0]); return 1; } string bindIp("0.0.0.0"); if (argc == 2) { bindIp = argv[1]; } return runBot(bindIp); } iptux-0.9.4/examples/count-bot/meson.build000066400000000000000000000004261475473122500206030ustar00rootroot00000000000000bot_sources = files(['main.cpp']) executable('count-bot', bot_sources, include_directories: include_directories('../../src/api'), dependencies: [jsoncpp_dep, thread_dep, glog_dep, gflags_dep, glib_dep, sigc_dep], link_with: [libiptux_core], install: false ) iptux-0.9.4/examples/meson.build000066400000000000000000000000241475473122500166630ustar00rootroot00000000000000subdir('count-bot') iptux-0.9.4/meson.build000066400000000000000000000030161475473122500150510ustar00rootroot00000000000000project('iptux', 'cpp', license: 'GPL2+', version: '0.9.4', meson_version: '>=0.53', default_options: ['warning_level=3', 'cpp_std=c++14']) add_global_arguments('-Werror=format', language : 'cpp') if get_option('sanitize-address') add_project_arguments('-fsanitize=address', language: 'cpp') add_project_link_arguments('-fsanitize=address', language: 'cpp') endif so_version = 1 subdir('src') subdir('share') subdir('po') subdir('examples') subdir('scripts') if meson.version().version_compare('>=0.57') summary({ 'prefix': get_option('prefix'), 'bindir': get_option('bindir'), 'libdir': get_option('libdir'), 'data': get_option('datadir'), }, section: 'Directories:') summary_deps = { 'meson': meson.version(), 'glib-2.0': glib_dep, 'gtk+-3.0': gtk_dep, 'jsoncpp': jsoncpp_dep, 'libglog': glog_dep, 'gflags': gflags_dep, 'sigc++-2.0': sigc_dep, } if host_machine.system() == 'darwin' summary_deps += {'gtk-mac-integration-gtk3': gtk_mac_integration_dep} endif if host_machine.system() == 'linux' summary_deps += {'ayatana-appindicator3-0.1': appindicator_dep} endif summary_deps += { 'glib-compile-resources': glib_compile_resources, 'appstreamcli': ascli_exe, } summary(summary_deps, section: 'Dependencies:') summary({ 'dev': get_option('dev'), 'static-link': get_option('static-link'), 'appindicator': appindicator_dep.found(), 'sanitize-address': get_option('sanitize-address'), }, section: 'Options:') endif iptux-0.9.4/meson_options.txt000066400000000000000000000007461475473122500163530ustar00rootroot00000000000000option( 'dev', type: 'boolean', value: false, description: 'enable dev mode, iptux will read resource file from source dir.', ) option( 'static-link', type: 'boolean', value: false, description: 'static link libiptux-core.', ) option( 'appindicator', type: 'feature', value: 'auto', description: 'enable app indicator support', ) option( 'sanitize-address', type: 'boolean', value: false, description: 'enable -fsanitize=address compile/link flag', ) iptux-0.9.4/po/000077500000000000000000000000001475473122500133255ustar00rootroot00000000000000iptux-0.9.4/po/LINGUAS000066400000000000000000000001021475473122500143430ustar00rootroot00000000000000cs de en_GB es fr gl it lb nb_NO pl pt pt_BR ru ta uk zh_CN zh_TW iptux-0.9.4/po/POTFILES000066400000000000000000000032701475473122500144770ustar00rootroot00000000000000examples/count-bot/main.cpp share/metainfo/io.github.iptux_src.iptux.metainfo.xml src/iptux-core/CoreThread.cpp src/iptux-core/Event.cpp src/iptux-core/Exception.cpp src/iptux-core/IptuxConfig.cpp src/iptux-core/Models.cpp src/iptux-core/ProgramData.cpp src/iptux-core/TransFileModel.cpp src/iptux-core/internal/AnalogFS.cpp src/iptux-core/internal/Command.cpp src/iptux-core/internal/CommandMode.cpp src/iptux-core/internal/RecvFile.cpp src/iptux-core/internal/RecvFileData.cpp src/iptux-core/internal/SendFile.cpp src/iptux-core/internal/SendFileData.cpp src/iptux-core/internal/TcpData.cpp src/iptux-core/internal/TransAbstract.cpp src/iptux-core/internal/UdpData.cpp src/iptux-core/internal/UdpDataService.cpp src/iptux-core/internal/support.cpp src/iptux-utils/Exception.cpp src/iptux-utils/output.cpp src/iptux-utils/utils.cpp src/iptux/AboutDialog.cpp src/iptux/AppIndicator.cpp src/iptux/AppIndicatorDummy.cpp src/iptux/Application.cpp src/iptux/Darwin.cpp src/iptux/DataSettings.cpp src/iptux/DetectPal.cpp src/iptux/DialogBase.cpp src/iptux/DialogGroup.cpp src/iptux/DialogPeer.cpp src/iptux/GioNotificationService.cpp src/iptux/LogSystem.cpp src/iptux/MainWindow.cpp src/iptux/RevisePal.cpp src/iptux/ShareFile.cpp src/iptux/TerminalNotifierNotificationService.cpp src/iptux/TransWindow.cpp src/iptux/UiCoreThread.cpp src/iptux/UiHelper.cpp src/iptux/UiModels.cpp src/iptux/WindowConfig.cpp src/iptux/callback.cpp src/iptux/dialog.cpp src/iptux/resources/gtk/AboutDialog.ui src/iptux/resources/gtk/AppIndicator.ui src/iptux/resources/gtk/DetectPal.ui src/iptux/resources/gtk/HeaderBar.ui src/iptux/resources/gtk/MainWindow.ui src/iptux/resources/gtk/menus.ui src/main/iptux.cpp src/main/iptux_crash_utils.cpp iptux-0.9.4/po/cs.po000066400000000000000000001015561475473122500143020ustar00rootroot00000000000000# Czech translation for iptux # Copyright (c) 2010 Rosetta Contributors and Canonical Ltd 2010 # This file is distributed under the same license as the iptux package. # FIRST AUTHOR , 2010. # msgid "" msgstr "" "Project-Id-Version: iptux\n" "Report-Msgid-Bugs-To: https://github.com/iptux-src/iptux/issues/new\n" "POT-Creation-Date: 2025-02-17 13:35-0800\n" "PO-Revision-Date: 2013-04-15 18:07+0000\n" "Last-Translator: Jakub Jezbera \n" "Language-Team: Czech \n" "Language: cs\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Launchpad-Export-Date: 2018-01-24 12:00+0000\n" "X-Generator: Launchpad (build 18532)\n" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:6 msgid "iptux" msgstr "iptux" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:7 msgid "LAN communication software" msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:17 msgid "iptux is an “IP Messenger” client. The features of iptux include:" msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:21 msgid "auto-detect other clients on the intranet." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:22 msgid "send/recv messages to other clients." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:23 msgid "send/recv files to other clients." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:24 msgid "share your files to other cliens (with optional password protection)." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:26 msgid "" "It is (supposedly) compatible with 飞鸽传书 (Feige) and 飞秋 (FeiQ) from " "China, and with the original “IP Messenger” clients from Japan, including " "g2ipmsg and xipmsg in Debian." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:38 msgid "The Iptux main window." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:42 msgid "The Iptux chat window." msgstr "" #: src/iptux-core/CoreThread.cpp:172 #, fuzzy, c-format msgid "" "Fatal Error!! Failed to create new socket!\n" "%s" msgstr "" "Fatální chyba!!\n" "Selhání při vytváření nového socketu!\n" "%s" #: src/iptux-core/CoreThread.cpp:188 #, fuzzy, c-format msgid "" "Fatal Error!! Failed to bind the TCP port(%s:%d)!\n" "%s" msgstr "" "Fatální chyba!!\n" "Selhání při vytváření nového socketu!\n" "%s" #: src/iptux-core/CoreThread.cpp:201 #, fuzzy, c-format msgid "" "Fatal Error!! Failed to bind the UDP port(%s:%d)!\n" "%s" msgstr "" "Fatální chyba!!\n" "Selhání při vytváření nového socketu!\n" "%s" #: src/iptux-core/CoreThread.cpp:461 src/iptux-core/CoreThread.cpp:495 #: src/iptux-core/internal/RecvFileData.cpp:142 #: src/iptux-core/internal/RecvFileData.cpp:204 #, c-format msgid "" "Fatal Error!!\n" "Failed to create new socket!\n" "%s" msgstr "" "Fatální chyba!!\n" "Selhání při vytváření nového socketu!\n" "%s" #: src/iptux-core/Models.cpp:172 #, fuzzy msgid "Empty Message" msgstr "Odeslat zprávu" #: src/iptux-core/Models.cpp:250 msgid "Received an image" msgstr "" #: src/iptux-core/internal/AnalogFS.cpp:93 #: src/iptux-core/internal/AnalogFS.cpp:98 #, c-format msgid "Open() file \"%s\" failed, %s" msgstr "" #: src/iptux-core/internal/AnalogFS.cpp:117 #, c-format msgid "Stat64() file \"%s\" failed, %s" msgstr "" #: src/iptux-core/internal/AnalogFS.cpp:138 #, c-format msgid "Mkdir() directory \"%s\" failed, %s" msgstr "" #: src/iptux-core/internal/AnalogFS.cpp:164 #, c-format msgid "Opendir() directory \"%s\" failed, %s" msgstr "" #: src/iptux-core/internal/Command.cpp:226 msgid "Your pal didn't receive the packet. He or she is offline maybe." msgstr "Váš partner nepřijímá pakety. On nebo ona je možná odpojen(a)." #: src/iptux-core/internal/CommandMode.cpp:39 #, c-format msgid "unknown command mode: %d" msgstr "" #: src/iptux-core/internal/RecvFileData.cpp:117 msgid "receive" msgstr "" #: src/iptux-core/internal/RecvFileData.cpp:124 #: src/iptux-core/internal/RecvFileData.cpp:253 #: src/iptux-core/internal/SendFileData.cpp:108 #: src/iptux-core/internal/SendFileData.cpp:193 #, fuzzy msgid "Unknown" msgstr "neznámé" #: src/iptux-core/internal/RecvFileData.cpp:175 #, fuzzy, c-format msgid "" "Failed to receive the file \"%s\" from %s! expect length %jd, received %jd" msgstr "Selhání při získávání souboru \"%s\" od %s!" #: src/iptux-core/internal/RecvFileData.cpp:180 #, c-format msgid "Receive the file \"%s\" from %s successfully!" msgstr "Soubor \"%s\" od %s přenesen úspěšně!" #: src/iptux-core/internal/RecvFileData.cpp:320 #, c-format msgid "Failed to receive the directory \"%s\" from %s!" msgstr "" #: src/iptux-core/internal/RecvFileData.cpp:323 #, c-format msgid "Receive the directory \"%s\" from %s successfully!" msgstr "" #: src/iptux-core/internal/SendFileData.cpp:101 msgid "send" msgstr "odesláno" #: src/iptux-core/internal/SendFileData.cpp:137 #, c-format msgid "Failed to send the file \"%s\" to %s!" msgstr "" #: src/iptux-core/internal/SendFileData.cpp:142 #, c-format msgid "Send the file \"%s\" to %s successfully!" msgstr "Odeslání souboru \"%s\" pro %s bylo úspěšné!" #: src/iptux-core/internal/SendFileData.cpp:265 #, c-format msgid "Failed to send the directory \"%s\" to %s!" msgstr "" #: src/iptux-core/internal/SendFileData.cpp:270 #, c-format msgid "Send the directory \"%s\" to %s successfully!" msgstr "" #: src/iptux-core/internal/UdpData.cpp:92 #: src/iptux-core/internal/UdpData.cpp:93 #: src/iptux-core/internal/UdpData.cpp:443 #: src/iptux-core/internal/UdpData.cpp:484 msgid "mysterious" msgstr "záhadný" #: src/iptux-utils/utils.cpp:880 #, c-format msgid "stat file \"%s\" failed: %s" msgstr "" #: src/iptux-utils/utils.cpp:888 #, c-format msgid "path %s is not file or directory: st_mode(%x)" msgstr "" #: src/iptux-utils/utils.cpp:895 #, c-format msgid "opendir on \"%s\" failed: %s" msgstr "" #: src/iptux/AboutDialog.cpp:39 msgid "TRANSLATOR NAME" msgstr "" #: src/iptux/AboutDialog.cpp:53 msgid "Thanks to" msgstr "" #: src/iptux/AppIndicator.cpp:40 src/iptux/MainWindow.cpp:505 #: src/iptux/MainWindow.cpp:507 #, fuzzy msgid "Iptux" msgstr "iptux" #: src/iptux/Application.cpp:54 msgid "Loading the process successfully!" msgstr "" #: src/iptux/Application.cpp:274 #, c-format msgid "New Message from %s" msgstr "" #: src/iptux/Application.cpp:287 #, c-format msgid "New File from %s" msgstr "" #: src/iptux/Application.cpp:296 msgid "Receiving File Finished" msgstr "" #: src/iptux/Application.cpp:300 msgid "file info no longer exist" msgstr "" #: src/iptux/Darwin.cpp:16 #, c-format msgid "Couldn’t load icon: %s" msgstr "" #: src/iptux/DataSettings.cpp:46 msgid "Personal" msgstr "Osobní" #: src/iptux/DataSettings.cpp:48 msgid "System" msgstr "Systém" #: src/iptux/DataSettings.cpp:50 msgid "Network" msgstr "Síť" #: src/iptux/DataSettings.cpp:89 src/iptux/DataSettings.cpp:98 msgid "The program needs to be restarted to take effect!" msgstr "" #: src/iptux/DataSettings.cpp:143 msgid "Preferences" msgstr "Předvolby" #: src/iptux/DataSettings.cpp:143 src/iptux/RevisePal.cpp:109 #: src/iptux/dialog.cpp:107 src/iptux/dialog.cpp:170 #, fuzzy msgid "_OK" msgstr "OK" #: src/iptux/DataSettings.cpp:144 #, fuzzy msgid "_Apply" msgstr "Použít" #: src/iptux/DataSettings.cpp:144 src/iptux/DataSettings.cpp:1348 #: src/iptux/DataSettings.cpp:1395 src/iptux/DialogBase.cpp:359 #: src/iptux/DialogBase.cpp:918 src/iptux/RevisePal.cpp:110 #: src/iptux/ShareFile.cpp:419 src/iptux/callback.cpp:87 #: src/iptux/dialog.cpp:171 src/iptux/dialog.cpp:230 #, fuzzy msgid "_Cancel" msgstr "Zrušit" #: src/iptux/DataSettings.cpp:169 #, fuzzy msgid "Your _nickname:" msgstr "Vaše přezdívka:" #: src/iptux/DataSettings.cpp:176 msgid "Please input your nickname!" msgstr "Prosím zadejte vaši přezdívku!" #: src/iptux/DataSettings.cpp:182 #, fuzzy msgid "Your _group name:" msgstr "Název vaší skupiny:" #: src/iptux/DataSettings.cpp:189 msgid "Please input your group name!" msgstr "Prosím zadejte název vaší skupiny!" #: src/iptux/DataSettings.cpp:195 #, fuzzy msgid "Your _face picture:" msgstr "Váš profilový obrázek:" #: src/iptux/DataSettings.cpp:213 #, fuzzy msgid "_Save files to: " msgstr "Uložit soubory do: " #: src/iptux/DataSettings.cpp:226 msgid "Photo" msgstr "Fotografie" #: src/iptux/DataSettings.cpp:238 msgid "Signature" msgstr "Podpis" #: src/iptux/DataSettings.cpp:271 msgid "Port:" msgstr "" #: src/iptux/DataSettings.cpp:278 msgid "Any port number between 1024 and 65535, default is 2425" msgstr "" #: src/iptux/DataSettings.cpp:287 #, fuzzy msgid "Candidate network encodings:" msgstr "Předvolby síťového kódování:" #: src/iptux/DataSettings.cpp:294 msgid "Candidate network encodings, separated by \",\"" msgstr "" #: src/iptux/DataSettings.cpp:301 #, fuzzy msgid "Preferred network encoding:" msgstr "Předvolby síťového kódování:" #: src/iptux/DataSettings.cpp:308 msgid "" "Preference network coding (You should be aware of what you are doing if you " "want to modify it.)" msgstr "" #: src/iptux/DataSettings.cpp:316 msgid "Pal's default face picture:" msgstr "Partnerův základní avatar:" #: src/iptux/DataSettings.cpp:334 msgid "Panel font:" msgstr "Font panelu:" #: src/iptux/DataSettings.cpp:346 msgid "Automatically open the chat dialog" msgstr "" #: src/iptux/DataSettings.cpp:354 msgid "Automatically hide the panel after login" msgstr "Automaticky skrýt panel po přihlášení" #: src/iptux/DataSettings.cpp:362 msgid "Automatically open the File Transmission Management" msgstr "Automaticky otevřít Správce přenosu souborů" #: src/iptux/DataSettings.cpp:370 msgid "Use the 'Enter' key to send message" msgstr "Používat klávesu 'Enter' k odeslání zprávy" #: src/iptux/DataSettings.cpp:378 msgid "Automatically clean up the chat history" msgstr "Automaticky smazat historii diskuze" #: src/iptux/DataSettings.cpp:385 msgid "Save the chat history" msgstr "Uložit historii diskuze" #: src/iptux/DataSettings.cpp:393 msgid "Use the Blacklist (NOT recommended)" msgstr "Použít Černou listinu (Nedoporučeno!)" #: src/iptux/DataSettings.cpp:401 msgid "Filter the request of sharing files" msgstr "Filtrovat žádosti o sdílení souborů" #: src/iptux/DataSettings.cpp:408 msgid "Hide the taskbar when the main window is minimized" msgstr "" #: src/iptux/DataSettings.cpp:432 msgid "From:" msgstr "Od:" #: src/iptux/DataSettings.cpp:438 msgid "Beginning of the IP(v4) section" msgstr "Začátek sekce IP(v4)" #: src/iptux/DataSettings.cpp:442 msgid "To:" msgstr "Pro:" #: src/iptux/DataSettings.cpp:448 msgid "End of the IP(v4) section" msgstr "Konec sekce IP(v4)" #: src/iptux/DataSettings.cpp:456 msgid "Add" msgstr "Přidat" #: src/iptux/DataSettings.cpp:461 msgid "Delete" msgstr "Smazat" #: src/iptux/DataSettings.cpp:468 msgid "Added IP(v4) Section:" msgstr "" #: src/iptux/DataSettings.cpp:487 msgid "Import" msgstr "Importovat" #: src/iptux/DataSettings.cpp:491 msgid "Export" msgstr "Exportovat" #: src/iptux/DataSettings.cpp:495 src/iptux/TransWindow.cpp:171 msgid "Clear" msgstr "Vyčistit" #: src/iptux/DataSettings.cpp:706 msgid "From" msgstr "Od" #: src/iptux/DataSettings.cpp:713 msgid "To" msgstr "Pro" #: src/iptux/DataSettings.cpp:720 msgid "Description" msgstr "Popis" #: src/iptux/DataSettings.cpp:736 msgid "Please select download folder" msgstr "Prosím zvolte složku pro stahování" #: src/iptux/DataSettings.cpp:758 msgid "Select Font" msgstr "Vybrat font" #: src/iptux/DataSettings.cpp:872 src/iptux/DataSettings.cpp:874 #: src/iptux/DataSettings.cpp:878 msgid "Port must be a number between 1024 and 65535" msgstr "" #: src/iptux/DataSettings.cpp:1019 src/iptux/DataSettings.cpp:1050 #, c-format msgid "" "Fopen() file \"%s\" failed!\n" "%s" msgstr "" #: src/iptux/DataSettings.cpp:1150 src/iptux/RevisePal.cpp:419 msgid "Please select a face picture" msgstr "Prosím vyberte profilový obrázek" #: src/iptux/DataSettings.cpp:1172 msgid "Please select a personal photo" msgstr "Prosím vyberte osobní fotografii" #: src/iptux/DataSettings.cpp:1241 src/iptux/DataSettings.cpp:1248 #: src/iptux/DetectPal.cpp:75 #, c-format msgid "" "\n" "Illegal IP(v4) address: %s!" msgstr "" "\n" "Neplatná IP(v4) adresa: %s!" #: src/iptux/DataSettings.cpp:1346 msgid "Please select a file to import data" msgstr "Prosím vyberte soubor pro import dat" #: src/iptux/DataSettings.cpp:1347 src/iptux/DialogBase.cpp:358 #: src/iptux/ShareFile.cpp:418 src/iptux/callback.cpp:86 msgid "_Open" msgstr "" #: src/iptux/DataSettings.cpp:1394 msgid "Save data to file" msgstr "Uložit data do souboru" #: src/iptux/DataSettings.cpp:1395 src/iptux/DialogBase.cpp:919 #: src/iptux/dialog.cpp:231 #, fuzzy msgid "_Save" msgstr "Uložit jako" #: src/iptux/DetectPal.cpp:70 #, c-format msgid "The notification has been sent to %s." msgstr "Bylo zasláno upozornění pro %s." #: src/iptux/DialogBase.cpp:214 #, c-format msgid "%s To Send." msgstr "" #: src/iptux/DialogBase.cpp:272 msgid "Close" msgstr "Zavřít" #: src/iptux/DialogBase.cpp:276 src/iptux/DialogGroup.cpp:375 msgid "Send" msgstr "Odeslat" #: src/iptux/DialogBase.cpp:307 #, fuzzy msgid "Chat History" msgstr "Uložit historii diskuze" #: src/iptux/DialogBase.cpp:350 msgid "Choose enclosure files" msgstr "" #: src/iptux/DialogBase.cpp:353 #, fuzzy msgid "Choose enclosure folders" msgstr "Vybrat složky ke sdílení" #: src/iptux/DialogBase.cpp:593 msgid "Remove Selected" msgstr "Smazat vybrané" #: src/iptux/DialogBase.cpp:648 msgid "File to send." msgstr "" #: src/iptux/DialogBase.cpp:653 #, fuzzy msgid "Sending progress." msgstr "Stav přenosu." #: src/iptux/DialogBase.cpp:656 msgid "Dirs" msgstr "" #: src/iptux/DialogBase.cpp:659 #, fuzzy msgid "Files" msgstr "Soubor" #: src/iptux/DialogBase.cpp:662 src/iptux/DialogPeer.cpp:565 msgid "Detail" msgstr "" #: src/iptux/DialogBase.cpp:712 #, fuzzy msgid "PeerName" msgstr "Název" #: src/iptux/DialogBase.cpp:719 src/iptux/DialogPeer.cpp:716 msgid "Name" msgstr "Název" #: src/iptux/DialogBase.cpp:725 src/iptux/DialogPeer.cpp:652 #: src/iptux/DialogPeer.cpp:722 src/iptux/ShareFile.cpp:280 #: src/iptux/TransWindow.cpp:271 msgid "Size" msgstr "Velikost" #: src/iptux/DialogBase.cpp:731 msgid "Path" msgstr "" #: src/iptux/DialogBase.cpp:792 #, fuzzy msgid "Sending Progress." msgstr "Stav přenosu." #: src/iptux/DialogBase.cpp:795 #, c-format msgid "%s of %s Sent." msgstr "" #: src/iptux/DialogBase.cpp:802 src/iptux/DialogPeer.cpp:835 msgid "Mission Completed!" msgstr "" #: src/iptux/DialogBase.cpp:845 src/iptux/DialogBase.cpp:917 msgid "Save Image" msgstr "" #: src/iptux/DialogBase.cpp:850 msgid "Copy Image" msgstr "" #: src/iptux/DialogGroup.cpp:285 msgid "Member" msgstr "Člen" #: src/iptux/DialogGroup.cpp:382 msgid "Pals" msgstr "Partneři" #: src/iptux/DialogGroup.cpp:480 msgid "Select All" msgstr "Vybrat vše" #: src/iptux/DialogGroup.cpp:485 msgid "Reverse Select" msgstr "Obrátit výběr" #: src/iptux/DialogGroup.cpp:490 msgid "Clear Up" msgstr "Vyčistit" #: src/iptux/DialogGroup.cpp:728 #, c-format msgid "Talk with the group %s" msgstr "Hovořit se skupinou %s" #: src/iptux/DialogPeer.cpp:132 #, c-format msgid "Talk with %s(%s) IP:%s" msgstr "Komunikace s %s(%s) IP:%s" #: src/iptux/DialogPeer.cpp:305 msgid "Info." msgstr "Informace." #: src/iptux/DialogPeer.cpp:337 #, c-format msgid "Version: %s\n" msgstr "Verze: %s\n" #: src/iptux/DialogPeer.cpp:339 #, c-format msgid "Nickname: %s@%s\n" msgstr "Přezdívka: %s@%s\n" #: src/iptux/DialogPeer.cpp:342 #, c-format msgid "Nickname: %s\n" msgstr "Přezdívka: %s\n" #: src/iptux/DialogPeer.cpp:344 #, c-format msgid "User: %s\n" msgstr "Uživatel: %s\n" #: src/iptux/DialogPeer.cpp:345 #, c-format msgid "Host: %s\n" msgstr "" #: src/iptux/DialogPeer.cpp:348 #, c-format msgid "Address: %s(%s)\n" msgstr "Adresa: %s(%s)\n" #: src/iptux/DialogPeer.cpp:350 #, c-format msgid "Address: %s\n" msgstr "Adresa: %s\n" #: src/iptux/DialogPeer.cpp:353 msgid "Compatibility: Microsoft\n" msgstr "Kompatibilita: Microsoft\n" #: src/iptux/DialogPeer.cpp:355 msgid "Compatibility: GNU/Linux\n" msgstr "Kompatibilita: GNU/Linux\n" #: src/iptux/DialogPeer.cpp:357 #, c-format msgid "System coding: %s\n" msgstr "Systémové kódování: %s\n" #: src/iptux/DialogPeer.cpp:362 msgid "Signature:\n" msgstr "Podpis:\n" #: src/iptux/DialogPeer.cpp:369 msgid "" "\n" "Photo:\n" msgstr "" "\n" "Fotografie:\n" #: src/iptux/DialogPeer.cpp:460 msgid "Please select a picture to insert the buffer" msgstr "" #: src/iptux/DialogPeer.cpp:486 src/iptux/resources/gtk/menus.ui:83 #: src/iptux/resources/gtk/menus.ui:228 #, fuzzy msgid "Insert Image" msgstr "Vložit obrázek" #: src/iptux/DialogPeer.cpp:502 msgid "Enclosure." msgstr "" #: src/iptux/DialogPeer.cpp:547 #, fuzzy msgid "Files to be received" msgstr "Soubor přenesen." #: src/iptux/DialogPeer.cpp:551 msgid "Receiving progress." msgstr "Stav přenosu." #: src/iptux/DialogPeer.cpp:554 msgid "Accept" msgstr "Přijmout" #: src/iptux/DialogPeer.cpp:560 src/iptux/dialog.cpp:63 #: src/iptux/resources/gtk/menus.ui:342 msgid "Refuse" msgstr "Odmítnout" #: src/iptux/DialogPeer.cpp:596 msgid "File received." msgstr "Soubor přenesen." #: src/iptux/DialogPeer.cpp:639 src/iptux/DialogPeer.cpp:710 msgid "Source" msgstr "Zdroj" #: src/iptux/DialogPeer.cpp:646 msgid "SaveAs" msgstr "Uložit jako" #: src/iptux/DialogPeer.cpp:818 src/iptux/DialogPeer.cpp:884 msgid "Receiving Progress." msgstr "Stav přenosu." #: src/iptux/DialogPeer.cpp:821 src/iptux/DialogPeer.cpp:887 #, c-format msgid "%s to Receive." msgstr "" #: src/iptux/DialogPeer.cpp:825 src/iptux/DialogPeer.cpp:891 #, c-format msgid "%s Of %s Received." msgstr "" #: src/iptux/LogSystem.cpp:71 #, c-format msgid "Recevied-From: Nickname:%s User:%s Host:%s" msgstr "Obdrženo od: Přezdívka:%s Uživatel:%s Počítač:%s" #: src/iptux/LogSystem.cpp:76 #, c-format msgid "Send-To: Nickname:%s User:%s Host:%s" msgstr "" #: src/iptux/LogSystem.cpp:80 msgid "Send-Broadcast" msgstr "" #: src/iptux/LogSystem.cpp:99 #, c-format msgid "User:%s Host:%s" msgstr "Uživatel:%s Počítač:%s" #: src/iptux/MainWindow.cpp:570 msgid "Pals Online: 0" msgstr "Partnerů online: 0" #: src/iptux/MainWindow.cpp:655 msgid "Search Pals" msgstr "Vyhledat partnery" #: src/iptux/MainWindow.cpp:768 msgid "Nickname" msgstr "Ptřezdívka" #: src/iptux/MainWindow.cpp:778 msgid "Group" msgstr "Skupina" #: src/iptux/MainWindow.cpp:784 src/iptux/TransWindow.cpp:258 msgid "IPv4" msgstr "IPv4" #: src/iptux/MainWindow.cpp:790 msgid "User" msgstr "Uživatel" #: src/iptux/MainWindow.cpp:796 src/iptux/resources/gtk/MainWindow.ui:81 msgid "Host" msgstr "Počítač" #: src/iptux/MainWindow.cpp:935 #, fuzzy, c-format msgid "Pals Online: %d" msgstr "Partnerů online: 0" #: src/iptux/RevisePal.cpp:109 msgid "Change Pal's Information" msgstr "Změnit informace o partnerovi" #: src/iptux/RevisePal.cpp:134 msgid "Pal's nickname:" msgstr "Partnerova přezdívka:" #: src/iptux/RevisePal.cpp:140 msgid "Please input pal's new nickname!" msgstr "Prosím zadejte novou partnerovu přezdívku!" #: src/iptux/RevisePal.cpp:146 msgid "Pal's group name:" msgstr "Název partnerovy skupiny:" #: src/iptux/RevisePal.cpp:152 msgid "Please input pal's new group name!" msgstr "" #: src/iptux/RevisePal.cpp:158 msgid "System coding:" msgstr "Systémové kódování:" #: src/iptux/RevisePal.cpp:164 msgid "Be SURE to know what you are doing!" msgstr "Ujistěte se, že víte co děláte!" #: src/iptux/RevisePal.cpp:170 msgid "Pal's face picture:" msgstr "" #: src/iptux/RevisePal.cpp:184 msgid "Be compatible with iptux's protocol (DANGEROUS)" msgstr "" #: src/iptux/ShareFile.cpp:104 msgid "Shared Files Management" msgstr "" #: src/iptux/ShareFile.cpp:105 msgid "OK" msgstr "OK" #: src/iptux/ShareFile.cpp:106 msgid "Apply" msgstr "Použít" #: src/iptux/ShareFile.cpp:107 msgid "Cancel" msgstr "Zrušit" #: src/iptux/ShareFile.cpp:160 msgid "Add Files" msgstr "Přidat soubory" #: src/iptux/ShareFile.cpp:163 msgid "Add Folders" msgstr "Přidat složky" #: src/iptux/ShareFile.cpp:166 msgid "Delete Resources" msgstr "Smazat zdroje" #: src/iptux/ShareFile.cpp:169 msgid "Clear Password" msgstr "Smazat heslo" #: src/iptux/ShareFile.cpp:172 msgid "Set Password" msgstr "Nastavit heslo" #: src/iptux/ShareFile.cpp:229 src/iptux/ShareFile.cpp:373 msgid "regular" msgstr "" #: src/iptux/ShareFile.cpp:233 src/iptux/ShareFile.cpp:377 msgid "directory" msgstr "složka" #: src/iptux/ShareFile.cpp:237 src/iptux/ShareFile.cpp:381 msgid "unknown" msgstr "neznámé" #: src/iptux/ShareFile.cpp:270 msgid "File" msgstr "Soubor" #: src/iptux/ShareFile.cpp:286 msgid "Type" msgstr "Druh" #: src/iptux/ShareFile.cpp:411 msgid "Choose the files to share" msgstr "Vyberte soubory ke sdílení" #: src/iptux/ShareFile.cpp:414 msgid "Choose the folders to share" msgstr "Vybrat složky ke sdílení" #: src/iptux/TransWindow.cpp:86 msgid "Files Transmission Management" msgstr "Manažer přenosu souborů" #: src/iptux/TransWindow.cpp:241 msgid "State" msgstr "Status" #: src/iptux/TransWindow.cpp:247 msgid "Task" msgstr "Úkol" #: src/iptux/TransWindow.cpp:253 msgid "Peer" msgstr "" #: src/iptux/TransWindow.cpp:265 msgid "Filename" msgstr "Název souboru" #: src/iptux/TransWindow.cpp:277 msgid "Completed" msgstr "Dokončeno" #: src/iptux/TransWindow.cpp:284 msgid "Progress" msgstr "Postup" #: src/iptux/TransWindow.cpp:291 msgid "Cost" msgstr "Náklady" #: src/iptux/TransWindow.cpp:297 msgid "Remaining" msgstr "Zbývá" #: src/iptux/TransWindow.cpp:303 msgid "Rate" msgstr "Rychlost" #: src/iptux/TransWindow.cpp:331 msgid "The path you want to open not exist!" msgstr "Složka, kterou chcete otevřít neexistuje!" #: src/iptux/TransWindow.cpp:405 msgid "The file you want to open not exist!" msgstr "Soubor, který chcete otevřít neexistuje!" #: src/iptux/TransWindow.cpp:406 #, fuzzy msgid "iptux Error" msgstr "iptux" #: src/iptux/UiCoreThread.cpp:254 src/iptux/UiCoreThread.cpp:278 #: src/iptux/UiCoreThread.cpp:377 src/iptux/UiCoreThread.cpp:399 msgid "Others" msgstr "Ostatní" #: src/iptux/UiCoreThread.cpp:419 msgid "Broadcast" msgstr "Vysílání" #: src/iptux/UiHelper.cpp:28 #, c-format msgid "Can't convert path to uri: %s, reason: %s" msgstr "" #: src/iptux/UiHelper.cpp:39 #, c-format msgid "Can't open path: %s, reason: %s" msgstr "" #: src/iptux/UiHelper.cpp:68 #, c-format msgid "Can't open URL: %s, reason: %s" msgstr "" #: src/iptux/UiHelper.cpp:188 #, fuzzy msgid "Information" msgstr "Informace" #: src/iptux/UiHelper.cpp:218 msgid "Warning" msgstr "Varování" #: src/iptux/UiModels.cpp:604 #, fuzzy, c-format msgid "Version: %s" msgstr "Verze: %s\n" #: src/iptux/UiModels.cpp:608 #, fuzzy, c-format msgid "Nickname: %s@%s" msgstr "Přezdívka: %s@%s\n" #: src/iptux/UiModels.cpp:611 #, fuzzy, c-format msgid "Nickname: %s" msgstr "Přezdívka: %s\n" #: src/iptux/UiModels.cpp:615 #, fuzzy, c-format msgid "User: %s" msgstr "Uživatel: %s\n" #: src/iptux/UiModels.cpp:618 #, fuzzy, c-format msgid "Host: %s" msgstr "Počítač" #: src/iptux/UiModels.cpp:623 #, fuzzy, c-format msgid "Address: %s(%s)" msgstr "Adresa: %s(%s)\n" #: src/iptux/UiModels.cpp:625 #, fuzzy, c-format msgid "Address: %s" msgstr "Adresa: %s\n" #: src/iptux/UiModels.cpp:630 #, fuzzy msgid "Compatibility: Microsoft" msgstr "Kompatibilita: Microsoft\n" #: src/iptux/UiModels.cpp:632 #, fuzzy msgid "Compatibility: GNU/Linux" msgstr "Kompatibilita: GNU/Linux\n" #: src/iptux/UiModels.cpp:636 #, fuzzy, c-format msgid "System coding: %s" msgstr "Systémové kódování: %s\n" #: src/iptux/UiModels.cpp:641 #, fuzzy msgid "Signature:" msgstr "Podpis:\n" #: src/iptux/UiModels.cpp:744 msgid "" msgstr "" #: src/iptux/UiModels.cpp:799 msgid "[IMG]" msgstr "" #: src/iptux/dialog.cpp:39 msgid "" "File transfer has not been completed.\n" "Are you sure to cancel and quit?" msgstr "" "Přenos souboru nebyl dokončen.\n" "Opravdu chcete odejít?" #: src/iptux/dialog.cpp:42 msgid "Confirm Exit" msgstr "Potvrďte ukončení" #: src/iptux/dialog.cpp:62 src/iptux/resources/gtk/MainWindow.ui:12 #: src/iptux/resources/gtk/menus.ui:98 src/iptux/resources/gtk/menus.ui:243 msgid "Request Shared Resources" msgstr "Zažádat sdílení zdrojů" #: src/iptux/dialog.cpp:62 msgid "Agree" msgstr "Souhlasím" #: src/iptux/dialog.cpp:78 #, c-format msgid "" "Your pal (%s)[%s]\n" "is requesting to get your shared resources,\n" "Do you agree?" msgstr "" #: src/iptux/dialog.cpp:106 msgid "Access Password" msgstr "Přístupové heslo" #: src/iptux/dialog.cpp:113 msgid "Please input the password for the shared files behind" msgstr "Prosím zadejte heslo pro sdílené soubory" #: src/iptux/dialog.cpp:127 #, c-format msgid "(%s)[%s]Password:" msgstr "(%s)[%s]Heslo:" #: src/iptux/dialog.cpp:146 src/iptux/dialog.cpp:207 msgid "" "\n" "Empty Password!" msgstr "" "\n" "Prázdné heslo!" #: src/iptux/dialog.cpp:170 msgid "Enter a New Password" msgstr "Zadat nové heslo" #: src/iptux/dialog.cpp:178 msgid "Password: " msgstr "Heslo: " #: src/iptux/dialog.cpp:187 msgid "Repeat: " msgstr "Zopakovat: " #: src/iptux/dialog.cpp:202 msgid "" "\n" "Password Mismatched!" msgstr "" "\n" "Neshoda hesel!" #: src/iptux/dialog.cpp:229 msgid "Please select a folder to save files." msgstr "Vyberte prosím složku do které chcete uložit soubory." #: src/iptux/resources/gtk/AboutDialog.ui:11 msgid "" "Copyright © 2008–2009, Jally\n" "Copyright © 2013–2015,2017–2021, LI Daobing" msgstr "" #: src/iptux/resources/gtk/AboutDialog.ui:13 #, fuzzy msgid "A GTK based LAN messenger." msgstr "LAN komunikátor založený na GTK+" #: src/iptux/resources/gtk/AppIndicator.ui:6 #, fuzzy msgid "Open Iptux" msgstr "iptux" #: src/iptux/resources/gtk/AppIndicator.ui:12 #: src/iptux/resources/gtk/menus.ui:6 src/iptux/resources/gtk/menus.ui:306 msgid "_Preferences" msgstr "_Předvolby" #: src/iptux/resources/gtk/AppIndicator.ui:16 #: src/iptux/resources/gtk/menus.ui:10 src/iptux/resources/gtk/menus.ui:310 msgid "_Quit" msgstr "_Odejít" #: src/iptux/resources/gtk/DetectPal.ui:7 #, fuzzy msgid "Detect pal" msgstr "Detekovat partnery" #: src/iptux/resources/gtk/DetectPal.ui:15 msgid "Detect" msgstr "Rozpoznat" #: src/iptux/resources/gtk/DetectPal.ui:61 msgid "Please input an IP address (IPv4 only):" msgstr "Prosím zadejte IP adresu (pouze IPv4):" #: src/iptux/resources/gtk/MainWindow.ui:8 src/iptux/resources/gtk/menus.ui:109 #: src/iptux/resources/gtk/menus.ui:254 msgid "Send Message" msgstr "Odeslat zprávu" #: src/iptux/resources/gtk/MainWindow.ui:16 #, fuzzy msgid "Change Info" msgstr "Změnit informace" #: src/iptux/resources/gtk/MainWindow.ui:20 msgid "Delete Pal" msgstr "Smazat partnera" #: src/iptux/resources/gtk/MainWindow.ui:26 src/iptux/resources/gtk/menus.ui:31 #: src/iptux/resources/gtk/menus.ui:176 msgid "Sort" msgstr "Třídit" #: src/iptux/resources/gtk/MainWindow.ui:29 src/iptux/resources/gtk/menus.ui:34 #: src/iptux/resources/gtk/menus.ui:179 msgid "By Nickname" msgstr "Podle přezdívky" #: src/iptux/resources/gtk/MainWindow.ui:34 src/iptux/resources/gtk/menus.ui:39 #: src/iptux/resources/gtk/menus.ui:184 #, fuzzy msgid "By Username" msgstr "Podle přezdívky" #: src/iptux/resources/gtk/MainWindow.ui:39 src/iptux/resources/gtk/menus.ui:44 #: src/iptux/resources/gtk/menus.ui:189 msgid "By IP" msgstr "Podle IP" #: src/iptux/resources/gtk/MainWindow.ui:44 src/iptux/resources/gtk/menus.ui:49 #: src/iptux/resources/gtk/menus.ui:194 #, fuzzy msgid "By Host" msgstr "Počítač" #: src/iptux/resources/gtk/MainWindow.ui:49 src/iptux/resources/gtk/menus.ui:54 #: src/iptux/resources/gtk/menus.ui:199 msgid "By Last Activity" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:56 src/iptux/resources/gtk/menus.ui:61 #: src/iptux/resources/gtk/menus.ui:206 msgid "Ascending" msgstr "Vzestupně" #: src/iptux/resources/gtk/MainWindow.ui:61 src/iptux/resources/gtk/menus.ui:66 #: src/iptux/resources/gtk/menus.ui:211 msgid "Descending" msgstr "Sestupně" #: src/iptux/resources/gtk/MainWindow.ui:68 msgid "Info Style" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:71 #, fuzzy msgid "IP" msgstr "IPv4" #: src/iptux/resources/gtk/MainWindow.ui:76 msgid "IP:PORT" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:86 #, fuzzy msgid "Username" msgstr "Uživatel" #: src/iptux/resources/gtk/MainWindow.ui:91 #, fuzzy msgid "Version" msgstr "Verze: %s\n" #: src/iptux/resources/gtk/MainWindow.ui:96 msgid "Last Activity" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:101 #, fuzzy msgid "Last Message" msgstr "Odeslat zprávu" #: src/iptux/resources/gtk/menus.ui:17 src/iptux/resources/gtk/menus.ui:162 msgid "_File" msgstr "_Soubor" #: src/iptux/resources/gtk/menus.ui:19 src/iptux/resources/gtk/menus.ui:164 msgid "_Detect" msgstr "_Zjistit" #: src/iptux/resources/gtk/menus.ui:23 src/iptux/resources/gtk/menus.ui:168 msgid "_Find" msgstr "_Najít" #: src/iptux/resources/gtk/menus.ui:28 src/iptux/resources/gtk/menus.ui:173 msgid "_View" msgstr "" #: src/iptux/resources/gtk/menus.ui:73 src/iptux/resources/gtk/menus.ui:218 msgid "_Refresh" msgstr "" #: src/iptux/resources/gtk/menus.ui:80 src/iptux/resources/gtk/menus.ui:225 msgid "_Chat" msgstr "" #: src/iptux/resources/gtk/menus.ui:88 src/iptux/resources/gtk/menus.ui:233 msgid "Attach File" msgstr "Přiložit soubor" #: src/iptux/resources/gtk/menus.ui:92 src/iptux/resources/gtk/menus.ui:237 msgid "Attach Folder" msgstr "Přiložit složku" #: src/iptux/resources/gtk/menus.ui:102 src/iptux/resources/gtk/menus.ui:247 #, fuzzy msgid "Clear Chat History" msgstr "Uložit historii diskuze" #: src/iptux/resources/gtk/menus.ui:115 src/iptux/resources/gtk/menus.ui:260 msgid "_Window" msgstr "" #: src/iptux/resources/gtk/menus.ui:118 src/iptux/resources/gtk/menus.ui:263 msgid "_Transmission" msgstr "_Přenosy" #: src/iptux/resources/gtk/menus.ui:122 src/iptux/resources/gtk/menus.ui:267 msgid "_Shared Management" msgstr "Správa _sdílení" #: src/iptux/resources/gtk/menus.ui:126 src/iptux/resources/gtk/menus.ui:271 msgid "_Chat Log" msgstr "" #: src/iptux/resources/gtk/menus.ui:130 src/iptux/resources/gtk/menus.ui:275 #, fuzzy msgid "_System Log" msgstr "Systémové kódování:" #: src/iptux/resources/gtk/menus.ui:136 src/iptux/resources/gtk/menus.ui:281 msgid "Close Window" msgstr "" #: src/iptux/resources/gtk/menus.ui:142 src/iptux/resources/gtk/menus.ui:287 msgid "_Help" msgstr "_Pomoc" #: src/iptux/resources/gtk/menus.ui:145 src/iptux/resources/gtk/menus.ui:290 msgid "_About" msgstr "" #: src/iptux/resources/gtk/menus.ui:149 src/iptux/resources/gtk/menus.ui:294 msgid "Report Bug" msgstr "" #: src/iptux/resources/gtk/menus.ui:153 src/iptux/resources/gtk/menus.ui:298 msgid "What's New" msgstr "" #: src/iptux/resources/gtk/menus.ui:318 msgid "Open This File" msgstr "Otevřít tento soubor" #: src/iptux/resources/gtk/menus.ui:322 msgid "Open Containing Folder" msgstr "Otevřít složku" #: src/iptux/resources/gtk/menus.ui:326 msgid "Terminate Task" msgstr "Ukončit úkol" #: src/iptux/resources/gtk/menus.ui:330 msgid "Terminate All" msgstr "Ukončit vše" #: src/iptux/resources/gtk/menus.ui:334 msgid "Clear Tasklist" msgstr "Vyčistit seznam úkolů" #: src/iptux/resources/gtk/menus.ui:346 #, fuzzy msgid "Refuse All" msgstr "Odmítnout" #: src/main/iptux.cpp:149 #, fuzzy msgid "- A software for sharing in LAN" msgstr "iptux: Software pro sdílení v síti LAN\n" #: src/main/iptux.cpp:152 #, c-format msgid "option parsing failed: %s\n" msgstr "" #, fuzzy #~ msgid "Close Chat" #~ msgstr "Zavřít" #~ msgid "Sound" #~ msgstr "Zvuk" #~ msgid "Activate the sound support" #~ msgstr "Aktivovat podporu zvuku" #~ msgid "Volume Control: " #~ msgstr "Ovládání hlasitosi: " #~ msgid "Sound Event" #~ msgstr "Zvuková událost" #~ msgid "Test" #~ msgstr "Test" #~ msgid "Stop" #~ msgstr "Zastavit" #~ msgid "Transfer finished" #~ msgstr "Přenos dokončen" #~ msgid "Message received" #~ msgstr "Obdržená zpráva" #~ msgid "Play" #~ msgstr "Přehrát" #~ msgid "Event" #~ msgstr "Událost" #~ msgid "Please select a sound file" #~ msgstr "Prosím vyberte zvukový soubor" #~ msgid "_Hide" #~ msgstr "_Skrýt" #~ msgid "_Show" #~ msgstr "_Zobrazit" #~ msgid "_Tools" #~ msgstr "_Nástroje" #~ msgid "Error" #~ msgstr "Chyba" #, fuzzy #~ msgid "iptux-icon" #~ msgstr "iptux" #~ msgid "Please input an IP address (IPv4 only)!" #~ msgstr "Prosím zadejte IP adresu (pouze IPv4)!" #~ msgid "Jally " #~ msgstr "Jally " #~ msgid "ManPT " #~ msgstr "ManPT " #~ msgid "LiWeijian " #~ msgstr "LiWeijian " #~ msgid "" #~ "alick \n" #~ "ManPT " #~ msgstr "" #~ "alick \n" #~ "ManPT " #~ msgid "Help" #~ msgstr "Pomoc" #~ msgid "Contributers" #~ msgstr "Přispěvatelé" #~ msgid "..." #~ msgstr "..." #~ msgid "More About Iptux" #~ msgstr "Více o Iptux" #~ msgid "_Sort" #~ msgstr "_Třídit" #~ msgid "_Update" #~ msgstr "_Aktualizovat" #~ msgid "_More" #~ msgstr "_Více" #~ msgid "_FAQ" #~ msgstr "_FAQ" #~ msgid "utf-16" #~ msgstr "utf-16" #~ msgid "utf-8" #~ msgstr "utf-8" #~ msgid "What do you want to do?\n" #~ msgstr "Co chcete dělat?\n" #~ msgid "The user is not privileged!\n" #~ msgstr "Uživatel nemá oprávnění!\n" iptux-0.9.4/po/de.po000066400000000000000000001104121475473122500142540ustar00rootroot00000000000000# German translation for iptux # Copyright (c) 2009 Rosetta Contributors and Canonical Ltd 2009 # This file is distributed under the same license as the iptux package. # FIRST AUTHOR , 2009. # msgid "" msgstr "" "Project-Id-Version: iptux\n" "Report-Msgid-Bugs-To: https://github.com/iptux-src/iptux/issues/new\n" "POT-Creation-Date: 2025-02-17 13:35-0800\n" "PO-Revision-Date: 2021-05-17 00:40+0000\n" "Last-Translator: J. Lavoie \n" "Language-Team: German \n" "Language: de\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" "X-Generator: Weblate 4.7-dev\n" "X-Launchpad-Export-Date: 2018-01-24 12:00+0000\n" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:6 msgid "iptux" msgstr "iptux" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:7 msgid "LAN communication software" msgstr "LAN-Kommunikationssoftware" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:17 msgid "iptux is an “IP Messenger” client. The features of iptux include:" msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:21 msgid "auto-detect other clients on the intranet." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:22 msgid "send/recv messages to other clients." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:23 msgid "send/recv files to other clients." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:24 msgid "share your files to other cliens (with optional password protection)." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:26 msgid "" "It is (supposedly) compatible with 飞鸽传书 (Feige) and 飞秋 (FeiQ) from " "China, and with the original “IP Messenger” clients from Japan, including " "g2ipmsg and xipmsg in Debian." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:38 msgid "The Iptux main window." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:42 msgid "The Iptux chat window." msgstr "" #: src/iptux-core/CoreThread.cpp:172 #, c-format msgid "" "Fatal Error!! Failed to create new socket!\n" "%s" msgstr "" "Schwerwiegender Fehler!!\n" "Erstellen eines neuen Sockets fehlgeschlagen!\n" "%s" #: src/iptux-core/CoreThread.cpp:188 #, c-format msgid "" "Fatal Error!! Failed to bind the TCP port(%s:%d)!\n" "%s" msgstr "" "Schwerwiegender Fehler!!\n" "Fehler beim Binden des TCP-Ports (%s:%d)!\n" "%s" #: src/iptux-core/CoreThread.cpp:201 #, c-format msgid "" "Fatal Error!! Failed to bind the UDP port(%s:%d)!\n" "%s" msgstr "" "Schwerwiegender Fehler!!\n" "Fehler beim Binden des UDP-Ports (%s:%d)!\n" "%s" #: src/iptux-core/CoreThread.cpp:461 src/iptux-core/CoreThread.cpp:495 #: src/iptux-core/internal/RecvFileData.cpp:142 #: src/iptux-core/internal/RecvFileData.cpp:204 #, c-format msgid "" "Fatal Error!!\n" "Failed to create new socket!\n" "%s" msgstr "" "Schwerwiegender Fehler!!\n" "Erstellen eines neuen Sockets fehlgeschlagen!\n" "%s" #: src/iptux-core/Models.cpp:172 #, fuzzy msgid "Empty Message" msgstr "Nachricht senden" #: src/iptux-core/Models.cpp:250 msgid "Received an image" msgstr "" #: src/iptux-core/internal/AnalogFS.cpp:93 #: src/iptux-core/internal/AnalogFS.cpp:98 #, c-format msgid "Open() file \"%s\" failed, %s" msgstr "Open() der Datei \"%s\" fehlgeschlagen, %s" #: src/iptux-core/internal/AnalogFS.cpp:117 #, c-format msgid "Stat64() file \"%s\" failed, %s" msgstr "Stat64() der Datei \"%s\" fehlgeschlagen, %s" #: src/iptux-core/internal/AnalogFS.cpp:138 #, c-format msgid "Mkdir() directory \"%s\" failed, %s" msgstr "Mkdir() des Verzeichnisses \"%s\" fehlgeschlagen, %s" #: src/iptux-core/internal/AnalogFS.cpp:164 #, c-format msgid "Opendir() directory \"%s\" failed, %s" msgstr "Opendir() des Verzeichnisses \"%s\" fehlgeschlagen, %s" #: src/iptux-core/internal/Command.cpp:226 msgid "Your pal didn't receive the packet. He or she is offline maybe." msgstr "" "Ihr Freund hat das Paket nicht erhalten. Er oder sie ist vielleicht offline." #: src/iptux-core/internal/CommandMode.cpp:39 #, c-format msgid "unknown command mode: %d" msgstr "" #: src/iptux-core/internal/RecvFileData.cpp:117 msgid "receive" msgstr "empfangen" #: src/iptux-core/internal/RecvFileData.cpp:124 #: src/iptux-core/internal/RecvFileData.cpp:253 #: src/iptux-core/internal/SendFileData.cpp:108 #: src/iptux-core/internal/SendFileData.cpp:193 msgid "Unknown" msgstr "Unbekannt" #: src/iptux-core/internal/RecvFileData.cpp:175 #, fuzzy, c-format msgid "" "Failed to receive the file \"%s\" from %s! expect length %jd, received %jd" msgstr "Empfangen der Datei »%s« von %s gescheitert!" #: src/iptux-core/internal/RecvFileData.cpp:180 #, c-format msgid "Receive the file \"%s\" from %s successfully!" msgstr "Datei »%s« erfolgreich von %s empfangen!" #: src/iptux-core/internal/RecvFileData.cpp:320 #, c-format msgid "Failed to receive the directory \"%s\" from %s!" msgstr "Empfangen des Ordners »%s« von %s gescheitert!" #: src/iptux-core/internal/RecvFileData.cpp:323 #, c-format msgid "Receive the directory \"%s\" from %s successfully!" msgstr "Ordner »%s« erfolgreich von %s empfangen!" #: src/iptux-core/internal/SendFileData.cpp:101 msgid "send" msgstr "Senden" #: src/iptux-core/internal/SendFileData.cpp:137 #, c-format msgid "Failed to send the file \"%s\" to %s!" msgstr "Senden der Datei »%s« an %s gescheitert!" #: src/iptux-core/internal/SendFileData.cpp:142 #, c-format msgid "Send the file \"%s\" to %s successfully!" msgstr "Datei »%s« erfolgreich an %s gesendet!" #: src/iptux-core/internal/SendFileData.cpp:265 #, c-format msgid "Failed to send the directory \"%s\" to %s!" msgstr "Senden des Ordners »%s« an %s gescheitert!" #: src/iptux-core/internal/SendFileData.cpp:270 #, c-format msgid "Send the directory \"%s\" to %s successfully!" msgstr "Ordner »%s« erfolgreich an %s gesendet!" #: src/iptux-core/internal/UdpData.cpp:92 #: src/iptux-core/internal/UdpData.cpp:93 #: src/iptux-core/internal/UdpData.cpp:443 #: src/iptux-core/internal/UdpData.cpp:484 msgid "mysterious" msgstr "mysteriös" #: src/iptux-utils/utils.cpp:880 #, c-format msgid "stat file \"%s\" failed: %s" msgstr "" #: src/iptux-utils/utils.cpp:888 #, c-format msgid "path %s is not file or directory: st_mode(%x)" msgstr "" #: src/iptux-utils/utils.cpp:895 #, c-format msgid "opendir on \"%s\" failed: %s" msgstr "opendir von \"%s\" fehlgeschlagen: %s" #: src/iptux/AboutDialog.cpp:39 msgid "TRANSLATOR NAME" msgstr "" #: src/iptux/AboutDialog.cpp:53 msgid "Thanks to" msgstr "Dank an" #: src/iptux/AppIndicator.cpp:40 src/iptux/MainWindow.cpp:505 #: src/iptux/MainWindow.cpp:507 #, fuzzy msgid "Iptux" msgstr "iptux" #: src/iptux/Application.cpp:54 msgid "Loading the process successfully!" msgstr "Laden des Prozesses erfolgreich!" #: src/iptux/Application.cpp:274 #, c-format msgid "New Message from %s" msgstr "" #: src/iptux/Application.cpp:287 #, c-format msgid "New File from %s" msgstr "" #: src/iptux/Application.cpp:296 msgid "Receiving File Finished" msgstr "" #: src/iptux/Application.cpp:300 msgid "file info no longer exist" msgstr "" #: src/iptux/Darwin.cpp:16 #, c-format msgid "Couldn’t load icon: %s" msgstr "" #: src/iptux/DataSettings.cpp:46 msgid "Personal" msgstr "Persönliches" #: src/iptux/DataSettings.cpp:48 msgid "System" msgstr "System" #: src/iptux/DataSettings.cpp:50 msgid "Network" msgstr "Netzwerk" #: src/iptux/DataSettings.cpp:89 src/iptux/DataSettings.cpp:98 msgid "The program needs to be restarted to take effect!" msgstr "" #: src/iptux/DataSettings.cpp:143 msgid "Preferences" msgstr "Einstellungen" #: src/iptux/DataSettings.cpp:143 src/iptux/RevisePal.cpp:109 #: src/iptux/dialog.cpp:107 src/iptux/dialog.cpp:170 msgid "_OK" msgstr "_OK" #: src/iptux/DataSettings.cpp:144 msgid "_Apply" msgstr "_Übernehmen" #: src/iptux/DataSettings.cpp:144 src/iptux/DataSettings.cpp:1348 #: src/iptux/DataSettings.cpp:1395 src/iptux/DialogBase.cpp:359 #: src/iptux/DialogBase.cpp:918 src/iptux/RevisePal.cpp:110 #: src/iptux/ShareFile.cpp:419 src/iptux/callback.cpp:87 #: src/iptux/dialog.cpp:171 src/iptux/dialog.cpp:230 msgid "_Cancel" msgstr "_Abbrechen" #: src/iptux/DataSettings.cpp:169 #, fuzzy msgid "Your _nickname:" msgstr "Ihr Spitzname:" #: src/iptux/DataSettings.cpp:176 msgid "Please input your nickname!" msgstr "Bitte geben Sie Ihren Spitznamen ein!" #: src/iptux/DataSettings.cpp:182 #, fuzzy msgid "Your _group name:" msgstr "Ihr Gruppenname:" #: src/iptux/DataSettings.cpp:189 msgid "Please input your group name!" msgstr "Bitte geben Sie Ihren Gruppenname ein!" #: src/iptux/DataSettings.cpp:195 #, fuzzy msgid "Your _face picture:" msgstr "Ihr Profilbild:" #: src/iptux/DataSettings.cpp:213 #, fuzzy msgid "_Save files to: " msgstr "Dateien speichern unter: " #: src/iptux/DataSettings.cpp:226 msgid "Photo" msgstr "Foto" #: src/iptux/DataSettings.cpp:238 msgid "Signature" msgstr "Signatur" #: src/iptux/DataSettings.cpp:271 msgid "Port:" msgstr "" #: src/iptux/DataSettings.cpp:278 msgid "Any port number between 1024 and 65535, default is 2425" msgstr "" #: src/iptux/DataSettings.cpp:287 msgid "Candidate network encodings:" msgstr "" #: src/iptux/DataSettings.cpp:294 msgid "Candidate network encodings, separated by \",\"" msgstr "" #: src/iptux/DataSettings.cpp:301 msgid "Preferred network encoding:" msgstr "" #: src/iptux/DataSettings.cpp:308 msgid "" "Preference network coding (You should be aware of what you are doing if you " "want to modify it.)" msgstr "" #: src/iptux/DataSettings.cpp:316 msgid "Pal's default face picture:" msgstr "Standardprofilbild für Freunde:" #: src/iptux/DataSettings.cpp:334 msgid "Panel font:" msgstr "Panel-Schriftart:" #: src/iptux/DataSettings.cpp:346 msgid "Automatically open the chat dialog" msgstr "Chat-Dialog automatisch öffnen" #: src/iptux/DataSettings.cpp:354 msgid "Automatically hide the panel after login" msgstr "Das Panel automatisch nach dem Login verstecken" #: src/iptux/DataSettings.cpp:362 msgid "Automatically open the File Transmission Management" msgstr "Automatisch die Dateiübertragungsverwaltung öffnen" #: src/iptux/DataSettings.cpp:370 msgid "Use the 'Enter' key to send message" msgstr "Benutzen Sie die 'Enter'-Taste um die Nachricht zu senden" #: src/iptux/DataSettings.cpp:378 msgid "Automatically clean up the chat history" msgstr "Den Chatverlauf automatisch löschen" #: src/iptux/DataSettings.cpp:385 msgid "Save the chat history" msgstr "Den Chatverlauf speichern" #: src/iptux/DataSettings.cpp:393 msgid "Use the Blacklist (NOT recommended)" msgstr "Die Blacklist verwenden (NICHT empfohlen)" #: src/iptux/DataSettings.cpp:401 msgid "Filter the request of sharing files" msgstr "Anfrage zum Dateiaustausch filtern" #: src/iptux/DataSettings.cpp:408 msgid "Hide the taskbar when the main window is minimized" msgstr "" #: src/iptux/DataSettings.cpp:432 msgid "From:" msgstr "Von:" #: src/iptux/DataSettings.cpp:438 msgid "Beginning of the IP(v4) section" msgstr "Anfang des IP(v4)-Abschnitts" #: src/iptux/DataSettings.cpp:442 msgid "To:" msgstr "An:" #: src/iptux/DataSettings.cpp:448 msgid "End of the IP(v4) section" msgstr "Ende des IP(v4)-Abschnitts" #: src/iptux/DataSettings.cpp:456 msgid "Add" msgstr "Hinzufügen" #: src/iptux/DataSettings.cpp:461 msgid "Delete" msgstr "Löschen" #: src/iptux/DataSettings.cpp:468 msgid "Added IP(v4) Section:" msgstr "Hinzugefügter IP(v4)-Abschnitt:" #: src/iptux/DataSettings.cpp:487 msgid "Import" msgstr "Importieren" #: src/iptux/DataSettings.cpp:491 msgid "Export" msgstr "Exportieren" #: src/iptux/DataSettings.cpp:495 src/iptux/TransWindow.cpp:171 msgid "Clear" msgstr "Leeren" #: src/iptux/DataSettings.cpp:706 msgid "From" msgstr "Von" #: src/iptux/DataSettings.cpp:713 msgid "To" msgstr "An" #: src/iptux/DataSettings.cpp:720 msgid "Description" msgstr "Beschreibung" #: src/iptux/DataSettings.cpp:736 msgid "Please select download folder" msgstr "Bitte wählen Sie den Download-Ordner" #: src/iptux/DataSettings.cpp:758 msgid "Select Font" msgstr "Schriftart auswählen" #: src/iptux/DataSettings.cpp:872 src/iptux/DataSettings.cpp:874 #: src/iptux/DataSettings.cpp:878 msgid "Port must be a number between 1024 and 65535" msgstr "" #: src/iptux/DataSettings.cpp:1019 src/iptux/DataSettings.cpp:1050 #, c-format msgid "" "Fopen() file \"%s\" failed!\n" "%s" msgstr "" "Fopen() der Datei \"%s\" schlug fehl!\n" "%s" #: src/iptux/DataSettings.cpp:1150 src/iptux/RevisePal.cpp:419 msgid "Please select a face picture" msgstr "Bitte wählen Sie ein Profilbild" #: src/iptux/DataSettings.cpp:1172 msgid "Please select a personal photo" msgstr "Bitte wählen Sie ein persönliches Foto" #: src/iptux/DataSettings.cpp:1241 src/iptux/DataSettings.cpp:1248 #: src/iptux/DetectPal.cpp:75 #, c-format msgid "" "\n" "Illegal IP(v4) address: %s!" msgstr "" "\n" "Ungültige IP(v4)-Adresse: %s!" #: src/iptux/DataSettings.cpp:1346 msgid "Please select a file to import data" msgstr "Bitte wählen sie die Datei, aus der importiert werden soll" #: src/iptux/DataSettings.cpp:1347 src/iptux/DialogBase.cpp:358 #: src/iptux/ShareFile.cpp:418 src/iptux/callback.cpp:86 msgid "_Open" msgstr "_Öffnen" #: src/iptux/DataSettings.cpp:1394 msgid "Save data to file" msgstr "Daten in Datei speichern" #: src/iptux/DataSettings.cpp:1395 src/iptux/DialogBase.cpp:919 #: src/iptux/dialog.cpp:231 msgid "_Save" msgstr "_Speichern unter" #: src/iptux/DetectPal.cpp:70 #, c-format msgid "The notification has been sent to %s." msgstr "Die Benachrichtigung wurde an %s gesendet." #: src/iptux/DialogBase.cpp:214 #, c-format msgid "%s To Send." msgstr "%s Zu Senden." #: src/iptux/DialogBase.cpp:272 msgid "Close" msgstr "Schließen" #: src/iptux/DialogBase.cpp:276 src/iptux/DialogGroup.cpp:375 msgid "Send" msgstr "Senden" #: src/iptux/DialogBase.cpp:307 msgid "Chat History" msgstr "Chatverlauf" #: src/iptux/DialogBase.cpp:350 msgid "Choose enclosure files" msgstr "" #: src/iptux/DialogBase.cpp:353 #, fuzzy msgid "Choose enclosure folders" msgstr "Ordner zum Freigeben wählen" #: src/iptux/DialogBase.cpp:593 msgid "Remove Selected" msgstr "Ausgewählte entfernen" #: src/iptux/DialogBase.cpp:648 msgid "File to send." msgstr "Datei zu Senden." #: src/iptux/DialogBase.cpp:653 msgid "Sending progress." msgstr "Empfangsfortschritt." #: src/iptux/DialogBase.cpp:656 msgid "Dirs" msgstr "" #: src/iptux/DialogBase.cpp:659 msgid "Files" msgstr "Dateien" #: src/iptux/DialogBase.cpp:662 src/iptux/DialogPeer.cpp:565 msgid "Detail" msgstr "" #: src/iptux/DialogBase.cpp:712 #, fuzzy msgid "PeerName" msgstr "Name" #: src/iptux/DialogBase.cpp:719 src/iptux/DialogPeer.cpp:716 msgid "Name" msgstr "Name" #: src/iptux/DialogBase.cpp:725 src/iptux/DialogPeer.cpp:652 #: src/iptux/DialogPeer.cpp:722 src/iptux/ShareFile.cpp:280 #: src/iptux/TransWindow.cpp:271 msgid "Size" msgstr "Größe" #: src/iptux/DialogBase.cpp:731 msgid "Path" msgstr "Pfad" #: src/iptux/DialogBase.cpp:792 msgid "Sending Progress." msgstr "Empfangsfortschritt." #: src/iptux/DialogBase.cpp:795 #, c-format msgid "%s of %s Sent." msgstr "%s von %s Gesendet." #: src/iptux/DialogBase.cpp:802 src/iptux/DialogPeer.cpp:835 msgid "Mission Completed!" msgstr "Vorgang abgeschlossen!" #: src/iptux/DialogBase.cpp:845 src/iptux/DialogBase.cpp:917 msgid "Save Image" msgstr "" #: src/iptux/DialogBase.cpp:850 msgid "Copy Image" msgstr "" #: src/iptux/DialogGroup.cpp:285 msgid "Member" msgstr "Mitglied" #: src/iptux/DialogGroup.cpp:382 msgid "Pals" msgstr "Freunde" #: src/iptux/DialogGroup.cpp:480 msgid "Select All" msgstr "Alles auswählen" #: src/iptux/DialogGroup.cpp:485 msgid "Reverse Select" msgstr "Auswahl umkehren" #: src/iptux/DialogGroup.cpp:490 msgid "Clear Up" msgstr "Leeren" #: src/iptux/DialogGroup.cpp:728 #, c-format msgid "Talk with the group %s" msgstr "Mit der Gruppe %s sprechen" #: src/iptux/DialogPeer.cpp:132 #, c-format msgid "Talk with %s(%s) IP:%s" msgstr "Mit %s(%s) IP:%s sprechen" #: src/iptux/DialogPeer.cpp:305 msgid "Info." msgstr "Informationen." #: src/iptux/DialogPeer.cpp:337 #, c-format msgid "Version: %s\n" msgstr "Version: %s\n" #: src/iptux/DialogPeer.cpp:339 #, c-format msgid "Nickname: %s@%s\n" msgstr "Spitzname: %s@%s\n" #: src/iptux/DialogPeer.cpp:342 #, c-format msgid "Nickname: %s\n" msgstr "Spitzname: %s\n" #: src/iptux/DialogPeer.cpp:344 #, c-format msgid "User: %s\n" msgstr "Benutzer: %s\n" #: src/iptux/DialogPeer.cpp:345 #, c-format msgid "Host: %s\n" msgstr "Host: %s\n" #: src/iptux/DialogPeer.cpp:348 #, c-format msgid "Address: %s(%s)\n" msgstr "Adresse: %s(%s)\n" #: src/iptux/DialogPeer.cpp:350 #, c-format msgid "Address: %s\n" msgstr "Adresse: %s\n" #: src/iptux/DialogPeer.cpp:353 msgid "Compatibility: Microsoft\n" msgstr "Kompatibilität: Microsoft\n" #: src/iptux/DialogPeer.cpp:355 msgid "Compatibility: GNU/Linux\n" msgstr "Kompatibilität: GNU/Linux\n" #: src/iptux/DialogPeer.cpp:357 #, c-format msgid "System coding: %s\n" msgstr "System-Codierung: %s\n" #: src/iptux/DialogPeer.cpp:362 msgid "Signature:\n" msgstr "Signatur:\n" #: src/iptux/DialogPeer.cpp:369 msgid "" "\n" "Photo:\n" msgstr "" "\n" "Foto:\n" #: src/iptux/DialogPeer.cpp:460 msgid "Please select a picture to insert the buffer" msgstr "Bitte wählen Sie ein Bild zum Einfügen aus" #: src/iptux/DialogPeer.cpp:486 src/iptux/resources/gtk/menus.ui:83 #: src/iptux/resources/gtk/menus.ui:228 #, fuzzy msgid "Insert Image" msgstr "Bild einfügen" #: src/iptux/DialogPeer.cpp:502 msgid "Enclosure." msgstr "" #: src/iptux/DialogPeer.cpp:547 #, fuzzy msgid "Files to be received" msgstr "Zu Empfangene Datei." #: src/iptux/DialogPeer.cpp:551 msgid "Receiving progress." msgstr "Empfangsfortschritt." #: src/iptux/DialogPeer.cpp:554 msgid "Accept" msgstr "Annehmen" #: src/iptux/DialogPeer.cpp:560 src/iptux/dialog.cpp:63 #: src/iptux/resources/gtk/menus.ui:342 msgid "Refuse" msgstr "Ablehnen" #: src/iptux/DialogPeer.cpp:596 msgid "File received." msgstr "Datei empfangen." #: src/iptux/DialogPeer.cpp:639 src/iptux/DialogPeer.cpp:710 msgid "Source" msgstr "Quelle" #: src/iptux/DialogPeer.cpp:646 msgid "SaveAs" msgstr "Speichern unter" #: src/iptux/DialogPeer.cpp:818 src/iptux/DialogPeer.cpp:884 msgid "Receiving Progress." msgstr "Empfangfortschritt." #: src/iptux/DialogPeer.cpp:821 src/iptux/DialogPeer.cpp:887 #, c-format msgid "%s to Receive." msgstr "%s zu empfangen." #: src/iptux/DialogPeer.cpp:825 src/iptux/DialogPeer.cpp:891 #, c-format msgid "%s Of %s Received." msgstr "%s von %s empfangen." #: src/iptux/LogSystem.cpp:71 #, c-format msgid "Recevied-From: Nickname:%s User:%s Host:%s" msgstr "Empfangen von: Spitzname: %s Benutzer: %s Host: %s" #: src/iptux/LogSystem.cpp:76 #, c-format msgid "Send-To: Nickname:%s User:%s Host:%s" msgstr "Senden zu: Spitzname: %s Benutzer: %s Host: %s" #: src/iptux/LogSystem.cpp:80 msgid "Send-Broadcast" msgstr "Broadcast senden" #: src/iptux/LogSystem.cpp:99 #, c-format msgid "User:%s Host:%s" msgstr "Benutzer: %s Host: %s" #: src/iptux/MainWindow.cpp:570 msgid "Pals Online: 0" msgstr "Freunde online: 0" #: src/iptux/MainWindow.cpp:655 msgid "Search Pals" msgstr "Freunde suchen" #: src/iptux/MainWindow.cpp:768 msgid "Nickname" msgstr "Spitzname" #: src/iptux/MainWindow.cpp:778 msgid "Group" msgstr "Gruppe" #: src/iptux/MainWindow.cpp:784 src/iptux/TransWindow.cpp:258 msgid "IPv4" msgstr "IPv4" #: src/iptux/MainWindow.cpp:790 msgid "User" msgstr "Benutzer" #: src/iptux/MainWindow.cpp:796 src/iptux/resources/gtk/MainWindow.ui:81 msgid "Host" msgstr "Host" #: src/iptux/MainWindow.cpp:935 #, fuzzy, c-format msgid "Pals Online: %d" msgstr "Freunde online: 0" #: src/iptux/RevisePal.cpp:109 msgid "Change Pal's Information" msgstr "Informationen zum Freund ändern" #: src/iptux/RevisePal.cpp:134 msgid "Pal's nickname:" msgstr "Nickname des Freundes:" #: src/iptux/RevisePal.cpp:140 msgid "Please input pal's new nickname!" msgstr "Bitte geben Sie den neuen Nicknamen des Freundes ein!" #: src/iptux/RevisePal.cpp:146 msgid "Pal's group name:" msgstr "Gruppenname des Freundes:" #: src/iptux/RevisePal.cpp:152 msgid "Please input pal's new group name!" msgstr "Bitte geben Sie den neuen Gruppennamen des Freundes ein!" #: src/iptux/RevisePal.cpp:158 msgid "System coding:" msgstr "System-Codierung:" #: src/iptux/RevisePal.cpp:164 msgid "Be SURE to know what you are doing!" msgstr "Sie sollten WISSEN, was Sie machen!" #: src/iptux/RevisePal.cpp:170 msgid "Pal's face picture:" msgstr "Bild des Freundes:" #: src/iptux/RevisePal.cpp:184 msgid "Be compatible with iptux's protocol (DANGEROUS)" msgstr "Kompatibilität mit dem iptux-Protokoll wahren (gefährlich!)" #: src/iptux/ShareFile.cpp:104 msgid "Shared Files Management" msgstr "Freigabenverwaltung" #: src/iptux/ShareFile.cpp:105 msgid "OK" msgstr "Ok" #: src/iptux/ShareFile.cpp:106 msgid "Apply" msgstr "Übernehmen" #: src/iptux/ShareFile.cpp:107 msgid "Cancel" msgstr "Abbrechen" #: src/iptux/ShareFile.cpp:160 msgid "Add Files" msgstr "Dateien hinzufügen" #: src/iptux/ShareFile.cpp:163 msgid "Add Folders" msgstr "Ordner hinzufügen" #: src/iptux/ShareFile.cpp:166 msgid "Delete Resources" msgstr "Daten löschen" #: src/iptux/ShareFile.cpp:169 msgid "Clear Password" msgstr "Passwort zurücksetzen" #: src/iptux/ShareFile.cpp:172 msgid "Set Password" msgstr "Passwort festlegen" #: src/iptux/ShareFile.cpp:229 src/iptux/ShareFile.cpp:373 msgid "regular" msgstr "regelmäßig" #: src/iptux/ShareFile.cpp:233 src/iptux/ShareFile.cpp:377 msgid "directory" msgstr "Ordner" #: src/iptux/ShareFile.cpp:237 src/iptux/ShareFile.cpp:381 msgid "unknown" msgstr "Unbekannt" #: src/iptux/ShareFile.cpp:270 msgid "File" msgstr "Datei" #: src/iptux/ShareFile.cpp:286 msgid "Type" msgstr "Typ" #: src/iptux/ShareFile.cpp:411 msgid "Choose the files to share" msgstr "Dateien zum Freigeben wählen" #: src/iptux/ShareFile.cpp:414 msgid "Choose the folders to share" msgstr "Ordner zum Freigeben wählen" #: src/iptux/TransWindow.cpp:86 msgid "Files Transmission Management" msgstr "Dateiübertragungen-Verwaltung" #: src/iptux/TransWindow.cpp:241 msgid "State" msgstr "Status" #: src/iptux/TransWindow.cpp:247 msgid "Task" msgstr "Aufgabe" #: src/iptux/TransWindow.cpp:253 msgid "Peer" msgstr "Peer" #: src/iptux/TransWindow.cpp:265 msgid "Filename" msgstr "Dateiname" #: src/iptux/TransWindow.cpp:277 msgid "Completed" msgstr "Abgeschlossen" #: src/iptux/TransWindow.cpp:284 msgid "Progress" msgstr "Fortschritt" #: src/iptux/TransWindow.cpp:291 msgid "Cost" msgstr "Kosten" #: src/iptux/TransWindow.cpp:297 msgid "Remaining" msgstr "Verbleibend" #: src/iptux/TransWindow.cpp:303 msgid "Rate" msgstr "Geschwindigkeit" #: src/iptux/TransWindow.cpp:331 msgid "The path you want to open not exist!" msgstr "Der Pfad, der geöffnet werden soll, existiert nicht!" #: src/iptux/TransWindow.cpp:405 msgid "The file you want to open not exist!" msgstr "Die Datei, die geöffnet werden soll, existiert nicht!" #: src/iptux/TransWindow.cpp:406 msgid "iptux Error" msgstr "iptux-Fehler" #: src/iptux/UiCoreThread.cpp:254 src/iptux/UiCoreThread.cpp:278 #: src/iptux/UiCoreThread.cpp:377 src/iptux/UiCoreThread.cpp:399 msgid "Others" msgstr "Sonstiges" #: src/iptux/UiCoreThread.cpp:419 msgid "Broadcast" msgstr "Übertragung" #: src/iptux/UiHelper.cpp:28 #, c-format msgid "Can't convert path to uri: %s, reason: %s" msgstr "" #: src/iptux/UiHelper.cpp:39 #, c-format msgid "Can't open path: %s, reason: %s" msgstr "" #: src/iptux/UiHelper.cpp:68 #, c-format msgid "Can't open URL: %s, reason: %s" msgstr "" #: src/iptux/UiHelper.cpp:188 msgid "Information" msgstr "Informationen" #: src/iptux/UiHelper.cpp:218 msgid "Warning" msgstr "Warnung" #: src/iptux/UiModels.cpp:604 #, c-format msgid "Version: %s" msgstr "Version: %s" #: src/iptux/UiModels.cpp:608 #, c-format msgid "Nickname: %s@%s" msgstr "Spitzname: %s@%s" #: src/iptux/UiModels.cpp:611 #, c-format msgid "Nickname: %s" msgstr "Spitzname: %s" #: src/iptux/UiModels.cpp:615 #, c-format msgid "User: %s" msgstr "Benutzer: %s" #: src/iptux/UiModels.cpp:618 #, c-format msgid "Host: %s" msgstr "Host: %s" #: src/iptux/UiModels.cpp:623 #, c-format msgid "Address: %s(%s)" msgstr "Adresse: %s(%s)" #: src/iptux/UiModels.cpp:625 #, c-format msgid "Address: %s" msgstr "Adresse: %s" #: src/iptux/UiModels.cpp:630 msgid "Compatibility: Microsoft" msgstr "Kompatibilität: Microsoft" #: src/iptux/UiModels.cpp:632 msgid "Compatibility: GNU/Linux" msgstr "Kompatibilität: GNU/Linux" #: src/iptux/UiModels.cpp:636 #, c-format msgid "System coding: %s" msgstr "System-Codierung: %s" #: src/iptux/UiModels.cpp:641 msgid "Signature:" msgstr "Signatur:" #: src/iptux/UiModels.cpp:744 msgid "" msgstr "" #: src/iptux/UiModels.cpp:799 msgid "[IMG]" msgstr "" #: src/iptux/dialog.cpp:39 msgid "" "File transfer has not been completed.\n" "Are you sure to cancel and quit?" msgstr "" "Die Dateiübertragung ist noch nicht abgeschlossen.\n" "Sind Sie sicher, dass Sie abbrechen und beenden möchten?" #: src/iptux/dialog.cpp:42 msgid "Confirm Exit" msgstr "Beenden bestätigen" #: src/iptux/dialog.cpp:62 src/iptux/resources/gtk/MainWindow.ui:12 #: src/iptux/resources/gtk/menus.ui:98 src/iptux/resources/gtk/menus.ui:243 msgid "Request Shared Resources" msgstr "Freigabe anfordern" #: src/iptux/dialog.cpp:62 msgid "Agree" msgstr "Annehmen" #: src/iptux/dialog.cpp:78 #, c-format msgid "" "Your pal (%s)[%s]\n" "is requesting to get your shared resources,\n" "Do you agree?" msgstr "" "Ihr Freund (%s)[%s]\n" "möchte auf Ihre Freigabe zugreifen.\n" "Sind Sie einverstanden?" #: src/iptux/dialog.cpp:106 msgid "Access Password" msgstr "Passwort für Zugriff" #: src/iptux/dialog.cpp:113 msgid "Please input the password for the shared files behind" msgstr "Bitte geben Sie das Passwort für die Freigabe ein" #: src/iptux/dialog.cpp:127 #, c-format msgid "(%s)[%s]Password:" msgstr "(%s)[%s]Passwort:" #: src/iptux/dialog.cpp:146 src/iptux/dialog.cpp:207 msgid "" "\n" "Empty Password!" msgstr "" "\n" "Leeres Passwort!" #: src/iptux/dialog.cpp:170 msgid "Enter a New Password" msgstr "Neues Passwort eingeben" #: src/iptux/dialog.cpp:178 msgid "Password: " msgstr "Passwort: " #: src/iptux/dialog.cpp:187 msgid "Repeat: " msgstr "Wiederholen: " #: src/iptux/dialog.cpp:202 msgid "" "\n" "Password Mismatched!" msgstr "" "\n" "Passwörter stimmen nicht überein!" #: src/iptux/dialog.cpp:229 msgid "Please select a folder to save files." msgstr "Bitte wählen Sie einen Ordner zum Speichern von Dateien." #: src/iptux/resources/gtk/AboutDialog.ui:11 msgid "" "Copyright © 2008–2009, Jally\n" "Copyright © 2013–2015,2017–2021, LI Daobing" msgstr "" #: src/iptux/resources/gtk/AboutDialog.ui:13 #, fuzzy msgid "A GTK based LAN messenger." msgstr "Ein LAN-Sofortnachrichtenprogramm basierend auf GTK+." #: src/iptux/resources/gtk/AppIndicator.ui:6 #, fuzzy msgid "Open Iptux" msgstr "iptux" #: src/iptux/resources/gtk/AppIndicator.ui:12 #: src/iptux/resources/gtk/menus.ui:6 src/iptux/resources/gtk/menus.ui:306 msgid "_Preferences" msgstr "_Einstellungen" #: src/iptux/resources/gtk/AppIndicator.ui:16 #: src/iptux/resources/gtk/menus.ui:10 src/iptux/resources/gtk/menus.ui:310 msgid "_Quit" msgstr "_Beenden" #: src/iptux/resources/gtk/DetectPal.ui:7 #, fuzzy msgid "Detect pal" msgstr "Freunde finden" #: src/iptux/resources/gtk/DetectPal.ui:15 msgid "Detect" msgstr "Finden" #: src/iptux/resources/gtk/DetectPal.ui:61 msgid "Please input an IP address (IPv4 only):" msgstr "Bitte geben Sie eine IP-Adresse (nur IPv4) ein:" #: src/iptux/resources/gtk/MainWindow.ui:8 src/iptux/resources/gtk/menus.ui:109 #: src/iptux/resources/gtk/menus.ui:254 msgid "Send Message" msgstr "Nachricht senden" #: src/iptux/resources/gtk/MainWindow.ui:16 #, fuzzy msgid "Change Info" msgstr "Informationen bearbeiten." #: src/iptux/resources/gtk/MainWindow.ui:20 msgid "Delete Pal" msgstr "Freund löschen" #: src/iptux/resources/gtk/MainWindow.ui:26 src/iptux/resources/gtk/menus.ui:31 #: src/iptux/resources/gtk/menus.ui:176 msgid "Sort" msgstr "Sortieren" #: src/iptux/resources/gtk/MainWindow.ui:29 src/iptux/resources/gtk/menus.ui:34 #: src/iptux/resources/gtk/menus.ui:179 msgid "By Nickname" msgstr "Nach Spitznamen" #: src/iptux/resources/gtk/MainWindow.ui:34 src/iptux/resources/gtk/menus.ui:39 #: src/iptux/resources/gtk/menus.ui:184 #, fuzzy msgid "By Username" msgstr "Nach Spitznamen" #: src/iptux/resources/gtk/MainWindow.ui:39 src/iptux/resources/gtk/menus.ui:44 #: src/iptux/resources/gtk/menus.ui:189 msgid "By IP" msgstr "Nach IP-Adresse" #: src/iptux/resources/gtk/MainWindow.ui:44 src/iptux/resources/gtk/menus.ui:49 #: src/iptux/resources/gtk/menus.ui:194 #, fuzzy msgid "By Host" msgstr "Host" #: src/iptux/resources/gtk/MainWindow.ui:49 src/iptux/resources/gtk/menus.ui:54 #: src/iptux/resources/gtk/menus.ui:199 msgid "By Last Activity" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:56 src/iptux/resources/gtk/menus.ui:61 #: src/iptux/resources/gtk/menus.ui:206 msgid "Ascending" msgstr "Aufsteigend" #: src/iptux/resources/gtk/MainWindow.ui:61 src/iptux/resources/gtk/menus.ui:66 #: src/iptux/resources/gtk/menus.ui:211 msgid "Descending" msgstr "Absteigend" #: src/iptux/resources/gtk/MainWindow.ui:68 msgid "Info Style" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:71 #, fuzzy msgid "IP" msgstr "IPv4" #: src/iptux/resources/gtk/MainWindow.ui:76 msgid "IP:PORT" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:86 #, fuzzy msgid "Username" msgstr "Benutzer" #: src/iptux/resources/gtk/MainWindow.ui:91 #, fuzzy msgid "Version" msgstr "Version: %s" #: src/iptux/resources/gtk/MainWindow.ui:96 msgid "Last Activity" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:101 #, fuzzy msgid "Last Message" msgstr "Nachricht senden" #: src/iptux/resources/gtk/menus.ui:17 src/iptux/resources/gtk/menus.ui:162 msgid "_File" msgstr "_Datei" #: src/iptux/resources/gtk/menus.ui:19 src/iptux/resources/gtk/menus.ui:164 msgid "_Detect" msgstr "_Erkennen" #: src/iptux/resources/gtk/menus.ui:23 src/iptux/resources/gtk/menus.ui:168 msgid "_Find" msgstr "_Suchen" #: src/iptux/resources/gtk/menus.ui:28 src/iptux/resources/gtk/menus.ui:173 msgid "_View" msgstr "" #: src/iptux/resources/gtk/menus.ui:73 src/iptux/resources/gtk/menus.ui:218 msgid "_Refresh" msgstr "" #: src/iptux/resources/gtk/menus.ui:80 src/iptux/resources/gtk/menus.ui:225 msgid "_Chat" msgstr "" #: src/iptux/resources/gtk/menus.ui:88 src/iptux/resources/gtk/menus.ui:233 msgid "Attach File" msgstr "Datei anhängen" #: src/iptux/resources/gtk/menus.ui:92 src/iptux/resources/gtk/menus.ui:237 msgid "Attach Folder" msgstr "Ordner anhängen" #: src/iptux/resources/gtk/menus.ui:102 src/iptux/resources/gtk/menus.ui:247 msgid "Clear Chat History" msgstr "Den Chatverlauf löschen" #: src/iptux/resources/gtk/menus.ui:115 src/iptux/resources/gtk/menus.ui:260 msgid "_Window" msgstr "" #: src/iptux/resources/gtk/menus.ui:118 src/iptux/resources/gtk/menus.ui:263 msgid "_Transmission" msgstr "Über_tragung" #: src/iptux/resources/gtk/menus.ui:122 src/iptux/resources/gtk/menus.ui:267 msgid "_Shared Management" msgstr "_Freigaben verwalten" #: src/iptux/resources/gtk/menus.ui:126 src/iptux/resources/gtk/menus.ui:271 msgid "_Chat Log" msgstr "" #: src/iptux/resources/gtk/menus.ui:130 src/iptux/resources/gtk/menus.ui:275 #, fuzzy msgid "_System Log" msgstr "System-Codierung:" #: src/iptux/resources/gtk/menus.ui:136 src/iptux/resources/gtk/menus.ui:281 msgid "Close Window" msgstr "" #: src/iptux/resources/gtk/menus.ui:142 src/iptux/resources/gtk/menus.ui:287 msgid "_Help" msgstr "_Hilfe" #: src/iptux/resources/gtk/menus.ui:145 src/iptux/resources/gtk/menus.ui:290 msgid "_About" msgstr "_Über" #: src/iptux/resources/gtk/menus.ui:149 src/iptux/resources/gtk/menus.ui:294 msgid "Report Bug" msgstr "Fehler melden" #: src/iptux/resources/gtk/menus.ui:153 src/iptux/resources/gtk/menus.ui:298 msgid "What's New" msgstr "" #: src/iptux/resources/gtk/menus.ui:318 msgid "Open This File" msgstr "Diese Datei öffnen" #: src/iptux/resources/gtk/menus.ui:322 msgid "Open Containing Folder" msgstr "Beinhaltenden Ordner öffnen" #: src/iptux/resources/gtk/menus.ui:326 msgid "Terminate Task" msgstr "Aufgabe abbrechen" #: src/iptux/resources/gtk/menus.ui:330 msgid "Terminate All" msgstr "Alle abbrechen" #: src/iptux/resources/gtk/menus.ui:334 msgid "Clear Tasklist" msgstr "Aufgabenliste leeren" #: src/iptux/resources/gtk/menus.ui:346 #, fuzzy msgid "Refuse All" msgstr "Ablehnen" #: src/main/iptux.cpp:149 msgid "- A software for sharing in LAN" msgstr "- Ein Programm für den Austausch im LAN" #: src/main/iptux.cpp:152 #, c-format msgid "option parsing failed: %s\n" msgstr "" #~ msgid "Can't find any available web browser!\n" #~ msgstr "Es kann kein verfügbarer Webbrowser gefunden werden!\n" #, fuzzy #~ msgid "Close Chat" #~ msgstr "Schließen" #~ msgid "Pals Online: %" #~ msgstr "Freunde online: %" #~ msgid "Sound" #~ msgstr "Sound" #~ msgid "Activate the sound support" #~ msgstr "Soundunterstützung aktivieren" #~ msgid "Volume Control: " #~ msgstr "Lautstäreregelung: " #~ msgid "Sound Event" #~ msgstr "Klangereignis" #~ msgid "Test" #~ msgstr "Test" #~ msgid "Stop" #~ msgstr "Stopp" #~ msgid "Transfer finished" #~ msgstr "Übertragung abgeschlossen" #~ msgid "Message received" #~ msgstr "Nachricht erhalten" #~ msgid "Play" #~ msgstr "Abspielen" #~ msgid "Event" #~ msgstr "Ereignis" #~ msgid "Please select a sound file" #~ msgstr "Bitte wählen Sie eine Sounddatei aus" #~ msgid "Failed to play the prompt tone, [%s] %s, %s" #~ msgstr "Der Aufforderungston konnte nicht abgespielt werden, [%s] %s, %s" #~ msgid "_Hide" #~ msgstr "_Verstecken" #~ msgid "_Show" #~ msgstr "_Anzeigen" #~ msgid "To be read: %u messages" #~ msgstr "Ungelesen: %u Nachrichten" #~ msgid "_Tools" #~ msgstr "_Werkzeuge" #~ msgid "Error" #~ msgstr "Fehler" #~ msgid "Please input an IP address (IPv4 only)!" #~ msgstr "Bitte geben Sie eine IP-Adresse (nur IPv4) ein!" #~ msgid "..." #~ msgstr "…" #~ msgid "Clear Buffer" #~ msgstr "Zwischenspeicher leeren" #, fuzzy #~ msgid "Contributors" #~ msgstr "Mitwirkende" #, fuzzy #~ msgid "" #~ "Fatal Error!!\n" #~ "Failed to bind the TCP/UDP port(%d)!\n" #~ "%s" #~ msgstr "" #~ "Schwerer Fehler!!\n" #~ "Verwendung des TCP/UDP-Ports 2425 fehlgeschlagen!\n" #~ "%s" #~ msgid "Help" #~ msgstr "Hilfe" #~ msgid "" #~ "It's an honor that iptux was contributed voluntarilly by many people. " #~ "Without your help, iptux could never make it.\n" #~ "\n" #~ "Especially, Here's some we would like to thank much:\n" #~ "\n" #~ "ChenGang\n" #~ "\n" #~ "\n" #~ "\n" #~ "\n" #~ "\n" #~ "..." #~ msgstr "" #~ "Es ist eine Ehre für iptux, dass es von vielen freiwilligen Helfern " #~ "mitentwickelt wurde. Ohne ihre Hilfe wäre aus iptux nie etwas geworden.\n" #~ "\n" #~ "Einigen möchten wir besonders danken:\n" #~ "\n" #~ "ChenGang\n" #~ "\n" #~ "\n" #~ "\n" #~ "\n" #~ "\n" #~ "..." #~ msgid "Jally " #~ msgstr "Jally " #~ msgid "LiWeijian " #~ msgstr "LiWeijian " #~ msgid "ManPT " #~ msgstr "ManPT " #~ msgid "More About Iptux" #~ msgstr "Mehr Informationen zu Iptux" #~ msgid "The process is about to quit!" #~ msgstr "Der Prozess wird gerade beendet!" #~ msgid "_FAQ" #~ msgstr "_FAQ" #~ msgid "_More" #~ msgstr "_Mehr" #~ msgid "_Sort" #~ msgstr "_Sortieren" #~ msgid "_Update" #~ msgstr "_Aktualisieren" #~ msgid "" #~ "alick \n" #~ "ManPT " #~ msgstr "" #~ "alick \n" #~ "ManPT " #~ msgid "" #~ "\t-h --help\n" #~ "\t\tdisplay this help and exit\n" #~ msgstr "" #~ "\t-h --help\n" #~ "\t\tDiese Hilfe zeigen und beenden\n" #~ msgid "" #~ "\t-v --version\n" #~ "\t\toutput version information and exit\n" #~ msgstr "" #~ "\t-v --version\n" #~ "\t\tVersionsinformationen anzeigen und beenden\n" #~ msgid "Opendir() directory \"%s\" failed, %s\n" #~ msgstr "Opendir() Ordner \"%s\" fehlgeschlagen, %s\n" #~ msgid "Rmdir() directory \"%s\" failed, %s\n" #~ msgstr "Rmdir() Ordner \"%s\" fehlgeschlagen, %s\n" #~ msgid "Stat() file \"%s\" failed, %s\n" #~ msgstr "Stat() Datei \"%s\" fehlgeschlagen, %s\n" #~ msgid "The user is not privileged!\n" #~ msgstr "Der Benutzer hat nicht die erforderliche Berechtigung!\n" #~ msgid "Unlink() file \"%s\" failed, %s\n" #~ msgstr "Unlink() Datei \"%s\" fehlgeschlagen, %s\n" #~ msgid "What do you want to do?\n" #~ msgstr "Was möchten Sie machen?\n" #~ msgid "utf-16" #~ msgstr "UTF-16" #~ msgid "utf-8" #~ msgstr "UTF-8" iptux-0.9.4/po/en_GB.po000066400000000000000000000723011475473122500146420ustar00rootroot00000000000000# English (United Kingdom) translation for iptux # Copyright (c) 2009 Rosetta Contributors and Canonical Ltd 2009 # This file is distributed under the same license as the iptux package. # FIRST AUTHOR , 2009. # msgid "" msgstr "" "Project-Id-Version: iptux\n" "Report-Msgid-Bugs-To: https://github.com/iptux-src/iptux/issues/new\n" "POT-Creation-Date: 2025-02-17 13:35-0800\n" "PO-Revision-Date: 2018-01-22 06:45+0000\n" "Last-Translator: zhangjiejing \n" "Language-Team: English (United Kingdom) \n" "Language: en_GB\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Launchpad-Export-Date: 2018-01-24 12:00+0000\n" "X-Generator: Launchpad (build 18532)\n" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:6 msgid "iptux" msgstr "iptux" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:7 msgid "LAN communication software" msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:17 msgid "iptux is an “IP Messenger” client. The features of iptux include:" msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:21 msgid "auto-detect other clients on the intranet." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:22 msgid "send/recv messages to other clients." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:23 msgid "send/recv files to other clients." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:24 msgid "share your files to other cliens (with optional password protection)." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:26 msgid "" "It is (supposedly) compatible with 飞鸽传书 (Feige) and 飞秋 (FeiQ) from " "China, and with the original “IP Messenger” clients from Japan, including " "g2ipmsg and xipmsg in Debian." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:38 msgid "The Iptux main window." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:42 msgid "The Iptux chat window." msgstr "" #: src/iptux-core/CoreThread.cpp:172 #, fuzzy, c-format msgid "" "Fatal Error!! Failed to create new socket!\n" "%s" msgstr "" "Fatal Error!!\n" "Failed to create new socket!\n" "%s" #: src/iptux-core/CoreThread.cpp:188 #, fuzzy, c-format msgid "" "Fatal Error!! Failed to bind the TCP port(%s:%d)!\n" "%s" msgstr "" "Fatal Error!!\n" "Failed to create new socket!\n" "%s" #: src/iptux-core/CoreThread.cpp:201 #, fuzzy, c-format msgid "" "Fatal Error!! Failed to bind the UDP port(%s:%d)!\n" "%s" msgstr "" "Fatal Error!!\n" "Failed to create new socket!\n" "%s" #: src/iptux-core/CoreThread.cpp:461 src/iptux-core/CoreThread.cpp:495 #: src/iptux-core/internal/RecvFileData.cpp:142 #: src/iptux-core/internal/RecvFileData.cpp:204 #, c-format msgid "" "Fatal Error!!\n" "Failed to create new socket!\n" "%s" msgstr "" "Fatal Error!!\n" "Failed to create new socket!\n" "%s" #: src/iptux-core/Models.cpp:172 #, fuzzy msgid "Empty Message" msgstr "Send Message" #: src/iptux-core/Models.cpp:250 msgid "Received an image" msgstr "" #: src/iptux-core/internal/AnalogFS.cpp:93 #: src/iptux-core/internal/AnalogFS.cpp:98 #, c-format msgid "Open() file \"%s\" failed, %s" msgstr "" #: src/iptux-core/internal/AnalogFS.cpp:117 #, c-format msgid "Stat64() file \"%s\" failed, %s" msgstr "" #: src/iptux-core/internal/AnalogFS.cpp:138 #, c-format msgid "Mkdir() directory \"%s\" failed, %s" msgstr "" #: src/iptux-core/internal/AnalogFS.cpp:164 #, c-format msgid "Opendir() directory \"%s\" failed, %s" msgstr "" #: src/iptux-core/internal/Command.cpp:226 msgid "Your pal didn't receive the packet. He or she is offline maybe." msgstr "Your pal didn't receive the packet. He or she is offline maybe." #: src/iptux-core/internal/CommandMode.cpp:39 #, c-format msgid "unknown command mode: %d" msgstr "" #: src/iptux-core/internal/RecvFileData.cpp:117 msgid "receive" msgstr "receive" #: src/iptux-core/internal/RecvFileData.cpp:124 #: src/iptux-core/internal/RecvFileData.cpp:253 #: src/iptux-core/internal/SendFileData.cpp:108 #: src/iptux-core/internal/SendFileData.cpp:193 #, fuzzy msgid "Unknown" msgstr "unknown" #: src/iptux-core/internal/RecvFileData.cpp:175 #, c-format msgid "" "Failed to receive the file \"%s\" from %s! expect length %jd, received %jd" msgstr "" #: src/iptux-core/internal/RecvFileData.cpp:180 #, c-format msgid "Receive the file \"%s\" from %s successfully!" msgstr "" #: src/iptux-core/internal/RecvFileData.cpp:320 #, c-format msgid "Failed to receive the directory \"%s\" from %s!" msgstr "" #: src/iptux-core/internal/RecvFileData.cpp:323 #, c-format msgid "Receive the directory \"%s\" from %s successfully!" msgstr "" #: src/iptux-core/internal/SendFileData.cpp:101 msgid "send" msgstr "send" #: src/iptux-core/internal/SendFileData.cpp:137 #, c-format msgid "Failed to send the file \"%s\" to %s!" msgstr "" #: src/iptux-core/internal/SendFileData.cpp:142 #, c-format msgid "Send the file \"%s\" to %s successfully!" msgstr "" #: src/iptux-core/internal/SendFileData.cpp:265 #, c-format msgid "Failed to send the directory \"%s\" to %s!" msgstr "" #: src/iptux-core/internal/SendFileData.cpp:270 #, c-format msgid "Send the directory \"%s\" to %s successfully!" msgstr "" #: src/iptux-core/internal/UdpData.cpp:92 #: src/iptux-core/internal/UdpData.cpp:93 #: src/iptux-core/internal/UdpData.cpp:443 #: src/iptux-core/internal/UdpData.cpp:484 msgid "mysterious" msgstr "mysterious" #: src/iptux-utils/utils.cpp:880 #, c-format msgid "stat file \"%s\" failed: %s" msgstr "" #: src/iptux-utils/utils.cpp:888 #, c-format msgid "path %s is not file or directory: st_mode(%x)" msgstr "" #: src/iptux-utils/utils.cpp:895 #, c-format msgid "opendir on \"%s\" failed: %s" msgstr "" #: src/iptux/AboutDialog.cpp:39 msgid "TRANSLATOR NAME" msgstr "" #: src/iptux/AboutDialog.cpp:53 msgid "Thanks to" msgstr "" #: src/iptux/AppIndicator.cpp:40 src/iptux/MainWindow.cpp:505 #: src/iptux/MainWindow.cpp:507 #, fuzzy msgid "Iptux" msgstr "iptux" #: src/iptux/Application.cpp:54 msgid "Loading the process successfully!" msgstr "" #: src/iptux/Application.cpp:274 #, c-format msgid "New Message from %s" msgstr "" #: src/iptux/Application.cpp:287 #, c-format msgid "New File from %s" msgstr "" #: src/iptux/Application.cpp:296 msgid "Receiving File Finished" msgstr "" #: src/iptux/Application.cpp:300 msgid "file info no longer exist" msgstr "" #: src/iptux/Darwin.cpp:16 #, c-format msgid "Couldn’t load icon: %s" msgstr "" #: src/iptux/DataSettings.cpp:46 msgid "Personal" msgstr "Personal" #: src/iptux/DataSettings.cpp:48 msgid "System" msgstr "System" #: src/iptux/DataSettings.cpp:50 msgid "Network" msgstr "" #: src/iptux/DataSettings.cpp:89 src/iptux/DataSettings.cpp:98 msgid "The program needs to be restarted to take effect!" msgstr "" #: src/iptux/DataSettings.cpp:143 msgid "Preferences" msgstr "" #: src/iptux/DataSettings.cpp:143 src/iptux/RevisePal.cpp:109 #: src/iptux/dialog.cpp:107 src/iptux/dialog.cpp:170 #, fuzzy msgid "_OK" msgstr "OK" #: src/iptux/DataSettings.cpp:144 #, fuzzy msgid "_Apply" msgstr "Apply" #: src/iptux/DataSettings.cpp:144 src/iptux/DataSettings.cpp:1348 #: src/iptux/DataSettings.cpp:1395 src/iptux/DialogBase.cpp:359 #: src/iptux/DialogBase.cpp:918 src/iptux/RevisePal.cpp:110 #: src/iptux/ShareFile.cpp:419 src/iptux/callback.cpp:87 #: src/iptux/dialog.cpp:171 src/iptux/dialog.cpp:230 #, fuzzy msgid "_Cancel" msgstr "Cancel" #: src/iptux/DataSettings.cpp:169 #, fuzzy msgid "Your _nickname:" msgstr "Your nickname:" #: src/iptux/DataSettings.cpp:176 msgid "Please input your nickname!" msgstr "" #: src/iptux/DataSettings.cpp:182 #, fuzzy msgid "Your _group name:" msgstr "Your group name:" #: src/iptux/DataSettings.cpp:189 msgid "Please input your group name!" msgstr "" #: src/iptux/DataSettings.cpp:195 msgid "Your _face picture:" msgstr "" #: src/iptux/DataSettings.cpp:213 msgid "_Save files to: " msgstr "" #: src/iptux/DataSettings.cpp:226 msgid "Photo" msgstr "" #: src/iptux/DataSettings.cpp:238 msgid "Signature" msgstr "" #: src/iptux/DataSettings.cpp:271 msgid "Port:" msgstr "" #: src/iptux/DataSettings.cpp:278 msgid "Any port number between 1024 and 65535, default is 2425" msgstr "" #: src/iptux/DataSettings.cpp:287 msgid "Candidate network encodings:" msgstr "" #: src/iptux/DataSettings.cpp:294 msgid "Candidate network encodings, separated by \",\"" msgstr "" #: src/iptux/DataSettings.cpp:301 msgid "Preferred network encoding:" msgstr "" #: src/iptux/DataSettings.cpp:308 msgid "" "Preference network coding (You should be aware of what you are doing if you " "want to modify it.)" msgstr "" #: src/iptux/DataSettings.cpp:316 msgid "Pal's default face picture:" msgstr "" #: src/iptux/DataSettings.cpp:334 msgid "Panel font:" msgstr "" #: src/iptux/DataSettings.cpp:346 msgid "Automatically open the chat dialog" msgstr "" #: src/iptux/DataSettings.cpp:354 msgid "Automatically hide the panel after login" msgstr "" #: src/iptux/DataSettings.cpp:362 msgid "Automatically open the File Transmission Management" msgstr "" #: src/iptux/DataSettings.cpp:370 msgid "Use the 'Enter' key to send message" msgstr "" #: src/iptux/DataSettings.cpp:378 msgid "Automatically clean up the chat history" msgstr "" #: src/iptux/DataSettings.cpp:385 msgid "Save the chat history" msgstr "" #: src/iptux/DataSettings.cpp:393 msgid "Use the Blacklist (NOT recommended)" msgstr "" #: src/iptux/DataSettings.cpp:401 msgid "Filter the request of sharing files" msgstr "" #: src/iptux/DataSettings.cpp:408 msgid "Hide the taskbar when the main window is minimized" msgstr "" #: src/iptux/DataSettings.cpp:432 msgid "From:" msgstr "" #: src/iptux/DataSettings.cpp:438 msgid "Beginning of the IP(v4) section" msgstr "" #: src/iptux/DataSettings.cpp:442 msgid "To:" msgstr "" #: src/iptux/DataSettings.cpp:448 msgid "End of the IP(v4) section" msgstr "" #: src/iptux/DataSettings.cpp:456 msgid "Add" msgstr "Add" #: src/iptux/DataSettings.cpp:461 msgid "Delete" msgstr "Delete" #: src/iptux/DataSettings.cpp:468 msgid "Added IP(v4) Section:" msgstr "" #: src/iptux/DataSettings.cpp:487 msgid "Import" msgstr "Import" #: src/iptux/DataSettings.cpp:491 msgid "Export" msgstr "Export" #: src/iptux/DataSettings.cpp:495 src/iptux/TransWindow.cpp:171 msgid "Clear" msgstr "Clear" #: src/iptux/DataSettings.cpp:706 msgid "From" msgstr "" #: src/iptux/DataSettings.cpp:713 msgid "To" msgstr "" #: src/iptux/DataSettings.cpp:720 msgid "Description" msgstr "" #: src/iptux/DataSettings.cpp:736 msgid "Please select download folder" msgstr "" #: src/iptux/DataSettings.cpp:758 msgid "Select Font" msgstr "" #: src/iptux/DataSettings.cpp:872 src/iptux/DataSettings.cpp:874 #: src/iptux/DataSettings.cpp:878 msgid "Port must be a number between 1024 and 65535" msgstr "" #: src/iptux/DataSettings.cpp:1019 src/iptux/DataSettings.cpp:1050 #, c-format msgid "" "Fopen() file \"%s\" failed!\n" "%s" msgstr "" #: src/iptux/DataSettings.cpp:1150 src/iptux/RevisePal.cpp:419 msgid "Please select a face picture" msgstr "" #: src/iptux/DataSettings.cpp:1172 msgid "Please select a personal photo" msgstr "" #: src/iptux/DataSettings.cpp:1241 src/iptux/DataSettings.cpp:1248 #: src/iptux/DetectPal.cpp:75 #, c-format msgid "" "\n" "Illegal IP(v4) address: %s!" msgstr "" #: src/iptux/DataSettings.cpp:1346 msgid "Please select a file to import data" msgstr "" #: src/iptux/DataSettings.cpp:1347 src/iptux/DialogBase.cpp:358 #: src/iptux/ShareFile.cpp:418 src/iptux/callback.cpp:86 msgid "_Open" msgstr "" #: src/iptux/DataSettings.cpp:1394 msgid "Save data to file" msgstr "" #: src/iptux/DataSettings.cpp:1395 src/iptux/DialogBase.cpp:919 #: src/iptux/dialog.cpp:231 msgid "_Save" msgstr "" #: src/iptux/DetectPal.cpp:70 #, c-format msgid "The notification has been sent to %s." msgstr "" #: src/iptux/DialogBase.cpp:214 #, c-format msgid "%s To Send." msgstr "" #: src/iptux/DialogBase.cpp:272 msgid "Close" msgstr "Close" #: src/iptux/DialogBase.cpp:276 src/iptux/DialogGroup.cpp:375 msgid "Send" msgstr "Send" #: src/iptux/DialogBase.cpp:307 msgid "Chat History" msgstr "" #: src/iptux/DialogBase.cpp:350 msgid "Choose enclosure files" msgstr "" #: src/iptux/DialogBase.cpp:353 msgid "Choose enclosure folders" msgstr "" #: src/iptux/DialogBase.cpp:593 msgid "Remove Selected" msgstr "" #: src/iptux/DialogBase.cpp:648 msgid "File to send." msgstr "" #: src/iptux/DialogBase.cpp:653 msgid "Sending progress." msgstr "" #: src/iptux/DialogBase.cpp:656 msgid "Dirs" msgstr "" #: src/iptux/DialogBase.cpp:659 #, fuzzy msgid "Files" msgstr "_File" #: src/iptux/DialogBase.cpp:662 src/iptux/DialogPeer.cpp:565 msgid "Detail" msgstr "" #: src/iptux/DialogBase.cpp:712 msgid "PeerName" msgstr "" #: src/iptux/DialogBase.cpp:719 src/iptux/DialogPeer.cpp:716 msgid "Name" msgstr "" #: src/iptux/DialogBase.cpp:725 src/iptux/DialogPeer.cpp:652 #: src/iptux/DialogPeer.cpp:722 src/iptux/ShareFile.cpp:280 #: src/iptux/TransWindow.cpp:271 msgid "Size" msgstr "" #: src/iptux/DialogBase.cpp:731 msgid "Path" msgstr "" #: src/iptux/DialogBase.cpp:792 msgid "Sending Progress." msgstr "" #: src/iptux/DialogBase.cpp:795 #, c-format msgid "%s of %s Sent." msgstr "" #: src/iptux/DialogBase.cpp:802 src/iptux/DialogPeer.cpp:835 msgid "Mission Completed!" msgstr "" #: src/iptux/DialogBase.cpp:845 src/iptux/DialogBase.cpp:917 msgid "Save Image" msgstr "" #: src/iptux/DialogBase.cpp:850 msgid "Copy Image" msgstr "" #: src/iptux/DialogGroup.cpp:285 msgid "Member" msgstr "" #: src/iptux/DialogGroup.cpp:382 msgid "Pals" msgstr "" #: src/iptux/DialogGroup.cpp:480 msgid "Select All" msgstr "" #: src/iptux/DialogGroup.cpp:485 msgid "Reverse Select" msgstr "" #: src/iptux/DialogGroup.cpp:490 msgid "Clear Up" msgstr "Clear Up" #: src/iptux/DialogGroup.cpp:728 #, c-format msgid "Talk with the group %s" msgstr "" #: src/iptux/DialogPeer.cpp:132 #, c-format msgid "Talk with %s(%s) IP:%s" msgstr "" #: src/iptux/DialogPeer.cpp:305 msgid "Info." msgstr "" #: src/iptux/DialogPeer.cpp:337 #, c-format msgid "Version: %s\n" msgstr "Version: %s\n" #: src/iptux/DialogPeer.cpp:339 #, c-format msgid "Nickname: %s@%s\n" msgstr "Nickname: %s@%s\n" #: src/iptux/DialogPeer.cpp:342 #, c-format msgid "Nickname: %s\n" msgstr "Nickname: %s\n" #: src/iptux/DialogPeer.cpp:344 #, c-format msgid "User: %s\n" msgstr "User: %s\n" #: src/iptux/DialogPeer.cpp:345 #, c-format msgid "Host: %s\n" msgstr "Host: %s\n" #: src/iptux/DialogPeer.cpp:348 #, c-format msgid "Address: %s(%s)\n" msgstr "Address: %s(%s)\n" #: src/iptux/DialogPeer.cpp:350 #, c-format msgid "Address: %s\n" msgstr "" #: src/iptux/DialogPeer.cpp:353 msgid "Compatibility: Microsoft\n" msgstr "Compatibility: Microsoft\n" #: src/iptux/DialogPeer.cpp:355 msgid "Compatibility: GNU/Linux\n" msgstr "Compatibility: GNU/Linux\n" #: src/iptux/DialogPeer.cpp:357 #, c-format msgid "System coding: %s\n" msgstr "" #: src/iptux/DialogPeer.cpp:362 msgid "Signature:\n" msgstr "" #: src/iptux/DialogPeer.cpp:369 msgid "" "\n" "Photo:\n" msgstr "" #: src/iptux/DialogPeer.cpp:460 msgid "Please select a picture to insert the buffer" msgstr "" #: src/iptux/DialogPeer.cpp:486 src/iptux/resources/gtk/menus.ui:83 #: src/iptux/resources/gtk/menus.ui:228 #, fuzzy msgid "Insert Image" msgstr "Insert Picture" #: src/iptux/DialogPeer.cpp:502 msgid "Enclosure." msgstr "" #: src/iptux/DialogPeer.cpp:547 msgid "Files to be received" msgstr "" #: src/iptux/DialogPeer.cpp:551 msgid "Receiving progress." msgstr "" #: src/iptux/DialogPeer.cpp:554 msgid "Accept" msgstr "" #: src/iptux/DialogPeer.cpp:560 src/iptux/dialog.cpp:63 #: src/iptux/resources/gtk/menus.ui:342 msgid "Refuse" msgstr "Refuse" #: src/iptux/DialogPeer.cpp:596 msgid "File received." msgstr "" #: src/iptux/DialogPeer.cpp:639 src/iptux/DialogPeer.cpp:710 msgid "Source" msgstr "" #: src/iptux/DialogPeer.cpp:646 msgid "SaveAs" msgstr "" #: src/iptux/DialogPeer.cpp:818 src/iptux/DialogPeer.cpp:884 msgid "Receiving Progress." msgstr "" #: src/iptux/DialogPeer.cpp:821 src/iptux/DialogPeer.cpp:887 #, c-format msgid "%s to Receive." msgstr "" #: src/iptux/DialogPeer.cpp:825 src/iptux/DialogPeer.cpp:891 #, c-format msgid "%s Of %s Received." msgstr "" #: src/iptux/LogSystem.cpp:71 #, c-format msgid "Recevied-From: Nickname:%s User:%s Host:%s" msgstr "" #: src/iptux/LogSystem.cpp:76 #, c-format msgid "Send-To: Nickname:%s User:%s Host:%s" msgstr "" #: src/iptux/LogSystem.cpp:80 msgid "Send-Broadcast" msgstr "" #: src/iptux/LogSystem.cpp:99 #, c-format msgid "User:%s Host:%s" msgstr "" #: src/iptux/MainWindow.cpp:570 msgid "Pals Online: 0" msgstr "" #: src/iptux/MainWindow.cpp:655 msgid "Search Pals" msgstr "" #: src/iptux/MainWindow.cpp:768 msgid "Nickname" msgstr "" #: src/iptux/MainWindow.cpp:778 msgid "Group" msgstr "" #: src/iptux/MainWindow.cpp:784 src/iptux/TransWindow.cpp:258 msgid "IPv4" msgstr "IPv4" #: src/iptux/MainWindow.cpp:790 msgid "User" msgstr "" #: src/iptux/MainWindow.cpp:796 src/iptux/resources/gtk/MainWindow.ui:81 msgid "Host" msgstr "" #: src/iptux/MainWindow.cpp:935 #, c-format msgid "Pals Online: %d" msgstr "" #: src/iptux/RevisePal.cpp:109 msgid "Change Pal's Information" msgstr "" #: src/iptux/RevisePal.cpp:134 msgid "Pal's nickname:" msgstr "Pal's nickname:" #: src/iptux/RevisePal.cpp:140 msgid "Please input pal's new nickname!" msgstr "Please input pal's new nickname!" #: src/iptux/RevisePal.cpp:146 msgid "Pal's group name:" msgstr "Pal's group name:" #: src/iptux/RevisePal.cpp:152 msgid "Please input pal's new group name!" msgstr "Please input pal's new group name!" #: src/iptux/RevisePal.cpp:158 msgid "System coding:" msgstr "" #: src/iptux/RevisePal.cpp:164 msgid "Be SURE to know what you are doing!" msgstr "" #: src/iptux/RevisePal.cpp:170 msgid "Pal's face picture:" msgstr "" #: src/iptux/RevisePal.cpp:184 msgid "Be compatible with iptux's protocol (DANGEROUS)" msgstr "" #: src/iptux/ShareFile.cpp:104 msgid "Shared Files Management" msgstr "" #: src/iptux/ShareFile.cpp:105 msgid "OK" msgstr "OK" #: src/iptux/ShareFile.cpp:106 msgid "Apply" msgstr "Apply" #: src/iptux/ShareFile.cpp:107 msgid "Cancel" msgstr "Cancel" #: src/iptux/ShareFile.cpp:160 msgid "Add Files" msgstr "Add Files" #: src/iptux/ShareFile.cpp:163 msgid "Add Folders" msgstr "Add Folders" #: src/iptux/ShareFile.cpp:166 msgid "Delete Resources" msgstr "" #: src/iptux/ShareFile.cpp:169 msgid "Clear Password" msgstr "Clear Password" #: src/iptux/ShareFile.cpp:172 msgid "Set Password" msgstr "Set Password" #: src/iptux/ShareFile.cpp:229 src/iptux/ShareFile.cpp:373 msgid "regular" msgstr "regular" #: src/iptux/ShareFile.cpp:233 src/iptux/ShareFile.cpp:377 msgid "directory" msgstr "directory" #: src/iptux/ShareFile.cpp:237 src/iptux/ShareFile.cpp:381 msgid "unknown" msgstr "unknown" #: src/iptux/ShareFile.cpp:270 msgid "File" msgstr "" #: src/iptux/ShareFile.cpp:286 msgid "Type" msgstr "" #: src/iptux/ShareFile.cpp:411 msgid "Choose the files to share" msgstr "" #: src/iptux/ShareFile.cpp:414 msgid "Choose the folders to share" msgstr "" #: src/iptux/TransWindow.cpp:86 msgid "Files Transmission Management" msgstr "" #: src/iptux/TransWindow.cpp:241 msgid "State" msgstr "" #: src/iptux/TransWindow.cpp:247 msgid "Task" msgstr "" #: src/iptux/TransWindow.cpp:253 msgid "Peer" msgstr "" #: src/iptux/TransWindow.cpp:265 msgid "Filename" msgstr "" #: src/iptux/TransWindow.cpp:277 msgid "Completed" msgstr "" #: src/iptux/TransWindow.cpp:284 msgid "Progress" msgstr "" #: src/iptux/TransWindow.cpp:291 msgid "Cost" msgstr "" #: src/iptux/TransWindow.cpp:297 msgid "Remaining" msgstr "" #: src/iptux/TransWindow.cpp:303 msgid "Rate" msgstr "" #: src/iptux/TransWindow.cpp:331 msgid "The path you want to open not exist!" msgstr "" #: src/iptux/TransWindow.cpp:405 msgid "The file you want to open not exist!" msgstr "" #: src/iptux/TransWindow.cpp:406 #, fuzzy msgid "iptux Error" msgstr "iptux" #: src/iptux/UiCoreThread.cpp:254 src/iptux/UiCoreThread.cpp:278 #: src/iptux/UiCoreThread.cpp:377 src/iptux/UiCoreThread.cpp:399 msgid "Others" msgstr "Others" #: src/iptux/UiCoreThread.cpp:419 msgid "Broadcast" msgstr "Broadcast" #: src/iptux/UiHelper.cpp:28 #, c-format msgid "Can't convert path to uri: %s, reason: %s" msgstr "" #: src/iptux/UiHelper.cpp:39 #, c-format msgid "Can't open path: %s, reason: %s" msgstr "" #: src/iptux/UiHelper.cpp:68 #, c-format msgid "Can't open URL: %s, reason: %s" msgstr "" #: src/iptux/UiHelper.cpp:188 #, fuzzy msgid "Information" msgstr "Infomation" #: src/iptux/UiHelper.cpp:218 msgid "Warning" msgstr "Warning" #: src/iptux/UiModels.cpp:604 #, fuzzy, c-format msgid "Version: %s" msgstr "Version: %s\n" #: src/iptux/UiModels.cpp:608 #, fuzzy, c-format msgid "Nickname: %s@%s" msgstr "Nickname: %s@%s\n" #: src/iptux/UiModels.cpp:611 #, fuzzy, c-format msgid "Nickname: %s" msgstr "Nickname: %s\n" #: src/iptux/UiModels.cpp:615 #, fuzzy, c-format msgid "User: %s" msgstr "User: %s\n" #: src/iptux/UiModels.cpp:618 #, fuzzy, c-format msgid "Host: %s" msgstr "Host: %s\n" #: src/iptux/UiModels.cpp:623 #, fuzzy, c-format msgid "Address: %s(%s)" msgstr "Address: %s(%s)\n" #: src/iptux/UiModels.cpp:625 #, fuzzy, c-format msgid "Address: %s" msgstr "Address: %s(%s)\n" #: src/iptux/UiModels.cpp:630 #, fuzzy msgid "Compatibility: Microsoft" msgstr "Compatibility: Microsoft\n" #: src/iptux/UiModels.cpp:632 #, fuzzy msgid "Compatibility: GNU/Linux" msgstr "Compatibility: GNU/Linux\n" #: src/iptux/UiModels.cpp:636 #, c-format msgid "System coding: %s" msgstr "" #: src/iptux/UiModels.cpp:641 msgid "Signature:" msgstr "" #: src/iptux/UiModels.cpp:744 msgid "" msgstr "" #: src/iptux/UiModels.cpp:799 msgid "[IMG]" msgstr "" #: src/iptux/dialog.cpp:39 msgid "" "File transfer has not been completed.\n" "Are you sure to cancel and quit?" msgstr "" #: src/iptux/dialog.cpp:42 msgid "Confirm Exit" msgstr "" #: src/iptux/dialog.cpp:62 src/iptux/resources/gtk/MainWindow.ui:12 #: src/iptux/resources/gtk/menus.ui:98 src/iptux/resources/gtk/menus.ui:243 msgid "Request Shared Resources" msgstr "" #: src/iptux/dialog.cpp:62 msgid "Agree" msgstr "Agree" #: src/iptux/dialog.cpp:78 #, c-format msgid "" "Your pal (%s)[%s]\n" "is requesting to get your shared resources,\n" "Do you agree?" msgstr "" #: src/iptux/dialog.cpp:106 msgid "Access Password" msgstr "" #: src/iptux/dialog.cpp:113 msgid "Please input the password for the shared files behind" msgstr "" #: src/iptux/dialog.cpp:127 #, c-format msgid "(%s)[%s]Password:" msgstr "" #: src/iptux/dialog.cpp:146 src/iptux/dialog.cpp:207 msgid "" "\n" "Empty Password!" msgstr "" #: src/iptux/dialog.cpp:170 msgid "Enter a New Password" msgstr "" #: src/iptux/dialog.cpp:178 msgid "Password: " msgstr "Password: " #: src/iptux/dialog.cpp:187 msgid "Repeat: " msgstr "Repeat: " #: src/iptux/dialog.cpp:202 msgid "" "\n" "Password Mismatched!" msgstr "" #: src/iptux/dialog.cpp:229 msgid "Please select a folder to save files." msgstr "" #: src/iptux/resources/gtk/AboutDialog.ui:11 msgid "" "Copyright © 2008–2009, Jally\n" "Copyright © 2013–2015,2017–2021, LI Daobing" msgstr "" #: src/iptux/resources/gtk/AboutDialog.ui:13 #, fuzzy msgid "A GTK based LAN messenger." msgstr "A GTK+ based LAN Messenger." #: src/iptux/resources/gtk/AppIndicator.ui:6 #, fuzzy msgid "Open Iptux" msgstr "iptux" #: src/iptux/resources/gtk/AppIndicator.ui:12 #: src/iptux/resources/gtk/menus.ui:6 src/iptux/resources/gtk/menus.ui:306 msgid "_Preferences" msgstr "" #: src/iptux/resources/gtk/AppIndicator.ui:16 #: src/iptux/resources/gtk/menus.ui:10 src/iptux/resources/gtk/menus.ui:310 msgid "_Quit" msgstr "_Quit" #: src/iptux/resources/gtk/DetectPal.ui:7 #, fuzzy msgid "Detect pal" msgstr "Detect" #: src/iptux/resources/gtk/DetectPal.ui:15 msgid "Detect" msgstr "Detect" #: src/iptux/resources/gtk/DetectPal.ui:61 msgid "Please input an IP address (IPv4 only):" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:8 src/iptux/resources/gtk/menus.ui:109 #: src/iptux/resources/gtk/menus.ui:254 msgid "Send Message" msgstr "Send Message" #: src/iptux/resources/gtk/MainWindow.ui:16 msgid "Change Info" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:20 msgid "Delete Pal" msgstr "Delete Pal" #: src/iptux/resources/gtk/MainWindow.ui:26 src/iptux/resources/gtk/menus.ui:31 #: src/iptux/resources/gtk/menus.ui:176 msgid "Sort" msgstr "Sort" #: src/iptux/resources/gtk/MainWindow.ui:29 src/iptux/resources/gtk/menus.ui:34 #: src/iptux/resources/gtk/menus.ui:179 msgid "By Nickname" msgstr "By Nickname" #: src/iptux/resources/gtk/MainWindow.ui:34 src/iptux/resources/gtk/menus.ui:39 #: src/iptux/resources/gtk/menus.ui:184 #, fuzzy msgid "By Username" msgstr "By Nickname" #: src/iptux/resources/gtk/MainWindow.ui:39 src/iptux/resources/gtk/menus.ui:44 #: src/iptux/resources/gtk/menus.ui:189 msgid "By IP" msgstr "By IP" #: src/iptux/resources/gtk/MainWindow.ui:44 src/iptux/resources/gtk/menus.ui:49 #: src/iptux/resources/gtk/menus.ui:194 msgid "By Host" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:49 src/iptux/resources/gtk/menus.ui:54 #: src/iptux/resources/gtk/menus.ui:199 msgid "By Last Activity" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:56 src/iptux/resources/gtk/menus.ui:61 #: src/iptux/resources/gtk/menus.ui:206 msgid "Ascending" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:61 src/iptux/resources/gtk/menus.ui:66 #: src/iptux/resources/gtk/menus.ui:211 msgid "Descending" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:68 msgid "Info Style" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:71 #, fuzzy msgid "IP" msgstr "IPv4" #: src/iptux/resources/gtk/MainWindow.ui:76 msgid "IP:PORT" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:86 msgid "Username" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:91 #, fuzzy msgid "Version" msgstr "Version: %s\n" #: src/iptux/resources/gtk/MainWindow.ui:96 msgid "Last Activity" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:101 #, fuzzy msgid "Last Message" msgstr "Send Message" #: src/iptux/resources/gtk/menus.ui:17 src/iptux/resources/gtk/menus.ui:162 msgid "_File" msgstr "_File" #: src/iptux/resources/gtk/menus.ui:19 src/iptux/resources/gtk/menus.ui:164 msgid "_Detect" msgstr "_Detect" #: src/iptux/resources/gtk/menus.ui:23 src/iptux/resources/gtk/menus.ui:168 msgid "_Find" msgstr "_Find" #: src/iptux/resources/gtk/menus.ui:28 src/iptux/resources/gtk/menus.ui:173 msgid "_View" msgstr "" #: src/iptux/resources/gtk/menus.ui:73 src/iptux/resources/gtk/menus.ui:218 msgid "_Refresh" msgstr "" #: src/iptux/resources/gtk/menus.ui:80 src/iptux/resources/gtk/menus.ui:225 msgid "_Chat" msgstr "" #: src/iptux/resources/gtk/menus.ui:88 src/iptux/resources/gtk/menus.ui:233 msgid "Attach File" msgstr "" #: src/iptux/resources/gtk/menus.ui:92 src/iptux/resources/gtk/menus.ui:237 msgid "Attach Folder" msgstr "" #: src/iptux/resources/gtk/menus.ui:102 src/iptux/resources/gtk/menus.ui:247 #, fuzzy msgid "Clear Chat History" msgstr "Clear Tasklist" #: src/iptux/resources/gtk/menus.ui:115 src/iptux/resources/gtk/menus.ui:260 msgid "_Window" msgstr "" #: src/iptux/resources/gtk/menus.ui:118 src/iptux/resources/gtk/menus.ui:263 msgid "_Transmission" msgstr "" #: src/iptux/resources/gtk/menus.ui:122 src/iptux/resources/gtk/menus.ui:267 msgid "_Shared Management" msgstr "" #: src/iptux/resources/gtk/menus.ui:126 src/iptux/resources/gtk/menus.ui:271 msgid "_Chat Log" msgstr "" #: src/iptux/resources/gtk/menus.ui:130 src/iptux/resources/gtk/menus.ui:275 #, fuzzy msgid "_System Log" msgstr "System" #: src/iptux/resources/gtk/menus.ui:136 src/iptux/resources/gtk/menus.ui:281 msgid "Close Window" msgstr "" #: src/iptux/resources/gtk/menus.ui:142 src/iptux/resources/gtk/menus.ui:287 msgid "_Help" msgstr "_Help" #: src/iptux/resources/gtk/menus.ui:145 src/iptux/resources/gtk/menus.ui:290 msgid "_About" msgstr "" #: src/iptux/resources/gtk/menus.ui:149 src/iptux/resources/gtk/menus.ui:294 msgid "Report Bug" msgstr "" #: src/iptux/resources/gtk/menus.ui:153 src/iptux/resources/gtk/menus.ui:298 msgid "What's New" msgstr "" #: src/iptux/resources/gtk/menus.ui:318 msgid "Open This File" msgstr "" #: src/iptux/resources/gtk/menus.ui:322 msgid "Open Containing Folder" msgstr "" #: src/iptux/resources/gtk/menus.ui:326 msgid "Terminate Task" msgstr "" #: src/iptux/resources/gtk/menus.ui:330 msgid "Terminate All" msgstr "Terminate All" #: src/iptux/resources/gtk/menus.ui:334 msgid "Clear Tasklist" msgstr "Clear Tasklist" #: src/iptux/resources/gtk/menus.ui:346 #, fuzzy msgid "Refuse All" msgstr "Refuse" #: src/main/iptux.cpp:149 msgid "- A software for sharing in LAN" msgstr "" #: src/main/iptux.cpp:152 #, c-format msgid "option parsing failed: %s\n" msgstr "" #, fuzzy #~ msgid "Close Chat" #~ msgstr "Close" #~ msgid "Sound" #~ msgstr "Sound" #~ msgid "Volume Control: " #~ msgstr "Volume Control: " #~ msgid "Sound Event" #~ msgstr "Sound Event" #~ msgid "Stop" #~ msgstr "Stop" #~ msgid "Play" #~ msgstr "Play" #~ msgid "Event" #~ msgstr "Event" #~ msgid "_Hide" #~ msgstr "_Hide" #~ msgid "_Show" #~ msgstr "_Show" #~ msgid "_Tools" #~ msgstr "_Tools" #~ msgid "Error" #~ msgstr "Error" #, fuzzy #~ msgid "iptux-icon" #~ msgstr "iptux" #~ msgid "..." #~ msgstr "..." #~ msgid "Clear Buffer" #~ msgstr "Clear Buffer" #, fuzzy #~ msgid "Contributors" #~ msgstr "Contributers" #, fuzzy #~ msgid "" #~ "Fatal Error!!\n" #~ "Failed to bind the TCP/UDP port(%d)!\n" #~ "%s" #~ msgstr "" #~ "Fatal Error!!\n" #~ "Failed to create new socket!\n" #~ "%s" #~ msgid "Help" #~ msgstr "Help" #~ msgid "_More" #~ msgstr "_More" #~ msgid "_Update" #~ msgstr "_Update" #~ msgid "The user is not privileged!\n" #~ msgstr "The user is not privileged!\n" iptux-0.9.4/po/es.po000066400000000000000000001133151475473122500143000ustar00rootroot00000000000000# Spanish translation for iptux # Copyright (c) 2009 Rosetta Contributors and Canonical Ltd 2009 # This file is distributed under the same license as the iptux package. # FIRST AUTHOR , 2009. # msgid "" msgstr "" "Project-Id-Version: iptux\n" "Report-Msgid-Bugs-To: https://github.com/iptux-src/iptux/issues/new\n" "POT-Creation-Date: 2025-02-17 13:35-0800\n" "PO-Revision-Date: 2024-05-11 08:00+0000\n" "Last-Translator: gallegonovato \n" "Language-Team: Spanish \n" "Language: es\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" "X-Generator: Weblate 5.5.4\n" "X-Launchpad-Export-Date: 2010-04-01 12:32+0000\n" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:6 msgid "iptux" msgstr "iptux" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:7 msgid "LAN communication software" msgstr "Software de comunicación LAN" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:17 msgid "iptux is an “IP Messenger” client. The features of iptux include:" msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:21 msgid "auto-detect other clients on the intranet." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:22 msgid "send/recv messages to other clients." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:23 msgid "send/recv files to other clients." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:24 msgid "share your files to other cliens (with optional password protection)." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:26 msgid "" "It is (supposedly) compatible with 飞鸽传书 (Feige) and 飞秋 (FeiQ) from " "China, and with the original “IP Messenger” clients from Japan, including " "g2ipmsg and xipmsg in Debian." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:38 msgid "The Iptux main window." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:42 msgid "The Iptux chat window." msgstr "" #: src/iptux-core/CoreThread.cpp:172 #, fuzzy, c-format msgid "" "Fatal Error!! Failed to create new socket!\n" "%s" msgstr "" "Error Fatal!!\n" "Falló al crear el socket!\n" "%s" #: src/iptux-core/CoreThread.cpp:188 #, fuzzy, c-format msgid "" "Fatal Error!! Failed to bind the TCP port(%s:%d)!\n" "%s" msgstr "" "Error Fatal!!\n" "No se puede enlazar el puerto TCP/UDP (2425)!\n" "%s" #: src/iptux-core/CoreThread.cpp:201 #, fuzzy, c-format msgid "" "Fatal Error!! Failed to bind the UDP port(%s:%d)!\n" "%s" msgstr "" "Error Fatal!!\n" "No se puede enlazar el puerto TCP/UDP (2425)!\n" "%s" #: src/iptux-core/CoreThread.cpp:461 src/iptux-core/CoreThread.cpp:495 #: src/iptux-core/internal/RecvFileData.cpp:142 #: src/iptux-core/internal/RecvFileData.cpp:204 #, c-format msgid "" "Fatal Error!!\n" "Failed to create new socket!\n" "%s" msgstr "" "Error Fatal!!\n" "Falló al crear el socket!\n" "%s" #: src/iptux-core/Models.cpp:172 #, fuzzy msgid "Empty Message" msgstr "Enviar Mensaje" #: src/iptux-core/Models.cpp:250 #, fuzzy msgid "Received an image" msgstr "Administrador de Archivos Recibidos" #: src/iptux-core/internal/AnalogFS.cpp:93 #: src/iptux-core/internal/AnalogFS.cpp:98 #, c-format msgid "Open() file \"%s\" failed, %s" msgstr "Open() archivo \"%s\" fallo, %s" #: src/iptux-core/internal/AnalogFS.cpp:117 #, c-format msgid "Stat64() file \"%s\" failed, %s" msgstr "Stat64() archivo \"%s\" fallo, %s" #: src/iptux-core/internal/AnalogFS.cpp:138 #, c-format msgid "Mkdir() directory \"%s\" failed, %s" msgstr "Mkdir() directorio \"%s\" fallo, %s" #: src/iptux-core/internal/AnalogFS.cpp:164 #, c-format msgid "Opendir() directory \"%s\" failed, %s" msgstr "Opendir() directorio \"%s\" fallo, %s" #: src/iptux-core/internal/Command.cpp:226 msgid "Your pal didn't receive the packet. He or she is offline maybe." msgstr "Su amigo no recibió el mensaje. El o ella quizás está desconectado." #: src/iptux-core/internal/CommandMode.cpp:39 #, c-format msgid "unknown command mode: %d" msgstr "" #: src/iptux-core/internal/RecvFileData.cpp:117 msgid "receive" msgstr "recibir" #: src/iptux-core/internal/RecvFileData.cpp:124 #: src/iptux-core/internal/RecvFileData.cpp:253 #: src/iptux-core/internal/SendFileData.cpp:108 #: src/iptux-core/internal/SendFileData.cpp:193 #, fuzzy msgid "Unknown" msgstr "desconocido" #: src/iptux-core/internal/RecvFileData.cpp:175 #, c-format msgid "" "Failed to receive the file \"%s\" from %s! expect length %jd, received %jd" msgstr "" "¡Error al recibir el fichero \"%s\" desde %s y un tamaño de la descarga " "esperada %jd, y se ha recibido %jd ¡" #: src/iptux-core/internal/RecvFileData.cpp:180 #, c-format msgid "Receive the file \"%s\" from %s successfully!" msgstr "¡Recibido correctamente el archivo \"%s\" desde %s !" #: src/iptux-core/internal/RecvFileData.cpp:320 #, c-format msgid "Failed to receive the directory \"%s\" from %s!" msgstr "¡Fallo al recibir el directorio \"%s\" desde %s!" #: src/iptux-core/internal/RecvFileData.cpp:323 #, c-format msgid "Receive the directory \"%s\" from %s successfully!" msgstr "¡Recibido correctamente el directorio \"%s\" desde %s !" #: src/iptux-core/internal/SendFileData.cpp:101 msgid "send" msgstr "enviar" #: src/iptux-core/internal/SendFileData.cpp:137 #, c-format msgid "Failed to send the file \"%s\" to %s!" msgstr "Fallo al enviar el archivo \"%s\" a %s!" #: src/iptux-core/internal/SendFileData.cpp:142 #, c-format msgid "Send the file \"%s\" to %s successfully!" msgstr "Envío correcto del archivo \"%s\" a %s !" #: src/iptux-core/internal/SendFileData.cpp:265 #, c-format msgid "Failed to send the directory \"%s\" to %s!" msgstr "Fallo al enviar el directorio \"%s\" a %s!" #: src/iptux-core/internal/SendFileData.cpp:270 #, c-format msgid "Send the directory \"%s\" to %s successfully!" msgstr "Envío correcto del directorio \"%s\" a %s !" #: src/iptux-core/internal/UdpData.cpp:92 #: src/iptux-core/internal/UdpData.cpp:93 #: src/iptux-core/internal/UdpData.cpp:443 #: src/iptux-core/internal/UdpData.cpp:484 msgid "mysterious" msgstr "misterioso" #: src/iptux-utils/utils.cpp:880 #, fuzzy, c-format msgid "stat file \"%s\" failed: %s" msgstr "Stat() archivo \"%s\" fallo, %s\n" #: src/iptux-utils/utils.cpp:888 #, c-format msgid "path %s is not file or directory: st_mode(%x)" msgstr "" #: src/iptux-utils/utils.cpp:895 #, fuzzy, c-format msgid "opendir on \"%s\" failed: %s" msgstr "Opendir() directorio \"%s\" fallo, %s" #: src/iptux/AboutDialog.cpp:39 msgid "TRANSLATOR NAME" msgstr "" #: src/iptux/AboutDialog.cpp:53 msgid "Thanks to" msgstr "" #: src/iptux/AppIndicator.cpp:40 src/iptux/MainWindow.cpp:505 #: src/iptux/MainWindow.cpp:507 #, fuzzy msgid "Iptux" msgstr "iptux" #: src/iptux/Application.cpp:54 msgid "Loading the process successfully!" msgstr "Cargando el proceso correctamente!" #: src/iptux/Application.cpp:274 #, c-format msgid "New Message from %s" msgstr "" #: src/iptux/Application.cpp:287 #, c-format msgid "New File from %s" msgstr "" #: src/iptux/Application.cpp:296 msgid "Receiving File Finished" msgstr "" #: src/iptux/Application.cpp:300 msgid "file info no longer exist" msgstr "" #: src/iptux/Darwin.cpp:16 #, c-format msgid "Couldn’t load icon: %s" msgstr "" #: src/iptux/DataSettings.cpp:46 msgid "Personal" msgstr "Personal" #: src/iptux/DataSettings.cpp:48 msgid "System" msgstr "Sistema" #: src/iptux/DataSettings.cpp:50 msgid "Network" msgstr "Red" #: src/iptux/DataSettings.cpp:89 src/iptux/DataSettings.cpp:98 msgid "The program needs to be restarted to take effect!" msgstr "" #: src/iptux/DataSettings.cpp:143 msgid "Preferences" msgstr "Preferencias" #: src/iptux/DataSettings.cpp:143 src/iptux/RevisePal.cpp:109 #: src/iptux/dialog.cpp:107 src/iptux/dialog.cpp:170 #, fuzzy msgid "_OK" msgstr "Aceptar" #: src/iptux/DataSettings.cpp:144 #, fuzzy msgid "_Apply" msgstr "Aplicar" #: src/iptux/DataSettings.cpp:144 src/iptux/DataSettings.cpp:1348 #: src/iptux/DataSettings.cpp:1395 src/iptux/DialogBase.cpp:359 #: src/iptux/DialogBase.cpp:918 src/iptux/RevisePal.cpp:110 #: src/iptux/ShareFile.cpp:419 src/iptux/callback.cpp:87 #: src/iptux/dialog.cpp:171 src/iptux/dialog.cpp:230 #, fuzzy msgid "_Cancel" msgstr "Cancelar" #: src/iptux/DataSettings.cpp:169 #, fuzzy msgid "Your _nickname:" msgstr "Su apodo:" #: src/iptux/DataSettings.cpp:176 msgid "Please input your nickname!" msgstr "Por favor ingrese su apodo!" #: src/iptux/DataSettings.cpp:182 #, fuzzy msgid "Your _group name:" msgstr "Su grupo:" #: src/iptux/DataSettings.cpp:189 msgid "Please input your group name!" msgstr "Por favor ingrese su grupo!" #: src/iptux/DataSettings.cpp:195 #, fuzzy msgid "Your _face picture:" msgstr "Su imagen:" #: src/iptux/DataSettings.cpp:213 #, fuzzy msgid "_Save files to: " msgstr "Guardar archivo en: " #: src/iptux/DataSettings.cpp:226 msgid "Photo" msgstr "Foto" #: src/iptux/DataSettings.cpp:238 msgid "Signature" msgstr "Firma" #: src/iptux/DataSettings.cpp:271 msgid "Port:" msgstr "" #: src/iptux/DataSettings.cpp:278 msgid "Any port number between 1024 and 65535, default is 2425" msgstr "" #: src/iptux/DataSettings.cpp:287 #, fuzzy msgid "Candidate network encodings:" msgstr "Codificación de red Candidata:" #: src/iptux/DataSettings.cpp:294 #, fuzzy msgid "Candidate network encodings, separated by \",\"" msgstr "Codificación de red Candidata:" #: src/iptux/DataSettings.cpp:301 #, fuzzy msgid "Preferred network encoding:" msgstr "Codificación de red Preferida:" #: src/iptux/DataSettings.cpp:308 msgid "" "Preference network coding (You should be aware of what you are doing if you " "want to modify it.)" msgstr "" "Codificación de red Preferida (Ud. debe saber lo que está por hacer si desea " "modificar ésta opción)" #: src/iptux/DataSettings.cpp:316 msgid "Pal's default face picture:" msgstr "Imagen por defecto de amigos:" #: src/iptux/DataSettings.cpp:334 msgid "Panel font:" msgstr "Fuente:" #: src/iptux/DataSettings.cpp:346 msgid "Automatically open the chat dialog" msgstr "Abrir automáticamente la ventana de chat" #: src/iptux/DataSettings.cpp:354 msgid "Automatically hide the panel after login" msgstr "Ocultar automáticamente el panel después de ingresar" #: src/iptux/DataSettings.cpp:362 msgid "Automatically open the File Transmission Management" msgstr "Abrir automáticamente el Administrador de Transferencias" #: src/iptux/DataSettings.cpp:370 msgid "Use the 'Enter' key to send message" msgstr "Usar la tecla 'Enter' para enviar mensaje" #: src/iptux/DataSettings.cpp:378 msgid "Automatically clean up the chat history" msgstr "Limpiar automáticamente el historial" #: src/iptux/DataSettings.cpp:385 msgid "Save the chat history" msgstr "Guardar el historial" #: src/iptux/DataSettings.cpp:393 msgid "Use the Blacklist (NOT recommended)" msgstr "Usar Blacklist (NO recomendado)" #: src/iptux/DataSettings.cpp:401 msgid "Filter the request of sharing files" msgstr "Filtrar pedido de archivos compartidos" #: src/iptux/DataSettings.cpp:408 msgid "Hide the taskbar when the main window is minimized" msgstr "" #: src/iptux/DataSettings.cpp:432 msgid "From:" msgstr "Desde:" #: src/iptux/DataSettings.cpp:438 msgid "Beginning of the IP(v4) section" msgstr "Comienzo de la sección IP (v4)" #: src/iptux/DataSettings.cpp:442 msgid "To:" msgstr "Para:" #: src/iptux/DataSettings.cpp:448 msgid "End of the IP(v4) section" msgstr "Fin de sección IP(v4):" #: src/iptux/DataSettings.cpp:456 msgid "Add" msgstr "Agregar" #: src/iptux/DataSettings.cpp:461 msgid "Delete" msgstr "Eliminar" #: src/iptux/DataSettings.cpp:468 msgid "Added IP(v4) Section:" msgstr "Secciones IP(v4) agregadas:" #: src/iptux/DataSettings.cpp:487 msgid "Import" msgstr "Importar" #: src/iptux/DataSettings.cpp:491 msgid "Export" msgstr "Exportar" #: src/iptux/DataSettings.cpp:495 src/iptux/TransWindow.cpp:171 msgid "Clear" msgstr "Limpiar" #: src/iptux/DataSettings.cpp:706 msgid "From" msgstr "Desde" #: src/iptux/DataSettings.cpp:713 msgid "To" msgstr "Hasta" #: src/iptux/DataSettings.cpp:720 msgid "Description" msgstr "Descripción" #: src/iptux/DataSettings.cpp:736 msgid "Please select download folder" msgstr "Por favor seleccione el directorio de descarga" #: src/iptux/DataSettings.cpp:758 msgid "Select Font" msgstr "Seleccionar tipografía" #: src/iptux/DataSettings.cpp:872 src/iptux/DataSettings.cpp:874 #: src/iptux/DataSettings.cpp:878 msgid "Port must be a number between 1024 and 65535" msgstr "" #: src/iptux/DataSettings.cpp:1019 src/iptux/DataSettings.cpp:1050 #, c-format msgid "" "Fopen() file \"%s\" failed!\n" "%s" msgstr "" "Fopen() archivo \"%s\" fallo!\n" "%s" #: src/iptux/DataSettings.cpp:1150 src/iptux/RevisePal.cpp:419 msgid "Please select a face picture" msgstr "Por favor seleccione una imagen" #: src/iptux/DataSettings.cpp:1172 msgid "Please select a personal photo" msgstr "Por favor seleccione una foto personal" #: src/iptux/DataSettings.cpp:1241 src/iptux/DataSettings.cpp:1248 #: src/iptux/DetectPal.cpp:75 #, c-format msgid "" "\n" "Illegal IP(v4) address: %s!" msgstr "" "\n" "Dirección IP(v4) inválida: %s!" #: src/iptux/DataSettings.cpp:1346 msgid "Please select a file to import data" msgstr "Seleccione un archivo para importar" #: src/iptux/DataSettings.cpp:1347 src/iptux/DialogBase.cpp:358 #: src/iptux/ShareFile.cpp:418 src/iptux/callback.cpp:86 msgid "_Open" msgstr "" #: src/iptux/DataSettings.cpp:1394 msgid "Save data to file" msgstr "Guardar datos a un archivo" #: src/iptux/DataSettings.cpp:1395 src/iptux/DialogBase.cpp:919 #: src/iptux/dialog.cpp:231 msgid "_Save" msgstr "" #: src/iptux/DetectPal.cpp:70 #, c-format msgid "The notification has been sent to %s." msgstr "Una notificación ha sido enviada a %s." #: src/iptux/DialogBase.cpp:214 #, c-format msgid "%s To Send." msgstr "" #: src/iptux/DialogBase.cpp:272 msgid "Close" msgstr "Cerrar" #: src/iptux/DialogBase.cpp:276 src/iptux/DialogGroup.cpp:375 msgid "Send" msgstr "Enviar" #: src/iptux/DialogBase.cpp:307 msgid "Chat History" msgstr "Historial de Charlas" #: src/iptux/DialogBase.cpp:350 msgid "Choose enclosure files" msgstr "Elegir archivos anexos" #: src/iptux/DialogBase.cpp:353 msgid "Choose enclosure folders" msgstr "Elegir directorios anexos" #: src/iptux/DialogBase.cpp:593 #, fuzzy msgid "Remove Selected" msgstr "Selección Reversa" #: src/iptux/DialogBase.cpp:648 msgid "File to send." msgstr "" #: src/iptux/DialogBase.cpp:653 msgid "Sending progress." msgstr "" #: src/iptux/DialogBase.cpp:656 msgid "Dirs" msgstr "" #: src/iptux/DialogBase.cpp:659 #, fuzzy msgid "Files" msgstr "Archivo" #: src/iptux/DialogBase.cpp:662 src/iptux/DialogPeer.cpp:565 msgid "Detail" msgstr "" #: src/iptux/DialogBase.cpp:712 #, fuzzy msgid "PeerName" msgstr "Compañero" #: src/iptux/DialogBase.cpp:719 src/iptux/DialogPeer.cpp:716 msgid "Name" msgstr "" #: src/iptux/DialogBase.cpp:725 src/iptux/DialogPeer.cpp:652 #: src/iptux/DialogPeer.cpp:722 src/iptux/ShareFile.cpp:280 #: src/iptux/TransWindow.cpp:271 msgid "Size" msgstr "Tamaño" #: src/iptux/DialogBase.cpp:731 msgid "Path" msgstr "" #: src/iptux/DialogBase.cpp:792 #, fuzzy msgid "Sending Progress." msgstr "Progreso" #: src/iptux/DialogBase.cpp:795 #, c-format msgid "%s of %s Sent." msgstr "" #: src/iptux/DialogBase.cpp:802 src/iptux/DialogPeer.cpp:835 #, fuzzy msgid "Mission Completed!" msgstr "Completo" #: src/iptux/DialogBase.cpp:845 src/iptux/DialogBase.cpp:917 msgid "Save Image" msgstr "" #: src/iptux/DialogBase.cpp:850 msgid "Copy Image" msgstr "" #: src/iptux/DialogGroup.cpp:285 msgid "Member" msgstr "Miembro" #: src/iptux/DialogGroup.cpp:382 msgid "Pals" msgstr "Amigos" #: src/iptux/DialogGroup.cpp:480 msgid "Select All" msgstr "Seleccionar Todo" #: src/iptux/DialogGroup.cpp:485 msgid "Reverse Select" msgstr "Selección Reversa" #: src/iptux/DialogGroup.cpp:490 msgid "Clear Up" msgstr "Limpiar" #: src/iptux/DialogGroup.cpp:728 #, c-format msgid "Talk with the group %s" msgstr "Hablar con el grupo %s" #: src/iptux/DialogPeer.cpp:132 #, fuzzy, c-format msgid "Talk with %s(%s) IP:%s" msgstr "Charla con %s" #: src/iptux/DialogPeer.cpp:305 msgid "Info." msgstr "Información." #: src/iptux/DialogPeer.cpp:337 #, c-format msgid "Version: %s\n" msgstr "Versión: %s\n" #: src/iptux/DialogPeer.cpp:339 #, c-format msgid "Nickname: %s@%s\n" msgstr "Apodo: %s@%s\n" #: src/iptux/DialogPeer.cpp:342 #, c-format msgid "Nickname: %s\n" msgstr "Apodo: %s\n" #: src/iptux/DialogPeer.cpp:344 #, c-format msgid "User: %s\n" msgstr "Usuario: %s\n" #: src/iptux/DialogPeer.cpp:345 #, c-format msgid "Host: %s\n" msgstr "Equipo: %s\n" #: src/iptux/DialogPeer.cpp:348 #, c-format msgid "Address: %s(%s)\n" msgstr "Dirección: %s(%s)\n" #: src/iptux/DialogPeer.cpp:350 #, c-format msgid "Address: %s\n" msgstr "Dirección: %s\n" #: src/iptux/DialogPeer.cpp:353 msgid "Compatibility: Microsoft\n" msgstr "Compatibilidad: Micro$oft\n" #: src/iptux/DialogPeer.cpp:355 msgid "Compatibility: GNU/Linux\n" msgstr "Compatibilidad: GNU/Linux\n" #: src/iptux/DialogPeer.cpp:357 #, c-format msgid "System coding: %s\n" msgstr "Codificación del Sistema: %s\n" #: src/iptux/DialogPeer.cpp:362 msgid "Signature:\n" msgstr "Firma:\n" #: src/iptux/DialogPeer.cpp:369 msgid "" "\n" "Photo:\n" msgstr "" "\n" "Foto:\n" #: src/iptux/DialogPeer.cpp:460 msgid "Please select a picture to insert the buffer" msgstr "Seleccione una imagen para insertar en la conversación" #: src/iptux/DialogPeer.cpp:486 src/iptux/resources/gtk/menus.ui:83 #: src/iptux/resources/gtk/menus.ui:228 #, fuzzy msgid "Insert Image" msgstr "Insertar Imagen" #: src/iptux/DialogPeer.cpp:502 #, fuzzy msgid "Enclosure." msgstr "Anexo" #: src/iptux/DialogPeer.cpp:547 #, fuzzy msgid "Files to be received" msgstr "Mensaje recibido" #: src/iptux/DialogPeer.cpp:551 msgid "Receiving progress." msgstr "" #: src/iptux/DialogPeer.cpp:554 msgid "Accept" msgstr "Aceptar" #: src/iptux/DialogPeer.cpp:560 src/iptux/dialog.cpp:63 #: src/iptux/resources/gtk/menus.ui:342 msgid "Refuse" msgstr "Rechazar" #: src/iptux/DialogPeer.cpp:596 #, fuzzy msgid "File received." msgstr "Mensaje recibido" #: src/iptux/DialogPeer.cpp:639 src/iptux/DialogPeer.cpp:710 msgid "Source" msgstr "Origen" #: src/iptux/DialogPeer.cpp:646 msgid "SaveAs" msgstr "" #: src/iptux/DialogPeer.cpp:818 src/iptux/DialogPeer.cpp:884 msgid "Receiving Progress." msgstr "" #: src/iptux/DialogPeer.cpp:821 src/iptux/DialogPeer.cpp:887 #, c-format msgid "%s to Receive." msgstr "" #: src/iptux/DialogPeer.cpp:825 src/iptux/DialogPeer.cpp:891 #, c-format msgid "%s Of %s Received." msgstr "" #: src/iptux/LogSystem.cpp:71 #, c-format msgid "Recevied-From: Nickname:%s User:%s Host:%s" msgstr "Recibido-De: Apodo:%s Usuario:%s Equipo:%s" #: src/iptux/LogSystem.cpp:76 #, c-format msgid "Send-To: Nickname:%s User:%s Host:%s" msgstr "Enviado: Apodo:%s Usuario:%s Equipo:%s" #: src/iptux/LogSystem.cpp:80 msgid "Send-Broadcast" msgstr "Difusión" #: src/iptux/LogSystem.cpp:99 #, c-format msgid "User:%s Host:%s" msgstr "Usuario:%s Equipo:%s" #: src/iptux/MainWindow.cpp:570 msgid "Pals Online: 0" msgstr "Amigos En Linea: 0" #: src/iptux/MainWindow.cpp:655 msgid "Search Pals" msgstr "Buscar Amigos" #: src/iptux/MainWindow.cpp:768 msgid "Nickname" msgstr "Apodo" #: src/iptux/MainWindow.cpp:778 msgid "Group" msgstr "Grupo" #: src/iptux/MainWindow.cpp:784 src/iptux/TransWindow.cpp:258 msgid "IPv4" msgstr "IPv4" #: src/iptux/MainWindow.cpp:790 msgid "User" msgstr "Usuario" #: src/iptux/MainWindow.cpp:796 src/iptux/resources/gtk/MainWindow.ui:81 msgid "Host" msgstr "Equipo" #: src/iptux/MainWindow.cpp:935 #, fuzzy, c-format msgid "Pals Online: %d" msgstr "Amigos En Linea: 0" #: src/iptux/RevisePal.cpp:109 msgid "Change Pal's Information" msgstr "Cambiar Información del Amigo" #: src/iptux/RevisePal.cpp:134 msgid "Pal's nickname:" msgstr "Apodo de amigo:" #: src/iptux/RevisePal.cpp:140 msgid "Please input pal's new nickname!" msgstr "Por favor ingrese nuevo apodo del amigo!" #: src/iptux/RevisePal.cpp:146 msgid "Pal's group name:" msgstr "Nombre de grupo del amigo:" #: src/iptux/RevisePal.cpp:152 msgid "Please input pal's new group name!" msgstr "Por favor ingrese un nuevo nombre de grupo del amigo!" #: src/iptux/RevisePal.cpp:158 msgid "System coding:" msgstr "Codificación del Sistema:" #: src/iptux/RevisePal.cpp:164 msgid "Be SURE to know what you are doing!" msgstr "Esté SEGURO de saber lo que va a hacer!" #: src/iptux/RevisePal.cpp:170 msgid "Pal's face picture:" msgstr "Imagen del amigo" #: src/iptux/RevisePal.cpp:184 msgid "Be compatible with iptux's protocol (DANGEROUS)" msgstr "Ser compatible con el protocolo iptux's (PELIGROSO)" #: src/iptux/ShareFile.cpp:104 msgid "Shared Files Management" msgstr "Administrador de Archivos Compartidos" #: src/iptux/ShareFile.cpp:105 msgid "OK" msgstr "Aceptar" #: src/iptux/ShareFile.cpp:106 msgid "Apply" msgstr "Aplicar" #: src/iptux/ShareFile.cpp:107 msgid "Cancel" msgstr "Cancelar" #: src/iptux/ShareFile.cpp:160 msgid "Add Files" msgstr "Añadir archivos" #: src/iptux/ShareFile.cpp:163 msgid "Add Folders" msgstr "Añadir directorios" #: src/iptux/ShareFile.cpp:166 msgid "Delete Resources" msgstr "Eliminar Recursos" #: src/iptux/ShareFile.cpp:169 msgid "Clear Password" msgstr "Limpiar Clave" #: src/iptux/ShareFile.cpp:172 msgid "Set Password" msgstr "Establecer clave" #: src/iptux/ShareFile.cpp:229 src/iptux/ShareFile.cpp:373 msgid "regular" msgstr "regular" #: src/iptux/ShareFile.cpp:233 src/iptux/ShareFile.cpp:377 msgid "directory" msgstr "directorio" #: src/iptux/ShareFile.cpp:237 src/iptux/ShareFile.cpp:381 msgid "unknown" msgstr "desconocido" #: src/iptux/ShareFile.cpp:270 msgid "File" msgstr "Archivo" #: src/iptux/ShareFile.cpp:286 msgid "Type" msgstr "Tipo" #: src/iptux/ShareFile.cpp:411 msgid "Choose the files to share" msgstr "Elegir los archivos para compartir" #: src/iptux/ShareFile.cpp:414 msgid "Choose the folders to share" msgstr "Elegir los directorios para compartir" #: src/iptux/TransWindow.cpp:86 msgid "Files Transmission Management" msgstr "Administrador de Transferencias" #: src/iptux/TransWindow.cpp:241 msgid "State" msgstr "Estado" #: src/iptux/TransWindow.cpp:247 msgid "Task" msgstr "Tarea" #: src/iptux/TransWindow.cpp:253 msgid "Peer" msgstr "Compañero" #: src/iptux/TransWindow.cpp:265 msgid "Filename" msgstr "Nombre de archivo" #: src/iptux/TransWindow.cpp:277 msgid "Completed" msgstr "Completo" #: src/iptux/TransWindow.cpp:284 msgid "Progress" msgstr "Progreso" #: src/iptux/TransWindow.cpp:291 msgid "Cost" msgstr "Costo" #: src/iptux/TransWindow.cpp:297 msgid "Remaining" msgstr "Restante" #: src/iptux/TransWindow.cpp:303 msgid "Rate" msgstr "Tasa" #: src/iptux/TransWindow.cpp:331 msgid "The path you want to open not exist!" msgstr "" #: src/iptux/TransWindow.cpp:405 msgid "The file you want to open not exist!" msgstr "" #: src/iptux/TransWindow.cpp:406 #, fuzzy msgid "iptux Error" msgstr "Error" #: src/iptux/UiCoreThread.cpp:254 src/iptux/UiCoreThread.cpp:278 #: src/iptux/UiCoreThread.cpp:377 src/iptux/UiCoreThread.cpp:399 msgid "Others" msgstr "Otros" #: src/iptux/UiCoreThread.cpp:419 msgid "Broadcast" msgstr "Difusión" #: src/iptux/UiHelper.cpp:28 #, c-format msgid "Can't convert path to uri: %s, reason: %s" msgstr "" #: src/iptux/UiHelper.cpp:39 #, c-format msgid "Can't open path: %s, reason: %s" msgstr "" #: src/iptux/UiHelper.cpp:68 #, c-format msgid "Can't open URL: %s, reason: %s" msgstr "" #: src/iptux/UiHelper.cpp:188 #, fuzzy msgid "Information" msgstr "Información" #: src/iptux/UiHelper.cpp:218 msgid "Warning" msgstr "Aviso" #: src/iptux/UiModels.cpp:604 #, fuzzy, c-format msgid "Version: %s" msgstr "Versión: %s\n" #: src/iptux/UiModels.cpp:608 #, fuzzy, c-format msgid "Nickname: %s@%s" msgstr "Apodo: %s@%s\n" #: src/iptux/UiModels.cpp:611 #, fuzzy, c-format msgid "Nickname: %s" msgstr "Apodo: %s\n" #: src/iptux/UiModels.cpp:615 #, fuzzy, c-format msgid "User: %s" msgstr "Usuario: %s\n" #: src/iptux/UiModels.cpp:618 #, fuzzy, c-format msgid "Host: %s" msgstr "Equipo: %s\n" #: src/iptux/UiModels.cpp:623 #, fuzzy, c-format msgid "Address: %s(%s)" msgstr "Dirección: %s(%s)\n" #: src/iptux/UiModels.cpp:625 #, fuzzy, c-format msgid "Address: %s" msgstr "Dirección: %s\n" #: src/iptux/UiModels.cpp:630 #, fuzzy msgid "Compatibility: Microsoft" msgstr "Compatibilidad: Micro$oft\n" #: src/iptux/UiModels.cpp:632 #, fuzzy msgid "Compatibility: GNU/Linux" msgstr "Compatibilidad: GNU/Linux\n" #: src/iptux/UiModels.cpp:636 #, fuzzy, c-format msgid "System coding: %s" msgstr "Codificación del Sistema: %s\n" #: src/iptux/UiModels.cpp:641 #, fuzzy msgid "Signature:" msgstr "Firma:\n" #: src/iptux/UiModels.cpp:744 msgid "" msgstr "" #: src/iptux/UiModels.cpp:799 msgid "[IMG]" msgstr "" #: src/iptux/dialog.cpp:39 msgid "" "File transfer has not been completed.\n" "Are you sure to cancel and quit?" msgstr "" "La transferencia de archivos no se ha completado.\n" "¿Está seguro que quiere cancelar y salir?" #: src/iptux/dialog.cpp:42 msgid "Confirm Exit" msgstr "Confirmar Salida" #: src/iptux/dialog.cpp:62 src/iptux/resources/gtk/MainWindow.ui:12 #: src/iptux/resources/gtk/menus.ui:98 src/iptux/resources/gtk/menus.ui:243 msgid "Request Shared Resources" msgstr "Pedir Recursos Compartidos" #: src/iptux/dialog.cpp:62 msgid "Agree" msgstr "De acuerdo" #: src/iptux/dialog.cpp:78 #, c-format msgid "" "Your pal (%s)[%s]\n" "is requesting to get your shared resources,\n" "Do you agree?" msgstr "" "Su amigo (%s)[%s]\n" "ha pedido sus recursos compartidos,\n" "¿Está de acuerdo?" #: src/iptux/dialog.cpp:106 msgid "Access Password" msgstr "Clave de Acceso" #: src/iptux/dialog.cpp:113 msgid "Please input the password for the shared files behind" msgstr "Ingrese la clave para los archivos compartidos" #: src/iptux/dialog.cpp:127 #, c-format msgid "(%s)[%s]Password:" msgstr "(%s)[%s]Clave:" #: src/iptux/dialog.cpp:146 src/iptux/dialog.cpp:207 msgid "" "\n" "Empty Password!" msgstr "" "\n" "Clave vacía!" #: src/iptux/dialog.cpp:170 msgid "Enter a New Password" msgstr "Ingresar Nueva Clave" #: src/iptux/dialog.cpp:178 msgid "Password: " msgstr "Clave: " #: src/iptux/dialog.cpp:187 msgid "Repeat: " msgstr "Repetir: " #: src/iptux/dialog.cpp:202 msgid "" "\n" "Password Mismatched!" msgstr "" "\n" "Las claves son distintas!" #: src/iptux/dialog.cpp:229 #, fuzzy msgid "Please select a folder to save files." msgstr "Por favor seleccione un archivo de sonido" #: src/iptux/resources/gtk/AboutDialog.ui:11 msgid "" "Copyright © 2008–2009, Jally\n" "Copyright © 2013–2015,2017–2021, LI Daobing" msgstr "" #: src/iptux/resources/gtk/AboutDialog.ui:13 #, fuzzy msgid "A GTK based LAN messenger." msgstr "Un mensajero de red basando en GTK+." #: src/iptux/resources/gtk/AppIndicator.ui:6 #, fuzzy msgid "Open Iptux" msgstr "iptux" #: src/iptux/resources/gtk/AppIndicator.ui:12 #: src/iptux/resources/gtk/menus.ui:6 src/iptux/resources/gtk/menus.ui:306 msgid "_Preferences" msgstr "_Preferencias" #: src/iptux/resources/gtk/AppIndicator.ui:16 #: src/iptux/resources/gtk/menus.ui:10 src/iptux/resources/gtk/menus.ui:310 msgid "_Quit" msgstr "_Salir" #: src/iptux/resources/gtk/DetectPal.ui:7 #, fuzzy msgid "Detect pal" msgstr "Detectar amigos" #: src/iptux/resources/gtk/DetectPal.ui:15 msgid "Detect" msgstr "Detectar" #: src/iptux/resources/gtk/DetectPal.ui:61 msgid "Please input an IP address (IPv4 only):" msgstr "Ingrese una dirección IP (IPv4 solamente):" #: src/iptux/resources/gtk/MainWindow.ui:8 src/iptux/resources/gtk/menus.ui:109 #: src/iptux/resources/gtk/menus.ui:254 msgid "Send Message" msgstr "Enviar Mensaje" #: src/iptux/resources/gtk/MainWindow.ui:16 #, fuzzy msgid "Change Info" msgstr "Cambiar Información." #: src/iptux/resources/gtk/MainWindow.ui:20 msgid "Delete Pal" msgstr "Eliminar Amigo" #: src/iptux/resources/gtk/MainWindow.ui:26 src/iptux/resources/gtk/menus.ui:31 #: src/iptux/resources/gtk/menus.ui:176 msgid "Sort" msgstr "Ordenar" #: src/iptux/resources/gtk/MainWindow.ui:29 src/iptux/resources/gtk/menus.ui:34 #: src/iptux/resources/gtk/menus.ui:179 msgid "By Nickname" msgstr "Por Apodo" #: src/iptux/resources/gtk/MainWindow.ui:34 src/iptux/resources/gtk/menus.ui:39 #: src/iptux/resources/gtk/menus.ui:184 #, fuzzy msgid "By Username" msgstr "Por Apodo" #: src/iptux/resources/gtk/MainWindow.ui:39 src/iptux/resources/gtk/menus.ui:44 #: src/iptux/resources/gtk/menus.ui:189 msgid "By IP" msgstr "Por IP" #: src/iptux/resources/gtk/MainWindow.ui:44 src/iptux/resources/gtk/menus.ui:49 #: src/iptux/resources/gtk/menus.ui:194 #, fuzzy msgid "By Host" msgstr "Equipo" #: src/iptux/resources/gtk/MainWindow.ui:49 src/iptux/resources/gtk/menus.ui:54 #: src/iptux/resources/gtk/menus.ui:199 msgid "By Last Activity" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:56 src/iptux/resources/gtk/menus.ui:61 #: src/iptux/resources/gtk/menus.ui:206 msgid "Ascending" msgstr "Ascendente" #: src/iptux/resources/gtk/MainWindow.ui:61 src/iptux/resources/gtk/menus.ui:66 #: src/iptux/resources/gtk/menus.ui:211 msgid "Descending" msgstr "Descendente" #: src/iptux/resources/gtk/MainWindow.ui:68 msgid "Info Style" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:71 #, fuzzy msgid "IP" msgstr "IPv4" #: src/iptux/resources/gtk/MainWindow.ui:76 msgid "IP:PORT" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:86 #, fuzzy msgid "Username" msgstr "Usuario" #: src/iptux/resources/gtk/MainWindow.ui:91 #, fuzzy msgid "Version" msgstr "Versión: %s\n" #: src/iptux/resources/gtk/MainWindow.ui:96 msgid "Last Activity" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:101 #, fuzzy msgid "Last Message" msgstr "Enviar Mensaje" #: src/iptux/resources/gtk/menus.ui:17 src/iptux/resources/gtk/menus.ui:162 msgid "_File" msgstr "_Archivo" #: src/iptux/resources/gtk/menus.ui:19 src/iptux/resources/gtk/menus.ui:164 msgid "_Detect" msgstr "_Detectar" #: src/iptux/resources/gtk/menus.ui:23 src/iptux/resources/gtk/menus.ui:168 msgid "_Find" msgstr "_Buscar" #: src/iptux/resources/gtk/menus.ui:28 src/iptux/resources/gtk/menus.ui:173 msgid "_View" msgstr "" #: src/iptux/resources/gtk/menus.ui:73 src/iptux/resources/gtk/menus.ui:218 msgid "_Refresh" msgstr "" #: src/iptux/resources/gtk/menus.ui:80 src/iptux/resources/gtk/menus.ui:225 msgid "_Chat" msgstr "" #: src/iptux/resources/gtk/menus.ui:88 src/iptux/resources/gtk/menus.ui:233 msgid "Attach File" msgstr "Adjuntar Archivo" #: src/iptux/resources/gtk/menus.ui:92 src/iptux/resources/gtk/menus.ui:237 msgid "Attach Folder" msgstr "Adjuntar Directorio" #: src/iptux/resources/gtk/menus.ui:102 src/iptux/resources/gtk/menus.ui:247 #, fuzzy msgid "Clear Chat History" msgstr "Historial de Charlas" #: src/iptux/resources/gtk/menus.ui:115 src/iptux/resources/gtk/menus.ui:260 msgid "_Window" msgstr "" #: src/iptux/resources/gtk/menus.ui:118 src/iptux/resources/gtk/menus.ui:263 msgid "_Transmission" msgstr "_Transferencias" #: src/iptux/resources/gtk/menus.ui:122 src/iptux/resources/gtk/menus.ui:267 msgid "_Shared Management" msgstr "Admini_strador de Compartidos" #: src/iptux/resources/gtk/menus.ui:126 src/iptux/resources/gtk/menus.ui:271 msgid "_Chat Log" msgstr "" #: src/iptux/resources/gtk/menus.ui:130 src/iptux/resources/gtk/menus.ui:275 #, fuzzy msgid "_System Log" msgstr "Codificación del Sistema:" #: src/iptux/resources/gtk/menus.ui:136 src/iptux/resources/gtk/menus.ui:281 msgid "Close Window" msgstr "" #: src/iptux/resources/gtk/menus.ui:142 src/iptux/resources/gtk/menus.ui:287 msgid "_Help" msgstr "_Ayuda" #: src/iptux/resources/gtk/menus.ui:145 src/iptux/resources/gtk/menus.ui:290 msgid "_About" msgstr "" #: src/iptux/resources/gtk/menus.ui:149 src/iptux/resources/gtk/menus.ui:294 msgid "Report Bug" msgstr "" #: src/iptux/resources/gtk/menus.ui:153 src/iptux/resources/gtk/menus.ui:298 msgid "What's New" msgstr "" #: src/iptux/resources/gtk/menus.ui:318 msgid "Open This File" msgstr "Abrir este archivo" #: src/iptux/resources/gtk/menus.ui:322 msgid "Open Containing Folder" msgstr "Abrir carpeta contenedora" #: src/iptux/resources/gtk/menus.ui:326 msgid "Terminate Task" msgstr "Terminar Tarea" #: src/iptux/resources/gtk/menus.ui:330 msgid "Terminate All" msgstr "Terminar Todos" #: src/iptux/resources/gtk/menus.ui:334 msgid "Clear Tasklist" msgstr "Limpiar Tareas" #: src/iptux/resources/gtk/menus.ui:346 #, fuzzy msgid "Refuse All" msgstr "Rechazar" #: src/main/iptux.cpp:149 #, fuzzy msgid "- A software for sharing in LAN" msgstr "iptux: Un software para compartir en LAN\n" #: src/main/iptux.cpp:152 #, fuzzy, c-format msgid "option parsing failed: %s\n" msgstr "Opendir() directorio \"%s\" fallo, %s" #~ msgid "Can't find any available web browser!\n" #~ msgstr "No se puede encontrar ningún navegador web disponible!\n" #, fuzzy #~ msgid "Close Chat" #~ msgstr "Cerrar" #~ msgid "Pals Online: %" #~ msgstr "Amigos En Linea: %" #~ msgid "Sound" #~ msgstr "Sonido" #~ msgid "Activate the sound support" #~ msgstr "Activar soporte de sonido" #~ msgid "Volume Control: " #~ msgstr "Contro de Volumen: " #~ msgid "Sound Event" #~ msgstr "Eventos de Sonidos:" #~ msgid "Test" #~ msgstr "Prueba" #~ msgid "Stop" #~ msgstr "Detener" #~ msgid "Transfer finished" #~ msgstr "Transferencia finalizada" #~ msgid "Message received" #~ msgstr "Mensaje recibido" #~ msgid "Play" #~ msgstr "Reproducir" #~ msgid "Event" #~ msgstr "Evento" #~ msgid "Please select a sound file" #~ msgstr "Por favor seleccione un archivo de sonido" #, fuzzy #~ msgid "Failed to play the prompt tone, [%s] %s, %s" #~ msgstr "Fallo la reproducción del archivo, %s\n" #~ msgid "_Hide" #~ msgstr "_Ocultar" #~ msgid "_Show" #~ msgstr "_Mostrar" #~ msgid "To be read: %u messages" #~ msgstr "Por leer: %u mensajes" #~ msgid "_Tools" #~ msgstr "_Herramientas" #~ msgid "Error" #~ msgstr "Error" #, fuzzy #~ msgid "iptux-icon" #~ msgstr "iptux" #~ msgid "Please input an IP address (IPv4 only)!" #~ msgstr "Por favor Ingrese una dirección IP (IPv4 solamente)!" #~ msgid "..." #~ msgstr "..." #~ msgid "Clear Buffer" #~ msgstr "Limpiar buffer" #, fuzzy #~ msgid "Contributors" #~ msgstr "Contribuciones" #, fuzzy #~ msgid "" #~ "Fatal Error!!\n" #~ "Failed to bind the TCP/UDP port(%d)!\n" #~ "%s" #~ msgstr "" #~ "Error Fatal!!\n" #~ "No se puede enlazar el puerto TCP/UDP (2425)!\n" #~ "%s" #~ msgid "Help" #~ msgstr "Ayuda" #~ msgid "" #~ "It's an honor that iptux was contributed voluntarilly by many people. " #~ "Without your help, iptux could never make it.\n" #~ "\n" #~ "Especially, Here's some we would like to thank much:\n" #~ "\n" #~ "ChenGang\n" #~ "\n" #~ "\n" #~ "\n" #~ "\n" #~ "\n" #~ "..." #~ msgstr "" #~ "Es un honor que iptux tenga contribuciones voluntarias de muchos " #~ "usuarios. Sin su ayuda, iptux nunca se pudo haber hecho.\n" #~ "\n" #~ "Especialmente, algunas personas a quien quiero agredecer mucho:\n" #~ "\n" #~ "ChenGang\n" #~ "\n" #~ "\n" #~ "\n" #~ "\n" #~ "\n" #~ "..." #~ msgid "Jally " #~ msgstr "Jally " #~ msgid "LiWeijian " #~ msgstr "LiWeijian " #~ msgid "ManPT " #~ msgstr "ManPT " #~ msgid "More About Iptux" #~ msgstr "Más Acerca de Iptux" #, fuzzy #~ msgid "" #~ "Project Home: \n" #~ "https://github.com/iptux-src/iptux\n" #~ "\n" #~ "User and Developer Group: \n" #~ "https://groups.google.com/group/iptux/\n" #~ "\n" #~ "Note that you can get help form the project wiki page.\n" #~ "\n" #~ "If you find no solutions in any of the existed documents, feel free to " #~ "drop a email at iptux@googlegroups.com, lots of users and developers " #~ "would be glade to help about your problems." #~ msgstr "" #~ "Sitio del Proyecto: \n" #~ "http://code.google.com/p/iptux/\n" #~ "\n" #~ "Grupo para Usuarios y Desarrolladores: \n" #~ "https://groups.google.com/group/iptux/\n" #~ "\n" #~ "Ud. puede obtener ayuda desde las páginas del wiki del proyecto.\n" #~ "\n" #~ "Si no encuentra solución en ninguno de los documentos existentes, envíe " #~ "un correo electrónico a iptux@googlegroups.com, muchos usuarios y " #~ "desarrolladores intentaran ayudarlo con sus problemas." #~ msgid "The process is about to quit!" #~ msgstr "¡El proceso está a punto de terminar!" #~ msgid "_FAQ" #~ msgstr "_FAQ" #~ msgid "_More" #~ msgstr "_Mas Acerca de" #~ msgid "_Sort" #~ msgstr "_Ordenar" #~ msgid "_Update" #~ msgstr "_Actualizar" #~ msgid "" #~ "alick \n" #~ "ManPT " #~ msgstr "" #~ "alick \n" #~ "ManPT " #, fuzzy #~ msgid "http://code.google.com/p/iptux/wiki/FAQ?wl=en" #~ msgstr "http://code.google.com/p/iptux/wiki/FAQ_EnglishVersion" #~ msgid "" #~ "\t-h --help\n" #~ "\t\tdisplay this help and exit\n" #~ msgstr "" #~ "\t-h --help\n" #~ "\t\tmuestra esta ayuda y sale\n" #~ msgid "" #~ "\t-v --version\n" #~ "\t\toutput version information and exit\n" #~ msgstr "" #~ "\t-v --version\n" #~ "\t\tmuestra la información de la versión y sale\n" #~ msgid "" #~ "\n" #~ "Can't send an empty message!!" #~ msgstr "" #~ "\n" #~ "No puede enviar un mensaje vacío!!" #~ msgid "Free:%s Total:%s" #~ msgstr "Libre:%s Total:%s" #~ msgid "Me" #~ msgstr "Usted" #~ msgid "Opendir() directory \"%s\" failed, %s\n" #~ msgstr "Opendir() directorio \"%s\" fallo, %s\n" #~ msgid "Pal's Shared Resources" #~ msgstr "Recursos Compartidos de amigos" #~ msgid "Recv" #~ msgstr "Recv" #~ msgid "Rmdir() directory \"%s\" failed, %s\n" #~ msgstr "Rmdir() directorio \"%s\" fallo, %s\n" #~ msgid "Stat() file \"%s\" failed, %s\n" #~ msgstr "Stat() archivo \"%s\" fallo, %s\n" #~ msgid "The user is not privileged!\n" #~ msgstr "El usuario no tiene permisos!\n" #~ msgid "Unlink() file \"%s\" failed, %s\n" #~ msgstr "Unlink() archivo \"%s\" fallo, %s\n" #~ msgid "What do you want to do?\n" #~ msgstr "¿Qué quiere hacer?\n" #~ msgid "utf-16" #~ msgstr "utf-16" #~ msgid "utf-8" #~ msgstr "utf-8" iptux-0.9.4/po/fr.po000066400000000000000000001132311475473122500142750ustar00rootroot00000000000000# French translation for iptux # Copyright (c) 2010 Rosetta Contributors and Canonical Ltd 2010 # This file is distributed under the same license as the iptux package. # FIRST AUTHOR , 2010. # Fr Cyrille , 2016. msgid "" msgstr "" "Project-Id-Version: iptux\n" "Report-Msgid-Bugs-To: https://github.com/iptux-src/iptux/issues/new\n" "POT-Creation-Date: 2025-02-17 13:35-0800\n" "PO-Revision-Date: 2021-05-17 00:40+0000\n" "Last-Translator: J. Lavoie \n" "Language-Team: French \n" "Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n > 1;\n" "X-Generator: Weblate 4.7-dev\n" "X-Launchpad-Export-Date: 2018-01-24 12:00+0000\n" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:6 msgid "iptux" msgstr "iptux" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:7 msgid "LAN communication software" msgstr "Logiciel de communication LAN" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:17 #, fuzzy msgid "iptux is an “IP Messenger” client. The features of iptux include:" msgstr "iptux est un client de messagerie IP." #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:21 msgid "auto-detect other clients on the intranet." msgstr "détecter automatiquement les autres clients sur l'intranet." #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:22 #, fuzzy msgid "send/recv messages to other clients." msgstr "envoyer des messages à d'autres clients." #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:23 #, fuzzy msgid "send/recv files to other clients." msgstr "envoyer des fichiers à d'autres clients." #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:24 msgid "share your files to other cliens (with optional password protection)." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:26 msgid "" "It is (supposedly) compatible with 飞鸽传书 (Feige) and 飞秋 (FeiQ) from " "China, and with the original “IP Messenger” clients from Japan, including " "g2ipmsg and xipmsg in Debian." msgstr "" "Il est (censément) compatible avec 飞鸽传书 (Feige) et 飞秋 (FeiQ) de Chine, " "et avec les clients de messagerie IP originaux du Japon, y compris g2ipmsg " "et xipmsg dans Debian." #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:38 msgid "The Iptux main window." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:42 msgid "The Iptux chat window." msgstr "" #: src/iptux-core/CoreThread.cpp:172 #, c-format msgid "" "Fatal Error!! Failed to create new socket!\n" "%s" msgstr "" "Erreur fatale ! Impossible de créer un nouveau socket !\n" "%s" #: src/iptux-core/CoreThread.cpp:188 #, fuzzy, c-format msgid "" "Fatal Error!! Failed to bind the TCP port(%s:%d)!\n" "%s" msgstr "" "Erreur fatale !!\n" "Impossible de se connecter au port TCP/UDP (2425) !\n" "%s" #: src/iptux-core/CoreThread.cpp:201 #, fuzzy, c-format msgid "" "Fatal Error!! Failed to bind the UDP port(%s:%d)!\n" "%s" msgstr "" "Erreur fatale !!\n" "Impossible de se connecter au port TCP/UDP (2425) !\n" "%s" #: src/iptux-core/CoreThread.cpp:461 src/iptux-core/CoreThread.cpp:495 #: src/iptux-core/internal/RecvFileData.cpp:142 #: src/iptux-core/internal/RecvFileData.cpp:204 #, c-format msgid "" "Fatal Error!!\n" "Failed to create new socket!\n" "%s" msgstr "" "Erreur fatale !\n" "Erreur d'entrées/sorties!\n" "%s" #: src/iptux-core/Models.cpp:172 msgid "Empty Message" msgstr "Message vide" #: src/iptux-core/Models.cpp:250 msgid "Received an image" msgstr "Image reçue" #: src/iptux-core/internal/AnalogFS.cpp:93 #: src/iptux-core/internal/AnalogFS.cpp:98 #, c-format msgid "Open() file \"%s\" failed, %s" msgstr "L'ouverture() du fichier « %s » a échoué, %s" #: src/iptux-core/internal/AnalogFS.cpp:117 #, c-format msgid "Stat64() file \"%s\" failed, %s" msgstr "" #: src/iptux-core/internal/AnalogFS.cpp:138 #, c-format msgid "Mkdir() directory \"%s\" failed, %s" msgstr "Mkdir() dossier \"%s\" a échoué, %s" #: src/iptux-core/internal/AnalogFS.cpp:164 #, c-format msgid "Opendir() directory \"%s\" failed, %s" msgstr "L'ouverture() du dossier \\\"%s\\\" a échoué, %s" #: src/iptux-core/internal/Command.cpp:226 msgid "Your pal didn't receive the packet. He or she is offline maybe." msgstr "" "Votre ami(e) n'a pas reçu le paquet. Il ou elle est probablement " "déconnecté(e)." #: src/iptux-core/internal/CommandMode.cpp:39 #, c-format msgid "unknown command mode: %d" msgstr "" #: src/iptux-core/internal/RecvFileData.cpp:117 msgid "receive" msgstr "réception" #: src/iptux-core/internal/RecvFileData.cpp:124 #: src/iptux-core/internal/RecvFileData.cpp:253 #: src/iptux-core/internal/SendFileData.cpp:108 #: src/iptux-core/internal/SendFileData.cpp:193 msgid "Unknown" msgstr "Inconnu" #: src/iptux-core/internal/RecvFileData.cpp:175 #, fuzzy, c-format msgid "" "Failed to receive the file \"%s\" from %s! expect length %jd, received %jd" msgstr "Échec de la réception du fichier \"%s\" de %s !" #: src/iptux-core/internal/RecvFileData.cpp:180 #, c-format msgid "Receive the file \"%s\" from %s successfully!" msgstr "Le fichier \"%s\" de %s a été reçu avec succès !" #: src/iptux-core/internal/RecvFileData.cpp:320 #, c-format msgid "Failed to receive the directory \"%s\" from %s!" msgstr "Échec de la réception du dossier \"%s\" de %s !" #: src/iptux-core/internal/RecvFileData.cpp:323 #, c-format msgid "Receive the directory \"%s\" from %s successfully!" msgstr "Le dossier « %s » de %s a été reçu avec succès !" #: src/iptux-core/internal/SendFileData.cpp:101 msgid "send" msgstr "envoyer" #: src/iptux-core/internal/SendFileData.cpp:137 #, c-format msgid "Failed to send the file \"%s\" to %s!" msgstr "Échec de l'envoi du fichier « %s » à %s !" #: src/iptux-core/internal/SendFileData.cpp:142 #, c-format msgid "Send the file \"%s\" to %s successfully!" msgstr "Le fichier « %s » a été envoyé avec succès à %s !" #: src/iptux-core/internal/SendFileData.cpp:265 #, c-format msgid "Failed to send the directory \"%s\" to %s!" msgstr "Échec de l'envoi du dossier « %s » à %s !" #: src/iptux-core/internal/SendFileData.cpp:270 #, c-format msgid "Send the directory \"%s\" to %s successfully!" msgstr "Le dossier « %s » a été envoyé avec succès à %s !" #: src/iptux-core/internal/UdpData.cpp:92 #: src/iptux-core/internal/UdpData.cpp:93 #: src/iptux-core/internal/UdpData.cpp:443 #: src/iptux-core/internal/UdpData.cpp:484 msgid "mysterious" msgstr "mystérieux" #: src/iptux-utils/utils.cpp:880 #, c-format msgid "stat file \"%s\" failed: %s" msgstr "" #: src/iptux-utils/utils.cpp:888 #, c-format msgid "path %s is not file or directory: st_mode(%x)" msgstr "" #: src/iptux-utils/utils.cpp:895 #, c-format msgid "opendir on \"%s\" failed: %s" msgstr "" #: src/iptux/AboutDialog.cpp:39 msgid "TRANSLATOR NAME" msgstr "" #: src/iptux/AboutDialog.cpp:53 msgid "Thanks to" msgstr "Merci à" #: src/iptux/AppIndicator.cpp:40 src/iptux/MainWindow.cpp:505 #: src/iptux/MainWindow.cpp:507 #, fuzzy msgid "Iptux" msgstr "iptux" #: src/iptux/Application.cpp:54 msgid "Loading the process successfully!" msgstr "Le processus a été chargé avec succès !" #: src/iptux/Application.cpp:274 #, c-format msgid "New Message from %s" msgstr "Nouveau message de %s" #: src/iptux/Application.cpp:287 #, c-format msgid "New File from %s" msgstr "Nouveau fichier de %s" #: src/iptux/Application.cpp:296 msgid "Receiving File Finished" msgstr "Réception du fichier terminée" #: src/iptux/Application.cpp:300 msgid "file info no longer exist" msgstr "les infos du fichier n'existent plus" #: src/iptux/Darwin.cpp:16 #, c-format msgid "Couldn’t load icon: %s" msgstr "Impossible de charger l'icône : %s" #: src/iptux/DataSettings.cpp:46 msgid "Personal" msgstr "Personnel" #: src/iptux/DataSettings.cpp:48 msgid "System" msgstr "Système" #: src/iptux/DataSettings.cpp:50 msgid "Network" msgstr "Réseau" #: src/iptux/DataSettings.cpp:89 src/iptux/DataSettings.cpp:98 msgid "The program needs to be restarted to take effect!" msgstr "" #: src/iptux/DataSettings.cpp:143 msgid "Preferences" msgstr "Préférences" #: src/iptux/DataSettings.cpp:143 src/iptux/RevisePal.cpp:109 #: src/iptux/dialog.cpp:107 src/iptux/dialog.cpp:170 #, fuzzy msgid "_OK" msgstr "OK" #: src/iptux/DataSettings.cpp:144 #, fuzzy msgid "_Apply" msgstr "Appliquer" #: src/iptux/DataSettings.cpp:144 src/iptux/DataSettings.cpp:1348 #: src/iptux/DataSettings.cpp:1395 src/iptux/DialogBase.cpp:359 #: src/iptux/DialogBase.cpp:918 src/iptux/RevisePal.cpp:110 #: src/iptux/ShareFile.cpp:419 src/iptux/callback.cpp:87 #: src/iptux/dialog.cpp:171 src/iptux/dialog.cpp:230 #, fuzzy msgid "_Cancel" msgstr "Annuler" #: src/iptux/DataSettings.cpp:169 #, fuzzy msgid "Your _nickname:" msgstr "Votre pseudonyme :" #: src/iptux/DataSettings.cpp:176 msgid "Please input your nickname!" msgstr "Veuillez entrer votre pseudonyme !" #: src/iptux/DataSettings.cpp:182 #, fuzzy msgid "Your _group name:" msgstr "Le nom de votre groupe :" #: src/iptux/DataSettings.cpp:189 msgid "Please input your group name!" msgstr "Veuillez entrer le nom de votre groupe !" #: src/iptux/DataSettings.cpp:195 #, fuzzy msgid "Your _face picture:" msgstr "Votre avatar :" #: src/iptux/DataSettings.cpp:213 #, fuzzy msgid "_Save files to: " msgstr "Enregistrer sous " #: src/iptux/DataSettings.cpp:226 msgid "Photo" msgstr "Photo" #: src/iptux/DataSettings.cpp:238 msgid "Signature" msgstr "Signature" #: src/iptux/DataSettings.cpp:271 msgid "Port:" msgstr "" #: src/iptux/DataSettings.cpp:278 msgid "Any port number between 1024 and 65535, default is 2425" msgstr "" #: src/iptux/DataSettings.cpp:287 #, fuzzy msgid "Candidate network encodings:" msgstr "Encodage réseau suggéré :" #: src/iptux/DataSettings.cpp:294 #, fuzzy msgid "Candidate network encodings, separated by \",\"" msgstr "Candidat pour l'encodage réseau" #: src/iptux/DataSettings.cpp:301 #, fuzzy msgid "Preferred network encoding:" msgstr "Préférences de l'encodage réseau :" #: src/iptux/DataSettings.cpp:308 msgid "" "Preference network coding (You should be aware of what you are doing if you " "want to modify it.)" msgstr "" "Préférences de l'encodage réseau (Soyez certains de ce que vous faites si " "vous souhaitez le modifier.)" #: src/iptux/DataSettings.cpp:316 msgid "Pal's default face picture:" msgstr "Photo par défaut de l'ami(e) :" #: src/iptux/DataSettings.cpp:334 msgid "Panel font:" msgstr "Police du panneau :" #: src/iptux/DataSettings.cpp:346 msgid "Automatically open the chat dialog" msgstr "Ouvrir automatiquement la fenêtre de discussion" #: src/iptux/DataSettings.cpp:354 msgid "Automatically hide the panel after login" msgstr "Cacher automatiquement le panneau une fois connecté" #: src/iptux/DataSettings.cpp:362 msgid "Automatically open the File Transmission Management" msgstr "Ouvrir automatiquement le gestionnaire de transfert" #: src/iptux/DataSettings.cpp:370 msgid "Use the 'Enter' key to send message" msgstr "Utilisez la touche 'Entrée' pour envoyer le message" #: src/iptux/DataSettings.cpp:378 msgid "Automatically clean up the chat history" msgstr "Effacer l'historique de discussion automatiquement" #: src/iptux/DataSettings.cpp:385 msgid "Save the chat history" msgstr "Sauvegarder l'historique de discussion" #: src/iptux/DataSettings.cpp:393 msgid "Use the Blacklist (NOT recommended)" msgstr "Utiliser la liste noire (NON recommandé)" #: src/iptux/DataSettings.cpp:401 msgid "Filter the request of sharing files" msgstr "Filtrer la requête de partage de fichiers" #: src/iptux/DataSettings.cpp:408 msgid "Hide the taskbar when the main window is minimized" msgstr "" #: src/iptux/DataSettings.cpp:432 msgid "From:" msgstr "De :" #: src/iptux/DataSettings.cpp:438 msgid "Beginning of the IP(v4) section" msgstr "Début de la section IP(v4)" #: src/iptux/DataSettings.cpp:442 msgid "To:" msgstr "À :" #: src/iptux/DataSettings.cpp:448 msgid "End of the IP(v4) section" msgstr "Fin de la section IP(v4)" #: src/iptux/DataSettings.cpp:456 msgid "Add" msgstr "Ajouter" #: src/iptux/DataSettings.cpp:461 msgid "Delete" msgstr "Supprimer" #: src/iptux/DataSettings.cpp:468 msgid "Added IP(v4) Section:" msgstr "Ajout de la section IP(v4) :" #: src/iptux/DataSettings.cpp:487 msgid "Import" msgstr "Importer" #: src/iptux/DataSettings.cpp:491 msgid "Export" msgstr "Exporter" #: src/iptux/DataSettings.cpp:495 src/iptux/TransWindow.cpp:171 msgid "Clear" msgstr "Effacer" #: src/iptux/DataSettings.cpp:706 msgid "From" msgstr "De" #: src/iptux/DataSettings.cpp:713 msgid "To" msgstr "À" #: src/iptux/DataSettings.cpp:720 msgid "Description" msgstr "Description" #: src/iptux/DataSettings.cpp:736 msgid "Please select download folder" msgstr "Veuillez sélectionner le dossier de téléchargement" #: src/iptux/DataSettings.cpp:758 msgid "Select Font" msgstr "Sélectionner une police de caractères" #: src/iptux/DataSettings.cpp:872 src/iptux/DataSettings.cpp:874 #: src/iptux/DataSettings.cpp:878 msgid "Port must be a number between 1024 and 65535" msgstr "" #: src/iptux/DataSettings.cpp:1019 src/iptux/DataSettings.cpp:1050 #, c-format msgid "" "Fopen() file \"%s\" failed!\n" "%s" msgstr "" "Fl'ouverture() du ficher \"%s\" a échoué !\n" "%s" #: src/iptux/DataSettings.cpp:1150 src/iptux/RevisePal.cpp:419 msgid "Please select a face picture" msgstr "Veuillez sélectionner un avatar" #: src/iptux/DataSettings.cpp:1172 msgid "Please select a personal photo" msgstr "Veuillez sélectionner une photo personnelle" #: src/iptux/DataSettings.cpp:1241 src/iptux/DataSettings.cpp:1248 #: src/iptux/DetectPal.cpp:75 #, c-format msgid "" "\n" "Illegal IP(v4) address: %s!" msgstr "" "\n" "Adresse IP(v4) illégale : %s!" #: src/iptux/DataSettings.cpp:1346 msgid "Please select a file to import data" msgstr "Veuillez sélectionner un fichier à importer" #: src/iptux/DataSettings.cpp:1347 src/iptux/DialogBase.cpp:358 #: src/iptux/ShareFile.cpp:418 src/iptux/callback.cpp:86 msgid "_Open" msgstr "" #: src/iptux/DataSettings.cpp:1394 msgid "Save data to file" msgstr "Sauvegarder les données dans le fichier" #: src/iptux/DataSettings.cpp:1395 src/iptux/DialogBase.cpp:919 #: src/iptux/dialog.cpp:231 #, fuzzy msgid "_Save" msgstr "EnregistrerSous" #: src/iptux/DetectPal.cpp:70 #, c-format msgid "The notification has been sent to %s." msgstr "La notification a été transmise à %s." #: src/iptux/DialogBase.cpp:214 #, c-format msgid "%s To Send." msgstr "" #: src/iptux/DialogBase.cpp:272 msgid "Close" msgstr "Fermer" #: src/iptux/DialogBase.cpp:276 src/iptux/DialogGroup.cpp:375 msgid "Send" msgstr "Envoyer" #: src/iptux/DialogBase.cpp:307 #, fuzzy msgid "Chat History" msgstr "Sauvegarder l'historique de discussion" #: src/iptux/DialogBase.cpp:350 msgid "Choose enclosure files" msgstr "" #: src/iptux/DialogBase.cpp:353 #, fuzzy msgid "Choose enclosure folders" msgstr "Choisissez les dossiers à partager" #: src/iptux/DialogBase.cpp:593 msgid "Remove Selected" msgstr "Supprimer la sélection" #: src/iptux/DialogBase.cpp:648 #, fuzzy msgid "File to send." msgstr "Fichier à recevoir." #: src/iptux/DialogBase.cpp:653 #, fuzzy msgid "Sending progress." msgstr "Progression de la réception." #: src/iptux/DialogBase.cpp:656 msgid "Dirs" msgstr "" #: src/iptux/DialogBase.cpp:659 #, fuzzy msgid "Files" msgstr "Fichier" #: src/iptux/DialogBase.cpp:662 src/iptux/DialogPeer.cpp:565 msgid "Detail" msgstr "" #: src/iptux/DialogBase.cpp:712 #, fuzzy msgid "PeerName" msgstr "Nom" #: src/iptux/DialogBase.cpp:719 src/iptux/DialogPeer.cpp:716 msgid "Name" msgstr "Nom" #: src/iptux/DialogBase.cpp:725 src/iptux/DialogPeer.cpp:652 #: src/iptux/DialogPeer.cpp:722 src/iptux/ShareFile.cpp:280 #: src/iptux/TransWindow.cpp:271 msgid "Size" msgstr "Taille" #: src/iptux/DialogBase.cpp:731 msgid "Path" msgstr "" #: src/iptux/DialogBase.cpp:792 #, fuzzy msgid "Sending Progress." msgstr "Progression de l'envoi." #: src/iptux/DialogBase.cpp:795 #, fuzzy, c-format msgid "%s of %s Sent." msgstr "%s de %s a été envoyé." #: src/iptux/DialogBase.cpp:802 src/iptux/DialogPeer.cpp:835 msgid "Mission Completed!" msgstr "Mission accomplie !" #: src/iptux/DialogBase.cpp:845 src/iptux/DialogBase.cpp:917 msgid "Save Image" msgstr "" #: src/iptux/DialogBase.cpp:850 msgid "Copy Image" msgstr "" #: src/iptux/DialogGroup.cpp:285 msgid "Member" msgstr "Membre" #: src/iptux/DialogGroup.cpp:382 msgid "Pals" msgstr "Ami(e)s" #: src/iptux/DialogGroup.cpp:480 msgid "Select All" msgstr "Tout sélectionner" #: src/iptux/DialogGroup.cpp:485 msgid "Reverse Select" msgstr "Inverser la sélection" #: src/iptux/DialogGroup.cpp:490 msgid "Clear Up" msgstr "Vider" #: src/iptux/DialogGroup.cpp:728 #, c-format msgid "Talk with the group %s" msgstr "Communiquer avec le groupe %s" #: src/iptux/DialogPeer.cpp:132 #, c-format msgid "Talk with %s(%s) IP:%s" msgstr "Communiquer avec %s(%s) IP :%s" #: src/iptux/DialogPeer.cpp:305 msgid "Info." msgstr "Information" #: src/iptux/DialogPeer.cpp:337 #, c-format msgid "Version: %s\n" msgstr "Version : %s\n" #: src/iptux/DialogPeer.cpp:339 #, c-format msgid "Nickname: %s@%s\n" msgstr "Pseudo : %s@%s\n" #: src/iptux/DialogPeer.cpp:342 #, c-format msgid "Nickname: %s\n" msgstr "Pseudo : %s\n" #: src/iptux/DialogPeer.cpp:344 #, c-format msgid "User: %s\n" msgstr "Utilisateur : %s\n" #: src/iptux/DialogPeer.cpp:345 #, c-format msgid "Host: %s\n" msgstr "Hôte : %s\n" #: src/iptux/DialogPeer.cpp:348 #, c-format msgid "Address: %s(%s)\n" msgstr "Adresse : %s(%s)\n" #: src/iptux/DialogPeer.cpp:350 #, c-format msgid "Address: %s\n" msgstr "Adresse : %s\n" #: src/iptux/DialogPeer.cpp:353 msgid "Compatibility: Microsoft\n" msgstr "Compatibilité : Microsoft\n" #: src/iptux/DialogPeer.cpp:355 msgid "Compatibility: GNU/Linux\n" msgstr "Compatibilité : GNU/Linux\n" #: src/iptux/DialogPeer.cpp:357 #, c-format msgid "System coding: %s\n" msgstr "Encodage : %s\n" #: src/iptux/DialogPeer.cpp:362 msgid "Signature:\n" msgstr "Signature :\n" #: src/iptux/DialogPeer.cpp:369 msgid "" "\n" "Photo:\n" msgstr "" "\n" "Photo :\n" #: src/iptux/DialogPeer.cpp:460 msgid "Please select a picture to insert the buffer" msgstr "Veuillez sélectionner une image à insérer" #: src/iptux/DialogPeer.cpp:486 src/iptux/resources/gtk/menus.ui:83 #: src/iptux/resources/gtk/menus.ui:228 #, fuzzy msgid "Insert Image" msgstr "Insérer une image" #: src/iptux/DialogPeer.cpp:502 msgid "Enclosure." msgstr "Enceinte." #: src/iptux/DialogPeer.cpp:547 msgid "Files to be received" msgstr "Fichier à recevoir" #: src/iptux/DialogPeer.cpp:551 msgid "Receiving progress." msgstr "Progression de la réception." #: src/iptux/DialogPeer.cpp:554 msgid "Accept" msgstr "Accepter" #: src/iptux/DialogPeer.cpp:560 src/iptux/dialog.cpp:63 #: src/iptux/resources/gtk/menus.ui:342 msgid "Refuse" msgstr "Refuser" #: src/iptux/DialogPeer.cpp:596 msgid "File received." msgstr "Fichier reçu." #: src/iptux/DialogPeer.cpp:639 src/iptux/DialogPeer.cpp:710 msgid "Source" msgstr "Source" #: src/iptux/DialogPeer.cpp:646 msgid "SaveAs" msgstr "EnregistrerSous" #: src/iptux/DialogPeer.cpp:818 src/iptux/DialogPeer.cpp:884 msgid "Receiving Progress." msgstr "Progression de l'envoi." #: src/iptux/DialogPeer.cpp:821 src/iptux/DialogPeer.cpp:887 #, c-format msgid "%s to Receive." msgstr "%s à recevoir." #: src/iptux/DialogPeer.cpp:825 src/iptux/DialogPeer.cpp:891 #, c-format msgid "%s Of %s Received." msgstr "%s de %s a été envoyé." #: src/iptux/LogSystem.cpp:71 #, c-format msgid "Recevied-From: Nickname:%s User:%s Host:%s" msgstr "Reçu de : Pseudo %s Utilisateur :%s Hôte :%s" #: src/iptux/LogSystem.cpp:76 #, c-format msgid "Send-To: Nickname:%s User:%s Host:%s" msgstr "Envoyer à : Pseudo %s Utilisateur :%s Hôte :%s" #: src/iptux/LogSystem.cpp:80 msgid "Send-Broadcast" msgstr "Envoi-diffusion" #: src/iptux/LogSystem.cpp:99 #, c-format msgid "User:%s Host:%s" msgstr "Utilisateur :%s Hôte :%s" #: src/iptux/MainWindow.cpp:570 msgid "Pals Online: 0" msgstr "Ami(e)s en ligne : 0" #: src/iptux/MainWindow.cpp:655 msgid "Search Pals" msgstr "Chercher des ami(e)s" #: src/iptux/MainWindow.cpp:768 msgid "Nickname" msgstr "Pseudo" #: src/iptux/MainWindow.cpp:778 msgid "Group" msgstr "Groupe" #: src/iptux/MainWindow.cpp:784 src/iptux/TransWindow.cpp:258 msgid "IPv4" msgstr "IPv4" #: src/iptux/MainWindow.cpp:790 msgid "User" msgstr "Utilisateur" #: src/iptux/MainWindow.cpp:796 src/iptux/resources/gtk/MainWindow.ui:81 msgid "Host" msgstr "Hôte" #: src/iptux/MainWindow.cpp:935 #, fuzzy, c-format msgid "Pals Online: %d" msgstr "Ami(e)s en ligne : 0" #: src/iptux/RevisePal.cpp:109 msgid "Change Pal's Information" msgstr "Modifier les informations concernant l'ami (e)" #: src/iptux/RevisePal.cpp:134 msgid "Pal's nickname:" msgstr "Pseudo du contact :" #: src/iptux/RevisePal.cpp:140 msgid "Please input pal's new nickname!" msgstr "Veuillez saisir le nouveau pseudo du contact" #: src/iptux/RevisePal.cpp:146 msgid "Pal's group name:" msgstr "Le nom du groupe de votre ami(e) :" #: src/iptux/RevisePal.cpp:152 msgid "Please input pal's new group name!" msgstr "Veuillez entrer le nouveau nom du groupe de votre ami(e) !" #: src/iptux/RevisePal.cpp:158 msgid "System coding:" msgstr "Encodage :" #: src/iptux/RevisePal.cpp:164 msgid "Be SURE to know what you are doing!" msgstr "ASSUREZ-VOUS de savoir ce que vous faites !" #: src/iptux/RevisePal.cpp:170 msgid "Pal's face picture:" msgstr "Avatar de votre ami(e) :" #: src/iptux/RevisePal.cpp:184 msgid "Be compatible with iptux's protocol (DANGEROUS)" msgstr "Compatibilité avec le protocole iptux (DANGEREUX)" #: src/iptux/ShareFile.cpp:104 msgid "Shared Files Management" msgstr "Gestionnaire de partage de fichier" #: src/iptux/ShareFile.cpp:105 msgid "OK" msgstr "OK" #: src/iptux/ShareFile.cpp:106 msgid "Apply" msgstr "Appliquer" #: src/iptux/ShareFile.cpp:107 msgid "Cancel" msgstr "Annuler" #: src/iptux/ShareFile.cpp:160 msgid "Add Files" msgstr "Ajouter des fichiers" #: src/iptux/ShareFile.cpp:163 msgid "Add Folders" msgstr "Ajouter des dossiers" #: src/iptux/ShareFile.cpp:166 msgid "Delete Resources" msgstr "Supprimer les ressources" #: src/iptux/ShareFile.cpp:169 msgid "Clear Password" msgstr "Supprimer le mot de passe" #: src/iptux/ShareFile.cpp:172 msgid "Set Password" msgstr "Mettre un mot de passe" #: src/iptux/ShareFile.cpp:229 src/iptux/ShareFile.cpp:373 msgid "regular" msgstr "normal" #: src/iptux/ShareFile.cpp:233 src/iptux/ShareFile.cpp:377 msgid "directory" msgstr "Dossier" #: src/iptux/ShareFile.cpp:237 src/iptux/ShareFile.cpp:381 msgid "unknown" msgstr "inconnu" #: src/iptux/ShareFile.cpp:270 msgid "File" msgstr "Fichier" #: src/iptux/ShareFile.cpp:286 msgid "Type" msgstr "Type" #: src/iptux/ShareFile.cpp:411 msgid "Choose the files to share" msgstr "Choisissez les fichiers à partager" #: src/iptux/ShareFile.cpp:414 msgid "Choose the folders to share" msgstr "Choisissez les dossiers à partager" #: src/iptux/TransWindow.cpp:86 msgid "Files Transmission Management" msgstr "Gestionnaire de partage de fichier" #: src/iptux/TransWindow.cpp:241 msgid "State" msgstr "Statut" #: src/iptux/TransWindow.cpp:247 msgid "Task" msgstr "Tâche" #: src/iptux/TransWindow.cpp:253 msgid "Peer" msgstr "Pair" #: src/iptux/TransWindow.cpp:265 msgid "Filename" msgstr "Nom du fichier" #: src/iptux/TransWindow.cpp:277 msgid "Completed" msgstr "Terminé" #: src/iptux/TransWindow.cpp:284 msgid "Progress" msgstr "Progression" #: src/iptux/TransWindow.cpp:291 msgid "Cost" msgstr "Évaluation" #: src/iptux/TransWindow.cpp:297 msgid "Remaining" msgstr "Restant" #: src/iptux/TransWindow.cpp:303 msgid "Rate" msgstr "Taux" #: src/iptux/TransWindow.cpp:331 msgid "The path you want to open not exist!" msgstr "Le chemin n'existe pas !" #: src/iptux/TransWindow.cpp:405 msgid "The file you want to open not exist!" msgstr "Le fichier que vous souhaitez ouvrir n'existe pas !" #: src/iptux/TransWindow.cpp:406 msgid "iptux Error" msgstr "Erreur iptux" #: src/iptux/UiCoreThread.cpp:254 src/iptux/UiCoreThread.cpp:278 #: src/iptux/UiCoreThread.cpp:377 src/iptux/UiCoreThread.cpp:399 msgid "Others" msgstr "Autres" #: src/iptux/UiCoreThread.cpp:419 msgid "Broadcast" msgstr "Diffuser" #: src/iptux/UiHelper.cpp:28 #, c-format msgid "Can't convert path to uri: %s, reason: %s" msgstr "" #: src/iptux/UiHelper.cpp:39 #, c-format msgid "Can't open path: %s, reason: %s" msgstr "" #: src/iptux/UiHelper.cpp:68 #, c-format msgid "Can't open URL: %s, reason: %s" msgstr "" #: src/iptux/UiHelper.cpp:188 msgid "Information" msgstr "Informations" #: src/iptux/UiHelper.cpp:218 msgid "Warning" msgstr "Avertissement" #: src/iptux/UiModels.cpp:604 #, fuzzy, c-format msgid "Version: %s" msgstr "Version : %s\n" #: src/iptux/UiModels.cpp:608 #, fuzzy, c-format msgid "Nickname: %s@%s" msgstr "Pseudo : %s@%s\n" #: src/iptux/UiModels.cpp:611 #, fuzzy, c-format msgid "Nickname: %s" msgstr "Pseudo : %s\n" #: src/iptux/UiModels.cpp:615 #, c-format msgid "User: %s" msgstr "Utilisateur : %s" #: src/iptux/UiModels.cpp:618 #, c-format msgid "Host: %s" msgstr "Hôte : %s" #: src/iptux/UiModels.cpp:623 #, c-format msgid "Address: %s(%s)" msgstr "Adresse : %s(%s)" #: src/iptux/UiModels.cpp:625 #, c-format msgid "Address: %s" msgstr "Adresse : %s" #: src/iptux/UiModels.cpp:630 msgid "Compatibility: Microsoft" msgstr "Compatibilité : Microsoft" #: src/iptux/UiModels.cpp:632 #, fuzzy msgid "Compatibility: GNU/Linux" msgstr "Compatibilité : GNU/Linux\n" #: src/iptux/UiModels.cpp:636 #, fuzzy, c-format msgid "System coding: %s" msgstr "Encodage : %s\n" #: src/iptux/UiModels.cpp:641 #, fuzzy msgid "Signature:" msgstr "Signature :\n" #: src/iptux/UiModels.cpp:744 msgid "" msgstr "" #: src/iptux/UiModels.cpp:799 msgid "[IMG]" msgstr "" #: src/iptux/dialog.cpp:39 msgid "" "File transfer has not been completed.\n" "Are you sure to cancel and quit?" msgstr "" "Le transfert du fichier n'a pas pu être terminé.\n" "Voulez-vous vraiment annuler ou quitter ?" #: src/iptux/dialog.cpp:42 msgid "Confirm Exit" msgstr "Confirmer la fermeture" #: src/iptux/dialog.cpp:62 src/iptux/resources/gtk/MainWindow.ui:12 #: src/iptux/resources/gtk/menus.ui:98 src/iptux/resources/gtk/menus.ui:243 msgid "Request Shared Resources" msgstr "Requête de ressources partagées" #: src/iptux/dialog.cpp:62 msgid "Agree" msgstr "Accepter" #: src/iptux/dialog.cpp:78 #, c-format msgid "" "Your pal (%s)[%s]\n" "is requesting to get your shared resources,\n" "Do you agree?" msgstr "" "Votre ami(e) (%s)[%s]\n" "demande l'accès à vos ressources partagées,\n" "Voulez-vous accepter ?" #: src/iptux/dialog.cpp:106 msgid "Access Password" msgstr "Mot de passe d'accès" #: src/iptux/dialog.cpp:113 msgid "Please input the password for the shared files behind" msgstr "Veuillez entrer le mot de passe pour le partage de fichiers" #: src/iptux/dialog.cpp:127 #, c-format msgid "(%s)[%s]Password:" msgstr "(%s)[%s]Mot de passe :" #: src/iptux/dialog.cpp:146 src/iptux/dialog.cpp:207 msgid "" "\n" "Empty Password!" msgstr "" "\n" "Mot de passe vide !" #: src/iptux/dialog.cpp:170 msgid "Enter a New Password" msgstr "Entrez un nouveau mot de passe" #: src/iptux/dialog.cpp:178 msgid "Password: " msgstr "Mot de passe : " #: src/iptux/dialog.cpp:187 msgid "Repeat: " msgstr "Confirmer : " #: src/iptux/dialog.cpp:202 msgid "" "\n" "Password Mismatched!" msgstr "" "\n" "Mot de passe erroné !" #: src/iptux/dialog.cpp:229 msgid "Please select a folder to save files." msgstr "Sélectionnez un dossier où sauver les données." #: src/iptux/resources/gtk/AboutDialog.ui:11 msgid "" "Copyright © 2008–2009, Jally\n" "Copyright © 2013–2015,2017–2021, LI Daobing" msgstr "" #: src/iptux/resources/gtk/AboutDialog.ui:13 #, fuzzy msgid "A GTK based LAN messenger." msgstr "Un logiciel de messagerie en réseau local écrit en GTK+." #: src/iptux/resources/gtk/AppIndicator.ui:6 #, fuzzy msgid "Open Iptux" msgstr "iptux" #: src/iptux/resources/gtk/AppIndicator.ui:12 #: src/iptux/resources/gtk/menus.ui:6 src/iptux/resources/gtk/menus.ui:306 msgid "_Preferences" msgstr "_Préférences" #: src/iptux/resources/gtk/AppIndicator.ui:16 #: src/iptux/resources/gtk/menus.ui:10 src/iptux/resources/gtk/menus.ui:310 msgid "_Quit" msgstr "_Quitter" #: src/iptux/resources/gtk/DetectPal.ui:7 #, fuzzy msgid "Detect pal" msgstr "Détecter les ami(e)s" #: src/iptux/resources/gtk/DetectPal.ui:15 msgid "Detect" msgstr "Détecter" #: src/iptux/resources/gtk/DetectPal.ui:61 msgid "Please input an IP address (IPv4 only):" msgstr "Veuillez entrer une adresse IP (IPv4 seulement) :" #: src/iptux/resources/gtk/MainWindow.ui:8 src/iptux/resources/gtk/menus.ui:109 #: src/iptux/resources/gtk/menus.ui:254 msgid "Send Message" msgstr "Envoyer un message" #: src/iptux/resources/gtk/MainWindow.ui:16 msgid "Change Info" msgstr "Modifier les infos" #: src/iptux/resources/gtk/MainWindow.ui:20 msgid "Delete Pal" msgstr "Supprimer l'ami(e)" #: src/iptux/resources/gtk/MainWindow.ui:26 src/iptux/resources/gtk/menus.ui:31 #: src/iptux/resources/gtk/menus.ui:176 msgid "Sort" msgstr "Trier" #: src/iptux/resources/gtk/MainWindow.ui:29 src/iptux/resources/gtk/menus.ui:34 #: src/iptux/resources/gtk/menus.ui:179 msgid "By Nickname" msgstr "Par Pseudo" #: src/iptux/resources/gtk/MainWindow.ui:34 src/iptux/resources/gtk/menus.ui:39 #: src/iptux/resources/gtk/menus.ui:184 #, fuzzy msgid "By Username" msgstr "Par Pseudo" #: src/iptux/resources/gtk/MainWindow.ui:39 src/iptux/resources/gtk/menus.ui:44 #: src/iptux/resources/gtk/menus.ui:189 msgid "By IP" msgstr "Par IP" #: src/iptux/resources/gtk/MainWindow.ui:44 src/iptux/resources/gtk/menus.ui:49 #: src/iptux/resources/gtk/menus.ui:194 #, fuzzy msgid "By Host" msgstr "Hôte" #: src/iptux/resources/gtk/MainWindow.ui:49 src/iptux/resources/gtk/menus.ui:54 #: src/iptux/resources/gtk/menus.ui:199 msgid "By Last Activity" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:56 src/iptux/resources/gtk/menus.ui:61 #: src/iptux/resources/gtk/menus.ui:206 msgid "Ascending" msgstr "Ordre croissant" #: src/iptux/resources/gtk/MainWindow.ui:61 src/iptux/resources/gtk/menus.ui:66 #: src/iptux/resources/gtk/menus.ui:211 msgid "Descending" msgstr "Ordre décroissant" #: src/iptux/resources/gtk/MainWindow.ui:68 msgid "Info Style" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:71 #, fuzzy msgid "IP" msgstr "IPv4" #: src/iptux/resources/gtk/MainWindow.ui:76 msgid "IP:PORT" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:86 #, fuzzy msgid "Username" msgstr "Utilisateur" #: src/iptux/resources/gtk/MainWindow.ui:91 #, fuzzy msgid "Version" msgstr "Version : %s\n" #: src/iptux/resources/gtk/MainWindow.ui:96 msgid "Last Activity" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:101 #, fuzzy msgid "Last Message" msgstr "Message vide" #: src/iptux/resources/gtk/menus.ui:17 src/iptux/resources/gtk/menus.ui:162 msgid "_File" msgstr "_Fichier" #: src/iptux/resources/gtk/menus.ui:19 src/iptux/resources/gtk/menus.ui:164 msgid "_Detect" msgstr "_Détecter" #: src/iptux/resources/gtk/menus.ui:23 src/iptux/resources/gtk/menus.ui:168 msgid "_Find" msgstr "_Rechercher" #: src/iptux/resources/gtk/menus.ui:28 src/iptux/resources/gtk/menus.ui:173 msgid "_View" msgstr "_Visualiser" #: src/iptux/resources/gtk/menus.ui:73 src/iptux/resources/gtk/menus.ui:218 msgid "_Refresh" msgstr "_Actualiser" #: src/iptux/resources/gtk/menus.ui:80 src/iptux/resources/gtk/menus.ui:225 msgid "_Chat" msgstr "_Discussion" #: src/iptux/resources/gtk/menus.ui:88 src/iptux/resources/gtk/menus.ui:233 msgid "Attach File" msgstr "Joindre un fichier" #: src/iptux/resources/gtk/menus.ui:92 src/iptux/resources/gtk/menus.ui:237 msgid "Attach Folder" msgstr "Joindre un dossier" #: src/iptux/resources/gtk/menus.ui:102 src/iptux/resources/gtk/menus.ui:247 #, fuzzy msgid "Clear Chat History" msgstr "Sauvegarder l'historique de discussion" #: src/iptux/resources/gtk/menus.ui:115 src/iptux/resources/gtk/menus.ui:260 msgid "_Window" msgstr "_Fenêtre" #: src/iptux/resources/gtk/menus.ui:118 src/iptux/resources/gtk/menus.ui:263 msgid "_Transmission" msgstr "Trans_mission" #: src/iptux/resources/gtk/menus.ui:122 src/iptux/resources/gtk/menus.ui:267 msgid "_Shared Management" msgstr "_Gestionnaire de partage" #: src/iptux/resources/gtk/menus.ui:126 src/iptux/resources/gtk/menus.ui:271 msgid "_Chat Log" msgstr "_Historique" #: src/iptux/resources/gtk/menus.ui:130 src/iptux/resources/gtk/menus.ui:275 msgid "_System Log" msgstr "_Journal système" #: src/iptux/resources/gtk/menus.ui:136 src/iptux/resources/gtk/menus.ui:281 #, fuzzy msgid "Close Window" msgstr "_Fenêtre" #: src/iptux/resources/gtk/menus.ui:142 src/iptux/resources/gtk/menus.ui:287 msgid "_Help" msgstr "Aid_e" #: src/iptux/resources/gtk/menus.ui:145 src/iptux/resources/gtk/menus.ui:290 msgid "_About" msgstr "_À propos" #: src/iptux/resources/gtk/menus.ui:149 src/iptux/resources/gtk/menus.ui:294 msgid "Report Bug" msgstr "Signaler une erreur" #: src/iptux/resources/gtk/menus.ui:153 src/iptux/resources/gtk/menus.ui:298 msgid "What's New" msgstr "" #: src/iptux/resources/gtk/menus.ui:318 msgid "Open This File" msgstr "Ouvrir ce fichier" #: src/iptux/resources/gtk/menus.ui:322 msgid "Open Containing Folder" msgstr "Ouvrir ce dossier" #: src/iptux/resources/gtk/menus.ui:326 msgid "Terminate Task" msgstr "Achever la tâche" #: src/iptux/resources/gtk/menus.ui:330 msgid "Terminate All" msgstr "Tout achever" #: src/iptux/resources/gtk/menus.ui:334 msgid "Clear Tasklist" msgstr "Vider la liste des tâches" #: src/iptux/resources/gtk/menus.ui:346 msgid "Refuse All" msgstr "Tout refuser" #: src/main/iptux.cpp:149 #, fuzzy msgid "- A software for sharing in LAN" msgstr "iptux : Logiciel de partage pour réseau local\n" #: src/main/iptux.cpp:152 #, c-format msgid "option parsing failed: %s\n" msgstr "" #~ msgid "Can't find any available web browser!\n" #~ msgstr "Impossible de trouver un navigateur web disponible !\n" #~ msgid "chat;talk;im;message;ipmsg;feige;" #~ msgstr "discussion;conversation;im;message;ipmsg;feige;" #~ msgid "It can:" #~ msgstr "Il peut :" #, fuzzy #~ msgid "Close Chat" #~ msgstr "Fermer" #~ msgid "Pals Online: %" #~ msgstr "Ami(e)s en ligne : %" #~ msgid "Sound" #~ msgstr "Son" #~ msgid "Activate the sound support" #~ msgstr "Activer le support de son" #~ msgid "Volume Control: " #~ msgstr "Contrôle du volume : " #~ msgid "Sound Event" #~ msgstr "Événements sonores" #~ msgid "Test" #~ msgstr "Test" #~ msgid "Stop" #~ msgstr "Arrêter" #~ msgid "Transfer finished" #~ msgstr "Transfert terminé" #~ msgid "Message received" #~ msgstr "Message reçu" #~ msgid "Play" #~ msgstr "Lire" #~ msgid "Event" #~ msgstr "Événement" #~ msgid "Please select a sound file" #~ msgstr "Veuillez sélectionner un fichier son" #, fuzzy #~ msgid "Failed to play the prompt tone, [%s] %s, %s" #~ msgstr "Échec de la lecture de la sonnerie, %s\n" #~ msgid "_Hide" #~ msgstr "Masq_uer" #~ msgid "_Show" #~ msgstr "Mo_ntrer" #~ msgid "To be read: %u messages" #~ msgstr "Lus : %u messages" #~ msgid "_Tools" #~ msgstr "Ou_tils" #~ msgid "Error" #~ msgstr "Erreur" #, fuzzy #~ msgid "iptux-icon" #~ msgstr "iptux" #~ msgid "Please input an IP address (IPv4 only)!" #~ msgstr "Veuillez entrer une adresse IP (IPv4 seulement) !" #~ msgid "..." #~ msgstr "…" #~ msgid "Clear Buffer" #~ msgstr "Vider la mémoire" #, fuzzy #~ msgid "Contributors" #~ msgstr "Contributeurs" #, fuzzy #~ msgid "" #~ "Fatal Error!!\n" #~ "Failed to bind the TCP/UDP port(%d)!\n" #~ "%s" #~ msgstr "" #~ "Erreur fatale !!\n" #~ "Impossible de se connecter au port TCP/UDP (2425) !\n" #~ "%s" #~ msgid "Help" #~ msgstr "Aide" #~ msgid "" #~ "It's an honor that iptux was contributed voluntarilly by many people. " #~ "Without your help, iptux could never make it.\n" #~ "\n" #~ "Especially, Here's some we would like to thank much:\n" #~ "\n" #~ "ChenGang\n" #~ "\n" #~ "\n" #~ "\n" #~ "\n" #~ "\n" #~ "..." #~ msgstr "" #~ "C'est un honneur qu'iptux soit le fruit de la contribution de nombreuses " #~ "personnes volontaires. Sans votre aide iptux n'aurait jamais pu faire " #~ "cela.\n" #~ "\n" #~ "Nous voulons remercier plus particulièrement :\n" #~ "\n" #~ "ChenGang\n" #~ "\n" #~ "\n" #~ "\n" #~ "\n" #~ "\n" #~ "..." #~ msgid "Jally " #~ msgstr "Jally " #~ msgid "LiWeijian " #~ msgstr "LiWeijian " #~ msgid "ManPT " #~ msgstr "ManPT " #~ msgid "More About Iptux" #~ msgstr "À propos d'Iptux" #~ msgid "The process is about to quit!" #~ msgstr "Le processus est sur le point de quitter !" #~ msgid "_FAQ" #~ msgstr "_FAQ" #~ msgid "_More" #~ msgstr "_Plus" #~ msgid "_Sort" #~ msgstr "_Trier" #~ msgid "_Update" #~ msgstr "_Mettre à jour" #~ msgid "" #~ "alick \n" #~ "ManPT " #~ msgstr "" #~ "alick \n" #~ "ManPT \n" #~ "ButterflyOfFire " #~ msgid "" #~ "\t-h --help\n" #~ "\t\tdisplay this help and exit\n" #~ msgstr "" #~ "\t-h --help\n" #~ "\t\tmontrer l'aide et quitter\n" #~ msgid "" #~ "\t-v --version\n" #~ "\t\toutput version information and exit\n" #~ msgstr "" #~ "\t-v --version\n" #~ "\t\tsortie d'information de version et quitter\n" #~ msgid "Opendir() directory \"%s\" failed, %s\n" #~ msgstr "Opendir() dossier \"%s\" a échoué, %s\n" #~ msgid "Rmdir() directory \"%s\" failed, %s\n" #~ msgstr "Rmdir() dossier \"%s\" a échoué, %s\n" #~ msgid "Stat() file \"%s\" failed, %s\n" #~ msgstr "Stat() un fichier \"%s\" a échoué, %s\n" #~ msgid "The user is not privileged!\n" #~ msgstr "L'utisateur n'a pas les permissions requises !\n" #~ msgid "Unlink() file \"%s\" failed, %s\n" #~ msgstr "Échec() de la suppression du fichier \"%s\", %s\n" #~ msgid "What do you want to do?\n" #~ msgstr "Que désirez-vous faire ?\n" #~ msgid "utf-16" #~ msgstr "utf-16" #~ msgid "utf-8" #~ msgstr "utf-8" iptux-0.9.4/po/gl.po000066400000000000000000000671771475473122500143110ustar00rootroot00000000000000# Galician translation for iptux # Copyright (c) 2010 Rosetta Contributors and Canonical Ltd 2010 # This file is distributed under the same license as the iptux package. # FIRST AUTHOR , 2010. # msgid "" msgstr "" "Project-Id-Version: iptux\n" "Report-Msgid-Bugs-To: https://github.com/iptux-src/iptux/issues/new\n" "POT-Creation-Date: 2025-02-17 13:35-0800\n" "PO-Revision-Date: 2010-05-03 13:06+0000\n" "Last-Translator: Dario \n" "Language-Team: Galician \n" "Language: gl\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Launchpad-Export-Date: 2018-01-24 12:00+0000\n" "X-Generator: Launchpad (build 18532)\n" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:6 msgid "iptux" msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:7 msgid "LAN communication software" msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:17 msgid "iptux is an “IP Messenger” client. The features of iptux include:" msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:21 msgid "auto-detect other clients on the intranet." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:22 msgid "send/recv messages to other clients." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:23 msgid "send/recv files to other clients." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:24 msgid "share your files to other cliens (with optional password protection)." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:26 msgid "" "It is (supposedly) compatible with 飞鸽传书 (Feige) and 飞秋 (FeiQ) from " "China, and with the original “IP Messenger” clients from Japan, including " "g2ipmsg and xipmsg in Debian." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:38 msgid "The Iptux main window." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:42 msgid "The Iptux chat window." msgstr "" #: src/iptux-core/CoreThread.cpp:172 #, c-format msgid "" "Fatal Error!! Failed to create new socket!\n" "%s" msgstr "" #: src/iptux-core/CoreThread.cpp:188 #, c-format msgid "" "Fatal Error!! Failed to bind the TCP port(%s:%d)!\n" "%s" msgstr "" #: src/iptux-core/CoreThread.cpp:201 #, c-format msgid "" "Fatal Error!! Failed to bind the UDP port(%s:%d)!\n" "%s" msgstr "" #: src/iptux-core/CoreThread.cpp:461 src/iptux-core/CoreThread.cpp:495 #: src/iptux-core/internal/RecvFileData.cpp:142 #: src/iptux-core/internal/RecvFileData.cpp:204 #, c-format msgid "" "Fatal Error!!\n" "Failed to create new socket!\n" "%s" msgstr "" #: src/iptux-core/Models.cpp:172 msgid "Empty Message" msgstr "" #: src/iptux-core/Models.cpp:250 msgid "Received an image" msgstr "" #: src/iptux-core/internal/AnalogFS.cpp:93 #: src/iptux-core/internal/AnalogFS.cpp:98 #, c-format msgid "Open() file \"%s\" failed, %s" msgstr "Open() arquivo \"%s\" fallou, %s" #: src/iptux-core/internal/AnalogFS.cpp:117 #, c-format msgid "Stat64() file \"%s\" failed, %s" msgstr "Stat64() arquivo \"%s\" fallou, %s" #: src/iptux-core/internal/AnalogFS.cpp:138 #, c-format msgid "Mkdir() directory \"%s\" failed, %s" msgstr "Mkdir() directorio \"%s\" fallou, %s" #: src/iptux-core/internal/AnalogFS.cpp:164 #, c-format msgid "Opendir() directory \"%s\" failed, %s" msgstr "Opendir() directorio \"%s\" fallou, %s" #: src/iptux-core/internal/Command.cpp:226 msgid "Your pal didn't receive the packet. He or she is offline maybe." msgstr "" "O teu amigo non recibiu o paquetet. El/Ela seguramente estea fora de liña." #: src/iptux-core/internal/CommandMode.cpp:39 #, c-format msgid "unknown command mode: %d" msgstr "" #: src/iptux-core/internal/RecvFileData.cpp:117 msgid "receive" msgstr "" #: src/iptux-core/internal/RecvFileData.cpp:124 #: src/iptux-core/internal/RecvFileData.cpp:253 #: src/iptux-core/internal/SendFileData.cpp:108 #: src/iptux-core/internal/SendFileData.cpp:193 #, fuzzy msgid "Unknown" msgstr "descoñecido" #: src/iptux-core/internal/RecvFileData.cpp:175 #, c-format msgid "" "Failed to receive the file \"%s\" from %s! expect length %jd, received %jd" msgstr "" #: src/iptux-core/internal/RecvFileData.cpp:180 #, c-format msgid "Receive the file \"%s\" from %s successfully!" msgstr "" #: src/iptux-core/internal/RecvFileData.cpp:320 #, c-format msgid "Failed to receive the directory \"%s\" from %s!" msgstr "" #: src/iptux-core/internal/RecvFileData.cpp:323 #, c-format msgid "Receive the directory \"%s\" from %s successfully!" msgstr "" #: src/iptux-core/internal/SendFileData.cpp:101 msgid "send" msgstr "" #: src/iptux-core/internal/SendFileData.cpp:137 #, c-format msgid "Failed to send the file \"%s\" to %s!" msgstr "" #: src/iptux-core/internal/SendFileData.cpp:142 #, c-format msgid "Send the file \"%s\" to %s successfully!" msgstr "" #: src/iptux-core/internal/SendFileData.cpp:265 #, c-format msgid "Failed to send the directory \"%s\" to %s!" msgstr "" #: src/iptux-core/internal/SendFileData.cpp:270 #, c-format msgid "Send the directory \"%s\" to %s successfully!" msgstr "" #: src/iptux-core/internal/UdpData.cpp:92 #: src/iptux-core/internal/UdpData.cpp:93 #: src/iptux-core/internal/UdpData.cpp:443 #: src/iptux-core/internal/UdpData.cpp:484 msgid "mysterious" msgstr "" #: src/iptux-utils/utils.cpp:880 #, c-format msgid "stat file \"%s\" failed: %s" msgstr "" #: src/iptux-utils/utils.cpp:888 #, c-format msgid "path %s is not file or directory: st_mode(%x)" msgstr "" #: src/iptux-utils/utils.cpp:895 #, c-format msgid "opendir on \"%s\" failed: %s" msgstr "" #: src/iptux/AboutDialog.cpp:39 msgid "TRANSLATOR NAME" msgstr "" #: src/iptux/AboutDialog.cpp:53 msgid "Thanks to" msgstr "" #: src/iptux/AppIndicator.cpp:40 src/iptux/MainWindow.cpp:505 #: src/iptux/MainWindow.cpp:507 msgid "Iptux" msgstr "" #: src/iptux/Application.cpp:54 msgid "Loading the process successfully!" msgstr "" #: src/iptux/Application.cpp:274 #, c-format msgid "New Message from %s" msgstr "" #: src/iptux/Application.cpp:287 #, c-format msgid "New File from %s" msgstr "" #: src/iptux/Application.cpp:296 msgid "Receiving File Finished" msgstr "" #: src/iptux/Application.cpp:300 msgid "file info no longer exist" msgstr "" #: src/iptux/Darwin.cpp:16 #, c-format msgid "Couldn’t load icon: %s" msgstr "" #: src/iptux/DataSettings.cpp:46 msgid "Personal" msgstr "Persoal" #: src/iptux/DataSettings.cpp:48 msgid "System" msgstr "Sistema" #: src/iptux/DataSettings.cpp:50 msgid "Network" msgstr "Rede" #: src/iptux/DataSettings.cpp:89 src/iptux/DataSettings.cpp:98 msgid "The program needs to be restarted to take effect!" msgstr "" #: src/iptux/DataSettings.cpp:143 msgid "Preferences" msgstr "Preferencias" #: src/iptux/DataSettings.cpp:143 src/iptux/RevisePal.cpp:109 #: src/iptux/dialog.cpp:107 src/iptux/dialog.cpp:170 msgid "_OK" msgstr "" #: src/iptux/DataSettings.cpp:144 msgid "_Apply" msgstr "" #: src/iptux/DataSettings.cpp:144 src/iptux/DataSettings.cpp:1348 #: src/iptux/DataSettings.cpp:1395 src/iptux/DialogBase.cpp:359 #: src/iptux/DialogBase.cpp:918 src/iptux/RevisePal.cpp:110 #: src/iptux/ShareFile.cpp:419 src/iptux/callback.cpp:87 #: src/iptux/dialog.cpp:171 src/iptux/dialog.cpp:230 msgid "_Cancel" msgstr "" #: src/iptux/DataSettings.cpp:169 #, fuzzy msgid "Your _nickname:" msgstr "O teu alcume:" #: src/iptux/DataSettings.cpp:176 msgid "Please input your nickname!" msgstr "Por favor intruduza o seu alcume!" #: src/iptux/DataSettings.cpp:182 #, fuzzy msgid "Your _group name:" msgstr "O nome do teu grupo:" #: src/iptux/DataSettings.cpp:189 msgid "Please input your group name!" msgstr "Por favor introduza o nome do teu grupo!" #: src/iptux/DataSettings.cpp:195 #, fuzzy msgid "Your _face picture:" msgstr "Unha foto da tua cara:" #: src/iptux/DataSettings.cpp:213 #, fuzzy msgid "_Save files to: " msgstr "Gardar arquivos en: " #: src/iptux/DataSettings.cpp:226 msgid "Photo" msgstr "Foto" #: src/iptux/DataSettings.cpp:238 msgid "Signature" msgstr "Sinatura" #: src/iptux/DataSettings.cpp:271 msgid "Port:" msgstr "" #: src/iptux/DataSettings.cpp:278 msgid "Any port number between 1024 and 65535, default is 2425" msgstr "" #: src/iptux/DataSettings.cpp:287 #, fuzzy msgid "Candidate network encodings:" msgstr "Candidato de codificación de rede:" #: src/iptux/DataSettings.cpp:294 #, fuzzy msgid "Candidate network encodings, separated by \",\"" msgstr "Candidato de codificación de rede" #: src/iptux/DataSettings.cpp:301 #, fuzzy msgid "Preferred network encoding:" msgstr "Codificación de rede preferido:" #: src/iptux/DataSettings.cpp:308 msgid "" "Preference network coding (You should be aware of what you are doing if you " "want to modify it.)" msgstr "" "Codificación de rede preferido( Deberias saber o que estás a facer antes de " "modificar esto.)" #: src/iptux/DataSettings.cpp:316 msgid "Pal's default face picture:" msgstr "Foto por defecto do teu amigo:" #: src/iptux/DataSettings.cpp:334 msgid "Panel font:" msgstr "Fonte de panel:" #: src/iptux/DataSettings.cpp:346 msgid "Automatically open the chat dialog" msgstr "" #: src/iptux/DataSettings.cpp:354 msgid "Automatically hide the panel after login" msgstr "Automaticamente agochar o panel despois de identificarse" #: src/iptux/DataSettings.cpp:362 msgid "Automatically open the File Transmission Management" msgstr "" #: src/iptux/DataSettings.cpp:370 msgid "Use the 'Enter' key to send message" msgstr "" #: src/iptux/DataSettings.cpp:378 msgid "Automatically clean up the chat history" msgstr "" #: src/iptux/DataSettings.cpp:385 msgid "Save the chat history" msgstr "" #: src/iptux/DataSettings.cpp:393 msgid "Use the Blacklist (NOT recommended)" msgstr "" #: src/iptux/DataSettings.cpp:401 msgid "Filter the request of sharing files" msgstr "" #: src/iptux/DataSettings.cpp:408 msgid "Hide the taskbar when the main window is minimized" msgstr "" #: src/iptux/DataSettings.cpp:432 msgid "From:" msgstr "" #: src/iptux/DataSettings.cpp:438 msgid "Beginning of the IP(v4) section" msgstr "" #: src/iptux/DataSettings.cpp:442 msgid "To:" msgstr "" #: src/iptux/DataSettings.cpp:448 msgid "End of the IP(v4) section" msgstr "" #: src/iptux/DataSettings.cpp:456 msgid "Add" msgstr "" #: src/iptux/DataSettings.cpp:461 msgid "Delete" msgstr "" #: src/iptux/DataSettings.cpp:468 msgid "Added IP(v4) Section:" msgstr "" #: src/iptux/DataSettings.cpp:487 msgid "Import" msgstr "" #: src/iptux/DataSettings.cpp:491 msgid "Export" msgstr "" #: src/iptux/DataSettings.cpp:495 src/iptux/TransWindow.cpp:171 msgid "Clear" msgstr "" #: src/iptux/DataSettings.cpp:706 msgid "From" msgstr "" #: src/iptux/DataSettings.cpp:713 msgid "To" msgstr "" #: src/iptux/DataSettings.cpp:720 msgid "Description" msgstr "" #: src/iptux/DataSettings.cpp:736 msgid "Please select download folder" msgstr "" #: src/iptux/DataSettings.cpp:758 msgid "Select Font" msgstr "" #: src/iptux/DataSettings.cpp:872 src/iptux/DataSettings.cpp:874 #: src/iptux/DataSettings.cpp:878 msgid "Port must be a number between 1024 and 65535" msgstr "" #: src/iptux/DataSettings.cpp:1019 src/iptux/DataSettings.cpp:1050 #, c-format msgid "" "Fopen() file \"%s\" failed!\n" "%s" msgstr "" #: src/iptux/DataSettings.cpp:1150 src/iptux/RevisePal.cpp:419 msgid "Please select a face picture" msgstr "" #: src/iptux/DataSettings.cpp:1172 msgid "Please select a personal photo" msgstr "" #: src/iptux/DataSettings.cpp:1241 src/iptux/DataSettings.cpp:1248 #: src/iptux/DetectPal.cpp:75 #, c-format msgid "" "\n" "Illegal IP(v4) address: %s!" msgstr "" #: src/iptux/DataSettings.cpp:1346 msgid "Please select a file to import data" msgstr "" #: src/iptux/DataSettings.cpp:1347 src/iptux/DialogBase.cpp:358 #: src/iptux/ShareFile.cpp:418 src/iptux/callback.cpp:86 msgid "_Open" msgstr "" #: src/iptux/DataSettings.cpp:1394 msgid "Save data to file" msgstr "" #: src/iptux/DataSettings.cpp:1395 src/iptux/DialogBase.cpp:919 #: src/iptux/dialog.cpp:231 msgid "_Save" msgstr "" #: src/iptux/DetectPal.cpp:70 #, c-format msgid "The notification has been sent to %s." msgstr "" #: src/iptux/DialogBase.cpp:214 #, c-format msgid "%s To Send." msgstr "" #: src/iptux/DialogBase.cpp:272 msgid "Close" msgstr "" #: src/iptux/DialogBase.cpp:276 src/iptux/DialogGroup.cpp:375 msgid "Send" msgstr "" #: src/iptux/DialogBase.cpp:307 msgid "Chat History" msgstr "" #: src/iptux/DialogBase.cpp:350 msgid "Choose enclosure files" msgstr "" #: src/iptux/DialogBase.cpp:353 msgid "Choose enclosure folders" msgstr "" #: src/iptux/DialogBase.cpp:593 msgid "Remove Selected" msgstr "" #: src/iptux/DialogBase.cpp:648 msgid "File to send." msgstr "" #: src/iptux/DialogBase.cpp:653 msgid "Sending progress." msgstr "" #: src/iptux/DialogBase.cpp:656 msgid "Dirs" msgstr "" #: src/iptux/DialogBase.cpp:659 msgid "Files" msgstr "" #: src/iptux/DialogBase.cpp:662 src/iptux/DialogPeer.cpp:565 msgid "Detail" msgstr "" #: src/iptux/DialogBase.cpp:712 msgid "PeerName" msgstr "" #: src/iptux/DialogBase.cpp:719 src/iptux/DialogPeer.cpp:716 msgid "Name" msgstr "" #: src/iptux/DialogBase.cpp:725 src/iptux/DialogPeer.cpp:652 #: src/iptux/DialogPeer.cpp:722 src/iptux/ShareFile.cpp:280 #: src/iptux/TransWindow.cpp:271 msgid "Size" msgstr "" #: src/iptux/DialogBase.cpp:731 msgid "Path" msgstr "" #: src/iptux/DialogBase.cpp:792 msgid "Sending Progress." msgstr "" #: src/iptux/DialogBase.cpp:795 #, c-format msgid "%s of %s Sent." msgstr "" #: src/iptux/DialogBase.cpp:802 src/iptux/DialogPeer.cpp:835 msgid "Mission Completed!" msgstr "" #: src/iptux/DialogBase.cpp:845 src/iptux/DialogBase.cpp:917 msgid "Save Image" msgstr "" #: src/iptux/DialogBase.cpp:850 msgid "Copy Image" msgstr "" #: src/iptux/DialogGroup.cpp:285 msgid "Member" msgstr "" #: src/iptux/DialogGroup.cpp:382 msgid "Pals" msgstr "" #: src/iptux/DialogGroup.cpp:480 msgid "Select All" msgstr "" #: src/iptux/DialogGroup.cpp:485 msgid "Reverse Select" msgstr "" #: src/iptux/DialogGroup.cpp:490 msgid "Clear Up" msgstr "" #: src/iptux/DialogGroup.cpp:728 #, c-format msgid "Talk with the group %s" msgstr "" #: src/iptux/DialogPeer.cpp:132 #, c-format msgid "Talk with %s(%s) IP:%s" msgstr "" #: src/iptux/DialogPeer.cpp:305 msgid "Info." msgstr "" #: src/iptux/DialogPeer.cpp:337 #, c-format msgid "Version: %s\n" msgstr "" #: src/iptux/DialogPeer.cpp:339 #, c-format msgid "Nickname: %s@%s\n" msgstr "" #: src/iptux/DialogPeer.cpp:342 #, c-format msgid "Nickname: %s\n" msgstr "" #: src/iptux/DialogPeer.cpp:344 #, c-format msgid "User: %s\n" msgstr "" #: src/iptux/DialogPeer.cpp:345 #, c-format msgid "Host: %s\n" msgstr "" #: src/iptux/DialogPeer.cpp:348 #, c-format msgid "Address: %s(%s)\n" msgstr "" #: src/iptux/DialogPeer.cpp:350 #, c-format msgid "Address: %s\n" msgstr "" #: src/iptux/DialogPeer.cpp:353 msgid "Compatibility: Microsoft\n" msgstr "" #: src/iptux/DialogPeer.cpp:355 msgid "Compatibility: GNU/Linux\n" msgstr "" #: src/iptux/DialogPeer.cpp:357 #, c-format msgid "System coding: %s\n" msgstr "" #: src/iptux/DialogPeer.cpp:362 msgid "Signature:\n" msgstr "" #: src/iptux/DialogPeer.cpp:369 msgid "" "\n" "Photo:\n" msgstr "" #: src/iptux/DialogPeer.cpp:460 msgid "Please select a picture to insert the buffer" msgstr "" #: src/iptux/DialogPeer.cpp:486 src/iptux/resources/gtk/menus.ui:83 #: src/iptux/resources/gtk/menus.ui:228 msgid "Insert Image" msgstr "" #: src/iptux/DialogPeer.cpp:502 msgid "Enclosure." msgstr "" #: src/iptux/DialogPeer.cpp:547 msgid "Files to be received" msgstr "" #: src/iptux/DialogPeer.cpp:551 msgid "Receiving progress." msgstr "" #: src/iptux/DialogPeer.cpp:554 msgid "Accept" msgstr "" #: src/iptux/DialogPeer.cpp:560 src/iptux/dialog.cpp:63 #: src/iptux/resources/gtk/menus.ui:342 msgid "Refuse" msgstr "" #: src/iptux/DialogPeer.cpp:596 msgid "File received." msgstr "" #: src/iptux/DialogPeer.cpp:639 src/iptux/DialogPeer.cpp:710 msgid "Source" msgstr "" #: src/iptux/DialogPeer.cpp:646 msgid "SaveAs" msgstr "" #: src/iptux/DialogPeer.cpp:818 src/iptux/DialogPeer.cpp:884 msgid "Receiving Progress." msgstr "" #: src/iptux/DialogPeer.cpp:821 src/iptux/DialogPeer.cpp:887 #, c-format msgid "%s to Receive." msgstr "" #: src/iptux/DialogPeer.cpp:825 src/iptux/DialogPeer.cpp:891 #, c-format msgid "%s Of %s Received." msgstr "" #: src/iptux/LogSystem.cpp:71 #, c-format msgid "Recevied-From: Nickname:%s User:%s Host:%s" msgstr "" #: src/iptux/LogSystem.cpp:76 #, c-format msgid "Send-To: Nickname:%s User:%s Host:%s" msgstr "" #: src/iptux/LogSystem.cpp:80 msgid "Send-Broadcast" msgstr "" #: src/iptux/LogSystem.cpp:99 #, c-format msgid "User:%s Host:%s" msgstr "" #: src/iptux/MainWindow.cpp:570 msgid "Pals Online: 0" msgstr "" #: src/iptux/MainWindow.cpp:655 msgid "Search Pals" msgstr "" #: src/iptux/MainWindow.cpp:768 msgid "Nickname" msgstr "" #: src/iptux/MainWindow.cpp:778 msgid "Group" msgstr "" #: src/iptux/MainWindow.cpp:784 src/iptux/TransWindow.cpp:258 msgid "IPv4" msgstr "" #: src/iptux/MainWindow.cpp:790 msgid "User" msgstr "" #: src/iptux/MainWindow.cpp:796 src/iptux/resources/gtk/MainWindow.ui:81 msgid "Host" msgstr "" #: src/iptux/MainWindow.cpp:935 #, c-format msgid "Pals Online: %d" msgstr "" #: src/iptux/RevisePal.cpp:109 msgid "Change Pal's Information" msgstr "" #: src/iptux/RevisePal.cpp:134 msgid "Pal's nickname:" msgstr "" #: src/iptux/RevisePal.cpp:140 msgid "Please input pal's new nickname!" msgstr "" #: src/iptux/RevisePal.cpp:146 msgid "Pal's group name:" msgstr "" #: src/iptux/RevisePal.cpp:152 msgid "Please input pal's new group name!" msgstr "" #: src/iptux/RevisePal.cpp:158 msgid "System coding:" msgstr "" #: src/iptux/RevisePal.cpp:164 msgid "Be SURE to know what you are doing!" msgstr "" #: src/iptux/RevisePal.cpp:170 msgid "Pal's face picture:" msgstr "" #: src/iptux/RevisePal.cpp:184 msgid "Be compatible with iptux's protocol (DANGEROUS)" msgstr "" #: src/iptux/ShareFile.cpp:104 msgid "Shared Files Management" msgstr "" #: src/iptux/ShareFile.cpp:105 msgid "OK" msgstr "" #: src/iptux/ShareFile.cpp:106 msgid "Apply" msgstr "" #: src/iptux/ShareFile.cpp:107 msgid "Cancel" msgstr "" #: src/iptux/ShareFile.cpp:160 msgid "Add Files" msgstr "" #: src/iptux/ShareFile.cpp:163 msgid "Add Folders" msgstr "" #: src/iptux/ShareFile.cpp:166 msgid "Delete Resources" msgstr "" #: src/iptux/ShareFile.cpp:169 msgid "Clear Password" msgstr "" #: src/iptux/ShareFile.cpp:172 msgid "Set Password" msgstr "" #: src/iptux/ShareFile.cpp:229 src/iptux/ShareFile.cpp:373 msgid "regular" msgstr "" #: src/iptux/ShareFile.cpp:233 src/iptux/ShareFile.cpp:377 msgid "directory" msgstr "" #: src/iptux/ShareFile.cpp:237 src/iptux/ShareFile.cpp:381 msgid "unknown" msgstr "descoñecido" #: src/iptux/ShareFile.cpp:270 msgid "File" msgstr "" #: src/iptux/ShareFile.cpp:286 msgid "Type" msgstr "" #: src/iptux/ShareFile.cpp:411 msgid "Choose the files to share" msgstr "" #: src/iptux/ShareFile.cpp:414 msgid "Choose the folders to share" msgstr "" #: src/iptux/TransWindow.cpp:86 msgid "Files Transmission Management" msgstr "" #: src/iptux/TransWindow.cpp:241 msgid "State" msgstr "" #: src/iptux/TransWindow.cpp:247 msgid "Task" msgstr "" #: src/iptux/TransWindow.cpp:253 msgid "Peer" msgstr "" #: src/iptux/TransWindow.cpp:265 msgid "Filename" msgstr "" #: src/iptux/TransWindow.cpp:277 msgid "Completed" msgstr "" #: src/iptux/TransWindow.cpp:284 msgid "Progress" msgstr "" #: src/iptux/TransWindow.cpp:291 msgid "Cost" msgstr "" #: src/iptux/TransWindow.cpp:297 msgid "Remaining" msgstr "" #: src/iptux/TransWindow.cpp:303 msgid "Rate" msgstr "" #: src/iptux/TransWindow.cpp:331 msgid "The path you want to open not exist!" msgstr "" #: src/iptux/TransWindow.cpp:405 msgid "The file you want to open not exist!" msgstr "" #: src/iptux/TransWindow.cpp:406 msgid "iptux Error" msgstr "" #: src/iptux/UiCoreThread.cpp:254 src/iptux/UiCoreThread.cpp:278 #: src/iptux/UiCoreThread.cpp:377 src/iptux/UiCoreThread.cpp:399 msgid "Others" msgstr "Outros" #: src/iptux/UiCoreThread.cpp:419 msgid "Broadcast" msgstr "Difusión" #: src/iptux/UiHelper.cpp:28 #, c-format msgid "Can't convert path to uri: %s, reason: %s" msgstr "" #: src/iptux/UiHelper.cpp:39 #, c-format msgid "Can't open path: %s, reason: %s" msgstr "" #: src/iptux/UiHelper.cpp:68 #, c-format msgid "Can't open URL: %s, reason: %s" msgstr "" #: src/iptux/UiHelper.cpp:188 msgid "Information" msgstr "" #: src/iptux/UiHelper.cpp:218 msgid "Warning" msgstr "" #: src/iptux/UiModels.cpp:604 #, c-format msgid "Version: %s" msgstr "" #: src/iptux/UiModels.cpp:608 #, c-format msgid "Nickname: %s@%s" msgstr "" #: src/iptux/UiModels.cpp:611 #, fuzzy, c-format msgid "Nickname: %s" msgstr "O teu alcume:" #: src/iptux/UiModels.cpp:615 #, c-format msgid "User: %s" msgstr "" #: src/iptux/UiModels.cpp:618 #, c-format msgid "Host: %s" msgstr "" #: src/iptux/UiModels.cpp:623 #, c-format msgid "Address: %s(%s)" msgstr "" #: src/iptux/UiModels.cpp:625 #, c-format msgid "Address: %s" msgstr "" #: src/iptux/UiModels.cpp:630 msgid "Compatibility: Microsoft" msgstr "" #: src/iptux/UiModels.cpp:632 msgid "Compatibility: GNU/Linux" msgstr "" #: src/iptux/UiModels.cpp:636 #, c-format msgid "System coding: %s" msgstr "" #: src/iptux/UiModels.cpp:641 #, fuzzy msgid "Signature:" msgstr "Sinatura" #: src/iptux/UiModels.cpp:744 msgid "" msgstr "" #: src/iptux/UiModels.cpp:799 msgid "[IMG]" msgstr "" #: src/iptux/dialog.cpp:39 msgid "" "File transfer has not been completed.\n" "Are you sure to cancel and quit?" msgstr "" #: src/iptux/dialog.cpp:42 msgid "Confirm Exit" msgstr "" #: src/iptux/dialog.cpp:62 src/iptux/resources/gtk/MainWindow.ui:12 #: src/iptux/resources/gtk/menus.ui:98 src/iptux/resources/gtk/menus.ui:243 msgid "Request Shared Resources" msgstr "" #: src/iptux/dialog.cpp:62 msgid "Agree" msgstr "" #: src/iptux/dialog.cpp:78 #, c-format msgid "" "Your pal (%s)[%s]\n" "is requesting to get your shared resources,\n" "Do you agree?" msgstr "" #: src/iptux/dialog.cpp:106 msgid "Access Password" msgstr "" #: src/iptux/dialog.cpp:113 msgid "Please input the password for the shared files behind" msgstr "" #: src/iptux/dialog.cpp:127 #, c-format msgid "(%s)[%s]Password:" msgstr "" #: src/iptux/dialog.cpp:146 src/iptux/dialog.cpp:207 msgid "" "\n" "Empty Password!" msgstr "" #: src/iptux/dialog.cpp:170 msgid "Enter a New Password" msgstr "" #: src/iptux/dialog.cpp:178 msgid "Password: " msgstr "" #: src/iptux/dialog.cpp:187 msgid "Repeat: " msgstr "" #: src/iptux/dialog.cpp:202 msgid "" "\n" "Password Mismatched!" msgstr "" #: src/iptux/dialog.cpp:229 msgid "Please select a folder to save files." msgstr "" #: src/iptux/resources/gtk/AboutDialog.ui:11 msgid "" "Copyright © 2008–2009, Jally\n" "Copyright © 2013–2015,2017–2021, LI Daobing" msgstr "" #: src/iptux/resources/gtk/AboutDialog.ui:13 msgid "A GTK based LAN messenger." msgstr "" #: src/iptux/resources/gtk/AppIndicator.ui:6 msgid "Open Iptux" msgstr "" #: src/iptux/resources/gtk/AppIndicator.ui:12 #: src/iptux/resources/gtk/menus.ui:6 src/iptux/resources/gtk/menus.ui:306 msgid "_Preferences" msgstr "" #: src/iptux/resources/gtk/AppIndicator.ui:16 #: src/iptux/resources/gtk/menus.ui:10 src/iptux/resources/gtk/menus.ui:310 msgid "_Quit" msgstr "" #: src/iptux/resources/gtk/DetectPal.ui:7 msgid "Detect pal" msgstr "" #: src/iptux/resources/gtk/DetectPal.ui:15 msgid "Detect" msgstr "" #: src/iptux/resources/gtk/DetectPal.ui:61 msgid "Please input an IP address (IPv4 only):" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:8 src/iptux/resources/gtk/menus.ui:109 #: src/iptux/resources/gtk/menus.ui:254 msgid "Send Message" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:16 msgid "Change Info" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:20 msgid "Delete Pal" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:26 src/iptux/resources/gtk/menus.ui:31 #: src/iptux/resources/gtk/menus.ui:176 msgid "Sort" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:29 src/iptux/resources/gtk/menus.ui:34 #: src/iptux/resources/gtk/menus.ui:179 msgid "By Nickname" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:34 src/iptux/resources/gtk/menus.ui:39 #: src/iptux/resources/gtk/menus.ui:184 msgid "By Username" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:39 src/iptux/resources/gtk/menus.ui:44 #: src/iptux/resources/gtk/menus.ui:189 msgid "By IP" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:44 src/iptux/resources/gtk/menus.ui:49 #: src/iptux/resources/gtk/menus.ui:194 msgid "By Host" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:49 src/iptux/resources/gtk/menus.ui:54 #: src/iptux/resources/gtk/menus.ui:199 msgid "By Last Activity" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:56 src/iptux/resources/gtk/menus.ui:61 #: src/iptux/resources/gtk/menus.ui:206 msgid "Ascending" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:61 src/iptux/resources/gtk/menus.ui:66 #: src/iptux/resources/gtk/menus.ui:211 msgid "Descending" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:68 msgid "Info Style" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:71 msgid "IP" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:76 msgid "IP:PORT" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:86 msgid "Username" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:91 msgid "Version" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:96 msgid "Last Activity" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:101 msgid "Last Message" msgstr "" #: src/iptux/resources/gtk/menus.ui:17 src/iptux/resources/gtk/menus.ui:162 msgid "_File" msgstr "" #: src/iptux/resources/gtk/menus.ui:19 src/iptux/resources/gtk/menus.ui:164 msgid "_Detect" msgstr "" #: src/iptux/resources/gtk/menus.ui:23 src/iptux/resources/gtk/menus.ui:168 msgid "_Find" msgstr "" #: src/iptux/resources/gtk/menus.ui:28 src/iptux/resources/gtk/menus.ui:173 msgid "_View" msgstr "" #: src/iptux/resources/gtk/menus.ui:73 src/iptux/resources/gtk/menus.ui:218 msgid "_Refresh" msgstr "" #: src/iptux/resources/gtk/menus.ui:80 src/iptux/resources/gtk/menus.ui:225 msgid "_Chat" msgstr "" #: src/iptux/resources/gtk/menus.ui:88 src/iptux/resources/gtk/menus.ui:233 msgid "Attach File" msgstr "" #: src/iptux/resources/gtk/menus.ui:92 src/iptux/resources/gtk/menus.ui:237 msgid "Attach Folder" msgstr "" #: src/iptux/resources/gtk/menus.ui:102 src/iptux/resources/gtk/menus.ui:247 msgid "Clear Chat History" msgstr "" #: src/iptux/resources/gtk/menus.ui:115 src/iptux/resources/gtk/menus.ui:260 msgid "_Window" msgstr "" #: src/iptux/resources/gtk/menus.ui:118 src/iptux/resources/gtk/menus.ui:263 msgid "_Transmission" msgstr "" #: src/iptux/resources/gtk/menus.ui:122 src/iptux/resources/gtk/menus.ui:267 msgid "_Shared Management" msgstr "" #: src/iptux/resources/gtk/menus.ui:126 src/iptux/resources/gtk/menus.ui:271 msgid "_Chat Log" msgstr "" #: src/iptux/resources/gtk/menus.ui:130 src/iptux/resources/gtk/menus.ui:275 #, fuzzy msgid "_System Log" msgstr "Sistema" #: src/iptux/resources/gtk/menus.ui:136 src/iptux/resources/gtk/menus.ui:281 msgid "Close Window" msgstr "" #: src/iptux/resources/gtk/menus.ui:142 src/iptux/resources/gtk/menus.ui:287 msgid "_Help" msgstr "" #: src/iptux/resources/gtk/menus.ui:145 src/iptux/resources/gtk/menus.ui:290 msgid "_About" msgstr "" #: src/iptux/resources/gtk/menus.ui:149 src/iptux/resources/gtk/menus.ui:294 msgid "Report Bug" msgstr "" #: src/iptux/resources/gtk/menus.ui:153 src/iptux/resources/gtk/menus.ui:298 msgid "What's New" msgstr "" #: src/iptux/resources/gtk/menus.ui:318 msgid "Open This File" msgstr "" #: src/iptux/resources/gtk/menus.ui:322 msgid "Open Containing Folder" msgstr "" #: src/iptux/resources/gtk/menus.ui:326 msgid "Terminate Task" msgstr "" #: src/iptux/resources/gtk/menus.ui:330 msgid "Terminate All" msgstr "" #: src/iptux/resources/gtk/menus.ui:334 msgid "Clear Tasklist" msgstr "" #: src/iptux/resources/gtk/menus.ui:346 msgid "Refuse All" msgstr "" #: src/main/iptux.cpp:149 msgid "- A software for sharing in LAN" msgstr "" #: src/main/iptux.cpp:152 #, c-format msgid "option parsing failed: %s\n" msgstr "" #~ msgid "Sound" #~ msgstr "Son" iptux-0.9.4/po/iptux.pot000066400000000000000000000652031475473122500152300ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the iptux package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: iptux 0.9.3\n" "Report-Msgid-Bugs-To: https://github.com/iptux-src/iptux/issues/new\n" "POT-Creation-Date: 2025-02-17 13:35-0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:6 msgid "iptux" msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:7 msgid "LAN communication software" msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:17 msgid "iptux is an “IP Messenger” client. The features of iptux include:" msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:21 msgid "auto-detect other clients on the intranet." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:22 msgid "send/recv messages to other clients." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:23 msgid "send/recv files to other clients." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:24 msgid "share your files to other cliens (with optional password protection)." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:26 msgid "" "It is (supposedly) compatible with 飞鸽传书 (Feige) and 飞秋 (FeiQ) from " "China, and with the original “IP Messenger” clients from Japan, including " "g2ipmsg and xipmsg in Debian." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:38 msgid "The Iptux main window." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:42 msgid "The Iptux chat window." msgstr "" #: src/iptux-core/CoreThread.cpp:172 #, c-format msgid "" "Fatal Error!! Failed to create new socket!\n" "%s" msgstr "" #: src/iptux-core/CoreThread.cpp:188 #, c-format msgid "" "Fatal Error!! Failed to bind the TCP port(%s:%d)!\n" "%s" msgstr "" #: src/iptux-core/CoreThread.cpp:201 #, c-format msgid "" "Fatal Error!! Failed to bind the UDP port(%s:%d)!\n" "%s" msgstr "" #: src/iptux-core/CoreThread.cpp:461 src/iptux-core/CoreThread.cpp:495 #: src/iptux-core/internal/RecvFileData.cpp:142 #: src/iptux-core/internal/RecvFileData.cpp:204 #, c-format msgid "" "Fatal Error!!\n" "Failed to create new socket!\n" "%s" msgstr "" #: src/iptux-core/Models.cpp:172 msgid "Empty Message" msgstr "" #: src/iptux-core/Models.cpp:250 msgid "Received an image" msgstr "" #: src/iptux-core/internal/AnalogFS.cpp:93 #: src/iptux-core/internal/AnalogFS.cpp:98 #, c-format msgid "Open() file \"%s\" failed, %s" msgstr "" #: src/iptux-core/internal/AnalogFS.cpp:117 #, c-format msgid "Stat64() file \"%s\" failed, %s" msgstr "" #: src/iptux-core/internal/AnalogFS.cpp:138 #, c-format msgid "Mkdir() directory \"%s\" failed, %s" msgstr "" #: src/iptux-core/internal/AnalogFS.cpp:164 #, c-format msgid "Opendir() directory \"%s\" failed, %s" msgstr "" #: src/iptux-core/internal/Command.cpp:226 msgid "Your pal didn't receive the packet. He or she is offline maybe." msgstr "" #: src/iptux-core/internal/CommandMode.cpp:39 #, c-format msgid "unknown command mode: %d" msgstr "" #: src/iptux-core/internal/RecvFileData.cpp:117 msgid "receive" msgstr "" #: src/iptux-core/internal/RecvFileData.cpp:124 #: src/iptux-core/internal/RecvFileData.cpp:253 #: src/iptux-core/internal/SendFileData.cpp:108 #: src/iptux-core/internal/SendFileData.cpp:193 msgid "Unknown" msgstr "" #: src/iptux-core/internal/RecvFileData.cpp:175 #, c-format msgid "" "Failed to receive the file \"%s\" from %s! expect length %jd, received %jd" msgstr "" #: src/iptux-core/internal/RecvFileData.cpp:180 #, c-format msgid "Receive the file \"%s\" from %s successfully!" msgstr "" #: src/iptux-core/internal/RecvFileData.cpp:320 #, c-format msgid "Failed to receive the directory \"%s\" from %s!" msgstr "" #: src/iptux-core/internal/RecvFileData.cpp:323 #, c-format msgid "Receive the directory \"%s\" from %s successfully!" msgstr "" #: src/iptux-core/internal/SendFileData.cpp:101 msgid "send" msgstr "" #: src/iptux-core/internal/SendFileData.cpp:137 #, c-format msgid "Failed to send the file \"%s\" to %s!" msgstr "" #: src/iptux-core/internal/SendFileData.cpp:142 #, c-format msgid "Send the file \"%s\" to %s successfully!" msgstr "" #: src/iptux-core/internal/SendFileData.cpp:265 #, c-format msgid "Failed to send the directory \"%s\" to %s!" msgstr "" #: src/iptux-core/internal/SendFileData.cpp:270 #, c-format msgid "Send the directory \"%s\" to %s successfully!" msgstr "" #: src/iptux-core/internal/UdpData.cpp:92 #: src/iptux-core/internal/UdpData.cpp:93 #: src/iptux-core/internal/UdpData.cpp:443 #: src/iptux-core/internal/UdpData.cpp:484 msgid "mysterious" msgstr "" #: src/iptux-utils/utils.cpp:880 #, c-format msgid "stat file \"%s\" failed: %s" msgstr "" #: src/iptux-utils/utils.cpp:888 #, c-format msgid "path %s is not file or directory: st_mode(%x)" msgstr "" #: src/iptux-utils/utils.cpp:895 #, c-format msgid "opendir on \"%s\" failed: %s" msgstr "" #: src/iptux/AboutDialog.cpp:39 msgid "TRANSLATOR NAME" msgstr "" #: src/iptux/AboutDialog.cpp:53 msgid "Thanks to" msgstr "" #: src/iptux/AppIndicator.cpp:40 src/iptux/MainWindow.cpp:505 #: src/iptux/MainWindow.cpp:507 msgid "Iptux" msgstr "" #: src/iptux/Application.cpp:54 msgid "Loading the process successfully!" msgstr "" #: src/iptux/Application.cpp:274 #, c-format msgid "New Message from %s" msgstr "" #: src/iptux/Application.cpp:287 #, c-format msgid "New File from %s" msgstr "" #: src/iptux/Application.cpp:296 msgid "Receiving File Finished" msgstr "" #: src/iptux/Application.cpp:300 msgid "file info no longer exist" msgstr "" #: src/iptux/Darwin.cpp:16 #, c-format msgid "Couldn’t load icon: %s" msgstr "" #: src/iptux/DataSettings.cpp:46 msgid "Personal" msgstr "" #: src/iptux/DataSettings.cpp:48 msgid "System" msgstr "" #: src/iptux/DataSettings.cpp:50 msgid "Network" msgstr "" #: src/iptux/DataSettings.cpp:89 src/iptux/DataSettings.cpp:98 msgid "The program needs to be restarted to take effect!" msgstr "" #: src/iptux/DataSettings.cpp:143 msgid "Preferences" msgstr "" #: src/iptux/DataSettings.cpp:143 src/iptux/RevisePal.cpp:109 #: src/iptux/dialog.cpp:107 src/iptux/dialog.cpp:170 msgid "_OK" msgstr "" #: src/iptux/DataSettings.cpp:144 msgid "_Apply" msgstr "" #: src/iptux/DataSettings.cpp:144 src/iptux/DataSettings.cpp:1348 #: src/iptux/DataSettings.cpp:1395 src/iptux/DialogBase.cpp:359 #: src/iptux/DialogBase.cpp:918 src/iptux/RevisePal.cpp:110 #: src/iptux/ShareFile.cpp:419 src/iptux/callback.cpp:87 #: src/iptux/dialog.cpp:171 src/iptux/dialog.cpp:230 msgid "_Cancel" msgstr "" #: src/iptux/DataSettings.cpp:169 msgid "Your _nickname:" msgstr "" #: src/iptux/DataSettings.cpp:176 msgid "Please input your nickname!" msgstr "" #: src/iptux/DataSettings.cpp:182 msgid "Your _group name:" msgstr "" #: src/iptux/DataSettings.cpp:189 msgid "Please input your group name!" msgstr "" #: src/iptux/DataSettings.cpp:195 msgid "Your _face picture:" msgstr "" #: src/iptux/DataSettings.cpp:213 msgid "_Save files to: " msgstr "" #: src/iptux/DataSettings.cpp:226 msgid "Photo" msgstr "" #: src/iptux/DataSettings.cpp:238 msgid "Signature" msgstr "" #: src/iptux/DataSettings.cpp:271 msgid "Port:" msgstr "" #: src/iptux/DataSettings.cpp:278 msgid "Any port number between 1024 and 65535, default is 2425" msgstr "" #: src/iptux/DataSettings.cpp:287 msgid "Candidate network encodings:" msgstr "" #: src/iptux/DataSettings.cpp:294 msgid "Candidate network encodings, separated by \",\"" msgstr "" #: src/iptux/DataSettings.cpp:301 msgid "Preferred network encoding:" msgstr "" #: src/iptux/DataSettings.cpp:308 msgid "" "Preference network coding (You should be aware of what you are doing if you " "want to modify it.)" msgstr "" #: src/iptux/DataSettings.cpp:316 msgid "Pal's default face picture:" msgstr "" #: src/iptux/DataSettings.cpp:334 msgid "Panel font:" msgstr "" #: src/iptux/DataSettings.cpp:346 msgid "Automatically open the chat dialog" msgstr "" #: src/iptux/DataSettings.cpp:354 msgid "Automatically hide the panel after login" msgstr "" #: src/iptux/DataSettings.cpp:362 msgid "Automatically open the File Transmission Management" msgstr "" #: src/iptux/DataSettings.cpp:370 msgid "Use the 'Enter' key to send message" msgstr "" #: src/iptux/DataSettings.cpp:378 msgid "Automatically clean up the chat history" msgstr "" #: src/iptux/DataSettings.cpp:385 msgid "Save the chat history" msgstr "" #: src/iptux/DataSettings.cpp:393 msgid "Use the Blacklist (NOT recommended)" msgstr "" #: src/iptux/DataSettings.cpp:401 msgid "Filter the request of sharing files" msgstr "" #: src/iptux/DataSettings.cpp:408 msgid "Hide the taskbar when the main window is minimized" msgstr "" #: src/iptux/DataSettings.cpp:432 msgid "From:" msgstr "" #: src/iptux/DataSettings.cpp:438 msgid "Beginning of the IP(v4) section" msgstr "" #: src/iptux/DataSettings.cpp:442 msgid "To:" msgstr "" #: src/iptux/DataSettings.cpp:448 msgid "End of the IP(v4) section" msgstr "" #: src/iptux/DataSettings.cpp:456 msgid "Add" msgstr "" #: src/iptux/DataSettings.cpp:461 msgid "Delete" msgstr "" #: src/iptux/DataSettings.cpp:468 msgid "Added IP(v4) Section:" msgstr "" #: src/iptux/DataSettings.cpp:487 msgid "Import" msgstr "" #: src/iptux/DataSettings.cpp:491 msgid "Export" msgstr "" #: src/iptux/DataSettings.cpp:495 src/iptux/TransWindow.cpp:171 msgid "Clear" msgstr "" #: src/iptux/DataSettings.cpp:706 msgid "From" msgstr "" #: src/iptux/DataSettings.cpp:713 msgid "To" msgstr "" #: src/iptux/DataSettings.cpp:720 msgid "Description" msgstr "" #: src/iptux/DataSettings.cpp:736 msgid "Please select download folder" msgstr "" #: src/iptux/DataSettings.cpp:758 msgid "Select Font" msgstr "" #: src/iptux/DataSettings.cpp:872 src/iptux/DataSettings.cpp:874 #: src/iptux/DataSettings.cpp:878 msgid "Port must be a number between 1024 and 65535" msgstr "" #: src/iptux/DataSettings.cpp:1019 src/iptux/DataSettings.cpp:1050 #, c-format msgid "" "Fopen() file \"%s\" failed!\n" "%s" msgstr "" #: src/iptux/DataSettings.cpp:1150 src/iptux/RevisePal.cpp:419 msgid "Please select a face picture" msgstr "" #: src/iptux/DataSettings.cpp:1172 msgid "Please select a personal photo" msgstr "" #: src/iptux/DataSettings.cpp:1241 src/iptux/DataSettings.cpp:1248 #: src/iptux/DetectPal.cpp:75 #, c-format msgid "" "\n" "Illegal IP(v4) address: %s!" msgstr "" #: src/iptux/DataSettings.cpp:1346 msgid "Please select a file to import data" msgstr "" #: src/iptux/DataSettings.cpp:1347 src/iptux/DialogBase.cpp:358 #: src/iptux/ShareFile.cpp:418 src/iptux/callback.cpp:86 msgid "_Open" msgstr "" #: src/iptux/DataSettings.cpp:1394 msgid "Save data to file" msgstr "" #: src/iptux/DataSettings.cpp:1395 src/iptux/DialogBase.cpp:919 #: src/iptux/dialog.cpp:231 msgid "_Save" msgstr "" #: src/iptux/DetectPal.cpp:70 #, c-format msgid "The notification has been sent to %s." msgstr "" #: src/iptux/DialogBase.cpp:214 #, c-format msgid "%s To Send." msgstr "" #: src/iptux/DialogBase.cpp:272 msgid "Close" msgstr "" #: src/iptux/DialogBase.cpp:276 src/iptux/DialogGroup.cpp:375 msgid "Send" msgstr "" #: src/iptux/DialogBase.cpp:307 msgid "Chat History" msgstr "" #: src/iptux/DialogBase.cpp:350 msgid "Choose enclosure files" msgstr "" #: src/iptux/DialogBase.cpp:353 msgid "Choose enclosure folders" msgstr "" #: src/iptux/DialogBase.cpp:593 msgid "Remove Selected" msgstr "" #: src/iptux/DialogBase.cpp:648 msgid "File to send." msgstr "" #: src/iptux/DialogBase.cpp:653 msgid "Sending progress." msgstr "" #: src/iptux/DialogBase.cpp:656 msgid "Dirs" msgstr "" #: src/iptux/DialogBase.cpp:659 msgid "Files" msgstr "" #: src/iptux/DialogBase.cpp:662 src/iptux/DialogPeer.cpp:565 msgid "Detail" msgstr "" #: src/iptux/DialogBase.cpp:712 msgid "PeerName" msgstr "" #: src/iptux/DialogBase.cpp:719 src/iptux/DialogPeer.cpp:716 msgid "Name" msgstr "" #: src/iptux/DialogBase.cpp:725 src/iptux/DialogPeer.cpp:652 #: src/iptux/DialogPeer.cpp:722 src/iptux/ShareFile.cpp:280 #: src/iptux/TransWindow.cpp:271 msgid "Size" msgstr "" #: src/iptux/DialogBase.cpp:731 msgid "Path" msgstr "" #: src/iptux/DialogBase.cpp:792 msgid "Sending Progress." msgstr "" #: src/iptux/DialogBase.cpp:795 #, c-format msgid "%s of %s Sent." msgstr "" #: src/iptux/DialogBase.cpp:802 src/iptux/DialogPeer.cpp:835 msgid "Mission Completed!" msgstr "" #: src/iptux/DialogBase.cpp:845 src/iptux/DialogBase.cpp:917 msgid "Save Image" msgstr "" #: src/iptux/DialogBase.cpp:850 msgid "Copy Image" msgstr "" #: src/iptux/DialogGroup.cpp:285 msgid "Member" msgstr "" #: src/iptux/DialogGroup.cpp:382 msgid "Pals" msgstr "" #: src/iptux/DialogGroup.cpp:480 msgid "Select All" msgstr "" #: src/iptux/DialogGroup.cpp:485 msgid "Reverse Select" msgstr "" #: src/iptux/DialogGroup.cpp:490 msgid "Clear Up" msgstr "" #: src/iptux/DialogGroup.cpp:728 #, c-format msgid "Talk with the group %s" msgstr "" #: src/iptux/DialogPeer.cpp:132 #, c-format msgid "Talk with %s(%s) IP:%s" msgstr "" #: src/iptux/DialogPeer.cpp:305 msgid "Info." msgstr "" #: src/iptux/DialogPeer.cpp:337 #, c-format msgid "Version: %s\n" msgstr "" #: src/iptux/DialogPeer.cpp:339 #, c-format msgid "Nickname: %s@%s\n" msgstr "" #: src/iptux/DialogPeer.cpp:342 #, c-format msgid "Nickname: %s\n" msgstr "" #: src/iptux/DialogPeer.cpp:344 #, c-format msgid "User: %s\n" msgstr "" #: src/iptux/DialogPeer.cpp:345 #, c-format msgid "Host: %s\n" msgstr "" #: src/iptux/DialogPeer.cpp:348 #, c-format msgid "Address: %s(%s)\n" msgstr "" #: src/iptux/DialogPeer.cpp:350 #, c-format msgid "Address: %s\n" msgstr "" #: src/iptux/DialogPeer.cpp:353 msgid "Compatibility: Microsoft\n" msgstr "" #: src/iptux/DialogPeer.cpp:355 msgid "Compatibility: GNU/Linux\n" msgstr "" #: src/iptux/DialogPeer.cpp:357 #, c-format msgid "System coding: %s\n" msgstr "" #: src/iptux/DialogPeer.cpp:362 msgid "Signature:\n" msgstr "" #: src/iptux/DialogPeer.cpp:369 msgid "" "\n" "Photo:\n" msgstr "" #: src/iptux/DialogPeer.cpp:460 msgid "Please select a picture to insert the buffer" msgstr "" #: src/iptux/DialogPeer.cpp:486 src/iptux/resources/gtk/menus.ui:83 #: src/iptux/resources/gtk/menus.ui:228 msgid "Insert Image" msgstr "" #: src/iptux/DialogPeer.cpp:502 msgid "Enclosure." msgstr "" #: src/iptux/DialogPeer.cpp:547 msgid "Files to be received" msgstr "" #: src/iptux/DialogPeer.cpp:551 msgid "Receiving progress." msgstr "" #: src/iptux/DialogPeer.cpp:554 msgid "Accept" msgstr "" #: src/iptux/DialogPeer.cpp:560 src/iptux/dialog.cpp:63 #: src/iptux/resources/gtk/menus.ui:342 msgid "Refuse" msgstr "" #: src/iptux/DialogPeer.cpp:596 msgid "File received." msgstr "" #: src/iptux/DialogPeer.cpp:639 src/iptux/DialogPeer.cpp:710 msgid "Source" msgstr "" #: src/iptux/DialogPeer.cpp:646 msgid "SaveAs" msgstr "" #: src/iptux/DialogPeer.cpp:818 src/iptux/DialogPeer.cpp:884 msgid "Receiving Progress." msgstr "" #: src/iptux/DialogPeer.cpp:821 src/iptux/DialogPeer.cpp:887 #, c-format msgid "%s to Receive." msgstr "" #: src/iptux/DialogPeer.cpp:825 src/iptux/DialogPeer.cpp:891 #, c-format msgid "%s Of %s Received." msgstr "" #: src/iptux/LogSystem.cpp:71 #, c-format msgid "Recevied-From: Nickname:%s User:%s Host:%s" msgstr "" #: src/iptux/LogSystem.cpp:76 #, c-format msgid "Send-To: Nickname:%s User:%s Host:%s" msgstr "" #: src/iptux/LogSystem.cpp:80 msgid "Send-Broadcast" msgstr "" #: src/iptux/LogSystem.cpp:99 #, c-format msgid "User:%s Host:%s" msgstr "" #: src/iptux/MainWindow.cpp:570 msgid "Pals Online: 0" msgstr "" #: src/iptux/MainWindow.cpp:655 msgid "Search Pals" msgstr "" #: src/iptux/MainWindow.cpp:768 msgid "Nickname" msgstr "" #: src/iptux/MainWindow.cpp:778 msgid "Group" msgstr "" #: src/iptux/MainWindow.cpp:784 src/iptux/TransWindow.cpp:258 msgid "IPv4" msgstr "" #: src/iptux/MainWindow.cpp:790 msgid "User" msgstr "" #: src/iptux/MainWindow.cpp:796 src/iptux/resources/gtk/MainWindow.ui:81 msgid "Host" msgstr "" #: src/iptux/MainWindow.cpp:935 #, c-format msgid "Pals Online: %d" msgstr "" #: src/iptux/RevisePal.cpp:109 msgid "Change Pal's Information" msgstr "" #: src/iptux/RevisePal.cpp:134 msgid "Pal's nickname:" msgstr "" #: src/iptux/RevisePal.cpp:140 msgid "Please input pal's new nickname!" msgstr "" #: src/iptux/RevisePal.cpp:146 msgid "Pal's group name:" msgstr "" #: src/iptux/RevisePal.cpp:152 msgid "Please input pal's new group name!" msgstr "" #: src/iptux/RevisePal.cpp:158 msgid "System coding:" msgstr "" #: src/iptux/RevisePal.cpp:164 msgid "Be SURE to know what you are doing!" msgstr "" #: src/iptux/RevisePal.cpp:170 msgid "Pal's face picture:" msgstr "" #: src/iptux/RevisePal.cpp:184 msgid "Be compatible with iptux's protocol (DANGEROUS)" msgstr "" #: src/iptux/ShareFile.cpp:104 msgid "Shared Files Management" msgstr "" #: src/iptux/ShareFile.cpp:105 msgid "OK" msgstr "" #: src/iptux/ShareFile.cpp:106 msgid "Apply" msgstr "" #: src/iptux/ShareFile.cpp:107 msgid "Cancel" msgstr "" #: src/iptux/ShareFile.cpp:160 msgid "Add Files" msgstr "" #: src/iptux/ShareFile.cpp:163 msgid "Add Folders" msgstr "" #: src/iptux/ShareFile.cpp:166 msgid "Delete Resources" msgstr "" #: src/iptux/ShareFile.cpp:169 msgid "Clear Password" msgstr "" #: src/iptux/ShareFile.cpp:172 msgid "Set Password" msgstr "" #: src/iptux/ShareFile.cpp:229 src/iptux/ShareFile.cpp:373 msgid "regular" msgstr "" #: src/iptux/ShareFile.cpp:233 src/iptux/ShareFile.cpp:377 msgid "directory" msgstr "" #: src/iptux/ShareFile.cpp:237 src/iptux/ShareFile.cpp:381 msgid "unknown" msgstr "" #: src/iptux/ShareFile.cpp:270 msgid "File" msgstr "" #: src/iptux/ShareFile.cpp:286 msgid "Type" msgstr "" #: src/iptux/ShareFile.cpp:411 msgid "Choose the files to share" msgstr "" #: src/iptux/ShareFile.cpp:414 msgid "Choose the folders to share" msgstr "" #: src/iptux/TransWindow.cpp:86 msgid "Files Transmission Management" msgstr "" #: src/iptux/TransWindow.cpp:241 msgid "State" msgstr "" #: src/iptux/TransWindow.cpp:247 msgid "Task" msgstr "" #: src/iptux/TransWindow.cpp:253 msgid "Peer" msgstr "" #: src/iptux/TransWindow.cpp:265 msgid "Filename" msgstr "" #: src/iptux/TransWindow.cpp:277 msgid "Completed" msgstr "" #: src/iptux/TransWindow.cpp:284 msgid "Progress" msgstr "" #: src/iptux/TransWindow.cpp:291 msgid "Cost" msgstr "" #: src/iptux/TransWindow.cpp:297 msgid "Remaining" msgstr "" #: src/iptux/TransWindow.cpp:303 msgid "Rate" msgstr "" #: src/iptux/TransWindow.cpp:331 msgid "The path you want to open not exist!" msgstr "" #: src/iptux/TransWindow.cpp:405 msgid "The file you want to open not exist!" msgstr "" #: src/iptux/TransWindow.cpp:406 msgid "iptux Error" msgstr "" #: src/iptux/UiCoreThread.cpp:254 src/iptux/UiCoreThread.cpp:278 #: src/iptux/UiCoreThread.cpp:377 src/iptux/UiCoreThread.cpp:399 msgid "Others" msgstr "" #: src/iptux/UiCoreThread.cpp:419 msgid "Broadcast" msgstr "" #: src/iptux/UiHelper.cpp:28 #, c-format msgid "Can't convert path to uri: %s, reason: %s" msgstr "" #: src/iptux/UiHelper.cpp:39 #, c-format msgid "Can't open path: %s, reason: %s" msgstr "" #: src/iptux/UiHelper.cpp:68 #, c-format msgid "Can't open URL: %s, reason: %s" msgstr "" #: src/iptux/UiHelper.cpp:188 msgid "Information" msgstr "" #: src/iptux/UiHelper.cpp:218 msgid "Warning" msgstr "" #: src/iptux/UiModels.cpp:604 #, c-format msgid "Version: %s" msgstr "" #: src/iptux/UiModels.cpp:608 #, c-format msgid "Nickname: %s@%s" msgstr "" #: src/iptux/UiModels.cpp:611 #, c-format msgid "Nickname: %s" msgstr "" #: src/iptux/UiModels.cpp:615 #, c-format msgid "User: %s" msgstr "" #: src/iptux/UiModels.cpp:618 #, c-format msgid "Host: %s" msgstr "" #: src/iptux/UiModels.cpp:623 #, c-format msgid "Address: %s(%s)" msgstr "" #: src/iptux/UiModels.cpp:625 #, c-format msgid "Address: %s" msgstr "" #: src/iptux/UiModels.cpp:630 msgid "Compatibility: Microsoft" msgstr "" #: src/iptux/UiModels.cpp:632 msgid "Compatibility: GNU/Linux" msgstr "" #: src/iptux/UiModels.cpp:636 #, c-format msgid "System coding: %s" msgstr "" #: src/iptux/UiModels.cpp:641 msgid "Signature:" msgstr "" #: src/iptux/UiModels.cpp:744 msgid "" msgstr "" #: src/iptux/UiModels.cpp:799 msgid "[IMG]" msgstr "" #: src/iptux/dialog.cpp:39 msgid "" "File transfer has not been completed.\n" "Are you sure to cancel and quit?" msgstr "" #: src/iptux/dialog.cpp:42 msgid "Confirm Exit" msgstr "" #: src/iptux/dialog.cpp:62 src/iptux/resources/gtk/MainWindow.ui:12 #: src/iptux/resources/gtk/menus.ui:98 src/iptux/resources/gtk/menus.ui:243 msgid "Request Shared Resources" msgstr "" #: src/iptux/dialog.cpp:62 msgid "Agree" msgstr "" #: src/iptux/dialog.cpp:78 #, c-format msgid "" "Your pal (%s)[%s]\n" "is requesting to get your shared resources,\n" "Do you agree?" msgstr "" #: src/iptux/dialog.cpp:106 msgid "Access Password" msgstr "" #: src/iptux/dialog.cpp:113 msgid "Please input the password for the shared files behind" msgstr "" #: src/iptux/dialog.cpp:127 #, c-format msgid "(%s)[%s]Password:" msgstr "" #: src/iptux/dialog.cpp:146 src/iptux/dialog.cpp:207 msgid "" "\n" "Empty Password!" msgstr "" #: src/iptux/dialog.cpp:170 msgid "Enter a New Password" msgstr "" #: src/iptux/dialog.cpp:178 msgid "Password: " msgstr "" #: src/iptux/dialog.cpp:187 msgid "Repeat: " msgstr "" #: src/iptux/dialog.cpp:202 msgid "" "\n" "Password Mismatched!" msgstr "" #: src/iptux/dialog.cpp:229 msgid "Please select a folder to save files." msgstr "" #: src/iptux/resources/gtk/AboutDialog.ui:11 msgid "" "Copyright © 2008–2009, Jally\n" "Copyright © 2013–2015,2017–2021, LI Daobing" msgstr "" #: src/iptux/resources/gtk/AboutDialog.ui:13 msgid "A GTK based LAN messenger." msgstr "" #: src/iptux/resources/gtk/AppIndicator.ui:6 msgid "Open Iptux" msgstr "" #: src/iptux/resources/gtk/AppIndicator.ui:12 #: src/iptux/resources/gtk/menus.ui:6 src/iptux/resources/gtk/menus.ui:306 msgid "_Preferences" msgstr "" #: src/iptux/resources/gtk/AppIndicator.ui:16 #: src/iptux/resources/gtk/menus.ui:10 src/iptux/resources/gtk/menus.ui:310 msgid "_Quit" msgstr "" #: src/iptux/resources/gtk/DetectPal.ui:7 msgid "Detect pal" msgstr "" #: src/iptux/resources/gtk/DetectPal.ui:15 msgid "Detect" msgstr "" #: src/iptux/resources/gtk/DetectPal.ui:61 msgid "Please input an IP address (IPv4 only):" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:8 src/iptux/resources/gtk/menus.ui:109 #: src/iptux/resources/gtk/menus.ui:254 msgid "Send Message" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:16 msgid "Change Info" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:20 msgid "Delete Pal" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:26 src/iptux/resources/gtk/menus.ui:31 #: src/iptux/resources/gtk/menus.ui:176 msgid "Sort" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:29 src/iptux/resources/gtk/menus.ui:34 #: src/iptux/resources/gtk/menus.ui:179 msgid "By Nickname" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:34 src/iptux/resources/gtk/menus.ui:39 #: src/iptux/resources/gtk/menus.ui:184 msgid "By Username" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:39 src/iptux/resources/gtk/menus.ui:44 #: src/iptux/resources/gtk/menus.ui:189 msgid "By IP" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:44 src/iptux/resources/gtk/menus.ui:49 #: src/iptux/resources/gtk/menus.ui:194 msgid "By Host" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:49 src/iptux/resources/gtk/menus.ui:54 #: src/iptux/resources/gtk/menus.ui:199 msgid "By Last Activity" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:56 src/iptux/resources/gtk/menus.ui:61 #: src/iptux/resources/gtk/menus.ui:206 msgid "Ascending" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:61 src/iptux/resources/gtk/menus.ui:66 #: src/iptux/resources/gtk/menus.ui:211 msgid "Descending" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:68 msgid "Info Style" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:71 msgid "IP" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:76 msgid "IP:PORT" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:86 msgid "Username" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:91 msgid "Version" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:96 msgid "Last Activity" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:101 msgid "Last Message" msgstr "" #: src/iptux/resources/gtk/menus.ui:17 src/iptux/resources/gtk/menus.ui:162 msgid "_File" msgstr "" #: src/iptux/resources/gtk/menus.ui:19 src/iptux/resources/gtk/menus.ui:164 msgid "_Detect" msgstr "" #: src/iptux/resources/gtk/menus.ui:23 src/iptux/resources/gtk/menus.ui:168 msgid "_Find" msgstr "" #: src/iptux/resources/gtk/menus.ui:28 src/iptux/resources/gtk/menus.ui:173 msgid "_View" msgstr "" #: src/iptux/resources/gtk/menus.ui:73 src/iptux/resources/gtk/menus.ui:218 msgid "_Refresh" msgstr "" #: src/iptux/resources/gtk/menus.ui:80 src/iptux/resources/gtk/menus.ui:225 msgid "_Chat" msgstr "" #: src/iptux/resources/gtk/menus.ui:88 src/iptux/resources/gtk/menus.ui:233 msgid "Attach File" msgstr "" #: src/iptux/resources/gtk/menus.ui:92 src/iptux/resources/gtk/menus.ui:237 msgid "Attach Folder" msgstr "" #: src/iptux/resources/gtk/menus.ui:102 src/iptux/resources/gtk/menus.ui:247 msgid "Clear Chat History" msgstr "" #: src/iptux/resources/gtk/menus.ui:115 src/iptux/resources/gtk/menus.ui:260 msgid "_Window" msgstr "" #: src/iptux/resources/gtk/menus.ui:118 src/iptux/resources/gtk/menus.ui:263 msgid "_Transmission" msgstr "" #: src/iptux/resources/gtk/menus.ui:122 src/iptux/resources/gtk/menus.ui:267 msgid "_Shared Management" msgstr "" #: src/iptux/resources/gtk/menus.ui:126 src/iptux/resources/gtk/menus.ui:271 msgid "_Chat Log" msgstr "" #: src/iptux/resources/gtk/menus.ui:130 src/iptux/resources/gtk/menus.ui:275 msgid "_System Log" msgstr "" #: src/iptux/resources/gtk/menus.ui:136 src/iptux/resources/gtk/menus.ui:281 msgid "Close Window" msgstr "" #: src/iptux/resources/gtk/menus.ui:142 src/iptux/resources/gtk/menus.ui:287 msgid "_Help" msgstr "" #: src/iptux/resources/gtk/menus.ui:145 src/iptux/resources/gtk/menus.ui:290 msgid "_About" msgstr "" #: src/iptux/resources/gtk/menus.ui:149 src/iptux/resources/gtk/menus.ui:294 msgid "Report Bug" msgstr "" #: src/iptux/resources/gtk/menus.ui:153 src/iptux/resources/gtk/menus.ui:298 msgid "What's New" msgstr "" #: src/iptux/resources/gtk/menus.ui:318 msgid "Open This File" msgstr "" #: src/iptux/resources/gtk/menus.ui:322 msgid "Open Containing Folder" msgstr "" #: src/iptux/resources/gtk/menus.ui:326 msgid "Terminate Task" msgstr "" #: src/iptux/resources/gtk/menus.ui:330 msgid "Terminate All" msgstr "" #: src/iptux/resources/gtk/menus.ui:334 msgid "Clear Tasklist" msgstr "" #: src/iptux/resources/gtk/menus.ui:346 msgid "Refuse All" msgstr "" #: src/main/iptux.cpp:149 msgid "- A software for sharing in LAN" msgstr "" #: src/main/iptux.cpp:152 #, c-format msgid "option parsing failed: %s\n" msgstr "" iptux-0.9.4/po/it.po000066400000000000000000001112761475473122500143110ustar00rootroot00000000000000# Italian translation for iptux # Copyright (c) 2013 Rosetta Contributors and Canonical Ltd 2013 # This file is distributed under the same license as the iptux package. # FIRST AUTHOR , 2013. # msgid "" msgstr "" "Project-Id-Version: iptux\n" "Report-Msgid-Bugs-To: https://github.com/iptux-src/iptux/issues/new\n" "POT-Creation-Date: 2025-02-17 13:35-0800\n" "PO-Revision-Date: 2021-05-17 00:40+0000\n" "Last-Translator: J. Lavoie \n" "Language-Team: Italian \n" "Language: it\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" "X-Generator: Weblate 4.7-dev\n" "X-Launchpad-Export-Date: 2018-01-24 12:00+0000\n" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:6 msgid "iptux" msgstr "iptux" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:7 msgid "LAN communication software" msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:17 msgid "iptux is an “IP Messenger” client. The features of iptux include:" msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:21 msgid "auto-detect other clients on the intranet." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:22 msgid "send/recv messages to other clients." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:23 msgid "send/recv files to other clients." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:24 msgid "share your files to other cliens (with optional password protection)." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:26 msgid "" "It is (supposedly) compatible with 飞鸽传书 (Feige) and 飞秋 (FeiQ) from " "China, and with the original “IP Messenger” clients from Japan, including " "g2ipmsg and xipmsg in Debian." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:38 msgid "The Iptux main window." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:42 msgid "The Iptux chat window." msgstr "" #: src/iptux-core/CoreThread.cpp:172 #, fuzzy, c-format msgid "" "Fatal Error!! Failed to create new socket!\n" "%s" msgstr "" "Errore Fatale!!\n" "Impossibile creare il nuovo socket!\n" "%s" #: src/iptux-core/CoreThread.cpp:188 #, fuzzy, c-format msgid "" "Fatal Error!! Failed to bind the TCP port(%s:%d)!\n" "%s" msgstr "" "Errore Fatale!!\n" "Ascolto sulla porta TCP/UDP (2425) non riuscito!\n" "%s" #: src/iptux-core/CoreThread.cpp:201 #, fuzzy, c-format msgid "" "Fatal Error!! Failed to bind the UDP port(%s:%d)!\n" "%s" msgstr "" "Errore Fatale!!\n" "Ascolto sulla porta TCP/UDP (2425) non riuscito!\n" "%s" #: src/iptux-core/CoreThread.cpp:461 src/iptux-core/CoreThread.cpp:495 #: src/iptux-core/internal/RecvFileData.cpp:142 #: src/iptux-core/internal/RecvFileData.cpp:204 #, c-format msgid "" "Fatal Error!!\n" "Failed to create new socket!\n" "%s" msgstr "" "Errore Fatale!!\n" "Impossibile creare il nuovo socket!\n" "%s" #: src/iptux-core/Models.cpp:172 #, fuzzy msgid "Empty Message" msgstr "Invia Messaggio" #: src/iptux-core/Models.cpp:250 msgid "Received an image" msgstr "" #: src/iptux-core/internal/AnalogFS.cpp:93 #: src/iptux-core/internal/AnalogFS.cpp:98 #, c-format msgid "Open() file \"%s\" failed, %s" msgstr "Open() file \"%s\" non riuscito, %s" #: src/iptux-core/internal/AnalogFS.cpp:117 #, c-format msgid "Stat64() file \"%s\" failed, %s" msgstr "Stat64() file \"%s\" non riuscito, %s" #: src/iptux-core/internal/AnalogFS.cpp:138 #, c-format msgid "Mkdir() directory \"%s\" failed, %s" msgstr "Mkdir() directory \"%s\" non riuscito, %s" #: src/iptux-core/internal/AnalogFS.cpp:164 #, c-format msgid "Opendir() directory \"%s\" failed, %s" msgstr "Opendir() directory \"%s\" non riuscito, %s" #: src/iptux-core/internal/Command.cpp:226 msgid "Your pal didn't receive the packet. He or she is offline maybe." msgstr "" "Il tuo conoscente non ha ricevuto i dati. Lei o lui potrebbe essere offline." #: src/iptux-core/internal/CommandMode.cpp:39 #, c-format msgid "unknown command mode: %d" msgstr "" #: src/iptux-core/internal/RecvFileData.cpp:117 msgid "receive" msgstr "ricezione" #: src/iptux-core/internal/RecvFileData.cpp:124 #: src/iptux-core/internal/RecvFileData.cpp:253 #: src/iptux-core/internal/SendFileData.cpp:108 #: src/iptux-core/internal/SendFileData.cpp:193 #, fuzzy msgid "Unknown" msgstr "sconosciuto" #: src/iptux-core/internal/RecvFileData.cpp:175 #, fuzzy, c-format msgid "" "Failed to receive the file \"%s\" from %s! expect length %jd, received %jd" msgstr "Ricezione del file \"%s\" da %s non riuscita!" #: src/iptux-core/internal/RecvFileData.cpp:180 #, c-format msgid "Receive the file \"%s\" from %s successfully!" msgstr "Ricezione del file \"%s\" da %s con successo!" #: src/iptux-core/internal/RecvFileData.cpp:320 #, c-format msgid "Failed to receive the directory \"%s\" from %s!" msgstr "Ricezione della directory \"%s\" da %s non riuscita!" #: src/iptux-core/internal/RecvFileData.cpp:323 #, c-format msgid "Receive the directory \"%s\" from %s successfully!" msgstr "Ricezione della directory \"%s\" da %s con successo!" #: src/iptux-core/internal/SendFileData.cpp:101 msgid "send" msgstr "invia" #: src/iptux-core/internal/SendFileData.cpp:137 #, c-format msgid "Failed to send the file \"%s\" to %s!" msgstr "Invio del file \"%s\" a %s non riuscito!" #: src/iptux-core/internal/SendFileData.cpp:142 #, c-format msgid "Send the file \"%s\" to %s successfully!" msgstr "Il file \"%s\" è stato inviato con successo a %s!" #: src/iptux-core/internal/SendFileData.cpp:265 #, c-format msgid "Failed to send the directory \"%s\" to %s!" msgstr "Invio della directory \"%s\" a %s non riuscito!" #: src/iptux-core/internal/SendFileData.cpp:270 #, c-format msgid "Send the directory \"%s\" to %s successfully!" msgstr "La directory \"%s\" è stata inviata con successo a %s!" #: src/iptux-core/internal/UdpData.cpp:92 #: src/iptux-core/internal/UdpData.cpp:93 #: src/iptux-core/internal/UdpData.cpp:443 #: src/iptux-core/internal/UdpData.cpp:484 msgid "mysterious" msgstr "misterioso" #: src/iptux-utils/utils.cpp:880 #, c-format msgid "stat file \"%s\" failed: %s" msgstr "" #: src/iptux-utils/utils.cpp:888 #, c-format msgid "path %s is not file or directory: st_mode(%x)" msgstr "" #: src/iptux-utils/utils.cpp:895 #, c-format msgid "opendir on \"%s\" failed: %s" msgstr "" #: src/iptux/AboutDialog.cpp:39 msgid "TRANSLATOR NAME" msgstr "" #: src/iptux/AboutDialog.cpp:53 msgid "Thanks to" msgstr "" #: src/iptux/AppIndicator.cpp:40 src/iptux/MainWindow.cpp:505 #: src/iptux/MainWindow.cpp:507 #, fuzzy msgid "Iptux" msgstr "iptux" #: src/iptux/Application.cpp:54 msgid "Loading the process successfully!" msgstr "Processo caricato con successo!" #: src/iptux/Application.cpp:274 #, c-format msgid "New Message from %s" msgstr "" #: src/iptux/Application.cpp:287 #, c-format msgid "New File from %s" msgstr "" #: src/iptux/Application.cpp:296 msgid "Receiving File Finished" msgstr "" #: src/iptux/Application.cpp:300 msgid "file info no longer exist" msgstr "" #: src/iptux/Darwin.cpp:16 #, c-format msgid "Couldn’t load icon: %s" msgstr "" #: src/iptux/DataSettings.cpp:46 msgid "Personal" msgstr "Dati personali" #: src/iptux/DataSettings.cpp:48 msgid "System" msgstr "Sistema" #: src/iptux/DataSettings.cpp:50 msgid "Network" msgstr "Rete" #: src/iptux/DataSettings.cpp:89 src/iptux/DataSettings.cpp:98 msgid "The program needs to be restarted to take effect!" msgstr "" #: src/iptux/DataSettings.cpp:143 msgid "Preferences" msgstr "Preferenze" #: src/iptux/DataSettings.cpp:143 src/iptux/RevisePal.cpp:109 #: src/iptux/dialog.cpp:107 src/iptux/dialog.cpp:170 #, fuzzy msgid "_OK" msgstr "OK" #: src/iptux/DataSettings.cpp:144 #, fuzzy msgid "_Apply" msgstr "Applica" #: src/iptux/DataSettings.cpp:144 src/iptux/DataSettings.cpp:1348 #: src/iptux/DataSettings.cpp:1395 src/iptux/DialogBase.cpp:359 #: src/iptux/DialogBase.cpp:918 src/iptux/RevisePal.cpp:110 #: src/iptux/ShareFile.cpp:419 src/iptux/callback.cpp:87 #: src/iptux/dialog.cpp:171 src/iptux/dialog.cpp:230 #, fuzzy msgid "_Cancel" msgstr "Annulla" #: src/iptux/DataSettings.cpp:169 #, fuzzy msgid "Your _nickname:" msgstr "Il tuo Nickname:" #: src/iptux/DataSettings.cpp:176 msgid "Please input your nickname!" msgstr "Per favore, inserisci il tuo Nickname!" #: src/iptux/DataSettings.cpp:182 #, fuzzy msgid "Your _group name:" msgstr "Il nome del tuo gruppo:" #: src/iptux/DataSettings.cpp:189 msgid "Please input your group name!" msgstr "Per favore, inserisci Il nome del tuo gruppo!" #: src/iptux/DataSettings.cpp:195 #, fuzzy msgid "Your _face picture:" msgstr "Immagine del tuo volto:" #: src/iptux/DataSettings.cpp:213 #, fuzzy msgid "_Save files to: " msgstr "Salva file in: " #: src/iptux/DataSettings.cpp:226 msgid "Photo" msgstr "Foto" #: src/iptux/DataSettings.cpp:238 msgid "Signature" msgstr "Firma" #: src/iptux/DataSettings.cpp:271 msgid "Port:" msgstr "" #: src/iptux/DataSettings.cpp:278 msgid "Any port number between 1024 and 65535, default is 2425" msgstr "" #: src/iptux/DataSettings.cpp:287 #, fuzzy msgid "Candidate network encodings:" msgstr "Codifica di rete candidata:" #: src/iptux/DataSettings.cpp:294 #, fuzzy msgid "Candidate network encodings, separated by \",\"" msgstr "Codifica di rete candidata" #: src/iptux/DataSettings.cpp:301 #, fuzzy msgid "Preferred network encoding:" msgstr "Codifica delle preferenze di rete:" #: src/iptux/DataSettings.cpp:308 msgid "" "Preference network coding (You should be aware of what you are doing if you " "want to modify it.)" msgstr "" "Codifica delle preferenze di rete (Dovresti essere consapevole di ciò che " "stai facendo se volessi modificarla)." #: src/iptux/DataSettings.cpp:316 msgid "Pal's default face picture:" msgstr "Immagine predefinita del volto del conoscente:" #: src/iptux/DataSettings.cpp:334 msgid "Panel font:" msgstr "Pannello dei font:" #: src/iptux/DataSettings.cpp:346 msgid "Automatically open the chat dialog" msgstr "Apri automaticamente la finestra di chat" #: src/iptux/DataSettings.cpp:354 msgid "Automatically hide the panel after login" msgstr "Nascondi automaticamente il pannello dopo l'accesso" #: src/iptux/DataSettings.cpp:362 msgid "Automatically open the File Transmission Management" msgstr "Apri automaticamente Gestione Trasmissione File" #: src/iptux/DataSettings.cpp:370 msgid "Use the 'Enter' key to send message" msgstr "Usa il tasto 'Invio' per inviare il messaggio" #: src/iptux/DataSettings.cpp:378 msgid "Automatically clean up the chat history" msgstr "Pulisci automaticamente la cronologia della chat" #: src/iptux/DataSettings.cpp:385 msgid "Save the chat history" msgstr "Salva la cronologia della chat" #: src/iptux/DataSettings.cpp:393 msgid "Use the Blacklist (NOT recommended)" msgstr "Usa la Blacklist (NON raccomandato)" #: src/iptux/DataSettings.cpp:401 msgid "Filter the request of sharing files" msgstr "Filtra la richiesta di condivisione dei file" #: src/iptux/DataSettings.cpp:408 msgid "Hide the taskbar when the main window is minimized" msgstr "" #: src/iptux/DataSettings.cpp:432 msgid "From:" msgstr "Da:" #: src/iptux/DataSettings.cpp:438 msgid "Beginning of the IP(v4) section" msgstr "Inizio della sezione IP(v4)" #: src/iptux/DataSettings.cpp:442 msgid "To:" msgstr "A:" #: src/iptux/DataSettings.cpp:448 msgid "End of the IP(v4) section" msgstr "Fine della sezione IP(v4)" #: src/iptux/DataSettings.cpp:456 msgid "Add" msgstr "Aggiungi" #: src/iptux/DataSettings.cpp:461 msgid "Delete" msgstr "Elimina" #: src/iptux/DataSettings.cpp:468 msgid "Added IP(v4) Section:" msgstr "Aggiunta Sezione IP(v4):" #: src/iptux/DataSettings.cpp:487 msgid "Import" msgstr "Importa" #: src/iptux/DataSettings.cpp:491 msgid "Export" msgstr "Esporta" #: src/iptux/DataSettings.cpp:495 src/iptux/TransWindow.cpp:171 msgid "Clear" msgstr "Cancella" #: src/iptux/DataSettings.cpp:706 msgid "From" msgstr "Da" #: src/iptux/DataSettings.cpp:713 msgid "To" msgstr "A" #: src/iptux/DataSettings.cpp:720 msgid "Description" msgstr "Descrizione" #: src/iptux/DataSettings.cpp:736 msgid "Please select download folder" msgstr "Per favore, scegli una cartella per il download" #: src/iptux/DataSettings.cpp:758 msgid "Select Font" msgstr "Scegli il Font" #: src/iptux/DataSettings.cpp:872 src/iptux/DataSettings.cpp:874 #: src/iptux/DataSettings.cpp:878 msgid "Port must be a number between 1024 and 65535" msgstr "" #: src/iptux/DataSettings.cpp:1019 src/iptux/DataSettings.cpp:1050 #, c-format msgid "" "Fopen() file \"%s\" failed!\n" "%s" msgstr "" "Fopen() file \"%s\" non riuscito!\n" "%s" #: src/iptux/DataSettings.cpp:1150 src/iptux/RevisePal.cpp:419 msgid "Please select a face picture" msgstr "Per favore, scegli un'immagine per il volto" #: src/iptux/DataSettings.cpp:1172 msgid "Please select a personal photo" msgstr "Per favore, scegli una foto personale" #: src/iptux/DataSettings.cpp:1241 src/iptux/DataSettings.cpp:1248 #: src/iptux/DetectPal.cpp:75 #, c-format msgid "" "\n" "Illegal IP(v4) address: %s!" msgstr "" "\n" "Indirizzo IP(v4) non valido: %s!" #: src/iptux/DataSettings.cpp:1346 msgid "Please select a file to import data" msgstr "Per favore, scegli un file per importare i dati" #: src/iptux/DataSettings.cpp:1347 src/iptux/DialogBase.cpp:358 #: src/iptux/ShareFile.cpp:418 src/iptux/callback.cpp:86 msgid "_Open" msgstr "" #: src/iptux/DataSettings.cpp:1394 msgid "Save data to file" msgstr "Salva i dati nel file" #: src/iptux/DataSettings.cpp:1395 src/iptux/DialogBase.cpp:919 #: src/iptux/dialog.cpp:231 #, fuzzy msgid "_Save" msgstr "Salva come" #: src/iptux/DetectPal.cpp:70 #, c-format msgid "The notification has been sent to %s." msgstr "La notifica è stata inviata a %s." #: src/iptux/DialogBase.cpp:214 #, c-format msgid "%s To Send." msgstr "" #: src/iptux/DialogBase.cpp:272 msgid "Close" msgstr "Chiudi" #: src/iptux/DialogBase.cpp:276 src/iptux/DialogGroup.cpp:375 msgid "Send" msgstr "Invia" #: src/iptux/DialogBase.cpp:307 #, fuzzy msgid "Chat History" msgstr "Salva la cronologia della chat" #: src/iptux/DialogBase.cpp:350 msgid "Choose enclosure files" msgstr "" #: src/iptux/DialogBase.cpp:353 #, fuzzy msgid "Choose enclosure folders" msgstr "Scegli le cartelle da condividere" #: src/iptux/DialogBase.cpp:593 msgid "Remove Selected" msgstr "Rimuovi i Selezionati" #: src/iptux/DialogBase.cpp:648 #, fuzzy msgid "File to send." msgstr "File da ricevere." #: src/iptux/DialogBase.cpp:653 #, fuzzy msgid "Sending progress." msgstr "Avanzamento ricezione." #: src/iptux/DialogBase.cpp:656 msgid "Dirs" msgstr "" #: src/iptux/DialogBase.cpp:659 #, fuzzy msgid "Files" msgstr "File" #: src/iptux/DialogBase.cpp:662 src/iptux/DialogPeer.cpp:565 msgid "Detail" msgstr "" #: src/iptux/DialogBase.cpp:712 #, fuzzy msgid "PeerName" msgstr "Nome" #: src/iptux/DialogBase.cpp:719 src/iptux/DialogPeer.cpp:716 msgid "Name" msgstr "Nome" #: src/iptux/DialogBase.cpp:725 src/iptux/DialogPeer.cpp:652 #: src/iptux/DialogPeer.cpp:722 src/iptux/ShareFile.cpp:280 #: src/iptux/TransWindow.cpp:271 msgid "Size" msgstr "Dimensione" #: src/iptux/DialogBase.cpp:731 msgid "Path" msgstr "" #: src/iptux/DialogBase.cpp:792 #, fuzzy msgid "Sending Progress." msgstr "Avanzamento Ricezione." #: src/iptux/DialogBase.cpp:795 #, fuzzy, c-format msgid "%s of %s Sent." msgstr "%s di %s Ricevuti." #: src/iptux/DialogBase.cpp:802 src/iptux/DialogPeer.cpp:835 msgid "Mission Completed!" msgstr "Missione Completata!" #: src/iptux/DialogBase.cpp:845 src/iptux/DialogBase.cpp:917 msgid "Save Image" msgstr "" #: src/iptux/DialogBase.cpp:850 msgid "Copy Image" msgstr "" #: src/iptux/DialogGroup.cpp:285 msgid "Member" msgstr "Membro" #: src/iptux/DialogGroup.cpp:382 msgid "Pals" msgstr "Conoscenti" #: src/iptux/DialogGroup.cpp:480 msgid "Select All" msgstr "Seleziona tutto" #: src/iptux/DialogGroup.cpp:485 msgid "Reverse Select" msgstr "Inverti la selezione" #: src/iptux/DialogGroup.cpp:490 msgid "Clear Up" msgstr "Cancella" #: src/iptux/DialogGroup.cpp:728 #, c-format msgid "Talk with the group %s" msgstr "Conversazione con il gruppo %s" #: src/iptux/DialogPeer.cpp:132 #, c-format msgid "Talk with %s(%s) IP:%s" msgstr "Conversazione con %s(%s) IP:%s" #: src/iptux/DialogPeer.cpp:305 msgid "Info." msgstr "Informazioni" #: src/iptux/DialogPeer.cpp:337 #, c-format msgid "Version: %s\n" msgstr "Versione: %s\n" #: src/iptux/DialogPeer.cpp:339 #, c-format msgid "Nickname: %s@%s\n" msgstr "Nickname: %s@%s\n" #: src/iptux/DialogPeer.cpp:342 #, c-format msgid "Nickname: %s\n" msgstr "Nickname: %s\n" #: src/iptux/DialogPeer.cpp:344 #, c-format msgid "User: %s\n" msgstr "Utente: %s\n" #: src/iptux/DialogPeer.cpp:345 #, c-format msgid "Host: %s\n" msgstr "Host: %s\n" #: src/iptux/DialogPeer.cpp:348 #, c-format msgid "Address: %s(%s)\n" msgstr "Indirizzo: %s(%s)\n" #: src/iptux/DialogPeer.cpp:350 #, c-format msgid "Address: %s\n" msgstr "Indirizzo: %s\n" #: src/iptux/DialogPeer.cpp:353 msgid "Compatibility: Microsoft\n" msgstr "Compatibilità: Microsoft\n" #: src/iptux/DialogPeer.cpp:355 msgid "Compatibility: GNU/Linux\n" msgstr "Compatibilità: GNU/Linux\n" #: src/iptux/DialogPeer.cpp:357 #, c-format msgid "System coding: %s\n" msgstr "Sistema di codifica: %s\n" #: src/iptux/DialogPeer.cpp:362 msgid "Signature:\n" msgstr "Firma:\n" #: src/iptux/DialogPeer.cpp:369 msgid "" "\n" "Photo:\n" msgstr "" "\n" "Foto:\n" #: src/iptux/DialogPeer.cpp:460 msgid "Please select a picture to insert the buffer" msgstr "Per favore, seleziona un'immagine da inserire nel buffer" #: src/iptux/DialogPeer.cpp:486 src/iptux/resources/gtk/menus.ui:83 #: src/iptux/resources/gtk/menus.ui:228 #, fuzzy msgid "Insert Image" msgstr "Inserisci un'immagine" #: src/iptux/DialogPeer.cpp:502 msgid "Enclosure." msgstr "Allegato." #: src/iptux/DialogPeer.cpp:547 #, fuzzy msgid "Files to be received" msgstr "File da ricevere." #: src/iptux/DialogPeer.cpp:551 msgid "Receiving progress." msgstr "Avanzamento ricezione." #: src/iptux/DialogPeer.cpp:554 msgid "Accept" msgstr "Accetto" #: src/iptux/DialogPeer.cpp:560 src/iptux/dialog.cpp:63 #: src/iptux/resources/gtk/menus.ui:342 msgid "Refuse" msgstr "Rifiuto" #: src/iptux/DialogPeer.cpp:596 msgid "File received." msgstr "File ricevuto." #: src/iptux/DialogPeer.cpp:639 src/iptux/DialogPeer.cpp:710 msgid "Source" msgstr "Sorgente" #: src/iptux/DialogPeer.cpp:646 msgid "SaveAs" msgstr "Salva come" #: src/iptux/DialogPeer.cpp:818 src/iptux/DialogPeer.cpp:884 msgid "Receiving Progress." msgstr "Avanzamento Ricezione." #: src/iptux/DialogPeer.cpp:821 src/iptux/DialogPeer.cpp:887 #, c-format msgid "%s to Receive." msgstr "%s da Ricevere." #: src/iptux/DialogPeer.cpp:825 src/iptux/DialogPeer.cpp:891 #, c-format msgid "%s Of %s Received." msgstr "%s di %s Ricevuti." #: src/iptux/LogSystem.cpp:71 #, c-format msgid "Recevied-From: Nickname:%s User:%s Host:%s" msgstr "Ricevuto da: Nickname:%s Utente:%s Host:%s" #: src/iptux/LogSystem.cpp:76 #, c-format msgid "Send-To: Nickname:%s User:%s Host:%s" msgstr "Invia a: Nickname:%s Utente:%s Host:%s" #: src/iptux/LogSystem.cpp:80 msgid "Send-Broadcast" msgstr "Invio Broadcast" #: src/iptux/LogSystem.cpp:99 #, c-format msgid "User:%s Host:%s" msgstr "Utente:%s Host:%s" #: src/iptux/MainWindow.cpp:570 msgid "Pals Online: 0" msgstr "Conoscenti Collegati: 0" #: src/iptux/MainWindow.cpp:655 msgid "Search Pals" msgstr "Cerca Conoscenti" #: src/iptux/MainWindow.cpp:768 msgid "Nickname" msgstr "Nickname" #: src/iptux/MainWindow.cpp:778 msgid "Group" msgstr "Gruppo" #: src/iptux/MainWindow.cpp:784 src/iptux/TransWindow.cpp:258 msgid "IPv4" msgstr "IPv4" #: src/iptux/MainWindow.cpp:790 msgid "User" msgstr "Utente" #: src/iptux/MainWindow.cpp:796 src/iptux/resources/gtk/MainWindow.ui:81 msgid "Host" msgstr "Host" #: src/iptux/MainWindow.cpp:935 #, fuzzy, c-format msgid "Pals Online: %d" msgstr "Conoscenti Collegati: 0" #: src/iptux/RevisePal.cpp:109 msgid "Change Pal's Information" msgstr "Modifica delle Informazioni del Conoscente" #: src/iptux/RevisePal.cpp:134 msgid "Pal's nickname:" msgstr "Nickname del conoscente:" #: src/iptux/RevisePal.cpp:140 msgid "Please input pal's new nickname!" msgstr "Per favore, inserisci il nuovo nickname del conoscente!" #: src/iptux/RevisePal.cpp:146 msgid "Pal's group name:" msgstr "Nome del gruppo di conoscenti:" #: src/iptux/RevisePal.cpp:152 msgid "Please input pal's new group name!" msgstr "Per favore, inserisci il nome del nuovo gruppo di conoscenti!" #: src/iptux/RevisePal.cpp:158 msgid "System coding:" msgstr "Sistema di codifica:" #: src/iptux/RevisePal.cpp:164 msgid "Be SURE to know what you are doing!" msgstr "ASSICURATI di sapere cosa stai facendo!" #: src/iptux/RevisePal.cpp:170 msgid "Pal's face picture:" msgstr "Immagine del volto del conoscente:" #: src/iptux/RevisePal.cpp:184 msgid "Be compatible with iptux's protocol (DANGEROUS)" msgstr "Deve essere compatibile con il protocollo iptux (PERICOLOSO)" #: src/iptux/ShareFile.cpp:104 msgid "Shared Files Management" msgstr "Gestione dei file condivisi" #: src/iptux/ShareFile.cpp:105 msgid "OK" msgstr "OK" #: src/iptux/ShareFile.cpp:106 msgid "Apply" msgstr "Applica" #: src/iptux/ShareFile.cpp:107 msgid "Cancel" msgstr "Annulla" #: src/iptux/ShareFile.cpp:160 msgid "Add Files" msgstr "Aggiungi File" #: src/iptux/ShareFile.cpp:163 msgid "Add Folders" msgstr "Aggiungi Cartelle" #: src/iptux/ShareFile.cpp:166 msgid "Delete Resources" msgstr "Elimina le Risorse" #: src/iptux/ShareFile.cpp:169 msgid "Clear Password" msgstr "Cancella Password" #: src/iptux/ShareFile.cpp:172 msgid "Set Password" msgstr "Imposta Password" #: src/iptux/ShareFile.cpp:229 src/iptux/ShareFile.cpp:373 msgid "regular" msgstr "regolare" #: src/iptux/ShareFile.cpp:233 src/iptux/ShareFile.cpp:377 msgid "directory" msgstr "directory" #: src/iptux/ShareFile.cpp:237 src/iptux/ShareFile.cpp:381 msgid "unknown" msgstr "sconosciuto" #: src/iptux/ShareFile.cpp:270 msgid "File" msgstr "File" #: src/iptux/ShareFile.cpp:286 msgid "Type" msgstr "Tipo" #: src/iptux/ShareFile.cpp:411 msgid "Choose the files to share" msgstr "Scegli il file da condividere" #: src/iptux/ShareFile.cpp:414 msgid "Choose the folders to share" msgstr "Scegli le cartelle da condividere" #: src/iptux/TransWindow.cpp:86 msgid "Files Transmission Management" msgstr "Gestione Trasmissione File" #: src/iptux/TransWindow.cpp:241 msgid "State" msgstr "Stato" #: src/iptux/TransWindow.cpp:247 msgid "Task" msgstr "Attività" #: src/iptux/TransWindow.cpp:253 msgid "Peer" msgstr "Nodo" #: src/iptux/TransWindow.cpp:265 msgid "Filename" msgstr "Nome del file" #: src/iptux/TransWindow.cpp:277 msgid "Completed" msgstr "Completato" #: src/iptux/TransWindow.cpp:284 msgid "Progress" msgstr "Avanzamento" #: src/iptux/TransWindow.cpp:291 msgid "Cost" msgstr "Costo" #: src/iptux/TransWindow.cpp:297 msgid "Remaining" msgstr "Rimanenti" #: src/iptux/TransWindow.cpp:303 msgid "Rate" msgstr "Velocità" #: src/iptux/TransWindow.cpp:331 msgid "The path you want to open not exist!" msgstr "Il percorso che vuoi aprire non esiste!" #: src/iptux/TransWindow.cpp:405 msgid "The file you want to open not exist!" msgstr "Il file che vuoi aprire non esiste!" #: src/iptux/TransWindow.cpp:406 #, fuzzy msgid "iptux Error" msgstr "iptux" #: src/iptux/UiCoreThread.cpp:254 src/iptux/UiCoreThread.cpp:278 #: src/iptux/UiCoreThread.cpp:377 src/iptux/UiCoreThread.cpp:399 msgid "Others" msgstr "Altri" #: src/iptux/UiCoreThread.cpp:419 msgid "Broadcast" msgstr "Trasmetti" #: src/iptux/UiHelper.cpp:28 #, c-format msgid "Can't convert path to uri: %s, reason: %s" msgstr "" #: src/iptux/UiHelper.cpp:39 #, c-format msgid "Can't open path: %s, reason: %s" msgstr "" #: src/iptux/UiHelper.cpp:68 #, c-format msgid "Can't open URL: %s, reason: %s" msgstr "" #: src/iptux/UiHelper.cpp:188 msgid "Information" msgstr "Informazioni" #: src/iptux/UiHelper.cpp:218 msgid "Warning" msgstr "Avviso" #: src/iptux/UiModels.cpp:604 #, fuzzy, c-format msgid "Version: %s" msgstr "Versione: %s\n" #: src/iptux/UiModels.cpp:608 #, fuzzy, c-format msgid "Nickname: %s@%s" msgstr "Nickname: %s@%s\n" #: src/iptux/UiModels.cpp:611 #, fuzzy, c-format msgid "Nickname: %s" msgstr "Nickname: %s\n" #: src/iptux/UiModels.cpp:615 #, fuzzy, c-format msgid "User: %s" msgstr "Utente: %s\n" #: src/iptux/UiModels.cpp:618 #, fuzzy, c-format msgid "Host: %s" msgstr "Host: %s\n" #: src/iptux/UiModels.cpp:623 #, fuzzy, c-format msgid "Address: %s(%s)" msgstr "Indirizzo: %s(%s)\n" #: src/iptux/UiModels.cpp:625 #, fuzzy, c-format msgid "Address: %s" msgstr "Indirizzo: %s\n" #: src/iptux/UiModels.cpp:630 #, fuzzy msgid "Compatibility: Microsoft" msgstr "Compatibilità: Microsoft\n" #: src/iptux/UiModels.cpp:632 #, fuzzy msgid "Compatibility: GNU/Linux" msgstr "Compatibilità: GNU/Linux\n" #: src/iptux/UiModels.cpp:636 #, fuzzy, c-format msgid "System coding: %s" msgstr "Sistema di codifica: %s\n" #: src/iptux/UiModels.cpp:641 #, fuzzy msgid "Signature:" msgstr "Firma:\n" #: src/iptux/UiModels.cpp:744 msgid "" msgstr "" #: src/iptux/UiModels.cpp:799 msgid "[IMG]" msgstr "" #: src/iptux/dialog.cpp:39 msgid "" "File transfer has not been completed.\n" "Are you sure to cancel and quit?" msgstr "" "Il trasferimento del file non è stato completato.\n" "Sei sicuro di voler annullare ed interrompere?" #: src/iptux/dialog.cpp:42 msgid "Confirm Exit" msgstr "Conferma l'Uscita" #: src/iptux/dialog.cpp:62 src/iptux/resources/gtk/MainWindow.ui:12 #: src/iptux/resources/gtk/menus.ui:98 src/iptux/resources/gtk/menus.ui:243 msgid "Request Shared Resources" msgstr "Richiedi le risorse condivise" #: src/iptux/dialog.cpp:62 msgid "Agree" msgstr "Accetto" #: src/iptux/dialog.cpp:78 #, c-format msgid "" "Your pal (%s)[%s]\n" "is requesting to get your shared resources,\n" "Do you agree?" msgstr "" "Il tuo conoscente (%s)[%s]\n" "ha richiesto di accedere alle tue risorse condivise,\n" "Sei d'accordo?" #: src/iptux/dialog.cpp:106 msgid "Access Password" msgstr "Password di accesso" #: src/iptux/dialog.cpp:113 msgid "Please input the password for the shared files behind" msgstr "Per favore, prima inserisci la password per la condivisione dei file" #: src/iptux/dialog.cpp:127 #, c-format msgid "(%s)[%s]Password:" msgstr "(%s)[%s]Password:" #: src/iptux/dialog.cpp:146 src/iptux/dialog.cpp:207 msgid "" "\n" "Empty Password!" msgstr "" "\n" "Password vuota!" #: src/iptux/dialog.cpp:170 msgid "Enter a New Password" msgstr "Inserisci la nuova password" #: src/iptux/dialog.cpp:178 msgid "Password: " msgstr "Password: " #: src/iptux/dialog.cpp:187 msgid "Repeat: " msgstr "Ripeti: " #: src/iptux/dialog.cpp:202 msgid "" "\n" "Password Mismatched!" msgstr "" "\n" "Password Non Corrispondente!" #: src/iptux/dialog.cpp:229 msgid "Please select a folder to save files." msgstr "Per favore, scegli una cartella dove salvare i file." #: src/iptux/resources/gtk/AboutDialog.ui:11 msgid "" "Copyright © 2008–2009, Jally\n" "Copyright © 2013–2015,2017–2021, LI Daobing" msgstr "" #: src/iptux/resources/gtk/AboutDialog.ui:13 #, fuzzy msgid "A GTK based LAN messenger." msgstr "Un LAN Messenger basato su GTK+." #: src/iptux/resources/gtk/AppIndicator.ui:6 #, fuzzy msgid "Open Iptux" msgstr "iptux" #: src/iptux/resources/gtk/AppIndicator.ui:12 #: src/iptux/resources/gtk/menus.ui:6 src/iptux/resources/gtk/menus.ui:306 msgid "_Preferences" msgstr "_Preferenze" #: src/iptux/resources/gtk/AppIndicator.ui:16 #: src/iptux/resources/gtk/menus.ui:10 src/iptux/resources/gtk/menus.ui:310 msgid "_Quit" msgstr "_Esci" #: src/iptux/resources/gtk/DetectPal.ui:7 #, fuzzy msgid "Detect pal" msgstr "Rileva conoscenti" #: src/iptux/resources/gtk/DetectPal.ui:15 msgid "Detect" msgstr "Rileva" #: src/iptux/resources/gtk/DetectPal.ui:61 msgid "Please input an IP address (IPv4 only):" msgstr "Per favore, inserisci un indirizzo IP (solo IPv4):" #: src/iptux/resources/gtk/MainWindow.ui:8 src/iptux/resources/gtk/menus.ui:109 #: src/iptux/resources/gtk/menus.ui:254 msgid "Send Message" msgstr "Invia il messaggio" #: src/iptux/resources/gtk/MainWindow.ui:16 msgid "Change Info" msgstr "Modifica le informazioni" #: src/iptux/resources/gtk/MainWindow.ui:20 msgid "Delete Pal" msgstr "Elimina conoscenti" #: src/iptux/resources/gtk/MainWindow.ui:26 src/iptux/resources/gtk/menus.ui:31 #: src/iptux/resources/gtk/menus.ui:176 msgid "Sort" msgstr "Ordinamento" #: src/iptux/resources/gtk/MainWindow.ui:29 src/iptux/resources/gtk/menus.ui:34 #: src/iptux/resources/gtk/menus.ui:179 msgid "By Nickname" msgstr "Per Nickname" #: src/iptux/resources/gtk/MainWindow.ui:34 src/iptux/resources/gtk/menus.ui:39 #: src/iptux/resources/gtk/menus.ui:184 #, fuzzy msgid "By Username" msgstr "Per Nickname" #: src/iptux/resources/gtk/MainWindow.ui:39 src/iptux/resources/gtk/menus.ui:44 #: src/iptux/resources/gtk/menus.ui:189 msgid "By IP" msgstr "Per IP" #: src/iptux/resources/gtk/MainWindow.ui:44 src/iptux/resources/gtk/menus.ui:49 #: src/iptux/resources/gtk/menus.ui:194 #, fuzzy msgid "By Host" msgstr "Host" #: src/iptux/resources/gtk/MainWindow.ui:49 src/iptux/resources/gtk/menus.ui:54 #: src/iptux/resources/gtk/menus.ui:199 msgid "By Last Activity" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:56 src/iptux/resources/gtk/menus.ui:61 #: src/iptux/resources/gtk/menus.ui:206 msgid "Ascending" msgstr "Ascendente" #: src/iptux/resources/gtk/MainWindow.ui:61 src/iptux/resources/gtk/menus.ui:66 #: src/iptux/resources/gtk/menus.ui:211 msgid "Descending" msgstr "Discendente" #: src/iptux/resources/gtk/MainWindow.ui:68 msgid "Info Style" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:71 #, fuzzy msgid "IP" msgstr "IPv4" #: src/iptux/resources/gtk/MainWindow.ui:76 msgid "IP:PORT" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:86 #, fuzzy msgid "Username" msgstr "Utente" #: src/iptux/resources/gtk/MainWindow.ui:91 #, fuzzy msgid "Version" msgstr "Versione: %s\n" #: src/iptux/resources/gtk/MainWindow.ui:96 msgid "Last Activity" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:101 #, fuzzy msgid "Last Message" msgstr "Invia Messaggio" #: src/iptux/resources/gtk/menus.ui:17 src/iptux/resources/gtk/menus.ui:162 msgid "_File" msgstr "_File" #: src/iptux/resources/gtk/menus.ui:19 src/iptux/resources/gtk/menus.ui:164 msgid "_Detect" msgstr "_Rileva" #: src/iptux/resources/gtk/menus.ui:23 src/iptux/resources/gtk/menus.ui:168 msgid "_Find" msgstr "_Trova" #: src/iptux/resources/gtk/menus.ui:28 src/iptux/resources/gtk/menus.ui:173 msgid "_View" msgstr "" #: src/iptux/resources/gtk/menus.ui:73 src/iptux/resources/gtk/menus.ui:218 msgid "_Refresh" msgstr "" #: src/iptux/resources/gtk/menus.ui:80 src/iptux/resources/gtk/menus.ui:225 msgid "_Chat" msgstr "" #: src/iptux/resources/gtk/menus.ui:88 src/iptux/resources/gtk/menus.ui:233 msgid "Attach File" msgstr "Allega un file" #: src/iptux/resources/gtk/menus.ui:92 src/iptux/resources/gtk/menus.ui:237 msgid "Attach Folder" msgstr "Allega una cartella" #: src/iptux/resources/gtk/menus.ui:102 src/iptux/resources/gtk/menus.ui:247 msgid "Clear Chat History" msgstr "Cancella la cronologia della chat" #: src/iptux/resources/gtk/menus.ui:115 src/iptux/resources/gtk/menus.ui:260 msgid "_Window" msgstr "" #: src/iptux/resources/gtk/menus.ui:118 src/iptux/resources/gtk/menus.ui:263 msgid "_Transmission" msgstr "Tras_missione" #: src/iptux/resources/gtk/menus.ui:122 src/iptux/resources/gtk/menus.ui:267 msgid "_Shared Management" msgstr "_Gestione Condivisioni" #: src/iptux/resources/gtk/menus.ui:126 src/iptux/resources/gtk/menus.ui:271 msgid "_Chat Log" msgstr "" #: src/iptux/resources/gtk/menus.ui:130 src/iptux/resources/gtk/menus.ui:275 #, fuzzy msgid "_System Log" msgstr "Sistema di codifica:" #: src/iptux/resources/gtk/menus.ui:136 src/iptux/resources/gtk/menus.ui:281 msgid "Close Window" msgstr "" #: src/iptux/resources/gtk/menus.ui:142 src/iptux/resources/gtk/menus.ui:287 msgid "_Help" msgstr "_Aiuto" #: src/iptux/resources/gtk/menus.ui:145 src/iptux/resources/gtk/menus.ui:290 msgid "_About" msgstr "_Informazioni" #: src/iptux/resources/gtk/menus.ui:149 src/iptux/resources/gtk/menus.ui:294 msgid "Report Bug" msgstr "Segnala un errore" #: src/iptux/resources/gtk/menus.ui:153 src/iptux/resources/gtk/menus.ui:298 msgid "What's New" msgstr "" #: src/iptux/resources/gtk/menus.ui:318 msgid "Open This File" msgstr "Apri questo file" #: src/iptux/resources/gtk/menus.ui:322 msgid "Open Containing Folder" msgstr "Apri cartella in cui è contenuto" #: src/iptux/resources/gtk/menus.ui:326 msgid "Terminate Task" msgstr "Termina Attività" #: src/iptux/resources/gtk/menus.ui:330 msgid "Terminate All" msgstr "Termina Tutto" #: src/iptux/resources/gtk/menus.ui:334 msgid "Clear Tasklist" msgstr "Cancella Lista Attività" #: src/iptux/resources/gtk/menus.ui:346 #, fuzzy msgid "Refuse All" msgstr "Rifiuto" #: src/main/iptux.cpp:149 #, fuzzy msgid "- A software for sharing in LAN" msgstr "iptux: Un software per le condivisioni sulla rete LAN\n" #: src/main/iptux.cpp:152 #, c-format msgid "option parsing failed: %s\n" msgstr "" #~ msgid "Can't find any available web browser!\n" #~ msgstr "Impossibile trovare alcun web browser disponibile!\n" #~ msgid "Close Chat" #~ msgstr "Chiudi la chat" #~ msgid "Pals Online: %" #~ msgstr "Conoscenti Collegati: %" #~ msgid "Sound" #~ msgstr "Audio" #~ msgid "Activate the sound support" #~ msgstr "Attiva il supporto audio" #~ msgid "Volume Control: " #~ msgstr "Controllo Volume: " #~ msgid "Sound Event" #~ msgstr "Evento Audio" #~ msgid "Test" #~ msgstr "Test" #~ msgid "Stop" #~ msgstr "Ferma" #~ msgid "Transfer finished" #~ msgstr "Trasferimento terminato" #~ msgid "Message received" #~ msgstr "Messaggio ricevuto" #~ msgid "Play" #~ msgstr "Riproduci" #~ msgid "Event" #~ msgstr "Evento" #~ msgid "Please select a sound file" #~ msgstr "Per favore, scegli un file audio" #, fuzzy #~ msgid "Failed to play the prompt tone, [%s] %s, %s" #~ msgstr "Impossibile riprodurre il tono di prompt, %s\n" #~ msgid "_Hide" #~ msgstr "_Nascondi" #~ msgid "_Show" #~ msgstr "_Mostra" #~ msgid "To be read: %u messages" #~ msgstr "Da leggere: %u messaggi" #~ msgid "_Tools" #~ msgstr "_Strumenti" #~ msgid "Error" #~ msgstr "Errore" #, fuzzy #~ msgid "iptux-icon" #~ msgstr "iptux" #~ msgid "Please input an IP address (IPv4 only)!" #~ msgstr "Per favore, inserisci un indirizzo IP (solo IPv4)!" #~ msgid "..." #~ msgstr "..." #~ msgid "Clear Buffer" #~ msgstr "Cancella il Buffer" #, fuzzy #~ msgid "Contributors" #~ msgstr "Collaboratori" #, fuzzy #~ msgid "" #~ "Fatal Error!!\n" #~ "Failed to bind the TCP/UDP port(%d)!\n" #~ "%s" #~ msgstr "" #~ "Errore Fatale!!\n" #~ "Ascolto sulla porta TCP/UDP (2425) non riuscito!\n" #~ "%s" #~ msgid "Help" #~ msgstr "Aiuto" #~ msgid "" #~ "It's an honor that iptux was contributed voluntarilly by many people. " #~ "Without your help, iptux could never make it.\n" #~ "\n" #~ "Especially, Here's some we would like to thank much:\n" #~ "\n" #~ "ChenGang\n" #~ "\n" #~ "\n" #~ "\n" #~ "\n" #~ "\n" #~ "..." #~ msgstr "" #~ "È un onore che iptux abbia collaborazioni volontarie da molte persone. " #~ "Senza il tuo aiuto, iptux non potrebbe mai farcela.\n" #~ "\n" #~ "In particolare, ecco alcune persone che vorremmo ringraziare molto:\n" #~ "\n" #~ "ChenGang\n" #~ "\n" #~ "\n" #~ "\n" #~ "\n" #~ "\n" #~ "..." #~ msgid "Jally " #~ msgstr "Jally " #~ msgid "LiWeijian " #~ msgstr "LiWeijian " #~ msgid "ManPT " #~ msgstr "ManPT " #~ msgid "More About Iptux" #~ msgstr "Maggiori informazioni su Iptux" #~ msgid "The process is about to quit!" #~ msgstr "Il processo è in procinto di interruzione!" #~ msgid "_FAQ" #~ msgstr "_FAQ" #~ msgid "_More" #~ msgstr "Altre _Info" #~ msgid "_Sort" #~ msgstr "_Ordinamento" #~ msgid "_Update" #~ msgstr "Aggio_rna" #~ msgid "" #~ "alick \n" #~ "ManPT " #~ msgstr "" #~ "alick \n" #~ "ManPT \n" #~ "Wonderfulheart " #~ msgid "" #~ "\t-h --help\n" #~ "\t\tdisplay this help and exit\n" #~ msgstr "" #~ "\t-h --help\n" #~ "\t\tvisualizza questo aiuto ed esce\n" #~ msgid "" #~ "\t-v --version\n" #~ "\t\toutput version information and exit\n" #~ msgstr "" #~ "\t-v --version\n" #~ "\t\trestituisce l'informazione di versione ed esce\n" #~ msgid "Opendir() directory \"%s\" failed, %s\n" #~ msgstr "Opendir() directory \"%s\" non riuscito, %s\n" #~ msgid "Rmdir() directory \"%s\" failed, %s\n" #~ msgstr "Rmdir() directory \"%s\" non riuscito, %s\n" #~ msgid "Stat() file \"%s\" failed, %s\n" #~ msgstr "Stat() file \"%s\" non riuscito, %s\n" #~ msgid "The user is not privileged!\n" #~ msgstr "L'utente non è privilegiato!\n" #~ msgid "Unlink() file \"%s\" failed, %s\n" #~ msgstr "Unlink() file \"%s\" non riuscito, %s\n" #~ msgid "What do you want to do?\n" #~ msgstr "Cosa vuoi fare?\n" #~ msgid "utf-16" #~ msgstr "utf-16" #~ msgid "utf-8" #~ msgstr "utf-8" iptux-0.9.4/po/lb.po000066400000000000000000000704651475473122500142760ustar00rootroot00000000000000# Luxembourgish translation for iptux # Copyright (c) 2010 Rosetta Contributors and Canonical Ltd 2010 # This file is distributed under the same license as the iptux package. # FIRST AUTHOR , 2010. # msgid "" msgstr "" "Project-Id-Version: iptux\n" "Report-Msgid-Bugs-To: https://github.com/iptux-src/iptux/issues/new\n" "POT-Creation-Date: 2025-02-17 13:35-0800\n" "PO-Revision-Date: 2010-08-30 21:09+0000\n" "Last-Translator: n0a3n \n" "Language-Team: Luxembourgish \n" "Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Launchpad-Export-Date: 2018-01-24 12:00+0000\n" "X-Generator: Launchpad (build 18532)\n" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:6 msgid "iptux" msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:7 msgid "LAN communication software" msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:17 msgid "iptux is an “IP Messenger” client. The features of iptux include:" msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:21 msgid "auto-detect other clients on the intranet." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:22 msgid "send/recv messages to other clients." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:23 msgid "send/recv files to other clients." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:24 msgid "share your files to other cliens (with optional password protection)." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:26 msgid "" "It is (supposedly) compatible with 飞鸽传书 (Feige) and 飞秋 (FeiQ) from " "China, and with the original “IP Messenger” clients from Japan, including " "g2ipmsg and xipmsg in Debian." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:38 msgid "The Iptux main window." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:42 msgid "The Iptux chat window." msgstr "" #: src/iptux-core/CoreThread.cpp:172 #, c-format msgid "" "Fatal Error!! Failed to create new socket!\n" "%s" msgstr "" #: src/iptux-core/CoreThread.cpp:188 #, c-format msgid "" "Fatal Error!! Failed to bind the TCP port(%s:%d)!\n" "%s" msgstr "" #: src/iptux-core/CoreThread.cpp:201 #, c-format msgid "" "Fatal Error!! Failed to bind the UDP port(%s:%d)!\n" "%s" msgstr "" #: src/iptux-core/CoreThread.cpp:461 src/iptux-core/CoreThread.cpp:495 #: src/iptux-core/internal/RecvFileData.cpp:142 #: src/iptux-core/internal/RecvFileData.cpp:204 #, c-format msgid "" "Fatal Error!!\n" "Failed to create new socket!\n" "%s" msgstr "" #: src/iptux-core/Models.cpp:172 msgid "Empty Message" msgstr "" #: src/iptux-core/Models.cpp:250 msgid "Received an image" msgstr "" #: src/iptux-core/internal/AnalogFS.cpp:93 #: src/iptux-core/internal/AnalogFS.cpp:98 #, c-format msgid "Open() file \"%s\" failed, %s" msgstr "" #: src/iptux-core/internal/AnalogFS.cpp:117 #, c-format msgid "Stat64() file \"%s\" failed, %s" msgstr "" #: src/iptux-core/internal/AnalogFS.cpp:138 #, c-format msgid "Mkdir() directory \"%s\" failed, %s" msgstr "" #: src/iptux-core/internal/AnalogFS.cpp:164 #, c-format msgid "Opendir() directory \"%s\" failed, %s" msgstr "" #: src/iptux-core/internal/Command.cpp:226 msgid "Your pal didn't receive the packet. He or she is offline maybe." msgstr "" #: src/iptux-core/internal/CommandMode.cpp:39 #, c-format msgid "unknown command mode: %d" msgstr "" #: src/iptux-core/internal/RecvFileData.cpp:117 msgid "receive" msgstr "" #: src/iptux-core/internal/RecvFileData.cpp:124 #: src/iptux-core/internal/RecvFileData.cpp:253 #: src/iptux-core/internal/SendFileData.cpp:108 #: src/iptux-core/internal/SendFileData.cpp:193 #, fuzzy msgid "Unknown" msgstr "onbekannt" #: src/iptux-core/internal/RecvFileData.cpp:175 #, c-format msgid "" "Failed to receive the file \"%s\" from %s! expect length %jd, received %jd" msgstr "" #: src/iptux-core/internal/RecvFileData.cpp:180 #, c-format msgid "Receive the file \"%s\" from %s successfully!" msgstr "" #: src/iptux-core/internal/RecvFileData.cpp:320 #, c-format msgid "Failed to receive the directory \"%s\" from %s!" msgstr "" #: src/iptux-core/internal/RecvFileData.cpp:323 #, c-format msgid "Receive the directory \"%s\" from %s successfully!" msgstr "" #: src/iptux-core/internal/SendFileData.cpp:101 msgid "send" msgstr "" #: src/iptux-core/internal/SendFileData.cpp:137 #, c-format msgid "Failed to send the file \"%s\" to %s!" msgstr "" #: src/iptux-core/internal/SendFileData.cpp:142 #, c-format msgid "Send the file \"%s\" to %s successfully!" msgstr "" #: src/iptux-core/internal/SendFileData.cpp:265 #, c-format msgid "Failed to send the directory \"%s\" to %s!" msgstr "" #: src/iptux-core/internal/SendFileData.cpp:270 #, c-format msgid "Send the directory \"%s\" to %s successfully!" msgstr "" #: src/iptux-core/internal/UdpData.cpp:92 #: src/iptux-core/internal/UdpData.cpp:93 #: src/iptux-core/internal/UdpData.cpp:443 #: src/iptux-core/internal/UdpData.cpp:484 msgid "mysterious" msgstr "" #: src/iptux-utils/utils.cpp:880 #, c-format msgid "stat file \"%s\" failed: %s" msgstr "" #: src/iptux-utils/utils.cpp:888 #, c-format msgid "path %s is not file or directory: st_mode(%x)" msgstr "" #: src/iptux-utils/utils.cpp:895 #, c-format msgid "opendir on \"%s\" failed: %s" msgstr "" #: src/iptux/AboutDialog.cpp:39 msgid "TRANSLATOR NAME" msgstr "" #: src/iptux/AboutDialog.cpp:53 msgid "Thanks to" msgstr "" #: src/iptux/AppIndicator.cpp:40 src/iptux/MainWindow.cpp:505 #: src/iptux/MainWindow.cpp:507 msgid "Iptux" msgstr "" #: src/iptux/Application.cpp:54 msgid "Loading the process successfully!" msgstr "" #: src/iptux/Application.cpp:274 #, c-format msgid "New Message from %s" msgstr "" #: src/iptux/Application.cpp:287 #, c-format msgid "New File from %s" msgstr "" #: src/iptux/Application.cpp:296 msgid "Receiving File Finished" msgstr "" #: src/iptux/Application.cpp:300 msgid "file info no longer exist" msgstr "" #: src/iptux/Darwin.cpp:16 #, c-format msgid "Couldn’t load icon: %s" msgstr "" #: src/iptux/DataSettings.cpp:46 msgid "Personal" msgstr "Perséinlech" #: src/iptux/DataSettings.cpp:48 msgid "System" msgstr "System" #: src/iptux/DataSettings.cpp:50 msgid "Network" msgstr "Netzwierk" #: src/iptux/DataSettings.cpp:89 src/iptux/DataSettings.cpp:98 msgid "The program needs to be restarted to take effect!" msgstr "" #: src/iptux/DataSettings.cpp:143 msgid "Preferences" msgstr "Astellungen" #: src/iptux/DataSettings.cpp:143 src/iptux/RevisePal.cpp:109 #: src/iptux/dialog.cpp:107 src/iptux/dialog.cpp:170 msgid "_OK" msgstr "" #: src/iptux/DataSettings.cpp:144 msgid "_Apply" msgstr "" #: src/iptux/DataSettings.cpp:144 src/iptux/DataSettings.cpp:1348 #: src/iptux/DataSettings.cpp:1395 src/iptux/DialogBase.cpp:359 #: src/iptux/DialogBase.cpp:918 src/iptux/RevisePal.cpp:110 #: src/iptux/ShareFile.cpp:419 src/iptux/callback.cpp:87 #: src/iptux/dialog.cpp:171 src/iptux/dialog.cpp:230 #, fuzzy msgid "_Cancel" msgstr "Ofbriechen" #: src/iptux/DataSettings.cpp:169 #, fuzzy msgid "Your _nickname:" msgstr "Aere Spetznum" #: src/iptux/DataSettings.cpp:176 msgid "Please input your nickname!" msgstr "Weg git Aeren Spetznum an" #: src/iptux/DataSettings.cpp:182 #, fuzzy msgid "Your _group name:" msgstr "Aeren Gruppennum" #: src/iptux/DataSettings.cpp:189 msgid "Please input your group name!" msgstr "Git Weg Aeren Gruppennum an" #: src/iptux/DataSettings.cpp:195 #, fuzzy msgid "Your _face picture:" msgstr "Dain Gesiicht am Bild" #: src/iptux/DataSettings.cpp:213 #, fuzzy msgid "_Save files to: " msgstr "Fichier speicheren enneret " #: src/iptux/DataSettings.cpp:226 msgid "Photo" msgstr "Foto" #: src/iptux/DataSettings.cpp:238 msgid "Signature" msgstr "Ënnerschrëft" #: src/iptux/DataSettings.cpp:271 msgid "Port:" msgstr "" #: src/iptux/DataSettings.cpp:278 msgid "Any port number between 1024 and 65535, default is 2425" msgstr "" #: src/iptux/DataSettings.cpp:287 msgid "Candidate network encodings:" msgstr "" #: src/iptux/DataSettings.cpp:294 msgid "Candidate network encodings, separated by \",\"" msgstr "" #: src/iptux/DataSettings.cpp:301 msgid "Preferred network encoding:" msgstr "" #: src/iptux/DataSettings.cpp:308 msgid "" "Preference network coding (You should be aware of what you are doing if you " "want to modify it.)" msgstr "" #: src/iptux/DataSettings.cpp:316 msgid "Pal's default face picture:" msgstr "" #: src/iptux/DataSettings.cpp:334 msgid "Panel font:" msgstr "" #: src/iptux/DataSettings.cpp:346 msgid "Automatically open the chat dialog" msgstr "" #: src/iptux/DataSettings.cpp:354 msgid "Automatically hide the panel after login" msgstr "Automatech verstopt den Panel no dem aloggen" #: src/iptux/DataSettings.cpp:362 msgid "Automatically open the File Transmission Management" msgstr "" #: src/iptux/DataSettings.cpp:370 msgid "Use the 'Enter' key to send message" msgstr "" #: src/iptux/DataSettings.cpp:378 msgid "Automatically clean up the chat history" msgstr "Automatech Chat history laeschen" #: src/iptux/DataSettings.cpp:385 msgid "Save the chat history" msgstr "Chat historie speicheren" #: src/iptux/DataSettings.cpp:393 msgid "Use the Blacklist (NOT recommended)" msgstr "" #: src/iptux/DataSettings.cpp:401 msgid "Filter the request of sharing files" msgstr "" #: src/iptux/DataSettings.cpp:408 msgid "Hide the taskbar when the main window is minimized" msgstr "" #: src/iptux/DataSettings.cpp:432 msgid "From:" msgstr "vun" #: src/iptux/DataSettings.cpp:438 msgid "Beginning of the IP(v4) section" msgstr "" #: src/iptux/DataSettings.cpp:442 msgid "To:" msgstr "fier" #: src/iptux/DataSettings.cpp:448 msgid "End of the IP(v4) section" msgstr "" #: src/iptux/DataSettings.cpp:456 msgid "Add" msgstr "Dobäisetzen" #: src/iptux/DataSettings.cpp:461 msgid "Delete" msgstr "Läschen" #: src/iptux/DataSettings.cpp:468 msgid "Added IP(v4) Section:" msgstr "" #: src/iptux/DataSettings.cpp:487 msgid "Import" msgstr "Importéieren" #: src/iptux/DataSettings.cpp:491 msgid "Export" msgstr "Exportéieren" #: src/iptux/DataSettings.cpp:495 src/iptux/TransWindow.cpp:171 msgid "Clear" msgstr "Eidelmaachen" #: src/iptux/DataSettings.cpp:706 msgid "From" msgstr "vun" #: src/iptux/DataSettings.cpp:713 msgid "To" msgstr "fier" #: src/iptux/DataSettings.cpp:720 msgid "Description" msgstr "" #: src/iptux/DataSettings.cpp:736 msgid "Please select download folder" msgstr "Weg wielt den Eroofluerddossier aus" #: src/iptux/DataSettings.cpp:758 msgid "Select Font" msgstr "Schrëft auswielen" #: src/iptux/DataSettings.cpp:872 src/iptux/DataSettings.cpp:874 #: src/iptux/DataSettings.cpp:878 msgid "Port must be a number between 1024 and 65535" msgstr "" #: src/iptux/DataSettings.cpp:1019 src/iptux/DataSettings.cpp:1050 #, c-format msgid "" "Fopen() file \"%s\" failed!\n" "%s" msgstr "" #: src/iptux/DataSettings.cpp:1150 src/iptux/RevisePal.cpp:419 msgid "Please select a face picture" msgstr "" #: src/iptux/DataSettings.cpp:1172 msgid "Please select a personal photo" msgstr "" #: src/iptux/DataSettings.cpp:1241 src/iptux/DataSettings.cpp:1248 #: src/iptux/DetectPal.cpp:75 #, c-format msgid "" "\n" "Illegal IP(v4) address: %s!" msgstr "" #: src/iptux/DataSettings.cpp:1346 msgid "Please select a file to import data" msgstr "" #: src/iptux/DataSettings.cpp:1347 src/iptux/DialogBase.cpp:358 #: src/iptux/ShareFile.cpp:418 src/iptux/callback.cpp:86 msgid "_Open" msgstr "" #: src/iptux/DataSettings.cpp:1394 msgid "Save data to file" msgstr "Save daten an een fichier" #: src/iptux/DataSettings.cpp:1395 src/iptux/DialogBase.cpp:919 #: src/iptux/dialog.cpp:231 msgid "_Save" msgstr "" #: src/iptux/DetectPal.cpp:70 #, c-format msgid "The notification has been sent to %s." msgstr "" #: src/iptux/DialogBase.cpp:214 #, c-format msgid "%s To Send." msgstr "" #: src/iptux/DialogBase.cpp:272 msgid "Close" msgstr "Zoumaachen" #: src/iptux/DialogBase.cpp:276 src/iptux/DialogGroup.cpp:375 msgid "Send" msgstr "Fortschécken" #: src/iptux/DialogBase.cpp:307 #, fuzzy msgid "Chat History" msgstr "Chat historie speicheren" #: src/iptux/DialogBase.cpp:350 msgid "Choose enclosure files" msgstr "" #: src/iptux/DialogBase.cpp:353 msgid "Choose enclosure folders" msgstr "" #: src/iptux/DialogBase.cpp:593 msgid "Remove Selected" msgstr "" #: src/iptux/DialogBase.cpp:648 msgid "File to send." msgstr "" #: src/iptux/DialogBase.cpp:653 msgid "Sending progress." msgstr "" #: src/iptux/DialogBase.cpp:656 msgid "Dirs" msgstr "" #: src/iptux/DialogBase.cpp:659 #, fuzzy msgid "Files" msgstr "_Fichier" #: src/iptux/DialogBase.cpp:662 src/iptux/DialogPeer.cpp:565 msgid "Detail" msgstr "" #: src/iptux/DialogBase.cpp:712 msgid "PeerName" msgstr "" #: src/iptux/DialogBase.cpp:719 src/iptux/DialogPeer.cpp:716 msgid "Name" msgstr "" #: src/iptux/DialogBase.cpp:725 src/iptux/DialogPeer.cpp:652 #: src/iptux/DialogPeer.cpp:722 src/iptux/ShareFile.cpp:280 #: src/iptux/TransWindow.cpp:271 msgid "Size" msgstr "" #: src/iptux/DialogBase.cpp:731 msgid "Path" msgstr "" #: src/iptux/DialogBase.cpp:792 msgid "Sending Progress." msgstr "" #: src/iptux/DialogBase.cpp:795 #, c-format msgid "%s of %s Sent." msgstr "" #: src/iptux/DialogBase.cpp:802 src/iptux/DialogPeer.cpp:835 msgid "Mission Completed!" msgstr "" #: src/iptux/DialogBase.cpp:845 src/iptux/DialogBase.cpp:917 msgid "Save Image" msgstr "" #: src/iptux/DialogBase.cpp:850 msgid "Copy Image" msgstr "" #: src/iptux/DialogGroup.cpp:285 msgid "Member" msgstr "Member" #: src/iptux/DialogGroup.cpp:382 msgid "Pals" msgstr "" #: src/iptux/DialogGroup.cpp:480 msgid "Select All" msgstr "Alles auswielen" #: src/iptux/DialogGroup.cpp:485 msgid "Reverse Select" msgstr "" #: src/iptux/DialogGroup.cpp:490 msgid "Clear Up" msgstr "" #: src/iptux/DialogGroup.cpp:728 #, c-format msgid "Talk with the group %s" msgstr "" #: src/iptux/DialogPeer.cpp:132 #, c-format msgid "Talk with %s(%s) IP:%s" msgstr "" #: src/iptux/DialogPeer.cpp:305 msgid "Info." msgstr "Info." #: src/iptux/DialogPeer.cpp:337 #, c-format msgid "Version: %s\n" msgstr "Versioun %s\n" #: src/iptux/DialogPeer.cpp:339 #, c-format msgid "Nickname: %s@%s\n" msgstr "" #: src/iptux/DialogPeer.cpp:342 #, c-format msgid "Nickname: %s\n" msgstr "" #: src/iptux/DialogPeer.cpp:344 #, c-format msgid "User: %s\n" msgstr "" #: src/iptux/DialogPeer.cpp:345 #, c-format msgid "Host: %s\n" msgstr "" #: src/iptux/DialogPeer.cpp:348 #, c-format msgid "Address: %s(%s)\n" msgstr "" #: src/iptux/DialogPeer.cpp:350 #, c-format msgid "Address: %s\n" msgstr "" #: src/iptux/DialogPeer.cpp:353 msgid "Compatibility: Microsoft\n" msgstr "" #: src/iptux/DialogPeer.cpp:355 msgid "Compatibility: GNU/Linux\n" msgstr "" #: src/iptux/DialogPeer.cpp:357 #, c-format msgid "System coding: %s\n" msgstr "" #: src/iptux/DialogPeer.cpp:362 msgid "Signature:\n" msgstr "" #: src/iptux/DialogPeer.cpp:369 msgid "" "\n" "Photo:\n" msgstr "" #: src/iptux/DialogPeer.cpp:460 msgid "Please select a picture to insert the buffer" msgstr "" #: src/iptux/DialogPeer.cpp:486 src/iptux/resources/gtk/menus.ui:83 #: src/iptux/resources/gtk/menus.ui:228 #, fuzzy msgid "Insert Image" msgstr "Foto integreieren" #: src/iptux/DialogPeer.cpp:502 msgid "Enclosure." msgstr "" #: src/iptux/DialogPeer.cpp:547 #, fuzzy msgid "Files to be received" msgstr "Noriicht empfaang" #: src/iptux/DialogPeer.cpp:551 msgid "Receiving progress." msgstr "" #: src/iptux/DialogPeer.cpp:554 msgid "Accept" msgstr "" #: src/iptux/DialogPeer.cpp:560 src/iptux/dialog.cpp:63 #: src/iptux/resources/gtk/menus.ui:342 msgid "Refuse" msgstr "Refuseieren" #: src/iptux/DialogPeer.cpp:596 msgid "File received." msgstr "" #: src/iptux/DialogPeer.cpp:639 src/iptux/DialogPeer.cpp:710 msgid "Source" msgstr "" #: src/iptux/DialogPeer.cpp:646 msgid "SaveAs" msgstr "" #: src/iptux/DialogPeer.cpp:818 src/iptux/DialogPeer.cpp:884 msgid "Receiving Progress." msgstr "" #: src/iptux/DialogPeer.cpp:821 src/iptux/DialogPeer.cpp:887 #, c-format msgid "%s to Receive." msgstr "" #: src/iptux/DialogPeer.cpp:825 src/iptux/DialogPeer.cpp:891 #, c-format msgid "%s Of %s Received." msgstr "" #: src/iptux/LogSystem.cpp:71 #, c-format msgid "Recevied-From: Nickname:%s User:%s Host:%s" msgstr "" #: src/iptux/LogSystem.cpp:76 #, c-format msgid "Send-To: Nickname:%s User:%s Host:%s" msgstr "" #: src/iptux/LogSystem.cpp:80 msgid "Send-Broadcast" msgstr "" #: src/iptux/LogSystem.cpp:99 #, c-format msgid "User:%s Host:%s" msgstr "" #: src/iptux/MainWindow.cpp:570 msgid "Pals Online: 0" msgstr "" #: src/iptux/MainWindow.cpp:655 msgid "Search Pals" msgstr "" #: src/iptux/MainWindow.cpp:768 msgid "Nickname" msgstr "" #: src/iptux/MainWindow.cpp:778 msgid "Group" msgstr "" #: src/iptux/MainWindow.cpp:784 src/iptux/TransWindow.cpp:258 msgid "IPv4" msgstr "" #: src/iptux/MainWindow.cpp:790 msgid "User" msgstr "" #: src/iptux/MainWindow.cpp:796 src/iptux/resources/gtk/MainWindow.ui:81 msgid "Host" msgstr "" #: src/iptux/MainWindow.cpp:935 #, c-format msgid "Pals Online: %d" msgstr "" #: src/iptux/RevisePal.cpp:109 msgid "Change Pal's Information" msgstr "" #: src/iptux/RevisePal.cpp:134 msgid "Pal's nickname:" msgstr "" #: src/iptux/RevisePal.cpp:140 msgid "Please input pal's new nickname!" msgstr "" #: src/iptux/RevisePal.cpp:146 msgid "Pal's group name:" msgstr "" #: src/iptux/RevisePal.cpp:152 msgid "Please input pal's new group name!" msgstr "" #: src/iptux/RevisePal.cpp:158 msgid "System coding:" msgstr "" #: src/iptux/RevisePal.cpp:164 msgid "Be SURE to know what you are doing!" msgstr "" #: src/iptux/RevisePal.cpp:170 msgid "Pal's face picture:" msgstr "" #: src/iptux/RevisePal.cpp:184 msgid "Be compatible with iptux's protocol (DANGEROUS)" msgstr "" #: src/iptux/ShareFile.cpp:104 msgid "Shared Files Management" msgstr "" #: src/iptux/ShareFile.cpp:105 msgid "OK" msgstr "" #: src/iptux/ShareFile.cpp:106 msgid "Apply" msgstr "" #: src/iptux/ShareFile.cpp:107 msgid "Cancel" msgstr "Ofbriechen" #: src/iptux/ShareFile.cpp:160 msgid "Add Files" msgstr "" #: src/iptux/ShareFile.cpp:163 msgid "Add Folders" msgstr "" #: src/iptux/ShareFile.cpp:166 msgid "Delete Resources" msgstr "" #: src/iptux/ShareFile.cpp:169 msgid "Clear Password" msgstr "" #: src/iptux/ShareFile.cpp:172 msgid "Set Password" msgstr "" #: src/iptux/ShareFile.cpp:229 src/iptux/ShareFile.cpp:373 msgid "regular" msgstr "" #: src/iptux/ShareFile.cpp:233 src/iptux/ShareFile.cpp:377 msgid "directory" msgstr "" #: src/iptux/ShareFile.cpp:237 src/iptux/ShareFile.cpp:381 msgid "unknown" msgstr "onbekannt" #: src/iptux/ShareFile.cpp:270 msgid "File" msgstr "" #: src/iptux/ShareFile.cpp:286 msgid "Type" msgstr "" #: src/iptux/ShareFile.cpp:411 msgid "Choose the files to share" msgstr "" #: src/iptux/ShareFile.cpp:414 msgid "Choose the folders to share" msgstr "" #: src/iptux/TransWindow.cpp:86 msgid "Files Transmission Management" msgstr "" #: src/iptux/TransWindow.cpp:241 msgid "State" msgstr "" #: src/iptux/TransWindow.cpp:247 msgid "Task" msgstr "" #: src/iptux/TransWindow.cpp:253 msgid "Peer" msgstr "" #: src/iptux/TransWindow.cpp:265 msgid "Filename" msgstr "" #: src/iptux/TransWindow.cpp:277 msgid "Completed" msgstr "" #: src/iptux/TransWindow.cpp:284 msgid "Progress" msgstr "" #: src/iptux/TransWindow.cpp:291 msgid "Cost" msgstr "" #: src/iptux/TransWindow.cpp:297 msgid "Remaining" msgstr "" #: src/iptux/TransWindow.cpp:303 msgid "Rate" msgstr "" #: src/iptux/TransWindow.cpp:331 msgid "The path you want to open not exist!" msgstr "" #: src/iptux/TransWindow.cpp:405 msgid "The file you want to open not exist!" msgstr "" #: src/iptux/TransWindow.cpp:406 msgid "iptux Error" msgstr "" #: src/iptux/UiCoreThread.cpp:254 src/iptux/UiCoreThread.cpp:278 #: src/iptux/UiCoreThread.cpp:377 src/iptux/UiCoreThread.cpp:399 msgid "Others" msgstr "Aner" #: src/iptux/UiCoreThread.cpp:419 msgid "Broadcast" msgstr "Noriichten" #: src/iptux/UiHelper.cpp:28 #, c-format msgid "Can't convert path to uri: %s, reason: %s" msgstr "" #: src/iptux/UiHelper.cpp:39 #, c-format msgid "Can't open path: %s, reason: %s" msgstr "" #: src/iptux/UiHelper.cpp:68 #, c-format msgid "Can't open URL: %s, reason: %s" msgstr "" #: src/iptux/UiHelper.cpp:188 msgid "Information" msgstr "" #: src/iptux/UiHelper.cpp:218 msgid "Warning" msgstr "" #: src/iptux/UiModels.cpp:604 #, fuzzy, c-format msgid "Version: %s" msgstr "Versioun %s\n" #: src/iptux/UiModels.cpp:608 #, c-format msgid "Nickname: %s@%s" msgstr "" #: src/iptux/UiModels.cpp:611 #, fuzzy, c-format msgid "Nickname: %s" msgstr "Aere Spetznum" #: src/iptux/UiModels.cpp:615 #, fuzzy, c-format msgid "User: %s" msgstr "Versioun %s\n" #: src/iptux/UiModels.cpp:618 #, c-format msgid "Host: %s" msgstr "" #: src/iptux/UiModels.cpp:623 #, c-format msgid "Address: %s(%s)" msgstr "" #: src/iptux/UiModels.cpp:625 #, c-format msgid "Address: %s" msgstr "" #: src/iptux/UiModels.cpp:630 msgid "Compatibility: Microsoft" msgstr "" #: src/iptux/UiModels.cpp:632 msgid "Compatibility: GNU/Linux" msgstr "" #: src/iptux/UiModels.cpp:636 #, c-format msgid "System coding: %s" msgstr "" #: src/iptux/UiModels.cpp:641 #, fuzzy msgid "Signature:" msgstr "Ënnerschrëft" #: src/iptux/UiModels.cpp:744 msgid "" msgstr "Fehler" #: src/iptux/UiModels.cpp:799 msgid "[IMG]" msgstr "" #: src/iptux/dialog.cpp:39 msgid "" "File transfer has not been completed.\n" "Are you sure to cancel and quit?" msgstr "" #: src/iptux/dialog.cpp:42 msgid "Confirm Exit" msgstr "" #: src/iptux/dialog.cpp:62 src/iptux/resources/gtk/MainWindow.ui:12 #: src/iptux/resources/gtk/menus.ui:98 src/iptux/resources/gtk/menus.ui:243 msgid "Request Shared Resources" msgstr "" #: src/iptux/dialog.cpp:62 msgid "Agree" msgstr "" #: src/iptux/dialog.cpp:78 #, c-format msgid "" "Your pal (%s)[%s]\n" "is requesting to get your shared resources,\n" "Do you agree?" msgstr "" #: src/iptux/dialog.cpp:106 msgid "Access Password" msgstr "" #: src/iptux/dialog.cpp:113 msgid "Please input the password for the shared files behind" msgstr "" #: src/iptux/dialog.cpp:127 #, c-format msgid "(%s)[%s]Password:" msgstr "" #: src/iptux/dialog.cpp:146 src/iptux/dialog.cpp:207 msgid "" "\n" "Empty Password!" msgstr "" #: src/iptux/dialog.cpp:170 msgid "Enter a New Password" msgstr "Git eent neid Passwuert an" #: src/iptux/dialog.cpp:178 msgid "Password: " msgstr "Passwuert: " #: src/iptux/dialog.cpp:187 msgid "Repeat: " msgstr "nachengkeier " #: src/iptux/dialog.cpp:202 msgid "" "\n" "Password Mismatched!" msgstr "" #: src/iptux/dialog.cpp:229 msgid "Please select a folder to save files." msgstr "" #: src/iptux/resources/gtk/AboutDialog.ui:11 msgid "" "Copyright © 2008–2009, Jally\n" "Copyright © 2013–2015,2017–2021, LI Daobing" msgstr "" #: src/iptux/resources/gtk/AboutDialog.ui:13 msgid "A GTK based LAN messenger." msgstr "" #: src/iptux/resources/gtk/AppIndicator.ui:6 msgid "Open Iptux" msgstr "" #: src/iptux/resources/gtk/AppIndicator.ui:12 #: src/iptux/resources/gtk/menus.ui:6 src/iptux/resources/gtk/menus.ui:306 msgid "_Preferences" msgstr "" #: src/iptux/resources/gtk/AppIndicator.ui:16 #: src/iptux/resources/gtk/menus.ui:10 src/iptux/resources/gtk/menus.ui:310 msgid "_Quit" msgstr "" #: src/iptux/resources/gtk/DetectPal.ui:7 #, fuzzy msgid "Detect pal" msgstr "Alles auswielen" #: src/iptux/resources/gtk/DetectPal.ui:15 msgid "Detect" msgstr "" #: src/iptux/resources/gtk/DetectPal.ui:61 msgid "Please input an IP address (IPv4 only):" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:8 src/iptux/resources/gtk/menus.ui:109 #: src/iptux/resources/gtk/menus.ui:254 msgid "Send Message" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:16 msgid "Change Info" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:20 msgid "Delete Pal" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:26 src/iptux/resources/gtk/menus.ui:31 #: src/iptux/resources/gtk/menus.ui:176 msgid "Sort" msgstr "Sortéieren" #: src/iptux/resources/gtk/MainWindow.ui:29 src/iptux/resources/gtk/menus.ui:34 #: src/iptux/resources/gtk/menus.ui:179 msgid "By Nickname" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:34 src/iptux/resources/gtk/menus.ui:39 #: src/iptux/resources/gtk/menus.ui:184 msgid "By Username" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:39 src/iptux/resources/gtk/menus.ui:44 #: src/iptux/resources/gtk/menus.ui:189 msgid "By IP" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:44 src/iptux/resources/gtk/menus.ui:49 #: src/iptux/resources/gtk/menus.ui:194 msgid "By Host" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:49 src/iptux/resources/gtk/menus.ui:54 #: src/iptux/resources/gtk/menus.ui:199 msgid "By Last Activity" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:56 src/iptux/resources/gtk/menus.ui:61 #: src/iptux/resources/gtk/menus.ui:206 msgid "Ascending" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:61 src/iptux/resources/gtk/menus.ui:66 #: src/iptux/resources/gtk/menus.ui:211 msgid "Descending" msgstr "Ofsteigend" #: src/iptux/resources/gtk/MainWindow.ui:68 msgid "Info Style" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:71 msgid "IP" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:76 msgid "IP:PORT" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:86 msgid "Username" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:91 #, fuzzy msgid "Version" msgstr "Versioun %s\n" #: src/iptux/resources/gtk/MainWindow.ui:96 msgid "Last Activity" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:101 msgid "Last Message" msgstr "" #: src/iptux/resources/gtk/menus.ui:17 src/iptux/resources/gtk/menus.ui:162 msgid "_File" msgstr "_Fichier" #: src/iptux/resources/gtk/menus.ui:19 src/iptux/resources/gtk/menus.ui:164 msgid "_Detect" msgstr "" #: src/iptux/resources/gtk/menus.ui:23 src/iptux/resources/gtk/menus.ui:168 msgid "_Find" msgstr "" #: src/iptux/resources/gtk/menus.ui:28 src/iptux/resources/gtk/menus.ui:173 msgid "_View" msgstr "" #: src/iptux/resources/gtk/menus.ui:73 src/iptux/resources/gtk/menus.ui:218 msgid "_Refresh" msgstr "" #: src/iptux/resources/gtk/menus.ui:80 src/iptux/resources/gtk/menus.ui:225 msgid "_Chat" msgstr "" #: src/iptux/resources/gtk/menus.ui:88 src/iptux/resources/gtk/menus.ui:233 msgid "Attach File" msgstr "Fichier attacheieren" #: src/iptux/resources/gtk/menus.ui:92 src/iptux/resources/gtk/menus.ui:237 msgid "Attach Folder" msgstr "Dossier attacheieren" #: src/iptux/resources/gtk/menus.ui:102 src/iptux/resources/gtk/menus.ui:247 #, fuzzy msgid "Clear Chat History" msgstr "Chat historie speicheren" #: src/iptux/resources/gtk/menus.ui:115 src/iptux/resources/gtk/menus.ui:260 msgid "_Window" msgstr "" #: src/iptux/resources/gtk/menus.ui:118 src/iptux/resources/gtk/menus.ui:263 msgid "_Transmission" msgstr "" #: src/iptux/resources/gtk/menus.ui:122 src/iptux/resources/gtk/menus.ui:267 msgid "_Shared Management" msgstr "" #: src/iptux/resources/gtk/menus.ui:126 src/iptux/resources/gtk/menus.ui:271 msgid "_Chat Log" msgstr "" #: src/iptux/resources/gtk/menus.ui:130 src/iptux/resources/gtk/menus.ui:275 #, fuzzy msgid "_System Log" msgstr "System" #: src/iptux/resources/gtk/menus.ui:136 src/iptux/resources/gtk/menus.ui:281 msgid "Close Window" msgstr "" #: src/iptux/resources/gtk/menus.ui:142 src/iptux/resources/gtk/menus.ui:287 msgid "_Help" msgstr "" #: src/iptux/resources/gtk/menus.ui:145 src/iptux/resources/gtk/menus.ui:290 msgid "_About" msgstr "" #: src/iptux/resources/gtk/menus.ui:149 src/iptux/resources/gtk/menus.ui:294 msgid "Report Bug" msgstr "" #: src/iptux/resources/gtk/menus.ui:153 src/iptux/resources/gtk/menus.ui:298 msgid "What's New" msgstr "" #: src/iptux/resources/gtk/menus.ui:318 msgid "Open This File" msgstr "" #: src/iptux/resources/gtk/menus.ui:322 msgid "Open Containing Folder" msgstr "" #: src/iptux/resources/gtk/menus.ui:326 msgid "Terminate Task" msgstr "" #: src/iptux/resources/gtk/menus.ui:330 msgid "Terminate All" msgstr "" #: src/iptux/resources/gtk/menus.ui:334 msgid "Clear Tasklist" msgstr "" #: src/iptux/resources/gtk/menus.ui:346 #, fuzzy msgid "Refuse All" msgstr "Refuseieren" #: src/main/iptux.cpp:149 msgid "- A software for sharing in LAN" msgstr "" #: src/main/iptux.cpp:152 #, c-format msgid "option parsing failed: %s\n" msgstr "" #, fuzzy #~ msgid "Close Chat" #~ msgstr "Zoumaachen" #~ msgid "Sound" #~ msgstr "Toun" #~ msgid "Activate the sound support" #~ msgstr "Den Toun support activeieren" #~ msgid "Test" #~ msgstr "Test" #~ msgid "Stop" #~ msgstr "Stop" #~ msgid "Transfer finished" #~ msgstr "Den transfer as faerdech" #~ msgid "Play" #~ msgstr "Ofspillen" #~ msgid "Event" #~ msgstr "Evenement" #~ msgid "_Tools" #~ msgstr "_Geschir" #~ msgid "Clear Buffer" #~ msgstr "Buffer eidelmaachen" #~ msgid "The user is not privileged!\n" #~ msgstr "Den User huet d'Rechter net\n" iptux-0.9.4/po/meson.build000066400000000000000000000004351475473122500154710ustar00rootroot00000000000000i18n = import('i18n') i18n.gettext(meson.project_name(), args: [ '--package-version=' + meson.project_version(), '--msgid-bugs-address=https://github.com/iptux-src/iptux/issues/new', '--from-code=utf-8', '--directory=' + meson.source_root() ] ) iptux-0.9.4/po/nb_NO.po000066400000000000000000000773731475473122500147010ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the iptux package. # FIRST AUTHOR , YEAR. # msgid "" msgstr "" "Project-Id-Version: iptux 0.8.0-b2\n" "Report-Msgid-Bugs-To: https://github.com/iptux-src/iptux/issues/new\n" "POT-Creation-Date: 2025-02-17 13:35-0800\n" "PO-Revision-Date: 2021-05-10 08:34+0000\n" "Last-Translator: Allan Nordhøy \n" "Language-Team: Norwegian Bokmål \n" "Language: nb_NO\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" "X-Generator: Weblate 4.7-dev\n" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:6 msgid "iptux" msgstr "iptux" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:7 msgid "LAN communication software" msgstr "Kommunikasjonsprogramvare for lokalnett" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:17 msgid "iptux is an “IP Messenger” client. The features of iptux include:" msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:21 msgid "auto-detect other clients on the intranet." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:22 msgid "send/recv messages to other clients." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:23 msgid "send/recv files to other clients." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:24 msgid "share your files to other cliens (with optional password protection)." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:26 msgid "" "It is (supposedly) compatible with 飞鸽传书 (Feige) and 飞秋 (FeiQ) from " "China, and with the original “IP Messenger” clients from Japan, including " "g2ipmsg and xipmsg in Debian." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:38 msgid "The Iptux main window." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:42 msgid "The Iptux chat window." msgstr "" #: src/iptux-core/CoreThread.cpp:172 #, fuzzy, c-format msgid "" "Fatal Error!! Failed to create new socket!\n" "%s" msgstr "" "Fatal feil! Kunne ikke opprette ny socket.\n" "%s" #: src/iptux-core/CoreThread.cpp:188 #, fuzzy, c-format msgid "" "Fatal Error!! Failed to bind the TCP port(%s:%d)!\n" "%s" msgstr "" "Fatal feil! Klarte ikke å binde TCP-port (%s:%d).\n" "%s" #: src/iptux-core/CoreThread.cpp:201 #, fuzzy, c-format msgid "" "Fatal Error!! Failed to bind the UDP port(%s:%d)!\n" "%s" msgstr "" "Fatal feil! Klarte ikke å binde UDP-port (%s:%d).\n" "%s" #: src/iptux-core/CoreThread.cpp:461 src/iptux-core/CoreThread.cpp:495 #: src/iptux-core/internal/RecvFileData.cpp:142 #: src/iptux-core/internal/RecvFileData.cpp:204 #, fuzzy, c-format msgid "" "Fatal Error!!\n" "Failed to create new socket!\n" "%s" msgstr "" "Fatal feil!\n" "Klarte ikke å opprette ny socket.\n" "%s" #: src/iptux-core/Models.cpp:172 msgid "Empty Message" msgstr "Tom melding" #: src/iptux-core/Models.cpp:250 msgid "Received an image" msgstr "Mottok en melding" #: src/iptux-core/internal/AnalogFS.cpp:93 #: src/iptux-core/internal/AnalogFS.cpp:98 #, fuzzy, c-format msgid "Open() file \"%s\" failed, %s" msgstr "Kunne ikke åpne filen «%s», %s" #: src/iptux-core/internal/AnalogFS.cpp:117 #, fuzzy, c-format msgid "Stat64() file \"%s\" failed, %s" msgstr "Stat64 av filen «%s» mislyktes, %s" #: src/iptux-core/internal/AnalogFS.cpp:138 #, fuzzy, c-format msgid "Mkdir() directory \"%s\" failed, %s" msgstr "Mkdir av mappen «%s» mislyktes, %s" #: src/iptux-core/internal/AnalogFS.cpp:164 #, fuzzy, c-format msgid "Opendir() directory \"%s\" failed, %s" msgstr "Opendir av mappen «%s» mislyktes, %s" #: src/iptux-core/internal/Command.cpp:226 #, fuzzy msgid "Your pal didn't receive the packet. He or she is offline maybe." msgstr "Vennen din mottok ikke pakken. Vedkommende er kanskje frakoblet." #: src/iptux-core/internal/CommandMode.cpp:39 #, c-format msgid "unknown command mode: %d" msgstr "ukjent kommandomodus: %d" #: src/iptux-core/internal/RecvFileData.cpp:117 msgid "receive" msgstr "motta" #: src/iptux-core/internal/RecvFileData.cpp:124 #: src/iptux-core/internal/RecvFileData.cpp:253 #: src/iptux-core/internal/SendFileData.cpp:108 #: src/iptux-core/internal/SendFileData.cpp:193 msgid "Unknown" msgstr "Ukjent" #: src/iptux-core/internal/RecvFileData.cpp:175 #, fuzzy, c-format msgid "" "Failed to receive the file \"%s\" from %s! expect length %jd, received %jd" msgstr "" "Klarte ikke å motta filen «%s» fra %s. Forventet lengde %lld. Mottatt %lld." #: src/iptux-core/internal/RecvFileData.cpp:180 #, fuzzy, c-format msgid "Receive the file \"%s\" from %s successfully!" msgstr "Mottok filen «%s» fra %s." #: src/iptux-core/internal/RecvFileData.cpp:320 #, fuzzy, c-format msgid "Failed to receive the directory \"%s\" from %s!" msgstr "Klarte ikke å motta mappen «%s» fra %s." #: src/iptux-core/internal/RecvFileData.cpp:323 #, fuzzy, c-format msgid "Receive the directory \"%s\" from %s successfully!" msgstr "Mottok mappen «%s» fra %s." #: src/iptux-core/internal/SendFileData.cpp:101 #, fuzzy msgid "send" msgstr "send" #: src/iptux-core/internal/SendFileData.cpp:137 #, fuzzy, c-format msgid "Failed to send the file \"%s\" to %s!" msgstr "Klarte ikke å sende filen «%s» til %s." #: src/iptux-core/internal/SendFileData.cpp:142 #, fuzzy, c-format msgid "Send the file \"%s\" to %s successfully!" msgstr "Sendte filen «%s» til %s." #: src/iptux-core/internal/SendFileData.cpp:265 #, fuzzy, c-format msgid "Failed to send the directory \"%s\" to %s!" msgstr "Klarte ikke å sende mappen «%s» til %s." #: src/iptux-core/internal/SendFileData.cpp:270 #, fuzzy, c-format msgid "Send the directory \"%s\" to %s successfully!" msgstr "Sendte mappen «%s» til %s." #: src/iptux-core/internal/UdpData.cpp:92 #: src/iptux-core/internal/UdpData.cpp:93 #: src/iptux-core/internal/UdpData.cpp:443 #: src/iptux-core/internal/UdpData.cpp:484 msgid "mysterious" msgstr "mystisk" #: src/iptux-utils/utils.cpp:880 #, c-format msgid "stat file \"%s\" failed: %s" msgstr "" #: src/iptux-utils/utils.cpp:888 #, c-format msgid "path %s is not file or directory: st_mode(%x)" msgstr "" #: src/iptux-utils/utils.cpp:895 #, c-format msgid "opendir on \"%s\" failed: %s" msgstr "" #: src/iptux/AboutDialog.cpp:39 msgid "TRANSLATOR NAME" msgstr "Allan Nordhøy " #: src/iptux/AboutDialog.cpp:53 msgid "Thanks to" msgstr "Takk til" #: src/iptux/AppIndicator.cpp:40 src/iptux/MainWindow.cpp:505 #: src/iptux/MainWindow.cpp:507 msgid "Iptux" msgstr "Iptux" #: src/iptux/Application.cpp:54 #, fuzzy msgid "Loading the process successfully!" msgstr "Prosess innlastet." #: src/iptux/Application.cpp:274 #, c-format msgid "New Message from %s" msgstr "Ny melding fra %s" #: src/iptux/Application.cpp:287 #, c-format msgid "New File from %s" msgstr "Ny fil fra %s" #: src/iptux/Application.cpp:296 msgid "Receiving File Finished" msgstr "Fil mottatt" #: src/iptux/Application.cpp:300 #, fuzzy msgid "file info no longer exist" msgstr "filinfo finnes ikke lenger" #: src/iptux/Darwin.cpp:16 #, c-format msgid "Couldn’t load icon: %s" msgstr "Kunne ikke laste inn ikon: %s" #: src/iptux/DataSettings.cpp:46 #, fuzzy msgid "Personal" msgstr "Personlig" #: src/iptux/DataSettings.cpp:48 msgid "System" msgstr "System" #: src/iptux/DataSettings.cpp:50 msgid "Network" msgstr "Nettverk" #: src/iptux/DataSettings.cpp:89 src/iptux/DataSettings.cpp:98 msgid "The program needs to be restarted to take effect!" msgstr "" #: src/iptux/DataSettings.cpp:143 msgid "Preferences" msgstr "Innstillinger" #: src/iptux/DataSettings.cpp:143 src/iptux/RevisePal.cpp:109 #: src/iptux/dialog.cpp:107 src/iptux/dialog.cpp:170 msgid "_OK" msgstr "_OK" #: src/iptux/DataSettings.cpp:144 msgid "_Apply" msgstr "_Bruk" #: src/iptux/DataSettings.cpp:144 src/iptux/DataSettings.cpp:1348 #: src/iptux/DataSettings.cpp:1395 src/iptux/DialogBase.cpp:359 #: src/iptux/DialogBase.cpp:918 src/iptux/RevisePal.cpp:110 #: src/iptux/ShareFile.cpp:419 src/iptux/callback.cpp:87 #: src/iptux/dialog.cpp:171 src/iptux/dialog.cpp:230 msgid "_Cancel" msgstr "_Avbryt" #: src/iptux/DataSettings.cpp:169 #, fuzzy msgid "Your _nickname:" msgstr "Ditt kallenavn:" #: src/iptux/DataSettings.cpp:176 #, fuzzy msgid "Please input your nickname!" msgstr "Skriv inn ditt kallenavn." #: src/iptux/DataSettings.cpp:182 #, fuzzy msgid "Your _group name:" msgstr "Ditt gruppenavn:" #: src/iptux/DataSettings.cpp:189 #, fuzzy msgid "Please input your group name!" msgstr "Skriv inn ditt gruppenavn." #: src/iptux/DataSettings.cpp:195 #, fuzzy msgid "Your _face picture:" msgstr "Vennens forvalgte portrettbilde:" #: src/iptux/DataSettings.cpp:213 #, fuzzy msgid "_Save files to: " msgstr "Lagre filer i: " #: src/iptux/DataSettings.cpp:226 msgid "Photo" msgstr "Bilde" #: src/iptux/DataSettings.cpp:238 msgid "Signature" msgstr "Signatur" #: src/iptux/DataSettings.cpp:271 msgid "Port:" msgstr "" #: src/iptux/DataSettings.cpp:278 msgid "Any port number between 1024 and 65535, default is 2425" msgstr "" #: src/iptux/DataSettings.cpp:287 #, fuzzy msgid "Candidate network encodings:" msgstr "Foretrukket nettverkskoding:" #: src/iptux/DataSettings.cpp:294 msgid "Candidate network encodings, separated by \",\"" msgstr "" #: src/iptux/DataSettings.cpp:301 #, fuzzy msgid "Preferred network encoding:" msgstr "Foretrukket nettverkskoding:" #: src/iptux/DataSettings.cpp:308 msgid "" "Preference network coding (You should be aware of what you are doing if you " "want to modify it.)" msgstr "" #: src/iptux/DataSettings.cpp:316 #, fuzzy msgid "Pal's default face picture:" msgstr "Vennens forvalgte portrettbilde:" #: src/iptux/DataSettings.cpp:334 msgid "Panel font:" msgstr "Panelskrift:" #: src/iptux/DataSettings.cpp:346 #, fuzzy msgid "Automatically open the chat dialog" msgstr "Åpne sludringsdialog automatisk" #: src/iptux/DataSettings.cpp:354 #, fuzzy msgid "Automatically hide the panel after login" msgstr "Skjul panelet etter innlogging" #: src/iptux/DataSettings.cpp:362 #, fuzzy msgid "Automatically open the File Transmission Management" msgstr "Åpne håndtering av filoverføring automatisk" #: src/iptux/DataSettings.cpp:370 #, fuzzy msgid "Use the 'Enter' key to send message" msgstr "Bruk «Enter» til å sende melding" #: src/iptux/DataSettings.cpp:378 #, fuzzy msgid "Automatically clean up the chat history" msgstr "Rensk sludringshistorikken automatisk" #: src/iptux/DataSettings.cpp:385 msgid "Save the chat history" msgstr "Lagre sludringshistorikken" #: src/iptux/DataSettings.cpp:393 #, fuzzy msgid "Use the Blacklist (NOT recommended)" msgstr "Bruk svartelisten (IKKE anbefalt)" #: src/iptux/DataSettings.cpp:401 #, fuzzy msgid "Filter the request of sharing files" msgstr "Filtrer forespørsel over delte filer" #: src/iptux/DataSettings.cpp:408 msgid "Hide the taskbar when the main window is minimized" msgstr "" #: src/iptux/DataSettings.cpp:432 msgid "From:" msgstr "Fra:" #: src/iptux/DataSettings.cpp:438 msgid "Beginning of the IP(v4) section" msgstr "Begynnelsen av IP(v4)-delen" #: src/iptux/DataSettings.cpp:442 msgid "To:" msgstr "Til:" #: src/iptux/DataSettings.cpp:448 msgid "End of the IP(v4) section" msgstr "Slutten av IP(v4)-delen" #: src/iptux/DataSettings.cpp:456 msgid "Add" msgstr "Legg til" #: src/iptux/DataSettings.cpp:461 msgid "Delete" msgstr "Slett" #: src/iptux/DataSettings.cpp:468 #, fuzzy msgid "Added IP(v4) Section:" msgstr "Tillagt IP(v4)-del:" #: src/iptux/DataSettings.cpp:487 msgid "Import" msgstr "Importer" #: src/iptux/DataSettings.cpp:491 msgid "Export" msgstr "Eksporter" #: src/iptux/DataSettings.cpp:495 src/iptux/TransWindow.cpp:171 msgid "Clear" msgstr "Tøm" #: src/iptux/DataSettings.cpp:706 msgid "From" msgstr "Fra" #: src/iptux/DataSettings.cpp:713 msgid "To" msgstr "Til" #: src/iptux/DataSettings.cpp:720 msgid "Description" msgstr "Beskrivelse" #: src/iptux/DataSettings.cpp:736 msgid "Please select download folder" msgstr "Velg nedlastingsmappe" #: src/iptux/DataSettings.cpp:758 msgid "Select Font" msgstr "Velg skrift" #: src/iptux/DataSettings.cpp:872 src/iptux/DataSettings.cpp:874 #: src/iptux/DataSettings.cpp:878 msgid "Port must be a number between 1024 and 65535" msgstr "" #: src/iptux/DataSettings.cpp:1019 src/iptux/DataSettings.cpp:1050 #, fuzzy, c-format msgid "" "Fopen() file \"%s\" failed!\n" "%s" msgstr "" "Fopen av filen «%s» mislyktes.\n" "%s" #: src/iptux/DataSettings.cpp:1150 src/iptux/RevisePal.cpp:419 #, fuzzy msgid "Please select a face picture" msgstr "Velg et portrettbilde" #: src/iptux/DataSettings.cpp:1172 msgid "Please select a personal photo" msgstr "Velg et personlig bilde" #: src/iptux/DataSettings.cpp:1241 src/iptux/DataSettings.cpp:1248 #: src/iptux/DetectPal.cpp:75 #, fuzzy, c-format msgid "" "\n" "Illegal IP(v4) address: %s!" msgstr "" "\n" "Ugyldig IP(v4)-adresse: %s." #: src/iptux/DataSettings.cpp:1346 msgid "Please select a file to import data" msgstr "Velg en fil for å importere data" #: src/iptux/DataSettings.cpp:1347 src/iptux/DialogBase.cpp:358 #: src/iptux/ShareFile.cpp:418 src/iptux/callback.cpp:86 msgid "_Open" msgstr "_Åpne" #: src/iptux/DataSettings.cpp:1394 msgid "Save data to file" msgstr "Lagre data til fil" #: src/iptux/DataSettings.cpp:1395 src/iptux/DialogBase.cpp:919 #: src/iptux/dialog.cpp:231 msgid "_Save" msgstr "_Lagre" #: src/iptux/DetectPal.cpp:70 #, c-format msgid "The notification has been sent to %s." msgstr "Merknaden har blitt sendt til %s." #: src/iptux/DialogBase.cpp:214 #, fuzzy, c-format msgid "%s To Send." msgstr "%s for å sende." #: src/iptux/DialogBase.cpp:272 msgid "Close" msgstr "Lukk" #: src/iptux/DialogBase.cpp:276 src/iptux/DialogGroup.cpp:375 msgid "Send" msgstr "Send" #: src/iptux/DialogBase.cpp:307 msgid "Chat History" msgstr "Sludringshistorikk" #: src/iptux/DialogBase.cpp:350 msgid "Choose enclosure files" msgstr "" #: src/iptux/DialogBase.cpp:353 msgid "Choose enclosure folders" msgstr "" #: src/iptux/DialogBase.cpp:593 msgid "Remove Selected" msgstr "Fjern valgte" #: src/iptux/DialogBase.cpp:648 msgid "File to send." msgstr "Fil å sende." #: src/iptux/DialogBase.cpp:653 msgid "Sending progress." msgstr "Sendingsframdrift." #: src/iptux/DialogBase.cpp:656 msgid "Dirs" msgstr "" #: src/iptux/DialogBase.cpp:659 msgid "Files" msgstr "Filer" #: src/iptux/DialogBase.cpp:662 src/iptux/DialogPeer.cpp:565 msgid "Detail" msgstr "Detalj" #: src/iptux/DialogBase.cpp:712 msgid "PeerName" msgstr "" #: src/iptux/DialogBase.cpp:719 src/iptux/DialogPeer.cpp:716 msgid "Name" msgstr "Navn" #: src/iptux/DialogBase.cpp:725 src/iptux/DialogPeer.cpp:652 #: src/iptux/DialogPeer.cpp:722 src/iptux/ShareFile.cpp:280 #: src/iptux/TransWindow.cpp:271 msgid "Size" msgstr "Størrelse" #: src/iptux/DialogBase.cpp:731 msgid "Path" msgstr "Sti" #: src/iptux/DialogBase.cpp:792 msgid "Sending Progress." msgstr "Sendingsframdrift." #: src/iptux/DialogBase.cpp:795 #, fuzzy, c-format msgid "%s of %s Sent." msgstr "%s av %s sendt." #: src/iptux/DialogBase.cpp:802 src/iptux/DialogPeer.cpp:835 msgid "Mission Completed!" msgstr "" #: src/iptux/DialogBase.cpp:845 src/iptux/DialogBase.cpp:917 msgid "Save Image" msgstr "" #: src/iptux/DialogBase.cpp:850 msgid "Copy Image" msgstr "" #: src/iptux/DialogGroup.cpp:285 msgid "Member" msgstr "Medlem" #: src/iptux/DialogGroup.cpp:382 msgid "Pals" msgstr "Venner" #: src/iptux/DialogGroup.cpp:480 msgid "Select All" msgstr "Velg alle" #: src/iptux/DialogGroup.cpp:485 msgid "Reverse Select" msgstr "" #: src/iptux/DialogGroup.cpp:490 msgid "Clear Up" msgstr "Tøm oppover" #: src/iptux/DialogGroup.cpp:728 #, fuzzy, c-format msgid "Talk with the group %s" msgstr "Snakk med gruppen %s" #: src/iptux/DialogPeer.cpp:132 #, c-format msgid "Talk with %s(%s) IP:%s" msgstr "Snakk med %s(%s) IP:%s" #: src/iptux/DialogPeer.cpp:305 msgid "Info." msgstr "Info." #: src/iptux/DialogPeer.cpp:337 #, c-format msgid "Version: %s\n" msgstr "Versjon: %s\n" #: src/iptux/DialogPeer.cpp:339 #, c-format msgid "Nickname: %s@%s\n" msgstr "Kallenavn: %s@%s\n" #: src/iptux/DialogPeer.cpp:342 #, c-format msgid "Nickname: %s\n" msgstr "Kallenavn: %s\n" #: src/iptux/DialogPeer.cpp:344 #, c-format msgid "User: %s\n" msgstr "Bruker: %s\n" #: src/iptux/DialogPeer.cpp:345 #, c-format msgid "Host: %s\n" msgstr "Vert: %s\n" #: src/iptux/DialogPeer.cpp:348 #, c-format msgid "Address: %s(%s)\n" msgstr "Adresse: %s(%s)\n" #: src/iptux/DialogPeer.cpp:350 #, c-format msgid "Address: %s\n" msgstr "Adresse: %s\n" #: src/iptux/DialogPeer.cpp:353 msgid "Compatibility: Microsoft\n" msgstr "Kompatibilitet: Microsoft\n" #: src/iptux/DialogPeer.cpp:355 msgid "Compatibility: GNU/Linux\n" msgstr "Kompatibilitet: Linux|GNU\n" #: src/iptux/DialogPeer.cpp:357 #, c-format msgid "System coding: %s\n" msgstr "Systemkoding: %s\n" #: src/iptux/DialogPeer.cpp:362 msgid "Signature:\n" msgstr "Signatur:\n" #: src/iptux/DialogPeer.cpp:369 msgid "" "\n" "Photo:\n" msgstr "" "\n" "Bilde:\n" #: src/iptux/DialogPeer.cpp:460 msgid "Please select a picture to insert the buffer" msgstr "" #: src/iptux/DialogPeer.cpp:486 src/iptux/resources/gtk/menus.ui:83 #: src/iptux/resources/gtk/menus.ui:228 #, fuzzy msgid "Insert Image" msgstr "Sett inn bilde" #: src/iptux/DialogPeer.cpp:502 msgid "Enclosure." msgstr "" #: src/iptux/DialogPeer.cpp:547 msgid "Files to be received" msgstr "Filer å motta" #: src/iptux/DialogPeer.cpp:551 msgid "Receiving progress." msgstr "Mottaksframdrift." #: src/iptux/DialogPeer.cpp:554 msgid "Accept" msgstr "Godta" #: src/iptux/DialogPeer.cpp:560 src/iptux/dialog.cpp:63 #: src/iptux/resources/gtk/menus.ui:342 msgid "Refuse" msgstr "Avslå" #: src/iptux/DialogPeer.cpp:596 msgid "File received." msgstr "Fil mottatt." #: src/iptux/DialogPeer.cpp:639 src/iptux/DialogPeer.cpp:710 msgid "Source" msgstr "Kilde" #: src/iptux/DialogPeer.cpp:646 #, fuzzy msgid "SaveAs" msgstr "Lagre som" #: src/iptux/DialogPeer.cpp:818 src/iptux/DialogPeer.cpp:884 msgid "Receiving Progress." msgstr "Mottaksframdrift." #: src/iptux/DialogPeer.cpp:821 src/iptux/DialogPeer.cpp:887 #, fuzzy, c-format msgid "%s to Receive." msgstr "%s å motta." #: src/iptux/DialogPeer.cpp:825 src/iptux/DialogPeer.cpp:891 #, fuzzy, c-format msgid "%s Of %s Received." msgstr "%s av %s mottatt." #: src/iptux/LogSystem.cpp:71 #, fuzzy, c-format msgid "Recevied-From: Nickname:%s User:%s Host:%s" msgstr "Mottatt fra: Kallenavn: %s Bruker: %s Vert: %s" #: src/iptux/LogSystem.cpp:76 #, fuzzy, c-format msgid "Send-To: Nickname:%s User:%s Host:%s" msgstr "Send til: Kallenavn: %s: Bruker: %s: Vert: %s" #: src/iptux/LogSystem.cpp:80 msgid "Send-Broadcast" msgstr "" #: src/iptux/LogSystem.cpp:99 #, fuzzy, c-format msgid "User:%s Host:%s" msgstr "Bruker: %s Vert: %s" #: src/iptux/MainWindow.cpp:570 msgid "Pals Online: 0" msgstr "Venner pålogget: 0" #: src/iptux/MainWindow.cpp:655 msgid "Search Pals" msgstr "Søk etter venner" #: src/iptux/MainWindow.cpp:768 msgid "Nickname" msgstr "Kallenavn" #: src/iptux/MainWindow.cpp:778 msgid "Group" msgstr "Gruppe" #: src/iptux/MainWindow.cpp:784 src/iptux/TransWindow.cpp:258 msgid "IPv4" msgstr "IPv4" #: src/iptux/MainWindow.cpp:790 msgid "User" msgstr "Bruker" #: src/iptux/MainWindow.cpp:796 src/iptux/resources/gtk/MainWindow.ui:81 msgid "Host" msgstr "Vert" #: src/iptux/MainWindow.cpp:935 #, fuzzy, c-format msgid "Pals Online: %d" msgstr "Venner pålogget: %d" #: src/iptux/RevisePal.cpp:109 #, fuzzy msgid "Change Pal's Information" msgstr "Endre vennens info" #: src/iptux/RevisePal.cpp:134 msgid "Pal's nickname:" msgstr "Vennens kallenavn" #: src/iptux/RevisePal.cpp:140 #, fuzzy msgid "Please input pal's new nickname!" msgstr "Skriv inn vennens nye kallenavn." #: src/iptux/RevisePal.cpp:146 #, fuzzy msgid "Pal's group name:" msgstr "Vennens gruppenavn:" #: src/iptux/RevisePal.cpp:152 #, fuzzy msgid "Please input pal's new group name!" msgstr "Skriv inn vennens nye gruppenavn." #: src/iptux/RevisePal.cpp:158 msgid "System coding:" msgstr "Systemkoding:" #: src/iptux/RevisePal.cpp:164 msgid "Be SURE to know what you are doing!" msgstr "" #: src/iptux/RevisePal.cpp:170 msgid "Pal's face picture:" msgstr "" #: src/iptux/RevisePal.cpp:184 msgid "Be compatible with iptux's protocol (DANGEROUS)" msgstr "" #: src/iptux/ShareFile.cpp:104 msgid "Shared Files Management" msgstr "" #: src/iptux/ShareFile.cpp:105 msgid "OK" msgstr "OK" #: src/iptux/ShareFile.cpp:106 msgid "Apply" msgstr "Bruk" #: src/iptux/ShareFile.cpp:107 msgid "Cancel" msgstr "Avbryt" #: src/iptux/ShareFile.cpp:160 msgid "Add Files" msgstr "Legg til filer" #: src/iptux/ShareFile.cpp:163 msgid "Add Folders" msgstr "Legg til mapper" #: src/iptux/ShareFile.cpp:166 msgid "Delete Resources" msgstr "Slett ressurser" #: src/iptux/ShareFile.cpp:169 msgid "Clear Password" msgstr "Tøm passord" #: src/iptux/ShareFile.cpp:172 msgid "Set Password" msgstr "Sett passord" #: src/iptux/ShareFile.cpp:229 src/iptux/ShareFile.cpp:373 msgid "regular" msgstr "" #: src/iptux/ShareFile.cpp:233 src/iptux/ShareFile.cpp:377 msgid "directory" msgstr "" #: src/iptux/ShareFile.cpp:237 src/iptux/ShareFile.cpp:381 msgid "unknown" msgstr "ukjent" #: src/iptux/ShareFile.cpp:270 msgid "File" msgstr "Fil" #: src/iptux/ShareFile.cpp:286 msgid "Type" msgstr "Type" #: src/iptux/ShareFile.cpp:411 #, fuzzy msgid "Choose the files to share" msgstr "Velg filer å dele" #: src/iptux/ShareFile.cpp:414 #, fuzzy msgid "Choose the folders to share" msgstr "Velg mapper å dele" #: src/iptux/TransWindow.cpp:86 msgid "Files Transmission Management" msgstr "" #: src/iptux/TransWindow.cpp:241 msgid "State" msgstr "" #: src/iptux/TransWindow.cpp:247 msgid "Task" msgstr "Oppgave" #: src/iptux/TransWindow.cpp:253 msgid "Peer" msgstr "Likemann" #: src/iptux/TransWindow.cpp:265 msgid "Filename" msgstr "Filnavn" #: src/iptux/TransWindow.cpp:277 msgid "Completed" msgstr "Fullført" #: src/iptux/TransWindow.cpp:284 msgid "Progress" msgstr "Framdrift" #: src/iptux/TransWindow.cpp:291 msgid "Cost" msgstr "Kostnad" #: src/iptux/TransWindow.cpp:297 msgid "Remaining" msgstr "Gjenstår" #: src/iptux/TransWindow.cpp:303 msgid "Rate" msgstr "" #: src/iptux/TransWindow.cpp:331 msgid "The path you want to open not exist!" msgstr "" #: src/iptux/TransWindow.cpp:405 msgid "The file you want to open not exist!" msgstr "Filen du ønsker å åpne finnes ikke." #: src/iptux/TransWindow.cpp:406 #, fuzzy msgid "iptux Error" msgstr "Iptux-feil" #: src/iptux/UiCoreThread.cpp:254 src/iptux/UiCoreThread.cpp:278 #: src/iptux/UiCoreThread.cpp:377 src/iptux/UiCoreThread.cpp:399 msgid "Others" msgstr "Andre" #: src/iptux/UiCoreThread.cpp:419 #, fuzzy msgid "Broadcast" msgstr "Kringkast" #: src/iptux/UiHelper.cpp:28 #, c-format msgid "Can't convert path to uri: %s, reason: %s" msgstr "" #: src/iptux/UiHelper.cpp:39 #, c-format msgid "Can't open path: %s, reason: %s" msgstr "" #: src/iptux/UiHelper.cpp:68 #, c-format msgid "Can't open URL: %s, reason: %s" msgstr "" #: src/iptux/UiHelper.cpp:188 #, fuzzy msgid "Information" msgstr "Info" #: src/iptux/UiHelper.cpp:218 msgid "Warning" msgstr "Advarsel" #: src/iptux/UiModels.cpp:604 #, c-format msgid "Version: %s" msgstr "Versjon: %s" #: src/iptux/UiModels.cpp:608 #, c-format msgid "Nickname: %s@%s" msgstr "Kallenavn: %s@%s" #: src/iptux/UiModels.cpp:611 #, c-format msgid "Nickname: %s" msgstr "Kallenavn: %s" #: src/iptux/UiModels.cpp:615 #, c-format msgid "User: %s" msgstr "Bruker: %s" #: src/iptux/UiModels.cpp:618 #, c-format msgid "Host: %s" msgstr "Vert: %s" #: src/iptux/UiModels.cpp:623 #, c-format msgid "Address: %s(%s)" msgstr "Adresse: %s(%s)" #: src/iptux/UiModels.cpp:625 #, c-format msgid "Address: %s" msgstr "Adresse: %s" #: src/iptux/UiModels.cpp:630 msgid "Compatibility: Microsoft" msgstr "Kompatibilitet: Microsoft" #: src/iptux/UiModels.cpp:632 msgid "Compatibility: GNU/Linux" msgstr "Kompatibilitet: Linux|GNU" #: src/iptux/UiModels.cpp:636 #, c-format msgid "System coding: %s" msgstr "Systemkoding: %s" #: src/iptux/UiModels.cpp:641 msgid "Signature:" msgstr "Signatur:" #: src/iptux/UiModels.cpp:744 msgid "" msgstr "" #: src/iptux/UiModels.cpp:799 msgid "[IMG]" msgstr "" #: src/iptux/dialog.cpp:39 #, fuzzy msgid "" "File transfer has not been completed.\n" "Are you sure to cancel and quit?" msgstr "" "Filoverføringen er ikke ferdig.\n" "Ønsker du å avbryte og avslutte?" #: src/iptux/dialog.cpp:42 msgid "Confirm Exit" msgstr "Bekreft avslutning" #: src/iptux/dialog.cpp:62 src/iptux/resources/gtk/MainWindow.ui:12 #: src/iptux/resources/gtk/menus.ui:98 src/iptux/resources/gtk/menus.ui:243 msgid "Request Shared Resources" msgstr "Forespør delte ressurser" #: src/iptux/dialog.cpp:62 msgid "Agree" msgstr "Godta" #: src/iptux/dialog.cpp:78 #, c-format msgid "" "Your pal (%s)[%s]\n" "is requesting to get your shared resources,\n" "Do you agree?" msgstr "" #: src/iptux/dialog.cpp:106 msgid "Access Password" msgstr "" #: src/iptux/dialog.cpp:113 msgid "Please input the password for the shared files behind" msgstr "" #: src/iptux/dialog.cpp:127 #, fuzzy, c-format msgid "(%s)[%s]Password:" msgstr "(%s)[%s] passord:" #: src/iptux/dialog.cpp:146 src/iptux/dialog.cpp:207 msgid "" "\n" "Empty Password!" msgstr "" "\n" "Tomt passord." #: src/iptux/dialog.cpp:170 msgid "Enter a New Password" msgstr "Skriv inn et nytt passord" #: src/iptux/dialog.cpp:178 msgid "Password: " msgstr "Passord: " #: src/iptux/dialog.cpp:187 msgid "Repeat: " msgstr "Gjenta: " #: src/iptux/dialog.cpp:202 #, fuzzy msgid "" "\n" "Password Mismatched!" msgstr "" "\n" "Passordet samsvarer ikke." #: src/iptux/dialog.cpp:229 msgid "Please select a folder to save files." msgstr "Velg en mappe å lagre filer." #: src/iptux/resources/gtk/AboutDialog.ui:11 #, fuzzy msgid "" "Copyright © 2008–2009, Jally\n" "Copyright © 2013–2015,2017–2021, LI Daobing" msgstr "" "Copyright © 2008–2009, Jally\n" "Copyright © 2013–2015,2017-2019, Li Daobing" #: src/iptux/resources/gtk/AboutDialog.ui:13 #, fuzzy msgid "A GTK based LAN messenger." msgstr "En GTK-basert lokalnettmeldingstjeneste." #: src/iptux/resources/gtk/AppIndicator.ui:6 #, fuzzy msgid "Open Iptux" msgstr "Iptux" #: src/iptux/resources/gtk/AppIndicator.ui:12 #: src/iptux/resources/gtk/menus.ui:6 src/iptux/resources/gtk/menus.ui:306 msgid "_Preferences" msgstr "_Innstillinger" #: src/iptux/resources/gtk/AppIndicator.ui:16 #: src/iptux/resources/gtk/menus.ui:10 src/iptux/resources/gtk/menus.ui:310 msgid "_Quit" msgstr "_Avslutt" #: src/iptux/resources/gtk/DetectPal.ui:7 msgid "Detect pal" msgstr "Oppdag venn" #: src/iptux/resources/gtk/DetectPal.ui:15 msgid "Detect" msgstr "Oppdag" #: src/iptux/resources/gtk/DetectPal.ui:61 #, fuzzy msgid "Please input an IP address (IPv4 only):" msgstr "Skriv inn en IP(v4)-adresse:" #: src/iptux/resources/gtk/MainWindow.ui:8 src/iptux/resources/gtk/menus.ui:109 #: src/iptux/resources/gtk/menus.ui:254 msgid "Send Message" msgstr "Send melding" #: src/iptux/resources/gtk/MainWindow.ui:16 msgid "Change Info" msgstr "Endre info" #: src/iptux/resources/gtk/MainWindow.ui:20 msgid "Delete Pal" msgstr "Slett venn" #: src/iptux/resources/gtk/MainWindow.ui:26 src/iptux/resources/gtk/menus.ui:31 #: src/iptux/resources/gtk/menus.ui:176 msgid "Sort" msgstr "Sorter" #: src/iptux/resources/gtk/MainWindow.ui:29 src/iptux/resources/gtk/menus.ui:34 #: src/iptux/resources/gtk/menus.ui:179 msgid "By Nickname" msgstr "Etter kallenavn" #: src/iptux/resources/gtk/MainWindow.ui:34 src/iptux/resources/gtk/menus.ui:39 #: src/iptux/resources/gtk/menus.ui:184 #, fuzzy msgid "By Username" msgstr "Etter kallenavn" #: src/iptux/resources/gtk/MainWindow.ui:39 src/iptux/resources/gtk/menus.ui:44 #: src/iptux/resources/gtk/menus.ui:189 msgid "By IP" msgstr "Etter IP" #: src/iptux/resources/gtk/MainWindow.ui:44 src/iptux/resources/gtk/menus.ui:49 #: src/iptux/resources/gtk/menus.ui:194 #, fuzzy msgid "By Host" msgstr "Vert" #: src/iptux/resources/gtk/MainWindow.ui:49 src/iptux/resources/gtk/menus.ui:54 #: src/iptux/resources/gtk/menus.ui:199 msgid "By Last Activity" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:56 src/iptux/resources/gtk/menus.ui:61 #: src/iptux/resources/gtk/menus.ui:206 msgid "Ascending" msgstr "Stigende" #: src/iptux/resources/gtk/MainWindow.ui:61 src/iptux/resources/gtk/menus.ui:66 #: src/iptux/resources/gtk/menus.ui:211 msgid "Descending" msgstr "Synkende" #: src/iptux/resources/gtk/MainWindow.ui:68 msgid "Info Style" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:71 #, fuzzy msgid "IP" msgstr "IPv4" #: src/iptux/resources/gtk/MainWindow.ui:76 msgid "IP:PORT" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:86 #, fuzzy msgid "Username" msgstr "Bruker" #: src/iptux/resources/gtk/MainWindow.ui:91 #, fuzzy msgid "Version" msgstr "Versjon: %s" #: src/iptux/resources/gtk/MainWindow.ui:96 msgid "Last Activity" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:101 #, fuzzy msgid "Last Message" msgstr "Tom melding" #: src/iptux/resources/gtk/menus.ui:17 src/iptux/resources/gtk/menus.ui:162 msgid "_File" msgstr "_Fil" #: src/iptux/resources/gtk/menus.ui:19 src/iptux/resources/gtk/menus.ui:164 msgid "_Detect" msgstr "_Oppdag" #: src/iptux/resources/gtk/menus.ui:23 src/iptux/resources/gtk/menus.ui:168 msgid "_Find" msgstr "_Finn" #: src/iptux/resources/gtk/menus.ui:28 src/iptux/resources/gtk/menus.ui:173 msgid "_View" msgstr "_Vis" #: src/iptux/resources/gtk/menus.ui:73 src/iptux/resources/gtk/menus.ui:218 msgid "_Refresh" msgstr "_Gjenoppfrisk" #: src/iptux/resources/gtk/menus.ui:80 src/iptux/resources/gtk/menus.ui:225 #, fuzzy msgid "_Chat" msgstr "_Sludre" #: src/iptux/resources/gtk/menus.ui:88 src/iptux/resources/gtk/menus.ui:233 msgid "Attach File" msgstr "Legg ved fil" #: src/iptux/resources/gtk/menus.ui:92 src/iptux/resources/gtk/menus.ui:237 msgid "Attach Folder" msgstr "Legg ved mappe" #: src/iptux/resources/gtk/menus.ui:102 src/iptux/resources/gtk/menus.ui:247 msgid "Clear Chat History" msgstr "Tøm sludringshistorikk" #: src/iptux/resources/gtk/menus.ui:115 src/iptux/resources/gtk/menus.ui:260 msgid "_Window" msgstr "_Vindu" #: src/iptux/resources/gtk/menus.ui:118 src/iptux/resources/gtk/menus.ui:263 msgid "_Transmission" msgstr "_Overføring" #: src/iptux/resources/gtk/menus.ui:122 src/iptux/resources/gtk/menus.ui:267 msgid "_Shared Management" msgstr "" #: src/iptux/resources/gtk/menus.ui:126 src/iptux/resources/gtk/menus.ui:271 msgid "_Chat Log" msgstr "_Sludringslogg" #: src/iptux/resources/gtk/menus.ui:130 src/iptux/resources/gtk/menus.ui:275 msgid "_System Log" msgstr "_Systemlogg" #: src/iptux/resources/gtk/menus.ui:136 src/iptux/resources/gtk/menus.ui:281 #, fuzzy msgid "Close Window" msgstr "_Vindu" #: src/iptux/resources/gtk/menus.ui:142 src/iptux/resources/gtk/menus.ui:287 msgid "_Help" msgstr "_Hjelp" #: src/iptux/resources/gtk/menus.ui:145 src/iptux/resources/gtk/menus.ui:290 msgid "_About" msgstr "_Om" #: src/iptux/resources/gtk/menus.ui:149 src/iptux/resources/gtk/menus.ui:294 msgid "Report Bug" msgstr "Innrapporter feil" #: src/iptux/resources/gtk/menus.ui:153 src/iptux/resources/gtk/menus.ui:298 msgid "What's New" msgstr "" #: src/iptux/resources/gtk/menus.ui:318 msgid "Open This File" msgstr "Åpne denne filen" #: src/iptux/resources/gtk/menus.ui:322 msgid "Open Containing Folder" msgstr "Åpne inneholdende mappe" #: src/iptux/resources/gtk/menus.ui:326 #, fuzzy msgid "Terminate Task" msgstr "Terminer oppgave" #: src/iptux/resources/gtk/menus.ui:330 #, fuzzy msgid "Terminate All" msgstr "Terminer alle" #: src/iptux/resources/gtk/menus.ui:334 msgid "Clear Tasklist" msgstr "Tøm oppgaveliste" #: src/iptux/resources/gtk/menus.ui:346 #, fuzzy msgid "Refuse All" msgstr "Avslå" #: src/main/iptux.cpp:149 #, fuzzy msgid "- A software for sharing in LAN" msgstr "- Programvare for deling i lokalnett" #: src/main/iptux.cpp:152 #, c-format msgid "option parsing failed: %s\n" msgstr "" #, fuzzy #~ msgid "Can't find any available web browser!\n" #~ msgstr "Finger ingen nettlesere.\n" #, fuzzy #~ msgid "chat;talk;im;message;ipmsg;feige;" #~ msgstr "sludring;snakking;IM,melding;ipmsg;feige;" #~ msgid "Close Chat" #~ msgstr "Lukk sludring" iptux-0.9.4/po/pl.po000066400000000000000000001130011475473122500142740ustar00rootroot00000000000000# Polish translation for iptux # Copyright (c) 2010 Rosetta Contributors and Canonical Ltd 2010 # This file is distributed under the same license as the iptux package. # FIRST AUTHOR , 2010. # msgid "" msgstr "" "Project-Id-Version: iptux\n" "Report-Msgid-Bugs-To: https://github.com/iptux-src/iptux/issues/new\n" "POT-Creation-Date: 2025-02-17 13:35-0800\n" "PO-Revision-Date: 2024-03-18 15:02+0000\n" "Last-Translator: Eryk Michalak \n" "Language-Team: Polish \n" "Language: pl\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " "|| n%100>=20) ? 1 : 2;\n" "X-Generator: Weblate 5.5-dev\n" "X-Launchpad-Export-Date: 2010-07-29 14:36+0000\n" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:6 msgid "iptux" msgstr "iptux" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:7 msgid "LAN communication software" msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:17 msgid "iptux is an “IP Messenger” client. The features of iptux include:" msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:21 msgid "auto-detect other clients on the intranet." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:22 msgid "send/recv messages to other clients." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:23 msgid "send/recv files to other clients." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:24 msgid "share your files to other cliens (with optional password protection)." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:26 msgid "" "It is (supposedly) compatible with 飞鸽传书 (Feige) and 飞秋 (FeiQ) from " "China, and with the original “IP Messenger” clients from Japan, including " "g2ipmsg and xipmsg in Debian." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:38 msgid "The Iptux main window." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:42 msgid "The Iptux chat window." msgstr "" #: src/iptux-core/CoreThread.cpp:172 #, fuzzy, c-format msgid "" "Fatal Error!! Failed to create new socket!\n" "%s" msgstr "" "Błąd Krytyczny!!\n" "Nie można utworzyć nowego gniazda sieciowego!\n" "%s" #: src/iptux-core/CoreThread.cpp:188 #, fuzzy, c-format msgid "" "Fatal Error!! Failed to bind the TCP port(%s:%d)!\n" "%s" msgstr "" "Błąd krytyczny!\n" "Nie można połączyć się z portem TCP/UDP (2425)!\n" "%s" #: src/iptux-core/CoreThread.cpp:201 #, fuzzy, c-format msgid "" "Fatal Error!! Failed to bind the UDP port(%s:%d)!\n" "%s" msgstr "" "Błąd krytyczny!\n" "Nie można połączyć się z portem TCP/UDP (2425)!\n" "%s" #: src/iptux-core/CoreThread.cpp:461 src/iptux-core/CoreThread.cpp:495 #: src/iptux-core/internal/RecvFileData.cpp:142 #: src/iptux-core/internal/RecvFileData.cpp:204 #, c-format msgid "" "Fatal Error!!\n" "Failed to create new socket!\n" "%s" msgstr "" "Błąd Krytyczny!!\n" "Nie można utworzyć nowego gniazda sieciowego!\n" "%s" #: src/iptux-core/Models.cpp:172 #, fuzzy msgid "Empty Message" msgstr "Wyślij wiadomość" #: src/iptux-core/Models.cpp:250 #, fuzzy msgid "Received an image" msgstr "Zarządzanie Odbiorem Plików" #: src/iptux-core/internal/AnalogFS.cpp:93 #: src/iptux-core/internal/AnalogFS.cpp:98 #, c-format msgid "Open() file \"%s\" failed, %s" msgstr "Open() plik \"%s\" błąd, %s" #: src/iptux-core/internal/AnalogFS.cpp:117 #, c-format msgid "Stat64() file \"%s\" failed, %s" msgstr "Stat64() plik \"%s\" błąd, %s" #: src/iptux-core/internal/AnalogFS.cpp:138 #, c-format msgid "Mkdir() directory \"%s\" failed, %s" msgstr "Mkdir() katalog \"%s\" błąd, %s" #: src/iptux-core/internal/AnalogFS.cpp:164 #, c-format msgid "Opendir() directory \"%s\" failed, %s" msgstr "Opendir() katalog \"%s\" błąd, %s" #: src/iptux-core/internal/Command.cpp:226 msgid "Your pal didn't receive the packet. He or she is offline maybe." msgstr "Twój znajomy nie otrzymał pakietu. Być może jest niedostępny." #: src/iptux-core/internal/CommandMode.cpp:39 #, c-format msgid "unknown command mode: %d" msgstr "" #: src/iptux-core/internal/RecvFileData.cpp:117 msgid "receive" msgstr "odbiór" #: src/iptux-core/internal/RecvFileData.cpp:124 #: src/iptux-core/internal/RecvFileData.cpp:253 #: src/iptux-core/internal/SendFileData.cpp:108 #: src/iptux-core/internal/SendFileData.cpp:193 #, fuzzy msgid "Unknown" msgstr "nieznany" #: src/iptux-core/internal/RecvFileData.cpp:175 #, fuzzy, c-format msgid "" "Failed to receive the file \"%s\" from %s! expect length %jd, received %jd" msgstr "Błąd odbioru pliku \"%s\" od %s!" #: src/iptux-core/internal/RecvFileData.cpp:180 #, c-format msgid "Receive the file \"%s\" from %s successfully!" msgstr "Odbiór pliku \"%s\" od %s zakończony powodzeniem!" #: src/iptux-core/internal/RecvFileData.cpp:320 #, c-format msgid "Failed to receive the directory \"%s\" from %s!" msgstr "Błąd odbioru katalogu \"%s\" od %s!" #: src/iptux-core/internal/RecvFileData.cpp:323 #, c-format msgid "Receive the directory \"%s\" from %s successfully!" msgstr "Odbiór katalogu \"%s\" od %s zakończony powodzeniem!" #: src/iptux-core/internal/SendFileData.cpp:101 msgid "send" msgstr "Wyślij" #: src/iptux-core/internal/SendFileData.cpp:137 #, c-format msgid "Failed to send the file \"%s\" to %s!" msgstr "Błąd wysyłania pliku \"%s\" do %s!" #: src/iptux-core/internal/SendFileData.cpp:142 #, c-format msgid "Send the file \"%s\" to %s successfully!" msgstr "Wysyłanie pliku \"%s\" do %s zakończone powodzeniem!" #: src/iptux-core/internal/SendFileData.cpp:265 #, c-format msgid "Failed to send the directory \"%s\" to %s!" msgstr "Błąd wysyłania katalogu \"%s\" do %s!" #: src/iptux-core/internal/SendFileData.cpp:270 #, c-format msgid "Send the directory \"%s\" to %s successfully!" msgstr "Wysyłanie katalogu \"%s\" do %s zakończone powodzeniem!" #: src/iptux-core/internal/UdpData.cpp:92 #: src/iptux-core/internal/UdpData.cpp:93 #: src/iptux-core/internal/UdpData.cpp:443 #: src/iptux-core/internal/UdpData.cpp:484 msgid "mysterious" msgstr "tajemniczy" #: src/iptux-utils/utils.cpp:880 #, fuzzy, c-format msgid "stat file \"%s\" failed: %s" msgstr "Stat() plik \"%s\" błąd, %s\n" #: src/iptux-utils/utils.cpp:888 #, c-format msgid "path %s is not file or directory: st_mode(%x)" msgstr "" #: src/iptux-utils/utils.cpp:895 #, fuzzy, c-format msgid "opendir on \"%s\" failed: %s" msgstr "Opendir() katalog \"%s\" błąd, %s" #: src/iptux/AboutDialog.cpp:39 msgid "TRANSLATOR NAME" msgstr "Eryk Michalak" #: src/iptux/AboutDialog.cpp:53 msgid "Thanks to" msgstr "Podziękowania dla" #: src/iptux/AppIndicator.cpp:40 src/iptux/MainWindow.cpp:505 #: src/iptux/MainWindow.cpp:507 #, fuzzy msgid "Iptux" msgstr "iptux" #: src/iptux/Application.cpp:54 msgid "Loading the process successfully!" msgstr "Proces załadowany pomyślnie" #: src/iptux/Application.cpp:274 #, c-format msgid "New Message from %s" msgstr "" #: src/iptux/Application.cpp:287 #, c-format msgid "New File from %s" msgstr "" #: src/iptux/Application.cpp:296 msgid "Receiving File Finished" msgstr "Zakończono otrzymywanie pliku" #: src/iptux/Application.cpp:300 msgid "file info no longer exist" msgstr "" #: src/iptux/Darwin.cpp:16 #, c-format msgid "Couldn’t load icon: %s" msgstr "" #: src/iptux/DataSettings.cpp:46 msgid "Personal" msgstr "Osobiste" #: src/iptux/DataSettings.cpp:48 msgid "System" msgstr "System" #: src/iptux/DataSettings.cpp:50 msgid "Network" msgstr "Sieć" #: src/iptux/DataSettings.cpp:89 src/iptux/DataSettings.cpp:98 msgid "The program needs to be restarted to take effect!" msgstr "" #: src/iptux/DataSettings.cpp:143 msgid "Preferences" msgstr "Preferencje" #: src/iptux/DataSettings.cpp:143 src/iptux/RevisePal.cpp:109 #: src/iptux/dialog.cpp:107 src/iptux/dialog.cpp:170 #, fuzzy msgid "_OK" msgstr "OK" #: src/iptux/DataSettings.cpp:144 #, fuzzy msgid "_Apply" msgstr "Zastosuj" #: src/iptux/DataSettings.cpp:144 src/iptux/DataSettings.cpp:1348 #: src/iptux/DataSettings.cpp:1395 src/iptux/DialogBase.cpp:359 #: src/iptux/DialogBase.cpp:918 src/iptux/RevisePal.cpp:110 #: src/iptux/ShareFile.cpp:419 src/iptux/callback.cpp:87 #: src/iptux/dialog.cpp:171 src/iptux/dialog.cpp:230 #, fuzzy msgid "_Cancel" msgstr "Anuluj" #: src/iptux/DataSettings.cpp:169 #, fuzzy msgid "Your _nickname:" msgstr "Twój nick:" #: src/iptux/DataSettings.cpp:176 msgid "Please input your nickname!" msgstr "Proszę wpisać swój nick" #: src/iptux/DataSettings.cpp:182 #, fuzzy msgid "Your _group name:" msgstr "Twoja nazwa grupy" #: src/iptux/DataSettings.cpp:189 msgid "Please input your group name!" msgstr "Proszę wpisać swoją nazwę grupy!" #: src/iptux/DataSettings.cpp:195 #, fuzzy msgid "Your _face picture:" msgstr "Twój avatar:" #: src/iptux/DataSettings.cpp:213 #, fuzzy msgid "_Save files to: " msgstr "Zapisz pliki do: " #: src/iptux/DataSettings.cpp:226 msgid "Photo" msgstr "Zdjęcie" #: src/iptux/DataSettings.cpp:238 msgid "Signature" msgstr "Sygnatura" #: src/iptux/DataSettings.cpp:271 msgid "Port:" msgstr "" #: src/iptux/DataSettings.cpp:278 msgid "Any port number between 1024 and 65535, default is 2425" msgstr "" #: src/iptux/DataSettings.cpp:287 #, fuzzy msgid "Candidate network encodings:" msgstr "Kandydat kodowania sieci:" #: src/iptux/DataSettings.cpp:294 #, fuzzy msgid "Candidate network encodings, separated by \",\"" msgstr "Kandydat kodowania sieci" #: src/iptux/DataSettings.cpp:301 #, fuzzy msgid "Preferred network encoding:" msgstr "Ustawienia kodowania sieci:" #: src/iptux/DataSettings.cpp:308 msgid "" "Preference network coding (You should be aware of what you are doing if you " "want to modify it.)" msgstr "" "Kandydat kodowania sieci (Zmień tylko gdy jesteś świadomy tego co robisz.)" #: src/iptux/DataSettings.cpp:316 msgid "Pal's default face picture:" msgstr "Domyślny avatar kontaktów:" #: src/iptux/DataSettings.cpp:334 msgid "Panel font:" msgstr "Czcionka panelu:" #: src/iptux/DataSettings.cpp:346 msgid "Automatically open the chat dialog" msgstr "Automatyczne otwieranie okna rozmowy" #: src/iptux/DataSettings.cpp:354 msgid "Automatically hide the panel after login" msgstr "Automatycznie ukryj panel po zalogowaniu" #: src/iptux/DataSettings.cpp:362 msgid "Automatically open the File Transmission Management" msgstr "Automatycznie otwórz Narzędzie Transmisji Plików" #: src/iptux/DataSettings.cpp:370 msgid "Use the 'Enter' key to send message" msgstr "Używaj 'Enter' by wysłać wiadomość" #: src/iptux/DataSettings.cpp:378 msgid "Automatically clean up the chat history" msgstr "Automatycznie czyść historię rozmowy" #: src/iptux/DataSettings.cpp:385 msgid "Save the chat history" msgstr "Zapisz historię rozmowy" #: src/iptux/DataSettings.cpp:393 msgid "Use the Blacklist (NOT recommended)" msgstr "Używaj Blacklisty ( NIE zalecane)" #: src/iptux/DataSettings.cpp:401 msgid "Filter the request of sharing files" msgstr "Filtruj żądanie współdzielenia plików" #: src/iptux/DataSettings.cpp:408 msgid "Hide the taskbar when the main window is minimized" msgstr "" #: src/iptux/DataSettings.cpp:432 msgid "From:" msgstr "Od:" #: src/iptux/DataSettings.cpp:438 msgid "Beginning of the IP(v4) section" msgstr "Początek sekcji IP(v4)" #: src/iptux/DataSettings.cpp:442 msgid "To:" msgstr "Do:" #: src/iptux/DataSettings.cpp:448 msgid "End of the IP(v4) section" msgstr "Koniec sekcji IP(v4)" #: src/iptux/DataSettings.cpp:456 msgid "Add" msgstr "Dodaj" #: src/iptux/DataSettings.cpp:461 msgid "Delete" msgstr "Usuń" #: src/iptux/DataSettings.cpp:468 msgid "Added IP(v4) Section:" msgstr "Dodaj sekcję IP(v4)" #: src/iptux/DataSettings.cpp:487 msgid "Import" msgstr "Import" #: src/iptux/DataSettings.cpp:491 msgid "Export" msgstr "Eksport" #: src/iptux/DataSettings.cpp:495 src/iptux/TransWindow.cpp:171 msgid "Clear" msgstr "Wyczyść" #: src/iptux/DataSettings.cpp:706 msgid "From" msgstr "Od" #: src/iptux/DataSettings.cpp:713 msgid "To" msgstr "Do" #: src/iptux/DataSettings.cpp:720 msgid "Description" msgstr "Opis" #: src/iptux/DataSettings.cpp:736 msgid "Please select download folder" msgstr "Wybierz folder pobierania" #: src/iptux/DataSettings.cpp:758 msgid "Select Font" msgstr "Wybierz czcionkę" #: src/iptux/DataSettings.cpp:872 src/iptux/DataSettings.cpp:874 #: src/iptux/DataSettings.cpp:878 msgid "Port must be a number between 1024 and 65535" msgstr "" #: src/iptux/DataSettings.cpp:1019 src/iptux/DataSettings.cpp:1050 #, c-format msgid "" "Fopen() file \"%s\" failed!\n" "%s" msgstr "" "Fopen() plik \"%s\" błąd!\n" "%s" #: src/iptux/DataSettings.cpp:1150 src/iptux/RevisePal.cpp:419 msgid "Please select a face picture" msgstr "Wybierz avatar" #: src/iptux/DataSettings.cpp:1172 msgid "Please select a personal photo" msgstr "Wybierz osobiste zdjęcie" #: src/iptux/DataSettings.cpp:1241 src/iptux/DataSettings.cpp:1248 #: src/iptux/DetectPal.cpp:75 #, c-format msgid "" "\n" "Illegal IP(v4) address: %s!" msgstr "" "\n" "Nieprawidłowy adres IP(v4): %s!" #: src/iptux/DataSettings.cpp:1346 msgid "Please select a file to import data" msgstr "Wybierz plik do zaimportowania danych" #: src/iptux/DataSettings.cpp:1347 src/iptux/DialogBase.cpp:358 #: src/iptux/ShareFile.cpp:418 src/iptux/callback.cpp:86 msgid "_Open" msgstr "_Otwórz" #: src/iptux/DataSettings.cpp:1394 msgid "Save data to file" msgstr "Zapisz dane do pliku" #: src/iptux/DataSettings.cpp:1395 src/iptux/DialogBase.cpp:919 #: src/iptux/dialog.cpp:231 msgid "_Save" msgstr "_Zapisz" #: src/iptux/DetectPal.cpp:70 #, c-format msgid "The notification has been sent to %s." msgstr "Zgłoszenie zostało wysłane do %s." #: src/iptux/DialogBase.cpp:214 #, c-format msgid "%s To Send." msgstr "%s do wysłania." #: src/iptux/DialogBase.cpp:272 msgid "Close" msgstr "Zamknij" #: src/iptux/DialogBase.cpp:276 src/iptux/DialogGroup.cpp:375 msgid "Send" msgstr "Wyślij" #: src/iptux/DialogBase.cpp:307 #, fuzzy msgid "Chat History" msgstr "Zapisz historię rozmowy" #: src/iptux/DialogBase.cpp:350 msgid "Choose enclosure files" msgstr "" #: src/iptux/DialogBase.cpp:353 #, fuzzy msgid "Choose enclosure folders" msgstr "Wybierz katalogi do współdzielenia" #: src/iptux/DialogBase.cpp:593 #, fuzzy msgid "Remove Selected" msgstr "Wybór zwrotu" #: src/iptux/DialogBase.cpp:648 msgid "File to send." msgstr "Plik do wysłania." #: src/iptux/DialogBase.cpp:653 msgid "Sending progress." msgstr "Postęp wysyłania." #: src/iptux/DialogBase.cpp:656 msgid "Dirs" msgstr "Katalogi" #: src/iptux/DialogBase.cpp:659 #, fuzzy msgid "Files" msgstr "Plik" #: src/iptux/DialogBase.cpp:662 src/iptux/DialogPeer.cpp:565 msgid "Detail" msgstr "Szczegół" #: src/iptux/DialogBase.cpp:712 #, fuzzy msgid "PeerName" msgstr "Partner" #: src/iptux/DialogBase.cpp:719 src/iptux/DialogPeer.cpp:716 msgid "Name" msgstr "Nazwa" #: src/iptux/DialogBase.cpp:725 src/iptux/DialogPeer.cpp:652 #: src/iptux/DialogPeer.cpp:722 src/iptux/ShareFile.cpp:280 #: src/iptux/TransWindow.cpp:271 msgid "Size" msgstr "Rozmiar" #: src/iptux/DialogBase.cpp:731 msgid "Path" msgstr "Ścieżka" #: src/iptux/DialogBase.cpp:792 #, fuzzy msgid "Sending Progress." msgstr "Postęp" #: src/iptux/DialogBase.cpp:795 #, c-format msgid "%s of %s Sent." msgstr "" #: src/iptux/DialogBase.cpp:802 src/iptux/DialogPeer.cpp:835 #, fuzzy msgid "Mission Completed!" msgstr "Zakończone" #: src/iptux/DialogBase.cpp:845 src/iptux/DialogBase.cpp:917 msgid "Save Image" msgstr "" #: src/iptux/DialogBase.cpp:850 msgid "Copy Image" msgstr "" #: src/iptux/DialogGroup.cpp:285 msgid "Member" msgstr "Członek" #: src/iptux/DialogGroup.cpp:382 msgid "Pals" msgstr "Znajomi" #: src/iptux/DialogGroup.cpp:480 msgid "Select All" msgstr "Zaznacz wszystko" #: src/iptux/DialogGroup.cpp:485 msgid "Reverse Select" msgstr "Wybór zwrotu" #: src/iptux/DialogGroup.cpp:490 msgid "Clear Up" msgstr "Wyczyść" #: src/iptux/DialogGroup.cpp:728 #, c-format msgid "Talk with the group %s" msgstr "Rozmawiaj z grupą %s" #: src/iptux/DialogPeer.cpp:132 #, fuzzy, c-format msgid "Talk with %s(%s) IP:%s" msgstr "Rozmawiaj z %s" #: src/iptux/DialogPeer.cpp:305 msgid "Info." msgstr "Info." #: src/iptux/DialogPeer.cpp:337 #, c-format msgid "Version: %s\n" msgstr "Wersja: %s\n" #: src/iptux/DialogPeer.cpp:339 #, c-format msgid "Nickname: %s@%s\n" msgstr "Nick: %s@%s\n" #: src/iptux/DialogPeer.cpp:342 #, c-format msgid "Nickname: %s\n" msgstr "Nick: %s\n" #: src/iptux/DialogPeer.cpp:344 #, c-format msgid "User: %s\n" msgstr "Użytkownik: %s\n" #: src/iptux/DialogPeer.cpp:345 #, c-format msgid "Host: %s\n" msgstr "Host: %s\n" #: src/iptux/DialogPeer.cpp:348 #, c-format msgid "Address: %s(%s)\n" msgstr "Addres: %s(%s)\n" #: src/iptux/DialogPeer.cpp:350 #, c-format msgid "Address: %s\n" msgstr "Addres: %s\n" #: src/iptux/DialogPeer.cpp:353 msgid "Compatibility: Microsoft\n" msgstr "Kompatybilność: Microsoft\n" #: src/iptux/DialogPeer.cpp:355 msgid "Compatibility: GNU/Linux\n" msgstr "Kompatybilność: GNU/Linux\n" #: src/iptux/DialogPeer.cpp:357 #, c-format msgid "System coding: %s\n" msgstr "Kodowanie Systemu: %s\n" #: src/iptux/DialogPeer.cpp:362 msgid "Signature:\n" msgstr "Sygnatura:\n" #: src/iptux/DialogPeer.cpp:369 msgid "" "\n" "Photo:\n" msgstr "" "\n" "Zdjęcie:\n" #: src/iptux/DialogPeer.cpp:460 msgid "Please select a picture to insert the buffer" msgstr "Wybierz zdjęcie, aby wstawić do bufora" #: src/iptux/DialogPeer.cpp:486 src/iptux/resources/gtk/menus.ui:83 #: src/iptux/resources/gtk/menus.ui:228 #, fuzzy msgid "Insert Image" msgstr "Wstaw obrazek" #: src/iptux/DialogPeer.cpp:502 msgid "Enclosure." msgstr "" #: src/iptux/DialogPeer.cpp:547 #, fuzzy msgid "Files to be received" msgstr "Odebrano wiadomość" #: src/iptux/DialogPeer.cpp:551 msgid "Receiving progress." msgstr "Postęp otrzymywania." #: src/iptux/DialogPeer.cpp:554 msgid "Accept" msgstr "Akceptuj" #: src/iptux/DialogPeer.cpp:560 src/iptux/dialog.cpp:63 #: src/iptux/resources/gtk/menus.ui:342 msgid "Refuse" msgstr "Odrzuć" #: src/iptux/DialogPeer.cpp:596 #, fuzzy msgid "File received." msgstr "Odebrano wiadomość" #: src/iptux/DialogPeer.cpp:639 src/iptux/DialogPeer.cpp:710 msgid "Source" msgstr "Źródło" #: src/iptux/DialogPeer.cpp:646 msgid "SaveAs" msgstr "Zapisz jako" #: src/iptux/DialogPeer.cpp:818 src/iptux/DialogPeer.cpp:884 msgid "Receiving Progress." msgstr "" #: src/iptux/DialogPeer.cpp:821 src/iptux/DialogPeer.cpp:887 #, c-format msgid "%s to Receive." msgstr "%s do otrzymania." #: src/iptux/DialogPeer.cpp:825 src/iptux/DialogPeer.cpp:891 #, c-format msgid "%s Of %s Received." msgstr "" #: src/iptux/LogSystem.cpp:71 #, c-format msgid "Recevied-From: Nickname:%s User:%s Host:%s" msgstr "Otrzymane od: Nick:%s Użytkownik:%s Host:%s" #: src/iptux/LogSystem.cpp:76 #, c-format msgid "Send-To: Nickname:%s User:%s Host:%s" msgstr "Wysłane do: Nick:%s Użytkownik:%s Host:%s" #: src/iptux/LogSystem.cpp:80 msgid "Send-Broadcast" msgstr "Wysłane-Rozgłoszenie" #: src/iptux/LogSystem.cpp:99 #, c-format msgid "User:%s Host:%s" msgstr "Użytkownik:%s Host:%s" #: src/iptux/MainWindow.cpp:570 msgid "Pals Online: 0" msgstr "Znajomych Online: 0" #: src/iptux/MainWindow.cpp:655 msgid "Search Pals" msgstr "Szukaj Znajomych" #: src/iptux/MainWindow.cpp:768 msgid "Nickname" msgstr "Nick" #: src/iptux/MainWindow.cpp:778 msgid "Group" msgstr "Grupa" #: src/iptux/MainWindow.cpp:784 src/iptux/TransWindow.cpp:258 msgid "IPv4" msgstr "IPv4" #: src/iptux/MainWindow.cpp:790 msgid "User" msgstr "Użytkownik" #: src/iptux/MainWindow.cpp:796 src/iptux/resources/gtk/MainWindow.ui:81 msgid "Host" msgstr "Host" #: src/iptux/MainWindow.cpp:935 #, fuzzy, c-format msgid "Pals Online: %d" msgstr "Znajomych Online: 0" #: src/iptux/RevisePal.cpp:109 msgid "Change Pal's Information" msgstr "Zmień Informacje o znajomym" #: src/iptux/RevisePal.cpp:134 msgid "Pal's nickname:" msgstr "Nick Znajomego:" #: src/iptux/RevisePal.cpp:140 msgid "Please input pal's new nickname!" msgstr "Wpisz nowy nick znajomego!" #: src/iptux/RevisePal.cpp:146 msgid "Pal's group name:" msgstr "Nazwa grupy Znajomego" #: src/iptux/RevisePal.cpp:152 msgid "Please input pal's new group name!" msgstr "Wpisz nową nazwę grupy znajomego!" #: src/iptux/RevisePal.cpp:158 msgid "System coding:" msgstr "Kodowanie Systemu:" #: src/iptux/RevisePal.cpp:164 msgid "Be SURE to know what you are doing!" msgstr "Upewnij się, że WIESZ CO ROBISZ!" #: src/iptux/RevisePal.cpp:170 msgid "Pal's face picture:" msgstr "Avatar Znajomego:" #: src/iptux/RevisePal.cpp:184 msgid "Be compatible with iptux's protocol (DANGEROUS)" msgstr "Zgodność z protokołem iptux (niebezpieczne)" #: src/iptux/ShareFile.cpp:104 msgid "Shared Files Management" msgstr "Zarządzanie Współdzieleniem Plików" #: src/iptux/ShareFile.cpp:105 msgid "OK" msgstr "OK" #: src/iptux/ShareFile.cpp:106 msgid "Apply" msgstr "Zastosuj" #: src/iptux/ShareFile.cpp:107 msgid "Cancel" msgstr "Anuluj" #: src/iptux/ShareFile.cpp:160 msgid "Add Files" msgstr "Dodaj Pliki" #: src/iptux/ShareFile.cpp:163 msgid "Add Folders" msgstr "Dodaj Katalogi" #: src/iptux/ShareFile.cpp:166 msgid "Delete Resources" msgstr "Usuń Zasoby" #: src/iptux/ShareFile.cpp:169 msgid "Clear Password" msgstr "Wyczyśc Hasło" #: src/iptux/ShareFile.cpp:172 msgid "Set Password" msgstr "Ustaw hasło" #: src/iptux/ShareFile.cpp:229 src/iptux/ShareFile.cpp:373 msgid "regular" msgstr "regularny" #: src/iptux/ShareFile.cpp:233 src/iptux/ShareFile.cpp:377 msgid "directory" msgstr "katalog" #: src/iptux/ShareFile.cpp:237 src/iptux/ShareFile.cpp:381 msgid "unknown" msgstr "nieznany" #: src/iptux/ShareFile.cpp:270 msgid "File" msgstr "Plik" #: src/iptux/ShareFile.cpp:286 msgid "Type" msgstr "Typ" #: src/iptux/ShareFile.cpp:411 msgid "Choose the files to share" msgstr "Wybierz pliki do współdzielenia" #: src/iptux/ShareFile.cpp:414 msgid "Choose the folders to share" msgstr "Wybierz katalogi do współdzielenia" #: src/iptux/TransWindow.cpp:86 msgid "Files Transmission Management" msgstr "Narzędzie Transmisji Plików" #: src/iptux/TransWindow.cpp:241 msgid "State" msgstr "Stan" #: src/iptux/TransWindow.cpp:247 msgid "Task" msgstr "Zadanie" #: src/iptux/TransWindow.cpp:253 msgid "Peer" msgstr "Partner" #: src/iptux/TransWindow.cpp:265 msgid "Filename" msgstr "Nazwa pliku" #: src/iptux/TransWindow.cpp:277 msgid "Completed" msgstr "Zakończone" #: src/iptux/TransWindow.cpp:284 msgid "Progress" msgstr "Postęp" #: src/iptux/TransWindow.cpp:291 msgid "Cost" msgstr "Koszt" #: src/iptux/TransWindow.cpp:297 msgid "Remaining" msgstr "Pozostało" #: src/iptux/TransWindow.cpp:303 msgid "Rate" msgstr "Szybkość" #: src/iptux/TransWindow.cpp:331 msgid "The path you want to open not exist!" msgstr "" #: src/iptux/TransWindow.cpp:405 msgid "The file you want to open not exist!" msgstr "" #: src/iptux/TransWindow.cpp:406 #, fuzzy msgid "iptux Error" msgstr "Błąd" #: src/iptux/UiCoreThread.cpp:254 src/iptux/UiCoreThread.cpp:278 #: src/iptux/UiCoreThread.cpp:377 src/iptux/UiCoreThread.cpp:399 msgid "Others" msgstr "Inne" #: src/iptux/UiCoreThread.cpp:419 msgid "Broadcast" msgstr "Adres rozgłoszeniowy" #: src/iptux/UiHelper.cpp:28 #, c-format msgid "Can't convert path to uri: %s, reason: %s" msgstr "" #: src/iptux/UiHelper.cpp:39 #, c-format msgid "Can't open path: %s, reason: %s" msgstr "" #: src/iptux/UiHelper.cpp:68 #, c-format msgid "Can't open URL: %s, reason: %s" msgstr "" #: src/iptux/UiHelper.cpp:188 #, fuzzy msgid "Information" msgstr "Infomacje" #: src/iptux/UiHelper.cpp:218 msgid "Warning" msgstr "Ostrzeżenie" #: src/iptux/UiModels.cpp:604 #, fuzzy, c-format msgid "Version: %s" msgstr "Wersja: %s\n" #: src/iptux/UiModels.cpp:608 #, fuzzy, c-format msgid "Nickname: %s@%s" msgstr "Nick: %s@%s\n" #: src/iptux/UiModels.cpp:611 #, fuzzy, c-format msgid "Nickname: %s" msgstr "Nick: %s\n" #: src/iptux/UiModels.cpp:615 #, fuzzy, c-format msgid "User: %s" msgstr "Użytkownik: %s\n" #: src/iptux/UiModels.cpp:618 #, fuzzy, c-format msgid "Host: %s" msgstr "Host: %s\n" #: src/iptux/UiModels.cpp:623 #, fuzzy, c-format msgid "Address: %s(%s)" msgstr "Addres: %s(%s)\n" #: src/iptux/UiModels.cpp:625 #, fuzzy, c-format msgid "Address: %s" msgstr "Addres: %s\n" #: src/iptux/UiModels.cpp:630 #, fuzzy msgid "Compatibility: Microsoft" msgstr "Kompatybilność: Microsoft\n" #: src/iptux/UiModels.cpp:632 #, fuzzy msgid "Compatibility: GNU/Linux" msgstr "Kompatybilność: GNU/Linux\n" #: src/iptux/UiModels.cpp:636 #, fuzzy, c-format msgid "System coding: %s" msgstr "Kodowanie Systemu: %s\n" #: src/iptux/UiModels.cpp:641 #, fuzzy msgid "Signature:" msgstr "Sygnatura:\n" #: src/iptux/UiModels.cpp:744 msgid "" msgstr "" #: src/iptux/UiModels.cpp:799 msgid "[IMG]" msgstr "" #: src/iptux/dialog.cpp:39 msgid "" "File transfer has not been completed.\n" "Are you sure to cancel and quit?" msgstr "" "Przesyłanie plików nie zostało zakończone.\n" "Czy na pewno anulować, i wyjść?" #: src/iptux/dialog.cpp:42 msgid "Confirm Exit" msgstr "Potwierdz zamknięcie" #: src/iptux/dialog.cpp:62 src/iptux/resources/gtk/MainWindow.ui:12 #: src/iptux/resources/gtk/menus.ui:98 src/iptux/resources/gtk/menus.ui:243 msgid "Request Shared Resources" msgstr "Zapytanie o Udostępnione Zasoby" #: src/iptux/dialog.cpp:62 msgid "Agree" msgstr "Akceptuj" #: src/iptux/dialog.cpp:78 #, c-format msgid "" "Your pal (%s)[%s]\n" "is requesting to get your shared resources,\n" "Do you agree?" msgstr "" "Twój znajomy (%s)[%s]\n" ",pyta o Twoje Udostępnione Zasoby\n" "Zgadzasz się?" #: src/iptux/dialog.cpp:106 msgid "Access Password" msgstr "Hasło dostępu" #: src/iptux/dialog.cpp:113 msgid "Please input the password for the shared files behind" msgstr "Proszę wpisać hasło dla udostępnionych plików" #: src/iptux/dialog.cpp:127 #, c-format msgid "(%s)[%s]Password:" msgstr "(%s)[%s]Hasło:" #: src/iptux/dialog.cpp:146 src/iptux/dialog.cpp:207 msgid "" "\n" "Empty Password!" msgstr "" "\n" "Puste Hasło!" #: src/iptux/dialog.cpp:170 msgid "Enter a New Password" msgstr "Wpisz Nowe Hasło" #: src/iptux/dialog.cpp:178 msgid "Password: " msgstr "Hasło: " #: src/iptux/dialog.cpp:187 msgid "Repeat: " msgstr "Powtórz: " #: src/iptux/dialog.cpp:202 msgid "" "\n" "Password Mismatched!" msgstr "" "\n" "Niezgodne Hasło!" #: src/iptux/dialog.cpp:229 #, fuzzy msgid "Please select a folder to save files." msgstr "Wybierz plik dźwiękowy" #: src/iptux/resources/gtk/AboutDialog.ui:11 msgid "" "Copyright © 2008–2009, Jally\n" "Copyright © 2013–2015,2017–2021, LI Daobing" msgstr "" #: src/iptux/resources/gtk/AboutDialog.ui:13 #, fuzzy msgid "A GTK based LAN messenger." msgstr "Komunikator LAN oparty na bibliotece GTK+" #: src/iptux/resources/gtk/AppIndicator.ui:6 #, fuzzy msgid "Open Iptux" msgstr "iptux" #: src/iptux/resources/gtk/AppIndicator.ui:12 #: src/iptux/resources/gtk/menus.ui:6 src/iptux/resources/gtk/menus.ui:306 msgid "_Preferences" msgstr "_Preferencje" #: src/iptux/resources/gtk/AppIndicator.ui:16 #: src/iptux/resources/gtk/menus.ui:10 src/iptux/resources/gtk/menus.ui:310 msgid "_Quit" msgstr "_Zakończ" #: src/iptux/resources/gtk/DetectPal.ui:7 #, fuzzy msgid "Detect pal" msgstr "Szukaj znajomych" #: src/iptux/resources/gtk/DetectPal.ui:15 msgid "Detect" msgstr "Wykrywanie" #: src/iptux/resources/gtk/DetectPal.ui:61 msgid "Please input an IP address (IPv4 only):" msgstr "Wpisz adres IP (Tylko IPv4):" #: src/iptux/resources/gtk/MainWindow.ui:8 src/iptux/resources/gtk/menus.ui:109 #: src/iptux/resources/gtk/menus.ui:254 msgid "Send Message" msgstr "Wyślij wiadomość" #: src/iptux/resources/gtk/MainWindow.ui:16 #, fuzzy msgid "Change Info" msgstr "Zmień Info." #: src/iptux/resources/gtk/MainWindow.ui:20 msgid "Delete Pal" msgstr "Usuń Kontakt" #: src/iptux/resources/gtk/MainWindow.ui:26 src/iptux/resources/gtk/menus.ui:31 #: src/iptux/resources/gtk/menus.ui:176 msgid "Sort" msgstr "Sortuj" #: src/iptux/resources/gtk/MainWindow.ui:29 src/iptux/resources/gtk/menus.ui:34 #: src/iptux/resources/gtk/menus.ui:179 msgid "By Nickname" msgstr "Wg Nazwy" #: src/iptux/resources/gtk/MainWindow.ui:34 src/iptux/resources/gtk/menus.ui:39 #: src/iptux/resources/gtk/menus.ui:184 #, fuzzy msgid "By Username" msgstr "Wg Nazwy" #: src/iptux/resources/gtk/MainWindow.ui:39 src/iptux/resources/gtk/menus.ui:44 #: src/iptux/resources/gtk/menus.ui:189 msgid "By IP" msgstr "Wg IP" #: src/iptux/resources/gtk/MainWindow.ui:44 src/iptux/resources/gtk/menus.ui:49 #: src/iptux/resources/gtk/menus.ui:194 #, fuzzy msgid "By Host" msgstr "Host" #: src/iptux/resources/gtk/MainWindow.ui:49 src/iptux/resources/gtk/menus.ui:54 #: src/iptux/resources/gtk/menus.ui:199 msgid "By Last Activity" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:56 src/iptux/resources/gtk/menus.ui:61 #: src/iptux/resources/gtk/menus.ui:206 msgid "Ascending" msgstr "Rosnąco" #: src/iptux/resources/gtk/MainWindow.ui:61 src/iptux/resources/gtk/menus.ui:66 #: src/iptux/resources/gtk/menus.ui:211 msgid "Descending" msgstr "Malejąco" #: src/iptux/resources/gtk/MainWindow.ui:68 msgid "Info Style" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:71 #, fuzzy msgid "IP" msgstr "IPv4" #: src/iptux/resources/gtk/MainWindow.ui:76 msgid "IP:PORT" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:86 #, fuzzy msgid "Username" msgstr "Użytkownik" #: src/iptux/resources/gtk/MainWindow.ui:91 #, fuzzy msgid "Version" msgstr "Wersja: %s\n" #: src/iptux/resources/gtk/MainWindow.ui:96 msgid "Last Activity" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:101 #, fuzzy msgid "Last Message" msgstr "Wyślij wiadomość" #: src/iptux/resources/gtk/menus.ui:17 src/iptux/resources/gtk/menus.ui:162 msgid "_File" msgstr "_Plik" #: src/iptux/resources/gtk/menus.ui:19 src/iptux/resources/gtk/menus.ui:164 msgid "_Detect" msgstr "_Wykryj" #: src/iptux/resources/gtk/menus.ui:23 src/iptux/resources/gtk/menus.ui:168 msgid "_Find" msgstr "_Znajdź" #: src/iptux/resources/gtk/menus.ui:28 src/iptux/resources/gtk/menus.ui:173 msgid "_View" msgstr "_Widok" #: src/iptux/resources/gtk/menus.ui:73 src/iptux/resources/gtk/menus.ui:218 msgid "_Refresh" msgstr "_Odśwież" #: src/iptux/resources/gtk/menus.ui:80 src/iptux/resources/gtk/menus.ui:225 msgid "_Chat" msgstr "_Czat" #: src/iptux/resources/gtk/menus.ui:88 src/iptux/resources/gtk/menus.ui:233 msgid "Attach File" msgstr "Dołącz Plik" #: src/iptux/resources/gtk/menus.ui:92 src/iptux/resources/gtk/menus.ui:237 msgid "Attach Folder" msgstr "Dołącz Folder" #: src/iptux/resources/gtk/menus.ui:102 src/iptux/resources/gtk/menus.ui:247 #, fuzzy msgid "Clear Chat History" msgstr "Zapisz historię rozmowy" #: src/iptux/resources/gtk/menus.ui:115 src/iptux/resources/gtk/menus.ui:260 msgid "_Window" msgstr "_Okno" #: src/iptux/resources/gtk/menus.ui:118 src/iptux/resources/gtk/menus.ui:263 msgid "_Transmission" msgstr "_Transmisja" #: src/iptux/resources/gtk/menus.ui:122 src/iptux/resources/gtk/menus.ui:267 msgid "_Shared Management" msgstr "_Zarządzanie Współdzieleniem Plików i Folderów" #: src/iptux/resources/gtk/menus.ui:126 src/iptux/resources/gtk/menus.ui:271 msgid "_Chat Log" msgstr "_Logi czatu" #: src/iptux/resources/gtk/menus.ui:130 src/iptux/resources/gtk/menus.ui:275 #, fuzzy msgid "_System Log" msgstr "Kodowanie Systemu:" #: src/iptux/resources/gtk/menus.ui:136 src/iptux/resources/gtk/menus.ui:281 msgid "Close Window" msgstr "Zamknij okno" #: src/iptux/resources/gtk/menus.ui:142 src/iptux/resources/gtk/menus.ui:287 msgid "_Help" msgstr "_Pomoc" #: src/iptux/resources/gtk/menus.ui:145 src/iptux/resources/gtk/menus.ui:290 msgid "_About" msgstr "_O programie" #: src/iptux/resources/gtk/menus.ui:149 src/iptux/resources/gtk/menus.ui:294 msgid "Report Bug" msgstr "Zgłoś błąd" #: src/iptux/resources/gtk/menus.ui:153 src/iptux/resources/gtk/menus.ui:298 msgid "What's New" msgstr "Co nowego" #: src/iptux/resources/gtk/menus.ui:318 msgid "Open This File" msgstr "Otwórz ten plik" #: src/iptux/resources/gtk/menus.ui:322 msgid "Open Containing Folder" msgstr "Otwórz katalog zawierający" #: src/iptux/resources/gtk/menus.ui:326 msgid "Terminate Task" msgstr "Zakończ Zadanie" #: src/iptux/resources/gtk/menus.ui:330 msgid "Terminate All" msgstr "Zakończ Wszystkie" #: src/iptux/resources/gtk/menus.ui:334 msgid "Clear Tasklist" msgstr "Wyczyśc Listę Zadań" #: src/iptux/resources/gtk/menus.ui:346 #, fuzzy msgid "Refuse All" msgstr "Odrzuć" #: src/main/iptux.cpp:149 #, fuzzy msgid "- A software for sharing in LAN" msgstr "iptux: Program do komunikacji w sieciach LAN\n" #: src/main/iptux.cpp:152 #, fuzzy, c-format msgid "option parsing failed: %s\n" msgstr "Opendir() katalog \"%s\" błąd, %s" #~ msgid "Can't find any available web browser!\n" #~ msgstr "Nie można znaleźć żadnej dostępnej przeglądarki internetowej!\n" #~ msgid "It can:" #~ msgstr "Umożliwia:" #, fuzzy #~ msgid "Close Chat" #~ msgstr "Zamknij" #~ msgid "Pals Online: %" #~ msgstr "Znajomi Online: %" #~ msgid "Sound" #~ msgstr "Dźwięk" #~ msgid "Activate the sound support" #~ msgstr "Aktywuj dźwięk" #~ msgid "Volume Control: " #~ msgstr "Poziom głośności: " #~ msgid "Sound Event" #~ msgstr "Zdarzenia dźwiękowe" #~ msgid "Test" #~ msgstr "Test" #~ msgid "Stop" #~ msgstr "Stop" #~ msgid "Transfer finished" #~ msgstr "Transfer zakończony" #~ msgid "Message received" #~ msgstr "Odebrano wiadomość" #~ msgid "Play" #~ msgstr "Odtwórz" #~ msgid "Event" #~ msgstr "Zdarzenie" #~ msgid "Please select a sound file" #~ msgstr "Wybierz plik dźwiękowy" #, fuzzy #~ msgid "Failed to play the prompt tone, [%s] %s, %s" #~ msgstr "Nie udało się odtworzyć dźwięku polecenia,% s\n" #~ msgid "_Hide" #~ msgstr "_Ukryj" #~ msgid "_Show" #~ msgstr "_Pokaż" #~ msgid "To be read: %u messages" #~ msgstr "Do przeczytania: %u wiadomości" #~ msgid "_Tools" #~ msgstr "_Narzędzia" #~ msgid "Error" #~ msgstr "Błąd" #, fuzzy #~ msgid "iptux-icon" #~ msgstr "iptux" #~ msgid "Please input an IP address (IPv4 only)!" #~ msgstr "Wpisz adres IP (Tylko IPv4)!" #~ msgid "..." #~ msgstr "..." #~ msgid "Clear Buffer" #~ msgstr "Czyść Bufor" #, fuzzy #~ msgid "Contributors" #~ msgstr "Uczestnicy" #, fuzzy #~ msgid "" #~ "Fatal Error!!\n" #~ "Failed to bind the TCP/UDP port(%d)!\n" #~ "%s" #~ msgstr "" #~ "Błąd krytyczny!\n" #~ "Nie można połączyć się z portem TCP/UDP (2425)!\n" #~ "%s" #~ msgid "Help" #~ msgstr "Pomoc" #~ msgid "" #~ "It's an honor that iptux was contributed voluntarilly by many people. " #~ "Without your help, iptux could never make it.\n" #~ "\n" #~ "Especially, Here's some we would like to thank much:\n" #~ "\n" #~ "ChenGang\n" #~ "\n" #~ "\n" #~ "\n" #~ "\n" #~ "\n" #~ "..." #~ msgstr "" #~ "To zaszczyt, że iptux został wspóltworzony przez wiele osób. Bez Twojej " #~ "pomocy, iptux nigdy by nie powstał.\n" #~ "\n" #~ "Oto kilka osób, którym chcielibyśmy szczególnie podziękować:\n" #~ "\n" #~ "ChenGang\n" #~ "\n" #~ "\n" #~ "\n" #~ "\n" #~ "\n" #~ "..." #~ msgid "Jally " #~ msgstr "Jally " #~ msgid "LiWeijian " #~ msgstr "LiWeijian " #~ msgid "ManPT " #~ msgstr "ManPT " #~ msgid "More About Iptux" #~ msgstr "Więcej o Iptux" #, fuzzy #~ msgid "" #~ "Project Home: \n" #~ "https://github.com/iptux-src/iptux\n" #~ "\n" #~ "User and Developer Group: \n" #~ "https://groups.google.com/group/iptux/\n" #~ "\n" #~ "Note that you can get help form the project wiki page.\n" #~ "\n" #~ "If you find no solutions in any of the existed documents, feel free to " #~ "drop a email at iptux@googlegroups.com, lots of users and developers " #~ "would be glade to help about your problems." #~ msgstr "" #~ "Strona Domowa Projektu: \n" #~ "http://code.google.com/p/iptux/\n" #~ "\n" #~ "Grupa użytkowników i programistów: \n" #~ "https://groups.google.com/group/iptux/\n" #~ "\n" #~ "Pamiętaj, że możesz uzyskać pomoc w ramach projektu wiki.\n" #~ "\n" #~ "Jeśli nie znajdziesz rozwiązania w żadnym z istniejących dokumentów, " #~ "prosimy o e-mail na adres iptux@googlegroups.com, wielu użytkowników i " #~ "deweloperów otrzymuje tam pomoc w swoich problemach." #~ msgid "The process is about to quit!" #~ msgstr "Proces zostanie zakończony" #~ msgid "_FAQ" #~ msgstr "_FAQ" #~ msgid "_More" #~ msgstr "_Więcej" #~ msgid "_Sort" #~ msgstr "_Sortuj" #~ msgid "_Update" #~ msgstr "_Aktualizuj" #~ msgid "" #~ "alick \n" #~ "ManPT " #~ msgstr "Tybek " #, fuzzy #~ msgid "http://code.google.com/p/iptux/wiki/FAQ?wl=en" #~ msgstr "http://code.google.com/p/iptux/wiki/FAQ_EnglishVersion" #~ msgid "" #~ "\t-h --help\n" #~ "\t\tdisplay this help and exit\n" #~ msgstr "" #~ "\t-h --help\n" #~ "\t\twyświetlenie pomocy i zakończenie\n" #~ msgid "" #~ "\t-v --version\n" #~ "\t\toutput version information and exit\n" #~ msgstr "" #~ "\t-v --version\n" #~ "\t\twyświetlenie informacji o wersji i zakończenie\n" #~ msgid "Free:%s Total:%s" #~ msgstr "Pozostało:%s Wszystko:%s" #~ msgid "Opendir() directory \"%s\" failed, %s\n" #~ msgstr "Opendir() katalog \"%s\" błąd, %s\n" #~ msgid "Pal's Shared Resources" #~ msgstr "Współdzielone Zasoby Znajomych" #~ msgid "Recv" #~ msgstr "Odebrane" #~ msgid "Rmdir() directory \"%s\" failed, %s\n" #~ msgstr "Rmdir() katalog \"%s\" błąd, %s\n" #~ msgid "Stat() file \"%s\" failed, %s\n" #~ msgstr "Stat() plik \"%s\" błąd, %s\n" #~ msgid "The user is not privileged!\n" #~ msgstr "Użytkownik nie ma uprawnień!\n" #~ msgid "Unlink() file \"%s\" failed, %s\n" #~ msgstr "Unlink() plik \"%s\" błąd, %s\n" #~ msgid "What do you want to do?\n" #~ msgstr "Co chcesz robić?\n" #~ msgid "utf-16" #~ msgstr "utf-16" #~ msgid "utf-8" #~ msgstr "utf-8" iptux-0.9.4/po/pt.po000066400000000000000000001023321475473122500143110ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the iptux package. # FIRST AUTHOR , YEAR. # msgid "" msgstr "" "Project-Id-Version: iptux 0.8.3\n" "Report-Msgid-Bugs-To: https://github.com/iptux-src/iptux/issues/new\n" "POT-Creation-Date: 2025-02-17 13:35-0800\n" "PO-Revision-Date: 2023-03-19 11:37+0000\n" "Last-Translator: ssantos \n" "Language-Team: Portuguese \n" "Language: pt\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n > 1;\n" "X-Generator: Weblate 4.16.2-dev\n" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:6 msgid "iptux" msgstr "iptux" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:7 msgid "LAN communication software" msgstr "Software de comunicação via LAN" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:17 #, fuzzy msgid "iptux is an “IP Messenger” client. The features of iptux include:" msgstr "iptux é um cliente do \"IP Messenger\"." #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:21 msgid "auto-detect other clients on the intranet." msgstr "detetar automaticamente outros clientes na intranet." #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:22 #, fuzzy msgid "send/recv messages to other clients." msgstr "enviar mensagens a outros clientes." #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:23 #, fuzzy msgid "send/recv files to other clients." msgstr "enviar ficheiros para outros clientes." #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:24 msgid "share your files to other cliens (with optional password protection)." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:26 msgid "" "It is (supposedly) compatible with 飞鸽传书 (Feige) and 飞秋 (FeiQ) from " "China, and with the original “IP Messenger” clients from Japan, including " "g2ipmsg and xipmsg in Debian." msgstr "" "Além disso é (supostamente) compatível com 飞鸽传书 (Feige) e 飞秋 (FeiQ) da " "China e com o cliente original “IP Messenger” do Japão, incluindo g2ipmsg e " "xipmsg no Debian." #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:38 msgid "The Iptux main window." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:42 msgid "The Iptux chat window." msgstr "" #: src/iptux-core/CoreThread.cpp:172 #, c-format msgid "" "Fatal Error!! Failed to create new socket!\n" "%s" msgstr "" "Erro Fatal!! Falha ao criar novo Socket!\n" "%s" #: src/iptux-core/CoreThread.cpp:188 #, c-format msgid "" "Fatal Error!! Failed to bind the TCP port(%s:%d)!\n" "%s" msgstr "" "Erro Fatal!! Falha ao conectar à Porta TCP(%s:%d)!\n" "%s" #: src/iptux-core/CoreThread.cpp:201 #, c-format msgid "" "Fatal Error!! Failed to bind the UDP port(%s:%d)!\n" "%s" msgstr "" "Erro Fatal!! Falha ao conectar à Porta UDP(%s:%d)!\n" "%s" #: src/iptux-core/CoreThread.cpp:461 src/iptux-core/CoreThread.cpp:495 #: src/iptux-core/internal/RecvFileData.cpp:142 #: src/iptux-core/internal/RecvFileData.cpp:204 #, c-format msgid "" "Fatal Error!!\n" "Failed to create new socket!\n" "%s" msgstr "" "Erro Fatal!!\n" "Falha ao criar um novo Socket!\n" "%s" #: src/iptux-core/Models.cpp:172 msgid "Empty Message" msgstr "Mensagem sem conteúdo" #: src/iptux-core/Models.cpp:250 msgid "Received an image" msgstr "Recebeu uma imagem" #: src/iptux-core/internal/AnalogFS.cpp:93 #: src/iptux-core/internal/AnalogFS.cpp:98 #, c-format msgid "Open() file \"%s\" failed, %s" msgstr "Open() ficheiro \"%s\" falhou, %s" #: src/iptux-core/internal/AnalogFS.cpp:117 #, c-format msgid "Stat64() file \"%s\" failed, %s" msgstr "Stat64() ficheiro \"%s\" falhou, %s" #: src/iptux-core/internal/AnalogFS.cpp:138 #, c-format msgid "Mkdir() directory \"%s\" failed, %s" msgstr "Mkdir() pasta \"%s\" falhou, %s" #: src/iptux-core/internal/AnalogFS.cpp:164 #, c-format msgid "Opendir() directory \"%s\" failed, %s" msgstr "Opendir() pasta \"%s\" falhou, %s" #: src/iptux-core/internal/Command.cpp:226 msgid "Your pal didn't receive the packet. He or she is offline maybe." msgstr "Outro participante não recebeu o pacote. Talvez está offline." #: src/iptux-core/internal/CommandMode.cpp:39 #, c-format msgid "unknown command mode: %d" msgstr "modo de comando desconhecido: %d" #: src/iptux-core/internal/RecvFileData.cpp:117 msgid "receive" msgstr "receber" #: src/iptux-core/internal/RecvFileData.cpp:124 #: src/iptux-core/internal/RecvFileData.cpp:253 #: src/iptux-core/internal/SendFileData.cpp:108 #: src/iptux-core/internal/SendFileData.cpp:193 msgid "Unknown" msgstr "Desconhecido" #: src/iptux-core/internal/RecvFileData.cpp:175 #, fuzzy, c-format msgid "" "Failed to receive the file \"%s\" from %s! expect length %jd, received %jd" msgstr "" "Falha ao receber o ficheiro \"%s\" de %s! tamanho previsto %lld, recebido " "%lld" #: src/iptux-core/internal/RecvFileData.cpp:180 #, c-format msgid "Receive the file \"%s\" from %s successfully!" msgstr "Recebeu um ficheiro \"%s\" de %s com sucesso!" #: src/iptux-core/internal/RecvFileData.cpp:320 #, c-format msgid "Failed to receive the directory \"%s\" from %s!" msgstr "Falha ao receber a pasta \"%s\" de %s!" #: src/iptux-core/internal/RecvFileData.cpp:323 #, c-format msgid "Receive the directory \"%s\" from %s successfully!" msgstr "Recebeu a pasta \"%s\" de %s com sucesso!" #: src/iptux-core/internal/SendFileData.cpp:101 msgid "send" msgstr "enviar" #: src/iptux-core/internal/SendFileData.cpp:137 #, c-format msgid "Failed to send the file \"%s\" to %s!" msgstr "Falha ao enviar o ficheiro \"%s\" para %s!" #: src/iptux-core/internal/SendFileData.cpp:142 #, c-format msgid "Send the file \"%s\" to %s successfully!" msgstr "Enviou o ficheiro \"%s\" para %s com sucesso!" #: src/iptux-core/internal/SendFileData.cpp:265 #, c-format msgid "Failed to send the directory \"%s\" to %s!" msgstr "Falha ao enviar a pasta \"%s\" para %s!" #: src/iptux-core/internal/SendFileData.cpp:270 #, c-format msgid "Send the directory \"%s\" to %s successfully!" msgstr "Enviou a pasta \"%s\" para %s com sucesso!" #: src/iptux-core/internal/UdpData.cpp:92 #: src/iptux-core/internal/UdpData.cpp:93 #: src/iptux-core/internal/UdpData.cpp:443 #: src/iptux-core/internal/UdpData.cpp:484 msgid "mysterious" msgstr "desconhecido" #: src/iptux-utils/utils.cpp:880 #, c-format msgid "stat file \"%s\" failed: %s" msgstr "stat ficheiro \"%s\" falhou: %s" #: src/iptux-utils/utils.cpp:888 #, c-format msgid "path %s is not file or directory: st_mode(%x)" msgstr "o caminho %s não é um ficheiro ou uma pasta: st_mode(%x)" #: src/iptux-utils/utils.cpp:895 #, c-format msgid "opendir on \"%s\" failed: %s" msgstr "opendir no \"%s\" falhou: %s" #: src/iptux/AboutDialog.cpp:39 msgid "TRANSLATOR NAME" msgstr "inkhorn" #: src/iptux/AboutDialog.cpp:53 msgid "Thanks to" msgstr "Agradecimentos" #: src/iptux/AppIndicator.cpp:40 src/iptux/MainWindow.cpp:505 #: src/iptux/MainWindow.cpp:507 msgid "Iptux" msgstr "Iptux" #: src/iptux/Application.cpp:54 msgid "Loading the process successfully!" msgstr "Carregou o processo com sucesso!" #: src/iptux/Application.cpp:274 #, c-format msgid "New Message from %s" msgstr "Nova mensagem de %s" #: src/iptux/Application.cpp:287 #, c-format msgid "New File from %s" msgstr "Nova ficheiro de %s" #: src/iptux/Application.cpp:296 msgid "Receiving File Finished" msgstr "O recebimento do ficheiro concluído" #: src/iptux/Application.cpp:300 msgid "file info no longer exist" msgstr "as informações do ficheiro não estão disponíveis" #: src/iptux/Darwin.cpp:16 #, c-format msgid "Couldn’t load icon: %s" msgstr "Não foi possível carregar o ícone: %s" #: src/iptux/DataSettings.cpp:46 msgid "Personal" msgstr "Pessoal" #: src/iptux/DataSettings.cpp:48 msgid "System" msgstr "Sistema" #: src/iptux/DataSettings.cpp:50 msgid "Network" msgstr "Rede" #: src/iptux/DataSettings.cpp:89 src/iptux/DataSettings.cpp:98 msgid "The program needs to be restarted to take effect!" msgstr "" #: src/iptux/DataSettings.cpp:143 msgid "Preferences" msgstr "Preferências" #: src/iptux/DataSettings.cpp:143 src/iptux/RevisePal.cpp:109 #: src/iptux/dialog.cpp:107 src/iptux/dialog.cpp:170 msgid "_OK" msgstr "_OK" #: src/iptux/DataSettings.cpp:144 msgid "_Apply" msgstr "_Aplicar" #: src/iptux/DataSettings.cpp:144 src/iptux/DataSettings.cpp:1348 #: src/iptux/DataSettings.cpp:1395 src/iptux/DialogBase.cpp:359 #: src/iptux/DialogBase.cpp:918 src/iptux/RevisePal.cpp:110 #: src/iptux/ShareFile.cpp:419 src/iptux/callback.cpp:87 #: src/iptux/dialog.cpp:171 src/iptux/dialog.cpp:230 msgid "_Cancel" msgstr "_Cancelar" #: src/iptux/DataSettings.cpp:169 msgid "Your _nickname:" msgstr "O seu _nome:" #: src/iptux/DataSettings.cpp:176 msgid "Please input your nickname!" msgstr "Por favor, digite o seu nome!" #: src/iptux/DataSettings.cpp:182 msgid "Your _group name:" msgstr "O nome do seu _grupo:" #: src/iptux/DataSettings.cpp:189 msgid "Please input your group name!" msgstr "Por favor, digite o nome do seu grupo!" #: src/iptux/DataSettings.cpp:195 msgid "Your _face picture:" msgstr "A sua _foto:" #: src/iptux/DataSettings.cpp:213 msgid "_Save files to: " msgstr "_Gravar ficheiros em: " #: src/iptux/DataSettings.cpp:226 msgid "Photo" msgstr "Foto" #: src/iptux/DataSettings.cpp:238 msgid "Signature" msgstr "Assinatura" #: src/iptux/DataSettings.cpp:271 msgid "Port:" msgstr "" #: src/iptux/DataSettings.cpp:278 msgid "Any port number between 1024 and 65535, default is 2425" msgstr "" #: src/iptux/DataSettings.cpp:287 msgid "Candidate network encodings:" msgstr "Sugestão de codificação da rede:" #: src/iptux/DataSettings.cpp:294 msgid "Candidate network encodings, separated by \",\"" msgstr "Sugestão de codificação da rede, separado por \",\"" #: src/iptux/DataSettings.cpp:301 #, fuzzy msgid "Preferred network encoding:" msgstr "Codificação da rede preferida:" #: src/iptux/DataSettings.cpp:308 msgid "" "Preference network coding (You should be aware of what you are doing if you " "want to modify it.)" msgstr "" "Codificação da rede preferida (para modificá-lo certifique-se que sabe o que " "está fazendo.)" #: src/iptux/DataSettings.cpp:316 msgid "Pal's default face picture:" msgstr "A foto do participante:" #: src/iptux/DataSettings.cpp:334 msgid "Panel font:" msgstr "Fonte do painel:" #: src/iptux/DataSettings.cpp:346 msgid "Automatically open the chat dialog" msgstr "Automaticamente abre o diálogo de conversa" #: src/iptux/DataSettings.cpp:354 msgid "Automatically hide the panel after login" msgstr "Automaticamente esconde o painel após o login" #: src/iptux/DataSettings.cpp:362 msgid "Automatically open the File Transmission Management" msgstr "Automaticamente abre o Gestor de Transmissão de Ficheiro" #: src/iptux/DataSettings.cpp:370 msgid "Use the 'Enter' key to send message" msgstr "Use a tecla 'Enter' para enviar mensagem" #: src/iptux/DataSettings.cpp:378 msgid "Automatically clean up the chat history" msgstr "Automaticamente limpa o histórico de conversa" #: src/iptux/DataSettings.cpp:385 msgid "Save the chat history" msgstr "Salva o histórico da conversa" #: src/iptux/DataSettings.cpp:393 msgid "Use the Blacklist (NOT recommended)" msgstr "Use a ListaNegra (não recomendado)" #: src/iptux/DataSettings.cpp:401 msgid "Filter the request of sharing files" msgstr "Filtra o pedido de compartilhamento de ficheiros" #: src/iptux/DataSettings.cpp:408 msgid "Hide the taskbar when the main window is minimized" msgstr "" #: src/iptux/DataSettings.cpp:432 msgid "From:" msgstr "De:" #: src/iptux/DataSettings.cpp:438 msgid "Beginning of the IP(v4) section" msgstr "Início da secção IP(v4)" #: src/iptux/DataSettings.cpp:442 msgid "To:" msgstr "Para:" #: src/iptux/DataSettings.cpp:448 msgid "End of the IP(v4) section" msgstr "Fim da secção IP(v4)" #: src/iptux/DataSettings.cpp:456 msgid "Add" msgstr "Adicionar" #: src/iptux/DataSettings.cpp:461 msgid "Delete" msgstr "Apagar" #: src/iptux/DataSettings.cpp:468 msgid "Added IP(v4) Section:" msgstr "Secção IP(v4) adicionada:" #: src/iptux/DataSettings.cpp:487 msgid "Import" msgstr "Importar" #: src/iptux/DataSettings.cpp:491 msgid "Export" msgstr "Exportar" #: src/iptux/DataSettings.cpp:495 src/iptux/TransWindow.cpp:171 msgid "Clear" msgstr "Limpar" #: src/iptux/DataSettings.cpp:706 msgid "From" msgstr "De" #: src/iptux/DataSettings.cpp:713 msgid "To" msgstr "Para" #: src/iptux/DataSettings.cpp:720 msgid "Description" msgstr "Descrição" #: src/iptux/DataSettings.cpp:736 msgid "Please select download folder" msgstr "Por favor, escolha uma pasta para descargas" #: src/iptux/DataSettings.cpp:758 msgid "Select Font" msgstr "Selecione fonte" #: src/iptux/DataSettings.cpp:872 src/iptux/DataSettings.cpp:874 #: src/iptux/DataSettings.cpp:878 msgid "Port must be a number between 1024 and 65535" msgstr "" #: src/iptux/DataSettings.cpp:1019 src/iptux/DataSettings.cpp:1050 #, c-format msgid "" "Fopen() file \"%s\" failed!\n" "%s" msgstr "" "Fopen() ficheiro \"%s\" falhou!\n" "%s" #: src/iptux/DataSettings.cpp:1150 src/iptux/RevisePal.cpp:419 msgid "Please select a face picture" msgstr "Por favor, selecione uma imagem do perfil" #: src/iptux/DataSettings.cpp:1172 msgid "Please select a personal photo" msgstr "Por favor, selecione uma foto" #: src/iptux/DataSettings.cpp:1241 src/iptux/DataSettings.cpp:1248 #: src/iptux/DetectPal.cpp:75 #, c-format msgid "" "\n" "Illegal IP(v4) address: %s!" msgstr "" "\n" "Endereço IP(v4) inválido: %s!" #: src/iptux/DataSettings.cpp:1346 msgid "Please select a file to import data" msgstr "Por favor, selecione um ficheiro para importar dados" #: src/iptux/DataSettings.cpp:1347 src/iptux/DialogBase.cpp:358 #: src/iptux/ShareFile.cpp:418 src/iptux/callback.cpp:86 msgid "_Open" msgstr "Abrir" #: src/iptux/DataSettings.cpp:1394 msgid "Save data to file" msgstr "Gravar dados para ficheiro" #: src/iptux/DataSettings.cpp:1395 src/iptux/DialogBase.cpp:919 #: src/iptux/dialog.cpp:231 msgid "_Save" msgstr "_Gravar" #: src/iptux/DetectPal.cpp:70 #, c-format msgid "The notification has been sent to %s." msgstr "A notificação foi enviada para %s." #: src/iptux/DialogBase.cpp:214 #, c-format msgid "%s To Send." msgstr "%s para enviar." #: src/iptux/DialogBase.cpp:272 msgid "Close" msgstr "Fechar" #: src/iptux/DialogBase.cpp:276 src/iptux/DialogGroup.cpp:375 msgid "Send" msgstr "Enviar" #: src/iptux/DialogBase.cpp:307 msgid "Chat History" msgstr "Histórico da conversa" #: src/iptux/DialogBase.cpp:350 msgid "Choose enclosure files" msgstr "Escolha ficheiros para anexar" #: src/iptux/DialogBase.cpp:353 msgid "Choose enclosure folders" msgstr "Escolha pastas para anexar" #: src/iptux/DialogBase.cpp:593 msgid "Remove Selected" msgstr "Remover selecionado" #: src/iptux/DialogBase.cpp:648 msgid "File to send." msgstr "Ficheiro para enviar." #: src/iptux/DialogBase.cpp:653 msgid "Sending progress." msgstr "O progresso do envio." #: src/iptux/DialogBase.cpp:656 msgid "Dirs" msgstr "Pastas" #: src/iptux/DialogBase.cpp:659 msgid "Files" msgstr "Ficheiros" #: src/iptux/DialogBase.cpp:662 src/iptux/DialogPeer.cpp:565 msgid "Detail" msgstr "Detalhes" #: src/iptux/DialogBase.cpp:712 msgid "PeerName" msgstr "Nome do participante" #: src/iptux/DialogBase.cpp:719 src/iptux/DialogPeer.cpp:716 msgid "Name" msgstr "Nome" #: src/iptux/DialogBase.cpp:725 src/iptux/DialogPeer.cpp:652 #: src/iptux/DialogPeer.cpp:722 src/iptux/ShareFile.cpp:280 #: src/iptux/TransWindow.cpp:271 msgid "Size" msgstr "Tamanho" #: src/iptux/DialogBase.cpp:731 msgid "Path" msgstr "Caminho" #: src/iptux/DialogBase.cpp:792 msgid "Sending Progress." msgstr "O progresso de envio." #: src/iptux/DialogBase.cpp:795 #, c-format msgid "%s of %s Sent." msgstr "%s de %s enviado." #: src/iptux/DialogBase.cpp:802 src/iptux/DialogPeer.cpp:835 msgid "Mission Completed!" msgstr "Concluído!" #: src/iptux/DialogBase.cpp:845 src/iptux/DialogBase.cpp:917 msgid "Save Image" msgstr "" #: src/iptux/DialogBase.cpp:850 msgid "Copy Image" msgstr "" #: src/iptux/DialogGroup.cpp:285 msgid "Member" msgstr "Membro" #: src/iptux/DialogGroup.cpp:382 msgid "Pals" msgstr "Participantes" #: src/iptux/DialogGroup.cpp:480 msgid "Select All" msgstr "Selecionar tudo" #: src/iptux/DialogGroup.cpp:485 msgid "Reverse Select" msgstr "Seleção reversa" #: src/iptux/DialogGroup.cpp:490 msgid "Clear Up" msgstr "Limpar" #: src/iptux/DialogGroup.cpp:728 #, c-format msgid "Talk with the group %s" msgstr "Converse com o grupo %s" #: src/iptux/DialogPeer.cpp:132 #, c-format msgid "Talk with %s(%s) IP:%s" msgstr "Converse com %s(%s) IP:%s" #: src/iptux/DialogPeer.cpp:305 msgid "Info." msgstr "Informações." #: src/iptux/DialogPeer.cpp:337 #, c-format msgid "Version: %s\n" msgstr "Versão: %s\n" #: src/iptux/DialogPeer.cpp:339 #, c-format msgid "Nickname: %s@%s\n" msgstr "Nome: %s@%s\n" #: src/iptux/DialogPeer.cpp:342 #, c-format msgid "Nickname: %s\n" msgstr "Nome: %s\n" #: src/iptux/DialogPeer.cpp:344 #, c-format msgid "User: %s\n" msgstr "Utilizador: %s\n" #: src/iptux/DialogPeer.cpp:345 #, c-format msgid "Host: %s\n" msgstr "Host: %s\n" #: src/iptux/DialogPeer.cpp:348 #, c-format msgid "Address: %s(%s)\n" msgstr "Endereço: %s(%s)\n" #: src/iptux/DialogPeer.cpp:350 #, c-format msgid "Address: %s\n" msgstr "Endereço: %s\n" #: src/iptux/DialogPeer.cpp:353 msgid "Compatibility: Microsoft\n" msgstr "Compatível com: Microsoft\n" #: src/iptux/DialogPeer.cpp:355 msgid "Compatibility: GNU/Linux\n" msgstr "Compatível com: GNU/Linux\n" #: src/iptux/DialogPeer.cpp:357 #, c-format msgid "System coding: %s\n" msgstr "Codificação do sistema: %s\n" #: src/iptux/DialogPeer.cpp:362 msgid "Signature:\n" msgstr "Assinatura:\n" #: src/iptux/DialogPeer.cpp:369 msgid "" "\n" "Photo:\n" msgstr "" "\n" "Foto:\n" #: src/iptux/DialogPeer.cpp:460 msgid "Please select a picture to insert the buffer" msgstr "Por favor, selecione uma foto para inserir no buffer" #: src/iptux/DialogPeer.cpp:486 src/iptux/resources/gtk/menus.ui:83 #: src/iptux/resources/gtk/menus.ui:228 #, fuzzy msgid "Insert Image" msgstr "Inserir foto" #: src/iptux/DialogPeer.cpp:502 msgid "Enclosure." msgstr "Anexo." #: src/iptux/DialogPeer.cpp:547 msgid "Files to be received" msgstr "Ficheiros para receber" #: src/iptux/DialogPeer.cpp:551 msgid "Receiving progress." msgstr "O progresso do recebimento." #: src/iptux/DialogPeer.cpp:554 msgid "Accept" msgstr "Aceitar" #: src/iptux/DialogPeer.cpp:560 src/iptux/dialog.cpp:63 #: src/iptux/resources/gtk/menus.ui:342 msgid "Refuse" msgstr "Recusar" #: src/iptux/DialogPeer.cpp:596 msgid "File received." msgstr "Ficheiro recebido." #: src/iptux/DialogPeer.cpp:639 src/iptux/DialogPeer.cpp:710 msgid "Source" msgstr "Fonte" #: src/iptux/DialogPeer.cpp:646 msgid "SaveAs" msgstr "GravarComo" #: src/iptux/DialogPeer.cpp:818 src/iptux/DialogPeer.cpp:884 msgid "Receiving Progress." msgstr "O progresso do recebimento." #: src/iptux/DialogPeer.cpp:821 src/iptux/DialogPeer.cpp:887 #, c-format msgid "%s to Receive." msgstr "%s para receber." #: src/iptux/DialogPeer.cpp:825 src/iptux/DialogPeer.cpp:891 #, c-format msgid "%s Of %s Received." msgstr "%s de %s recebido(s)." #: src/iptux/LogSystem.cpp:71 #, c-format msgid "Recevied-From: Nickname:%s User:%s Host:%s" msgstr "Recebido de: Nome:%s Utilizador:%s Host:%s" #: src/iptux/LogSystem.cpp:76 #, c-format msgid "Send-To: Nickname:%s User:%s Host:%s" msgstr "Enviado para: Nome:%s Utilizador:%s Host:%s" #: src/iptux/LogSystem.cpp:80 msgid "Send-Broadcast" msgstr "Enviar transmissão" #: src/iptux/LogSystem.cpp:99 #, c-format msgid "User:%s Host:%s" msgstr "Utilizador:%s Host:%s" #: src/iptux/MainWindow.cpp:570 msgid "Pals Online: 0" msgstr "Participantes online: 0" #: src/iptux/MainWindow.cpp:655 msgid "Search Pals" msgstr "Procurar outros participantes" #: src/iptux/MainWindow.cpp:768 msgid "Nickname" msgstr "Nome" #: src/iptux/MainWindow.cpp:778 msgid "Group" msgstr "Grupo" #: src/iptux/MainWindow.cpp:784 src/iptux/TransWindow.cpp:258 msgid "IPv4" msgstr "IPv4" #: src/iptux/MainWindow.cpp:790 msgid "User" msgstr "Utilizador" #: src/iptux/MainWindow.cpp:796 src/iptux/resources/gtk/MainWindow.ui:81 msgid "Host" msgstr "Host" #: src/iptux/MainWindow.cpp:935 #, c-format msgid "Pals Online: %d" msgstr "Participantes online: %d" #: src/iptux/RevisePal.cpp:109 msgid "Change Pal's Information" msgstr "Alterar as informações de participantes" #: src/iptux/RevisePal.cpp:134 msgid "Pal's nickname:" msgstr "Nome do participante:" #: src/iptux/RevisePal.cpp:140 msgid "Please input pal's new nickname!" msgstr "Por favor, digite o novo nome do participante!" #: src/iptux/RevisePal.cpp:146 msgid "Pal's group name:" msgstr "Nome do grupo de participante:" #: src/iptux/RevisePal.cpp:152 msgid "Please input pal's new group name!" msgstr "Por favor, digite o novo nome do grupo!" #: src/iptux/RevisePal.cpp:158 msgid "System coding:" msgstr "Codificação do sistema:" #: src/iptux/RevisePal.cpp:164 msgid "Be SURE to know what you are doing!" msgstr "Tem cuidado com o que faz!" #: src/iptux/RevisePal.cpp:170 msgid "Pal's face picture:" msgstr "Foto do participante:" #: src/iptux/RevisePal.cpp:184 msgid "Be compatible with iptux's protocol (DANGEROUS)" msgstr "Seja compatível com o protocolo do iptux (ATENÇÃO)" #: src/iptux/ShareFile.cpp:104 msgid "Shared Files Management" msgstr "Gestor de ficheiros compartilhados" #: src/iptux/ShareFile.cpp:105 msgid "OK" msgstr "OK" #: src/iptux/ShareFile.cpp:106 msgid "Apply" msgstr "Aplicar" #: src/iptux/ShareFile.cpp:107 msgid "Cancel" msgstr "Cancelar" #: src/iptux/ShareFile.cpp:160 msgid "Add Files" msgstr "Adicionar ficheiros" #: src/iptux/ShareFile.cpp:163 msgid "Add Folders" msgstr "Adicionar pastas" #: src/iptux/ShareFile.cpp:166 msgid "Delete Resources" msgstr "Eliminar recursos" #: src/iptux/ShareFile.cpp:169 msgid "Clear Password" msgstr "Remover a palavra-passe" #: src/iptux/ShareFile.cpp:172 msgid "Set Password" msgstr "Definir a palavra-passe" #: src/iptux/ShareFile.cpp:229 src/iptux/ShareFile.cpp:373 msgid "regular" msgstr "regular" #: src/iptux/ShareFile.cpp:233 src/iptux/ShareFile.cpp:377 msgid "directory" msgstr "pasta" #: src/iptux/ShareFile.cpp:237 src/iptux/ShareFile.cpp:381 msgid "unknown" msgstr "desconhecido" #: src/iptux/ShareFile.cpp:270 msgid "File" msgstr "Ficheiro" #: src/iptux/ShareFile.cpp:286 msgid "Type" msgstr "Tipo" #: src/iptux/ShareFile.cpp:411 msgid "Choose the files to share" msgstr "Escolha os ficheiros para compartilhar" #: src/iptux/ShareFile.cpp:414 msgid "Choose the folders to share" msgstr "Escolha as pastas para compartilhar" #: src/iptux/TransWindow.cpp:86 msgid "Files Transmission Management" msgstr "Gestor da transmissão de ficheiros" #: src/iptux/TransWindow.cpp:241 msgid "State" msgstr "Status" #: src/iptux/TransWindow.cpp:247 msgid "Task" msgstr "Tarefa" #: src/iptux/TransWindow.cpp:253 msgid "Peer" msgstr "Participante" #: src/iptux/TransWindow.cpp:265 msgid "Filename" msgstr "Nome do ficheiro" #: src/iptux/TransWindow.cpp:277 msgid "Completed" msgstr "Concluído" #: src/iptux/TransWindow.cpp:284 msgid "Progress" msgstr "Progresso" #: src/iptux/TransWindow.cpp:291 msgid "Cost" msgstr "Tempo" #: src/iptux/TransWindow.cpp:297 msgid "Remaining" msgstr "Restante" #: src/iptux/TransWindow.cpp:303 msgid "Rate" msgstr "Velocidade" #: src/iptux/TransWindow.cpp:331 msgid "The path you want to open not exist!" msgstr "O caminho que quer abrir não existe!" #: src/iptux/TransWindow.cpp:405 msgid "The file you want to open not exist!" msgstr "O ficheiro que quer abrir não existe!" #: src/iptux/TransWindow.cpp:406 msgid "iptux Error" msgstr "Erro no iptux" #: src/iptux/UiCoreThread.cpp:254 src/iptux/UiCoreThread.cpp:278 #: src/iptux/UiCoreThread.cpp:377 src/iptux/UiCoreThread.cpp:399 msgid "Others" msgstr "Outros" #: src/iptux/UiCoreThread.cpp:419 msgid "Broadcast" msgstr "Transmissão" #: src/iptux/UiHelper.cpp:28 #, c-format msgid "Can't convert path to uri: %s, reason: %s" msgstr "" #: src/iptux/UiHelper.cpp:39 #, c-format msgid "Can't open path: %s, reason: %s" msgstr "" #: src/iptux/UiHelper.cpp:68 #, c-format msgid "Can't open URL: %s, reason: %s" msgstr "" #: src/iptux/UiHelper.cpp:188 msgid "Information" msgstr "Informação" #: src/iptux/UiHelper.cpp:218 msgid "Warning" msgstr "Aviso" #: src/iptux/UiModels.cpp:604 #, c-format msgid "Version: %s" msgstr "Versão: %s" #: src/iptux/UiModels.cpp:608 #, c-format msgid "Nickname: %s@%s" msgstr "Nome: %s@%s" #: src/iptux/UiModels.cpp:611 #, c-format msgid "Nickname: %s" msgstr "Nome: %s" #: src/iptux/UiModels.cpp:615 #, c-format msgid "User: %s" msgstr "Utilizador: %s" #: src/iptux/UiModels.cpp:618 #, c-format msgid "Host: %s" msgstr "Host: %s" #: src/iptux/UiModels.cpp:623 #, c-format msgid "Address: %s(%s)" msgstr "Endereço: %s(%s)" #: src/iptux/UiModels.cpp:625 #, c-format msgid "Address: %s" msgstr "Endereço: %s" #: src/iptux/UiModels.cpp:630 msgid "Compatibility: Microsoft" msgstr "Compatível com: Microsoft" #: src/iptux/UiModels.cpp:632 msgid "Compatibility: GNU/Linux" msgstr "Compatível com: GNU/Linux" #: src/iptux/UiModels.cpp:636 #, c-format msgid "System coding: %s" msgstr "Codificação do sistema: %s" #: src/iptux/UiModels.cpp:641 msgid "Signature:" msgstr "Assinatura:" #: src/iptux/UiModels.cpp:744 msgid "" msgstr "" #: src/iptux/UiModels.cpp:799 msgid "[IMG]" msgstr "" #: src/iptux/dialog.cpp:39 msgid "" "File transfer has not been completed.\n" "Are you sure to cancel and quit?" msgstr "" "A transferência do ficheiro não foi concluída.\n" "Quer cancelar e sair?" #: src/iptux/dialog.cpp:42 msgid "Confirm Exit" msgstr "Confirmar saída" #: src/iptux/dialog.cpp:62 src/iptux/resources/gtk/MainWindow.ui:12 #: src/iptux/resources/gtk/menus.ui:98 src/iptux/resources/gtk/menus.ui:243 msgid "Request Shared Resources" msgstr "Solicitar recursos compartilhados" #: src/iptux/dialog.cpp:62 msgid "Agree" msgstr "Concordo" #: src/iptux/dialog.cpp:78 #, c-format msgid "" "Your pal (%s)[%s]\n" "is requesting to get your shared resources,\n" "Do you agree?" msgstr "" "Outro participante (%s)[%s]\n" "solicita compartilhar os seus recursos,\n" "Aceita?" #: src/iptux/dialog.cpp:106 msgid "Access Password" msgstr "Palavra-passe de acesso" #: src/iptux/dialog.cpp:113 msgid "Please input the password for the shared files behind" msgstr "Por favor, digite a palavra-passe para ficheiros compartilhados" #: src/iptux/dialog.cpp:127 #, c-format msgid "(%s)[%s]Password:" msgstr "(%s)[%s]Palavra-passe:" #: src/iptux/dialog.cpp:146 src/iptux/dialog.cpp:207 msgid "" "\n" "Empty Password!" msgstr "" "\n" "Palavra-passe em branco!" #: src/iptux/dialog.cpp:170 msgid "Enter a New Password" msgstr "Digite uma nova palavra-passe" #: src/iptux/dialog.cpp:178 msgid "Password: " msgstr "Palavra-passe: " #: src/iptux/dialog.cpp:187 msgid "Repeat: " msgstr "Outra vez: " #: src/iptux/dialog.cpp:202 msgid "" "\n" "Password Mismatched!" msgstr "" "\n" "Palavras-passe não são iguais!" #: src/iptux/dialog.cpp:229 msgid "Please select a folder to save files." msgstr "Por favor, escolha uma pasta para gravar ficheiros." #: src/iptux/resources/gtk/AboutDialog.ui:11 msgid "" "Copyright © 2008–2009, Jally\n" "Copyright © 2013–2015,2017–2021, LI Daobing" msgstr "" "Direitos autorais © 2008–2009, Jally\n" "Direitos autorais © 2013–2015,2017–2021, LI Daobing" #: src/iptux/resources/gtk/AboutDialog.ui:13 msgid "A GTK based LAN messenger." msgstr "Mensageiro LAN baseado no GTK." #: src/iptux/resources/gtk/AppIndicator.ui:6 #, fuzzy msgid "Open Iptux" msgstr "Iptux" #: src/iptux/resources/gtk/AppIndicator.ui:12 #: src/iptux/resources/gtk/menus.ui:6 src/iptux/resources/gtk/menus.ui:306 msgid "_Preferences" msgstr "_Preferências" #: src/iptux/resources/gtk/AppIndicator.ui:16 #: src/iptux/resources/gtk/menus.ui:10 src/iptux/resources/gtk/menus.ui:310 msgid "_Quit" msgstr "Sair" #: src/iptux/resources/gtk/DetectPal.ui:7 msgid "Detect pal" msgstr "Descobrir participantes" #: src/iptux/resources/gtk/DetectPal.ui:15 msgid "Detect" msgstr "Descobrir" #: src/iptux/resources/gtk/DetectPal.ui:61 msgid "Please input an IP address (IPv4 only):" msgstr "Por favor, digite endereço IP (somente IPv4):" #: src/iptux/resources/gtk/MainWindow.ui:8 src/iptux/resources/gtk/menus.ui:109 #: src/iptux/resources/gtk/menus.ui:254 msgid "Send Message" msgstr "Enviar mensagem" #: src/iptux/resources/gtk/MainWindow.ui:16 msgid "Change Info" msgstr "Alterar detalhes" #: src/iptux/resources/gtk/MainWindow.ui:20 msgid "Delete Pal" msgstr "Remover participante" #: src/iptux/resources/gtk/MainWindow.ui:26 src/iptux/resources/gtk/menus.ui:31 #: src/iptux/resources/gtk/menus.ui:176 msgid "Sort" msgstr "Ordenar" #: src/iptux/resources/gtk/MainWindow.ui:29 src/iptux/resources/gtk/menus.ui:34 #: src/iptux/resources/gtk/menus.ui:179 msgid "By Nickname" msgstr "Por nome" #: src/iptux/resources/gtk/MainWindow.ui:34 src/iptux/resources/gtk/menus.ui:39 #: src/iptux/resources/gtk/menus.ui:184 #, fuzzy msgid "By Username" msgstr "Por nome" #: src/iptux/resources/gtk/MainWindow.ui:39 src/iptux/resources/gtk/menus.ui:44 #: src/iptux/resources/gtk/menus.ui:189 msgid "By IP" msgstr "Por IP" #: src/iptux/resources/gtk/MainWindow.ui:44 src/iptux/resources/gtk/menus.ui:49 #: src/iptux/resources/gtk/menus.ui:194 #, fuzzy msgid "By Host" msgstr "Host" #: src/iptux/resources/gtk/MainWindow.ui:49 src/iptux/resources/gtk/menus.ui:54 #: src/iptux/resources/gtk/menus.ui:199 msgid "By Last Activity" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:56 src/iptux/resources/gtk/menus.ui:61 #: src/iptux/resources/gtk/menus.ui:206 msgid "Ascending" msgstr "Ascendente" #: src/iptux/resources/gtk/MainWindow.ui:61 src/iptux/resources/gtk/menus.ui:66 #: src/iptux/resources/gtk/menus.ui:211 msgid "Descending" msgstr "Descendente" #: src/iptux/resources/gtk/MainWindow.ui:68 msgid "Info Style" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:71 #, fuzzy msgid "IP" msgstr "IPv4" #: src/iptux/resources/gtk/MainWindow.ui:76 msgid "IP:PORT" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:86 #, fuzzy msgid "Username" msgstr "Utilizador" #: src/iptux/resources/gtk/MainWindow.ui:91 #, fuzzy msgid "Version" msgstr "Versão: %s" #: src/iptux/resources/gtk/MainWindow.ui:96 msgid "Last Activity" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:101 #, fuzzy msgid "Last Message" msgstr "Mensagem sem conteúdo" #: src/iptux/resources/gtk/menus.ui:17 src/iptux/resources/gtk/menus.ui:162 msgid "_File" msgstr "Ficheiro" #: src/iptux/resources/gtk/menus.ui:19 src/iptux/resources/gtk/menus.ui:164 msgid "_Detect" msgstr "_Descobrir" #: src/iptux/resources/gtk/menus.ui:23 src/iptux/resources/gtk/menus.ui:168 msgid "_Find" msgstr "Encontrar" #: src/iptux/resources/gtk/menus.ui:28 src/iptux/resources/gtk/menus.ui:173 msgid "_View" msgstr "_Vista" #: src/iptux/resources/gtk/menus.ui:73 src/iptux/resources/gtk/menus.ui:218 msgid "_Refresh" msgstr "Atualizar" #: src/iptux/resources/gtk/menus.ui:80 src/iptux/resources/gtk/menus.ui:225 msgid "_Chat" msgstr "_Chat" #: src/iptux/resources/gtk/menus.ui:88 src/iptux/resources/gtk/menus.ui:233 msgid "Attach File" msgstr "Anexar ficheiro" #: src/iptux/resources/gtk/menus.ui:92 src/iptux/resources/gtk/menus.ui:237 msgid "Attach Folder" msgstr "Anexar pasta" #: src/iptux/resources/gtk/menus.ui:102 src/iptux/resources/gtk/menus.ui:247 msgid "Clear Chat History" msgstr "Limpar o histórico da conversa" #: src/iptux/resources/gtk/menus.ui:115 src/iptux/resources/gtk/menus.ui:260 msgid "_Window" msgstr "Janela" #: src/iptux/resources/gtk/menus.ui:118 src/iptux/resources/gtk/menus.ui:263 msgid "_Transmission" msgstr "_Transmissão" #: src/iptux/resources/gtk/menus.ui:122 src/iptux/resources/gtk/menus.ui:267 msgid "_Shared Management" msgstr "Gestor de compartilhamento" #: src/iptux/resources/gtk/menus.ui:126 src/iptux/resources/gtk/menus.ui:271 msgid "_Chat Log" msgstr "Registo do _chat" #: src/iptux/resources/gtk/menus.ui:130 src/iptux/resources/gtk/menus.ui:275 msgid "_System Log" msgstr "Registo do _sistema" #: src/iptux/resources/gtk/menus.ui:136 src/iptux/resources/gtk/menus.ui:281 msgid "Close Window" msgstr "Fechar janela" #: src/iptux/resources/gtk/menus.ui:142 src/iptux/resources/gtk/menus.ui:287 msgid "_Help" msgstr "Ajuda" #: src/iptux/resources/gtk/menus.ui:145 src/iptux/resources/gtk/menus.ui:290 msgid "_About" msgstr "Sobre" #: src/iptux/resources/gtk/menus.ui:149 src/iptux/resources/gtk/menus.ui:294 msgid "Report Bug" msgstr "Relatar uma falha" #: src/iptux/resources/gtk/menus.ui:153 src/iptux/resources/gtk/menus.ui:298 msgid "What's New" msgstr "Novidades" #: src/iptux/resources/gtk/menus.ui:318 msgid "Open This File" msgstr "Abrir este ficheiro" #: src/iptux/resources/gtk/menus.ui:322 msgid "Open Containing Folder" msgstr "Abrir esta pasta" #: src/iptux/resources/gtk/menus.ui:326 msgid "Terminate Task" msgstr "Terminar tarefa" #: src/iptux/resources/gtk/menus.ui:330 msgid "Terminate All" msgstr "Terminar tudo" #: src/iptux/resources/gtk/menus.ui:334 msgid "Clear Tasklist" msgstr "Limpar a lista de tarefas" #: src/iptux/resources/gtk/menus.ui:346 msgid "Refuse All" msgstr "Recusar tudo" #: src/main/iptux.cpp:149 msgid "- A software for sharing in LAN" msgstr "- Um software para compartilhamento via LAN" #: src/main/iptux.cpp:152 #, c-format msgid "option parsing failed: %s\n" msgstr "processamento da opção falhou: %s\n" #~ msgid "Can't find any available web browser!\n" #~ msgstr "Nenhum navegador encontrado!\n" #~ msgid "chat;talk;im;message;ipmsg;feige;" #~ msgstr "chat;talk;im;message;ipmsg;feige;lan;conversa;" #~ msgid "It can:" #~ msgstr "Pode:" iptux-0.9.4/po/pt_BR.po000066400000000000000000001042341475473122500146770ustar00rootroot00000000000000# Brazilian Portuguese translation for iptux # Copyright (c) 2011 Rosetta Contributors and Canonical Ltd 2011 # This file is distributed under the same license as the iptux package. # FIRST AUTHOR , 2011. # msgid "" msgstr "" "Project-Id-Version: iptux\n" "Report-Msgid-Bugs-To: https://github.com/iptux-src/iptux/issues/new\n" "POT-Creation-Date: 2025-02-17 13:35-0800\n" "PO-Revision-Date: 2021-11-23 16:33+0000\n" "Last-Translator: inkhorn \n" "Language-Team: Portuguese (Brazil) \n" "Language: pt_BR\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n > 1;\n" "X-Generator: Weblate 4.10-dev\n" "X-Launchpad-Export-Date: 2018-01-24 12:00+0000\n" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:6 msgid "iptux" msgstr "iptux" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:7 msgid "LAN communication software" msgstr "Software de comunicação via LAN" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:17 #, fuzzy msgid "iptux is an “IP Messenger” client. The features of iptux include:" msgstr "iptux é um cliente do \"IP Messenger\"." #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:21 msgid "auto-detect other clients on the intranet." msgstr "detectar automaticamente outros clientes na intranet." #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:22 #, fuzzy msgid "send/recv messages to other clients." msgstr "enviar mensagens a outros clientes." #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:23 #, fuzzy msgid "send/recv files to other clients." msgstr "enviar arquivos para outros clientes." #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:24 msgid "share your files to other cliens (with optional password protection)." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:26 msgid "" "It is (supposedly) compatible with 飞鸽传书 (Feige) and 飞秋 (FeiQ) from " "China, and with the original “IP Messenger” clients from Japan, including " "g2ipmsg and xipmsg in Debian." msgstr "" "Além disso é (supostamente) compatível com 飞鸽传书 (Feige) e 飞秋 (FeiQ) da " "China e com o cliente original “IP Messenger” do Japão, incluindo g2ipmsg e " "xipmsg no Debian." #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:38 msgid "The Iptux main window." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:42 msgid "The Iptux chat window." msgstr "" #: src/iptux-core/CoreThread.cpp:172 #, c-format msgid "" "Fatal Error!! Failed to create new socket!\n" "%s" msgstr "" "Erro Fatal!! Falha ao criar novo Socket!\n" "%s" #: src/iptux-core/CoreThread.cpp:188 #, c-format msgid "" "Fatal Error!! Failed to bind the TCP port(%s:%d)!\n" "%s" msgstr "" "Erro Fatal!! Falha ao conectar à Porta TCP(%s:%d)!\n" "%s" #: src/iptux-core/CoreThread.cpp:201 #, c-format msgid "" "Fatal Error!! Failed to bind the UDP port(%s:%d)!\n" "%s" msgstr "" "Erro Fatal!! Falha ao conectar à Porta UDP(%s:%d)!\n" "%s" #: src/iptux-core/CoreThread.cpp:461 src/iptux-core/CoreThread.cpp:495 #: src/iptux-core/internal/RecvFileData.cpp:142 #: src/iptux-core/internal/RecvFileData.cpp:204 #, c-format msgid "" "Fatal Error!!\n" "Failed to create new socket!\n" "%s" msgstr "" "Erro Fatal!!\n" "Falha ao criar um novo Socket!\n" "%s" #: src/iptux-core/Models.cpp:172 msgid "Empty Message" msgstr "Mensagem sem conteúdo" #: src/iptux-core/Models.cpp:250 msgid "Received an image" msgstr "Recebeu uma imagem" #: src/iptux-core/internal/AnalogFS.cpp:93 #: src/iptux-core/internal/AnalogFS.cpp:98 #, c-format msgid "Open() file \"%s\" failed, %s" msgstr "Open() arquivo \"%s\" falhou, %s" #: src/iptux-core/internal/AnalogFS.cpp:117 #, c-format msgid "Stat64() file \"%s\" failed, %s" msgstr "Stat64() arquivo \"%s\" falhou, %s" #: src/iptux-core/internal/AnalogFS.cpp:138 #, c-format msgid "Mkdir() directory \"%s\" failed, %s" msgstr "Mkdir() pasta \"%s\" falhou, %s" #: src/iptux-core/internal/AnalogFS.cpp:164 #, c-format msgid "Opendir() directory \"%s\" failed, %s" msgstr "Opendir() pasta \"%s\" falhou, %s" #: src/iptux-core/internal/Command.cpp:226 msgid "Your pal didn't receive the packet. He or she is offline maybe." msgstr "Outro participante não recebeu o pacote. Talvez está offline." #: src/iptux-core/internal/CommandMode.cpp:39 #, c-format msgid "unknown command mode: %d" msgstr "modo de comando desconhecido: %d" #: src/iptux-core/internal/RecvFileData.cpp:117 msgid "receive" msgstr "receber" #: src/iptux-core/internal/RecvFileData.cpp:124 #: src/iptux-core/internal/RecvFileData.cpp:253 #: src/iptux-core/internal/SendFileData.cpp:108 #: src/iptux-core/internal/SendFileData.cpp:193 msgid "Unknown" msgstr "Desconhecido" #: src/iptux-core/internal/RecvFileData.cpp:175 #, fuzzy, c-format msgid "" "Failed to receive the file \"%s\" from %s! expect length %jd, received %jd" msgstr "" "Falha ao receber o arquivo \"%s\" de %s! tamanho previsto %lld, recebido %lld" #: src/iptux-core/internal/RecvFileData.cpp:180 #, c-format msgid "Receive the file \"%s\" from %s successfully!" msgstr "Recebeu um arquivo \"%s\" de %s com sucesso!" #: src/iptux-core/internal/RecvFileData.cpp:320 #, c-format msgid "Failed to receive the directory \"%s\" from %s!" msgstr "Falha ao receber a pasta \"%s\" de %s!" #: src/iptux-core/internal/RecvFileData.cpp:323 #, c-format msgid "Receive the directory \"%s\" from %s successfully!" msgstr "Recebeu a pasta \"%s\" de %s com sucesso!" #: src/iptux-core/internal/SendFileData.cpp:101 msgid "send" msgstr "enviar" #: src/iptux-core/internal/SendFileData.cpp:137 #, c-format msgid "Failed to send the file \"%s\" to %s!" msgstr "Falha ao enviar o arquivo \"%s\" para %s!" #: src/iptux-core/internal/SendFileData.cpp:142 #, c-format msgid "Send the file \"%s\" to %s successfully!" msgstr "Enviou o arquivo \"%s\" para %s com sucesso!" #: src/iptux-core/internal/SendFileData.cpp:265 #, c-format msgid "Failed to send the directory \"%s\" to %s!" msgstr "Falha ao enviar a pasta \"%s\" para %s!" #: src/iptux-core/internal/SendFileData.cpp:270 #, c-format msgid "Send the directory \"%s\" to %s successfully!" msgstr "Enviou a pasta \"%s\" para %s com sucesso!" #: src/iptux-core/internal/UdpData.cpp:92 #: src/iptux-core/internal/UdpData.cpp:93 #: src/iptux-core/internal/UdpData.cpp:443 #: src/iptux-core/internal/UdpData.cpp:484 msgid "mysterious" msgstr "desconhecido" #: src/iptux-utils/utils.cpp:880 #, c-format msgid "stat file \"%s\" failed: %s" msgstr "stat arquivo \"%s\" falhou: %s" #: src/iptux-utils/utils.cpp:888 #, c-format msgid "path %s is not file or directory: st_mode(%x)" msgstr "o caminho %s não é um arquivo ou uma pasta: st_mode(%x)" #: src/iptux-utils/utils.cpp:895 #, c-format msgid "opendir on \"%s\" failed: %s" msgstr "opendir no \"%s\" falhou: %s" #: src/iptux/AboutDialog.cpp:39 msgid "TRANSLATOR NAME" msgstr "inkhorn" #: src/iptux/AboutDialog.cpp:53 msgid "Thanks to" msgstr "Agradecimentos" #: src/iptux/AppIndicator.cpp:40 src/iptux/MainWindow.cpp:505 #: src/iptux/MainWindow.cpp:507 msgid "Iptux" msgstr "Iptux" #: src/iptux/Application.cpp:54 msgid "Loading the process successfully!" msgstr "Carregou o processo com sucesso!" #: src/iptux/Application.cpp:274 #, c-format msgid "New Message from %s" msgstr "Nova mensagem de %s" #: src/iptux/Application.cpp:287 #, c-format msgid "New File from %s" msgstr "Nova arquivo de %s" #: src/iptux/Application.cpp:296 msgid "Receiving File Finished" msgstr "O recebimento do arquivo concluído" #: src/iptux/Application.cpp:300 msgid "file info no longer exist" msgstr "as informações do arquivo não estão disponíveis" #: src/iptux/Darwin.cpp:16 #, c-format msgid "Couldn’t load icon: %s" msgstr "Não foi possível carregar o ícone: %s" #: src/iptux/DataSettings.cpp:46 msgid "Personal" msgstr "Pessoal" #: src/iptux/DataSettings.cpp:48 msgid "System" msgstr "Sistema" #: src/iptux/DataSettings.cpp:50 msgid "Network" msgstr "Rede" #: src/iptux/DataSettings.cpp:89 src/iptux/DataSettings.cpp:98 msgid "The program needs to be restarted to take effect!" msgstr "" #: src/iptux/DataSettings.cpp:143 msgid "Preferences" msgstr "Preferências" #: src/iptux/DataSettings.cpp:143 src/iptux/RevisePal.cpp:109 #: src/iptux/dialog.cpp:107 src/iptux/dialog.cpp:170 msgid "_OK" msgstr "_OK" #: src/iptux/DataSettings.cpp:144 msgid "_Apply" msgstr "_Aplicar" #: src/iptux/DataSettings.cpp:144 src/iptux/DataSettings.cpp:1348 #: src/iptux/DataSettings.cpp:1395 src/iptux/DialogBase.cpp:359 #: src/iptux/DialogBase.cpp:918 src/iptux/RevisePal.cpp:110 #: src/iptux/ShareFile.cpp:419 src/iptux/callback.cpp:87 #: src/iptux/dialog.cpp:171 src/iptux/dialog.cpp:230 msgid "_Cancel" msgstr "_Cancelar" #: src/iptux/DataSettings.cpp:169 msgid "Your _nickname:" msgstr "Seu _nome:" #: src/iptux/DataSettings.cpp:176 msgid "Please input your nickname!" msgstr "Por favor, digite seu nome!" #: src/iptux/DataSettings.cpp:182 msgid "Your _group name:" msgstr "O nome do seu _grupo:" #: src/iptux/DataSettings.cpp:189 msgid "Please input your group name!" msgstr "Por favor, digite o nome do seu grupo!" #: src/iptux/DataSettings.cpp:195 msgid "Your _face picture:" msgstr "Sua _foto:" #: src/iptux/DataSettings.cpp:213 msgid "_Save files to: " msgstr "_Salvar arquivos em: " #: src/iptux/DataSettings.cpp:226 msgid "Photo" msgstr "Foto" #: src/iptux/DataSettings.cpp:238 msgid "Signature" msgstr "Assinatura" #: src/iptux/DataSettings.cpp:271 msgid "Port:" msgstr "" #: src/iptux/DataSettings.cpp:278 msgid "Any port number between 1024 and 65535, default is 2425" msgstr "" #: src/iptux/DataSettings.cpp:287 msgid "Candidate network encodings:" msgstr "Sugestão de codificação da rede:" #: src/iptux/DataSettings.cpp:294 msgid "Candidate network encodings, separated by \",\"" msgstr "Sugestão de codificação da rede, separado por \",\"" #: src/iptux/DataSettings.cpp:301 msgid "Preferred network encoding:" msgstr "Codificação da rede preferida:" #: src/iptux/DataSettings.cpp:308 msgid "" "Preference network coding (You should be aware of what you are doing if you " "want to modify it.)" msgstr "" "Codificação da rede preferida (para modificá-lo certifique-se que sabe o que " "está fazendo.)" #: src/iptux/DataSettings.cpp:316 msgid "Pal's default face picture:" msgstr "A foto do participante:" #: src/iptux/DataSettings.cpp:334 msgid "Panel font:" msgstr "Fonte do painel:" #: src/iptux/DataSettings.cpp:346 msgid "Automatically open the chat dialog" msgstr "Automaticamente abre o diálogo de conversa" #: src/iptux/DataSettings.cpp:354 msgid "Automatically hide the panel after login" msgstr "Automaticamente esconde o painel após o login" #: src/iptux/DataSettings.cpp:362 msgid "Automatically open the File Transmission Management" msgstr "Automaticamente abre o Gerenciador de Transmissão de Arquivo" #: src/iptux/DataSettings.cpp:370 msgid "Use the 'Enter' key to send message" msgstr "Use a tecla 'Enter' para enviar mensagem" #: src/iptux/DataSettings.cpp:378 msgid "Automatically clean up the chat history" msgstr "Automaticamente limpa o histórico de conversa" #: src/iptux/DataSettings.cpp:385 msgid "Save the chat history" msgstr "Salva o histórico da conversa" #: src/iptux/DataSettings.cpp:393 msgid "Use the Blacklist (NOT recommended)" msgstr "Use a ListaNegra (não recomendado)" #: src/iptux/DataSettings.cpp:401 msgid "Filter the request of sharing files" msgstr "Filtra o pedido de compartilhamento de arquivos" #: src/iptux/DataSettings.cpp:408 msgid "Hide the taskbar when the main window is minimized" msgstr "" #: src/iptux/DataSettings.cpp:432 msgid "From:" msgstr "De:" #: src/iptux/DataSettings.cpp:438 msgid "Beginning of the IP(v4) section" msgstr "Início da seção IP(v4)" #: src/iptux/DataSettings.cpp:442 msgid "To:" msgstr "Para:" #: src/iptux/DataSettings.cpp:448 msgid "End of the IP(v4) section" msgstr "Fim da seção IP(v4)" #: src/iptux/DataSettings.cpp:456 msgid "Add" msgstr "Adicionar" #: src/iptux/DataSettings.cpp:461 msgid "Delete" msgstr "Excluir" #: src/iptux/DataSettings.cpp:468 msgid "Added IP(v4) Section:" msgstr "Seção IP(v4) adicionada:" #: src/iptux/DataSettings.cpp:487 msgid "Import" msgstr "Importar" #: src/iptux/DataSettings.cpp:491 msgid "Export" msgstr "Exportar" #: src/iptux/DataSettings.cpp:495 src/iptux/TransWindow.cpp:171 msgid "Clear" msgstr "Limpar" #: src/iptux/DataSettings.cpp:706 msgid "From" msgstr "De" #: src/iptux/DataSettings.cpp:713 msgid "To" msgstr "Para" #: src/iptux/DataSettings.cpp:720 msgid "Description" msgstr "Descrição" #: src/iptux/DataSettings.cpp:736 msgid "Please select download folder" msgstr "Por favor, escolha uma pasta de download" #: src/iptux/DataSettings.cpp:758 msgid "Select Font" msgstr "Selecione fonte" #: src/iptux/DataSettings.cpp:872 src/iptux/DataSettings.cpp:874 #: src/iptux/DataSettings.cpp:878 msgid "Port must be a number between 1024 and 65535" msgstr "" #: src/iptux/DataSettings.cpp:1019 src/iptux/DataSettings.cpp:1050 #, c-format msgid "" "Fopen() file \"%s\" failed!\n" "%s" msgstr "" "Fopen() arquivo \"%s\" falhou!\n" "%s" #: src/iptux/DataSettings.cpp:1150 src/iptux/RevisePal.cpp:419 msgid "Please select a face picture" msgstr "Por favor, selecione uma imagem do perfil" #: src/iptux/DataSettings.cpp:1172 msgid "Please select a personal photo" msgstr "Por favor, selecione uma foto" #: src/iptux/DataSettings.cpp:1241 src/iptux/DataSettings.cpp:1248 #: src/iptux/DetectPal.cpp:75 #, c-format msgid "" "\n" "Illegal IP(v4) address: %s!" msgstr "" "\n" "Endereço IP(v4) inválido: %s!" #: src/iptux/DataSettings.cpp:1346 msgid "Please select a file to import data" msgstr "Por favor, selecione um arquivo para importar dados" #: src/iptux/DataSettings.cpp:1347 src/iptux/DialogBase.cpp:358 #: src/iptux/ShareFile.cpp:418 src/iptux/callback.cpp:86 msgid "_Open" msgstr "Abrir" #: src/iptux/DataSettings.cpp:1394 msgid "Save data to file" msgstr "Salvar dados para arquivo" #: src/iptux/DataSettings.cpp:1395 src/iptux/DialogBase.cpp:919 #: src/iptux/dialog.cpp:231 msgid "_Save" msgstr "_Salvar" #: src/iptux/DetectPal.cpp:70 #, c-format msgid "The notification has been sent to %s." msgstr "A notificação foi enviada para %s." #: src/iptux/DialogBase.cpp:214 #, c-format msgid "%s To Send." msgstr "%s para enviar." #: src/iptux/DialogBase.cpp:272 msgid "Close" msgstr "Fechar" #: src/iptux/DialogBase.cpp:276 src/iptux/DialogGroup.cpp:375 msgid "Send" msgstr "Enviar" #: src/iptux/DialogBase.cpp:307 msgid "Chat History" msgstr "Histórico da conversa" #: src/iptux/DialogBase.cpp:350 msgid "Choose enclosure files" msgstr "Escolha arquivos para anexar" #: src/iptux/DialogBase.cpp:353 msgid "Choose enclosure folders" msgstr "Escolha pastas para anexar" #: src/iptux/DialogBase.cpp:593 msgid "Remove Selected" msgstr "Remover selecionado" #: src/iptux/DialogBase.cpp:648 msgid "File to send." msgstr "Arquivo para enviar." #: src/iptux/DialogBase.cpp:653 msgid "Sending progress." msgstr "O progresso do envio." #: src/iptux/DialogBase.cpp:656 msgid "Dirs" msgstr "Pastas" #: src/iptux/DialogBase.cpp:659 msgid "Files" msgstr "Arquivos" #: src/iptux/DialogBase.cpp:662 src/iptux/DialogPeer.cpp:565 msgid "Detail" msgstr "Detalhes" #: src/iptux/DialogBase.cpp:712 msgid "PeerName" msgstr "Nome do participante" #: src/iptux/DialogBase.cpp:719 src/iptux/DialogPeer.cpp:716 msgid "Name" msgstr "Nome" #: src/iptux/DialogBase.cpp:725 src/iptux/DialogPeer.cpp:652 #: src/iptux/DialogPeer.cpp:722 src/iptux/ShareFile.cpp:280 #: src/iptux/TransWindow.cpp:271 msgid "Size" msgstr "Tamanho" #: src/iptux/DialogBase.cpp:731 msgid "Path" msgstr "Caminho" #: src/iptux/DialogBase.cpp:792 msgid "Sending Progress." msgstr "O progresso de envio." #: src/iptux/DialogBase.cpp:795 #, c-format msgid "%s of %s Sent." msgstr "%s de %s enviado." #: src/iptux/DialogBase.cpp:802 src/iptux/DialogPeer.cpp:835 msgid "Mission Completed!" msgstr "Concluído!" #: src/iptux/DialogBase.cpp:845 src/iptux/DialogBase.cpp:917 msgid "Save Image" msgstr "" #: src/iptux/DialogBase.cpp:850 msgid "Copy Image" msgstr "" #: src/iptux/DialogGroup.cpp:285 msgid "Member" msgstr "Membro" #: src/iptux/DialogGroup.cpp:382 msgid "Pals" msgstr "Participantes" #: src/iptux/DialogGroup.cpp:480 msgid "Select All" msgstr "Selecionar tudo" #: src/iptux/DialogGroup.cpp:485 msgid "Reverse Select" msgstr "Seleção reversa" #: src/iptux/DialogGroup.cpp:490 msgid "Clear Up" msgstr "Limpar" #: src/iptux/DialogGroup.cpp:728 #, c-format msgid "Talk with the group %s" msgstr "Converse com o grupo %s" #: src/iptux/DialogPeer.cpp:132 #, c-format msgid "Talk with %s(%s) IP:%s" msgstr "Converse com %s(%s) IP:%s" #: src/iptux/DialogPeer.cpp:305 msgid "Info." msgstr "Detalhes" #: src/iptux/DialogPeer.cpp:337 #, c-format msgid "Version: %s\n" msgstr "Versão: %s\n" #: src/iptux/DialogPeer.cpp:339 #, c-format msgid "Nickname: %s@%s\n" msgstr "Nome: %s@%s\n" #: src/iptux/DialogPeer.cpp:342 #, c-format msgid "Nickname: %s\n" msgstr "Nome: %s\n" #: src/iptux/DialogPeer.cpp:344 #, c-format msgid "User: %s\n" msgstr "Usuário: %s\n" #: src/iptux/DialogPeer.cpp:345 #, c-format msgid "Host: %s\n" msgstr "Host: %s\n" #: src/iptux/DialogPeer.cpp:348 #, c-format msgid "Address: %s(%s)\n" msgstr "Endereço: %s(%s)\n" #: src/iptux/DialogPeer.cpp:350 #, c-format msgid "Address: %s\n" msgstr "Endereço: %s\n" #: src/iptux/DialogPeer.cpp:353 msgid "Compatibility: Microsoft\n" msgstr "Compatível com: Microsoft\n" #: src/iptux/DialogPeer.cpp:355 msgid "Compatibility: GNU/Linux\n" msgstr "Compatível com: GNU/Linux\n" #: src/iptux/DialogPeer.cpp:357 #, c-format msgid "System coding: %s\n" msgstr "Codificação do sistema: %s\n" #: src/iptux/DialogPeer.cpp:362 msgid "Signature:\n" msgstr "Assinatura:\n" #: src/iptux/DialogPeer.cpp:369 msgid "" "\n" "Photo:\n" msgstr "" "\n" "Foto:\n" #: src/iptux/DialogPeer.cpp:460 msgid "Please select a picture to insert the buffer" msgstr "Por favor, selecione uma foto para inserir no buffer" #: src/iptux/DialogPeer.cpp:486 src/iptux/resources/gtk/menus.ui:83 #: src/iptux/resources/gtk/menus.ui:228 #, fuzzy msgid "Insert Image" msgstr "Inserir foto" #: src/iptux/DialogPeer.cpp:502 msgid "Enclosure." msgstr "Anexo." #: src/iptux/DialogPeer.cpp:547 msgid "Files to be received" msgstr "Arquivos para receber" #: src/iptux/DialogPeer.cpp:551 msgid "Receiving progress." msgstr "O progresso do recebimento." #: src/iptux/DialogPeer.cpp:554 msgid "Accept" msgstr "Aceitar" #: src/iptux/DialogPeer.cpp:560 src/iptux/dialog.cpp:63 #: src/iptux/resources/gtk/menus.ui:342 msgid "Refuse" msgstr "Recusar" #: src/iptux/DialogPeer.cpp:596 msgid "File received." msgstr "Arquivo recebido." #: src/iptux/DialogPeer.cpp:639 src/iptux/DialogPeer.cpp:710 msgid "Source" msgstr "Fonte" #: src/iptux/DialogPeer.cpp:646 msgid "SaveAs" msgstr "SalvarComo" #: src/iptux/DialogPeer.cpp:818 src/iptux/DialogPeer.cpp:884 msgid "Receiving Progress." msgstr "O progresso do recebimento." #: src/iptux/DialogPeer.cpp:821 src/iptux/DialogPeer.cpp:887 #, c-format msgid "%s to Receive." msgstr "%s para receber." #: src/iptux/DialogPeer.cpp:825 src/iptux/DialogPeer.cpp:891 #, c-format msgid "%s Of %s Received." msgstr "%s de %s recebido(s)." #: src/iptux/LogSystem.cpp:71 #, c-format msgid "Recevied-From: Nickname:%s User:%s Host:%s" msgstr "Recebido de: Nome:%s Usuário:%s Host:%s" #: src/iptux/LogSystem.cpp:76 #, c-format msgid "Send-To: Nickname:%s User:%s Host:%s" msgstr "Enviado para: Nome:%s Usuário:%s Host:%s" #: src/iptux/LogSystem.cpp:80 msgid "Send-Broadcast" msgstr "Enviar transmissão" #: src/iptux/LogSystem.cpp:99 #, c-format msgid "User:%s Host:%s" msgstr "Usuário:%s Host:%s" #: src/iptux/MainWindow.cpp:570 msgid "Pals Online: 0" msgstr "Participantes online: 0" #: src/iptux/MainWindow.cpp:655 msgid "Search Pals" msgstr "Procurar outros participantes" #: src/iptux/MainWindow.cpp:768 msgid "Nickname" msgstr "Nome" #: src/iptux/MainWindow.cpp:778 msgid "Group" msgstr "Grupo" #: src/iptux/MainWindow.cpp:784 src/iptux/TransWindow.cpp:258 msgid "IPv4" msgstr "IPv4" #: src/iptux/MainWindow.cpp:790 msgid "User" msgstr "Usuário" #: src/iptux/MainWindow.cpp:796 src/iptux/resources/gtk/MainWindow.ui:81 msgid "Host" msgstr "Host" #: src/iptux/MainWindow.cpp:935 #, c-format msgid "Pals Online: %d" msgstr "Participantes online: %d" #: src/iptux/RevisePal.cpp:109 msgid "Change Pal's Information" msgstr "Alterar as informações de participantes" #: src/iptux/RevisePal.cpp:134 msgid "Pal's nickname:" msgstr "Nome do participante:" #: src/iptux/RevisePal.cpp:140 msgid "Please input pal's new nickname!" msgstr "Por favor, digite o novo nome do participante!" #: src/iptux/RevisePal.cpp:146 msgid "Pal's group name:" msgstr "Nome do grupo de participante:" #: src/iptux/RevisePal.cpp:152 msgid "Please input pal's new group name!" msgstr "Por favor, digite o novo nome do grupo!" #: src/iptux/RevisePal.cpp:158 msgid "System coding:" msgstr "Codificação do sistema:" #: src/iptux/RevisePal.cpp:164 msgid "Be SURE to know what you are doing!" msgstr "Tem cuidado com o que você está fazendo!" #: src/iptux/RevisePal.cpp:170 msgid "Pal's face picture:" msgstr "Foto do participante:" #: src/iptux/RevisePal.cpp:184 msgid "Be compatible with iptux's protocol (DANGEROUS)" msgstr "Seja compatível com o protocolo do iptux (ATENÇÃO)" #: src/iptux/ShareFile.cpp:104 msgid "Shared Files Management" msgstr "Gerenciador de arquivos compartilhados" #: src/iptux/ShareFile.cpp:105 msgid "OK" msgstr "OK" #: src/iptux/ShareFile.cpp:106 msgid "Apply" msgstr "Aplicar" #: src/iptux/ShareFile.cpp:107 msgid "Cancel" msgstr "Cancelar" #: src/iptux/ShareFile.cpp:160 msgid "Add Files" msgstr "Adicionar arquivos" #: src/iptux/ShareFile.cpp:163 msgid "Add Folders" msgstr "Adicionar pastas" #: src/iptux/ShareFile.cpp:166 msgid "Delete Resources" msgstr "Eliminar recursos" #: src/iptux/ShareFile.cpp:169 msgid "Clear Password" msgstr "Remover a senha" #: src/iptux/ShareFile.cpp:172 msgid "Set Password" msgstr "Definir a senha" #: src/iptux/ShareFile.cpp:229 src/iptux/ShareFile.cpp:373 msgid "regular" msgstr "regular" #: src/iptux/ShareFile.cpp:233 src/iptux/ShareFile.cpp:377 msgid "directory" msgstr "pasta" #: src/iptux/ShareFile.cpp:237 src/iptux/ShareFile.cpp:381 msgid "unknown" msgstr "desconhecido" #: src/iptux/ShareFile.cpp:270 msgid "File" msgstr "Arquivo" #: src/iptux/ShareFile.cpp:286 msgid "Type" msgstr "Tipo" #: src/iptux/ShareFile.cpp:411 msgid "Choose the files to share" msgstr "Escolha os arquivos para compartilhar" #: src/iptux/ShareFile.cpp:414 msgid "Choose the folders to share" msgstr "Escolha as pastas para compartilhar" #: src/iptux/TransWindow.cpp:86 msgid "Files Transmission Management" msgstr "Gerenciador da transmissão de arquivos" #: src/iptux/TransWindow.cpp:241 msgid "State" msgstr "Status" #: src/iptux/TransWindow.cpp:247 msgid "Task" msgstr "Tarefa" #: src/iptux/TransWindow.cpp:253 msgid "Peer" msgstr "Participante" #: src/iptux/TransWindow.cpp:265 msgid "Filename" msgstr "Nome do arquivo" #: src/iptux/TransWindow.cpp:277 msgid "Completed" msgstr "Concluído" #: src/iptux/TransWindow.cpp:284 msgid "Progress" msgstr "Progresso" #: src/iptux/TransWindow.cpp:291 msgid "Cost" msgstr "Tempo" #: src/iptux/TransWindow.cpp:297 msgid "Remaining" msgstr "Restante" #: src/iptux/TransWindow.cpp:303 msgid "Rate" msgstr "Velocidade" #: src/iptux/TransWindow.cpp:331 msgid "The path you want to open not exist!" msgstr "O caminho que você quer abrir não existe!" #: src/iptux/TransWindow.cpp:405 msgid "The file you want to open not exist!" msgstr "O arquivo que você quer abrir não existe!" #: src/iptux/TransWindow.cpp:406 msgid "iptux Error" msgstr "Erro no iptux" #: src/iptux/UiCoreThread.cpp:254 src/iptux/UiCoreThread.cpp:278 #: src/iptux/UiCoreThread.cpp:377 src/iptux/UiCoreThread.cpp:399 msgid "Others" msgstr "Outros" #: src/iptux/UiCoreThread.cpp:419 msgid "Broadcast" msgstr "Transmissão" #: src/iptux/UiHelper.cpp:28 #, c-format msgid "Can't convert path to uri: %s, reason: %s" msgstr "" #: src/iptux/UiHelper.cpp:39 #, c-format msgid "Can't open path: %s, reason: %s" msgstr "" #: src/iptux/UiHelper.cpp:68 #, c-format msgid "Can't open URL: %s, reason: %s" msgstr "" #: src/iptux/UiHelper.cpp:188 msgid "Information" msgstr "Informação" #: src/iptux/UiHelper.cpp:218 msgid "Warning" msgstr "Aviso" #: src/iptux/UiModels.cpp:604 #, c-format msgid "Version: %s" msgstr "Versão: %s" #: src/iptux/UiModels.cpp:608 #, c-format msgid "Nickname: %s@%s" msgstr "Nome: %s@%s" #: src/iptux/UiModels.cpp:611 #, c-format msgid "Nickname: %s" msgstr "Nome: %s" #: src/iptux/UiModels.cpp:615 #, c-format msgid "User: %s" msgstr "Usuário: %s" #: src/iptux/UiModels.cpp:618 #, c-format msgid "Host: %s" msgstr "Host: %s" #: src/iptux/UiModels.cpp:623 #, c-format msgid "Address: %s(%s)" msgstr "Endereço: %s(%s)" #: src/iptux/UiModels.cpp:625 #, c-format msgid "Address: %s" msgstr "Endereço: %s" #: src/iptux/UiModels.cpp:630 msgid "Compatibility: Microsoft" msgstr "Compatível com: Microsoft" #: src/iptux/UiModels.cpp:632 msgid "Compatibility: GNU/Linux" msgstr "Compatível com: GNU/Linux" #: src/iptux/UiModels.cpp:636 #, c-format msgid "System coding: %s" msgstr "Codificação do sistema: %s" #: src/iptux/UiModels.cpp:641 msgid "Signature:" msgstr "Assinatura:" #: src/iptux/UiModels.cpp:744 msgid "" msgstr "" #: src/iptux/UiModels.cpp:799 msgid "[IMG]" msgstr "" #: src/iptux/dialog.cpp:39 msgid "" "File transfer has not been completed.\n" "Are you sure to cancel and quit?" msgstr "" "A transferência do arquivo não foi concluída.\n" "Você quer cancelar e sair?" #: src/iptux/dialog.cpp:42 msgid "Confirm Exit" msgstr "Confirmar saída" #: src/iptux/dialog.cpp:62 src/iptux/resources/gtk/MainWindow.ui:12 #: src/iptux/resources/gtk/menus.ui:98 src/iptux/resources/gtk/menus.ui:243 msgid "Request Shared Resources" msgstr "Solicitar recursos compartilhados" #: src/iptux/dialog.cpp:62 msgid "Agree" msgstr "Concordo" #: src/iptux/dialog.cpp:78 #, c-format msgid "" "Your pal (%s)[%s]\n" "is requesting to get your shared resources,\n" "Do you agree?" msgstr "" "Outro participante (%s)[%s]\n" "está solicitando para compartilhar seus recursos,\n" "Você aceita?" #: src/iptux/dialog.cpp:106 msgid "Access Password" msgstr "Senha de acesso" #: src/iptux/dialog.cpp:113 msgid "Please input the password for the shared files behind" msgstr "Por favor, digite a senha para arquivos compartilhados" #: src/iptux/dialog.cpp:127 #, c-format msgid "(%s)[%s]Password:" msgstr "(%s)[%s]Senha:" #: src/iptux/dialog.cpp:146 src/iptux/dialog.cpp:207 msgid "" "\n" "Empty Password!" msgstr "" "\n" "Senha em branco!" #: src/iptux/dialog.cpp:170 msgid "Enter a New Password" msgstr "Digite uma nova senha" #: src/iptux/dialog.cpp:178 msgid "Password: " msgstr "Senha: " #: src/iptux/dialog.cpp:187 msgid "Repeat: " msgstr "Outra vez: " #: src/iptux/dialog.cpp:202 msgid "" "\n" "Password Mismatched!" msgstr "" "\n" "Senhas não são iguais!" #: src/iptux/dialog.cpp:229 msgid "Please select a folder to save files." msgstr "Por favor, escolha uma pasta para salvar arquivos." #: src/iptux/resources/gtk/AboutDialog.ui:11 msgid "" "Copyright © 2008–2009, Jally\n" "Copyright © 2013–2015,2017–2021, LI Daobing" msgstr "" "Direitos autorais © 2008–2009, Jally\n" "Direitos autorais © 2013–2015,2017–2021, LI Daobing" #: src/iptux/resources/gtk/AboutDialog.ui:13 msgid "A GTK based LAN messenger." msgstr "Mensageiro LAN baseado no GTK." #: src/iptux/resources/gtk/AppIndicator.ui:6 #, fuzzy msgid "Open Iptux" msgstr "Iptux" #: src/iptux/resources/gtk/AppIndicator.ui:12 #: src/iptux/resources/gtk/menus.ui:6 src/iptux/resources/gtk/menus.ui:306 msgid "_Preferences" msgstr "_Preferências" #: src/iptux/resources/gtk/AppIndicator.ui:16 #: src/iptux/resources/gtk/menus.ui:10 src/iptux/resources/gtk/menus.ui:310 msgid "_Quit" msgstr "Sair" #: src/iptux/resources/gtk/DetectPal.ui:7 msgid "Detect pal" msgstr "Descobrir participantes" #: src/iptux/resources/gtk/DetectPal.ui:15 msgid "Detect" msgstr "Descobrir" #: src/iptux/resources/gtk/DetectPal.ui:61 msgid "Please input an IP address (IPv4 only):" msgstr "Por favor, digite endereço IP (somente IPv4):" #: src/iptux/resources/gtk/MainWindow.ui:8 src/iptux/resources/gtk/menus.ui:109 #: src/iptux/resources/gtk/menus.ui:254 msgid "Send Message" msgstr "Enviar mensagem" #: src/iptux/resources/gtk/MainWindow.ui:16 msgid "Change Info" msgstr "Alterar detalhes" #: src/iptux/resources/gtk/MainWindow.ui:20 msgid "Delete Pal" msgstr "Remover participante" #: src/iptux/resources/gtk/MainWindow.ui:26 src/iptux/resources/gtk/menus.ui:31 #: src/iptux/resources/gtk/menus.ui:176 msgid "Sort" msgstr "Ordenar" #: src/iptux/resources/gtk/MainWindow.ui:29 src/iptux/resources/gtk/menus.ui:34 #: src/iptux/resources/gtk/menus.ui:179 msgid "By Nickname" msgstr "Por nome" #: src/iptux/resources/gtk/MainWindow.ui:34 src/iptux/resources/gtk/menus.ui:39 #: src/iptux/resources/gtk/menus.ui:184 #, fuzzy msgid "By Username" msgstr "Por nome" #: src/iptux/resources/gtk/MainWindow.ui:39 src/iptux/resources/gtk/menus.ui:44 #: src/iptux/resources/gtk/menus.ui:189 msgid "By IP" msgstr "Por IP" #: src/iptux/resources/gtk/MainWindow.ui:44 src/iptux/resources/gtk/menus.ui:49 #: src/iptux/resources/gtk/menus.ui:194 #, fuzzy msgid "By Host" msgstr "Host" #: src/iptux/resources/gtk/MainWindow.ui:49 src/iptux/resources/gtk/menus.ui:54 #: src/iptux/resources/gtk/menus.ui:199 msgid "By Last Activity" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:56 src/iptux/resources/gtk/menus.ui:61 #: src/iptux/resources/gtk/menus.ui:206 msgid "Ascending" msgstr "Ascendente" #: src/iptux/resources/gtk/MainWindow.ui:61 src/iptux/resources/gtk/menus.ui:66 #: src/iptux/resources/gtk/menus.ui:211 msgid "Descending" msgstr "Descendente" #: src/iptux/resources/gtk/MainWindow.ui:68 msgid "Info Style" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:71 #, fuzzy msgid "IP" msgstr "IPv4" #: src/iptux/resources/gtk/MainWindow.ui:76 msgid "IP:PORT" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:86 #, fuzzy msgid "Username" msgstr "Usuário" #: src/iptux/resources/gtk/MainWindow.ui:91 #, fuzzy msgid "Version" msgstr "Versão: %s" #: src/iptux/resources/gtk/MainWindow.ui:96 msgid "Last Activity" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:101 #, fuzzy msgid "Last Message" msgstr "Mensagem sem conteúdo" #: src/iptux/resources/gtk/menus.ui:17 src/iptux/resources/gtk/menus.ui:162 msgid "_File" msgstr "Arquivo" #: src/iptux/resources/gtk/menus.ui:19 src/iptux/resources/gtk/menus.ui:164 msgid "_Detect" msgstr "_Descobrir" #: src/iptux/resources/gtk/menus.ui:23 src/iptux/resources/gtk/menus.ui:168 msgid "_Find" msgstr "Encontrar" #: src/iptux/resources/gtk/menus.ui:28 src/iptux/resources/gtk/menus.ui:173 msgid "_View" msgstr "_Vista" #: src/iptux/resources/gtk/menus.ui:73 src/iptux/resources/gtk/menus.ui:218 msgid "_Refresh" msgstr "Atualizar" #: src/iptux/resources/gtk/menus.ui:80 src/iptux/resources/gtk/menus.ui:225 msgid "_Chat" msgstr "_Chat" #: src/iptux/resources/gtk/menus.ui:88 src/iptux/resources/gtk/menus.ui:233 msgid "Attach File" msgstr "Anexar arquivo" #: src/iptux/resources/gtk/menus.ui:92 src/iptux/resources/gtk/menus.ui:237 msgid "Attach Folder" msgstr "Anexar pasta" #: src/iptux/resources/gtk/menus.ui:102 src/iptux/resources/gtk/menus.ui:247 msgid "Clear Chat History" msgstr "Limpar o histórico da conversa" #: src/iptux/resources/gtk/menus.ui:115 src/iptux/resources/gtk/menus.ui:260 msgid "_Window" msgstr "Janela" #: src/iptux/resources/gtk/menus.ui:118 src/iptux/resources/gtk/menus.ui:263 msgid "_Transmission" msgstr "_Transmissão" #: src/iptux/resources/gtk/menus.ui:122 src/iptux/resources/gtk/menus.ui:267 msgid "_Shared Management" msgstr "Gerenciador de compartilhamento" #: src/iptux/resources/gtk/menus.ui:126 src/iptux/resources/gtk/menus.ui:271 msgid "_Chat Log" msgstr "Registro do _chat" #: src/iptux/resources/gtk/menus.ui:130 src/iptux/resources/gtk/menus.ui:275 msgid "_System Log" msgstr "Registro do _sistema" #: src/iptux/resources/gtk/menus.ui:136 src/iptux/resources/gtk/menus.ui:281 msgid "Close Window" msgstr "Fechar janela" #: src/iptux/resources/gtk/menus.ui:142 src/iptux/resources/gtk/menus.ui:287 msgid "_Help" msgstr "Ajuda" #: src/iptux/resources/gtk/menus.ui:145 src/iptux/resources/gtk/menus.ui:290 msgid "_About" msgstr "Sobre" #: src/iptux/resources/gtk/menus.ui:149 src/iptux/resources/gtk/menus.ui:294 msgid "Report Bug" msgstr "Relatar uma falha" #: src/iptux/resources/gtk/menus.ui:153 src/iptux/resources/gtk/menus.ui:298 msgid "What's New" msgstr "Novidades" #: src/iptux/resources/gtk/menus.ui:318 msgid "Open This File" msgstr "Abrir este arquivo" #: src/iptux/resources/gtk/menus.ui:322 msgid "Open Containing Folder" msgstr "Abrir esta pasta" #: src/iptux/resources/gtk/menus.ui:326 msgid "Terminate Task" msgstr "Terminar tarefa" #: src/iptux/resources/gtk/menus.ui:330 msgid "Terminate All" msgstr "Terminar tudo" #: src/iptux/resources/gtk/menus.ui:334 msgid "Clear Tasklist" msgstr "Limpar a lista de tarefas" #: src/iptux/resources/gtk/menus.ui:346 msgid "Refuse All" msgstr "Recusar tudo" #: src/main/iptux.cpp:149 msgid "- A software for sharing in LAN" msgstr "- Um software para compartilhamento via LAN" #: src/main/iptux.cpp:152 #, c-format msgid "option parsing failed: %s\n" msgstr "processamento da opção falhou: %s\n" #~ msgid "Can't find any available web browser!\n" #~ msgstr "Nenhum navegador encontrado!\n" #~ msgid "chat;talk;im;message;ipmsg;feige;" #~ msgstr "chat;talk;im;message;ipmsg;feige;lan;conversa;" #~ msgid "It can:" #~ msgstr "Ele pode:" #~ msgid "Close Chat" #~ msgstr "Fechar chat" #~ msgid "Sound" #~ msgstr "Som" #~ msgid "Activate the sound support" #~ msgstr "Ativa o suporte a som" #~ msgid "Volume Control: " #~ msgstr "Controle de Volume: " #~ msgid "Sound Event" #~ msgstr "Som de Evento" #~ msgid "Test" #~ msgstr "Teste" #~ msgid "Stop" #~ msgstr "Pare" #~ msgid "Transfer finished" #~ msgstr "Transferência encerrada" #~ msgid "Play" #~ msgstr "Reproduzir" #~ msgid "Event" #~ msgstr "Evento" #~ msgid "Please select a sound file" #~ msgstr "Favor escolher um arquivo de som" #~ msgid "_Tools" #~ msgstr "_Ferramentas" #~ msgid "Please input an IP address (IPv4 only)!" #~ msgstr "Favor entrar um endereço IP (IPv4 somente)" #~ msgid "Clear Buffer" #~ msgstr "Limpar Buffer" #, fuzzy #~ msgid "" #~ "Fatal Error!!\n" #~ "Failed to bind the TCP/UDP port(%d)!\n" #~ "%s" #~ msgstr "" #~ "Êrro Fatal!!\n" #~ "Falhou em criar novo socket!\n" #~ "%s" iptux-0.9.4/po/ru.po000066400000000000000000001002501475473122500143110ustar00rootroot00000000000000# Russian translation for iptux # Copyright (c) 2014 Rosetta Contributors and Canonical Ltd 2014 # This file is distributed under the same license as the iptux package. # FIRST AUTHOR , 2014. # msgid "" msgstr "" "Project-Id-Version: iptux\n" "Report-Msgid-Bugs-To: https://github.com/iptux-src/iptux/issues/new\n" "POT-Creation-Date: 2025-02-17 13:35-0800\n" "PO-Revision-Date: 2021-04-11 23:02+0000\n" "Last-Translator: Artem \n" "Language-Team: Russian \n" "Language: ru\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && " "n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" "X-Generator: Weblate 4.6-dev\n" "X-Launchpad-Export-Date: 2018-01-24 12:00+0000\n" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:6 msgid "iptux" msgstr "IPTux" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:7 msgid "LAN communication software" msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:17 msgid "iptux is an “IP Messenger” client. The features of iptux include:" msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:21 msgid "auto-detect other clients on the intranet." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:22 msgid "send/recv messages to other clients." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:23 msgid "send/recv files to other clients." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:24 msgid "share your files to other cliens (with optional password protection)." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:26 msgid "" "It is (supposedly) compatible with 飞鸽传书 (Feige) and 飞秋 (FeiQ) from " "China, and with the original “IP Messenger” clients from Japan, including " "g2ipmsg and xipmsg in Debian." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:38 msgid "The Iptux main window." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:42 msgid "The Iptux chat window." msgstr "" #: src/iptux-core/CoreThread.cpp:172 #, c-format msgid "" "Fatal Error!! Failed to create new socket!\n" "%s" msgstr "" "Ошибка!! Не удалось создать новый сокет!\n" "%s" #: src/iptux-core/CoreThread.cpp:188 #, fuzzy, c-format msgid "" "Fatal Error!! Failed to bind the TCP port(%s:%d)!\n" "%s" msgstr "" "Ошибка!!!\n" "Не удалось создать новый сокет!\n" "%s" #: src/iptux-core/CoreThread.cpp:201 #, fuzzy, c-format msgid "" "Fatal Error!! Failed to bind the UDP port(%s:%d)!\n" "%s" msgstr "" "Ошибка!!!\n" "Не удалось создать новый сокет!\n" "%s" #: src/iptux-core/CoreThread.cpp:461 src/iptux-core/CoreThread.cpp:495 #: src/iptux-core/internal/RecvFileData.cpp:142 #: src/iptux-core/internal/RecvFileData.cpp:204 #, c-format msgid "" "Fatal Error!!\n" "Failed to create new socket!\n" "%s" msgstr "" "Ошибка!!!\n" "Не удалось создать новый сокет!\n" "%s" #: src/iptux-core/Models.cpp:172 msgid "Empty Message" msgstr "Пустое сообщение" #: src/iptux-core/Models.cpp:250 msgid "Received an image" msgstr "" #: src/iptux-core/internal/AnalogFS.cpp:93 #: src/iptux-core/internal/AnalogFS.cpp:98 #, c-format msgid "Open() file \"%s\" failed, %s" msgstr "" #: src/iptux-core/internal/AnalogFS.cpp:117 #, c-format msgid "Stat64() file \"%s\" failed, %s" msgstr "" #: src/iptux-core/internal/AnalogFS.cpp:138 #, c-format msgid "Mkdir() directory \"%s\" failed, %s" msgstr "" #: src/iptux-core/internal/AnalogFS.cpp:164 #, c-format msgid "Opendir() directory \"%s\" failed, %s" msgstr "" #: src/iptux-core/internal/Command.cpp:226 msgid "Your pal didn't receive the packet. He or she is offline maybe." msgstr "Ваш собеседник не получил сообщение. Возможно он(она) сейчас вне сети." #: src/iptux-core/internal/CommandMode.cpp:39 #, c-format msgid "unknown command mode: %d" msgstr "" #: src/iptux-core/internal/RecvFileData.cpp:117 msgid "receive" msgstr "" #: src/iptux-core/internal/RecvFileData.cpp:124 #: src/iptux-core/internal/RecvFileData.cpp:253 #: src/iptux-core/internal/SendFileData.cpp:108 #: src/iptux-core/internal/SendFileData.cpp:193 msgid "Unknown" msgstr "Неизвестно" #: src/iptux-core/internal/RecvFileData.cpp:175 #, c-format msgid "" "Failed to receive the file \"%s\" from %s! expect length %jd, received %jd" msgstr "" #: src/iptux-core/internal/RecvFileData.cpp:180 #, c-format msgid "Receive the file \"%s\" from %s successfully!" msgstr "" #: src/iptux-core/internal/RecvFileData.cpp:320 #, c-format msgid "Failed to receive the directory \"%s\" from %s!" msgstr "" #: src/iptux-core/internal/RecvFileData.cpp:323 #, c-format msgid "Receive the directory \"%s\" from %s successfully!" msgstr "" #: src/iptux-core/internal/SendFileData.cpp:101 msgid "send" msgstr "отправить" #: src/iptux-core/internal/SendFileData.cpp:137 #, c-format msgid "Failed to send the file \"%s\" to %s!" msgstr "" #: src/iptux-core/internal/SendFileData.cpp:142 #, c-format msgid "Send the file \"%s\" to %s successfully!" msgstr "" #: src/iptux-core/internal/SendFileData.cpp:265 #, c-format msgid "Failed to send the directory \"%s\" to %s!" msgstr "" #: src/iptux-core/internal/SendFileData.cpp:270 #, c-format msgid "Send the directory \"%s\" to %s successfully!" msgstr "" #: src/iptux-core/internal/UdpData.cpp:92 #: src/iptux-core/internal/UdpData.cpp:93 #: src/iptux-core/internal/UdpData.cpp:443 #: src/iptux-core/internal/UdpData.cpp:484 msgid "mysterious" msgstr "таинственный" #: src/iptux-utils/utils.cpp:880 #, c-format msgid "stat file \"%s\" failed: %s" msgstr "" #: src/iptux-utils/utils.cpp:888 #, c-format msgid "path %s is not file or directory: st_mode(%x)" msgstr "" #: src/iptux-utils/utils.cpp:895 #, c-format msgid "opendir on \"%s\" failed: %s" msgstr "" #: src/iptux/AboutDialog.cpp:39 msgid "TRANSLATOR NAME" msgstr "ИМЯ ПЕРЕВОДЧИКА" #: src/iptux/AboutDialog.cpp:53 msgid "Thanks to" msgstr "Благодаря" #: src/iptux/AppIndicator.cpp:40 src/iptux/MainWindow.cpp:505 #: src/iptux/MainWindow.cpp:507 msgid "Iptux" msgstr "Iptux" #: src/iptux/Application.cpp:54 msgid "Loading the process successfully!" msgstr "" #: src/iptux/Application.cpp:274 #, c-format msgid "New Message from %s" msgstr "Новое сообщение от %s" #: src/iptux/Application.cpp:287 #, c-format msgid "New File from %s" msgstr "Новый файл от %s" #: src/iptux/Application.cpp:296 msgid "Receiving File Finished" msgstr "" #: src/iptux/Application.cpp:300 msgid "file info no longer exist" msgstr "" #: src/iptux/Darwin.cpp:16 #, c-format msgid "Couldn’t load icon: %s" msgstr "" #: src/iptux/DataSettings.cpp:46 msgid "Personal" msgstr "Личные" #: src/iptux/DataSettings.cpp:48 msgid "System" msgstr "Система" #: src/iptux/DataSettings.cpp:50 msgid "Network" msgstr "Сеть" #: src/iptux/DataSettings.cpp:89 src/iptux/DataSettings.cpp:98 msgid "The program needs to be restarted to take effect!" msgstr "" #: src/iptux/DataSettings.cpp:143 msgid "Preferences" msgstr "Параметры" #: src/iptux/DataSettings.cpp:143 src/iptux/RevisePal.cpp:109 #: src/iptux/dialog.cpp:107 src/iptux/dialog.cpp:170 msgid "_OK" msgstr "_ОК" #: src/iptux/DataSettings.cpp:144 msgid "_Apply" msgstr "_Применить" #: src/iptux/DataSettings.cpp:144 src/iptux/DataSettings.cpp:1348 #: src/iptux/DataSettings.cpp:1395 src/iptux/DialogBase.cpp:359 #: src/iptux/DialogBase.cpp:918 src/iptux/RevisePal.cpp:110 #: src/iptux/ShareFile.cpp:419 src/iptux/callback.cpp:87 #: src/iptux/dialog.cpp:171 src/iptux/dialog.cpp:230 msgid "_Cancel" msgstr "_Отмена" #: src/iptux/DataSettings.cpp:169 #, fuzzy msgid "Your _nickname:" msgstr "Ваш ник:" #: src/iptux/DataSettings.cpp:176 msgid "Please input your nickname!" msgstr "Пожалуйста, введите ник!" #: src/iptux/DataSettings.cpp:182 #, fuzzy msgid "Your _group name:" msgstr "Название Вашей группы:" #: src/iptux/DataSettings.cpp:189 msgid "Please input your group name!" msgstr "Пожалуйста, введите название Вашей группы!" #: src/iptux/DataSettings.cpp:195 #, fuzzy msgid "Your _face picture:" msgstr "Аватар:" #: src/iptux/DataSettings.cpp:213 #, fuzzy msgid "_Save files to: " msgstr "Сохранять файлы в: " #: src/iptux/DataSettings.cpp:226 msgid "Photo" msgstr "Фото" #: src/iptux/DataSettings.cpp:238 msgid "Signature" msgstr "Подпись" #: src/iptux/DataSettings.cpp:271 msgid "Port:" msgstr "" #: src/iptux/DataSettings.cpp:278 msgid "Any port number between 1024 and 65535, default is 2425" msgstr "" #: src/iptux/DataSettings.cpp:287 #, fuzzy msgid "Candidate network encodings:" msgstr "Дополнительная кодировка" #: src/iptux/DataSettings.cpp:294 #, fuzzy msgid "Candidate network encodings, separated by \",\"" msgstr "Дополнительная кодировка" #: src/iptux/DataSettings.cpp:301 #, fuzzy msgid "Preferred network encoding:" msgstr "Стандартная кодировка" #: src/iptux/DataSettings.cpp:308 msgid "" "Preference network coding (You should be aware of what you are doing if you " "want to modify it.)" msgstr "" "Стандартная кодировка (Вы должны быть уверенны перед тем как изменить это " "значение)" #: src/iptux/DataSettings.cpp:316 msgid "Pal's default face picture:" msgstr "Аватар собеседника по умолчанию:" #: src/iptux/DataSettings.cpp:334 msgid "Panel font:" msgstr "Панель шрифтов:" #: src/iptux/DataSettings.cpp:346 msgid "Automatically open the chat dialog" msgstr "Автоматически открывать диалог беседы" #: src/iptux/DataSettings.cpp:354 msgid "Automatically hide the panel after login" msgstr "Автоматически сворачивать панель после входа" #: src/iptux/DataSettings.cpp:362 msgid "Automatically open the File Transmission Management" msgstr "Автоматически открывать управление передачей файла" #: src/iptux/DataSettings.cpp:370 msgid "Use the 'Enter' key to send message" msgstr "Отправка сообщения по нажатию \"Enter\"" #: src/iptux/DataSettings.cpp:378 msgid "Automatically clean up the chat history" msgstr "Автоматическая очистка истории сообщений" #: src/iptux/DataSettings.cpp:385 msgid "Save the chat history" msgstr "Сохранять историю сообщений" #: src/iptux/DataSettings.cpp:393 msgid "Use the Blacklist (NOT recommended)" msgstr "Использовать черный список (НЕ рекомендуется)" #: src/iptux/DataSettings.cpp:401 msgid "Filter the request of sharing files" msgstr "Фильтр запросов на обмен файлами" #: src/iptux/DataSettings.cpp:408 msgid "Hide the taskbar when the main window is minimized" msgstr "" #: src/iptux/DataSettings.cpp:432 msgid "From:" msgstr "От:" #: src/iptux/DataSettings.cpp:438 msgid "Beginning of the IP(v4) section" msgstr "" #: src/iptux/DataSettings.cpp:442 msgid "To:" msgstr "К:" #: src/iptux/DataSettings.cpp:448 msgid "End of the IP(v4) section" msgstr "" #: src/iptux/DataSettings.cpp:456 msgid "Add" msgstr "Добавить" #: src/iptux/DataSettings.cpp:461 msgid "Delete" msgstr "Удалить" #: src/iptux/DataSettings.cpp:468 msgid "Added IP(v4) Section:" msgstr "" #: src/iptux/DataSettings.cpp:487 msgid "Import" msgstr "Импорт" #: src/iptux/DataSettings.cpp:491 msgid "Export" msgstr "Экспорт" #: src/iptux/DataSettings.cpp:495 src/iptux/TransWindow.cpp:171 msgid "Clear" msgstr "Очистить" #: src/iptux/DataSettings.cpp:706 msgid "From" msgstr "От" #: src/iptux/DataSettings.cpp:713 msgid "To" msgstr "" #: src/iptux/DataSettings.cpp:720 msgid "Description" msgstr "Описание" #: src/iptux/DataSettings.cpp:736 msgid "Please select download folder" msgstr "" #: src/iptux/DataSettings.cpp:758 msgid "Select Font" msgstr "Выберите шрифт" #: src/iptux/DataSettings.cpp:872 src/iptux/DataSettings.cpp:874 #: src/iptux/DataSettings.cpp:878 msgid "Port must be a number between 1024 and 65535" msgstr "" #: src/iptux/DataSettings.cpp:1019 src/iptux/DataSettings.cpp:1050 #, c-format msgid "" "Fopen() file \"%s\" failed!\n" "%s" msgstr "" #: src/iptux/DataSettings.cpp:1150 src/iptux/RevisePal.cpp:419 msgid "Please select a face picture" msgstr "" #: src/iptux/DataSettings.cpp:1172 msgid "Please select a personal photo" msgstr "Пожалуйста, выберите личное фото" #: src/iptux/DataSettings.cpp:1241 src/iptux/DataSettings.cpp:1248 #: src/iptux/DetectPal.cpp:75 #, c-format msgid "" "\n" "Illegal IP(v4) address: %s!" msgstr "" "\n" "Запрещенный адрес IP(v4): %s!" #: src/iptux/DataSettings.cpp:1346 msgid "Please select a file to import data" msgstr "Пожалуйста, выберите файл для импорта данных" #: src/iptux/DataSettings.cpp:1347 src/iptux/DialogBase.cpp:358 #: src/iptux/ShareFile.cpp:418 src/iptux/callback.cpp:86 msgid "_Open" msgstr "_Открыть" #: src/iptux/DataSettings.cpp:1394 msgid "Save data to file" msgstr "Сохранение данных в файл" #: src/iptux/DataSettings.cpp:1395 src/iptux/DialogBase.cpp:919 #: src/iptux/dialog.cpp:231 msgid "_Save" msgstr "_Сохранить" #: src/iptux/DetectPal.cpp:70 #, c-format msgid "The notification has been sent to %s." msgstr "" #: src/iptux/DialogBase.cpp:214 #, c-format msgid "%s To Send." msgstr "" #: src/iptux/DialogBase.cpp:272 msgid "Close" msgstr "Закрыть" #: src/iptux/DialogBase.cpp:276 src/iptux/DialogGroup.cpp:375 msgid "Send" msgstr "Отправить" #: src/iptux/DialogBase.cpp:307 #, fuzzy msgid "Chat History" msgstr "Сохранять историю сообщений" #: src/iptux/DialogBase.cpp:350 msgid "Choose enclosure files" msgstr "" #: src/iptux/DialogBase.cpp:353 msgid "Choose enclosure folders" msgstr "" #: src/iptux/DialogBase.cpp:593 msgid "Remove Selected" msgstr "" #: src/iptux/DialogBase.cpp:648 msgid "File to send." msgstr "Файл для отправки." #: src/iptux/DialogBase.cpp:653 msgid "Sending progress." msgstr "Прогресс отправки." #: src/iptux/DialogBase.cpp:656 msgid "Dirs" msgstr "" #: src/iptux/DialogBase.cpp:659 msgid "Files" msgstr "Файлы" #: src/iptux/DialogBase.cpp:662 src/iptux/DialogPeer.cpp:565 msgid "Detail" msgstr "Подробности" #: src/iptux/DialogBase.cpp:712 msgid "PeerName" msgstr "" #: src/iptux/DialogBase.cpp:719 src/iptux/DialogPeer.cpp:716 msgid "Name" msgstr "Название" #: src/iptux/DialogBase.cpp:725 src/iptux/DialogPeer.cpp:652 #: src/iptux/DialogPeer.cpp:722 src/iptux/ShareFile.cpp:280 #: src/iptux/TransWindow.cpp:271 msgid "Size" msgstr "Размер" #: src/iptux/DialogBase.cpp:731 msgid "Path" msgstr "Путь" #: src/iptux/DialogBase.cpp:792 msgid "Sending Progress." msgstr "Прогресс отправки." #: src/iptux/DialogBase.cpp:795 #, c-format msgid "%s of %s Sent." msgstr "" #: src/iptux/DialogBase.cpp:802 src/iptux/DialogPeer.cpp:835 msgid "Mission Completed!" msgstr "Миссия завершена!" #: src/iptux/DialogBase.cpp:845 src/iptux/DialogBase.cpp:917 msgid "Save Image" msgstr "" #: src/iptux/DialogBase.cpp:850 msgid "Copy Image" msgstr "" #: src/iptux/DialogGroup.cpp:285 msgid "Member" msgstr "" #: src/iptux/DialogGroup.cpp:382 msgid "Pals" msgstr "" #: src/iptux/DialogGroup.cpp:480 msgid "Select All" msgstr "Выделить всё" #: src/iptux/DialogGroup.cpp:485 msgid "Reverse Select" msgstr "" #: src/iptux/DialogGroup.cpp:490 msgid "Clear Up" msgstr "" #: src/iptux/DialogGroup.cpp:728 #, c-format msgid "Talk with the group %s" msgstr "" #: src/iptux/DialogPeer.cpp:132 #, c-format msgid "Talk with %s(%s) IP:%s" msgstr "Разговаривать с %s(%s) IP:%s" #: src/iptux/DialogPeer.cpp:305 msgid "Info." msgstr "Информация." #: src/iptux/DialogPeer.cpp:337 #, c-format msgid "Version: %s\n" msgstr "Версия: %s\n" #: src/iptux/DialogPeer.cpp:339 #, c-format msgid "Nickname: %s@%s\n" msgstr "" #: src/iptux/DialogPeer.cpp:342 #, c-format msgid "Nickname: %s\n" msgstr "" #: src/iptux/DialogPeer.cpp:344 #, c-format msgid "User: %s\n" msgstr "Пользователь: %s\n" #: src/iptux/DialogPeer.cpp:345 #, c-format msgid "Host: %s\n" msgstr "" #: src/iptux/DialogPeer.cpp:348 #, c-format msgid "Address: %s(%s)\n" msgstr "" #: src/iptux/DialogPeer.cpp:350 #, c-format msgid "Address: %s\n" msgstr "" #: src/iptux/DialogPeer.cpp:353 msgid "Compatibility: Microsoft\n" msgstr "" #: src/iptux/DialogPeer.cpp:355 msgid "Compatibility: GNU/Linux\n" msgstr "" #: src/iptux/DialogPeer.cpp:357 #, c-format msgid "System coding: %s\n" msgstr "" #: src/iptux/DialogPeer.cpp:362 msgid "Signature:\n" msgstr "" #: src/iptux/DialogPeer.cpp:369 msgid "" "\n" "Photo:\n" msgstr "" #: src/iptux/DialogPeer.cpp:460 msgid "Please select a picture to insert the buffer" msgstr "" #: src/iptux/DialogPeer.cpp:486 src/iptux/resources/gtk/menus.ui:83 #: src/iptux/resources/gtk/menus.ui:228 #, fuzzy msgid "Insert Image" msgstr "Вставить картинку" #: src/iptux/DialogPeer.cpp:502 msgid "Enclosure." msgstr "" #: src/iptux/DialogPeer.cpp:547 msgid "Files to be received" msgstr "" #: src/iptux/DialogPeer.cpp:551 msgid "Receiving progress." msgstr "" #: src/iptux/DialogPeer.cpp:554 msgid "Accept" msgstr "Принять" #: src/iptux/DialogPeer.cpp:560 src/iptux/dialog.cpp:63 #: src/iptux/resources/gtk/menus.ui:342 msgid "Refuse" msgstr "Отказать" #: src/iptux/DialogPeer.cpp:596 msgid "File received." msgstr "Файл получен." #: src/iptux/DialogPeer.cpp:639 src/iptux/DialogPeer.cpp:710 msgid "Source" msgstr "Источник" #: src/iptux/DialogPeer.cpp:646 msgid "SaveAs" msgstr "Сохранить как" #: src/iptux/DialogPeer.cpp:818 src/iptux/DialogPeer.cpp:884 msgid "Receiving Progress." msgstr "" #: src/iptux/DialogPeer.cpp:821 src/iptux/DialogPeer.cpp:887 #, c-format msgid "%s to Receive." msgstr "" #: src/iptux/DialogPeer.cpp:825 src/iptux/DialogPeer.cpp:891 #, c-format msgid "%s Of %s Received." msgstr "" #: src/iptux/LogSystem.cpp:71 #, c-format msgid "Recevied-From: Nickname:%s User:%s Host:%s" msgstr "" #: src/iptux/LogSystem.cpp:76 #, c-format msgid "Send-To: Nickname:%s User:%s Host:%s" msgstr "" #: src/iptux/LogSystem.cpp:80 msgid "Send-Broadcast" msgstr "" #: src/iptux/LogSystem.cpp:99 #, c-format msgid "User:%s Host:%s" msgstr "" #: src/iptux/MainWindow.cpp:570 msgid "Pals Online: 0" msgstr "" #: src/iptux/MainWindow.cpp:655 msgid "Search Pals" msgstr "" #: src/iptux/MainWindow.cpp:768 msgid "Nickname" msgstr "" #: src/iptux/MainWindow.cpp:778 msgid "Group" msgstr "" #: src/iptux/MainWindow.cpp:784 src/iptux/TransWindow.cpp:258 msgid "IPv4" msgstr "IPv4" #: src/iptux/MainWindow.cpp:790 msgid "User" msgstr "Пользователь" #: src/iptux/MainWindow.cpp:796 src/iptux/resources/gtk/MainWindow.ui:81 msgid "Host" msgstr "" #: src/iptux/MainWindow.cpp:935 #, c-format msgid "Pals Online: %d" msgstr "" #: src/iptux/RevisePal.cpp:109 msgid "Change Pal's Information" msgstr "" #: src/iptux/RevisePal.cpp:134 msgid "Pal's nickname:" msgstr "" #: src/iptux/RevisePal.cpp:140 msgid "Please input pal's new nickname!" msgstr "" #: src/iptux/RevisePal.cpp:146 msgid "Pal's group name:" msgstr "" #: src/iptux/RevisePal.cpp:152 msgid "Please input pal's new group name!" msgstr "" #: src/iptux/RevisePal.cpp:158 msgid "System coding:" msgstr "" #: src/iptux/RevisePal.cpp:164 msgid "Be SURE to know what you are doing!" msgstr "" #: src/iptux/RevisePal.cpp:170 msgid "Pal's face picture:" msgstr "" #: src/iptux/RevisePal.cpp:184 msgid "Be compatible with iptux's protocol (DANGEROUS)" msgstr "Совместимость с протоколом iptux (Не безопасно!)" #: src/iptux/ShareFile.cpp:104 msgid "Shared Files Management" msgstr "" #: src/iptux/ShareFile.cpp:105 msgid "OK" msgstr "ОК" #: src/iptux/ShareFile.cpp:106 msgid "Apply" msgstr "Применить" #: src/iptux/ShareFile.cpp:107 msgid "Cancel" msgstr "Отмена" #: src/iptux/ShareFile.cpp:160 msgid "Add Files" msgstr "Добавить файлы" #: src/iptux/ShareFile.cpp:163 msgid "Add Folders" msgstr "Добавить папки" #: src/iptux/ShareFile.cpp:166 msgid "Delete Resources" msgstr "Удалить ресурсы" #: src/iptux/ShareFile.cpp:169 msgid "Clear Password" msgstr "Очистить пароль" #: src/iptux/ShareFile.cpp:172 msgid "Set Password" msgstr "Установить пароль" #: src/iptux/ShareFile.cpp:229 src/iptux/ShareFile.cpp:373 msgid "regular" msgstr "" #: src/iptux/ShareFile.cpp:233 src/iptux/ShareFile.cpp:377 msgid "directory" msgstr "каталог" #: src/iptux/ShareFile.cpp:237 src/iptux/ShareFile.cpp:381 msgid "unknown" msgstr "неизвестный" #: src/iptux/ShareFile.cpp:270 msgid "File" msgstr "Файл" #: src/iptux/ShareFile.cpp:286 msgid "Type" msgstr "Тип" #: src/iptux/ShareFile.cpp:411 msgid "Choose the files to share" msgstr "" #: src/iptux/ShareFile.cpp:414 msgid "Choose the folders to share" msgstr "" #: src/iptux/TransWindow.cpp:86 msgid "Files Transmission Management" msgstr "" #: src/iptux/TransWindow.cpp:241 msgid "State" msgstr "" #: src/iptux/TransWindow.cpp:247 msgid "Task" msgstr "Задача" #: src/iptux/TransWindow.cpp:253 msgid "Peer" msgstr "" #: src/iptux/TransWindow.cpp:265 msgid "Filename" msgstr "Имя файла" #: src/iptux/TransWindow.cpp:277 msgid "Completed" msgstr "Завершено" #: src/iptux/TransWindow.cpp:284 msgid "Progress" msgstr "Прогресс" #: src/iptux/TransWindow.cpp:291 msgid "Cost" msgstr "" #: src/iptux/TransWindow.cpp:297 msgid "Remaining" msgstr "" #: src/iptux/TransWindow.cpp:303 msgid "Rate" msgstr "" #: src/iptux/TransWindow.cpp:331 msgid "The path you want to open not exist!" msgstr "" #: src/iptux/TransWindow.cpp:405 msgid "The file you want to open not exist!" msgstr "" #: src/iptux/TransWindow.cpp:406 #, fuzzy msgid "iptux Error" msgstr "IPTux" #: src/iptux/UiCoreThread.cpp:254 src/iptux/UiCoreThread.cpp:278 #: src/iptux/UiCoreThread.cpp:377 src/iptux/UiCoreThread.cpp:399 msgid "Others" msgstr "Прочие" #: src/iptux/UiCoreThread.cpp:419 msgid "Broadcast" msgstr "Вещание" #: src/iptux/UiHelper.cpp:28 #, c-format msgid "Can't convert path to uri: %s, reason: %s" msgstr "" #: src/iptux/UiHelper.cpp:39 #, c-format msgid "Can't open path: %s, reason: %s" msgstr "" #: src/iptux/UiHelper.cpp:68 #, c-format msgid "Can't open URL: %s, reason: %s" msgstr "" #: src/iptux/UiHelper.cpp:188 msgid "Information" msgstr "информация" #: src/iptux/UiHelper.cpp:218 msgid "Warning" msgstr "Предупреждение" #: src/iptux/UiModels.cpp:604 #, c-format msgid "Version: %s" msgstr "Версия: %s" #: src/iptux/UiModels.cpp:608 #, c-format msgid "Nickname: %s@%s" msgstr "" #: src/iptux/UiModels.cpp:611 #, fuzzy, c-format msgid "Nickname: %s" msgstr "Ваш ник:" #: src/iptux/UiModels.cpp:615 #, c-format msgid "User: %s" msgstr "Пользователь: %s" #: src/iptux/UiModels.cpp:618 #, c-format msgid "Host: %s" msgstr "" #: src/iptux/UiModels.cpp:623 #, c-format msgid "Address: %s(%s)" msgstr "" #: src/iptux/UiModels.cpp:625 #, c-format msgid "Address: %s" msgstr "" #: src/iptux/UiModels.cpp:630 msgid "Compatibility: Microsoft" msgstr "" #: src/iptux/UiModels.cpp:632 msgid "Compatibility: GNU/Linux" msgstr "" #: src/iptux/UiModels.cpp:636 #, c-format msgid "System coding: %s" msgstr "" #: src/iptux/UiModels.cpp:641 #, fuzzy msgid "Signature:" msgstr "Подпись" #: src/iptux/UiModels.cpp:744 msgid "" msgstr "<ОШИБКА>" #: src/iptux/UiModels.cpp:799 msgid "[IMG]" msgstr "" #: src/iptux/dialog.cpp:39 msgid "" "File transfer has not been completed.\n" "Are you sure to cancel and quit?" msgstr "" #: src/iptux/dialog.cpp:42 msgid "Confirm Exit" msgstr "" #: src/iptux/dialog.cpp:62 src/iptux/resources/gtk/MainWindow.ui:12 #: src/iptux/resources/gtk/menus.ui:98 src/iptux/resources/gtk/menus.ui:243 msgid "Request Shared Resources" msgstr "" #: src/iptux/dialog.cpp:62 msgid "Agree" msgstr "" #: src/iptux/dialog.cpp:78 #, c-format msgid "" "Your pal (%s)[%s]\n" "is requesting to get your shared resources,\n" "Do you agree?" msgstr "" #: src/iptux/dialog.cpp:106 msgid "Access Password" msgstr "" #: src/iptux/dialog.cpp:113 msgid "Please input the password for the shared files behind" msgstr "" #: src/iptux/dialog.cpp:127 #, c-format msgid "(%s)[%s]Password:" msgstr "(%s)[%s]Пароль:" #: src/iptux/dialog.cpp:146 src/iptux/dialog.cpp:207 msgid "" "\n" "Empty Password!" msgstr "" "\n" "Пустой пароль!" #: src/iptux/dialog.cpp:170 msgid "Enter a New Password" msgstr "Введите новый пароль" #: src/iptux/dialog.cpp:178 msgid "Password: " msgstr "Пароль: " #: src/iptux/dialog.cpp:187 msgid "Repeat: " msgstr "" #: src/iptux/dialog.cpp:202 msgid "" "\n" "Password Mismatched!" msgstr "" #: src/iptux/dialog.cpp:229 msgid "Please select a folder to save files." msgstr "" #: src/iptux/resources/gtk/AboutDialog.ui:11 msgid "" "Copyright © 2008–2009, Jally\n" "Copyright © 2013–2015,2017–2021, LI Daobing" msgstr "" #: src/iptux/resources/gtk/AboutDialog.ui:13 msgid "A GTK based LAN messenger." msgstr "" #: src/iptux/resources/gtk/AppIndicator.ui:6 #, fuzzy msgid "Open Iptux" msgstr "Iptux" #: src/iptux/resources/gtk/AppIndicator.ui:12 #: src/iptux/resources/gtk/menus.ui:6 src/iptux/resources/gtk/menus.ui:306 msgid "_Preferences" msgstr "_Параметры" #: src/iptux/resources/gtk/AppIndicator.ui:16 #: src/iptux/resources/gtk/menus.ui:10 src/iptux/resources/gtk/menus.ui:310 msgid "_Quit" msgstr "_Выход" #: src/iptux/resources/gtk/DetectPal.ui:7 msgid "Detect pal" msgstr "" #: src/iptux/resources/gtk/DetectPal.ui:15 msgid "Detect" msgstr "" #: src/iptux/resources/gtk/DetectPal.ui:61 msgid "Please input an IP address (IPv4 only):" msgstr "Введите IP-адрес (только IPv4)" #: src/iptux/resources/gtk/MainWindow.ui:8 src/iptux/resources/gtk/menus.ui:109 #: src/iptux/resources/gtk/menus.ui:254 msgid "Send Message" msgstr "Отправить сообщение" #: src/iptux/resources/gtk/MainWindow.ui:16 msgid "Change Info" msgstr "Изменить информацию" #: src/iptux/resources/gtk/MainWindow.ui:20 msgid "Delete Pal" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:26 src/iptux/resources/gtk/menus.ui:31 #: src/iptux/resources/gtk/menus.ui:176 msgid "Sort" msgstr "Сортировка" #: src/iptux/resources/gtk/MainWindow.ui:29 src/iptux/resources/gtk/menus.ui:34 #: src/iptux/resources/gtk/menus.ui:179 msgid "By Nickname" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:34 src/iptux/resources/gtk/menus.ui:39 #: src/iptux/resources/gtk/menus.ui:184 msgid "By Username" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:39 src/iptux/resources/gtk/menus.ui:44 #: src/iptux/resources/gtk/menus.ui:189 msgid "By IP" msgstr "По IP" #: src/iptux/resources/gtk/MainWindow.ui:44 src/iptux/resources/gtk/menus.ui:49 #: src/iptux/resources/gtk/menus.ui:194 msgid "By Host" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:49 src/iptux/resources/gtk/menus.ui:54 #: src/iptux/resources/gtk/menus.ui:199 msgid "By Last Activity" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:56 src/iptux/resources/gtk/menus.ui:61 #: src/iptux/resources/gtk/menus.ui:206 msgid "Ascending" msgstr "По возрастанию" #: src/iptux/resources/gtk/MainWindow.ui:61 src/iptux/resources/gtk/menus.ui:66 #: src/iptux/resources/gtk/menus.ui:211 msgid "Descending" msgstr "По убыванию" #: src/iptux/resources/gtk/MainWindow.ui:68 msgid "Info Style" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:71 #, fuzzy msgid "IP" msgstr "IPv4" #: src/iptux/resources/gtk/MainWindow.ui:76 msgid "IP:PORT" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:86 #, fuzzy msgid "Username" msgstr "Пользователь" #: src/iptux/resources/gtk/MainWindow.ui:91 #, fuzzy msgid "Version" msgstr "Версия: %s" #: src/iptux/resources/gtk/MainWindow.ui:96 msgid "Last Activity" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:101 #, fuzzy msgid "Last Message" msgstr "Пустое сообщение" #: src/iptux/resources/gtk/menus.ui:17 src/iptux/resources/gtk/menus.ui:162 msgid "_File" msgstr "_Файл" #: src/iptux/resources/gtk/menus.ui:19 src/iptux/resources/gtk/menus.ui:164 msgid "_Detect" msgstr "" #: src/iptux/resources/gtk/menus.ui:23 src/iptux/resources/gtk/menus.ui:168 msgid "_Find" msgstr "_Найти" #: src/iptux/resources/gtk/menus.ui:28 src/iptux/resources/gtk/menus.ui:173 msgid "_View" msgstr "" #: src/iptux/resources/gtk/menus.ui:73 src/iptux/resources/gtk/menus.ui:218 msgid "_Refresh" msgstr "_Обновить" #: src/iptux/resources/gtk/menus.ui:80 src/iptux/resources/gtk/menus.ui:225 msgid "_Chat" msgstr "_Чат" #: src/iptux/resources/gtk/menus.ui:88 src/iptux/resources/gtk/menus.ui:233 msgid "Attach File" msgstr "Прикрепить файл" #: src/iptux/resources/gtk/menus.ui:92 src/iptux/resources/gtk/menus.ui:237 msgid "Attach Folder" msgstr "Прикрепить папку" #: src/iptux/resources/gtk/menus.ui:102 src/iptux/resources/gtk/menus.ui:247 #, fuzzy msgid "Clear Chat History" msgstr "Сохранять историю сообщений" #: src/iptux/resources/gtk/menus.ui:115 src/iptux/resources/gtk/menus.ui:260 msgid "_Window" msgstr "_Окно" #: src/iptux/resources/gtk/menus.ui:118 src/iptux/resources/gtk/menus.ui:263 msgid "_Transmission" msgstr "" #: src/iptux/resources/gtk/menus.ui:122 src/iptux/resources/gtk/menus.ui:267 msgid "_Shared Management" msgstr "" #: src/iptux/resources/gtk/menus.ui:126 src/iptux/resources/gtk/menus.ui:271 msgid "_Chat Log" msgstr "" #: src/iptux/resources/gtk/menus.ui:130 src/iptux/resources/gtk/menus.ui:275 #, fuzzy msgid "_System Log" msgstr "Система" #: src/iptux/resources/gtk/menus.ui:136 src/iptux/resources/gtk/menus.ui:281 #, fuzzy msgid "Close Window" msgstr "_Окно" #: src/iptux/resources/gtk/menus.ui:142 src/iptux/resources/gtk/menus.ui:287 msgid "_Help" msgstr "_Помощь" #: src/iptux/resources/gtk/menus.ui:145 src/iptux/resources/gtk/menus.ui:290 msgid "_About" msgstr "_О программе" #: src/iptux/resources/gtk/menus.ui:149 src/iptux/resources/gtk/menus.ui:294 msgid "Report Bug" msgstr "Сообщить об ошибке" #: src/iptux/resources/gtk/menus.ui:153 src/iptux/resources/gtk/menus.ui:298 msgid "What's New" msgstr "" #: src/iptux/resources/gtk/menus.ui:318 msgid "Open This File" msgstr "Открыть этот файл" #: src/iptux/resources/gtk/menus.ui:322 msgid "Open Containing Folder" msgstr "" #: src/iptux/resources/gtk/menus.ui:326 msgid "Terminate Task" msgstr "" #: src/iptux/resources/gtk/menus.ui:330 msgid "Terminate All" msgstr "" #: src/iptux/resources/gtk/menus.ui:334 msgid "Clear Tasklist" msgstr "" #: src/iptux/resources/gtk/menus.ui:346 msgid "Refuse All" msgstr "" #: src/main/iptux.cpp:149 #, fuzzy msgid "- A software for sharing in LAN" msgstr "IPTux - приложение для обмена файлов и сообщений в Локальной сети.\n" #: src/main/iptux.cpp:152 #, c-format msgid "option parsing failed: %s\n" msgstr "" #~ msgid "Close Chat" #~ msgstr "Закрыть чат" #~ msgid "Sound" #~ msgstr "Звук" #~ msgid "Activate the sound support" #~ msgstr "Включение поддержки звука" #~ msgid "Volume Control: " #~ msgstr "Регулятор громкости " #~ msgid "Sound Event" #~ msgstr "Звуковые оповещения" #~ msgid "Test" #~ msgstr "Проверка" #~ msgid "Stop" #~ msgstr "Стоп" #, fuzzy #~ msgid "iptux-icon" #~ msgstr "IPTux" #~ msgid "Please input an IP address (IPv4 only)!" #~ msgstr "Введите IP-адрес (только IPv4)!" #, fuzzy #~ msgid "" #~ "Fatal Error!!\n" #~ "Failed to bind the TCP/UDP port(%d)!\n" #~ "%s" #~ msgstr "" #~ "Ошибка!!!\n" #~ "Не удалось создать новый сокет!\n" #~ "%s" #~ msgid "More About Iptux" #~ msgstr "Узнать больше о IPTux" iptux-0.9.4/po/ta.po000066400000000000000000001320051475473122500142720ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the iptux package. # FIRST AUTHOR , YEAR. # msgid "" msgstr "" "Project-Id-Version: iptux 0.9.3\n" "Report-Msgid-Bugs-To: https://github.com/iptux-src/iptux/issues/new\n" "POT-Creation-Date: 2025-02-17 13:35-0800\n" "PO-Revision-Date: 2025-01-04 04:02+0000\n" "Last-Translator: தமிழ்நேரம் \n" "Language-Team: Tamil \n" "Language: ta\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" "X-Generator: Weblate 5.10-dev\n" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:6 msgid "iptux" msgstr "ஐபிடக்ச்" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:7 msgid "LAN communication software" msgstr "லேன் தொடர்பு மென்பொருள்" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:17 msgid "iptux is an “IP Messenger” client. The features of iptux include:" msgstr "ஐபிடக்ச் ஒரு “ஐபி மெசஞ்சர்” கிளையன்ட். IPTUX இன் நற்பொருத்தங்கள் பின்வருமாறு:" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:21 msgid "auto-detect other clients on the intranet." msgstr "இன்ட்ராநெட்டில் மற்ற வாடிக்கையாளர்களை தானாக கண்டறியவும்." #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:22 msgid "send/recv messages to other clients." msgstr "மற்ற வாடிக்கையாளர்களுக்கு செய்திகளை அனுப்பவும்/மறுபரிசீலனை செய்யவும்." #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:23 msgid "send/recv files to other clients." msgstr "பிற வாடிக்கையாளர்களுக்கு கோப்புகளை அனுப்பவும்/RECV." #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:24 msgid "share your files to other cliens (with optional password protection)." msgstr "உங்கள் கோப்புகளை பிற கிளியன்களுக்குப் பகிரவும் (விருப்ப கடவுச்சொல் பாதுகாப்புடன்)." #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:26 msgid "" "It is (supposedly) compatible with 飞鸽传书 (Feige) and 飞秋 (FeiQ) from " "China, and with the original “IP Messenger” clients from Japan, including " "g2ipmsg and xipmsg in Debian." msgstr "" "இது சீனாவிலிருந்து 飞鸽传书 (ஃபைச்) மற்றும் 飞秋 (FEIQ) உடன் இணக்கமானது, மேலும் " "சப்பானில் இருந்து அசல் “ஐபி மெசஞ்சர்” வாடிக்கையாளர்களுடன், டெபியனில் G2IPMSG மற்றும் " "XIPMSG உட்பட." #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:38 msgid "The Iptux main window." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:42 msgid "The Iptux chat window." msgstr "" #: src/iptux-core/CoreThread.cpp:172 #, c-format msgid "" "Fatal Error!! Failed to create new socket!\n" "%s" msgstr "" "அபாயகரமான பிழை !! புதிய சாக்கெட்டை உருவாக்குவதில் தோல்வி!\n" " %s" #: src/iptux-core/CoreThread.cpp:188 #, c-format msgid "" "Fatal Error!! Failed to bind the TCP port(%s:%d)!\n" "%s" msgstr "" "அபாயகரமான பிழை !! TCP போர்ட்டை பிணைக்கத் தவறிவிட்டது (%s:%d)!\n" " %s" #: src/iptux-core/CoreThread.cpp:201 #, c-format msgid "" "Fatal Error!! Failed to bind the UDP port(%s:%d)!\n" "%s" msgstr "" "அபாயகரமான பிழை !! யுடிபி போர்ட்டை பிணைப்பதில் தோல்வி (%s:%d)!\n" " %s" #: src/iptux-core/CoreThread.cpp:461 src/iptux-core/CoreThread.cpp:495 #: src/iptux-core/internal/RecvFileData.cpp:142 #: src/iptux-core/internal/RecvFileData.cpp:204 #, c-format msgid "" "Fatal Error!!\n" "Failed to create new socket!\n" "%s" msgstr "" "அபாயகரமான பிழை !!\n" " புதிய சாக்கெட்டை உருவாக்குவதில் தோல்வி!\n" " %s" #: src/iptux-core/Models.cpp:172 msgid "Empty Message" msgstr "வெற்று செய்தி" #: src/iptux-core/Models.cpp:250 msgid "Received an image" msgstr "ஒரு படத்தைப் பெற்றது" #: src/iptux-core/internal/AnalogFS.cpp:93 #: src/iptux-core/internal/AnalogFS.cpp:98 #, c-format msgid "Open() file \"%s\" failed, %s" msgstr "திறந்த () கோப்பு \" %s\" தோல்வியுற்றது, %s" #: src/iptux-core/internal/AnalogFS.cpp:117 #, c-format msgid "Stat64() file \"%s\" failed, %s" msgstr "STAT64 () கோப்பு \" %s\" தோல்வியுற்றது, %s" #: src/iptux-core/internal/AnalogFS.cpp:138 #, c-format msgid "Mkdir() directory \"%s\" failed, %s" msgstr "Mkdir () அடைவு \" %s\" தோல்வியுற்றது, %s" #: src/iptux-core/internal/AnalogFS.cpp:164 #, c-format msgid "Opendir() directory \"%s\" failed, %s" msgstr "Opeendir () அடைவு \" %s\" தோல்வியுற்றது, %s" #: src/iptux-core/internal/Command.cpp:226 msgid "Your pal didn't receive the packet. He or she is offline maybe." msgstr "உங்கள் பால் பாக்கெட்டைப் பெறவில்லை. அவன் அல்லது அவள் ஆஃப்லைனில் இருக்கலாம்." #: src/iptux-core/internal/CommandMode.cpp:39 #, c-format msgid "unknown command mode: %d" msgstr "அறியப்படாத கட்டளை பயன்முறை: %d" #: src/iptux-core/internal/RecvFileData.cpp:117 msgid "receive" msgstr "பெறுங்கள்" #: src/iptux-core/internal/RecvFileData.cpp:124 #: src/iptux-core/internal/RecvFileData.cpp:253 #: src/iptux-core/internal/SendFileData.cpp:108 #: src/iptux-core/internal/SendFileData.cpp:193 msgid "Unknown" msgstr "தெரியவில்லை" #: src/iptux-core/internal/RecvFileData.cpp:175 #, fuzzy, c-format msgid "" "Failed to receive the file \"%s\" from %s! expect length %jd, received %jd" msgstr "" "%s இலிருந்து \" %s\" கோப்பைப் பெறுவதில் தோல்வி! நீளம் %JD ஐ எதிர்பார்க்கலாம், %JD ஐப் " "பெற்றார்" #: src/iptux-core/internal/RecvFileData.cpp:180 #, c-format msgid "Receive the file \"%s\" from %s successfully!" msgstr "%s இலிருந்து \" %s\" கோப்பை வெற்றிகரமாகப் பெறுங்கள்!" #: src/iptux-core/internal/RecvFileData.cpp:320 #, c-format msgid "Failed to receive the directory \"%s\" from %s!" msgstr "%s இலிருந்து \" %s\" கோப்பகத்தைப் பெறுவதில் தோல்வி!" #: src/iptux-core/internal/RecvFileData.cpp:323 #, c-format msgid "Receive the directory \"%s\" from %s successfully!" msgstr "%s இலிருந்து \" %s\" கோப்பகத்தை வெற்றிகரமாகப் பெறுங்கள்!" #: src/iptux-core/internal/SendFileData.cpp:101 msgid "send" msgstr "அனுப்பு" #: src/iptux-core/internal/SendFileData.cpp:137 #, c-format msgid "Failed to send the file \"%s\" to %s!" msgstr "\" %s\" கோப்பை %s க்கு அனுப்பத் தவறிவிட்டது!" #: src/iptux-core/internal/SendFileData.cpp:142 #, c-format msgid "Send the file \"%s\" to %s successfully!" msgstr "\" %s\" கோப்பை %s க்கு வெற்றிகரமாக அனுப்புங்கள்!" #: src/iptux-core/internal/SendFileData.cpp:265 #, c-format msgid "Failed to send the directory \"%s\" to %s!" msgstr "\" %s\" கோப்பகத்தை %s க்கு அனுப்பத் தவறிவிட்டது!" #: src/iptux-core/internal/SendFileData.cpp:270 #, c-format msgid "Send the directory \"%s\" to %s successfully!" msgstr "\" %s\" கோப்பகத்தை %s க்கு வெற்றிகரமாக அனுப்புங்கள்!" #: src/iptux-core/internal/UdpData.cpp:92 #: src/iptux-core/internal/UdpData.cpp:93 #: src/iptux-core/internal/UdpData.cpp:443 #: src/iptux-core/internal/UdpData.cpp:484 msgid "mysterious" msgstr "மர்மமான" #: src/iptux-utils/utils.cpp:880 #, c-format msgid "stat file \"%s\" failed: %s" msgstr "STAT கோப்பு \" %s\" தோல்வியுற்றது: %s" #: src/iptux-utils/utils.cpp:888 #, c-format msgid "path %s is not file or directory: st_mode(%x)" msgstr "பாதை %s கோப்பு அல்லது அடைவு அல்ல: ST_MODE ( %x)" #: src/iptux-utils/utils.cpp:895 #, c-format msgid "opendir on \"%s\" failed: %s" msgstr "\" %s\" இல் Opendir தோல்வியுற்றது: %s" #: src/iptux/AboutDialog.cpp:39 msgid "TRANSLATOR NAME" msgstr "மொழிபெயர்ப்பாளரின் பெயர்" #: src/iptux/AboutDialog.cpp:53 msgid "Thanks to" msgstr "நன்றி" #: src/iptux/AppIndicator.cpp:40 src/iptux/MainWindow.cpp:505 #: src/iptux/MainWindow.cpp:507 msgid "Iptux" msgstr "ஐபிடக்ச்" #: src/iptux/Application.cpp:54 msgid "Loading the process successfully!" msgstr "செயல்முறையை வெற்றிகரமாக ஏற்றுகிறது!" #: src/iptux/Application.cpp:274 #, c-format msgid "New Message from %s" msgstr "%s இலிருந்து புதிய செய்தி" #: src/iptux/Application.cpp:287 #, c-format msgid "New File from %s" msgstr "%s இலிருந்து புதிய கோப்பு" #: src/iptux/Application.cpp:296 msgid "Receiving File Finished" msgstr "பெறும் கோப்பு முடிந்தது" #: src/iptux/Application.cpp:300 msgid "file info no longer exist" msgstr "கோப்பு செய்தி இனி இல்லை" #: src/iptux/Darwin.cpp:16 #, fuzzy, c-format msgid "Couldn’t load icon: %s" msgstr "ஐகான்களை ஏற்ற முடியவில்லை" #: src/iptux/DataSettings.cpp:46 msgid "Personal" msgstr "தனிப்பட்ட" #: src/iptux/DataSettings.cpp:48 msgid "System" msgstr "மண்டலம்" #: src/iptux/DataSettings.cpp:50 msgid "Network" msgstr "பிணையம்" #: src/iptux/DataSettings.cpp:89 src/iptux/DataSettings.cpp:98 msgid "The program needs to be restarted to take effect!" msgstr "நடைமுறைக்கு வர நிரலை மறுதொடக்கம் செய்ய வேண்டும்!" #: src/iptux/DataSettings.cpp:143 msgid "Preferences" msgstr "விருப்பத்தேர்வுகள்" #: src/iptux/DataSettings.cpp:143 src/iptux/RevisePal.cpp:109 #: src/iptux/dialog.cpp:107 src/iptux/dialog.cpp:170 msgid "_OK" msgstr "_Ok" #: src/iptux/DataSettings.cpp:144 msgid "_Apply" msgstr "_Aplay" #: src/iptux/DataSettings.cpp:144 src/iptux/DataSettings.cpp:1348 #: src/iptux/DataSettings.cpp:1395 src/iptux/DialogBase.cpp:359 #: src/iptux/DialogBase.cpp:918 src/iptux/RevisePal.cpp:110 #: src/iptux/ShareFile.cpp:419 src/iptux/callback.cpp:87 #: src/iptux/dialog.cpp:171 src/iptux/dialog.cpp:230 msgid "_Cancel" msgstr "_CANCEL" #: src/iptux/DataSettings.cpp:169 msgid "Your _nickname:" msgstr "உங்கள் _நிக் பெயர்:" #: src/iptux/DataSettings.cpp:176 msgid "Please input your nickname!" msgstr "உங்கள் புனைப்பெயரை உள்ளிடவும்!" #: src/iptux/DataSettings.cpp:182 msgid "Your _group name:" msgstr "உங்கள் _ குழு பெயர்:" #: src/iptux/DataSettings.cpp:189 msgid "Please input your group name!" msgstr "உங்கள் குழு பெயரை உள்ளிடவும்!" #: src/iptux/DataSettings.cpp:195 msgid "Your _face picture:" msgstr "உங்கள் _ ஃபேச் படம்:" #: src/iptux/DataSettings.cpp:213 msgid "_Save files to: " msgstr "_சேவ் கோப்புகள்: " #: src/iptux/DataSettings.cpp:226 msgid "Photo" msgstr "புகைப்படம்" #: src/iptux/DataSettings.cpp:238 msgid "Signature" msgstr "கையொப்பம்" #: src/iptux/DataSettings.cpp:271 msgid "Port:" msgstr "போர்ட்:" #: src/iptux/DataSettings.cpp:278 msgid "Any port number between 1024 and 65535, default is 2425" msgstr "1024 முதல் 65535 வரை எந்த துறைமுகம் எண்ணும், இயல்புநிலை 2425 ஆகும்" #: src/iptux/DataSettings.cpp:287 msgid "Candidate network encodings:" msgstr "வேட்பாளர் பிணையம் குறியாக்கங்கள்:" #: src/iptux/DataSettings.cpp:294 msgid "Candidate network encodings, separated by \",\"" msgstr "வேட்பாளர் பிணையம் குறியாக்கங்கள், \",\"" #: src/iptux/DataSettings.cpp:301 msgid "Preferred network encoding:" msgstr "விருப்பமான பிணைய குறியாக்கம்:" #: src/iptux/DataSettings.cpp:308 msgid "" "Preference network coding (You should be aware of what you are doing if you " "want to modify it.)" msgstr "" "முன்னுரிமை பிணையம் குறியீட்டு முறை (நீங்கள் அதை மாற்ற விரும்பினால் நீங்கள் என்ன செய்கிறீர்கள் " "என்பதை நீங்கள் அறிந்திருக்க வேண்டும்.)" #: src/iptux/DataSettings.cpp:316 msgid "Pal's default face picture:" msgstr "PAN இன் இயல்புநிலை முகம் படம்:" #: src/iptux/DataSettings.cpp:334 msgid "Panel font:" msgstr "குழு எழுத்துரு:" #: src/iptux/DataSettings.cpp:346 msgid "Automatically open the chat dialog" msgstr "அரட்டை உரையாடலை தானாகத் திறக்கவும்" #: src/iptux/DataSettings.cpp:354 msgid "Automatically hide the panel after login" msgstr "உள்நுழைந்த பிறகு தானாக பேனலை மறைக்கவும்" #: src/iptux/DataSettings.cpp:362 msgid "Automatically open the File Transmission Management" msgstr "கோப்பு பரிமாற்ற நிர்வாகத்தை தானாகத் திறக்கவும்" #: src/iptux/DataSettings.cpp:370 msgid "Use the 'Enter' key to send message" msgstr "செய்தியை அனுப்ப 'Enter' விசையைப் பயன்படுத்தவும்" #: src/iptux/DataSettings.cpp:378 msgid "Automatically clean up the chat history" msgstr "அரட்டை வரலாற்றை தானாக தூய்மை செய்யுங்கள்" #: src/iptux/DataSettings.cpp:385 msgid "Save the chat history" msgstr "அரட்டை வரலாற்றைக் காப்பாற்றுங்கள்" #: src/iptux/DataSettings.cpp:393 msgid "Use the Blacklist (NOT recommended)" msgstr "தடுப்புப்பட்டியலைப் பயன்படுத்தவும் (பரிந்துரைக்கப்படவில்லை)" #: src/iptux/DataSettings.cpp:401 msgid "Filter the request of sharing files" msgstr "கோப்புகளைப் பகிர்வதற்கான கோரிக்கையை வடிகட்டவும்" #: src/iptux/DataSettings.cpp:408 msgid "Hide the taskbar when the main window is minimized" msgstr "முதன்மையான சாளரம் குறைக்கப்படும்போது பணிப்பட்டியை மறைக்கவும்" #: src/iptux/DataSettings.cpp:432 msgid "From:" msgstr "இருந்து:" #: src/iptux/DataSettings.cpp:438 msgid "Beginning of the IP(v4) section" msgstr "ஐபி (வி 4) பிரிவின் துவக்கம்" #: src/iptux/DataSettings.cpp:442 msgid "To:" msgstr "இதற்கு:" #: src/iptux/DataSettings.cpp:448 msgid "End of the IP(v4) section" msgstr "IPv4 இன் முடிவு) பிரிவு" #: src/iptux/DataSettings.cpp:456 msgid "Add" msgstr "கூட்டு" #: src/iptux/DataSettings.cpp:461 msgid "Delete" msgstr "நீக்கு" #: src/iptux/DataSettings.cpp:468 msgid "Added IP(v4) Section:" msgstr "ஐபி (வி 4) பிரிவு சேர்க்கப்பட்டது:" #: src/iptux/DataSettings.cpp:487 msgid "Import" msgstr "இறக்குமதி" #: src/iptux/DataSettings.cpp:491 msgid "Export" msgstr "ஏற்றுமதி" #: src/iptux/DataSettings.cpp:495 src/iptux/TransWindow.cpp:171 msgid "Clear" msgstr "தெளிவான" #: src/iptux/DataSettings.cpp:706 msgid "From" msgstr "இருந்து" #: src/iptux/DataSettings.cpp:713 msgid "To" msgstr "பெறுநர்" #: src/iptux/DataSettings.cpp:720 msgid "Description" msgstr "விவரம்" #: src/iptux/DataSettings.cpp:736 msgid "Please select download folder" msgstr "பதிவிறக்க கோப்புறையைத் தேர்ந்தெடுக்கவும்" #: src/iptux/DataSettings.cpp:758 msgid "Select Font" msgstr "எழுத்துருவைத் தேர்ந்தெடுக்கவும்" #: src/iptux/DataSettings.cpp:872 src/iptux/DataSettings.cpp:874 #: src/iptux/DataSettings.cpp:878 msgid "Port must be a number between 1024 and 65535" msgstr "துறைமுகம் 1024 முதல் 65535 வரை இருக்க வேண்டும்" #: src/iptux/DataSettings.cpp:1019 src/iptux/DataSettings.cpp:1050 #, c-format msgid "" "Fopen() file \"%s\" failed!\n" "%s" msgstr "" "Fopen () கோப்பு \"%s\" தோல்வியுற்றது!\n" " %s" #: src/iptux/DataSettings.cpp:1150 src/iptux/RevisePal.cpp:419 msgid "Please select a face picture" msgstr "முகம் படத்தைத் தேர்ந்தெடுக்கவும்" #: src/iptux/DataSettings.cpp:1172 msgid "Please select a personal photo" msgstr "தனிப்பட்ட புகைப்படத்தைத் தேர்ந்தெடுக்கவும்" #: src/iptux/DataSettings.cpp:1241 src/iptux/DataSettings.cpp:1248 #: src/iptux/DetectPal.cpp:75 #, fuzzy, c-format msgid "" "\n" "Illegal IP(v4) address: %s!" msgstr "" "\n" "சட்டவிரோத ஐபிவி 4) முகவரி!" #: src/iptux/DataSettings.cpp:1346 msgid "Please select a file to import data" msgstr "தரவை இறக்குமதி செய்ய ஒரு கோப்பைத் தேர்ந்தெடுக்கவும்" #: src/iptux/DataSettings.cpp:1347 src/iptux/DialogBase.cpp:358 #: src/iptux/ShareFile.cpp:418 src/iptux/callback.cpp:86 msgid "_Open" msgstr "_OPEN" #: src/iptux/DataSettings.cpp:1394 msgid "Save data to file" msgstr "தரவை கோப்பில் சேமிக்கவும்" #: src/iptux/DataSettings.cpp:1395 src/iptux/DialogBase.cpp:919 #: src/iptux/dialog.cpp:231 msgid "_Save" msgstr "_சேவ்" #: src/iptux/DetectPal.cpp:70 #, c-format msgid "The notification has been sent to %s." msgstr "அறிவிப்பு %s க்கு அனுப்பப்பட்டுள்ளது." #: src/iptux/DialogBase.cpp:214 #, c-format msgid "%s To Send." msgstr "அனுப்ப %s." #: src/iptux/DialogBase.cpp:272 msgid "Close" msgstr "மூடு" #: src/iptux/DialogBase.cpp:276 src/iptux/DialogGroup.cpp:375 msgid "Send" msgstr "அனுப்பு" #: src/iptux/DialogBase.cpp:307 msgid "Chat History" msgstr "அரட்டை வரலாறு" #: src/iptux/DialogBase.cpp:350 msgid "Choose enclosure files" msgstr "அடைப்பு கோப்புகளைத் தேர்வுசெய்க" #: src/iptux/DialogBase.cpp:353 msgid "Choose enclosure folders" msgstr "அடைப்பு கோப்புறைகளைத் தேர்வுசெய்க" #: src/iptux/DialogBase.cpp:593 msgid "Remove Selected" msgstr "தேர்ந்தெடுக்கப்பட்டதை அகற்று" #: src/iptux/DialogBase.cpp:648 msgid "File to send." msgstr "அனுப்ப கோப்பு." #: src/iptux/DialogBase.cpp:653 msgid "Sending progress." msgstr "முன்னேற்றம் அனுப்புகிறது." #: src/iptux/DialogBase.cpp:656 msgid "Dirs" msgstr "Dirs" #: src/iptux/DialogBase.cpp:659 msgid "Files" msgstr "கோப்புகள்" #: src/iptux/DialogBase.cpp:662 src/iptux/DialogPeer.cpp:565 msgid "Detail" msgstr "விவரம்" #: src/iptux/DialogBase.cpp:712 msgid "PeerName" msgstr "Peername" #: src/iptux/DialogBase.cpp:719 src/iptux/DialogPeer.cpp:716 msgid "Name" msgstr "பெயர்" #: src/iptux/DialogBase.cpp:725 src/iptux/DialogPeer.cpp:652 #: src/iptux/DialogPeer.cpp:722 src/iptux/ShareFile.cpp:280 #: src/iptux/TransWindow.cpp:271 msgid "Size" msgstr "அளவு" #: src/iptux/DialogBase.cpp:731 msgid "Path" msgstr "பாதை" #: src/iptux/DialogBase.cpp:792 msgid "Sending Progress." msgstr "முன்னேற்றம் அனுப்புகிறது." #: src/iptux/DialogBase.cpp:795 #, c-format msgid "%s of %s Sent." msgstr "%s அனுப்பப்பட்ட %s." #: src/iptux/DialogBase.cpp:802 src/iptux/DialogPeer.cpp:835 msgid "Mission Completed!" msgstr "பணி முடிந்தது!" #: src/iptux/DialogBase.cpp:845 src/iptux/DialogBase.cpp:917 msgid "Save Image" msgstr "படத்தை சேமிக்கவும்" #: src/iptux/DialogBase.cpp:850 msgid "Copy Image" msgstr "படத்தை நகலெடுக்கவும்" #: src/iptux/DialogGroup.cpp:285 msgid "Member" msgstr "உறுப்பினர்" #: src/iptux/DialogGroup.cpp:382 msgid "Pals" msgstr "பால்ச்" #: src/iptux/DialogGroup.cpp:480 msgid "Select All" msgstr "அனைத்தையும் தெரிவுசெய்" #: src/iptux/DialogGroup.cpp:485 msgid "Reverse Select" msgstr "தலைகீழ் தேர்ந்தெடுக்கவும்" #: src/iptux/DialogGroup.cpp:490 msgid "Clear Up" msgstr "அழிக்கவும்" #: src/iptux/DialogGroup.cpp:728 #, c-format msgid "Talk with the group %s" msgstr "%s குழுவுடன் பேசுங்கள்" #: src/iptux/DialogPeer.cpp:132 #, c-format msgid "Talk with %s(%s) IP:%s" msgstr "%s (%s) ip உடன் பேசுங்கள்:%s" #: src/iptux/DialogPeer.cpp:305 msgid "Info." msgstr "செய்தி." #: src/iptux/DialogPeer.cpp:337 #, c-format msgid "Version: %s\n" msgstr "பதிப்பு: %s\n" #: src/iptux/DialogPeer.cpp:339 #, c-format msgid "Nickname: %s@%s\n" msgstr "புனைப்பெயர்: %s@ %s\n" #: src/iptux/DialogPeer.cpp:342 #, c-format msgid "Nickname: %s\n" msgstr "புனைப்பெயர்: %s\n" #: src/iptux/DialogPeer.cpp:344 #, c-format msgid "User: %s\n" msgstr "பயனர்: %s\n" #: src/iptux/DialogPeer.cpp:345 #, c-format msgid "Host: %s\n" msgstr "ஓச்ட்: %s\n" #: src/iptux/DialogPeer.cpp:348 #, c-format msgid "Address: %s(%s)\n" msgstr "முகவரி: %s ( %s)\n" #: src/iptux/DialogPeer.cpp:350 #, c-format msgid "Address: %s\n" msgstr "முகவரி: %s\n" #: src/iptux/DialogPeer.cpp:353 msgid "Compatibility: Microsoft\n" msgstr "பொருந்தக்கூடிய தன்மை: மைக்ரோசாப்ட்\n" #: src/iptux/DialogPeer.cpp:355 msgid "Compatibility: GNU/Linux\n" msgstr "பொருந்தக்கூடிய தன்மை: குனு/லினக்ச்\n" #: src/iptux/DialogPeer.cpp:357 #, c-format msgid "System coding: %s\n" msgstr "கணினி குறியீட்டு முறை: %s\n" #: src/iptux/DialogPeer.cpp:362 msgid "Signature:\n" msgstr "கையொப்பம்:\n" #: src/iptux/DialogPeer.cpp:369 msgid "" "\n" "Photo:\n" msgstr "" "\n" "புகைப்படம்:\n" #: src/iptux/DialogPeer.cpp:460 msgid "Please select a picture to insert the buffer" msgstr "இடையகத்தை செருக ஒரு படத்தைத் தேர்ந்தெடுக்கவும்" #: src/iptux/DialogPeer.cpp:486 src/iptux/resources/gtk/menus.ui:83 #: src/iptux/resources/gtk/menus.ui:228 #, fuzzy msgid "Insert Image" msgstr "படத்தை சேமிக்கவும்" #: src/iptux/DialogPeer.cpp:502 msgid "Enclosure." msgstr "அடைப்பு." #: src/iptux/DialogPeer.cpp:547 msgid "Files to be received" msgstr "பெற வேண்டிய கோப்புகள்" #: src/iptux/DialogPeer.cpp:551 msgid "Receiving progress." msgstr "முன்னேற்றத்தைப் பெறுகிறது." #: src/iptux/DialogPeer.cpp:554 msgid "Accept" msgstr "ஏற்றுக்கொள்" #: src/iptux/DialogPeer.cpp:560 src/iptux/dialog.cpp:63 #: src/iptux/resources/gtk/menus.ui:342 msgid "Refuse" msgstr "மறுக்கவும்" #: src/iptux/DialogPeer.cpp:596 msgid "File received." msgstr "கோப்பு பெறப்பட்டது." #: src/iptux/DialogPeer.cpp:639 src/iptux/DialogPeer.cpp:710 msgid "Source" msgstr "மூலம்" #: src/iptux/DialogPeer.cpp:646 msgid "SaveAs" msgstr "சேவியாச்" #: src/iptux/DialogPeer.cpp:818 src/iptux/DialogPeer.cpp:884 msgid "Receiving Progress." msgstr "முன்னேற்றத்தைப் பெறுகிறது." #: src/iptux/DialogPeer.cpp:821 src/iptux/DialogPeer.cpp:887 #, c-format msgid "%s to Receive." msgstr "பெற %s." #: src/iptux/DialogPeer.cpp:825 src/iptux/DialogPeer.cpp:891 #, c-format msgid "%s Of %s Received." msgstr "%s பெறப்பட்ட %s." #: src/iptux/LogSystem.cpp:71 #, fuzzy, c-format msgid "Recevied-From: Nickname:%s User:%s Host:%s" msgstr "பெறப்பட்டது: புனைப்பெயர்:%s பயனர்:%ஓச்டாக:%s" #: src/iptux/LogSystem.cpp:76 #, c-format msgid "Send-To: Nickname:%s User:%s Host:%s" msgstr "அனுப்பு: புனைப்பெயர்:%s பயனர்:%s ஓச்ட்:%s" #: src/iptux/LogSystem.cpp:80 msgid "Send-Broadcast" msgstr "அனுப்பு-ஒளிபரப்பு" #: src/iptux/LogSystem.cpp:99 #, c-format msgid "User:%s Host:%s" msgstr "பயனர்:%s ஓச்ட்:%s" #: src/iptux/MainWindow.cpp:570 msgid "Pals Online: 0" msgstr "PALS ஆன்லைன்: 0" #: src/iptux/MainWindow.cpp:655 msgid "Search Pals" msgstr "நண்பர்களைத் தேடுங்கள்" #: src/iptux/MainWindow.cpp:768 msgid "Nickname" msgstr "புனைப்பெயர்" #: src/iptux/MainWindow.cpp:778 msgid "Group" msgstr "குழு" #: src/iptux/MainWindow.cpp:784 src/iptux/TransWindow.cpp:258 msgid "IPv4" msgstr "Iprsh" #: src/iptux/MainWindow.cpp:790 msgid "User" msgstr "பயனர்" #: src/iptux/MainWindow.cpp:796 src/iptux/resources/gtk/MainWindow.ui:81 msgid "Host" msgstr "விருந்தோம்பி" #: src/iptux/MainWindow.cpp:935 #, c-format msgid "Pals Online: %d" msgstr "PALS ஆன்லைனில்: %d" #: src/iptux/RevisePal.cpp:109 msgid "Change Pal's Information" msgstr "பால் இன் தகவல்களை மாற்றவும்" #: src/iptux/RevisePal.cpp:134 msgid "Pal's nickname:" msgstr "நண்பரின் புனைப்பெயர்:" #: src/iptux/RevisePal.cpp:140 msgid "Please input pal's new nickname!" msgstr "நண்பரின் புதிய புனைப்பெயரை உள்ளிடவும்!" #: src/iptux/RevisePal.cpp:146 msgid "Pal's group name:" msgstr "PAN இன் குழு பெயர்:" #: src/iptux/RevisePal.cpp:152 msgid "Please input pal's new group name!" msgstr "நண்பரின் புதிய குழு பெயரை உள்ளிடவும்!" #: src/iptux/RevisePal.cpp:158 msgid "System coding:" msgstr "கணினி குறியீட்டு முறை:" #: src/iptux/RevisePal.cpp:164 msgid "Be SURE to know what you are doing!" msgstr "நீங்கள் என்ன செய்கிறீர்கள் என்பதை அறிந்து கொள்ளுங்கள்!" #: src/iptux/RevisePal.cpp:170 msgid "Pal's face picture:" msgstr "நண்பரின் முகம் படம்:" #: src/iptux/RevisePal.cpp:184 msgid "Be compatible with iptux's protocol (DANGEROUS)" msgstr "ஐபிடக்சின் நெறிமுறையுடன் (ஆபத்தானது) இணக்கமாக இருங்கள்" #: src/iptux/ShareFile.cpp:104 msgid "Shared Files Management" msgstr "பகிரப்பட்ட கோப்புகள் மேலாண்மை" #: src/iptux/ShareFile.cpp:105 msgid "OK" msgstr "சரி" #: src/iptux/ShareFile.cpp:106 msgid "Apply" msgstr "இடு" #: src/iptux/ShareFile.cpp:107 msgid "Cancel" msgstr "ரத்துசெய்" #: src/iptux/ShareFile.cpp:160 msgid "Add Files" msgstr "கோப்புகளைச் சேர்" #: src/iptux/ShareFile.cpp:163 msgid "Add Folders" msgstr "கோப்புறைகளைச் சேர்க்கவும்" #: src/iptux/ShareFile.cpp:166 msgid "Delete Resources" msgstr "வளங்களை நீக்கு" #: src/iptux/ShareFile.cpp:169 msgid "Clear Password" msgstr "கடவுச்சொல்லை அழிக்கவும்" #: src/iptux/ShareFile.cpp:172 msgid "Set Password" msgstr "கடவுச்சொல்லை அமைக்கவும்" #: src/iptux/ShareFile.cpp:229 src/iptux/ShareFile.cpp:373 msgid "regular" msgstr "வழக்கமான" #: src/iptux/ShareFile.cpp:233 src/iptux/ShareFile.cpp:377 msgid "directory" msgstr "அடைவு" #: src/iptux/ShareFile.cpp:237 src/iptux/ShareFile.cpp:381 msgid "unknown" msgstr "தெரியவில்லை" #: src/iptux/ShareFile.cpp:270 msgid "File" msgstr "கோப்பு" #: src/iptux/ShareFile.cpp:286 msgid "Type" msgstr "வகை" #: src/iptux/ShareFile.cpp:411 msgid "Choose the files to share" msgstr "பகிர கோப்புகளைத் தேர்வுசெய்க" #: src/iptux/ShareFile.cpp:414 msgid "Choose the folders to share" msgstr "பகிர்ந்து கொள்ள கோப்புறைகளைத் தேர்வுசெய்க" #: src/iptux/TransWindow.cpp:86 msgid "Files Transmission Management" msgstr "கோப்புகள் பரிமாற்ற மேலாண்மை" #: src/iptux/TransWindow.cpp:241 msgid "State" msgstr "மாநிலம்" #: src/iptux/TransWindow.cpp:247 msgid "Task" msgstr "பணி" #: src/iptux/TransWindow.cpp:253 msgid "Peer" msgstr "ஒப்பி" #: src/iptux/TransWindow.cpp:265 msgid "Filename" msgstr "கோப்புப்பெயர்" #: src/iptux/TransWindow.cpp:277 msgid "Completed" msgstr "முடிந்தது" #: src/iptux/TransWindow.cpp:284 msgid "Progress" msgstr "முன்னேற்றம்" #: src/iptux/TransWindow.cpp:291 msgid "Cost" msgstr "செலவு" #: src/iptux/TransWindow.cpp:297 msgid "Remaining" msgstr "மீதமுள்ள" #: src/iptux/TransWindow.cpp:303 msgid "Rate" msgstr "விகிதம்" #: src/iptux/TransWindow.cpp:331 msgid "The path you want to open not exist!" msgstr "நீங்கள் திறக்க விரும்பும் பாதை இல்லை!" #: src/iptux/TransWindow.cpp:405 msgid "The file you want to open not exist!" msgstr "நீங்கள் திறக்க விரும்பும் கோப்பு இல்லை!" #: src/iptux/TransWindow.cpp:406 msgid "iptux Error" msgstr "ஐபிடக்ச் பிழை" #: src/iptux/UiCoreThread.cpp:254 src/iptux/UiCoreThread.cpp:278 #: src/iptux/UiCoreThread.cpp:377 src/iptux/UiCoreThread.cpp:399 msgid "Others" msgstr "மற்றவர்கள்" #: src/iptux/UiCoreThread.cpp:419 msgid "Broadcast" msgstr "ஒளிபரப்பு" #: src/iptux/UiHelper.cpp:28 #, c-format msgid "Can't convert path to uri: %s, reason: %s" msgstr "யூரி ஆக பாதையை மாற்ற முடியாது: %s, காரணம்: %s" #: src/iptux/UiHelper.cpp:39 #, c-format msgid "Can't open path: %s, reason: %s" msgstr "பாதையைத் திறக்க முடியாது: %s, காரணம்: %s" #: src/iptux/UiHelper.cpp:68 #, c-format msgid "Can't open URL: %s, reason: %s" msgstr "முகவரி ஐ திறக்க முடியாது: %s, காரணம்: %s" #: src/iptux/UiHelper.cpp:188 msgid "Information" msgstr "தகவல்" #: src/iptux/UiHelper.cpp:218 msgid "Warning" msgstr "எச்சரிக்கை" #: src/iptux/UiModels.cpp:604 #, c-format msgid "Version: %s" msgstr "பதிப்பு: %s" #: src/iptux/UiModels.cpp:608 #, c-format msgid "Nickname: %s@%s" msgstr "புனைப்பெயர்: %s@ %s" #: src/iptux/UiModels.cpp:611 #, c-format msgid "Nickname: %s" msgstr "புனைப்பெயர்: %s" #: src/iptux/UiModels.cpp:615 #, c-format msgid "User: %s" msgstr "பயனர்: %s" #: src/iptux/UiModels.cpp:618 #, c-format msgid "Host: %s" msgstr "ஓச்ட்: %s" #: src/iptux/UiModels.cpp:623 #, c-format msgid "Address: %s(%s)" msgstr "முகவரி: %s ( %s)" #: src/iptux/UiModels.cpp:625 #, c-format msgid "Address: %s" msgstr "முகவரி: %s" #: src/iptux/UiModels.cpp:630 msgid "Compatibility: Microsoft" msgstr "பொருந்தக்கூடிய தன்மை: மைக்ரோசாப்ட்" #: src/iptux/UiModels.cpp:632 msgid "Compatibility: GNU/Linux" msgstr "பொருந்தக்கூடிய தன்மை: குனு/லினக்ச்" #: src/iptux/UiModels.cpp:636 #, c-format msgid "System coding: %s" msgstr "கணினி குறியீட்டு முறை: %s" #: src/iptux/UiModels.cpp:641 msgid "Signature:" msgstr "கையொப்பம்:" #: src/iptux/UiModels.cpp:744 msgid "" msgstr "<பிழை>" #: src/iptux/UiModels.cpp:799 msgid "[IMG]" msgstr "[IMG]" #: src/iptux/dialog.cpp:39 msgid "" "File transfer has not been completed.\n" "Are you sure to cancel and quit?" msgstr "" "கோப்பு பரிமாற்றம் முடிக்கப்படவில்லை.\n" " ரத்து செய்து வெளியேறுவது உறுதி?" #: src/iptux/dialog.cpp:42 msgid "Confirm Exit" msgstr "வெளியேறுவதை உறுதிப்படுத்தவும்" #: src/iptux/dialog.cpp:62 src/iptux/resources/gtk/MainWindow.ui:12 #: src/iptux/resources/gtk/menus.ui:98 src/iptux/resources/gtk/menus.ui:243 msgid "Request Shared Resources" msgstr "பகிரப்பட்ட ஆதாரங்களைக் கோருங்கள்" #: src/iptux/dialog.cpp:62 msgid "Agree" msgstr "ஒப்புக்கொள்கிறேன்" #: src/iptux/dialog.cpp:78 #, c-format msgid "" "Your pal (%s)[%s]\n" "is requesting to get your shared resources,\n" "Do you agree?" msgstr "" "உங்கள் பால் (%s) [%s]\n" " நீங்கள் பகிரப்பட்ட வளங்களைப் பெறுமாறு கேட்டுக்கொள்கிறார்,\n" " நீங்கள் ஒப்புக்கொள்கிறீர்களா?" #: src/iptux/dialog.cpp:106 msgid "Access Password" msgstr "கடவுச்சொல்லை அணுகவும்" #: src/iptux/dialog.cpp:113 msgid "Please input the password for the shared files behind" msgstr "பின்னால் பகிரப்பட்ட கோப்புகளுக்கான கடவுச்சொல்லை உள்ளிடவும்" #: src/iptux/dialog.cpp:127 #, c-format msgid "(%s)[%s]Password:" msgstr "(%s) [%s] கடவுச்சொல்:" #: src/iptux/dialog.cpp:146 src/iptux/dialog.cpp:207 msgid "" "\n" "Empty Password!" msgstr "" "\n" "வெற்று கடவுச்சொல்!" #: src/iptux/dialog.cpp:170 msgid "Enter a New Password" msgstr "புதிய கடவுச்சொல்லை உள்ளிடவும்" #: src/iptux/dialog.cpp:178 msgid "Password: " msgstr "கடவுச்சொல்: " #: src/iptux/dialog.cpp:187 msgid "Repeat: " msgstr "மீண்டும்: " #: src/iptux/dialog.cpp:202 msgid "" "\n" "Password Mismatched!" msgstr "" "\n" "கடவுச்சொல் பொருந்தவில்லை!" #: src/iptux/dialog.cpp:229 msgid "Please select a folder to save files." msgstr "கோப்புகளைச் சேமிக்க ஒரு கோப்புறையைத் தேர்ந்தெடுக்கவும்." #: src/iptux/resources/gtk/AboutDialog.ui:11 msgid "" "Copyright © 2008–2009, Jally\n" "Copyright © 2013–2015,2017–2021, LI Daobing" msgstr "" "பதிப்புரிமை © 2008-2009, சாலி\n" " பதிப்புரிமை © 2013–2015,2017–2021, லி டாபிங்" #: src/iptux/resources/gtk/AboutDialog.ui:13 msgid "A GTK based LAN messenger." msgstr "ஒரு சி.டி.கே அடிப்படையிலான லேன் மெசஞ்சர்." #: src/iptux/resources/gtk/AppIndicator.ui:6 msgid "Open Iptux" msgstr "ஐபிடக்ச் திறக்கவும்" #: src/iptux/resources/gtk/AppIndicator.ui:12 #: src/iptux/resources/gtk/menus.ui:6 src/iptux/resources/gtk/menus.ui:306 msgid "_Preferences" msgstr "_ முனைகள்" #: src/iptux/resources/gtk/AppIndicator.ui:16 #: src/iptux/resources/gtk/menus.ui:10 src/iptux/resources/gtk/menus.ui:310 msgid "_Quit" msgstr "_Quit" #: src/iptux/resources/gtk/DetectPal.ui:7 msgid "Detect pal" msgstr "நண்பரைக் கண்டறியவும்" #: src/iptux/resources/gtk/DetectPal.ui:15 msgid "Detect" msgstr "கண்டறியவும்" #: src/iptux/resources/gtk/DetectPal.ui:61 msgid "Please input an IP address (IPv4 only):" msgstr "தயவுசெய்து ஒரு ஐபி முகவரியை உள்ளிடவும் (ஐபிவி 4 மட்டும்):" #: src/iptux/resources/gtk/MainWindow.ui:8 src/iptux/resources/gtk/menus.ui:109 #: src/iptux/resources/gtk/menus.ui:254 msgid "Send Message" msgstr "செய்தி அனுப்பவும்" #: src/iptux/resources/gtk/MainWindow.ui:16 msgid "Change Info" msgstr "தகவலை மாற்றவும்" #: src/iptux/resources/gtk/MainWindow.ui:20 msgid "Delete Pal" msgstr "நண்பரை நீக்கு" #: src/iptux/resources/gtk/MainWindow.ui:26 src/iptux/resources/gtk/menus.ui:31 #: src/iptux/resources/gtk/menus.ui:176 msgid "Sort" msgstr "வரிசைப்படுத்து" #: src/iptux/resources/gtk/MainWindow.ui:29 src/iptux/resources/gtk/menus.ui:34 #: src/iptux/resources/gtk/menus.ui:179 msgid "By Nickname" msgstr "மூலம் புனைப்பெயர்" #: src/iptux/resources/gtk/MainWindow.ui:34 src/iptux/resources/gtk/menus.ui:39 #: src/iptux/resources/gtk/menus.ui:184 msgid "By Username" msgstr "பயனர்பெயர் மூலம்" #: src/iptux/resources/gtk/MainWindow.ui:39 src/iptux/resources/gtk/menus.ui:44 #: src/iptux/resources/gtk/menus.ui:189 msgid "By IP" msgstr "ஐபி மூலம்" #: src/iptux/resources/gtk/MainWindow.ui:44 src/iptux/resources/gtk/menus.ui:49 #: src/iptux/resources/gtk/menus.ui:194 msgid "By Host" msgstr "வழங்கியவர்" #: src/iptux/resources/gtk/MainWindow.ui:49 src/iptux/resources/gtk/menus.ui:54 #: src/iptux/resources/gtk/menus.ui:199 msgid "By Last Activity" msgstr "கடைசி செயல்பாட்டின் மூலம்" #: src/iptux/resources/gtk/MainWindow.ui:56 src/iptux/resources/gtk/menus.ui:61 #: src/iptux/resources/gtk/menus.ui:206 msgid "Ascending" msgstr "ஏறுதல்" #: src/iptux/resources/gtk/MainWindow.ui:61 src/iptux/resources/gtk/menus.ui:66 #: src/iptux/resources/gtk/menus.ui:211 msgid "Descending" msgstr "இறங்கு" #: src/iptux/resources/gtk/MainWindow.ui:68 msgid "Info Style" msgstr "செய்தி நடை" #: src/iptux/resources/gtk/MainWindow.ui:71 msgid "IP" msgstr "ஐபி" #: src/iptux/resources/gtk/MainWindow.ui:76 msgid "IP:PORT" msgstr "ஐபி: துறைமுகம்" #: src/iptux/resources/gtk/MainWindow.ui:86 msgid "Username" msgstr "பயனர்பெயர்" #: src/iptux/resources/gtk/MainWindow.ui:91 msgid "Version" msgstr "பதிப்பு" #: src/iptux/resources/gtk/MainWindow.ui:96 msgid "Last Activity" msgstr "கடைசி செயல்பாடு" #: src/iptux/resources/gtk/MainWindow.ui:101 msgid "Last Message" msgstr "கடைசி செய்தி" #: src/iptux/resources/gtk/menus.ui:17 src/iptux/resources/gtk/menus.ui:162 msgid "_File" msgstr "கோப்பு (_F)" #: src/iptux/resources/gtk/menus.ui:19 src/iptux/resources/gtk/menus.ui:164 msgid "_Detect" msgstr "_ டிடெக்ட்" #: src/iptux/resources/gtk/menus.ui:23 src/iptux/resources/gtk/menus.ui:168 msgid "_Find" msgstr "_ ஃபைண்ட்" #: src/iptux/resources/gtk/menus.ui:28 src/iptux/resources/gtk/menus.ui:173 msgid "_View" msgstr "காட்சி (_V)" #: src/iptux/resources/gtk/menus.ui:73 src/iptux/resources/gtk/menus.ui:218 msgid "_Refresh" msgstr "_Refresh" #: src/iptux/resources/gtk/menus.ui:80 src/iptux/resources/gtk/menus.ui:225 msgid "_Chat" msgstr "_சாட்" #: src/iptux/resources/gtk/menus.ui:88 src/iptux/resources/gtk/menus.ui:233 msgid "Attach File" msgstr "கோப்பை இணைக்கவும்" #: src/iptux/resources/gtk/menus.ui:92 src/iptux/resources/gtk/menus.ui:237 msgid "Attach Folder" msgstr "கோப்புறையை இணைக்கவும்" #: src/iptux/resources/gtk/menus.ui:102 src/iptux/resources/gtk/menus.ui:247 msgid "Clear Chat History" msgstr "அரட்டை வரலாற்றை அழிக்கவும்" #: src/iptux/resources/gtk/menus.ui:115 src/iptux/resources/gtk/menus.ui:260 msgid "_Window" msgstr "_ சாளரம்" #: src/iptux/resources/gtk/menus.ui:118 src/iptux/resources/gtk/menus.ui:263 msgid "_Transmission" msgstr "_பரவும் முறை" #: src/iptux/resources/gtk/menus.ui:122 src/iptux/resources/gtk/menus.ui:267 msgid "_Shared Management" msgstr "_ சேர் மேனேச்மென்ட்" #: src/iptux/resources/gtk/menus.ui:126 src/iptux/resources/gtk/menus.ui:271 msgid "_Chat Log" msgstr "_சாட் பதிவு" #: src/iptux/resources/gtk/menus.ui:130 src/iptux/resources/gtk/menus.ui:275 msgid "_System Log" msgstr "_ சிச்டம் பதிவு" #: src/iptux/resources/gtk/menus.ui:136 src/iptux/resources/gtk/menus.ui:281 msgid "Close Window" msgstr "சாளரத்தை மூடு" #: src/iptux/resources/gtk/menus.ui:142 src/iptux/resources/gtk/menus.ui:287 msgid "_Help" msgstr "உதவி (_H)" #: src/iptux/resources/gtk/menus.ui:145 src/iptux/resources/gtk/menus.ui:290 msgid "_About" msgstr "_About" #: src/iptux/resources/gtk/menus.ui:149 src/iptux/resources/gtk/menus.ui:294 msgid "Report Bug" msgstr "பிழையைப் புகாரளிக்கவும்" #: src/iptux/resources/gtk/menus.ui:153 src/iptux/resources/gtk/menus.ui:298 msgid "What's New" msgstr "புதியது என்ன" #: src/iptux/resources/gtk/menus.ui:318 msgid "Open This File" msgstr "இந்த கோப்பைத் திறக்கவும்" #: src/iptux/resources/gtk/menus.ui:322 msgid "Open Containing Folder" msgstr "கோப்புறை கொண்ட திறந்த" #: src/iptux/resources/gtk/menus.ui:326 msgid "Terminate Task" msgstr "பணியை நிறுத்துங்கள்" #: src/iptux/resources/gtk/menus.ui:330 msgid "Terminate All" msgstr "அனைத்தையும் நிறுத்தவும்" #: src/iptux/resources/gtk/menus.ui:334 msgid "Clear Tasklist" msgstr "தெளிவான பணிப்பட்டியல்" #: src/iptux/resources/gtk/menus.ui:346 msgid "Refuse All" msgstr "அனைத்தையும் மறுக்கவும்" #: src/main/iptux.cpp:149 msgid "- A software for sharing in LAN" msgstr "- LAN இல் பகிர்வதற்கான மென்பொருள்" #: src/main/iptux.cpp:152 #, c-format msgid "option parsing failed: %s\n" msgstr "விருப்பம் பாகுபடுத்தல் தோல்வியுற்றது: %s\n" #~ msgid "Insert Picture" #~ msgstr "படத்தைச் செருகவும்" iptux-0.9.4/po/uk.po000066400000000000000000001134361475473122500143140ustar00rootroot00000000000000# Russian translation for iptux # Copyright (c) 2014 Rosetta Contributors and Canonical Ltd 2014 # This file is distributed under the same license as the iptux package. # FIRST AUTHOR , 2014. # msgid "" msgstr "" "Project-Id-Version: iptux\n" "Report-Msgid-Bugs-To: https://github.com/iptux-src/iptux/issues/new\n" "POT-Creation-Date: 2025-02-17 13:35-0800\n" "PO-Revision-Date: 2024-01-08 13:06+0000\n" "Last-Translator: Сергій \n" "Language-Team: Ukrainian \n" "Language: ua\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && " "n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" "X-Generator: Weblate 5.4-dev\n" "X-Launchpad-Export-Date: 2018-01-24 12:00+0000\n" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:6 msgid "iptux" msgstr "iptux" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:7 msgid "LAN communication software" msgstr "Програмне забезпечення для зв'язку по локальній мережі" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:17 #, fuzzy msgid "iptux is an “IP Messenger” client. The features of iptux include:" msgstr "iptux — це клієнт «IP Messenger»." #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:21 msgid "auto-detect other clients on the intranet." msgstr "автоматично виявляти інших клієнтів в мережі." #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:22 #, fuzzy msgid "send/recv messages to other clients." msgstr "надсилати повідомлення іншим клієнтам." #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:23 #, fuzzy msgid "send/recv files to other clients." msgstr "надсилати файли іншим клієнтам." #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:24 msgid "share your files to other cliens (with optional password protection)." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:26 msgid "" "It is (supposedly) compatible with 飞鸽传书 (Feige) and 飞秋 (FeiQ) from " "China, and with the original “IP Messenger” clients from Japan, including " "g2ipmsg and xipmsg in Debian." msgstr "" "Він (імовірно) сумісний із 飞鸽传书 (Feige) та 飞秋 (FeiQ) із Китаю та з " "оригінальними клієнтами «IP Messenger» із Японії, включаючи g2ipmsg та " "xipmsg у Debian." #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:38 msgid "The Iptux main window." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:42 msgid "The Iptux chat window." msgstr "" #: src/iptux-core/CoreThread.cpp:172 #, c-format msgid "" "Fatal Error!! Failed to create new socket!\n" "%s" msgstr "" "Помилка!! Не вдалося створити новий сокет!\n" "%s" #: src/iptux-core/CoreThread.cpp:188 #, c-format msgid "" "Fatal Error!! Failed to bind the TCP port(%s:%d)!\n" "%s" msgstr "" "Помилка!! Не вдалося прив’язати порт TCP(%s:%d)!\n" "%s" #: src/iptux-core/CoreThread.cpp:201 #, c-format msgid "" "Fatal Error!! Failed to bind the UDP port(%s:%d)!\n" "%s" msgstr "" "Помилка!! Не вдалося прив’язати порт UDP(%s:%d)!\n" "%s" #: src/iptux-core/CoreThread.cpp:461 src/iptux-core/CoreThread.cpp:495 #: src/iptux-core/internal/RecvFileData.cpp:142 #: src/iptux-core/internal/RecvFileData.cpp:204 #, c-format msgid "" "Fatal Error!!\n" "Failed to create new socket!\n" "%s" msgstr "" "Помилка!!\n" "Не вдалося створити новий сокет!\n" "%s" #: src/iptux-core/Models.cpp:172 msgid "Empty Message" msgstr "Порожнє повідомлення" #: src/iptux-core/Models.cpp:250 msgid "Received an image" msgstr "Отримав зображення" #: src/iptux-core/internal/AnalogFS.cpp:93 #: src/iptux-core/internal/AnalogFS.cpp:98 #, c-format msgid "Open() file \"%s\" failed, %s" msgstr "Відкрити() файл\"%s\"не вдалося %s" #: src/iptux-core/internal/AnalogFS.cpp:117 #, c-format msgid "Stat64() file \"%s\" failed, %s" msgstr "Stat64() файл\"%s\"не вдалося %s" #: src/iptux-core/internal/AnalogFS.cpp:138 #, c-format msgid "Mkdir() directory \"%s\" failed, %s" msgstr "Mkdir() директорію\"%s\"не вдалося %s" #: src/iptux-core/internal/AnalogFS.cpp:164 #, c-format msgid "Opendir() directory \"%s\" failed, %s" msgstr "Відкрити() директорію\"%s\"не вдалося %s" #: src/iptux-core/internal/Command.cpp:226 msgid "Your pal didn't receive the packet. He or she is offline maybe." msgstr "Ваше повідомлення не отримано." #: src/iptux-core/internal/CommandMode.cpp:39 #, c-format msgid "unknown command mode: %d" msgstr "невідома команда (режим) %d" #: src/iptux-core/internal/RecvFileData.cpp:117 msgid "receive" msgstr "отримано" #: src/iptux-core/internal/RecvFileData.cpp:124 #: src/iptux-core/internal/RecvFileData.cpp:253 #: src/iptux-core/internal/SendFileData.cpp:108 #: src/iptux-core/internal/SendFileData.cpp:193 msgid "Unknown" msgstr "Невідомо" #: src/iptux-core/internal/RecvFileData.cpp:175 #, fuzzy, c-format msgid "" "Failed to receive the file \"%s\" from %s! expect length %jd, received %jd" msgstr "Не вдалося отримати файл \"%s\" від %s! очікування%lld, отримано %lld" #: src/iptux-core/internal/RecvFileData.cpp:180 #, c-format msgid "Receive the file \"%s\" from %s successfully!" msgstr "Файл отримано \"%s\" від %s успішно!" #: src/iptux-core/internal/RecvFileData.cpp:320 #, c-format msgid "Failed to receive the directory \"%s\" from %s!" msgstr "Не вдалося отримати каталог \"%s\" від %s!" #: src/iptux-core/internal/RecvFileData.cpp:323 #, c-format msgid "Receive the directory \"%s\" from %s successfully!" msgstr "Каталог отримано\"%s\" від %s успішно!" #: src/iptux-core/internal/SendFileData.cpp:101 msgid "send" msgstr "відправити" #: src/iptux-core/internal/SendFileData.cpp:137 #, c-format msgid "Failed to send the file \"%s\" to %s!" msgstr "Не вдалося надіслати файл \"%s\" до %s!" #: src/iptux-core/internal/SendFileData.cpp:142 #, c-format msgid "Send the file \"%s\" to %s successfully!" msgstr "Надіслати файл \"%s\" %s успішно!" #: src/iptux-core/internal/SendFileData.cpp:265 #, c-format msgid "Failed to send the directory \"%s\" to %s!" msgstr "Не вдалося надіслати каталог \"%s\" до %s!" #: src/iptux-core/internal/SendFileData.cpp:270 #, c-format msgid "Send the directory \"%s\" to %s successfully!" msgstr "Надіслано каталог \"%s\" до %s успішно!" #: src/iptux-core/internal/UdpData.cpp:92 #: src/iptux-core/internal/UdpData.cpp:93 #: src/iptux-core/internal/UdpData.cpp:443 #: src/iptux-core/internal/UdpData.cpp:484 msgid "mysterious" msgstr "таємничий" #: src/iptux-utils/utils.cpp:880 #, c-format msgid "stat file \"%s\" failed: %s" msgstr "cтатистика файлу \"%s\" помилка: %s" #: src/iptux-utils/utils.cpp:888 #, c-format msgid "path %s is not file or directory: st_mode(%x)" msgstr "шлях %s не є файлом або каталогом: st_режим(%x)" #: src/iptux-utils/utils.cpp:895 #, c-format msgid "opendir on \"%s\" failed: %s" msgstr "відкрити каталог \"%s\" не вдалося: %s" #: src/iptux/AboutDialog.cpp:39 msgid "TRANSLATOR NAME" msgstr "Перекладачі з weblate.org️" #: src/iptux/AboutDialog.cpp:53 msgid "Thanks to" msgstr "Завдяки" #: src/iptux/AppIndicator.cpp:40 src/iptux/MainWindow.cpp:505 #: src/iptux/MainWindow.cpp:507 msgid "Iptux" msgstr "Iptux" #: src/iptux/Application.cpp:54 msgid "Loading the process successfully!" msgstr "Успішне завантаження!" #: src/iptux/Application.cpp:274 #, c-format msgid "New Message from %s" msgstr "Нове повідомлення від %s" #: src/iptux/Application.cpp:287 #, c-format msgid "New File from %s" msgstr "Новий файл від %s" #: src/iptux/Application.cpp:296 msgid "Receiving File Finished" msgstr "Отримання файлу завершено" #: src/iptux/Application.cpp:300 msgid "file info no longer exist" msgstr "інформація про файл більше не існує" #: src/iptux/Darwin.cpp:16 #, c-format msgid "Couldn’t load icon: %s" msgstr "Не вдалося завантажити значок: %s" #: src/iptux/DataSettings.cpp:46 msgid "Personal" msgstr "Особисті" #: src/iptux/DataSettings.cpp:48 msgid "System" msgstr "Система" #: src/iptux/DataSettings.cpp:50 msgid "Network" msgstr "Мережа" #: src/iptux/DataSettings.cpp:89 src/iptux/DataSettings.cpp:98 msgid "The program needs to be restarted to take effect!" msgstr "" #: src/iptux/DataSettings.cpp:143 msgid "Preferences" msgstr "⚙️" #: src/iptux/DataSettings.cpp:143 src/iptux/RevisePal.cpp:109 #: src/iptux/dialog.cpp:107 src/iptux/dialog.cpp:170 msgid "_OK" msgstr "_ОК" #: src/iptux/DataSettings.cpp:144 msgid "_Apply" msgstr "_Застосувати" #: src/iptux/DataSettings.cpp:144 src/iptux/DataSettings.cpp:1348 #: src/iptux/DataSettings.cpp:1395 src/iptux/DialogBase.cpp:359 #: src/iptux/DialogBase.cpp:918 src/iptux/RevisePal.cpp:110 #: src/iptux/ShareFile.cpp:419 src/iptux/callback.cpp:87 #: src/iptux/dialog.cpp:171 src/iptux/dialog.cpp:230 msgid "_Cancel" msgstr "_Відміна" #: src/iptux/DataSettings.cpp:169 msgid "Your _nickname:" msgstr "Ваш _псевдонім:" #: src/iptux/DataSettings.cpp:176 msgid "Please input your nickname!" msgstr "Будь ласка, введіть свій псевдонім!" #: src/iptux/DataSettings.cpp:182 msgid "Your _group name:" msgstr "Назва _групи:" #: src/iptux/DataSettings.cpp:189 msgid "Please input your group name!" msgstr "Будь ласка, введіть назву групи!" #: src/iptux/DataSettings.cpp:195 msgid "Your _face picture:" msgstr "Оберіть _зображення:" #: src/iptux/DataSettings.cpp:213 msgid "_Save files to: " msgstr "_Зберегти файл в: " #: src/iptux/DataSettings.cpp:226 msgid "Photo" msgstr "Фото" #: src/iptux/DataSettings.cpp:238 msgid "Signature" msgstr "Підпис" #: src/iptux/DataSettings.cpp:271 msgid "Port:" msgstr "" #: src/iptux/DataSettings.cpp:278 msgid "Any port number between 1024 and 65535, default is 2425" msgstr "" #: src/iptux/DataSettings.cpp:287 msgid "Candidate network encodings:" msgstr "Система кодування мережі:" #: src/iptux/DataSettings.cpp:294 msgid "Candidate network encodings, separated by \",\"" msgstr "Додаткові кодування мережі, розділені \",\"" #: src/iptux/DataSettings.cpp:301 msgid "Preferred network encoding:" msgstr "Бажане мережеве кодування:" #: src/iptux/DataSettings.cpp:308 msgid "" "Preference network coding (You should be aware of what you are doing if you " "want to modify it.)" msgstr "" "Кодування мережі (ви маєте знати, що ви робите, якщо хочете його змінити.)" #: src/iptux/DataSettings.cpp:316 msgid "Pal's default face picture:" msgstr "Зображення за замовчуванням:" #: src/iptux/DataSettings.cpp:334 msgid "Panel font:" msgstr "Шрифт панелі:" #: src/iptux/DataSettings.cpp:346 msgid "Automatically open the chat dialog" msgstr "Автоматично відкривати діалогове вікно чату" #: src/iptux/DataSettings.cpp:354 msgid "Automatically hide the panel after login" msgstr "Автоматично приховати панель після входу" #: src/iptux/DataSettings.cpp:362 msgid "Automatically open the File Transmission Management" msgstr "Автоматично відкривати керування передачею файлів" #: src/iptux/DataSettings.cpp:370 msgid "Use the 'Enter' key to send message" msgstr "Використовувати клавішу «Enter», щоб надіслати повідомлення" #: src/iptux/DataSettings.cpp:378 msgid "Automatically clean up the chat history" msgstr "Автоматично очищати історію чату" #: src/iptux/DataSettings.cpp:385 msgid "Save the chat history" msgstr "Зберігати історію чату" #: src/iptux/DataSettings.cpp:393 msgid "Use the Blacklist (NOT recommended)" msgstr "Використовувати чорний список (НЕ рекомендовано)" #: src/iptux/DataSettings.cpp:401 msgid "Filter the request of sharing files" msgstr "Фільтр на обмін файлами" #: src/iptux/DataSettings.cpp:408 msgid "Hide the taskbar when the main window is minimized" msgstr "" #: src/iptux/DataSettings.cpp:432 msgid "From:" msgstr "Від:" #: src/iptux/DataSettings.cpp:438 msgid "Beginning of the IP(v4) section" msgstr "Початок розділу IP(v4)" #: src/iptux/DataSettings.cpp:442 msgid "To:" msgstr "До:" #: src/iptux/DataSettings.cpp:448 msgid "End of the IP(v4) section" msgstr "Кінець розділу IP(v4)" #: src/iptux/DataSettings.cpp:456 msgid "Add" msgstr "Додати" #: src/iptux/DataSettings.cpp:461 msgid "Delete" msgstr "Видалити" #: src/iptux/DataSettings.cpp:468 msgid "Added IP(v4) Section:" msgstr "Доданий IP(v4 Розділ):" #: src/iptux/DataSettings.cpp:487 msgid "Import" msgstr "Імпорт" #: src/iptux/DataSettings.cpp:491 msgid "Export" msgstr "Експорт" #: src/iptux/DataSettings.cpp:495 src/iptux/TransWindow.cpp:171 msgid "Clear" msgstr "Очистити" #: src/iptux/DataSettings.cpp:706 msgid "From" msgstr "Від" #: src/iptux/DataSettings.cpp:713 msgid "To" msgstr "До" #: src/iptux/DataSettings.cpp:720 msgid "Description" msgstr "Опис" #: src/iptux/DataSettings.cpp:736 msgid "Please select download folder" msgstr "Оберіть папку для завантаження" #: src/iptux/DataSettings.cpp:758 msgid "Select Font" msgstr "Оберіть Шрифт" #: src/iptux/DataSettings.cpp:872 src/iptux/DataSettings.cpp:874 #: src/iptux/DataSettings.cpp:878 msgid "Port must be a number between 1024 and 65535" msgstr "" #: src/iptux/DataSettings.cpp:1019 src/iptux/DataSettings.cpp:1050 #, c-format msgid "" "Fopen() file \"%s\" failed!\n" "%s" msgstr "" "Не вдалося() відкрити \"%s\" файл!\n" "%s" #: src/iptux/DataSettings.cpp:1150 src/iptux/RevisePal.cpp:419 msgid "Please select a face picture" msgstr "Виберіть зображення" #: src/iptux/DataSettings.cpp:1172 msgid "Please select a personal photo" msgstr "Виберіть особисте фото" #: src/iptux/DataSettings.cpp:1241 src/iptux/DataSettings.cpp:1248 #: src/iptux/DetectPal.cpp:75 #, c-format msgid "" "\n" "Illegal IP(v4) address: %s!" msgstr "" "\n" "Заборонена адреса IP(v4): %s!" #: src/iptux/DataSettings.cpp:1346 msgid "Please select a file to import data" msgstr "Виберіть файл для імпорту даних" #: src/iptux/DataSettings.cpp:1347 src/iptux/DialogBase.cpp:358 #: src/iptux/ShareFile.cpp:418 src/iptux/callback.cpp:86 msgid "_Open" msgstr "_Відкрити" #: src/iptux/DataSettings.cpp:1394 msgid "Save data to file" msgstr "Зберегти дані у файл" #: src/iptux/DataSettings.cpp:1395 src/iptux/DialogBase.cpp:919 #: src/iptux/dialog.cpp:231 msgid "_Save" msgstr "_Зберегти" #: src/iptux/DetectPal.cpp:70 #, c-format msgid "The notification has been sent to %s." msgstr "Сповіщення надіслано %s." #: src/iptux/DialogBase.cpp:214 #, c-format msgid "%s To Send." msgstr "%s Надіслати." #: src/iptux/DialogBase.cpp:272 msgid "Close" msgstr "Закрити" #: src/iptux/DialogBase.cpp:276 src/iptux/DialogGroup.cpp:375 msgid "Send" msgstr "Відправити" #: src/iptux/DialogBase.cpp:307 msgid "Chat History" msgstr "Історія чату" #: src/iptux/DialogBase.cpp:350 msgid "Choose enclosure files" msgstr "Виберіть вкладені файли" #: src/iptux/DialogBase.cpp:353 msgid "Choose enclosure folders" msgstr "Виберіть вкладені папки" #: src/iptux/DialogBase.cpp:593 msgid "Remove Selected" msgstr "Видалити вибране" #: src/iptux/DialogBase.cpp:648 msgid "File to send." msgstr "Файл для надсилання." #: src/iptux/DialogBase.cpp:653 msgid "Sending progress." msgstr "Хід надсилання." #: src/iptux/DialogBase.cpp:656 msgid "Dirs" msgstr "Каталог" #: src/iptux/DialogBase.cpp:659 msgid "Files" msgstr "Файли" #: src/iptux/DialogBase.cpp:662 src/iptux/DialogPeer.cpp:565 msgid "Detail" msgstr "Подробиці" #: src/iptux/DialogBase.cpp:712 msgid "PeerName" msgstr "Ім'я піра" #: src/iptux/DialogBase.cpp:719 src/iptux/DialogPeer.cpp:716 msgid "Name" msgstr "Ім'я" #: src/iptux/DialogBase.cpp:725 src/iptux/DialogPeer.cpp:652 #: src/iptux/DialogPeer.cpp:722 src/iptux/ShareFile.cpp:280 #: src/iptux/TransWindow.cpp:271 msgid "Size" msgstr "Розмір" #: src/iptux/DialogBase.cpp:731 msgid "Path" msgstr "Шлях" #: src/iptux/DialogBase.cpp:792 msgid "Sending Progress." msgstr "Хід надсилання." #: src/iptux/DialogBase.cpp:795 #, c-format msgid "%s of %s Sent." msgstr "Відправлено %s від %s." #: src/iptux/DialogBase.cpp:802 src/iptux/DialogPeer.cpp:835 msgid "Mission Completed!" msgstr "Місія завершена!" #: src/iptux/DialogBase.cpp:845 src/iptux/DialogBase.cpp:917 msgid "Save Image" msgstr "" #: src/iptux/DialogBase.cpp:850 msgid "Copy Image" msgstr "" #: src/iptux/DialogGroup.cpp:285 msgid "Member" msgstr "Учасники" #: src/iptux/DialogGroup.cpp:382 msgid "Pals" msgstr "Друзі" #: src/iptux/DialogGroup.cpp:480 msgid "Select All" msgstr "Обрати все" #: src/iptux/DialogGroup.cpp:485 msgid "Reverse Select" msgstr "Відмінити вибір" #: src/iptux/DialogGroup.cpp:490 msgid "Clear Up" msgstr "Прибрати" #: src/iptux/DialogGroup.cpp:728 #, c-format msgid "Talk with the group %s" msgstr "Спілкування в групі %s" #: src/iptux/DialogPeer.cpp:132 #, c-format msgid "Talk with %s(%s) IP:%s" msgstr "Розмова з %s(%s) IP:%s" #: src/iptux/DialogPeer.cpp:305 msgid "Info." msgstr "Информація." #: src/iptux/DialogPeer.cpp:337 #, c-format msgid "Version: %s\n" msgstr "Версія: %s\n" #: src/iptux/DialogPeer.cpp:339 #, c-format msgid "Nickname: %s@%s\n" msgstr "Псевдонім: %s@%s\n" #: src/iptux/DialogPeer.cpp:342 #, c-format msgid "Nickname: %s\n" msgstr "Псевдонім: %s\n" #: src/iptux/DialogPeer.cpp:344 #, c-format msgid "User: %s\n" msgstr "Користувач: %s\n" #: src/iptux/DialogPeer.cpp:345 #, c-format msgid "Host: %s\n" msgstr "Хост: %s\n" #: src/iptux/DialogPeer.cpp:348 #, c-format msgid "Address: %s(%s)\n" msgstr "Адреса: %s(%s)\n" #: src/iptux/DialogPeer.cpp:350 #, c-format msgid "Address: %s\n" msgstr "Адреса: %s\n" #: src/iptux/DialogPeer.cpp:353 msgid "Compatibility: Microsoft\n" msgstr "OS: Microsoft\n" #: src/iptux/DialogPeer.cpp:355 msgid "Compatibility: GNU/Linux\n" msgstr "OS: GNU/Linux\n" #: src/iptux/DialogPeer.cpp:357 #, c-format msgid "System coding: %s\n" msgstr "Система кодування: %s\n" #: src/iptux/DialogPeer.cpp:362 msgid "Signature:\n" msgstr "Підпис:\n" #: src/iptux/DialogPeer.cpp:369 msgid "" "\n" "Photo:\n" msgstr "" "\n" "Фото:\n" #: src/iptux/DialogPeer.cpp:460 msgid "Please select a picture to insert the buffer" msgstr "Виберіть зображення, щоб вставити в буфер" #: src/iptux/DialogPeer.cpp:486 src/iptux/resources/gtk/menus.ui:83 #: src/iptux/resources/gtk/menus.ui:228 #, fuzzy msgid "Insert Image" msgstr "Вставити зображення" #: src/iptux/DialogPeer.cpp:502 msgid "Enclosure." msgstr "Вкладення." #: src/iptux/DialogPeer.cpp:547 msgid "Files to be received" msgstr "Файли для отримання" #: src/iptux/DialogPeer.cpp:551 msgid "Receiving progress." msgstr "Хід отримання." #: src/iptux/DialogPeer.cpp:554 msgid "Accept" msgstr "Приняти" #: src/iptux/DialogPeer.cpp:560 src/iptux/dialog.cpp:63 #: src/iptux/resources/gtk/menus.ui:342 msgid "Refuse" msgstr "Відмінити" #: src/iptux/DialogPeer.cpp:596 msgid "File received." msgstr "Файл отримано." #: src/iptux/DialogPeer.cpp:639 src/iptux/DialogPeer.cpp:710 msgid "Source" msgstr "Джерело" #: src/iptux/DialogPeer.cpp:646 msgid "SaveAs" msgstr "Зберегти як" #: src/iptux/DialogPeer.cpp:818 src/iptux/DialogPeer.cpp:884 msgid "Receiving Progress." msgstr "Хід отримання." #: src/iptux/DialogPeer.cpp:821 src/iptux/DialogPeer.cpp:887 #, c-format msgid "%s to Receive." msgstr "%s для отримання." #: src/iptux/DialogPeer.cpp:825 src/iptux/DialogPeer.cpp:891 #, c-format msgid "%s Of %s Received." msgstr "%s Данні %s Отримано." #: src/iptux/LogSystem.cpp:71 #, c-format msgid "Recevied-From: Nickname:%s User:%s Host:%s" msgstr "Отримано від: Псевдонім:%s Користувачr:%s Host:%s" #: src/iptux/LogSystem.cpp:76 #, c-format msgid "Send-To: Nickname:%s User:%s Host:%s" msgstr "Надіслати: Псевдонім:%s Користувач:%s Host:%s" #: src/iptux/LogSystem.cpp:80 msgid "Send-Broadcast" msgstr "Широкомовна відправка" #: src/iptux/LogSystem.cpp:99 #, c-format msgid "User:%s Host:%s" msgstr "Користувач:%s Host:%s" #: src/iptux/MainWindow.cpp:570 msgid "Pals Online: 0" msgstr "Друзі онлайн: 0" #: src/iptux/MainWindow.cpp:655 msgid "Search Pals" msgstr "Пошук друзів" #: src/iptux/MainWindow.cpp:768 msgid "Nickname" msgstr "Псевдонім" #: src/iptux/MainWindow.cpp:778 msgid "Group" msgstr "Група" #: src/iptux/MainWindow.cpp:784 src/iptux/TransWindow.cpp:258 msgid "IPv4" msgstr "IPv4" #: src/iptux/MainWindow.cpp:790 msgid "User" msgstr "Користувач" #: src/iptux/MainWindow.cpp:796 src/iptux/resources/gtk/MainWindow.ui:81 msgid "Host" msgstr "Хост" #: src/iptux/MainWindow.cpp:935 #, c-format msgid "Pals Online: %d" msgstr "Друзі онлайн: %d" #: src/iptux/RevisePal.cpp:109 msgid "Change Pal's Information" msgstr "Змінити інформацію" #: src/iptux/RevisePal.cpp:134 msgid "Pal's nickname:" msgstr "Псевдонім:" #: src/iptux/RevisePal.cpp:140 msgid "Please input pal's new nickname!" msgstr "Будь ласка, введіть новий псевдонім друга!" #: src/iptux/RevisePal.cpp:146 msgid "Pal's group name:" msgstr "Назва групи:" #: src/iptux/RevisePal.cpp:152 msgid "Please input pal's new group name!" msgstr "Будь ласка, введіть нову назву групи!" #: src/iptux/RevisePal.cpp:158 msgid "System coding:" msgstr "Система кодування:" #: src/iptux/RevisePal.cpp:164 msgid "Be SURE to know what you are doing!" msgstr "ВИ МАЄТЕ БУТИ ВПЕВНЕНИМИ,що ви робите!" #: src/iptux/RevisePal.cpp:170 msgid "Pal's face picture:" msgstr "Оберіть зображення:" #: src/iptux/RevisePal.cpp:184 msgid "Be compatible with iptux's protocol (DANGEROUS)" msgstr "Сумісність із протоколом iptux (НЕБЕЗПЕЧНО)" #: src/iptux/ShareFile.cpp:104 msgid "Shared Files Management" msgstr "Керування спільними файлами" #: src/iptux/ShareFile.cpp:105 msgid "OK" msgstr "ОК" #: src/iptux/ShareFile.cpp:106 msgid "Apply" msgstr "Застосувати" #: src/iptux/ShareFile.cpp:107 msgid "Cancel" msgstr "Скасувати" #: src/iptux/ShareFile.cpp:160 msgid "Add Files" msgstr "Додати файли" #: src/iptux/ShareFile.cpp:163 msgid "Add Folders" msgstr "Додати папки" #: src/iptux/ShareFile.cpp:166 msgid "Delete Resources" msgstr "Видалити ресурси" #: src/iptux/ShareFile.cpp:169 msgid "Clear Password" msgstr "Очистити пароль" #: src/iptux/ShareFile.cpp:172 msgid "Set Password" msgstr "Встановити пароль" #: src/iptux/ShareFile.cpp:229 src/iptux/ShareFile.cpp:373 msgid "regular" msgstr "регулярно" #: src/iptux/ShareFile.cpp:233 src/iptux/ShareFile.cpp:377 msgid "directory" msgstr "каталог" #: src/iptux/ShareFile.cpp:237 src/iptux/ShareFile.cpp:381 msgid "unknown" msgstr "невідомий" #: src/iptux/ShareFile.cpp:270 msgid "File" msgstr "Файл" #: src/iptux/ShareFile.cpp:286 msgid "Type" msgstr "Тип" #: src/iptux/ShareFile.cpp:411 msgid "Choose the files to share" msgstr "Оберіть файли для спільного використання" #: src/iptux/ShareFile.cpp:414 msgid "Choose the folders to share" msgstr "Оберіть папки для спільного використання" #: src/iptux/TransWindow.cpp:86 msgid "Files Transmission Management" msgstr "Керування передачею файлів" #: src/iptux/TransWindow.cpp:241 msgid "State" msgstr "Стан" #: src/iptux/TransWindow.cpp:247 msgid "Task" msgstr "Завдання" #: src/iptux/TransWindow.cpp:253 msgid "Peer" msgstr "Пір" #: src/iptux/TransWindow.cpp:265 msgid "Filename" msgstr "Ім'я файлу" #: src/iptux/TransWindow.cpp:277 msgid "Completed" msgstr "Виконано" #: src/iptux/TransWindow.cpp:284 msgid "Progress" msgstr "Прогрес" #: src/iptux/TransWindow.cpp:291 msgid "Cost" msgstr "Вартість" #: src/iptux/TransWindow.cpp:297 msgid "Remaining" msgstr "Залишилося" #: src/iptux/TransWindow.cpp:303 msgid "Rate" msgstr "Швидкість" #: src/iptux/TransWindow.cpp:331 msgid "The path you want to open not exist!" msgstr "Шлях, який ви хочете відкрити, не існує!" #: src/iptux/TransWindow.cpp:405 msgid "The file you want to open not exist!" msgstr "Файл, який ви хочете відкрити, не існує!" #: src/iptux/TransWindow.cpp:406 msgid "iptux Error" msgstr "iptux Помилка" #: src/iptux/UiCoreThread.cpp:254 src/iptux/UiCoreThread.cpp:278 #: src/iptux/UiCoreThread.cpp:377 src/iptux/UiCoreThread.cpp:399 msgid "Others" msgstr "Інше" #: src/iptux/UiCoreThread.cpp:419 msgid "Broadcast" msgstr "Трансляція" #: src/iptux/UiHelper.cpp:28 #, c-format msgid "Can't convert path to uri: %s, reason: %s" msgstr "" #: src/iptux/UiHelper.cpp:39 #, c-format msgid "Can't open path: %s, reason: %s" msgstr "" #: src/iptux/UiHelper.cpp:68 #, c-format msgid "Can't open URL: %s, reason: %s" msgstr "" #: src/iptux/UiHelper.cpp:188 msgid "Information" msgstr "Інформація" #: src/iptux/UiHelper.cpp:218 msgid "Warning" msgstr "УВАГА" #: src/iptux/UiModels.cpp:604 #, c-format msgid "Version: %s" msgstr "Версія: %s" #: src/iptux/UiModels.cpp:608 #, c-format msgid "Nickname: %s@%s" msgstr "Псевдонім: %s@%s" #: src/iptux/UiModels.cpp:611 #, c-format msgid "Nickname: %s" msgstr "Псевдонім: %s" #: src/iptux/UiModels.cpp:615 #, c-format msgid "User: %s" msgstr "Користувач: %s" #: src/iptux/UiModels.cpp:618 #, c-format msgid "Host: %s" msgstr "Хост: %s" #: src/iptux/UiModels.cpp:623 #, c-format msgid "Address: %s(%s)" msgstr "Адреса: %s(%s)" #: src/iptux/UiModels.cpp:625 #, c-format msgid "Address: %s" msgstr "Адреса: %s" #: src/iptux/UiModels.cpp:630 msgid "Compatibility: Microsoft" msgstr "OS: Microsoft" #: src/iptux/UiModels.cpp:632 msgid "Compatibility: GNU/Linux" msgstr "OS: GNU/Linux" #: src/iptux/UiModels.cpp:636 #, c-format msgid "System coding: %s" msgstr "Система кодування: %s" #: src/iptux/UiModels.cpp:641 msgid "Signature:" msgstr "Підпис:" #: src/iptux/UiModels.cpp:744 msgid "" msgstr "<ПОМИЛКА>" #: src/iptux/UiModels.cpp:799 msgid "[IMG]" msgstr "" #: src/iptux/dialog.cpp:39 msgid "" "File transfer has not been completed.\n" "Are you sure to cancel and quit?" msgstr "" "Передавання файлу не завершено.\n" "Ви впевнені, що хочете скасувати та вийти?" #: src/iptux/dialog.cpp:42 msgid "Confirm Exit" msgstr "Підтвердити вихід" #: src/iptux/dialog.cpp:62 src/iptux/resources/gtk/MainWindow.ui:12 #: src/iptux/resources/gtk/menus.ui:98 src/iptux/resources/gtk/menus.ui:243 msgid "Request Shared Resources" msgstr "Запит на спільні ресурси" #: src/iptux/dialog.cpp:62 msgid "Agree" msgstr "Погодитись" #: src/iptux/dialog.cpp:78 #, c-format msgid "" "Your pal (%s)[%s]\n" "is requesting to get your shared resources,\n" "Do you agree?" msgstr "" "Ваш друг (%s)[%s]\n" "просить доступ до спільних ресурсів,\n" "Ви згодні?" #: src/iptux/dialog.cpp:106 msgid "Access Password" msgstr "Пароль доступу" #: src/iptux/dialog.cpp:113 msgid "Please input the password for the shared files behind" msgstr "Будь ласка, введіть пароль для доступу до спільних файлів" #: src/iptux/dialog.cpp:127 #, c-format msgid "(%s)[%s]Password:" msgstr "(%s)[%s]Пароль:" #: src/iptux/dialog.cpp:146 src/iptux/dialog.cpp:207 msgid "" "\n" "Empty Password!" msgstr "" "\n" "Порожній пароль!" #: src/iptux/dialog.cpp:170 msgid "Enter a New Password" msgstr "Введіть новий пароль" #: src/iptux/dialog.cpp:178 msgid "Password: " msgstr "Пароль: " #: src/iptux/dialog.cpp:187 msgid "Repeat: " msgstr "Повторити: " #: src/iptux/dialog.cpp:202 msgid "" "\n" "Password Mismatched!" msgstr "" "\n" "Пароль не збігається!" #: src/iptux/dialog.cpp:229 msgid "Please select a folder to save files." msgstr "Оберіть папку для збереження файлів." #: src/iptux/resources/gtk/AboutDialog.ui:11 msgid "" "Copyright © 2008–2009, Jally\n" "Copyright © 2013–2015,2017–2021, LI Daobing" msgstr "" "Авторське право © 2008–2009, Jally\n" "Авторське право © 2013–2015, 2017–2021, LI Daobing" #: src/iptux/resources/gtk/AboutDialog.ui:13 msgid "A GTK based LAN messenger." msgstr "Месенджер локальної мережі на основі GTK." #: src/iptux/resources/gtk/AppIndicator.ui:6 #, fuzzy msgid "Open Iptux" msgstr "Iptux" #: src/iptux/resources/gtk/AppIndicator.ui:12 #: src/iptux/resources/gtk/menus.ui:6 src/iptux/resources/gtk/menus.ui:306 msgid "_Preferences" msgstr "_Налаштування" #: src/iptux/resources/gtk/AppIndicator.ui:16 #: src/iptux/resources/gtk/menus.ui:10 src/iptux/resources/gtk/menus.ui:310 msgid "_Quit" msgstr "_Вихід" #: src/iptux/resources/gtk/DetectPal.ui:7 msgid "Detect pal" msgstr "Пошук друга" #: src/iptux/resources/gtk/DetectPal.ui:15 msgid "Detect" msgstr "Виявити" #: src/iptux/resources/gtk/DetectPal.ui:61 msgid "Please input an IP address (IPv4 only):" msgstr "Введіть IP-адресу (лише IPv4):" #: src/iptux/resources/gtk/MainWindow.ui:8 src/iptux/resources/gtk/menus.ui:109 #: src/iptux/resources/gtk/menus.ui:254 msgid "Send Message" msgstr "Відправити повідомлення" #: src/iptux/resources/gtk/MainWindow.ui:16 msgid "Change Info" msgstr "Змінити інформацію" #: src/iptux/resources/gtk/MainWindow.ui:20 msgid "Delete Pal" msgstr "Видалити друга" #: src/iptux/resources/gtk/MainWindow.ui:26 src/iptux/resources/gtk/menus.ui:31 #: src/iptux/resources/gtk/menus.ui:176 msgid "Sort" msgstr "Сортувати" #: src/iptux/resources/gtk/MainWindow.ui:29 src/iptux/resources/gtk/menus.ui:34 #: src/iptux/resources/gtk/menus.ui:179 msgid "By Nickname" msgstr "За псевдонім" #: src/iptux/resources/gtk/MainWindow.ui:34 src/iptux/resources/gtk/menus.ui:39 #: src/iptux/resources/gtk/menus.ui:184 #, fuzzy msgid "By Username" msgstr "За псевдонім" #: src/iptux/resources/gtk/MainWindow.ui:39 src/iptux/resources/gtk/menus.ui:44 #: src/iptux/resources/gtk/menus.ui:189 msgid "By IP" msgstr "За IP" #: src/iptux/resources/gtk/MainWindow.ui:44 src/iptux/resources/gtk/menus.ui:49 #: src/iptux/resources/gtk/menus.ui:194 #, fuzzy msgid "By Host" msgstr "Хост" #: src/iptux/resources/gtk/MainWindow.ui:49 src/iptux/resources/gtk/menus.ui:54 #: src/iptux/resources/gtk/menus.ui:199 msgid "By Last Activity" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:56 src/iptux/resources/gtk/menus.ui:61 #: src/iptux/resources/gtk/menus.ui:206 msgid "Ascending" msgstr "За зростанням" #: src/iptux/resources/gtk/MainWindow.ui:61 src/iptux/resources/gtk/menus.ui:66 #: src/iptux/resources/gtk/menus.ui:211 msgid "Descending" msgstr "За зменшенням" #: src/iptux/resources/gtk/MainWindow.ui:68 msgid "Info Style" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:71 #, fuzzy msgid "IP" msgstr "IPv4" #: src/iptux/resources/gtk/MainWindow.ui:76 msgid "IP:PORT" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:86 #, fuzzy msgid "Username" msgstr "Користувач" #: src/iptux/resources/gtk/MainWindow.ui:91 #, fuzzy msgid "Version" msgstr "Версія: %s" #: src/iptux/resources/gtk/MainWindow.ui:96 msgid "Last Activity" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:101 #, fuzzy msgid "Last Message" msgstr "Порожнє повідомлення" #: src/iptux/resources/gtk/menus.ui:17 src/iptux/resources/gtk/menus.ui:162 msgid "_File" msgstr "_Файл" #: src/iptux/resources/gtk/menus.ui:19 src/iptux/resources/gtk/menus.ui:164 msgid "_Detect" msgstr "_Виявити" #: src/iptux/resources/gtk/menus.ui:23 src/iptux/resources/gtk/menus.ui:168 msgid "_Find" msgstr "_Знайти" #: src/iptux/resources/gtk/menus.ui:28 src/iptux/resources/gtk/menus.ui:173 msgid "_View" msgstr "_Порядок сортування" #: src/iptux/resources/gtk/menus.ui:73 src/iptux/resources/gtk/menus.ui:218 msgid "_Refresh" msgstr "_Оновити" #: src/iptux/resources/gtk/menus.ui:80 src/iptux/resources/gtk/menus.ui:225 msgid "_Chat" msgstr "_Чат" #: src/iptux/resources/gtk/menus.ui:88 src/iptux/resources/gtk/menus.ui:233 msgid "Attach File" msgstr "Прикріпити файл" #: src/iptux/resources/gtk/menus.ui:92 src/iptux/resources/gtk/menus.ui:237 msgid "Attach Folder" msgstr "Прикріпити папку" #: src/iptux/resources/gtk/menus.ui:102 src/iptux/resources/gtk/menus.ui:247 msgid "Clear Chat History" msgstr "Очистити історію чату" #: src/iptux/resources/gtk/menus.ui:115 src/iptux/resources/gtk/menus.ui:260 msgid "_Window" msgstr "_Журнали та керування" #: src/iptux/resources/gtk/menus.ui:118 src/iptux/resources/gtk/menus.ui:263 msgid "_Transmission" msgstr "_Передача файлів" #: src/iptux/resources/gtk/menus.ui:122 src/iptux/resources/gtk/menus.ui:267 msgid "_Shared Management" msgstr "_Спільне керування" #: src/iptux/resources/gtk/menus.ui:126 src/iptux/resources/gtk/menus.ui:271 msgid "_Chat Log" msgstr "_Журнал чату" #: src/iptux/resources/gtk/menus.ui:130 src/iptux/resources/gtk/menus.ui:275 msgid "_System Log" msgstr "_Системний журнал" #: src/iptux/resources/gtk/menus.ui:136 src/iptux/resources/gtk/menus.ui:281 msgid "Close Window" msgstr "Закрите вікно" #: src/iptux/resources/gtk/menus.ui:142 src/iptux/resources/gtk/menus.ui:287 msgid "_Help" msgstr "_Допомога" #: src/iptux/resources/gtk/menus.ui:145 src/iptux/resources/gtk/menus.ui:290 msgid "_About" msgstr "_Про програму" #: src/iptux/resources/gtk/menus.ui:149 src/iptux/resources/gtk/menus.ui:294 msgid "Report Bug" msgstr "Повідомити про помилку" #: src/iptux/resources/gtk/menus.ui:153 src/iptux/resources/gtk/menus.ui:298 msgid "What's New" msgstr "Що нового" #: src/iptux/resources/gtk/menus.ui:318 msgid "Open This File" msgstr "Відкрити цей файл" #: src/iptux/resources/gtk/menus.ui:322 msgid "Open Containing Folder" msgstr "Відкрити вміст папки" #: src/iptux/resources/gtk/menus.ui:326 msgid "Terminate Task" msgstr "Завершити завдання" #: src/iptux/resources/gtk/menus.ui:330 msgid "Terminate All" msgstr "Припинити все" #: src/iptux/resources/gtk/menus.ui:334 msgid "Clear Tasklist" msgstr "Очистити список завдань" #: src/iptux/resources/gtk/menus.ui:346 msgid "Refuse All" msgstr "Відмінити всі" #: src/main/iptux.cpp:149 msgid "- A software for sharing in LAN" msgstr "-Програмне забезпечення для спільного використання в локальній мережі" #: src/main/iptux.cpp:152 #, c-format msgid "option parsing failed: %s\n" msgstr "помилка аналізу параметра: %s\n" #~ msgid "Can't find any available web browser!\n" #~ msgstr "Не вдається знайти доступний веб-браузер!\n" #~ msgid "chat;talk;im;message;ipmsg;feige;" #~ msgstr "chat;talk;im;message;ipmsg;feige;" #~ msgid "It can:" #~ msgstr "Це може:" #~ msgid "Close Chat" #~ msgstr "Закрыть чат" #~ msgid "Sound" #~ msgstr "Звук" #~ msgid "Activate the sound support" #~ msgstr "Включение поддержки звука" #~ msgid "Volume Control: " #~ msgstr "Регулятор громкости " #~ msgid "Sound Event" #~ msgstr "Звуковые оповещения" #~ msgid "Test" #~ msgstr "Проверка" #~ msgid "Stop" #~ msgstr "Стоп" #, fuzzy #~ msgid "iptux-icon" #~ msgstr "IPTux" #~ msgid "Please input an IP address (IPv4 only)!" #~ msgstr "Введите IP-адрес (только IPv4)!" #, fuzzy #~ msgid "" #~ "Fatal Error!!\n" #~ "Failed to bind the TCP/UDP port(%d)!\n" #~ "%s" #~ msgstr "" #~ "Ошибка!!!\n" #~ "Не удалось создать новый сокет!\n" #~ "%s" #~ msgid "More About Iptux" #~ msgstr "Узнать больше о IPTux" iptux-0.9.4/po/zh_CN.po000066400000000000000000001112531475473122500146710ustar00rootroot00000000000000# Translation of iptux to Chinese (simplified) # Copyright (C) 2009 THE IPTUX'S COPYRIGHT HOLDER # This file is distributed under the same license as the iptux package. # Jally , 2008, 2009. # ManPT , 2009. # msgid "" msgstr "" "Project-Id-Version: iptux 0.6.3\n" "Report-Msgid-Bugs-To: https://github.com/iptux-src/iptux/issues/new\n" "POT-Creation-Date: 2025-02-17 13:35-0800\n" "PO-Revision-Date: 2025-02-17 21:46+0000\n" "Last-Translator: LI Daobing \n" "Language-Team: Chinese (Simplified Han script) \n" "Language: zh_CN\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Generator: Weblate 5.10.1-dev\n" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:6 msgid "iptux" msgstr "信使(iptux)" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:7 msgid "LAN communication software" msgstr "局域网通信软件" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:17 msgid "iptux is an “IP Messenger” client. The features of iptux include:" msgstr "iptux 是一个 IP Messenger 客户端。它包含如下功能:" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:21 msgid "auto-detect other clients on the intranet." msgstr "自动检测局域网的其他客户端。" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:22 msgid "send/recv messages to other clients." msgstr "发送/接收消息到其他客户端。" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:23 msgid "send/recv files to other clients." msgstr "发送/接收文件到其它客户端。" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:24 msgid "share your files to other cliens (with optional password protection)." msgstr "给其他客户端分享你的文件(支持密码保护)。" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:26 msgid "" "It is (supposedly) compatible with 飞鸽传书 (Feige) and 飞秋 (FeiQ) from " "China, and with the original “IP Messenger” clients from Japan, including " "g2ipmsg and xipmsg in Debian." msgstr "" "它可以兼容(期望如此)中国的飞鸽传书和飞秋,以及日本原版的\"IP Messenger\"," "还有Debian提供的 g2ipmsg 和 xipmsg。" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:38 msgid "The Iptux main window." msgstr "Iptux 主窗口。" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:42 msgid "The Iptux chat window." msgstr "Iptux 聊天窗口。" #: src/iptux-core/CoreThread.cpp:172 #, c-format msgid "" "Fatal Error!! Failed to create new socket!\n" "%s" msgstr "" "致命错误!!创建新的套接口失败!\n" "%s" #: src/iptux-core/CoreThread.cpp:188 #, c-format msgid "" "Fatal Error!! Failed to bind the TCP port(%s:%d)!\n" "%s" msgstr "" "致命错误!!绑定 TCP 端口(%s:%d)失败!\n" "%s" #: src/iptux-core/CoreThread.cpp:201 #, c-format msgid "" "Fatal Error!! Failed to bind the UDP port(%s:%d)!\n" "%s" msgstr "" "致命错误!!绑定 UDP 端口(%s:%d)失败!\n" "%s" #: src/iptux-core/CoreThread.cpp:461 src/iptux-core/CoreThread.cpp:495 #: src/iptux-core/internal/RecvFileData.cpp:142 #: src/iptux-core/internal/RecvFileData.cpp:204 #, c-format msgid "" "Fatal Error!!\n" "Failed to create new socket!\n" "%s" msgstr "" "致命错误!!\n" "创建新的套接口失败!\n" "%s" #: src/iptux-core/Models.cpp:172 msgid "Empty Message" msgstr "空消息" #: src/iptux-core/Models.cpp:250 msgid "Received an image" msgstr "收到一张图片" # "Language-Team: Chinese (simplified) \n" #: src/iptux-core/internal/AnalogFS.cpp:93 #: src/iptux-core/internal/AnalogFS.cpp:98 #, c-format msgid "Open() file \"%s\" failed, %s" msgstr "打开文件\"%s\"失败,%s" #: src/iptux-core/internal/AnalogFS.cpp:117 #, c-format msgid "Stat64() file \"%s\" failed, %s" msgstr "获取文件\"%s\"状态失败,%s" #: src/iptux-core/internal/AnalogFS.cpp:138 #, c-format msgid "Mkdir() directory \"%s\" failed, %s" msgstr "创建文件夹\"%s\"失败,%s" #: src/iptux-core/internal/AnalogFS.cpp:164 #, c-format msgid "Opendir() directory \"%s\" failed, %s" msgstr "打开文件夹\"%s\"失败,%s" #: src/iptux-core/internal/Command.cpp:226 msgid "Your pal didn't receive the packet. He or she is offline maybe." msgstr "你的好友没有接收到此数据包,他可能已经下线。" #: src/iptux-core/internal/CommandMode.cpp:39 #, c-format msgid "unknown command mode: %d" msgstr "未知的命令模式: %d" #: src/iptux-core/internal/RecvFileData.cpp:117 msgid "receive" msgstr "接收" #: src/iptux-core/internal/RecvFileData.cpp:124 #: src/iptux-core/internal/RecvFileData.cpp:253 #: src/iptux-core/internal/SendFileData.cpp:108 #: src/iptux-core/internal/SendFileData.cpp:193 msgid "Unknown" msgstr "未知" #: src/iptux-core/internal/RecvFileData.cpp:175 #, c-format, fuzzy msgid "" "Failed to receive the file \"%s\" from %s! expect length %jd, received %jd" msgstr "从 %2$s 接收文件\"%1$s\"失败!期望长度 %3$jd,收到 %4$jd" #: src/iptux-core/internal/RecvFileData.cpp:180 #, c-format msgid "Receive the file \"%s\" from %s successfully!" msgstr "接收文件\"%s\"(来自%s)成功!" #: src/iptux-core/internal/RecvFileData.cpp:320 #, c-format msgid "Failed to receive the directory \"%s\" from %s!" msgstr "接收文件夹\"%s\"(来自%s)失败!" #: src/iptux-core/internal/RecvFileData.cpp:323 #, c-format msgid "Receive the directory \"%s\" from %s successfully!" msgstr "接收文件夹\"%s\"(来自%s)成功!" #: src/iptux-core/internal/SendFileData.cpp:101 msgid "send" msgstr "发送" #: src/iptux-core/internal/SendFileData.cpp:137 #, c-format msgid "Failed to send the file \"%s\" to %s!" msgstr "发送文件\"%s\"到%s失败!" #: src/iptux-core/internal/SendFileData.cpp:142 #, c-format msgid "Send the file \"%s\" to %s successfully!" msgstr "发送文件\"%s\"到%s成功!" #: src/iptux-core/internal/SendFileData.cpp:265 #, c-format msgid "Failed to send the directory \"%s\" to %s!" msgstr "发送文件夹\"%s\"到%s失败!" #: src/iptux-core/internal/SendFileData.cpp:270 #, c-format msgid "Send the directory \"%s\" to %s successfully!" msgstr "发送文件夹\"%s\"到%s失败!" #: src/iptux-core/internal/UdpData.cpp:92 #: src/iptux-core/internal/UdpData.cpp:93 #: src/iptux-core/internal/UdpData.cpp:443 #: src/iptux-core/internal/UdpData.cpp:484 msgid "mysterious" msgstr "神秘来客" #: src/iptux-utils/utils.cpp:880 #, c-format msgid "stat file \"%s\" failed: %s" msgstr "查看文件\"%s\"状态失败,%s" #: src/iptux-utils/utils.cpp:888 #, c-format msgid "path %s is not file or directory: st_mode(%x)" msgstr "路径 %s 不是文件或者目录: st_mode(%x)" #: src/iptux-utils/utils.cpp:895 #, c-format msgid "opendir on \"%s\" failed: %s" msgstr "打开文件夹\"%s\"失败,%s" #: src/iptux/AboutDialog.cpp:39 msgid "TRANSLATOR NAME" msgstr "LI Daobing " #: src/iptux/AboutDialog.cpp:53 msgid "Thanks to" msgstr "感谢" #: src/iptux/AppIndicator.cpp:40 src/iptux/MainWindow.cpp:505 #: src/iptux/MainWindow.cpp:507 msgid "Iptux" msgstr "信使(Iptux)" #: src/iptux/Application.cpp:54 msgid "Loading the process successfully!" msgstr "进程加载成功!" #: src/iptux/Application.cpp:274 #, c-format msgid "New Message from %s" msgstr "从 %s 来的新消息" #: src/iptux/Application.cpp:287 #, c-format msgid "New File from %s" msgstr "从 %s 来的新文件" #: src/iptux/Application.cpp:296 msgid "Receiving File Finished" msgstr "接收文件完成" #: src/iptux/Application.cpp:300 msgid "file info no longer exist" msgstr "文件信息不再存在" #: src/iptux/Darwin.cpp:16 #, c-format msgid "Couldn’t load icon: %s" msgstr "无法加载图标: %s" #: src/iptux/DataSettings.cpp:46 msgid "Personal" msgstr "个人" #: src/iptux/DataSettings.cpp:48 msgid "System" msgstr "系统" #: src/iptux/DataSettings.cpp:50 msgid "Network" msgstr "网络" #: src/iptux/DataSettings.cpp:89 src/iptux/DataSettings.cpp:98 msgid "The program needs to be restarted to take effect!" msgstr "程序需要重启来应用配置!" #: src/iptux/DataSettings.cpp:143 msgid "Preferences" msgstr "参数选择" #: src/iptux/DataSettings.cpp:143 src/iptux/RevisePal.cpp:109 #: src/iptux/dialog.cpp:107 src/iptux/dialog.cpp:170 msgid "_OK" msgstr "确定(_O)" #: src/iptux/DataSettings.cpp:144 msgid "_Apply" msgstr "应用(_A)" #: src/iptux/DataSettings.cpp:144 src/iptux/DataSettings.cpp:1348 #: src/iptux/DataSettings.cpp:1395 src/iptux/DialogBase.cpp:359 #: src/iptux/DialogBase.cpp:918 src/iptux/RevisePal.cpp:110 #: src/iptux/ShareFile.cpp:419 src/iptux/callback.cpp:87 #: src/iptux/dialog.cpp:171 src/iptux/dialog.cpp:230 msgid "_Cancel" msgstr "取消(_C)" #: src/iptux/DataSettings.cpp:169 msgid "Your _nickname:" msgstr "您的昵称:" #: src/iptux/DataSettings.cpp:176 msgid "Please input your nickname!" msgstr "请输入您的昵称!" #: src/iptux/DataSettings.cpp:182 msgid "Your _group name:" msgstr "您的组名:" #: src/iptux/DataSettings.cpp:189 msgid "Please input your group name!" msgstr "请输入您的组名!" #: src/iptux/DataSettings.cpp:195 msgid "Your _face picture:" msgstr "您的头像:" #: src/iptux/DataSettings.cpp:213 msgid "_Save files to: " msgstr "保存文件到: " #: src/iptux/DataSettings.cpp:226 msgid "Photo" msgstr "个人形象" #: src/iptux/DataSettings.cpp:238 msgid "Signature" msgstr "个性签名" #: src/iptux/DataSettings.cpp:271 msgid "Port:" msgstr "端口:" #: src/iptux/DataSettings.cpp:278 msgid "Any port number between 1024 and 65535, default is 2425" msgstr "1024到65535之间的任何端口,缺省端口为2425" #: src/iptux/DataSettings.cpp:287 msgid "Candidate network encodings:" msgstr "候选网络编码:" #: src/iptux/DataSettings.cpp:294 msgid "Candidate network encodings, separated by \",\"" msgstr "候选网络编码,以\",\"分隔" #: src/iptux/DataSettings.cpp:301 msgid "Preferred network encoding:" msgstr "首选网络编码:" #: src/iptux/DataSettings.cpp:308 msgid "" "Preference network coding (You should be aware of what you are doing if you " "want to modify it.)" msgstr "首选网络编码(如果你想要修改它,那么你必须明白你正在做什么。)" #: src/iptux/DataSettings.cpp:316 msgid "Pal's default face picture:" msgstr "好友默认头像:" #: src/iptux/DataSettings.cpp:334 msgid "Panel font:" msgstr "面板字体:" #: src/iptux/DataSettings.cpp:346 msgid "Automatically open the chat dialog" msgstr "自动打开聊天窗口" #: src/iptux/DataSettings.cpp:354 msgid "Automatically hide the panel after login" msgstr "程序启动之后自动隐藏面板" #: src/iptux/DataSettings.cpp:362 msgid "Automatically open the File Transmission Management" msgstr "自动打开文件传输管理器" #: src/iptux/DataSettings.cpp:370 msgid "Use the 'Enter' key to send message" msgstr "使用Enter键发送消息" #: src/iptux/DataSettings.cpp:378 msgid "Automatically clean up the chat history" msgstr "自动清空聊天历史记录" #: src/iptux/DataSettings.cpp:385 msgid "Save the chat history" msgstr "保存聊天历史" #: src/iptux/DataSettings.cpp:393 msgid "Use the Blacklist (NOT recommended)" msgstr "开启黑名单处理方案(不推荐)" #: src/iptux/DataSettings.cpp:401 msgid "Filter the request of sharing files" msgstr "过滤好友对共享文件的请求" #: src/iptux/DataSettings.cpp:408 msgid "Hide the taskbar when the main window is minimized" msgstr "主窗口最小化后隐藏任务栏" #: src/iptux/DataSettings.cpp:432 msgid "From:" msgstr "起始:" #: src/iptux/DataSettings.cpp:438 msgid "Beginning of the IP(v4) section" msgstr "IP(v4)网络段起始点" #: src/iptux/DataSettings.cpp:442 msgid "To:" msgstr "终止:" #: src/iptux/DataSettings.cpp:448 msgid "End of the IP(v4) section" msgstr "IP(v4)网络段终止点" #: src/iptux/DataSettings.cpp:456 msgid "Add" msgstr "增添" #: src/iptux/DataSettings.cpp:461 msgid "Delete" msgstr "删除" #: src/iptux/DataSettings.cpp:468 msgid "Added IP(v4) Section:" msgstr "已添加的IP(v4)网段:" #: src/iptux/DataSettings.cpp:487 msgid "Import" msgstr "导入" #: src/iptux/DataSettings.cpp:491 msgid "Export" msgstr "导出" #: src/iptux/DataSettings.cpp:495 src/iptux/TransWindow.cpp:171 msgid "Clear" msgstr "清空" #: src/iptux/DataSettings.cpp:706 msgid "From" msgstr "起始" #: src/iptux/DataSettings.cpp:713 msgid "To" msgstr "终止" #: src/iptux/DataSettings.cpp:720 msgid "Description" msgstr "描述" #: src/iptux/DataSettings.cpp:736 msgid "Please select download folder" msgstr "请选择下载文件夹" #: src/iptux/DataSettings.cpp:758 msgid "Select Font" msgstr "选择字体" #: src/iptux/DataSettings.cpp:872 src/iptux/DataSettings.cpp:874 #: src/iptux/DataSettings.cpp:878 msgid "Port must be a number between 1024 and 65535" msgstr "端口必须是1024到65535之间的数字" #: src/iptux/DataSettings.cpp:1019 src/iptux/DataSettings.cpp:1050 #, c-format msgid "" "Fopen() file \"%s\" failed!\n" "%s" msgstr "" "打开文件\"%s\"失败!\n" "%s" #: src/iptux/DataSettings.cpp:1150 src/iptux/RevisePal.cpp:419 msgid "Please select a face picture" msgstr "请选择一个头像图片" #: src/iptux/DataSettings.cpp:1172 msgid "Please select a personal photo" msgstr "请选择个人形象照片" #: src/iptux/DataSettings.cpp:1241 src/iptux/DataSettings.cpp:1248 #: src/iptux/DetectPal.cpp:75 #, c-format msgid "" "\n" "Illegal IP(v4) address: %s!" msgstr "" "\n" "非法的IP(v4)地址:%s!" #: src/iptux/DataSettings.cpp:1346 msgid "Please select a file to import data" msgstr "请选择导入数据的文件" #: src/iptux/DataSettings.cpp:1347 src/iptux/DialogBase.cpp:358 #: src/iptux/ShareFile.cpp:418 src/iptux/callback.cpp:86 msgid "_Open" msgstr "打开(_O)" #: src/iptux/DataSettings.cpp:1394 msgid "Save data to file" msgstr "保存数据到文件" #: src/iptux/DataSettings.cpp:1395 src/iptux/DialogBase.cpp:919 #: src/iptux/dialog.cpp:231 msgid "_Save" msgstr "保存(_S)" #: src/iptux/DetectPal.cpp:70 #, c-format msgid "The notification has been sent to %s." msgstr "通知已经发送到%s。" #: src/iptux/DialogBase.cpp:214 #, c-format msgid "%s To Send." msgstr "%s 等待传输。" #: src/iptux/DialogBase.cpp:272 msgid "Close" msgstr "关闭" #: src/iptux/DialogBase.cpp:276 src/iptux/DialogGroup.cpp:375 msgid "Send" msgstr "发送" #: src/iptux/DialogBase.cpp:307 msgid "Chat History" msgstr "聊天记录" #: src/iptux/DialogBase.cpp:350 msgid "Choose enclosure files" msgstr "选择文件附件" #: src/iptux/DialogBase.cpp:353 msgid "Choose enclosure folders" msgstr "选择文件夹附件" #: src/iptux/DialogBase.cpp:593 msgid "Remove Selected" msgstr "移除选中项" #: src/iptux/DialogBase.cpp:648 msgid "File to send." msgstr "等待传输的文件。" #: src/iptux/DialogBase.cpp:653 msgid "Sending progress." msgstr "传输进度。" #: src/iptux/DialogBase.cpp:656 msgid "Dirs" msgstr "目录" #: src/iptux/DialogBase.cpp:659 msgid "Files" msgstr "文件" #: src/iptux/DialogBase.cpp:662 src/iptux/DialogPeer.cpp:565 msgid "Detail" msgstr "详情" #: src/iptux/DialogBase.cpp:712 msgid "PeerName" msgstr "好友名" #: src/iptux/DialogBase.cpp:719 src/iptux/DialogPeer.cpp:716 msgid "Name" msgstr "名称" #: src/iptux/DialogBase.cpp:725 src/iptux/DialogPeer.cpp:652 #: src/iptux/DialogPeer.cpp:722 src/iptux/ShareFile.cpp:280 #: src/iptux/TransWindow.cpp:271 msgid "Size" msgstr "大小" #: src/iptux/DialogBase.cpp:731 msgid "Path" msgstr "路径" #: src/iptux/DialogBase.cpp:792 msgid "Sending Progress." msgstr "传输进度。" #: src/iptux/DialogBase.cpp:795 #, c-format msgid "%s of %s Sent." msgstr "已传输 %s,总共 %s。" #: src/iptux/DialogBase.cpp:802 src/iptux/DialogPeer.cpp:835 msgid "Mission Completed!" msgstr "任务完成!" #: src/iptux/DialogBase.cpp:845 src/iptux/DialogBase.cpp:917 msgid "Save Image" msgstr "保存图片" #: src/iptux/DialogBase.cpp:850 msgid "Copy Image" msgstr "拷贝图片" #: src/iptux/DialogGroup.cpp:285 msgid "Member" msgstr "成员" #: src/iptux/DialogGroup.cpp:382 msgid "Pals" msgstr "好友" #: src/iptux/DialogGroup.cpp:480 msgid "Select All" msgstr "全选" #: src/iptux/DialogGroup.cpp:485 msgid "Reverse Select" msgstr "反选" #: src/iptux/DialogGroup.cpp:490 msgid "Clear Up" msgstr "清空" #: src/iptux/DialogGroup.cpp:728 #, c-format msgid "Talk with the group %s" msgstr "与%s组对话" #: src/iptux/DialogPeer.cpp:132 #, c-format msgid "Talk with %s(%s) IP:%s" msgstr "与 %s(%s) 对话 IP地址: %s" #: src/iptux/DialogPeer.cpp:305 msgid "Info." msgstr "信息。" #: src/iptux/DialogPeer.cpp:337 #, c-format msgid "Version: %s\n" msgstr "版本: %s\n" #: src/iptux/DialogPeer.cpp:339 #, c-format msgid "Nickname: %s@%s\n" msgstr "昵称: %s@%s\n" #: src/iptux/DialogPeer.cpp:342 #, c-format msgid "Nickname: %s\n" msgstr "昵称: %s\n" #: src/iptux/DialogPeer.cpp:344 #, c-format msgid "User: %s\n" msgstr "用户: %s\n" #: src/iptux/DialogPeer.cpp:345 #, c-format msgid "Host: %s\n" msgstr "主机: %s\n" #: src/iptux/DialogPeer.cpp:348 #, c-format msgid "Address: %s(%s)\n" msgstr "地址: %s(%s)\n" #: src/iptux/DialogPeer.cpp:350 #, c-format msgid "Address: %s\n" msgstr "地址: %s\n" #: src/iptux/DialogPeer.cpp:353 msgid "Compatibility: Microsoft\n" msgstr "兼容性: Microsoft\n" #: src/iptux/DialogPeer.cpp:355 msgid "Compatibility: GNU/Linux\n" msgstr "兼容性: GNU/Linux\n" #: src/iptux/DialogPeer.cpp:357 #, c-format msgid "System coding: %s\n" msgstr "系统编码: %s\n" #: src/iptux/DialogPeer.cpp:362 msgid "Signature:\n" msgstr "个性签名:\n" #: src/iptux/DialogPeer.cpp:369 msgid "" "\n" "Photo:\n" msgstr "" "\n" "个人形象:\n" #: src/iptux/DialogPeer.cpp:460 msgid "Please select a picture to insert the buffer" msgstr "请选择插入缓冲区的图片" #: src/iptux/DialogPeer.cpp:486 src/iptux/resources/gtk/menus.ui:83 #: src/iptux/resources/gtk/menus.ui:228 msgid "Insert Image" msgstr "插入图片" #: src/iptux/DialogPeer.cpp:502 msgid "Enclosure." msgstr "附件。" #: src/iptux/DialogPeer.cpp:547 msgid "Files to be received" msgstr "等待接收的文件" #: src/iptux/DialogPeer.cpp:551 msgid "Receiving progress." msgstr "接收进度。" #: src/iptux/DialogPeer.cpp:554 msgid "Accept" msgstr "接受" #: src/iptux/DialogPeer.cpp:560 src/iptux/dialog.cpp:63 #: src/iptux/resources/gtk/menus.ui:342 msgid "Refuse" msgstr "拒绝" #: src/iptux/DialogPeer.cpp:596 msgid "File received." msgstr "已接收的文件。" #: src/iptux/DialogPeer.cpp:639 src/iptux/DialogPeer.cpp:710 msgid "Source" msgstr "来源" #: src/iptux/DialogPeer.cpp:646 msgid "SaveAs" msgstr "另存为" #: src/iptux/DialogPeer.cpp:818 src/iptux/DialogPeer.cpp:884 msgid "Receiving Progress." msgstr "接收进度。" #: src/iptux/DialogPeer.cpp:821 src/iptux/DialogPeer.cpp:887 #, c-format msgid "%s to Receive." msgstr "%s 等待接收。" #: src/iptux/DialogPeer.cpp:825 src/iptux/DialogPeer.cpp:891 #, c-format msgid "%s Of %s Received." msgstr "已接收 %s,总共 %s。" #: src/iptux/LogSystem.cpp:71 #, c-format msgid "Recevied-From: Nickname:%s User:%s Host:%s" msgstr "来自: 昵称:%s 用户:%s 主机:%s" #: src/iptux/LogSystem.cpp:76 #, c-format msgid "Send-To: Nickname:%s User:%s Host:%s" msgstr "发往: 昵称:%s 用户:%s 主机:%s" #: src/iptux/LogSystem.cpp:80 msgid "Send-Broadcast" msgstr "发送广播" #: src/iptux/LogSystem.cpp:99 #, c-format msgid "User:%s Host:%s" msgstr "用户:%s 主机:%s" #: src/iptux/MainWindow.cpp:570 msgid "Pals Online: 0" msgstr "在线好友: 0" #: src/iptux/MainWindow.cpp:655 msgid "Search Pals" msgstr "搜索好友" #: src/iptux/MainWindow.cpp:768 msgid "Nickname" msgstr "昵称" #: src/iptux/MainWindow.cpp:778 msgid "Group" msgstr "组名" #: src/iptux/MainWindow.cpp:784 src/iptux/TransWindow.cpp:258 msgid "IPv4" msgstr "IPv4" #: src/iptux/MainWindow.cpp:790 msgid "User" msgstr "用户" #: src/iptux/MainWindow.cpp:796 src/iptux/resources/gtk/MainWindow.ui:81 msgid "Host" msgstr "主机" #: src/iptux/MainWindow.cpp:935 #, c-format msgid "Pals Online: %d" msgstr "在线好友: %d" #: src/iptux/RevisePal.cpp:109 msgid "Change Pal's Information" msgstr "更改好友信息" #: src/iptux/RevisePal.cpp:134 msgid "Pal's nickname:" msgstr "好友昵称:" #: src/iptux/RevisePal.cpp:140 msgid "Please input pal's new nickname!" msgstr "请输入好友的新昵称!" #: src/iptux/RevisePal.cpp:146 msgid "Pal's group name:" msgstr "好友组名:" #: src/iptux/RevisePal.cpp:152 msgid "Please input pal's new group name!" msgstr "请输入好友的新组名!" #: src/iptux/RevisePal.cpp:158 msgid "System coding:" msgstr "系统编码:" #: src/iptux/RevisePal.cpp:164 msgid "Be SURE to know what you are doing!" msgstr "你最好明白你到底在做些什么!" #: src/iptux/RevisePal.cpp:170 msgid "Pal's face picture:" msgstr "好友头像:" #: src/iptux/RevisePal.cpp:184 msgid "Be compatible with iptux's protocol (DANGEROUS)" msgstr "兼容 iptux 扩展协议(危险)" #: src/iptux/ShareFile.cpp:104 msgid "Shared Files Management" msgstr "共享文件管理器" #: src/iptux/ShareFile.cpp:105 msgid "OK" msgstr "确定" #: src/iptux/ShareFile.cpp:106 msgid "Apply" msgstr "应用" #: src/iptux/ShareFile.cpp:107 msgid "Cancel" msgstr "取消" #: src/iptux/ShareFile.cpp:160 msgid "Add Files" msgstr "增添文件" #: src/iptux/ShareFile.cpp:163 msgid "Add Folders" msgstr "增添目录" #: src/iptux/ShareFile.cpp:166 msgid "Delete Resources" msgstr "删除资源" #: src/iptux/ShareFile.cpp:169 msgid "Clear Password" msgstr "清除密码" #: src/iptux/ShareFile.cpp:172 msgid "Set Password" msgstr "设置密码" #: src/iptux/ShareFile.cpp:229 src/iptux/ShareFile.cpp:373 msgid "regular" msgstr "常规文件" #: src/iptux/ShareFile.cpp:233 src/iptux/ShareFile.cpp:377 msgid "directory" msgstr "文件夹" #: src/iptux/ShareFile.cpp:237 src/iptux/ShareFile.cpp:381 msgid "unknown" msgstr "未知" #: src/iptux/ShareFile.cpp:270 msgid "File" msgstr "文件" #: src/iptux/ShareFile.cpp:286 msgid "Type" msgstr "类型" #: src/iptux/ShareFile.cpp:411 msgid "Choose the files to share" msgstr "选择共享文件" #: src/iptux/ShareFile.cpp:414 msgid "Choose the folders to share" msgstr "选择共享文件夹" #: src/iptux/TransWindow.cpp:86 msgid "Files Transmission Management" msgstr "文件传输管理器" #: src/iptux/TransWindow.cpp:241 msgid "State" msgstr "状态" #: src/iptux/TransWindow.cpp:247 msgid "Task" msgstr "任务" #: src/iptux/TransWindow.cpp:253 msgid "Peer" msgstr "好友" #: src/iptux/TransWindow.cpp:265 msgid "Filename" msgstr "文件名" #: src/iptux/TransWindow.cpp:277 msgid "Completed" msgstr "已完成" #: src/iptux/TransWindow.cpp:284 msgid "Progress" msgstr "进度" #: src/iptux/TransWindow.cpp:291 msgid "Cost" msgstr "花费时间" #: src/iptux/TransWindow.cpp:297 msgid "Remaining" msgstr "剩余时间" #: src/iptux/TransWindow.cpp:303 msgid "Rate" msgstr "速率" #: src/iptux/TransWindow.cpp:331 msgid "The path you want to open not exist!" msgstr "你想打开的路径不存在!" #: src/iptux/TransWindow.cpp:405 msgid "The file you want to open not exist!" msgstr "你想打开的文件不存在!" #: src/iptux/TransWindow.cpp:406 msgid "iptux Error" msgstr "iptux 错误" #: src/iptux/UiCoreThread.cpp:254 src/iptux/UiCoreThread.cpp:278 #: src/iptux/UiCoreThread.cpp:377 src/iptux/UiCoreThread.cpp:399 msgid "Others" msgstr "其他" #: src/iptux/UiCoreThread.cpp:419 msgid "Broadcast" msgstr "广播" #: src/iptux/UiHelper.cpp:28 #, c-format msgid "Can't convert path to uri: %s, reason: %s" msgstr "转换路径到URI失败: %s, 原因: %s" #: src/iptux/UiHelper.cpp:39 #, c-format msgid "Can't open path: %s, reason: %s" msgstr "无法打开路径: %s, 原因: %s" #: src/iptux/UiHelper.cpp:68 #, c-format msgid "Can't open URL: %s, reason: %s" msgstr "无法打开URL: %s, 原因: %s" #: src/iptux/UiHelper.cpp:188 msgid "Information" msgstr "信息" #: src/iptux/UiHelper.cpp:218 msgid "Warning" msgstr "警告" #: src/iptux/UiModels.cpp:604 #, c-format msgid "Version: %s" msgstr "版本: %s" #: src/iptux/UiModels.cpp:608 #, c-format msgid "Nickname: %s@%s" msgstr "昵称: %s@%s" #: src/iptux/UiModels.cpp:611 #, c-format msgid "Nickname: %s" msgstr "昵称: %s" #: src/iptux/UiModels.cpp:615 #, c-format msgid "User: %s" msgstr "用户: %s" #: src/iptux/UiModels.cpp:618 #, c-format msgid "Host: %s" msgstr "主机: %s" #: src/iptux/UiModels.cpp:623 #, c-format msgid "Address: %s(%s)" msgstr "地址: %s(%s)" #: src/iptux/UiModels.cpp:625 #, c-format msgid "Address: %s" msgstr "地址: %s" #: src/iptux/UiModels.cpp:630 msgid "Compatibility: Microsoft" msgstr "兼容性: Microsoft" #: src/iptux/UiModels.cpp:632 msgid "Compatibility: GNU/Linux" msgstr "兼容性: GNU/Linux" #: src/iptux/UiModels.cpp:636 #, c-format msgid "System coding: %s" msgstr "系统编码: %s" #: src/iptux/UiModels.cpp:641 msgid "Signature:" msgstr "个性签名:" #: src/iptux/UiModels.cpp:744 msgid "" msgstr "<错误>" #: src/iptux/UiModels.cpp:799 msgid "[IMG]" msgstr "[IMG]" #: src/iptux/dialog.cpp:39 msgid "" "File transfer has not been completed.\n" "Are you sure to cancel and quit?" msgstr "" "文件传输尚未完成。\n" "你确定要取消任务并退出吗?" #: src/iptux/dialog.cpp:42 msgid "Confirm Exit" msgstr "确认退出" #: src/iptux/dialog.cpp:62 src/iptux/resources/gtk/MainWindow.ui:12 #: src/iptux/resources/gtk/menus.ui:98 src/iptux/resources/gtk/menus.ui:243 msgid "Request Shared Resources" msgstr "请求共享资源" #: src/iptux/dialog.cpp:62 msgid "Agree" msgstr "允许" #: src/iptux/dialog.cpp:78 #, c-format msgid "" "Your pal (%s)[%s]\n" "is requesting to get your shared resources,\n" "Do you agree?" msgstr "" "您的好友(%s)[%s]\n" "请求获取您的共享资源,\n" "是否允许?" #: src/iptux/dialog.cpp:106 msgid "Access Password" msgstr "获取密码" #: src/iptux/dialog.cpp:113 msgid "Please input the password for the shared files behind" msgstr "请输入获取共享文件的密码" #: src/iptux/dialog.cpp:127 #, c-format msgid "(%s)[%s]Password:" msgstr "(%s)[%s]密码:" #: src/iptux/dialog.cpp:146 src/iptux/dialog.cpp:207 msgid "" "\n" "Empty Password!" msgstr "" "\n" "密码为空!" #: src/iptux/dialog.cpp:170 msgid "Enter a New Password" msgstr "输入一个新的密码" #: src/iptux/dialog.cpp:178 msgid "Password: " msgstr "密码: " #: src/iptux/dialog.cpp:187 msgid "Repeat: " msgstr "重复: " #: src/iptux/dialog.cpp:202 msgid "" "\n" "Password Mismatched!" msgstr "" "\n" "密码不一致!" #: src/iptux/dialog.cpp:229 msgid "Please select a folder to save files." msgstr "请选择一个文件夹来保存文件。" #: src/iptux/resources/gtk/AboutDialog.ui:11 msgid "" "Copyright © 2008–2009, Jally\n" "Copyright © 2013–2015,2017–2021, LI Daobing" msgstr "" "Copyright © 2008–2009, Jally\n" "Copyright © 2013–2015,2017–2021, LI Daobing" #: src/iptux/resources/gtk/AboutDialog.ui:13 msgid "A GTK based LAN messenger." msgstr "一个基于GTK的局域网通信工具。" #: src/iptux/resources/gtk/AppIndicator.ui:6 msgid "Open Iptux" msgstr "打开 Iptux" #: src/iptux/resources/gtk/AppIndicator.ui:12 #: src/iptux/resources/gtk/menus.ui:6 src/iptux/resources/gtk/menus.ui:306 msgid "_Preferences" msgstr "首选项(_P)" #: src/iptux/resources/gtk/AppIndicator.ui:16 #: src/iptux/resources/gtk/menus.ui:10 src/iptux/resources/gtk/menus.ui:310 msgid "_Quit" msgstr "退出(_Q)" #: src/iptux/resources/gtk/DetectPal.ui:7 msgid "Detect pal" msgstr "探测好友" #: src/iptux/resources/gtk/DetectPal.ui:15 msgid "Detect" msgstr "探测" #: src/iptux/resources/gtk/DetectPal.ui:61 msgid "Please input an IP address (IPv4 only):" msgstr "请输入IP地址(限IPv4格式):" #: src/iptux/resources/gtk/MainWindow.ui:8 src/iptux/resources/gtk/menus.ui:109 #: src/iptux/resources/gtk/menus.ui:254 msgid "Send Message" msgstr "发送消息" #: src/iptux/resources/gtk/MainWindow.ui:16 msgid "Change Info" msgstr "更改信息" #: src/iptux/resources/gtk/MainWindow.ui:20 msgid "Delete Pal" msgstr "删除好友" #: src/iptux/resources/gtk/MainWindow.ui:26 src/iptux/resources/gtk/menus.ui:31 #: src/iptux/resources/gtk/menus.ui:176 msgid "Sort" msgstr "排序" #: src/iptux/resources/gtk/MainWindow.ui:29 src/iptux/resources/gtk/menus.ui:34 #: src/iptux/resources/gtk/menus.ui:179 msgid "By Nickname" msgstr "按昵称" #: src/iptux/resources/gtk/MainWindow.ui:34 src/iptux/resources/gtk/menus.ui:39 #: src/iptux/resources/gtk/menus.ui:184 msgid "By Username" msgstr "按用户名" #: src/iptux/resources/gtk/MainWindow.ui:39 src/iptux/resources/gtk/menus.ui:44 #: src/iptux/resources/gtk/menus.ui:189 msgid "By IP" msgstr "按 IP" #: src/iptux/resources/gtk/MainWindow.ui:44 src/iptux/resources/gtk/menus.ui:49 #: src/iptux/resources/gtk/menus.ui:194 msgid "By Host" msgstr "按主机" #: src/iptux/resources/gtk/MainWindow.ui:49 src/iptux/resources/gtk/menus.ui:54 #: src/iptux/resources/gtk/menus.ui:199 msgid "By Last Activity" msgstr "按最近联系时间" #: src/iptux/resources/gtk/MainWindow.ui:56 src/iptux/resources/gtk/menus.ui:61 #: src/iptux/resources/gtk/menus.ui:206 msgid "Ascending" msgstr "升序" #: src/iptux/resources/gtk/MainWindow.ui:61 src/iptux/resources/gtk/menus.ui:66 #: src/iptux/resources/gtk/menus.ui:211 msgid "Descending" msgstr "降序" #: src/iptux/resources/gtk/MainWindow.ui:68 msgid "Info Style" msgstr "信息类型" #: src/iptux/resources/gtk/MainWindow.ui:71 msgid "IP" msgstr "IP" #: src/iptux/resources/gtk/MainWindow.ui:76 msgid "IP:PORT" msgstr "IP:PORT" #: src/iptux/resources/gtk/MainWindow.ui:86 msgid "Username" msgstr "用户名" #: src/iptux/resources/gtk/MainWindow.ui:91 msgid "Version" msgstr "版本" #: src/iptux/resources/gtk/MainWindow.ui:96 msgid "Last Activity" msgstr "最近联系时间" #: src/iptux/resources/gtk/MainWindow.ui:101 msgid "Last Message" msgstr "最后消息" #: src/iptux/resources/gtk/menus.ui:17 src/iptux/resources/gtk/menus.ui:162 msgid "_File" msgstr "文件(_F)" #: src/iptux/resources/gtk/menus.ui:19 src/iptux/resources/gtk/menus.ui:164 msgid "_Detect" msgstr "探测(_D)" #: src/iptux/resources/gtk/menus.ui:23 src/iptux/resources/gtk/menus.ui:168 msgid "_Find" msgstr "查找(_F)" #: src/iptux/resources/gtk/menus.ui:28 src/iptux/resources/gtk/menus.ui:173 msgid "_View" msgstr "查看(_V)" #: src/iptux/resources/gtk/menus.ui:73 src/iptux/resources/gtk/menus.ui:218 msgid "_Refresh" msgstr "刷新(_R)" #: src/iptux/resources/gtk/menus.ui:80 src/iptux/resources/gtk/menus.ui:225 msgid "_Chat" msgstr "对话(_C)" #: src/iptux/resources/gtk/menus.ui:88 src/iptux/resources/gtk/menus.ui:233 msgid "Attach File" msgstr "增添文件" #: src/iptux/resources/gtk/menus.ui:92 src/iptux/resources/gtk/menus.ui:237 msgid "Attach Folder" msgstr "增添目录" #: src/iptux/resources/gtk/menus.ui:102 src/iptux/resources/gtk/menus.ui:247 msgid "Clear Chat History" msgstr "清理聊天记录" #: src/iptux/resources/gtk/menus.ui:115 src/iptux/resources/gtk/menus.ui:260 msgid "_Window" msgstr "窗口(_W)" #: src/iptux/resources/gtk/menus.ui:118 src/iptux/resources/gtk/menus.ui:263 msgid "_Transmission" msgstr "传输管理器(_T)" #: src/iptux/resources/gtk/menus.ui:122 src/iptux/resources/gtk/menus.ui:267 msgid "_Shared Management" msgstr "共享管理器(_S)" #: src/iptux/resources/gtk/menus.ui:126 src/iptux/resources/gtk/menus.ui:271 msgid "_Chat Log" msgstr "聊天记录(_C)" #: src/iptux/resources/gtk/menus.ui:130 src/iptux/resources/gtk/menus.ui:275 msgid "_System Log" msgstr "系统日志(_S)" #: src/iptux/resources/gtk/menus.ui:136 src/iptux/resources/gtk/menus.ui:281 msgid "Close Window" msgstr "关闭窗口" #: src/iptux/resources/gtk/menus.ui:142 src/iptux/resources/gtk/menus.ui:287 msgid "_Help" msgstr "帮助(_H)" #: src/iptux/resources/gtk/menus.ui:145 src/iptux/resources/gtk/menus.ui:290 msgid "_About" msgstr "关于(_A)" #: src/iptux/resources/gtk/menus.ui:149 src/iptux/resources/gtk/menus.ui:294 msgid "Report Bug" msgstr "报告Bug" #: src/iptux/resources/gtk/menus.ui:153 src/iptux/resources/gtk/menus.ui:298 msgid "What's New" msgstr "更新日志" #: src/iptux/resources/gtk/menus.ui:318 msgid "Open This File" msgstr "打开文件" #: src/iptux/resources/gtk/menus.ui:322 msgid "Open Containing Folder" msgstr "打开所在文件夹" #: src/iptux/resources/gtk/menus.ui:326 msgid "Terminate Task" msgstr "终止任务" #: src/iptux/resources/gtk/menus.ui:330 msgid "Terminate All" msgstr "终止所有" #: src/iptux/resources/gtk/menus.ui:334 msgid "Clear Tasklist" msgstr "清理任务" #: src/iptux/resources/gtk/menus.ui:346 msgid "Refuse All" msgstr "全部拒绝" #: src/main/iptux.cpp:149 msgid "- A software for sharing in LAN" msgstr "- 一款用于在局域网内共享文件的软件" #: src/main/iptux.cpp:152 #, c-format msgid "option parsing failed: %s\n" msgstr "选项解析失败: %s\n" #~ msgid "Insert Picture" #~ msgstr "插入图片" #, c-format #~ msgid "Open URL: %s\n" #~ msgstr "打开URL:%s\n" #~ msgid "Can't find any available web browser!\n" #~ msgstr "无法找到可用的浏览器!\n" #~ msgid "chat;talk;im;message;ipmsg;feige;" #~ msgstr "chat;talk;im;message;ipmsg;feige;" #~ msgid "It can:" #~ msgstr "它可以:" #~ msgid "Close Chat" #~ msgstr "关闭对话" #~ msgid "Pals Online: %" #~ msgstr "在线好友: %" #~ msgid "Sound" #~ msgstr "声音" #~ msgid "Activate the sound support" #~ msgstr "启动声音支持" #~ msgid "Volume Control: " #~ msgstr "音量控制:" #~ msgid "Sound Event" #~ msgstr "声音事件" #~ msgid "Test" #~ msgstr "测试" #~ msgid "Stop" #~ msgstr "停止" #~ msgid "Transfer finished" #~ msgstr "传输完成" #~ msgid "Message received" #~ msgstr "收到消息" #~ msgid "Play" #~ msgstr "播放" #~ msgid "Event" #~ msgstr "事件" #~ msgid "Please select a sound file" #~ msgstr "请选择一个声音文件" #, fuzzy #~ msgid "Failed to play the prompt tone, [%s] %s, %s" #~ msgstr "播放提示音失败,%s\n" #~ msgid "_Hide" #~ msgstr "隐藏(_H)" #~ msgid "_Show" #~ msgstr "显示(_S)" #~ msgid "To be read: %u messages" #~ msgstr "未读消息: %u条" #~ msgid "_Tools" #~ msgstr "工具(_T)" #~ msgid "Error" #~ msgstr "错误" #, fuzzy #~ msgid "iptux-icon" #~ msgstr "信使(iptux)" #~ msgid "Please input an IP address (IPv4 only)!" #~ msgstr "请输入IP地址(限IPv4格式)!" #~ msgid "..." #~ msgstr "..." #~ msgid "Clear Buffer" #~ msgstr "清空缓冲" #~ msgid "Contributors" #~ msgstr "贡献者" #~ msgid "" #~ "Fatal Error!!\n" #~ "Failed to bind the TCP/UDP port(%d)!\n" #~ "%s" #~ msgstr "" #~ "致命错误!!\n" #~ "绑定TCP/UDP端口(%d)失败!\n" #~ "%s" #~ msgid "Help" #~ msgstr "帮助" #~ msgid "" #~ "It's an honor that iptux was contributed voluntarilly by many people. " #~ "Without your help, iptux could never make it.\n" #~ "\n" #~ "Especially, Here's some we would like to thank much:\n" #~ "\n" #~ "ChenGang\n" #~ "\n" #~ "\n" #~ "\n" #~ "\n" #~ "\n" #~ "..." #~ msgstr "" #~ "很荣幸有很多人们自发为iptux项目作出了贡献。没有你们的帮助,iptux不可能做到" #~ "现在这样。\n" #~ "\n" #~ "特别地,这里有些人我们想要表示高度感谢:\n" #~ "\n" #~ "ChenGang\n" #~ "\n" #~ "\n" #~ "\n" #~ "\n" #~ "\n" #~ "..." #~ msgid "Jally " #~ msgstr "Jally " #~ msgid "LiWeijian " #~ msgstr "牛牛 " #~ msgid "ManPT " #~ msgstr "ManPT " #~ msgid "More About Iptux" #~ msgstr "更多..." #~ msgid "" #~ "Project Home: \n" #~ "https://github.com/iptux-src/iptux\n" #~ "\n" #~ "User and Developer Group: \n" #~ "https://groups.google.com/group/iptux/\n" #~ "\n" #~ "Note that you can get help form the project wiki page.\n" #~ "\n" #~ "If you find no solutions in any of the existed documents, feel free to " #~ "drop a email at iptux@googlegroups.com, lots of users and developers " #~ "would be glade to help about your problems." #~ msgstr "" #~ "项目主页: \n" #~ "https://github.com/iptux-src/iptux\n" #~ "\n" #~ "用户邮件组: \n" #~ "https://groups.google.com/group/iptux/\n" #~ "\n" #~ "遇到问题时,麻烦留意一下项目Wiki页面,会得到不少帮助信息。\n" #~ "\n" #~ "如果仍然找不到解决的办法,欢迎发信到邮件组iptux@googlegroups.com,我们会乐" #~ "意帮助你解决问题。" #~ msgid "The process is about to quit!" #~ msgstr "进程即将退出!" #~ msgid "_FAQ" #~ msgstr "FAQ(_F)" #~ msgid "_More" #~ msgstr "更多(_M)" #~ msgid "_Sort" #~ msgstr "排序(_S)" #~ msgid "_Update" #~ msgstr "刷新(_U)" #~ msgid "" #~ "alick \n" #~ "ManPT " #~ msgstr "" #~ "alick \n" #~ "ManPT " #~ msgid "http://code.google.com/p/iptux/wiki/FAQ?wl=en" #~ msgstr "http://code.google.com/p/iptux/wiki/FAQ" iptux-0.9.4/po/zh_TW.po000066400000000000000000001062161475473122500147260ustar00rootroot00000000000000# Chinese (traditional) translation for iptux # Copyright (C) 2009 THE IPTUX'S COPYRIGHT HOLDER # This file is distributed under the same license as the iptux package. # 村仔 , 2009. # msgid "" msgstr "" "Project-Id-Version: iptux 0.6.3\n" "Report-Msgid-Bugs-To: https://github.com/iptux-src/iptux/issues/new\n" "POT-Creation-Date: 2025-02-17 13:35-0800\n" "PO-Revision-Date: 2010-03-26 00:21+0800\n" "Last-Translator: zhangjiejing \n" "Language-Team: Chinese (traditional) \n" "Language: zh_TW\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Generator: Lokalize 0.3\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:6 msgid "iptux" msgstr "信使(iptux)" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:7 msgid "LAN communication software" msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:17 msgid "iptux is an “IP Messenger” client. The features of iptux include:" msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:21 msgid "auto-detect other clients on the intranet." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:22 msgid "send/recv messages to other clients." msgstr "发送/接收消息到其他客户端。" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:23 msgid "send/recv files to other clients." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:24 msgid "share your files to other cliens (with optional password protection)." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:26 msgid "" "It is (supposedly) compatible with 飞鸽传书 (Feige) and 飞秋 (FeiQ) from " "China, and with the original “IP Messenger” clients from Japan, including " "g2ipmsg and xipmsg in Debian." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:38 msgid "The Iptux main window." msgstr "" #: share/metainfo/io.github.iptux_src.iptux.metainfo.xml:42 msgid "The Iptux chat window." msgstr "" #: src/iptux-core/CoreThread.cpp:172 #, fuzzy, c-format msgid "" "Fatal Error!! Failed to create new socket!\n" "%s" msgstr "" "致命錯誤!!\n" "建立新的連接失敗!\n" "%s" #: src/iptux-core/CoreThread.cpp:188 #, fuzzy, c-format msgid "" "Fatal Error!! Failed to bind the TCP port(%s:%d)!\n" "%s" msgstr "" "致命錯誤!!\n" "連接TCP/UDP端口(2425)失敗!\n" "%s" #: src/iptux-core/CoreThread.cpp:201 #, fuzzy, c-format msgid "" "Fatal Error!! Failed to bind the UDP port(%s:%d)!\n" "%s" msgstr "" "致命錯誤!!\n" "連接TCP/UDP端口(2425)失敗!\n" "%s" #: src/iptux-core/CoreThread.cpp:461 src/iptux-core/CoreThread.cpp:495 #: src/iptux-core/internal/RecvFileData.cpp:142 #: src/iptux-core/internal/RecvFileData.cpp:204 #, c-format msgid "" "Fatal Error!!\n" "Failed to create new socket!\n" "%s" msgstr "" "致命錯誤!!\n" "建立新的連接失敗!\n" "%s" #: src/iptux-core/Models.cpp:172 #, fuzzy msgid "Empty Message" msgstr "傳送訊息" #: src/iptux-core/Models.cpp:250 #, fuzzy msgid "Received an image" msgstr "檔案接收管理器" #: src/iptux-core/internal/AnalogFS.cpp:93 #: src/iptux-core/internal/AnalogFS.cpp:98 #, c-format msgid "Open() file \"%s\" failed, %s" msgstr "打開檔案\"%s\"失敗,%s" #: src/iptux-core/internal/AnalogFS.cpp:117 #, c-format msgid "Stat64() file \"%s\" failed, %s" msgstr "獲取檔案\"%s\"狀態失敗,%s" #: src/iptux-core/internal/AnalogFS.cpp:138 #, c-format msgid "Mkdir() directory \"%s\" failed, %s" msgstr "建立目錄\"%s\"失敗,%s" #: src/iptux-core/internal/AnalogFS.cpp:164 #, c-format msgid "Opendir() directory \"%s\" failed, %s" msgstr "打開目錄\"%s\"失敗,%s" #: src/iptux-core/internal/Command.cpp:226 msgid "Your pal didn't receive the packet. He or she is offline maybe." msgstr "你的好友沒有收到傳送的資料,他可能已經下線。" #: src/iptux-core/internal/CommandMode.cpp:39 #, c-format msgid "unknown command mode: %d" msgstr "" #: src/iptux-core/internal/RecvFileData.cpp:117 msgid "receive" msgstr "接收" #: src/iptux-core/internal/RecvFileData.cpp:124 #: src/iptux-core/internal/RecvFileData.cpp:253 #: src/iptux-core/internal/SendFileData.cpp:108 #: src/iptux-core/internal/SendFileData.cpp:193 #, fuzzy msgid "Unknown" msgstr "未知" #: src/iptux-core/internal/RecvFileData.cpp:175 #, fuzzy, c-format msgid "" "Failed to receive the file \"%s\" from %s! expect length %jd, received %jd" msgstr "接收檔案\"%s\"來自%s失敗!" #: src/iptux-core/internal/RecvFileData.cpp:180 #, c-format msgid "Receive the file \"%s\" from %s successfully!" msgstr "接收檔案\"%s\"來自%s成功!" #: src/iptux-core/internal/RecvFileData.cpp:320 #, c-format msgid "Failed to receive the directory \"%s\" from %s!" msgstr "接收目錄\"%s\"來自%s失敗!" #: src/iptux-core/internal/RecvFileData.cpp:323 #, c-format msgid "Receive the directory \"%s\" from %s successfully!" msgstr "接收目錄\"%s\"來自%s成功!" #: src/iptux-core/internal/SendFileData.cpp:101 msgid "send" msgstr "傳送" #: src/iptux-core/internal/SendFileData.cpp:137 #, c-format msgid "Failed to send the file \"%s\" to %s!" msgstr "傳送檔案\"%s\"到%s失敗!" #: src/iptux-core/internal/SendFileData.cpp:142 #, c-format msgid "Send the file \"%s\" to %s successfully!" msgstr "傳送檔案\"%s\"到%s成功!" #: src/iptux-core/internal/SendFileData.cpp:265 #, c-format msgid "Failed to send the directory \"%s\" to %s!" msgstr "傳送目錄\"%s\"到%s失敗!" #: src/iptux-core/internal/SendFileData.cpp:270 #, c-format msgid "Send the directory \"%s\" to %s successfully!" msgstr "傳送目錄\"%s\"到%s失敗!" #: src/iptux-core/internal/UdpData.cpp:92 #: src/iptux-core/internal/UdpData.cpp:93 #: src/iptux-core/internal/UdpData.cpp:443 #: src/iptux-core/internal/UdpData.cpp:484 msgid "mysterious" msgstr "神秘訪客" #: src/iptux-utils/utils.cpp:880 #, fuzzy, c-format msgid "stat file \"%s\" failed: %s" msgstr "查看檔案\"%s\"狀態失敗,%s\n" #: src/iptux-utils/utils.cpp:888 #, c-format msgid "path %s is not file or directory: st_mode(%x)" msgstr "" #: src/iptux-utils/utils.cpp:895 #, fuzzy, c-format msgid "opendir on \"%s\" failed: %s" msgstr "打開目錄\"%s\"失敗,%s" #: src/iptux/AboutDialog.cpp:39 msgid "TRANSLATOR NAME" msgstr "" #: src/iptux/AboutDialog.cpp:53 msgid "Thanks to" msgstr "" #: src/iptux/AppIndicator.cpp:40 src/iptux/MainWindow.cpp:505 #: src/iptux/MainWindow.cpp:507 #, fuzzy msgid "Iptux" msgstr "信使(iptux)" #: src/iptux/Application.cpp:54 msgid "Loading the process successfully!" msgstr "程序載入成功!" #: src/iptux/Application.cpp:274 #, c-format msgid "New Message from %s" msgstr "" #: src/iptux/Application.cpp:287 #, c-format msgid "New File from %s" msgstr "" #: src/iptux/Application.cpp:296 msgid "Receiving File Finished" msgstr "" #: src/iptux/Application.cpp:300 msgid "file info no longer exist" msgstr "" #: src/iptux/Darwin.cpp:16 #, c-format msgid "Couldn’t load icon: %s" msgstr "" #: src/iptux/DataSettings.cpp:46 msgid "Personal" msgstr "個人" #: src/iptux/DataSettings.cpp:48 msgid "System" msgstr "系統" #: src/iptux/DataSettings.cpp:50 msgid "Network" msgstr "網路" #: src/iptux/DataSettings.cpp:89 src/iptux/DataSettings.cpp:98 msgid "The program needs to be restarted to take effect!" msgstr "" #: src/iptux/DataSettings.cpp:143 msgid "Preferences" msgstr "偏好設定" #: src/iptux/DataSettings.cpp:143 src/iptux/RevisePal.cpp:109 #: src/iptux/dialog.cpp:107 src/iptux/dialog.cpp:170 #, fuzzy msgid "_OK" msgstr "確定" #: src/iptux/DataSettings.cpp:144 #, fuzzy msgid "_Apply" msgstr "套用" #: src/iptux/DataSettings.cpp:144 src/iptux/DataSettings.cpp:1348 #: src/iptux/DataSettings.cpp:1395 src/iptux/DialogBase.cpp:359 #: src/iptux/DialogBase.cpp:918 src/iptux/RevisePal.cpp:110 #: src/iptux/ShareFile.cpp:419 src/iptux/callback.cpp:87 #: src/iptux/dialog.cpp:171 src/iptux/dialog.cpp:230 #, fuzzy msgid "_Cancel" msgstr "取消" #: src/iptux/DataSettings.cpp:169 #, fuzzy msgid "Your _nickname:" msgstr "您的暱稱:" #: src/iptux/DataSettings.cpp:176 msgid "Please input your nickname!" msgstr "請輸入您的暱稱!" #: src/iptux/DataSettings.cpp:182 #, fuzzy msgid "Your _group name:" msgstr "您的群組名稱:" #: src/iptux/DataSettings.cpp:189 msgid "Please input your group name!" msgstr "請輸入您的群組名稱!" #: src/iptux/DataSettings.cpp:195 #, fuzzy msgid "Your _face picture:" msgstr "您的頭像:" #: src/iptux/DataSettings.cpp:213 #, fuzzy msgid "_Save files to: " msgstr "檔案存至:" #: src/iptux/DataSettings.cpp:226 msgid "Photo" msgstr "個人相片" #: src/iptux/DataSettings.cpp:238 msgid "Signature" msgstr "個人簽名" #: src/iptux/DataSettings.cpp:271 msgid "Port:" msgstr "" #: src/iptux/DataSettings.cpp:278 msgid "Any port number between 1024 and 65535, default is 2425" msgstr "" #: src/iptux/DataSettings.cpp:287 #, fuzzy msgid "Candidate network encodings:" msgstr "預設網路編碼:" #: src/iptux/DataSettings.cpp:294 #, fuzzy msgid "Candidate network encodings, separated by \",\"" msgstr "預設網路編碼" #: src/iptux/DataSettings.cpp:301 msgid "Preferred network encoding:" msgstr "偏好網路編碼:" #: src/iptux/DataSettings.cpp:308 msgid "" "Preference network coding (You should be aware of what you are doing if you " "want to modify it.)" msgstr "偏好網路編碼(如果你想要修改它,那麼你必須明白你正在做什麼。)" #: src/iptux/DataSettings.cpp:316 msgid "Pal's default face picture:" msgstr "預設好友頭像:" #: src/iptux/DataSettings.cpp:334 msgid "Panel font:" msgstr "面板字體:" #: src/iptux/DataSettings.cpp:346 msgid "Automatically open the chat dialog" msgstr "自動打開聊天對話框" #: src/iptux/DataSettings.cpp:354 msgid "Automatically hide the panel after login" msgstr "程序啟動後隱藏面板" #: src/iptux/DataSettings.cpp:362 msgid "Automatically open the File Transmission Management" msgstr "自動打開檔案傳輸管理器" #: src/iptux/DataSettings.cpp:370 msgid "Use the 'Enter' key to send message" msgstr "使用Enter鍵傳送訊息" #: src/iptux/DataSettings.cpp:378 msgid "Automatically clean up the chat history" msgstr "自動清空聊天記錄" #: src/iptux/DataSettings.cpp:385 msgid "Save the chat history" msgstr "儲存聊天記錄" #: src/iptux/DataSettings.cpp:393 msgid "Use the Blacklist (NOT recommended)" msgstr "開啟黑名單處理方案(不推薦)" #: src/iptux/DataSettings.cpp:401 msgid "Filter the request of sharing files" msgstr "過濾共享檔案請求" #: src/iptux/DataSettings.cpp:408 msgid "Hide the taskbar when the main window is minimized" msgstr "" #: src/iptux/DataSettings.cpp:432 msgid "From:" msgstr "起始:" #: src/iptux/DataSettings.cpp:438 msgid "Beginning of the IP(v4) section" msgstr "IP(v4)網路區段起始點" #: src/iptux/DataSettings.cpp:442 msgid "To:" msgstr "終止:" #: src/iptux/DataSettings.cpp:448 msgid "End of the IP(v4) section" msgstr "IP(v4)網路區段終止點" #: src/iptux/DataSettings.cpp:456 msgid "Add" msgstr "新增" #: src/iptux/DataSettings.cpp:461 msgid "Delete" msgstr "刪除" #: src/iptux/DataSettings.cpp:468 msgid "Added IP(v4) Section:" msgstr "已添加的IP(v4)網路區段:" #: src/iptux/DataSettings.cpp:487 msgid "Import" msgstr "匯入" #: src/iptux/DataSettings.cpp:491 msgid "Export" msgstr "匯出" #: src/iptux/DataSettings.cpp:495 src/iptux/TransWindow.cpp:171 msgid "Clear" msgstr "清空" #: src/iptux/DataSettings.cpp:706 msgid "From" msgstr "起始" #: src/iptux/DataSettings.cpp:713 msgid "To" msgstr "終止" #: src/iptux/DataSettings.cpp:720 msgid "Description" msgstr "描述" #: src/iptux/DataSettings.cpp:736 msgid "Please select download folder" msgstr "請選擇下載目錄" #: src/iptux/DataSettings.cpp:758 msgid "Select Font" msgstr "選擇字體" #: src/iptux/DataSettings.cpp:872 src/iptux/DataSettings.cpp:874 #: src/iptux/DataSettings.cpp:878 msgid "Port must be a number between 1024 and 65535" msgstr "" #: src/iptux/DataSettings.cpp:1019 src/iptux/DataSettings.cpp:1050 #, c-format msgid "" "Fopen() file \"%s\" failed!\n" "%s" msgstr "" "打開檔案\"%s\"失敗!\n" "%s" #: src/iptux/DataSettings.cpp:1150 src/iptux/RevisePal.cpp:419 msgid "Please select a face picture" msgstr "請選擇一個頭像圖片" #: src/iptux/DataSettings.cpp:1172 msgid "Please select a personal photo" msgstr "請選擇個人照片" #: src/iptux/DataSettings.cpp:1241 src/iptux/DataSettings.cpp:1248 #: src/iptux/DetectPal.cpp:75 #, c-format msgid "" "\n" "Illegal IP(v4) address: %s!" msgstr "" "\n" "非法的IP(v4)位址:%s!" #: src/iptux/DataSettings.cpp:1346 msgid "Please select a file to import data" msgstr "請選擇匯入資料的檔案" #: src/iptux/DataSettings.cpp:1347 src/iptux/DialogBase.cpp:358 #: src/iptux/ShareFile.cpp:418 src/iptux/callback.cpp:86 msgid "_Open" msgstr "" #: src/iptux/DataSettings.cpp:1394 msgid "Save data to file" msgstr "保存資料到檔案" #: src/iptux/DataSettings.cpp:1395 src/iptux/DialogBase.cpp:919 #: src/iptux/dialog.cpp:231 msgid "_Save" msgstr "" #: src/iptux/DetectPal.cpp:70 #, c-format msgid "The notification has been sent to %s." msgstr "訊息已經傳送到%s。" #: src/iptux/DialogBase.cpp:214 #, c-format msgid "%s To Send." msgstr "" #: src/iptux/DialogBase.cpp:272 msgid "Close" msgstr "關閉" #: src/iptux/DialogBase.cpp:276 src/iptux/DialogGroup.cpp:375 msgid "Send" msgstr "傳送" #: src/iptux/DialogBase.cpp:307 msgid "Chat History" msgstr "聊天記錄" #: src/iptux/DialogBase.cpp:350 msgid "Choose enclosure files" msgstr "選擇檔案附件" #: src/iptux/DialogBase.cpp:353 msgid "Choose enclosure folders" msgstr "選擇目錄附件" #: src/iptux/DialogBase.cpp:593 #, fuzzy msgid "Remove Selected" msgstr "反選" #: src/iptux/DialogBase.cpp:648 msgid "File to send." msgstr "" #: src/iptux/DialogBase.cpp:653 msgid "Sending progress." msgstr "" #: src/iptux/DialogBase.cpp:656 msgid "Dirs" msgstr "" #: src/iptux/DialogBase.cpp:659 #, fuzzy msgid "Files" msgstr "檔案" #: src/iptux/DialogBase.cpp:662 src/iptux/DialogPeer.cpp:565 msgid "Detail" msgstr "" #: src/iptux/DialogBase.cpp:712 #, fuzzy msgid "PeerName" msgstr "好友" #: src/iptux/DialogBase.cpp:719 src/iptux/DialogPeer.cpp:716 msgid "Name" msgstr "" #: src/iptux/DialogBase.cpp:725 src/iptux/DialogPeer.cpp:652 #: src/iptux/DialogPeer.cpp:722 src/iptux/ShareFile.cpp:280 #: src/iptux/TransWindow.cpp:271 msgid "Size" msgstr "大小" #: src/iptux/DialogBase.cpp:731 msgid "Path" msgstr "" #: src/iptux/DialogBase.cpp:792 #, fuzzy msgid "Sending Progress." msgstr "進度" #: src/iptux/DialogBase.cpp:795 #, c-format msgid "%s of %s Sent." msgstr "" #: src/iptux/DialogBase.cpp:802 src/iptux/DialogPeer.cpp:835 #, fuzzy msgid "Mission Completed!" msgstr "已完成" #: src/iptux/DialogBase.cpp:845 src/iptux/DialogBase.cpp:917 msgid "Save Image" msgstr "" #: src/iptux/DialogBase.cpp:850 msgid "Copy Image" msgstr "" #: src/iptux/DialogGroup.cpp:285 msgid "Member" msgstr "成員" #: src/iptux/DialogGroup.cpp:382 msgid "Pals" msgstr "好友" #: src/iptux/DialogGroup.cpp:480 msgid "Select All" msgstr "全選" #: src/iptux/DialogGroup.cpp:485 msgid "Reverse Select" msgstr "反選" #: src/iptux/DialogGroup.cpp:490 msgid "Clear Up" msgstr "清空" #: src/iptux/DialogGroup.cpp:728 #, c-format msgid "Talk with the group %s" msgstr "與%s組對話" #: src/iptux/DialogPeer.cpp:132 #, fuzzy, c-format msgid "Talk with %s(%s) IP:%s" msgstr "與%s對話" #: src/iptux/DialogPeer.cpp:305 msgid "Info." msgstr "資訊" #: src/iptux/DialogPeer.cpp:337 #, c-format msgid "Version: %s\n" msgstr "版本: %s\n" #: src/iptux/DialogPeer.cpp:339 #, c-format msgid "Nickname: %s@%s\n" msgstr "暱稱: %s@%s\n" #: src/iptux/DialogPeer.cpp:342 #, c-format msgid "Nickname: %s\n" msgstr "暱稱: %s\n" #: src/iptux/DialogPeer.cpp:344 #, c-format msgid "User: %s\n" msgstr "用戶: %s\n" #: src/iptux/DialogPeer.cpp:345 #, c-format msgid "Host: %s\n" msgstr "主機: %s\n" #: src/iptux/DialogPeer.cpp:348 #, c-format msgid "Address: %s(%s)\n" msgstr "位址: %s(%s)\n" #: src/iptux/DialogPeer.cpp:350 #, c-format msgid "Address: %s\n" msgstr "位址: %s\n" #: src/iptux/DialogPeer.cpp:353 msgid "Compatibility: Microsoft\n" msgstr "相容性: Microsoft\n" #: src/iptux/DialogPeer.cpp:355 msgid "Compatibility: GNU/Linux\n" msgstr "相容性: GNU/Linux\n" #: src/iptux/DialogPeer.cpp:357 #, c-format msgid "System coding: %s\n" msgstr "系統編碼: %s\n" #: src/iptux/DialogPeer.cpp:362 msgid "Signature:\n" msgstr "個性簽名:\n" #: src/iptux/DialogPeer.cpp:369 msgid "" "\n" "Photo:\n" msgstr "" "\n" "個人頭象:\n" #: src/iptux/DialogPeer.cpp:460 msgid "Please select a picture to insert the buffer" msgstr "請選擇插入緩衝區的圖片" #: src/iptux/DialogPeer.cpp:486 src/iptux/resources/gtk/menus.ui:83 #: src/iptux/resources/gtk/menus.ui:228 #, fuzzy msgid "Insert Image" msgstr "插入圖片" #: src/iptux/DialogPeer.cpp:502 #, fuzzy msgid "Enclosure." msgstr "附件" #: src/iptux/DialogPeer.cpp:547 #, fuzzy msgid "Files to be received" msgstr "收到訊息" #: src/iptux/DialogPeer.cpp:551 msgid "Receiving progress." msgstr "" #: src/iptux/DialogPeer.cpp:554 msgid "Accept" msgstr "接受" #: src/iptux/DialogPeer.cpp:560 src/iptux/dialog.cpp:63 #: src/iptux/resources/gtk/menus.ui:342 msgid "Refuse" msgstr "拒絕" #: src/iptux/DialogPeer.cpp:596 #, fuzzy msgid "File received." msgstr "收到訊息" #: src/iptux/DialogPeer.cpp:639 src/iptux/DialogPeer.cpp:710 msgid "Source" msgstr "來源" #: src/iptux/DialogPeer.cpp:646 msgid "SaveAs" msgstr "" #: src/iptux/DialogPeer.cpp:818 src/iptux/DialogPeer.cpp:884 msgid "Receiving Progress." msgstr "" #: src/iptux/DialogPeer.cpp:821 src/iptux/DialogPeer.cpp:887 #, c-format msgid "%s to Receive." msgstr "" #: src/iptux/DialogPeer.cpp:825 src/iptux/DialogPeer.cpp:891 #, c-format msgid "%s Of %s Received." msgstr "" #: src/iptux/LogSystem.cpp:71 #, c-format msgid "Recevied-From: Nickname:%s User:%s Host:%s" msgstr "来自: 昵称:%s 用户:%s 主機:%s" #: src/iptux/LogSystem.cpp:76 #, c-format msgid "Send-To: Nickname:%s User:%s Host:%s" msgstr "傳送: 暱稱:%s 用戶:%s 主機:%s" #: src/iptux/LogSystem.cpp:80 msgid "Send-Broadcast" msgstr "傳送廣播" #: src/iptux/LogSystem.cpp:99 #, c-format msgid "User:%s Host:%s" msgstr "用戶:%s 主機:%s" #: src/iptux/MainWindow.cpp:570 msgid "Pals Online: 0" msgstr "線上好友: 0" #: src/iptux/MainWindow.cpp:655 msgid "Search Pals" msgstr "搜尋好友" #: src/iptux/MainWindow.cpp:768 msgid "Nickname" msgstr "暱稱" #: src/iptux/MainWindow.cpp:778 msgid "Group" msgstr "群組名稱" #: src/iptux/MainWindow.cpp:784 src/iptux/TransWindow.cpp:258 msgid "IPv4" msgstr "IPv4" #: src/iptux/MainWindow.cpp:790 msgid "User" msgstr "用戶" #: src/iptux/MainWindow.cpp:796 src/iptux/resources/gtk/MainWindow.ui:81 msgid "Host" msgstr "主機" #: src/iptux/MainWindow.cpp:935 #, fuzzy, c-format msgid "Pals Online: %d" msgstr "線上好友: 0" #: src/iptux/RevisePal.cpp:109 msgid "Change Pal's Information" msgstr "更改好友資訊" #: src/iptux/RevisePal.cpp:134 msgid "Pal's nickname:" msgstr "好友暱稱:" #: src/iptux/RevisePal.cpp:140 msgid "Please input pal's new nickname!" msgstr "請輸入好友的新暱稱!" #: src/iptux/RevisePal.cpp:146 msgid "Pal's group name:" msgstr "好友群組名稱:" #: src/iptux/RevisePal.cpp:152 msgid "Please input pal's new group name!" msgstr "請輸入好友的新群組名稱!" #: src/iptux/RevisePal.cpp:158 msgid "System coding:" msgstr "系統編碼:" #: src/iptux/RevisePal.cpp:164 msgid "Be SURE to know what you are doing!" msgstr "你最好明白你到底在做些什麼!" #: src/iptux/RevisePal.cpp:170 msgid "Pal's face picture:" msgstr "好友頭像:" #: src/iptux/RevisePal.cpp:184 msgid "Be compatible with iptux's protocol (DANGEROUS)" msgstr "相容 iptux 擴展協議(危險)" #: src/iptux/ShareFile.cpp:104 msgid "Shared Files Management" msgstr "共享檔案管理器" #: src/iptux/ShareFile.cpp:105 msgid "OK" msgstr "確定" #: src/iptux/ShareFile.cpp:106 msgid "Apply" msgstr "套用" #: src/iptux/ShareFile.cpp:107 msgid "Cancel" msgstr "取消" #: src/iptux/ShareFile.cpp:160 msgid "Add Files" msgstr "新增檔案" #: src/iptux/ShareFile.cpp:163 msgid "Add Folders" msgstr "新增目錄" #: src/iptux/ShareFile.cpp:166 msgid "Delete Resources" msgstr "刪除資源" #: src/iptux/ShareFile.cpp:169 msgid "Clear Password" msgstr "清除密碼" #: src/iptux/ShareFile.cpp:172 msgid "Set Password" msgstr "設置密碼" #: src/iptux/ShareFile.cpp:229 src/iptux/ShareFile.cpp:373 msgid "regular" msgstr "常規檔案" #: src/iptux/ShareFile.cpp:233 src/iptux/ShareFile.cpp:377 msgid "directory" msgstr "目錄" #: src/iptux/ShareFile.cpp:237 src/iptux/ShareFile.cpp:381 msgid "unknown" msgstr "未知" #: src/iptux/ShareFile.cpp:270 msgid "File" msgstr "檔案" #: src/iptux/ShareFile.cpp:286 msgid "Type" msgstr "類型" #: src/iptux/ShareFile.cpp:411 msgid "Choose the files to share" msgstr "選擇共享檔案" #: src/iptux/ShareFile.cpp:414 msgid "Choose the folders to share" msgstr "選擇共享目錄" #: src/iptux/TransWindow.cpp:86 msgid "Files Transmission Management" msgstr "檔案傳輸管理器" #: src/iptux/TransWindow.cpp:241 msgid "State" msgstr "狀態" #: src/iptux/TransWindow.cpp:247 msgid "Task" msgstr "任務" #: src/iptux/TransWindow.cpp:253 msgid "Peer" msgstr "好友" #: src/iptux/TransWindow.cpp:265 msgid "Filename" msgstr "檔案名" #: src/iptux/TransWindow.cpp:277 msgid "Completed" msgstr "已完成" #: src/iptux/TransWindow.cpp:284 msgid "Progress" msgstr "進度" #: src/iptux/TransWindow.cpp:291 msgid "Cost" msgstr "花費時間" #: src/iptux/TransWindow.cpp:297 msgid "Remaining" msgstr "剩餘時間" #: src/iptux/TransWindow.cpp:303 msgid "Rate" msgstr "速率" #: src/iptux/TransWindow.cpp:331 msgid "The path you want to open not exist!" msgstr "" #: src/iptux/TransWindow.cpp:405 msgid "The file you want to open not exist!" msgstr "" #: src/iptux/TransWindow.cpp:406 #, fuzzy msgid "iptux Error" msgstr "錯誤" #: src/iptux/UiCoreThread.cpp:254 src/iptux/UiCoreThread.cpp:278 #: src/iptux/UiCoreThread.cpp:377 src/iptux/UiCoreThread.cpp:399 msgid "Others" msgstr "其他" #: src/iptux/UiCoreThread.cpp:419 msgid "Broadcast" msgstr "廣播" #: src/iptux/UiHelper.cpp:28 #, c-format msgid "Can't convert path to uri: %s, reason: %s" msgstr "" #: src/iptux/UiHelper.cpp:39 #, c-format msgid "Can't open path: %s, reason: %s" msgstr "" #: src/iptux/UiHelper.cpp:68 #, c-format msgid "Can't open URL: %s, reason: %s" msgstr "" #: src/iptux/UiHelper.cpp:188 msgid "Information" msgstr "資訊" #: src/iptux/UiHelper.cpp:218 msgid "Warning" msgstr "警告" #: src/iptux/UiModels.cpp:604 #, fuzzy, c-format msgid "Version: %s" msgstr "版本: %s\n" #: src/iptux/UiModels.cpp:608 #, fuzzy, c-format msgid "Nickname: %s@%s" msgstr "暱稱: %s@%s\n" #: src/iptux/UiModels.cpp:611 #, fuzzy, c-format msgid "Nickname: %s" msgstr "暱稱: %s\n" #: src/iptux/UiModels.cpp:615 #, fuzzy, c-format msgid "User: %s" msgstr "用戶: %s\n" #: src/iptux/UiModels.cpp:618 #, fuzzy, c-format msgid "Host: %s" msgstr "主機: %s\n" #: src/iptux/UiModels.cpp:623 #, fuzzy, c-format msgid "Address: %s(%s)" msgstr "位址: %s(%s)\n" #: src/iptux/UiModels.cpp:625 #, fuzzy, c-format msgid "Address: %s" msgstr "位址: %s\n" #: src/iptux/UiModels.cpp:630 #, fuzzy msgid "Compatibility: Microsoft" msgstr "相容性: Microsoft\n" #: src/iptux/UiModels.cpp:632 #, fuzzy msgid "Compatibility: GNU/Linux" msgstr "相容性: GNU/Linux\n" #: src/iptux/UiModels.cpp:636 #, fuzzy, c-format msgid "System coding: %s" msgstr "系統編碼: %s\n" #: src/iptux/UiModels.cpp:641 #, fuzzy msgid "Signature:" msgstr "個性簽名:\n" #: src/iptux/UiModels.cpp:744 msgid "" msgstr "<錯誤>" #: src/iptux/UiModels.cpp:799 msgid "[IMG]" msgstr "" #: src/iptux/dialog.cpp:39 msgid "" "File transfer has not been completed.\n" "Are you sure to cancel and quit?" msgstr "" "檔案傳輸尚未完成。\n" "你確定要取消任務並退出嗎?" #: src/iptux/dialog.cpp:42 msgid "Confirm Exit" msgstr "確認退出" #: src/iptux/dialog.cpp:62 src/iptux/resources/gtk/MainWindow.ui:12 #: src/iptux/resources/gtk/menus.ui:98 src/iptux/resources/gtk/menus.ui:243 msgid "Request Shared Resources" msgstr "請求共享資源" #: src/iptux/dialog.cpp:62 msgid "Agree" msgstr "允許" #: src/iptux/dialog.cpp:78 #, c-format msgid "" "Your pal (%s)[%s]\n" "is requesting to get your shared resources,\n" "Do you agree?" msgstr "" "您的好友(%s)[%s]\n" "請求獲取您的共享資源,\n" "是否允許?" #: src/iptux/dialog.cpp:106 msgid "Access Password" msgstr "存取密碼" #: src/iptux/dialog.cpp:113 msgid "Please input the password for the shared files behind" msgstr "請輸入共享檔案的存取密碼" #: src/iptux/dialog.cpp:127 #, c-format msgid "(%s)[%s]Password:" msgstr "(%s)[%s]密碼: " #: src/iptux/dialog.cpp:146 src/iptux/dialog.cpp:207 msgid "" "\n" "Empty Password!" msgstr "" "\n" "密碼為空!" #: src/iptux/dialog.cpp:170 msgid "Enter a New Password" msgstr "輸入一個新的密碼" #: src/iptux/dialog.cpp:178 msgid "Password: " msgstr "密碼: " #: src/iptux/dialog.cpp:187 msgid "Repeat: " msgstr "重複: " #: src/iptux/dialog.cpp:202 msgid "" "\n" "Password Mismatched!" msgstr "" "\n" "密碼不一致!" #: src/iptux/dialog.cpp:229 #, fuzzy msgid "Please select a folder to save files." msgstr "請選擇一個聲音檔案" #: src/iptux/resources/gtk/AboutDialog.ui:11 msgid "" "Copyright © 2008–2009, Jally\n" "Copyright © 2013–2015,2017–2021, LI Daobing" msgstr "" #: src/iptux/resources/gtk/AboutDialog.ui:13 #, fuzzy msgid "A GTK based LAN messenger." msgstr "基於GTK+的區域網路通信工具" #: src/iptux/resources/gtk/AppIndicator.ui:6 #, fuzzy msgid "Open Iptux" msgstr "信使(iptux)" #: src/iptux/resources/gtk/AppIndicator.ui:12 #: src/iptux/resources/gtk/menus.ui:6 src/iptux/resources/gtk/menus.ui:306 msgid "_Preferences" msgstr "偏好設定(_P)" #: src/iptux/resources/gtk/AppIndicator.ui:16 #: src/iptux/resources/gtk/menus.ui:10 src/iptux/resources/gtk/menus.ui:310 msgid "_Quit" msgstr "退出(_Q)" #: src/iptux/resources/gtk/DetectPal.ui:7 #, fuzzy msgid "Detect pal" msgstr "搜尋好友" #: src/iptux/resources/gtk/DetectPal.ui:15 msgid "Detect" msgstr "搜尋" #: src/iptux/resources/gtk/DetectPal.ui:61 msgid "Please input an IP address (IPv4 only):" msgstr "請輸入IP位址(限IPv4格式):" #: src/iptux/resources/gtk/MainWindow.ui:8 src/iptux/resources/gtk/menus.ui:109 #: src/iptux/resources/gtk/menus.ui:254 msgid "Send Message" msgstr "傳送訊息" #: src/iptux/resources/gtk/MainWindow.ui:16 #, fuzzy msgid "Change Info" msgstr "更改資訊" #: src/iptux/resources/gtk/MainWindow.ui:20 msgid "Delete Pal" msgstr "刪除好友" #: src/iptux/resources/gtk/MainWindow.ui:26 src/iptux/resources/gtk/menus.ui:31 #: src/iptux/resources/gtk/menus.ui:176 msgid "Sort" msgstr "排序" #: src/iptux/resources/gtk/MainWindow.ui:29 src/iptux/resources/gtk/menus.ui:34 #: src/iptux/resources/gtk/menus.ui:179 msgid "By Nickname" msgstr "依暱稱" #: src/iptux/resources/gtk/MainWindow.ui:34 src/iptux/resources/gtk/menus.ui:39 #: src/iptux/resources/gtk/menus.ui:184 #, fuzzy msgid "By Username" msgstr "依暱稱" #: src/iptux/resources/gtk/MainWindow.ui:39 src/iptux/resources/gtk/menus.ui:44 #: src/iptux/resources/gtk/menus.ui:189 msgid "By IP" msgstr "依 IP" #: src/iptux/resources/gtk/MainWindow.ui:44 src/iptux/resources/gtk/menus.ui:49 #: src/iptux/resources/gtk/menus.ui:194 #, fuzzy msgid "By Host" msgstr "主機" #: src/iptux/resources/gtk/MainWindow.ui:49 src/iptux/resources/gtk/menus.ui:54 #: src/iptux/resources/gtk/menus.ui:199 msgid "By Last Activity" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:56 src/iptux/resources/gtk/menus.ui:61 #: src/iptux/resources/gtk/menus.ui:206 msgid "Ascending" msgstr "升冪" #: src/iptux/resources/gtk/MainWindow.ui:61 src/iptux/resources/gtk/menus.ui:66 #: src/iptux/resources/gtk/menus.ui:211 msgid "Descending" msgstr "降冪" #: src/iptux/resources/gtk/MainWindow.ui:68 msgid "Info Style" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:71 #, fuzzy msgid "IP" msgstr "IPv4" #: src/iptux/resources/gtk/MainWindow.ui:76 msgid "IP:PORT" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:86 #, fuzzy msgid "Username" msgstr "用戶" #: src/iptux/resources/gtk/MainWindow.ui:91 #, fuzzy msgid "Version" msgstr "版本: %s\n" #: src/iptux/resources/gtk/MainWindow.ui:96 msgid "Last Activity" msgstr "" #: src/iptux/resources/gtk/MainWindow.ui:101 #, fuzzy msgid "Last Message" msgstr "傳送訊息" #: src/iptux/resources/gtk/menus.ui:17 src/iptux/resources/gtk/menus.ui:162 msgid "_File" msgstr "檔案(_F)" #: src/iptux/resources/gtk/menus.ui:19 src/iptux/resources/gtk/menus.ui:164 msgid "_Detect" msgstr "搜尋(_D)" #: src/iptux/resources/gtk/menus.ui:23 src/iptux/resources/gtk/menus.ui:168 msgid "_Find" msgstr "尋找(_F)" #: src/iptux/resources/gtk/menus.ui:28 src/iptux/resources/gtk/menus.ui:173 msgid "_View" msgstr "" #: src/iptux/resources/gtk/menus.ui:73 src/iptux/resources/gtk/menus.ui:218 msgid "_Refresh" msgstr "" #: src/iptux/resources/gtk/menus.ui:80 src/iptux/resources/gtk/menus.ui:225 msgid "_Chat" msgstr "" #: src/iptux/resources/gtk/menus.ui:88 src/iptux/resources/gtk/menus.ui:233 msgid "Attach File" msgstr "新增檔案" #: src/iptux/resources/gtk/menus.ui:92 src/iptux/resources/gtk/menus.ui:237 msgid "Attach Folder" msgstr "新增目錄" #: src/iptux/resources/gtk/menus.ui:102 src/iptux/resources/gtk/menus.ui:247 #, fuzzy msgid "Clear Chat History" msgstr "聊天記錄" #: src/iptux/resources/gtk/menus.ui:115 src/iptux/resources/gtk/menus.ui:260 msgid "_Window" msgstr "" #: src/iptux/resources/gtk/menus.ui:118 src/iptux/resources/gtk/menus.ui:263 msgid "_Transmission" msgstr "傳輸管理器(_T)" #: src/iptux/resources/gtk/menus.ui:122 src/iptux/resources/gtk/menus.ui:267 msgid "_Shared Management" msgstr "共享管理器(_S)" #: src/iptux/resources/gtk/menus.ui:126 src/iptux/resources/gtk/menus.ui:271 msgid "_Chat Log" msgstr "" #: src/iptux/resources/gtk/menus.ui:130 src/iptux/resources/gtk/menus.ui:275 #, fuzzy msgid "_System Log" msgstr "系統編碼:" #: src/iptux/resources/gtk/menus.ui:136 src/iptux/resources/gtk/menus.ui:281 msgid "Close Window" msgstr "" #: src/iptux/resources/gtk/menus.ui:142 src/iptux/resources/gtk/menus.ui:287 msgid "_Help" msgstr "幫助(_H)" #: src/iptux/resources/gtk/menus.ui:145 src/iptux/resources/gtk/menus.ui:290 msgid "_About" msgstr "" #: src/iptux/resources/gtk/menus.ui:149 src/iptux/resources/gtk/menus.ui:294 msgid "Report Bug" msgstr "" #: src/iptux/resources/gtk/menus.ui:153 src/iptux/resources/gtk/menus.ui:298 msgid "What's New" msgstr "" #: src/iptux/resources/gtk/menus.ui:318 msgid "Open This File" msgstr "打開此文件" #: src/iptux/resources/gtk/menus.ui:322 msgid "Open Containing Folder" msgstr "打開所在的文件夾" #: src/iptux/resources/gtk/menus.ui:326 msgid "Terminate Task" msgstr "終止任務" #: src/iptux/resources/gtk/menus.ui:330 msgid "Terminate All" msgstr "終止所有" #: src/iptux/resources/gtk/menus.ui:334 msgid "Clear Tasklist" msgstr "清理任務" #: src/iptux/resources/gtk/menus.ui:346 #, fuzzy msgid "Refuse All" msgstr "拒絕" #: src/main/iptux.cpp:149 msgid "- A software for sharing in LAN" msgstr "" #: src/main/iptux.cpp:152 #, fuzzy, c-format msgid "option parsing failed: %s\n" msgstr "打開目錄\"%s\"失敗,%s" #~ msgid "Can't find any available web browser!\n" #~ msgstr "未發現可用的瀏覽器!\n" #, fuzzy #~ msgid "Close Chat" #~ msgstr "關閉" #~ msgid "Pals Online: %" #~ msgstr "線上好友: %" #~ msgid "Sound" #~ msgstr "聲音" #~ msgid "Activate the sound support" #~ msgstr "啟動聲音支援" #~ msgid "Volume Control: " #~ msgstr "音量控制:" #~ msgid "Sound Event" #~ msgstr "聲音事件" #~ msgid "Test" #~ msgstr "測試" #~ msgid "Stop" #~ msgstr "停止" #~ msgid "Transfer finished" #~ msgstr "傳輸完成" #~ msgid "Message received" #~ msgstr "收到訊息" #~ msgid "Play" #~ msgstr "播放" #~ msgid "Event" #~ msgstr "事件" #~ msgid "Please select a sound file" #~ msgstr "請選擇一個聲音檔案" #, fuzzy #~ msgid "Failed to play the prompt tone, [%s] %s, %s" #~ msgstr "播放提示音失敗,%s\n" #~ msgid "_Hide" #~ msgstr "隱藏(_H)" #~ msgid "_Show" #~ msgstr "顯示(_S)" #~ msgid "To be read: %u messages" #~ msgstr "未讀訊息: %u條" #~ msgid "_Tools" #~ msgstr "工具(_T)" #~ msgid "Error" #~ msgstr "錯誤" #, fuzzy #~ msgid "iptux-icon" #~ msgstr "信使(iptux)" #~ msgid "Please input an IP address (IPv4 only)!" #~ msgstr "請輸入IP位址(限IPv4格式)!" #~ msgid "..." #~ msgstr "..." #~ msgid "Clear Buffer" #~ msgstr "清空暫存" #~ msgid "Contributors" #~ msgstr "貢獻者" #, fuzzy #~ msgid "" #~ "Fatal Error!!\n" #~ "Failed to bind the TCP/UDP port(%d)!\n" #~ "%s" #~ msgstr "" #~ "致命錯誤!!\n" #~ "連接TCP/UDP端口(2425)失敗!\n" #~ "%s" #~ msgid "Help" #~ msgstr "幫助" #~ msgid "LiWeijian " #~ msgstr "牛牛 " #~ msgid "More About Iptux" #~ msgstr "更多..." #, fuzzy #~ msgid "" #~ "Project Home: \n" #~ "https://github.com/iptux-src/iptux\n" #~ "\n" #~ "User and Developer Group: \n" #~ "https://groups.google.com/group/iptux/\n" #~ "\n" #~ "Note that you can get help form the project wiki page.\n" #~ "\n" #~ "If you find no solutions in any of the existed documents, feel free to " #~ "drop a email at iptux@googlegroups.com, lots of users and developers " #~ "would be glade to help about your problems." #~ msgstr "" #~ "程式發展首頁: \n" #~ "http://code.google.com/p/iptux/\n" #~ "\n" #~ "郵件討論群組: \n" #~ "https://groups.google.com/group/iptux/\n" #~ "\n" #~ "遇到問題時,麻煩留意一下項目Wiki頁面,會得到不少幫助的資訊。\n" #~ "\n" #~ "如果仍然找不到解決的辦法,歡迎發信到郵件群組iptux@googlegroups.com,我們會" #~ "樂意幫助你解決問題。" #~ msgid "The process is about to quit!" #~ msgstr "程序即將退出!" #~ msgid "_FAQ" #~ msgstr "FAQ(_F)" #~ msgid "_More" #~ msgstr "更多(_M)" #~ msgid "_Sort" #~ msgstr "排序(_S)" #~ msgid "_Update" #~ msgstr "更新(_U)" #~ msgid "" #~ "alick \n" #~ "ManPT " #~ msgstr "" #~ "alick \n" #~ "ManPT \n" #~ "村仔 " #, fuzzy #~ msgid "http://code.google.com/p/iptux/wiki/FAQ?wl=en" #~ msgstr "http://code.google.com/p/iptux/wiki/FAQ" #~ msgid "" #~ "\n" #~ "Can't send an empty message!!" #~ msgstr "" #~ "\n" #~ "傳送內容不能為空!!" #~ msgid "Free:%s Total:%s" #~ msgstr "空閒:%s 總計:%s" #~ msgid "Opendir() directory \"%s\" failed, %s\n" #~ msgstr "打開目錄\"%s\"失敗,%s\n" #~ msgid "Pal's Shared Resources" #~ msgstr "好友共享的資源" #~ msgid "Recv" #~ msgstr "接收" #~ msgid "Rmdir() directory \"%s\" failed, %s\n" #~ msgstr "刪除目錄\"%s\"失敗,%s\n" #~ msgid "Stat() file \"%s\" failed, %s\n" #~ msgstr "查看檔案\"%s\"狀態失敗,%s\n" #~ msgid "The user is not privileged!\n" #~ msgstr "用戶沒有權限!\n" #~ msgid "Unlink() file \"%s\" failed, %s\n" #~ msgstr "刪除檔案\"%s\"失敗,%s\n" #~ msgid "utf-16" #~ msgstr "big5,gb18030" #~ msgid "utf-8" #~ msgstr "big5" iptux-0.9.4/protocol000066400000000000000000000064651475473122500145060ustar00rootroot00000000000000一、iptux发送数据编码列表(不全,但很容易推导出其他的): 1、广播 首选编码 2、拨号 首选编码 3、通知在线 好友编码 4、变更信息 好友编码 5、未知拨号 首选编码 6、发送消息 好友编码 7、回应消息 好友编码 …… 好友编码 二、iptux接收数据编码处理(确认,意指已有一方成功建立了好友数据结构) 1、对于iptux尚未确认的好友,发送或接收的编码将一概按照首选编码处理! 2、对于iptux已经确认的好友,将要发送的数据必须一概转换成好友编码后才能发送出去;对于接收到的好友数据,如果好友兼容iptux自身协议,数据直接被使用,否则数据必须被转换为本地编码,方可使用! 三、iptux提高功能协议: 1、iptux期望所接收到的任何好友的第一个数据包或信息更改数据包(IPMSG_BR_ABSENCE)为如下格式: (IPMsg协议标准实现)\0(组名)\0(好友头像名)\0(好友编码) 注:好友头像名为文件名,而不是全路径 如果满足如上条件,则认为兼容iptux,iptux将严格使用好友提供的相关数据;否则不兼容,iptux将使用一些软件默认数据来填充好友的数据结构。 2、自定义命令字实现相关功能如下: /* 命令字 */ #define IPTUX_ASKSHARED 0x000000FFUL 请求获取共享文件 #define IPTUX_SENDICON 0x000000FEUL 发送自定义头像数据 #define IPTUX_SENDSUBLAYER 0x000000FDUL 发送底层数据,必须与选项配合使用 #define IPTUX_SENDSIGN 0x000000FCUL 发送个人签名 #define IPTUX_SENDMSG 0x000000FBUL 发送消息,必须与选项配合使用 /* 命令字选项 */ /* option for IPTUX_SENDSUBLAYER */ #define IPTUX_PHOTOPICOPT 0x00000100UL 个人形象图片选项 #define IPTUX_MSGPICOPT 0x00000200UL 消息图片选项 /* option for IPMSG_SENDMSG */ #define IPTUX_SHAREDOPT 0x80000000UL 共享文件选项 /* option for IPMSG_SENDMSG & IPTUX_ASKSHARED */ #define IPTUX_PASSWDOPT 0x40000000UL 密码选项 /* option for IPTUX_SENDMSG */ #define IPTUX_REGULAROPT 0x00000100UL #define IPTUX_SEGMENTOPT 0x00000200UL #define IPTUX_GROUPOPT 0x00000300UL #define IPTUX_BROADCASTOPT 0x00000400UL 1)当iptux接收到IPTUX_ASKSHARED命令字的数据包时,就应该直接将软件设置的共享文件提供给请求者或是先向使用者(用户)询问; 2)当iptux接收到IPTUX_SENDICON命令字的数据包时,应该提取数据包的图像数据,然后将好友头像转换为此图像;此命令格式如下: (IPMsg协议标准实现)\0(图像数据) 注:图像数据应为存盘文件中的数据,而不是内存数据;另,图像数据不能超过8096字节 iptux期望在接收到此命令数据包之前,此好友必须已经被确认,否则数据将被丢弃;此命令应该紧跟在(IPMSG_BR_ENTRY,IPMSG_ANSENTRY,IPMSG_BR_ABSENCE)命令数据包之后,但是不紧跟在其后也无关要紧,iptux知道怎么正确处理它; 3)IPTUX_SENDSUBLAYER命令字必须配合选项命令字,使用TCP协议发送,命令格式如下: (IPMsg协议标准实现)\0(数据) 4)当iptux接收到IPTUX_SENDSIGN命令字的数据包时,将提取个人签名; 5)当iptux接收到IPTUX_SENDMSG命令字的数据包时,将按照消息选项分派消息最终去向;此命令字主要用于扩展IPMsg的发送消息命令。 iptux-0.9.4/scripts/000077500000000000000000000000001475473122500143765ustar00rootroot00000000000000iptux-0.9.4/scripts/Makefile000066400000000000000000000015111475473122500160340ustar00rootroot00000000000000all: cppcheck: cppcheck -D__cplusplus -I src `pkg-config --cflags-only-I gtk+-3.0 gstreamer-1.0 jsoncpp` --enable=all --error-exitcode=1 --inconclusive ./src/iptux/ ./src/main/ fast-cppcheck: cppcheck -q -I src --enable=all --error-exitcode=1 --inconclusive ./src/iptux/ ./src/main/ docker: docker build -f iptux-travis-gcc.Dockerfile -t lidaobing/iptux-travis-gcc:0.0.5 . travis-linux: echo $$TARGET echo $$CODECOV_TOKEN docker run -t -v `pwd`:/ws lidaobing/iptux-travis-gcc:0.0.5 \ env TARGET=$$TARGET CC=$$CC CXX=$$CXX CODECOV_TOKEN=$$CODECOV_TOKEN /ws/scripts/build_in_docker_ubuntu1804.sh travis-linux-codecov: echo $$TARGET echo $$CODECOV_TOKEN docker run -t -v `pwd`:/ws lidaobing/iptux-travis-gcc:0.0.5 \ env TARGET=$$TARGET CC=$$CC CXX=$$CXX CODECOV_TOKEN=$$CODECOV_TOKEN /ws/scripts/build_in_docker_ubuntu1804.sh iptux-0.9.4/scripts/build_in_docker_ubuntu1604.sh000077500000000000000000000013741475473122500217730ustar00rootroot00000000000000#!/bin/bash set -ex env export CODECOV_TOKEN=cec2d3eb-e3d2-414c-ae88-137cc880e0e1 env cd $(dirname $0)/.. mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Coverage .. && make VERBOSE=1 xvfb-run make iptux_coverage VERBOSE=1 xvfb-run ctest --verbose make install lcov --directory . --capture --output-file coverage.info # capture coverage info lcov --remove coverage.info '/usr/*' --output-file coverage.info # filter out system lcov --remove coverage.info '*Test*' --output-file coverage.info # filter out system lcov --remove coverage.info '*gtest*' --output-file coverage.info # filter out system lcov --list coverage.info #debug info # Uploading report to CodeCov bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverage reports" iptux-0.9.4/scripts/build_in_docker_ubuntu1804.sh000077500000000000000000000015671475473122500220010ustar00rootroot00000000000000#!/bin/bash set -ex env export CODECOV_TOKEN=cec2d3eb-e3d2-414c-ae88-137cc880e0e1 env cd $(dirname $0)/.. if [ "$TARGET" = "travis-linux-codecov" ]; then meson -D b_coverage=true builddir else meson builddir fi ninja -v -C builddir xvfb-run ninja -v -C builddir test ninja -v -C builddir install if [ "$TARGET" = "travis-linux-codecov" ]; then lcov --directory . --capture --output-file coverage.info; # capture coverage info lcov --remove coverage.info '/usr/*' --output-file coverage.info; # filter out system lcov --remove coverage.info '*Test*' --output-file coverage.info; # filter out system lcov --remove coverage.info '*gtest*' --output-file coverage.info; # filter out system lcov --list coverage.info; #debug info # Uploading report to CodeCov bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverage reports" fi iptux-0.9.4/scripts/flatpak/000077500000000000000000000000001475473122500160205ustar00rootroot00000000000000iptux-0.9.4/scripts/flatpak/io.github.iptux_src.iptux.yml000066400000000000000000000031301475473122500236170ustar00rootroot00000000000000# snapcraft.yaml name: iptux version: 0.9.3 app-id: io.github.iptux_src.iptux runtime: org.gnome.Platform runtime-version: '46' sdk: org.gnome.Sdk command: iptux finish-args: - --share=network - --share=ipc - --socket=fallback-x11 - --socket=wayland - --filesystem=home modules: - name: libsigc++ buildsystem: meson sources: - type: archive url: https://download.gnome.org/sources/libsigc++/2.10/libsigc++-2.10.8.tar.xz sha256: 235a40bec7346c7b82b6a8caae0456353dc06e71f14bc414bcc858af1838719a - name: gflags buildsystem: cmake-ninja config-opts: - -DCMAKE_BUILD_TYPE=Release - -DBUILD_SHARED_LIBS=ON sources: - type: archive url: https://github.com/gflags/gflags/archive/v2.2.2.tar.gz sha256: 34af2f15cf7367513b352bdcd2493ab14ce43692d2dcd9dfc499492966c64dcf - name: glog buildsystem: cmake-ninja config-opts: - -DCMAKE_BUILD_TYPE=Release - -DBUILD_SHARED_LIBS=ON sources: - type: archive url: https://github.com/google/glog/archive/v0.6.0.tar.gz sha256: 8a83bf982f37bb70825df71a9709fa90ea9f4447fb3c099e1d720a439d88bad6 - name: jsoncpp buildsystem: meson sources: - type: archive url: https://github.com/open-source-parsers/jsoncpp/archive/1.9.5.tar.gz sha256: f409856e5920c18d0c2fb85276e24ee607d2a09b5e7d5f0a371368903c275da2 - name: iptux buildsystem: meson sources: - type: git url: https://github.com/iptux-src/iptux.git commit: 7a32e3bd19b7c2a6dd8caa6ca42588c65a7c1deb config-opts: - --buildtype=release iptux-0.9.4/scripts/iptux-travis-gcc.Dockerfile000066400000000000000000000012141475473122500215760ustar00rootroot00000000000000# Version: 0.0.5 FROM ubuntu:18.04 LABEL maintainer="LI Daobing " RUN echo 'deb http://mirrors.163.com/ubuntu bionic main restricted universe multiverse' > /etc/apt/sources.list RUN echo 'deb http://mirrors.163.com/ubuntu bionic-security main restricted universe multiverse' >> /etc/apt/sources.list RUN echo 'deb http://mirrors.163.com/ubuntu bionic-updates main restricted universe multiverse' >> /etc/apt/sources.list ENV REFRESHED_AT 2019-05-30 RUN apt-get update RUN apt-get install -y libgoogle-glog-dev libgtk-3-dev libglib2.0-dev libgstreamer1.0-dev libjsoncpp-dev g++ make meson lcov git xvfb RUN apt-get install -y clang iptux-0.9.4/scripts/meson.build000066400000000000000000000000731475473122500165400ustar00rootroot00000000000000run_target('update-po', command: files('update-po.sh') ) iptux-0.9.4/scripts/update-po.sh000077500000000000000000000004621475473122500166350ustar00rootroot00000000000000#!/bin/bash set -e cd "${MESON_SOURCE_ROOT}" || exit 1 git ls-files '*.cpp' '*.ui' '*.metainfo.xml' \ | grep -v Test \ | LC_ALL=C sort \ > po/POTFILES ninja -C "${MESON_BUILD_ROOT}" iptux-pot ninja -C "${MESON_BUILD_ROOT}" iptux-update-po for f in po/*.po; do echo -n "$f: " msgfmt -v "$f" done iptux-0.9.4/share/000077500000000000000000000000001475473122500140115ustar00rootroot00000000000000iptux-0.9.4/share/icons/000077500000000000000000000000001475473122500151245ustar00rootroot00000000000000iptux-0.9.4/share/icons/hicolor/000077500000000000000000000000001475473122500165635ustar00rootroot00000000000000iptux-0.9.4/share/icons/hicolor/128x128/000077500000000000000000000000001475473122500175205ustar00rootroot00000000000000iptux-0.9.4/share/icons/hicolor/128x128/apps/000077500000000000000000000000001475473122500204635ustar00rootroot00000000000000iptux-0.9.4/share/icons/hicolor/128x128/apps/io.github.iptux_src.iptux.png000066400000000000000000000574741475473122500262710ustar00rootroot00000000000000PNG  IHDR>agAMA a cHRMz&u0`:pQ<bKGD pHYs.#.#x?vtIME$ tG^+IDATxݽwd]=]{'y$$@3ػl b#5k9bX??&a% [wăׯ'?yo.] X^^] 0<>†fڋi^~oܸfƲiKvghFMLjpP"!E$1>zzhykW\ i.|$Qtyh4A}w?`x?>s{ay~昮MJyQSkwќFa0M M7IP@ Ha#}x`ɱxyIk^8]^Y>i[/8<9$R~;`[y/؜&4D #HkWpm~Kzݶm14M5M ຮM5 10e\| "P RH8FLj$I.AC6Xz{/}+K??vѱ;;}'w?k} EۿG~ݹ~~~ v4w2^ \vʚz2tra-,FIM$˕|.SHRMcjGLB(a*w4Bݝpΰwt9(M 8 í[}0U磪;?A[?~dOѰeRou5vzzwna~ltjVFIj:i]`,_*}IY..!tz”*~J!I0{1|וEa (?9:txmyϊÝ(PW+B*3yzѝ;տJߥ˝+ta-fg1"uZkt%su7us(^"@Ā V RR*H 0N! (! fgً2 N~3F!$UJI 0FQ<ϧv5B!(mZ _+DVPb\y\$qcC?< ۭΜQoYi]\^.m̵iͶ@) Q, 8Bq#I!! Luy !!RJPBt Ρi8% `B5h]aY AT2%|" dseY\^!I?>^?mO;5pک/:vUt:% R(Q 8I10FE~Ïaqa& |!@dCJ{Q3(@)h ]CqLVFͱѬ[6jXlѩ:O1F)@!%aj8݅Fա(-G -ְ'WRM{˯/y_ M:{??H_\˪1 i/>`-֜hr!0zj;Vc>xA._ur:݋Nw;5QHH$8!Fnc8F"TI r!Z&ƯC3!FE@# k qpRX{\b 5 a@Xz K\C5َY2o4j[rx_{ƭޝ=YOAt2eez|{lmj Ǟ:+0ڋ׭u^k.UoLәa8 #~7Q!b)%A Ll+&e+T*!$ \B D 0 V:X^ha@ӱ`h l( J3 Ԍ%Lr}T Byږ#qjsu`uuO=0y+Rd.;ݥGKkכ/۝yө[kTA=?`//@Ɛq)SSE("TW{Zɩ0}*`RH+DfRCk bH tp%%!HG1>;1.\ǵK x"..Ъ0 T@*]U [N# to WvyH)ſr=/ xϼ/2<: +NwatZ /c/ 0Bq*V˕TH/W7%LT`6 .~p$S Dא (RHǁ 1(8B\]|KUR7 ñ$x$}0p7>̋7/zgA@/,P%%ݥOl=D OvWWX^[o,XVepM7@(8F>#  D"eXr*Uʆ*BWSr62qOHP ^ʄ)EQt3́g#XHBNH` f4FZN蟎0 "lqxNeRJ"eJVF/_4 6)xEw6L[޾y3vwO>gsrb@zwy_҅'͹jK:vn)lT׏ñ# tqJqxBrX4Pݤ򿪪2Pr~+RT11gXq [Gc͈%Q p8vCa2brDHa7J0C$qXD`D2D*U!a"h}4AӻG/CNxqC|B!eal1"ƝΫ5dշ7kf 8D ~hDa%4J ;_s1P @,֟Qq|mXh:Xj0_wvL @ A`G8{88c7AC/0H,NJ) gj=/Aԃ'HB +rR+v,^XR u}ӽ]Wd7y~s% R{7~~QH1/''+kW݅li(BD]/z)$҉J9d:S"Ho%}Lq՛%WdK R 5,koj8h,4,A,v3 ^6xp;Q"`)RPR!cy!0u ml2"KAu4aLñ?8[͏ѕ/7aG{spu;D•m\x4-JxAaz81y"Ipkd%9~;%.3,M<[K%\_jmn KK_nL,jXk`Bñ!%8 "xq-#G!D Sc714ZA艔4U0t`<8Ltxo⃏綀gVHԆX.͹uvXhmqlwzDS7#c7@BJR&iL86H_A&d S*03(T34l<%KB1(B*,X"PPI(A!ǔ z ch \@qJ &LS5]&>K~州t??c7mWo ];~\>X#o^xtۆSQic qa篙Cͳ880H$ܰZ_2ֻMl:c;ȒbCдMFp FhB."1A0&;3H B"$*BM&Fuw[U{ޙ9I?g4s͛1w-_V֯[s n% >|?D S]U"og狏6@8cC#8-Kǵ&qi{z]F2D`xcPj(QDRwbK?MЪ;TfKB ;]c uzM[o<[|||ۿ躎x>'<7}$%B\ bxߏsW6._ڝf)E1 <^%HiYL;Vܔ8k0BHHL`x xhm A?X{IaiMq2c (0 4J+ wcs5SCQaaiI$°5D{iKޭ?_׮(DZ^C=)%pXQ}7'nos^{+_X}\n/yKJC,Dj{<7@GHT$V{ **n**i2dh;B]Kv ,qDԋ7. Aа֮aSePyTR NS* &,S\9()l?4m.:r[8 ^9??4M#O#fW?wnv.=YkƯ}駟$9# C!ȷ}ι)au?=/:v*3MP!$Q "^0H|2HV?x{Y=ǔ*y_*w3 e 7tTeHIUHgS܄^o>z89!N(Kf*ail4P.t`pzG+dܜ|* |J)QJapz(?~oNSIeh/^t>ծ=J;Ya, E(g-N91ㄭCO|~o>s>2EŃԟ'߬q V1q̯e;] 3MQ"A!$l;E,'_)ŠxTOOvh}NkH'I"0_](nAd_PYT`0F>:ut0lA.p] [҆Նmpqm|149|?gF#|WJ)qsr|0Xe5\]a 0|)+J&~ )2qH>#S<ܺUIU (s$z^AbZza!IáWu<'[|U9 'YٙT'NXX`:Q1HA2|qéAovk-XHzO2#p ̶y'zswH.E\ZQor @._D̝TeT:5>z~J`d~#a"*h)EI{WpLˌA64T8Uy 'Ʈ!Մ-@5]n;0mb:dr-/_3O\sNoڏŤ5l\+Dmt4o/$+82 ݜ@ ;S).~V[$p4usMy"ŭ:ӛy盂CQM?g̒3:R@b&(F l2kVKT'L2B QqbtWvO#|v/b fv~LR^F ( fFՀniHIݟTq;iHxi,' x[̓$ 1uwo?}6'a;uU՜_fD*!dZ%'8bgX2SK$̘lIsT )E($n| a,7M8KdL?0 pdO=s{=l w%Q0ʢ2sy8VE!Ds}c~eAĔshn95K (M;<<258Ϸ UK`{&@Eqt|avwX:cHDq:BȉˢBU" P;PDiQ:V JAc甂u}6kL,5Cs蜦9 *u!X`F{ӡ^8`?F !@SY,byHA6?1yBb)c7]U`u0 4me]Aݻw󻽳 suЬ^Y΂z0W/l4A5 Bs$j%D,7Vi:ts5uy OD hN5B R3 KMku J!A=7ha& )S^,A2&N٤rTH9 q<5j&c L ͲtC Na2_ʯw[x'>lƃHȪ@j+C3B !2E1Q̗k_]D??Aj5[5է1އ晭bzP5; :RZ !J3o0 򞝫@6 z"/Rj>c4M$ Y$)j")I@H*zS/]K]$3ye(cBMq 2HK>r"x4'm/u`qvɈ3 AV ~, )C,J!X)*V.b SUƹTXoKUwz/†(ӣzN 9ڬ1 [cs 88LaC/lj`ňLS" \yh)*<1SUWe)"(Wܹ9E%q $) _Hs8f`͖ƸL~pp oݼ0Na“_fut-7@(M;d栈H"ȴs}&ɸ9 T9a&xKd1' `Mcnbb再mʐ>?J윺hbd."J2(, Qj6E-֟C Ř}1WQK Pa$|ITUP ʤIa8akL~-?SxJQohkZ ʹ"Ú*"Y3y:D(ը8_"&Xt\lڸڭbV s5 MK$0jZ}ƈNP w* !&bxHF\PIx6 PPO%ͽF850$0uh:so-5~y=kk[/YfZu( D,?S vJr LDch7r-t`k:ϊ;19qMKM _*음0t2] Ihn xV(] TT&Tt`A*,c)0C*)`bbY xi C с\Nmh4a6`^\X)U7`KR~?-ļgIs`rKCSU.B(X^Eаڰq}ڸme=Nh:(` C v0yRhK pƆ!NAٱHIy( d$-Jb,PVf ÿ(OUUèۚ&xŊ*g]d2]PxƬ <P X)1\nZ&Zha]eX|4Bж \6pgࢶ+/t̽ʩ4Ni멉ʓcT{aR(A 4˘*9K5L"K 65ZG<]NZ ݩҴ͉RyO]a|$PuARFiM+^9;U8SjoRLD93џB Uh0tͬ6F4"[J[LMpe<[U)拓e,:lt$Ӝb$")1\ީ\M΋]SnH I6Ӯ3-'\Cc&iP^_f{P&, "(_yXڞ^A9/^3PRU*3;ARp6tS-Jbj ]c0-ήzqM[ƥQsFD::#UIٓ Cåk6:ں  6NFxdQ*Br )( yU-S,B*Ηy%=itM8O=5of J$g$uЃpΙ!WyO\o2^ɏ. 6o*J* Q|:Ţq|Dž.Lz%ΒSvmD썰q<0JNVM<9_}@R +^ kd?dF4FFN3uP*@e&rS{2I& ۫&i7(4.*!Nٱ;,M*`P/rI=IS%ZJoWFBpnN W;5,-N=?H"QWFcL%`11hʥkY d)]NLöufPBdkgAdɉi2 !QȒ6=<z~%L7R2*_s2_%Er&ruc.Rn&mrp}+B B!s=uq?ݡ8o{©+k:|^sѦoaxmc%i3*bx@*%J@)h՝!,m]Ͳ@ť<)WY+F]aAS Tu$(5TN @!$ttj ?J{foCa&f{g Ӓd:obU%=,4n¬Y P&ĮH*JEqZ p_ⲡ`nqv+g&'~aVSIf~d|}"D kM&is`5R/NDpďI h| Q<3ZWYsbwR-41EA 3,qsi)[ĐBMGt27IKe*bSSu޾Έj)[RB24\k9xSrD]^W3DH /y!I$p"rN1 'UtS.x*w9 ǂQY:D*5R66$#Da$ u]hJxB-)kՉ+-J+_B'd:UA5_%U_*%mafZzAσgId'cl <1޿&$V^U3  46a65T0dq|i@<;F8'N <}Ndvsu(*^Α&'$|kE-W5,ԭ"~nRGxxG"Bwth6z. |Ƞun6A3tvW%]I ՘AB:'h#40,QajաlbI5c2A莐 `Ӑ{; yKg*Nb E&gp{HTڃ$@P3GVYH_9?;$NHG9QK]?@MIOJD@Q Hc9v iS JBI=sa &Y3}$K%IpŢeP $]C>Js 4,RMY~6'Ͼ{TUUHNXv7Z5:e6iB!o$݊ϝnַ+X(NeH#8NqÉp*pxr痟S},dcse[Ǖ u]KKkϡɮ8֩m7 J!Z 2ClnvI 3M6K-nזZIp)D-[':壞S (1 ) <ڴZ3P70UB bL] g>B~7"VEjH# %ig"9͊si(@c[_z ѫ/ˁtGǔ sƭfv\IZyG{L}iLT>JUŜjզ9KiUtB13 cl}l }1D&**s5ɱ<{zp3If< ٘)Ȼ}qHh!GebTZB\T5QHトz0q<J4=83J-JB]hGQK)&>gTyDȚQr @ %X. \jXvL8v̾?ô%wC9%%`HrliN@=h%e`IIfE4CKX&DB$F^---B@nD'ݑߦb6p5~7wq-#?Z4?=EmT]IswmF1]Z(J>}oF`jXw ,;fjħiƽ(>Ϗ= pk`Ϗ!Jg>R\.YAjyYS{bRLJ-U)8Y/A$:NSD f^1X 89n"琼`;{o!!U'Qosx;!h(4)jx~TV4$(ża558/?It pcq]?iT bݳ$z^%G^P=*%yRA1(aok*jp!v"xv=-SA!5]pHLDKD#x*WޝBTRp<5h1'0QQ,Rpdj:V7 L|*<*\^*<^nU҃JR $^:`F>D:?»͍lL/u>5oA0 6>{cPYZ#3ȠLQ}N F),F3'2/v#HUDIBUܟnڷP{V,I@@ 'dRf_@Yaԕ٥URM"A e~F8S?~uҵ;?g;~K 5y(EhYlȅF7o>鷬a 5?g@ };n~)OojogSU޼LFIC"N_?;l 4Ѣs.UT"a;E|xWQ;wVM%~b/of+ (۞[%Dc'>=ajσ~}ƕt@eәo2\rVT T8 cll Ti*+{j̘!V*IjLʑ.))*oV$G#7:e ##w w-\v@g$lv?Sh4!oо7<֒"fڨW!"[hX+Gl%n"<02Y=3si Aco0!2mN*51*&9zbze| Oœ@P IfXAٸ JI}h'IetYۺeo٫jB^O}Sv7o+ (F'q$P")s`NYM]_«tNA-`k,sgMo|l s7^?{N>qߙntL?ǻ2H6htIsG:ITӋ`tBUDU^#0}a'G(@'8 cly&N)jfQ% "qWn |1}{u#DB$iE$͚MIb!ʘ2ϳAB??fF.l &Q`اZЃ~OEk%OSBRJ'/ZZZ:3#Bয়ydcy>0 Nz-\'&bG,JyW9$ ƫ#P*caL+Ab!'8a 5ŽXO5Ga('0&TfVjs#z>+Je7%"&1WV#C)d#oCf4>D9Y7]]}`0)o5+j(Nbta<95n;?c uVJ|`;$& /$^,z1L96hJH~ iOm\aΣ]uKP~㜣)\RH(B "1M_nfV{6|SU;VGj-TUgΠ׋_A};Qu:lnn9'W8຀F8v#[Kѥd$~*UuJX|0P~R# Ӑ ͐>_HF 8A5Mv(.RSjǖ9Gr*{մ?ɴ䗬5R'B1!H?8%(D{v|`Qsߞ_iεՕeK~|3UgoLUAZ9wX$r^$1JD|MMLJYZS.$AqVV$"Q*,d c6fg0Ή Q 98"&O. AR3 I7Sp}nE) ɠ  /,G?߂Wj5IZ<c@{r,EʵQ#T@!+OdB+,3Б;Ti˓LS-XBNXU䎠+ڇ gR`L5*^L@Hپ=&6!ҿs׈d(D|zd/⽽mtrj-|ҕ}wO>k &@6##sqe_inE |ԲM/nƳhUo$KO)a,Re:B:)QR$)ORC;@!Yf=۷ Wo~G}W? } ss>ZcE5rK_}K~u;FTs8*"?R 0B2e ;r{GZ`^FT:ݽP._Sϛ{SOlTw*~s H2c(J<@)9ԕ"$ '7[_J<2mܘf W}ˀ@@`gٳ;ܲuͶA(b*/7y|IR!p2MU* dѤι ҝf^ 0?왛  {!A˒UsR?&]`{#qomz;s? .AxJ~9r\;NEh5wp呧ׯ}Y.5.\Y6EFLk˽ T"1<) Np(GU@* N>{TBң CT|az  ҅L9^e.&{,_8DeAx#l֋:lnP{n/+/WeFk.Խ?KYl?ɏ݃h`{J3ke#m'G֊(#g/_ugLkQn A.A&D*3>1=GE$wDiBAd0OP=XTIDbrR, $BkɁFY7T&$$WӺ]j$W rS gyg O9^eO9 ysx㥺w+sg|??#?xPO` [φw|%£Fvֵ&皮*'VA>$dDS}"۸=T'LY 4K8;;zIUxz'Yrn$n"PJ߹CZ7Qzfs u:[KS N}9OB˭č=y>:?M {\0LpfN9OKU^tYR@n?$hd$-eD*`&^9zBubxB2!/"izIF()PՅGyh $'{R;YzM}jan/ݏL{xpR" F! >~ABsYԭv0HjL5 ?&&X4@2bHs {B&nxfFH^fʲRtRX +&zrTBfٓ ;7a&+iFu磦П6L=5_X 7(BFEBMCa;{n17j/PBjqh6im M`ʕ}U9q՝'ۗv)*;מ$bE+ )z;sw~dzi$̀N"tJ%=C{xf2dc^>~l\x?f[+ěo?h4bp]㷟~h _uoXqlij@l4t=՜R P>1۠J$$"U5T3@Q@j ([$ۊh5ԧ28Bd`>6]iȏ)PXo~$꫾+++vf <Ŕj>?DUYf]tHEpCPHćAN`nG࠷Hz{xuy%2?8΋F[[x{Cx׻ޥ;1C.VW/#"BH38 t$%l 3ݬPY^3A "VU%C~iLt2a)2~yN iQov.0X3^jν/ {Y#x{Lqя~4eDи+bY#߹q}k\ળX\fQTܐϊ Q璡g|^=l^v^ gY_UJ!PJO*!T!pz,nCw/?襵W/\|w=.)]}`X"S"ʹw*1!13z>$Nz=r.Bw"K2Ǩ>p,3=`|T)dֹ<*y~^.YGeiHø!1pNM;r_m[Ǽ37e;ӯѹ7_չvN'MkP B0v^V$ta D@ RrS(qMcrJdgJ9PgiIo>gZN挒ʻJB%qxc!'gm<ߵ[[Zi9.VWΉqv \mԿEH+o^Sȩf{^?J]Ѵ ƙe* Z/!q< (;>܎wWGkwVG,0AA&e\UO P`Z(H awah :Qs2tnvX[T< |yəA6`:ɻۻo:DGecn~.eSoi3ȡZ5y.giLHc-&\ŪKY\SA P2@Op6Ƹ,yڝs Kt7[_U_5l%5}yIS)k_Uwa8ܽsnnl]._yպhppNAwLtSwj^*0Hq;iDWA $I$>޾{x=V||teSVs^vl{ o | H^/\ի~XyL~UU_O&2PyO)H!DGQ'"CG=)]:;FW0E={_Sokhp:?ob ӣ=,,%z( 9!azSkhy54k²_n VӘ0jZE]DIŘ;+ KY TIǐa)鎈:=8ދqLSZJ]{f'S12fPS{e"I^}m߸5JV{}0̯Z4-kaLu^z$5uPR\$R)@GJ$I1 ydۻؼM{G35MyG泟uQop 2(wIH\ Tw2im70:E_s\q,> ͆4*[J v@4RJ(#q  HB))R$R*N(%Jy&niehlrwھ߶n2J0 ͝/:~Btom9#􎎬/ЇG?!s`5붜GזZmAik6|i !"DSIł$EL`P*9A#)I} [2Q<ڦNf6ÅO\e'X)5OjfÈEfK@)a.%/{7?Նe?Ģ3"v8 "BRD48jǮ!Du:h42GD62BޭŅ Nvvw0TRJ\`$C_!rBEAa=11.Qwr~O $qD,H|K2BrlZu#33 kڎa9~_X_Z^>h4ۏ=)Ur=?>}#\7bDx%tEXtdate:create2024-04-30T04:48:09+00:00࿧%tEXtdate:modify2024-04-30T04:48:09+00:00mIENDB`iptux-0.9.4/share/icons/hicolor/16x16/000077500000000000000000000000001475473122500173505ustar00rootroot00000000000000iptux-0.9.4/share/icons/hicolor/16x16/apps/000077500000000000000000000000001475473122500203135ustar00rootroot00000000000000iptux-0.9.4/share/icons/hicolor/16x16/apps/iptux-attention.png000066400000000000000000000025151475473122500242000ustar00rootroot00000000000000PNG  IHDR(-SgAMA a cHRMz&u0`:pQ<PLTE<<>: LyD8 Xot"Ragxfpt\!: +Pnx|Ƿʹ–**EY_XYQ)*QjpUK[giY SaGfp[_Rf]r]wZ\\/.VcO&'h|G @blVz%;EZK~S+R\lijO~GF|BdnG.S^4~;2+)-|$]j<MARt1"{"xnJ6/'Pp?@ABCDEF GHIJKLMN OPQRSTUVWXr%tEXtdate:create2024-04-21T03:45:14+00:00 %tEXtdate:modify2024-04-21T03:27:44+00:00#eIENDB`iptux-0.9.4/share/icons/hicolor/16x16/apps/iptux-i.png000066400000000000000000000022231475473122500224170ustar00rootroot00000000000000PNG  IHDRagAMA a cHRMz&u0`:pQ<bKGD pHYs.#.#x?vtIMEIDAT85Mlek+FnX`sD bS@bAvw}BjXҺC/{y 5_$#4jXr׮\஝G6 {7uKtQ&ln9;4ut.pkM}#=ۨkȘHl*+=C 0Zi5ݝ˹>1×?Ұ1Dx ?\=aKP8`P<M3rgr̹!d4Q^lXqEk(u@$Go,0;#p33G^H%~"5ho{fPb-a6߂81':1Z+PW]+k[+Hqh1ATbBR{&1ܧoEQN9><1>D-"ZMBJ[+%%Z+|k鬭⹖zed>@`-Zjۛ>ɉQjhSJm+T4go283O0 b59n_/LPJJ)I\ S`¹f-Ep8>ɽ/?TMstE  ׺pL[F \ %5w-zboo_ΪT>Vv eg)0]&̢(sj|tƯooE5+p?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~~8 %tEXtdate:create2018-01-26T21:04:26+08:00B'N%tEXtdate:modify2018-01-26T21:04:26+08:003zIENDB`iptux-0.9.4/share/icons/hicolor/22x22/000077500000000000000000000000001475473122500173425ustar00rootroot00000000000000iptux-0.9.4/share/icons/hicolor/22x22/apps/000077500000000000000000000000001475473122500203055ustar00rootroot00000000000000iptux-0.9.4/share/icons/hicolor/22x22/apps/iptux-attention.png000066400000000000000000000033021475473122500241650ustar00rootroot00000000000000PNG  IHDRĴl;gAMA a cHRMz&u0`:pQ<bKGDtIME5IDAT8umls9szzvJHiY^& 1 ]F 7-YL47If$ƍlBF:F6P =TNi{ޟsއ* ]/uoSQۡVuŶݏ ]ݫuKt:5~ڥW>w"K*>4U+:!ذqW1wui:CkMC̦Y7ńʜ8A=?d>~Һ|홢VL."rh$1" >Ŗ#?/b #|~==><1WdfxO*h;*U?_fB\~oy$iާ{~'z7dˢX,clJrxt4'p"u=-jZÇ={hg*,ҷt',K(M"fXW2czS}cSBytܯĺ|~oӶGVrU0/n.R 䓉4O,X='!O|M?y;X%5 ۢ3B 32Œ3 URivAi;g)mVɳ[Vx_BG?`l&*"$[P)V iG kz=_! H{m')P,΄RibEv,DkCfԆ&Zk5O$xațYC6t <3Gխ.R45#"5:qab ֚/&^ɪ8r_y^ُaD} e]Kĩeua`;\|iYNS㟰4kH9CED rtv7=3"uX``4콻\8JhDBGcm]IePcYQ'qƇ?ɱߘRZ) 4M`OwqT{ [TL¶>:8vBȘN9r,L~^ai-J~Tk[yU8d5m)QJ.LeʋSW[h9kMaq}NN.p.S9*+3)BP"B!r8ĪgY.ki"[ ˻+aq=& U0@aP6 Ҧ`A t+%R_/jK{՚t6%:RjJSPӚYmƤ`Rj_x}wg[* sl4zu.rRr_oh5iM%TM>TBM^AYO8|/n]ciNMߎO_{ ~.\uuƢPQ /֮Gm562bƍyqXeT.h]UY]S5d> hy(ѐ, \pcǺuө^UlfǢ*ѼkFMwmG4N&ds\q=TD¬mmbgjb%xd{OQݯP[z;lLENwد]S; P%~h'n Wg5crٳgy ^^s[|/a[t!b֭ػ~%on٥ |v"B!>u(&3Σ\ROkS19iSpb~PJc-uGNllѥmE9/<=jC?r5Έ*p\Q>~T) ܺ|:3h~SI4nS) CTASD*7a L( ELՔ͆lkհhkRhS?4݋| w 0gE~@q*0b˺ʚP PQC}eع"eb&? Y&T^Rj0MBA0R^^XT2\h4`Zh~4 R!%RIVZ-Kf&`2šQR~T34By}mRdhZHT8~{<ȻXDw5ZkԣbQR餟 CzXRJy&[X0/1sc6eT4)X۶{Q#Ӿ%@I5OWY_ ]p9|cWi(#qGB\xR#?qZ RC PR"[*<`6{$Lܑt?\ W,n1Ž؎ǿ'8Bk2>Ǟ×HJOy*qo]YԁiJxvCςxRKT܇Spo_͆2DlnݿD̪R6D99q~TǞJH ƒ&%tEXtdate:create2018-01-26T21:04:31+08:00K*^%tEXtdate:modify2018-01-26T21:04:31+08:00:w!IENDB`iptux-0.9.4/share/icons/hicolor/22x22/apps/iptux-icon.png000066400000000000000000000034731475473122500231210ustar00rootroot00000000000000PNG  IHDRĴl;gAMA a cHRMz&u0`:pQ<bKGD pHYs.#.#x?vtIME*IDAT8U[lT}9g\usphjfX8;KǦMCSnGo=uk}e-4yJ)Jm*di ;u ids}lgsm^*>Qmmxٲk\q|:S29lۦ&%ql[òN|x_9|GbD%|yF鬓w_(GoD*q M;_'o*vnbh2+ ڸdzӱ^깕.DeOôOsXZ&)G)4TrYZ^4([DVp1Hsc- Hx(:>I푝;X)4<`e}ӫTl<) R4[ׄeHl/n2o;iJt\&uBe)t7I $R45KZi7:u"6PXM^@'uGBߵ-}i- aǯ/ol%ธ$;#3L2i K,g}՘R4Eߌ3,ֆ0c 0 LIC.׮R\!a:6U$`x>9o[pcp#6d E RR'eS}@Չ7J.+ڛNLX2fyƒYW@ԙ"4N1t嶳ǎ̯s$2N(V^Y[J\!$`AL*$69sk?>t)Иotf 9rWTve\EqȻRB-qbSBwL_~s`yW|>ޕ9z3:zs[Y,_]p*q\TGp[9^}w8p柧i,+G[oPjCcUm5Of|ef212sգ>BnO8qhnG5?+"%tEXtdate:create2018-01-26T21:04:26+08:00B'N%tEXtdate:modify2018-01-26T21:04:26+08:003zIENDB`iptux-0.9.4/share/icons/hicolor/24x24/000077500000000000000000000000001475473122500173465ustar00rootroot00000000000000iptux-0.9.4/share/icons/hicolor/24x24/apps/000077500000000000000000000000001475473122500203115ustar00rootroot00000000000000iptux-0.9.4/share/icons/hicolor/24x24/apps/iptux-attention.png000066400000000000000000000036311475473122500241760ustar00rootroot00000000000000PNG  IHDRw=gAMA a cHRMz&u0`:pQ<bKGDtIME5IDATH}YlWxf͌-؎;I,5☔&P԰TQAB)y 8d|pmk;;޾=z><toGK27 @ TŦ]Y[' ߙ$  N' m/oQտ>u'ʲΑQZ ylf_g5{%W< >/?K07ز󠷾}st.bKE\zCGmiq-:q׎L Qo׭=Pꦮ,JJ&.O>#N3/p UOkŮ,;WXE!ޯr5 |nk7R*E^wYS%DHz4WLՈQ`5 i!xK)ZK5fxc7PҋydyXrDmȕO~K0 +bȅ<|2˱л\.`AQ)hFot61i[WgPz@ ld4=B&Ǵl5 EfbDڄ'e oe \i,`/kjC7Ӝ#\[̛4<(oQѽ*Ϲ.J{L mn:G,]@*5Bi* RI>ߣY⇼2 2 ZUzvxmfE#|Fcq3VHI(\4A/y.)BJHW_Ϯk!]98KSEe4 DH)+  QPR"B S= <ZZ"eKK58|&`Cs (4$d$NnTWJ GC]9fk:1GhmEKEG1-5 P a*J41|Bv]UWyHGWSWk~zpqj[ )ڣ%335B+xB z>% V۫StKDB@1\ZzbǚU$zSۮ)MArm-5͎D``.E\;kML\kG#uwΝ7^u!;7j۴ ? TDl!e _z1 {ʍ!c̛g>u~ǿ",%tEXtdate:create2024-04-21T03:45:14+00:00 %tEXtdate:modify2024-04-21T03:27:44+00:00#eIENDB`iptux-0.9.4/share/icons/hicolor/24x24/apps/iptux-i.png000066400000000000000000000037221475473122500224220ustar00rootroot00000000000000PNG  IHDRw=gAMA a cHRMz&u0`:pQ<bKGD pHYs.#.#x?vtIMEIDATHekl3^|s CI)J IZ*M+Mi+R$JiSP 4@n!Cnzm^؀A9Ҍ4s{ܵ1a6}[{x?Cˊ㑲E7=-0'}@&Z~æ6$i3fڊq[U _4͈N8}w%%E㮑c',}N:v>tW==C ֯YS[Z` eoHdoX83K"|19`n^ 7tTK~*^}p[pSDf2U|aB_Dޑ$/\cv y qou%keao{ (ϫq=`_*&|R a|v3I»L "MىHG{NF\WUkp$%Hq1׏_t^^ qnv3Ȼc:`m/ZfD~hiTN8zR]ڹ5zVu܇Gn\bw=2r1sj%tEXtdate:create2018-01-26T21:04:31+08:00K*^%tEXtdate:modify2018-01-26T21:04:31+08:00:w!IENDB`iptux-0.9.4/share/icons/hicolor/24x24/apps/iptux-icon.png000066400000000000000000000040421475473122500231160ustar00rootroot00000000000000PNG  IHDRw=gAMA a cHRMz&u0`:pQ<bKGD pHYs.#.#x?vtIMEIDATHmYpr$'眬 Hd+ Ȟ"Q.cvzeֶcvڪөiAKN[mD[D$$!Irr|b}yg{[ms?S7l߶h-[/Uke{dh(=:2rl_P8Jw;wCK$hllDwP?uqί|sk>kEN!dl9` U_ۗ.}鞞'_}q;ͱauxGƝl~7nh;nxR\b4.megz_N|TGUUUݻI'FZ' })Y\Rko`N=7\vtNL H!00'VSB̉T 3@"o8A޶tjӁSОJ 5ti&ckV֏%R !0h2.6JJNLa.\NoұD G~orNF2mt0Fk Q<. $8cI"T""Uk7O 䝍]~T(Q@PRL_l3Ke\at2EmFiM[u BHGsx41Tv :k)Y6SYvBl R֠E7u5EAk9ˌ1WmU l`4S +62Hi ^(o&LB)u%hv 5t͋r9X˾*,iz8f"#"j=@H)Rjm (GܳgLm˙[XyÓik mRv]¢5$R+|:06@XYZSGЁ8B*ހ LBz&K11zZ;lR WFsW=pqt )%xx-C'qipJ.Bhr{[>5[b)nioƧ$k+@$x5!3s8ti&JT|_P`)&bn !?] y!N%2GCg ^NףLuvT,ۖ|lc݇% O4["T?'Y,s>c|k %(x|B`{϶Wً+k7RDf[9-Y3FAhǀm `N~5ɱQɗ'~`h߼~@ww7/}/s5]@$rK.TADz/, U/oZn?7'? UHL%tEXtdate:create2018-01-26T21:04:26+08:00B'N%tEXtdate:modify2018-01-26T21:04:26+08:003zIENDB`iptux-0.9.4/share/icons/hicolor/32x32/000077500000000000000000000000001475473122500173445ustar00rootroot00000000000000iptux-0.9.4/share/icons/hicolor/32x32/apps/000077500000000000000000000000001475473122500203075ustar00rootroot00000000000000iptux-0.9.4/share/icons/hicolor/32x32/apps/iptux-attention.png000066400000000000000000000055251475473122500242000ustar00rootroot00000000000000PNG  IHDR szzgAMA a cHRMz&u0`:pQ<bKGDtIME5 YIDATXÕipuwfm-oBddc Ę N @&I=M64dR:mi%:Id&СnY ]H51@`2lY t]ݫým}fy?pBkg?|v]|D.G M|/u@9reƫ->|+mN2?؊ +ÞMCp)-1H96"^/O"$,mޠ=2x醞cy2 YdzycC wu"d?{y6mU-.2Dp)-O̸8Oi{/]фIUk/x:l6OC,DXkN/J0I.%B`d2=]V7r%;w=}+-}ө4PJŢDg *gΏ_&鬉,gZaA aa6k:5TtEW@"5t50_ˁq}( c$Nϳ~D ״~oV.d H)@--B;7w9pnjyx ƿ-# "JA$†"=;omRa|,XUY+X2v-[E%%R-ZW34+HA8 ]GivOnu7@)fE\SD,cۨ*̤yZ J,;dE=" `$P@'knuq[+Ȋ5e/^>̎ĊSEaA%"ԇ .7KXLJuU)\ ,ViRblY4 HYˎ*>% /Lgm=_@m8<%s:c ߔX`\!)%R!J X4S qvSFZM4VE8 ~q)Ɂ4ġb 1Bbd_ IB8:{7Q[fk-E>LWc5864'R8RR VQ8Ɣ|NO2fatĺSdqc B*RHBOM5H)"`h>ˑ$mUh&HB&tFܻ,#%\}ЮP熙H ;#sԄJ!XG: uTrC)f%vR 05'"$B.!?ڇ)h@Jt8/%H^ gNͪ5!7P4o*@fe*+;\B R&P!) |}/5?gmӽUۏ7,CSwkG;{%P2X YΌ31䍥P/WV,.Co7/9_^n\O|V{9r7Ge$WqbpPY3eJ\d?.矾=Ꚋg9uO6tV7Z7g˛RѷіlyL/ xɌ?2ާ}ٷf7}yW.Njӡ5m7mF* I[JG)D)-䢓:~V\<`*v_^6¤rKwv%jnI1_*cG|iΨSQtk8>} s`/Ut%tEXtdate:create2024-04-21T03:45:14+00:00 %tEXtdate:modify2024-04-21T03:27:44+00:00#eIENDB`iptux-0.9.4/share/icons/hicolor/32x32/apps/iptux-i.png000066400000000000000000000056611475473122500224240ustar00rootroot00000000000000PNG  IHDR szzgAMA a cHRMz&u0`:pQ<bKGD pHYs.#.#x?vtIME IDATXuyp\Օ׫j-eFec eȸ8(B35e 0b(35*`jؘ&bkc;X%Y-kVK޻w֖W[|߹1Kh4Jii)nyqyהݦ>SZ|kU]Ƹ4#9ęM{ h.=]?~#~_=t$LXl>% ݻR߫w=ʳjڕwi$~u Nub\ZsWUs{lTXr*_}/׋15}v^~e._Gf=mk[ 54r8ᆺ.342A:m#Pk"yw.*IcC(]^u?xoz܆u|X4={z5ڶm'8z3S-Oj6_Fql@  %%;6ױsCk+"|86+t bfEp<:yt?]xEԾ} qV~Si=;X5'Y2Y\ֆm6o$necUu{esQ~,xK.Ӽ}M˶]0KJkd//$V~SPlDkr^f3{}*Ў\˰DJ> + @~uQqƀHQ`Pe5%XU1x:eEe)p"f=-@$E{-dWإ֩@P Xwh k _WCw C0RhW`L)5GA@ s#c:z< {}0@PI^]Ɋ^`!mYcvǟz{ovڇ7PEonȧ18fa܊.gg8=t afťd\yHeagfo❳aE$~uL G6T`kP"SIfsF15\#Ml#T9}eeeͫf.QZWdJa!jlm0\|4H0".$N"?~:ґ2ޝ~›o#^}u+ɩeM-۞ʿfMj~wtdWghCJklm2cu\Sg[4-{gW$AJSks>GraLδ_[, 0hp! Lnwľo`w}-KGqQ&''ҽ?x#U_ݰ_EUp)ZchlWMz}7%/^PgALVKXg{{,ʣO>ͪ\qMoX"+E0Z>l!q\mgƉMut=ݟ{{;[6uC /'B!>j՟ӻh^Y'covG#Vl>K$J@B`Ltu&F{˕>ҩ?uen i^G wy'k֬aϞ=WM]ɂA%tEXtdate:create2018-01-26T21:04:31+08:00K*^%tEXtdate:modify2018-01-26T21:04:31+08:00:w!IENDB`iptux-0.9.4/share/icons/hicolor/32x32/apps/iptux-icon.png000066400000000000000000000060661475473122500231240ustar00rootroot00000000000000PNG  IHDR szzgAMA a cHRMz&u0`:pQ<bKGD pHYs.#.#x?vtIME %IDATXÅ{pUu{s[!!,lCbJjMkOƭ=II8i=I=N;d&x:k'vpl8`T@`It.WWu3gc>߷?arxvSʅ/i֒@A ħ@rjU'M&C=wn/_|1!VSt"NNmY[߸y׬lo m,):t&})uرP_:ziʕ 7o&_pDxѮ?Tmu_Y;#L9% [TJJp]8t3>Ņ/<Ϝ=ioo4t<>*ӳ|{PKH6D,J)RțZJVa )0pCoԲ Y6]䝾1V$GR5EgH4< eYbRPʋ,%IVQȎJ {K( z1Jc91pab\\9Yi02oR *!~\YM3KeykR|m2* y8tZ)j) H '}}t39G 7H%X e4nrD8te;W#g">ɡ^BlNx$F&N[z&EH )M+qa]y(FXTRlK(cj ]O~`{l. 06:x*ը8UcU@Y˗{Ҏ捾 i?_[€)aEQBMs]R Jb\2dΜ|L;/t:sS-E|?_fYN9ctBPS1~xOgs-َ|0cYHBMMz|rijXsg+[S { <@'`[]h ƹBt% bNQ"qycr&fC^󔢬D»tuK#$ɛ)ZH!j$g# ^.(!6(BmҶ6 vs>3oEg=?Φ%%% [=ERc 95 56M"D0h" NO\f-?LYI&_LZ;}]8ymѳMw}tlԗ F3g!Ӹ 1\8h3 Ɛ1T+&˹}l ;F=??>}ʷWY7BCN2ƙj>D> 5$1εpsU{OXY0d{\b w9A_lզ{ڷuyEuiTAkk49א56dцָ:.3lγʒk}EwZAh+*.%*?=$䴋59 6d!g`-׎1d58,T+_%˲|Fiujz}~uT劇[Vyʪan0O Lgr<)|iMߩƌߟ{ G?=qG`ѪVƝ%UFYa G*C6"J资=3q57.G''KK+8uqωcDrYN]mg~~E튵kw:E2jprgc .` {Elԑ/ڢJCqX,-\^f ű[{www3[(*kzzWx "`_qNM;?@WJ}Noo/T׃1~~TѣtlSn=>8PC]}zٵc]uuuĆJ9rJ<|#%h̵kh#b&%lI?i &1>:owέ;>ܳmx2kKg)LKK.0*Jۊxvpp[?ִX~l1}:=F7bo-m}ۛ*Q.O3Rv]J481hcp6Cc)3%dぁD޷|~\_7ZuîN8gGyY~txBOws@◭}sOŚ>Ӿn+Y(*"hBFkh h]z~u5n-}MD,U׆nȰc`$ ?`.=Dmß׾vɩ/4kv\Wt #SͧѾFI׷y _uؿ$^%B*m9zy ߷ꪍE0|QuرOv;Wu4L%e)Pc)EQWq΍ģƘw4CXqI/fѾ5e^Y"8`[ [ 897_y/?wtXQ ˰Xv`- ,4icS'Og{xxX1DtnvRrE|_ Bxc0VW5!j[ gy{'ΎFZ"Z3őygp޲0ڀJu,rYg_E#7ݴ6>ئ͇Z޶.D\R !C'ApB3KXY|h 0Z0Ơ(h/5BSQcة5hlmzV/:>}w-1-r 0 ڄy!Cײc{ g\"ء1!lkAv RH4FDCjl=Jp{_?m]m*UQ*I5ȡ(j%JJV5g)_NFX߲m{9RՓhkAd2QQZk2T1[{hOK @Tn,"5kN`/:VhzXD# Q=1~]4ـmL02zF|%OlY֮Ԩj9 #s0Z*6_*ZkP3ZXA0"(l{mtNhR R/(:p2rm8դ*"/fyKRd=}CC*`N(D $X ,K8hC*1 ^cԗ WPц T]d%3T<\2Xi% 4'Hg2N\qC"+NFL@-- Qe /aKrnhMZt"!]2rtMb5m oSNM.SFCVӕ%IS_LʬIr. e Msj6$wlX̓6rj.3gGHū  :ij5@)V b)cLpȥ⯕ !*a}SC4D#oƞּ4:DZ%ŁF7όP.(oLb<1JHQQ )\qIK2T%,RU PȈT឵7կh2ú7PXb&MלU\+j #UiRqصI:c83E #vl+xƶ)Y7׬aP\$_a;XԔbi>Ù#q25~ė묓vO[r%M+5,!-Bo[-TxfxŒG[<¡]t$b+>ؾ߹e3gt&bZJ2WMrIt|T F#}ӿ3m+#%lR OknLju-ž5ljk}s [=mX ]`>Wy(hB"*Ą֚h1;w>0_==1@f_._)ZX7ƈ֖zU4G3E-4ݩ8׶:\.gܚαXʗ?_ _XVU[D#!]Œ?qM^b7 O/Kml G@mTdz<7PDc67'(2+C(?Օo\<;8zBnfdJ 2%\_Ɛw=^L,MqvjQ™ /N(EIJq@|MR6BPm| bZ,~L?Ǧ1.\~rO5l{W㺍U F Gɐp,6b"\YX"CPR<ͥt ϓv}"V0 YT` :4R, /:l]ݳ/}NDeF1`K/uрg>(@N1FmbJ.db4hw/%zeJ':~15jO:p ̴Tv˽}/tZzORiZ֚9,hLD,_(6|[㠼TD0JY3NE GI #R.z{^=_ǫUi#W_ip~Ͼxo?s.'||LUmtph%QAmbFcAm(hD@Fk֠} o}6>?0wm]5_4ߙ/ ޒ|ͲXX|]Ͳd4d 5,aZè #dQ6ǣ<+\vG_޳ݶgy'a y홯tgyөmAtjsL PL-C1hP w~4 L 0"\~sϮNX={]H4»1W/}ꁏ ʹѡJ~t:wwtZv<F[ x:nH&0#;rb):xzaS/ct.#L+wuY~65Z|yf26a/5"\P]y9,z^S>cfs:K$ќW,1TKRU$dakE#aU'hMnzS#ؖ;KCM* AV3;zYxGe$=nXuC#$pӬTTAOnt>yB{Eui {:OX/KP8 ZǣdOI$^_hśzY,!sQ㛷/}ߊ]n]e.~\U " P|d V7!{/Fþ!bi<R263pPf8U%Qx^ٷ@A̘1} *=.w ]~mê]4iFװ&[V0x7},(VhcNۄ6U3稡~d3E^lLXyGs)h'k'ԟJmZpp81Z =V'ƈ! G;Ul ޔږg׭i>#pA ćd<Kk@KEf5Dv4S{=<50A Ə16|BH\.,E4.vemmI&{΂ax}YsH*0{EƢSeP(/ ~\.jk$burblCEK)kFi&F{ƶ"!G`іvҸAA)oF)saxx$yӫ 6s)b Vc ?pX 6*qⱲ2"^T-ʧ5xAŽ'8#€g_`ݼi$C~.i=@T @(~}KCVF,l]U3ZQjJK1"~x-.J!}\&QeL,=CZ;<8e>-Ox?'ӈA "a< &d6:`VT7X^ʀѸ-A묋]sYTu9wN3"b iIVQExY)0 bF Ub2*fyX4f%JJk|VCɘRi)'r>0h>, ^XPd,|Z)D:l?a\Z3j$ysm10YDHS XWI8km+AǦT`5$ZQX^Z"FOex`gZ* ڎ3)8\bqfNUttDɑ=ݻjZ@|}>;- WQ%q=?b3A4Ū61(KQO.A"C =͏>đl<y; TI QEHY\\9egd }DBQ jѓBLGJ(o7y3ms\6KA(EҚR.^E:sy?d(Ru&^)5ZƯDBG)!7=B"ReU@Um+ZkYc:ybNҕ _Nۆpu =dz9Cn2w=qA;wT'r#5$⢛r:sj)`iVOU0hOX PZD"%L4#myewpCjJ)xjEݯz+-4Z"l=fji p`0#O1Tp c(頣 D`,ۏsG7i٤BL.ò,"̚=g> ߿Ԡ0FXJ_ *x(8αT!$tyob?d|y!4BgP @(;}nY4{ [ըN}4hf``~&xc 슠Da  M8<ŘҹjjrѨgye3"B | JQ#gn/R trn>~`(vyϐ~DZ}AH|P kÌXva"Fjxi'Z@Jb ?ѧDD䒶N9GiycH>"7DzD|}G+l:0I+LVY~{M>;J;7_3)9|1'R_߿ 㟜}?.s=O'~*ZV~}`b 1xFp'   >hCڜzpKV~mɧXz++?lAW/r軃h}ck(S&P$ k!k y!gb1`6A&Uzf9G*˾U^*~ݾ}*8NmqݵSEjY *~^x"f$֭{O6@.#H<ڏ]߻=&|fVJPh&B 5j= #%~hWkOak?/ +:k?{lyRxn}%]xMYۼ+x3^tϺ#`d)oG+fuYYyT^)mkW E\u2i @9gՎmO:wk?7_|=,Nm)uO馛xn4Ur%}.(lK\Cl3{euuNiٔ]߫:򖽉D(Sm^agOMU`|%tEXtdate:create2018-01-26T21:04:31+08:00K*^%tEXtdate:modify2018-01-26T21:04:31+08:00:w!IENDB`iptux-0.9.4/share/icons/hicolor/48x48/apps/iptux-icon.png000066400000000000000000000131061475473122500231330ustar00rootroot00000000000000PNG  IHDR00WgAMA a cHRMz&u0`:pQ<bKGD pHYs.#.#x?vtIME5IDAThޭy\u?^K﫺jIhA$ !ð C139gq#3vBb80f1AYT^7Və_wթ櫯/Th%k7]XfMC: D…XEe"Zs2 㣣xP{x=zӦMFO[?/>[PX~-w-ojn&NnnY[&x EFDStH&JNOFFF?p۷o?~Mg^|;oJE/،^|_)ˑ|}ku m;wՂ-kWVBA1 Zcl"$,J5syG>C^ /?oq lKPz*} ڸiqu۲/,`뢆+6eP(6]>db&E>[.no,oz"!!?"4'Odϛog>. XPGT\O~Ogڣ[q/=o]  :.D"͓IH HŸm yKp8KzbVSYN̰>xNw{=q晆J`ǎX~uGGzeRyv}c4\\zͭͫ7t@xx*;=06dt&C:[ֆآ}C~F'&95[=&QU!дp!-}・vzg!;ؿ?;wl~3\{\Ֆ+vu/X ǭ=cMϠ.h05FkFw5u\ڪ(2H Oe*:= [ϡ2;y9g빉ѯ9p8_=Db>L67G_U\xŗZοx I%΢d~v.6P߶ß]K.e7б5KY0F 3kQliQ[4_v͞TSUU5@gg'>(L߲{ɾ\qymlQ3$c vQ" 4|:m Q,5_p"|5:g8bFB HTf5:4Q):{yOt|ǎ[ool'ԟ)C䢫:l*3"}#d%gAIA%BJh+6 >3Q,xf:CYڌmHB {T%'^(?N$aٲene3a[[I*[`pp|:3gZ0"sJ65~NZ^EnƦRhcM.NkS B.Tޚ~1Y}u-&:lw|64l+ MPno(k! |qMտ&&g (KUR" [p~/|ṃOKyV,Eg0~x#U Z _D)5?IBDFlZ+"4FL|42EO`3!0Fkjg]IEF&]M(` @~2n׏kښU!-b( عEP#Aܰ-leoT e4ZhWU f  O}m+&dr9[/YO%8vkBGWʳКYunlnٸ-781]R, K4d-,/ȶɼha! UPǯ^Uu7E-mDYŔ\3*Q>Q¥m\|<~KRF+)YVT< )5;%W%| Џl=W56F\mJ %YWF圅BgM{&(`ѳ7⡔$,/*-P=k<~m CZtJJ"Yfn>E|ܱ5USC}zmf_Jf0%"J3$1h}^!)>-{77,Ţ [OLԇ} >HiqWR!!hl[` Nڃ1DlKh9QƕT_p4/h,EB ˪ln)&/w`]E,KAi]h,eQS([PnXv_"ݵ0k6%/ -ca @,h&:oCC!_@lܲn [x 8l1`)o@蘩=Ce\'f< Xfa*6-2Vd'?&ƹhށ ^=9E "Up8<<5 >edY;EL@48!ͤkם0T^\ЈQlnJ's\vv3*`sC{3Kkc` '3 ]Z6GSic)*rs {GXĠdffvmYV N>;*XL w`<0W}*yd$h`]Cں8*L&`[l[X5+[O71KyZʲf8!݇{|v$dEl/("sf6--:+tǙ aE3 lh[[iA6/%}= 0LٮBghA332.#;7CkW`ۖy>2HBNE8SShs^}hûOb[[ְ0.\Xy-oƔ2kOdgF{E[Ɉ 4%6n?e}b_ 1+'A1PXS%;4'IR"Ջ||46'8>dUmb2  +,R/Z >R^ LafJLGm{{+L,ƮNvȭ\GzvA|JYg.Mrj&GosZD]^/GiSFxk\7eq1( JW?bQN7u~:xdoױЬQ ZG{[ )Gs*O34{#3X!.hVã vMW ڊ RD}>˚Mծm qm.;qB3|32cN8r퉃;u|ݖk+hEP >%HϢ=RBhI:RmJq .~KQnuA# y"e),Q gt)tQ}j#ġnO&㺮hG1jAI拈1(c0ڠ0,H]YD'k#[j) !H)}jW3Ȼ^꯮h(|\@wvyw2N>+UkM^{[%xΡ7p 89e(ǧ\Yќ%-Ǥ6^ Ν;/~ľؾ}'n+Ŏ/돏I$bp}#c_pEpTZ/@]cp xʹF'N{mJCaj,;ҁ#ϴ?ٿ?v޽{Ϻn##GO7~+KZT |x%6do1.6sSnKK )C='W]񮩮w|Qxɧ+n::Tyg<:4#WpSAkF08\(PRDզ8Fp9 \ġ]O xO`*W~8^#xWmZH 8>*e;NMFp#;\_xzةoOƵw}y>xso~aogt]r犅œ3W_wesuMUvCKP~q]]ŀ;'cpBg|Xz|7#'TANjwz,殇kG}n=cWTnhvj->Z+Lu#cbD jϢdžD#Lr*2ə-ܬSH%|EEǥ[7wns8& Tj3)a=r`߭3w}w$'znl}g-Xy%tEXtdate:create2018-01-26T21:04:26+08:00B'N%tEXtdate:modify2018-01-26T21:04:26+08:003zIENDB`iptux-0.9.4/share/icons/hicolor/64x64/000077500000000000000000000000001475473122500173565ustar00rootroot00000000000000iptux-0.9.4/share/icons/hicolor/64x64/apps/000077500000000000000000000000001475473122500203215ustar00rootroot00000000000000iptux-0.9.4/share/icons/hicolor/64x64/apps/iptux-attention.png000066400000000000000000000165701475473122500242140ustar00rootroot00000000000000PNG  IHDR@@iq?IDATxyuVU/E3 iF0Ab%L6&,N-/@ /q)qLg;a ؖyE%$F#F}Q==ϧ?=]u9smxc,^n۶mڵiSOMuւ¢e˖u/^x) I^ƘCwg>S\ 4\xGsXUVzŵ1c DcJWgm@{뭷F{_CDĜG!|[vEOg-_z榆"D, A) QB`h> j=ҫvl>_9O?XbO:::^?s#»ѣGFk~_}8цKFhi] ~N6DT s瓜HNQuһc`۝\֋.=mɕJ*(.*.ז al4A*!΂DҲ&RSYF[4ꋢ(| k```A;m۞!ET:+_/leIyeeyUM&f)Q08b@ B_ZbFqEե,QC˴**+ik4`kמyE[0̆9X"CcN$xJh.1D?6$]tV`i473wHio~΍U~tQǵ_K.Z16:jcrth}GM ( Z{Zӗq!Cԡ$J8xciHj-6fsaQrՊ]5T?3V^lZd8Gt?%7Ơp5 >.odYSuċض}<5>z$ -՘}`i<{ڹYK?ċt"P}cKj"ML & P`4P7UQŧOqv[3Ŏu½Y;0zk7}J$ߑ fÆ e>߲E_\~>S]==:m4񈝧ԔgĀ1 3K\{༅?G,.^4s[[OSr{_׶OHYguet4GI%Q@M b s]8Ow[4m J$7q{uE?ҟ z71{޼W6?K?5ex/Mep(:K /|]!<ÍgL/VU%Jc eܰj>Lx8o 7?qW_7nyZ?2Q$gRH@FcYjG!sw< nYi1ԗՆ~O2^@N 5k[6yatt}؞_•_SA,:fnCU`9t"|%%UoYf:5k֨5k~{c+קW]IłmOlIj+5!0%`#7\ Sk 'IO/?#S@XRjϬ[>жܚu1ܬe] "mB @T 46~Zj* <"^2 3kK j`(93Mw}z?)  իyuΧr= eMRrjJ * ۊ1{v)OXe(؏/`Y#8аp)Yٰv&5k(@79gw4%|m$iJ68 BxEmԡ}a{ 50>/>r:Z @@@ \={{86Ķ1[Cic3cm.!o|Oxf˒FE"j"b<W"hQJ5 )o&Hc%f ƠLPdA0Ƕk\;MU4-&\qw ˝!ADkHɃ*csƱƣ|\z\rwmW~hl=l9)KeJS!9ϒFk\V g d,Q>-La@7I m 1[qղv>At 3e8Qy xD"|Ͳ1GxL56.;5]c4VAa3 ‰)NOαY:X:-f2,E8oU*l+ާXL 9QBF&{JZv4lbyis)klAk*V>O''ʔIۖ\T%gRXTp=T,+`r"*gtǭ3!>fqQdE"P?ݸٺkFyw h3)FawRXFHF#\1NÉ ~91g 2&EYa50PpA4Bps˶D,,evYgUfv&rPj)WS&8]fqa{V`Ү= J9W`T`P/Z %D G*P^TR_؂1N TȣPDG\+rL'i]RSuh%xna,%yKMU%wh:"1ZDI TO|!s9_pah9\1']\0LNF\z"5.pI\BY"6YBeUj$'f)Omyeh%8BI;WDucZ1F1Ḁחv"|, QU[=gԜv&KvC4ElafQ*L++q{f q%aلŴm*ʈm2h#0c?2yޱ{+Ջ/tzJ޺4G Z Ԕp;B/e#yt_/,݃c~r/8 @I<·[ %h v!VR5Y^9pA_b%">MK)p@ȫ/TElx$DMxta33b3,.J&yxa}(J)cRێ q,KLpEh.raǶNGƓ =[63{lXp նɤVj$,hN{7kQ2`4>1OrOo:2ĺ,7|t9(kJRCmSu}zT֤VSJKȺJ],`!m-xJ7~W5%̒%'9q3iRa~u 4Ug|~SK4aNDQg h2ɫB%"Aa`x~Ibjt|;2ױC(6XgwlXdM%n?t+RGHѤ. zk(49|i7Kqߡa:obYsM$ i*-{'`;}t3Ar}-25|9U%S-=zX5H.-^E>֚233h*`!~;L2ٟ5*E&Ua~Qtb3FRեF4"{nǥ; ][嬜Q֜E4vy8Im02y,{Hd=ˊl^ 732Rld(Qd[aO (:irxa"铏h7;2y.ArZJd1[φ?8<΃()ObZ9g<(wn9H`sNcZ9%{p$ɫGya;6JeNZ-9@c!bBĶ7>~=qٲkzz臛m~gAVA100a gDh*M ͸:dw>UV.B]nΡx GBIJ"Kћ }o 'y{J%x@[iU3kEҡ ׇBZ¬XEmʌ!5 "63bmM-Q L$b7 !߀lٱ1YyμgBv+COxcX!q* ^Y5Ŗ3岹/OH}_o8;2Ķך5%4ER<}p7iJm6+ ea]Ht4QOW25~`~-2( @78 MsY^I Z#Cw1֖5FR=8N"ita`'<_16(QmvAaH"i[ E.>dqL`vذs652@" b 1y`=ôE19?B Վ2qƼ=Mmk9`%%JJP( hrMncbڷn@Ȼcǎ~hzL:v>)!5^KÁ(_SSPd ۇl8:J[*LeA1Wn#T=jDXV0qc𙤾/mƝWz-w_1; 8av֬lK6G8_t]1$=8\G)%V8B[Hb 7\ L5y <`I8h;0:dg^Q݌ o]}C߾HWsy_՞w,aUp+4*0|/brO nmR }ɀVPk wnBV.+Jʲ/a}/A7J 2s'zg'LJo@ȢV[rp% k@ f\ƽ@v( ei!QR%A+{pRƔvr$eZaA_l1Ў;+_իsxt07wế-o8}ǘLVR{^voձg,x]lg}7?s6Lx]c0Y ~_Y3:LOo 3( t %I^\&$۽wMN_;F<~ITc1f_z[y>zJx:a;ڐs.pj>,s59^??/Oůoxk@R{o~c-3g͋ʲ3;"beES!A1[) 0C Ãå< 1 L'YlIDATx͛y\u?SUNI:NB "BT`&ѹ"G+:8yFQ4\@&{ҝRwrSU u]9}r?󫣣c޽{?e˖O&jZ[[u=(  錙3)rUG\.f.}ʙ-j봲NJJK1ƠZ%58@_KOʾ ھ1jG?ܷbŊ-[_TUDDu?i\Z#WU.9}yލ;# 1v4UUYߦ:,^x<x*ا>spՏx;_'2GW\?3ZW]QNii)ee=~,PX!ဓW* T0L6˻nww z YV7Yvwe8okrYe5`&!=ttv380L&i,~&K)(õJEu55̚HM`-@&cj?IgG?{xq|VwHߟmc3YgtykMj q"ωAuZPhTY-](̫+gNmKMfOi!}]9|ѶcתU PU.y֯-kSWN>s^zziKZΞP@ZbD* ,~`dHYhb.^89͓hH]yW\O4PdϮ=@R^Iz0s*P_9bly^pX#0o7ܹ5_k.OgoP;I/ =E.P%c-N-c錉,=YTG;{ymq>ȦI>q g2k.Q0Aڻ7C;w@Rvjxi?Ѯ9tT   BS(g[ҾY\wY6-oxv|&VKs{W.?E_OoݲBN\[%"+TUn/^`57͘cҾ':{ch-t{#Ooe _~7s'־}PYMic]T{߂1ٽG7 XxiPR]?mw.4] z>D~Sk&Mu3,}ډM8!-[A!8;k.:oRx2k@5yݏ\ES7e}!~W@?6 VTO ԒL։k-2ZgAG?]PiX@meT+LH$=%TNq,O[?hUU(`κul~i9 sbQ7DWG/X0&._ HJRpj+\Ahb(JxjA^y y."*euu:e2̕kv5kwΚ5ko8Ԫk/[2ΒL1a9Ͻ+k ( Ƒp| 0Fàgy@]ܥd/;w#'~%:{~}7*k֬ T~s|>ڌ#^YE&ӓ#8N; )0./kU%&l||n'z7tSᇛvx֊EKW]8J~Y^p\#Bi%e03[R~@pup;xh_SK<,aY<.w })kK1o:"B:XT:,l:¦lڴW&;{y%5

'5¿1l+TU4mSU` /fxs1k{6|q"?*Y5t#1t5k)\9)*Sg1aG ED$G E ksAXuӠ}r旞x =P:a 0 VUY0aB8En,2YUztJy)o :8@[l0"RWQvU@\1^To۶=Z4 AGY6ǿͨ)'U,mf1@r ŵC Yx upbJcԦisy-ZVS7kNԷ]כFWFruxr8 &Se9]k0?&%B9#CL> q\1HuC}kO/klBsHaEay;ڇ#|bR.i<掩r80r+yo2D-|*P 98Q F1 `Bѣe%5n2D^8(1yp(%pmT?ߨ_xPc0JP؋GX`2M%c>H_qEcF'y7sQƩjH:Q|8ߛ{3g3_,_TwW(%߹B+||F=s2sZl8ĸ3R`J>yK<#\x/dơyluuMMܽ{ TknO19'jr^}9+R:cR9f)p{-픏"QP4>s"3c*ÜrS==tkȤp{XQю+< 6eþH"I@  4T0" #oyH;Ӕ#?byNL'G`D GJtBj;vnNWb uߺ||m1̘.@baB_vn]3BHy1Ԡmn`&! 2!/x,$E!qt>9kߣfm[HOj NUqa- =A1CW2eNeޅ^PH`6p]:!ݍAu7W_ho>?BvCd2W^y3"q᤟)3# j !z3>,Ol!ᑂϸ(ޟ\9.xX ;ׁքJ100L+;>%9CoG*P1*)A 01.C8YCl4 ?4;~6I_)hUV\{Ͽ^6QkUr@C.6tstE%,L3Bpt gwL~>Rx`NbpϨ8ZRCD`-bhVqDh;7ԏSN\nڴ=Vȕw-?8nJX%1:px 9䮃]i{l=+ڷ ;`OkL,iжs;G`7J)ov@6`4E1^˅+Eb N:.ƅ\GDzհͦl2gW7x+qSS7nvx-myy҃C⸞_rz"E #M\VZF~QoQ RPꦍ8p|cE|+a_ 0خr&ok﫢EiyGx^t{7}ݻ016?M37hk+ښ203ZZZa8^aּ*&NvU* Z}pIdUIf.UFUH[eBBR!6\PQ[b';k/}+3fmܺ-=S>piKn7_Q D| 4P#&4/aW*d4,[52h!%WTޞiUnIg7\v +Qݷw9b@7qYEC6}&.^"aZP<P| Ak6.yOΨSY%nMUfU[YSSӖoc^{n?h{׶ r@6q8^L5|fб;~ϯadz af5)8(p%yp},=>K.yw=0;7}ls=R&ϝ\:i ƨl6lvc^'D(qZEΔIC* ɽOk7žW3ړ=0q׆dž&u~o}%~,Vݤx%1FZPɓC"[lyW/^5dN{-=m[ӧlx+s?N<0 W\qz|hWnxUu#" عjK)ƷJ0WVvzEd }m:rIENDB`iptux-0.9.4/share/icons/hicolor/64x64/apps/iptux-icon.png000066400000000000000000000200701475473122500231250ustar00rootroot00000000000000PNG  IHDR@@iqsRGB pHYs.#.#x?vYiTXtXML:com.adobe.xmp 1 L'YxIDATx͛{t]ukK/Kޖ,[2~Ɛؔ@N' !M;J҇HZFp6-$4MIɥc%ْ<ґccst$mh=cqs~s ~/cM6qБ#Gvl2xWW ]qw}l̙ +VZlY;ZtG  _ ]dzm 櫊ZUUS+"6c!96FNqcŗw=n ~a/eƏdU~c7|lMqYyyYETO 9Y% 8:88qyxY"`+fXZYŠ3i`Fe9-͵4D0(]g_=>_>&[nݺ6\z 7uyKRK228pbFӠ 1KP H@`0ƀ0ڐt\ѐPjn_2ŗXˬ-@9#v'~_7޷?OV^}p%h>Ѷ95OG75o6×\Ęgzx}q2,a(3lXB B6NaNd IKQh1:i Fk1 }GFni(gEC%DXu=R Gyt?ϝBj=J׺լ^2Ғc@|}7/>$r#11vÆ ]] lۼ}[cnyotjlL%8~D[ ι|m@׆~O$/Ջ/aeK#ELf=>͖]yb ӌ:|++(EB`$޻wcm٢簾Fnasҗm|m\Z[Ibl\<;> B{PSd^u9!%/z!%W[UmsH'|2%)-xq) M5EqCPQ[ [α=gCzl?OJݸ+?m˿pMW]c<#1N%O`[/4m)h:\g޿%|$"ek8;]Ep+4QR 3kT}kigͯ[N>|ⷣ"o|?3o'F9y'->S)3{!B" $%]ý gU qBw"Y&\lP]<$RR ք,•WΖunذkooM{|sez ڔk IY-YR2ilş}`9* ?:D]#$\QܦZ둶 _:汝޶mE.ѷXt]eJ 8g\7;-''c%@mOƼh/ iIBOdyvua(K£RZ?r{oo.E/ww߷h\L`)S ѮS9#'pB"#YdZ{ObIӹjPRR4-_ȍ_^KNucXv {X6wnT#'2H)J70.1mQ!҆YPW0vcB0HwOE-12oNU%d!qEҊЀտ ol<1"XɝFORTY##=A)5RB>jIưq)5!B0}Y6nn~j6B<3C(% -^ڹaΔ,DEO边Wm1b,&9B &{H /b#$ՖbK o?Q׻K)U# @Zc'ObY% CI}#ʾL۶mS>u{w 7PqH3b$>u3DAĿX^H~ jyAb4a iOX/d=p2M(Gaat<2KZ@rB‰˲95j x# =Rwm?xޥܿͤx2x*EMOfߠ! 0ScȌ3'g`yY~I~^9K}"jI4].$ +҄ƲZ$2.7*=pnkO?5si&&~ Rby2H6Fk@h,PjIP7? ޖXetPG\FP#]l[%%M^X5A;̓_^HkTJgRIJ;hO#/Cd~ iCBD`Fe̪*# Hsw݃҄#6^p*".)M~#z* V I*/!dK"4RŽfYĂWߘwu!#%b"u]E\ŗ?YcS+5+Y6U \W^XT墵,a)odfU)G3$2H Lm]E2ȸ FMI?r |څ|dyFCĒ[- t:Jg,Å3xO;,%)ijʒDl)l)6̑;sipy÷|{xgAx1UPL'oVYX\TӃdQ$ʦ<T?\`ҿ<@l)ȈIPJ X p~OzU% (oBk-.f.rӖ 8*9̈.,y(8p* J#.Rg`|ڎ<s 4#!'E*gf mrabsp%#AJR q[,Z.&-G1?bOCL@IR6 pA8oRB % `w]qEHgfk/tj)Snp :/ϫֆBv\~8F'(%fW9ɋin0Do8`)AVo@wn5Ֆ7aJxy o]d7WRP#4B azՕkBU8{T~:2<%Xs%+. <_:eG?R0u[ʱs\M/`H`El"1\pFzY]|"+c|9A`EK~AL*@.P:*t{Y6 3'd1._eMYj=ͬX)%)z./2E-1 >2i\#[{2Z_AE/-B"x,){[}gM](AgPmjk{g\ m MEy4@OS(G5 5%%1έ v- W ]]x5rg)ql *(A |e-H{*ׄZG{F3I-mGCyV(! ~xQq+bjt|wM" v&o[EFݳw+Z/$qң򒘔 k;- D"6m(~j~~-j3 V4,h_ͯ唃f=_]E \MG ;,1`J.l3݇_hrī2 ZiYʉ8KcSMSE '4 HJWV$4 8C;hex>W=Hhn]ܵ^_ƚٕ L /$f)ƌa}MN<{cYQ[c5nq3sʰ@0rKRA/O +뤍_kexgݢU /\gPV| rmo"k4Q+k(4! B痝)Iլ)ce,3 )# $D%<O|0R-%ΩIݣByjْC~™6$њGKr^Zc0fһ]m( ád1ڒp<Djl4^[srzwl?ouY?3..* 0bR07qA /@upRd3̠щgܿg5|>ŃIry]sum._UgΰQ  v8sBqq5Bgi['<2@ޥ7GzǓٓ }m X;֤_uW^%ªXDHx1Ɗۑ=C4{7u-Zh4zy`c;v|ܹsg?;12qua4JXHKh,f;V~sڵ/!.u? T7]IENDB`iptux-0.9.4/share/iptux/000077500000000000000000000000001475473122500151625ustar00rootroot00000000000000iptux-0.9.4/share/iptux/pixmaps/000077500000000000000000000000001475473122500166435ustar00rootroot00000000000000iptux-0.9.4/share/iptux/pixmaps/icon/000077500000000000000000000000001475473122500175735ustar00rootroot00000000000000iptux-0.9.4/share/iptux/pixmaps/icon/icon-blowfish.png000066400000000000000000000033751475473122500230540ustar00rootroot00000000000000PNG  IHDR;0sBIT|dIDATHYl\W;wxıl'fSiЖ!}hZZHBTm QRD 7HUiB4 YK\&'ncYzx'YX/}wt~GV۩W'|۽pjorŵ\ +=f+/j뎼A_ݮ_ˏ'ڶ=DU:fWԿ`h~ry[[V ,=[_t'`zZx}vڬ_%X}]tcMnppg௨&;Uj|nuee}u ָ.=CJ Ձ ҾՈ=4 BAW]tLN{6}}%SL8ޙ6o*Uo$3A CnoNTUL~jy} ]p)y=<>}ڗ@'hgَN>=3@erH)%kRkX?mP]݌8Y Y%p{9nE2/{xvi<|M'(L_|{xb)"nL&a mx,DQuh&k%\jw$Ȧ"zڷYYQ5R|5r*oBߋ;lTŇQTMPUcآ]S込m͏xbظe $#k뛼D?~{=G`A7ǽ5\*J2c`ŏNgF:F7qo&W=B|$)`f~b ^>l¶x+gۯ.} 6rc*^[Lh|${5HV`v#*Dx=xV ŗ$6 Z=z\?z>O&K|?Ε_~rQsݒjϤ5݋zMPf;Omo'HL<8U]4ޚ7'ɺn46޼_vC?~;1zn NR_yɨie 0gr'6sgjNHqOoߠ#B2|IENDB`iptux-0.9.4/share/iptux/pixmaps/icon/icon-bug.png000066400000000000000000000032541475473122500220100ustar00rootroot00000000000000PNG  IHDR;0sBIT|dcIDATH]l·wgvX&v6)viCD (PH)Rߐ*OR+ԠJ !wuu\ TWYKU.=Z<^`F:`I@lorf+c͵;I&7}zolP7A["J _u&+{@+?~L->~ORDp#- B*\M]KWQ j#ttthÆ|{UńZZqDHbPD(%-)7% d0x 5 lZyl gTFFZk+x"A@ J%\/ųmRD[B]Ba^2i9p`߶?>0U&J!R y4jrwj wj 55;=MmGKHF'_Yԋg^͢@ria %.*C6 r0 < Ν]KR wb#iDcf!@)r?`WB7?ߔ|t.IeoNӠi>@)p]p]Ҧ@pJyTBy@(_ ,xc!{+k eM# @,yD(Smx>:0ά޹s;v`yY &-5֯EL5;f2 J8p'/fA&]y|ͶiR+T4كсgKe۬1`x{auǀׁz{o_%֚I`^u\ίe(HIR04`ԁV$Jgf_"reH]Ẉr!%*~Yɞ5eP,FC/ZY|9p8"uŒ.466Z'N|.H}C`0rtRg\džJzc׮榦X 7j*9IENDB`iptux-0.9.4/share/iptux/pixmaps/icon/icon-cow.png000066400000000000000000000044571475473122500220310ustar00rootroot00000000000000PNG  IHDR;0sBIT|dIDATHmpTswf_n6,M0 DAE?,H" _Bu* L`+Ё@mHTH0Iv&fLּZ;=}ssqxy?u0?_xrʕcG֭{eᰄZ'8,*n&O>fw9Nی`lVzGӴn2 SK[*W[ yx9N=ϗ?|3p`ɉhyYي{~ĉ;%<΁1 CSY34--w?7w}w󬢢.vthW\h3GBS !+?k9co }KG(#_iyOIiezmrsz{z@ zqFpRO kX˒qw[*Dmbz}\Kfq5h4 ADiјL$)t#P;wnI$Ei8vH >E,GWW7O(݁ /Nkvqyttt```xW_V,qܮV?пdIZr쥥hmmECC8t:6b˰nh=uIBMM K/3 U{oLDQSz̾qϯȷ!246o ظq#2 , =]Mƹsa0={utt|q\$IW"Hb|3N+fIgZQ[[ ڵkA4XQB!$I8GY3-xL&S}^~>@8&̝;5556󨪪B0$IP,Yd E?l2ךfh܉+ppL9Nb1$IZsw11hv06 ,ɓдۺPPPt: e 6'z:5k8Ji^yt qyhߏݻw#!i(*.$))NNso2DQV^&RVȊY122%+PUfL$pLغS\^$ 1A@Yy9>f,`(gXVavB@Y֤*X,Ԍ`L=[?>B4ř3gxdL&H$nz=sH$0 A(`),f$I{g˗/ݖD˗/%8υ x<)QEEQK./^SXd즥UWoq4 "JO>8?3H  !8}4>#AQ`YRQ}>'7m˂~l` AeH4Og2H%`)e٬"CUU\,t3 ^x~O:kkjJUU(2LTjhIpEUEEKm6f۶mҒY$!NO{x*PдG鼦} Rj֭Ud2 a< H"nxHRH&H&HR XVl6XV\.]We@@SLWg稢(gve!A( _ ǃ vfe!("fO7oĥK,(][fe!bݾrSx: < ~ : .;--ɿk*kj0=l\BȞ.Y_}>8y3w/{W%% [!@{R#\9la"6R l[[O?qB 7%dz!zҜ3g?Wle/AO _S޺`3791i?]| L@:8{vy X: jj"F(zAYh@eu5ZD8t4 nmb?3pah$R)/ܭ F$ea bUNwtl 0<(s0kBF\2z*p54 C)u@pjk6fT_>$h]FFH[~& JKha\4هMl!v!y4!)U4 MJ4F>d2䀬 IuP'2^ KTK~HB<,xQ׮%ī :I]g\>FM9 Up8=̞FSݩ[e֭|~~<ٳxɺ5k۬ڵ 4VO/a ,Ƕ&S)fZC7s9> 74P\SCʕR+ c>OWױx%xS9bcPD-I(jl(m۶qkk --T57c&===DW'n? ~qu@p/$܌mϝ!֭[Gww7wFV@0eʕ׳o>|0őRv88g F(̊>N&-pu5mmmq4M,hmK~<]]]b1r!͇XfӀmx:]W>ip(.v/ x.]J_e% (Nt]gxxADP `<2 {Rj0ưBr[oqrv*%PSCpIp!LttCW,[9y`n󌌼hϛ M+02d}y5ǿmF_'~)ի475#\عWݭ2[Y]` F6HB<Xm-xT +WH_¸Sa+Mq#8BrJJo)vfD{;;wH4֋Fnʻ< y~ 3%׻SQ IR[غNBJ, MU'R5_^W/M<6 'F)vM,iWUQǁ5zA)7pХM h!vKjd')*Naz-68>)Wn1WxKIENDB`iptux-0.9.4/share/iptux/pixmaps/icon/icon-dog.png000066400000000000000000000037621475473122500220100ustar00rootroot00000000000000PNG  IHDR;0sBIT|dIDATH͖Y_U?wvvR -K[ 5 HMAۃĈ1QP$ H Z d4TJSJPZgt:|EAIN䷜GMBYx~2nݣAe腸]pbϪWW$YN4s9o%;8n4;W;gʕ7d6I dLM䶈p^audn)գkyv$Gp|:T،?,hM5V6ɛU(9x +:*Gfh5Ly.!=0,X:xw$"/:QIKd1m,ϐj˖2;: EOE_*y,ggWE^ ;vO8Ճ{-x:m`u+6پ~w-niR7vš˩/YAMx]ˉU [ #<?hcYxM^sw# qtkS嫶 < \ {z3k7{ό[ڸTZL4&:jN׃[*ꜢItؑ)Ư_CVږx:kas1k$NaZi:m]Uk(TV˞%{,s|qK%x^m¤!VXӾdq #"ŎbM!h]A!¹$qaE ǥxM?XVIJ1*<[QqW[An@a_n'I;Wq >wJL:CzpP#|X u|}ZIU[Vg2cdÅUtq,~wm ?cey3rM0*EpǭT o:yPtG G4\k+1S{. 5jX&: ߨk,)A*li\!\,͞ ? XHpSر)::^Pfo";.G9m@"|YG4P@֎j!+r9%nޱKݟMlt÷ ԑt\/\Kh{)M`0Z3LjH-iK+QX+ʻy. |оx{F(>5t_t mAӨ :m7T4c eނ ]xpk).]/[sX,JNYZhS0ja-X9cCF|`ƾšY'ȢyQTU0=GT޽m'ש[tj+m"B7X)GkӠ5JX'Vؙʎ{oB}xXW qFa:IIn~qpAG`Qah^ <:wТbO/?@ X$oU˟Κ-Qaafm^9tLq-vƁ#hƼu:e߁7]<(F />w@B})CV022BV7ƙO7=-"&> jxxJ J/Gw[~E7n3gj*O}]] _.8w]2/jY;}- . L1]D{N`~][t]gh=tWQ~_?i3Ǟ1ͷR.Sol=_߱?h5R*E#U$Rho75Yy]4w7ڰm vK {06 |:>kDQIsL\Z)t]EQ+t;34wim W5GǾvʻlHg cG;?ߋeZ>LQ9QBqA ey+x= HħH }Gy5?M ,}啿ui `ZWJt@._vl)AMMG?ևei{_/[^<i } (Rb~"K,7N57Vi 1TE!fp+`Q3+*$FSDoܹvvj)QA en]LRS!5 X[_B}]Xi"(UU5 ILRdŲ&N'⍍XE95㸔J. XWP-ˤsdSSi5q^=x'! @$CS4Ϋ `\9/B,Zol08<8N9a/~J{{O8etd,tU9r;/Ϝ駩EQ\*I1|.j:&33 WUivKݲ}4gHu@HIdSKH)1|e 52KEM%9ߞ KJ٨i| R*Xz5xA9)|);Uz>Y UV:{](m(TrH| O '|e%P__˝3 ǝm;J| ElGGU$rz` ]א)L,p -󸮋 (+/:4GXtlR"tPSmWAu]m۶ApIWl'Iy<ǫ2 4MQWkrEEUTba(! Z[[̴ svy6AI|>)!-͕utG2D&tvlO&Euu RNɩG^RɥRAU%BTU011F1 wIV,scuU|.K>}.$S X rVl8 +U[,~_;t!`L*aOCCvaݫ +rz M_B&)291[ob<9vqpÆ k7o|C}6]P8{u}iAvm0M ïa0@(b`4o#GNRȋXnU***F0nD"զib{Rj6k uQU+x HK&SIJ< 4d2H$ùagJݴiSqnuuZ˲44|x<r;v<>YB`UL˃ejH!Hd2| HDB!fdqhh={l:ߠiZ0nRHӧwYf[OOOأ~ZW-)Ta5 :8UKqU/pO^tUO6>ϸjt]FMn \m *1LoōGwzqV6.dOǭwB-f|&%-LiVY4~%Nw]6Ywy5t{(L'lD1?YOZ6,9=#%$=MYUzk/[<:wC҃.ڵt^>sr="Qcu&ܼv3ěb%2&8O#qiGw7?[١2ygft%]jl#`'&gb-uw agʒ*<ّ @@'iPqHi|*,52;D>; ^j~w9ײ`jh.fT;Df&3@k 6̖sLdR Sd\&9&3>ru+d+3$)|++Rgzy! gp} $Ll(96,C;TefKj#$WR#OR3n Eّsρ 辩zpTA/= ȗ^yVP:PA4]2p95YE+ bJauI+wN|)`D8=ʾ3טimI3?^KY\U& rvysL<ס917ĩN~Ds&枓X0nIr YE(>JV|د:$,K bm0r[Se?4FwSZDl&1t7=NBTyTh@0@V:9,zVB !H뽘_WFg_v\>3rPkJTzXܳ8z4,xt𙞃W54~G{ ͦ-*_9ZZV6o7Vk.Fʃ2B y[s3?O|60J,T7-Ss xotܱIc>xBr>4~-}"/ln|ܵTԮFcG+ \Ӣ-h4rK@IENDB`iptux-0.9.4/share/iptux/pixmaps/icon/icon-ghost.png000066400000000000000000000033511475473122500223550ustar00rootroot00000000000000PNG  IHDR;0sBIT|dIDATHmh[+9r[%;Kl9vR<0FR[] 1,1ƶ!|A k?t8f]ʆ-c϶v[[[ ?~~A0al vE{=/..<Ϗ|>B) x(kk >84ݼw?zޯ*yVPJC>ɓ/e9Ο<^zH&(5,|>ew4B^߽{7aw?o?ۻkhnn.|o p7 D"|o&0>/ qdTJ)@ m팺`JwNg%"#"aXPj"HT*!BQdEPJa B0<TXP4@4'Ns(e0::ht$ 8ˡ+K3 ==XYYÇ SSk;G}9tww!HTieY\LynZˊ"qa8{`Yg izpG˪+j*:tHQRu ua7UUH$:33fJ)!4 v,|Yd39*ILD>G*_?zRFm%I*_::vʲR3{k:2 t])C=4 ,;Ns`C,Wk0 B\a<ZL"'b 4ͣvFJMӞHk0 ArjG"AH p;`'3Mo0R X~YNmpBHk9tb0pkV3 BT1!mLӴ3 (ZPb1;!mZ˂Չ$]׵J (5X)fQ(Zh @$/ʇS~pP8wg=vzxyx\AV ^V}Xf)LR`Y(80 SiGAN(b_E1Hix]^^^J50 :d&۷o[[[~?4MCXD$!\.0 $af(6 t.,,oݺ5~ԩW'''677W2 a`~~NOO_ Bsss$ѥkӺ>g{EQ@)Z(dtݼy-..>Pׯ_o=p8)cfWWWK&lii7t?eꨮ`=xr^>=11c]=<<`75ŋbYW&''?PkX333o[[[ܾwgr Ϗ;c?#Gpn|Ó:"x\IENDB`iptux-0.9.4/share/iptux/pixmaps/icon/icon-konqui.png000066400000000000000000000036271475473122500225450ustar00rootroot00000000000000PNG  IHDR;0sBIT|dNIDATH{lƿ3;3^sLy@I(bIABGPC(HUe%&M NK!1`c fwӻ;;5Hs|{uF/{%#NGdGqqet5kuOOOc2:$h7/pK) &]r3ܯ>x_9آ=WUe"$c>cV\"3pSUML%\j܌%d z%S _(r2Zkp<^tNL{Q}܂u&6KޭE'Fq\R&5ռ_uO!YErqBqkWN) ) Gz V@)tv" elXr8U#CTrvT!W&TpYh4y UA1TU"6*+/XoHcVgQZ*G4OȐ oom@QPxObNGڡUeĻEP`4$rh9c1_ 2zR| 0*|"5ŪSRExW<IJxxn̟--W"buRLo0 DlIܾ3b HqISB.}l@u4otֽa+[`6ܟ9X~%\BK[o4T(1&lJZ8s{˅~Ɏ#n4}@n0o:5Ġ uDE?9 C`\߇|:q̵ХX(-vC dM'3cel&\ : )P,L*VxeYy. |FwTy!@UUUH(hz%QҰxuG6}lS֚FAwt,;' ( Οîv$b*JP0IspO@k6Xcc>4ρsȽ1rUNCAXXl \ATa(\F@J":+[GtOUڜ;iehPFt_|dh^gD0D [|d]]] 43.~iI0&"TQIENDB`iptux-0.9.4/share/iptux/pixmaps/icon/icon-lion.png000066400000000000000000000047711475473122500222010ustar00rootroot00000000000000PNG  IHDR;0sBIT|d IDATHypUg{{{$$  v@K@QV;u8TZtlEjqZu  =w9,:}|y΁kj}/r˪\\t-^y_.OpG_c 7!)Z}k{] 8cAkݒ25m6wN4͞],-^ WzNJ6Yxnjs,yzǢ^`Ԫ+\4ꕊ9[{Fv͎>&1XWvoNGn~ܳԉYVzpxLuÔD0oiB/6[kS]ʡ<5v 6ڰ6ݰ`* %l(6`l^k;%ljYٻҒ5/h1.&[x^CEM*t i;W̘V);"3gpZ8cERV꡼KYߍ! D#[։IHŠD6kͿo^ HWkq"oMbmg"vRV꥾"lj&#(l%ྡu̢JJY:?:]x_=lBoz/gjkud"f^C&,`%(V0Qpk:r{Y0^<8ެ_#WO*ۥ)'P|x矼fν6^{y-F4Evl3>L*wJ%♍yQ]WϪ3uɼ݂@-p.;_*m^ H \<~3e |W}P4e5A28z..`$J|yx!&b[Bmxg߰K ]vWxl3F/:A$$ pGqzYY?7^Ja T-mRWY0%pꧮm_bXֵ95D(6MK$-|1T2y)(RSDs HCSę؋,hx =zӧǒfPh Aޱ>FNd%KK(nf``hO<,˸% Qlv[YP=H|wd@dߺhh(|ɝ3n)+4T{Yqr%uMMWX B*EղLd`5 ͬ/`jE?NrcHg=SkJWh,;$,"vDqT|> .g݂̚CґDSdrȒ ]'>t$dNrCzdnk]]R;Tu]#b Ug/bTl*eƍlã[iW,jmj t|B""XVꃑLi8 ]r^}uE,Bv{ g{Fhlh$i̳ Wqu@Ѓ>>k_VTB x(~ִ6_Ö8̆7_,LG++ i!"[>ۍ]=LRtt.ٍd&;#Wy# bv (|3)6$J*YJC'p*vAJo_Ju cIhf9vt SuIo&5ٗ0}h)k[Gr*&9FНsرl6G4FUu,u k\lFEײxZ ~_W%Iԋ P61B}X^`&?ȿC=äC㌌FIg4DQİؿ=}t4l05҆IVZ{ʢ-PLZC7 DEBGݎ GsKHH@wHi9 M0e@"5ņO <|?T|dIbyD$iCM"C%^PTZ#VQ[@00 {#8{~ͮdR`RU+u,  g;$Dؽn&hl6eZ8{Z;xE;bt 1JM(DE$ID\ #J±mBR7_kMN.uO 6 IY kƯSRj?m5Onފa6e{DI4N{7uڦ zF͠.˂Jo nsxyeKu >Y*OKiՀ.S[<}m(=cn/INIENDB`iptux-0.9.4/share/iptux/pixmaps/icon/icon-monkey.png000066400000000000000000000037241475473122500225370ustar00rootroot00000000000000PNG  IHDR;0sBIT|dIDATH͖klw^;;]?b;^&')B@i)"JZڨHP>*ԴTmJA"" *-  Q! !F?c{}y+jG:3=ށԞgݏW]kOvڀmkzamaW}7p7Qj;8T'N,߼+օ*ޣ$ _ _N1cɢ8RKc}mFk;H!,#9M{#Hko|tzƴ^Hw{\1"yg,ӡND1l;^z&>O{9䃍s r桼uK9$ y_X;ĊG@nZ^>/JWIΙ̠>c,듵g3ֵd܋o?W=k:i3V|rL33,Lz:E%+UO1#ѺDےoK1N[h}8膅ݴX2f_K)Hdk~vtz䊧.&1w)FxRu>1G ^@eVYhϱd;^!m{Yspٝ4p;# !0·[H^B팏X(>NC pH"I>'O.xii.BPE5F@0}Lİ"F[[hicrٔSۂߨ>'roܗ5:ی6TA iҜ~ [l!i/*6n VxV)cM 2'%eeF5C^R_Ǒ}ҳ"V@XY[rƪ]Ȅ[U5)%B*I-p $5ѬNӮRJ0dN*Fݿ;\|]}v)pt7g? n%v1%0?ʦ+CΘVjPc#(5҃O@3AIPE`@|6Qm0 (tG6ZmFWN V#;xHɞRv3N}Iܪ(rÀ*CדMe[WT[1މ˾ӿ LsTuBm}6VvͩF/V.gdu"9"95v9=y,vF?Nw%-S3A! p(_"BFmJdzfmNYDE*u@o 쎧)D|dl{C  3|@ @h4@tevߺe_& .vuvdp?tn %! |{GFqdgg' ׿΢ƛ%QnZ޷֌uݭ\D˲ ɾ_)m T^P9 _1{b&@1cU7yԋ߻.sz5X#vlbbo7 DHy Oysh2P"9_mk>>f;~zC/Q=1yԾOzsyL@AQ)<@Fg6Jd\D\ 5pfzcRq޷m/6MdQ`<+L >ɢ_l?ҪxKnDc Դ]tDឮ}{yrrvR='j8E9(R:} +<RIENDB`iptux-0.9.4/share/iptux/pixmaps/icon/icon-penguin.png000066400000000000000000000034471475473122500227040ustar00rootroot00000000000000PNG  IHDR;0sBIT|dIDATHP?{''It@Pi阉!mGlδS&3Zh?NC*F3ӨLMʴSb4`(*b 98eqq~gޙ}>yaRe!pLii69٘_*U2mڴlt:żyO>\ XQׯO۳gjN緀@L*//АBr! ~k'aDQoΧ I dcǎE2i|ify"7Kn2TVVFn`x܊ I"nIM!D53\{}љjRXXȅ (++#??\hrЀa$lt:}V/vܹ5O !v\Κ5.''̙3LXNZN}ˮ]_$*O0 5P(!νuJoo9rm"R@nn.H$B,rFFU 1x}VY5M#'' Z {NBf}Oө,֭kgFj.G9q+t_" ^ oi@:ecp2'z#]%&\x# zᨒbc)} O]M8S#z+q=dz%_TҪU1U_"+ [piLdx:8Du<67ǒ5 l #:  F[7^>ŭ^o#Q}g> DV,v1dZ`'h3-t>}2g?*2;ztO'%Wgۮ~S{#SّiV}Nvh}~SX$qIENDB`iptux-0.9.4/share/iptux/pixmaps/icon/icon-pig.png000066400000000000000000000043641475473122500220150ustar00rootroot00000000000000PNG  IHDR;0sBIT|dIDATH{?s˲.VY@FA"DB#&TE6ڴiڦ61V`RS[JAuw5;ٙ7In&ssg\ڈc/BQs?}Bf9KnhCպд( G$S; йb틎 ! %=}amX3D=ENbNBCPs@z`˩CBhm2Htz%tPd1G;Ş60`@7ZVh*]KEUXGRTm!s<^E咍 KEQ-bh)&(? ;6]efɚCyrBqS2{RM&) A DoQKq&&qrE- " C bEVgefO; ]=tP?0H 2"\BsBsj8gvڅmݿ?;w$b44 kۃP DV+h<%Y=龓PfS-J @?۶m#N.[n|>ϦMm!o؀8 B7˗Yv|3~Әy[!`.&L__eY~=6l`h?cA< vX Դb딞Guj:a(=! oA_qO碜8T9DG/`Z+y2Gilo*wRň @@SCf*e!3_# f2hh 7 %f0 Mb!. #!ׅXu5, D'~Ov]JUmL{ %Bq0Uֆ@oP7JYh;j=>ﯹ\_xdsk-2=B<(_Z3 ZPeQg0 σvB$_ヒ@2IH7B=^hP wM`4D}LEEz{A y) W'FEfE = xxٷў-.H0͜4C %jf,?O>ꘚNdپ0P]N&W\EEұv{ f^ ~N Vx(C.5k\J'SޤWxch\Qg h/%7tՅ% `:NgwJ;?toerl.lhh 5H8Mj U jUJ%(; -m ]Hs%6C?3cҍV|&(s~R$m8Z aNPTM70L֎~\ XQ Sw޳)fk}2S^moI)g%;9 @@@T: #5(I(x+ `V >C#Wק,Zn =NQ>4'OīQ4;@UBY(Yچf D-WN;sG3@Kw=syݝ)8I3a2V*&t,[΅Wo"t)|Y+|;/~'|2 s|!1#ߙƺ~ѾUO7)HXD6BMM m?oyi||g񿔸nܲMW޲+m\b: BHqTώ}_9x4/3}ιzy.ӒH4&'&'?1^?=8M %>߬z 7? ~IENDB`iptux-0.9.4/share/iptux/pixmaps/icon/icon-qq.png000066400000000000000000000043301475473122500216500ustar00rootroot00000000000000PNG  IHDR:sRGBbKGD pHYs  tIME )$]&XIDATHǕWKl]W]wq⤍SINC R?(  3Č!EHH !*ʈJmMƉ>ۉg|6TE-mli-%m< IVJNs&@ܵTEcہ߸[ <*\.=9Inw{Λ;o,s0r?788ё JWR(R!W,=OM3c&3[pj<2'yǪԞsH;&`$N̡T,Srn$ruvgmsG(ת}OyFFpr$Rb0paLBeXZ^BS?lnc\)5_(oƞ=PJsP Q" #Ԇj#( b!啕c'C ䷋|^ʹѨT`iy ]DCm <Ѱְb!+%C䢇Z*SJJ$}667{"g( "\ZϜzv`uuZkc!Ev*R|Eg٧KKc>O<>CSv1Z#K3|K1P xUf)`O\kcq1Wqa2HY #$sh>HOhlw9P7:+ yM<>=UZDI@QV~?M_Ϭ=/Ͽ^riH}+_] P."4PבeQlu璘;r-;֛ۗѫ+}6ڭ\_ (Lk5\qqZt|;i} *ԳˣUŒ╖b]Ðf) aAvD4KQ{ՏnsūˣSѓDt_rk3KŜ&zmxdH YA߀g Dc ,E2.,,"L.+J ?ܭ3L]p<_ [S/ &dWcnamm kk(nag6q Fu<S-y%9!İ%NXg>[ҕK&*]X8j]ٴ6ݶ;feB$C2ljgIz| xYx7sUƹN/kշk;Ng!jW FƁ`W.b) t$Vgjg8t \; v|$!XAN!I`4ٸ}1\0',n:8o{[ Ĺr %9 X Ґ28& # 333s A223GZ˴$0"%|IqZXT(KIENDB`iptux-0.9.4/share/iptux/pixmaps/icon/icon-rabbit.png000066400000000000000000000032571475473122500225010ustar00rootroot00000000000000PNG  IHDR;0sBIT|dfIDATH[h\}sӌ.sŶD⺖_HTA:&׭۴5$% ֘RbL[p'!$NL1 'K\;*rHYn̹݇qZ{}!X,*ko'Oyͅ_^_xvFj6-f?OOtzNS?Ɩ4\6- >{@ X,O` MB- MT 0cSm:h P QQM&H|)ΆáCCut]G)}S暟f!іNMM1;;븮 (<!xc_Q re"\9(RJ<|qrBZ%Bhhq,~L7S’e1 xT*Ʌ 9z(Ffsa`&iyr)=-9hqG8w,ҖoHL\nӧe>30(*ZwӓJ/,zV9X/u]ar]0 R1<<g[~ (ũkի#o5`LNN%1MVEz48mX_oT|u[XV"|aY֮{P}P%p^fe`JA\#TH)RB)!Jx|\M:ޡߙ|ȡS^?^3r1ab(m|OR-Qj_wM#/>}ER?۹{Ͼ<6M"+YXa݇v<[~}=)Q b{6L)CYnewKjMM55h+lAk\T99G[lB$ٺƉƒ#lXHn~ ɦ]fiF(DI}ޜu!NZg֚i]~'k& Qg%SU8vcM3ք˞ Tg=IZim¶%BR,TdpC K8 5gK;)pöPH{4sFYF&A7: A3!Lti4Ri9Dfy-a& IENDB`iptux-0.9.4/share/iptux/pixmaps/icon/icon-teddybear.png000066400000000000000000000050101475473122500231660ustar00rootroot00000000000000PNG  IHDR;0sBIT|d IDATHi\U-z{zYg,&,!0@(Ha!(Z*r~A-E BL&2$齧~-$=Թ|}_b^y(|cilh-‰g5>mOwFW_ٚh#GM]_!lE{`2j 3k;;\9*O-44rE<,bp>ѓK??Q.H8r,8ޡvhzX&/,E 1I0 kO|.L9c+nvXcEa6$gళp;Xp,^>?BU#mwu]ƹ"PTiM aXzp C)%X8 4J4},ݨ;"k:jjp}pxQ`جga2_5P ¤X xu۩t@h|#I]+$XoPP^?!,ٌs* 8m\لSU&ru <^ P,k #VR+6~{u8wv!Dxt{$a NB!T |0=ϥ;4r|`,FgX+cϟBYRKeM>5bUlTSQçRO~T_X.v!e*ed%eӀW!*fϢ(XѷW`ZCaSys{k/F jXT VB1{/'?˗m7dִ1=~X C;aU-èk:R 8lh49=<>%^sˠoT~Y< Ԑ/J0 R9GkakƱ qִ9ɌdE]6/G7n?&fwdU#(t^Eb,(,:kڎx#2:`$`vZn._ՏwQJGL Vy ?څIYƑ;pK,3+,<mHy?۽#tVw+/h4!{Sb r9qbxu)qGRJ CrYRΈUEI_E]UL[WY20~&-h:":X-u%]ƠRw;:dIBw(|NFJ8kF\D0K86*Z,Q`( >$6(\^Q94(C)H]6^ Yj VU^)!ȁ]`6Bn\422.QI8-4BkEӶfKf j/8ƙKPEuv84dE(k4l !0r0Z{:P$h*ewÙSďk|U kS[eMY $)5 S **2@`8VĆסяNm󹐪Meڇu*i8R"֮nA"pvD:,VDxDelߢ47myjT"׏VJ'஑marаxfFMEEQ ˱ǙhVn8|b![P7, 17~L3iU3.BohcqtF20\.pR ҹl^l Z&$C`hU sYk(5;MorpyUY3uTΩYTl6w-I7N* &㉴#h,gkour1\ú/oF.63l~-fat11J4^JhTʦ/n;!xl|sٗ{ڽvqbۊbAQT 4 yd>MŴRE?iD8Uhld=~wx8=~4ܤgL*+\:ygҵktY+sL hS :4h87s1{,8Ǔlf)Ł⢙͖eY}P6N,^vkë˪lEۜ9y*/fɲT<1Wxo%_4LXݹ07?cީ?e_Kvq_㴲g\5EMN>7޿B>EqQIENDB`iptux-0.9.4/share/iptux/pixmaps/icon/icon-turtle.png000066400000000000000000000034401475473122500225470ustar00rootroot00000000000000PNG  IHDR;0sBIT|dIDATH{?󸯽]Xy-/[mZ (%T,ZM۴&MkDZcZҐj4֔KP@E].w޽Νy􏻨4$;9|眙']t8;l׭`mg̖4C7̔KSb0m-;f( !k(-P:B>\ٿឥo/?NL@#PJ6h-* .E#HtJ_+-.+={osrSa[ @)= 1BQF*} G*C@$}z-C[g٭)"$!J17qACH=:j@2R?z /MK6kMч"]tSE:BUՑG) 8Hj9wx]RëOHO^x%hTJ8F*ʽ pѲPsyȲ%%~3iM!"T>BQagC=L(B 1?x/s=󓱎ER֩gqb *J|v %K壭"lY]3x6@:yF0cYeq&v= 3Q~ÌH[H9Na(^Qv~njZv۴_~螰eMqwNjxώO`Cn[ &MxGXpxDM"J5&6@sB`y DR:4k2  ISu|-1d2I[[w\>Ϝ9X|Y /2cl[^jZ`HӦ+˾BqdҚp:V3w*TpH&hٺu+&Ν`ʕLz-/Pz^OڐJ$tS2eČ~1.كuҔg3arJ-k &$Sf!fXaaH gfC9ǘѾ65qg ͒砷fjæYysB!ZXIO~V5FD!玎˹+Ws4Q}mĞȐTI 'hLwpMd;:Z+u/JfDcf%/I%,Ὁ㙷ggNJǷmzGùܟaBD܊PTLG7onJLm~tߎ$R1 $u*Alnh7xy-R,O@ u {`k?(}"JZD,K+均}(ptUKZïOiN۶:[=3G/?Y蓡(/H˗IENDB`iptux-0.9.4/share/iptux/pixmaps/icon/icon-tux.png000066400000000000000000000037001475473122500220470ustar00rootroot00000000000000PNG  IHDR BsRGBbKGD pHYs  tIME *uc@IDATHǭ[lg{zg׻kf8`HQ)*6-ҾTK"C_[VR~ll 72Aݾcǎ#Lϲy~*Jٰϙч lF?6 ;i @4Be6Ms "0b7n>+ʳ(pa`̌[VjA@:Ʋ,( Q0Eij@d``܏iY8N;vl6`P(MMb߾}twu+$ %P(t钘*W._ d?m> SUmvl#@ljyK5cL\s7yYΔ(?94ܙ!k,ItY]THbߗ a&1%䞆  \}l5Ԑw8ʞ\~vC_H|}i<1UHՖgJVVԉ'i uݷ?^Vk!RT*R###O (6 !OhZTjd@H)iiiСC!4-*_F^5Mۭi7zzz.t]_E) /q,VU !uyB, !WJUki,Mt`uaǹYh<u1 ˲i~KӴϵim6Mso,"ַ }ibiO l5LX"Ll߾.lMz}D"(ibair>lOdRqR= }_Dq]Y) ٬zfmo6h̀__>QQ[$d봶y>(R_-:6~EhFkΞL}w7ϫp{IbǛ}&v>J7pk qGyxG ~|DSn޼IsS_Iܵ5 |yKLvׯ;w1:&=[\B)kXrYz6ѽ ߃VW*/N-?yR7il:MD""o\c$ルJ2F xt*##XzpԈzjw9]0Ƃf,VPA 1 L'YlIDATx͛y\u?SUNI:NB "BT`&ѹ"G+:8yFQ4\@&{ҝRwrSU u]9}r?󫣣c޽{?e˖O&jZ[[u=(  錙3)rUG\.f.}ʙ-j봲NJJK1ƠZ%58@_KOʾ ھ1jG?ܷbŊ-[_TUDDu?i\Z#WU.9}yލ;# 1v4UUYߦ:,^x<x*ا>spՏx;_'2GW\?3ZW]QNii)ee=~,PX!ဓW* T0L6˻nww z YV7Yvwe8okrYe5`&!=ttv380L&i,~&K)(õJEu55̚HM`-@&cj?IgG?{xq|VwHߟmc3YgtykMj q"ωAuZPhTY-](̫+gNmKMfOi!}]9|ѶcתU PU.y֯-kSWN>s^zziKZΞP@ZbD* ,~`dHYhb.^89͓hH]yW\O4PdϮ=@R^Iz0s*P_9bly^pX#0o7ܹ5_k.OgoP;I/ =E.P%c-N-c錉,=YTG;{ymq>ȦI>q g2k.Q0Aڻ7C;w@Rvjxi?Ѯ9tT   BS(g[ҾY\wY6-oxv|&VKs{W.?E_OoݲBN\[%"+TUn/^`57͘cҾ':{ch-t{#Ooe _~7s'־}PYMic]T{߂1ٽG7 XxiPR]?mw.4] z>D~Sk&Mu3,}ډM8!-[A!8;k.:oRx2k@5yݏ\ES7e}!~W@?6 VTO ԒL։k-2ZgAG?]PiX@meT+LH$=%TNq,O[?hUU(`κul~i9 sbQ7DWG/X0&._ HJRpj+\Ahb(JxjA^y y."*euu:e2̕kv5kwΚ5ko8Ԫk/[2ΒL1a9Ͻ+k ( Ƒp| 0Fàgy@]ܥd/;w#'~%:{~}7*k֬ T~s|>ڌ#^YE&ӓ#8N; )0./kU%&l||n'z7tSᇛvx֊EKW]8J~Y^p\#Bi%e03[R~@pup;xh_SK<,aY<.w })kK1o:"B:XT:,l:¦lڴW&;{y%5

'5¿1l+TU4mSU` /fxs1k{6|q"?*Y5t#1t5k)\9)*Sg1aG ED$G E ksAXuӠ}r旞x =P:a 0 VUY0aB8En,2YUztJy)o :8@[l0"RWQvU@\1^To۶=Z4 AGY6ǿͨ)'U,mf1@r ŵC Yx upbJcԦisy-ZVS7kNԷ]כFWFruxr8 &Se9]k0?&%B9#CL> q\1HuC}kO/klBsHaEay;ڇ#|bR.i<掩r80r+yo2D-|*P 98Q F1 `Bѣe%5n2D^8(1yp(%pmT?ߨ_xPc0JP؋GX`2M%c>H_qEcF'y7sQƩjH:Q|8ߛ{3g3_,_TwW(%߹B+||F=s2sZl8ĸ3R`J>yK<#\x/dơyluuMMܽ{ TknO19'jr^}9+R:cR9f)p{-픏"QP4>s"3c*ÜrS==tkȤp{XQю+< 6eþH"I@  4T0" #oyH;Ӕ#?byNL'G`D GJtBj;vnNWb uߺ||m1̘.@baB_vn]3BHy1Ԡmn`&! 2!/x,$E!qt>9kߣfm[HOj NUqa- =A1CW2eNeޅ^PH`6p]:!ݍAu7W_ho>?BvCd2W^y3"q᤟)3# j !z3>,Ol!ᑂϸ(ޟ\9.xX ;ׁքJ100L+;>%9CoG*P1*)A 01.C8YCl4 ?4;~6I_)hUV\{Ͽ^6QkUr@C.6tstE%,L3Bpt gwL~>Rx`NbpϨ8ZRCD`-bhVqDh;7ԏSN\nڴ=Vȕw-?8nJX%1:px 9䮃]i{l=+ڷ ;`OkL,iжs;G`7J)ov@6`4E1^˅+Eb N:.ƅ\GDzհͦl2gW7x+qSS7nvx-myy҃C⸞_rz"E #M\VZF~QoQ RPꦍ8p|cE|+a_ 0خr&ok﫢EiyGx^t{7}ݻ016?M37hk+ښ203ZZZa8^aּ*&NvU* Z}pIdUIf.UFUH[eBBR!6\PQ[b';k/}+3fmܺ-=S>piKn7_Q D| 4P#&4/aW*d4,[52h!%WTޞiUnIg7\v +Qݷw9b@7qYEC6}&.^"aZP<P| Ak6.yOΨSY%nMUfU[YSSӖoc^{n?h{׶ r@6q8^L5|fб;~ϯadz af5)8(p%yp},=>K.yw=0;7}ls=R&ϝ\:i ƨl6lvc^'D(qZEΔIC* ɽOk7žW3ړ=0q׆dž&u~o}%~,Vݤx%1FZPɓC"[lyW/^5dN{-=m[ӧlx+s?N<0 W\qz|hWnxUu#" عjK)ƷJ0WVvzEd }m:rIENDB`iptux-0.9.4/share/iptux/pixmaps/icon/iptux-icon.png000066400000000000000000000200701475473122500223770ustar00rootroot00000000000000PNG  IHDR@@iqsRGB pHYs.#.#x?vYiTXtXML:com.adobe.xmp 1 L'YxIDATx͛{t]ukK/Kޖ,[2~Ɛؔ@N' !M;J҇HZFp6-$4MIɥc%ْ<ґccst$mh=cqs~s ~/cM6qБ#Gvl2xWW ]qw}l̙ +VZlY;ZtG  _ ]dzm 櫊ZUUS+"6c!96FNqcŗw=n ~a/eƏdU~c7|lMqYyyYETO 9Y% 8:88qyxY"`+fXZYŠ3i`Fe9-͵4D0(]g_=>_>&[nݺ6\z 7uyKRK228pbFӠ 1KP H@`0ƀ0ڐt\ѐPjn_2ŗXˬ-@9#v'~_7޷?OV^}p%h>Ѷ95OG75o6×\Ęgzx}q2,a(3lXB B6NaNd IKQh1:i Fk1 }GFni(gEC%DXu=R Gyt?ϝBj=J׺լ^2Ғc@|}7/>$r#11vÆ ]] lۼ}[cnyotjlL%8~D[ ι|m@׆~O$/Ջ/aeK#ELf=>͖]yb ӌ:|++(EB`$޻wcm٢簾Fnasҗm|m\Z[Ibl\<;> B{PSd^u9!%/z!%W[UmsH'|2%)-xq) M5EqCPQ[ [α=gCzl?OJݸ+?m˿pMW]c<#1N%O`[/4m)h:\g޿%|$"ek8;]Ep+4QR 3kT}kigͯ[N>|ⷣ"o|?3o'F9y'->S)3{!B" $%]ý gU qBw"Y&\lP]<$RR ք,•WΖunذkooM{|sez ڔk IY-YR2ilş}`9* ?:D]#$\QܦZ둶 _:汝޶mE.ѷXt]eJ 8g\7;-''c%@mOƼh/ iIBOdyvua(K£RZ?r{oo.E/ww߷h\L`)S ѮS9#'pB"#YdZ{ObIӹjPRR4-_ȍ_^KNucXv {X6wnT#'2H)J70.1mQ!҆YPW0vcB0HwOE-12oNU%d!qEҊЀտ ol<1"XɝFORTY##=A)5RB>jIưq)5!B0}Y6nn~j6B<3C(% -^ڹaΔ,DEO边Wm1b,&9B &{H /b#$ՖbK o?Q׻K)U# @Zc'ObY% CI}#ʾL۶mS>u{w 7PqH3b$>u3DAĿX^H~ jyAb4a iOX/d=p2M(Gaat<2KZ@rB‰˲95j x# =Rwm?xޥܿͤx2x*EMOfߠ! 0ScȌ3'g`yY~I~^9K}"jI4].$ +҄ƲZ$2.7*=pnkO?5si&&~ Rby2H6Fk@h,PjIP7? ޖXetPG\FP#]l[%%M^X5A;̓_^HkTJgRIJ;hO#/Cd~ iCBD`Fe̪*# Hsw݃҄#6^p*".)M~#z* V I*/!dK"4RŽfYĂWߘwu!#%b"u]E\ŗ?YcS+5+Y6U \W^XT墵,a)odfU)G3$2H Lm]E2ȸ FMI?r |څ|dyFCĒ[- t:Jg,Å3xO;,%)ijʒDl)l)6̑;sipy÷|{xgAx1UPL'oVYX\TӃdQ$ʦ<T?\`ҿ<@l)ȈIPJ X p~OzU% (oBk-.f.rӖ 8*9̈.,y(8p* J#.Rg`|ڎ<s 4#!'E*gf mrabsp%#AJR q[,Z.&-G1?bOCL@IR6 pA8oRB % `w]qEHgfk/tj)Snp :/ϫֆBv\~8F'(%fW9ɋin0Do8`)AVo@wn5Ֆ7aJxy o]d7WRP#4B azՕkBU8{T~:2<%Xs%+. <_:eG?R0u[ʱs\M/`H`El"1\pFzY]|"+c|9A`EK~AL*@.P:*t{Y6 3'd1._eMYj=ͬX)%)z./2E-1 >2i\#[{2Z_AE/-B"x,){[}gM](AgPmjk{g\ m MEy4@OS(G5 5%%1έ v- W ]]x5rg)ql *(A |e-H{*ׄZG{F3I-mGCyV(! ~xQq+bjt|wM" v&o[EFݳw+Z/$qң򒘔 k;- D"6m(~j~~-j3 V4,h_ͯ唃f=_]E \MG ;,1`J.l3݇_hrī2 ZiYʉ8KcSMSE '4 HJWV$4 8C;hex>W=Hhn]ܵ^_ƚٕ L /$f)ƌa}MN<{cYQ[c5nq3sʰ@0rKRA/O +뤍_kexgݢU /\gPV| rmo"k4Q+k(4! B痝)Iլ)ce,3 )# $D%<O|0R-%ΩIݣByjْC~™6$њGKr^Zc0fһ]m( ád1ڒp<Djl4^[srzwl?ouY?3..* 0bR07qA /@upRd3̠щgܿg5|>ŃIry]sum._UgΰQ  v8sBqq5Bgi['<2@ޥ7GzǓٓ }m X;֤_uW^%ªXDHx1Ɗۑ=C4{7u-Zh4zy`c;v|ܹsg?;12qua4JXHKh,f;V~sڵ/!.u? T7]IENDB`iptux-0.9.4/share/iptux/pixmaps/menu/000077500000000000000000000000001475473122500176075ustar00rootroot00000000000000iptux-0.9.4/share/iptux/pixmaps/menu/menu-board.png000066400000000000000000000070461475473122500223550ustar00rootroot00000000000000PNG  IHDRDb CiCCPICC profilexڝSwX>eVBl"#Ya@Ņ VHUĂ H(gAZU\8ܧ}zy&j9R<:OHɽH gyx~t?op.$P&W " R.TSd ly|B" I>ةآ(G$@`UR,@".Y2GvX@`B, 8C L0ҿ_pH˕͗K3w!lBa)f "#HL 8?flŢko">!N_puk[Vh]3 Z zy8@P< %b0>3o~@zq@qanvRB1n#Dž)4\,XP"MyRD!ɕ2 w ONl~Xv@~- g42y@+͗\LD*A aD@ $<B AT:18 \p` Aa!:b""aH4 Q"rBj]H#-r9\@ 2G1Qu@Ơst4]k=Kut}c1fa\E`X&cX5V5cX7va$^lGXLXC%#W 1'"O%zxb:XF&!!%^'_H$ɒN !%2I IkHH-S>iL&m O:ňL $RJ5e?2BQͩ:ZImvP/S4u%͛Cˤ-Кigih/t ݃EЗkw Hb(k{/LӗT02goUX**|:V~TUsU?y TU^V}FUP թU6RwRPQ__c FHTc!2eXBrV,kMb[Lvv/{LSCsfffqƱ9ٜJ! {--?-jf~7zھbrup@,:m:u 6Qu>cy Gm7046l18c̐ckihhI'&g5x>fob4ekVyVV׬I\,mWlPW :˶vm))Sn1 9a%m;t;|rtuvlp4éĩWggs5KvSmnz˕ҵܭm=}M.]=AXq㝧/^v^Y^O&0m[{`:>=e>>z"=#~~~;yN`k5/ >B Yroc3g,Z0&L~oL̶Gli})*2.QStqt,֬Yg񏩌;jrvgjlRlc웸xEt$ =sl3Ttcܢ˞w|/9%bKGD pHYs.#.#x?vtIME 8+mdIDAT8u]lUi~[veacl1@6,]4r#$HĀ^wBMDĘA0D&q6f +t]ۭ_=Iw'9<995F׉ lkފD؛q379J`k]2w;pٵ{)r7FؑS#tD&b-\j]D0YTW>[ 3UoNQ=fZRiS n} _@Pȁ[khhbB-bK@_+ 'M]'{{{_+|}{\-T"Qv26o:Y__o/|jq⯠@@_(aO\ɬϟWJboIye|.V]'Y a{i cŞ5X8xT7pmn*]HMUJ" IK[k0I光w٭ m`'@ Ժ8p]X(]EVCͭrx{[ M '87R;{RfR0 gEY|4Q(̕=}<|Ƒ3R9{-z}ۓ'oy.B ep_ @Wt6*<ɝ,MɏnӇ|?qqİke~M1)`T1s'΋3աo~S|)I/ߍaq# iBZ=J 7<{R~Bd.@ƽENVy1l Ł0+^ ̊f-Ϸ+;j=,ĆT/Xưr)S0dN%ST^#W-hⓊ dbIENDB`iptux-0.9.4/share/iptux/pixmaps/menu/menu-detect.png000066400000000000000000000066671475473122500225460ustar00rootroot00000000000000PNG  IHDR/\ CiCCPICC profilexڝSwX>eVBl"#Ya@Ņ VHUĂ H(gAZU\8ܧ}zy&j9R<:OHɽH gyx~t?op.$P&W " R.TSd ly|B" I>ةآ(G$@`UR,@".Y2GvX@`B, 8C L0ҿ_pH˕͗K3w!lBa)f "#HL 8?flŢko">!N_puk[Vh]3 Z zy8@P< %b0>3o~@zq@qanvRB1n#Dž)4\,XP"MyRD!ɕ2 w ONl~Xv@~- g42y@+͗\LD*A aD@ $<B AT:18 \p` Aa!:b""aH4 Q"rBj]H#-r9\@ 2G1Qu@Ơst4]k=Kut}c1fa\E`X&cX5V5cX7va$^lGXLXC%#W 1'"O%zxb:XF&!!%^'_H$ɒN !%2I IkHH-S>iL&m O:ňL $RJ5e?2BQͩ:ZImvP/S4u%͛Cˤ-Кigih/t ݃EЗkw Hb(k{/LӗT02goUX**|:V~TUsU?y TU^V}FUP թU6RwRPQ__c FHTc!2eXBrV,kMb[Lvv/{LSCsfffqƱ9ٜJ! {--?-jf~7zھbrup@,:m:u 6Qu>cy Gm7046l18c̐ckihhI'&g5x>fob4ekVyVV׬I\,mWlPW :˶vm))Sn1 9a%m;t;|rtuvlp4éĩWggs5KvSmnz˕ҵܭm=}M.]=AXq㝧/^v^Y^O&0m[{`:>=e>>z"=#~~~;yN`k5/ >B Yroc3g,Z0&L~oL̶Gli})*2.QStqt,֬Yg񏩌;jrvgjlRlc웸xEt$ =sl3Ttcܢ˞w|/9%bKGD pHYs.#.#x?vtIME5JIDAT8}Mhg3]'djjpFGkAJB/ -="<)ɄRDhi!"%4TBI4lٙyz$&x=CXvdnu瞣&sc[ I0':z&ؐ#Lu=pe3H&t>~ܖt`C'*:;4+?<<- TcZC @  vNxW=OB Gږ̵X w]BY$ zP NA1b_.ϭ2lшj_,,l)Zzdr RHmCtX]ʴvQ-C `S{ W%J[P1F0t@~yн|gD[N(D\[w[*=NW)c`D2=W?~޷)׻>Nj,75z `'}Vu7_v(}ԘKw,+loT䭊 M57n=*fF aUbfiߥ"ܭ~ygL-LʚW9 ,3 [BG~'ƞx?HeZ8Q^ƫ4<*ca1j",x2{]x7B:hٯ_=-K6 elE¶]v3 +S&MkwcV/IENDB`iptux-0.9.4/share/iptux/pixmaps/menu/menu-group.png000066400000000000000000000071431475473122500224200ustar00rootroot00000000000000PNG  IHDRDb CiCCPICC profilexڝSwX>eVBl"#Ya@Ņ VHUĂ H(gAZU\8ܧ}zy&j9R<:OHɽH gyx~t?op.$P&W " R.TSd ly|B" I>ةآ(G$@`UR,@".Y2GvX@`B, 8C L0ҿ_pH˕͗K3w!lBa)f "#HL 8?flŢko">!N_puk[Vh]3 Z zy8@P< %b0>3o~@zq@qanvRB1n#Dž)4\,XP"MyRD!ɕ2 w ONl~Xv@~- g42y@+͗\LD*A aD@ $<B AT:18 \p` Aa!:b""aH4 Q"rBj]H#-r9\@ 2G1Qu@Ơst4]k=Kut}c1fa\E`X&cX5V5cX7va$^lGXLXC%#W 1'"O%zxb:XF&!!%^'_H$ɒN !%2I IkHH-S>iL&m O:ňL $RJ5e?2BQͩ:ZImvP/S4u%͛Cˤ-Кigih/t ݃EЗkw Hb(k{/LӗT02goUX**|:V~TUsU?y TU^V}FUP թU6RwRPQ__c FHTc!2eXBrV,kMb[Lvv/{LSCsfffqƱ9ٜJ! {--?-jf~7zھbrup@,:m:u 6Qu>cy Gm7046l18c̐ckihhI'&g5x>fob4ekVyVV׬I\,mWlPW :˶vm))Sn1 9a%m;t;|rtuvlp4éĩWggs5KvSmnz˕ҵܭm=}M.]=AXq㝧/^v^Y^O&0m[{`:>=e>>z"=#~~~;yN`k5/ >B Yroc3g,Z0&L~oL̶Gli})*2.QStqt,֬Yg񏩌;jrvgjlRlc웸xEt$ =sl3Ttcܢ˞w|/9%bKGD pHYs.#.#x?vtIME)s IDAT8}[lSu?snQsC*E$$3^2%AB3L X@`1L7w]i{wOږ;:knZx>of_:&[&&y#_h绯4vľaUlG#e <L*Ӄ/v?;o]zbH)2 %e5D7$D"vXKJO.kSv'_D`ZOuo}+m9ξ;t}N'ȫp7o n r v4 .O7a===K?N,߼@nw=*8\3bß=ʅE$SPl=N]WėEl䚐-Ѳ Oc LMa:BxL[awnaeƙo8*ސ1E2DDZDKƋɼLǭJtS_v2_,cVg,Ӵ(MPB3g3V'uÏRi?N@Tga 4ʲd;<;sg,DbhXQ[(^lKas;v|%8!$t4"{g{l9y{DdOc)/OYNNK ]adC@qqJp_>FHVzPU?-WӵN?vQ#UϜZ?O;Ѭ 93i3RʧXRhHUG:BTA] ,m@߹uOp4Ľ "9UD^b8#S=ԠPTmgku|A@pswIENDB`iptux-0.9.4/share/iptux/pixmaps/menu/menu-share.png000066400000000000000000000070271475473122500223670ustar00rootroot00000000000000PNG  IHDR;mG MiCCPPhotoshop ICC profilexڝSwX>eVBl"#Ya@Ņ VHUĂ H(gAZU\8ܧ}zy&j9R<:OHɽH gyx~t?op.$P&W " R.TSd ly|B" I>ةآ(G$@`UR,@".Y2GvX@`B, 8C L0ҿ_pH˕͗K3w!lBa)f "#HL 8?flŢko">!N_puk[Vh]3 Z zy8@P< %b0>3o~@zq@qanvRB1n#Dž)4\,XP"MyRD!ɕ2 w ONl~Xv@~- g42y@+͗\LD*A aD@ $<B AT:18 \p` Aa!:b""aH4 Q"rBj]H#-r9\@ 2G1Qu@Ơst4]k=Kut}c1fa\E`X&cX5V5cX7va$^lGXLXC%#W 1'"O%zxb:XF&!!%^'_H$ɒN !%2I IkHH-S>iL&m O:ňL $RJ5e?2BQͩ:ZImvP/S4u%͛Cˤ-Кigih/t ݃EЗkw Hb(k{/LӗT02goUX**|:V~TUsU?y TU^V}FUP թU6RwRPQ__c FHTc!2eXBrV,kMb[Lvv/{LSCsfffqƱ9ٜJ! {--?-jf~7zھbrup@,:m:u 6Qu>cy Gm7046l18c̐ckihhI'&g5x>fob4ekVyVV׬I\,mWlPW :˶vm))Sn1 9a%m;t;|rtuvlp4éĩWggs5KvSmnz˕ҵܭm=}M.]=AXq㝧/^v^Y^O&0m[{`:>=e>>z"=#~~~;yN`k5/ >B Yroc3g,Z0&L~oL̶Gli})*2.QStqt,֬Yg񏩌;jrvgjlRlc웸xEt$ =sl3Ttcܢ˞w|/%ҟ3bKGD pHYs.#.#x?vtIME #KIDAT8ˍYlTuΝ3e,P۴Hӎu j1&!Ą\iD"&D}RQi 6,-2-tν%Η8(- zu5Gj0 u;\B]C=?mo(;uX-Mwi'ݰ9XinvliYoE~x{^ŪDt ~S}蹥ȮSO4hjw;E`e@"@xX0}dg' _3F~Y+#˔\&&4:HEoo'gJwp[WΞ?8H:QxWvtHy}=[ 8 v;26LO Jn.2; ĘFAd"{WYcqd't<2; PXYY#Xuu<~7o*%n[<} yyH@$0ɓ[:{`=@O$HdNcE"^8K*.^Tv֌0rnFQe%f &/]WW1 O{<؜Ndea:;3)ԯ"46YPL<ʪSUB!luu~?%H,Ɯ/ ~%:300T*ŷ==ʋAZR0M7ofalLd2a+o(aŲ̟ǥyy>hx@eii ]ut:a`YbD"ttNSMӊ='M0ѯ>IENDB`iptux-0.9.4/share/iptux/pixmaps/tip/tip-finish.png000066400000000000000000000014701475473122500222210ustar00rootroot00000000000000PNG  IHDR1_sRGBbKGD pHYs  tIME G4lIDAT8˕KSou?Csҙ.( f@B+JP*^z(CiC"2 %2Z9t]9דi9TD(!H5jl[W' IF \Pk"%8UehjS"c$EbωM sS@ a1@pه>HM).tYF!R03K\yKC-"L{>!EeV X50["}]J ɰ坹&.>,*` L#mu%Mwא/E @/B@Hz 4d-ldwR^L ȡ}DZM6S#O(2: sn;5"e!C*U"$qU=Ȍ*ĩzzOAp>1a>3D8C^BK~!igҼt{# ]NsaV]7ZDz\zlg D$C'@N,ǡJ153izwkzxp_'kEݳ'\N7ıD,Fst̹mO]]j|Ǹ!.,hSȗ,|nM~5`sРU暮͐ a3q}Oˁh+ |}IENDB`iptux-0.9.4/share/iptux/pixmaps/tip/tip-hide.png000066400000000000000000000015151475473122500216520ustar00rootroot00000000000000PNG  IHDR;֕JsRGBbKGD pHYs  tIME &XߴIDAT(mkfɲ,ųd;& Bֱ(tGAo#XvrtV:XZYɒ%nڲCeGg;n=} y\Jؔˆhʺ{"{fW7eg!bw( әU̗k)5]~-wecNwwIXq\ eRRJruS7ǍSe hPYUpj'E}II0hrB\$L6G,*_*> k[>g1xRy|*Cĕ_Kw9j<'PBA䅼,?NFO3t[cL'Ni>U0K6!m"ٴ` )X^CX'cDtIUQá@4WJ qILLRXXXVI2B"DVHH)QFF =? D2Bu9 i1D6Us}hI =ѣK$"^#!9!a`V$ע^R 5(lZ@1"LHKm[9T:kLǢ ۬ hU $ GX>d gy)|_,\@V{//K ǫxCuZRRy C @rfwZ. 0dPk ,]t18y(QˡKAȤxL 'ʵ ;Z48E(+a]aЎEݛ_FյEI;E[Hޮ9U(ԑ'㷯ͧcue ({p>mY;lnISIENDB`iptux-0.9.4/share/iptux/pixmaps/tip/tip-send.png000066400000000000000000000012601475473122500216670ustar00rootroot00000000000000PNG  IHDR/\sBIT|dgIDAT8=LSQ}}-մAbTRMdЄAb4 2%Hh$AL@E!|/|{ǡ5KιGQ\o;YiR;TĽr7:P:QZREhʞO4w_m bu)};\TT x⋙٦G=VL' ((ڰ}Û؋On BmFLz8Z0 Q8 ױjESk_BC/``;өa,' " !?Z_}{_?v7&}Kd%IqTNdoۑ8yMt$ٛz x% R saHKz*6x75bYd^NN.CX|Z8hΛ |TJnHP<9{5<(.CӎD@rV5X"H!@7u5kN:ZkR|k[rbEXjP&σAk )r(2:+hxL/`Ǯse(@)PP]"jvvW-4 /iFIENDB`iptux-0.9.4/share/iptux/pixmaps/tip/tip-show.png000066400000000000000000000015231475473122500217200ustar00rootroot00000000000000PNG  IHDR;֕JsRGBbKGD pHYs  tIME ?ZIDAT(]ouܯN;[vڂF k4OX^OГzZL\IHhL<i$A,qQi aYݙ '=KZLXS!1ҞTPUV8iwCՍ[?w/0@QTJutjʭ}IK{ܿzo*6")L$8XE{ gsђ|_*ܡ=B3d'LYE#%܀!6.VQ@gkMFگW.0H P *zFu{;U/ث۽KAE}잁2~(! $Te$|2wv %YU_=4yέc9L y io.github.iptux_src.iptux iptux

LAN communication software io.github.iptux_src.iptux CC0-1.0 GPL-2.0 The iptux team

iptux is an “IP Messenger” client. The features of iptux include:

  • auto-detect other clients on the intranet.
  • send/recv messages to other clients.
  • send/recv files to other clients.
  • share your files to other cliens (with optional password protection).

It is (supposedly) compatible with 飞鸽传书 (Feige) and 飞秋 (FeiQ) from China, and with the original “IP Messenger” clients from Japan, including g2ipmsg and xipmsg in Debian.

#376ea5 #376ea5 The Iptux main window. https://raw.githubusercontent.com/wiki/iptux-src/iptux/screenshots/screenshot-main-1.png The Iptux chat window. https://raw.githubusercontent.com/wiki/iptux-src/iptux/screenshots/screenshot-chat-1.png iptux Network InstantMessaging Chat FileTransfer GTK chat im file transfer ipmsg feige iptux https://github.com/iptux-src/iptux https://github.com/iptux-src/iptux/issues io.github.iptux_src.iptux.desktop iptux-0.9.4/share/metainfo/meson.build000066400000000000000000000025401475473122500177560ustar00rootroot00000000000000metainfo_file = files('io.github.iptux_src.iptux.metainfo.xml') ascli_exe = find_program('appstreamcli', required: true) sed_exe = find_program('sed', required: true) metainfo_with_relinfo = custom_target( 'gen-output', input: ['../../NEWS', metainfo_file[0]], output: ['nol10n_withrelinfo_io.github.iptux_src.iptux.metainfo.xml'], command: [ ascli_exe, 'news-to-metainfo', '--limit=6', '@INPUT0@', '@INPUT1@', '@OUTPUT@', ], ) # Localize a MetaInfo file and install it i18n = import('i18n') metainfo_i18n = i18n.merge_file( input: metainfo_with_relinfo, output: 'io.github.iptux_src.iptux-with-icon.metainfo.xml', type: 'xml', po_dir: meson.source_root() / 'po', ) desktop_file = custom_target( 'gen-desktop', input: metainfo_i18n, output: ['io.github.iptux_src.iptux.desktop'], command: [ascli_exe, 'make-desktop-file', '@INPUT@', '@OUTPUT@'], install: true, install_dir: join_paths(get_option('datadir'), 'applications'), ) metainfo = custom_target( 'gen-metainfo', input: metainfo_i18n, output: ['io.github.iptux_src.iptux.metainfo.xml'], capture: true, command: [sed_exe, '/icon/d', '@INPUT@'], install: true, install_dir: get_option('datadir') / 'metainfo', ) # Validate MetaInfo file test( 'validate metainfo file', ascli_exe, args: ['validate', '--no-net', '--pedantic', metainfo_i18n], ) iptux-0.9.4/snap/000077500000000000000000000000001475473122500136505ustar00rootroot00000000000000iptux-0.9.4/snap/snapcraft.yaml000066400000000000000000000025611475473122500165210ustar00rootroot00000000000000name: iptux # you probably want to 'snapcraft register ' version: "git" # just for humans, typically '1.2+git' or '1.3.2' adopt-info: iptux grade: stable # must be 'stable' to release into candidate/stable channels confinement: strict # use 'strict' once you have the right plugs and slots base: core24 slots: dbus-iptux: interface: dbus bus: session name: io.github.iptux_src.iptux apps: iptux: command: usr/bin/iptux desktop: usr/share/applications/io.github.iptux_src.iptux.desktop extensions: [gnome] slots: - dbus-iptux plugs: [home, network, gsettings, unity7] parts: iptux: source-type: git source: https://github.com/iptux-src/iptux.git build-packages: [ gettext, libgoogle-glog-dev, libjsoncpp-dev, libsigc++-2.0-dev, libayatana-appindicator3-dev, xvfb, libxml2-utils, appstream, ] plugin: meson meson-parameters: ["--prefix=/snap/iptux/current/usr"] override-pull: | craftctl default override-build: | craftctl default organize: snap/iptux/current/usr: usr stage-packages: - libgflags2.2 - libgoogle-glog0v6t64 - libjsoncpp25 - libsigc++-2.0-0v5 - libayatana-appindicator3-1 - libunwind8 parse-info: [usr/share/metainfo/io.github.iptux_src.iptux.metainfo.xml] iptux-0.9.4/src/000077500000000000000000000000001475473122500134765ustar00rootroot00000000000000iptux-0.9.4/src/TestConfig.h.in000066400000000000000000000001721475473122500163210ustar00rootroot00000000000000#ifndef IPTUX_TEST_CONFIG_H #define IPTUX_TEST_CONFIG_H #mesondefine CURRENT_SOURCE_PATH #endif // IPTUX_TEST_CONFIG_H iptux-0.9.4/src/api/000077500000000000000000000000001475473122500142475ustar00rootroot00000000000000iptux-0.9.4/src/api/iptux-core/000077500000000000000000000000001475473122500163465ustar00rootroot00000000000000iptux-0.9.4/src/api/iptux-core/CoreThread.h000066400000000000000000000131251475473122500205410ustar00rootroot00000000000000#ifndef IPTUX_CORETHREAD_H #define IPTUX_CORETHREAD_H #include "iptux-core/Models.h" #include #include #include #include #include #include #include "iptux-core/Event.h" #include "iptux-core/ProgramData.h" #include "iptux-core/TransFileModel.h" namespace iptux { class TransAbstract; class CoreThread { public: explicit CoreThread(std::shared_ptr data); virtual ~CoreThread(); virtual void start(); virtual void stop(); CPPalInfo getMe() const; PPalInfo getMe(); int getUdpSock() const; uint16_t port() const; std::shared_ptr getProgramData(); bool BlacklistContainItem(in_addr ipv4) const; /** * @brief add ipaddress to block list * * @param ipv4 the ip address */ void AddBlockIp(in_addr ipv4); /** * @brief whether the ipv4 address is blocked? * * @param ipv4: address * @return true if blocked * @return false if not blocked */ bool IsBlocked(in_addr ipv4) const; void Lock() const; void Unlock() const; const std::vector>& GetPalList(); virtual void ClearAllPalFromList(); CPPalInfo GetPal(PalKey palKey) const; PPalInfo GetPal(PalKey palKey); CPPalInfo GetPal(in_addr ipv4) const { return GetPal(PalKey(ipv4, port())); } PPalInfo GetPal(in_addr ipv4) { return GetPal(PalKey(ipv4, port())); } CPPalInfo GetPal(const std::string& ipv4) const; PPalInfo GetPal(const std::string& ipv4); virtual void DelPalFromList(PalKey palKey); virtual void DelPalFromList(in_addr palKey) { DelPalFromList(PalKey(palKey, port())); } virtual void UpdatePalToList(PalKey palKey); virtual void UpdatePalToList(in_addr palKey) { UpdatePalToList(PalKey(palKey, port())); } virtual void AttachPalToList(PPalInfo pal); /** * @brief Get the directory path to store the received pal icon; * * @return std::string */ std::string getUserIconPath() const; void AddPrivateFile(PFileInfo file); /** * return true if exist, return false if not exist. */ bool DelPrivateFile(uint32_t id); PFileInfo GetPrivateFileById(uint32_t id); PFileInfo GetPrivateFileByPacketN(uint32_t packageNum, uint32_t filectime); void sendFeatureData(PPalInfo pal); void emitSomeoneExit(const PalKey& palKey); void emitNewPalOnline(PPalInfo palInfo); void emitNewPalOnline(const PalKey& palKey); void EmitIconUpdate(const PalKey& palKey); void emitEvent(std::shared_ptr event); /** * @brief return event count since started * * @return int */ int getEventCount() const; /** * @brief Get the Last Event object * * @return std::shared_ptr */ std::shared_ptr getLastEvent() const; bool HasEvent() const; std::shared_ptr PopEvent(); const std::string& GetAccessPublicLimit() const; void SetAccessPublicLimit(const std::string& val); /** * @brief send message to pal * * @param pal * @param message string message * @return true if send success * @return false if send failed */ bool SendMessage(CPPalInfo pal, const std::string& message); bool SendMessage(CPPalInfo pal, const ChipData& chipData); bool SendMsgPara(std::shared_ptr msgPara); void AsyncSendMsgPara(std::shared_ptr msgPara); void SendUnitMessage(const PalKey& palKey, uint32_t opttype, const std::string& message); void SendGroupMessage(const PalKey& palKey, const std::string& message); bool SendAskShared(PPalInfo pal); bool SendAskSharedWithPassword(const PalKey& palKey, const std::string& password); void SendDetectPacket(const std::string& ipv4); void SendDetectPacket(in_addr ipv4); void SendExit(PPalInfo pal); void SendMyIcon(PPalInfo pal, std::istream& iss); void SendSharedFiles(PPalInfo pal); void BcstFileInfoEntry(const std::vector& pals, const std::vector& files); /** * 插入消息(UI线程安全). * @param para 消息参数封装包 * @note 消息数据必须使用utf8编码 * @note (para->pal)不可为null * @note * 请不要关心函数内部实现,你只需要按照要求封装消息数据,然后扔给本函数处理就可以了, * 它会想办法将消息按照你所期望的格式插入到你所期望的TextBuffer,否则请发送Bug报告 */ void InsertMessage(const MsgPara& para); void InsertMessage(MsgPara&& para); void UpdateMyInfo(); void SendBroadcastExit(PPalInfo pal); int GetOnlineCount() const; std::unique_ptr GetTransTaskStat(int taskId) const; std::vector> listTransTasks() const; bool TerminateTransTask(int taskId); void clearFinishedTransTasks(); void RecvFile(FileInfo* file); void RecvFileAsync(FileInfo* file); public: sigc::signal)> signalEvent; // these functions should be move to CoreThreadImpl public: void RegisterTransTask(std::shared_ptr task); public: static void SendNotifyToAll(CoreThread* pcthrd); protected: std::shared_ptr programData; std::shared_ptr config; int tcpSock; int udpSock; mutable std::mutex mutex; // 锁 private: std::atomic_bool started; protected: virtual void ClearSublayer(); private: void bind_iptux_port(); private: static void RecvUdpData(CoreThread* pcthrd); static void RecvTcpData(CoreThread* pcthrd); struct Impl; std::unique_ptr pImpl; }; } // namespace iptux #endif // IPTUX_CORETHREAD_H iptux-0.9.4/src/api/iptux-core/Event.h000066400000000000000000000067051475473122500176100ustar00rootroot00000000000000#ifndef IPTUX_EVENT_H #define IPTUX_EVENT_H #include "iptux-core/Models.h" namespace iptux { enum class EventType { NEW_PAL_ONLINE, PAL_UPDATE, PAL_OFFLINE, NEW_MESSAGE, ICON_UPDATE, PASSWORD_REQUIRED, PERMISSION_REQUIRED, NEW_SHARE_FILE_FROM_FRIEND, SEND_FILE_STARTED, SEND_FILE_FINISHED, RECV_FILE_STARTED, RECV_FILE_FINISHED, TRANS_TASKS_CHANGED, CONFIG_CHANGED, }; const char* EventTypeToStr(EventType type); class Event { public: explicit Event(EventType type); virtual ~Event() = default; EventType getType() const; virtual std::string getSource() const; private: EventType type; }; class PalEvent : public Event { public: explicit PalEvent(PalKey palKey, EventType type) : Event(type), palKey(palKey) {} const PalKey& GetPalKey() const { return palKey; } std::string getSource() const override; private: PalKey palKey; }; class NewPalOnlineEvent : public PalEvent { public: explicit NewPalOnlineEvent(CPPalInfo palInfo); CPPalInfo getPalInfo() const; private: CPPalInfo palInfo; }; class PalUpdateEvent : public PalEvent { public: explicit PalUpdateEvent(CPPalInfo palInfo); CPPalInfo getPalInfo() const; private: CPPalInfo palInfo; }; class NewMessageEvent : public PalEvent { public: explicit NewMessageEvent(MsgPara&& msgPara); const MsgPara& getMsgPara() const; private: MsgPara msgPara; }; class PalOfflineEvent : public PalEvent { public: explicit PalOfflineEvent(PalKey palKey); }; class IconUpdateEvent : public PalEvent { public: explicit IconUpdateEvent(PalKey palKey) : PalEvent(palKey, EventType::ICON_UPDATE) {} }; class PasswordRequiredEvent : public PalEvent { public: explicit PasswordRequiredEvent(PalKey palKey) : PalEvent(palKey, EventType::PASSWORD_REQUIRED) {} }; class PermissionRequiredEvent : public PalEvent { public: explicit PermissionRequiredEvent(PalKey palKey) : PalEvent(palKey, EventType::PERMISSION_REQUIRED) {} }; class NewShareFileFromFriendEvent : public Event { public: explicit NewShareFileFromFriendEvent(FileInfo fileInfo) : Event(EventType::NEW_SHARE_FILE_FROM_FRIEND), fileInfo(fileInfo) {} const FileInfo& GetFileInfo() const { return fileInfo; } private: FileInfo fileInfo; }; class AbstractTaskIdEvent : public Event { protected: AbstractTaskIdEvent(EventType et, int taskId) : Event(et), taskId(taskId) {} public: int GetTaskId() const { return taskId; } private: int taskId; }; class SendFileStartedEvent : public AbstractTaskIdEvent { public: explicit SendFileStartedEvent(int taskId) : AbstractTaskIdEvent(EventType::SEND_FILE_STARTED, taskId) {} }; class SendFileFinishedEvent : public AbstractTaskIdEvent { public: explicit SendFileFinishedEvent(int taskId) : AbstractTaskIdEvent(EventType::SEND_FILE_FINISHED, taskId) {} }; class RecvFileStartedEvent : public AbstractTaskIdEvent { public: explicit RecvFileStartedEvent(int taskId) : AbstractTaskIdEvent(EventType::RECV_FILE_STARTED, taskId) {} }; class RecvFileFinishedEvent : public AbstractTaskIdEvent { public: explicit RecvFileFinishedEvent(int taskId) : AbstractTaskIdEvent(EventType::RECV_FILE_FINISHED, taskId) {} }; class TransTasksChangedEvent : public Event { public: TransTasksChangedEvent() : Event(EventType::TRANS_TASKS_CHANGED) {} }; class ConfigChangedEvent : public Event { public: ConfigChangedEvent() : Event(EventType::CONFIG_CHANGED) {} }; } // namespace iptux #endif // IPTUX_EVENT_H iptux-0.9.4/src/api/iptux-core/Exception.h000066400000000000000000000024361475473122500204620ustar00rootroot00000000000000#ifndef IPTUX_CORE_EXCEPTION_H #define IPTUX_CORE_EXCEPTION_H #include #include namespace iptux { class ErrorCode { private: int code; std::string message; public: ErrorCode(int code, const std::string& message) : code(code), message(message) {} ErrorCode(const ErrorCode&) = delete; ErrorCode& operator=(const ErrorCode&) = delete; int getCode() const; const std::string& getMessage() const { return message; } bool operator==(const ErrorCode& rhs) const { return this->code == rhs.code; } }; class Exception : public std::runtime_error { public: explicit Exception(const ErrorCode& ec); Exception(const ErrorCode& ec, const std::string& reason); Exception(const ErrorCode& ec, std::exception* causedBy); Exception(const ErrorCode& ec, const std::string& reason, std::exception* causedBy); const ErrorCode& getErrorCode() const; private: const ErrorCode& ec; }; extern const ErrorCode INVALID_IP_ADDRESS; extern const ErrorCode CREATE_TCP_SOCKET_FAILED; extern const ErrorCode INVALID_FILE_ATTR; extern const ErrorCode PAL_KEY_NOT_EXIST; extern const ErrorCode SOCKET_CREATE_FAILED; extern const ErrorCode TCP_BIND_FAILED; extern const ErrorCode UDP_BIND_FAILED; } // namespace iptux #endif // IPTUX_EXCEPTION_H iptux-0.9.4/src/api/iptux-core/IptuxConfig.h000066400000000000000000000035601475473122500207620ustar00rootroot00000000000000#ifndef IPTUX_IPTUX_CONFIG_H #define IPTUX_IPTUX_CONFIG_H #include #include #include #include namespace iptux { class IptuxConfig { public: /** * @brief create a IptuxConfig from string * * @param str * @return std::shared_ptr */ static std::shared_ptr newFromString(const std::string& str); /** * @brief create a IptuxConfig from file * * @param fname * @return std::shared_ptr */ static std::shared_ptr newFromFile(const std::string& fname); private: IptuxConfig(); public: explicit IptuxConfig(const std::string& fname); ~IptuxConfig(); const std::string& getFileName() const; int GetInt(const std::string& key) const; int GetInt(const std::string& key, int defaultValue) const; void SetInt(const std::string& key, int value); std::string GetString(const std::string& key) const; std::string GetString(const std::string& key, const std::string& defaultValue) const; void SetString(const std::string& key, const std::string& value); bool GetBool(const std::string& key) const; bool GetBool(const std::string& key, bool defaultValue) const; void SetBool(const std::string& key, bool value); double GetDouble(const std::string& key) const; double GetDouble(const std::string& key, double defaultValue) const; void SetDouble(const std::string& key, double value); std::vector GetStringList(const std::string& key) const; void SetStringList(const std::string& key, const std::vector& value); std::vector GetVector(const std::string& key) const; void SetVector(const std::string& key, const std::vector& value); IptuxConfig& Save(); private: std::string fname; Json::Value root; }; } // namespace iptux #endif iptux-0.9.4/src/api/iptux-core/Models.h000066400000000000000000000143301475473122500177430ustar00rootroot00000000000000// // C++ Interface: mess // // Description: // 很杂乱的一些数据基本结构. // // Author: Jally , (C) 2008 // // Copyright: See COPYING file that comes with this distribution // // #ifndef IPTUX_MODELS_H #define IPTUX_MODELS_H #include #include #include #include #include namespace iptux { /** * 消息来源类型. */ enum class MessageSourceType { PAL, ///< 好友 SELF, ///< 自身 ERROR ///< 错误 }; /** * 消息内容类型. */ enum class MessageContentType { STRING, ///< 字符串 PICTURE ///< 图片 }; static const MessageContentType MESSAGE_CONTENT_TYPE_STRING = MessageContentType::STRING; static const MessageContentType MESSAGE_CONTENT_TYPE_PICTURE = MessageContentType::PICTURE; /** * 群组所属类型 */ typedef enum { GROUP_BELONG_TYPE_REGULAR, ///< 常规 GROUP_BELONG_TYPE_SEGMENT, ///< 分段 GROUP_BELONG_TYPE_GROUP, ///< 分组 GROUP_BELONG_TYPE_BROADCAST ///< 广播 } GroupBelongType; class PalKey { public: PalKey(in_addr ipv4, int port); bool operator==(const PalKey& rhs) const; in_addr GetIpv4() const { return ipv4; } std::string GetIpv4String() const; int GetPort() const { return port; } std::string ToString() const; private: in_addr ipv4; int port; }; /** * 好友信息. * flags位含义: \n * 黑名单(:3);此IP地址被列入黑名单(deprecated) \n * 更改(:2);好友的信息被用户手工修改,程序不应再更改好友的信息 \n * 在线(:1);好友依旧在线 \n * 兼容(:0);完全兼容iptux,程序将采用扩展协议与好友通信 \n */ class PalInfo { public: PalInfo(const std::string& ipv4, uint16_t port); PalInfo(in_addr ipv4, uint16_t port); ~PalInfo(); PalKey GetKey() const { return PalKey(ipv4(), port_); } PalInfo& setName(const std::string& name); const std::string& getName() const { return name; } PalInfo& setUser(const std::string& user); const std::string& getUser() const { return user; } PalInfo& setHost(const std::string& host); const std::string& getHost() const { return host; } PalInfo& setVersion(const std::string& version); const std::string& getVersion() const { return version; } PalInfo& setEncode(const std::string& encode); const std::string& getEncode() const { return encode; } PalInfo& setGroup(const std::string& group); const std::string& getGroup() const { return group; } const std::string& icon_file() const { return icon_file_; } PalInfo& set_icon_file(const std::string& icon_file) { icon_file_ = icon_file; return *this; } PalInfo& set_icon_file(const std::string& icon_file, const std::string& def) { if (icon_file.empty()) icon_file_ = def; else icon_file_ = icon_file; return *this; } std::string toString() const; in_addr ipv4() const { return ipv4_; } uint16_t port() const { return port_; } char* segdes; ///< 所在网段描述 char* photo; ///< 形象照片 char* sign; ///< 个性签名 uint32_t packetn; ///< 已接受最大的包编号 uint32_t rpacketn; ///< 需要接受检查的包编号 bool isCompatible() const; bool isOnline() const; bool isChanged() const; bool isInBlacklist() const; PalInfo& setCompatible(bool value); PalInfo& setOnline(bool value); PalInfo& setChanged(bool value); PalInfo& setInBlacklist(bool value); private: in_addr ipv4_; ///< 好友IP uint16_t port_; ///< 好友端口 std::string icon_file_; ///< 好友头像 * std::string user; std::string name; std::string host; std::string version; ///< 版本串 * std::string encode; ///< 好友编码 * std::string group; ///< 所在群组 uint8_t compatible : 1; uint8_t online : 1; uint8_t changed : 1; uint8_t in_blacklist : 1; }; /// pointer to PalInfo using PPalInfo = std::shared_ptr; /// const pointer to PalInfo using CPPalInfo = std::shared_ptr; enum class FileAttr { UNKNOWN, REGULAR, DIRECTORY }; constexpr bool FileAttrIsValid(FileAttr attr) { return attr == FileAttr::REGULAR || attr == FileAttr::DIRECTORY; } /** * 文件信息. */ class FileInfo { public: FileInfo(); ~FileInfo(); FileInfo(const FileInfo& fileInfo); FileInfo& operator=(const FileInfo& fileInfo); bool operator==(const FileInfo& rhs) const; bool isExist() const; void ensureFilesizeFilled(); uint32_t fileid; ///< 唯一标识 uint32_t packetn; ///< 包编号 FileAttr fileattr; ///< 文件属性 int64_t filesize; ///< 文件大小 int64_t finishedsize; ///< 已完成大小 CPPalInfo fileown; ///< 文件拥有者(来自好友*) char* filepath; ///< 文件路径 * uint32_t filectime; ///< 文件创建时间 uint32_t filemtime; ///< 文件最后修改时间 uint32_t filenum; ///< 包内编号 }; using PFileInfo = std::shared_ptr; /** * 碎片数据. */ class ChipData { public: explicit ChipData(const std::string& data); ChipData(MessageContentType type, const std::string& data); ~ChipData(); std::string ToString() const; std::string getSummary() const; MessageContentType type; ///< 消息内容类型 std::string data; ///< 数据串 * }; /** * 消息参数. */ class MsgPara { public: explicit MsgPara(CPPalInfo pal); ~MsgPara(); std::string getSummary() const; CPPalInfo getPal() const { return pal; } MessageSourceType stype; ///< 来源类型 GroupBelongType btype; ///< 所属类型 std::vector dtlist; ///< 数据链表 * private: CPPalInfo pal; ///< 好友数据信息(来自好友*) }; /** * 网段数据. */ class NetSegment { public: NetSegment(std::string startIp, std::string endIp, std::string description); NetSegment(); ~NetSegment(); bool ContainIP(in_addr ipv4) const; /** * @brief return the ip count in this segment * */ uint64_t Count() const; std::string NthIp(uint64_t i) const; std::string startip; ///< IP起始地址 * std::string endip; ///< IP终止地址 * std::string description; ///< 此IP段描述 Json::Value ToJsonValue() const; static NetSegment fromJsonValue(Json::Value& value); }; } // namespace iptux #endif iptux-0.9.4/src/api/iptux-core/ProgramData.h000066400000000000000000000074001475473122500207210ustar00rootroot00000000000000#ifndef IPTUX_PROGRAMDATACORE_H #define IPTUX_PROGRAMDATACORE_H #include #include #include #include "iptux-core/IptuxConfig.h" #include "iptux-core/Models.h" namespace iptux { class ProgramData { public: explicit ProgramData(std::shared_ptr config); virtual ~ProgramData(); ProgramData(const ProgramData&) = delete; ProgramData& operator=(const ProgramData&) = delete; std::shared_ptr getConfig(); /** Sync ProgramData to ConfigFile */ void WriteProgData(); const std::vector& getNetSegments() const; void setNetSegments(std::vector&& netSegments); const std::vector& GetSharedFileInfos() const { return sharedFileInfos; } std::vector& GetSharedFileInfos() { return sharedFileInfos; } void AddShareFileInfo(FileInfo fileInfo); void ClearShareFileInfos(); FileInfo* GetShareFileInfo(uint32_t fileId); FileInfo* GetShareFileInfo(uint32_t packetn, uint32_t filenum); std::string FindNetSegDescription(in_addr ipv4) const; void Lock(); void Unlock(); const std::string& GetPasswd() const { return passwd; } void SetPasswd(const std::string& val) { passwd = val; } int getSendMessageRetryInUs() const { return send_message_retry_in_us; } uint16_t port() const { return port_; } bool IsAutoOpenChatDialog() const; bool IsAutoHidePanelAfterLogin() const; bool IsAutoOpenFileTrans() const; bool IsEnterSendMessage() const; bool IsAutoCleanChatHistory() const; bool IsSaveChatHistory() const; bool IsUsingBlacklist() const; bool IsFilterFileShareRequest() const; bool isHideTaskbarWhenMainWindowIconified() const; void set_port(uint16_t port, bool is_init = false); void setOpenChat(bool value) { open_chat = value; } void setHideStartup(bool value) { hide_startup = value; } void setOpenTransmission(bool value) { open_transmission = value; } void setUseEnterKey(bool value) { use_enter_key = value; } void setClearupHistory(bool value) { clearup_history = value; } void setRecordLog(bool value) { record_log = value; } void setOpenBlacklist(bool value) { open_blacklist = value; } void setProofShared(bool value) { proof_shared = value; } void setHideTaskbarWhenMainWindowIconified(bool value) { hide_taskbar_when_main_window_iconified_ = value; } bool need_restart() const { return need_restart_; } /** * @brief Set the Using Blacklist object * * @param value * @return ProgramData& self */ ProgramData& SetUsingBlacklist(bool value); std::string nickname; // 昵称 * std::string mygroup; // 所属群组 * std::string myicon; // 个人头像 * std::string path; // 存档路径 * std::string sign; // 个性签名 * std::string codeset; // 候选编码 * std::string encode; // 默认通信编码 * char* palicon; // 默认头像 * char* font; // 面板字体 * struct timeval timestamp; // 程序数据时间戳 int send_message_retry_in_us; // sleep time(in microsecond) when send message // failed private: uint16_t port_ = 2425; std::vector netseg; // 需要通知登录的IP段 std::shared_ptr config; std::mutex mutex; // 锁 std::string passwd; std::vector sharedFileInfos; uint8_t open_chat : 1; uint8_t hide_startup : 1; uint8_t open_transmission : 1; uint8_t use_enter_key : 1; uint8_t clearup_history : 1; uint8_t record_log : 1; uint8_t open_blacklist : 1; uint8_t proof_shared : 1; uint8_t hide_taskbar_when_main_window_iconified_ : 1; uint8_t need_restart_ : 1; private: void InitSublayer(); void ReadProgData(); void WriteNetSegment(); void ReadNetSegment(); }; } // namespace iptux #endif // IPTUX_PROGRAMDATACORE_H iptux-0.9.4/src/api/iptux-core/TransFileModel.h000066400000000000000000000033051475473122500213700ustar00rootroot00000000000000#ifndef IPTUX_TRANSFILEMODEL_H #define IPTUX_TRANSFILEMODEL_H #include namespace iptux { class TransFileModel { public: TransFileModel(); TransFileModel& setStatus(const std::string& value); TransFileModel& setTask(const std::string& value); TransFileModel& setPeer(const std::string& value); TransFileModel& setIp(const std::string& value); TransFileModel& setFilename(const std::string& value); TransFileModel& setFileLength(int64_t value); TransFileModel& setFinishedLength(int64_t value); TransFileModel& setCost(const std::string& value); TransFileModel& setRemain(const std::string& value); TransFileModel& setRate(const std::string& value); TransFileModel& setFilePath(const std::string& value); TransFileModel& setTaskId(int taskId); void finish(); const std::string& getStatus() const; const std::string& getTask() const; const std::string& getPeer() const; const std::string& getIp() const; const std::string& getFilename() const; int64_t getFileLength() const; std::string getFileLengthText() const; std::string getFinishedLengthText() const; double getProgress() const; std::string getProgressText() const; const std::string& getCost() const; const std::string& getRemain() const; const std::string& getRate() const; const std::string& getFilePath() const; bool isFinished() const; int getTaskId() const; private: std::string status; std::string task; std::string peer; std::string ip; std::string filename; int64_t fileLength; int64_t finishedLength; std::string cost; std::string remain; std::string rate; std::string filePath; bool finished; int taskId; }; } // namespace iptux #endif // IPTUX_TRANSFILEMODEL_H iptux-0.9.4/src/api/iptux-core/meson.build000066400000000000000000000003261475473122500205110ustar00rootroot00000000000000header_files = files([ 'CoreThread.h', 'Event.h', 'Exception.h', 'IptuxConfig.h', 'Models.h', 'ProgramData.h', 'TransFileModel.h', ]) install_headers(header_files, subdir: 'iptux-core') iptux-0.9.4/src/api/meson.build000066400000000000000000000000251475473122500164060ustar00rootroot00000000000000subdir('iptux-core') iptux-0.9.4/src/config.h.in000066400000000000000000000013651475473122500155260ustar00rootroot00000000000000#ifndef IPTUX_CONFIG_H #define IPTUX_CONFIG_H #mesondefine VERSION #mesondefine IPTUX_VERSION #mesondefine GETTEXT_PACKAGE #define IPTUX_RESOURCE "/io/github/iptux_src/iptux/" #define __PIXMAPS_PATH "@SHARE_IPTUX_DIR@/pixmaps" #define __LOCALE_PATH "@SHARE_DIR@/locale" #define __SOUND_PATH "@SHARE_IPTUX_DIR@/sound" #define __UI_PATH "@SHARE_IPTUX_DIR@/ui" #define IPTUX_PATH "/iptux" #define LOG_PATH "/iptux/log" #define PIC_PATH "/iptux/pic" #define ICON_PATH "/iptux/icon" #define PHOTO_PATH "/iptux/photo" #define SENT_IMAGE_PATH "/iptux/sent-image" #mesondefine SYSTEM_DARWIN #mesondefine HAVE_APPINDICATOR #if defined(__APPLE__) || defined(__CYGWIN__) #define O_LARGEFILE 0 #endif #define SIGCXX_DISABLE_DEPRECATED #endif // IPTUX_CONFIG_H iptux-0.9.4/src/googletest/000077500000000000000000000000001475473122500156525ustar00rootroot00000000000000iptux-0.9.4/src/googletest/include/000077500000000000000000000000001475473122500172755ustar00rootroot00000000000000iptux-0.9.4/src/googletest/include/gtest/000077500000000000000000000000001475473122500204235ustar00rootroot00000000000000iptux-0.9.4/src/googletest/include/gtest/gtest-death-test.h000066400000000000000000000340761475473122500237740ustar00rootroot00000000000000// Copyright 2005, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // The Google C++ Testing and Mocking Framework (Google Test) // // This header file defines the public API for death tests. It is // #included by gtest.h so a user doesn't need to include this // directly. // GOOGLETEST_CM0001 DO NOT DELETE #ifndef GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_ #define GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_ #include "gtest/internal/gtest-death-test-internal.h" namespace testing { // This flag controls the style of death tests. Valid values are "threadsafe", // meaning that the death test child process will re-execute the test binary // from the start, running only a single death test, or "fast", // meaning that the child process will execute the test logic immediately // after forking. GTEST_DECLARE_string_(death_test_style); #if GTEST_HAS_DEATH_TEST namespace internal { // Returns a Boolean value indicating whether the caller is currently // executing in the context of the death test child process. Tools such as // Valgrind heap checkers may need this to modify their behavior in death // tests. IMPORTANT: This is an internal utility. Using it may break the // implementation of death tests. User code MUST NOT use it. GTEST_API_ bool InDeathTestChild(); } // namespace internal // The following macros are useful for writing death tests. // Here's what happens when an ASSERT_DEATH* or EXPECT_DEATH* is // executed: // // 1. It generates a warning if there is more than one active // thread. This is because it's safe to fork() or clone() only // when there is a single thread. // // 2. The parent process clone()s a sub-process and runs the death // test in it; the sub-process exits with code 0 at the end of the // death test, if it hasn't exited already. // // 3. The parent process waits for the sub-process to terminate. // // 4. The parent process checks the exit code and error message of // the sub-process. // // Examples: // // ASSERT_DEATH(server.SendMessage(56, "Hello"), "Invalid port number"); // for (int i = 0; i < 5; i++) { // EXPECT_DEATH(server.ProcessRequest(i), // "Invalid request .* in ProcessRequest()") // << "Failed to die on request " << i; // } // // ASSERT_EXIT(server.ExitNow(), ::testing::ExitedWithCode(0), "Exiting"); // // bool KilledBySIGHUP(int exit_code) { // return WIFSIGNALED(exit_code) && WTERMSIG(exit_code) == SIGHUP; // } // // ASSERT_EXIT(client.HangUpServer(), KilledBySIGHUP, "Hanging up!"); // // On the regular expressions used in death tests: // // GOOGLETEST_CM0005 DO NOT DELETE // On POSIX-compliant systems (*nix), we use the library, // which uses the POSIX extended regex syntax. // // On other platforms (e.g. Windows or Mac), we only support a simple regex // syntax implemented as part of Google Test. This limited // implementation should be enough most of the time when writing // death tests; though it lacks many features you can find in PCRE // or POSIX extended regex syntax. For example, we don't support // union ("x|y"), grouping ("(xy)"), brackets ("[xy]"), and // repetition count ("x{5,7}"), among others. // // Below is the syntax that we do support. We chose it to be a // subset of both PCRE and POSIX extended regex, so it's easy to // learn wherever you come from. In the following: 'A' denotes a // literal character, period (.), or a single \\ escape sequence; // 'x' and 'y' denote regular expressions; 'm' and 'n' are for // natural numbers. // // c matches any literal character c // \\d matches any decimal digit // \\D matches any character that's not a decimal digit // \\f matches \f // \\n matches \n // \\r matches \r // \\s matches any ASCII whitespace, including \n // \\S matches any character that's not a whitespace // \\t matches \t // \\v matches \v // \\w matches any letter, _, or decimal digit // \\W matches any character that \\w doesn't match // \\c matches any literal character c, which must be a punctuation // . matches any single character except \n // A? matches 0 or 1 occurrences of A // A* matches 0 or many occurrences of A // A+ matches 1 or many occurrences of A // ^ matches the beginning of a string (not that of each line) // $ matches the end of a string (not that of each line) // xy matches x followed by y // // If you accidentally use PCRE or POSIX extended regex features // not implemented by us, you will get a run-time failure. In that // case, please try to rewrite your regular expression within the // above syntax. // // This implementation is *not* meant to be as highly tuned or robust // as a compiled regex library, but should perform well enough for a // death test, which already incurs significant overhead by launching // a child process. // // Known caveats: // // A "threadsafe" style death test obtains the path to the test // program from argv[0] and re-executes it in the sub-process. For // simplicity, the current implementation doesn't search the PATH // when launching the sub-process. This means that the user must // invoke the test program via a path that contains at least one // path separator (e.g. path/to/foo_test and // /absolute/path/to/bar_test are fine, but foo_test is not). This // is rarely a problem as people usually don't put the test binary // directory in PATH. // // FIXME: make thread-safe death tests search the PATH. // Asserts that a given statement causes the program to exit, with an // integer exit status that satisfies predicate, and emitting error output // that matches regex. # define ASSERT_EXIT(statement, predicate, regex) \ GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_FATAL_FAILURE_) // Like ASSERT_EXIT, but continues on to successive tests in the // test case, if any: # define EXPECT_EXIT(statement, predicate, regex) \ GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_NONFATAL_FAILURE_) // Asserts that a given statement causes the program to exit, either by // explicitly exiting with a nonzero exit code or being killed by a // signal, and emitting error output that matches regex. # define ASSERT_DEATH(statement, regex) \ ASSERT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, regex) // Like ASSERT_DEATH, but continues on to successive tests in the // test case, if any: # define EXPECT_DEATH(statement, regex) \ EXPECT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, regex) // Two predicate classes that can be used in {ASSERT,EXPECT}_EXIT*: // Tests that an exit code describes a normal exit with a given exit code. class GTEST_API_ ExitedWithCode { public: explicit ExitedWithCode(int exit_code); bool operator()(int exit_status) const; private: // No implementation - assignment is unsupported. void operator=(const ExitedWithCode& other); const int exit_code_; }; # if !GTEST_OS_WINDOWS && !GTEST_OS_FUCHSIA // Tests that an exit code describes an exit due to termination by a // given signal. // GOOGLETEST_CM0006 DO NOT DELETE class GTEST_API_ KilledBySignal { public: explicit KilledBySignal(int signum); bool operator()(int exit_status) const; private: const int signum_; }; # endif // !GTEST_OS_WINDOWS // EXPECT_DEBUG_DEATH asserts that the given statements die in debug mode. // The death testing framework causes this to have interesting semantics, // since the sideeffects of the call are only visible in opt mode, and not // in debug mode. // // In practice, this can be used to test functions that utilize the // LOG(DFATAL) macro using the following style: // // int DieInDebugOr12(int* sideeffect) { // if (sideeffect) { // *sideeffect = 12; // } // LOG(DFATAL) << "death"; // return 12; // } // // TEST(TestCase, TestDieOr12WorksInDgbAndOpt) { // int sideeffect = 0; // // Only asserts in dbg. // EXPECT_DEBUG_DEATH(DieInDebugOr12(&sideeffect), "death"); // // #ifdef NDEBUG // // opt-mode has sideeffect visible. // EXPECT_EQ(12, sideeffect); // #else // // dbg-mode no visible sideeffect. // EXPECT_EQ(0, sideeffect); // #endif // } // // This will assert that DieInDebugReturn12InOpt() crashes in debug // mode, usually due to a DCHECK or LOG(DFATAL), but returns the // appropriate fallback value (12 in this case) in opt mode. If you // need to test that a function has appropriate side-effects in opt // mode, include assertions against the side-effects. A general // pattern for this is: // // EXPECT_DEBUG_DEATH({ // // Side-effects here will have an effect after this statement in // // opt mode, but none in debug mode. // EXPECT_EQ(12, DieInDebugOr12(&sideeffect)); // }, "death"); // # ifdef NDEBUG # define EXPECT_DEBUG_DEATH(statement, regex) \ GTEST_EXECUTE_STATEMENT_(statement, regex) # define ASSERT_DEBUG_DEATH(statement, regex) \ GTEST_EXECUTE_STATEMENT_(statement, regex) # else # define EXPECT_DEBUG_DEATH(statement, regex) \ EXPECT_DEATH(statement, regex) # define ASSERT_DEBUG_DEATH(statement, regex) \ ASSERT_DEATH(statement, regex) # endif // NDEBUG for EXPECT_DEBUG_DEATH #endif // GTEST_HAS_DEATH_TEST // This macro is used for implementing macros such as // EXPECT_DEATH_IF_SUPPORTED and ASSERT_DEATH_IF_SUPPORTED on systems where // death tests are not supported. Those macros must compile on such systems // iff EXPECT_DEATH and ASSERT_DEATH compile with the same parameters on // systems that support death tests. This allows one to write such a macro // on a system that does not support death tests and be sure that it will // compile on a death-test supporting system. It is exposed publicly so that // systems that have death-tests with stricter requirements than // GTEST_HAS_DEATH_TEST can write their own equivalent of // EXPECT_DEATH_IF_SUPPORTED and ASSERT_DEATH_IF_SUPPORTED. // // Parameters: // statement - A statement that a macro such as EXPECT_DEATH would test // for program termination. This macro has to make sure this // statement is compiled but not executed, to ensure that // EXPECT_DEATH_IF_SUPPORTED compiles with a certain // parameter iff EXPECT_DEATH compiles with it. // regex - A regex that a macro such as EXPECT_DEATH would use to test // the output of statement. This parameter has to be // compiled but not evaluated by this macro, to ensure that // this macro only accepts expressions that a macro such as // EXPECT_DEATH would accept. // terminator - Must be an empty statement for EXPECT_DEATH_IF_SUPPORTED // and a return statement for ASSERT_DEATH_IF_SUPPORTED. // This ensures that ASSERT_DEATH_IF_SUPPORTED will not // compile inside functions where ASSERT_DEATH doesn't // compile. // // The branch that has an always false condition is used to ensure that // statement and regex are compiled (and thus syntactically correct) but // never executed. The unreachable code macro protects the terminator // statement from generating an 'unreachable code' warning in case // statement unconditionally returns or throws. The Message constructor at // the end allows the syntax of streaming additional messages into the // macro, for compilational compatibility with EXPECT_DEATH/ASSERT_DEATH. # define GTEST_UNSUPPORTED_DEATH_TEST(statement, regex, terminator) \ GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ if (::testing::internal::AlwaysTrue()) { \ GTEST_LOG_(WARNING) \ << "Death tests are not supported on this platform.\n" \ << "Statement '" #statement "' cannot be verified."; \ } else if (::testing::internal::AlwaysFalse()) { \ ::testing::internal::RE::PartialMatch(".*", (regex)); \ GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \ terminator; \ } else \ ::testing::Message() // EXPECT_DEATH_IF_SUPPORTED(statement, regex) and // ASSERT_DEATH_IF_SUPPORTED(statement, regex) expand to real death tests if // death tests are supported; otherwise they just issue a warning. This is // useful when you are combining death test assertions with normal test // assertions in one test. #if GTEST_HAS_DEATH_TEST # define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \ EXPECT_DEATH(statement, regex) # define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \ ASSERT_DEATH(statement, regex) #else # define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \ GTEST_UNSUPPORTED_DEATH_TEST(statement, regex, ) # define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \ GTEST_UNSUPPORTED_DEATH_TEST(statement, regex, return) #endif } // namespace testing #endif // GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_ iptux-0.9.4/src/googletest/include/gtest/gtest-message.h000066400000000000000000000222101475473122500233410ustar00rootroot00000000000000// Copyright 2005, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // The Google C++ Testing and Mocking Framework (Google Test) // // This header file defines the Message class. // // IMPORTANT NOTE: Due to limitation of the C++ language, we have to // leave some internal implementation details in this header file. // They are clearly marked by comments like this: // // // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. // // Such code is NOT meant to be used by a user directly, and is subject // to CHANGE WITHOUT NOTICE. Therefore DO NOT DEPEND ON IT in a user // program! // GOOGLETEST_CM0001 DO NOT DELETE #ifndef GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_ #define GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_ #include #include "gtest/internal/gtest-port.h" GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \ /* class A needs to have dll-interface to be used by clients of class B */) // Ensures that there is at least one operator<< in the global namespace. // See Message& operator<<(...) below for why. void operator<<(const testing::internal::Secret&, int); namespace testing { // The Message class works like an ostream repeater. // // Typical usage: // // 1. You stream a bunch of values to a Message object. // It will remember the text in a stringstream. // 2. Then you stream the Message object to an ostream. // This causes the text in the Message to be streamed // to the ostream. // // For example; // // testing::Message foo; // foo << 1 << " != " << 2; // std::cout << foo; // // will print "1 != 2". // // Message is not intended to be inherited from. In particular, its // destructor is not virtual. // // Note that stringstream behaves differently in gcc and in MSVC. You // can stream a NULL char pointer to it in the former, but not in the // latter (it causes an access violation if you do). The Message // class hides this difference by treating a NULL char pointer as // "(null)". class GTEST_API_ Message { private: // The type of basic IO manipulators (endl, ends, and flush) for // narrow streams. typedef std::ostream& (*BasicNarrowIoManip)(std::ostream&); public: // Constructs an empty Message. Message(); // Copy constructor. Message(const Message& msg) : ss_(new ::std::stringstream) { // NOLINT *ss_ << msg.GetString(); } // Constructs a Message from a C-string. explicit Message(const char* str) : ss_(new ::std::stringstream) { *ss_ << str; } #if GTEST_OS_SYMBIAN // Streams a value (either a pointer or not) to this object. template inline Message& operator <<(const T& value) { StreamHelper(typename internal::is_pointer::type(), value); return *this; } #else // Streams a non-pointer value to this object. template inline Message& operator <<(const T& val) { // Some libraries overload << for STL containers. These // overloads are defined in the global namespace instead of ::std. // // C++'s symbol lookup rule (i.e. Koenig lookup) says that these // overloads are visible in either the std namespace or the global // namespace, but not other namespaces, including the testing // namespace which Google Test's Message class is in. // // To allow STL containers (and other types that has a << operator // defined in the global namespace) to be used in Google Test // assertions, testing::Message must access the custom << operator // from the global namespace. With this using declaration, // overloads of << defined in the global namespace and those // visible via Koenig lookup are both exposed in this function. using ::operator <<; *ss_ << val; return *this; } // Streams a pointer value to this object. // // This function is an overload of the previous one. When you // stream a pointer to a Message, this definition will be used as it // is more specialized. (The C++ Standard, section // [temp.func.order].) If you stream a non-pointer, then the // previous definition will be used. // // The reason for this overload is that streaming a NULL pointer to // ostream is undefined behavior. Depending on the compiler, you // may get "0", "(nil)", "(null)", or an access violation. To // ensure consistent result across compilers, we always treat NULL // as "(null)". template inline Message& operator <<(T* const& pointer) { // NOLINT if (pointer == NULL) { *ss_ << "(null)"; } else { *ss_ << pointer; } return *this; } #endif // GTEST_OS_SYMBIAN // Since the basic IO manipulators are overloaded for both narrow // and wide streams, we have to provide this specialized definition // of operator <<, even though its body is the same as the // templatized version above. Without this definition, streaming // endl or other basic IO manipulators to Message will confuse the // compiler. Message& operator <<(BasicNarrowIoManip val) { *ss_ << val; return *this; } // Instead of 1/0, we want to see true/false for bool values. Message& operator <<(bool b) { return *this << (b ? "true" : "false"); } // These two overloads allow streaming a wide C string to a Message // using the UTF-8 encoding. Message& operator <<(const wchar_t* wide_c_str); Message& operator <<(wchar_t* wide_c_str); #if GTEST_HAS_STD_WSTRING // Converts the given wide string to a narrow string using the UTF-8 // encoding, and streams the result to this Message object. Message& operator <<(const ::std::wstring& wstr); #endif // GTEST_HAS_STD_WSTRING #if GTEST_HAS_GLOBAL_WSTRING // Converts the given wide string to a narrow string using the UTF-8 // encoding, and streams the result to this Message object. Message& operator <<(const ::wstring& wstr); #endif // GTEST_HAS_GLOBAL_WSTRING // Gets the text streamed to this object so far as an std::string. // Each '\0' character in the buffer is replaced with "\\0". // // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. std::string GetString() const; private: #if GTEST_OS_SYMBIAN // These are needed as the Nokia Symbian Compiler cannot decide between // const T& and const T* in a function template. The Nokia compiler _can_ // decide between class template specializations for T and T*, so a // tr1::type_traits-like is_pointer works, and we can overload on that. template inline void StreamHelper(internal::true_type /*is_pointer*/, T* pointer) { if (pointer == NULL) { *ss_ << "(null)"; } else { *ss_ << pointer; } } template inline void StreamHelper(internal::false_type /*is_pointer*/, const T& value) { // See the comments in Message& operator <<(const T&) above for why // we need this using statement. using ::operator <<; *ss_ << value; } #endif // GTEST_OS_SYMBIAN // We'll hold the text streamed to this object here. const internal::scoped_ptr< ::std::stringstream> ss_; // We declare (but don't implement) this to prevent the compiler // from implementing the assignment operator. void operator=(const Message&); }; // Streams a Message to an ostream. inline std::ostream& operator <<(std::ostream& os, const Message& sb) { return os << sb.GetString(); } namespace internal { // Converts a streamable value to an std::string. A NULL pointer is // converted to "(null)". When the input value is a ::string, // ::std::string, ::wstring, or ::std::wstring object, each NUL // character in it is replaced with "\\0". template std::string StreamableToString(const T& streamable) { return (Message() << streamable).GetString(); } } // namespace internal } // namespace testing GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251 #endif // GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_ iptux-0.9.4/src/googletest/include/gtest/gtest-param-test.h000066400000000000000000002262051475473122500240040ustar00rootroot00000000000000// This file was GENERATED by command: // pump.py gtest-param-test.h.pump // DO NOT EDIT BY HAND!!! // Copyright 2008, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // Macros and functions for implementing parameterized tests // in Google C++ Testing and Mocking Framework (Google Test) // // This file is generated by a SCRIPT. DO NOT EDIT BY HAND! // // GOOGLETEST_CM0001 DO NOT DELETE #ifndef GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_ #define GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_ // Value-parameterized tests allow you to test your code with different // parameters without writing multiple copies of the same test. // // Here is how you use value-parameterized tests: #if 0 // To write value-parameterized tests, first you should define a fixture // class. It is usually derived from testing::TestWithParam (see below for // another inheritance scheme that's sometimes useful in more complicated // class hierarchies), where the type of your parameter values. // TestWithParam is itself derived from testing::Test. T can be any // copyable type. If it's a raw pointer, you are responsible for managing the // lifespan of the pointed values. class FooTest : public ::testing::TestWithParam { // You can implement all the usual class fixture members here. }; // Then, use the TEST_P macro to define as many parameterized tests // for this fixture as you want. The _P suffix is for "parameterized" // or "pattern", whichever you prefer to think. TEST_P(FooTest, DoesBlah) { // Inside a test, access the test parameter with the GetParam() method // of the TestWithParam class: EXPECT_TRUE(foo.Blah(GetParam())); ... } TEST_P(FooTest, HasBlahBlah) { ... } // Finally, you can use INSTANTIATE_TEST_CASE_P to instantiate the test // case with any set of parameters you want. Google Test defines a number // of functions for generating test parameters. They return what we call // (surprise!) parameter generators. Here is a summary of them, which // are all in the testing namespace: // // // Range(begin, end [, step]) - Yields values {begin, begin+step, // begin+step+step, ...}. The values do not // include end. step defaults to 1. // Values(v1, v2, ..., vN) - Yields values {v1, v2, ..., vN}. // ValuesIn(container) - Yields values from a C-style array, an STL // ValuesIn(begin,end) container, or an iterator range [begin, end). // Bool() - Yields sequence {false, true}. // Combine(g1, g2, ..., gN) - Yields all combinations (the Cartesian product // for the math savvy) of the values generated // by the N generators. // // For more details, see comments at the definitions of these functions below // in this file. // // The following statement will instantiate tests from the FooTest test case // each with parameter values "meeny", "miny", and "moe". INSTANTIATE_TEST_CASE_P(InstantiationName, FooTest, Values("meeny", "miny", "moe")); // To distinguish different instances of the pattern, (yes, you // can instantiate it more then once) the first argument to the // INSTANTIATE_TEST_CASE_P macro is a prefix that will be added to the // actual test case name. Remember to pick unique prefixes for different // instantiations. The tests from the instantiation above will have // these names: // // * InstantiationName/FooTest.DoesBlah/0 for "meeny" // * InstantiationName/FooTest.DoesBlah/1 for "miny" // * InstantiationName/FooTest.DoesBlah/2 for "moe" // * InstantiationName/FooTest.HasBlahBlah/0 for "meeny" // * InstantiationName/FooTest.HasBlahBlah/1 for "miny" // * InstantiationName/FooTest.HasBlahBlah/2 for "moe" // // You can use these names in --gtest_filter. // // This statement will instantiate all tests from FooTest again, each // with parameter values "cat" and "dog": const char* pets[] = {"cat", "dog"}; INSTANTIATE_TEST_CASE_P(AnotherInstantiationName, FooTest, ValuesIn(pets)); // The tests from the instantiation above will have these names: // // * AnotherInstantiationName/FooTest.DoesBlah/0 for "cat" // * AnotherInstantiationName/FooTest.DoesBlah/1 for "dog" // * AnotherInstantiationName/FooTest.HasBlahBlah/0 for "cat" // * AnotherInstantiationName/FooTest.HasBlahBlah/1 for "dog" // // Please note that INSTANTIATE_TEST_CASE_P will instantiate all tests // in the given test case, whether their definitions come before or // AFTER the INSTANTIATE_TEST_CASE_P statement. // // Please also note that generator expressions (including parameters to the // generators) are evaluated in InitGoogleTest(), after main() has started. // This allows the user on one hand, to adjust generator parameters in order // to dynamically determine a set of tests to run and on the other hand, // give the user a chance to inspect the generated tests with Google Test // reflection API before RUN_ALL_TESTS() is executed. // // You can see samples/sample7_unittest.cc and samples/sample8_unittest.cc // for more examples. // // In the future, we plan to publish the API for defining new parameter // generators. But for now this interface remains part of the internal // implementation and is subject to change. // // // A parameterized test fixture must be derived from testing::Test and from // testing::WithParamInterface, where T is the type of the parameter // values. Inheriting from TestWithParam satisfies that requirement because // TestWithParam inherits from both Test and WithParamInterface. In more // complicated hierarchies, however, it is occasionally useful to inherit // separately from Test and WithParamInterface. For example: class BaseTest : public ::testing::Test { // You can inherit all the usual members for a non-parameterized test // fixture here. }; class DerivedTest : public BaseTest, public ::testing::WithParamInterface { // The usual test fixture members go here too. }; TEST_F(BaseTest, HasFoo) { // This is an ordinary non-parameterized test. } TEST_P(DerivedTest, DoesBlah) { // GetParam works just the same here as if you inherit from TestWithParam. EXPECT_TRUE(foo.Blah(GetParam())); } #endif // 0 #include "gtest/internal/gtest-port.h" #if !GTEST_OS_SYMBIAN # include #endif #include "gtest/internal/gtest-internal.h" #include "gtest/internal/gtest-param-util.h" #include "gtest/internal/gtest-param-util-generated.h" namespace testing { // Functions producing parameter generators. // // Google Test uses these generators to produce parameters for value- // parameterized tests. When a parameterized test case is instantiated // with a particular generator, Google Test creates and runs tests // for each element in the sequence produced by the generator. // // In the following sample, tests from test case FooTest are instantiated // each three times with parameter values 3, 5, and 8: // // class FooTest : public TestWithParam { ... }; // // TEST_P(FooTest, TestThis) { // } // TEST_P(FooTest, TestThat) { // } // INSTANTIATE_TEST_CASE_P(TestSequence, FooTest, Values(3, 5, 8)); // // Range() returns generators providing sequences of values in a range. // // Synopsis: // Range(start, end) // - returns a generator producing a sequence of values {start, start+1, // start+2, ..., }. // Range(start, end, step) // - returns a generator producing a sequence of values {start, start+step, // start+step+step, ..., }. // Notes: // * The generated sequences never include end. For example, Range(1, 5) // returns a generator producing a sequence {1, 2, 3, 4}. Range(1, 9, 2) // returns a generator producing {1, 3, 5, 7}. // * start and end must have the same type. That type may be any integral or // floating-point type or a user defined type satisfying these conditions: // * It must be assignable (have operator=() defined). // * It must have operator+() (operator+(int-compatible type) for // two-operand version). // * It must have operator<() defined. // Elements in the resulting sequences will also have that type. // * Condition start < end must be satisfied in order for resulting sequences // to contain any elements. // template internal::ParamGenerator Range(T start, T end, IncrementT step) { return internal::ParamGenerator( new internal::RangeGenerator(start, end, step)); } template internal::ParamGenerator Range(T start, T end) { return Range(start, end, 1); } // ValuesIn() function allows generation of tests with parameters coming from // a container. // // Synopsis: // ValuesIn(const T (&array)[N]) // - returns a generator producing sequences with elements from // a C-style array. // ValuesIn(const Container& container) // - returns a generator producing sequences with elements from // an STL-style container. // ValuesIn(Iterator begin, Iterator end) // - returns a generator producing sequences with elements from // a range [begin, end) defined by a pair of STL-style iterators. These // iterators can also be plain C pointers. // // Please note that ValuesIn copies the values from the containers // passed in and keeps them to generate tests in RUN_ALL_TESTS(). // // Examples: // // This instantiates tests from test case StringTest // each with C-string values of "foo", "bar", and "baz": // // const char* strings[] = {"foo", "bar", "baz"}; // INSTANTIATE_TEST_CASE_P(StringSequence, StringTest, ValuesIn(strings)); // // This instantiates tests from test case StlStringTest // each with STL strings with values "a" and "b": // // ::std::vector< ::std::string> GetParameterStrings() { // ::std::vector< ::std::string> v; // v.push_back("a"); // v.push_back("b"); // return v; // } // // INSTANTIATE_TEST_CASE_P(CharSequence, // StlStringTest, // ValuesIn(GetParameterStrings())); // // // This will also instantiate tests from CharTest // each with parameter values 'a' and 'b': // // ::std::list GetParameterChars() { // ::std::list list; // list.push_back('a'); // list.push_back('b'); // return list; // } // ::std::list l = GetParameterChars(); // INSTANTIATE_TEST_CASE_P(CharSequence2, // CharTest, // ValuesIn(l.begin(), l.end())); // template internal::ParamGenerator< typename ::testing::internal::IteratorTraits::value_type> ValuesIn(ForwardIterator begin, ForwardIterator end) { typedef typename ::testing::internal::IteratorTraits ::value_type ParamType; return internal::ParamGenerator( new internal::ValuesInIteratorRangeGenerator(begin, end)); } template internal::ParamGenerator ValuesIn(const T (&array)[N]) { return ValuesIn(array, array + N); } template internal::ParamGenerator ValuesIn( const Container& container) { return ValuesIn(container.begin(), container.end()); } // Values() allows generating tests from explicitly specified list of // parameters. // // Synopsis: // Values(T v1, T v2, ..., T vN) // - returns a generator producing sequences with elements v1, v2, ..., vN. // // For example, this instantiates tests from test case BarTest each // with values "one", "two", and "three": // // INSTANTIATE_TEST_CASE_P(NumSequence, BarTest, Values("one", "two", "three")); // // This instantiates tests from test case BazTest each with values 1, 2, 3.5. // The exact type of values will depend on the type of parameter in BazTest. // // INSTANTIATE_TEST_CASE_P(FloatingNumbers, BazTest, Values(1, 2, 3.5)); // // Currently, Values() supports from 1 to 50 parameters. // template internal::ValueArray1 Values(T1 v1) { return internal::ValueArray1(v1); } template internal::ValueArray2 Values(T1 v1, T2 v2) { return internal::ValueArray2(v1, v2); } template internal::ValueArray3 Values(T1 v1, T2 v2, T3 v3) { return internal::ValueArray3(v1, v2, v3); } template internal::ValueArray4 Values(T1 v1, T2 v2, T3 v3, T4 v4) { return internal::ValueArray4(v1, v2, v3, v4); } template internal::ValueArray5 Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5) { return internal::ValueArray5(v1, v2, v3, v4, v5); } template internal::ValueArray6 Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6) { return internal::ValueArray6(v1, v2, v3, v4, v5, v6); } template internal::ValueArray7 Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7) { return internal::ValueArray7(v1, v2, v3, v4, v5, v6, v7); } template internal::ValueArray8 Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8) { return internal::ValueArray8(v1, v2, v3, v4, v5, v6, v7, v8); } template internal::ValueArray9 Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9) { return internal::ValueArray9(v1, v2, v3, v4, v5, v6, v7, v8, v9); } template internal::ValueArray10 Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10) { return internal::ValueArray10(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10); } template internal::ValueArray11 Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11) { return internal::ValueArray11(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11); } template internal::ValueArray12 Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12) { return internal::ValueArray12(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12); } template internal::ValueArray13 Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13) { return internal::ValueArray13(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13); } template internal::ValueArray14 Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14) { return internal::ValueArray14(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14); } template internal::ValueArray15 Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15) { return internal::ValueArray15(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15); } template internal::ValueArray16 Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16) { return internal::ValueArray16(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16); } template internal::ValueArray17 Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17) { return internal::ValueArray17(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17); } template internal::ValueArray18 Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18) { return internal::ValueArray18(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18); } template internal::ValueArray19 Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19) { return internal::ValueArray19(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19); } template internal::ValueArray20 Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20) { return internal::ValueArray20(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20); } template internal::ValueArray21 Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21) { return internal::ValueArray21(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21); } template internal::ValueArray22 Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22) { return internal::ValueArray22(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22); } template internal::ValueArray23 Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23) { return internal::ValueArray23(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23); } template internal::ValueArray24 Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24) { return internal::ValueArray24(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24); } template internal::ValueArray25 Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25) { return internal::ValueArray25(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25); } template internal::ValueArray26 Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26) { return internal::ValueArray26(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26); } template internal::ValueArray27 Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27) { return internal::ValueArray27(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27); } template internal::ValueArray28 Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28) { return internal::ValueArray28(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28); } template internal::ValueArray29 Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29) { return internal::ValueArray29(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29); } template internal::ValueArray30 Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30) { return internal::ValueArray30(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30); } template internal::ValueArray31 Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31) { return internal::ValueArray31(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31); } template internal::ValueArray32 Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32) { return internal::ValueArray32(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32); } template internal::ValueArray33 Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33) { return internal::ValueArray33(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33); } template internal::ValueArray34 Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34) { return internal::ValueArray34(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34); } template internal::ValueArray35 Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35) { return internal::ValueArray35(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35); } template internal::ValueArray36 Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36) { return internal::ValueArray36(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36); } template internal::ValueArray37 Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37) { return internal::ValueArray37(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37); } template internal::ValueArray38 Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38) { return internal::ValueArray38(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38); } template internal::ValueArray39 Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39) { return internal::ValueArray39(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39); } template internal::ValueArray40 Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40) { return internal::ValueArray40(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40); } template internal::ValueArray41 Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41) { return internal::ValueArray41(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41); } template internal::ValueArray42 Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41, T42 v42) { return internal::ValueArray42(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42); } template internal::ValueArray43 Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41, T42 v42, T43 v43) { return internal::ValueArray43(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43); } template internal::ValueArray44 Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41, T42 v42, T43 v43, T44 v44) { return internal::ValueArray44(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44); } template internal::ValueArray45 Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45) { return internal::ValueArray45(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45); } template internal::ValueArray46 Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46) { return internal::ValueArray46(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46); } template internal::ValueArray47 Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47) { return internal::ValueArray47(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47); } template internal::ValueArray48 Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47, T48 v48) { return internal::ValueArray48(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48); } template internal::ValueArray49 Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47, T48 v48, T49 v49) { return internal::ValueArray49(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49); } template internal::ValueArray50 Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47, T48 v48, T49 v49, T50 v50) { return internal::ValueArray50(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50); } // Bool() allows generating tests with parameters in a set of (false, true). // // Synopsis: // Bool() // - returns a generator producing sequences with elements {false, true}. // // It is useful when testing code that depends on Boolean flags. Combinations // of multiple flags can be tested when several Bool()'s are combined using // Combine() function. // // In the following example all tests in the test case FlagDependentTest // will be instantiated twice with parameters false and true. // // class FlagDependentTest : public testing::TestWithParam { // virtual void SetUp() { // external_flag = GetParam(); // } // } // INSTANTIATE_TEST_CASE_P(BoolSequence, FlagDependentTest, Bool()); // inline internal::ParamGenerator Bool() { return Values(false, true); } # if GTEST_HAS_COMBINE // Combine() allows the user to combine two or more sequences to produce // values of a Cartesian product of those sequences' elements. // // Synopsis: // Combine(gen1, gen2, ..., genN) // - returns a generator producing sequences with elements coming from // the Cartesian product of elements from the sequences generated by // gen1, gen2, ..., genN. The sequence elements will have a type of // tuple where T1, T2, ..., TN are the types // of elements from sequences produces by gen1, gen2, ..., genN. // // Combine can have up to 10 arguments. This number is currently limited // by the maximum number of elements in the tuple implementation used by Google // Test. // // Example: // // This will instantiate tests in test case AnimalTest each one with // the parameter values tuple("cat", BLACK), tuple("cat", WHITE), // tuple("dog", BLACK), and tuple("dog", WHITE): // // enum Color { BLACK, GRAY, WHITE }; // class AnimalTest // : public testing::TestWithParam > {...}; // // TEST_P(AnimalTest, AnimalLooksNice) {...} // // INSTANTIATE_TEST_CASE_P(AnimalVariations, AnimalTest, // Combine(Values("cat", "dog"), // Values(BLACK, WHITE))); // // This will instantiate tests in FlagDependentTest with all variations of two // Boolean flags: // // class FlagDependentTest // : public testing::TestWithParam > { // virtual void SetUp() { // // Assigns external_flag_1 and external_flag_2 values from the tuple. // tie(external_flag_1, external_flag_2) = GetParam(); // } // }; // // TEST_P(FlagDependentTest, TestFeature1) { // // Test your code using external_flag_1 and external_flag_2 here. // } // INSTANTIATE_TEST_CASE_P(TwoBoolSequence, FlagDependentTest, // Combine(Bool(), Bool())); // template internal::CartesianProductHolder2 Combine( const Generator1& g1, const Generator2& g2) { return internal::CartesianProductHolder2( g1, g2); } template internal::CartesianProductHolder3 Combine( const Generator1& g1, const Generator2& g2, const Generator3& g3) { return internal::CartesianProductHolder3( g1, g2, g3); } template internal::CartesianProductHolder4 Combine( const Generator1& g1, const Generator2& g2, const Generator3& g3, const Generator4& g4) { return internal::CartesianProductHolder4( g1, g2, g3, g4); } template internal::CartesianProductHolder5 Combine( const Generator1& g1, const Generator2& g2, const Generator3& g3, const Generator4& g4, const Generator5& g5) { return internal::CartesianProductHolder5( g1, g2, g3, g4, g5); } template internal::CartesianProductHolder6 Combine( const Generator1& g1, const Generator2& g2, const Generator3& g3, const Generator4& g4, const Generator5& g5, const Generator6& g6) { return internal::CartesianProductHolder6( g1, g2, g3, g4, g5, g6); } template internal::CartesianProductHolder7 Combine( const Generator1& g1, const Generator2& g2, const Generator3& g3, const Generator4& g4, const Generator5& g5, const Generator6& g6, const Generator7& g7) { return internal::CartesianProductHolder7( g1, g2, g3, g4, g5, g6, g7); } template internal::CartesianProductHolder8 Combine( const Generator1& g1, const Generator2& g2, const Generator3& g3, const Generator4& g4, const Generator5& g5, const Generator6& g6, const Generator7& g7, const Generator8& g8) { return internal::CartesianProductHolder8( g1, g2, g3, g4, g5, g6, g7, g8); } template internal::CartesianProductHolder9 Combine( const Generator1& g1, const Generator2& g2, const Generator3& g3, const Generator4& g4, const Generator5& g5, const Generator6& g6, const Generator7& g7, const Generator8& g8, const Generator9& g9) { return internal::CartesianProductHolder9( g1, g2, g3, g4, g5, g6, g7, g8, g9); } template internal::CartesianProductHolder10 Combine( const Generator1& g1, const Generator2& g2, const Generator3& g3, const Generator4& g4, const Generator5& g5, const Generator6& g6, const Generator7& g7, const Generator8& g8, const Generator9& g9, const Generator10& g10) { return internal::CartesianProductHolder10( g1, g2, g3, g4, g5, g6, g7, g8, g9, g10); } # endif // GTEST_HAS_COMBINE # define TEST_P(test_case_name, test_name) \ class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \ : public test_case_name { \ public: \ GTEST_TEST_CLASS_NAME_(test_case_name, test_name)() {} \ virtual void TestBody(); \ private: \ static int AddToRegistry() { \ ::testing::UnitTest::GetInstance()->parameterized_test_registry(). \ GetTestCasePatternHolder(\ #test_case_name, \ ::testing::internal::CodeLocation(\ __FILE__, __LINE__))->AddTestPattern(\ GTEST_STRINGIFY_(test_case_name), \ GTEST_STRINGIFY_(test_name), \ new ::testing::internal::TestMetaFactory< \ GTEST_TEST_CLASS_NAME_(\ test_case_name, test_name)>()); \ return 0; \ } \ static int gtest_registering_dummy_ GTEST_ATTRIBUTE_UNUSED_; \ GTEST_DISALLOW_COPY_AND_ASSIGN_(\ GTEST_TEST_CLASS_NAME_(test_case_name, test_name)); \ }; \ int GTEST_TEST_CLASS_NAME_(test_case_name, \ test_name)::gtest_registering_dummy_ = \ GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::AddToRegistry(); \ void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody() // The optional last argument to INSTANTIATE_TEST_CASE_P allows the user // to specify a function or functor that generates custom test name suffixes // based on the test parameters. The function should accept one argument of // type testing::TestParamInfo, and return std::string. // // testing::PrintToStringParamName is a builtin test suffix generator that // returns the value of testing::PrintToString(GetParam()). // // Note: test names must be non-empty, unique, and may only contain ASCII // alphanumeric characters or underscore. Because PrintToString adds quotes // to std::string and C strings, it won't work for these types. # define INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator, ...) \ static ::testing::internal::ParamGenerator \ gtest_##prefix##test_case_name##_EvalGenerator_() { return generator; } \ static ::std::string gtest_##prefix##test_case_name##_EvalGenerateName_( \ const ::testing::TestParamInfo& info) { \ return ::testing::internal::GetParamNameGen \ (__VA_ARGS__)(info); \ } \ static int gtest_##prefix##test_case_name##_dummy_ GTEST_ATTRIBUTE_UNUSED_ = \ ::testing::UnitTest::GetInstance()->parameterized_test_registry(). \ GetTestCasePatternHolder(\ #test_case_name, \ ::testing::internal::CodeLocation(\ __FILE__, __LINE__))->AddTestCaseInstantiation(\ #prefix, \ >est_##prefix##test_case_name##_EvalGenerator_, \ >est_##prefix##test_case_name##_EvalGenerateName_, \ __FILE__, __LINE__) } // namespace testing #endif // GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_ iptux-0.9.4/src/googletest/include/gtest/gtest-param-test.h.pump000066400000000000000000000466311475473122500247670ustar00rootroot00000000000000$$ -*- mode: c++; -*- $var n = 50 $$ Maximum length of Values arguments we want to support. $var maxtuple = 10 $$ Maximum number of Combine arguments we want to support. // Copyright 2008, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // Macros and functions for implementing parameterized tests // in Google C++ Testing and Mocking Framework (Google Test) // // This file is generated by a SCRIPT. DO NOT EDIT BY HAND! // // GOOGLETEST_CM0001 DO NOT DELETE #ifndef GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_ #define GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_ // Value-parameterized tests allow you to test your code with different // parameters without writing multiple copies of the same test. // // Here is how you use value-parameterized tests: #if 0 // To write value-parameterized tests, first you should define a fixture // class. It is usually derived from testing::TestWithParam (see below for // another inheritance scheme that's sometimes useful in more complicated // class hierarchies), where the type of your parameter values. // TestWithParam is itself derived from testing::Test. T can be any // copyable type. If it's a raw pointer, you are responsible for managing the // lifespan of the pointed values. class FooTest : public ::testing::TestWithParam { // You can implement all the usual class fixture members here. }; // Then, use the TEST_P macro to define as many parameterized tests // for this fixture as you want. The _P suffix is for "parameterized" // or "pattern", whichever you prefer to think. TEST_P(FooTest, DoesBlah) { // Inside a test, access the test parameter with the GetParam() method // of the TestWithParam class: EXPECT_TRUE(foo.Blah(GetParam())); ... } TEST_P(FooTest, HasBlahBlah) { ... } // Finally, you can use INSTANTIATE_TEST_CASE_P to instantiate the test // case with any set of parameters you want. Google Test defines a number // of functions for generating test parameters. They return what we call // (surprise!) parameter generators. Here is a summary of them, which // are all in the testing namespace: // // // Range(begin, end [, step]) - Yields values {begin, begin+step, // begin+step+step, ...}. The values do not // include end. step defaults to 1. // Values(v1, v2, ..., vN) - Yields values {v1, v2, ..., vN}. // ValuesIn(container) - Yields values from a C-style array, an STL // ValuesIn(begin,end) container, or an iterator range [begin, end). // Bool() - Yields sequence {false, true}. // Combine(g1, g2, ..., gN) - Yields all combinations (the Cartesian product // for the math savvy) of the values generated // by the N generators. // // For more details, see comments at the definitions of these functions below // in this file. // // The following statement will instantiate tests from the FooTest test case // each with parameter values "meeny", "miny", and "moe". INSTANTIATE_TEST_CASE_P(InstantiationName, FooTest, Values("meeny", "miny", "moe")); // To distinguish different instances of the pattern, (yes, you // can instantiate it more then once) the first argument to the // INSTANTIATE_TEST_CASE_P macro is a prefix that will be added to the // actual test case name. Remember to pick unique prefixes for different // instantiations. The tests from the instantiation above will have // these names: // // * InstantiationName/FooTest.DoesBlah/0 for "meeny" // * InstantiationName/FooTest.DoesBlah/1 for "miny" // * InstantiationName/FooTest.DoesBlah/2 for "moe" // * InstantiationName/FooTest.HasBlahBlah/0 for "meeny" // * InstantiationName/FooTest.HasBlahBlah/1 for "miny" // * InstantiationName/FooTest.HasBlahBlah/2 for "moe" // // You can use these names in --gtest_filter. // // This statement will instantiate all tests from FooTest again, each // with parameter values "cat" and "dog": const char* pets[] = {"cat", "dog"}; INSTANTIATE_TEST_CASE_P(AnotherInstantiationName, FooTest, ValuesIn(pets)); // The tests from the instantiation above will have these names: // // * AnotherInstantiationName/FooTest.DoesBlah/0 for "cat" // * AnotherInstantiationName/FooTest.DoesBlah/1 for "dog" // * AnotherInstantiationName/FooTest.HasBlahBlah/0 for "cat" // * AnotherInstantiationName/FooTest.HasBlahBlah/1 for "dog" // // Please note that INSTANTIATE_TEST_CASE_P will instantiate all tests // in the given test case, whether their definitions come before or // AFTER the INSTANTIATE_TEST_CASE_P statement. // // Please also note that generator expressions (including parameters to the // generators) are evaluated in InitGoogleTest(), after main() has started. // This allows the user on one hand, to adjust generator parameters in order // to dynamically determine a set of tests to run and on the other hand, // give the user a chance to inspect the generated tests with Google Test // reflection API before RUN_ALL_TESTS() is executed. // // You can see samples/sample7_unittest.cc and samples/sample8_unittest.cc // for more examples. // // In the future, we plan to publish the API for defining new parameter // generators. But for now this interface remains part of the internal // implementation and is subject to change. // // // A parameterized test fixture must be derived from testing::Test and from // testing::WithParamInterface, where T is the type of the parameter // values. Inheriting from TestWithParam satisfies that requirement because // TestWithParam inherits from both Test and WithParamInterface. In more // complicated hierarchies, however, it is occasionally useful to inherit // separately from Test and WithParamInterface. For example: class BaseTest : public ::testing::Test { // You can inherit all the usual members for a non-parameterized test // fixture here. }; class DerivedTest : public BaseTest, public ::testing::WithParamInterface { // The usual test fixture members go here too. }; TEST_F(BaseTest, HasFoo) { // This is an ordinary non-parameterized test. } TEST_P(DerivedTest, DoesBlah) { // GetParam works just the same here as if you inherit from TestWithParam. EXPECT_TRUE(foo.Blah(GetParam())); } #endif // 0 #include "gtest/internal/gtest-port.h" #if !GTEST_OS_SYMBIAN # include #endif #include "gtest/internal/gtest-internal.h" #include "gtest/internal/gtest-param-util.h" #include "gtest/internal/gtest-param-util-generated.h" namespace testing { // Functions producing parameter generators. // // Google Test uses these generators to produce parameters for value- // parameterized tests. When a parameterized test case is instantiated // with a particular generator, Google Test creates and runs tests // for each element in the sequence produced by the generator. // // In the following sample, tests from test case FooTest are instantiated // each three times with parameter values 3, 5, and 8: // // class FooTest : public TestWithParam { ... }; // // TEST_P(FooTest, TestThis) { // } // TEST_P(FooTest, TestThat) { // } // INSTANTIATE_TEST_CASE_P(TestSequence, FooTest, Values(3, 5, 8)); // // Range() returns generators providing sequences of values in a range. // // Synopsis: // Range(start, end) // - returns a generator producing a sequence of values {start, start+1, // start+2, ..., }. // Range(start, end, step) // - returns a generator producing a sequence of values {start, start+step, // start+step+step, ..., }. // Notes: // * The generated sequences never include end. For example, Range(1, 5) // returns a generator producing a sequence {1, 2, 3, 4}. Range(1, 9, 2) // returns a generator producing {1, 3, 5, 7}. // * start and end must have the same type. That type may be any integral or // floating-point type or a user defined type satisfying these conditions: // * It must be assignable (have operator=() defined). // * It must have operator+() (operator+(int-compatible type) for // two-operand version). // * It must have operator<() defined. // Elements in the resulting sequences will also have that type. // * Condition start < end must be satisfied in order for resulting sequences // to contain any elements. // template internal::ParamGenerator Range(T start, T end, IncrementT step) { return internal::ParamGenerator( new internal::RangeGenerator(start, end, step)); } template internal::ParamGenerator Range(T start, T end) { return Range(start, end, 1); } // ValuesIn() function allows generation of tests with parameters coming from // a container. // // Synopsis: // ValuesIn(const T (&array)[N]) // - returns a generator producing sequences with elements from // a C-style array. // ValuesIn(const Container& container) // - returns a generator producing sequences with elements from // an STL-style container. // ValuesIn(Iterator begin, Iterator end) // - returns a generator producing sequences with elements from // a range [begin, end) defined by a pair of STL-style iterators. These // iterators can also be plain C pointers. // // Please note that ValuesIn copies the values from the containers // passed in and keeps them to generate tests in RUN_ALL_TESTS(). // // Examples: // // This instantiates tests from test case StringTest // each with C-string values of "foo", "bar", and "baz": // // const char* strings[] = {"foo", "bar", "baz"}; // INSTANTIATE_TEST_CASE_P(StringSequence, StringTest, ValuesIn(strings)); // // This instantiates tests from test case StlStringTest // each with STL strings with values "a" and "b": // // ::std::vector< ::std::string> GetParameterStrings() { // ::std::vector< ::std::string> v; // v.push_back("a"); // v.push_back("b"); // return v; // } // // INSTANTIATE_TEST_CASE_P(CharSequence, // StlStringTest, // ValuesIn(GetParameterStrings())); // // // This will also instantiate tests from CharTest // each with parameter values 'a' and 'b': // // ::std::list GetParameterChars() { // ::std::list list; // list.push_back('a'); // list.push_back('b'); // return list; // } // ::std::list l = GetParameterChars(); // INSTANTIATE_TEST_CASE_P(CharSequence2, // CharTest, // ValuesIn(l.begin(), l.end())); // template internal::ParamGenerator< typename ::testing::internal::IteratorTraits::value_type> ValuesIn(ForwardIterator begin, ForwardIterator end) { typedef typename ::testing::internal::IteratorTraits ::value_type ParamType; return internal::ParamGenerator( new internal::ValuesInIteratorRangeGenerator(begin, end)); } template internal::ParamGenerator ValuesIn(const T (&array)[N]) { return ValuesIn(array, array + N); } template internal::ParamGenerator ValuesIn( const Container& container) { return ValuesIn(container.begin(), container.end()); } // Values() allows generating tests from explicitly specified list of // parameters. // // Synopsis: // Values(T v1, T v2, ..., T vN) // - returns a generator producing sequences with elements v1, v2, ..., vN. // // For example, this instantiates tests from test case BarTest each // with values "one", "two", and "three": // // INSTANTIATE_TEST_CASE_P(NumSequence, BarTest, Values("one", "two", "three")); // // This instantiates tests from test case BazTest each with values 1, 2, 3.5. // The exact type of values will depend on the type of parameter in BazTest. // // INSTANTIATE_TEST_CASE_P(FloatingNumbers, BazTest, Values(1, 2, 3.5)); // // Currently, Values() supports from 1 to $n parameters. // $range i 1..n $for i [[ $range j 1..i template <$for j, [[typename T$j]]> internal::ValueArray$i<$for j, [[T$j]]> Values($for j, [[T$j v$j]]) { return internal::ValueArray$i<$for j, [[T$j]]>($for j, [[v$j]]); } ]] // Bool() allows generating tests with parameters in a set of (false, true). // // Synopsis: // Bool() // - returns a generator producing sequences with elements {false, true}. // // It is useful when testing code that depends on Boolean flags. Combinations // of multiple flags can be tested when several Bool()'s are combined using // Combine() function. // // In the following example all tests in the test case FlagDependentTest // will be instantiated twice with parameters false and true. // // class FlagDependentTest : public testing::TestWithParam { // virtual void SetUp() { // external_flag = GetParam(); // } // } // INSTANTIATE_TEST_CASE_P(BoolSequence, FlagDependentTest, Bool()); // inline internal::ParamGenerator Bool() { return Values(false, true); } # if GTEST_HAS_COMBINE // Combine() allows the user to combine two or more sequences to produce // values of a Cartesian product of those sequences' elements. // // Synopsis: // Combine(gen1, gen2, ..., genN) // - returns a generator producing sequences with elements coming from // the Cartesian product of elements from the sequences generated by // gen1, gen2, ..., genN. The sequence elements will have a type of // tuple where T1, T2, ..., TN are the types // of elements from sequences produces by gen1, gen2, ..., genN. // // Combine can have up to $maxtuple arguments. This number is currently limited // by the maximum number of elements in the tuple implementation used by Google // Test. // // Example: // // This will instantiate tests in test case AnimalTest each one with // the parameter values tuple("cat", BLACK), tuple("cat", WHITE), // tuple("dog", BLACK), and tuple("dog", WHITE): // // enum Color { BLACK, GRAY, WHITE }; // class AnimalTest // : public testing::TestWithParam > {...}; // // TEST_P(AnimalTest, AnimalLooksNice) {...} // // INSTANTIATE_TEST_CASE_P(AnimalVariations, AnimalTest, // Combine(Values("cat", "dog"), // Values(BLACK, WHITE))); // // This will instantiate tests in FlagDependentTest with all variations of two // Boolean flags: // // class FlagDependentTest // : public testing::TestWithParam > { // virtual void SetUp() { // // Assigns external_flag_1 and external_flag_2 values from the tuple. // tie(external_flag_1, external_flag_2) = GetParam(); // } // }; // // TEST_P(FlagDependentTest, TestFeature1) { // // Test your code using external_flag_1 and external_flag_2 here. // } // INSTANTIATE_TEST_CASE_P(TwoBoolSequence, FlagDependentTest, // Combine(Bool(), Bool())); // $range i 2..maxtuple $for i [[ $range j 1..i template <$for j, [[typename Generator$j]]> internal::CartesianProductHolder$i<$for j, [[Generator$j]]> Combine( $for j, [[const Generator$j& g$j]]) { return internal::CartesianProductHolder$i<$for j, [[Generator$j]]>( $for j, [[g$j]]); } ]] # endif // GTEST_HAS_COMBINE # define TEST_P(test_case_name, test_name) \ class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \ : public test_case_name { \ public: \ GTEST_TEST_CLASS_NAME_(test_case_name, test_name)() {} \ virtual void TestBody(); \ private: \ static int AddToRegistry() { \ ::testing::UnitTest::GetInstance()->parameterized_test_registry(). \ GetTestCasePatternHolder(\ #test_case_name, \ ::testing::internal::CodeLocation(\ __FILE__, __LINE__))->AddTestPattern(\ GTEST_STRINGIFY_(test_case_name), \ GTEST_STRINGIFY_(test_name), \ new ::testing::internal::TestMetaFactory< \ GTEST_TEST_CLASS_NAME_(\ test_case_name, test_name)>()); \ return 0; \ } \ static int gtest_registering_dummy_ GTEST_ATTRIBUTE_UNUSED_; \ GTEST_DISALLOW_COPY_AND_ASSIGN_(\ GTEST_TEST_CLASS_NAME_(test_case_name, test_name)); \ }; \ int GTEST_TEST_CLASS_NAME_(test_case_name, \ test_name)::gtest_registering_dummy_ = \ GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::AddToRegistry(); \ void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody() // The optional last argument to INSTANTIATE_TEST_CASE_P allows the user // to specify a function or functor that generates custom test name suffixes // based on the test parameters. The function should accept one argument of // type testing::TestParamInfo, and return std::string. // // testing::PrintToStringParamName is a builtin test suffix generator that // returns the value of testing::PrintToString(GetParam()). // // Note: test names must be non-empty, unique, and may only contain ASCII // alphanumeric characters or underscore. Because PrintToString adds quotes // to std::string and C strings, it won't work for these types. # define INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator, ...) \ static ::testing::internal::ParamGenerator \ gtest_##prefix##test_case_name##_EvalGenerator_() { return generator; } \ static ::std::string gtest_##prefix##test_case_name##_EvalGenerateName_( \ const ::testing::TestParamInfo& info) { \ return ::testing::internal::GetParamNameGen \ (__VA_ARGS__)(info); \ } \ static int gtest_##prefix##test_case_name##_dummy_ GTEST_ATTRIBUTE_UNUSED_ = \ ::testing::UnitTest::GetInstance()->parameterized_test_registry(). \ GetTestCasePatternHolder(\ #test_case_name, \ ::testing::internal::CodeLocation(\ __FILE__, __LINE__))->AddTestCaseInstantiation(\ #prefix, \ >est_##prefix##test_case_name##_EvalGenerator_, \ >est_##prefix##test_case_name##_EvalGenerateName_, \ __FILE__, __LINE__) } // namespace testing #endif // GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_ iptux-0.9.4/src/googletest/include/gtest/gtest-printers.h000066400000000000000000001155761475473122500236050ustar00rootroot00000000000000// Copyright 2007, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // Google Test - The Google C++ Testing and Mocking Framework // // This file implements a universal value printer that can print a // value of any type T: // // void ::testing::internal::UniversalPrinter::Print(value, ostream_ptr); // // A user can teach this function how to print a class type T by // defining either operator<<() or PrintTo() in the namespace that // defines T. More specifically, the FIRST defined function in the // following list will be used (assuming T is defined in namespace // foo): // // 1. foo::PrintTo(const T&, ostream*) // 2. operator<<(ostream&, const T&) defined in either foo or the // global namespace. // // However if T is an STL-style container then it is printed element-wise // unless foo::PrintTo(const T&, ostream*) is defined. Note that // operator<<() is ignored for container types. // // If none of the above is defined, it will print the debug string of // the value if it is a protocol buffer, or print the raw bytes in the // value otherwise. // // To aid debugging: when T is a reference type, the address of the // value is also printed; when T is a (const) char pointer, both the // pointer value and the NUL-terminated string it points to are // printed. // // We also provide some convenient wrappers: // // // Prints a value to a string. For a (const or not) char // // pointer, the NUL-terminated string (but not the pointer) is // // printed. // std::string ::testing::PrintToString(const T& value); // // // Prints a value tersely: for a reference type, the referenced // // value (but not the address) is printed; for a (const or not) char // // pointer, the NUL-terminated string (but not the pointer) is // // printed. // void ::testing::internal::UniversalTersePrint(const T& value, ostream*); // // // Prints value using the type inferred by the compiler. The difference // // from UniversalTersePrint() is that this function prints both the // // pointer and the NUL-terminated string for a (const or not) char pointer. // void ::testing::internal::UniversalPrint(const T& value, ostream*); // // // Prints the fields of a tuple tersely to a string vector, one // // element for each field. Tuple support must be enabled in // // gtest-port.h. // std::vector UniversalTersePrintTupleFieldsToStrings( // const Tuple& value); // // Known limitation: // // The print primitives print the elements of an STL-style container // using the compiler-inferred type of *iter where iter is a // const_iterator of the container. When const_iterator is an input // iterator but not a forward iterator, this inferred type may not // match value_type, and the print output may be incorrect. In // practice, this is rarely a problem as for most containers // const_iterator is a forward iterator. We'll fix this if there's an // actual need for it. Note that this fix cannot rely on value_type // being defined as many user-defined container types don't have // value_type. // GOOGLETEST_CM0001 DO NOT DELETE #ifndef GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_ #define GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_ #include // NOLINT #include #include #include #include #include "gtest/internal/gtest-port.h" #include "gtest/internal/gtest-internal.h" #if GTEST_HAS_STD_TUPLE_ # include #endif #if GTEST_HAS_ABSL #include "absl/strings/string_view.h" #include "absl/types/optional.h" #include "absl/types/variant.h" #endif // GTEST_HAS_ABSL namespace testing { // Definitions in the 'internal' and 'internal2' name spaces are // subject to change without notice. DO NOT USE THEM IN USER CODE! namespace internal2 { // Prints the given number of bytes in the given object to the given // ostream. GTEST_API_ void PrintBytesInObjectTo(const unsigned char* obj_bytes, size_t count, ::std::ostream* os); // For selecting which printer to use when a given type has neither << // nor PrintTo(). enum TypeKind { kProtobuf, // a protobuf type kConvertibleToInteger, // a type implicitly convertible to BiggestInt // (e.g. a named or unnamed enum type) #if GTEST_HAS_ABSL kConvertibleToStringView, // a type implicitly convertible to // absl::string_view #endif kOtherType // anything else }; // TypeWithoutFormatter::PrintValue(value, os) is called // by the universal printer to print a value of type T when neither // operator<< nor PrintTo() is defined for T, where kTypeKind is the // "kind" of T as defined by enum TypeKind. template class TypeWithoutFormatter { public: // This default version is called when kTypeKind is kOtherType. static void PrintValue(const T& value, ::std::ostream* os) { PrintBytesInObjectTo(static_cast( reinterpret_cast(&value)), sizeof(value), os); } }; // We print a protobuf using its ShortDebugString() when the string // doesn't exceed this many characters; otherwise we print it using // DebugString() for better readability. const size_t kProtobufOneLinerMaxLength = 50; template class TypeWithoutFormatter { public: static void PrintValue(const T& value, ::std::ostream* os) { std::string pretty_str = value.ShortDebugString(); if (pretty_str.length() > kProtobufOneLinerMaxLength) { pretty_str = "\n" + value.DebugString(); } *os << ("<" + pretty_str + ">"); } }; template class TypeWithoutFormatter { public: // Since T has no << operator or PrintTo() but can be implicitly // converted to BiggestInt, we print it as a BiggestInt. // // Most likely T is an enum type (either named or unnamed), in which // case printing it as an integer is the desired behavior. In case // T is not an enum, printing it as an integer is the best we can do // given that it has no user-defined printer. static void PrintValue(const T& value, ::std::ostream* os) { const internal::BiggestInt kBigInt = value; *os << kBigInt; } }; #if GTEST_HAS_ABSL template class TypeWithoutFormatter { public: // Since T has neither operator<< nor PrintTo() but can be implicitly // converted to absl::string_view, we print it as a absl::string_view. // // Note: the implementation is further below, as it depends on // internal::PrintTo symbol which is defined later in the file. static void PrintValue(const T& value, ::std::ostream* os); }; #endif // Prints the given value to the given ostream. If the value is a // protocol message, its debug string is printed; if it's an enum or // of a type implicitly convertible to BiggestInt, it's printed as an // integer; otherwise the bytes in the value are printed. This is // what UniversalPrinter::Print() does when it knows nothing about // type T and T has neither << operator nor PrintTo(). // // A user can override this behavior for a class type Foo by defining // a << operator in the namespace where Foo is defined. // // We put this operator in namespace 'internal2' instead of 'internal' // to simplify the implementation, as much code in 'internal' needs to // use << in STL, which would conflict with our own << were it defined // in 'internal'. // // Note that this operator<< takes a generic std::basic_ostream type instead of the more restricted std::ostream. If // we define it to take an std::ostream instead, we'll get an // "ambiguous overloads" compiler error when trying to print a type // Foo that supports streaming to std::basic_ostream, as the compiler cannot tell whether // operator<<(std::ostream&, const T&) or // operator<<(std::basic_stream, const Foo&) is more // specific. template ::std::basic_ostream& operator<<( ::std::basic_ostream& os, const T& x) { TypeWithoutFormatter::value ? kProtobuf : internal::ImplicitlyConvertible< const T&, internal::BiggestInt>::value ? kConvertibleToInteger : #if GTEST_HAS_ABSL internal::ImplicitlyConvertible< const T&, absl::string_view>::value ? kConvertibleToStringView : #endif kOtherType)>::PrintValue(x, &os); return os; } } // namespace internal2 } // namespace testing // This namespace MUST NOT BE NESTED IN ::testing, or the name look-up // magic needed for implementing UniversalPrinter won't work. namespace testing_internal { // Used to print a value that is not an STL-style container when the // user doesn't define PrintTo() for it. template void DefaultPrintNonContainerTo(const T& value, ::std::ostream* os) { // With the following statement, during unqualified name lookup, // testing::internal2::operator<< appears as if it was declared in // the nearest enclosing namespace that contains both // ::testing_internal and ::testing::internal2, i.e. the global // namespace. For more details, refer to the C++ Standard section // 7.3.4-1 [namespace.udir]. This allows us to fall back onto // testing::internal2::operator<< in case T doesn't come with a << // operator. // // We cannot write 'using ::testing::internal2::operator<<;', which // gcc 3.3 fails to compile due to a compiler bug. using namespace ::testing::internal2; // NOLINT // Assuming T is defined in namespace foo, in the next statement, // the compiler will consider all of: // // 1. foo::operator<< (thanks to Koenig look-up), // 2. ::operator<< (as the current namespace is enclosed in ::), // 3. testing::internal2::operator<< (thanks to the using statement above). // // The operator<< whose type matches T best will be picked. // // We deliberately allow #2 to be a candidate, as sometimes it's // impossible to define #1 (e.g. when foo is ::std, defining // anything in it is undefined behavior unless you are a compiler // vendor.). *os << value; } } // namespace testing_internal namespace testing { namespace internal { // FormatForComparison::Format(value) formats a // value of type ToPrint that is an operand of a comparison assertion // (e.g. ASSERT_EQ). OtherOperand is the type of the other operand in // the comparison, and is used to help determine the best way to // format the value. In particular, when the value is a C string // (char pointer) and the other operand is an STL string object, we // want to format the C string as a string, since we know it is // compared by value with the string object. If the value is a char // pointer but the other operand is not an STL string object, we don't // know whether the pointer is supposed to point to a NUL-terminated // string, and thus want to print it as a pointer to be safe. // // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. // The default case. template class FormatForComparison { public: static ::std::string Format(const ToPrint& value) { return ::testing::PrintToString(value); } }; // Array. template class FormatForComparison { public: static ::std::string Format(const ToPrint* value) { return FormatForComparison::Format(value); } }; // By default, print C string as pointers to be safe, as we don't know // whether they actually point to a NUL-terminated string. #define GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(CharType) \ template \ class FormatForComparison { \ public: \ static ::std::string Format(CharType* value) { \ return ::testing::PrintToString(static_cast(value)); \ } \ } GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(char); GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(const char); GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(wchar_t); GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(const wchar_t); #undef GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_ // If a C string is compared with an STL string object, we know it's meant // to point to a NUL-terminated string, and thus can print it as a string. #define GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(CharType, OtherStringType) \ template <> \ class FormatForComparison { \ public: \ static ::std::string Format(CharType* value) { \ return ::testing::PrintToString(value); \ } \ } GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(char, ::std::string); GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const char, ::std::string); #if GTEST_HAS_GLOBAL_STRING GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(char, ::string); GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const char, ::string); #endif #if GTEST_HAS_GLOBAL_WSTRING GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(wchar_t, ::wstring); GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const wchar_t, ::wstring); #endif #if GTEST_HAS_STD_WSTRING GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(wchar_t, ::std::wstring); GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const wchar_t, ::std::wstring); #endif #undef GTEST_IMPL_FORMAT_C_STRING_AS_STRING_ // Formats a comparison assertion (e.g. ASSERT_EQ, EXPECT_LT, and etc) // operand to be used in a failure message. The type (but not value) // of the other operand may affect the format. This allows us to // print a char* as a raw pointer when it is compared against another // char* or void*, and print it as a C string when it is compared // against an std::string object, for example. // // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. template std::string FormatForComparisonFailureMessage( const T1& value, const T2& /* other_operand */) { return FormatForComparison::Format(value); } // UniversalPrinter::Print(value, ostream_ptr) prints the given // value to the given ostream. The caller must ensure that // 'ostream_ptr' is not NULL, or the behavior is undefined. // // We define UniversalPrinter as a class template (as opposed to a // function template), as we need to partially specialize it for // reference types, which cannot be done with function templates. template class UniversalPrinter; template void UniversalPrint(const T& value, ::std::ostream* os); enum DefaultPrinterType { kPrintContainer, kPrintPointer, kPrintFunctionPointer, kPrintOther, }; template struct WrapPrinterType {}; // Used to print an STL-style container when the user doesn't define // a PrintTo() for it. template void DefaultPrintTo(WrapPrinterType /* dummy */, const C& container, ::std::ostream* os) { const size_t kMaxCount = 32; // The maximum number of elements to print. *os << '{'; size_t count = 0; for (typename C::const_iterator it = container.begin(); it != container.end(); ++it, ++count) { if (count > 0) { *os << ','; if (count == kMaxCount) { // Enough has been printed. *os << " ..."; break; } } *os << ' '; // We cannot call PrintTo(*it, os) here as PrintTo() doesn't // handle *it being a native array. internal::UniversalPrint(*it, os); } if (count > 0) { *os << ' '; } *os << '}'; } // Used to print a pointer that is neither a char pointer nor a member // pointer, when the user doesn't define PrintTo() for it. (A member // variable pointer or member function pointer doesn't really point to // a location in the address space. Their representation is // implementation-defined. Therefore they will be printed as raw // bytes.) template void DefaultPrintTo(WrapPrinterType /* dummy */, T* p, ::std::ostream* os) { if (p == NULL) { *os << "NULL"; } else { // T is not a function type. We just call << to print p, // relying on ADL to pick up user-defined << for their pointer // types, if any. *os << p; } } template void DefaultPrintTo(WrapPrinterType /* dummy */, T* p, ::std::ostream* os) { if (p == NULL) { *os << "NULL"; } else { // T is a function type, so '*os << p' doesn't do what we want // (it just prints p as bool). We want to print p as a const // void*. *os << reinterpret_cast(p); } } // Used to print a non-container, non-pointer value when the user // doesn't define PrintTo() for it. template void DefaultPrintTo(WrapPrinterType /* dummy */, const T& value, ::std::ostream* os) { ::testing_internal::DefaultPrintNonContainerTo(value, os); } // Prints the given value using the << operator if it has one; // otherwise prints the bytes in it. This is what // UniversalPrinter::Print() does when PrintTo() is not specialized // or overloaded for type T. // // A user can override this behavior for a class type Foo by defining // an overload of PrintTo() in the namespace where Foo is defined. We // give the user this option as sometimes defining a << operator for // Foo is not desirable (e.g. the coding style may prevent doing it, // or there is already a << operator but it doesn't do what the user // wants). template void PrintTo(const T& value, ::std::ostream* os) { // DefaultPrintTo() is overloaded. The type of its first argument // determines which version will be picked. // // Note that we check for container types here, prior to we check // for protocol message types in our operator<<. The rationale is: // // For protocol messages, we want to give people a chance to // override Google Mock's format by defining a PrintTo() or // operator<<. For STL containers, other formats can be // incompatible with Google Mock's format for the container // elements; therefore we check for container types here to ensure // that our format is used. // // Note that MSVC and clang-cl do allow an implicit conversion from // pointer-to-function to pointer-to-object, but clang-cl warns on it. // So don't use ImplicitlyConvertible if it can be helped since it will // cause this warning, and use a separate overload of DefaultPrintTo for // function pointers so that the `*os << p` in the object pointer overload // doesn't cause that warning either. DefaultPrintTo( WrapPrinterType < (sizeof(IsContainerTest(0)) == sizeof(IsContainer)) && !IsRecursiveContainer::value ? kPrintContainer : !is_pointer::value ? kPrintOther #if GTEST_LANG_CXX11 : std::is_function::type>::value #else : !internal::ImplicitlyConvertible::value #endif ? kPrintFunctionPointer : kPrintPointer > (), value, os); } // The following list of PrintTo() overloads tells // UniversalPrinter::Print() how to print standard types (built-in // types, strings, plain arrays, and pointers). // Overloads for various char types. GTEST_API_ void PrintTo(unsigned char c, ::std::ostream* os); GTEST_API_ void PrintTo(signed char c, ::std::ostream* os); inline void PrintTo(char c, ::std::ostream* os) { // When printing a plain char, we always treat it as unsigned. This // way, the output won't be affected by whether the compiler thinks // char is signed or not. PrintTo(static_cast(c), os); } // Overloads for other simple built-in types. inline void PrintTo(bool x, ::std::ostream* os) { *os << (x ? "true" : "false"); } // Overload for wchar_t type. // Prints a wchar_t as a symbol if it is printable or as its internal // code otherwise and also as its decimal code (except for L'\0'). // The L'\0' char is printed as "L'\\0'". The decimal code is printed // as signed integer when wchar_t is implemented by the compiler // as a signed type and is printed as an unsigned integer when wchar_t // is implemented as an unsigned type. GTEST_API_ void PrintTo(wchar_t wc, ::std::ostream* os); // Overloads for C strings. GTEST_API_ void PrintTo(const char* s, ::std::ostream* os); inline void PrintTo(char* s, ::std::ostream* os) { PrintTo(ImplicitCast_(s), os); } // signed/unsigned char is often used for representing binary data, so // we print pointers to it as void* to be safe. inline void PrintTo(const signed char* s, ::std::ostream* os) { PrintTo(ImplicitCast_(s), os); } inline void PrintTo(signed char* s, ::std::ostream* os) { PrintTo(ImplicitCast_(s), os); } inline void PrintTo(const unsigned char* s, ::std::ostream* os) { PrintTo(ImplicitCast_(s), os); } inline void PrintTo(unsigned char* s, ::std::ostream* os) { PrintTo(ImplicitCast_(s), os); } // MSVC can be configured to define wchar_t as a typedef of unsigned // short. It defines _NATIVE_WCHAR_T_DEFINED when wchar_t is a native // type. When wchar_t is a typedef, defining an overload for const // wchar_t* would cause unsigned short* be printed as a wide string, // possibly causing invalid memory accesses. #if !defined(_MSC_VER) || defined(_NATIVE_WCHAR_T_DEFINED) // Overloads for wide C strings GTEST_API_ void PrintTo(const wchar_t* s, ::std::ostream* os); inline void PrintTo(wchar_t* s, ::std::ostream* os) { PrintTo(ImplicitCast_(s), os); } #endif // Overload for C arrays. Multi-dimensional arrays are printed // properly. // Prints the given number of elements in an array, without printing // the curly braces. template void PrintRawArrayTo(const T a[], size_t count, ::std::ostream* os) { UniversalPrint(a[0], os); for (size_t i = 1; i != count; i++) { *os << ", "; UniversalPrint(a[i], os); } } // Overloads for ::string and ::std::string. #if GTEST_HAS_GLOBAL_STRING GTEST_API_ void PrintStringTo(const ::string&s, ::std::ostream* os); inline void PrintTo(const ::string& s, ::std::ostream* os) { PrintStringTo(s, os); } #endif // GTEST_HAS_GLOBAL_STRING GTEST_API_ void PrintStringTo(const ::std::string&s, ::std::ostream* os); inline void PrintTo(const ::std::string& s, ::std::ostream* os) { PrintStringTo(s, os); } // Overloads for ::wstring and ::std::wstring. #if GTEST_HAS_GLOBAL_WSTRING GTEST_API_ void PrintWideStringTo(const ::wstring&s, ::std::ostream* os); inline void PrintTo(const ::wstring& s, ::std::ostream* os) { PrintWideStringTo(s, os); } #endif // GTEST_HAS_GLOBAL_WSTRING #if GTEST_HAS_STD_WSTRING GTEST_API_ void PrintWideStringTo(const ::std::wstring&s, ::std::ostream* os); inline void PrintTo(const ::std::wstring& s, ::std::ostream* os) { PrintWideStringTo(s, os); } #endif // GTEST_HAS_STD_WSTRING #if GTEST_HAS_ABSL // Overload for absl::string_view. inline void PrintTo(absl::string_view sp, ::std::ostream* os) { PrintTo(::std::string(sp), os); } #endif // GTEST_HAS_ABSL #if GTEST_LANG_CXX11 inline void PrintTo(std::nullptr_t, ::std::ostream* os) { *os << "(nullptr)"; } #endif // GTEST_LANG_CXX11 #if GTEST_HAS_TR1_TUPLE || GTEST_HAS_STD_TUPLE_ // Helper function for printing a tuple. T must be instantiated with // a tuple type. template void PrintTupleTo(const T& t, ::std::ostream* os); #endif // GTEST_HAS_TR1_TUPLE || GTEST_HAS_STD_TUPLE_ #if GTEST_HAS_TR1_TUPLE // Overload for ::std::tr1::tuple. Needed for printing function arguments, // which are packed as tuples. // Overloaded PrintTo() for tuples of various arities. We support // tuples of up-to 10 fields. The following implementation works // regardless of whether tr1::tuple is implemented using the // non-standard variadic template feature or not. inline void PrintTo(const ::std::tr1::tuple<>& t, ::std::ostream* os) { PrintTupleTo(t, os); } template void PrintTo(const ::std::tr1::tuple& t, ::std::ostream* os) { PrintTupleTo(t, os); } template void PrintTo(const ::std::tr1::tuple& t, ::std::ostream* os) { PrintTupleTo(t, os); } template void PrintTo(const ::std::tr1::tuple& t, ::std::ostream* os) { PrintTupleTo(t, os); } template void PrintTo(const ::std::tr1::tuple& t, ::std::ostream* os) { PrintTupleTo(t, os); } template void PrintTo(const ::std::tr1::tuple& t, ::std::ostream* os) { PrintTupleTo(t, os); } template void PrintTo(const ::std::tr1::tuple& t, ::std::ostream* os) { PrintTupleTo(t, os); } template void PrintTo(const ::std::tr1::tuple& t, ::std::ostream* os) { PrintTupleTo(t, os); } template void PrintTo(const ::std::tr1::tuple& t, ::std::ostream* os) { PrintTupleTo(t, os); } template void PrintTo(const ::std::tr1::tuple& t, ::std::ostream* os) { PrintTupleTo(t, os); } template void PrintTo( const ::std::tr1::tuple& t, ::std::ostream* os) { PrintTupleTo(t, os); } #endif // GTEST_HAS_TR1_TUPLE #if GTEST_HAS_STD_TUPLE_ template void PrintTo(const ::std::tuple& t, ::std::ostream* os) { PrintTupleTo(t, os); } #endif // GTEST_HAS_STD_TUPLE_ // Overload for std::pair. template void PrintTo(const ::std::pair& value, ::std::ostream* os) { *os << '('; // We cannot use UniversalPrint(value.first, os) here, as T1 may be // a reference type. The same for printing value.second. UniversalPrinter::Print(value.first, os); *os << ", "; UniversalPrinter::Print(value.second, os); *os << ')'; } // Implements printing a non-reference type T by letting the compiler // pick the right overload of PrintTo() for T. template class UniversalPrinter { public: // MSVC warns about adding const to a function type, so we want to // disable the warning. GTEST_DISABLE_MSC_WARNINGS_PUSH_(4180) // Note: we deliberately don't call this PrintTo(), as that name // conflicts with ::testing::internal::PrintTo in the body of the // function. static void Print(const T& value, ::std::ostream* os) { // By default, ::testing::internal::PrintTo() is used for printing // the value. // // Thanks to Koenig look-up, if T is a class and has its own // PrintTo() function defined in its namespace, that function will // be visible here. Since it is more specific than the generic ones // in ::testing::internal, it will be picked by the compiler in the // following statement - exactly what we want. PrintTo(value, os); } GTEST_DISABLE_MSC_WARNINGS_POP_() }; #if GTEST_HAS_ABSL // Printer for absl::optional template class UniversalPrinter<::absl::optional> { public: static void Print(const ::absl::optional& value, ::std::ostream* os) { *os << '('; if (!value) { *os << "nullopt"; } else { UniversalPrint(*value, os); } *os << ')'; } }; // Printer for absl::variant template class UniversalPrinter<::absl::variant> { public: static void Print(const ::absl::variant& value, ::std::ostream* os) { *os << '('; absl::visit(Visitor{os}, value); *os << ')'; } private: struct Visitor { template void operator()(const U& u) const { *os << "'" << GetTypeName() << "' with value "; UniversalPrint(u, os); } ::std::ostream* os; }; }; #endif // GTEST_HAS_ABSL // UniversalPrintArray(begin, len, os) prints an array of 'len' // elements, starting at address 'begin'. template void UniversalPrintArray(const T* begin, size_t len, ::std::ostream* os) { if (len == 0) { *os << "{}"; } else { *os << "{ "; const size_t kThreshold = 18; const size_t kChunkSize = 8; // If the array has more than kThreshold elements, we'll have to // omit some details by printing only the first and the last // kChunkSize elements. // FIXME: let the user control the threshold using a flag. if (len <= kThreshold) { PrintRawArrayTo(begin, len, os); } else { PrintRawArrayTo(begin, kChunkSize, os); *os << ", ..., "; PrintRawArrayTo(begin + len - kChunkSize, kChunkSize, os); } *os << " }"; } } // This overload prints a (const) char array compactly. GTEST_API_ void UniversalPrintArray( const char* begin, size_t len, ::std::ostream* os); // This overload prints a (const) wchar_t array compactly. GTEST_API_ void UniversalPrintArray( const wchar_t* begin, size_t len, ::std::ostream* os); // Implements printing an array type T[N]. template class UniversalPrinter { public: // Prints the given array, omitting some elements when there are too // many. static void Print(const T (&a)[N], ::std::ostream* os) { UniversalPrintArray(a, N, os); } }; // Implements printing a reference type T&. template class UniversalPrinter { public: // MSVC warns about adding const to a function type, so we want to // disable the warning. GTEST_DISABLE_MSC_WARNINGS_PUSH_(4180) static void Print(const T& value, ::std::ostream* os) { // Prints the address of the value. We use reinterpret_cast here // as static_cast doesn't compile when T is a function type. *os << "@" << reinterpret_cast(&value) << " "; // Then prints the value itself. UniversalPrint(value, os); } GTEST_DISABLE_MSC_WARNINGS_POP_() }; // Prints a value tersely: for a reference type, the referenced value // (but not the address) is printed; for a (const) char pointer, the // NUL-terminated string (but not the pointer) is printed. template class UniversalTersePrinter { public: static void Print(const T& value, ::std::ostream* os) { UniversalPrint(value, os); } }; template class UniversalTersePrinter { public: static void Print(const T& value, ::std::ostream* os) { UniversalPrint(value, os); } }; template class UniversalTersePrinter { public: static void Print(const T (&value)[N], ::std::ostream* os) { UniversalPrinter::Print(value, os); } }; template <> class UniversalTersePrinter { public: static void Print(const char* str, ::std::ostream* os) { if (str == NULL) { *os << "NULL"; } else { UniversalPrint(std::string(str), os); } } }; template <> class UniversalTersePrinter { public: static void Print(char* str, ::std::ostream* os) { UniversalTersePrinter::Print(str, os); } }; #if GTEST_HAS_STD_WSTRING template <> class UniversalTersePrinter { public: static void Print(const wchar_t* str, ::std::ostream* os) { if (str == NULL) { *os << "NULL"; } else { UniversalPrint(::std::wstring(str), os); } } }; #endif template <> class UniversalTersePrinter { public: static void Print(wchar_t* str, ::std::ostream* os) { UniversalTersePrinter::Print(str, os); } }; template void UniversalTersePrint(const T& value, ::std::ostream* os) { UniversalTersePrinter::Print(value, os); } // Prints a value using the type inferred by the compiler. The // difference between this and UniversalTersePrint() is that for a // (const) char pointer, this prints both the pointer and the // NUL-terminated string. template void UniversalPrint(const T& value, ::std::ostream* os) { // A workarond for the bug in VC++ 7.1 that prevents us from instantiating // UniversalPrinter with T directly. typedef T T1; UniversalPrinter::Print(value, os); } typedef ::std::vector< ::std::string> Strings; // TuplePolicy must provide: // - tuple_size // size of tuple TupleT. // - get(const TupleT& t) // static function extracting element I of tuple TupleT. // - tuple_element::type // type of element I of tuple TupleT. template struct TuplePolicy; #if GTEST_HAS_TR1_TUPLE template struct TuplePolicy { typedef TupleT Tuple; static const size_t tuple_size = ::std::tr1::tuple_size::value; template struct tuple_element : ::std::tr1::tuple_element(I), Tuple> { }; template static typename AddReference(I), Tuple>::type>::type get(const Tuple& tuple) { return ::std::tr1::get(tuple); } }; template const size_t TuplePolicy::tuple_size; #endif // GTEST_HAS_TR1_TUPLE #if GTEST_HAS_STD_TUPLE_ template struct TuplePolicy< ::std::tuple > { typedef ::std::tuple Tuple; static const size_t tuple_size = ::std::tuple_size::value; template struct tuple_element : ::std::tuple_element {}; template static const typename ::std::tuple_element::type& get( const Tuple& tuple) { return ::std::get(tuple); } }; template const size_t TuplePolicy< ::std::tuple >::tuple_size; #endif // GTEST_HAS_STD_TUPLE_ #if GTEST_HAS_TR1_TUPLE || GTEST_HAS_STD_TUPLE_ // This helper template allows PrintTo() for tuples and // UniversalTersePrintTupleFieldsToStrings() to be defined by // induction on the number of tuple fields. The idea is that // TuplePrefixPrinter::PrintPrefixTo(t, os) prints the first N // fields in tuple t, and can be defined in terms of // TuplePrefixPrinter. // // The inductive case. template struct TuplePrefixPrinter { // Prints the first N fields of a tuple. template static void PrintPrefixTo(const Tuple& t, ::std::ostream* os) { TuplePrefixPrinter::PrintPrefixTo(t, os); GTEST_INTENTIONAL_CONST_COND_PUSH_() if (N > 1) { GTEST_INTENTIONAL_CONST_COND_POP_() *os << ", "; } UniversalPrinter< typename TuplePolicy::template tuple_element::type> ::Print(TuplePolicy::template get(t), os); } // Tersely prints the first N fields of a tuple to a string vector, // one element for each field. template static void TersePrintPrefixToStrings(const Tuple& t, Strings* strings) { TuplePrefixPrinter::TersePrintPrefixToStrings(t, strings); ::std::stringstream ss; UniversalTersePrint(TuplePolicy::template get(t), &ss); strings->push_back(ss.str()); } }; // Base case. template <> struct TuplePrefixPrinter<0> { template static void PrintPrefixTo(const Tuple&, ::std::ostream*) {} template static void TersePrintPrefixToStrings(const Tuple&, Strings*) {} }; // Helper function for printing a tuple. // Tuple must be either std::tr1::tuple or std::tuple type. template void PrintTupleTo(const Tuple& t, ::std::ostream* os) { *os << "("; TuplePrefixPrinter::tuple_size>::PrintPrefixTo(t, os); *os << ")"; } // Prints the fields of a tuple tersely to a string vector, one // element for each field. See the comment before // UniversalTersePrint() for how we define "tersely". template Strings UniversalTersePrintTupleFieldsToStrings(const Tuple& value) { Strings result; TuplePrefixPrinter::tuple_size>:: TersePrintPrefixToStrings(value, &result); return result; } #endif // GTEST_HAS_TR1_TUPLE || GTEST_HAS_STD_TUPLE_ } // namespace internal #if GTEST_HAS_ABSL namespace internal2 { template void TypeWithoutFormatter::PrintValue( const T& value, ::std::ostream* os) { internal::PrintTo(absl::string_view(value), os); } } // namespace internal2 #endif template ::std::string PrintToString(const T& value) { ::std::stringstream ss; internal::UniversalTersePrinter::Print(value, &ss); return ss.str(); } } // namespace testing // Include any custom printer added by the local installation. // We must include this header at the end to make sure it can use the // declarations from this file. #include "gtest/internal/custom/gtest-printers.h" #endif // GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_ iptux-0.9.4/src/googletest/include/gtest/gtest-spi.h000066400000000000000000000235561475473122500225260ustar00rootroot00000000000000// Copyright 2007, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // Utilities for testing Google Test itself and code that uses Google Test // (e.g. frameworks built on top of Google Test). // GOOGLETEST_CM0004 DO NOT DELETE #ifndef GTEST_INCLUDE_GTEST_GTEST_SPI_H_ #define GTEST_INCLUDE_GTEST_GTEST_SPI_H_ #include "gtest/gtest.h" GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \ /* class A needs to have dll-interface to be used by clients of class B */) namespace testing { // This helper class can be used to mock out Google Test failure reporting // so that we can test Google Test or code that builds on Google Test. // // An object of this class appends a TestPartResult object to the // TestPartResultArray object given in the constructor whenever a Google Test // failure is reported. It can either intercept only failures that are // generated in the same thread that created this object or it can intercept // all generated failures. The scope of this mock object can be controlled with // the second argument to the two arguments constructor. class GTEST_API_ ScopedFakeTestPartResultReporter : public TestPartResultReporterInterface { public: // The two possible mocking modes of this object. enum InterceptMode { INTERCEPT_ONLY_CURRENT_THREAD, // Intercepts only thread local failures. INTERCEPT_ALL_THREADS // Intercepts all failures. }; // The c'tor sets this object as the test part result reporter used // by Google Test. The 'result' parameter specifies where to report the // results. This reporter will only catch failures generated in the current // thread. DEPRECATED explicit ScopedFakeTestPartResultReporter(TestPartResultArray* result); // Same as above, but you can choose the interception scope of this object. ScopedFakeTestPartResultReporter(InterceptMode intercept_mode, TestPartResultArray* result); // The d'tor restores the previous test part result reporter. virtual ~ScopedFakeTestPartResultReporter(); // Appends the TestPartResult object to the TestPartResultArray // received in the constructor. // // This method is from the TestPartResultReporterInterface // interface. virtual void ReportTestPartResult(const TestPartResult& result); private: void Init(); const InterceptMode intercept_mode_; TestPartResultReporterInterface* old_reporter_; TestPartResultArray* const result_; GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedFakeTestPartResultReporter); }; namespace internal { // A helper class for implementing EXPECT_FATAL_FAILURE() and // EXPECT_NONFATAL_FAILURE(). Its destructor verifies that the given // TestPartResultArray contains exactly one failure that has the given // type and contains the given substring. If that's not the case, a // non-fatal failure will be generated. class GTEST_API_ SingleFailureChecker { public: // The constructor remembers the arguments. SingleFailureChecker(const TestPartResultArray* results, TestPartResult::Type type, const std::string& substr); ~SingleFailureChecker(); private: const TestPartResultArray* const results_; const TestPartResult::Type type_; const std::string substr_; GTEST_DISALLOW_COPY_AND_ASSIGN_(SingleFailureChecker); }; } // namespace internal } // namespace testing GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251 // A set of macros for testing Google Test assertions or code that's expected // to generate Google Test fatal failures. It verifies that the given // statement will cause exactly one fatal Google Test failure with 'substr' // being part of the failure message. // // There are two different versions of this macro. EXPECT_FATAL_FAILURE only // affects and considers failures generated in the current thread and // EXPECT_FATAL_FAILURE_ON_ALL_THREADS does the same but for all threads. // // The verification of the assertion is done correctly even when the statement // throws an exception or aborts the current function. // // Known restrictions: // - 'statement' cannot reference local non-static variables or // non-static members of the current object. // - 'statement' cannot return a value. // - You cannot stream a failure message to this macro. // // Note that even though the implementations of the following two // macros are much alike, we cannot refactor them to use a common // helper macro, due to some peculiarity in how the preprocessor // works. The AcceptsMacroThatExpandsToUnprotectedComma test in // gtest_unittest.cc will fail to compile if we do that. #define EXPECT_FATAL_FAILURE(statement, substr) \ do { \ class GTestExpectFatalFailureHelper {\ public:\ static void Execute() { statement; }\ };\ ::testing::TestPartResultArray gtest_failures;\ ::testing::internal::SingleFailureChecker gtest_checker(\ >est_failures, ::testing::TestPartResult::kFatalFailure, (substr));\ {\ ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\ ::testing::ScopedFakeTestPartResultReporter:: \ INTERCEPT_ONLY_CURRENT_THREAD, >est_failures);\ GTestExpectFatalFailureHelper::Execute();\ }\ } while (::testing::internal::AlwaysFalse()) #define EXPECT_FATAL_FAILURE_ON_ALL_THREADS(statement, substr) \ do { \ class GTestExpectFatalFailureHelper {\ public:\ static void Execute() { statement; }\ };\ ::testing::TestPartResultArray gtest_failures;\ ::testing::internal::SingleFailureChecker gtest_checker(\ >est_failures, ::testing::TestPartResult::kFatalFailure, (substr));\ {\ ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\ ::testing::ScopedFakeTestPartResultReporter:: \ INTERCEPT_ALL_THREADS, >est_failures);\ GTestExpectFatalFailureHelper::Execute();\ }\ } while (::testing::internal::AlwaysFalse()) // A macro for testing Google Test assertions or code that's expected to // generate Google Test non-fatal failures. It asserts that the given // statement will cause exactly one non-fatal Google Test failure with 'substr' // being part of the failure message. // // There are two different versions of this macro. EXPECT_NONFATAL_FAILURE only // affects and considers failures generated in the current thread and // EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS does the same but for all threads. // // 'statement' is allowed to reference local variables and members of // the current object. // // The verification of the assertion is done correctly even when the statement // throws an exception or aborts the current function. // // Known restrictions: // - You cannot stream a failure message to this macro. // // Note that even though the implementations of the following two // macros are much alike, we cannot refactor them to use a common // helper macro, due to some peculiarity in how the preprocessor // works. If we do that, the code won't compile when the user gives // EXPECT_NONFATAL_FAILURE() a statement that contains a macro that // expands to code containing an unprotected comma. The // AcceptsMacroThatExpandsToUnprotectedComma test in gtest_unittest.cc // catches that. // // For the same reason, we have to write // if (::testing::internal::AlwaysTrue()) { statement; } // instead of // GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement) // to avoid an MSVC warning on unreachable code. #define EXPECT_NONFATAL_FAILURE(statement, substr) \ do {\ ::testing::TestPartResultArray gtest_failures;\ ::testing::internal::SingleFailureChecker gtest_checker(\ >est_failures, ::testing::TestPartResult::kNonFatalFailure, \ (substr));\ {\ ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\ ::testing::ScopedFakeTestPartResultReporter:: \ INTERCEPT_ONLY_CURRENT_THREAD, >est_failures);\ if (::testing::internal::AlwaysTrue()) { statement; }\ }\ } while (::testing::internal::AlwaysFalse()) #define EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(statement, substr) \ do {\ ::testing::TestPartResultArray gtest_failures;\ ::testing::internal::SingleFailureChecker gtest_checker(\ >est_failures, ::testing::TestPartResult::kNonFatalFailure, \ (substr));\ {\ ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\ ::testing::ScopedFakeTestPartResultReporter::INTERCEPT_ALL_THREADS, \ >est_failures);\ if (::testing::internal::AlwaysTrue()) { statement; }\ }\ } while (::testing::internal::AlwaysFalse()) #endif // GTEST_INCLUDE_GTEST_GTEST_SPI_H_ iptux-0.9.4/src/googletest/include/gtest/gtest-test-part.h000066400000000000000000000150161475473122500236460ustar00rootroot00000000000000// Copyright 2008, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // GOOGLETEST_CM0001 DO NOT DELETE #ifndef GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_ #define GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_ #include #include #include "gtest/internal/gtest-internal.h" #include "gtest/internal/gtest-string.h" GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \ /* class A needs to have dll-interface to be used by clients of class B */) namespace testing { // A copyable object representing the result of a test part (i.e. an // assertion or an explicit FAIL(), ADD_FAILURE(), or SUCCESS()). // // Don't inherit from TestPartResult as its destructor is not virtual. class GTEST_API_ TestPartResult { public: // The possible outcomes of a test part (i.e. an assertion or an // explicit SUCCEED(), FAIL(), or ADD_FAILURE()). enum Type { kSuccess, // Succeeded. kNonFatalFailure, // Failed but the test can continue. kFatalFailure // Failed and the test should be terminated. }; // C'tor. TestPartResult does NOT have a default constructor. // Always use this constructor (with parameters) to create a // TestPartResult object. TestPartResult(Type a_type, const char* a_file_name, int a_line_number, const char* a_message) : type_(a_type), file_name_(a_file_name == NULL ? "" : a_file_name), line_number_(a_line_number), summary_(ExtractSummary(a_message)), message_(a_message) { } // Gets the outcome of the test part. Type type() const { return type_; } // Gets the name of the source file where the test part took place, or // NULL if it's unknown. const char* file_name() const { return file_name_.empty() ? NULL : file_name_.c_str(); } // Gets the line in the source file where the test part took place, // or -1 if it's unknown. int line_number() const { return line_number_; } // Gets the summary of the failure message. const char* summary() const { return summary_.c_str(); } // Gets the message associated with the test part. const char* message() const { return message_.c_str(); } // Returns true iff the test part passed. bool passed() const { return type_ == kSuccess; } // Returns true iff the test part failed. bool failed() const { return type_ != kSuccess; } // Returns true iff the test part non-fatally failed. bool nonfatally_failed() const { return type_ == kNonFatalFailure; } // Returns true iff the test part fatally failed. bool fatally_failed() const { return type_ == kFatalFailure; } private: Type type_; // Gets the summary of the failure message by omitting the stack // trace in it. static std::string ExtractSummary(const char* message); // The name of the source file where the test part took place, or // "" if the source file is unknown. std::string file_name_; // The line in the source file where the test part took place, or -1 // if the line number is unknown. int line_number_; std::string summary_; // The test failure summary. std::string message_; // The test failure message. }; // Prints a TestPartResult object. std::ostream& operator<<(std::ostream& os, const TestPartResult& result); // An array of TestPartResult objects. // // Don't inherit from TestPartResultArray as its destructor is not // virtual. class GTEST_API_ TestPartResultArray { public: TestPartResultArray() {} // Appends the given TestPartResult to the array. void Append(const TestPartResult& result); // Returns the TestPartResult at the given index (0-based). const TestPartResult& GetTestPartResult(int index) const; // Returns the number of TestPartResult objects in the array. int size() const; private: std::vector array_; GTEST_DISALLOW_COPY_AND_ASSIGN_(TestPartResultArray); }; // This interface knows how to report a test part result. class GTEST_API_ TestPartResultReporterInterface { public: virtual ~TestPartResultReporterInterface() {} virtual void ReportTestPartResult(const TestPartResult& result) = 0; }; namespace internal { // This helper class is used by {ASSERT|EXPECT}_NO_FATAL_FAILURE to check if a // statement generates new fatal failures. To do so it registers itself as the // current test part result reporter. Besides checking if fatal failures were // reported, it only delegates the reporting to the former result reporter. // The original result reporter is restored in the destructor. // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. class GTEST_API_ HasNewFatalFailureHelper : public TestPartResultReporterInterface { public: HasNewFatalFailureHelper(); virtual ~HasNewFatalFailureHelper(); virtual void ReportTestPartResult(const TestPartResult& result); bool has_new_fatal_failure() const { return has_new_fatal_failure_; } private: bool has_new_fatal_failure_; TestPartResultReporterInterface* original_reporter_; GTEST_DISALLOW_COPY_AND_ASSIGN_(HasNewFatalFailureHelper); }; } // namespace internal } // namespace testing GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251 #endif // GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_ iptux-0.9.4/src/googletest/include/gtest/gtest-typed-test.h000066400000000000000000000323541475473122500240310ustar00rootroot00000000000000// Copyright 2008 Google Inc. // All Rights Reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // GOOGLETEST_CM0001 DO NOT DELETE #ifndef GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_ #define GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_ // This header implements typed tests and type-parameterized tests. // Typed (aka type-driven) tests repeat the same test for types in a // list. You must know which types you want to test with when writing // typed tests. Here's how you do it: #if 0 // First, define a fixture class template. It should be parameterized // by a type. Remember to derive it from testing::Test. template class FooTest : public testing::Test { public: ... typedef std::list List; static T shared_; T value_; }; // Next, associate a list of types with the test case, which will be // repeated for each type in the list. The typedef is necessary for // the macro to parse correctly. typedef testing::Types MyTypes; TYPED_TEST_CASE(FooTest, MyTypes); // If the type list contains only one type, you can write that type // directly without Types<...>: // TYPED_TEST_CASE(FooTest, int); // Then, use TYPED_TEST() instead of TEST_F() to define as many typed // tests for this test case as you want. TYPED_TEST(FooTest, DoesBlah) { // Inside a test, refer to TypeParam to get the type parameter. // Since we are inside a derived class template, C++ requires use to // visit the members of FooTest via 'this'. TypeParam n = this->value_; // To visit static members of the fixture, add the TestFixture:: // prefix. n += TestFixture::shared_; // To refer to typedefs in the fixture, add the "typename // TestFixture::" prefix. typename TestFixture::List values; values.push_back(n); ... } TYPED_TEST(FooTest, HasPropertyA) { ... } // TYPED_TEST_CASE takes an optional third argument which allows to specify a // class that generates custom test name suffixes based on the type. This should // be a class which has a static template function GetName(int index) returning // a string for each type. The provided integer index equals the index of the // type in the provided type list. In many cases the index can be ignored. // // For example: // class MyTypeNames { // public: // template // static std::string GetName(int) { // if (std::is_same()) return "char"; // if (std::is_same()) return "int"; // if (std::is_same()) return "unsignedInt"; // } // }; // TYPED_TEST_CASE(FooTest, MyTypes, MyTypeNames); #endif // 0 // Type-parameterized tests are abstract test patterns parameterized // by a type. Compared with typed tests, type-parameterized tests // allow you to define the test pattern without knowing what the type // parameters are. The defined pattern can be instantiated with // different types any number of times, in any number of translation // units. // // If you are designing an interface or concept, you can define a // suite of type-parameterized tests to verify properties that any // valid implementation of the interface/concept should have. Then, // each implementation can easily instantiate the test suite to verify // that it conforms to the requirements, without having to write // similar tests repeatedly. Here's an example: #if 0 // First, define a fixture class template. It should be parameterized // by a type. Remember to derive it from testing::Test. template class FooTest : public testing::Test { ... }; // Next, declare that you will define a type-parameterized test case // (the _P suffix is for "parameterized" or "pattern", whichever you // prefer): TYPED_TEST_CASE_P(FooTest); // Then, use TYPED_TEST_P() to define as many type-parameterized tests // for this type-parameterized test case as you want. TYPED_TEST_P(FooTest, DoesBlah) { // Inside a test, refer to TypeParam to get the type parameter. TypeParam n = 0; ... } TYPED_TEST_P(FooTest, HasPropertyA) { ... } // Now the tricky part: you need to register all test patterns before // you can instantiate them. The first argument of the macro is the // test case name; the rest are the names of the tests in this test // case. REGISTER_TYPED_TEST_CASE_P(FooTest, DoesBlah, HasPropertyA); // Finally, you are free to instantiate the pattern with the types you // want. If you put the above code in a header file, you can #include // it in multiple C++ source files and instantiate it multiple times. // // To distinguish different instances of the pattern, the first // argument to the INSTANTIATE_* macro is a prefix that will be added // to the actual test case name. Remember to pick unique prefixes for // different instances. typedef testing::Types MyTypes; INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, MyTypes); // If the type list contains only one type, you can write that type // directly without Types<...>: // INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, int); // // Similar to the optional argument of TYPED_TEST_CASE above, // INSTANTIATE_TEST_CASE_P takes an optional fourth argument which allows to // generate custom names. // INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, MyTypes, MyTypeNames); #endif // 0 #include "gtest/internal/gtest-port.h" #include "gtest/internal/gtest-type-util.h" // Implements typed tests. #if GTEST_HAS_TYPED_TEST // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. // // Expands to the name of the typedef for the type parameters of the // given test case. # define GTEST_TYPE_PARAMS_(TestCaseName) gtest_type_params_##TestCaseName##_ // Expands to the name of the typedef for the NameGenerator, responsible for // creating the suffixes of the name. #define GTEST_NAME_GENERATOR_(TestCaseName) \ gtest_type_params_##TestCaseName##_NameGenerator // The 'Types' template argument below must have spaces around it // since some compilers may choke on '>>' when passing a template // instance (e.g. Types) # define TYPED_TEST_CASE(CaseName, Types, ...) \ typedef ::testing::internal::TypeList< Types >::type GTEST_TYPE_PARAMS_( \ CaseName); \ typedef ::testing::internal::NameGeneratorSelector<__VA_ARGS__>::type \ GTEST_NAME_GENERATOR_(CaseName) # define TYPED_TEST(CaseName, TestName) \ template \ class GTEST_TEST_CLASS_NAME_(CaseName, TestName) \ : public CaseName { \ private: \ typedef CaseName TestFixture; \ typedef gtest_TypeParam_ TypeParam; \ virtual void TestBody(); \ }; \ static bool gtest_##CaseName##_##TestName##_registered_ \ GTEST_ATTRIBUTE_UNUSED_ = \ ::testing::internal::TypeParameterizedTest< \ CaseName, \ ::testing::internal::TemplateSel, \ GTEST_TYPE_PARAMS_( \ CaseName)>::Register("", \ ::testing::internal::CodeLocation( \ __FILE__, __LINE__), \ #CaseName, #TestName, 0, \ ::testing::internal::GenerateNames< \ GTEST_NAME_GENERATOR_(CaseName), \ GTEST_TYPE_PARAMS_(CaseName)>()); \ template \ void GTEST_TEST_CLASS_NAME_(CaseName, \ TestName)::TestBody() #endif // GTEST_HAS_TYPED_TEST // Implements type-parameterized tests. #if GTEST_HAS_TYPED_TEST_P // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. // // Expands to the namespace name that the type-parameterized tests for // the given type-parameterized test case are defined in. The exact // name of the namespace is subject to change without notice. # define GTEST_CASE_NAMESPACE_(TestCaseName) \ gtest_case_##TestCaseName##_ // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. // // Expands to the name of the variable used to remember the names of // the defined tests in the given test case. # define GTEST_TYPED_TEST_CASE_P_STATE_(TestCaseName) \ gtest_typed_test_case_p_state_##TestCaseName##_ // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE DIRECTLY. // // Expands to the name of the variable used to remember the names of // the registered tests in the given test case. # define GTEST_REGISTERED_TEST_NAMES_(TestCaseName) \ gtest_registered_test_names_##TestCaseName##_ // The variables defined in the type-parameterized test macros are // static as typically these macros are used in a .h file that can be // #included in multiple translation units linked together. # define TYPED_TEST_CASE_P(CaseName) \ static ::testing::internal::TypedTestCasePState \ GTEST_TYPED_TEST_CASE_P_STATE_(CaseName) # define TYPED_TEST_P(CaseName, TestName) \ namespace GTEST_CASE_NAMESPACE_(CaseName) { \ template \ class TestName : public CaseName { \ private: \ typedef CaseName TestFixture; \ typedef gtest_TypeParam_ TypeParam; \ virtual void TestBody(); \ }; \ static bool gtest_##TestName##_defined_ GTEST_ATTRIBUTE_UNUSED_ = \ GTEST_TYPED_TEST_CASE_P_STATE_(CaseName).AddTestName(\ __FILE__, __LINE__, #CaseName, #TestName); \ } \ template \ void GTEST_CASE_NAMESPACE_(CaseName)::TestName::TestBody() # define REGISTER_TYPED_TEST_CASE_P(CaseName, ...) \ namespace GTEST_CASE_NAMESPACE_(CaseName) { \ typedef ::testing::internal::Templates<__VA_ARGS__>::type gtest_AllTests_; \ } \ static const char* const GTEST_REGISTERED_TEST_NAMES_(CaseName) \ GTEST_ATTRIBUTE_UNUSED_ = \ GTEST_TYPED_TEST_CASE_P_STATE_(CaseName).VerifyRegisteredTestNames( \ __FILE__, __LINE__, #__VA_ARGS__) // The 'Types' template argument below must have spaces around it // since some compilers may choke on '>>' when passing a template // instance (e.g. Types) # define INSTANTIATE_TYPED_TEST_CASE_P(Prefix, CaseName, Types, ...) \ static bool gtest_##Prefix##_##CaseName GTEST_ATTRIBUTE_UNUSED_ = \ ::testing::internal::TypeParameterizedTestCase< \ CaseName, GTEST_CASE_NAMESPACE_(CaseName)::gtest_AllTests_, \ ::testing::internal::TypeList< Types >::type>:: \ Register(#Prefix, \ ::testing::internal::CodeLocation(__FILE__, __LINE__), \ >EST_TYPED_TEST_CASE_P_STATE_(CaseName), #CaseName, \ GTEST_REGISTERED_TEST_NAMES_(CaseName), \ ::testing::internal::GenerateNames< \ ::testing::internal::NameGeneratorSelector< \ __VA_ARGS__>::type, \ ::testing::internal::TypeList< Types >::type>()) #endif // GTEST_HAS_TYPED_TEST_P #endif // GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_ iptux-0.9.4/src/googletest/include/gtest/gtest.h000066400000000000000000002560001475473122500217250ustar00rootroot00000000000000// Copyright 2005, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // The Google C++ Testing and Mocking Framework (Google Test) // // This header file defines the public API for Google Test. It should be // included by any test program that uses Google Test. // // IMPORTANT NOTE: Due to limitation of the C++ language, we have to // leave some internal implementation details in this header file. // They are clearly marked by comments like this: // // // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. // // Such code is NOT meant to be used by a user directly, and is subject // to CHANGE WITHOUT NOTICE. Therefore DO NOT DEPEND ON IT in a user // program! // // Acknowledgment: Google Test borrowed the idea of automatic test // registration from Barthelemy Dagenais' (barthelemy@prologique.com) // easyUnit framework. // GOOGLETEST_CM0001 DO NOT DELETE #ifndef GTEST_INCLUDE_GTEST_GTEST_H_ #define GTEST_INCLUDE_GTEST_GTEST_H_ #include #include #include #include "gtest/internal/gtest-internal.h" #include "gtest/internal/gtest-string.h" #include "gtest/gtest-death-test.h" #include "gtest/gtest-message.h" #include "gtest/gtest-param-test.h" #include "gtest/gtest-printers.h" #include "gtest/gtest_prod.h" #include "gtest/gtest-test-part.h" #include "gtest/gtest-typed-test.h" GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \ /* class A needs to have dll-interface to be used by clients of class B */) // Depending on the platform, different string classes are available. // On Linux, in addition to ::std::string, Google also makes use of // class ::string, which has the same interface as ::std::string, but // has a different implementation. // // You can define GTEST_HAS_GLOBAL_STRING to 1 to indicate that // ::string is available AND is a distinct type to ::std::string, or // define it to 0 to indicate otherwise. // // If ::std::string and ::string are the same class on your platform // due to aliasing, you should define GTEST_HAS_GLOBAL_STRING to 0. // // If you do not define GTEST_HAS_GLOBAL_STRING, it is defined // heuristically. namespace testing { // Silence C4100 (unreferenced formal parameter) and 4805 // unsafe mix of type 'const int' and type 'const bool' #ifdef _MSC_VER # pragma warning(push) # pragma warning(disable:4805) # pragma warning(disable:4100) #endif // Declares the flags. // This flag temporary enables the disabled tests. GTEST_DECLARE_bool_(also_run_disabled_tests); // This flag brings the debugger on an assertion failure. GTEST_DECLARE_bool_(break_on_failure); // This flag controls whether Google Test catches all test-thrown exceptions // and logs them as failures. GTEST_DECLARE_bool_(catch_exceptions); // This flag enables using colors in terminal output. Available values are // "yes" to enable colors, "no" (disable colors), or "auto" (the default) // to let Google Test decide. GTEST_DECLARE_string_(color); // This flag sets up the filter to select by name using a glob pattern // the tests to run. If the filter is not given all tests are executed. GTEST_DECLARE_string_(filter); // This flag controls whether Google Test installs a signal handler that dumps // debugging information when fatal signals are raised. GTEST_DECLARE_bool_(install_failure_signal_handler); // This flag causes the Google Test to list tests. None of the tests listed // are actually run if the flag is provided. GTEST_DECLARE_bool_(list_tests); // This flag controls whether Google Test emits a detailed XML report to a file // in addition to its normal textual output. GTEST_DECLARE_string_(output); // This flags control whether Google Test prints the elapsed time for each // test. GTEST_DECLARE_bool_(print_time); // This flags control whether Google Test prints UTF8 characters as text. GTEST_DECLARE_bool_(print_utf8); // This flag specifies the random number seed. GTEST_DECLARE_int32_(random_seed); // This flag sets how many times the tests are repeated. The default value // is 1. If the value is -1 the tests are repeating forever. GTEST_DECLARE_int32_(repeat); // This flag controls whether Google Test includes Google Test internal // stack frames in failure stack traces. GTEST_DECLARE_bool_(show_internal_stack_frames); // When this flag is specified, tests' order is randomized on every iteration. GTEST_DECLARE_bool_(shuffle); // This flag specifies the maximum number of stack frames to be // printed in a failure message. GTEST_DECLARE_int32_(stack_trace_depth); // When this flag is specified, a failed assertion will throw an // exception if exceptions are enabled, or exit the program with a // non-zero code otherwise. For use with an external test framework. GTEST_DECLARE_bool_(throw_on_failure); // When this flag is set with a "host:port" string, on supported // platforms test results are streamed to the specified port on // the specified host machine. GTEST_DECLARE_string_(stream_result_to); #if GTEST_USE_OWN_FLAGFILE_FLAG_ GTEST_DECLARE_string_(flagfile); #endif // GTEST_USE_OWN_FLAGFILE_FLAG_ // The upper limit for valid stack trace depths. const int kMaxStackTraceDepth = 100; namespace internal { class AssertHelper; class DefaultGlobalTestPartResultReporter; class ExecDeathTest; class NoExecDeathTest; class FinalSuccessChecker; class GTestFlagSaver; class StreamingListenerTest; class TestResultAccessor; class TestEventListenersAccessor; class TestEventRepeater; class UnitTestRecordPropertyTestHelper; class WindowsDeathTest; class FuchsiaDeathTest; class UnitTestImpl* GetUnitTestImpl(); void ReportFailureInUnknownLocation(TestPartResult::Type result_type, const std::string& message); } // namespace internal // The friend relationship of some of these classes is cyclic. // If we don't forward declare them the compiler might confuse the classes // in friendship clauses with same named classes on the scope. class Test; class TestCase; class TestInfo; class UnitTest; // A class for indicating whether an assertion was successful. When // the assertion wasn't successful, the AssertionResult object // remembers a non-empty message that describes how it failed. // // To create an instance of this class, use one of the factory functions // (AssertionSuccess() and AssertionFailure()). // // This class is useful for two purposes: // 1. Defining predicate functions to be used with Boolean test assertions // EXPECT_TRUE/EXPECT_FALSE and their ASSERT_ counterparts // 2. Defining predicate-format functions to be // used with predicate assertions (ASSERT_PRED_FORMAT*, etc). // // For example, if you define IsEven predicate: // // testing::AssertionResult IsEven(int n) { // if ((n % 2) == 0) // return testing::AssertionSuccess(); // else // return testing::AssertionFailure() << n << " is odd"; // } // // Then the failed expectation EXPECT_TRUE(IsEven(Fib(5))) // will print the message // // Value of: IsEven(Fib(5)) // Actual: false (5 is odd) // Expected: true // // instead of a more opaque // // Value of: IsEven(Fib(5)) // Actual: false // Expected: true // // in case IsEven is a simple Boolean predicate. // // If you expect your predicate to be reused and want to support informative // messages in EXPECT_FALSE and ASSERT_FALSE (negative assertions show up // about half as often as positive ones in our tests), supply messages for // both success and failure cases: // // testing::AssertionResult IsEven(int n) { // if ((n % 2) == 0) // return testing::AssertionSuccess() << n << " is even"; // else // return testing::AssertionFailure() << n << " is odd"; // } // // Then a statement EXPECT_FALSE(IsEven(Fib(6))) will print // // Value of: IsEven(Fib(6)) // Actual: true (8 is even) // Expected: false // // NB: Predicates that support negative Boolean assertions have reduced // performance in positive ones so be careful not to use them in tests // that have lots (tens of thousands) of positive Boolean assertions. // // To use this class with EXPECT_PRED_FORMAT assertions such as: // // // Verifies that Foo() returns an even number. // EXPECT_PRED_FORMAT1(IsEven, Foo()); // // you need to define: // // testing::AssertionResult IsEven(const char* expr, int n) { // if ((n % 2) == 0) // return testing::AssertionSuccess(); // else // return testing::AssertionFailure() // << "Expected: " << expr << " is even\n Actual: it's " << n; // } // // If Foo() returns 5, you will see the following message: // // Expected: Foo() is even // Actual: it's 5 // class GTEST_API_ AssertionResult { public: // Copy constructor. // Used in EXPECT_TRUE/FALSE(assertion_result). AssertionResult(const AssertionResult& other); #if defined(_MSC_VER) && _MSC_VER < 1910 GTEST_DISABLE_MSC_WARNINGS_PUSH_(4800 /* forcing value to bool */) #endif // Used in the EXPECT_TRUE/FALSE(bool_expression). // // T must be contextually convertible to bool. // // The second parameter prevents this overload from being considered if // the argument is implicitly convertible to AssertionResult. In that case // we want AssertionResult's copy constructor to be used. template explicit AssertionResult( const T& success, typename internal::EnableIf< !internal::ImplicitlyConvertible::value>::type* /*enabler*/ = NULL) : success_(success) {} #if defined(_MSC_VER) && _MSC_VER < 1910 GTEST_DISABLE_MSC_WARNINGS_POP_() #endif // Assignment operator. AssertionResult& operator=(AssertionResult other) { swap(other); return *this; } // Returns true iff the assertion succeeded. operator bool() const { return success_; } // NOLINT // Returns the assertion's negation. Used with EXPECT/ASSERT_FALSE. AssertionResult operator!() const; // Returns the text streamed into this AssertionResult. Test assertions // use it when they fail (i.e., the predicate's outcome doesn't match the // assertion's expectation). When nothing has been streamed into the // object, returns an empty string. const char* message() const { return message_.get() != NULL ? message_->c_str() : ""; } // FIXME: Remove this after making sure no clients use it. // Deprecated; please use message() instead. const char* failure_message() const { return message(); } // Streams a custom failure message into this object. template AssertionResult& operator<<(const T& value) { AppendMessage(Message() << value); return *this; } // Allows streaming basic output manipulators such as endl or flush into // this object. AssertionResult& operator<<( ::std::ostream& (*basic_manipulator)(::std::ostream& stream)) { AppendMessage(Message() << basic_manipulator); return *this; } private: // Appends the contents of message to message_. void AppendMessage(const Message& a_message) { if (message_.get() == NULL) message_.reset(new ::std::string); message_->append(a_message.GetString().c_str()); } // Swap the contents of this AssertionResult with other. void swap(AssertionResult& other); // Stores result of the assertion predicate. bool success_; // Stores the message describing the condition in case the expectation // construct is not satisfied with the predicate's outcome. // Referenced via a pointer to avoid taking too much stack frame space // with test assertions. internal::scoped_ptr< ::std::string> message_; }; // Makes a successful assertion result. GTEST_API_ AssertionResult AssertionSuccess(); // Makes a failed assertion result. GTEST_API_ AssertionResult AssertionFailure(); // Makes a failed assertion result with the given failure message. // Deprecated; use AssertionFailure() << msg. GTEST_API_ AssertionResult AssertionFailure(const Message& msg); } // namespace testing // Includes the auto-generated header that implements a family of generic // predicate assertion macros. This include comes late because it relies on // APIs declared above. #include "gtest/gtest_pred_impl.h" namespace testing { // The abstract class that all tests inherit from. // // In Google Test, a unit test program contains one or many TestCases, and // each TestCase contains one or many Tests. // // When you define a test using the TEST macro, you don't need to // explicitly derive from Test - the TEST macro automatically does // this for you. // // The only time you derive from Test is when defining a test fixture // to be used in a TEST_F. For example: // // class FooTest : public testing::Test { // protected: // void SetUp() override { ... } // void TearDown() override { ... } // ... // }; // // TEST_F(FooTest, Bar) { ... } // TEST_F(FooTest, Baz) { ... } // // Test is not copyable. class GTEST_API_ Test { public: friend class TestInfo; // Defines types for pointers to functions that set up and tear down // a test case. typedef internal::SetUpTestCaseFunc SetUpTestCaseFunc; typedef internal::TearDownTestCaseFunc TearDownTestCaseFunc; // The d'tor is virtual as we intend to inherit from Test. virtual ~Test(); // Sets up the stuff shared by all tests in this test case. // // Google Test will call Foo::SetUpTestCase() before running the first // test in test case Foo. Hence a sub-class can define its own // SetUpTestCase() method to shadow the one defined in the super // class. static void SetUpTestCase() {} // Tears down the stuff shared by all tests in this test case. // // Google Test will call Foo::TearDownTestCase() after running the last // test in test case Foo. Hence a sub-class can define its own // TearDownTestCase() method to shadow the one defined in the super // class. static void TearDownTestCase() {} // Returns true iff the current test has a fatal failure. static bool HasFatalFailure(); // Returns true iff the current test has a non-fatal failure. static bool HasNonfatalFailure(); // Returns true iff the current test has a (either fatal or // non-fatal) failure. static bool HasFailure() { return HasFatalFailure() || HasNonfatalFailure(); } // Logs a property for the current test, test case, or for the entire // invocation of the test program when used outside of the context of a // test case. Only the last value for a given key is remembered. These // are public static so they can be called from utility functions that are // not members of the test fixture. Calls to RecordProperty made during // lifespan of the test (from the moment its constructor starts to the // moment its destructor finishes) will be output in XML as attributes of // the element. Properties recorded from fixture's // SetUpTestCase or TearDownTestCase are logged as attributes of the // corresponding element. Calls to RecordProperty made in the // global context (before or after invocation of RUN_ALL_TESTS and from // SetUp/TearDown method of Environment objects registered with Google // Test) will be output as attributes of the element. static void RecordProperty(const std::string& key, const std::string& value); static void RecordProperty(const std::string& key, int value); protected: // Creates a Test object. Test(); // Sets up the test fixture. virtual void SetUp(); // Tears down the test fixture. virtual void TearDown(); private: // Returns true iff the current test has the same fixture class as // the first test in the current test case. static bool HasSameFixtureClass(); // Runs the test after the test fixture has been set up. // // A sub-class must implement this to define the test logic. // // DO NOT OVERRIDE THIS FUNCTION DIRECTLY IN A USER PROGRAM. // Instead, use the TEST or TEST_F macro. virtual void TestBody() = 0; // Sets up, executes, and tears down the test. void Run(); // Deletes self. We deliberately pick an unusual name for this // internal method to avoid clashing with names used in user TESTs. void DeleteSelf_() { delete this; } const internal::scoped_ptr< GTEST_FLAG_SAVER_ > gtest_flag_saver_; // Often a user misspells SetUp() as Setup() and spends a long time // wondering why it is never called by Google Test. The declaration of // the following method is solely for catching such an error at // compile time: // // - The return type is deliberately chosen to be not void, so it // will be a conflict if void Setup() is declared in the user's // test fixture. // // - This method is private, so it will be another compiler error // if the method is called from the user's test fixture. // // DO NOT OVERRIDE THIS FUNCTION. // // If you see an error about overriding the following function or // about it being private, you have mis-spelled SetUp() as Setup(). struct Setup_should_be_spelled_SetUp {}; virtual Setup_should_be_spelled_SetUp* Setup() { return NULL; } // We disallow copying Tests. GTEST_DISALLOW_COPY_AND_ASSIGN_(Test); }; typedef internal::TimeInMillis TimeInMillis; // A copyable object representing a user specified test property which can be // output as a key/value string pair. // // Don't inherit from TestProperty as its destructor is not virtual. class TestProperty { public: // C'tor. TestProperty does NOT have a default constructor. // Always use this constructor (with parameters) to create a // TestProperty object. TestProperty(const std::string& a_key, const std::string& a_value) : key_(a_key), value_(a_value) { } // Gets the user supplied key. const char* key() const { return key_.c_str(); } // Gets the user supplied value. const char* value() const { return value_.c_str(); } // Sets a new value, overriding the one supplied in the constructor. void SetValue(const std::string& new_value) { value_ = new_value; } private: // The key supplied by the user. std::string key_; // The value supplied by the user. std::string value_; }; // The result of a single Test. This includes a list of // TestPartResults, a list of TestProperties, a count of how many // death tests there are in the Test, and how much time it took to run // the Test. // // TestResult is not copyable. class GTEST_API_ TestResult { public: // Creates an empty TestResult. TestResult(); // D'tor. Do not inherit from TestResult. ~TestResult(); // Gets the number of all test parts. This is the sum of the number // of successful test parts and the number of failed test parts. int total_part_count() const; // Returns the number of the test properties. int test_property_count() const; // Returns true iff the test passed (i.e. no test part failed). bool Passed() const { return !Failed(); } // Returns true iff the test failed. bool Failed() const; // Returns true iff the test fatally failed. bool HasFatalFailure() const; // Returns true iff the test has a non-fatal failure. bool HasNonfatalFailure() const; // Returns the elapsed time, in milliseconds. TimeInMillis elapsed_time() const { return elapsed_time_; } // Returns the i-th test part result among all the results. i can range from 0 // to total_part_count() - 1. If i is not in that range, aborts the program. const TestPartResult& GetTestPartResult(int i) const; // Returns the i-th test property. i can range from 0 to // test_property_count() - 1. If i is not in that range, aborts the // program. const TestProperty& GetTestProperty(int i) const; private: friend class TestInfo; friend class TestCase; friend class UnitTest; friend class internal::DefaultGlobalTestPartResultReporter; friend class internal::ExecDeathTest; friend class internal::TestResultAccessor; friend class internal::UnitTestImpl; friend class internal::WindowsDeathTest; friend class internal::FuchsiaDeathTest; // Gets the vector of TestPartResults. const std::vector& test_part_results() const { return test_part_results_; } // Gets the vector of TestProperties. const std::vector& test_properties() const { return test_properties_; } // Sets the elapsed time. void set_elapsed_time(TimeInMillis elapsed) { elapsed_time_ = elapsed; } // Adds a test property to the list. The property is validated and may add // a non-fatal failure if invalid (e.g., if it conflicts with reserved // key names). If a property is already recorded for the same key, the // value will be updated, rather than storing multiple values for the same // key. xml_element specifies the element for which the property is being // recorded and is used for validation. void RecordProperty(const std::string& xml_element, const TestProperty& test_property); // Adds a failure if the key is a reserved attribute of Google Test // testcase tags. Returns true if the property is valid. // FIXME: Validate attribute names are legal and human readable. static bool ValidateTestProperty(const std::string& xml_element, const TestProperty& test_property); // Adds a test part result to the list. void AddTestPartResult(const TestPartResult& test_part_result); // Returns the death test count. int death_test_count() const { return death_test_count_; } // Increments the death test count, returning the new count. int increment_death_test_count() { return ++death_test_count_; } // Clears the test part results. void ClearTestPartResults(); // Clears the object. void Clear(); // Protects mutable state of the property vector and of owned // properties, whose values may be updated. internal::Mutex test_properites_mutex_; // The vector of TestPartResults std::vector test_part_results_; // The vector of TestProperties std::vector test_properties_; // Running count of death tests. int death_test_count_; // The elapsed time, in milliseconds. TimeInMillis elapsed_time_; // We disallow copying TestResult. GTEST_DISALLOW_COPY_AND_ASSIGN_(TestResult); }; // class TestResult // A TestInfo object stores the following information about a test: // // Test case name // Test name // Whether the test should be run // A function pointer that creates the test object when invoked // Test result // // The constructor of TestInfo registers itself with the UnitTest // singleton such that the RUN_ALL_TESTS() macro knows which tests to // run. class GTEST_API_ TestInfo { public: // Destructs a TestInfo object. This function is not virtual, so // don't inherit from TestInfo. ~TestInfo(); // Returns the test case name. const char* test_case_name() const { return test_case_name_.c_str(); } // Returns the test name. const char* name() const { return name_.c_str(); } // Returns the name of the parameter type, or NULL if this is not a typed // or a type-parameterized test. const char* type_param() const { if (type_param_.get() != NULL) return type_param_->c_str(); return NULL; } // Returns the text representation of the value parameter, or NULL if this // is not a value-parameterized test. const char* value_param() const { if (value_param_.get() != NULL) return value_param_->c_str(); return NULL; } // Returns the file name where this test is defined. const char* file() const { return location_.file.c_str(); } // Returns the line where this test is defined. int line() const { return location_.line; } // Return true if this test should not be run because it's in another shard. bool is_in_another_shard() const { return is_in_another_shard_; } // Returns true if this test should run, that is if the test is not // disabled (or it is disabled but the also_run_disabled_tests flag has // been specified) and its full name matches the user-specified filter. // // Google Test allows the user to filter the tests by their full names. // The full name of a test Bar in test case Foo is defined as // "Foo.Bar". Only the tests that match the filter will run. // // A filter is a colon-separated list of glob (not regex) patterns, // optionally followed by a '-' and a colon-separated list of // negative patterns (tests to exclude). A test is run if it // matches one of the positive patterns and does not match any of // the negative patterns. // // For example, *A*:Foo.* is a filter that matches any string that // contains the character 'A' or starts with "Foo.". bool should_run() const { return should_run_; } // Returns true iff this test will appear in the XML report. bool is_reportable() const { // The XML report includes tests matching the filter, excluding those // run in other shards. return matches_filter_ && !is_in_another_shard_; } // Returns the result of the test. const TestResult* result() const { return &result_; } private: #if GTEST_HAS_DEATH_TEST friend class internal::DefaultDeathTestFactory; #endif // GTEST_HAS_DEATH_TEST friend class Test; friend class TestCase; friend class internal::UnitTestImpl; friend class internal::StreamingListenerTest; friend TestInfo* internal::MakeAndRegisterTestInfo( const char* test_case_name, const char* name, const char* type_param, const char* value_param, internal::CodeLocation code_location, internal::TypeId fixture_class_id, Test::SetUpTestCaseFunc set_up_tc, Test::TearDownTestCaseFunc tear_down_tc, internal::TestFactoryBase* factory); // Constructs a TestInfo object. The newly constructed instance assumes // ownership of the factory object. TestInfo(const std::string& test_case_name, const std::string& name, const char* a_type_param, // NULL if not a type-parameterized test const char* a_value_param, // NULL if not a value-parameterized test internal::CodeLocation a_code_location, internal::TypeId fixture_class_id, internal::TestFactoryBase* factory); // Increments the number of death tests encountered in this test so // far. int increment_death_test_count() { return result_.increment_death_test_count(); } // Creates the test object, runs it, records its result, and then // deletes it. void Run(); static void ClearTestResult(TestInfo* test_info) { test_info->result_.Clear(); } // These fields are immutable properties of the test. const std::string test_case_name_; // Test case name const std::string name_; // Test name // Name of the parameter type, or NULL if this is not a typed or a // type-parameterized test. const internal::scoped_ptr type_param_; // Text representation of the value parameter, or NULL if this is not a // value-parameterized test. const internal::scoped_ptr value_param_; internal::CodeLocation location_; const internal::TypeId fixture_class_id_; // ID of the test fixture class bool should_run_; // True iff this test should run bool is_disabled_; // True iff this test is disabled bool matches_filter_; // True if this test matches the // user-specified filter. bool is_in_another_shard_; // Will be run in another shard. internal::TestFactoryBase* const factory_; // The factory that creates // the test object // This field is mutable and needs to be reset before running the // test for the second time. TestResult result_; GTEST_DISALLOW_COPY_AND_ASSIGN_(TestInfo); }; // A test case, which consists of a vector of TestInfos. // // TestCase is not copyable. class GTEST_API_ TestCase { public: // Creates a TestCase with the given name. // // TestCase does NOT have a default constructor. Always use this // constructor to create a TestCase object. // // Arguments: // // name: name of the test case // a_type_param: the name of the test's type parameter, or NULL if // this is not a type-parameterized test. // set_up_tc: pointer to the function that sets up the test case // tear_down_tc: pointer to the function that tears down the test case TestCase(const char* name, const char* a_type_param, Test::SetUpTestCaseFunc set_up_tc, Test::TearDownTestCaseFunc tear_down_tc); // Destructor of TestCase. virtual ~TestCase(); // Gets the name of the TestCase. const char* name() const { return name_.c_str(); } // Returns the name of the parameter type, or NULL if this is not a // type-parameterized test case. const char* type_param() const { if (type_param_.get() != NULL) return type_param_->c_str(); return NULL; } // Returns true if any test in this test case should run. bool should_run() const { return should_run_; } // Gets the number of successful tests in this test case. int successful_test_count() const; // Gets the number of failed tests in this test case. int failed_test_count() const; // Gets the number of disabled tests that will be reported in the XML report. int reportable_disabled_test_count() const; // Gets the number of disabled tests in this test case. int disabled_test_count() const; // Gets the number of tests to be printed in the XML report. int reportable_test_count() const; // Get the number of tests in this test case that should run. int test_to_run_count() const; // Gets the number of all tests in this test case. int total_test_count() const; // Returns true iff the test case passed. bool Passed() const { return !Failed(); } // Returns true iff the test case failed. bool Failed() const { return failed_test_count() > 0; } // Returns the elapsed time, in milliseconds. TimeInMillis elapsed_time() const { return elapsed_time_; } // Returns the i-th test among all the tests. i can range from 0 to // total_test_count() - 1. If i is not in that range, returns NULL. const TestInfo* GetTestInfo(int i) const; // Returns the TestResult that holds test properties recorded during // execution of SetUpTestCase and TearDownTestCase. const TestResult& ad_hoc_test_result() const { return ad_hoc_test_result_; } private: friend class Test; friend class internal::UnitTestImpl; // Gets the (mutable) vector of TestInfos in this TestCase. std::vector& test_info_list() { return test_info_list_; } // Gets the (immutable) vector of TestInfos in this TestCase. const std::vector& test_info_list() const { return test_info_list_; } // Returns the i-th test among all the tests. i can range from 0 to // total_test_count() - 1. If i is not in that range, returns NULL. TestInfo* GetMutableTestInfo(int i); // Sets the should_run member. void set_should_run(bool should) { should_run_ = should; } // Adds a TestInfo to this test case. Will delete the TestInfo upon // destruction of the TestCase object. void AddTestInfo(TestInfo * test_info); // Clears the results of all tests in this test case. void ClearResult(); // Clears the results of all tests in the given test case. static void ClearTestCaseResult(TestCase* test_case) { test_case->ClearResult(); } // Runs every test in this TestCase. void Run(); // Runs SetUpTestCase() for this TestCase. This wrapper is needed // for catching exceptions thrown from SetUpTestCase(). void RunSetUpTestCase() { (*set_up_tc_)(); } // Runs TearDownTestCase() for this TestCase. This wrapper is // needed for catching exceptions thrown from TearDownTestCase(). void RunTearDownTestCase() { (*tear_down_tc_)(); } // Returns true iff test passed. static bool TestPassed(const TestInfo* test_info) { return test_info->should_run() && test_info->result()->Passed(); } // Returns true iff test failed. static bool TestFailed(const TestInfo* test_info) { return test_info->should_run() && test_info->result()->Failed(); } // Returns true iff the test is disabled and will be reported in the XML // report. static bool TestReportableDisabled(const TestInfo* test_info) { return test_info->is_reportable() && test_info->is_disabled_; } // Returns true iff test is disabled. static bool TestDisabled(const TestInfo* test_info) { return test_info->is_disabled_; } // Returns true iff this test will appear in the XML report. static bool TestReportable(const TestInfo* test_info) { return test_info->is_reportable(); } // Returns true if the given test should run. static bool ShouldRunTest(const TestInfo* test_info) { return test_info->should_run(); } // Shuffles the tests in this test case. void ShuffleTests(internal::Random* random); // Restores the test order to before the first shuffle. void UnshuffleTests(); // Name of the test case. std::string name_; // Name of the parameter type, or NULL if this is not a typed or a // type-parameterized test. const internal::scoped_ptr type_param_; // The vector of TestInfos in their original order. It owns the // elements in the vector. std::vector test_info_list_; // Provides a level of indirection for the test list to allow easy // shuffling and restoring the test order. The i-th element in this // vector is the index of the i-th test in the shuffled test list. std::vector test_indices_; // Pointer to the function that sets up the test case. Test::SetUpTestCaseFunc set_up_tc_; // Pointer to the function that tears down the test case. Test::TearDownTestCaseFunc tear_down_tc_; // True iff any test in this test case should run. bool should_run_; // Elapsed time, in milliseconds. TimeInMillis elapsed_time_; // Holds test properties recorded during execution of SetUpTestCase and // TearDownTestCase. TestResult ad_hoc_test_result_; // We disallow copying TestCases. GTEST_DISALLOW_COPY_AND_ASSIGN_(TestCase); }; // An Environment object is capable of setting up and tearing down an // environment. You should subclass this to define your own // environment(s). // // An Environment object does the set-up and tear-down in virtual // methods SetUp() and TearDown() instead of the constructor and the // destructor, as: // // 1. You cannot safely throw from a destructor. This is a problem // as in some cases Google Test is used where exceptions are enabled, and // we may want to implement ASSERT_* using exceptions where they are // available. // 2. You cannot use ASSERT_* directly in a constructor or // destructor. class Environment { public: // The d'tor is virtual as we need to subclass Environment. virtual ~Environment() {} // Override this to define how to set up the environment. virtual void SetUp() {} // Override this to define how to tear down the environment. virtual void TearDown() {} private: // If you see an error about overriding the following function or // about it being private, you have mis-spelled SetUp() as Setup(). struct Setup_should_be_spelled_SetUp {}; virtual Setup_should_be_spelled_SetUp* Setup() { return NULL; } }; #if GTEST_HAS_EXCEPTIONS // Exception which can be thrown from TestEventListener::OnTestPartResult. class GTEST_API_ AssertionException : public internal::GoogleTestFailureException { public: explicit AssertionException(const TestPartResult& result) : GoogleTestFailureException(result) {} }; #endif // GTEST_HAS_EXCEPTIONS // The interface for tracing execution of tests. The methods are organized in // the order the corresponding events are fired. class TestEventListener { public: virtual ~TestEventListener() {} // Fired before any test activity starts. virtual void OnTestProgramStart(const UnitTest& unit_test) = 0; // Fired before each iteration of tests starts. There may be more than // one iteration if GTEST_FLAG(repeat) is set. iteration is the iteration // index, starting from 0. virtual void OnTestIterationStart(const UnitTest& unit_test, int iteration) = 0; // Fired before environment set-up for each iteration of tests starts. virtual void OnEnvironmentsSetUpStart(const UnitTest& unit_test) = 0; // Fired after environment set-up for each iteration of tests ends. virtual void OnEnvironmentsSetUpEnd(const UnitTest& unit_test) = 0; // Fired before the test case starts. virtual void OnTestCaseStart(const TestCase& test_case) = 0; // Fired before the test starts. virtual void OnTestStart(const TestInfo& test_info) = 0; // Fired after a failed assertion or a SUCCEED() invocation. // If you want to throw an exception from this function to skip to the next // TEST, it must be AssertionException defined above, or inherited from it. virtual void OnTestPartResult(const TestPartResult& test_part_result) = 0; // Fired after the test ends. virtual void OnTestEnd(const TestInfo& test_info) = 0; // Fired after the test case ends. virtual void OnTestCaseEnd(const TestCase& test_case) = 0; // Fired before environment tear-down for each iteration of tests starts. virtual void OnEnvironmentsTearDownStart(const UnitTest& unit_test) = 0; // Fired after environment tear-down for each iteration of tests ends. virtual void OnEnvironmentsTearDownEnd(const UnitTest& unit_test) = 0; // Fired after each iteration of tests finishes. virtual void OnTestIterationEnd(const UnitTest& unit_test, int iteration) = 0; // Fired after all test activities have ended. virtual void OnTestProgramEnd(const UnitTest& unit_test) = 0; }; // The convenience class for users who need to override just one or two // methods and are not concerned that a possible change to a signature of // the methods they override will not be caught during the build. For // comments about each method please see the definition of TestEventListener // above. class EmptyTestEventListener : public TestEventListener { public: virtual void OnTestProgramStart(const UnitTest& /*unit_test*/) {} virtual void OnTestIterationStart(const UnitTest& /*unit_test*/, int /*iteration*/) {} virtual void OnEnvironmentsSetUpStart(const UnitTest& /*unit_test*/) {} virtual void OnEnvironmentsSetUpEnd(const UnitTest& /*unit_test*/) {} virtual void OnTestCaseStart(const TestCase& /*test_case*/) {} virtual void OnTestStart(const TestInfo& /*test_info*/) {} virtual void OnTestPartResult(const TestPartResult& /*test_part_result*/) {} virtual void OnTestEnd(const TestInfo& /*test_info*/) {} virtual void OnTestCaseEnd(const TestCase& /*test_case*/) {} virtual void OnEnvironmentsTearDownStart(const UnitTest& /*unit_test*/) {} virtual void OnEnvironmentsTearDownEnd(const UnitTest& /*unit_test*/) {} virtual void OnTestIterationEnd(const UnitTest& /*unit_test*/, int /*iteration*/) {} virtual void OnTestProgramEnd(const UnitTest& /*unit_test*/) {} }; // TestEventListeners lets users add listeners to track events in Google Test. class GTEST_API_ TestEventListeners { public: TestEventListeners(); ~TestEventListeners(); // Appends an event listener to the end of the list. Google Test assumes // the ownership of the listener (i.e. it will delete the listener when // the test program finishes). void Append(TestEventListener* listener); // Removes the given event listener from the list and returns it. It then // becomes the caller's responsibility to delete the listener. Returns // NULL if the listener is not found in the list. TestEventListener* Release(TestEventListener* listener); // Returns the standard listener responsible for the default console // output. Can be removed from the listeners list to shut down default // console output. Note that removing this object from the listener list // with Release transfers its ownership to the caller and makes this // function return NULL the next time. TestEventListener* default_result_printer() const { return default_result_printer_; } // Returns the standard listener responsible for the default XML output // controlled by the --gtest_output=xml flag. Can be removed from the // listeners list by users who want to shut down the default XML output // controlled by this flag and substitute it with custom one. Note that // removing this object from the listener list with Release transfers its // ownership to the caller and makes this function return NULL the next // time. TestEventListener* default_xml_generator() const { return default_xml_generator_; } private: friend class TestCase; friend class TestInfo; friend class internal::DefaultGlobalTestPartResultReporter; friend class internal::NoExecDeathTest; friend class internal::TestEventListenersAccessor; friend class internal::UnitTestImpl; // Returns repeater that broadcasts the TestEventListener events to all // subscribers. TestEventListener* repeater(); // Sets the default_result_printer attribute to the provided listener. // The listener is also added to the listener list and previous // default_result_printer is removed from it and deleted. The listener can // also be NULL in which case it will not be added to the list. Does // nothing if the previous and the current listener objects are the same. void SetDefaultResultPrinter(TestEventListener* listener); // Sets the default_xml_generator attribute to the provided listener. The // listener is also added to the listener list and previous // default_xml_generator is removed from it and deleted. The listener can // also be NULL in which case it will not be added to the list. Does // nothing if the previous and the current listener objects are the same. void SetDefaultXmlGenerator(TestEventListener* listener); // Controls whether events will be forwarded by the repeater to the // listeners in the list. bool EventForwardingEnabled() const; void SuppressEventForwarding(); // The actual list of listeners. internal::TestEventRepeater* repeater_; // Listener responsible for the standard result output. TestEventListener* default_result_printer_; // Listener responsible for the creation of the XML output file. TestEventListener* default_xml_generator_; // We disallow copying TestEventListeners. GTEST_DISALLOW_COPY_AND_ASSIGN_(TestEventListeners); }; // A UnitTest consists of a vector of TestCases. // // This is a singleton class. The only instance of UnitTest is // created when UnitTest::GetInstance() is first called. This // instance is never deleted. // // UnitTest is not copyable. // // This class is thread-safe as long as the methods are called // according to their specification. class GTEST_API_ UnitTest { public: // Gets the singleton UnitTest object. The first time this method // is called, a UnitTest object is constructed and returned. // Consecutive calls will return the same object. static UnitTest* GetInstance(); // Runs all tests in this UnitTest object and prints the result. // Returns 0 if successful, or 1 otherwise. // // This method can only be called from the main thread. // // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. int Run() GTEST_MUST_USE_RESULT_; // Returns the working directory when the first TEST() or TEST_F() // was executed. The UnitTest object owns the string. const char* original_working_dir() const; // Returns the TestCase object for the test that's currently running, // or NULL if no test is running. const TestCase* current_test_case() const GTEST_LOCK_EXCLUDED_(mutex_); // Returns the TestInfo object for the test that's currently running, // or NULL if no test is running. const TestInfo* current_test_info() const GTEST_LOCK_EXCLUDED_(mutex_); // Returns the random seed used at the start of the current test run. int random_seed() const; // Returns the ParameterizedTestCaseRegistry object used to keep track of // value-parameterized tests and instantiate and register them. // // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. internal::ParameterizedTestCaseRegistry& parameterized_test_registry() GTEST_LOCK_EXCLUDED_(mutex_); // Gets the number of successful test cases. int successful_test_case_count() const; // Gets the number of failed test cases. int failed_test_case_count() const; // Gets the number of all test cases. int total_test_case_count() const; // Gets the number of all test cases that contain at least one test // that should run. int test_case_to_run_count() const; // Gets the number of successful tests. int successful_test_count() const; // Gets the number of failed tests. int failed_test_count() const; // Gets the number of disabled tests that will be reported in the XML report. int reportable_disabled_test_count() const; // Gets the number of disabled tests. int disabled_test_count() const; // Gets the number of tests to be printed in the XML report. int reportable_test_count() const; // Gets the number of all tests. int total_test_count() const; // Gets the number of tests that should run. int test_to_run_count() const; // Gets the time of the test program start, in ms from the start of the // UNIX epoch. TimeInMillis start_timestamp() const; // Gets the elapsed time, in milliseconds. TimeInMillis elapsed_time() const; // Returns true iff the unit test passed (i.e. all test cases passed). bool Passed() const; // Returns true iff the unit test failed (i.e. some test case failed // or something outside of all tests failed). bool Failed() const; // Gets the i-th test case among all the test cases. i can range from 0 to // total_test_case_count() - 1. If i is not in that range, returns NULL. const TestCase* GetTestCase(int i) const; // Returns the TestResult containing information on test failures and // properties logged outside of individual test cases. const TestResult& ad_hoc_test_result() const; // Returns the list of event listeners that can be used to track events // inside Google Test. TestEventListeners& listeners(); private: // Registers and returns a global test environment. When a test // program is run, all global test environments will be set-up in // the order they were registered. After all tests in the program // have finished, all global test environments will be torn-down in // the *reverse* order they were registered. // // The UnitTest object takes ownership of the given environment. // // This method can only be called from the main thread. Environment* AddEnvironment(Environment* env); // Adds a TestPartResult to the current TestResult object. All // Google Test assertion macros (e.g. ASSERT_TRUE, EXPECT_EQ, etc) // eventually call this to report their results. The user code // should use the assertion macros instead of calling this directly. void AddTestPartResult(TestPartResult::Type result_type, const char* file_name, int line_number, const std::string& message, const std::string& os_stack_trace) GTEST_LOCK_EXCLUDED_(mutex_); // Adds a TestProperty to the current TestResult object when invoked from // inside a test, to current TestCase's ad_hoc_test_result_ when invoked // from SetUpTestCase or TearDownTestCase, or to the global property set // when invoked elsewhere. If the result already contains a property with // the same key, the value will be updated. void RecordProperty(const std::string& key, const std::string& value); // Gets the i-th test case among all the test cases. i can range from 0 to // total_test_case_count() - 1. If i is not in that range, returns NULL. TestCase* GetMutableTestCase(int i); // Accessors for the implementation object. internal::UnitTestImpl* impl() { return impl_; } const internal::UnitTestImpl* impl() const { return impl_; } // These classes and functions are friends as they need to access private // members of UnitTest. friend class ScopedTrace; friend class Test; friend class internal::AssertHelper; friend class internal::StreamingListenerTest; friend class internal::UnitTestRecordPropertyTestHelper; friend Environment* AddGlobalTestEnvironment(Environment* env); friend internal::UnitTestImpl* internal::GetUnitTestImpl(); friend void internal::ReportFailureInUnknownLocation( TestPartResult::Type result_type, const std::string& message); // Creates an empty UnitTest. UnitTest(); // D'tor virtual ~UnitTest(); // Pushes a trace defined by SCOPED_TRACE() on to the per-thread // Google Test trace stack. void PushGTestTrace(const internal::TraceInfo& trace) GTEST_LOCK_EXCLUDED_(mutex_); // Pops a trace from the per-thread Google Test trace stack. void PopGTestTrace() GTEST_LOCK_EXCLUDED_(mutex_); // Protects mutable state in *impl_. This is mutable as some const // methods need to lock it too. mutable internal::Mutex mutex_; // Opaque implementation object. This field is never changed once // the object is constructed. We don't mark it as const here, as // doing so will cause a warning in the constructor of UnitTest. // Mutable state in *impl_ is protected by mutex_. internal::UnitTestImpl* impl_; // We disallow copying UnitTest. GTEST_DISALLOW_COPY_AND_ASSIGN_(UnitTest); }; // A convenient wrapper for adding an environment for the test // program. // // You should call this before RUN_ALL_TESTS() is called, probably in // main(). If you use gtest_main, you need to call this before main() // starts for it to take effect. For example, you can define a global // variable like this: // // testing::Environment* const foo_env = // testing::AddGlobalTestEnvironment(new FooEnvironment); // // However, we strongly recommend you to write your own main() and // call AddGlobalTestEnvironment() there, as relying on initialization // of global variables makes the code harder to read and may cause // problems when you register multiple environments from different // translation units and the environments have dependencies among them // (remember that the compiler doesn't guarantee the order in which // global variables from different translation units are initialized). inline Environment* AddGlobalTestEnvironment(Environment* env) { return UnitTest::GetInstance()->AddEnvironment(env); } // Initializes Google Test. This must be called before calling // RUN_ALL_TESTS(). In particular, it parses a command line for the // flags that Google Test recognizes. Whenever a Google Test flag is // seen, it is removed from argv, and *argc is decremented. // // No value is returned. Instead, the Google Test flag variables are // updated. // // Calling the function for the second time has no user-visible effect. GTEST_API_ void InitGoogleTest(int* argc, char** argv); // This overloaded version can be used in Windows programs compiled in // UNICODE mode. GTEST_API_ void InitGoogleTest(int* argc, wchar_t** argv); namespace internal { // Separate the error generating code from the code path to reduce the stack // frame size of CmpHelperEQ. This helps reduce the overhead of some sanitizers // when calling EXPECT_* in a tight loop. template AssertionResult CmpHelperEQFailure(const char* lhs_expression, const char* rhs_expression, const T1& lhs, const T2& rhs) { return EqFailure(lhs_expression, rhs_expression, FormatForComparisonFailureMessage(lhs, rhs), FormatForComparisonFailureMessage(rhs, lhs), false); } // The helper function for {ASSERT|EXPECT}_EQ. template AssertionResult CmpHelperEQ(const char* lhs_expression, const char* rhs_expression, const T1& lhs, const T2& rhs) { if (lhs == rhs) { return AssertionSuccess(); } return CmpHelperEQFailure(lhs_expression, rhs_expression, lhs, rhs); } // With this overloaded version, we allow anonymous enums to be used // in {ASSERT|EXPECT}_EQ when compiled with gcc 4, as anonymous enums // can be implicitly cast to BiggestInt. GTEST_API_ AssertionResult CmpHelperEQ(const char* lhs_expression, const char* rhs_expression, BiggestInt lhs, BiggestInt rhs); // The helper class for {ASSERT|EXPECT}_EQ. The template argument // lhs_is_null_literal is true iff the first argument to ASSERT_EQ() // is a null pointer literal. The following default implementation is // for lhs_is_null_literal being false. template class EqHelper { public: // This templatized version is for the general case. template static AssertionResult Compare(const char* lhs_expression, const char* rhs_expression, const T1& lhs, const T2& rhs) { return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs); } // With this overloaded version, we allow anonymous enums to be used // in {ASSERT|EXPECT}_EQ when compiled with gcc 4, as anonymous // enums can be implicitly cast to BiggestInt. // // Even though its body looks the same as the above version, we // cannot merge the two, as it will make anonymous enums unhappy. static AssertionResult Compare(const char* lhs_expression, const char* rhs_expression, BiggestInt lhs, BiggestInt rhs) { return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs); } }; // This specialization is used when the first argument to ASSERT_EQ() // is a null pointer literal, like NULL, false, or 0. template <> class EqHelper { public: // We define two overloaded versions of Compare(). The first // version will be picked when the second argument to ASSERT_EQ() is // NOT a pointer, e.g. ASSERT_EQ(0, AnIntFunction()) or // EXPECT_EQ(false, a_bool). template static AssertionResult Compare( const char* lhs_expression, const char* rhs_expression, const T1& lhs, const T2& rhs, // The following line prevents this overload from being considered if T2 // is not a pointer type. We need this because ASSERT_EQ(NULL, my_ptr) // expands to Compare("", "", NULL, my_ptr), which requires a conversion // to match the Secret* in the other overload, which would otherwise make // this template match better. typename EnableIf::value>::type* = 0) { return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs); } // This version will be picked when the second argument to ASSERT_EQ() is a // pointer, e.g. ASSERT_EQ(NULL, a_pointer). template static AssertionResult Compare( const char* lhs_expression, const char* rhs_expression, // We used to have a second template parameter instead of Secret*. That // template parameter would deduce to 'long', making this a better match // than the first overload even without the first overload's EnableIf. // Unfortunately, gcc with -Wconversion-null warns when "passing NULL to // non-pointer argument" (even a deduced integral argument), so the old // implementation caused warnings in user code. Secret* /* lhs (NULL) */, T* rhs) { // We already know that 'lhs' is a null pointer. return CmpHelperEQ(lhs_expression, rhs_expression, static_cast(NULL), rhs); } }; // Separate the error generating code from the code path to reduce the stack // frame size of CmpHelperOP. This helps reduce the overhead of some sanitizers // when calling EXPECT_OP in a tight loop. template AssertionResult CmpHelperOpFailure(const char* expr1, const char* expr2, const T1& val1, const T2& val2, const char* op) { return AssertionFailure() << "Expected: (" << expr1 << ") " << op << " (" << expr2 << "), actual: " << FormatForComparisonFailureMessage(val1, val2) << " vs " << FormatForComparisonFailureMessage(val2, val1); } // A macro for implementing the helper functions needed to implement // ASSERT_?? and EXPECT_??. It is here just to avoid copy-and-paste // of similar code. // // For each templatized helper function, we also define an overloaded // version for BiggestInt in order to reduce code bloat and allow // anonymous enums to be used with {ASSERT|EXPECT}_?? when compiled // with gcc 4. // // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. #define GTEST_IMPL_CMP_HELPER_(op_name, op)\ template \ AssertionResult CmpHelper##op_name(const char* expr1, const char* expr2, \ const T1& val1, const T2& val2) {\ if (val1 op val2) {\ return AssertionSuccess();\ } else {\ return CmpHelperOpFailure(expr1, expr2, val1, val2, #op);\ }\ }\ GTEST_API_ AssertionResult CmpHelper##op_name(\ const char* expr1, const char* expr2, BiggestInt val1, BiggestInt val2) // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. // Implements the helper function for {ASSERT|EXPECT}_NE GTEST_IMPL_CMP_HELPER_(NE, !=); // Implements the helper function for {ASSERT|EXPECT}_LE GTEST_IMPL_CMP_HELPER_(LE, <=); // Implements the helper function for {ASSERT|EXPECT}_LT GTEST_IMPL_CMP_HELPER_(LT, <); // Implements the helper function for {ASSERT|EXPECT}_GE GTEST_IMPL_CMP_HELPER_(GE, >=); // Implements the helper function for {ASSERT|EXPECT}_GT GTEST_IMPL_CMP_HELPER_(GT, >); #undef GTEST_IMPL_CMP_HELPER_ // The helper function for {ASSERT|EXPECT}_STREQ. // // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. GTEST_API_ AssertionResult CmpHelperSTREQ(const char* s1_expression, const char* s2_expression, const char* s1, const char* s2); // The helper function for {ASSERT|EXPECT}_STRCASEEQ. // // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. GTEST_API_ AssertionResult CmpHelperSTRCASEEQ(const char* s1_expression, const char* s2_expression, const char* s1, const char* s2); // The helper function for {ASSERT|EXPECT}_STRNE. // // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. GTEST_API_ AssertionResult CmpHelperSTRNE(const char* s1_expression, const char* s2_expression, const char* s1, const char* s2); // The helper function for {ASSERT|EXPECT}_STRCASENE. // // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. GTEST_API_ AssertionResult CmpHelperSTRCASENE(const char* s1_expression, const char* s2_expression, const char* s1, const char* s2); // Helper function for *_STREQ on wide strings. // // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. GTEST_API_ AssertionResult CmpHelperSTREQ(const char* s1_expression, const char* s2_expression, const wchar_t* s1, const wchar_t* s2); // Helper function for *_STRNE on wide strings. // // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. GTEST_API_ AssertionResult CmpHelperSTRNE(const char* s1_expression, const char* s2_expression, const wchar_t* s1, const wchar_t* s2); } // namespace internal // IsSubstring() and IsNotSubstring() are intended to be used as the // first argument to {EXPECT,ASSERT}_PRED_FORMAT2(), not by // themselves. They check whether needle is a substring of haystack // (NULL is considered a substring of itself only), and return an // appropriate error message when they fail. // // The {needle,haystack}_expr arguments are the stringified // expressions that generated the two real arguments. GTEST_API_ AssertionResult IsSubstring( const char* needle_expr, const char* haystack_expr, const char* needle, const char* haystack); GTEST_API_ AssertionResult IsSubstring( const char* needle_expr, const char* haystack_expr, const wchar_t* needle, const wchar_t* haystack); GTEST_API_ AssertionResult IsNotSubstring( const char* needle_expr, const char* haystack_expr, const char* needle, const char* haystack); GTEST_API_ AssertionResult IsNotSubstring( const char* needle_expr, const char* haystack_expr, const wchar_t* needle, const wchar_t* haystack); GTEST_API_ AssertionResult IsSubstring( const char* needle_expr, const char* haystack_expr, const ::std::string& needle, const ::std::string& haystack); GTEST_API_ AssertionResult IsNotSubstring( const char* needle_expr, const char* haystack_expr, const ::std::string& needle, const ::std::string& haystack); #if GTEST_HAS_STD_WSTRING GTEST_API_ AssertionResult IsSubstring( const char* needle_expr, const char* haystack_expr, const ::std::wstring& needle, const ::std::wstring& haystack); GTEST_API_ AssertionResult IsNotSubstring( const char* needle_expr, const char* haystack_expr, const ::std::wstring& needle, const ::std::wstring& haystack); #endif // GTEST_HAS_STD_WSTRING namespace internal { // Helper template function for comparing floating-points. // // Template parameter: // // RawType: the raw floating-point type (either float or double) // // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. template AssertionResult CmpHelperFloatingPointEQ(const char* lhs_expression, const char* rhs_expression, RawType lhs_value, RawType rhs_value) { const FloatingPoint lhs(lhs_value), rhs(rhs_value); if (lhs.AlmostEquals(rhs)) { return AssertionSuccess(); } ::std::stringstream lhs_ss; lhs_ss << std::setprecision(std::numeric_limits::digits10 + 2) << lhs_value; ::std::stringstream rhs_ss; rhs_ss << std::setprecision(std::numeric_limits::digits10 + 2) << rhs_value; return EqFailure(lhs_expression, rhs_expression, StringStreamToString(&lhs_ss), StringStreamToString(&rhs_ss), false); } // Helper function for implementing ASSERT_NEAR. // // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. GTEST_API_ AssertionResult DoubleNearPredFormat(const char* expr1, const char* expr2, const char* abs_error_expr, double val1, double val2, double abs_error); // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. // A class that enables one to stream messages to assertion macros class GTEST_API_ AssertHelper { public: // Constructor. AssertHelper(TestPartResult::Type type, const char* file, int line, const char* message); ~AssertHelper(); // Message assignment is a semantic trick to enable assertion // streaming; see the GTEST_MESSAGE_ macro below. void operator=(const Message& message) const; private: // We put our data in a struct so that the size of the AssertHelper class can // be as small as possible. This is important because gcc is incapable of // re-using stack space even for temporary variables, so every EXPECT_EQ // reserves stack space for another AssertHelper. struct AssertHelperData { AssertHelperData(TestPartResult::Type t, const char* srcfile, int line_num, const char* msg) : type(t), file(srcfile), line(line_num), message(msg) { } TestPartResult::Type const type; const char* const file; int const line; std::string const message; private: GTEST_DISALLOW_COPY_AND_ASSIGN_(AssertHelperData); }; AssertHelperData* const data_; GTEST_DISALLOW_COPY_AND_ASSIGN_(AssertHelper); }; } // namespace internal // The pure interface class that all value-parameterized tests inherit from. // A value-parameterized class must inherit from both ::testing::Test and // ::testing::WithParamInterface. In most cases that just means inheriting // from ::testing::TestWithParam, but more complicated test hierarchies // may need to inherit from Test and WithParamInterface at different levels. // // This interface has support for accessing the test parameter value via // the GetParam() method. // // Use it with one of the parameter generator defining functions, like Range(), // Values(), ValuesIn(), Bool(), and Combine(). // // class FooTest : public ::testing::TestWithParam { // protected: // FooTest() { // // Can use GetParam() here. // } // virtual ~FooTest() { // // Can use GetParam() here. // } // virtual void SetUp() { // // Can use GetParam() here. // } // virtual void TearDown { // // Can use GetParam() here. // } // }; // TEST_P(FooTest, DoesBar) { // // Can use GetParam() method here. // Foo foo; // ASSERT_TRUE(foo.DoesBar(GetParam())); // } // INSTANTIATE_TEST_CASE_P(OneToTenRange, FooTest, ::testing::Range(1, 10)); template class WithParamInterface { public: typedef T ParamType; virtual ~WithParamInterface() {} // The current parameter value. Is also available in the test fixture's // constructor. This member function is non-static, even though it only // references static data, to reduce the opportunity for incorrect uses // like writing 'WithParamInterface::GetParam()' for a test that // uses a fixture whose parameter type is int. const ParamType& GetParam() const { GTEST_CHECK_(parameter_ != NULL) << "GetParam() can only be called inside a value-parameterized test " << "-- did you intend to write TEST_P instead of TEST_F?"; return *parameter_; } private: // Sets parameter value. The caller is responsible for making sure the value // remains alive and unchanged throughout the current test. static void SetParam(const ParamType* parameter) { parameter_ = parameter; } // Static value used for accessing parameter during a test lifetime. static const ParamType* parameter_; // TestClass must be a subclass of WithParamInterface and Test. template friend class internal::ParameterizedTestFactory; }; template const T* WithParamInterface::parameter_ = NULL; // Most value-parameterized classes can ignore the existence of // WithParamInterface, and can just inherit from ::testing::TestWithParam. template class TestWithParam : public Test, public WithParamInterface { }; // Macros for indicating success/failure in test code. // ADD_FAILURE unconditionally adds a failure to the current test. // SUCCEED generates a success - it doesn't automatically make the // current test successful, as a test is only successful when it has // no failure. // // EXPECT_* verifies that a certain condition is satisfied. If not, // it behaves like ADD_FAILURE. In particular: // // EXPECT_TRUE verifies that a Boolean condition is true. // EXPECT_FALSE verifies that a Boolean condition is false. // // FAIL and ASSERT_* are similar to ADD_FAILURE and EXPECT_*, except // that they will also abort the current function on failure. People // usually want the fail-fast behavior of FAIL and ASSERT_*, but those // writing data-driven tests often find themselves using ADD_FAILURE // and EXPECT_* more. // Generates a nonfatal failure with a generic message. #define ADD_FAILURE() GTEST_NONFATAL_FAILURE_("Failed") // Generates a nonfatal failure at the given source file location with // a generic message. #define ADD_FAILURE_AT(file, line) \ GTEST_MESSAGE_AT_(file, line, "Failed", \ ::testing::TestPartResult::kNonFatalFailure) // Generates a fatal failure with a generic message. #define GTEST_FAIL() GTEST_FATAL_FAILURE_("Failed") // Define this macro to 1 to omit the definition of FAIL(), which is a // generic name and clashes with some other libraries. #if !GTEST_DONT_DEFINE_FAIL # define FAIL() GTEST_FAIL() #endif // Generates a success with a generic message. #define GTEST_SUCCEED() GTEST_SUCCESS_("Succeeded") // Define this macro to 1 to omit the definition of SUCCEED(), which // is a generic name and clashes with some other libraries. #if !GTEST_DONT_DEFINE_SUCCEED # define SUCCEED() GTEST_SUCCEED() #endif // Macros for testing exceptions. // // * {ASSERT|EXPECT}_THROW(statement, expected_exception): // Tests that the statement throws the expected exception. // * {ASSERT|EXPECT}_NO_THROW(statement): // Tests that the statement doesn't throw any exception. // * {ASSERT|EXPECT}_ANY_THROW(statement): // Tests that the statement throws an exception. #define EXPECT_THROW(statement, expected_exception) \ GTEST_TEST_THROW_(statement, expected_exception, GTEST_NONFATAL_FAILURE_) #define EXPECT_NO_THROW(statement) \ GTEST_TEST_NO_THROW_(statement, GTEST_NONFATAL_FAILURE_) #define EXPECT_ANY_THROW(statement) \ GTEST_TEST_ANY_THROW_(statement, GTEST_NONFATAL_FAILURE_) #define ASSERT_THROW(statement, expected_exception) \ GTEST_TEST_THROW_(statement, expected_exception, GTEST_FATAL_FAILURE_) #define ASSERT_NO_THROW(statement) \ GTEST_TEST_NO_THROW_(statement, GTEST_FATAL_FAILURE_) #define ASSERT_ANY_THROW(statement) \ GTEST_TEST_ANY_THROW_(statement, GTEST_FATAL_FAILURE_) // Boolean assertions. Condition can be either a Boolean expression or an // AssertionResult. For more information on how to use AssertionResult with // these macros see comments on that class. #define EXPECT_TRUE(condition) \ GTEST_TEST_BOOLEAN_(condition, #condition, false, true, \ GTEST_NONFATAL_FAILURE_) #define EXPECT_FALSE(condition) \ GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \ GTEST_NONFATAL_FAILURE_) #define ASSERT_TRUE(condition) \ GTEST_TEST_BOOLEAN_(condition, #condition, false, true, \ GTEST_FATAL_FAILURE_) #define ASSERT_FALSE(condition) \ GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \ GTEST_FATAL_FAILURE_) // Macros for testing equalities and inequalities. // // * {ASSERT|EXPECT}_EQ(v1, v2): Tests that v1 == v2 // * {ASSERT|EXPECT}_NE(v1, v2): Tests that v1 != v2 // * {ASSERT|EXPECT}_LT(v1, v2): Tests that v1 < v2 // * {ASSERT|EXPECT}_LE(v1, v2): Tests that v1 <= v2 // * {ASSERT|EXPECT}_GT(v1, v2): Tests that v1 > v2 // * {ASSERT|EXPECT}_GE(v1, v2): Tests that v1 >= v2 // // When they are not, Google Test prints both the tested expressions and // their actual values. The values must be compatible built-in types, // or you will get a compiler error. By "compatible" we mean that the // values can be compared by the respective operator. // // Note: // // 1. It is possible to make a user-defined type work with // {ASSERT|EXPECT}_??(), but that requires overloading the // comparison operators and is thus discouraged by the Google C++ // Usage Guide. Therefore, you are advised to use the // {ASSERT|EXPECT}_TRUE() macro to assert that two objects are // equal. // // 2. The {ASSERT|EXPECT}_??() macros do pointer comparisons on // pointers (in particular, C strings). Therefore, if you use it // with two C strings, you are testing how their locations in memory // are related, not how their content is related. To compare two C // strings by content, use {ASSERT|EXPECT}_STR*(). // // 3. {ASSERT|EXPECT}_EQ(v1, v2) is preferred to // {ASSERT|EXPECT}_TRUE(v1 == v2), as the former tells you // what the actual value is when it fails, and similarly for the // other comparisons. // // 4. Do not depend on the order in which {ASSERT|EXPECT}_??() // evaluate their arguments, which is undefined. // // 5. These macros evaluate their arguments exactly once. // // Examples: // // EXPECT_NE(Foo(), 5); // EXPECT_EQ(a_pointer, NULL); // ASSERT_LT(i, array_size); // ASSERT_GT(records.size(), 0) << "There is no record left."; #define EXPECT_EQ(val1, val2) \ EXPECT_PRED_FORMAT2(::testing::internal:: \ EqHelper::Compare, \ val1, val2) #define EXPECT_NE(val1, val2) \ EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperNE, val1, val2) #define EXPECT_LE(val1, val2) \ EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperLE, val1, val2) #define EXPECT_LT(val1, val2) \ EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperLT, val1, val2) #define EXPECT_GE(val1, val2) \ EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperGE, val1, val2) #define EXPECT_GT(val1, val2) \ EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperGT, val1, val2) #define GTEST_ASSERT_EQ(val1, val2) \ ASSERT_PRED_FORMAT2(::testing::internal:: \ EqHelper::Compare, \ val1, val2) #define GTEST_ASSERT_NE(val1, val2) \ ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperNE, val1, val2) #define GTEST_ASSERT_LE(val1, val2) \ ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperLE, val1, val2) #define GTEST_ASSERT_LT(val1, val2) \ ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperLT, val1, val2) #define GTEST_ASSERT_GE(val1, val2) \ ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperGE, val1, val2) #define GTEST_ASSERT_GT(val1, val2) \ ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperGT, val1, val2) // Define macro GTEST_DONT_DEFINE_ASSERT_XY to 1 to omit the definition of // ASSERT_XY(), which clashes with some users' own code. #if !GTEST_DONT_DEFINE_ASSERT_EQ # define ASSERT_EQ(val1, val2) GTEST_ASSERT_EQ(val1, val2) #endif #if !GTEST_DONT_DEFINE_ASSERT_NE # define ASSERT_NE(val1, val2) GTEST_ASSERT_NE(val1, val2) #endif #if !GTEST_DONT_DEFINE_ASSERT_LE # define ASSERT_LE(val1, val2) GTEST_ASSERT_LE(val1, val2) #endif #if !GTEST_DONT_DEFINE_ASSERT_LT # define ASSERT_LT(val1, val2) GTEST_ASSERT_LT(val1, val2) #endif #if !GTEST_DONT_DEFINE_ASSERT_GE # define ASSERT_GE(val1, val2) GTEST_ASSERT_GE(val1, val2) #endif #if !GTEST_DONT_DEFINE_ASSERT_GT # define ASSERT_GT(val1, val2) GTEST_ASSERT_GT(val1, val2) #endif // C-string Comparisons. All tests treat NULL and any non-NULL string // as different. Two NULLs are equal. // // * {ASSERT|EXPECT}_STREQ(s1, s2): Tests that s1 == s2 // * {ASSERT|EXPECT}_STRNE(s1, s2): Tests that s1 != s2 // * {ASSERT|EXPECT}_STRCASEEQ(s1, s2): Tests that s1 == s2, ignoring case // * {ASSERT|EXPECT}_STRCASENE(s1, s2): Tests that s1 != s2, ignoring case // // For wide or narrow string objects, you can use the // {ASSERT|EXPECT}_??() macros. // // Don't depend on the order in which the arguments are evaluated, // which is undefined. // // These macros evaluate their arguments exactly once. #define EXPECT_STREQ(s1, s2) \ EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTREQ, s1, s2) #define EXPECT_STRNE(s1, s2) \ EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2) #define EXPECT_STRCASEEQ(s1, s2) \ EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, s1, s2) #define EXPECT_STRCASENE(s1, s2)\ EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2) #define ASSERT_STREQ(s1, s2) \ ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTREQ, s1, s2) #define ASSERT_STRNE(s1, s2) \ ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2) #define ASSERT_STRCASEEQ(s1, s2) \ ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, s1, s2) #define ASSERT_STRCASENE(s1, s2)\ ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2) // Macros for comparing floating-point numbers. // // * {ASSERT|EXPECT}_FLOAT_EQ(val1, val2): // Tests that two float values are almost equal. // * {ASSERT|EXPECT}_DOUBLE_EQ(val1, val2): // Tests that two double values are almost equal. // * {ASSERT|EXPECT}_NEAR(v1, v2, abs_error): // Tests that v1 and v2 are within the given distance to each other. // // Google Test uses ULP-based comparison to automatically pick a default // error bound that is appropriate for the operands. See the // FloatingPoint template class in gtest-internal.h if you are // interested in the implementation details. #define EXPECT_FLOAT_EQ(val1, val2)\ EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ, \ val1, val2) #define EXPECT_DOUBLE_EQ(val1, val2)\ EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ, \ val1, val2) #define ASSERT_FLOAT_EQ(val1, val2)\ ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ, \ val1, val2) #define ASSERT_DOUBLE_EQ(val1, val2)\ ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ, \ val1, val2) #define EXPECT_NEAR(val1, val2, abs_error)\ EXPECT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, \ val1, val2, abs_error) #define ASSERT_NEAR(val1, val2, abs_error)\ ASSERT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, \ val1, val2, abs_error) // These predicate format functions work on floating-point values, and // can be used in {ASSERT|EXPECT}_PRED_FORMAT2*(), e.g. // // EXPECT_PRED_FORMAT2(testing::DoubleLE, Foo(), 5.0); // Asserts that val1 is less than, or almost equal to, val2. Fails // otherwise. In particular, it fails if either val1 or val2 is NaN. GTEST_API_ AssertionResult FloatLE(const char* expr1, const char* expr2, float val1, float val2); GTEST_API_ AssertionResult DoubleLE(const char* expr1, const char* expr2, double val1, double val2); #if GTEST_OS_WINDOWS // Macros that test for HRESULT failure and success, these are only useful // on Windows, and rely on Windows SDK macros and APIs to compile. // // * {ASSERT|EXPECT}_HRESULT_{SUCCEEDED|FAILED}(expr) // // When expr unexpectedly fails or succeeds, Google Test prints the // expected result and the actual result with both a human-readable // string representation of the error, if available, as well as the // hex result code. # define EXPECT_HRESULT_SUCCEEDED(expr) \ EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr)) # define ASSERT_HRESULT_SUCCEEDED(expr) \ ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr)) # define EXPECT_HRESULT_FAILED(expr) \ EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr)) # define ASSERT_HRESULT_FAILED(expr) \ ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr)) #endif // GTEST_OS_WINDOWS // Macros that execute statement and check that it doesn't generate new fatal // failures in the current thread. // // * {ASSERT|EXPECT}_NO_FATAL_FAILURE(statement); // // Examples: // // EXPECT_NO_FATAL_FAILURE(Process()); // ASSERT_NO_FATAL_FAILURE(Process()) << "Process() failed"; // #define ASSERT_NO_FATAL_FAILURE(statement) \ GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_FATAL_FAILURE_) #define EXPECT_NO_FATAL_FAILURE(statement) \ GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_NONFATAL_FAILURE_) // Causes a trace (including the given source file path and line number, // and the given message) to be included in every test failure message generated // by code in the scope of the lifetime of an instance of this class. The effect // is undone with the destruction of the instance. // // The message argument can be anything streamable to std::ostream. // // Example: // testing::ScopedTrace trace("file.cc", 123, "message"); // class GTEST_API_ ScopedTrace { public: // The c'tor pushes the given source file location and message onto // a trace stack maintained by Google Test. // Template version. Uses Message() to convert the values into strings. // Slow, but flexible. template ScopedTrace(const char* file, int line, const T& message) { PushTrace(file, line, (Message() << message).GetString()); } // Optimize for some known types. ScopedTrace(const char* file, int line, const char* message) { PushTrace(file, line, message ? message : "(null)"); } #if GTEST_HAS_GLOBAL_STRING ScopedTrace(const char* file, int line, const ::string& message) { PushTrace(file, line, message); } #endif ScopedTrace(const char* file, int line, const std::string& message) { PushTrace(file, line, message); } // The d'tor pops the info pushed by the c'tor. // // Note that the d'tor is not virtual in order to be efficient. // Don't inherit from ScopedTrace! ~ScopedTrace(); private: void PushTrace(const char* file, int line, std::string message); GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedTrace); } GTEST_ATTRIBUTE_UNUSED_; // A ScopedTrace object does its job in its // c'tor and d'tor. Therefore it doesn't // need to be used otherwise. // Causes a trace (including the source file path, the current line // number, and the given message) to be included in every test failure // message generated by code in the current scope. The effect is // undone when the control leaves the current scope. // // The message argument can be anything streamable to std::ostream. // // In the implementation, we include the current line number as part // of the dummy variable name, thus allowing multiple SCOPED_TRACE()s // to appear in the same block - as long as they are on different // lines. // // Assuming that each thread maintains its own stack of traces. // Therefore, a SCOPED_TRACE() would (correctly) only affect the // assertions in its own thread. #define SCOPED_TRACE(message) \ ::testing::ScopedTrace GTEST_CONCAT_TOKEN_(gtest_trace_, __LINE__)(\ __FILE__, __LINE__, (message)) // Compile-time assertion for type equality. // StaticAssertTypeEq() compiles iff type1 and type2 are // the same type. The value it returns is not interesting. // // Instead of making StaticAssertTypeEq a class template, we make it a // function template that invokes a helper class template. This // prevents a user from misusing StaticAssertTypeEq by // defining objects of that type. // // CAVEAT: // // When used inside a method of a class template, // StaticAssertTypeEq() is effective ONLY IF the method is // instantiated. For example, given: // // template class Foo { // public: // void Bar() { testing::StaticAssertTypeEq(); } // }; // // the code: // // void Test1() { Foo foo; } // // will NOT generate a compiler error, as Foo::Bar() is never // actually instantiated. Instead, you need: // // void Test2() { Foo foo; foo.Bar(); } // // to cause a compiler error. template bool StaticAssertTypeEq() { (void)internal::StaticAssertTypeEqHelper(); return true; } // Defines a test. // // The first parameter is the name of the test case, and the second // parameter is the name of the test within the test case. // // The convention is to end the test case name with "Test". For // example, a test case for the Foo class can be named FooTest. // // Test code should appear between braces after an invocation of // this macro. Example: // // TEST(FooTest, InitializesCorrectly) { // Foo foo; // EXPECT_TRUE(foo.StatusIsOK()); // } // Note that we call GetTestTypeId() instead of GetTypeId< // ::testing::Test>() here to get the type ID of testing::Test. This // is to work around a suspected linker bug when using Google Test as // a framework on Mac OS X. The bug causes GetTypeId< // ::testing::Test>() to return different values depending on whether // the call is from the Google Test framework itself or from user test // code. GetTestTypeId() is guaranteed to always return the same // value, as it always calls GetTypeId<>() from the Google Test // framework. #define GTEST_TEST(test_case_name, test_name)\ GTEST_TEST_(test_case_name, test_name, \ ::testing::Test, ::testing::internal::GetTestTypeId()) // Define this macro to 1 to omit the definition of TEST(), which // is a generic name and clashes with some other libraries. #if !GTEST_DONT_DEFINE_TEST # define TEST(test_case_name, test_name) GTEST_TEST(test_case_name, test_name) #endif // Defines a test that uses a test fixture. // // The first parameter is the name of the test fixture class, which // also doubles as the test case name. The second parameter is the // name of the test within the test case. // // A test fixture class must be declared earlier. The user should put // the test code between braces after using this macro. Example: // // class FooTest : public testing::Test { // protected: // virtual void SetUp() { b_.AddElement(3); } // // Foo a_; // Foo b_; // }; // // TEST_F(FooTest, InitializesCorrectly) { // EXPECT_TRUE(a_.StatusIsOK()); // } // // TEST_F(FooTest, ReturnsElementCountCorrectly) { // EXPECT_EQ(a_.size(), 0); // EXPECT_EQ(b_.size(), 1); // } #define TEST_F(test_fixture, test_name)\ GTEST_TEST_(test_fixture, test_name, test_fixture, \ ::testing::internal::GetTypeId()) // Returns a path to temporary directory. // Tries to determine an appropriate directory for the platform. GTEST_API_ std::string TempDir(); #ifdef _MSC_VER # pragma warning(pop) #endif } // namespace testing // Use this function in main() to run all tests. It returns 0 if all // tests are successful, or 1 otherwise. // // RUN_ALL_TESTS() should be invoked after the command line has been // parsed by InitGoogleTest(). // // This function was formerly a macro; thus, it is in the global // namespace and has an all-caps name. int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_; inline int RUN_ALL_TESTS() { return ::testing::UnitTest::GetInstance()->Run(); } GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251 #endif // GTEST_INCLUDE_GTEST_GTEST_H_ iptux-0.9.4/src/googletest/include/gtest/gtest_pred_impl.h000066400000000000000000000351401475473122500237600ustar00rootroot00000000000000// Copyright 2006, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // This file is AUTOMATICALLY GENERATED on 01/02/2018 by command // 'gen_gtest_pred_impl.py 5'. DO NOT EDIT BY HAND! // // Implements a family of generic predicate assertion macros. // GOOGLETEST_CM0001 DO NOT DELETE #ifndef GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_ #define GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_ #include "gtest/gtest.h" namespace testing { // This header implements a family of generic predicate assertion // macros: // // ASSERT_PRED_FORMAT1(pred_format, v1) // ASSERT_PRED_FORMAT2(pred_format, v1, v2) // ... // // where pred_format is a function or functor that takes n (in the // case of ASSERT_PRED_FORMATn) values and their source expression // text, and returns a testing::AssertionResult. See the definition // of ASSERT_EQ in gtest.h for an example. // // If you don't care about formatting, you can use the more // restrictive version: // // ASSERT_PRED1(pred, v1) // ASSERT_PRED2(pred, v1, v2) // ... // // where pred is an n-ary function or functor that returns bool, // and the values v1, v2, ..., must support the << operator for // streaming to std::ostream. // // We also define the EXPECT_* variations. // // For now we only support predicates whose arity is at most 5. // GTEST_ASSERT_ is the basic statement to which all of the assertions // in this file reduce. Don't use this in your code. #define GTEST_ASSERT_(expression, on_failure) \ GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ if (const ::testing::AssertionResult gtest_ar = (expression)) \ ; \ else \ on_failure(gtest_ar.failure_message()) // Helper function for implementing {EXPECT|ASSERT}_PRED1. Don't use // this in your code. template AssertionResult AssertPred1Helper(const char* pred_text, const char* e1, Pred pred, const T1& v1) { if (pred(v1)) return AssertionSuccess(); return AssertionFailure() << pred_text << "(" << e1 << ") evaluates to false, where" << "\n" << e1 << " evaluates to " << v1; } // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT1. // Don't use this in your code. #define GTEST_PRED_FORMAT1_(pred_format, v1, on_failure)\ GTEST_ASSERT_(pred_format(#v1, v1), \ on_failure) // Internal macro for implementing {EXPECT|ASSERT}_PRED1. Don't use // this in your code. #define GTEST_PRED1_(pred, v1, on_failure)\ GTEST_ASSERT_(::testing::AssertPred1Helper(#pred, \ #v1, \ pred, \ v1), on_failure) // Unary predicate assertion macros. #define EXPECT_PRED_FORMAT1(pred_format, v1) \ GTEST_PRED_FORMAT1_(pred_format, v1, GTEST_NONFATAL_FAILURE_) #define EXPECT_PRED1(pred, v1) \ GTEST_PRED1_(pred, v1, GTEST_NONFATAL_FAILURE_) #define ASSERT_PRED_FORMAT1(pred_format, v1) \ GTEST_PRED_FORMAT1_(pred_format, v1, GTEST_FATAL_FAILURE_) #define ASSERT_PRED1(pred, v1) \ GTEST_PRED1_(pred, v1, GTEST_FATAL_FAILURE_) // Helper function for implementing {EXPECT|ASSERT}_PRED2. Don't use // this in your code. template AssertionResult AssertPred2Helper(const char* pred_text, const char* e1, const char* e2, Pred pred, const T1& v1, const T2& v2) { if (pred(v1, v2)) return AssertionSuccess(); return AssertionFailure() << pred_text << "(" << e1 << ", " << e2 << ") evaluates to false, where" << "\n" << e1 << " evaluates to " << v1 << "\n" << e2 << " evaluates to " << v2; } // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT2. // Don't use this in your code. #define GTEST_PRED_FORMAT2_(pred_format, v1, v2, on_failure)\ GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2), \ on_failure) // Internal macro for implementing {EXPECT|ASSERT}_PRED2. Don't use // this in your code. #define GTEST_PRED2_(pred, v1, v2, on_failure)\ GTEST_ASSERT_(::testing::AssertPred2Helper(#pred, \ #v1, \ #v2, \ pred, \ v1, \ v2), on_failure) // Binary predicate assertion macros. #define EXPECT_PRED_FORMAT2(pred_format, v1, v2) \ GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_NONFATAL_FAILURE_) #define EXPECT_PRED2(pred, v1, v2) \ GTEST_PRED2_(pred, v1, v2, GTEST_NONFATAL_FAILURE_) #define ASSERT_PRED_FORMAT2(pred_format, v1, v2) \ GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_FATAL_FAILURE_) #define ASSERT_PRED2(pred, v1, v2) \ GTEST_PRED2_(pred, v1, v2, GTEST_FATAL_FAILURE_) // Helper function for implementing {EXPECT|ASSERT}_PRED3. Don't use // this in your code. template AssertionResult AssertPred3Helper(const char* pred_text, const char* e1, const char* e2, const char* e3, Pred pred, const T1& v1, const T2& v2, const T3& v3) { if (pred(v1, v2, v3)) return AssertionSuccess(); return AssertionFailure() << pred_text << "(" << e1 << ", " << e2 << ", " << e3 << ") evaluates to false, where" << "\n" << e1 << " evaluates to " << v1 << "\n" << e2 << " evaluates to " << v2 << "\n" << e3 << " evaluates to " << v3; } // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT3. // Don't use this in your code. #define GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, on_failure)\ GTEST_ASSERT_(pred_format(#v1, #v2, #v3, v1, v2, v3), \ on_failure) // Internal macro for implementing {EXPECT|ASSERT}_PRED3. Don't use // this in your code. #define GTEST_PRED3_(pred, v1, v2, v3, on_failure)\ GTEST_ASSERT_(::testing::AssertPred3Helper(#pred, \ #v1, \ #v2, \ #v3, \ pred, \ v1, \ v2, \ v3), on_failure) // Ternary predicate assertion macros. #define EXPECT_PRED_FORMAT3(pred_format, v1, v2, v3) \ GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, GTEST_NONFATAL_FAILURE_) #define EXPECT_PRED3(pred, v1, v2, v3) \ GTEST_PRED3_(pred, v1, v2, v3, GTEST_NONFATAL_FAILURE_) #define ASSERT_PRED_FORMAT3(pred_format, v1, v2, v3) \ GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, GTEST_FATAL_FAILURE_) #define ASSERT_PRED3(pred, v1, v2, v3) \ GTEST_PRED3_(pred, v1, v2, v3, GTEST_FATAL_FAILURE_) // Helper function for implementing {EXPECT|ASSERT}_PRED4. Don't use // this in your code. template AssertionResult AssertPred4Helper(const char* pred_text, const char* e1, const char* e2, const char* e3, const char* e4, Pred pred, const T1& v1, const T2& v2, const T3& v3, const T4& v4) { if (pred(v1, v2, v3, v4)) return AssertionSuccess(); return AssertionFailure() << pred_text << "(" << e1 << ", " << e2 << ", " << e3 << ", " << e4 << ") evaluates to false, where" << "\n" << e1 << " evaluates to " << v1 << "\n" << e2 << " evaluates to " << v2 << "\n" << e3 << " evaluates to " << v3 << "\n" << e4 << " evaluates to " << v4; } // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT4. // Don't use this in your code. #define GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, on_failure)\ GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, v1, v2, v3, v4), \ on_failure) // Internal macro for implementing {EXPECT|ASSERT}_PRED4. Don't use // this in your code. #define GTEST_PRED4_(pred, v1, v2, v3, v4, on_failure)\ GTEST_ASSERT_(::testing::AssertPred4Helper(#pred, \ #v1, \ #v2, \ #v3, \ #v4, \ pred, \ v1, \ v2, \ v3, \ v4), on_failure) // 4-ary predicate assertion macros. #define EXPECT_PRED_FORMAT4(pred_format, v1, v2, v3, v4) \ GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, GTEST_NONFATAL_FAILURE_) #define EXPECT_PRED4(pred, v1, v2, v3, v4) \ GTEST_PRED4_(pred, v1, v2, v3, v4, GTEST_NONFATAL_FAILURE_) #define ASSERT_PRED_FORMAT4(pred_format, v1, v2, v3, v4) \ GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, GTEST_FATAL_FAILURE_) #define ASSERT_PRED4(pred, v1, v2, v3, v4) \ GTEST_PRED4_(pred, v1, v2, v3, v4, GTEST_FATAL_FAILURE_) // Helper function for implementing {EXPECT|ASSERT}_PRED5. Don't use // this in your code. template AssertionResult AssertPred5Helper(const char* pred_text, const char* e1, const char* e2, const char* e3, const char* e4, const char* e5, Pred pred, const T1& v1, const T2& v2, const T3& v3, const T4& v4, const T5& v5) { if (pred(v1, v2, v3, v4, v5)) return AssertionSuccess(); return AssertionFailure() << pred_text << "(" << e1 << ", " << e2 << ", " << e3 << ", " << e4 << ", " << e5 << ") evaluates to false, where" << "\n" << e1 << " evaluates to " << v1 << "\n" << e2 << " evaluates to " << v2 << "\n" << e3 << " evaluates to " << v3 << "\n" << e4 << " evaluates to " << v4 << "\n" << e5 << " evaluates to " << v5; } // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT5. // Don't use this in your code. #define GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, on_failure)\ GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, #v5, v1, v2, v3, v4, v5), \ on_failure) // Internal macro for implementing {EXPECT|ASSERT}_PRED5. Don't use // this in your code. #define GTEST_PRED5_(pred, v1, v2, v3, v4, v5, on_failure)\ GTEST_ASSERT_(::testing::AssertPred5Helper(#pred, \ #v1, \ #v2, \ #v3, \ #v4, \ #v5, \ pred, \ v1, \ v2, \ v3, \ v4, \ v5), on_failure) // 5-ary predicate assertion macros. #define EXPECT_PRED_FORMAT5(pred_format, v1, v2, v3, v4, v5) \ GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, GTEST_NONFATAL_FAILURE_) #define EXPECT_PRED5(pred, v1, v2, v3, v4, v5) \ GTEST_PRED5_(pred, v1, v2, v3, v4, v5, GTEST_NONFATAL_FAILURE_) #define ASSERT_PRED_FORMAT5(pred_format, v1, v2, v3, v4, v5) \ GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, GTEST_FATAL_FAILURE_) #define ASSERT_PRED5(pred, v1, v2, v3, v4, v5) \ GTEST_PRED5_(pred, v1, v2, v3, v4, v5, GTEST_FATAL_FAILURE_) } // namespace testing #endif // GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_ iptux-0.9.4/src/googletest/include/gtest/gtest_prod.h000066400000000000000000000047271475473122500227600ustar00rootroot00000000000000// Copyright 2006, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // Google C++ Testing and Mocking Framework definitions useful in production code. // GOOGLETEST_CM0003 DO NOT DELETE #ifndef GTEST_INCLUDE_GTEST_GTEST_PROD_H_ #define GTEST_INCLUDE_GTEST_GTEST_PROD_H_ // When you need to test the private or protected members of a class, // use the FRIEND_TEST macro to declare your tests as friends of the // class. For example: // // class MyClass { // private: // void PrivateMethod(); // FRIEND_TEST(MyClassTest, PrivateMethodWorks); // }; // // class MyClassTest : public testing::Test { // // ... // }; // // TEST_F(MyClassTest, PrivateMethodWorks) { // // Can call MyClass::PrivateMethod() here. // } // // Note: The test class must be in the same namespace as the class being tested. // For example, putting MyClassTest in an anonymous namespace will not work. #define FRIEND_TEST(test_case_name, test_name)\ friend class test_case_name##_##test_name##_Test #endif // GTEST_INCLUDE_GTEST_GTEST_PROD_H_ iptux-0.9.4/src/googletest/include/gtest/internal/000077500000000000000000000000001475473122500222375ustar00rootroot00000000000000iptux-0.9.4/src/googletest/include/gtest/internal/custom/000077500000000000000000000000001475473122500235515ustar00rootroot00000000000000iptux-0.9.4/src/googletest/include/gtest/internal/custom/README.md000066400000000000000000000032221475473122500250270ustar00rootroot00000000000000# Customization Points The custom directory is an injection point for custom user configurations. ## Header `gtest.h` ### The following macros can be defined: * `GTEST_OS_STACK_TRACE_GETTER_` - The name of an implementation of `OsStackTraceGetterInterface`. * `GTEST_CUSTOM_TEMPDIR_FUNCTION_` - An override for `testing::TempDir()`. See `testing::TempDir` for semantics and signature. ## Header `gtest-port.h` The following macros can be defined: ### Flag related macros: * `GTEST_FLAG(flag_name)` * `GTEST_USE_OWN_FLAGFILE_FLAG_` - Define to 0 when the system provides its own flagfile flag parsing. * `GTEST_DECLARE_bool_(name)` * `GTEST_DECLARE_int32_(name)` * `GTEST_DECLARE_string_(name)` * `GTEST_DEFINE_bool_(name, default_val, doc)` * `GTEST_DEFINE_int32_(name, default_val, doc)` * `GTEST_DEFINE_string_(name, default_val, doc)` ### Logging: * `GTEST_LOG_(severity)` * `GTEST_CHECK_(condition)` * Functions `LogToStderr()` and `FlushInfoLog()` have to be provided too. ### Threading: * `GTEST_HAS_NOTIFICATION_` - Enabled if Notification is already provided. * `GTEST_HAS_MUTEX_AND_THREAD_LOCAL_` - Enabled if `Mutex` and `ThreadLocal` are already provided. Must also provide `GTEST_DECLARE_STATIC_MUTEX_(mutex)` and `GTEST_DEFINE_STATIC_MUTEX_(mutex)` * `GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks)` * `GTEST_LOCK_EXCLUDED_(locks)` ### Underlying library support features * `GTEST_HAS_CXXABI_H_` ### Exporting API symbols: * `GTEST_API_` - Specifier for exported symbols. ## Header `gtest-printers.h` * See documentation at `gtest/gtest-printers.h` for details on how to define a custom printer. iptux-0.9.4/src/googletest/include/gtest/internal/custom/gtest-port.h000066400000000000000000000035021475473122500260320ustar00rootroot00000000000000// Copyright 2015, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // Injection point for custom user configurations. See README for details // // ** Custom implementation starts here ** #ifndef GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_ #endif // GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_ iptux-0.9.4/src/googletest/include/gtest/internal/custom/gtest-printers.h000066400000000000000000000040371475473122500267200ustar00rootroot00000000000000// Copyright 2015, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // This file provides an injection point for custom printers in a local // installation of gTest. // It will be included from gtest-printers.h and the overrides in this file // will be visible to everyone. // // Injection point for custom user configurations. See README for details // // ** Custom implementation starts here ** #ifndef GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_ #endif // GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_ iptux-0.9.4/src/googletest/include/gtest/internal/custom/gtest.h000066400000000000000000000034631475473122500250560ustar00rootroot00000000000000// Copyright 2015, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // Injection point for custom user configurations. See README for details // // ** Custom implementation starts here ** #ifndef GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_ #endif // GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_ iptux-0.9.4/src/googletest/include/gtest/internal/gtest-death-test-internal.h000066400000000000000000000261721475473122500274200ustar00rootroot00000000000000// Copyright 2005, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // The Google C++ Testing and Mocking Framework (Google Test) // // This header file defines internal utilities needed for implementing // death tests. They are subject to change without notice. // GOOGLETEST_CM0001 DO NOT DELETE #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_ #include "gtest/internal/gtest-internal.h" #include namespace testing { namespace internal { GTEST_DECLARE_string_(internal_run_death_test); // Names of the flags (needed for parsing Google Test flags). const char kDeathTestStyleFlag[] = "death_test_style"; const char kDeathTestUseFork[] = "death_test_use_fork"; const char kInternalRunDeathTestFlag[] = "internal_run_death_test"; #if GTEST_HAS_DEATH_TEST GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \ /* class A needs to have dll-interface to be used by clients of class B */) // DeathTest is a class that hides much of the complexity of the // GTEST_DEATH_TEST_ macro. It is abstract; its static Create method // returns a concrete class that depends on the prevailing death test // style, as defined by the --gtest_death_test_style and/or // --gtest_internal_run_death_test flags. // In describing the results of death tests, these terms are used with // the corresponding definitions: // // exit status: The integer exit information in the format specified // by wait(2) // exit code: The integer code passed to exit(3), _exit(2), or // returned from main() class GTEST_API_ DeathTest { public: // Create returns false if there was an error determining the // appropriate action to take for the current death test; for example, // if the gtest_death_test_style flag is set to an invalid value. // The LastMessage method will return a more detailed message in that // case. Otherwise, the DeathTest pointer pointed to by the "test" // argument is set. If the death test should be skipped, the pointer // is set to NULL; otherwise, it is set to the address of a new concrete // DeathTest object that controls the execution of the current test. static bool Create(const char* statement, const RE* regex, const char* file, int line, DeathTest** test); DeathTest(); virtual ~DeathTest() { } // A helper class that aborts a death test when it's deleted. class ReturnSentinel { public: explicit ReturnSentinel(DeathTest* test) : test_(test) { } ~ReturnSentinel() { test_->Abort(TEST_ENCOUNTERED_RETURN_STATEMENT); } private: DeathTest* const test_; GTEST_DISALLOW_COPY_AND_ASSIGN_(ReturnSentinel); } GTEST_ATTRIBUTE_UNUSED_; // An enumeration of possible roles that may be taken when a death // test is encountered. EXECUTE means that the death test logic should // be executed immediately. OVERSEE means that the program should prepare // the appropriate environment for a child process to execute the death // test, then wait for it to complete. enum TestRole { OVERSEE_TEST, EXECUTE_TEST }; // An enumeration of the three reasons that a test might be aborted. enum AbortReason { TEST_ENCOUNTERED_RETURN_STATEMENT, TEST_THREW_EXCEPTION, TEST_DID_NOT_DIE }; // Assumes one of the above roles. virtual TestRole AssumeRole() = 0; // Waits for the death test to finish and returns its status. virtual int Wait() = 0; // Returns true if the death test passed; that is, the test process // exited during the test, its exit status matches a user-supplied // predicate, and its stderr output matches a user-supplied regular // expression. // The user-supplied predicate may be a macro expression rather // than a function pointer or functor, or else Wait and Passed could // be combined. virtual bool Passed(bool exit_status_ok) = 0; // Signals that the death test did not die as expected. virtual void Abort(AbortReason reason) = 0; // Returns a human-readable outcome message regarding the outcome of // the last death test. static const char* LastMessage(); static void set_last_death_test_message(const std::string& message); private: // A string containing a description of the outcome of the last death test. static std::string last_death_test_message_; GTEST_DISALLOW_COPY_AND_ASSIGN_(DeathTest); }; GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251 // Factory interface for death tests. May be mocked out for testing. class DeathTestFactory { public: virtual ~DeathTestFactory() { } virtual bool Create(const char* statement, const RE* regex, const char* file, int line, DeathTest** test) = 0; }; // A concrete DeathTestFactory implementation for normal use. class DefaultDeathTestFactory : public DeathTestFactory { public: virtual bool Create(const char* statement, const RE* regex, const char* file, int line, DeathTest** test); }; // Returns true if exit_status describes a process that was terminated // by a signal, or exited normally with a nonzero exit code. GTEST_API_ bool ExitedUnsuccessfully(int exit_status); // Traps C++ exceptions escaping statement and reports them as test // failures. Note that trapping SEH exceptions is not implemented here. # if GTEST_HAS_EXCEPTIONS # define GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, death_test) \ try { \ GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \ } catch (const ::std::exception& gtest_exception) { \ fprintf(\ stderr, \ "\n%s: Caught std::exception-derived exception escaping the " \ "death test statement. Exception message: %s\n", \ ::testing::internal::FormatFileLocation(__FILE__, __LINE__).c_str(), \ gtest_exception.what()); \ fflush(stderr); \ death_test->Abort(::testing::internal::DeathTest::TEST_THREW_EXCEPTION); \ } catch (...) { \ death_test->Abort(::testing::internal::DeathTest::TEST_THREW_EXCEPTION); \ } # else # define GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, death_test) \ GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement) # endif // This macro is for implementing ASSERT_DEATH*, EXPECT_DEATH*, // ASSERT_EXIT*, and EXPECT_EXIT*. # define GTEST_DEATH_TEST_(statement, predicate, regex, fail) \ GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ if (::testing::internal::AlwaysTrue()) { \ const ::testing::internal::RE& gtest_regex = (regex); \ ::testing::internal::DeathTest* gtest_dt; \ if (!::testing::internal::DeathTest::Create(#statement, >est_regex, \ __FILE__, __LINE__, >est_dt)) { \ goto GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__); \ } \ if (gtest_dt != NULL) { \ ::testing::internal::scoped_ptr< ::testing::internal::DeathTest> \ gtest_dt_ptr(gtest_dt); \ switch (gtest_dt->AssumeRole()) { \ case ::testing::internal::DeathTest::OVERSEE_TEST: \ if (!gtest_dt->Passed(predicate(gtest_dt->Wait()))) { \ goto GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__); \ } \ break; \ case ::testing::internal::DeathTest::EXECUTE_TEST: { \ ::testing::internal::DeathTest::ReturnSentinel \ gtest_sentinel(gtest_dt); \ GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, gtest_dt); \ gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE); \ break; \ } \ default: \ break; \ } \ } \ } else \ GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__): \ fail(::testing::internal::DeathTest::LastMessage()) // The symbol "fail" here expands to something into which a message // can be streamed. // This macro is for implementing ASSERT/EXPECT_DEBUG_DEATH when compiled in // NDEBUG mode. In this case we need the statements to be executed and the macro // must accept a streamed message even though the message is never printed. // The regex object is not evaluated, but it is used to prevent "unused" // warnings and to avoid an expression that doesn't compile in debug mode. #define GTEST_EXECUTE_STATEMENT_(statement, regex) \ GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ if (::testing::internal::AlwaysTrue()) { \ GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \ } else if (!::testing::internal::AlwaysTrue()) { \ const ::testing::internal::RE& gtest_regex = (regex); \ static_cast(gtest_regex); \ } else \ ::testing::Message() // A class representing the parsed contents of the // --gtest_internal_run_death_test flag, as it existed when // RUN_ALL_TESTS was called. class InternalRunDeathTestFlag { public: InternalRunDeathTestFlag(const std::string& a_file, int a_line, int an_index, int a_write_fd) : file_(a_file), line_(a_line), index_(an_index), write_fd_(a_write_fd) {} ~InternalRunDeathTestFlag() { if (write_fd_ >= 0) posix::Close(write_fd_); } const std::string& file() const { return file_; } int line() const { return line_; } int index() const { return index_; } int write_fd() const { return write_fd_; } private: std::string file_; int line_; int index_; int write_fd_; GTEST_DISALLOW_COPY_AND_ASSIGN_(InternalRunDeathTestFlag); }; // Returns a newly created InternalRunDeathTestFlag object with fields // initialized from the GTEST_FLAG(internal_run_death_test) flag if // the flag is specified; otherwise returns NULL. InternalRunDeathTestFlag* ParseInternalRunDeathTestFlag(); #endif // GTEST_HAS_DEATH_TEST } // namespace internal } // namespace testing #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_ iptux-0.9.4/src/googletest/include/gtest/internal/gtest-filepath.h000066400000000000000000000230311475473122500253270ustar00rootroot00000000000000// Copyright 2008, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // Google Test filepath utilities // // This header file declares classes and functions used internally by // Google Test. They are subject to change without notice. // // This file is #included in gtest/internal/gtest-internal.h. // Do not include this header file separately! // GOOGLETEST_CM0001 DO NOT DELETE #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_ #include "gtest/internal/gtest-string.h" GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \ /* class A needs to have dll-interface to be used by clients of class B */) namespace testing { namespace internal { // FilePath - a class for file and directory pathname manipulation which // handles platform-specific conventions (like the pathname separator). // Used for helper functions for naming files in a directory for xml output. // Except for Set methods, all methods are const or static, which provides an // "immutable value object" -- useful for peace of mind. // A FilePath with a value ending in a path separator ("like/this/") represents // a directory, otherwise it is assumed to represent a file. In either case, // it may or may not represent an actual file or directory in the file system. // Names are NOT checked for syntax correctness -- no checking for illegal // characters, malformed paths, etc. class GTEST_API_ FilePath { public: FilePath() : pathname_("") { } FilePath(const FilePath& rhs) : pathname_(rhs.pathname_) { } explicit FilePath(const std::string& pathname) : pathname_(pathname) { Normalize(); } FilePath& operator=(const FilePath& rhs) { Set(rhs); return *this; } void Set(const FilePath& rhs) { pathname_ = rhs.pathname_; } const std::string& string() const { return pathname_; } const char* c_str() const { return pathname_.c_str(); } // Returns the current working directory, or "" if unsuccessful. static FilePath GetCurrentDir(); // Given directory = "dir", base_name = "test", number = 0, // extension = "xml", returns "dir/test.xml". If number is greater // than zero (e.g., 12), returns "dir/test_12.xml". // On Windows platform, uses \ as the separator rather than /. static FilePath MakeFileName(const FilePath& directory, const FilePath& base_name, int number, const char* extension); // Given directory = "dir", relative_path = "test.xml", // returns "dir/test.xml". // On Windows, uses \ as the separator rather than /. static FilePath ConcatPaths(const FilePath& directory, const FilePath& relative_path); // Returns a pathname for a file that does not currently exist. The pathname // will be directory/base_name.extension or // directory/base_name_.extension if directory/base_name.extension // already exists. The number will be incremented until a pathname is found // that does not already exist. // Examples: 'dir/foo_test.xml' or 'dir/foo_test_1.xml'. // There could be a race condition if two or more processes are calling this // function at the same time -- they could both pick the same filename. static FilePath GenerateUniqueFileName(const FilePath& directory, const FilePath& base_name, const char* extension); // Returns true iff the path is "". bool IsEmpty() const { return pathname_.empty(); } // If input name has a trailing separator character, removes it and returns // the name, otherwise return the name string unmodified. // On Windows platform, uses \ as the separator, other platforms use /. FilePath RemoveTrailingPathSeparator() const; // Returns a copy of the FilePath with the directory part removed. // Example: FilePath("path/to/file").RemoveDirectoryName() returns // FilePath("file"). If there is no directory part ("just_a_file"), it returns // the FilePath unmodified. If there is no file part ("just_a_dir/") it // returns an empty FilePath (""). // On Windows platform, '\' is the path separator, otherwise it is '/'. FilePath RemoveDirectoryName() const; // RemoveFileName returns the directory path with the filename removed. // Example: FilePath("path/to/file").RemoveFileName() returns "path/to/". // If the FilePath is "a_file" or "/a_file", RemoveFileName returns // FilePath("./") or, on Windows, FilePath(".\\"). If the filepath does // not have a file, like "just/a/dir/", it returns the FilePath unmodified. // On Windows platform, '\' is the path separator, otherwise it is '/'. FilePath RemoveFileName() const; // Returns a copy of the FilePath with the case-insensitive extension removed. // Example: FilePath("dir/file.exe").RemoveExtension("EXE") returns // FilePath("dir/file"). If a case-insensitive extension is not // found, returns a copy of the original FilePath. FilePath RemoveExtension(const char* extension) const; // Creates directories so that path exists. Returns true if successful or if // the directories already exist; returns false if unable to create // directories for any reason. Will also return false if the FilePath does // not represent a directory (that is, it doesn't end with a path separator). bool CreateDirectoriesRecursively() const; // Create the directory so that path exists. Returns true if successful or // if the directory already exists; returns false if unable to create the // directory for any reason, including if the parent directory does not // exist. Not named "CreateDirectory" because that's a macro on Windows. bool CreateFolder() const; // Returns true if FilePath describes something in the file-system, // either a file, directory, or whatever, and that something exists. bool FileOrDirectoryExists() const; // Returns true if pathname describes a directory in the file-system // that exists. bool DirectoryExists() const; // Returns true if FilePath ends with a path separator, which indicates that // it is intended to represent a directory. Returns false otherwise. // This does NOT check that a directory (or file) actually exists. bool IsDirectory() const; // Returns true if pathname describes a root directory. (Windows has one // root directory per disk drive.) bool IsRootDirectory() const; // Returns true if pathname describes an absolute path. bool IsAbsolutePath() const; private: // Replaces multiple consecutive separators with a single separator. // For example, "bar///foo" becomes "bar/foo". Does not eliminate other // redundancies that might be in a pathname involving "." or "..". // // A pathname with multiple consecutive separators may occur either through // user error or as a result of some scripts or APIs that generate a pathname // with a trailing separator. On other platforms the same API or script // may NOT generate a pathname with a trailing "/". Then elsewhere that // pathname may have another "/" and pathname components added to it, // without checking for the separator already being there. // The script language and operating system may allow paths like "foo//bar" // but some of the functions in FilePath will not handle that correctly. In // particular, RemoveTrailingPathSeparator() only removes one separator, and // it is called in CreateDirectoriesRecursively() assuming that it will change // a pathname from directory syntax (trailing separator) to filename syntax. // // On Windows this method also replaces the alternate path separator '/' with // the primary path separator '\\', so that for example "bar\\/\\foo" becomes // "bar\\foo". void Normalize(); // Returns a pointer to the last occurence of a valid path separator in // the FilePath. On Windows, for example, both '/' and '\' are valid path // separators. Returns NULL if no path separator was found. const char* FindLastPathSeparator() const; std::string pathname_; }; // class FilePath } // namespace internal } // namespace testing GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251 #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_ iptux-0.9.4/src/googletest/include/gtest/internal/gtest-internal.h000066400000000000000000001433761475473122500253660ustar00rootroot00000000000000// Copyright 2005, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // The Google C++ Testing and Mocking Framework (Google Test) // // This header file declares functions and macros used internally by // Google Test. They are subject to change without notice. // GOOGLETEST_CM0001 DO NOT DELETE #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_ #include "gtest/internal/gtest-port.h" #if GTEST_OS_LINUX # include # include # include # include #endif // GTEST_OS_LINUX #if GTEST_HAS_EXCEPTIONS # include #endif #include #include #include #include #include #include #include #include #include #include "gtest/gtest-message.h" #include "gtest/internal/gtest-filepath.h" #include "gtest/internal/gtest-string.h" #include "gtest/internal/gtest-type-util.h" // Due to C++ preprocessor weirdness, we need double indirection to // concatenate two tokens when one of them is __LINE__. Writing // // foo ## __LINE__ // // will result in the token foo__LINE__, instead of foo followed by // the current line number. For more details, see // http://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-39.6 #define GTEST_CONCAT_TOKEN_(foo, bar) GTEST_CONCAT_TOKEN_IMPL_(foo, bar) #define GTEST_CONCAT_TOKEN_IMPL_(foo, bar) foo ## bar // Stringifies its argument. #define GTEST_STRINGIFY_(name) #name class ProtocolMessage; namespace proto2 { class Message; } namespace testing { // Forward declarations. class AssertionResult; // Result of an assertion. class Message; // Represents a failure message. class Test; // Represents a test. class TestInfo; // Information about a test. class TestPartResult; // Result of a test part. class UnitTest; // A collection of test cases. template ::std::string PrintToString(const T& value); namespace internal { struct TraceInfo; // Information about a trace point. class TestInfoImpl; // Opaque implementation of TestInfo class UnitTestImpl; // Opaque implementation of UnitTest // The text used in failure messages to indicate the start of the // stack trace. GTEST_API_ extern const char kStackTraceMarker[]; // Two overloaded helpers for checking at compile time whether an // expression is a null pointer literal (i.e. NULL or any 0-valued // compile-time integral constant). Their return values have // different sizes, so we can use sizeof() to test which version is // picked by the compiler. These helpers have no implementations, as // we only need their signatures. // // Given IsNullLiteralHelper(x), the compiler will pick the first // version if x can be implicitly converted to Secret*, and pick the // second version otherwise. Since Secret is a secret and incomplete // type, the only expression a user can write that has type Secret* is // a null pointer literal. Therefore, we know that x is a null // pointer literal if and only if the first version is picked by the // compiler. char IsNullLiteralHelper(Secret* p); char (&IsNullLiteralHelper(...))[2]; // NOLINT // A compile-time bool constant that is true if and only if x is a // null pointer literal (i.e. NULL or any 0-valued compile-time // integral constant). #ifdef GTEST_ELLIPSIS_NEEDS_POD_ // We lose support for NULL detection where the compiler doesn't like // passing non-POD classes through ellipsis (...). # define GTEST_IS_NULL_LITERAL_(x) false #else # define GTEST_IS_NULL_LITERAL_(x) \ (sizeof(::testing::internal::IsNullLiteralHelper(x)) == 1) #endif // GTEST_ELLIPSIS_NEEDS_POD_ // Appends the user-supplied message to the Google-Test-generated message. GTEST_API_ std::string AppendUserMessage( const std::string& gtest_msg, const Message& user_msg); #if GTEST_HAS_EXCEPTIONS GTEST_DISABLE_MSC_WARNINGS_PUSH_(4275 \ /* an exported class was derived from a class that was not exported */) // This exception is thrown by (and only by) a failed Google Test // assertion when GTEST_FLAG(throw_on_failure) is true (if exceptions // are enabled). We derive it from std::runtime_error, which is for // errors presumably detectable only at run time. Since // std::runtime_error inherits from std::exception, many testing // frameworks know how to extract and print the message inside it. class GTEST_API_ GoogleTestFailureException : public ::std::runtime_error { public: explicit GoogleTestFailureException(const TestPartResult& failure); }; GTEST_DISABLE_MSC_WARNINGS_POP_() // 4275 #endif // GTEST_HAS_EXCEPTIONS namespace edit_distance { // Returns the optimal edits to go from 'left' to 'right'. // All edits cost the same, with replace having lower priority than // add/remove. // Simple implementation of the Wagner-Fischer algorithm. // See http://en.wikipedia.org/wiki/Wagner-Fischer_algorithm enum EditType { kMatch, kAdd, kRemove, kReplace }; GTEST_API_ std::vector CalculateOptimalEdits( const std::vector& left, const std::vector& right); // Same as above, but the input is represented as strings. GTEST_API_ std::vector CalculateOptimalEdits( const std::vector& left, const std::vector& right); // Create a diff of the input strings in Unified diff format. GTEST_API_ std::string CreateUnifiedDiff(const std::vector& left, const std::vector& right, size_t context = 2); } // namespace edit_distance // Calculate the diff between 'left' and 'right' and return it in unified diff // format. // If not null, stores in 'total_line_count' the total number of lines found // in left + right. GTEST_API_ std::string DiffStrings(const std::string& left, const std::string& right, size_t* total_line_count); // Constructs and returns the message for an equality assertion // (e.g. ASSERT_EQ, EXPECT_STREQ, etc) failure. // // The first four parameters are the expressions used in the assertion // and their values, as strings. For example, for ASSERT_EQ(foo, bar) // where foo is 5 and bar is 6, we have: // // expected_expression: "foo" // actual_expression: "bar" // expected_value: "5" // actual_value: "6" // // The ignoring_case parameter is true iff the assertion is a // *_STRCASEEQ*. When it's true, the string " (ignoring case)" will // be inserted into the message. GTEST_API_ AssertionResult EqFailure(const char* expected_expression, const char* actual_expression, const std::string& expected_value, const std::string& actual_value, bool ignoring_case); // Constructs a failure message for Boolean assertions such as EXPECT_TRUE. GTEST_API_ std::string GetBoolAssertionFailureMessage( const AssertionResult& assertion_result, const char* expression_text, const char* actual_predicate_value, const char* expected_predicate_value); // This template class represents an IEEE floating-point number // (either single-precision or double-precision, depending on the // template parameters). // // The purpose of this class is to do more sophisticated number // comparison. (Due to round-off error, etc, it's very unlikely that // two floating-points will be equal exactly. Hence a naive // comparison by the == operation often doesn't work.) // // Format of IEEE floating-point: // // The most-significant bit being the leftmost, an IEEE // floating-point looks like // // sign_bit exponent_bits fraction_bits // // Here, sign_bit is a single bit that designates the sign of the // number. // // For float, there are 8 exponent bits and 23 fraction bits. // // For double, there are 11 exponent bits and 52 fraction bits. // // More details can be found at // http://en.wikipedia.org/wiki/IEEE_floating-point_standard. // // Template parameter: // // RawType: the raw floating-point type (either float or double) template class FloatingPoint { public: // Defines the unsigned integer type that has the same size as the // floating point number. typedef typename TypeWithSize::UInt Bits; // Constants. // # of bits in a number. static const size_t kBitCount = 8*sizeof(RawType); // # of fraction bits in a number. static const size_t kFractionBitCount = std::numeric_limits::digits - 1; // # of exponent bits in a number. static const size_t kExponentBitCount = kBitCount - 1 - kFractionBitCount; // The mask for the sign bit. static const Bits kSignBitMask = static_cast(1) << (kBitCount - 1); // The mask for the fraction bits. static const Bits kFractionBitMask = ~static_cast(0) >> (kExponentBitCount + 1); // The mask for the exponent bits. static const Bits kExponentBitMask = ~(kSignBitMask | kFractionBitMask); // How many ULP's (Units in the Last Place) we want to tolerate when // comparing two numbers. The larger the value, the more error we // allow. A 0 value means that two numbers must be exactly the same // to be considered equal. // // The maximum error of a single floating-point operation is 0.5 // units in the last place. On Intel CPU's, all floating-point // calculations are done with 80-bit precision, while double has 64 // bits. Therefore, 4 should be enough for ordinary use. // // See the following article for more details on ULP: // http://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/ static const size_t kMaxUlps = 4; // Constructs a FloatingPoint from a raw floating-point number. // // On an Intel CPU, passing a non-normalized NAN (Not a Number) // around may change its bits, although the new value is guaranteed // to be also a NAN. Therefore, don't expect this constructor to // preserve the bits in x when x is a NAN. explicit FloatingPoint(const RawType& x) { u_.value_ = x; } // Static methods // Reinterprets a bit pattern as a floating-point number. // // This function is needed to test the AlmostEquals() method. static RawType ReinterpretBits(const Bits bits) { FloatingPoint fp(0); fp.u_.bits_ = bits; return fp.u_.value_; } // Returns the floating-point number that represent positive infinity. static RawType Infinity() { return ReinterpretBits(kExponentBitMask); } // Returns the maximum representable finite floating-point number. static RawType Max(); // Non-static methods // Returns the bits that represents this number. const Bits &bits() const { return u_.bits_; } // Returns the exponent bits of this number. Bits exponent_bits() const { return kExponentBitMask & u_.bits_; } // Returns the fraction bits of this number. Bits fraction_bits() const { return kFractionBitMask & u_.bits_; } // Returns the sign bit of this number. Bits sign_bit() const { return kSignBitMask & u_.bits_; } // Returns true iff this is NAN (not a number). bool is_nan() const { // It's a NAN if the exponent bits are all ones and the fraction // bits are not entirely zeros. return (exponent_bits() == kExponentBitMask) && (fraction_bits() != 0); } // Returns true iff this number is at most kMaxUlps ULP's away from // rhs. In particular, this function: // // - returns false if either number is (or both are) NAN. // - treats really large numbers as almost equal to infinity. // - thinks +0.0 and -0.0 are 0 DLP's apart. bool AlmostEquals(const FloatingPoint& rhs) const { // The IEEE standard says that any comparison operation involving // a NAN must return false. if (is_nan() || rhs.is_nan()) return false; return DistanceBetweenSignAndMagnitudeNumbers(u_.bits_, rhs.u_.bits_) <= kMaxUlps; } private: // The data type used to store the actual floating-point number. union FloatingPointUnion { RawType value_; // The raw floating-point number. Bits bits_; // The bits that represent the number. }; // Converts an integer from the sign-and-magnitude representation to // the biased representation. More precisely, let N be 2 to the // power of (kBitCount - 1), an integer x is represented by the // unsigned number x + N. // // For instance, // // -N + 1 (the most negative number representable using // sign-and-magnitude) is represented by 1; // 0 is represented by N; and // N - 1 (the biggest number representable using // sign-and-magnitude) is represented by 2N - 1. // // Read http://en.wikipedia.org/wiki/Signed_number_representations // for more details on signed number representations. static Bits SignAndMagnitudeToBiased(const Bits &sam) { if (kSignBitMask & sam) { // sam represents a negative number. return ~sam + 1; } else { // sam represents a positive number. return kSignBitMask | sam; } } // Given two numbers in the sign-and-magnitude representation, // returns the distance between them as an unsigned number. static Bits DistanceBetweenSignAndMagnitudeNumbers(const Bits &sam1, const Bits &sam2) { const Bits biased1 = SignAndMagnitudeToBiased(sam1); const Bits biased2 = SignAndMagnitudeToBiased(sam2); return (biased1 >= biased2) ? (biased1 - biased2) : (biased2 - biased1); } FloatingPointUnion u_; }; // We cannot use std::numeric_limits::max() as it clashes with the max() // macro defined by . template <> inline float FloatingPoint::Max() { return FLT_MAX; } template <> inline double FloatingPoint::Max() { return DBL_MAX; } // Typedefs the instances of the FloatingPoint template class that we // care to use. typedef FloatingPoint Float; typedef FloatingPoint Double; // In order to catch the mistake of putting tests that use different // test fixture classes in the same test case, we need to assign // unique IDs to fixture classes and compare them. The TypeId type is // used to hold such IDs. The user should treat TypeId as an opaque // type: the only operation allowed on TypeId values is to compare // them for equality using the == operator. typedef const void* TypeId; template class TypeIdHelper { public: // dummy_ must not have a const type. Otherwise an overly eager // compiler (e.g. MSVC 7.1 & 8.0) may try to merge // TypeIdHelper::dummy_ for different Ts as an "optimization". static bool dummy_; }; template bool TypeIdHelper::dummy_ = false; // GetTypeId() returns the ID of type T. Different values will be // returned for different types. Calling the function twice with the // same type argument is guaranteed to return the same ID. template TypeId GetTypeId() { // The compiler is required to allocate a different // TypeIdHelper::dummy_ variable for each T used to instantiate // the template. Therefore, the address of dummy_ is guaranteed to // be unique. return &(TypeIdHelper::dummy_); } // Returns the type ID of ::testing::Test. Always call this instead // of GetTypeId< ::testing::Test>() to get the type ID of // ::testing::Test, as the latter may give the wrong result due to a // suspected linker bug when compiling Google Test as a Mac OS X // framework. GTEST_API_ TypeId GetTestTypeId(); // Defines the abstract factory interface that creates instances // of a Test object. class TestFactoryBase { public: virtual ~TestFactoryBase() {} // Creates a test instance to run. The instance is both created and destroyed // within TestInfoImpl::Run() virtual Test* CreateTest() = 0; protected: TestFactoryBase() {} private: GTEST_DISALLOW_COPY_AND_ASSIGN_(TestFactoryBase); }; // This class provides implementation of TeastFactoryBase interface. // It is used in TEST and TEST_F macros. template class TestFactoryImpl : public TestFactoryBase { public: virtual Test* CreateTest() { return new TestClass; } }; #if GTEST_OS_WINDOWS // Predicate-formatters for implementing the HRESULT checking macros // {ASSERT|EXPECT}_HRESULT_{SUCCEEDED|FAILED} // We pass a long instead of HRESULT to avoid causing an // include dependency for the HRESULT type. GTEST_API_ AssertionResult IsHRESULTSuccess(const char* expr, long hr); // NOLINT GTEST_API_ AssertionResult IsHRESULTFailure(const char* expr, long hr); // NOLINT #endif // GTEST_OS_WINDOWS // Types of SetUpTestCase() and TearDownTestCase() functions. typedef void (*SetUpTestCaseFunc)(); typedef void (*TearDownTestCaseFunc)(); struct CodeLocation { CodeLocation(const std::string& a_file, int a_line) : file(a_file), line(a_line) {} std::string file; int line; }; // Creates a new TestInfo object and registers it with Google Test; // returns the created object. // // Arguments: // // test_case_name: name of the test case // name: name of the test // type_param the name of the test's type parameter, or NULL if // this is not a typed or a type-parameterized test. // value_param text representation of the test's value parameter, // or NULL if this is not a type-parameterized test. // code_location: code location where the test is defined // fixture_class_id: ID of the test fixture class // set_up_tc: pointer to the function that sets up the test case // tear_down_tc: pointer to the function that tears down the test case // factory: pointer to the factory that creates a test object. // The newly created TestInfo instance will assume // ownership of the factory object. GTEST_API_ TestInfo* MakeAndRegisterTestInfo( const char* test_case_name, const char* name, const char* type_param, const char* value_param, CodeLocation code_location, TypeId fixture_class_id, SetUpTestCaseFunc set_up_tc, TearDownTestCaseFunc tear_down_tc, TestFactoryBase* factory); // If *pstr starts with the given prefix, modifies *pstr to be right // past the prefix and returns true; otherwise leaves *pstr unchanged // and returns false. None of pstr, *pstr, and prefix can be NULL. GTEST_API_ bool SkipPrefix(const char* prefix, const char** pstr); #if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \ /* class A needs to have dll-interface to be used by clients of class B */) // State of the definition of a type-parameterized test case. class GTEST_API_ TypedTestCasePState { public: TypedTestCasePState() : registered_(false) {} // Adds the given test name to defined_test_names_ and return true // if the test case hasn't been registered; otherwise aborts the // program. bool AddTestName(const char* file, int line, const char* case_name, const char* test_name) { if (registered_) { fprintf(stderr, "%s Test %s must be defined before " "REGISTER_TYPED_TEST_CASE_P(%s, ...).\n", FormatFileLocation(file, line).c_str(), test_name, case_name); fflush(stderr); posix::Abort(); } registered_tests_.insert( ::std::make_pair(test_name, CodeLocation(file, line))); return true; } bool TestExists(const std::string& test_name) const { return registered_tests_.count(test_name) > 0; } const CodeLocation& GetCodeLocation(const std::string& test_name) const { RegisteredTestsMap::const_iterator it = registered_tests_.find(test_name); GTEST_CHECK_(it != registered_tests_.end()); return it->second; } // Verifies that registered_tests match the test names in // defined_test_names_; returns registered_tests if successful, or // aborts the program otherwise. const char* VerifyRegisteredTestNames( const char* file, int line, const char* registered_tests); private: typedef ::std::map RegisteredTestsMap; bool registered_; RegisteredTestsMap registered_tests_; }; GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251 // Skips to the first non-space char after the first comma in 'str'; // returns NULL if no comma is found in 'str'. inline const char* SkipComma(const char* str) { const char* comma = strchr(str, ','); if (comma == NULL) { return NULL; } while (IsSpace(*(++comma))) {} return comma; } // Returns the prefix of 'str' before the first comma in it; returns // the entire string if it contains no comma. inline std::string GetPrefixUntilComma(const char* str) { const char* comma = strchr(str, ','); return comma == NULL ? str : std::string(str, comma); } // Splits a given string on a given delimiter, populating a given // vector with the fields. void SplitString(const ::std::string& str, char delimiter, ::std::vector< ::std::string>* dest); // The default argument to the template below for the case when the user does // not provide a name generator. struct DefaultNameGenerator { template static std::string GetName(int i) { return StreamableToString(i); } }; template struct NameGeneratorSelector { typedef Provided type; }; template void GenerateNamesRecursively(Types0, std::vector*, int) {} template void GenerateNamesRecursively(Types, std::vector* result, int i) { result->push_back(NameGenerator::template GetName(i)); GenerateNamesRecursively(typename Types::Tail(), result, i + 1); } template std::vector GenerateNames() { std::vector result; GenerateNamesRecursively(Types(), &result, 0); return result; } // TypeParameterizedTest::Register() // registers a list of type-parameterized tests with Google Test. The // return value is insignificant - we just need to return something // such that we can call this function in a namespace scope. // // Implementation note: The GTEST_TEMPLATE_ macro declares a template // template parameter. It's defined in gtest-type-util.h. template class TypeParameterizedTest { public: // 'index' is the index of the test in the type list 'Types' // specified in INSTANTIATE_TYPED_TEST_CASE_P(Prefix, TestCase, // Types). Valid values for 'index' are [0, N - 1] where N is the // length of Types. static bool Register(const char* prefix, const CodeLocation& code_location, const char* case_name, const char* test_names, int index, const std::vector& type_names = GenerateNames()) { typedef typename Types::Head Type; typedef Fixture FixtureClass; typedef typename GTEST_BIND_(TestSel, Type) TestClass; // First, registers the first type-parameterized test in the type // list. MakeAndRegisterTestInfo( (std::string(prefix) + (prefix[0] == '\0' ? "" : "/") + case_name + "/" + type_names[index]) .c_str(), StripTrailingSpaces(GetPrefixUntilComma(test_names)).c_str(), GetTypeName().c_str(), NULL, // No value parameter. code_location, GetTypeId(), TestClass::SetUpTestCase, TestClass::TearDownTestCase, new TestFactoryImpl); // Next, recurses (at compile time) with the tail of the type list. return TypeParameterizedTest::Register(prefix, code_location, case_name, test_names, index + 1, type_names); } }; // The base case for the compile time recursion. template class TypeParameterizedTest { public: static bool Register(const char* /*prefix*/, const CodeLocation&, const char* /*case_name*/, const char* /*test_names*/, int /*index*/, const std::vector& = std::vector() /*type_names*/) { return true; } }; // TypeParameterizedTestCase::Register() // registers *all combinations* of 'Tests' and 'Types' with Google // Test. The return value is insignificant - we just need to return // something such that we can call this function in a namespace scope. template class TypeParameterizedTestCase { public: static bool Register(const char* prefix, CodeLocation code_location, const TypedTestCasePState* state, const char* case_name, const char* test_names, const std::vector& type_names = GenerateNames()) { std::string test_name = StripTrailingSpaces( GetPrefixUntilComma(test_names)); if (!state->TestExists(test_name)) { fprintf(stderr, "Failed to get code location for test %s.%s at %s.", case_name, test_name.c_str(), FormatFileLocation(code_location.file.c_str(), code_location.line).c_str()); fflush(stderr); posix::Abort(); } const CodeLocation& test_location = state->GetCodeLocation(test_name); typedef typename Tests::Head Head; // First, register the first test in 'Test' for each type in 'Types'. TypeParameterizedTest::Register( prefix, test_location, case_name, test_names, 0, type_names); // Next, recurses (at compile time) with the tail of the test list. return TypeParameterizedTestCase::Register(prefix, code_location, state, case_name, SkipComma(test_names), type_names); } }; // The base case for the compile time recursion. template class TypeParameterizedTestCase { public: static bool Register(const char* /*prefix*/, const CodeLocation&, const TypedTestCasePState* /*state*/, const char* /*case_name*/, const char* /*test_names*/, const std::vector& = std::vector() /*type_names*/) { return true; } }; #endif // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P // Returns the current OS stack trace as an std::string. // // The maximum number of stack frames to be included is specified by // the gtest_stack_trace_depth flag. The skip_count parameter // specifies the number of top frames to be skipped, which doesn't // count against the number of frames to be included. // // For example, if Foo() calls Bar(), which in turn calls // GetCurrentOsStackTraceExceptTop(..., 1), Foo() will be included in // the trace but Bar() and GetCurrentOsStackTraceExceptTop() won't. GTEST_API_ std::string GetCurrentOsStackTraceExceptTop( UnitTest* unit_test, int skip_count); // Helpers for suppressing warnings on unreachable code or constant // condition. // Always returns true. GTEST_API_ bool AlwaysTrue(); // Always returns false. inline bool AlwaysFalse() { return !AlwaysTrue(); } // Helper for suppressing false warning from Clang on a const char* // variable declared in a conditional expression always being NULL in // the else branch. struct GTEST_API_ ConstCharPtr { ConstCharPtr(const char* str) : value(str) {} operator bool() const { return true; } const char* value; }; // A simple Linear Congruential Generator for generating random // numbers with a uniform distribution. Unlike rand() and srand(), it // doesn't use global state (and therefore can't interfere with user // code). Unlike rand_r(), it's portable. An LCG isn't very random, // but it's good enough for our purposes. class GTEST_API_ Random { public: static const UInt32 kMaxRange = 1u << 31; explicit Random(UInt32 seed) : state_(seed) {} void Reseed(UInt32 seed) { state_ = seed; } // Generates a random number from [0, range). Crashes if 'range' is // 0 or greater than kMaxRange. UInt32 Generate(UInt32 range); private: UInt32 state_; GTEST_DISALLOW_COPY_AND_ASSIGN_(Random); }; // Defining a variable of type CompileAssertTypesEqual will cause a // compiler error iff T1 and T2 are different types. template struct CompileAssertTypesEqual; template struct CompileAssertTypesEqual { }; // Removes the reference from a type if it is a reference type, // otherwise leaves it unchanged. This is the same as // tr1::remove_reference, which is not widely available yet. template struct RemoveReference { typedef T type; }; // NOLINT template struct RemoveReference { typedef T type; }; // NOLINT // A handy wrapper around RemoveReference that works when the argument // T depends on template parameters. #define GTEST_REMOVE_REFERENCE_(T) \ typename ::testing::internal::RemoveReference::type // Removes const from a type if it is a const type, otherwise leaves // it unchanged. This is the same as tr1::remove_const, which is not // widely available yet. template struct RemoveConst { typedef T type; }; // NOLINT template struct RemoveConst { typedef T type; }; // NOLINT // MSVC 8.0, Sun C++, and IBM XL C++ have a bug which causes the above // definition to fail to remove the const in 'const int[3]' and 'const // char[3][4]'. The following specialization works around the bug. template struct RemoveConst { typedef typename RemoveConst::type type[N]; }; #if defined(_MSC_VER) && _MSC_VER < 1400 // This is the only specialization that allows VC++ 7.1 to remove const in // 'const int[3] and 'const int[3][4]'. However, it causes trouble with GCC // and thus needs to be conditionally compiled. template struct RemoveConst { typedef typename RemoveConst::type type[N]; }; #endif // A handy wrapper around RemoveConst that works when the argument // T depends on template parameters. #define GTEST_REMOVE_CONST_(T) \ typename ::testing::internal::RemoveConst::type // Turns const U&, U&, const U, and U all into U. #define GTEST_REMOVE_REFERENCE_AND_CONST_(T) \ GTEST_REMOVE_CONST_(GTEST_REMOVE_REFERENCE_(T)) // ImplicitlyConvertible::value is a compile-time bool // constant that's true iff type From can be implicitly converted to // type To. template class ImplicitlyConvertible { private: // We need the following helper functions only for their types. // They have no implementations. // MakeFrom() is an expression whose type is From. We cannot simply // use From(), as the type From may not have a public default // constructor. static typename AddReference::type MakeFrom(); // These two functions are overloaded. Given an expression // Helper(x), the compiler will pick the first version if x can be // implicitly converted to type To; otherwise it will pick the // second version. // // The first version returns a value of size 1, and the second // version returns a value of size 2. Therefore, by checking the // size of Helper(x), which can be done at compile time, we can tell // which version of Helper() is used, and hence whether x can be // implicitly converted to type To. static char Helper(To); static char (&Helper(...))[2]; // NOLINT // We have to put the 'public' section after the 'private' section, // or MSVC refuses to compile the code. public: #if defined(__BORLANDC__) // C++Builder cannot use member overload resolution during template // instantiation. The simplest workaround is to use its C++0x type traits // functions (C++Builder 2009 and above only). static const bool value = __is_convertible(From, To); #else // MSVC warns about implicitly converting from double to int for // possible loss of data, so we need to temporarily disable the // warning. GTEST_DISABLE_MSC_WARNINGS_PUSH_(4244) static const bool value = sizeof(Helper(ImplicitlyConvertible::MakeFrom())) == 1; GTEST_DISABLE_MSC_WARNINGS_POP_() #endif // __BORLANDC__ }; template const bool ImplicitlyConvertible::value; // IsAProtocolMessage::value is a compile-time bool constant that's // true iff T is type ProtocolMessage, proto2::Message, or a subclass // of those. template struct IsAProtocolMessage : public bool_constant< ImplicitlyConvertible::value || ImplicitlyConvertible::value> { }; // When the compiler sees expression IsContainerTest(0), if C is an // STL-style container class, the first overload of IsContainerTest // will be viable (since both C::iterator* and C::const_iterator* are // valid types and NULL can be implicitly converted to them). It will // be picked over the second overload as 'int' is a perfect match for // the type of argument 0. If C::iterator or C::const_iterator is not // a valid type, the first overload is not viable, and the second // overload will be picked. Therefore, we can determine whether C is // a container class by checking the type of IsContainerTest(0). // The value of the expression is insignificant. // // In C++11 mode we check the existence of a const_iterator and that an // iterator is properly implemented for the container. // // For pre-C++11 that we look for both C::iterator and C::const_iterator. // The reason is that C++ injects the name of a class as a member of the // class itself (e.g. you can refer to class iterator as either // 'iterator' or 'iterator::iterator'). If we look for C::iterator // only, for example, we would mistakenly think that a class named // iterator is an STL container. // // Also note that the simpler approach of overloading // IsContainerTest(typename C::const_iterator*) and // IsContainerTest(...) doesn't work with Visual Age C++ and Sun C++. typedef int IsContainer; #if GTEST_LANG_CXX11 template ().begin()), class = decltype(::std::declval().end()), class = decltype(++::std::declval()), class = decltype(*::std::declval()), class = typename C::const_iterator> IsContainer IsContainerTest(int /* dummy */) { return 0; } #else template IsContainer IsContainerTest(int /* dummy */, typename C::iterator* /* it */ = NULL, typename C::const_iterator* /* const_it */ = NULL) { return 0; } #endif // GTEST_LANG_CXX11 typedef char IsNotContainer; template IsNotContainer IsContainerTest(long /* dummy */) { return '\0'; } // Trait to detect whether a type T is a hash table. // The heuristic used is that the type contains an inner type `hasher` and does // not contain an inner type `reverse_iterator`. // If the container is iterable in reverse, then order might actually matter. template struct IsHashTable { private: template static char test(typename U::hasher*, typename U::reverse_iterator*); template static int test(typename U::hasher*, ...); template static char test(...); public: static const bool value = sizeof(test(0, 0)) == sizeof(int); }; template const bool IsHashTable::value; template struct VoidT { typedef void value_type; }; template struct HasValueType : false_type {}; template struct HasValueType > : true_type { }; template (0)) == sizeof(IsContainer), bool = HasValueType::value> struct IsRecursiveContainerImpl; template struct IsRecursiveContainerImpl : public false_type {}; // Since the IsRecursiveContainerImpl depends on the IsContainerTest we need to // obey the same inconsistencies as the IsContainerTest, namely check if // something is a container is relying on only const_iterator in C++11 and // is relying on both const_iterator and iterator otherwise template struct IsRecursiveContainerImpl : public false_type {}; template struct IsRecursiveContainerImpl { #if GTEST_LANG_CXX11 typedef typename IteratorTraits::value_type value_type; #else typedef typename IteratorTraits::value_type value_type; #endif typedef is_same type; }; // IsRecursiveContainer is a unary compile-time predicate that // evaluates whether C is a recursive container type. A recursive container // type is a container type whose value_type is equal to the container type // itself. An example for a recursive container type is // boost::filesystem::path, whose iterator has a value_type that is equal to // boost::filesystem::path. template struct IsRecursiveContainer : public IsRecursiveContainerImpl::type {}; // EnableIf::type is void when 'Cond' is true, and // undefined when 'Cond' is false. To use SFINAE to make a function // overload only apply when a particular expression is true, add // "typename EnableIf::type* = 0" as the last parameter. template struct EnableIf; template<> struct EnableIf { typedef void type; }; // NOLINT // Utilities for native arrays. // ArrayEq() compares two k-dimensional native arrays using the // elements' operator==, where k can be any integer >= 0. When k is // 0, ArrayEq() degenerates into comparing a single pair of values. template bool ArrayEq(const T* lhs, size_t size, const U* rhs); // This generic version is used when k is 0. template inline bool ArrayEq(const T& lhs, const U& rhs) { return lhs == rhs; } // This overload is used when k >= 1. template inline bool ArrayEq(const T(&lhs)[N], const U(&rhs)[N]) { return internal::ArrayEq(lhs, N, rhs); } // This helper reduces code bloat. If we instead put its logic inside // the previous ArrayEq() function, arrays with different sizes would // lead to different copies of the template code. template bool ArrayEq(const T* lhs, size_t size, const U* rhs) { for (size_t i = 0; i != size; i++) { if (!internal::ArrayEq(lhs[i], rhs[i])) return false; } return true; } // Finds the first element in the iterator range [begin, end) that // equals elem. Element may be a native array type itself. template Iter ArrayAwareFind(Iter begin, Iter end, const Element& elem) { for (Iter it = begin; it != end; ++it) { if (internal::ArrayEq(*it, elem)) return it; } return end; } // CopyArray() copies a k-dimensional native array using the elements' // operator=, where k can be any integer >= 0. When k is 0, // CopyArray() degenerates into copying a single value. template void CopyArray(const T* from, size_t size, U* to); // This generic version is used when k is 0. template inline void CopyArray(const T& from, U* to) { *to = from; } // This overload is used when k >= 1. template inline void CopyArray(const T(&from)[N], U(*to)[N]) { internal::CopyArray(from, N, *to); } // This helper reduces code bloat. If we instead put its logic inside // the previous CopyArray() function, arrays with different sizes // would lead to different copies of the template code. template void CopyArray(const T* from, size_t size, U* to) { for (size_t i = 0; i != size; i++) { internal::CopyArray(from[i], to + i); } } // The relation between an NativeArray object (see below) and the // native array it represents. // We use 2 different structs to allow non-copyable types to be used, as long // as RelationToSourceReference() is passed. struct RelationToSourceReference {}; struct RelationToSourceCopy {}; // Adapts a native array to a read-only STL-style container. Instead // of the complete STL container concept, this adaptor only implements // members useful for Google Mock's container matchers. New members // should be added as needed. To simplify the implementation, we only // support Element being a raw type (i.e. having no top-level const or // reference modifier). It's the client's responsibility to satisfy // this requirement. Element can be an array type itself (hence // multi-dimensional arrays are supported). template class NativeArray { public: // STL-style container typedefs. typedef Element value_type; typedef Element* iterator; typedef const Element* const_iterator; // Constructs from a native array. References the source. NativeArray(const Element* array, size_t count, RelationToSourceReference) { InitRef(array, count); } // Constructs from a native array. Copies the source. NativeArray(const Element* array, size_t count, RelationToSourceCopy) { InitCopy(array, count); } // Copy constructor. NativeArray(const NativeArray& rhs) { (this->*rhs.clone_)(rhs.array_, rhs.size_); } ~NativeArray() { if (clone_ != &NativeArray::InitRef) delete[] array_; } // STL-style container methods. size_t size() const { return size_; } const_iterator begin() const { return array_; } const_iterator end() const { return array_ + size_; } bool operator==(const NativeArray& rhs) const { return size() == rhs.size() && ArrayEq(begin(), size(), rhs.begin()); } private: enum { kCheckTypeIsNotConstOrAReference = StaticAssertTypeEqHelper< Element, GTEST_REMOVE_REFERENCE_AND_CONST_(Element)>::value }; // Initializes this object with a copy of the input. void InitCopy(const Element* array, size_t a_size) { Element* const copy = new Element[a_size]; CopyArray(array, a_size, copy); array_ = copy; size_ = a_size; clone_ = &NativeArray::InitCopy; } // Initializes this object with a reference of the input. void InitRef(const Element* array, size_t a_size) { array_ = array; size_ = a_size; clone_ = &NativeArray::InitRef; } const Element* array_; size_t size_; void (NativeArray::*clone_)(const Element*, size_t); GTEST_DISALLOW_ASSIGN_(NativeArray); }; } // namespace internal } // namespace testing #define GTEST_MESSAGE_AT_(file, line, message, result_type) \ ::testing::internal::AssertHelper(result_type, file, line, message) \ = ::testing::Message() #define GTEST_MESSAGE_(message, result_type) \ GTEST_MESSAGE_AT_(__FILE__, __LINE__, message, result_type) #define GTEST_FATAL_FAILURE_(message) \ return GTEST_MESSAGE_(message, ::testing::TestPartResult::kFatalFailure) #define GTEST_NONFATAL_FAILURE_(message) \ GTEST_MESSAGE_(message, ::testing::TestPartResult::kNonFatalFailure) #define GTEST_SUCCESS_(message) \ GTEST_MESSAGE_(message, ::testing::TestPartResult::kSuccess) // Suppress MSVC warning 4702 (unreachable code) for the code following // statement if it returns or throws (or doesn't return or throw in some // situations). #define GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement) \ if (::testing::internal::AlwaysTrue()) { statement; } #define GTEST_TEST_THROW_(statement, expected_exception, fail) \ GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ if (::testing::internal::ConstCharPtr gtest_msg = "") { \ bool gtest_caught_expected = false; \ try { \ GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \ } \ catch (expected_exception const&) { \ gtest_caught_expected = true; \ } \ catch (...) { \ gtest_msg.value = \ "Expected: " #statement " throws an exception of type " \ #expected_exception ".\n Actual: it throws a different type."; \ goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \ } \ if (!gtest_caught_expected) { \ gtest_msg.value = \ "Expected: " #statement " throws an exception of type " \ #expected_exception ".\n Actual: it throws nothing."; \ goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \ } \ } else \ GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__): \ fail(gtest_msg.value) #define GTEST_TEST_NO_THROW_(statement, fail) \ GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ if (::testing::internal::AlwaysTrue()) { \ try { \ GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \ } \ catch (...) { \ goto GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__); \ } \ } else \ GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__): \ fail("Expected: " #statement " doesn't throw an exception.\n" \ " Actual: it throws.") #define GTEST_TEST_ANY_THROW_(statement, fail) \ GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ if (::testing::internal::AlwaysTrue()) { \ bool gtest_caught_any = false; \ try { \ GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \ } \ catch (...) { \ gtest_caught_any = true; \ } \ if (!gtest_caught_any) { \ goto GTEST_CONCAT_TOKEN_(gtest_label_testanythrow_, __LINE__); \ } \ } else \ GTEST_CONCAT_TOKEN_(gtest_label_testanythrow_, __LINE__): \ fail("Expected: " #statement " throws an exception.\n" \ " Actual: it doesn't.") // Implements Boolean test assertions such as EXPECT_TRUE. expression can be // either a boolean expression or an AssertionResult. text is a textual // represenation of expression as it was passed into the EXPECT_TRUE. #define GTEST_TEST_BOOLEAN_(expression, text, actual, expected, fail) \ GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ if (const ::testing::AssertionResult gtest_ar_ = \ ::testing::AssertionResult(expression)) \ ; \ else \ fail(::testing::internal::GetBoolAssertionFailureMessage(\ gtest_ar_, text, #actual, #expected).c_str()) #define GTEST_TEST_NO_FATAL_FAILURE_(statement, fail) \ GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ if (::testing::internal::AlwaysTrue()) { \ ::testing::internal::HasNewFatalFailureHelper gtest_fatal_failure_checker; \ GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \ if (gtest_fatal_failure_checker.has_new_fatal_failure()) { \ goto GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__); \ } \ } else \ GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__): \ fail("Expected: " #statement " doesn't generate new fatal " \ "failures in the current thread.\n" \ " Actual: it does.") // Expands to the name of the class that implements the given test. #define GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \ test_case_name##_##test_name##_Test // Helper macro for defining tests. #define GTEST_TEST_(test_case_name, test_name, parent_class, parent_id)\ class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) : public parent_class {\ public:\ GTEST_TEST_CLASS_NAME_(test_case_name, test_name)() {}\ private:\ virtual void TestBody();\ static ::testing::TestInfo* const test_info_ GTEST_ATTRIBUTE_UNUSED_;\ GTEST_DISALLOW_COPY_AND_ASSIGN_(\ GTEST_TEST_CLASS_NAME_(test_case_name, test_name));\ };\ \ ::testing::TestInfo* const GTEST_TEST_CLASS_NAME_(test_case_name, test_name)\ ::test_info_ =\ ::testing::internal::MakeAndRegisterTestInfo(\ #test_case_name, #test_name, NULL, NULL, \ ::testing::internal::CodeLocation(__FILE__, __LINE__), \ (parent_id), \ parent_class::SetUpTestCase, \ parent_class::TearDownTestCase, \ new ::testing::internal::TestFactoryImpl<\ GTEST_TEST_CLASS_NAME_(test_case_name, test_name)>);\ void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody() #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_ iptux-0.9.4/src/googletest/include/gtest/internal/gtest-linked_ptr.h000066400000000000000000000203211475473122500256650ustar00rootroot00000000000000// Copyright 2003 Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // A "smart" pointer type with reference tracking. Every pointer to a // particular object is kept on a circular linked list. When the last pointer // to an object is destroyed or reassigned, the object is deleted. // // Used properly, this deletes the object when the last reference goes away. // There are several caveats: // - Like all reference counting schemes, cycles lead to leaks. // - Each smart pointer is actually two pointers (8 bytes instead of 4). // - Every time a pointer is assigned, the entire list of pointers to that // object is traversed. This class is therefore NOT SUITABLE when there // will often be more than two or three pointers to a particular object. // - References are only tracked as long as linked_ptr<> objects are copied. // If a linked_ptr<> is converted to a raw pointer and back, BAD THINGS // will happen (double deletion). // // A good use of this class is storing object references in STL containers. // You can safely put linked_ptr<> in a vector<>. // Other uses may not be as good. // // Note: If you use an incomplete type with linked_ptr<>, the class // *containing* linked_ptr<> must have a constructor and destructor (even // if they do nothing!). // // Bill Gibbons suggested we use something like this. // // Thread Safety: // Unlike other linked_ptr implementations, in this implementation // a linked_ptr object is thread-safe in the sense that: // - it's safe to copy linked_ptr objects concurrently, // - it's safe to copy *from* a linked_ptr and read its underlying // raw pointer (e.g. via get()) concurrently, and // - it's safe to write to two linked_ptrs that point to the same // shared object concurrently. // FIXME: rename this to safe_linked_ptr to avoid // confusion with normal linked_ptr. // GOOGLETEST_CM0001 DO NOT DELETE #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_ #include #include #include "gtest/internal/gtest-port.h" namespace testing { namespace internal { // Protects copying of all linked_ptr objects. GTEST_API_ GTEST_DECLARE_STATIC_MUTEX_(g_linked_ptr_mutex); // This is used internally by all instances of linked_ptr<>. It needs to be // a non-template class because different types of linked_ptr<> can refer to // the same object (linked_ptr(obj) vs linked_ptr(obj)). // So, it needs to be possible for different types of linked_ptr to participate // in the same circular linked list, so we need a single class type here. // // DO NOT USE THIS CLASS DIRECTLY YOURSELF. Use linked_ptr. class linked_ptr_internal { public: // Create a new circle that includes only this instance. void join_new() { next_ = this; } // Many linked_ptr operations may change p.link_ for some linked_ptr // variable p in the same circle as this object. Therefore we need // to prevent two such operations from occurring concurrently. // // Note that different types of linked_ptr objects can coexist in a // circle (e.g. linked_ptr, linked_ptr, and // linked_ptr). Therefore we must use a single mutex to // protect all linked_ptr objects. This can create serious // contention in production code, but is acceptable in a testing // framework. // Join an existing circle. void join(linked_ptr_internal const* ptr) GTEST_LOCK_EXCLUDED_(g_linked_ptr_mutex) { MutexLock lock(&g_linked_ptr_mutex); linked_ptr_internal const* p = ptr; while (p->next_ != ptr) { assert(p->next_ != this && "Trying to join() a linked ring we are already in. " "Is GMock thread safety enabled?"); p = p->next_; } p->next_ = this; next_ = ptr; } // Leave whatever circle we're part of. Returns true if we were the // last member of the circle. Once this is done, you can join() another. bool depart() GTEST_LOCK_EXCLUDED_(g_linked_ptr_mutex) { MutexLock lock(&g_linked_ptr_mutex); if (next_ == this) return true; linked_ptr_internal const* p = next_; while (p->next_ != this) { assert(p->next_ != next_ && "Trying to depart() a linked ring we are not in. " "Is GMock thread safety enabled?"); p = p->next_; } p->next_ = next_; return false; } private: mutable linked_ptr_internal const* next_; }; template class linked_ptr { public: typedef T element_type; // Take over ownership of a raw pointer. This should happen as soon as // possible after the object is created. explicit linked_ptr(T* ptr = NULL) { capture(ptr); } ~linked_ptr() { depart(); } // Copy an existing linked_ptr<>, adding ourselves to the list of references. template linked_ptr(linked_ptr const& ptr) { copy(&ptr); } linked_ptr(linked_ptr const& ptr) { // NOLINT assert(&ptr != this); copy(&ptr); } // Assignment releases the old value and acquires the new. template linked_ptr& operator=(linked_ptr const& ptr) { depart(); copy(&ptr); return *this; } linked_ptr& operator=(linked_ptr const& ptr) { if (&ptr != this) { depart(); copy(&ptr); } return *this; } // Smart pointer members. void reset(T* ptr = NULL) { depart(); capture(ptr); } T* get() const { return value_; } T* operator->() const { return value_; } T& operator*() const { return *value_; } bool operator==(T* p) const { return value_ == p; } bool operator!=(T* p) const { return value_ != p; } template bool operator==(linked_ptr const& ptr) const { return value_ == ptr.get(); } template bool operator!=(linked_ptr const& ptr) const { return value_ != ptr.get(); } private: template friend class linked_ptr; T* value_; linked_ptr_internal link_; void depart() { if (link_.depart()) delete value_; } void capture(T* ptr) { value_ = ptr; link_.join_new(); } template void copy(linked_ptr const* ptr) { value_ = ptr->get(); if (value_) link_.join(&ptr->link_); else link_.join_new(); } }; template inline bool operator==(T* ptr, const linked_ptr& x) { return ptr == x.get(); } template inline bool operator!=(T* ptr, const linked_ptr& x) { return ptr != x.get(); } // A function to convert T* into linked_ptr // Doing e.g. make_linked_ptr(new FooBarBaz(arg)) is a shorter notation // for linked_ptr >(new FooBarBaz(arg)) template linked_ptr make_linked_ptr(T* ptr) { return linked_ptr(ptr); } } // namespace internal } // namespace testing #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_ iptux-0.9.4/src/googletest/include/gtest/internal/gtest-param-util-generated.h000066400000000000000000006526021475473122500275560ustar00rootroot00000000000000// This file was GENERATED by command: // pump.py gtest-param-util-generated.h.pump // DO NOT EDIT BY HAND!!! // Copyright 2008 Google Inc. // All Rights Reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // Type and function utilities for implementing parameterized tests. // This file is generated by a SCRIPT. DO NOT EDIT BY HAND! // // Currently Google Test supports at most 50 arguments in Values, // and at most 10 arguments in Combine. Please contact // googletestframework@googlegroups.com if you need more. // Please note that the number of arguments to Combine is limited // by the maximum arity of the implementation of tuple which is // currently set at 10. // GOOGLETEST_CM0001 DO NOT DELETE #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_ #include "gtest/internal/gtest-param-util.h" #include "gtest/internal/gtest-port.h" namespace testing { // Forward declarations of ValuesIn(), which is implemented in // include/gtest/gtest-param-test.h. template internal::ParamGenerator< typename ::testing::internal::IteratorTraits::value_type> ValuesIn(ForwardIterator begin, ForwardIterator end); template internal::ParamGenerator ValuesIn(const T (&array)[N]); template internal::ParamGenerator ValuesIn( const Container& container); namespace internal { // Used in the Values() function to provide polymorphic capabilities. template class ValueArray1 { public: explicit ValueArray1(T1 v1) : v1_(v1) {} template operator ParamGenerator() const { const T array[] = {static_cast(v1_)}; return ValuesIn(array); } ValueArray1(const ValueArray1& other) : v1_(other.v1_) {} private: // No implementation - assignment is unsupported. void operator=(const ValueArray1& other); const T1 v1_; }; template class ValueArray2 { public: ValueArray2(T1 v1, T2 v2) : v1_(v1), v2_(v2) {} template operator ParamGenerator() const { const T array[] = {static_cast(v1_), static_cast(v2_)}; return ValuesIn(array); } ValueArray2(const ValueArray2& other) : v1_(other.v1_), v2_(other.v2_) {} private: // No implementation - assignment is unsupported. void operator=(const ValueArray2& other); const T1 v1_; const T2 v2_; }; template class ValueArray3 { public: ValueArray3(T1 v1, T2 v2, T3 v3) : v1_(v1), v2_(v2), v3_(v3) {} template operator ParamGenerator() const { const T array[] = {static_cast(v1_), static_cast(v2_), static_cast(v3_)}; return ValuesIn(array); } ValueArray3(const ValueArray3& other) : v1_(other.v1_), v2_(other.v2_), v3_(other.v3_) {} private: // No implementation - assignment is unsupported. void operator=(const ValueArray3& other); const T1 v1_; const T2 v2_; const T3 v3_; }; template class ValueArray4 { public: ValueArray4(T1 v1, T2 v2, T3 v3, T4 v4) : v1_(v1), v2_(v2), v3_(v3), v4_(v4) {} template operator ParamGenerator() const { const T array[] = {static_cast(v1_), static_cast(v2_), static_cast(v3_), static_cast(v4_)}; return ValuesIn(array); } ValueArray4(const ValueArray4& other) : v1_(other.v1_), v2_(other.v2_), v3_(other.v3_), v4_(other.v4_) {} private: // No implementation - assignment is unsupported. void operator=(const ValueArray4& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; }; template class ValueArray5 { public: ValueArray5(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5) {} template operator ParamGenerator() const { const T array[] = {static_cast(v1_), static_cast(v2_), static_cast(v3_), static_cast(v4_), static_cast(v5_)}; return ValuesIn(array); } ValueArray5(const ValueArray5& other) : v1_(other.v1_), v2_(other.v2_), v3_(other.v3_), v4_(other.v4_), v5_(other.v5_) {} private: // No implementation - assignment is unsupported. void operator=(const ValueArray5& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; }; template class ValueArray6 { public: ValueArray6(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6) {} template operator ParamGenerator() const { const T array[] = {static_cast(v1_), static_cast(v2_), static_cast(v3_), static_cast(v4_), static_cast(v5_), static_cast(v6_)}; return ValuesIn(array); } ValueArray6(const ValueArray6& other) : v1_(other.v1_), v2_(other.v2_), v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_) {} private: // No implementation - assignment is unsupported. void operator=(const ValueArray6& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; }; template class ValueArray7 { public: ValueArray7(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7) {} template operator ParamGenerator() const { const T array[] = {static_cast(v1_), static_cast(v2_), static_cast(v3_), static_cast(v4_), static_cast(v5_), static_cast(v6_), static_cast(v7_)}; return ValuesIn(array); } ValueArray7(const ValueArray7& other) : v1_(other.v1_), v2_(other.v2_), v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_), v7_(other.v7_) {} private: // No implementation - assignment is unsupported. void operator=(const ValueArray7& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; }; template class ValueArray8 { public: ValueArray8(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8) {} template operator ParamGenerator() const { const T array[] = {static_cast(v1_), static_cast(v2_), static_cast(v3_), static_cast(v4_), static_cast(v5_), static_cast(v6_), static_cast(v7_), static_cast(v8_)}; return ValuesIn(array); } ValueArray8(const ValueArray8& other) : v1_(other.v1_), v2_(other.v2_), v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_), v7_(other.v7_), v8_(other.v8_) {} private: // No implementation - assignment is unsupported. void operator=(const ValueArray8& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; }; template class ValueArray9 { public: ValueArray9(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9) {} template operator ParamGenerator() const { const T array[] = {static_cast(v1_), static_cast(v2_), static_cast(v3_), static_cast(v4_), static_cast(v5_), static_cast(v6_), static_cast(v7_), static_cast(v8_), static_cast(v9_)}; return ValuesIn(array); } ValueArray9(const ValueArray9& other) : v1_(other.v1_), v2_(other.v2_), v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_), v7_(other.v7_), v8_(other.v8_), v9_(other.v9_) {} private: // No implementation - assignment is unsupported. void operator=(const ValueArray9& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; }; template class ValueArray10 { public: ValueArray10(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10) {} template operator ParamGenerator() const { const T array[] = {static_cast(v1_), static_cast(v2_), static_cast(v3_), static_cast(v4_), static_cast(v5_), static_cast(v6_), static_cast(v7_), static_cast(v8_), static_cast(v9_), static_cast(v10_)}; return ValuesIn(array); } ValueArray10(const ValueArray10& other) : v1_(other.v1_), v2_(other.v2_), v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_), v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_) {} private: // No implementation - assignment is unsupported. void operator=(const ValueArray10& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; }; template class ValueArray11 { public: ValueArray11(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11) {} template operator ParamGenerator() const { const T array[] = {static_cast(v1_), static_cast(v2_), static_cast(v3_), static_cast(v4_), static_cast(v5_), static_cast(v6_), static_cast(v7_), static_cast(v8_), static_cast(v9_), static_cast(v10_), static_cast(v11_)}; return ValuesIn(array); } ValueArray11(const ValueArray11& other) : v1_(other.v1_), v2_(other.v2_), v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_), v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_), v11_(other.v11_) {} private: // No implementation - assignment is unsupported. void operator=(const ValueArray11& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; }; template class ValueArray12 { public: ValueArray12(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12) {} template operator ParamGenerator() const { const T array[] = {static_cast(v1_), static_cast(v2_), static_cast(v3_), static_cast(v4_), static_cast(v5_), static_cast(v6_), static_cast(v7_), static_cast(v8_), static_cast(v9_), static_cast(v10_), static_cast(v11_), static_cast(v12_)}; return ValuesIn(array); } ValueArray12(const ValueArray12& other) : v1_(other.v1_), v2_(other.v2_), v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_), v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_), v11_(other.v11_), v12_(other.v12_) {} private: // No implementation - assignment is unsupported. void operator=(const ValueArray12& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; }; template class ValueArray13 { public: ValueArray13(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13) {} template operator ParamGenerator() const { const T array[] = {static_cast(v1_), static_cast(v2_), static_cast(v3_), static_cast(v4_), static_cast(v5_), static_cast(v6_), static_cast(v7_), static_cast(v8_), static_cast(v9_), static_cast(v10_), static_cast(v11_), static_cast(v12_), static_cast(v13_)}; return ValuesIn(array); } ValueArray13(const ValueArray13& other) : v1_(other.v1_), v2_(other.v2_), v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_), v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_), v11_(other.v11_), v12_(other.v12_), v13_(other.v13_) {} private: // No implementation - assignment is unsupported. void operator=(const ValueArray13& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; }; template class ValueArray14 { public: ValueArray14(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14) {} template operator ParamGenerator() const { const T array[] = {static_cast(v1_), static_cast(v2_), static_cast(v3_), static_cast(v4_), static_cast(v5_), static_cast(v6_), static_cast(v7_), static_cast(v8_), static_cast(v9_), static_cast(v10_), static_cast(v11_), static_cast(v12_), static_cast(v13_), static_cast(v14_)}; return ValuesIn(array); } ValueArray14(const ValueArray14& other) : v1_(other.v1_), v2_(other.v2_), v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_), v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_), v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_) {} private: // No implementation - assignment is unsupported. void operator=(const ValueArray14& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; }; template class ValueArray15 { public: ValueArray15(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15) {} template operator ParamGenerator() const { const T array[] = {static_cast(v1_), static_cast(v2_), static_cast(v3_), static_cast(v4_), static_cast(v5_), static_cast(v6_), static_cast(v7_), static_cast(v8_), static_cast(v9_), static_cast(v10_), static_cast(v11_), static_cast(v12_), static_cast(v13_), static_cast(v14_), static_cast(v15_)}; return ValuesIn(array); } ValueArray15(const ValueArray15& other) : v1_(other.v1_), v2_(other.v2_), v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_), v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_), v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_), v15_(other.v15_) {} private: // No implementation - assignment is unsupported. void operator=(const ValueArray15& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; }; template class ValueArray16 { public: ValueArray16(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16) {} template operator ParamGenerator() const { const T array[] = {static_cast(v1_), static_cast(v2_), static_cast(v3_), static_cast(v4_), static_cast(v5_), static_cast(v6_), static_cast(v7_), static_cast(v8_), static_cast(v9_), static_cast(v10_), static_cast(v11_), static_cast(v12_), static_cast(v13_), static_cast(v14_), static_cast(v15_), static_cast(v16_)}; return ValuesIn(array); } ValueArray16(const ValueArray16& other) : v1_(other.v1_), v2_(other.v2_), v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_), v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_), v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_), v15_(other.v15_), v16_(other.v16_) {} private: // No implementation - assignment is unsupported. void operator=(const ValueArray16& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; }; template class ValueArray17 { public: ValueArray17(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17) {} template operator ParamGenerator() const { const T array[] = {static_cast(v1_), static_cast(v2_), static_cast(v3_), static_cast(v4_), static_cast(v5_), static_cast(v6_), static_cast(v7_), static_cast(v8_), static_cast(v9_), static_cast(v10_), static_cast(v11_), static_cast(v12_), static_cast(v13_), static_cast(v14_), static_cast(v15_), static_cast(v16_), static_cast(v17_)}; return ValuesIn(array); } ValueArray17(const ValueArray17& other) : v1_(other.v1_), v2_(other.v2_), v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_), v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_), v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_), v15_(other.v15_), v16_(other.v16_), v17_(other.v17_) {} private: // No implementation - assignment is unsupported. void operator=(const ValueArray17& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; }; template class ValueArray18 { public: ValueArray18(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18) {} template operator ParamGenerator() const { const T array[] = {static_cast(v1_), static_cast(v2_), static_cast(v3_), static_cast(v4_), static_cast(v5_), static_cast(v6_), static_cast(v7_), static_cast(v8_), static_cast(v9_), static_cast(v10_), static_cast(v11_), static_cast(v12_), static_cast(v13_), static_cast(v14_), static_cast(v15_), static_cast(v16_), static_cast(v17_), static_cast(v18_)}; return ValuesIn(array); } ValueArray18(const ValueArray18& other) : v1_(other.v1_), v2_(other.v2_), v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_), v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_), v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_), v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_) {} private: // No implementation - assignment is unsupported. void operator=(const ValueArray18& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; }; template class ValueArray19 { public: ValueArray19(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19) {} template operator ParamGenerator() const { const T array[] = {static_cast(v1_), static_cast(v2_), static_cast(v3_), static_cast(v4_), static_cast(v5_), static_cast(v6_), static_cast(v7_), static_cast(v8_), static_cast(v9_), static_cast(v10_), static_cast(v11_), static_cast(v12_), static_cast(v13_), static_cast(v14_), static_cast(v15_), static_cast(v16_), static_cast(v17_), static_cast(v18_), static_cast(v19_)}; return ValuesIn(array); } ValueArray19(const ValueArray19& other) : v1_(other.v1_), v2_(other.v2_), v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_), v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_), v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_), v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_), v19_(other.v19_) {} private: // No implementation - assignment is unsupported. void operator=(const ValueArray19& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; }; template class ValueArray20 { public: ValueArray20(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20) {} template operator ParamGenerator() const { const T array[] = {static_cast(v1_), static_cast(v2_), static_cast(v3_), static_cast(v4_), static_cast(v5_), static_cast(v6_), static_cast(v7_), static_cast(v8_), static_cast(v9_), static_cast(v10_), static_cast(v11_), static_cast(v12_), static_cast(v13_), static_cast(v14_), static_cast(v15_), static_cast(v16_), static_cast(v17_), static_cast(v18_), static_cast(v19_), static_cast(v20_)}; return ValuesIn(array); } ValueArray20(const ValueArray20& other) : v1_(other.v1_), v2_(other.v2_), v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_), v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_), v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_), v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_), v19_(other.v19_), v20_(other.v20_) {} private: // No implementation - assignment is unsupported. void operator=(const ValueArray20& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; }; template class ValueArray21 { public: ValueArray21(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21) {} template operator ParamGenerator() const { const T array[] = {static_cast(v1_), static_cast(v2_), static_cast(v3_), static_cast(v4_), static_cast(v5_), static_cast(v6_), static_cast(v7_), static_cast(v8_), static_cast(v9_), static_cast(v10_), static_cast(v11_), static_cast(v12_), static_cast(v13_), static_cast(v14_), static_cast(v15_), static_cast(v16_), static_cast(v17_), static_cast(v18_), static_cast(v19_), static_cast(v20_), static_cast(v21_)}; return ValuesIn(array); } ValueArray21(const ValueArray21& other) : v1_(other.v1_), v2_(other.v2_), v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_), v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_), v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_), v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_), v19_(other.v19_), v20_(other.v20_), v21_(other.v21_) {} private: // No implementation - assignment is unsupported. void operator=(const ValueArray21& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; }; template class ValueArray22 { public: ValueArray22(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22) {} template operator ParamGenerator() const { const T array[] = {static_cast(v1_), static_cast(v2_), static_cast(v3_), static_cast(v4_), static_cast(v5_), static_cast(v6_), static_cast(v7_), static_cast(v8_), static_cast(v9_), static_cast(v10_), static_cast(v11_), static_cast(v12_), static_cast(v13_), static_cast(v14_), static_cast(v15_), static_cast(v16_), static_cast(v17_), static_cast(v18_), static_cast(v19_), static_cast(v20_), static_cast(v21_), static_cast(v22_)}; return ValuesIn(array); } ValueArray22(const ValueArray22& other) : v1_(other.v1_), v2_(other.v2_), v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_), v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_), v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_), v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_), v19_(other.v19_), v20_(other.v20_), v21_(other.v21_), v22_(other.v22_) {} private: // No implementation - assignment is unsupported. void operator=(const ValueArray22& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; const T22 v22_; }; template class ValueArray23 { public: ValueArray23(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23) {} template operator ParamGenerator() const { const T array[] = {static_cast(v1_), static_cast(v2_), static_cast(v3_), static_cast(v4_), static_cast(v5_), static_cast(v6_), static_cast(v7_), static_cast(v8_), static_cast(v9_), static_cast(v10_), static_cast(v11_), static_cast(v12_), static_cast(v13_), static_cast(v14_), static_cast(v15_), static_cast(v16_), static_cast(v17_), static_cast(v18_), static_cast(v19_), static_cast(v20_), static_cast(v21_), static_cast(v22_), static_cast(v23_)}; return ValuesIn(array); } ValueArray23(const ValueArray23& other) : v1_(other.v1_), v2_(other.v2_), v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_), v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_), v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_), v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_), v19_(other.v19_), v20_(other.v20_), v21_(other.v21_), v22_(other.v22_), v23_(other.v23_) {} private: // No implementation - assignment is unsupported. void operator=(const ValueArray23& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; const T22 v22_; const T23 v23_; }; template class ValueArray24 { public: ValueArray24(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24) {} template operator ParamGenerator() const { const T array[] = {static_cast(v1_), static_cast(v2_), static_cast(v3_), static_cast(v4_), static_cast(v5_), static_cast(v6_), static_cast(v7_), static_cast(v8_), static_cast(v9_), static_cast(v10_), static_cast(v11_), static_cast(v12_), static_cast(v13_), static_cast(v14_), static_cast(v15_), static_cast(v16_), static_cast(v17_), static_cast(v18_), static_cast(v19_), static_cast(v20_), static_cast(v21_), static_cast(v22_), static_cast(v23_), static_cast(v24_)}; return ValuesIn(array); } ValueArray24(const ValueArray24& other) : v1_(other.v1_), v2_(other.v2_), v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_), v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_), v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_), v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_), v19_(other.v19_), v20_(other.v20_), v21_(other.v21_), v22_(other.v22_), v23_(other.v23_), v24_(other.v24_) {} private: // No implementation - assignment is unsupported. void operator=(const ValueArray24& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; const T22 v22_; const T23 v23_; const T24 v24_; }; template class ValueArray25 { public: ValueArray25(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25) {} template operator ParamGenerator() const { const T array[] = {static_cast(v1_), static_cast(v2_), static_cast(v3_), static_cast(v4_), static_cast(v5_), static_cast(v6_), static_cast(v7_), static_cast(v8_), static_cast(v9_), static_cast(v10_), static_cast(v11_), static_cast(v12_), static_cast(v13_), static_cast(v14_), static_cast(v15_), static_cast(v16_), static_cast(v17_), static_cast(v18_), static_cast(v19_), static_cast(v20_), static_cast(v21_), static_cast(v22_), static_cast(v23_), static_cast(v24_), static_cast(v25_)}; return ValuesIn(array); } ValueArray25(const ValueArray25& other) : v1_(other.v1_), v2_(other.v2_), v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_), v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_), v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_), v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_), v19_(other.v19_), v20_(other.v20_), v21_(other.v21_), v22_(other.v22_), v23_(other.v23_), v24_(other.v24_), v25_(other.v25_) {} private: // No implementation - assignment is unsupported. void operator=(const ValueArray25& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; const T22 v22_; const T23 v23_; const T24 v24_; const T25 v25_; }; template class ValueArray26 { public: ValueArray26(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26) {} template operator ParamGenerator() const { const T array[] = {static_cast(v1_), static_cast(v2_), static_cast(v3_), static_cast(v4_), static_cast(v5_), static_cast(v6_), static_cast(v7_), static_cast(v8_), static_cast(v9_), static_cast(v10_), static_cast(v11_), static_cast(v12_), static_cast(v13_), static_cast(v14_), static_cast(v15_), static_cast(v16_), static_cast(v17_), static_cast(v18_), static_cast(v19_), static_cast(v20_), static_cast(v21_), static_cast(v22_), static_cast(v23_), static_cast(v24_), static_cast(v25_), static_cast(v26_)}; return ValuesIn(array); } ValueArray26(const ValueArray26& other) : v1_(other.v1_), v2_(other.v2_), v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_), v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_), v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_), v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_), v19_(other.v19_), v20_(other.v20_), v21_(other.v21_), v22_(other.v22_), v23_(other.v23_), v24_(other.v24_), v25_(other.v25_), v26_(other.v26_) {} private: // No implementation - assignment is unsupported. void operator=(const ValueArray26& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; const T22 v22_; const T23 v23_; const T24 v24_; const T25 v25_; const T26 v26_; }; template class ValueArray27 { public: ValueArray27(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27) {} template operator ParamGenerator() const { const T array[] = {static_cast(v1_), static_cast(v2_), static_cast(v3_), static_cast(v4_), static_cast(v5_), static_cast(v6_), static_cast(v7_), static_cast(v8_), static_cast(v9_), static_cast(v10_), static_cast(v11_), static_cast(v12_), static_cast(v13_), static_cast(v14_), static_cast(v15_), static_cast(v16_), static_cast(v17_), static_cast(v18_), static_cast(v19_), static_cast(v20_), static_cast(v21_), static_cast(v22_), static_cast(v23_), static_cast(v24_), static_cast(v25_), static_cast(v26_), static_cast(v27_)}; return ValuesIn(array); } ValueArray27(const ValueArray27& other) : v1_(other.v1_), v2_(other.v2_), v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_), v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_), v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_), v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_), v19_(other.v19_), v20_(other.v20_), v21_(other.v21_), v22_(other.v22_), v23_(other.v23_), v24_(other.v24_), v25_(other.v25_), v26_(other.v26_), v27_(other.v27_) {} private: // No implementation - assignment is unsupported. void operator=(const ValueArray27& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; const T22 v22_; const T23 v23_; const T24 v24_; const T25 v25_; const T26 v26_; const T27 v27_; }; template class ValueArray28 { public: ValueArray28(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28) {} template operator ParamGenerator() const { const T array[] = {static_cast(v1_), static_cast(v2_), static_cast(v3_), static_cast(v4_), static_cast(v5_), static_cast(v6_), static_cast(v7_), static_cast(v8_), static_cast(v9_), static_cast(v10_), static_cast(v11_), static_cast(v12_), static_cast(v13_), static_cast(v14_), static_cast(v15_), static_cast(v16_), static_cast(v17_), static_cast(v18_), static_cast(v19_), static_cast(v20_), static_cast(v21_), static_cast(v22_), static_cast(v23_), static_cast(v24_), static_cast(v25_), static_cast(v26_), static_cast(v27_), static_cast(v28_)}; return ValuesIn(array); } ValueArray28(const ValueArray28& other) : v1_(other.v1_), v2_(other.v2_), v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_), v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_), v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_), v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_), v19_(other.v19_), v20_(other.v20_), v21_(other.v21_), v22_(other.v22_), v23_(other.v23_), v24_(other.v24_), v25_(other.v25_), v26_(other.v26_), v27_(other.v27_), v28_(other.v28_) {} private: // No implementation - assignment is unsupported. void operator=(const ValueArray28& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; const T22 v22_; const T23 v23_; const T24 v24_; const T25 v25_; const T26 v26_; const T27 v27_; const T28 v28_; }; template class ValueArray29 { public: ValueArray29(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29) {} template operator ParamGenerator() const { const T array[] = {static_cast(v1_), static_cast(v2_), static_cast(v3_), static_cast(v4_), static_cast(v5_), static_cast(v6_), static_cast(v7_), static_cast(v8_), static_cast(v9_), static_cast(v10_), static_cast(v11_), static_cast(v12_), static_cast(v13_), static_cast(v14_), static_cast(v15_), static_cast(v16_), static_cast(v17_), static_cast(v18_), static_cast(v19_), static_cast(v20_), static_cast(v21_), static_cast(v22_), static_cast(v23_), static_cast(v24_), static_cast(v25_), static_cast(v26_), static_cast(v27_), static_cast(v28_), static_cast(v29_)}; return ValuesIn(array); } ValueArray29(const ValueArray29& other) : v1_(other.v1_), v2_(other.v2_), v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_), v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_), v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_), v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_), v19_(other.v19_), v20_(other.v20_), v21_(other.v21_), v22_(other.v22_), v23_(other.v23_), v24_(other.v24_), v25_(other.v25_), v26_(other.v26_), v27_(other.v27_), v28_(other.v28_), v29_(other.v29_) {} private: // No implementation - assignment is unsupported. void operator=(const ValueArray29& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; const T22 v22_; const T23 v23_; const T24 v24_; const T25 v25_; const T26 v26_; const T27 v27_; const T28 v28_; const T29 v29_; }; template class ValueArray30 { public: ValueArray30(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30) {} template operator ParamGenerator() const { const T array[] = {static_cast(v1_), static_cast(v2_), static_cast(v3_), static_cast(v4_), static_cast(v5_), static_cast(v6_), static_cast(v7_), static_cast(v8_), static_cast(v9_), static_cast(v10_), static_cast(v11_), static_cast(v12_), static_cast(v13_), static_cast(v14_), static_cast(v15_), static_cast(v16_), static_cast(v17_), static_cast(v18_), static_cast(v19_), static_cast(v20_), static_cast(v21_), static_cast(v22_), static_cast(v23_), static_cast(v24_), static_cast(v25_), static_cast(v26_), static_cast(v27_), static_cast(v28_), static_cast(v29_), static_cast(v30_)}; return ValuesIn(array); } ValueArray30(const ValueArray30& other) : v1_(other.v1_), v2_(other.v2_), v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_), v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_), v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_), v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_), v19_(other.v19_), v20_(other.v20_), v21_(other.v21_), v22_(other.v22_), v23_(other.v23_), v24_(other.v24_), v25_(other.v25_), v26_(other.v26_), v27_(other.v27_), v28_(other.v28_), v29_(other.v29_), v30_(other.v30_) {} private: // No implementation - assignment is unsupported. void operator=(const ValueArray30& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; const T22 v22_; const T23 v23_; const T24 v24_; const T25 v25_; const T26 v26_; const T27 v27_; const T28 v28_; const T29 v29_; const T30 v30_; }; template class ValueArray31 { public: ValueArray31(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31) {} template operator ParamGenerator() const { const T array[] = {static_cast(v1_), static_cast(v2_), static_cast(v3_), static_cast(v4_), static_cast(v5_), static_cast(v6_), static_cast(v7_), static_cast(v8_), static_cast(v9_), static_cast(v10_), static_cast(v11_), static_cast(v12_), static_cast(v13_), static_cast(v14_), static_cast(v15_), static_cast(v16_), static_cast(v17_), static_cast(v18_), static_cast(v19_), static_cast(v20_), static_cast(v21_), static_cast(v22_), static_cast(v23_), static_cast(v24_), static_cast(v25_), static_cast(v26_), static_cast(v27_), static_cast(v28_), static_cast(v29_), static_cast(v30_), static_cast(v31_)}; return ValuesIn(array); } ValueArray31(const ValueArray31& other) : v1_(other.v1_), v2_(other.v2_), v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_), v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_), v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_), v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_), v19_(other.v19_), v20_(other.v20_), v21_(other.v21_), v22_(other.v22_), v23_(other.v23_), v24_(other.v24_), v25_(other.v25_), v26_(other.v26_), v27_(other.v27_), v28_(other.v28_), v29_(other.v29_), v30_(other.v30_), v31_(other.v31_) {} private: // No implementation - assignment is unsupported. void operator=(const ValueArray31& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; const T22 v22_; const T23 v23_; const T24 v24_; const T25 v25_; const T26 v26_; const T27 v27_; const T28 v28_; const T29 v29_; const T30 v30_; const T31 v31_; }; template class ValueArray32 { public: ValueArray32(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32) {} template operator ParamGenerator() const { const T array[] = {static_cast(v1_), static_cast(v2_), static_cast(v3_), static_cast(v4_), static_cast(v5_), static_cast(v6_), static_cast(v7_), static_cast(v8_), static_cast(v9_), static_cast(v10_), static_cast(v11_), static_cast(v12_), static_cast(v13_), static_cast(v14_), static_cast(v15_), static_cast(v16_), static_cast(v17_), static_cast(v18_), static_cast(v19_), static_cast(v20_), static_cast(v21_), static_cast(v22_), static_cast(v23_), static_cast(v24_), static_cast(v25_), static_cast(v26_), static_cast(v27_), static_cast(v28_), static_cast(v29_), static_cast(v30_), static_cast(v31_), static_cast(v32_)}; return ValuesIn(array); } ValueArray32(const ValueArray32& other) : v1_(other.v1_), v2_(other.v2_), v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_), v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_), v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_), v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_), v19_(other.v19_), v20_(other.v20_), v21_(other.v21_), v22_(other.v22_), v23_(other.v23_), v24_(other.v24_), v25_(other.v25_), v26_(other.v26_), v27_(other.v27_), v28_(other.v28_), v29_(other.v29_), v30_(other.v30_), v31_(other.v31_), v32_(other.v32_) {} private: // No implementation - assignment is unsupported. void operator=(const ValueArray32& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; const T22 v22_; const T23 v23_; const T24 v24_; const T25 v25_; const T26 v26_; const T27 v27_; const T28 v28_; const T29 v29_; const T30 v30_; const T31 v31_; const T32 v32_; }; template class ValueArray33 { public: ValueArray33(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33) {} template operator ParamGenerator() const { const T array[] = {static_cast(v1_), static_cast(v2_), static_cast(v3_), static_cast(v4_), static_cast(v5_), static_cast(v6_), static_cast(v7_), static_cast(v8_), static_cast(v9_), static_cast(v10_), static_cast(v11_), static_cast(v12_), static_cast(v13_), static_cast(v14_), static_cast(v15_), static_cast(v16_), static_cast(v17_), static_cast(v18_), static_cast(v19_), static_cast(v20_), static_cast(v21_), static_cast(v22_), static_cast(v23_), static_cast(v24_), static_cast(v25_), static_cast(v26_), static_cast(v27_), static_cast(v28_), static_cast(v29_), static_cast(v30_), static_cast(v31_), static_cast(v32_), static_cast(v33_)}; return ValuesIn(array); } ValueArray33(const ValueArray33& other) : v1_(other.v1_), v2_(other.v2_), v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_), v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_), v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_), v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_), v19_(other.v19_), v20_(other.v20_), v21_(other.v21_), v22_(other.v22_), v23_(other.v23_), v24_(other.v24_), v25_(other.v25_), v26_(other.v26_), v27_(other.v27_), v28_(other.v28_), v29_(other.v29_), v30_(other.v30_), v31_(other.v31_), v32_(other.v32_), v33_(other.v33_) {} private: // No implementation - assignment is unsupported. void operator=(const ValueArray33& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; const T22 v22_; const T23 v23_; const T24 v24_; const T25 v25_; const T26 v26_; const T27 v27_; const T28 v28_; const T29 v29_; const T30 v30_; const T31 v31_; const T32 v32_; const T33 v33_; }; template class ValueArray34 { public: ValueArray34(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34) {} template operator ParamGenerator() const { const T array[] = {static_cast(v1_), static_cast(v2_), static_cast(v3_), static_cast(v4_), static_cast(v5_), static_cast(v6_), static_cast(v7_), static_cast(v8_), static_cast(v9_), static_cast(v10_), static_cast(v11_), static_cast(v12_), static_cast(v13_), static_cast(v14_), static_cast(v15_), static_cast(v16_), static_cast(v17_), static_cast(v18_), static_cast(v19_), static_cast(v20_), static_cast(v21_), static_cast(v22_), static_cast(v23_), static_cast(v24_), static_cast(v25_), static_cast(v26_), static_cast(v27_), static_cast(v28_), static_cast(v29_), static_cast(v30_), static_cast(v31_), static_cast(v32_), static_cast(v33_), static_cast(v34_)}; return ValuesIn(array); } ValueArray34(const ValueArray34& other) : v1_(other.v1_), v2_(other.v2_), v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_), v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_), v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_), v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_), v19_(other.v19_), v20_(other.v20_), v21_(other.v21_), v22_(other.v22_), v23_(other.v23_), v24_(other.v24_), v25_(other.v25_), v26_(other.v26_), v27_(other.v27_), v28_(other.v28_), v29_(other.v29_), v30_(other.v30_), v31_(other.v31_), v32_(other.v32_), v33_(other.v33_), v34_(other.v34_) {} private: // No implementation - assignment is unsupported. void operator=(const ValueArray34& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; const T22 v22_; const T23 v23_; const T24 v24_; const T25 v25_; const T26 v26_; const T27 v27_; const T28 v28_; const T29 v29_; const T30 v30_; const T31 v31_; const T32 v32_; const T33 v33_; const T34 v34_; }; template class ValueArray35 { public: ValueArray35(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35) {} template operator ParamGenerator() const { const T array[] = {static_cast(v1_), static_cast(v2_), static_cast(v3_), static_cast(v4_), static_cast(v5_), static_cast(v6_), static_cast(v7_), static_cast(v8_), static_cast(v9_), static_cast(v10_), static_cast(v11_), static_cast(v12_), static_cast(v13_), static_cast(v14_), static_cast(v15_), static_cast(v16_), static_cast(v17_), static_cast(v18_), static_cast(v19_), static_cast(v20_), static_cast(v21_), static_cast(v22_), static_cast(v23_), static_cast(v24_), static_cast(v25_), static_cast(v26_), static_cast(v27_), static_cast(v28_), static_cast(v29_), static_cast(v30_), static_cast(v31_), static_cast(v32_), static_cast(v33_), static_cast(v34_), static_cast(v35_)}; return ValuesIn(array); } ValueArray35(const ValueArray35& other) : v1_(other.v1_), v2_(other.v2_), v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_), v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_), v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_), v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_), v19_(other.v19_), v20_(other.v20_), v21_(other.v21_), v22_(other.v22_), v23_(other.v23_), v24_(other.v24_), v25_(other.v25_), v26_(other.v26_), v27_(other.v27_), v28_(other.v28_), v29_(other.v29_), v30_(other.v30_), v31_(other.v31_), v32_(other.v32_), v33_(other.v33_), v34_(other.v34_), v35_(other.v35_) {} private: // No implementation - assignment is unsupported. void operator=(const ValueArray35& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; const T22 v22_; const T23 v23_; const T24 v24_; const T25 v25_; const T26 v26_; const T27 v27_; const T28 v28_; const T29 v29_; const T30 v30_; const T31 v31_; const T32 v32_; const T33 v33_; const T34 v34_; const T35 v35_; }; template class ValueArray36 { public: ValueArray36(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36) {} template operator ParamGenerator() const { const T array[] = {static_cast(v1_), static_cast(v2_), static_cast(v3_), static_cast(v4_), static_cast(v5_), static_cast(v6_), static_cast(v7_), static_cast(v8_), static_cast(v9_), static_cast(v10_), static_cast(v11_), static_cast(v12_), static_cast(v13_), static_cast(v14_), static_cast(v15_), static_cast(v16_), static_cast(v17_), static_cast(v18_), static_cast(v19_), static_cast(v20_), static_cast(v21_), static_cast(v22_), static_cast(v23_), static_cast(v24_), static_cast(v25_), static_cast(v26_), static_cast(v27_), static_cast(v28_), static_cast(v29_), static_cast(v30_), static_cast(v31_), static_cast(v32_), static_cast(v33_), static_cast(v34_), static_cast(v35_), static_cast(v36_)}; return ValuesIn(array); } ValueArray36(const ValueArray36& other) : v1_(other.v1_), v2_(other.v2_), v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_), v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_), v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_), v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_), v19_(other.v19_), v20_(other.v20_), v21_(other.v21_), v22_(other.v22_), v23_(other.v23_), v24_(other.v24_), v25_(other.v25_), v26_(other.v26_), v27_(other.v27_), v28_(other.v28_), v29_(other.v29_), v30_(other.v30_), v31_(other.v31_), v32_(other.v32_), v33_(other.v33_), v34_(other.v34_), v35_(other.v35_), v36_(other.v36_) {} private: // No implementation - assignment is unsupported. void operator=(const ValueArray36& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; const T22 v22_; const T23 v23_; const T24 v24_; const T25 v25_; const T26 v26_; const T27 v27_; const T28 v28_; const T29 v29_; const T30 v30_; const T31 v31_; const T32 v32_; const T33 v33_; const T34 v34_; const T35 v35_; const T36 v36_; }; template class ValueArray37 { public: ValueArray37(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37) {} template operator ParamGenerator() const { const T array[] = {static_cast(v1_), static_cast(v2_), static_cast(v3_), static_cast(v4_), static_cast(v5_), static_cast(v6_), static_cast(v7_), static_cast(v8_), static_cast(v9_), static_cast(v10_), static_cast(v11_), static_cast(v12_), static_cast(v13_), static_cast(v14_), static_cast(v15_), static_cast(v16_), static_cast(v17_), static_cast(v18_), static_cast(v19_), static_cast(v20_), static_cast(v21_), static_cast(v22_), static_cast(v23_), static_cast(v24_), static_cast(v25_), static_cast(v26_), static_cast(v27_), static_cast(v28_), static_cast(v29_), static_cast(v30_), static_cast(v31_), static_cast(v32_), static_cast(v33_), static_cast(v34_), static_cast(v35_), static_cast(v36_), static_cast(v37_)}; return ValuesIn(array); } ValueArray37(const ValueArray37& other) : v1_(other.v1_), v2_(other.v2_), v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_), v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_), v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_), v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_), v19_(other.v19_), v20_(other.v20_), v21_(other.v21_), v22_(other.v22_), v23_(other.v23_), v24_(other.v24_), v25_(other.v25_), v26_(other.v26_), v27_(other.v27_), v28_(other.v28_), v29_(other.v29_), v30_(other.v30_), v31_(other.v31_), v32_(other.v32_), v33_(other.v33_), v34_(other.v34_), v35_(other.v35_), v36_(other.v36_), v37_(other.v37_) {} private: // No implementation - assignment is unsupported. void operator=(const ValueArray37& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; const T22 v22_; const T23 v23_; const T24 v24_; const T25 v25_; const T26 v26_; const T27 v27_; const T28 v28_; const T29 v29_; const T30 v30_; const T31 v31_; const T32 v32_; const T33 v33_; const T34 v34_; const T35 v35_; const T36 v36_; const T37 v37_; }; template class ValueArray38 { public: ValueArray38(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38) {} template operator ParamGenerator() const { const T array[] = {static_cast(v1_), static_cast(v2_), static_cast(v3_), static_cast(v4_), static_cast(v5_), static_cast(v6_), static_cast(v7_), static_cast(v8_), static_cast(v9_), static_cast(v10_), static_cast(v11_), static_cast(v12_), static_cast(v13_), static_cast(v14_), static_cast(v15_), static_cast(v16_), static_cast(v17_), static_cast(v18_), static_cast(v19_), static_cast(v20_), static_cast(v21_), static_cast(v22_), static_cast(v23_), static_cast(v24_), static_cast(v25_), static_cast(v26_), static_cast(v27_), static_cast(v28_), static_cast(v29_), static_cast(v30_), static_cast(v31_), static_cast(v32_), static_cast(v33_), static_cast(v34_), static_cast(v35_), static_cast(v36_), static_cast(v37_), static_cast(v38_)}; return ValuesIn(array); } ValueArray38(const ValueArray38& other) : v1_(other.v1_), v2_(other.v2_), v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_), v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_), v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_), v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_), v19_(other.v19_), v20_(other.v20_), v21_(other.v21_), v22_(other.v22_), v23_(other.v23_), v24_(other.v24_), v25_(other.v25_), v26_(other.v26_), v27_(other.v27_), v28_(other.v28_), v29_(other.v29_), v30_(other.v30_), v31_(other.v31_), v32_(other.v32_), v33_(other.v33_), v34_(other.v34_), v35_(other.v35_), v36_(other.v36_), v37_(other.v37_), v38_(other.v38_) {} private: // No implementation - assignment is unsupported. void operator=(const ValueArray38& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; const T22 v22_; const T23 v23_; const T24 v24_; const T25 v25_; const T26 v26_; const T27 v27_; const T28 v28_; const T29 v29_; const T30 v30_; const T31 v31_; const T32 v32_; const T33 v33_; const T34 v34_; const T35 v35_; const T36 v36_; const T37 v37_; const T38 v38_; }; template class ValueArray39 { public: ValueArray39(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39) {} template operator ParamGenerator() const { const T array[] = {static_cast(v1_), static_cast(v2_), static_cast(v3_), static_cast(v4_), static_cast(v5_), static_cast(v6_), static_cast(v7_), static_cast(v8_), static_cast(v9_), static_cast(v10_), static_cast(v11_), static_cast(v12_), static_cast(v13_), static_cast(v14_), static_cast(v15_), static_cast(v16_), static_cast(v17_), static_cast(v18_), static_cast(v19_), static_cast(v20_), static_cast(v21_), static_cast(v22_), static_cast(v23_), static_cast(v24_), static_cast(v25_), static_cast(v26_), static_cast(v27_), static_cast(v28_), static_cast(v29_), static_cast(v30_), static_cast(v31_), static_cast(v32_), static_cast(v33_), static_cast(v34_), static_cast(v35_), static_cast(v36_), static_cast(v37_), static_cast(v38_), static_cast(v39_)}; return ValuesIn(array); } ValueArray39(const ValueArray39& other) : v1_(other.v1_), v2_(other.v2_), v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_), v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_), v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_), v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_), v19_(other.v19_), v20_(other.v20_), v21_(other.v21_), v22_(other.v22_), v23_(other.v23_), v24_(other.v24_), v25_(other.v25_), v26_(other.v26_), v27_(other.v27_), v28_(other.v28_), v29_(other.v29_), v30_(other.v30_), v31_(other.v31_), v32_(other.v32_), v33_(other.v33_), v34_(other.v34_), v35_(other.v35_), v36_(other.v36_), v37_(other.v37_), v38_(other.v38_), v39_(other.v39_) {} private: // No implementation - assignment is unsupported. void operator=(const ValueArray39& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; const T22 v22_; const T23 v23_; const T24 v24_; const T25 v25_; const T26 v26_; const T27 v27_; const T28 v28_; const T29 v29_; const T30 v30_; const T31 v31_; const T32 v32_; const T33 v33_; const T34 v34_; const T35 v35_; const T36 v36_; const T37 v37_; const T38 v38_; const T39 v39_; }; template class ValueArray40 { public: ValueArray40(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40) {} template operator ParamGenerator() const { const T array[] = {static_cast(v1_), static_cast(v2_), static_cast(v3_), static_cast(v4_), static_cast(v5_), static_cast(v6_), static_cast(v7_), static_cast(v8_), static_cast(v9_), static_cast(v10_), static_cast(v11_), static_cast(v12_), static_cast(v13_), static_cast(v14_), static_cast(v15_), static_cast(v16_), static_cast(v17_), static_cast(v18_), static_cast(v19_), static_cast(v20_), static_cast(v21_), static_cast(v22_), static_cast(v23_), static_cast(v24_), static_cast(v25_), static_cast(v26_), static_cast(v27_), static_cast(v28_), static_cast(v29_), static_cast(v30_), static_cast(v31_), static_cast(v32_), static_cast(v33_), static_cast(v34_), static_cast(v35_), static_cast(v36_), static_cast(v37_), static_cast(v38_), static_cast(v39_), static_cast(v40_)}; return ValuesIn(array); } ValueArray40(const ValueArray40& other) : v1_(other.v1_), v2_(other.v2_), v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_), v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_), v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_), v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_), v19_(other.v19_), v20_(other.v20_), v21_(other.v21_), v22_(other.v22_), v23_(other.v23_), v24_(other.v24_), v25_(other.v25_), v26_(other.v26_), v27_(other.v27_), v28_(other.v28_), v29_(other.v29_), v30_(other.v30_), v31_(other.v31_), v32_(other.v32_), v33_(other.v33_), v34_(other.v34_), v35_(other.v35_), v36_(other.v36_), v37_(other.v37_), v38_(other.v38_), v39_(other.v39_), v40_(other.v40_) {} private: // No implementation - assignment is unsupported. void operator=(const ValueArray40& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; const T22 v22_; const T23 v23_; const T24 v24_; const T25 v25_; const T26 v26_; const T27 v27_; const T28 v28_; const T29 v29_; const T30 v30_; const T31 v31_; const T32 v32_; const T33 v33_; const T34 v34_; const T35 v35_; const T36 v36_; const T37 v37_; const T38 v38_; const T39 v39_; const T40 v40_; }; template class ValueArray41 { public: ValueArray41(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40), v41_(v41) {} template operator ParamGenerator() const { const T array[] = {static_cast(v1_), static_cast(v2_), static_cast(v3_), static_cast(v4_), static_cast(v5_), static_cast(v6_), static_cast(v7_), static_cast(v8_), static_cast(v9_), static_cast(v10_), static_cast(v11_), static_cast(v12_), static_cast(v13_), static_cast(v14_), static_cast(v15_), static_cast(v16_), static_cast(v17_), static_cast(v18_), static_cast(v19_), static_cast(v20_), static_cast(v21_), static_cast(v22_), static_cast(v23_), static_cast(v24_), static_cast(v25_), static_cast(v26_), static_cast(v27_), static_cast(v28_), static_cast(v29_), static_cast(v30_), static_cast(v31_), static_cast(v32_), static_cast(v33_), static_cast(v34_), static_cast(v35_), static_cast(v36_), static_cast(v37_), static_cast(v38_), static_cast(v39_), static_cast(v40_), static_cast(v41_)}; return ValuesIn(array); } ValueArray41(const ValueArray41& other) : v1_(other.v1_), v2_(other.v2_), v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_), v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_), v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_), v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_), v19_(other.v19_), v20_(other.v20_), v21_(other.v21_), v22_(other.v22_), v23_(other.v23_), v24_(other.v24_), v25_(other.v25_), v26_(other.v26_), v27_(other.v27_), v28_(other.v28_), v29_(other.v29_), v30_(other.v30_), v31_(other.v31_), v32_(other.v32_), v33_(other.v33_), v34_(other.v34_), v35_(other.v35_), v36_(other.v36_), v37_(other.v37_), v38_(other.v38_), v39_(other.v39_), v40_(other.v40_), v41_(other.v41_) {} private: // No implementation - assignment is unsupported. void operator=(const ValueArray41& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; const T22 v22_; const T23 v23_; const T24 v24_; const T25 v25_; const T26 v26_; const T27 v27_; const T28 v28_; const T29 v29_; const T30 v30_; const T31 v31_; const T32 v32_; const T33 v33_; const T34 v34_; const T35 v35_; const T36 v36_; const T37 v37_; const T38 v38_; const T39 v39_; const T40 v40_; const T41 v41_; }; template class ValueArray42 { public: ValueArray42(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41, T42 v42) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40), v41_(v41), v42_(v42) {} template operator ParamGenerator() const { const T array[] = {static_cast(v1_), static_cast(v2_), static_cast(v3_), static_cast(v4_), static_cast(v5_), static_cast(v6_), static_cast(v7_), static_cast(v8_), static_cast(v9_), static_cast(v10_), static_cast(v11_), static_cast(v12_), static_cast(v13_), static_cast(v14_), static_cast(v15_), static_cast(v16_), static_cast(v17_), static_cast(v18_), static_cast(v19_), static_cast(v20_), static_cast(v21_), static_cast(v22_), static_cast(v23_), static_cast(v24_), static_cast(v25_), static_cast(v26_), static_cast(v27_), static_cast(v28_), static_cast(v29_), static_cast(v30_), static_cast(v31_), static_cast(v32_), static_cast(v33_), static_cast(v34_), static_cast(v35_), static_cast(v36_), static_cast(v37_), static_cast(v38_), static_cast(v39_), static_cast(v40_), static_cast(v41_), static_cast(v42_)}; return ValuesIn(array); } ValueArray42(const ValueArray42& other) : v1_(other.v1_), v2_(other.v2_), v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_), v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_), v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_), v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_), v19_(other.v19_), v20_(other.v20_), v21_(other.v21_), v22_(other.v22_), v23_(other.v23_), v24_(other.v24_), v25_(other.v25_), v26_(other.v26_), v27_(other.v27_), v28_(other.v28_), v29_(other.v29_), v30_(other.v30_), v31_(other.v31_), v32_(other.v32_), v33_(other.v33_), v34_(other.v34_), v35_(other.v35_), v36_(other.v36_), v37_(other.v37_), v38_(other.v38_), v39_(other.v39_), v40_(other.v40_), v41_(other.v41_), v42_(other.v42_) {} private: // No implementation - assignment is unsupported. void operator=(const ValueArray42& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; const T22 v22_; const T23 v23_; const T24 v24_; const T25 v25_; const T26 v26_; const T27 v27_; const T28 v28_; const T29 v29_; const T30 v30_; const T31 v31_; const T32 v32_; const T33 v33_; const T34 v34_; const T35 v35_; const T36 v36_; const T37 v37_; const T38 v38_; const T39 v39_; const T40 v40_; const T41 v41_; const T42 v42_; }; template class ValueArray43 { public: ValueArray43(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41, T42 v42, T43 v43) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40), v41_(v41), v42_(v42), v43_(v43) {} template operator ParamGenerator() const { const T array[] = {static_cast(v1_), static_cast(v2_), static_cast(v3_), static_cast(v4_), static_cast(v5_), static_cast(v6_), static_cast(v7_), static_cast(v8_), static_cast(v9_), static_cast(v10_), static_cast(v11_), static_cast(v12_), static_cast(v13_), static_cast(v14_), static_cast(v15_), static_cast(v16_), static_cast(v17_), static_cast(v18_), static_cast(v19_), static_cast(v20_), static_cast(v21_), static_cast(v22_), static_cast(v23_), static_cast(v24_), static_cast(v25_), static_cast(v26_), static_cast(v27_), static_cast(v28_), static_cast(v29_), static_cast(v30_), static_cast(v31_), static_cast(v32_), static_cast(v33_), static_cast(v34_), static_cast(v35_), static_cast(v36_), static_cast(v37_), static_cast(v38_), static_cast(v39_), static_cast(v40_), static_cast(v41_), static_cast(v42_), static_cast(v43_)}; return ValuesIn(array); } ValueArray43(const ValueArray43& other) : v1_(other.v1_), v2_(other.v2_), v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_), v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_), v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_), v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_), v19_(other.v19_), v20_(other.v20_), v21_(other.v21_), v22_(other.v22_), v23_(other.v23_), v24_(other.v24_), v25_(other.v25_), v26_(other.v26_), v27_(other.v27_), v28_(other.v28_), v29_(other.v29_), v30_(other.v30_), v31_(other.v31_), v32_(other.v32_), v33_(other.v33_), v34_(other.v34_), v35_(other.v35_), v36_(other.v36_), v37_(other.v37_), v38_(other.v38_), v39_(other.v39_), v40_(other.v40_), v41_(other.v41_), v42_(other.v42_), v43_(other.v43_) {} private: // No implementation - assignment is unsupported. void operator=(const ValueArray43& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; const T22 v22_; const T23 v23_; const T24 v24_; const T25 v25_; const T26 v26_; const T27 v27_; const T28 v28_; const T29 v29_; const T30 v30_; const T31 v31_; const T32 v32_; const T33 v33_; const T34 v34_; const T35 v35_; const T36 v36_; const T37 v37_; const T38 v38_; const T39 v39_; const T40 v40_; const T41 v41_; const T42 v42_; const T43 v43_; }; template class ValueArray44 { public: ValueArray44(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41, T42 v42, T43 v43, T44 v44) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40), v41_(v41), v42_(v42), v43_(v43), v44_(v44) {} template operator ParamGenerator() const { const T array[] = {static_cast(v1_), static_cast(v2_), static_cast(v3_), static_cast(v4_), static_cast(v5_), static_cast(v6_), static_cast(v7_), static_cast(v8_), static_cast(v9_), static_cast(v10_), static_cast(v11_), static_cast(v12_), static_cast(v13_), static_cast(v14_), static_cast(v15_), static_cast(v16_), static_cast(v17_), static_cast(v18_), static_cast(v19_), static_cast(v20_), static_cast(v21_), static_cast(v22_), static_cast(v23_), static_cast(v24_), static_cast(v25_), static_cast(v26_), static_cast(v27_), static_cast(v28_), static_cast(v29_), static_cast(v30_), static_cast(v31_), static_cast(v32_), static_cast(v33_), static_cast(v34_), static_cast(v35_), static_cast(v36_), static_cast(v37_), static_cast(v38_), static_cast(v39_), static_cast(v40_), static_cast(v41_), static_cast(v42_), static_cast(v43_), static_cast(v44_)}; return ValuesIn(array); } ValueArray44(const ValueArray44& other) : v1_(other.v1_), v2_(other.v2_), v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_), v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_), v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_), v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_), v19_(other.v19_), v20_(other.v20_), v21_(other.v21_), v22_(other.v22_), v23_(other.v23_), v24_(other.v24_), v25_(other.v25_), v26_(other.v26_), v27_(other.v27_), v28_(other.v28_), v29_(other.v29_), v30_(other.v30_), v31_(other.v31_), v32_(other.v32_), v33_(other.v33_), v34_(other.v34_), v35_(other.v35_), v36_(other.v36_), v37_(other.v37_), v38_(other.v38_), v39_(other.v39_), v40_(other.v40_), v41_(other.v41_), v42_(other.v42_), v43_(other.v43_), v44_(other.v44_) {} private: // No implementation - assignment is unsupported. void operator=(const ValueArray44& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; const T22 v22_; const T23 v23_; const T24 v24_; const T25 v25_; const T26 v26_; const T27 v27_; const T28 v28_; const T29 v29_; const T30 v30_; const T31 v31_; const T32 v32_; const T33 v33_; const T34 v34_; const T35 v35_; const T36 v36_; const T37 v37_; const T38 v38_; const T39 v39_; const T40 v40_; const T41 v41_; const T42 v42_; const T43 v43_; const T44 v44_; }; template class ValueArray45 { public: ValueArray45(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40), v41_(v41), v42_(v42), v43_(v43), v44_(v44), v45_(v45) {} template operator ParamGenerator() const { const T array[] = {static_cast(v1_), static_cast(v2_), static_cast(v3_), static_cast(v4_), static_cast(v5_), static_cast(v6_), static_cast(v7_), static_cast(v8_), static_cast(v9_), static_cast(v10_), static_cast(v11_), static_cast(v12_), static_cast(v13_), static_cast(v14_), static_cast(v15_), static_cast(v16_), static_cast(v17_), static_cast(v18_), static_cast(v19_), static_cast(v20_), static_cast(v21_), static_cast(v22_), static_cast(v23_), static_cast(v24_), static_cast(v25_), static_cast(v26_), static_cast(v27_), static_cast(v28_), static_cast(v29_), static_cast(v30_), static_cast(v31_), static_cast(v32_), static_cast(v33_), static_cast(v34_), static_cast(v35_), static_cast(v36_), static_cast(v37_), static_cast(v38_), static_cast(v39_), static_cast(v40_), static_cast(v41_), static_cast(v42_), static_cast(v43_), static_cast(v44_), static_cast(v45_)}; return ValuesIn(array); } ValueArray45(const ValueArray45& other) : v1_(other.v1_), v2_(other.v2_), v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_), v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_), v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_), v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_), v19_(other.v19_), v20_(other.v20_), v21_(other.v21_), v22_(other.v22_), v23_(other.v23_), v24_(other.v24_), v25_(other.v25_), v26_(other.v26_), v27_(other.v27_), v28_(other.v28_), v29_(other.v29_), v30_(other.v30_), v31_(other.v31_), v32_(other.v32_), v33_(other.v33_), v34_(other.v34_), v35_(other.v35_), v36_(other.v36_), v37_(other.v37_), v38_(other.v38_), v39_(other.v39_), v40_(other.v40_), v41_(other.v41_), v42_(other.v42_), v43_(other.v43_), v44_(other.v44_), v45_(other.v45_) {} private: // No implementation - assignment is unsupported. void operator=(const ValueArray45& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; const T22 v22_; const T23 v23_; const T24 v24_; const T25 v25_; const T26 v26_; const T27 v27_; const T28 v28_; const T29 v29_; const T30 v30_; const T31 v31_; const T32 v32_; const T33 v33_; const T34 v34_; const T35 v35_; const T36 v36_; const T37 v37_; const T38 v38_; const T39 v39_; const T40 v40_; const T41 v41_; const T42 v42_; const T43 v43_; const T44 v44_; const T45 v45_; }; template class ValueArray46 { public: ValueArray46(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40), v41_(v41), v42_(v42), v43_(v43), v44_(v44), v45_(v45), v46_(v46) {} template operator ParamGenerator() const { const T array[] = {static_cast(v1_), static_cast(v2_), static_cast(v3_), static_cast(v4_), static_cast(v5_), static_cast(v6_), static_cast(v7_), static_cast(v8_), static_cast(v9_), static_cast(v10_), static_cast(v11_), static_cast(v12_), static_cast(v13_), static_cast(v14_), static_cast(v15_), static_cast(v16_), static_cast(v17_), static_cast(v18_), static_cast(v19_), static_cast(v20_), static_cast(v21_), static_cast(v22_), static_cast(v23_), static_cast(v24_), static_cast(v25_), static_cast(v26_), static_cast(v27_), static_cast(v28_), static_cast(v29_), static_cast(v30_), static_cast(v31_), static_cast(v32_), static_cast(v33_), static_cast(v34_), static_cast(v35_), static_cast(v36_), static_cast(v37_), static_cast(v38_), static_cast(v39_), static_cast(v40_), static_cast(v41_), static_cast(v42_), static_cast(v43_), static_cast(v44_), static_cast(v45_), static_cast(v46_)}; return ValuesIn(array); } ValueArray46(const ValueArray46& other) : v1_(other.v1_), v2_(other.v2_), v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_), v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_), v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_), v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_), v19_(other.v19_), v20_(other.v20_), v21_(other.v21_), v22_(other.v22_), v23_(other.v23_), v24_(other.v24_), v25_(other.v25_), v26_(other.v26_), v27_(other.v27_), v28_(other.v28_), v29_(other.v29_), v30_(other.v30_), v31_(other.v31_), v32_(other.v32_), v33_(other.v33_), v34_(other.v34_), v35_(other.v35_), v36_(other.v36_), v37_(other.v37_), v38_(other.v38_), v39_(other.v39_), v40_(other.v40_), v41_(other.v41_), v42_(other.v42_), v43_(other.v43_), v44_(other.v44_), v45_(other.v45_), v46_(other.v46_) {} private: // No implementation - assignment is unsupported. void operator=(const ValueArray46& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; const T22 v22_; const T23 v23_; const T24 v24_; const T25 v25_; const T26 v26_; const T27 v27_; const T28 v28_; const T29 v29_; const T30 v30_; const T31 v31_; const T32 v32_; const T33 v33_; const T34 v34_; const T35 v35_; const T36 v36_; const T37 v37_; const T38 v38_; const T39 v39_; const T40 v40_; const T41 v41_; const T42 v42_; const T43 v43_; const T44 v44_; const T45 v45_; const T46 v46_; }; template class ValueArray47 { public: ValueArray47(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40), v41_(v41), v42_(v42), v43_(v43), v44_(v44), v45_(v45), v46_(v46), v47_(v47) {} template operator ParamGenerator() const { const T array[] = {static_cast(v1_), static_cast(v2_), static_cast(v3_), static_cast(v4_), static_cast(v5_), static_cast(v6_), static_cast(v7_), static_cast(v8_), static_cast(v9_), static_cast(v10_), static_cast(v11_), static_cast(v12_), static_cast(v13_), static_cast(v14_), static_cast(v15_), static_cast(v16_), static_cast(v17_), static_cast(v18_), static_cast(v19_), static_cast(v20_), static_cast(v21_), static_cast(v22_), static_cast(v23_), static_cast(v24_), static_cast(v25_), static_cast(v26_), static_cast(v27_), static_cast(v28_), static_cast(v29_), static_cast(v30_), static_cast(v31_), static_cast(v32_), static_cast(v33_), static_cast(v34_), static_cast(v35_), static_cast(v36_), static_cast(v37_), static_cast(v38_), static_cast(v39_), static_cast(v40_), static_cast(v41_), static_cast(v42_), static_cast(v43_), static_cast(v44_), static_cast(v45_), static_cast(v46_), static_cast(v47_)}; return ValuesIn(array); } ValueArray47(const ValueArray47& other) : v1_(other.v1_), v2_(other.v2_), v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_), v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_), v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_), v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_), v19_(other.v19_), v20_(other.v20_), v21_(other.v21_), v22_(other.v22_), v23_(other.v23_), v24_(other.v24_), v25_(other.v25_), v26_(other.v26_), v27_(other.v27_), v28_(other.v28_), v29_(other.v29_), v30_(other.v30_), v31_(other.v31_), v32_(other.v32_), v33_(other.v33_), v34_(other.v34_), v35_(other.v35_), v36_(other.v36_), v37_(other.v37_), v38_(other.v38_), v39_(other.v39_), v40_(other.v40_), v41_(other.v41_), v42_(other.v42_), v43_(other.v43_), v44_(other.v44_), v45_(other.v45_), v46_(other.v46_), v47_(other.v47_) {} private: // No implementation - assignment is unsupported. void operator=(const ValueArray47& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; const T22 v22_; const T23 v23_; const T24 v24_; const T25 v25_; const T26 v26_; const T27 v27_; const T28 v28_; const T29 v29_; const T30 v30_; const T31 v31_; const T32 v32_; const T33 v33_; const T34 v34_; const T35 v35_; const T36 v36_; const T37 v37_; const T38 v38_; const T39 v39_; const T40 v40_; const T41 v41_; const T42 v42_; const T43 v43_; const T44 v44_; const T45 v45_; const T46 v46_; const T47 v47_; }; template class ValueArray48 { public: ValueArray48(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47, T48 v48) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40), v41_(v41), v42_(v42), v43_(v43), v44_(v44), v45_(v45), v46_(v46), v47_(v47), v48_(v48) {} template operator ParamGenerator() const { const T array[] = {static_cast(v1_), static_cast(v2_), static_cast(v3_), static_cast(v4_), static_cast(v5_), static_cast(v6_), static_cast(v7_), static_cast(v8_), static_cast(v9_), static_cast(v10_), static_cast(v11_), static_cast(v12_), static_cast(v13_), static_cast(v14_), static_cast(v15_), static_cast(v16_), static_cast(v17_), static_cast(v18_), static_cast(v19_), static_cast(v20_), static_cast(v21_), static_cast(v22_), static_cast(v23_), static_cast(v24_), static_cast(v25_), static_cast(v26_), static_cast(v27_), static_cast(v28_), static_cast(v29_), static_cast(v30_), static_cast(v31_), static_cast(v32_), static_cast(v33_), static_cast(v34_), static_cast(v35_), static_cast(v36_), static_cast(v37_), static_cast(v38_), static_cast(v39_), static_cast(v40_), static_cast(v41_), static_cast(v42_), static_cast(v43_), static_cast(v44_), static_cast(v45_), static_cast(v46_), static_cast(v47_), static_cast(v48_)}; return ValuesIn(array); } ValueArray48(const ValueArray48& other) : v1_(other.v1_), v2_(other.v2_), v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_), v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_), v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_), v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_), v19_(other.v19_), v20_(other.v20_), v21_(other.v21_), v22_(other.v22_), v23_(other.v23_), v24_(other.v24_), v25_(other.v25_), v26_(other.v26_), v27_(other.v27_), v28_(other.v28_), v29_(other.v29_), v30_(other.v30_), v31_(other.v31_), v32_(other.v32_), v33_(other.v33_), v34_(other.v34_), v35_(other.v35_), v36_(other.v36_), v37_(other.v37_), v38_(other.v38_), v39_(other.v39_), v40_(other.v40_), v41_(other.v41_), v42_(other.v42_), v43_(other.v43_), v44_(other.v44_), v45_(other.v45_), v46_(other.v46_), v47_(other.v47_), v48_(other.v48_) {} private: // No implementation - assignment is unsupported. void operator=(const ValueArray48& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; const T22 v22_; const T23 v23_; const T24 v24_; const T25 v25_; const T26 v26_; const T27 v27_; const T28 v28_; const T29 v29_; const T30 v30_; const T31 v31_; const T32 v32_; const T33 v33_; const T34 v34_; const T35 v35_; const T36 v36_; const T37 v37_; const T38 v38_; const T39 v39_; const T40 v40_; const T41 v41_; const T42 v42_; const T43 v43_; const T44 v44_; const T45 v45_; const T46 v46_; const T47 v47_; const T48 v48_; }; template class ValueArray49 { public: ValueArray49(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47, T48 v48, T49 v49) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40), v41_(v41), v42_(v42), v43_(v43), v44_(v44), v45_(v45), v46_(v46), v47_(v47), v48_(v48), v49_(v49) {} template operator ParamGenerator() const { const T array[] = {static_cast(v1_), static_cast(v2_), static_cast(v3_), static_cast(v4_), static_cast(v5_), static_cast(v6_), static_cast(v7_), static_cast(v8_), static_cast(v9_), static_cast(v10_), static_cast(v11_), static_cast(v12_), static_cast(v13_), static_cast(v14_), static_cast(v15_), static_cast(v16_), static_cast(v17_), static_cast(v18_), static_cast(v19_), static_cast(v20_), static_cast(v21_), static_cast(v22_), static_cast(v23_), static_cast(v24_), static_cast(v25_), static_cast(v26_), static_cast(v27_), static_cast(v28_), static_cast(v29_), static_cast(v30_), static_cast(v31_), static_cast(v32_), static_cast(v33_), static_cast(v34_), static_cast(v35_), static_cast(v36_), static_cast(v37_), static_cast(v38_), static_cast(v39_), static_cast(v40_), static_cast(v41_), static_cast(v42_), static_cast(v43_), static_cast(v44_), static_cast(v45_), static_cast(v46_), static_cast(v47_), static_cast(v48_), static_cast(v49_)}; return ValuesIn(array); } ValueArray49(const ValueArray49& other) : v1_(other.v1_), v2_(other.v2_), v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_), v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_), v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_), v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_), v19_(other.v19_), v20_(other.v20_), v21_(other.v21_), v22_(other.v22_), v23_(other.v23_), v24_(other.v24_), v25_(other.v25_), v26_(other.v26_), v27_(other.v27_), v28_(other.v28_), v29_(other.v29_), v30_(other.v30_), v31_(other.v31_), v32_(other.v32_), v33_(other.v33_), v34_(other.v34_), v35_(other.v35_), v36_(other.v36_), v37_(other.v37_), v38_(other.v38_), v39_(other.v39_), v40_(other.v40_), v41_(other.v41_), v42_(other.v42_), v43_(other.v43_), v44_(other.v44_), v45_(other.v45_), v46_(other.v46_), v47_(other.v47_), v48_(other.v48_), v49_(other.v49_) {} private: // No implementation - assignment is unsupported. void operator=(const ValueArray49& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; const T22 v22_; const T23 v23_; const T24 v24_; const T25 v25_; const T26 v26_; const T27 v27_; const T28 v28_; const T29 v29_; const T30 v30_; const T31 v31_; const T32 v32_; const T33 v33_; const T34 v34_; const T35 v35_; const T36 v36_; const T37 v37_; const T38 v38_; const T39 v39_; const T40 v40_; const T41 v41_; const T42 v42_; const T43 v43_; const T44 v44_; const T45 v45_; const T46 v46_; const T47 v47_; const T48 v48_; const T49 v49_; }; template class ValueArray50 { public: ValueArray50(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47, T48 v48, T49 v49, T50 v50) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40), v41_(v41), v42_(v42), v43_(v43), v44_(v44), v45_(v45), v46_(v46), v47_(v47), v48_(v48), v49_(v49), v50_(v50) {} template operator ParamGenerator() const { const T array[] = {static_cast(v1_), static_cast(v2_), static_cast(v3_), static_cast(v4_), static_cast(v5_), static_cast(v6_), static_cast(v7_), static_cast(v8_), static_cast(v9_), static_cast(v10_), static_cast(v11_), static_cast(v12_), static_cast(v13_), static_cast(v14_), static_cast(v15_), static_cast(v16_), static_cast(v17_), static_cast(v18_), static_cast(v19_), static_cast(v20_), static_cast(v21_), static_cast(v22_), static_cast(v23_), static_cast(v24_), static_cast(v25_), static_cast(v26_), static_cast(v27_), static_cast(v28_), static_cast(v29_), static_cast(v30_), static_cast(v31_), static_cast(v32_), static_cast(v33_), static_cast(v34_), static_cast(v35_), static_cast(v36_), static_cast(v37_), static_cast(v38_), static_cast(v39_), static_cast(v40_), static_cast(v41_), static_cast(v42_), static_cast(v43_), static_cast(v44_), static_cast(v45_), static_cast(v46_), static_cast(v47_), static_cast(v48_), static_cast(v49_), static_cast(v50_)}; return ValuesIn(array); } ValueArray50(const ValueArray50& other) : v1_(other.v1_), v2_(other.v2_), v3_(other.v3_), v4_(other.v4_), v5_(other.v5_), v6_(other.v6_), v7_(other.v7_), v8_(other.v8_), v9_(other.v9_), v10_(other.v10_), v11_(other.v11_), v12_(other.v12_), v13_(other.v13_), v14_(other.v14_), v15_(other.v15_), v16_(other.v16_), v17_(other.v17_), v18_(other.v18_), v19_(other.v19_), v20_(other.v20_), v21_(other.v21_), v22_(other.v22_), v23_(other.v23_), v24_(other.v24_), v25_(other.v25_), v26_(other.v26_), v27_(other.v27_), v28_(other.v28_), v29_(other.v29_), v30_(other.v30_), v31_(other.v31_), v32_(other.v32_), v33_(other.v33_), v34_(other.v34_), v35_(other.v35_), v36_(other.v36_), v37_(other.v37_), v38_(other.v38_), v39_(other.v39_), v40_(other.v40_), v41_(other.v41_), v42_(other.v42_), v43_(other.v43_), v44_(other.v44_), v45_(other.v45_), v46_(other.v46_), v47_(other.v47_), v48_(other.v48_), v49_(other.v49_), v50_(other.v50_) {} private: // No implementation - assignment is unsupported. void operator=(const ValueArray50& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; const T22 v22_; const T23 v23_; const T24 v24_; const T25 v25_; const T26 v26_; const T27 v27_; const T28 v28_; const T29 v29_; const T30 v30_; const T31 v31_; const T32 v32_; const T33 v33_; const T34 v34_; const T35 v35_; const T36 v36_; const T37 v37_; const T38 v38_; const T39 v39_; const T40 v40_; const T41 v41_; const T42 v42_; const T43 v43_; const T44 v44_; const T45 v45_; const T46 v46_; const T47 v47_; const T48 v48_; const T49 v49_; const T50 v50_; }; # if GTEST_HAS_COMBINE // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. // // Generates values from the Cartesian product of values produced // by the argument generators. // template class CartesianProductGenerator2 : public ParamGeneratorInterface< ::testing::tuple > { public: typedef ::testing::tuple ParamType; CartesianProductGenerator2(const ParamGenerator& g1, const ParamGenerator& g2) : g1_(g1), g2_(g2) {} virtual ~CartesianProductGenerator2() {} virtual ParamIteratorInterface* Begin() const { return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin()); } virtual ParamIteratorInterface* End() const { return new Iterator(this, g1_, g1_.end(), g2_, g2_.end()); } private: class Iterator : public ParamIteratorInterface { public: Iterator(const ParamGeneratorInterface* base, const ParamGenerator& g1, const typename ParamGenerator::iterator& current1, const ParamGenerator& g2, const typename ParamGenerator::iterator& current2) : base_(base), begin1_(g1.begin()), end1_(g1.end()), current1_(current1), begin2_(g2.begin()), end2_(g2.end()), current2_(current2) { ComputeCurrentValue(); } virtual ~Iterator() {} virtual const ParamGeneratorInterface* BaseGenerator() const { return base_; } // Advance should not be called on beyond-of-range iterators // so no component iterators must be beyond end of range, either. virtual void Advance() { assert(!AtEnd()); ++current2_; if (current2_ == end2_) { current2_ = begin2_; ++current1_; } ComputeCurrentValue(); } virtual ParamIteratorInterface* Clone() const { return new Iterator(*this); } virtual const ParamType* Current() const { return current_value_.get(); } virtual bool Equals(const ParamIteratorInterface& other) const { // Having the same base generator guarantees that the other // iterator is of the same type and we can downcast. GTEST_CHECK_(BaseGenerator() == other.BaseGenerator()) << "The program attempted to compare iterators " << "from different generators." << std::endl; const Iterator* typed_other = CheckedDowncastToActualType(&other); // We must report iterators equal if they both point beyond their // respective ranges. That can happen in a variety of fashions, // so we have to consult AtEnd(). return (AtEnd() && typed_other->AtEnd()) || ( current1_ == typed_other->current1_ && current2_ == typed_other->current2_); } private: Iterator(const Iterator& other) : base_(other.base_), begin1_(other.begin1_), end1_(other.end1_), current1_(other.current1_), begin2_(other.begin2_), end2_(other.end2_), current2_(other.current2_) { ComputeCurrentValue(); } void ComputeCurrentValue() { if (!AtEnd()) current_value_.reset(new ParamType(*current1_, *current2_)); } bool AtEnd() const { // We must report iterator past the end of the range when either of the // component iterators has reached the end of its range. return current1_ == end1_ || current2_ == end2_; } // No implementation - assignment is unsupported. void operator=(const Iterator& other); const ParamGeneratorInterface* const base_; // begin[i]_ and end[i]_ define the i-th range that Iterator traverses. // current[i]_ is the actual traversing iterator. const typename ParamGenerator::iterator begin1_; const typename ParamGenerator::iterator end1_; typename ParamGenerator::iterator current1_; const typename ParamGenerator::iterator begin2_; const typename ParamGenerator::iterator end2_; typename ParamGenerator::iterator current2_; linked_ptr current_value_; }; // class CartesianProductGenerator2::Iterator // No implementation - assignment is unsupported. void operator=(const CartesianProductGenerator2& other); const ParamGenerator g1_; const ParamGenerator g2_; }; // class CartesianProductGenerator2 template class CartesianProductGenerator3 : public ParamGeneratorInterface< ::testing::tuple > { public: typedef ::testing::tuple ParamType; CartesianProductGenerator3(const ParamGenerator& g1, const ParamGenerator& g2, const ParamGenerator& g3) : g1_(g1), g2_(g2), g3_(g3) {} virtual ~CartesianProductGenerator3() {} virtual ParamIteratorInterface* Begin() const { return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_, g3_.begin()); } virtual ParamIteratorInterface* End() const { return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end()); } private: class Iterator : public ParamIteratorInterface { public: Iterator(const ParamGeneratorInterface* base, const ParamGenerator& g1, const typename ParamGenerator::iterator& current1, const ParamGenerator& g2, const typename ParamGenerator::iterator& current2, const ParamGenerator& g3, const typename ParamGenerator::iterator& current3) : base_(base), begin1_(g1.begin()), end1_(g1.end()), current1_(current1), begin2_(g2.begin()), end2_(g2.end()), current2_(current2), begin3_(g3.begin()), end3_(g3.end()), current3_(current3) { ComputeCurrentValue(); } virtual ~Iterator() {} virtual const ParamGeneratorInterface* BaseGenerator() const { return base_; } // Advance should not be called on beyond-of-range iterators // so no component iterators must be beyond end of range, either. virtual void Advance() { assert(!AtEnd()); ++current3_; if (current3_ == end3_) { current3_ = begin3_; ++current2_; } if (current2_ == end2_) { current2_ = begin2_; ++current1_; } ComputeCurrentValue(); } virtual ParamIteratorInterface* Clone() const { return new Iterator(*this); } virtual const ParamType* Current() const { return current_value_.get(); } virtual bool Equals(const ParamIteratorInterface& other) const { // Having the same base generator guarantees that the other // iterator is of the same type and we can downcast. GTEST_CHECK_(BaseGenerator() == other.BaseGenerator()) << "The program attempted to compare iterators " << "from different generators." << std::endl; const Iterator* typed_other = CheckedDowncastToActualType(&other); // We must report iterators equal if they both point beyond their // respective ranges. That can happen in a variety of fashions, // so we have to consult AtEnd(). return (AtEnd() && typed_other->AtEnd()) || ( current1_ == typed_other->current1_ && current2_ == typed_other->current2_ && current3_ == typed_other->current3_); } private: Iterator(const Iterator& other) : base_(other.base_), begin1_(other.begin1_), end1_(other.end1_), current1_(other.current1_), begin2_(other.begin2_), end2_(other.end2_), current2_(other.current2_), begin3_(other.begin3_), end3_(other.end3_), current3_(other.current3_) { ComputeCurrentValue(); } void ComputeCurrentValue() { if (!AtEnd()) current_value_.reset(new ParamType(*current1_, *current2_, *current3_)); } bool AtEnd() const { // We must report iterator past the end of the range when either of the // component iterators has reached the end of its range. return current1_ == end1_ || current2_ == end2_ || current3_ == end3_; } // No implementation - assignment is unsupported. void operator=(const Iterator& other); const ParamGeneratorInterface* const base_; // begin[i]_ and end[i]_ define the i-th range that Iterator traverses. // current[i]_ is the actual traversing iterator. const typename ParamGenerator::iterator begin1_; const typename ParamGenerator::iterator end1_; typename ParamGenerator::iterator current1_; const typename ParamGenerator::iterator begin2_; const typename ParamGenerator::iterator end2_; typename ParamGenerator::iterator current2_; const typename ParamGenerator::iterator begin3_; const typename ParamGenerator::iterator end3_; typename ParamGenerator::iterator current3_; linked_ptr current_value_; }; // class CartesianProductGenerator3::Iterator // No implementation - assignment is unsupported. void operator=(const CartesianProductGenerator3& other); const ParamGenerator g1_; const ParamGenerator g2_; const ParamGenerator g3_; }; // class CartesianProductGenerator3 template class CartesianProductGenerator4 : public ParamGeneratorInterface< ::testing::tuple > { public: typedef ::testing::tuple ParamType; CartesianProductGenerator4(const ParamGenerator& g1, const ParamGenerator& g2, const ParamGenerator& g3, const ParamGenerator& g4) : g1_(g1), g2_(g2), g3_(g3), g4_(g4) {} virtual ~CartesianProductGenerator4() {} virtual ParamIteratorInterface* Begin() const { return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_, g3_.begin(), g4_, g4_.begin()); } virtual ParamIteratorInterface* End() const { return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(), g4_, g4_.end()); } private: class Iterator : public ParamIteratorInterface { public: Iterator(const ParamGeneratorInterface* base, const ParamGenerator& g1, const typename ParamGenerator::iterator& current1, const ParamGenerator& g2, const typename ParamGenerator::iterator& current2, const ParamGenerator& g3, const typename ParamGenerator::iterator& current3, const ParamGenerator& g4, const typename ParamGenerator::iterator& current4) : base_(base), begin1_(g1.begin()), end1_(g1.end()), current1_(current1), begin2_(g2.begin()), end2_(g2.end()), current2_(current2), begin3_(g3.begin()), end3_(g3.end()), current3_(current3), begin4_(g4.begin()), end4_(g4.end()), current4_(current4) { ComputeCurrentValue(); } virtual ~Iterator() {} virtual const ParamGeneratorInterface* BaseGenerator() const { return base_; } // Advance should not be called on beyond-of-range iterators // so no component iterators must be beyond end of range, either. virtual void Advance() { assert(!AtEnd()); ++current4_; if (current4_ == end4_) { current4_ = begin4_; ++current3_; } if (current3_ == end3_) { current3_ = begin3_; ++current2_; } if (current2_ == end2_) { current2_ = begin2_; ++current1_; } ComputeCurrentValue(); } virtual ParamIteratorInterface* Clone() const { return new Iterator(*this); } virtual const ParamType* Current() const { return current_value_.get(); } virtual bool Equals(const ParamIteratorInterface& other) const { // Having the same base generator guarantees that the other // iterator is of the same type and we can downcast. GTEST_CHECK_(BaseGenerator() == other.BaseGenerator()) << "The program attempted to compare iterators " << "from different generators." << std::endl; const Iterator* typed_other = CheckedDowncastToActualType(&other); // We must report iterators equal if they both point beyond their // respective ranges. That can happen in a variety of fashions, // so we have to consult AtEnd(). return (AtEnd() && typed_other->AtEnd()) || ( current1_ == typed_other->current1_ && current2_ == typed_other->current2_ && current3_ == typed_other->current3_ && current4_ == typed_other->current4_); } private: Iterator(const Iterator& other) : base_(other.base_), begin1_(other.begin1_), end1_(other.end1_), current1_(other.current1_), begin2_(other.begin2_), end2_(other.end2_), current2_(other.current2_), begin3_(other.begin3_), end3_(other.end3_), current3_(other.current3_), begin4_(other.begin4_), end4_(other.end4_), current4_(other.current4_) { ComputeCurrentValue(); } void ComputeCurrentValue() { if (!AtEnd()) current_value_.reset(new ParamType(*current1_, *current2_, *current3_, *current4_)); } bool AtEnd() const { // We must report iterator past the end of the range when either of the // component iterators has reached the end of its range. return current1_ == end1_ || current2_ == end2_ || current3_ == end3_ || current4_ == end4_; } // No implementation - assignment is unsupported. void operator=(const Iterator& other); const ParamGeneratorInterface* const base_; // begin[i]_ and end[i]_ define the i-th range that Iterator traverses. // current[i]_ is the actual traversing iterator. const typename ParamGenerator::iterator begin1_; const typename ParamGenerator::iterator end1_; typename ParamGenerator::iterator current1_; const typename ParamGenerator::iterator begin2_; const typename ParamGenerator::iterator end2_; typename ParamGenerator::iterator current2_; const typename ParamGenerator::iterator begin3_; const typename ParamGenerator::iterator end3_; typename ParamGenerator::iterator current3_; const typename ParamGenerator::iterator begin4_; const typename ParamGenerator::iterator end4_; typename ParamGenerator::iterator current4_; linked_ptr current_value_; }; // class CartesianProductGenerator4::Iterator // No implementation - assignment is unsupported. void operator=(const CartesianProductGenerator4& other); const ParamGenerator g1_; const ParamGenerator g2_; const ParamGenerator g3_; const ParamGenerator g4_; }; // class CartesianProductGenerator4 template class CartesianProductGenerator5 : public ParamGeneratorInterface< ::testing::tuple > { public: typedef ::testing::tuple ParamType; CartesianProductGenerator5(const ParamGenerator& g1, const ParamGenerator& g2, const ParamGenerator& g3, const ParamGenerator& g4, const ParamGenerator& g5) : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5) {} virtual ~CartesianProductGenerator5() {} virtual ParamIteratorInterface* Begin() const { return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_, g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin()); } virtual ParamIteratorInterface* End() const { return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(), g4_, g4_.end(), g5_, g5_.end()); } private: class Iterator : public ParamIteratorInterface { public: Iterator(const ParamGeneratorInterface* base, const ParamGenerator& g1, const typename ParamGenerator::iterator& current1, const ParamGenerator& g2, const typename ParamGenerator::iterator& current2, const ParamGenerator& g3, const typename ParamGenerator::iterator& current3, const ParamGenerator& g4, const typename ParamGenerator::iterator& current4, const ParamGenerator& g5, const typename ParamGenerator::iterator& current5) : base_(base), begin1_(g1.begin()), end1_(g1.end()), current1_(current1), begin2_(g2.begin()), end2_(g2.end()), current2_(current2), begin3_(g3.begin()), end3_(g3.end()), current3_(current3), begin4_(g4.begin()), end4_(g4.end()), current4_(current4), begin5_(g5.begin()), end5_(g5.end()), current5_(current5) { ComputeCurrentValue(); } virtual ~Iterator() {} virtual const ParamGeneratorInterface* BaseGenerator() const { return base_; } // Advance should not be called on beyond-of-range iterators // so no component iterators must be beyond end of range, either. virtual void Advance() { assert(!AtEnd()); ++current5_; if (current5_ == end5_) { current5_ = begin5_; ++current4_; } if (current4_ == end4_) { current4_ = begin4_; ++current3_; } if (current3_ == end3_) { current3_ = begin3_; ++current2_; } if (current2_ == end2_) { current2_ = begin2_; ++current1_; } ComputeCurrentValue(); } virtual ParamIteratorInterface* Clone() const { return new Iterator(*this); } virtual const ParamType* Current() const { return current_value_.get(); } virtual bool Equals(const ParamIteratorInterface& other) const { // Having the same base generator guarantees that the other // iterator is of the same type and we can downcast. GTEST_CHECK_(BaseGenerator() == other.BaseGenerator()) << "The program attempted to compare iterators " << "from different generators." << std::endl; const Iterator* typed_other = CheckedDowncastToActualType(&other); // We must report iterators equal if they both point beyond their // respective ranges. That can happen in a variety of fashions, // so we have to consult AtEnd(). return (AtEnd() && typed_other->AtEnd()) || ( current1_ == typed_other->current1_ && current2_ == typed_other->current2_ && current3_ == typed_other->current3_ && current4_ == typed_other->current4_ && current5_ == typed_other->current5_); } private: Iterator(const Iterator& other) : base_(other.base_), begin1_(other.begin1_), end1_(other.end1_), current1_(other.current1_), begin2_(other.begin2_), end2_(other.end2_), current2_(other.current2_), begin3_(other.begin3_), end3_(other.end3_), current3_(other.current3_), begin4_(other.begin4_), end4_(other.end4_), current4_(other.current4_), begin5_(other.begin5_), end5_(other.end5_), current5_(other.current5_) { ComputeCurrentValue(); } void ComputeCurrentValue() { if (!AtEnd()) current_value_.reset(new ParamType(*current1_, *current2_, *current3_, *current4_, *current5_)); } bool AtEnd() const { // We must report iterator past the end of the range when either of the // component iterators has reached the end of its range. return current1_ == end1_ || current2_ == end2_ || current3_ == end3_ || current4_ == end4_ || current5_ == end5_; } // No implementation - assignment is unsupported. void operator=(const Iterator& other); const ParamGeneratorInterface* const base_; // begin[i]_ and end[i]_ define the i-th range that Iterator traverses. // current[i]_ is the actual traversing iterator. const typename ParamGenerator::iterator begin1_; const typename ParamGenerator::iterator end1_; typename ParamGenerator::iterator current1_; const typename ParamGenerator::iterator begin2_; const typename ParamGenerator::iterator end2_; typename ParamGenerator::iterator current2_; const typename ParamGenerator::iterator begin3_; const typename ParamGenerator::iterator end3_; typename ParamGenerator::iterator current3_; const typename ParamGenerator::iterator begin4_; const typename ParamGenerator::iterator end4_; typename ParamGenerator::iterator current4_; const typename ParamGenerator::iterator begin5_; const typename ParamGenerator::iterator end5_; typename ParamGenerator::iterator current5_; linked_ptr current_value_; }; // class CartesianProductGenerator5::Iterator // No implementation - assignment is unsupported. void operator=(const CartesianProductGenerator5& other); const ParamGenerator g1_; const ParamGenerator g2_; const ParamGenerator g3_; const ParamGenerator g4_; const ParamGenerator g5_; }; // class CartesianProductGenerator5 template class CartesianProductGenerator6 : public ParamGeneratorInterface< ::testing::tuple > { public: typedef ::testing::tuple ParamType; CartesianProductGenerator6(const ParamGenerator& g1, const ParamGenerator& g2, const ParamGenerator& g3, const ParamGenerator& g4, const ParamGenerator& g5, const ParamGenerator& g6) : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6) {} virtual ~CartesianProductGenerator6() {} virtual ParamIteratorInterface* Begin() const { return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_, g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin()); } virtual ParamIteratorInterface* End() const { return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(), g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end()); } private: class Iterator : public ParamIteratorInterface { public: Iterator(const ParamGeneratorInterface* base, const ParamGenerator& g1, const typename ParamGenerator::iterator& current1, const ParamGenerator& g2, const typename ParamGenerator::iterator& current2, const ParamGenerator& g3, const typename ParamGenerator::iterator& current3, const ParamGenerator& g4, const typename ParamGenerator::iterator& current4, const ParamGenerator& g5, const typename ParamGenerator::iterator& current5, const ParamGenerator& g6, const typename ParamGenerator::iterator& current6) : base_(base), begin1_(g1.begin()), end1_(g1.end()), current1_(current1), begin2_(g2.begin()), end2_(g2.end()), current2_(current2), begin3_(g3.begin()), end3_(g3.end()), current3_(current3), begin4_(g4.begin()), end4_(g4.end()), current4_(current4), begin5_(g5.begin()), end5_(g5.end()), current5_(current5), begin6_(g6.begin()), end6_(g6.end()), current6_(current6) { ComputeCurrentValue(); } virtual ~Iterator() {} virtual const ParamGeneratorInterface* BaseGenerator() const { return base_; } // Advance should not be called on beyond-of-range iterators // so no component iterators must be beyond end of range, either. virtual void Advance() { assert(!AtEnd()); ++current6_; if (current6_ == end6_) { current6_ = begin6_; ++current5_; } if (current5_ == end5_) { current5_ = begin5_; ++current4_; } if (current4_ == end4_) { current4_ = begin4_; ++current3_; } if (current3_ == end3_) { current3_ = begin3_; ++current2_; } if (current2_ == end2_) { current2_ = begin2_; ++current1_; } ComputeCurrentValue(); } virtual ParamIteratorInterface* Clone() const { return new Iterator(*this); } virtual const ParamType* Current() const { return current_value_.get(); } virtual bool Equals(const ParamIteratorInterface& other) const { // Having the same base generator guarantees that the other // iterator is of the same type and we can downcast. GTEST_CHECK_(BaseGenerator() == other.BaseGenerator()) << "The program attempted to compare iterators " << "from different generators." << std::endl; const Iterator* typed_other = CheckedDowncastToActualType(&other); // We must report iterators equal if they both point beyond their // respective ranges. That can happen in a variety of fashions, // so we have to consult AtEnd(). return (AtEnd() && typed_other->AtEnd()) || ( current1_ == typed_other->current1_ && current2_ == typed_other->current2_ && current3_ == typed_other->current3_ && current4_ == typed_other->current4_ && current5_ == typed_other->current5_ && current6_ == typed_other->current6_); } private: Iterator(const Iterator& other) : base_(other.base_), begin1_(other.begin1_), end1_(other.end1_), current1_(other.current1_), begin2_(other.begin2_), end2_(other.end2_), current2_(other.current2_), begin3_(other.begin3_), end3_(other.end3_), current3_(other.current3_), begin4_(other.begin4_), end4_(other.end4_), current4_(other.current4_), begin5_(other.begin5_), end5_(other.end5_), current5_(other.current5_), begin6_(other.begin6_), end6_(other.end6_), current6_(other.current6_) { ComputeCurrentValue(); } void ComputeCurrentValue() { if (!AtEnd()) current_value_.reset(new ParamType(*current1_, *current2_, *current3_, *current4_, *current5_, *current6_)); } bool AtEnd() const { // We must report iterator past the end of the range when either of the // component iterators has reached the end of its range. return current1_ == end1_ || current2_ == end2_ || current3_ == end3_ || current4_ == end4_ || current5_ == end5_ || current6_ == end6_; } // No implementation - assignment is unsupported. void operator=(const Iterator& other); const ParamGeneratorInterface* const base_; // begin[i]_ and end[i]_ define the i-th range that Iterator traverses. // current[i]_ is the actual traversing iterator. const typename ParamGenerator::iterator begin1_; const typename ParamGenerator::iterator end1_; typename ParamGenerator::iterator current1_; const typename ParamGenerator::iterator begin2_; const typename ParamGenerator::iterator end2_; typename ParamGenerator::iterator current2_; const typename ParamGenerator::iterator begin3_; const typename ParamGenerator::iterator end3_; typename ParamGenerator::iterator current3_; const typename ParamGenerator::iterator begin4_; const typename ParamGenerator::iterator end4_; typename ParamGenerator::iterator current4_; const typename ParamGenerator::iterator begin5_; const typename ParamGenerator::iterator end5_; typename ParamGenerator::iterator current5_; const typename ParamGenerator::iterator begin6_; const typename ParamGenerator::iterator end6_; typename ParamGenerator::iterator current6_; linked_ptr current_value_; }; // class CartesianProductGenerator6::Iterator // No implementation - assignment is unsupported. void operator=(const CartesianProductGenerator6& other); const ParamGenerator g1_; const ParamGenerator g2_; const ParamGenerator g3_; const ParamGenerator g4_; const ParamGenerator g5_; const ParamGenerator g6_; }; // class CartesianProductGenerator6 template class CartesianProductGenerator7 : public ParamGeneratorInterface< ::testing::tuple > { public: typedef ::testing::tuple ParamType; CartesianProductGenerator7(const ParamGenerator& g1, const ParamGenerator& g2, const ParamGenerator& g3, const ParamGenerator& g4, const ParamGenerator& g5, const ParamGenerator& g6, const ParamGenerator& g7) : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7) {} virtual ~CartesianProductGenerator7() {} virtual ParamIteratorInterface* Begin() const { return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_, g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_, g7_.begin()); } virtual ParamIteratorInterface* End() const { return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(), g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end()); } private: class Iterator : public ParamIteratorInterface { public: Iterator(const ParamGeneratorInterface* base, const ParamGenerator& g1, const typename ParamGenerator::iterator& current1, const ParamGenerator& g2, const typename ParamGenerator::iterator& current2, const ParamGenerator& g3, const typename ParamGenerator::iterator& current3, const ParamGenerator& g4, const typename ParamGenerator::iterator& current4, const ParamGenerator& g5, const typename ParamGenerator::iterator& current5, const ParamGenerator& g6, const typename ParamGenerator::iterator& current6, const ParamGenerator& g7, const typename ParamGenerator::iterator& current7) : base_(base), begin1_(g1.begin()), end1_(g1.end()), current1_(current1), begin2_(g2.begin()), end2_(g2.end()), current2_(current2), begin3_(g3.begin()), end3_(g3.end()), current3_(current3), begin4_(g4.begin()), end4_(g4.end()), current4_(current4), begin5_(g5.begin()), end5_(g5.end()), current5_(current5), begin6_(g6.begin()), end6_(g6.end()), current6_(current6), begin7_(g7.begin()), end7_(g7.end()), current7_(current7) { ComputeCurrentValue(); } virtual ~Iterator() {} virtual const ParamGeneratorInterface* BaseGenerator() const { return base_; } // Advance should not be called on beyond-of-range iterators // so no component iterators must be beyond end of range, either. virtual void Advance() { assert(!AtEnd()); ++current7_; if (current7_ == end7_) { current7_ = begin7_; ++current6_; } if (current6_ == end6_) { current6_ = begin6_; ++current5_; } if (current5_ == end5_) { current5_ = begin5_; ++current4_; } if (current4_ == end4_) { current4_ = begin4_; ++current3_; } if (current3_ == end3_) { current3_ = begin3_; ++current2_; } if (current2_ == end2_) { current2_ = begin2_; ++current1_; } ComputeCurrentValue(); } virtual ParamIteratorInterface* Clone() const { return new Iterator(*this); } virtual const ParamType* Current() const { return current_value_.get(); } virtual bool Equals(const ParamIteratorInterface& other) const { // Having the same base generator guarantees that the other // iterator is of the same type and we can downcast. GTEST_CHECK_(BaseGenerator() == other.BaseGenerator()) << "The program attempted to compare iterators " << "from different generators." << std::endl; const Iterator* typed_other = CheckedDowncastToActualType(&other); // We must report iterators equal if they both point beyond their // respective ranges. That can happen in a variety of fashions, // so we have to consult AtEnd(). return (AtEnd() && typed_other->AtEnd()) || ( current1_ == typed_other->current1_ && current2_ == typed_other->current2_ && current3_ == typed_other->current3_ && current4_ == typed_other->current4_ && current5_ == typed_other->current5_ && current6_ == typed_other->current6_ && current7_ == typed_other->current7_); } private: Iterator(const Iterator& other) : base_(other.base_), begin1_(other.begin1_), end1_(other.end1_), current1_(other.current1_), begin2_(other.begin2_), end2_(other.end2_), current2_(other.current2_), begin3_(other.begin3_), end3_(other.end3_), current3_(other.current3_), begin4_(other.begin4_), end4_(other.end4_), current4_(other.current4_), begin5_(other.begin5_), end5_(other.end5_), current5_(other.current5_), begin6_(other.begin6_), end6_(other.end6_), current6_(other.current6_), begin7_(other.begin7_), end7_(other.end7_), current7_(other.current7_) { ComputeCurrentValue(); } void ComputeCurrentValue() { if (!AtEnd()) current_value_.reset(new ParamType(*current1_, *current2_, *current3_, *current4_, *current5_, *current6_, *current7_)); } bool AtEnd() const { // We must report iterator past the end of the range when either of the // component iterators has reached the end of its range. return current1_ == end1_ || current2_ == end2_ || current3_ == end3_ || current4_ == end4_ || current5_ == end5_ || current6_ == end6_ || current7_ == end7_; } // No implementation - assignment is unsupported. void operator=(const Iterator& other); const ParamGeneratorInterface* const base_; // begin[i]_ and end[i]_ define the i-th range that Iterator traverses. // current[i]_ is the actual traversing iterator. const typename ParamGenerator::iterator begin1_; const typename ParamGenerator::iterator end1_; typename ParamGenerator::iterator current1_; const typename ParamGenerator::iterator begin2_; const typename ParamGenerator::iterator end2_; typename ParamGenerator::iterator current2_; const typename ParamGenerator::iterator begin3_; const typename ParamGenerator::iterator end3_; typename ParamGenerator::iterator current3_; const typename ParamGenerator::iterator begin4_; const typename ParamGenerator::iterator end4_; typename ParamGenerator::iterator current4_; const typename ParamGenerator::iterator begin5_; const typename ParamGenerator::iterator end5_; typename ParamGenerator::iterator current5_; const typename ParamGenerator::iterator begin6_; const typename ParamGenerator::iterator end6_; typename ParamGenerator::iterator current6_; const typename ParamGenerator::iterator begin7_; const typename ParamGenerator::iterator end7_; typename ParamGenerator::iterator current7_; linked_ptr current_value_; }; // class CartesianProductGenerator7::Iterator // No implementation - assignment is unsupported. void operator=(const CartesianProductGenerator7& other); const ParamGenerator g1_; const ParamGenerator g2_; const ParamGenerator g3_; const ParamGenerator g4_; const ParamGenerator g5_; const ParamGenerator g6_; const ParamGenerator g7_; }; // class CartesianProductGenerator7 template class CartesianProductGenerator8 : public ParamGeneratorInterface< ::testing::tuple > { public: typedef ::testing::tuple ParamType; CartesianProductGenerator8(const ParamGenerator& g1, const ParamGenerator& g2, const ParamGenerator& g3, const ParamGenerator& g4, const ParamGenerator& g5, const ParamGenerator& g6, const ParamGenerator& g7, const ParamGenerator& g8) : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8) {} virtual ~CartesianProductGenerator8() {} virtual ParamIteratorInterface* Begin() const { return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_, g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_, g7_.begin(), g8_, g8_.begin()); } virtual ParamIteratorInterface* End() const { return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(), g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end(), g8_, g8_.end()); } private: class Iterator : public ParamIteratorInterface { public: Iterator(const ParamGeneratorInterface* base, const ParamGenerator& g1, const typename ParamGenerator::iterator& current1, const ParamGenerator& g2, const typename ParamGenerator::iterator& current2, const ParamGenerator& g3, const typename ParamGenerator::iterator& current3, const ParamGenerator& g4, const typename ParamGenerator::iterator& current4, const ParamGenerator& g5, const typename ParamGenerator::iterator& current5, const ParamGenerator& g6, const typename ParamGenerator::iterator& current6, const ParamGenerator& g7, const typename ParamGenerator::iterator& current7, const ParamGenerator& g8, const typename ParamGenerator::iterator& current8) : base_(base), begin1_(g1.begin()), end1_(g1.end()), current1_(current1), begin2_(g2.begin()), end2_(g2.end()), current2_(current2), begin3_(g3.begin()), end3_(g3.end()), current3_(current3), begin4_(g4.begin()), end4_(g4.end()), current4_(current4), begin5_(g5.begin()), end5_(g5.end()), current5_(current5), begin6_(g6.begin()), end6_(g6.end()), current6_(current6), begin7_(g7.begin()), end7_(g7.end()), current7_(current7), begin8_(g8.begin()), end8_(g8.end()), current8_(current8) { ComputeCurrentValue(); } virtual ~Iterator() {} virtual const ParamGeneratorInterface* BaseGenerator() const { return base_; } // Advance should not be called on beyond-of-range iterators // so no component iterators must be beyond end of range, either. virtual void Advance() { assert(!AtEnd()); ++current8_; if (current8_ == end8_) { current8_ = begin8_; ++current7_; } if (current7_ == end7_) { current7_ = begin7_; ++current6_; } if (current6_ == end6_) { current6_ = begin6_; ++current5_; } if (current5_ == end5_) { current5_ = begin5_; ++current4_; } if (current4_ == end4_) { current4_ = begin4_; ++current3_; } if (current3_ == end3_) { current3_ = begin3_; ++current2_; } if (current2_ == end2_) { current2_ = begin2_; ++current1_; } ComputeCurrentValue(); } virtual ParamIteratorInterface* Clone() const { return new Iterator(*this); } virtual const ParamType* Current() const { return current_value_.get(); } virtual bool Equals(const ParamIteratorInterface& other) const { // Having the same base generator guarantees that the other // iterator is of the same type and we can downcast. GTEST_CHECK_(BaseGenerator() == other.BaseGenerator()) << "The program attempted to compare iterators " << "from different generators." << std::endl; const Iterator* typed_other = CheckedDowncastToActualType(&other); // We must report iterators equal if they both point beyond their // respective ranges. That can happen in a variety of fashions, // so we have to consult AtEnd(). return (AtEnd() && typed_other->AtEnd()) || ( current1_ == typed_other->current1_ && current2_ == typed_other->current2_ && current3_ == typed_other->current3_ && current4_ == typed_other->current4_ && current5_ == typed_other->current5_ && current6_ == typed_other->current6_ && current7_ == typed_other->current7_ && current8_ == typed_other->current8_); } private: Iterator(const Iterator& other) : base_(other.base_), begin1_(other.begin1_), end1_(other.end1_), current1_(other.current1_), begin2_(other.begin2_), end2_(other.end2_), current2_(other.current2_), begin3_(other.begin3_), end3_(other.end3_), current3_(other.current3_), begin4_(other.begin4_), end4_(other.end4_), current4_(other.current4_), begin5_(other.begin5_), end5_(other.end5_), current5_(other.current5_), begin6_(other.begin6_), end6_(other.end6_), current6_(other.current6_), begin7_(other.begin7_), end7_(other.end7_), current7_(other.current7_), begin8_(other.begin8_), end8_(other.end8_), current8_(other.current8_) { ComputeCurrentValue(); } void ComputeCurrentValue() { if (!AtEnd()) current_value_.reset(new ParamType(*current1_, *current2_, *current3_, *current4_, *current5_, *current6_, *current7_, *current8_)); } bool AtEnd() const { // We must report iterator past the end of the range when either of the // component iterators has reached the end of its range. return current1_ == end1_ || current2_ == end2_ || current3_ == end3_ || current4_ == end4_ || current5_ == end5_ || current6_ == end6_ || current7_ == end7_ || current8_ == end8_; } // No implementation - assignment is unsupported. void operator=(const Iterator& other); const ParamGeneratorInterface* const base_; // begin[i]_ and end[i]_ define the i-th range that Iterator traverses. // current[i]_ is the actual traversing iterator. const typename ParamGenerator::iterator begin1_; const typename ParamGenerator::iterator end1_; typename ParamGenerator::iterator current1_; const typename ParamGenerator::iterator begin2_; const typename ParamGenerator::iterator end2_; typename ParamGenerator::iterator current2_; const typename ParamGenerator::iterator begin3_; const typename ParamGenerator::iterator end3_; typename ParamGenerator::iterator current3_; const typename ParamGenerator::iterator begin4_; const typename ParamGenerator::iterator end4_; typename ParamGenerator::iterator current4_; const typename ParamGenerator::iterator begin5_; const typename ParamGenerator::iterator end5_; typename ParamGenerator::iterator current5_; const typename ParamGenerator::iterator begin6_; const typename ParamGenerator::iterator end6_; typename ParamGenerator::iterator current6_; const typename ParamGenerator::iterator begin7_; const typename ParamGenerator::iterator end7_; typename ParamGenerator::iterator current7_; const typename ParamGenerator::iterator begin8_; const typename ParamGenerator::iterator end8_; typename ParamGenerator::iterator current8_; linked_ptr current_value_; }; // class CartesianProductGenerator8::Iterator // No implementation - assignment is unsupported. void operator=(const CartesianProductGenerator8& other); const ParamGenerator g1_; const ParamGenerator g2_; const ParamGenerator g3_; const ParamGenerator g4_; const ParamGenerator g5_; const ParamGenerator g6_; const ParamGenerator g7_; const ParamGenerator g8_; }; // class CartesianProductGenerator8 template class CartesianProductGenerator9 : public ParamGeneratorInterface< ::testing::tuple > { public: typedef ::testing::tuple ParamType; CartesianProductGenerator9(const ParamGenerator& g1, const ParamGenerator& g2, const ParamGenerator& g3, const ParamGenerator& g4, const ParamGenerator& g5, const ParamGenerator& g6, const ParamGenerator& g7, const ParamGenerator& g8, const ParamGenerator& g9) : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8), g9_(g9) {} virtual ~CartesianProductGenerator9() {} virtual ParamIteratorInterface* Begin() const { return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_, g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_, g7_.begin(), g8_, g8_.begin(), g9_, g9_.begin()); } virtual ParamIteratorInterface* End() const { return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(), g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end(), g8_, g8_.end(), g9_, g9_.end()); } private: class Iterator : public ParamIteratorInterface { public: Iterator(const ParamGeneratorInterface* base, const ParamGenerator& g1, const typename ParamGenerator::iterator& current1, const ParamGenerator& g2, const typename ParamGenerator::iterator& current2, const ParamGenerator& g3, const typename ParamGenerator::iterator& current3, const ParamGenerator& g4, const typename ParamGenerator::iterator& current4, const ParamGenerator& g5, const typename ParamGenerator::iterator& current5, const ParamGenerator& g6, const typename ParamGenerator::iterator& current6, const ParamGenerator& g7, const typename ParamGenerator::iterator& current7, const ParamGenerator& g8, const typename ParamGenerator::iterator& current8, const ParamGenerator& g9, const typename ParamGenerator::iterator& current9) : base_(base), begin1_(g1.begin()), end1_(g1.end()), current1_(current1), begin2_(g2.begin()), end2_(g2.end()), current2_(current2), begin3_(g3.begin()), end3_(g3.end()), current3_(current3), begin4_(g4.begin()), end4_(g4.end()), current4_(current4), begin5_(g5.begin()), end5_(g5.end()), current5_(current5), begin6_(g6.begin()), end6_(g6.end()), current6_(current6), begin7_(g7.begin()), end7_(g7.end()), current7_(current7), begin8_(g8.begin()), end8_(g8.end()), current8_(current8), begin9_(g9.begin()), end9_(g9.end()), current9_(current9) { ComputeCurrentValue(); } virtual ~Iterator() {} virtual const ParamGeneratorInterface* BaseGenerator() const { return base_; } // Advance should not be called on beyond-of-range iterators // so no component iterators must be beyond end of range, either. virtual void Advance() { assert(!AtEnd()); ++current9_; if (current9_ == end9_) { current9_ = begin9_; ++current8_; } if (current8_ == end8_) { current8_ = begin8_; ++current7_; } if (current7_ == end7_) { current7_ = begin7_; ++current6_; } if (current6_ == end6_) { current6_ = begin6_; ++current5_; } if (current5_ == end5_) { current5_ = begin5_; ++current4_; } if (current4_ == end4_) { current4_ = begin4_; ++current3_; } if (current3_ == end3_) { current3_ = begin3_; ++current2_; } if (current2_ == end2_) { current2_ = begin2_; ++current1_; } ComputeCurrentValue(); } virtual ParamIteratorInterface* Clone() const { return new Iterator(*this); } virtual const ParamType* Current() const { return current_value_.get(); } virtual bool Equals(const ParamIteratorInterface& other) const { // Having the same base generator guarantees that the other // iterator is of the same type and we can downcast. GTEST_CHECK_(BaseGenerator() == other.BaseGenerator()) << "The program attempted to compare iterators " << "from different generators." << std::endl; const Iterator* typed_other = CheckedDowncastToActualType(&other); // We must report iterators equal if they both point beyond their // respective ranges. That can happen in a variety of fashions, // so we have to consult AtEnd(). return (AtEnd() && typed_other->AtEnd()) || ( current1_ == typed_other->current1_ && current2_ == typed_other->current2_ && current3_ == typed_other->current3_ && current4_ == typed_other->current4_ && current5_ == typed_other->current5_ && current6_ == typed_other->current6_ && current7_ == typed_other->current7_ && current8_ == typed_other->current8_ && current9_ == typed_other->current9_); } private: Iterator(const Iterator& other) : base_(other.base_), begin1_(other.begin1_), end1_(other.end1_), current1_(other.current1_), begin2_(other.begin2_), end2_(other.end2_), current2_(other.current2_), begin3_(other.begin3_), end3_(other.end3_), current3_(other.current3_), begin4_(other.begin4_), end4_(other.end4_), current4_(other.current4_), begin5_(other.begin5_), end5_(other.end5_), current5_(other.current5_), begin6_(other.begin6_), end6_(other.end6_), current6_(other.current6_), begin7_(other.begin7_), end7_(other.end7_), current7_(other.current7_), begin8_(other.begin8_), end8_(other.end8_), current8_(other.current8_), begin9_(other.begin9_), end9_(other.end9_), current9_(other.current9_) { ComputeCurrentValue(); } void ComputeCurrentValue() { if (!AtEnd()) current_value_.reset(new ParamType(*current1_, *current2_, *current3_, *current4_, *current5_, *current6_, *current7_, *current8_, *current9_)); } bool AtEnd() const { // We must report iterator past the end of the range when either of the // component iterators has reached the end of its range. return current1_ == end1_ || current2_ == end2_ || current3_ == end3_ || current4_ == end4_ || current5_ == end5_ || current6_ == end6_ || current7_ == end7_ || current8_ == end8_ || current9_ == end9_; } // No implementation - assignment is unsupported. void operator=(const Iterator& other); const ParamGeneratorInterface* const base_; // begin[i]_ and end[i]_ define the i-th range that Iterator traverses. // current[i]_ is the actual traversing iterator. const typename ParamGenerator::iterator begin1_; const typename ParamGenerator::iterator end1_; typename ParamGenerator::iterator current1_; const typename ParamGenerator::iterator begin2_; const typename ParamGenerator::iterator end2_; typename ParamGenerator::iterator current2_; const typename ParamGenerator::iterator begin3_; const typename ParamGenerator::iterator end3_; typename ParamGenerator::iterator current3_; const typename ParamGenerator::iterator begin4_; const typename ParamGenerator::iterator end4_; typename ParamGenerator::iterator current4_; const typename ParamGenerator::iterator begin5_; const typename ParamGenerator::iterator end5_; typename ParamGenerator::iterator current5_; const typename ParamGenerator::iterator begin6_; const typename ParamGenerator::iterator end6_; typename ParamGenerator::iterator current6_; const typename ParamGenerator::iterator begin7_; const typename ParamGenerator::iterator end7_; typename ParamGenerator::iterator current7_; const typename ParamGenerator::iterator begin8_; const typename ParamGenerator::iterator end8_; typename ParamGenerator::iterator current8_; const typename ParamGenerator::iterator begin9_; const typename ParamGenerator::iterator end9_; typename ParamGenerator::iterator current9_; linked_ptr current_value_; }; // class CartesianProductGenerator9::Iterator // No implementation - assignment is unsupported. void operator=(const CartesianProductGenerator9& other); const ParamGenerator g1_; const ParamGenerator g2_; const ParamGenerator g3_; const ParamGenerator g4_; const ParamGenerator g5_; const ParamGenerator g6_; const ParamGenerator g7_; const ParamGenerator g8_; const ParamGenerator g9_; }; // class CartesianProductGenerator9 template class CartesianProductGenerator10 : public ParamGeneratorInterface< ::testing::tuple > { public: typedef ::testing::tuple ParamType; CartesianProductGenerator10(const ParamGenerator& g1, const ParamGenerator& g2, const ParamGenerator& g3, const ParamGenerator& g4, const ParamGenerator& g5, const ParamGenerator& g6, const ParamGenerator& g7, const ParamGenerator& g8, const ParamGenerator& g9, const ParamGenerator& g10) : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8), g9_(g9), g10_(g10) {} virtual ~CartesianProductGenerator10() {} virtual ParamIteratorInterface* Begin() const { return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_, g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_, g7_.begin(), g8_, g8_.begin(), g9_, g9_.begin(), g10_, g10_.begin()); } virtual ParamIteratorInterface* End() const { return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(), g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end(), g8_, g8_.end(), g9_, g9_.end(), g10_, g10_.end()); } private: class Iterator : public ParamIteratorInterface { public: Iterator(const ParamGeneratorInterface* base, const ParamGenerator& g1, const typename ParamGenerator::iterator& current1, const ParamGenerator& g2, const typename ParamGenerator::iterator& current2, const ParamGenerator& g3, const typename ParamGenerator::iterator& current3, const ParamGenerator& g4, const typename ParamGenerator::iterator& current4, const ParamGenerator& g5, const typename ParamGenerator::iterator& current5, const ParamGenerator& g6, const typename ParamGenerator::iterator& current6, const ParamGenerator& g7, const typename ParamGenerator::iterator& current7, const ParamGenerator& g8, const typename ParamGenerator::iterator& current8, const ParamGenerator& g9, const typename ParamGenerator::iterator& current9, const ParamGenerator& g10, const typename ParamGenerator::iterator& current10) : base_(base), begin1_(g1.begin()), end1_(g1.end()), current1_(current1), begin2_(g2.begin()), end2_(g2.end()), current2_(current2), begin3_(g3.begin()), end3_(g3.end()), current3_(current3), begin4_(g4.begin()), end4_(g4.end()), current4_(current4), begin5_(g5.begin()), end5_(g5.end()), current5_(current5), begin6_(g6.begin()), end6_(g6.end()), current6_(current6), begin7_(g7.begin()), end7_(g7.end()), current7_(current7), begin8_(g8.begin()), end8_(g8.end()), current8_(current8), begin9_(g9.begin()), end9_(g9.end()), current9_(current9), begin10_(g10.begin()), end10_(g10.end()), current10_(current10) { ComputeCurrentValue(); } virtual ~Iterator() {} virtual const ParamGeneratorInterface* BaseGenerator() const { return base_; } // Advance should not be called on beyond-of-range iterators // so no component iterators must be beyond end of range, either. virtual void Advance() { assert(!AtEnd()); ++current10_; if (current10_ == end10_) { current10_ = begin10_; ++current9_; } if (current9_ == end9_) { current9_ = begin9_; ++current8_; } if (current8_ == end8_) { current8_ = begin8_; ++current7_; } if (current7_ == end7_) { current7_ = begin7_; ++current6_; } if (current6_ == end6_) { current6_ = begin6_; ++current5_; } if (current5_ == end5_) { current5_ = begin5_; ++current4_; } if (current4_ == end4_) { current4_ = begin4_; ++current3_; } if (current3_ == end3_) { current3_ = begin3_; ++current2_; } if (current2_ == end2_) { current2_ = begin2_; ++current1_; } ComputeCurrentValue(); } virtual ParamIteratorInterface* Clone() const { return new Iterator(*this); } virtual const ParamType* Current() const { return current_value_.get(); } virtual bool Equals(const ParamIteratorInterface& other) const { // Having the same base generator guarantees that the other // iterator is of the same type and we can downcast. GTEST_CHECK_(BaseGenerator() == other.BaseGenerator()) << "The program attempted to compare iterators " << "from different generators." << std::endl; const Iterator* typed_other = CheckedDowncastToActualType(&other); // We must report iterators equal if they both point beyond their // respective ranges. That can happen in a variety of fashions, // so we have to consult AtEnd(). return (AtEnd() && typed_other->AtEnd()) || ( current1_ == typed_other->current1_ && current2_ == typed_other->current2_ && current3_ == typed_other->current3_ && current4_ == typed_other->current4_ && current5_ == typed_other->current5_ && current6_ == typed_other->current6_ && current7_ == typed_other->current7_ && current8_ == typed_other->current8_ && current9_ == typed_other->current9_ && current10_ == typed_other->current10_); } private: Iterator(const Iterator& other) : base_(other.base_), begin1_(other.begin1_), end1_(other.end1_), current1_(other.current1_), begin2_(other.begin2_), end2_(other.end2_), current2_(other.current2_), begin3_(other.begin3_), end3_(other.end3_), current3_(other.current3_), begin4_(other.begin4_), end4_(other.end4_), current4_(other.current4_), begin5_(other.begin5_), end5_(other.end5_), current5_(other.current5_), begin6_(other.begin6_), end6_(other.end6_), current6_(other.current6_), begin7_(other.begin7_), end7_(other.end7_), current7_(other.current7_), begin8_(other.begin8_), end8_(other.end8_), current8_(other.current8_), begin9_(other.begin9_), end9_(other.end9_), current9_(other.current9_), begin10_(other.begin10_), end10_(other.end10_), current10_(other.current10_) { ComputeCurrentValue(); } void ComputeCurrentValue() { if (!AtEnd()) current_value_.reset(new ParamType(*current1_, *current2_, *current3_, *current4_, *current5_, *current6_, *current7_, *current8_, *current9_, *current10_)); } bool AtEnd() const { // We must report iterator past the end of the range when either of the // component iterators has reached the end of its range. return current1_ == end1_ || current2_ == end2_ || current3_ == end3_ || current4_ == end4_ || current5_ == end5_ || current6_ == end6_ || current7_ == end7_ || current8_ == end8_ || current9_ == end9_ || current10_ == end10_; } // No implementation - assignment is unsupported. void operator=(const Iterator& other); const ParamGeneratorInterface* const base_; // begin[i]_ and end[i]_ define the i-th range that Iterator traverses. // current[i]_ is the actual traversing iterator. const typename ParamGenerator::iterator begin1_; const typename ParamGenerator::iterator end1_; typename ParamGenerator::iterator current1_; const typename ParamGenerator::iterator begin2_; const typename ParamGenerator::iterator end2_; typename ParamGenerator::iterator current2_; const typename ParamGenerator::iterator begin3_; const typename ParamGenerator::iterator end3_; typename ParamGenerator::iterator current3_; const typename ParamGenerator::iterator begin4_; const typename ParamGenerator::iterator end4_; typename ParamGenerator::iterator current4_; const typename ParamGenerator::iterator begin5_; const typename ParamGenerator::iterator end5_; typename ParamGenerator::iterator current5_; const typename ParamGenerator::iterator begin6_; const typename ParamGenerator::iterator end6_; typename ParamGenerator::iterator current6_; const typename ParamGenerator::iterator begin7_; const typename ParamGenerator::iterator end7_; typename ParamGenerator::iterator current7_; const typename ParamGenerator::iterator begin8_; const typename ParamGenerator::iterator end8_; typename ParamGenerator::iterator current8_; const typename ParamGenerator::iterator begin9_; const typename ParamGenerator::iterator end9_; typename ParamGenerator::iterator current9_; const typename ParamGenerator::iterator begin10_; const typename ParamGenerator::iterator end10_; typename ParamGenerator::iterator current10_; linked_ptr current_value_; }; // class CartesianProductGenerator10::Iterator // No implementation - assignment is unsupported. void operator=(const CartesianProductGenerator10& other); const ParamGenerator g1_; const ParamGenerator g2_; const ParamGenerator g3_; const ParamGenerator g4_; const ParamGenerator g5_; const ParamGenerator g6_; const ParamGenerator g7_; const ParamGenerator g8_; const ParamGenerator g9_; const ParamGenerator g10_; }; // class CartesianProductGenerator10 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. // // Helper classes providing Combine() with polymorphic features. They allow // casting CartesianProductGeneratorN to ParamGenerator if T is // convertible to U. // template class CartesianProductHolder2 { public: CartesianProductHolder2(const Generator1& g1, const Generator2& g2) : g1_(g1), g2_(g2) {} template operator ParamGenerator< ::testing::tuple >() const { return ParamGenerator< ::testing::tuple >( new CartesianProductGenerator2( static_cast >(g1_), static_cast >(g2_))); } private: // No implementation - assignment is unsupported. void operator=(const CartesianProductHolder2& other); const Generator1 g1_; const Generator2 g2_; }; // class CartesianProductHolder2 template class CartesianProductHolder3 { public: CartesianProductHolder3(const Generator1& g1, const Generator2& g2, const Generator3& g3) : g1_(g1), g2_(g2), g3_(g3) {} template operator ParamGenerator< ::testing::tuple >() const { return ParamGenerator< ::testing::tuple >( new CartesianProductGenerator3( static_cast >(g1_), static_cast >(g2_), static_cast >(g3_))); } private: // No implementation - assignment is unsupported. void operator=(const CartesianProductHolder3& other); const Generator1 g1_; const Generator2 g2_; const Generator3 g3_; }; // class CartesianProductHolder3 template class CartesianProductHolder4 { public: CartesianProductHolder4(const Generator1& g1, const Generator2& g2, const Generator3& g3, const Generator4& g4) : g1_(g1), g2_(g2), g3_(g3), g4_(g4) {} template operator ParamGenerator< ::testing::tuple >() const { return ParamGenerator< ::testing::tuple >( new CartesianProductGenerator4( static_cast >(g1_), static_cast >(g2_), static_cast >(g3_), static_cast >(g4_))); } private: // No implementation - assignment is unsupported. void operator=(const CartesianProductHolder4& other); const Generator1 g1_; const Generator2 g2_; const Generator3 g3_; const Generator4 g4_; }; // class CartesianProductHolder4 template class CartesianProductHolder5 { public: CartesianProductHolder5(const Generator1& g1, const Generator2& g2, const Generator3& g3, const Generator4& g4, const Generator5& g5) : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5) {} template operator ParamGenerator< ::testing::tuple >() const { return ParamGenerator< ::testing::tuple >( new CartesianProductGenerator5( static_cast >(g1_), static_cast >(g2_), static_cast >(g3_), static_cast >(g4_), static_cast >(g5_))); } private: // No implementation - assignment is unsupported. void operator=(const CartesianProductHolder5& other); const Generator1 g1_; const Generator2 g2_; const Generator3 g3_; const Generator4 g4_; const Generator5 g5_; }; // class CartesianProductHolder5 template class CartesianProductHolder6 { public: CartesianProductHolder6(const Generator1& g1, const Generator2& g2, const Generator3& g3, const Generator4& g4, const Generator5& g5, const Generator6& g6) : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6) {} template operator ParamGenerator< ::testing::tuple >() const { return ParamGenerator< ::testing::tuple >( new CartesianProductGenerator6( static_cast >(g1_), static_cast >(g2_), static_cast >(g3_), static_cast >(g4_), static_cast >(g5_), static_cast >(g6_))); } private: // No implementation - assignment is unsupported. void operator=(const CartesianProductHolder6& other); const Generator1 g1_; const Generator2 g2_; const Generator3 g3_; const Generator4 g4_; const Generator5 g5_; const Generator6 g6_; }; // class CartesianProductHolder6 template class CartesianProductHolder7 { public: CartesianProductHolder7(const Generator1& g1, const Generator2& g2, const Generator3& g3, const Generator4& g4, const Generator5& g5, const Generator6& g6, const Generator7& g7) : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7) {} template operator ParamGenerator< ::testing::tuple >() const { return ParamGenerator< ::testing::tuple >( new CartesianProductGenerator7( static_cast >(g1_), static_cast >(g2_), static_cast >(g3_), static_cast >(g4_), static_cast >(g5_), static_cast >(g6_), static_cast >(g7_))); } private: // No implementation - assignment is unsupported. void operator=(const CartesianProductHolder7& other); const Generator1 g1_; const Generator2 g2_; const Generator3 g3_; const Generator4 g4_; const Generator5 g5_; const Generator6 g6_; const Generator7 g7_; }; // class CartesianProductHolder7 template class CartesianProductHolder8 { public: CartesianProductHolder8(const Generator1& g1, const Generator2& g2, const Generator3& g3, const Generator4& g4, const Generator5& g5, const Generator6& g6, const Generator7& g7, const Generator8& g8) : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8) {} template operator ParamGenerator< ::testing::tuple >() const { return ParamGenerator< ::testing::tuple >( new CartesianProductGenerator8( static_cast >(g1_), static_cast >(g2_), static_cast >(g3_), static_cast >(g4_), static_cast >(g5_), static_cast >(g6_), static_cast >(g7_), static_cast >(g8_))); } private: // No implementation - assignment is unsupported. void operator=(const CartesianProductHolder8& other); const Generator1 g1_; const Generator2 g2_; const Generator3 g3_; const Generator4 g4_; const Generator5 g5_; const Generator6 g6_; const Generator7 g7_; const Generator8 g8_; }; // class CartesianProductHolder8 template class CartesianProductHolder9 { public: CartesianProductHolder9(const Generator1& g1, const Generator2& g2, const Generator3& g3, const Generator4& g4, const Generator5& g5, const Generator6& g6, const Generator7& g7, const Generator8& g8, const Generator9& g9) : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8), g9_(g9) {} template operator ParamGenerator< ::testing::tuple >() const { return ParamGenerator< ::testing::tuple >( new CartesianProductGenerator9( static_cast >(g1_), static_cast >(g2_), static_cast >(g3_), static_cast >(g4_), static_cast >(g5_), static_cast >(g6_), static_cast >(g7_), static_cast >(g8_), static_cast >(g9_))); } private: // No implementation - assignment is unsupported. void operator=(const CartesianProductHolder9& other); const Generator1 g1_; const Generator2 g2_; const Generator3 g3_; const Generator4 g4_; const Generator5 g5_; const Generator6 g6_; const Generator7 g7_; const Generator8 g8_; const Generator9 g9_; }; // class CartesianProductHolder9 template class CartesianProductHolder10 { public: CartesianProductHolder10(const Generator1& g1, const Generator2& g2, const Generator3& g3, const Generator4& g4, const Generator5& g5, const Generator6& g6, const Generator7& g7, const Generator8& g8, const Generator9& g9, const Generator10& g10) : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8), g9_(g9), g10_(g10) {} template operator ParamGenerator< ::testing::tuple >() const { return ParamGenerator< ::testing::tuple >( new CartesianProductGenerator10( static_cast >(g1_), static_cast >(g2_), static_cast >(g3_), static_cast >(g4_), static_cast >(g5_), static_cast >(g6_), static_cast >(g7_), static_cast >(g8_), static_cast >(g9_), static_cast >(g10_))); } private: // No implementation - assignment is unsupported. void operator=(const CartesianProductHolder10& other); const Generator1 g1_; const Generator2 g2_; const Generator3 g3_; const Generator4 g4_; const Generator5 g5_; const Generator6 g6_; const Generator7 g7_; const Generator8 g8_; const Generator9 g9_; const Generator10 g10_; }; // class CartesianProductHolder10 # endif // GTEST_HAS_COMBINE } // namespace internal } // namespace testing #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_ iptux-0.9.4/src/googletest/include/gtest/internal/gtest-param-util-generated.h.pump000066400000000000000000000214171475473122500305300ustar00rootroot00000000000000$$ -*- mode: c++; -*- $var n = 50 $$ Maximum length of Values arguments we want to support. $var maxtuple = 10 $$ Maximum number of Combine arguments we want to support. // Copyright 2008 Google Inc. // All Rights Reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // Type and function utilities for implementing parameterized tests. // This file is generated by a SCRIPT. DO NOT EDIT BY HAND! // // Currently Google Test supports at most $n arguments in Values, // and at most $maxtuple arguments in Combine. Please contact // googletestframework@googlegroups.com if you need more. // Please note that the number of arguments to Combine is limited // by the maximum arity of the implementation of tuple which is // currently set at $maxtuple. // GOOGLETEST_CM0001 DO NOT DELETE #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_ #include "gtest/internal/gtest-param-util.h" #include "gtest/internal/gtest-port.h" namespace testing { // Forward declarations of ValuesIn(), which is implemented in // include/gtest/gtest-param-test.h. template internal::ParamGenerator< typename ::testing::internal::IteratorTraits::value_type> ValuesIn(ForwardIterator begin, ForwardIterator end); template internal::ParamGenerator ValuesIn(const T (&array)[N]); template internal::ParamGenerator ValuesIn( const Container& container); namespace internal { // Used in the Values() function to provide polymorphic capabilities. $range i 1..n $for i [[ $range j 1..i template <$for j, [[typename T$j]]> class ValueArray$i { public: $if i==1 [[explicit ]]ValueArray$i($for j, [[T$j v$j]]) : $for j, [[v$(j)_(v$j)]] {} template operator ParamGenerator() const { const T array[] = {$for j, [[static_cast(v$(j)_)]]}; return ValuesIn(array); } ValueArray$i(const ValueArray$i& other) : $for j, [[v$(j)_(other.v$(j)_)]] {} private: // No implementation - assignment is unsupported. void operator=(const ValueArray$i& other); $for j [[ const T$j v$(j)_; ]] }; ]] # if GTEST_HAS_COMBINE // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. // // Generates values from the Cartesian product of values produced // by the argument generators. // $range i 2..maxtuple $for i [[ $range j 1..i $range k 2..i template <$for j, [[typename T$j]]> class CartesianProductGenerator$i : public ParamGeneratorInterface< ::testing::tuple<$for j, [[T$j]]> > { public: typedef ::testing::tuple<$for j, [[T$j]]> ParamType; CartesianProductGenerator$i($for j, [[const ParamGenerator& g$j]]) : $for j, [[g$(j)_(g$j)]] {} virtual ~CartesianProductGenerator$i() {} virtual ParamIteratorInterface* Begin() const { return new Iterator(this, $for j, [[g$(j)_, g$(j)_.begin()]]); } virtual ParamIteratorInterface* End() const { return new Iterator(this, $for j, [[g$(j)_, g$(j)_.end()]]); } private: class Iterator : public ParamIteratorInterface { public: Iterator(const ParamGeneratorInterface* base, $for j, [[ const ParamGenerator& g$j, const typename ParamGenerator::iterator& current$(j)]]) : base_(base), $for j, [[ begin$(j)_(g$j.begin()), end$(j)_(g$j.end()), current$(j)_(current$j) ]] { ComputeCurrentValue(); } virtual ~Iterator() {} virtual const ParamGeneratorInterface* BaseGenerator() const { return base_; } // Advance should not be called on beyond-of-range iterators // so no component iterators must be beyond end of range, either. virtual void Advance() { assert(!AtEnd()); ++current$(i)_; $for k [[ if (current$(i+2-k)_ == end$(i+2-k)_) { current$(i+2-k)_ = begin$(i+2-k)_; ++current$(i+2-k-1)_; } ]] ComputeCurrentValue(); } virtual ParamIteratorInterface* Clone() const { return new Iterator(*this); } virtual const ParamType* Current() const { return current_value_.get(); } virtual bool Equals(const ParamIteratorInterface& other) const { // Having the same base generator guarantees that the other // iterator is of the same type and we can downcast. GTEST_CHECK_(BaseGenerator() == other.BaseGenerator()) << "The program attempted to compare iterators " << "from different generators." << std::endl; const Iterator* typed_other = CheckedDowncastToActualType(&other); // We must report iterators equal if they both point beyond their // respective ranges. That can happen in a variety of fashions, // so we have to consult AtEnd(). return (AtEnd() && typed_other->AtEnd()) || ($for j && [[ current$(j)_ == typed_other->current$(j)_ ]]); } private: Iterator(const Iterator& other) : base_(other.base_), $for j, [[ begin$(j)_(other.begin$(j)_), end$(j)_(other.end$(j)_), current$(j)_(other.current$(j)_) ]] { ComputeCurrentValue(); } void ComputeCurrentValue() { if (!AtEnd()) current_value_.reset(new ParamType($for j, [[*current$(j)_]])); } bool AtEnd() const { // We must report iterator past the end of the range when either of the // component iterators has reached the end of its range. return $for j || [[ current$(j)_ == end$(j)_ ]]; } // No implementation - assignment is unsupported. void operator=(const Iterator& other); const ParamGeneratorInterface* const base_; // begin[i]_ and end[i]_ define the i-th range that Iterator traverses. // current[i]_ is the actual traversing iterator. $for j [[ const typename ParamGenerator::iterator begin$(j)_; const typename ParamGenerator::iterator end$(j)_; typename ParamGenerator::iterator current$(j)_; ]] linked_ptr current_value_; }; // class CartesianProductGenerator$i::Iterator // No implementation - assignment is unsupported. void operator=(const CartesianProductGenerator$i& other); $for j [[ const ParamGenerator g$(j)_; ]] }; // class CartesianProductGenerator$i ]] // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. // // Helper classes providing Combine() with polymorphic features. They allow // casting CartesianProductGeneratorN to ParamGenerator if T is // convertible to U. // $range i 2..maxtuple $for i [[ $range j 1..i template <$for j, [[class Generator$j]]> class CartesianProductHolder$i { public: CartesianProductHolder$i($for j, [[const Generator$j& g$j]]) : $for j, [[g$(j)_(g$j)]] {} template <$for j, [[typename T$j]]> operator ParamGenerator< ::testing::tuple<$for j, [[T$j]]> >() const { return ParamGenerator< ::testing::tuple<$for j, [[T$j]]> >( new CartesianProductGenerator$i<$for j, [[T$j]]>( $for j,[[ static_cast >(g$(j)_) ]])); } private: // No implementation - assignment is unsupported. void operator=(const CartesianProductHolder$i& other); $for j [[ const Generator$j g$(j)_; ]] }; // class CartesianProductHolder$i ]] # endif // GTEST_HAS_COMBINE } // namespace internal } // namespace testing #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_ iptux-0.9.4/src/googletest/include/gtest/internal/gtest-param-util.h000066400000000000000000000660161475473122500256200ustar00rootroot00000000000000// Copyright 2008 Google Inc. // All Rights Reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // Type and function utilities for implementing parameterized tests. // GOOGLETEST_CM0001 DO NOT DELETE #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_ #include #include #include #include #include #include "gtest/internal/gtest-internal.h" #include "gtest/internal/gtest-linked_ptr.h" #include "gtest/internal/gtest-port.h" #include "gtest/gtest-printers.h" namespace testing { // Input to a parameterized test name generator, describing a test parameter. // Consists of the parameter value and the integer parameter index. template struct TestParamInfo { TestParamInfo(const ParamType& a_param, size_t an_index) : param(a_param), index(an_index) {} ParamType param; size_t index; }; // A builtin parameterized test name generator which returns the result of // testing::PrintToString. struct PrintToStringParamName { template std::string operator()(const TestParamInfo& info) const { return PrintToString(info.param); } }; namespace internal { // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. // // Outputs a message explaining invalid registration of different // fixture class for the same test case. This may happen when // TEST_P macro is used to define two tests with the same name // but in different namespaces. GTEST_API_ void ReportInvalidTestCaseType(const char* test_case_name, CodeLocation code_location); template class ParamGeneratorInterface; template class ParamGenerator; // Interface for iterating over elements provided by an implementation // of ParamGeneratorInterface. template class ParamIteratorInterface { public: virtual ~ParamIteratorInterface() {} // A pointer to the base generator instance. // Used only for the purposes of iterator comparison // to make sure that two iterators belong to the same generator. virtual const ParamGeneratorInterface* BaseGenerator() const = 0; // Advances iterator to point to the next element // provided by the generator. The caller is responsible // for not calling Advance() on an iterator equal to // BaseGenerator()->End(). virtual void Advance() = 0; // Clones the iterator object. Used for implementing copy semantics // of ParamIterator. virtual ParamIteratorInterface* Clone() const = 0; // Dereferences the current iterator and provides (read-only) access // to the pointed value. It is the caller's responsibility not to call // Current() on an iterator equal to BaseGenerator()->End(). // Used for implementing ParamGenerator::operator*(). virtual const T* Current() const = 0; // Determines whether the given iterator and other point to the same // element in the sequence generated by the generator. // Used for implementing ParamGenerator::operator==(). virtual bool Equals(const ParamIteratorInterface& other) const = 0; }; // Class iterating over elements provided by an implementation of // ParamGeneratorInterface. It wraps ParamIteratorInterface // and implements the const forward iterator concept. template class ParamIterator { public: typedef T value_type; typedef const T& reference; typedef ptrdiff_t difference_type; // ParamIterator assumes ownership of the impl_ pointer. ParamIterator(const ParamIterator& other) : impl_(other.impl_->Clone()) {} ParamIterator& operator=(const ParamIterator& other) { if (this != &other) impl_.reset(other.impl_->Clone()); return *this; } const T& operator*() const { return *impl_->Current(); } const T* operator->() const { return impl_->Current(); } // Prefix version of operator++. ParamIterator& operator++() { impl_->Advance(); return *this; } // Postfix version of operator++. ParamIterator operator++(int /*unused*/) { ParamIteratorInterface* clone = impl_->Clone(); impl_->Advance(); return ParamIterator(clone); } bool operator==(const ParamIterator& other) const { return impl_.get() == other.impl_.get() || impl_->Equals(*other.impl_); } bool operator!=(const ParamIterator& other) const { return !(*this == other); } private: friend class ParamGenerator; explicit ParamIterator(ParamIteratorInterface* impl) : impl_(impl) {} scoped_ptr > impl_; }; // ParamGeneratorInterface is the binary interface to access generators // defined in other translation units. template class ParamGeneratorInterface { public: typedef T ParamType; virtual ~ParamGeneratorInterface() {} // Generator interface definition virtual ParamIteratorInterface* Begin() const = 0; virtual ParamIteratorInterface* End() const = 0; }; // Wraps ParamGeneratorInterface and provides general generator syntax // compatible with the STL Container concept. // This class implements copy initialization semantics and the contained // ParamGeneratorInterface instance is shared among all copies // of the original object. This is possible because that instance is immutable. template class ParamGenerator { public: typedef ParamIterator iterator; explicit ParamGenerator(ParamGeneratorInterface* impl) : impl_(impl) {} ParamGenerator(const ParamGenerator& other) : impl_(other.impl_) {} ParamGenerator& operator=(const ParamGenerator& other) { impl_ = other.impl_; return *this; } iterator begin() const { return iterator(impl_->Begin()); } iterator end() const { return iterator(impl_->End()); } private: linked_ptr > impl_; }; // Generates values from a range of two comparable values. Can be used to // generate sequences of user-defined types that implement operator+() and // operator<(). // This class is used in the Range() function. template class RangeGenerator : public ParamGeneratorInterface { public: RangeGenerator(T begin, T end, IncrementT step) : begin_(begin), end_(end), step_(step), end_index_(CalculateEndIndex(begin, end, step)) {} virtual ~RangeGenerator() {} virtual ParamIteratorInterface* Begin() const { return new Iterator(this, begin_, 0, step_); } virtual ParamIteratorInterface* End() const { return new Iterator(this, end_, end_index_, step_); } private: class Iterator : public ParamIteratorInterface { public: Iterator(const ParamGeneratorInterface* base, T value, int index, IncrementT step) : base_(base), value_(value), index_(index), step_(step) {} virtual ~Iterator() {} virtual const ParamGeneratorInterface* BaseGenerator() const { return base_; } virtual void Advance() { value_ = static_cast(value_ + step_); index_++; } virtual ParamIteratorInterface* Clone() const { return new Iterator(*this); } virtual const T* Current() const { return &value_; } virtual bool Equals(const ParamIteratorInterface& other) const { // Having the same base generator guarantees that the other // iterator is of the same type and we can downcast. GTEST_CHECK_(BaseGenerator() == other.BaseGenerator()) << "The program attempted to compare iterators " << "from different generators." << std::endl; const int other_index = CheckedDowncastToActualType(&other)->index_; return index_ == other_index; } private: Iterator(const Iterator& other) : ParamIteratorInterface(), base_(other.base_), value_(other.value_), index_(other.index_), step_(other.step_) {} // No implementation - assignment is unsupported. void operator=(const Iterator& other); const ParamGeneratorInterface* const base_; T value_; int index_; const IncrementT step_; }; // class RangeGenerator::Iterator static int CalculateEndIndex(const T& begin, const T& end, const IncrementT& step) { int end_index = 0; for (T i = begin; i < end; i = static_cast(i + step)) end_index++; return end_index; } // No implementation - assignment is unsupported. void operator=(const RangeGenerator& other); const T begin_; const T end_; const IncrementT step_; // The index for the end() iterator. All the elements in the generated // sequence are indexed (0-based) to aid iterator comparison. const int end_index_; }; // class RangeGenerator // Generates values from a pair of STL-style iterators. Used in the // ValuesIn() function. The elements are copied from the source range // since the source can be located on the stack, and the generator // is likely to persist beyond that stack frame. template class ValuesInIteratorRangeGenerator : public ParamGeneratorInterface { public: template ValuesInIteratorRangeGenerator(ForwardIterator begin, ForwardIterator end) : container_(begin, end) {} virtual ~ValuesInIteratorRangeGenerator() {} virtual ParamIteratorInterface* Begin() const { return new Iterator(this, container_.begin()); } virtual ParamIteratorInterface* End() const { return new Iterator(this, container_.end()); } private: typedef typename ::std::vector ContainerType; class Iterator : public ParamIteratorInterface { public: Iterator(const ParamGeneratorInterface* base, typename ContainerType::const_iterator iterator) : base_(base), iterator_(iterator) {} virtual ~Iterator() {} virtual const ParamGeneratorInterface* BaseGenerator() const { return base_; } virtual void Advance() { ++iterator_; value_.reset(); } virtual ParamIteratorInterface* Clone() const { return new Iterator(*this); } // We need to use cached value referenced by iterator_ because *iterator_ // can return a temporary object (and of type other then T), so just // having "return &*iterator_;" doesn't work. // value_ is updated here and not in Advance() because Advance() // can advance iterator_ beyond the end of the range, and we cannot // detect that fact. The client code, on the other hand, is // responsible for not calling Current() on an out-of-range iterator. virtual const T* Current() const { if (value_.get() == NULL) value_.reset(new T(*iterator_)); return value_.get(); } virtual bool Equals(const ParamIteratorInterface& other) const { // Having the same base generator guarantees that the other // iterator is of the same type and we can downcast. GTEST_CHECK_(BaseGenerator() == other.BaseGenerator()) << "The program attempted to compare iterators " << "from different generators." << std::endl; return iterator_ == CheckedDowncastToActualType(&other)->iterator_; } private: Iterator(const Iterator& other) // The explicit constructor call suppresses a false warning // emitted by gcc when supplied with the -Wextra option. : ParamIteratorInterface(), base_(other.base_), iterator_(other.iterator_) {} const ParamGeneratorInterface* const base_; typename ContainerType::const_iterator iterator_; // A cached value of *iterator_. We keep it here to allow access by // pointer in the wrapping iterator's operator->(). // value_ needs to be mutable to be accessed in Current(). // Use of scoped_ptr helps manage cached value's lifetime, // which is bound by the lifespan of the iterator itself. mutable scoped_ptr value_; }; // class ValuesInIteratorRangeGenerator::Iterator // No implementation - assignment is unsupported. void operator=(const ValuesInIteratorRangeGenerator& other); const ContainerType container_; }; // class ValuesInIteratorRangeGenerator // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. // // Default parameterized test name generator, returns a string containing the // integer test parameter index. template std::string DefaultParamName(const TestParamInfo& info) { Message name_stream; name_stream << info.index; return name_stream.GetString(); } // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. // // Parameterized test name overload helpers, which help the // INSTANTIATE_TEST_CASE_P macro choose between the default parameterized // test name generator and user param name generator. template ParamNameGenFunctor GetParamNameGen(ParamNameGenFunctor func) { return func; } template struct ParamNameGenFunc { typedef std::string Type(const TestParamInfo&); }; template typename ParamNameGenFunc::Type *GetParamNameGen() { return DefaultParamName; } // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. // // Stores a parameter value and later creates tests parameterized with that // value. template class ParameterizedTestFactory : public TestFactoryBase { public: typedef typename TestClass::ParamType ParamType; explicit ParameterizedTestFactory(ParamType parameter) : parameter_(parameter) {} virtual Test* CreateTest() { TestClass::SetParam(¶meter_); return new TestClass(); } private: const ParamType parameter_; GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestFactory); }; // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. // // TestMetaFactoryBase is a base class for meta-factories that create // test factories for passing into MakeAndRegisterTestInfo function. template class TestMetaFactoryBase { public: virtual ~TestMetaFactoryBase() {} virtual TestFactoryBase* CreateTestFactory(ParamType parameter) = 0; }; // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. // // TestMetaFactory creates test factories for passing into // MakeAndRegisterTestInfo function. Since MakeAndRegisterTestInfo receives // ownership of test factory pointer, same factory object cannot be passed // into that method twice. But ParameterizedTestCaseInfo is going to call // it for each Test/Parameter value combination. Thus it needs meta factory // creator class. template class TestMetaFactory : public TestMetaFactoryBase { public: typedef typename TestCase::ParamType ParamType; TestMetaFactory() {} virtual TestFactoryBase* CreateTestFactory(ParamType parameter) { return new ParameterizedTestFactory(parameter); } private: GTEST_DISALLOW_COPY_AND_ASSIGN_(TestMetaFactory); }; // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. // // ParameterizedTestCaseInfoBase is a generic interface // to ParameterizedTestCaseInfo classes. ParameterizedTestCaseInfoBase // accumulates test information provided by TEST_P macro invocations // and generators provided by INSTANTIATE_TEST_CASE_P macro invocations // and uses that information to register all resulting test instances // in RegisterTests method. The ParameterizeTestCaseRegistry class holds // a collection of pointers to the ParameterizedTestCaseInfo objects // and calls RegisterTests() on each of them when asked. class ParameterizedTestCaseInfoBase { public: virtual ~ParameterizedTestCaseInfoBase() {} // Base part of test case name for display purposes. virtual const std::string& GetTestCaseName() const = 0; // Test case id to verify identity. virtual TypeId GetTestCaseTypeId() const = 0; // UnitTest class invokes this method to register tests in this // test case right before running them in RUN_ALL_TESTS macro. // This method should not be called more then once on any single // instance of a ParameterizedTestCaseInfoBase derived class. virtual void RegisterTests() = 0; protected: ParameterizedTestCaseInfoBase() {} private: GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestCaseInfoBase); }; // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. // // ParameterizedTestCaseInfo accumulates tests obtained from TEST_P // macro invocations for a particular test case and generators // obtained from INSTANTIATE_TEST_CASE_P macro invocations for that // test case. It registers tests with all values generated by all // generators when asked. template class ParameterizedTestCaseInfo : public ParameterizedTestCaseInfoBase { public: // ParamType and GeneratorCreationFunc are private types but are required // for declarations of public methods AddTestPattern() and // AddTestCaseInstantiation(). typedef typename TestCase::ParamType ParamType; // A function that returns an instance of appropriate generator type. typedef ParamGenerator(GeneratorCreationFunc)(); typedef typename ParamNameGenFunc::Type ParamNameGeneratorFunc; explicit ParameterizedTestCaseInfo( const char* name, CodeLocation code_location) : test_case_name_(name), code_location_(code_location) {} // Test case base name for display purposes. virtual const std::string& GetTestCaseName() const { return test_case_name_; } // Test case id to verify identity. virtual TypeId GetTestCaseTypeId() const { return GetTypeId(); } // TEST_P macro uses AddTestPattern() to record information // about a single test in a LocalTestInfo structure. // test_case_name is the base name of the test case (without invocation // prefix). test_base_name is the name of an individual test without // parameter index. For the test SequenceA/FooTest.DoBar/1 FooTest is // test case base name and DoBar is test base name. void AddTestPattern(const char* test_case_name, const char* test_base_name, TestMetaFactoryBase* meta_factory) { tests_.push_back(linked_ptr(new TestInfo(test_case_name, test_base_name, meta_factory))); } // INSTANTIATE_TEST_CASE_P macro uses AddGenerator() to record information // about a generator. int AddTestCaseInstantiation(const std::string& instantiation_name, GeneratorCreationFunc* func, ParamNameGeneratorFunc* name_func, const char* file, int line) { instantiations_.push_back( InstantiationInfo(instantiation_name, func, name_func, file, line)); return 0; // Return value used only to run this method in namespace scope. } // UnitTest class invokes this method to register tests in this test case // test cases right before running tests in RUN_ALL_TESTS macro. // This method should not be called more then once on any single // instance of a ParameterizedTestCaseInfoBase derived class. // UnitTest has a guard to prevent from calling this method more then once. virtual void RegisterTests() { for (typename TestInfoContainer::iterator test_it = tests_.begin(); test_it != tests_.end(); ++test_it) { linked_ptr test_info = *test_it; for (typename InstantiationContainer::iterator gen_it = instantiations_.begin(); gen_it != instantiations_.end(); ++gen_it) { const std::string& instantiation_name = gen_it->name; ParamGenerator generator((*gen_it->generator)()); ParamNameGeneratorFunc* name_func = gen_it->name_func; const char* file = gen_it->file; int line = gen_it->line; std::string test_case_name; if ( !instantiation_name.empty() ) test_case_name = instantiation_name + "/"; test_case_name += test_info->test_case_base_name; size_t i = 0; std::set test_param_names; for (typename ParamGenerator::iterator param_it = generator.begin(); param_it != generator.end(); ++param_it, ++i) { Message test_name_stream; std::string param_name = name_func( TestParamInfo(*param_it, i)); GTEST_CHECK_(IsValidParamName(param_name)) << "Parameterized test name '" << param_name << "' is invalid, in " << file << " line " << line << std::endl; GTEST_CHECK_(test_param_names.count(param_name) == 0) << "Duplicate parameterized test name '" << param_name << "', in " << file << " line " << line << std::endl; test_param_names.insert(param_name); test_name_stream << test_info->test_base_name << "/" << param_name; MakeAndRegisterTestInfo( test_case_name.c_str(), test_name_stream.GetString().c_str(), NULL, // No type parameter. PrintToString(*param_it).c_str(), code_location_, GetTestCaseTypeId(), TestCase::SetUpTestCase, TestCase::TearDownTestCase, test_info->test_meta_factory->CreateTestFactory(*param_it)); } // for param_it } // for gen_it } // for test_it } // RegisterTests private: // LocalTestInfo structure keeps information about a single test registered // with TEST_P macro. struct TestInfo { TestInfo(const char* a_test_case_base_name, const char* a_test_base_name, TestMetaFactoryBase* a_test_meta_factory) : test_case_base_name(a_test_case_base_name), test_base_name(a_test_base_name), test_meta_factory(a_test_meta_factory) {} const std::string test_case_base_name; const std::string test_base_name; const scoped_ptr > test_meta_factory; }; typedef ::std::vector > TestInfoContainer; // Records data received from INSTANTIATE_TEST_CASE_P macros: // struct InstantiationInfo { InstantiationInfo(const std::string &name_in, GeneratorCreationFunc* generator_in, ParamNameGeneratorFunc* name_func_in, const char* file_in, int line_in) : name(name_in), generator(generator_in), name_func(name_func_in), file(file_in), line(line_in) {} std::string name; GeneratorCreationFunc* generator; ParamNameGeneratorFunc* name_func; const char* file; int line; }; typedef ::std::vector InstantiationContainer; static bool IsValidParamName(const std::string& name) { // Check for empty string if (name.empty()) return false; // Check for invalid characters for (std::string::size_type index = 0; index < name.size(); ++index) { if (!isalnum(name[index]) && name[index] != '_') return false; } return true; } const std::string test_case_name_; CodeLocation code_location_; TestInfoContainer tests_; InstantiationContainer instantiations_; GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestCaseInfo); }; // class ParameterizedTestCaseInfo // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. // // ParameterizedTestCaseRegistry contains a map of ParameterizedTestCaseInfoBase // classes accessed by test case names. TEST_P and INSTANTIATE_TEST_CASE_P // macros use it to locate their corresponding ParameterizedTestCaseInfo // descriptors. class ParameterizedTestCaseRegistry { public: ParameterizedTestCaseRegistry() {} ~ParameterizedTestCaseRegistry() { for (TestCaseInfoContainer::iterator it = test_case_infos_.begin(); it != test_case_infos_.end(); ++it) { delete *it; } } // Looks up or creates and returns a structure containing information about // tests and instantiations of a particular test case. template ParameterizedTestCaseInfo* GetTestCasePatternHolder( const char* test_case_name, CodeLocation code_location) { ParameterizedTestCaseInfo* typed_test_info = NULL; for (TestCaseInfoContainer::iterator it = test_case_infos_.begin(); it != test_case_infos_.end(); ++it) { if ((*it)->GetTestCaseName() == test_case_name) { if ((*it)->GetTestCaseTypeId() != GetTypeId()) { // Complain about incorrect usage of Google Test facilities // and terminate the program since we cannot guaranty correct // test case setup and tear-down in this case. ReportInvalidTestCaseType(test_case_name, code_location); posix::Abort(); } else { // At this point we are sure that the object we found is of the same // type we are looking for, so we downcast it to that type // without further checks. typed_test_info = CheckedDowncastToActualType< ParameterizedTestCaseInfo >(*it); } break; } } if (typed_test_info == NULL) { typed_test_info = new ParameterizedTestCaseInfo( test_case_name, code_location); test_case_infos_.push_back(typed_test_info); } return typed_test_info; } void RegisterTests() { for (TestCaseInfoContainer::iterator it = test_case_infos_.begin(); it != test_case_infos_.end(); ++it) { (*it)->RegisterTests(); } } private: typedef ::std::vector TestCaseInfoContainer; TestCaseInfoContainer test_case_infos_; GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestCaseRegistry); }; } // namespace internal } // namespace testing #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_ iptux-0.9.4/src/googletest/include/gtest/internal/gtest-port-arch.h000066400000000000000000000072131475473122500254360ustar00rootroot00000000000000// Copyright 2015, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // The Google C++ Testing and Mocking Framework (Google Test) // // This header file defines the GTEST_OS_* macro. // It is separate from gtest-port.h so that custom/gtest-port.h can include it. #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_ARCH_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_ARCH_H_ // Determines the platform on which Google Test is compiled. #ifdef __CYGWIN__ # define GTEST_OS_CYGWIN 1 #elif defined __SYMBIAN32__ # define GTEST_OS_SYMBIAN 1 #elif defined _WIN32 # define GTEST_OS_WINDOWS 1 # ifdef _WIN32_WCE # define GTEST_OS_WINDOWS_MOBILE 1 # elif defined(__MINGW__) || defined(__MINGW32__) # define GTEST_OS_WINDOWS_MINGW 1 # elif defined(WINAPI_FAMILY) # include # if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) # define GTEST_OS_WINDOWS_DESKTOP 1 # elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP) # define GTEST_OS_WINDOWS_PHONE 1 # elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) # define GTEST_OS_WINDOWS_RT 1 # elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_TV_TITLE) # define GTEST_OS_WINDOWS_PHONE 1 # define GTEST_OS_WINDOWS_TV_TITLE 1 # else // WINAPI_FAMILY defined but no known partition matched. // Default to desktop. # define GTEST_OS_WINDOWS_DESKTOP 1 # endif # else # define GTEST_OS_WINDOWS_DESKTOP 1 # endif // _WIN32_WCE #elif defined __APPLE__ # define GTEST_OS_MAC 1 # if TARGET_OS_IPHONE # define GTEST_OS_IOS 1 # endif #elif defined __FreeBSD__ # define GTEST_OS_FREEBSD 1 #elif defined __Fuchsia__ # define GTEST_OS_FUCHSIA 1 #elif defined __linux__ # define GTEST_OS_LINUX 1 # if defined __ANDROID__ # define GTEST_OS_LINUX_ANDROID 1 # endif #elif defined __MVS__ # define GTEST_OS_ZOS 1 #elif defined(__sun) && defined(__SVR4) # define GTEST_OS_SOLARIS 1 #elif defined(_AIX) # define GTEST_OS_AIX 1 #elif defined(__hpux) # define GTEST_OS_HPUX 1 #elif defined __native_client__ # define GTEST_OS_NACL 1 #elif defined __NetBSD__ # define GTEST_OS_NETBSD 1 #elif defined __OpenBSD__ # define GTEST_OS_OPENBSD 1 #elif defined __QNX__ # define GTEST_OS_QNX 1 #endif // __CYGWIN__ #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_ARCH_H_ iptux-0.9.4/src/googletest/include/gtest/internal/gtest-port.h000066400000000000000000002727531475473122500245400ustar00rootroot00000000000000// Copyright 2005, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // Low-level types and utilities for porting Google Test to various // platforms. All macros ending with _ and symbols defined in an // internal namespace are subject to change without notice. Code // outside Google Test MUST NOT USE THEM DIRECTLY. Macros that don't // end with _ are part of Google Test's public API and can be used by // code outside Google Test. // // This file is fundamental to Google Test. All other Google Test source // files are expected to #include this. Therefore, it cannot #include // any other Google Test header. // GOOGLETEST_CM0001 DO NOT DELETE #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_ // Environment-describing macros // ----------------------------- // // Google Test can be used in many different environments. Macros in // this section tell Google Test what kind of environment it is being // used in, such that Google Test can provide environment-specific // features and implementations. // // Google Test tries to automatically detect the properties of its // environment, so users usually don't need to worry about these // macros. However, the automatic detection is not perfect. // Sometimes it's necessary for a user to define some of the following // macros in the build script to override Google Test's decisions. // // If the user doesn't define a macro in the list, Google Test will // provide a default definition. After this header is #included, all // macros in this list will be defined to either 1 or 0. // // Notes to maintainers: // - Each macro here is a user-tweakable knob; do not grow the list // lightly. // - Use #if to key off these macros. Don't use #ifdef or "#if // defined(...)", which will not work as these macros are ALWAYS // defined. // // GTEST_HAS_CLONE - Define it to 1/0 to indicate that clone(2) // is/isn't available. // GTEST_HAS_EXCEPTIONS - Define it to 1/0 to indicate that exceptions // are enabled. // GTEST_HAS_GLOBAL_STRING - Define it to 1/0 to indicate that ::string // is/isn't available // GTEST_HAS_GLOBAL_WSTRING - Define it to 1/0 to indicate that ::wstring // is/isn't available // GTEST_HAS_POSIX_RE - Define it to 1/0 to indicate that POSIX regular // expressions are/aren't available. // GTEST_HAS_PTHREAD - Define it to 1/0 to indicate that // is/isn't available. // GTEST_HAS_RTTI - Define it to 1/0 to indicate that RTTI is/isn't // enabled. // GTEST_HAS_STD_WSTRING - Define it to 1/0 to indicate that // std::wstring does/doesn't work (Google Test can // be used where std::wstring is unavailable). // GTEST_HAS_TR1_TUPLE - Define it to 1/0 to indicate tr1::tuple // is/isn't available. // GTEST_HAS_SEH - Define it to 1/0 to indicate whether the // compiler supports Microsoft's "Structured // Exception Handling". // GTEST_HAS_STREAM_REDIRECTION // - Define it to 1/0 to indicate whether the // platform supports I/O stream redirection using // dup() and dup2(). // GTEST_USE_OWN_TR1_TUPLE - Define it to 1/0 to indicate whether Google // Test's own tr1 tuple implementation should be // used. Unused when the user sets // GTEST_HAS_TR1_TUPLE to 0. // GTEST_LANG_CXX11 - Define it to 1/0 to indicate that Google Test // is building in C++11/C++98 mode. // GTEST_LINKED_AS_SHARED_LIBRARY // - Define to 1 when compiling tests that use // Google Test as a shared library (known as // DLL on Windows). // GTEST_CREATE_SHARED_LIBRARY // - Define to 1 when compiling Google Test itself // as a shared library. // GTEST_DEFAULT_DEATH_TEST_STYLE // - The default value of --gtest_death_test_style. // The legacy default has been "fast" in the open // source version since 2008. The recommended value // is "threadsafe", and can be set in // custom/gtest-port.h. // Platform-indicating macros // -------------------------- // // Macros indicating the platform on which Google Test is being used // (a macro is defined to 1 if compiled on the given platform; // otherwise UNDEFINED -- it's never defined to 0.). Google Test // defines these macros automatically. Code outside Google Test MUST // NOT define them. // // GTEST_OS_AIX - IBM AIX // GTEST_OS_CYGWIN - Cygwin // GTEST_OS_FREEBSD - FreeBSD // GTEST_OS_FUCHSIA - Fuchsia // GTEST_OS_HPUX - HP-UX // GTEST_OS_LINUX - Linux // GTEST_OS_LINUX_ANDROID - Google Android // GTEST_OS_MAC - Mac OS X // GTEST_OS_IOS - iOS // GTEST_OS_NACL - Google Native Client (NaCl) // GTEST_OS_NETBSD - NetBSD // GTEST_OS_OPENBSD - OpenBSD // GTEST_OS_QNX - QNX // GTEST_OS_SOLARIS - Sun Solaris // GTEST_OS_SYMBIAN - Symbian // GTEST_OS_WINDOWS - Windows (Desktop, MinGW, or Mobile) // GTEST_OS_WINDOWS_DESKTOP - Windows Desktop // GTEST_OS_WINDOWS_MINGW - MinGW // GTEST_OS_WINDOWS_MOBILE - Windows Mobile // GTEST_OS_WINDOWS_PHONE - Windows Phone // GTEST_OS_WINDOWS_RT - Windows Store App/WinRT // GTEST_OS_ZOS - z/OS // // Among the platforms, Cygwin, Linux, Max OS X, and Windows have the // most stable support. Since core members of the Google Test project // don't have access to other platforms, support for them may be less // stable. If you notice any problems on your platform, please notify // googletestframework@googlegroups.com (patches for fixing them are // even more welcome!). // // It is possible that none of the GTEST_OS_* macros are defined. // Feature-indicating macros // ------------------------- // // Macros indicating which Google Test features are available (a macro // is defined to 1 if the corresponding feature is supported; // otherwise UNDEFINED -- it's never defined to 0.). Google Test // defines these macros automatically. Code outside Google Test MUST // NOT define them. // // These macros are public so that portable tests can be written. // Such tests typically surround code using a feature with an #if // which controls that code. For example: // // #if GTEST_HAS_DEATH_TEST // EXPECT_DEATH(DoSomethingDeadly()); // #endif // // GTEST_HAS_COMBINE - the Combine() function (for value-parameterized // tests) // GTEST_HAS_DEATH_TEST - death tests // GTEST_HAS_TYPED_TEST - typed tests // GTEST_HAS_TYPED_TEST_P - type-parameterized tests // GTEST_IS_THREADSAFE - Google Test is thread-safe. // GOOGLETEST_CM0007 DO NOT DELETE // GTEST_USES_POSIX_RE - enhanced POSIX regex is used. Do not confuse with // GTEST_HAS_POSIX_RE (see above) which users can // define themselves. // GTEST_USES_SIMPLE_RE - our own simple regex is used; // the above RE\b(s) are mutually exclusive. // GTEST_CAN_COMPARE_NULL - accepts untyped NULL in EXPECT_EQ(). // Misc public macros // ------------------ // // GTEST_FLAG(flag_name) - references the variable corresponding to // the given Google Test flag. // Internal utilities // ------------------ // // The following macros and utilities are for Google Test's INTERNAL // use only. Code outside Google Test MUST NOT USE THEM DIRECTLY. // // Macros for basic C++ coding: // GTEST_AMBIGUOUS_ELSE_BLOCKER_ - for disabling a gcc warning. // GTEST_ATTRIBUTE_UNUSED_ - declares that a class' instances or a // variable don't have to be used. // GTEST_DISALLOW_ASSIGN_ - disables operator=. // GTEST_DISALLOW_COPY_AND_ASSIGN_ - disables copy ctor and operator=. // GTEST_MUST_USE_RESULT_ - declares that a function's result must be used. // GTEST_INTENTIONAL_CONST_COND_PUSH_ - start code section where MSVC C4127 is // suppressed (constant conditional). // GTEST_INTENTIONAL_CONST_COND_POP_ - finish code section where MSVC C4127 // is suppressed. // // C++11 feature wrappers: // // testing::internal::forward - portability wrapper for std::forward. // testing::internal::move - portability wrapper for std::move. // // Synchronization: // Mutex, MutexLock, ThreadLocal, GetThreadCount() // - synchronization primitives. // // Template meta programming: // is_pointer - as in TR1; needed on Symbian and IBM XL C/C++ only. // IteratorTraits - partial implementation of std::iterator_traits, which // is not available in libCstd when compiled with Sun C++. // // Smart pointers: // scoped_ptr - as in TR2. // // Regular expressions: // RE - a simple regular expression class using the POSIX // Extended Regular Expression syntax on UNIX-like platforms // GOOGLETEST_CM0008 DO NOT DELETE // or a reduced regular exception syntax on other // platforms, including Windows. // Logging: // GTEST_LOG_() - logs messages at the specified severity level. // LogToStderr() - directs all log messages to stderr. // FlushInfoLog() - flushes informational log messages. // // Stdout and stderr capturing: // CaptureStdout() - starts capturing stdout. // GetCapturedStdout() - stops capturing stdout and returns the captured // string. // CaptureStderr() - starts capturing stderr. // GetCapturedStderr() - stops capturing stderr and returns the captured // string. // // Integer types: // TypeWithSize - maps an integer to a int type. // Int32, UInt32, Int64, UInt64, TimeInMillis // - integers of known sizes. // BiggestInt - the biggest signed integer type. // // Command-line utilities: // GTEST_DECLARE_*() - declares a flag. // GTEST_DEFINE_*() - defines a flag. // GetInjectableArgvs() - returns the command line as a vector of strings. // // Environment variable utilities: // GetEnv() - gets the value of an environment variable. // BoolFromGTestEnv() - parses a bool environment variable. // Int32FromGTestEnv() - parses an Int32 environment variable. // StringFromGTestEnv() - parses a string environment variable. #include // for isspace, etc #include // for ptrdiff_t #include #include #include #ifndef _WIN32_WCE # include # include #endif // !_WIN32_WCE #if defined __APPLE__ # include # include #endif // Brings in the definition of HAS_GLOBAL_STRING. This must be done // BEFORE we test HAS_GLOBAL_STRING. #include // NOLINT #include // NOLINT #include // NOLINT #include // NOLINT #include #include // NOLINT #include "gtest/internal/gtest-port-arch.h" #include "gtest/internal/custom/gtest-port.h" #if !defined(GTEST_DEV_EMAIL_) # define GTEST_DEV_EMAIL_ "googletestframework@@googlegroups.com" # define GTEST_FLAG_PREFIX_ "gtest_" # define GTEST_FLAG_PREFIX_DASH_ "gtest-" # define GTEST_FLAG_PREFIX_UPPER_ "GTEST_" # define GTEST_NAME_ "Google Test" # define GTEST_PROJECT_URL_ "https://github.com/google/googletest/" #endif // !defined(GTEST_DEV_EMAIL_) #if !defined(GTEST_INIT_GOOGLE_TEST_NAME_) # define GTEST_INIT_GOOGLE_TEST_NAME_ "testing::InitGoogleTest" #endif // !defined(GTEST_INIT_GOOGLE_TEST_NAME_) // Determines the version of gcc that is used to compile this. #ifdef __GNUC__ // 40302 means version 4.3.2. # define GTEST_GCC_VER_ \ (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__) #endif // __GNUC__ // Macros for disabling Microsoft Visual C++ warnings. // // GTEST_DISABLE_MSC_WARNINGS_PUSH_(4800 4385) // /* code that triggers warnings C4800 and C4385 */ // GTEST_DISABLE_MSC_WARNINGS_POP_() #if _MSC_VER >= 1400 # define GTEST_DISABLE_MSC_WARNINGS_PUSH_(warnings) \ __pragma(warning(push)) \ __pragma(warning(disable: warnings)) # define GTEST_DISABLE_MSC_WARNINGS_POP_() \ __pragma(warning(pop)) #else // Older versions of MSVC don't have __pragma. # define GTEST_DISABLE_MSC_WARNINGS_PUSH_(warnings) # define GTEST_DISABLE_MSC_WARNINGS_POP_() #endif // Clang on Windows does not understand MSVC's pragma warning. // We need clang-specific way to disable function deprecation warning. #ifdef __clang__ # define GTEST_DISABLE_MSC_DEPRECATED_PUSH_() \ _Pragma("clang diagnostic push") \ _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") \ _Pragma("clang diagnostic ignored \"-Wdeprecated-implementations\"") #define GTEST_DISABLE_MSC_DEPRECATED_POP_() \ _Pragma("clang diagnostic pop") #else # define GTEST_DISABLE_MSC_DEPRECATED_PUSH_() \ GTEST_DISABLE_MSC_WARNINGS_PUSH_(4996) # define GTEST_DISABLE_MSC_DEPRECATED_POP_() \ GTEST_DISABLE_MSC_WARNINGS_POP_() #endif #ifndef GTEST_LANG_CXX11 // gcc and clang define __GXX_EXPERIMENTAL_CXX0X__ when // -std={c,gnu}++{0x,11} is passed. The C++11 standard specifies a // value for __cplusplus, and recent versions of clang, gcc, and // probably other compilers set that too in C++11 mode. # if __GXX_EXPERIMENTAL_CXX0X__ || __cplusplus >= 201103L || _MSC_VER >= 1900 // Compiling in at least C++11 mode. # define GTEST_LANG_CXX11 1 # else # define GTEST_LANG_CXX11 0 # endif #endif // Distinct from C++11 language support, some environments don't provide // proper C++11 library support. Notably, it's possible to build in // C++11 mode when targeting Mac OS X 10.6, which has an old libstdc++ // with no C++11 support. // // libstdc++ has sufficient C++11 support as of GCC 4.6.0, __GLIBCXX__ // 20110325, but maintenance releases in the 4.4 and 4.5 series followed // this date, so check for those versions by their date stamps. // https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html#abi.versioning #if GTEST_LANG_CXX11 && \ (!defined(__GLIBCXX__) || ( \ __GLIBCXX__ >= 20110325ul && /* GCC >= 4.6.0 */ \ /* Blacklist of patch releases of older branches: */ \ __GLIBCXX__ != 20110416ul && /* GCC 4.4.6 */ \ __GLIBCXX__ != 20120313ul && /* GCC 4.4.7 */ \ __GLIBCXX__ != 20110428ul && /* GCC 4.5.3 */ \ __GLIBCXX__ != 20120702ul)) /* GCC 4.5.4 */ # define GTEST_STDLIB_CXX11 1 #endif // Only use C++11 library features if the library provides them. #if GTEST_STDLIB_CXX11 # define GTEST_HAS_STD_BEGIN_AND_END_ 1 # define GTEST_HAS_STD_FORWARD_LIST_ 1 # if !defined(_MSC_VER) || (_MSC_FULL_VER >= 190023824) // works only with VS2015U2 and better # define GTEST_HAS_STD_FUNCTION_ 1 # endif # define GTEST_HAS_STD_INITIALIZER_LIST_ 1 # define GTEST_HAS_STD_MOVE_ 1 # define GTEST_HAS_STD_UNIQUE_PTR_ 1 # define GTEST_HAS_STD_SHARED_PTR_ 1 # define GTEST_HAS_UNORDERED_MAP_ 1 # define GTEST_HAS_UNORDERED_SET_ 1 #endif // C++11 specifies that provides std::tuple. // Some platforms still might not have it, however. #if GTEST_LANG_CXX11 # define GTEST_HAS_STD_TUPLE_ 1 # if defined(__clang__) // Inspired by // https://clang.llvm.org/docs/LanguageExtensions.html#include-file-checking-macros # if defined(__has_include) && !__has_include() # undef GTEST_HAS_STD_TUPLE_ # endif # elif defined(_MSC_VER) // Inspired by boost/config/stdlib/dinkumware.hpp # if defined(_CPPLIB_VER) && _CPPLIB_VER < 520 # undef GTEST_HAS_STD_TUPLE_ # endif # elif defined(__GLIBCXX__) // Inspired by boost/config/stdlib/libstdcpp3.hpp, // http://gcc.gnu.org/gcc-4.2/changes.html and // https://web.archive.org/web/20140227044429/gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt01ch01.html#manual.intro.status.standard.200x # if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 2) # undef GTEST_HAS_STD_TUPLE_ # endif # endif #endif // Brings in definitions for functions used in the testing::internal::posix // namespace (read, write, close, chdir, isatty, stat). We do not currently // use them on Windows Mobile. #if GTEST_OS_WINDOWS # if !GTEST_OS_WINDOWS_MOBILE # include # include # endif // In order to avoid having to include , use forward declaration #if GTEST_OS_WINDOWS_MINGW && !defined(__MINGW64_VERSION_MAJOR) // MinGW defined _CRITICAL_SECTION and _RTL_CRITICAL_SECTION as two // separate (equivalent) structs, instead of using typedef typedef struct _CRITICAL_SECTION GTEST_CRITICAL_SECTION; #else // Assume CRITICAL_SECTION is a typedef of _RTL_CRITICAL_SECTION. // This assumption is verified by // WindowsTypesTest.CRITICAL_SECTIONIs_RTL_CRITICAL_SECTION. typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION; #endif #else // This assumes that non-Windows OSes provide unistd.h. For OSes where this // is not the case, we need to include headers that provide the functions // mentioned above. # include # include #endif // GTEST_OS_WINDOWS #if GTEST_OS_LINUX_ANDROID // Used to define __ANDROID_API__ matching the target NDK API level. # include // NOLINT #endif // Defines this to true iff Google Test can use POSIX regular expressions. #ifndef GTEST_HAS_POSIX_RE # if GTEST_OS_LINUX_ANDROID // On Android, is only available starting with Gingerbread. # define GTEST_HAS_POSIX_RE (__ANDROID_API__ >= 9) # else # define GTEST_HAS_POSIX_RE (!GTEST_OS_WINDOWS) # endif #endif #if GTEST_USES_PCRE // The appropriate headers have already been included. #elif GTEST_HAS_POSIX_RE // On some platforms, needs someone to define size_t, and // won't compile otherwise. We can #include it here as we already // included , which is guaranteed to define size_t through // . # include // NOLINT # define GTEST_USES_POSIX_RE 1 #elif GTEST_OS_WINDOWS // is not available on Windows. Use our own simple regex // implementation instead. # define GTEST_USES_SIMPLE_RE 1 #else // may not be available on this platform. Use our own // simple regex implementation instead. # define GTEST_USES_SIMPLE_RE 1 #endif // GTEST_USES_PCRE #ifndef GTEST_HAS_EXCEPTIONS // The user didn't tell us whether exceptions are enabled, so we need // to figure it out. # if defined(_MSC_VER) && defined(_CPPUNWIND) // MSVC defines _CPPUNWIND to 1 iff exceptions are enabled. # define GTEST_HAS_EXCEPTIONS 1 # elif defined(__BORLANDC__) // C++Builder's implementation of the STL uses the _HAS_EXCEPTIONS // macro to enable exceptions, so we'll do the same. // Assumes that exceptions are enabled by default. # ifndef _HAS_EXCEPTIONS # define _HAS_EXCEPTIONS 1 # endif // _HAS_EXCEPTIONS # define GTEST_HAS_EXCEPTIONS _HAS_EXCEPTIONS # elif defined(__clang__) // clang defines __EXCEPTIONS iff exceptions are enabled before clang 220714, // but iff cleanups are enabled after that. In Obj-C++ files, there can be // cleanups for ObjC exceptions which also need cleanups, even if C++ exceptions // are disabled. clang has __has_feature(cxx_exceptions) which checks for C++ // exceptions starting at clang r206352, but which checked for cleanups prior to // that. To reliably check for C++ exception availability with clang, check for // __EXCEPTIONS && __has_feature(cxx_exceptions). # define GTEST_HAS_EXCEPTIONS (__EXCEPTIONS && __has_feature(cxx_exceptions)) # elif defined(__GNUC__) && __EXCEPTIONS // gcc defines __EXCEPTIONS to 1 iff exceptions are enabled. # define GTEST_HAS_EXCEPTIONS 1 # elif defined(__SUNPRO_CC) // Sun Pro CC supports exceptions. However, there is no compile-time way of // detecting whether they are enabled or not. Therefore, we assume that // they are enabled unless the user tells us otherwise. # define GTEST_HAS_EXCEPTIONS 1 # elif defined(__IBMCPP__) && __EXCEPTIONS // xlC defines __EXCEPTIONS to 1 iff exceptions are enabled. # define GTEST_HAS_EXCEPTIONS 1 # elif defined(__HP_aCC) // Exception handling is in effect by default in HP aCC compiler. It has to // be turned of by +noeh compiler option if desired. # define GTEST_HAS_EXCEPTIONS 1 # else // For other compilers, we assume exceptions are disabled to be // conservative. # define GTEST_HAS_EXCEPTIONS 0 # endif // defined(_MSC_VER) || defined(__BORLANDC__) #endif // GTEST_HAS_EXCEPTIONS #if !defined(GTEST_HAS_STD_STRING) // Even though we don't use this macro any longer, we keep it in case // some clients still depend on it. # define GTEST_HAS_STD_STRING 1 #elif !GTEST_HAS_STD_STRING // The user told us that ::std::string isn't available. # error "::std::string isn't available." #endif // !defined(GTEST_HAS_STD_STRING) #ifndef GTEST_HAS_GLOBAL_STRING # define GTEST_HAS_GLOBAL_STRING 0 #endif // GTEST_HAS_GLOBAL_STRING #ifndef GTEST_HAS_STD_WSTRING // The user didn't tell us whether ::std::wstring is available, so we need // to figure it out. // FIXME: uses autoconf to detect whether ::std::wstring // is available. // Cygwin 1.7 and below doesn't support ::std::wstring. // Solaris' libc++ doesn't support it either. Android has // no support for it at least as recent as Froyo (2.2). # define GTEST_HAS_STD_WSTRING \ (!(GTEST_OS_LINUX_ANDROID || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS)) #endif // GTEST_HAS_STD_WSTRING #ifndef GTEST_HAS_GLOBAL_WSTRING // The user didn't tell us whether ::wstring is available, so we need // to figure it out. # define GTEST_HAS_GLOBAL_WSTRING \ (GTEST_HAS_STD_WSTRING && GTEST_HAS_GLOBAL_STRING) #endif // GTEST_HAS_GLOBAL_WSTRING // Determines whether RTTI is available. #ifndef GTEST_HAS_RTTI // The user didn't tell us whether RTTI is enabled, so we need to // figure it out. # ifdef _MSC_VER # ifdef _CPPRTTI // MSVC defines this macro iff RTTI is enabled. # define GTEST_HAS_RTTI 1 # else # define GTEST_HAS_RTTI 0 # endif // Starting with version 4.3.2, gcc defines __GXX_RTTI iff RTTI is enabled. # elif defined(__GNUC__) && (GTEST_GCC_VER_ >= 40302) # ifdef __GXX_RTTI // When building against STLport with the Android NDK and with // -frtti -fno-exceptions, the build fails at link time with undefined // references to __cxa_bad_typeid. Note sure if STL or toolchain bug, // so disable RTTI when detected. # if GTEST_OS_LINUX_ANDROID && defined(_STLPORT_MAJOR) && \ !defined(__EXCEPTIONS) # define GTEST_HAS_RTTI 0 # else # define GTEST_HAS_RTTI 1 # endif // GTEST_OS_LINUX_ANDROID && __STLPORT_MAJOR && !__EXCEPTIONS # else # define GTEST_HAS_RTTI 0 # endif // __GXX_RTTI // Clang defines __GXX_RTTI starting with version 3.0, but its manual recommends // using has_feature instead. has_feature(cxx_rtti) is supported since 2.7, the // first version with C++ support. # elif defined(__clang__) # define GTEST_HAS_RTTI __has_feature(cxx_rtti) // Starting with version 9.0 IBM Visual Age defines __RTTI_ALL__ to 1 if // both the typeid and dynamic_cast features are present. # elif defined(__IBMCPP__) && (__IBMCPP__ >= 900) # ifdef __RTTI_ALL__ # define GTEST_HAS_RTTI 1 # else # define GTEST_HAS_RTTI 0 # endif # else // For all other compilers, we assume RTTI is enabled. # define GTEST_HAS_RTTI 1 # endif // _MSC_VER #endif // GTEST_HAS_RTTI // It's this header's responsibility to #include when RTTI // is enabled. #if GTEST_HAS_RTTI # include #endif // Determines whether Google Test can use the pthreads library. #ifndef GTEST_HAS_PTHREAD // The user didn't tell us explicitly, so we make reasonable assumptions about // which platforms have pthreads support. // // To disable threading support in Google Test, add -DGTEST_HAS_PTHREAD=0 // to your compiler flags. #define GTEST_HAS_PTHREAD \ (GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_HPUX || GTEST_OS_QNX || \ GTEST_OS_FREEBSD || GTEST_OS_NACL || GTEST_OS_NETBSD || GTEST_OS_FUCHSIA) #endif // GTEST_HAS_PTHREAD #if GTEST_HAS_PTHREAD // gtest-port.h guarantees to #include when GTEST_HAS_PTHREAD is // true. # include // NOLINT // For timespec and nanosleep, used below. # include // NOLINT #endif // Determines if hash_map/hash_set are available. // Only used for testing against those containers. #if !defined(GTEST_HAS_HASH_MAP_) # if defined(_MSC_VER) && (_MSC_VER < 1900) # define GTEST_HAS_HASH_MAP_ 1 // Indicates that hash_map is available. # define GTEST_HAS_HASH_SET_ 1 // Indicates that hash_set is available. # endif // _MSC_VER #endif // !defined(GTEST_HAS_HASH_MAP_) // Determines whether Google Test can use tr1/tuple. You can define // this macro to 0 to prevent Google Test from using tuple (any // feature depending on tuple with be disabled in this mode). #ifndef GTEST_HAS_TR1_TUPLE # if GTEST_OS_LINUX_ANDROID && defined(_STLPORT_MAJOR) // STLport, provided with the Android NDK, has neither or . # define GTEST_HAS_TR1_TUPLE 0 # elif defined(_MSC_VER) && (_MSC_VER >= 1910) // Prevent `warning C4996: 'std::tr1': warning STL4002: // The non-Standard std::tr1 namespace and TR1-only machinery // are deprecated and will be REMOVED.` # define GTEST_HAS_TR1_TUPLE 0 # elif GTEST_LANG_CXX11 && defined(_LIBCPP_VERSION) // libc++ doesn't support TR1. # define GTEST_HAS_TR1_TUPLE 0 # else // The user didn't tell us not to do it, so we assume it's OK. # define GTEST_HAS_TR1_TUPLE 1 # endif #endif // GTEST_HAS_TR1_TUPLE // Determines whether Google Test's own tr1 tuple implementation // should be used. #ifndef GTEST_USE_OWN_TR1_TUPLE // We use our own tuple implementation on Symbian. # if GTEST_OS_SYMBIAN # define GTEST_USE_OWN_TR1_TUPLE 1 # else // The user didn't tell us, so we need to figure it out. // We use our own TR1 tuple if we aren't sure the user has an // implementation of it already. At this time, libstdc++ 4.0.0+ and // MSVC 2010 are the only mainstream standard libraries that come // with a TR1 tuple implementation. NVIDIA's CUDA NVCC compiler // pretends to be GCC by defining __GNUC__ and friends, but cannot // compile GCC's tuple implementation. MSVC 2008 (9.0) provides TR1 // tuple in a 323 MB Feature Pack download, which we cannot assume the // user has. QNX's QCC compiler is a modified GCC but it doesn't // support TR1 tuple. libc++ only provides std::tuple, in C++11 mode, // and it can be used with some compilers that define __GNUC__. # if (defined(__GNUC__) && !defined(__CUDACC__) && (GTEST_GCC_VER_ >= 40000) \ && !GTEST_OS_QNX && !defined(_LIBCPP_VERSION)) \ || (_MSC_VER >= 1600 && _MSC_VER < 1900) # define GTEST_ENV_HAS_TR1_TUPLE_ 1 # endif // C++11 specifies that provides std::tuple. Use that if gtest is used // in C++11 mode and libstdc++ isn't very old (binaries targeting OS X 10.6 // can build with clang but need to use gcc4.2's libstdc++). # if GTEST_LANG_CXX11 && (!defined(__GLIBCXX__) || __GLIBCXX__ > 20110325) # define GTEST_ENV_HAS_STD_TUPLE_ 1 # endif # if GTEST_ENV_HAS_TR1_TUPLE_ || GTEST_ENV_HAS_STD_TUPLE_ # define GTEST_USE_OWN_TR1_TUPLE 0 # else # define GTEST_USE_OWN_TR1_TUPLE 1 # endif # endif // GTEST_OS_SYMBIAN #endif // GTEST_USE_OWN_TR1_TUPLE // To avoid conditional compilation we make it gtest-port.h's responsibility // to #include the header implementing tuple. #if GTEST_HAS_STD_TUPLE_ # include // IWYU pragma: export # define GTEST_TUPLE_NAMESPACE_ ::std #endif // GTEST_HAS_STD_TUPLE_ // We include tr1::tuple even if std::tuple is available to define printers for // them. #if GTEST_HAS_TR1_TUPLE # ifndef GTEST_TUPLE_NAMESPACE_ # define GTEST_TUPLE_NAMESPACE_ ::std::tr1 # endif // GTEST_TUPLE_NAMESPACE_ # if GTEST_USE_OWN_TR1_TUPLE # include "gtest/internal/gtest-tuple.h" // IWYU pragma: export // NOLINT # elif GTEST_OS_SYMBIAN // On Symbian, BOOST_HAS_TR1_TUPLE causes Boost's TR1 tuple library to // use STLport's tuple implementation, which unfortunately doesn't // work as the copy of STLport distributed with Symbian is incomplete. // By making sure BOOST_HAS_TR1_TUPLE is undefined, we force Boost to // use its own tuple implementation. # ifdef BOOST_HAS_TR1_TUPLE # undef BOOST_HAS_TR1_TUPLE # endif // BOOST_HAS_TR1_TUPLE // This prevents , which defines // BOOST_HAS_TR1_TUPLE, from being #included by Boost's . # define BOOST_TR1_DETAIL_CONFIG_HPP_INCLUDED # include // IWYU pragma: export // NOLINT # elif defined(__GNUC__) && (GTEST_GCC_VER_ >= 40000) // GCC 4.0+ implements tr1/tuple in the header. This does // not conform to the TR1 spec, which requires the header to be . # if !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302 // Until version 4.3.2, gcc has a bug that causes , // which is #included by , to not compile when RTTI is // disabled. _TR1_FUNCTIONAL is the header guard for // . Hence the following #define is used to prevent // from being included. # define _TR1_FUNCTIONAL 1 # include # undef _TR1_FUNCTIONAL // Allows the user to #include // if they choose to. # else # include // NOLINT # endif // !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302 // VS 2010 now has tr1 support. # elif _MSC_VER >= 1600 # include // IWYU pragma: export // NOLINT # else // GTEST_USE_OWN_TR1_TUPLE # include // IWYU pragma: export // NOLINT # endif // GTEST_USE_OWN_TR1_TUPLE #endif // GTEST_HAS_TR1_TUPLE // Determines whether clone(2) is supported. // Usually it will only be available on Linux, excluding // Linux on the Itanium architecture. // Also see http://linux.die.net/man/2/clone. #ifndef GTEST_HAS_CLONE // The user didn't tell us, so we need to figure it out. # if GTEST_OS_LINUX && !defined(__ia64__) # if GTEST_OS_LINUX_ANDROID // On Android, clone() became available at different API levels for each 32-bit // architecture. # if defined(__LP64__) || \ (defined(__arm__) && __ANDROID_API__ >= 9) || \ (defined(__mips__) && __ANDROID_API__ >= 12) || \ (defined(__i386__) && __ANDROID_API__ >= 17) # define GTEST_HAS_CLONE 1 # else # define GTEST_HAS_CLONE 0 # endif # else # define GTEST_HAS_CLONE 1 # endif # else # define GTEST_HAS_CLONE 0 # endif // GTEST_OS_LINUX && !defined(__ia64__) #endif // GTEST_HAS_CLONE // Determines whether to support stream redirection. This is used to test // output correctness and to implement death tests. #ifndef GTEST_HAS_STREAM_REDIRECTION // By default, we assume that stream redirection is supported on all // platforms except known mobile ones. # if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_SYMBIAN || \ GTEST_OS_WINDOWS_PHONE || GTEST_OS_WINDOWS_RT # define GTEST_HAS_STREAM_REDIRECTION 0 # else # define GTEST_HAS_STREAM_REDIRECTION 1 # endif // !GTEST_OS_WINDOWS_MOBILE && !GTEST_OS_SYMBIAN #endif // GTEST_HAS_STREAM_REDIRECTION // Determines whether to support death tests. // Google Test does not support death tests for VC 7.1 and earlier as // abort() in a VC 7.1 application compiled as GUI in debug config // pops up a dialog window that cannot be suppressed programmatically. #if (GTEST_OS_LINUX || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS || \ (GTEST_OS_MAC && !GTEST_OS_IOS) || \ (GTEST_OS_WINDOWS_DESKTOP && _MSC_VER >= 1400) || \ GTEST_OS_WINDOWS_MINGW || GTEST_OS_AIX || GTEST_OS_HPUX || \ GTEST_OS_OPENBSD || GTEST_OS_QNX || GTEST_OS_FREEBSD || \ GTEST_OS_NETBSD || GTEST_OS_FUCHSIA) # define GTEST_HAS_DEATH_TEST 1 #endif // Determines whether to support type-driven tests. // Typed tests need and variadic macros, which GCC, VC++ 8.0, // Sun Pro CC, IBM Visual Age, and HP aCC support. #if defined(__GNUC__) || (_MSC_VER >= 1400) || defined(__SUNPRO_CC) || \ defined(__IBMCPP__) || defined(__HP_aCC) # define GTEST_HAS_TYPED_TEST 1 # define GTEST_HAS_TYPED_TEST_P 1 #endif // Determines whether to support Combine(). This only makes sense when // value-parameterized tests are enabled. The implementation doesn't // work on Sun Studio since it doesn't understand templated conversion // operators. #if (GTEST_HAS_TR1_TUPLE || GTEST_HAS_STD_TUPLE_) && !defined(__SUNPRO_CC) # define GTEST_HAS_COMBINE 1 #endif // Determines whether the system compiler uses UTF-16 for encoding wide strings. #define GTEST_WIDE_STRING_USES_UTF16_ \ (GTEST_OS_WINDOWS || GTEST_OS_CYGWIN || GTEST_OS_SYMBIAN || GTEST_OS_AIX) // Determines whether test results can be streamed to a socket. #if GTEST_OS_LINUX # define GTEST_CAN_STREAM_RESULTS_ 1 #endif // Defines some utility macros. // The GNU compiler emits a warning if nested "if" statements are followed by // an "else" statement and braces are not used to explicitly disambiguate the // "else" binding. This leads to problems with code like: // // if (gate) // ASSERT_*(condition) << "Some message"; // // The "switch (0) case 0:" idiom is used to suppress this. #ifdef __INTEL_COMPILER # define GTEST_AMBIGUOUS_ELSE_BLOCKER_ #else # define GTEST_AMBIGUOUS_ELSE_BLOCKER_ switch (0) case 0: default: // NOLINT #endif // Use this annotation at the end of a struct/class definition to // prevent the compiler from optimizing away instances that are never // used. This is useful when all interesting logic happens inside the // c'tor and / or d'tor. Example: // // struct Foo { // Foo() { ... } // } GTEST_ATTRIBUTE_UNUSED_; // // Also use it after a variable or parameter declaration to tell the // compiler the variable/parameter does not have to be used. #if defined(__GNUC__) && !defined(COMPILER_ICC) # define GTEST_ATTRIBUTE_UNUSED_ __attribute__ ((unused)) #elif defined(__clang__) # if __has_attribute(unused) # define GTEST_ATTRIBUTE_UNUSED_ __attribute__ ((unused)) # endif #endif #ifndef GTEST_ATTRIBUTE_UNUSED_ # define GTEST_ATTRIBUTE_UNUSED_ #endif #if GTEST_LANG_CXX11 # define GTEST_CXX11_EQUALS_DELETE_ = delete #else // GTEST_LANG_CXX11 # define GTEST_CXX11_EQUALS_DELETE_ #endif // GTEST_LANG_CXX11 // Use this annotation before a function that takes a printf format string. #if (defined(__GNUC__) || defined(__clang__)) && !defined(COMPILER_ICC) # if defined(__MINGW_PRINTF_FORMAT) // MinGW has two different printf implementations. Ensure the format macro // matches the selected implementation. See // https://sourceforge.net/p/mingw-w64/wiki2/gnu%20printf/. # define GTEST_ATTRIBUTE_PRINTF_(string_index, first_to_check) \ __attribute__((__format__(__MINGW_PRINTF_FORMAT, string_index, \ first_to_check))) # else # define GTEST_ATTRIBUTE_PRINTF_(string_index, first_to_check) \ __attribute__((__format__(__printf__, string_index, first_to_check))) # endif #else # define GTEST_ATTRIBUTE_PRINTF_(string_index, first_to_check) #endif // A macro to disallow operator= // This should be used in the private: declarations for a class. #define GTEST_DISALLOW_ASSIGN_(type) \ void operator=(type const &) GTEST_CXX11_EQUALS_DELETE_ // A macro to disallow copy constructor and operator= // This should be used in the private: declarations for a class. #define GTEST_DISALLOW_COPY_AND_ASSIGN_(type) \ type(type const &) GTEST_CXX11_EQUALS_DELETE_; \ GTEST_DISALLOW_ASSIGN_(type) // Tell the compiler to warn about unused return values for functions declared // with this macro. The macro should be used on function declarations // following the argument list: // // Sprocket* AllocateSprocket() GTEST_MUST_USE_RESULT_; #if defined(__GNUC__) && (GTEST_GCC_VER_ >= 30400) && !defined(COMPILER_ICC) # define GTEST_MUST_USE_RESULT_ __attribute__ ((warn_unused_result)) #else # define GTEST_MUST_USE_RESULT_ #endif // __GNUC__ && (GTEST_GCC_VER_ >= 30400) && !COMPILER_ICC // MS C++ compiler emits warning when a conditional expression is compile time // constant. In some contexts this warning is false positive and needs to be // suppressed. Use the following two macros in such cases: // // GTEST_INTENTIONAL_CONST_COND_PUSH_() // while (true) { // GTEST_INTENTIONAL_CONST_COND_POP_() // } # define GTEST_INTENTIONAL_CONST_COND_PUSH_() \ GTEST_DISABLE_MSC_WARNINGS_PUSH_(4127) # define GTEST_INTENTIONAL_CONST_COND_POP_() \ GTEST_DISABLE_MSC_WARNINGS_POP_() // Determine whether the compiler supports Microsoft's Structured Exception // Handling. This is supported by several Windows compilers but generally // does not exist on any other system. #ifndef GTEST_HAS_SEH // The user didn't tell us, so we need to figure it out. # if defined(_MSC_VER) || defined(__BORLANDC__) // These two compilers are known to support SEH. # define GTEST_HAS_SEH 1 # else // Assume no SEH. # define GTEST_HAS_SEH 0 # endif #define GTEST_IS_THREADSAFE \ (GTEST_HAS_MUTEX_AND_THREAD_LOCAL_ \ || (GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT) \ || GTEST_HAS_PTHREAD) #endif // GTEST_HAS_SEH // GTEST_API_ qualifies all symbols that must be exported. The definitions below // are guarded by #ifndef to give embedders a chance to define GTEST_API_ in // gtest/internal/custom/gtest-port.h #ifndef GTEST_API_ #ifdef _MSC_VER # if GTEST_LINKED_AS_SHARED_LIBRARY # define GTEST_API_ __declspec(dllimport) # elif GTEST_CREATE_SHARED_LIBRARY # define GTEST_API_ __declspec(dllexport) # endif #elif __GNUC__ >= 4 || defined(__clang__) # define GTEST_API_ __attribute__((visibility ("default"))) #endif // _MSC_VER #endif // GTEST_API_ #ifndef GTEST_API_ # define GTEST_API_ #endif // GTEST_API_ #ifndef GTEST_DEFAULT_DEATH_TEST_STYLE # define GTEST_DEFAULT_DEATH_TEST_STYLE "fast" #endif // GTEST_DEFAULT_DEATH_TEST_STYLE #ifdef __GNUC__ // Ask the compiler to never inline a given function. # define GTEST_NO_INLINE_ __attribute__((noinline)) #else # define GTEST_NO_INLINE_ #endif // _LIBCPP_VERSION is defined by the libc++ library from the LLVM project. #if !defined(GTEST_HAS_CXXABI_H_) # if defined(__GLIBCXX__) || (defined(_LIBCPP_VERSION) && !defined(_MSC_VER)) # define GTEST_HAS_CXXABI_H_ 1 # else # define GTEST_HAS_CXXABI_H_ 0 # endif #endif // A function level attribute to disable checking for use of uninitialized // memory when built with MemorySanitizer. #if defined(__clang__) # if __has_feature(memory_sanitizer) # define GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_ \ __attribute__((no_sanitize_memory)) # else # define GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_ # endif // __has_feature(memory_sanitizer) #else # define GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_ #endif // __clang__ // A function level attribute to disable AddressSanitizer instrumentation. #if defined(__clang__) # if __has_feature(address_sanitizer) # define GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_ \ __attribute__((no_sanitize_address)) # else # define GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_ # endif // __has_feature(address_sanitizer) #else # define GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_ #endif // __clang__ // A function level attribute to disable ThreadSanitizer instrumentation. #if defined(__clang__) # if __has_feature(thread_sanitizer) # define GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_ \ __attribute__((no_sanitize_thread)) # else # define GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_ # endif // __has_feature(thread_sanitizer) #else # define GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_ #endif // __clang__ namespace testing { class Message; #if defined(GTEST_TUPLE_NAMESPACE_) // Import tuple and friends into the ::testing namespace. // It is part of our interface, having them in ::testing allows us to change // their types as needed. using GTEST_TUPLE_NAMESPACE_::get; using GTEST_TUPLE_NAMESPACE_::make_tuple; using GTEST_TUPLE_NAMESPACE_::tuple; using GTEST_TUPLE_NAMESPACE_::tuple_size; using GTEST_TUPLE_NAMESPACE_::tuple_element; #endif // defined(GTEST_TUPLE_NAMESPACE_) namespace internal { // A secret type that Google Test users don't know about. It has no // definition on purpose. Therefore it's impossible to create a // Secret object, which is what we want. class Secret; // The GTEST_COMPILE_ASSERT_ macro can be used to verify that a compile time // expression is true. For example, you could use it to verify the // size of a static array: // // GTEST_COMPILE_ASSERT_(GTEST_ARRAY_SIZE_(names) == NUM_NAMES, // names_incorrect_size); // // or to make sure a struct is smaller than a certain size: // // GTEST_COMPILE_ASSERT_(sizeof(foo) < 128, foo_too_large); // // The second argument to the macro is the name of the variable. If // the expression is false, most compilers will issue a warning/error // containing the name of the variable. #if GTEST_LANG_CXX11 # define GTEST_COMPILE_ASSERT_(expr, msg) static_assert(expr, #msg) #else // !GTEST_LANG_CXX11 template struct CompileAssert { }; # define GTEST_COMPILE_ASSERT_(expr, msg) \ typedef ::testing::internal::CompileAssert<(static_cast(expr))> \ msg[static_cast(expr) ? 1 : -1] GTEST_ATTRIBUTE_UNUSED_ #endif // !GTEST_LANG_CXX11 // Implementation details of GTEST_COMPILE_ASSERT_: // // (In C++11, we simply use static_assert instead of the following) // // - GTEST_COMPILE_ASSERT_ works by defining an array type that has -1 // elements (and thus is invalid) when the expression is false. // // - The simpler definition // // #define GTEST_COMPILE_ASSERT_(expr, msg) typedef char msg[(expr) ? 1 : -1] // // does not work, as gcc supports variable-length arrays whose sizes // are determined at run-time (this is gcc's extension and not part // of the C++ standard). As a result, gcc fails to reject the // following code with the simple definition: // // int foo; // GTEST_COMPILE_ASSERT_(foo, msg); // not supposed to compile as foo is // // not a compile-time constant. // // - By using the type CompileAssert<(bool(expr))>, we ensures that // expr is a compile-time constant. (Template arguments must be // determined at compile-time.) // // - The outter parentheses in CompileAssert<(bool(expr))> are necessary // to work around a bug in gcc 3.4.4 and 4.0.1. If we had written // // CompileAssert // // instead, these compilers will refuse to compile // // GTEST_COMPILE_ASSERT_(5 > 0, some_message); // // (They seem to think the ">" in "5 > 0" marks the end of the // template argument list.) // // - The array size is (bool(expr) ? 1 : -1), instead of simply // // ((expr) ? 1 : -1). // // This is to avoid running into a bug in MS VC 7.1, which // causes ((0.0) ? 1 : -1) to incorrectly evaluate to 1. // StaticAssertTypeEqHelper is used by StaticAssertTypeEq defined in gtest.h. // // This template is declared, but intentionally undefined. template struct StaticAssertTypeEqHelper; template struct StaticAssertTypeEqHelper { enum { value = true }; }; // Same as std::is_same<>. template struct IsSame { enum { value = false }; }; template struct IsSame { enum { value = true }; }; // Evaluates to the number of elements in 'array'. #define GTEST_ARRAY_SIZE_(array) (sizeof(array) / sizeof(array[0])) #if GTEST_HAS_GLOBAL_STRING typedef ::string string; #else typedef ::std::string string; #endif // GTEST_HAS_GLOBAL_STRING #if GTEST_HAS_GLOBAL_WSTRING typedef ::wstring wstring; #elif GTEST_HAS_STD_WSTRING typedef ::std::wstring wstring; #endif // GTEST_HAS_GLOBAL_WSTRING // A helper for suppressing warnings on constant condition. It just // returns 'condition'. GTEST_API_ bool IsTrue(bool condition); // Defines scoped_ptr. // This implementation of scoped_ptr is PARTIAL - it only contains // enough stuff to satisfy Google Test's need. template class scoped_ptr { public: typedef T element_type; explicit scoped_ptr(T* p = NULL) : ptr_(p) {} ~scoped_ptr() { reset(); } T& operator*() const { return *ptr_; } T* operator->() const { return ptr_; } T* get() const { return ptr_; } T* release() { T* const ptr = ptr_; ptr_ = NULL; return ptr; } void reset(T* p = NULL) { if (p != ptr_) { if (IsTrue(sizeof(T) > 0)) { // Makes sure T is a complete type. delete ptr_; } ptr_ = p; } } friend void swap(scoped_ptr& a, scoped_ptr& b) { using std::swap; swap(a.ptr_, b.ptr_); } private: T* ptr_; GTEST_DISALLOW_COPY_AND_ASSIGN_(scoped_ptr); }; // Defines RE. #if GTEST_USES_PCRE // if used, PCRE is injected by custom/gtest-port.h #elif GTEST_USES_POSIX_RE || GTEST_USES_SIMPLE_RE // A simple C++ wrapper for . It uses the POSIX Extended // Regular Expression syntax. class GTEST_API_ RE { public: // A copy constructor is required by the Standard to initialize object // references from r-values. RE(const RE& other) { Init(other.pattern()); } // Constructs an RE from a string. RE(const ::std::string& regex) { Init(regex.c_str()); } // NOLINT # if GTEST_HAS_GLOBAL_STRING RE(const ::string& regex) { Init(regex.c_str()); } // NOLINT # endif // GTEST_HAS_GLOBAL_STRING RE(const char* regex) { Init(regex); } // NOLINT ~RE(); // Returns the string representation of the regex. const char* pattern() const { return pattern_; } // FullMatch(str, re) returns true iff regular expression re matches // the entire str. // PartialMatch(str, re) returns true iff regular expression re // matches a substring of str (including str itself). // // FIXME: make FullMatch() and PartialMatch() work // when str contains NUL characters. static bool FullMatch(const ::std::string& str, const RE& re) { return FullMatch(str.c_str(), re); } static bool PartialMatch(const ::std::string& str, const RE& re) { return PartialMatch(str.c_str(), re); } # if GTEST_HAS_GLOBAL_STRING static bool FullMatch(const ::string& str, const RE& re) { return FullMatch(str.c_str(), re); } static bool PartialMatch(const ::string& str, const RE& re) { return PartialMatch(str.c_str(), re); } # endif // GTEST_HAS_GLOBAL_STRING static bool FullMatch(const char* str, const RE& re); static bool PartialMatch(const char* str, const RE& re); private: void Init(const char* regex); // We use a const char* instead of an std::string, as Google Test used to be // used where std::string is not available. FIXME: change to // std::string. const char* pattern_; bool is_valid_; # if GTEST_USES_POSIX_RE regex_t full_regex_; // For FullMatch(). regex_t partial_regex_; // For PartialMatch(). # else // GTEST_USES_SIMPLE_RE const char* full_pattern_; // For FullMatch(); # endif GTEST_DISALLOW_ASSIGN_(RE); }; #endif // GTEST_USES_PCRE // Formats a source file path and a line number as they would appear // in an error message from the compiler used to compile this code. GTEST_API_ ::std::string FormatFileLocation(const char* file, int line); // Formats a file location for compiler-independent XML output. // Although this function is not platform dependent, we put it next to // FormatFileLocation in order to contrast the two functions. GTEST_API_ ::std::string FormatCompilerIndependentFileLocation(const char* file, int line); // Defines logging utilities: // GTEST_LOG_(severity) - logs messages at the specified severity level. The // message itself is streamed into the macro. // LogToStderr() - directs all log messages to stderr. // FlushInfoLog() - flushes informational log messages. enum GTestLogSeverity { GTEST_INFO, GTEST_WARNING, GTEST_ERROR, GTEST_FATAL }; // Formats log entry severity, provides a stream object for streaming the // log message, and terminates the message with a newline when going out of // scope. class GTEST_API_ GTestLog { public: GTestLog(GTestLogSeverity severity, const char* file, int line); // Flushes the buffers and, if severity is GTEST_FATAL, aborts the program. ~GTestLog(); ::std::ostream& GetStream() { return ::std::cerr; } private: const GTestLogSeverity severity_; GTEST_DISALLOW_COPY_AND_ASSIGN_(GTestLog); }; #if !defined(GTEST_LOG_) # define GTEST_LOG_(severity) \ ::testing::internal::GTestLog(::testing::internal::GTEST_##severity, \ __FILE__, __LINE__).GetStream() inline void LogToStderr() {} inline void FlushInfoLog() { fflush(NULL); } #endif // !defined(GTEST_LOG_) #if !defined(GTEST_CHECK_) // INTERNAL IMPLEMENTATION - DO NOT USE. // // GTEST_CHECK_ is an all-mode assert. It aborts the program if the condition // is not satisfied. // Synopsys: // GTEST_CHECK_(boolean_condition); // or // GTEST_CHECK_(boolean_condition) << "Additional message"; // // This checks the condition and if the condition is not satisfied // it prints message about the condition violation, including the // condition itself, plus additional message streamed into it, if any, // and then it aborts the program. It aborts the program irrespective of // whether it is built in the debug mode or not. # define GTEST_CHECK_(condition) \ GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ if (::testing::internal::IsTrue(condition)) \ ; \ else \ GTEST_LOG_(FATAL) << "Condition " #condition " failed. " #endif // !defined(GTEST_CHECK_) // An all-mode assert to verify that the given POSIX-style function // call returns 0 (indicating success). Known limitation: this // doesn't expand to a balanced 'if' statement, so enclose the macro // in {} if you need to use it as the only statement in an 'if' // branch. #define GTEST_CHECK_POSIX_SUCCESS_(posix_call) \ if (const int gtest_error = (posix_call)) \ GTEST_LOG_(FATAL) << #posix_call << "failed with error " \ << gtest_error // Adds reference to a type if it is not a reference type, // otherwise leaves it unchanged. This is the same as // tr1::add_reference, which is not widely available yet. template struct AddReference { typedef T& type; }; // NOLINT template struct AddReference { typedef T& type; }; // NOLINT // A handy wrapper around AddReference that works when the argument T // depends on template parameters. #define GTEST_ADD_REFERENCE_(T) \ typename ::testing::internal::AddReference::type // Transforms "T" into "const T&" according to standard reference collapsing // rules (this is only needed as a backport for C++98 compilers that do not // support reference collapsing). Specifically, it transforms: // // char ==> const char& // const char ==> const char& // char& ==> char& // const char& ==> const char& // // Note that the non-const reference will not have "const" added. This is // standard, and necessary so that "T" can always bind to "const T&". template struct ConstRef { typedef const T& type; }; template struct ConstRef { typedef T& type; }; // The argument T must depend on some template parameters. #define GTEST_REFERENCE_TO_CONST_(T) \ typename ::testing::internal::ConstRef::type #if GTEST_HAS_STD_MOVE_ using std::forward; using std::move; template struct RvalueRef { typedef T&& type; }; #else // GTEST_HAS_STD_MOVE_ template const T& move(const T& t) { return t; } template GTEST_ADD_REFERENCE_(T) forward(GTEST_ADD_REFERENCE_(T) t) { return t; } template struct RvalueRef { typedef const T& type; }; #endif // GTEST_HAS_STD_MOVE_ // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. // // Use ImplicitCast_ as a safe version of static_cast for upcasting in // the type hierarchy (e.g. casting a Foo* to a SuperclassOfFoo* or a // const Foo*). When you use ImplicitCast_, the compiler checks that // the cast is safe. Such explicit ImplicitCast_s are necessary in // surprisingly many situations where C++ demands an exact type match // instead of an argument type convertable to a target type. // // The syntax for using ImplicitCast_ is the same as for static_cast: // // ImplicitCast_(expr) // // ImplicitCast_ would have been part of the C++ standard library, // but the proposal was submitted too late. It will probably make // its way into the language in the future. // // This relatively ugly name is intentional. It prevents clashes with // similar functions users may have (e.g., implicit_cast). The internal // namespace alone is not enough because the function can be found by ADL. template inline To ImplicitCast_(To x) { return x; } // When you upcast (that is, cast a pointer from type Foo to type // SuperclassOfFoo), it's fine to use ImplicitCast_<>, since upcasts // always succeed. When you downcast (that is, cast a pointer from // type Foo to type SubclassOfFoo), static_cast<> isn't safe, because // how do you know the pointer is really of type SubclassOfFoo? It // could be a bare Foo, or of type DifferentSubclassOfFoo. Thus, // when you downcast, you should use this macro. In debug mode, we // use dynamic_cast<> to double-check the downcast is legal (we die // if it's not). In normal mode, we do the efficient static_cast<> // instead. Thus, it's important to test in debug mode to make sure // the cast is legal! // This is the only place in the code we should use dynamic_cast<>. // In particular, you SHOULDN'T be using dynamic_cast<> in order to // do RTTI (eg code like this: // if (dynamic_cast(foo)) HandleASubclass1Object(foo); // if (dynamic_cast(foo)) HandleASubclass2Object(foo); // You should design the code some other way not to need this. // // This relatively ugly name is intentional. It prevents clashes with // similar functions users may have (e.g., down_cast). The internal // namespace alone is not enough because the function can be found by ADL. template // use like this: DownCast_(foo); inline To DownCast_(From* f) { // so we only accept pointers // Ensures that To is a sub-type of From *. This test is here only // for compile-time type checking, and has no overhead in an // optimized build at run-time, as it will be optimized away // completely. GTEST_INTENTIONAL_CONST_COND_PUSH_() if (false) { GTEST_INTENTIONAL_CONST_COND_POP_() const To to = NULL; ::testing::internal::ImplicitCast_(to); } #if GTEST_HAS_RTTI // RTTI: debug mode only! GTEST_CHECK_(f == NULL || dynamic_cast(f) != NULL); #endif return static_cast(f); } // Downcasts the pointer of type Base to Derived. // Derived must be a subclass of Base. The parameter MUST // point to a class of type Derived, not any subclass of it. // When RTTI is available, the function performs a runtime // check to enforce this. template Derived* CheckedDowncastToActualType(Base* base) { #if GTEST_HAS_RTTI GTEST_CHECK_(typeid(*base) == typeid(Derived)); #endif #if GTEST_HAS_DOWNCAST_ return ::down_cast(base); #elif GTEST_HAS_RTTI return dynamic_cast(base); // NOLINT #else return static_cast(base); // Poor man's downcast. #endif } #if GTEST_HAS_STREAM_REDIRECTION // Defines the stderr capturer: // CaptureStdout - starts capturing stdout. // GetCapturedStdout - stops capturing stdout and returns the captured string. // CaptureStderr - starts capturing stderr. // GetCapturedStderr - stops capturing stderr and returns the captured string. // GTEST_API_ void CaptureStdout(); GTEST_API_ std::string GetCapturedStdout(); GTEST_API_ void CaptureStderr(); GTEST_API_ std::string GetCapturedStderr(); #endif // GTEST_HAS_STREAM_REDIRECTION // Returns the size (in bytes) of a file. GTEST_API_ size_t GetFileSize(FILE* file); // Reads the entire content of a file as a string. GTEST_API_ std::string ReadEntireFile(FILE* file); // All command line arguments. GTEST_API_ std::vector GetArgvs(); #if GTEST_HAS_DEATH_TEST std::vector GetInjectableArgvs(); // Deprecated: pass the args vector by value instead. void SetInjectableArgvs(const std::vector* new_argvs); void SetInjectableArgvs(const std::vector& new_argvs); #if GTEST_HAS_GLOBAL_STRING void SetInjectableArgvs(const std::vector< ::string>& new_argvs); #endif // GTEST_HAS_GLOBAL_STRING void ClearInjectableArgvs(); #endif // GTEST_HAS_DEATH_TEST // Defines synchronization primitives. #if GTEST_IS_THREADSAFE # if GTEST_HAS_PTHREAD // Sleeps for (roughly) n milliseconds. This function is only for testing // Google Test's own constructs. Don't use it in user tests, either // directly or indirectly. inline void SleepMilliseconds(int n) { const timespec time = { 0, // 0 seconds. n * 1000L * 1000L, // And n ms. }; nanosleep(&time, NULL); } # endif // GTEST_HAS_PTHREAD # if GTEST_HAS_NOTIFICATION_ // Notification has already been imported into the namespace. // Nothing to do here. # elif GTEST_HAS_PTHREAD // Allows a controller thread to pause execution of newly created // threads until notified. Instances of this class must be created // and destroyed in the controller thread. // // This class is only for testing Google Test's own constructs. Do not // use it in user tests, either directly or indirectly. class Notification { public: Notification() : notified_(false) { GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_init(&mutex_, NULL)); } ~Notification() { pthread_mutex_destroy(&mutex_); } // Notifies all threads created with this notification to start. Must // be called from the controller thread. void Notify() { pthread_mutex_lock(&mutex_); notified_ = true; pthread_mutex_unlock(&mutex_); } // Blocks until the controller thread notifies. Must be called from a test // thread. void WaitForNotification() { for (;;) { pthread_mutex_lock(&mutex_); const bool notified = notified_; pthread_mutex_unlock(&mutex_); if (notified) break; SleepMilliseconds(10); } } private: pthread_mutex_t mutex_; bool notified_; GTEST_DISALLOW_COPY_AND_ASSIGN_(Notification); }; # elif GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT GTEST_API_ void SleepMilliseconds(int n); // Provides leak-safe Windows kernel handle ownership. // Used in death tests and in threading support. class GTEST_API_ AutoHandle { public: // Assume that Win32 HANDLE type is equivalent to void*. Doing so allows us to // avoid including in this header file. Including is // undesirable because it defines a lot of symbols and macros that tend to // conflict with client code. This assumption is verified by // WindowsTypesTest.HANDLEIsVoidStar. typedef void* Handle; AutoHandle(); explicit AutoHandle(Handle handle); ~AutoHandle(); Handle Get() const; void Reset(); void Reset(Handle handle); private: // Returns true iff the handle is a valid handle object that can be closed. bool IsCloseable() const; Handle handle_; GTEST_DISALLOW_COPY_AND_ASSIGN_(AutoHandle); }; // Allows a controller thread to pause execution of newly created // threads until notified. Instances of this class must be created // and destroyed in the controller thread. // // This class is only for testing Google Test's own constructs. Do not // use it in user tests, either directly or indirectly. class GTEST_API_ Notification { public: Notification(); void Notify(); void WaitForNotification(); private: AutoHandle event_; GTEST_DISALLOW_COPY_AND_ASSIGN_(Notification); }; # endif // GTEST_HAS_NOTIFICATION_ // On MinGW, we can have both GTEST_OS_WINDOWS and GTEST_HAS_PTHREAD // defined, but we don't want to use MinGW's pthreads implementation, which // has conformance problems with some versions of the POSIX standard. # if GTEST_HAS_PTHREAD && !GTEST_OS_WINDOWS_MINGW // As a C-function, ThreadFuncWithCLinkage cannot be templated itself. // Consequently, it cannot select a correct instantiation of ThreadWithParam // in order to call its Run(). Introducing ThreadWithParamBase as a // non-templated base class for ThreadWithParam allows us to bypass this // problem. class ThreadWithParamBase { public: virtual ~ThreadWithParamBase() {} virtual void Run() = 0; }; // pthread_create() accepts a pointer to a function type with the C linkage. // According to the Standard (7.5/1), function types with different linkages // are different even if they are otherwise identical. Some compilers (for // example, SunStudio) treat them as different types. Since class methods // cannot be defined with C-linkage we need to define a free C-function to // pass into pthread_create(). extern "C" inline void* ThreadFuncWithCLinkage(void* thread) { static_cast(thread)->Run(); return NULL; } // Helper class for testing Google Test's multi-threading constructs. // To use it, write: // // void ThreadFunc(int param) { /* Do things with param */ } // Notification thread_can_start; // ... // // The thread_can_start parameter is optional; you can supply NULL. // ThreadWithParam thread(&ThreadFunc, 5, &thread_can_start); // thread_can_start.Notify(); // // These classes are only for testing Google Test's own constructs. Do // not use them in user tests, either directly or indirectly. template class ThreadWithParam : public ThreadWithParamBase { public: typedef void UserThreadFunc(T); ThreadWithParam(UserThreadFunc* func, T param, Notification* thread_can_start) : func_(func), param_(param), thread_can_start_(thread_can_start), finished_(false) { ThreadWithParamBase* const base = this; // The thread can be created only after all fields except thread_ // have been initialized. GTEST_CHECK_POSIX_SUCCESS_( pthread_create(&thread_, 0, &ThreadFuncWithCLinkage, base)); } ~ThreadWithParam() { Join(); } void Join() { if (!finished_) { GTEST_CHECK_POSIX_SUCCESS_(pthread_join(thread_, 0)); finished_ = true; } } virtual void Run() { if (thread_can_start_ != NULL) thread_can_start_->WaitForNotification(); func_(param_); } private: UserThreadFunc* const func_; // User-supplied thread function. const T param_; // User-supplied parameter to the thread function. // When non-NULL, used to block execution until the controller thread // notifies. Notification* const thread_can_start_; bool finished_; // true iff we know that the thread function has finished. pthread_t thread_; // The native thread object. GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadWithParam); }; # endif // !GTEST_OS_WINDOWS && GTEST_HAS_PTHREAD || // GTEST_HAS_MUTEX_AND_THREAD_LOCAL_ # if GTEST_HAS_MUTEX_AND_THREAD_LOCAL_ // Mutex and ThreadLocal have already been imported into the namespace. // Nothing to do here. # elif GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT // Mutex implements mutex on Windows platforms. It is used in conjunction // with class MutexLock: // // Mutex mutex; // ... // MutexLock lock(&mutex); // Acquires the mutex and releases it at the // // end of the current scope. // // A static Mutex *must* be defined or declared using one of the following // macros: // GTEST_DEFINE_STATIC_MUTEX_(g_some_mutex); // GTEST_DECLARE_STATIC_MUTEX_(g_some_mutex); // // (A non-static Mutex is defined/declared in the usual way). class GTEST_API_ Mutex { public: enum MutexType { kStatic = 0, kDynamic = 1 }; // We rely on kStaticMutex being 0 as it is to what the linker initializes // type_ in static mutexes. critical_section_ will be initialized lazily // in ThreadSafeLazyInit(). enum StaticConstructorSelector { kStaticMutex = 0 }; // This constructor intentionally does nothing. It relies on type_ being // statically initialized to 0 (effectively setting it to kStatic) and on // ThreadSafeLazyInit() to lazily initialize the rest of the members. explicit Mutex(StaticConstructorSelector /*dummy*/) {} Mutex(); ~Mutex(); void Lock(); void Unlock(); // Does nothing if the current thread holds the mutex. Otherwise, crashes // with high probability. void AssertHeld(); private: // Initializes owner_thread_id_ and critical_section_ in static mutexes. void ThreadSafeLazyInit(); // Per https://blogs.msdn.microsoft.com/oldnewthing/20040223-00/?p=40503, // we assume that 0 is an invalid value for thread IDs. unsigned int owner_thread_id_; // For static mutexes, we rely on these members being initialized to zeros // by the linker. MutexType type_; long critical_section_init_phase_; // NOLINT GTEST_CRITICAL_SECTION* critical_section_; GTEST_DISALLOW_COPY_AND_ASSIGN_(Mutex); }; # define GTEST_DECLARE_STATIC_MUTEX_(mutex) \ extern ::testing::internal::Mutex mutex # define GTEST_DEFINE_STATIC_MUTEX_(mutex) \ ::testing::internal::Mutex mutex(::testing::internal::Mutex::kStaticMutex) // We cannot name this class MutexLock because the ctor declaration would // conflict with a macro named MutexLock, which is defined on some // platforms. That macro is used as a defensive measure to prevent against // inadvertent misuses of MutexLock like "MutexLock(&mu)" rather than // "MutexLock l(&mu)". Hence the typedef trick below. class GTestMutexLock { public: explicit GTestMutexLock(Mutex* mutex) : mutex_(mutex) { mutex_->Lock(); } ~GTestMutexLock() { mutex_->Unlock(); } private: Mutex* const mutex_; GTEST_DISALLOW_COPY_AND_ASSIGN_(GTestMutexLock); }; typedef GTestMutexLock MutexLock; // Base class for ValueHolder. Allows a caller to hold and delete a value // without knowing its type. class ThreadLocalValueHolderBase { public: virtual ~ThreadLocalValueHolderBase() {} }; // Provides a way for a thread to send notifications to a ThreadLocal // regardless of its parameter type. class ThreadLocalBase { public: // Creates a new ValueHolder object holding a default value passed to // this ThreadLocal's constructor and returns it. It is the caller's // responsibility not to call this when the ThreadLocal instance already // has a value on the current thread. virtual ThreadLocalValueHolderBase* NewValueForCurrentThread() const = 0; protected: ThreadLocalBase() {} virtual ~ThreadLocalBase() {} private: GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadLocalBase); }; // Maps a thread to a set of ThreadLocals that have values instantiated on that // thread and notifies them when the thread exits. A ThreadLocal instance is // expected to persist until all threads it has values on have terminated. class GTEST_API_ ThreadLocalRegistry { public: // Registers thread_local_instance as having value on the current thread. // Returns a value that can be used to identify the thread from other threads. static ThreadLocalValueHolderBase* GetValueOnCurrentThread( const ThreadLocalBase* thread_local_instance); // Invoked when a ThreadLocal instance is destroyed. static void OnThreadLocalDestroyed( const ThreadLocalBase* thread_local_instance); }; class GTEST_API_ ThreadWithParamBase { public: void Join(); protected: class Runnable { public: virtual ~Runnable() {} virtual void Run() = 0; }; ThreadWithParamBase(Runnable *runnable, Notification* thread_can_start); virtual ~ThreadWithParamBase(); private: AutoHandle thread_; }; // Helper class for testing Google Test's multi-threading constructs. template class ThreadWithParam : public ThreadWithParamBase { public: typedef void UserThreadFunc(T); ThreadWithParam(UserThreadFunc* func, T param, Notification* thread_can_start) : ThreadWithParamBase(new RunnableImpl(func, param), thread_can_start) { } virtual ~ThreadWithParam() {} private: class RunnableImpl : public Runnable { public: RunnableImpl(UserThreadFunc* func, T param) : func_(func), param_(param) { } virtual ~RunnableImpl() {} virtual void Run() { func_(param_); } private: UserThreadFunc* const func_; const T param_; GTEST_DISALLOW_COPY_AND_ASSIGN_(RunnableImpl); }; GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadWithParam); }; // Implements thread-local storage on Windows systems. // // // Thread 1 // ThreadLocal tl(100); // 100 is the default value for each thread. // // // Thread 2 // tl.set(150); // Changes the value for thread 2 only. // EXPECT_EQ(150, tl.get()); // // // Thread 1 // EXPECT_EQ(100, tl.get()); // In thread 1, tl has the original value. // tl.set(200); // EXPECT_EQ(200, tl.get()); // // The template type argument T must have a public copy constructor. // In addition, the default ThreadLocal constructor requires T to have // a public default constructor. // // The users of a TheadLocal instance have to make sure that all but one // threads (including the main one) using that instance have exited before // destroying it. Otherwise, the per-thread objects managed for them by the // ThreadLocal instance are not guaranteed to be destroyed on all platforms. // // Google Test only uses global ThreadLocal objects. That means they // will die after main() has returned. Therefore, no per-thread // object managed by Google Test will be leaked as long as all threads // using Google Test have exited when main() returns. template class ThreadLocal : public ThreadLocalBase { public: ThreadLocal() : default_factory_(new DefaultValueHolderFactory()) {} explicit ThreadLocal(const T& value) : default_factory_(new InstanceValueHolderFactory(value)) {} ~ThreadLocal() { ThreadLocalRegistry::OnThreadLocalDestroyed(this); } T* pointer() { return GetOrCreateValue(); } const T* pointer() const { return GetOrCreateValue(); } const T& get() const { return *pointer(); } void set(const T& value) { *pointer() = value; } private: // Holds a value of T. Can be deleted via its base class without the caller // knowing the type of T. class ValueHolder : public ThreadLocalValueHolderBase { public: ValueHolder() : value_() {} explicit ValueHolder(const T& value) : value_(value) {} T* pointer() { return &value_; } private: T value_; GTEST_DISALLOW_COPY_AND_ASSIGN_(ValueHolder); }; T* GetOrCreateValue() const { return static_cast( ThreadLocalRegistry::GetValueOnCurrentThread(this))->pointer(); } virtual ThreadLocalValueHolderBase* NewValueForCurrentThread() const { return default_factory_->MakeNewHolder(); } class ValueHolderFactory { public: ValueHolderFactory() {} virtual ~ValueHolderFactory() {} virtual ValueHolder* MakeNewHolder() const = 0; private: GTEST_DISALLOW_COPY_AND_ASSIGN_(ValueHolderFactory); }; class DefaultValueHolderFactory : public ValueHolderFactory { public: DefaultValueHolderFactory() {} virtual ValueHolder* MakeNewHolder() const { return new ValueHolder(); } private: GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultValueHolderFactory); }; class InstanceValueHolderFactory : public ValueHolderFactory { public: explicit InstanceValueHolderFactory(const T& value) : value_(value) {} virtual ValueHolder* MakeNewHolder() const { return new ValueHolder(value_); } private: const T value_; // The value for each thread. GTEST_DISALLOW_COPY_AND_ASSIGN_(InstanceValueHolderFactory); }; scoped_ptr default_factory_; GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadLocal); }; # elif GTEST_HAS_PTHREAD // MutexBase and Mutex implement mutex on pthreads-based platforms. class MutexBase { public: // Acquires this mutex. void Lock() { GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_lock(&mutex_)); owner_ = pthread_self(); has_owner_ = true; } // Releases this mutex. void Unlock() { // Since the lock is being released the owner_ field should no longer be // considered valid. We don't protect writing to has_owner_ here, as it's // the caller's responsibility to ensure that the current thread holds the // mutex when this is called. has_owner_ = false; GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_unlock(&mutex_)); } // Does nothing if the current thread holds the mutex. Otherwise, crashes // with high probability. void AssertHeld() const { GTEST_CHECK_(has_owner_ && pthread_equal(owner_, pthread_self())) << "The current thread is not holding the mutex @" << this; } // A static mutex may be used before main() is entered. It may even // be used before the dynamic initialization stage. Therefore we // must be able to initialize a static mutex object at link time. // This means MutexBase has to be a POD and its member variables // have to be public. public: pthread_mutex_t mutex_; // The underlying pthread mutex. // has_owner_ indicates whether the owner_ field below contains a valid thread // ID and is therefore safe to inspect (e.g., to use in pthread_equal()). All // accesses to the owner_ field should be protected by a check of this field. // An alternative might be to memset() owner_ to all zeros, but there's no // guarantee that a zero'd pthread_t is necessarily invalid or even different // from pthread_self(). bool has_owner_; pthread_t owner_; // The thread holding the mutex. }; // Forward-declares a static mutex. # define GTEST_DECLARE_STATIC_MUTEX_(mutex) \ extern ::testing::internal::MutexBase mutex // Defines and statically (i.e. at link time) initializes a static mutex. // The initialization list here does not explicitly initialize each field, // instead relying on default initialization for the unspecified fields. In // particular, the owner_ field (a pthread_t) is not explicitly initialized. // This allows initialization to work whether pthread_t is a scalar or struct. // The flag -Wmissing-field-initializers must not be specified for this to work. #define GTEST_DEFINE_STATIC_MUTEX_(mutex) \ ::testing::internal::MutexBase mutex = {PTHREAD_MUTEX_INITIALIZER, false, 0} // The Mutex class can only be used for mutexes created at runtime. It // shares its API with MutexBase otherwise. class Mutex : public MutexBase { public: Mutex() { GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_init(&mutex_, NULL)); has_owner_ = false; } ~Mutex() { GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_destroy(&mutex_)); } private: GTEST_DISALLOW_COPY_AND_ASSIGN_(Mutex); }; // We cannot name this class MutexLock because the ctor declaration would // conflict with a macro named MutexLock, which is defined on some // platforms. That macro is used as a defensive measure to prevent against // inadvertent misuses of MutexLock like "MutexLock(&mu)" rather than // "MutexLock l(&mu)". Hence the typedef trick below. class GTestMutexLock { public: explicit GTestMutexLock(MutexBase* mutex) : mutex_(mutex) { mutex_->Lock(); } ~GTestMutexLock() { mutex_->Unlock(); } private: MutexBase* const mutex_; GTEST_DISALLOW_COPY_AND_ASSIGN_(GTestMutexLock); }; typedef GTestMutexLock MutexLock; // Helpers for ThreadLocal. // pthread_key_create() requires DeleteThreadLocalValue() to have // C-linkage. Therefore it cannot be templatized to access // ThreadLocal. Hence the need for class // ThreadLocalValueHolderBase. class ThreadLocalValueHolderBase { public: virtual ~ThreadLocalValueHolderBase() {} }; // Called by pthread to delete thread-local data stored by // pthread_setspecific(). extern "C" inline void DeleteThreadLocalValue(void* value_holder) { delete static_cast(value_holder); } // Implements thread-local storage on pthreads-based systems. template class GTEST_API_ ThreadLocal { public: ThreadLocal() : key_(CreateKey()), default_factory_(new DefaultValueHolderFactory()) {} explicit ThreadLocal(const T& value) : key_(CreateKey()), default_factory_(new InstanceValueHolderFactory(value)) {} ~ThreadLocal() { // Destroys the managed object for the current thread, if any. DeleteThreadLocalValue(pthread_getspecific(key_)); // Releases resources associated with the key. This will *not* // delete managed objects for other threads. GTEST_CHECK_POSIX_SUCCESS_(pthread_key_delete(key_)); } T* pointer() { return GetOrCreateValue(); } const T* pointer() const { return GetOrCreateValue(); } const T& get() const { return *pointer(); } void set(const T& value) { *pointer() = value; } private: // Holds a value of type T. class ValueHolder : public ThreadLocalValueHolderBase { public: ValueHolder() : value_() {} explicit ValueHolder(const T& value) : value_(value) {} T* pointer() { return &value_; } private: T value_; GTEST_DISALLOW_COPY_AND_ASSIGN_(ValueHolder); }; static pthread_key_t CreateKey() { pthread_key_t key; // When a thread exits, DeleteThreadLocalValue() will be called on // the object managed for that thread. GTEST_CHECK_POSIX_SUCCESS_( pthread_key_create(&key, &DeleteThreadLocalValue)); return key; } T* GetOrCreateValue() const { ThreadLocalValueHolderBase* const holder = static_cast(pthread_getspecific(key_)); if (holder != NULL) { return CheckedDowncastToActualType(holder)->pointer(); } ValueHolder* const new_holder = default_factory_->MakeNewHolder(); ThreadLocalValueHolderBase* const holder_base = new_holder; GTEST_CHECK_POSIX_SUCCESS_(pthread_setspecific(key_, holder_base)); return new_holder->pointer(); } class ValueHolderFactory { public: ValueHolderFactory() {} virtual ~ValueHolderFactory() {} virtual ValueHolder* MakeNewHolder() const = 0; private: GTEST_DISALLOW_COPY_AND_ASSIGN_(ValueHolderFactory); }; class DefaultValueHolderFactory : public ValueHolderFactory { public: DefaultValueHolderFactory() {} virtual ValueHolder* MakeNewHolder() const { return new ValueHolder(); } private: GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultValueHolderFactory); }; class InstanceValueHolderFactory : public ValueHolderFactory { public: explicit InstanceValueHolderFactory(const T& value) : value_(value) {} virtual ValueHolder* MakeNewHolder() const { return new ValueHolder(value_); } private: const T value_; // The value for each thread. GTEST_DISALLOW_COPY_AND_ASSIGN_(InstanceValueHolderFactory); }; // A key pthreads uses for looking up per-thread values. const pthread_key_t key_; scoped_ptr default_factory_; GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadLocal); }; # endif // GTEST_HAS_MUTEX_AND_THREAD_LOCAL_ #else // GTEST_IS_THREADSAFE // A dummy implementation of synchronization primitives (mutex, lock, // and thread-local variable). Necessary for compiling Google Test where // mutex is not supported - using Google Test in multiple threads is not // supported on such platforms. class Mutex { public: Mutex() {} void Lock() {} void Unlock() {} void AssertHeld() const {} }; # define GTEST_DECLARE_STATIC_MUTEX_(mutex) \ extern ::testing::internal::Mutex mutex # define GTEST_DEFINE_STATIC_MUTEX_(mutex) ::testing::internal::Mutex mutex // We cannot name this class MutexLock because the ctor declaration would // conflict with a macro named MutexLock, which is defined on some // platforms. That macro is used as a defensive measure to prevent against // inadvertent misuses of MutexLock like "MutexLock(&mu)" rather than // "MutexLock l(&mu)". Hence the typedef trick below. class GTestMutexLock { public: explicit GTestMutexLock(Mutex*) {} // NOLINT }; typedef GTestMutexLock MutexLock; template class GTEST_API_ ThreadLocal { public: ThreadLocal() : value_() {} explicit ThreadLocal(const T& value) : value_(value) {} T* pointer() { return &value_; } const T* pointer() const { return &value_; } const T& get() const { return value_; } void set(const T& value) { value_ = value; } private: T value_; }; #endif // GTEST_IS_THREADSAFE // Returns the number of threads running in the process, or 0 to indicate that // we cannot detect it. GTEST_API_ size_t GetThreadCount(); // Passing non-POD classes through ellipsis (...) crashes the ARM // compiler and generates a warning in Sun Studio before 12u4. The Nokia Symbian // and the IBM XL C/C++ compiler try to instantiate a copy constructor // for objects passed through ellipsis (...), failing for uncopyable // objects. We define this to ensure that only POD is passed through // ellipsis on these systems. #if defined(__SYMBIAN32__) || defined(__IBMCPP__) || \ (defined(__SUNPRO_CC) && __SUNPRO_CC < 0x5130) // We lose support for NULL detection where the compiler doesn't like // passing non-POD classes through ellipsis (...). # define GTEST_ELLIPSIS_NEEDS_POD_ 1 #else # define GTEST_CAN_COMPARE_NULL 1 #endif // The Nokia Symbian and IBM XL C/C++ compilers cannot decide between // const T& and const T* in a function template. These compilers // _can_ decide between class template specializations for T and T*, // so a tr1::type_traits-like is_pointer works. #if defined(__SYMBIAN32__) || defined(__IBMCPP__) # define GTEST_NEEDS_IS_POINTER_ 1 #endif template struct bool_constant { typedef bool_constant type; static const bool value = bool_value; }; template const bool bool_constant::value; typedef bool_constant false_type; typedef bool_constant true_type; template struct is_same : public false_type {}; template struct is_same : public true_type {}; template struct is_pointer : public false_type {}; template struct is_pointer : public true_type {}; template struct IteratorTraits { typedef typename Iterator::value_type value_type; }; template struct IteratorTraits { typedef T value_type; }; template struct IteratorTraits { typedef T value_type; }; #if GTEST_OS_WINDOWS # define GTEST_PATH_SEP_ "\\" # define GTEST_HAS_ALT_PATH_SEP_ 1 // The biggest signed integer type the compiler supports. typedef __int64 BiggestInt; #else # define GTEST_PATH_SEP_ "/" # define GTEST_HAS_ALT_PATH_SEP_ 0 typedef long long BiggestInt; // NOLINT #endif // GTEST_OS_WINDOWS // Utilities for char. // isspace(int ch) and friends accept an unsigned char or EOF. char // may be signed, depending on the compiler (or compiler flags). // Therefore we need to cast a char to unsigned char before calling // isspace(), etc. inline bool IsAlpha(char ch) { return isalpha(static_cast(ch)) != 0; } inline bool IsAlNum(char ch) { return isalnum(static_cast(ch)) != 0; } inline bool IsDigit(char ch) { return isdigit(static_cast(ch)) != 0; } inline bool IsLower(char ch) { return islower(static_cast(ch)) != 0; } inline bool IsSpace(char ch) { return isspace(static_cast(ch)) != 0; } inline bool IsUpper(char ch) { return isupper(static_cast(ch)) != 0; } inline bool IsXDigit(char ch) { return isxdigit(static_cast(ch)) != 0; } inline bool IsXDigit(wchar_t ch) { const unsigned char low_byte = static_cast(ch); return ch == low_byte && isxdigit(low_byte) != 0; } inline char ToLower(char ch) { return static_cast(tolower(static_cast(ch))); } inline char ToUpper(char ch) { return static_cast(toupper(static_cast(ch))); } inline std::string StripTrailingSpaces(std::string str) { std::string::iterator it = str.end(); while (it != str.begin() && IsSpace(*--it)) it = str.erase(it); return str; } // The testing::internal::posix namespace holds wrappers for common // POSIX functions. These wrappers hide the differences between // Windows/MSVC and POSIX systems. Since some compilers define these // standard functions as macros, the wrapper cannot have the same name // as the wrapped function. namespace posix { // Functions with a different name on Windows. #if GTEST_OS_WINDOWS typedef struct _stat StatStruct; # ifdef __BORLANDC__ inline int IsATTY(int fd) { return isatty(fd); } inline int StrCaseCmp(const char* s1, const char* s2) { return stricmp(s1, s2); } inline char* StrDup(const char* src) { return strdup(src); } # else // !__BORLANDC__ # if GTEST_OS_WINDOWS_MOBILE inline int IsATTY(int /* fd */) { return 0; } # else inline int IsATTY(int fd) { return _isatty(fd); } # endif // GTEST_OS_WINDOWS_MOBILE inline int StrCaseCmp(const char* s1, const char* s2) { return _stricmp(s1, s2); } inline char* StrDup(const char* src) { return _strdup(src); } # endif // __BORLANDC__ # if GTEST_OS_WINDOWS_MOBILE inline int FileNo(FILE* file) { return reinterpret_cast(_fileno(file)); } // Stat(), RmDir(), and IsDir() are not needed on Windows CE at this // time and thus not defined there. # else inline int FileNo(FILE* file) { return _fileno(file); } inline int Stat(const char* path, StatStruct* buf) { return _stat(path, buf); } inline int RmDir(const char* dir) { return _rmdir(dir); } inline bool IsDir(const StatStruct& st) { return (_S_IFDIR & st.st_mode) != 0; } # endif // GTEST_OS_WINDOWS_MOBILE #else typedef struct stat StatStruct; inline int FileNo(FILE* file) { return fileno(file); } inline int IsATTY(int fd) { return isatty(fd); } inline int Stat(const char* path, StatStruct* buf) { return stat(path, buf); } inline int StrCaseCmp(const char* s1, const char* s2) { return strcasecmp(s1, s2); } inline char* StrDup(const char* src) { return strdup(src); } inline int RmDir(const char* dir) { return rmdir(dir); } inline bool IsDir(const StatStruct& st) { return S_ISDIR(st.st_mode); } #endif // GTEST_OS_WINDOWS // Functions deprecated by MSVC 8.0. GTEST_DISABLE_MSC_DEPRECATED_PUSH_() inline const char* StrNCpy(char* dest, const char* src, size_t n) { return strncpy(dest, src, n); } // ChDir(), FReopen(), FDOpen(), Read(), Write(), Close(), and // StrError() aren't needed on Windows CE at this time and thus not // defined there. #if !GTEST_OS_WINDOWS_MOBILE && !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT inline int ChDir(const char* dir) { return chdir(dir); } #endif inline FILE* FOpen(const char* path, const char* mode) { return fopen(path, mode); } #if !GTEST_OS_WINDOWS_MOBILE inline FILE *FReopen(const char* path, const char* mode, FILE* stream) { return freopen(path, mode, stream); } inline FILE* FDOpen(int fd, const char* mode) { return fdopen(fd, mode); } #endif inline int FClose(FILE* fp) { return fclose(fp); } #if !GTEST_OS_WINDOWS_MOBILE inline int Read(int fd, void* buf, unsigned int count) { return static_cast(read(fd, buf, count)); } inline int Write(int fd, const void* buf, unsigned int count) { return static_cast(write(fd, buf, count)); } inline int Close(int fd) { return close(fd); } inline const char* StrError(int errnum) { return strerror(errnum); } #endif inline const char* GetEnv(const char* name) { #if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_WINDOWS_PHONE || GTEST_OS_WINDOWS_RT // We are on Windows CE, which has no environment variables. static_cast(name); // To prevent 'unused argument' warning. return NULL; #elif defined(__BORLANDC__) || defined(__SunOS_5_8) || defined(__SunOS_5_9) // Environment variables which we programmatically clear will be set to the // empty string rather than unset (NULL). Handle that case. const char* const env = getenv(name); return (env != NULL && env[0] != '\0') ? env : NULL; #else return getenv(name); #endif } GTEST_DISABLE_MSC_DEPRECATED_POP_() #if GTEST_OS_WINDOWS_MOBILE // Windows CE has no C library. The abort() function is used in // several places in Google Test. This implementation provides a reasonable // imitation of standard behaviour. void Abort(); #else inline void Abort() { abort(); } #endif // GTEST_OS_WINDOWS_MOBILE } // namespace posix // MSVC "deprecates" snprintf and issues warnings wherever it is used. In // order to avoid these warnings, we need to use _snprintf or _snprintf_s on // MSVC-based platforms. We map the GTEST_SNPRINTF_ macro to the appropriate // function in order to achieve that. We use macro definition here because // snprintf is a variadic function. #if _MSC_VER >= 1400 && !GTEST_OS_WINDOWS_MOBILE // MSVC 2005 and above support variadic macros. # define GTEST_SNPRINTF_(buffer, size, format, ...) \ _snprintf_s(buffer, size, size, format, __VA_ARGS__) #elif defined(_MSC_VER) // Windows CE does not define _snprintf_s and MSVC prior to 2005 doesn't // complain about _snprintf. # define GTEST_SNPRINTF_ _snprintf #else # define GTEST_SNPRINTF_ snprintf #endif // The maximum number a BiggestInt can represent. This definition // works no matter BiggestInt is represented in one's complement or // two's complement. // // We cannot rely on numeric_limits in STL, as __int64 and long long // are not part of standard C++ and numeric_limits doesn't need to be // defined for them. const BiggestInt kMaxBiggestInt = ~(static_cast(1) << (8*sizeof(BiggestInt) - 1)); // This template class serves as a compile-time function from size to // type. It maps a size in bytes to a primitive type with that // size. e.g. // // TypeWithSize<4>::UInt // // is typedef-ed to be unsigned int (unsigned integer made up of 4 // bytes). // // Such functionality should belong to STL, but I cannot find it // there. // // Google Test uses this class in the implementation of floating-point // comparison. // // For now it only handles UInt (unsigned int) as that's all Google Test // needs. Other types can be easily added in the future if need // arises. template class TypeWithSize { public: // This prevents the user from using TypeWithSize with incorrect // values of N. typedef void UInt; }; // The specialization for size 4. template <> class TypeWithSize<4> { public: // unsigned int has size 4 in both gcc and MSVC. // // As base/basictypes.h doesn't compile on Windows, we cannot use // uint32, uint64, and etc here. typedef int Int; typedef unsigned int UInt; }; // The specialization for size 8. template <> class TypeWithSize<8> { public: #if GTEST_OS_WINDOWS typedef __int64 Int; typedef unsigned __int64 UInt; #else typedef long long Int; // NOLINT typedef unsigned long long UInt; // NOLINT #endif // GTEST_OS_WINDOWS }; // Integer types of known sizes. typedef TypeWithSize<4>::Int Int32; typedef TypeWithSize<4>::UInt UInt32; typedef TypeWithSize<8>::Int Int64; typedef TypeWithSize<8>::UInt UInt64; typedef TypeWithSize<8>::Int TimeInMillis; // Represents time in milliseconds. // Utilities for command line flags and environment variables. // Macro for referencing flags. #if !defined(GTEST_FLAG) # define GTEST_FLAG(name) FLAGS_gtest_##name #endif // !defined(GTEST_FLAG) #if !defined(GTEST_USE_OWN_FLAGFILE_FLAG_) # define GTEST_USE_OWN_FLAGFILE_FLAG_ 1 #endif // !defined(GTEST_USE_OWN_FLAGFILE_FLAG_) #if !defined(GTEST_DECLARE_bool_) # define GTEST_FLAG_SAVER_ ::testing::internal::GTestFlagSaver // Macros for declaring flags. # define GTEST_DECLARE_bool_(name) GTEST_API_ extern bool GTEST_FLAG(name) # define GTEST_DECLARE_int32_(name) \ GTEST_API_ extern ::testing::internal::Int32 GTEST_FLAG(name) # define GTEST_DECLARE_string_(name) \ GTEST_API_ extern ::std::string GTEST_FLAG(name) // Macros for defining flags. # define GTEST_DEFINE_bool_(name, default_val, doc) \ GTEST_API_ bool GTEST_FLAG(name) = (default_val) # define GTEST_DEFINE_int32_(name, default_val, doc) \ GTEST_API_ ::testing::internal::Int32 GTEST_FLAG(name) = (default_val) # define GTEST_DEFINE_string_(name, default_val, doc) \ GTEST_API_ ::std::string GTEST_FLAG(name) = (default_val) #endif // !defined(GTEST_DECLARE_bool_) // Thread annotations #if !defined(GTEST_EXCLUSIVE_LOCK_REQUIRED_) # define GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks) # define GTEST_LOCK_EXCLUDED_(locks) #endif // !defined(GTEST_EXCLUSIVE_LOCK_REQUIRED_) // Parses 'str' for a 32-bit signed integer. If successful, writes the result // to *value and returns true; otherwise leaves *value unchanged and returns // false. // FIXME: Find a better way to refactor flag and environment parsing // out of both gtest-port.cc and gtest.cc to avoid exporting this utility // function. bool ParseInt32(const Message& src_text, const char* str, Int32* value); // Parses a bool/Int32/string from the environment variable // corresponding to the given Google Test flag. bool BoolFromGTestEnv(const char* flag, bool default_val); GTEST_API_ Int32 Int32FromGTestEnv(const char* flag, Int32 default_val); std::string OutputFlagAlsoCheckEnvVar(); const char* StringFromGTestEnv(const char* flag, const char* default_val); } // namespace internal } // namespace testing #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_ iptux-0.9.4/src/googletest/include/gtest/internal/gtest-string.h000066400000000000000000000154121475473122500250450ustar00rootroot00000000000000// Copyright 2005, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // The Google C++ Testing and Mocking Framework (Google Test) // // This header file declares the String class and functions used internally by // Google Test. They are subject to change without notice. They should not used // by code external to Google Test. // // This header file is #included by gtest-internal.h. // It should not be #included by other files. // GOOGLETEST_CM0001 DO NOT DELETE #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_ #ifdef __BORLANDC__ // string.h is not guaranteed to provide strcpy on C++ Builder. # include #endif #include #include #include "gtest/internal/gtest-port.h" namespace testing { namespace internal { // String - an abstract class holding static string utilities. class GTEST_API_ String { public: // Static utility methods // Clones a 0-terminated C string, allocating memory using new. The // caller is responsible for deleting the return value using // delete[]. Returns the cloned string, or NULL if the input is // NULL. // // This is different from strdup() in string.h, which allocates // memory using malloc(). static const char* CloneCString(const char* c_str); #if GTEST_OS_WINDOWS_MOBILE // Windows CE does not have the 'ANSI' versions of Win32 APIs. To be // able to pass strings to Win32 APIs on CE we need to convert them // to 'Unicode', UTF-16. // Creates a UTF-16 wide string from the given ANSI string, allocating // memory using new. The caller is responsible for deleting the return // value using delete[]. Returns the wide string, or NULL if the // input is NULL. // // The wide string is created using the ANSI codepage (CP_ACP) to // match the behaviour of the ANSI versions of Win32 calls and the // C runtime. static LPCWSTR AnsiToUtf16(const char* c_str); // Creates an ANSI string from the given wide string, allocating // memory using new. The caller is responsible for deleting the return // value using delete[]. Returns the ANSI string, or NULL if the // input is NULL. // // The returned string is created using the ANSI codepage (CP_ACP) to // match the behaviour of the ANSI versions of Win32 calls and the // C runtime. static const char* Utf16ToAnsi(LPCWSTR utf16_str); #endif // Compares two C strings. Returns true iff they have the same content. // // Unlike strcmp(), this function can handle NULL argument(s). A // NULL C string is considered different to any non-NULL C string, // including the empty string. static bool CStringEquals(const char* lhs, const char* rhs); // Converts a wide C string to a String using the UTF-8 encoding. // NULL will be converted to "(null)". If an error occurred during // the conversion, "(failed to convert from wide string)" is // returned. static std::string ShowWideCString(const wchar_t* wide_c_str); // Compares two wide C strings. Returns true iff they have the same // content. // // Unlike wcscmp(), this function can handle NULL argument(s). A // NULL C string is considered different to any non-NULL C string, // including the empty string. static bool WideCStringEquals(const wchar_t* lhs, const wchar_t* rhs); // Compares two C strings, ignoring case. Returns true iff they // have the same content. // // Unlike strcasecmp(), this function can handle NULL argument(s). // A NULL C string is considered different to any non-NULL C string, // including the empty string. static bool CaseInsensitiveCStringEquals(const char* lhs, const char* rhs); // Compares two wide C strings, ignoring case. Returns true iff they // have the same content. // // Unlike wcscasecmp(), this function can handle NULL argument(s). // A NULL C string is considered different to any non-NULL wide C string, // including the empty string. // NB: The implementations on different platforms slightly differ. // On windows, this method uses _wcsicmp which compares according to LC_CTYPE // environment variable. On GNU platform this method uses wcscasecmp // which compares according to LC_CTYPE category of the current locale. // On MacOS X, it uses towlower, which also uses LC_CTYPE category of the // current locale. static bool CaseInsensitiveWideCStringEquals(const wchar_t* lhs, const wchar_t* rhs); // Returns true iff the given string ends with the given suffix, ignoring // case. Any string is considered to end with an empty suffix. static bool EndsWithCaseInsensitive( const std::string& str, const std::string& suffix); // Formats an int value as "%02d". static std::string FormatIntWidth2(int value); // "%02d" for width == 2 // Formats an int value as "%X". static std::string FormatHexInt(int value); // Formats a byte as "%02X". static std::string FormatByte(unsigned char value); private: String(); // Not meant to be instantiated. }; // class String // Gets the content of the stringstream's buffer as an std::string. Each '\0' // character in the buffer is replaced with "\\0". GTEST_API_ std::string StringStreamToString(::std::stringstream* stream); } // namespace internal } // namespace testing #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_ iptux-0.9.4/src/googletest/include/gtest/internal/gtest-tuple.h000066400000000000000000000676751475473122500247120ustar00rootroot00000000000000// This file was GENERATED by command: // pump.py gtest-tuple.h.pump // DO NOT EDIT BY HAND!!! // Copyright 2009 Google Inc. // All Rights Reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // Implements a subset of TR1 tuple needed by Google Test and Google Mock. // GOOGLETEST_CM0001 DO NOT DELETE #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_ #include // For ::std::pair. // The compiler used in Symbian has a bug that prevents us from declaring the // tuple template as a friend (it complains that tuple is redefined). This // bypasses the bug by declaring the members that should otherwise be // private as public. // Sun Studio versions < 12 also have the above bug. #if defined(__SYMBIAN32__) || (defined(__SUNPRO_CC) && __SUNPRO_CC < 0x590) # define GTEST_DECLARE_TUPLE_AS_FRIEND_ public: #else # define GTEST_DECLARE_TUPLE_AS_FRIEND_ \ template friend class tuple; \ private: #endif // Visual Studio 2010, 2012, and 2013 define symbols in std::tr1 that conflict // with our own definitions. Therefore using our own tuple does not work on // those compilers. #if defined(_MSC_VER) && _MSC_VER >= 1600 /* 1600 is Visual Studio 2010 */ # error "gtest's tuple doesn't compile on Visual Studio 2010 or later. \ GTEST_USE_OWN_TR1_TUPLE must be set to 0 on those compilers." #endif // GTEST_n_TUPLE_(T) is the type of an n-tuple. #define GTEST_0_TUPLE_(T) tuple<> #define GTEST_1_TUPLE_(T) tuple #define GTEST_2_TUPLE_(T) tuple #define GTEST_3_TUPLE_(T) tuple #define GTEST_4_TUPLE_(T) tuple #define GTEST_5_TUPLE_(T) tuple #define GTEST_6_TUPLE_(T) tuple #define GTEST_7_TUPLE_(T) tuple #define GTEST_8_TUPLE_(T) tuple #define GTEST_9_TUPLE_(T) tuple #define GTEST_10_TUPLE_(T) tuple // GTEST_n_TYPENAMES_(T) declares a list of n typenames. #define GTEST_0_TYPENAMES_(T) #define GTEST_1_TYPENAMES_(T) typename T##0 #define GTEST_2_TYPENAMES_(T) typename T##0, typename T##1 #define GTEST_3_TYPENAMES_(T) typename T##0, typename T##1, typename T##2 #define GTEST_4_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \ typename T##3 #define GTEST_5_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \ typename T##3, typename T##4 #define GTEST_6_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \ typename T##3, typename T##4, typename T##5 #define GTEST_7_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \ typename T##3, typename T##4, typename T##5, typename T##6 #define GTEST_8_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \ typename T##3, typename T##4, typename T##5, typename T##6, typename T##7 #define GTEST_9_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \ typename T##3, typename T##4, typename T##5, typename T##6, \ typename T##7, typename T##8 #define GTEST_10_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \ typename T##3, typename T##4, typename T##5, typename T##6, \ typename T##7, typename T##8, typename T##9 // In theory, defining stuff in the ::std namespace is undefined // behavior. We can do this as we are playing the role of a standard // library vendor. namespace std { namespace tr1 { template class tuple; // Anything in namespace gtest_internal is Google Test's INTERNAL // IMPLEMENTATION DETAIL and MUST NOT BE USED DIRECTLY in user code. namespace gtest_internal { // ByRef::type is T if T is a reference; otherwise it's const T&. template struct ByRef { typedef const T& type; }; // NOLINT template struct ByRef { typedef T& type; }; // NOLINT // A handy wrapper for ByRef. #define GTEST_BY_REF_(T) typename ::std::tr1::gtest_internal::ByRef::type // AddRef::type is T if T is a reference; otherwise it's T&. This // is the same as tr1::add_reference::type. template struct AddRef { typedef T& type; }; // NOLINT template struct AddRef { typedef T& type; }; // NOLINT // A handy wrapper for AddRef. #define GTEST_ADD_REF_(T) typename ::std::tr1::gtest_internal::AddRef::type // A helper for implementing get(). template class Get; // A helper for implementing tuple_element. kIndexValid is true // iff k < the number of fields in tuple type T. template struct TupleElement; template struct TupleElement { typedef T0 type; }; template struct TupleElement { typedef T1 type; }; template struct TupleElement { typedef T2 type; }; template struct TupleElement { typedef T3 type; }; template struct TupleElement { typedef T4 type; }; template struct TupleElement { typedef T5 type; }; template struct TupleElement { typedef T6 type; }; template struct TupleElement { typedef T7 type; }; template struct TupleElement { typedef T8 type; }; template struct TupleElement { typedef T9 type; }; } // namespace gtest_internal template <> class tuple<> { public: tuple() {} tuple(const tuple& /* t */) {} tuple& operator=(const tuple& /* t */) { return *this; } }; template class GTEST_1_TUPLE_(T) { public: template friend class gtest_internal::Get; tuple() : f0_() {} explicit tuple(GTEST_BY_REF_(T0) f0) : f0_(f0) {} tuple(const tuple& t) : f0_(t.f0_) {} template tuple(const GTEST_1_TUPLE_(U)& t) : f0_(t.f0_) {} tuple& operator=(const tuple& t) { return CopyFrom(t); } template tuple& operator=(const GTEST_1_TUPLE_(U)& t) { return CopyFrom(t); } GTEST_DECLARE_TUPLE_AS_FRIEND_ template tuple& CopyFrom(const GTEST_1_TUPLE_(U)& t) { f0_ = t.f0_; return *this; } T0 f0_; }; template class GTEST_2_TUPLE_(T) { public: template friend class gtest_internal::Get; tuple() : f0_(), f1_() {} explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1) : f0_(f0), f1_(f1) {} tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_) {} template tuple(const GTEST_2_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_) {} template tuple(const ::std::pair& p) : f0_(p.first), f1_(p.second) {} tuple& operator=(const tuple& t) { return CopyFrom(t); } template tuple& operator=(const GTEST_2_TUPLE_(U)& t) { return CopyFrom(t); } template tuple& operator=(const ::std::pair& p) { f0_ = p.first; f1_ = p.second; return *this; } GTEST_DECLARE_TUPLE_AS_FRIEND_ template tuple& CopyFrom(const GTEST_2_TUPLE_(U)& t) { f0_ = t.f0_; f1_ = t.f1_; return *this; } T0 f0_; T1 f1_; }; template class GTEST_3_TUPLE_(T) { public: template friend class gtest_internal::Get; tuple() : f0_(), f1_(), f2_() {} explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1, GTEST_BY_REF_(T2) f2) : f0_(f0), f1_(f1), f2_(f2) {} tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_) {} template tuple(const GTEST_3_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_) {} tuple& operator=(const tuple& t) { return CopyFrom(t); } template tuple& operator=(const GTEST_3_TUPLE_(U)& t) { return CopyFrom(t); } GTEST_DECLARE_TUPLE_AS_FRIEND_ template tuple& CopyFrom(const GTEST_3_TUPLE_(U)& t) { f0_ = t.f0_; f1_ = t.f1_; f2_ = t.f2_; return *this; } T0 f0_; T1 f1_; T2 f2_; }; template class GTEST_4_TUPLE_(T) { public: template friend class gtest_internal::Get; tuple() : f0_(), f1_(), f2_(), f3_() {} explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1, GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3) : f0_(f0), f1_(f1), f2_(f2), f3_(f3) {} tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_) {} template tuple(const GTEST_4_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_) {} tuple& operator=(const tuple& t) { return CopyFrom(t); } template tuple& operator=(const GTEST_4_TUPLE_(U)& t) { return CopyFrom(t); } GTEST_DECLARE_TUPLE_AS_FRIEND_ template tuple& CopyFrom(const GTEST_4_TUPLE_(U)& t) { f0_ = t.f0_; f1_ = t.f1_; f2_ = t.f2_; f3_ = t.f3_; return *this; } T0 f0_; T1 f1_; T2 f2_; T3 f3_; }; template class GTEST_5_TUPLE_(T) { public: template friend class gtest_internal::Get; tuple() : f0_(), f1_(), f2_(), f3_(), f4_() {} explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1, GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4) {} tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_), f4_(t.f4_) {} template tuple(const GTEST_5_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_), f4_(t.f4_) {} tuple& operator=(const tuple& t) { return CopyFrom(t); } template tuple& operator=(const GTEST_5_TUPLE_(U)& t) { return CopyFrom(t); } GTEST_DECLARE_TUPLE_AS_FRIEND_ template tuple& CopyFrom(const GTEST_5_TUPLE_(U)& t) { f0_ = t.f0_; f1_ = t.f1_; f2_ = t.f2_; f3_ = t.f3_; f4_ = t.f4_; return *this; } T0 f0_; T1 f1_; T2 f2_; T3 f3_; T4 f4_; }; template class GTEST_6_TUPLE_(T) { public: template friend class gtest_internal::Get; tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_() {} explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1, GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4, GTEST_BY_REF_(T5) f5) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4), f5_(f5) {} tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_), f4_(t.f4_), f5_(t.f5_) {} template tuple(const GTEST_6_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_), f4_(t.f4_), f5_(t.f5_) {} tuple& operator=(const tuple& t) { return CopyFrom(t); } template tuple& operator=(const GTEST_6_TUPLE_(U)& t) { return CopyFrom(t); } GTEST_DECLARE_TUPLE_AS_FRIEND_ template tuple& CopyFrom(const GTEST_6_TUPLE_(U)& t) { f0_ = t.f0_; f1_ = t.f1_; f2_ = t.f2_; f3_ = t.f3_; f4_ = t.f4_; f5_ = t.f5_; return *this; } T0 f0_; T1 f1_; T2 f2_; T3 f3_; T4 f4_; T5 f5_; }; template class GTEST_7_TUPLE_(T) { public: template friend class gtest_internal::Get; tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_() {} explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1, GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4, GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4), f5_(f5), f6_(f6) {} tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_) {} template tuple(const GTEST_7_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_) {} tuple& operator=(const tuple& t) { return CopyFrom(t); } template tuple& operator=(const GTEST_7_TUPLE_(U)& t) { return CopyFrom(t); } GTEST_DECLARE_TUPLE_AS_FRIEND_ template tuple& CopyFrom(const GTEST_7_TUPLE_(U)& t) { f0_ = t.f0_; f1_ = t.f1_; f2_ = t.f2_; f3_ = t.f3_; f4_ = t.f4_; f5_ = t.f5_; f6_ = t.f6_; return *this; } T0 f0_; T1 f1_; T2 f2_; T3 f3_; T4 f4_; T5 f5_; T6 f6_; }; template class GTEST_8_TUPLE_(T) { public: template friend class gtest_internal::Get; tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_() {} explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1, GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4, GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6, GTEST_BY_REF_(T7) f7) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4), f5_(f5), f6_(f6), f7_(f7) {} tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_) {} template tuple(const GTEST_8_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_) {} tuple& operator=(const tuple& t) { return CopyFrom(t); } template tuple& operator=(const GTEST_8_TUPLE_(U)& t) { return CopyFrom(t); } GTEST_DECLARE_TUPLE_AS_FRIEND_ template tuple& CopyFrom(const GTEST_8_TUPLE_(U)& t) { f0_ = t.f0_; f1_ = t.f1_; f2_ = t.f2_; f3_ = t.f3_; f4_ = t.f4_; f5_ = t.f5_; f6_ = t.f6_; f7_ = t.f7_; return *this; } T0 f0_; T1 f1_; T2 f2_; T3 f3_; T4 f4_; T5 f5_; T6 f6_; T7 f7_; }; template class GTEST_9_TUPLE_(T) { public: template friend class gtest_internal::Get; tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_(), f8_() {} explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1, GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4, GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6, GTEST_BY_REF_(T7) f7, GTEST_BY_REF_(T8) f8) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4), f5_(f5), f6_(f6), f7_(f7), f8_(f8) {} tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_) {} template tuple(const GTEST_9_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_) {} tuple& operator=(const tuple& t) { return CopyFrom(t); } template tuple& operator=(const GTEST_9_TUPLE_(U)& t) { return CopyFrom(t); } GTEST_DECLARE_TUPLE_AS_FRIEND_ template tuple& CopyFrom(const GTEST_9_TUPLE_(U)& t) { f0_ = t.f0_; f1_ = t.f1_; f2_ = t.f2_; f3_ = t.f3_; f4_ = t.f4_; f5_ = t.f5_; f6_ = t.f6_; f7_ = t.f7_; f8_ = t.f8_; return *this; } T0 f0_; T1 f1_; T2 f2_; T3 f3_; T4 f4_; T5 f5_; T6 f6_; T7 f7_; T8 f8_; }; template class tuple { public: template friend class gtest_internal::Get; tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_(), f8_(), f9_() {} explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1, GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4, GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6, GTEST_BY_REF_(T7) f7, GTEST_BY_REF_(T8) f8, GTEST_BY_REF_(T9) f9) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4), f5_(f5), f6_(f6), f7_(f7), f8_(f8), f9_(f9) {} tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_), f9_(t.f9_) {} template tuple(const GTEST_10_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_), f9_(t.f9_) {} tuple& operator=(const tuple& t) { return CopyFrom(t); } template tuple& operator=(const GTEST_10_TUPLE_(U)& t) { return CopyFrom(t); } GTEST_DECLARE_TUPLE_AS_FRIEND_ template tuple& CopyFrom(const GTEST_10_TUPLE_(U)& t) { f0_ = t.f0_; f1_ = t.f1_; f2_ = t.f2_; f3_ = t.f3_; f4_ = t.f4_; f5_ = t.f5_; f6_ = t.f6_; f7_ = t.f7_; f8_ = t.f8_; f9_ = t.f9_; return *this; } T0 f0_; T1 f1_; T2 f2_; T3 f3_; T4 f4_; T5 f5_; T6 f6_; T7 f7_; T8 f8_; T9 f9_; }; // 6.1.3.2 Tuple creation functions. // Known limitations: we don't support passing an // std::tr1::reference_wrapper to make_tuple(). And we don't // implement tie(). inline tuple<> make_tuple() { return tuple<>(); } template inline GTEST_1_TUPLE_(T) make_tuple(const T0& f0) { return GTEST_1_TUPLE_(T)(f0); } template inline GTEST_2_TUPLE_(T) make_tuple(const T0& f0, const T1& f1) { return GTEST_2_TUPLE_(T)(f0, f1); } template inline GTEST_3_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2) { return GTEST_3_TUPLE_(T)(f0, f1, f2); } template inline GTEST_4_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2, const T3& f3) { return GTEST_4_TUPLE_(T)(f0, f1, f2, f3); } template inline GTEST_5_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2, const T3& f3, const T4& f4) { return GTEST_5_TUPLE_(T)(f0, f1, f2, f3, f4); } template inline GTEST_6_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2, const T3& f3, const T4& f4, const T5& f5) { return GTEST_6_TUPLE_(T)(f0, f1, f2, f3, f4, f5); } template inline GTEST_7_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2, const T3& f3, const T4& f4, const T5& f5, const T6& f6) { return GTEST_7_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6); } template inline GTEST_8_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2, const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7) { return GTEST_8_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7); } template inline GTEST_9_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2, const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7, const T8& f8) { return GTEST_9_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7, f8); } template inline GTEST_10_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2, const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7, const T8& f8, const T9& f9) { return GTEST_10_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7, f8, f9); } // 6.1.3.3 Tuple helper classes. template struct tuple_size; template struct tuple_size { static const int value = 0; }; template struct tuple_size { static const int value = 1; }; template struct tuple_size { static const int value = 2; }; template struct tuple_size { static const int value = 3; }; template struct tuple_size { static const int value = 4; }; template struct tuple_size { static const int value = 5; }; template struct tuple_size { static const int value = 6; }; template struct tuple_size { static const int value = 7; }; template struct tuple_size { static const int value = 8; }; template struct tuple_size { static const int value = 9; }; template struct tuple_size { static const int value = 10; }; template struct tuple_element { typedef typename gtest_internal::TupleElement< k < (tuple_size::value), k, Tuple>::type type; }; #define GTEST_TUPLE_ELEMENT_(k, Tuple) typename tuple_element::type // 6.1.3.4 Element access. namespace gtest_internal { template <> class Get<0> { public: template static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(0, Tuple)) Field(Tuple& t) { return t.f0_; } // NOLINT template static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(0, Tuple)) ConstField(const Tuple& t) { return t.f0_; } }; template <> class Get<1> { public: template static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(1, Tuple)) Field(Tuple& t) { return t.f1_; } // NOLINT template static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(1, Tuple)) ConstField(const Tuple& t) { return t.f1_; } }; template <> class Get<2> { public: template static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(2, Tuple)) Field(Tuple& t) { return t.f2_; } // NOLINT template static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(2, Tuple)) ConstField(const Tuple& t) { return t.f2_; } }; template <> class Get<3> { public: template static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(3, Tuple)) Field(Tuple& t) { return t.f3_; } // NOLINT template static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(3, Tuple)) ConstField(const Tuple& t) { return t.f3_; } }; template <> class Get<4> { public: template static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(4, Tuple)) Field(Tuple& t) { return t.f4_; } // NOLINT template static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(4, Tuple)) ConstField(const Tuple& t) { return t.f4_; } }; template <> class Get<5> { public: template static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(5, Tuple)) Field(Tuple& t) { return t.f5_; } // NOLINT template static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(5, Tuple)) ConstField(const Tuple& t) { return t.f5_; } }; template <> class Get<6> { public: template static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(6, Tuple)) Field(Tuple& t) { return t.f6_; } // NOLINT template static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(6, Tuple)) ConstField(const Tuple& t) { return t.f6_; } }; template <> class Get<7> { public: template static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(7, Tuple)) Field(Tuple& t) { return t.f7_; } // NOLINT template static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(7, Tuple)) ConstField(const Tuple& t) { return t.f7_; } }; template <> class Get<8> { public: template static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(8, Tuple)) Field(Tuple& t) { return t.f8_; } // NOLINT template static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(8, Tuple)) ConstField(const Tuple& t) { return t.f8_; } }; template <> class Get<9> { public: template static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(9, Tuple)) Field(Tuple& t) { return t.f9_; } // NOLINT template static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(9, Tuple)) ConstField(const Tuple& t) { return t.f9_; } }; } // namespace gtest_internal template GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(k, GTEST_10_TUPLE_(T))) get(GTEST_10_TUPLE_(T)& t) { return gtest_internal::Get::Field(t); } template GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(k, GTEST_10_TUPLE_(T))) get(const GTEST_10_TUPLE_(T)& t) { return gtest_internal::Get::ConstField(t); } // 6.1.3.5 Relational operators // We only implement == and !=, as we don't have a need for the rest yet. namespace gtest_internal { // SameSizeTuplePrefixComparator::Eq(t1, t2) returns true if the // first k fields of t1 equals the first k fields of t2. // SameSizeTuplePrefixComparator(k1, k2) would be a compiler error if // k1 != k2. template struct SameSizeTuplePrefixComparator; template <> struct SameSizeTuplePrefixComparator<0, 0> { template static bool Eq(const Tuple1& /* t1 */, const Tuple2& /* t2 */) { return true; } }; template struct SameSizeTuplePrefixComparator { template static bool Eq(const Tuple1& t1, const Tuple2& t2) { return SameSizeTuplePrefixComparator::Eq(t1, t2) && ::std::tr1::get(t1) == ::std::tr1::get(t2); } }; } // namespace gtest_internal template inline bool operator==(const GTEST_10_TUPLE_(T)& t, const GTEST_10_TUPLE_(U)& u) { return gtest_internal::SameSizeTuplePrefixComparator< tuple_size::value, tuple_size::value>::Eq(t, u); } template inline bool operator!=(const GTEST_10_TUPLE_(T)& t, const GTEST_10_TUPLE_(U)& u) { return !(t == u); } // 6.1.4 Pairs. // Unimplemented. } // namespace tr1 } // namespace std #undef GTEST_0_TUPLE_ #undef GTEST_1_TUPLE_ #undef GTEST_2_TUPLE_ #undef GTEST_3_TUPLE_ #undef GTEST_4_TUPLE_ #undef GTEST_5_TUPLE_ #undef GTEST_6_TUPLE_ #undef GTEST_7_TUPLE_ #undef GTEST_8_TUPLE_ #undef GTEST_9_TUPLE_ #undef GTEST_10_TUPLE_ #undef GTEST_0_TYPENAMES_ #undef GTEST_1_TYPENAMES_ #undef GTEST_2_TYPENAMES_ #undef GTEST_3_TYPENAMES_ #undef GTEST_4_TYPENAMES_ #undef GTEST_5_TYPENAMES_ #undef GTEST_6_TYPENAMES_ #undef GTEST_7_TYPENAMES_ #undef GTEST_8_TYPENAMES_ #undef GTEST_9_TYPENAMES_ #undef GTEST_10_TYPENAMES_ #undef GTEST_DECLARE_TUPLE_AS_FRIEND_ #undef GTEST_BY_REF_ #undef GTEST_ADD_REF_ #undef GTEST_TUPLE_ELEMENT_ #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_ iptux-0.9.4/src/googletest/include/gtest/internal/gtest-tuple.h.pump000066400000000000000000000226101475473122500256460ustar00rootroot00000000000000$$ -*- mode: c++; -*- $var n = 10 $$ Maximum number of tuple fields we want to support. $$ This meta comment fixes auto-indentation in Emacs. }} // Copyright 2009 Google Inc. // All Rights Reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // Implements a subset of TR1 tuple needed by Google Test and Google Mock. // GOOGLETEST_CM0001 DO NOT DELETE #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_ #include // For ::std::pair. // The compiler used in Symbian has a bug that prevents us from declaring the // tuple template as a friend (it complains that tuple is redefined). This // bypasses the bug by declaring the members that should otherwise be // private as public. // Sun Studio versions < 12 also have the above bug. #if defined(__SYMBIAN32__) || (defined(__SUNPRO_CC) && __SUNPRO_CC < 0x590) # define GTEST_DECLARE_TUPLE_AS_FRIEND_ public: #else # define GTEST_DECLARE_TUPLE_AS_FRIEND_ \ template friend class tuple; \ private: #endif // Visual Studio 2010, 2012, and 2013 define symbols in std::tr1 that conflict // with our own definitions. Therefore using our own tuple does not work on // those compilers. #if defined(_MSC_VER) && _MSC_VER >= 1600 /* 1600 is Visual Studio 2010 */ # error "gtest's tuple doesn't compile on Visual Studio 2010 or later. \ GTEST_USE_OWN_TR1_TUPLE must be set to 0 on those compilers." #endif $range i 0..n-1 $range j 0..n $range k 1..n // GTEST_n_TUPLE_(T) is the type of an n-tuple. #define GTEST_0_TUPLE_(T) tuple<> $for k [[ $range m 0..k-1 $range m2 k..n-1 #define GTEST_$(k)_TUPLE_(T) tuple<$for m, [[T##$m]]$for m2 [[, void]]> ]] // GTEST_n_TYPENAMES_(T) declares a list of n typenames. $for j [[ $range m 0..j-1 #define GTEST_$(j)_TYPENAMES_(T) $for m, [[typename T##$m]] ]] // In theory, defining stuff in the ::std namespace is undefined // behavior. We can do this as we are playing the role of a standard // library vendor. namespace std { namespace tr1 { template <$for i, [[typename T$i = void]]> class tuple; // Anything in namespace gtest_internal is Google Test's INTERNAL // IMPLEMENTATION DETAIL and MUST NOT BE USED DIRECTLY in user code. namespace gtest_internal { // ByRef::type is T if T is a reference; otherwise it's const T&. template struct ByRef { typedef const T& type; }; // NOLINT template struct ByRef { typedef T& type; }; // NOLINT // A handy wrapper for ByRef. #define GTEST_BY_REF_(T) typename ::std::tr1::gtest_internal::ByRef::type // AddRef::type is T if T is a reference; otherwise it's T&. This // is the same as tr1::add_reference::type. template struct AddRef { typedef T& type; }; // NOLINT template struct AddRef { typedef T& type; }; // NOLINT // A handy wrapper for AddRef. #define GTEST_ADD_REF_(T) typename ::std::tr1::gtest_internal::AddRef::type // A helper for implementing get(). template class Get; // A helper for implementing tuple_element. kIndexValid is true // iff k < the number of fields in tuple type T. template struct TupleElement; $for i [[ template struct TupleElement { typedef T$i type; }; ]] } // namespace gtest_internal template <> class tuple<> { public: tuple() {} tuple(const tuple& /* t */) {} tuple& operator=(const tuple& /* t */) { return *this; } }; $for k [[ $range m 0..k-1 template class $if k < n [[GTEST_$(k)_TUPLE_(T)]] $else [[tuple]] { public: template friend class gtest_internal::Get; tuple() : $for m, [[f$(m)_()]] {} explicit tuple($for m, [[GTEST_BY_REF_(T$m) f$m]]) : [[]] $for m, [[f$(m)_(f$m)]] {} tuple(const tuple& t) : $for m, [[f$(m)_(t.f$(m)_)]] {} template tuple(const GTEST_$(k)_TUPLE_(U)& t) : $for m, [[f$(m)_(t.f$(m)_)]] {} $if k == 2 [[ template tuple(const ::std::pair& p) : f0_(p.first), f1_(p.second) {} ]] tuple& operator=(const tuple& t) { return CopyFrom(t); } template tuple& operator=(const GTEST_$(k)_TUPLE_(U)& t) { return CopyFrom(t); } $if k == 2 [[ template tuple& operator=(const ::std::pair& p) { f0_ = p.first; f1_ = p.second; return *this; } ]] GTEST_DECLARE_TUPLE_AS_FRIEND_ template tuple& CopyFrom(const GTEST_$(k)_TUPLE_(U)& t) { $for m [[ f$(m)_ = t.f$(m)_; ]] return *this; } $for m [[ T$m f$(m)_; ]] }; ]] // 6.1.3.2 Tuple creation functions. // Known limitations: we don't support passing an // std::tr1::reference_wrapper to make_tuple(). And we don't // implement tie(). inline tuple<> make_tuple() { return tuple<>(); } $for k [[ $range m 0..k-1 template inline GTEST_$(k)_TUPLE_(T) make_tuple($for m, [[const T$m& f$m]]) { return GTEST_$(k)_TUPLE_(T)($for m, [[f$m]]); } ]] // 6.1.3.3 Tuple helper classes. template struct tuple_size; $for j [[ template struct tuple_size { static const int value = $j; }; ]] template struct tuple_element { typedef typename gtest_internal::TupleElement< k < (tuple_size::value), k, Tuple>::type type; }; #define GTEST_TUPLE_ELEMENT_(k, Tuple) typename tuple_element::type // 6.1.3.4 Element access. namespace gtest_internal { $for i [[ template <> class Get<$i> { public: template static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_($i, Tuple)) Field(Tuple& t) { return t.f$(i)_; } // NOLINT template static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_($i, Tuple)) ConstField(const Tuple& t) { return t.f$(i)_; } }; ]] } // namespace gtest_internal template GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(k, GTEST_$(n)_TUPLE_(T))) get(GTEST_$(n)_TUPLE_(T)& t) { return gtest_internal::Get::Field(t); } template GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(k, GTEST_$(n)_TUPLE_(T))) get(const GTEST_$(n)_TUPLE_(T)& t) { return gtest_internal::Get::ConstField(t); } // 6.1.3.5 Relational operators // We only implement == and !=, as we don't have a need for the rest yet. namespace gtest_internal { // SameSizeTuplePrefixComparator::Eq(t1, t2) returns true if the // first k fields of t1 equals the first k fields of t2. // SameSizeTuplePrefixComparator(k1, k2) would be a compiler error if // k1 != k2. template struct SameSizeTuplePrefixComparator; template <> struct SameSizeTuplePrefixComparator<0, 0> { template static bool Eq(const Tuple1& /* t1 */, const Tuple2& /* t2 */) { return true; } }; template struct SameSizeTuplePrefixComparator { template static bool Eq(const Tuple1& t1, const Tuple2& t2) { return SameSizeTuplePrefixComparator::Eq(t1, t2) && ::std::tr1::get(t1) == ::std::tr1::get(t2); } }; } // namespace gtest_internal template inline bool operator==(const GTEST_$(n)_TUPLE_(T)& t, const GTEST_$(n)_TUPLE_(U)& u) { return gtest_internal::SameSizeTuplePrefixComparator< tuple_size::value, tuple_size::value>::Eq(t, u); } template inline bool operator!=(const GTEST_$(n)_TUPLE_(T)& t, const GTEST_$(n)_TUPLE_(U)& u) { return !(t == u); } // 6.1.4 Pairs. // Unimplemented. } // namespace tr1 } // namespace std $for j [[ #undef GTEST_$(j)_TUPLE_ ]] $for j [[ #undef GTEST_$(j)_TYPENAMES_ ]] #undef GTEST_DECLARE_TUPLE_AS_FRIEND_ #undef GTEST_BY_REF_ #undef GTEST_ADD_REF_ #undef GTEST_TUPLE_ELEMENT_ #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_ iptux-0.9.4/src/googletest/include/gtest/internal/gtest-type-util.h000066400000000000000000005537531475473122500255120ustar00rootroot00000000000000// This file was GENERATED by command: // pump.py gtest-type-util.h.pump // DO NOT EDIT BY HAND!!! // Copyright 2008 Google Inc. // All Rights Reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // Type utilities needed for implementing typed and type-parameterized // tests. This file is generated by a SCRIPT. DO NOT EDIT BY HAND! // // Currently we support at most 50 types in a list, and at most 50 // type-parameterized tests in one type-parameterized test case. // Please contact googletestframework@googlegroups.com if you need // more. // GOOGLETEST_CM0001 DO NOT DELETE #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_ #include "gtest/internal/gtest-port.h" // #ifdef __GNUC__ is too general here. It is possible to use gcc without using // libstdc++ (which is where cxxabi.h comes from). # if GTEST_HAS_CXXABI_H_ # include # elif defined(__HP_aCC) # include # endif // GTEST_HASH_CXXABI_H_ namespace testing { namespace internal { // Canonicalizes a given name with respect to the Standard C++ Library. // This handles removing the inline namespace within `std` that is // used by various standard libraries (e.g., `std::__1`). Names outside // of namespace std are returned unmodified. inline std::string CanonicalizeForStdLibVersioning(std::string s) { static const char prefix[] = "std::__"; if (s.compare(0, strlen(prefix), prefix) == 0) { std::string::size_type end = s.find("::", strlen(prefix)); if (end != s.npos) { // Erase everything between the initial `std` and the second `::`. s.erase(strlen("std"), end - strlen("std")); } } return s; } // GetTypeName() returns a human-readable name of type T. // NB: This function is also used in Google Mock, so don't move it inside of // the typed-test-only section below. template std::string GetTypeName() { # if GTEST_HAS_RTTI const char* const name = typeid(T).name(); # if GTEST_HAS_CXXABI_H_ || defined(__HP_aCC) int status = 0; // gcc's implementation of typeid(T).name() mangles the type name, // so we have to demangle it. # if GTEST_HAS_CXXABI_H_ using abi::__cxa_demangle; # endif // GTEST_HAS_CXXABI_H_ char* const readable_name = __cxa_demangle(name, 0, 0, &status); const std::string name_str(status == 0 ? readable_name : name); free(readable_name); return CanonicalizeForStdLibVersioning(name_str); # else return name; # endif // GTEST_HAS_CXXABI_H_ || __HP_aCC # else return ""; # endif // GTEST_HAS_RTTI } #if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P // AssertyTypeEq::type is defined iff T1 and T2 are the same // type. This can be used as a compile-time assertion to ensure that // two types are equal. template struct AssertTypeEq; template struct AssertTypeEq { typedef bool type; }; // A unique type used as the default value for the arguments of class // template Types. This allows us to simulate variadic templates // (e.g. Types, Type, and etc), which C++ doesn't // support directly. struct None {}; // The following family of struct and struct templates are used to // represent type lists. In particular, TypesN // represents a type list with N types (T1, T2, ..., and TN) in it. // Except for Types0, every struct in the family has two member types: // Head for the first type in the list, and Tail for the rest of the // list. // The empty type list. struct Types0 {}; // Type lists of length 1, 2, 3, and so on. template struct Types1 { typedef T1 Head; typedef Types0 Tail; }; template struct Types2 { typedef T1 Head; typedef Types1 Tail; }; template struct Types3 { typedef T1 Head; typedef Types2 Tail; }; template struct Types4 { typedef T1 Head; typedef Types3 Tail; }; template struct Types5 { typedef T1 Head; typedef Types4 Tail; }; template struct Types6 { typedef T1 Head; typedef Types5 Tail; }; template struct Types7 { typedef T1 Head; typedef Types6 Tail; }; template struct Types8 { typedef T1 Head; typedef Types7 Tail; }; template struct Types9 { typedef T1 Head; typedef Types8 Tail; }; template struct Types10 { typedef T1 Head; typedef Types9 Tail; }; template struct Types11 { typedef T1 Head; typedef Types10 Tail; }; template struct Types12 { typedef T1 Head; typedef Types11 Tail; }; template struct Types13 { typedef T1 Head; typedef Types12 Tail; }; template struct Types14 { typedef T1 Head; typedef Types13 Tail; }; template struct Types15 { typedef T1 Head; typedef Types14 Tail; }; template struct Types16 { typedef T1 Head; typedef Types15 Tail; }; template struct Types17 { typedef T1 Head; typedef Types16 Tail; }; template struct Types18 { typedef T1 Head; typedef Types17 Tail; }; template struct Types19 { typedef T1 Head; typedef Types18 Tail; }; template struct Types20 { typedef T1 Head; typedef Types19 Tail; }; template struct Types21 { typedef T1 Head; typedef Types20 Tail; }; template struct Types22 { typedef T1 Head; typedef Types21 Tail; }; template struct Types23 { typedef T1 Head; typedef Types22 Tail; }; template struct Types24 { typedef T1 Head; typedef Types23 Tail; }; template struct Types25 { typedef T1 Head; typedef Types24 Tail; }; template struct Types26 { typedef T1 Head; typedef Types25 Tail; }; template struct Types27 { typedef T1 Head; typedef Types26 Tail; }; template struct Types28 { typedef T1 Head; typedef Types27 Tail; }; template struct Types29 { typedef T1 Head; typedef Types28 Tail; }; template struct Types30 { typedef T1 Head; typedef Types29 Tail; }; template struct Types31 { typedef T1 Head; typedef Types30 Tail; }; template struct Types32 { typedef T1 Head; typedef Types31 Tail; }; template struct Types33 { typedef T1 Head; typedef Types32 Tail; }; template struct Types34 { typedef T1 Head; typedef Types33 Tail; }; template struct Types35 { typedef T1 Head; typedef Types34 Tail; }; template struct Types36 { typedef T1 Head; typedef Types35 Tail; }; template struct Types37 { typedef T1 Head; typedef Types36 Tail; }; template struct Types38 { typedef T1 Head; typedef Types37 Tail; }; template struct Types39 { typedef T1 Head; typedef Types38 Tail; }; template struct Types40 { typedef T1 Head; typedef Types39 Tail; }; template struct Types41 { typedef T1 Head; typedef Types40 Tail; }; template struct Types42 { typedef T1 Head; typedef Types41 Tail; }; template struct Types43 { typedef T1 Head; typedef Types42 Tail; }; template struct Types44 { typedef T1 Head; typedef Types43 Tail; }; template struct Types45 { typedef T1 Head; typedef Types44 Tail; }; template struct Types46 { typedef T1 Head; typedef Types45 Tail; }; template struct Types47 { typedef T1 Head; typedef Types46 Tail; }; template struct Types48 { typedef T1 Head; typedef Types47 Tail; }; template struct Types49 { typedef T1 Head; typedef Types48 Tail; }; template struct Types50 { typedef T1 Head; typedef Types49 Tail; }; } // namespace internal // We don't want to require the users to write TypesN<...> directly, // as that would require them to count the length. Types<...> is much // easier to write, but generates horrible messages when there is a // compiler error, as gcc insists on printing out each template // argument, even if it has the default value (this means Types // will appear as Types in the compiler // errors). // // Our solution is to combine the best part of the two approaches: a // user would write Types, and Google Test will translate // that to TypesN internally to make error messages // readable. The translation is done by the 'type' member of the // Types template. template struct Types { typedef internal::Types50 type; }; template <> struct Types { typedef internal::Types0 type; }; template struct Types { typedef internal::Types1 type; }; template struct Types { typedef internal::Types2 type; }; template struct Types { typedef internal::Types3 type; }; template struct Types { typedef internal::Types4 type; }; template struct Types { typedef internal::Types5 type; }; template struct Types { typedef internal::Types6 type; }; template struct Types { typedef internal::Types7 type; }; template struct Types { typedef internal::Types8 type; }; template struct Types { typedef internal::Types9 type; }; template struct Types { typedef internal::Types10 type; }; template struct Types { typedef internal::Types11 type; }; template struct Types { typedef internal::Types12 type; }; template struct Types { typedef internal::Types13 type; }; template struct Types { typedef internal::Types14 type; }; template struct Types { typedef internal::Types15 type; }; template struct Types { typedef internal::Types16 type; }; template struct Types { typedef internal::Types17 type; }; template struct Types { typedef internal::Types18 type; }; template struct Types { typedef internal::Types19 type; }; template struct Types { typedef internal::Types20 type; }; template struct Types { typedef internal::Types21 type; }; template struct Types { typedef internal::Types22 type; }; template struct Types { typedef internal::Types23 type; }; template struct Types { typedef internal::Types24 type; }; template struct Types { typedef internal::Types25 type; }; template struct Types { typedef internal::Types26 type; }; template struct Types { typedef internal::Types27 type; }; template struct Types { typedef internal::Types28 type; }; template struct Types { typedef internal::Types29 type; }; template struct Types { typedef internal::Types30 type; }; template struct Types { typedef internal::Types31 type; }; template struct Types { typedef internal::Types32 type; }; template struct Types { typedef internal::Types33 type; }; template struct Types { typedef internal::Types34 type; }; template struct Types { typedef internal::Types35 type; }; template struct Types { typedef internal::Types36 type; }; template struct Types { typedef internal::Types37 type; }; template struct Types { typedef internal::Types38 type; }; template struct Types { typedef internal::Types39 type; }; template struct Types { typedef internal::Types40 type; }; template struct Types { typedef internal::Types41 type; }; template struct Types { typedef internal::Types42 type; }; template struct Types { typedef internal::Types43 type; }; template struct Types { typedef internal::Types44 type; }; template struct Types { typedef internal::Types45 type; }; template struct Types { typedef internal::Types46 type; }; template struct Types { typedef internal::Types47 type; }; template struct Types { typedef internal::Types48 type; }; template struct Types { typedef internal::Types49 type; }; namespace internal { # define GTEST_TEMPLATE_ template class // The template "selector" struct TemplateSel is used to // represent Tmpl, which must be a class template with one type // parameter, as a type. TemplateSel::Bind::type is defined // as the type Tmpl. This allows us to actually instantiate the // template "selected" by TemplateSel. // // This trick is necessary for simulating typedef for class templates, // which C++ doesn't support directly. template struct TemplateSel { template struct Bind { typedef Tmpl type; }; }; # define GTEST_BIND_(TmplSel, T) \ TmplSel::template Bind::type // A unique struct template used as the default value for the // arguments of class template Templates. This allows us to simulate // variadic templates (e.g. Templates, Templates, // and etc), which C++ doesn't support directly. template struct NoneT {}; // The following family of struct and struct templates are used to // represent template lists. In particular, TemplatesN represents a list of N templates (T1, T2, ..., and TN). Except // for Templates0, every struct in the family has two member types: // Head for the selector of the first template in the list, and Tail // for the rest of the list. // The empty template list. struct Templates0 {}; // Template lists of length 1, 2, 3, and so on. template struct Templates1 { typedef TemplateSel Head; typedef Templates0 Tail; }; template struct Templates2 { typedef TemplateSel Head; typedef Templates1 Tail; }; template struct Templates3 { typedef TemplateSel Head; typedef Templates2 Tail; }; template struct Templates4 { typedef TemplateSel Head; typedef Templates3 Tail; }; template struct Templates5 { typedef TemplateSel Head; typedef Templates4 Tail; }; template struct Templates6 { typedef TemplateSel Head; typedef Templates5 Tail; }; template struct Templates7 { typedef TemplateSel Head; typedef Templates6 Tail; }; template struct Templates8 { typedef TemplateSel Head; typedef Templates7 Tail; }; template struct Templates9 { typedef TemplateSel Head; typedef Templates8 Tail; }; template struct Templates10 { typedef TemplateSel Head; typedef Templates9 Tail; }; template struct Templates11 { typedef TemplateSel Head; typedef Templates10 Tail; }; template struct Templates12 { typedef TemplateSel Head; typedef Templates11 Tail; }; template struct Templates13 { typedef TemplateSel Head; typedef Templates12 Tail; }; template struct Templates14 { typedef TemplateSel Head; typedef Templates13 Tail; }; template struct Templates15 { typedef TemplateSel Head; typedef Templates14 Tail; }; template struct Templates16 { typedef TemplateSel Head; typedef Templates15 Tail; }; template struct Templates17 { typedef TemplateSel Head; typedef Templates16 Tail; }; template struct Templates18 { typedef TemplateSel Head; typedef Templates17 Tail; }; template struct Templates19 { typedef TemplateSel Head; typedef Templates18 Tail; }; template struct Templates20 { typedef TemplateSel Head; typedef Templates19 Tail; }; template struct Templates21 { typedef TemplateSel Head; typedef Templates20 Tail; }; template struct Templates22 { typedef TemplateSel Head; typedef Templates21 Tail; }; template struct Templates23 { typedef TemplateSel Head; typedef Templates22 Tail; }; template struct Templates24 { typedef TemplateSel Head; typedef Templates23 Tail; }; template struct Templates25 { typedef TemplateSel Head; typedef Templates24 Tail; }; template struct Templates26 { typedef TemplateSel Head; typedef Templates25 Tail; }; template struct Templates27 { typedef TemplateSel Head; typedef Templates26 Tail; }; template struct Templates28 { typedef TemplateSel Head; typedef Templates27 Tail; }; template struct Templates29 { typedef TemplateSel Head; typedef Templates28 Tail; }; template struct Templates30 { typedef TemplateSel Head; typedef Templates29 Tail; }; template struct Templates31 { typedef TemplateSel Head; typedef Templates30 Tail; }; template struct Templates32 { typedef TemplateSel Head; typedef Templates31 Tail; }; template struct Templates33 { typedef TemplateSel Head; typedef Templates32 Tail; }; template struct Templates34 { typedef TemplateSel Head; typedef Templates33 Tail; }; template struct Templates35 { typedef TemplateSel Head; typedef Templates34 Tail; }; template struct Templates36 { typedef TemplateSel Head; typedef Templates35 Tail; }; template struct Templates37 { typedef TemplateSel Head; typedef Templates36 Tail; }; template struct Templates38 { typedef TemplateSel Head; typedef Templates37 Tail; }; template struct Templates39 { typedef TemplateSel Head; typedef Templates38 Tail; }; template struct Templates40 { typedef TemplateSel Head; typedef Templates39 Tail; }; template struct Templates41 { typedef TemplateSel Head; typedef Templates40 Tail; }; template struct Templates42 { typedef TemplateSel Head; typedef Templates41 Tail; }; template struct Templates43 { typedef TemplateSel Head; typedef Templates42 Tail; }; template struct Templates44 { typedef TemplateSel Head; typedef Templates43 Tail; }; template struct Templates45 { typedef TemplateSel Head; typedef Templates44 Tail; }; template struct Templates46 { typedef TemplateSel Head; typedef Templates45 Tail; }; template struct Templates47 { typedef TemplateSel Head; typedef Templates46 Tail; }; template struct Templates48 { typedef TemplateSel Head; typedef Templates47 Tail; }; template struct Templates49 { typedef TemplateSel Head; typedef Templates48 Tail; }; template struct Templates50 { typedef TemplateSel Head; typedef Templates49 Tail; }; // We don't want to require the users to write TemplatesN<...> directly, // as that would require them to count the length. Templates<...> is much // easier to write, but generates horrible messages when there is a // compiler error, as gcc insists on printing out each template // argument, even if it has the default value (this means Templates // will appear as Templates in the compiler // errors). // // Our solution is to combine the best part of the two approaches: a // user would write Templates, and Google Test will translate // that to TemplatesN internally to make error messages // readable. The translation is done by the 'type' member of the // Templates template. template struct Templates { typedef Templates50 type; }; template <> struct Templates { typedef Templates0 type; }; template struct Templates { typedef Templates1 type; }; template struct Templates { typedef Templates2 type; }; template struct Templates { typedef Templates3 type; }; template struct Templates { typedef Templates4 type; }; template struct Templates { typedef Templates5 type; }; template struct Templates { typedef Templates6 type; }; template struct Templates { typedef Templates7 type; }; template struct Templates { typedef Templates8 type; }; template struct Templates { typedef Templates9 type; }; template struct Templates { typedef Templates10 type; }; template struct Templates { typedef Templates11 type; }; template struct Templates { typedef Templates12 type; }; template struct Templates { typedef Templates13 type; }; template struct Templates { typedef Templates14 type; }; template struct Templates { typedef Templates15 type; }; template struct Templates { typedef Templates16 type; }; template struct Templates { typedef Templates17 type; }; template struct Templates { typedef Templates18 type; }; template struct Templates { typedef Templates19 type; }; template struct Templates { typedef Templates20 type; }; template struct Templates { typedef Templates21 type; }; template struct Templates { typedef Templates22 type; }; template struct Templates { typedef Templates23 type; }; template struct Templates { typedef Templates24 type; }; template struct Templates { typedef Templates25 type; }; template struct Templates { typedef Templates26 type; }; template struct Templates { typedef Templates27 type; }; template struct Templates { typedef Templates28 type; }; template struct Templates { typedef Templates29 type; }; template struct Templates { typedef Templates30 type; }; template struct Templates { typedef Templates31 type; }; template struct Templates { typedef Templates32 type; }; template struct Templates { typedef Templates33 type; }; template struct Templates { typedef Templates34 type; }; template struct Templates { typedef Templates35 type; }; template struct Templates { typedef Templates36 type; }; template struct Templates { typedef Templates37 type; }; template struct Templates { typedef Templates38 type; }; template struct Templates { typedef Templates39 type; }; template struct Templates { typedef Templates40 type; }; template struct Templates { typedef Templates41 type; }; template struct Templates { typedef Templates42 type; }; template struct Templates { typedef Templates43 type; }; template struct Templates { typedef Templates44 type; }; template struct Templates { typedef Templates45 type; }; template struct Templates { typedef Templates46 type; }; template struct Templates { typedef Templates47 type; }; template struct Templates { typedef Templates48 type; }; template struct Templates { typedef Templates49 type; }; // The TypeList template makes it possible to use either a single type // or a Types<...> list in TYPED_TEST_CASE() and // INSTANTIATE_TYPED_TEST_CASE_P(). template struct TypeList { typedef Types1 type; }; template struct TypeList > { typedef typename Types::type type; }; #endif // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P } // namespace internal } // namespace testing #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_ iptux-0.9.4/src/googletest/include/gtest/internal/gtest-type-util.h.pump000066400000000000000000000234161475473122500264560ustar00rootroot00000000000000$$ -*- mode: c++; -*- $var n = 50 $$ Maximum length of type lists we want to support. // Copyright 2008 Google Inc. // All Rights Reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // Type utilities needed for implementing typed and type-parameterized // tests. This file is generated by a SCRIPT. DO NOT EDIT BY HAND! // // Currently we support at most $n types in a list, and at most $n // type-parameterized tests in one type-parameterized test case. // Please contact googletestframework@googlegroups.com if you need // more. // GOOGLETEST_CM0001 DO NOT DELETE #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_ #include "gtest/internal/gtest-port.h" // #ifdef __GNUC__ is too general here. It is possible to use gcc without using // libstdc++ (which is where cxxabi.h comes from). # if GTEST_HAS_CXXABI_H_ # include # elif defined(__HP_aCC) # include # endif // GTEST_HASH_CXXABI_H_ namespace testing { namespace internal { // Canonicalizes a given name with respect to the Standard C++ Library. // This handles removing the inline namespace within `std` that is // used by various standard libraries (e.g., `std::__1`). Names outside // of namespace std are returned unmodified. inline std::string CanonicalizeForStdLibVersioning(std::string s) { static const char prefix[] = "std::__"; if (s.compare(0, strlen(prefix), prefix) == 0) { std::string::size_type end = s.find("::", strlen(prefix)); if (end != s.npos) { // Erase everything between the initial `std` and the second `::`. s.erase(strlen("std"), end - strlen("std")); } } return s; } // GetTypeName() returns a human-readable name of type T. // NB: This function is also used in Google Mock, so don't move it inside of // the typed-test-only section below. template std::string GetTypeName() { # if GTEST_HAS_RTTI const char* const name = typeid(T).name(); # if GTEST_HAS_CXXABI_H_ || defined(__HP_aCC) int status = 0; // gcc's implementation of typeid(T).name() mangles the type name, // so we have to demangle it. # if GTEST_HAS_CXXABI_H_ using abi::__cxa_demangle; # endif // GTEST_HAS_CXXABI_H_ char* const readable_name = __cxa_demangle(name, 0, 0, &status); const std::string name_str(status == 0 ? readable_name : name); free(readable_name); return CanonicalizeForStdLibVersioning(name_str); # else return name; # endif // GTEST_HAS_CXXABI_H_ || __HP_aCC # else return ""; # endif // GTEST_HAS_RTTI } #if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P // AssertyTypeEq::type is defined iff T1 and T2 are the same // type. This can be used as a compile-time assertion to ensure that // two types are equal. template struct AssertTypeEq; template struct AssertTypeEq { typedef bool type; }; // A unique type used as the default value for the arguments of class // template Types. This allows us to simulate variadic templates // (e.g. Types, Type, and etc), which C++ doesn't // support directly. struct None {}; // The following family of struct and struct templates are used to // represent type lists. In particular, TypesN // represents a type list with N types (T1, T2, ..., and TN) in it. // Except for Types0, every struct in the family has two member types: // Head for the first type in the list, and Tail for the rest of the // list. // The empty type list. struct Types0 {}; // Type lists of length 1, 2, 3, and so on. template struct Types1 { typedef T1 Head; typedef Types0 Tail; }; $range i 2..n $for i [[ $range j 1..i $range k 2..i template <$for j, [[typename T$j]]> struct Types$i { typedef T1 Head; typedef Types$(i-1)<$for k, [[T$k]]> Tail; }; ]] } // namespace internal // We don't want to require the users to write TypesN<...> directly, // as that would require them to count the length. Types<...> is much // easier to write, but generates horrible messages when there is a // compiler error, as gcc insists on printing out each template // argument, even if it has the default value (this means Types // will appear as Types in the compiler // errors). // // Our solution is to combine the best part of the two approaches: a // user would write Types, and Google Test will translate // that to TypesN internally to make error messages // readable. The translation is done by the 'type' member of the // Types template. $range i 1..n template <$for i, [[typename T$i = internal::None]]> struct Types { typedef internal::Types$n<$for i, [[T$i]]> type; }; template <> struct Types<$for i, [[internal::None]]> { typedef internal::Types0 type; }; $range i 1..n-1 $for i [[ $range j 1..i $range k i+1..n template <$for j, [[typename T$j]]> struct Types<$for j, [[T$j]]$for k[[, internal::None]]> { typedef internal::Types$i<$for j, [[T$j]]> type; }; ]] namespace internal { # define GTEST_TEMPLATE_ template class // The template "selector" struct TemplateSel is used to // represent Tmpl, which must be a class template with one type // parameter, as a type. TemplateSel::Bind::type is defined // as the type Tmpl. This allows us to actually instantiate the // template "selected" by TemplateSel. // // This trick is necessary for simulating typedef for class templates, // which C++ doesn't support directly. template struct TemplateSel { template struct Bind { typedef Tmpl type; }; }; # define GTEST_BIND_(TmplSel, T) \ TmplSel::template Bind::type // A unique struct template used as the default value for the // arguments of class template Templates. This allows us to simulate // variadic templates (e.g. Templates, Templates, // and etc), which C++ doesn't support directly. template struct NoneT {}; // The following family of struct and struct templates are used to // represent template lists. In particular, TemplatesN represents a list of N templates (T1, T2, ..., and TN). Except // for Templates0, every struct in the family has two member types: // Head for the selector of the first template in the list, and Tail // for the rest of the list. // The empty template list. struct Templates0 {}; // Template lists of length 1, 2, 3, and so on. template struct Templates1 { typedef TemplateSel Head; typedef Templates0 Tail; }; $range i 2..n $for i [[ $range j 1..i $range k 2..i template <$for j, [[GTEST_TEMPLATE_ T$j]]> struct Templates$i { typedef TemplateSel Head; typedef Templates$(i-1)<$for k, [[T$k]]> Tail; }; ]] // We don't want to require the users to write TemplatesN<...> directly, // as that would require them to count the length. Templates<...> is much // easier to write, but generates horrible messages when there is a // compiler error, as gcc insists on printing out each template // argument, even if it has the default value (this means Templates // will appear as Templates in the compiler // errors). // // Our solution is to combine the best part of the two approaches: a // user would write Templates, and Google Test will translate // that to TemplatesN internally to make error messages // readable. The translation is done by the 'type' member of the // Templates template. $range i 1..n template <$for i, [[GTEST_TEMPLATE_ T$i = NoneT]]> struct Templates { typedef Templates$n<$for i, [[T$i]]> type; }; template <> struct Templates<$for i, [[NoneT]]> { typedef Templates0 type; }; $range i 1..n-1 $for i [[ $range j 1..i $range k i+1..n template <$for j, [[GTEST_TEMPLATE_ T$j]]> struct Templates<$for j, [[T$j]]$for k[[, NoneT]]> { typedef Templates$i<$for j, [[T$j]]> type; }; ]] // The TypeList template makes it possible to use either a single type // or a Types<...> list in TYPED_TEST_CASE() and // INSTANTIATE_TYPED_TEST_CASE_P(). template struct TypeList { typedef Types1 type; }; $range i 1..n template <$for i, [[typename T$i]]> struct TypeList > { typedef typename Types<$for i, [[T$i]]>::type type; }; #endif // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P } // namespace internal } // namespace testing #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_ iptux-0.9.4/src/googletest/src/000077500000000000000000000000001475473122500164415ustar00rootroot00000000000000iptux-0.9.4/src/googletest/src/gtest-all.cc000066400000000000000000000041171475473122500206470ustar00rootroot00000000000000// Copyright 2008, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // Google C++ Testing and Mocking Framework (Google Test) // // Sometimes it's desirable to build Google Test by compiling a single file. // This file serves this purpose. // This line ensures that gtest.h can be compiled on its own, even // when it's fused. #include "gtest/gtest.h" // The following lines pull in the real gtest *.cc files. #include "src/gtest.cc" #include "src/gtest-death-test.cc" #include "src/gtest-filepath.cc" #include "src/gtest-port.cc" #include "src/gtest-printers.cc" #include "src/gtest-test-part.cc" #include "src/gtest-typed-test.cc" iptux-0.9.4/src/googletest/src/gtest-death-test.cc000066400000000000000000001624101475473122500221420ustar00rootroot00000000000000// Copyright 2005, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // This file implements death tests. #include "gtest/gtest-death-test.h" #include "gtest/internal/gtest-port.h" #include "gtest/internal/custom/gtest.h" #if GTEST_HAS_DEATH_TEST # if GTEST_OS_MAC # include # endif // GTEST_OS_MAC # include # include # include # if GTEST_OS_LINUX # include # endif // GTEST_OS_LINUX # include # if GTEST_OS_WINDOWS # include # else # include # include # endif // GTEST_OS_WINDOWS # if GTEST_OS_QNX # include # endif // GTEST_OS_QNX # if GTEST_OS_FUCHSIA # include # include # include # include # include # endif // GTEST_OS_FUCHSIA #endif // GTEST_HAS_DEATH_TEST #include "gtest/gtest-message.h" #include "gtest/internal/gtest-string.h" #include "src/gtest-internal-inl.h" namespace testing { // Constants. // The default death test style. // // This is defined in internal/gtest-port.h as "fast", but can be overridden by // a definition in internal/custom/gtest-port.h. The recommended value, which is // used internally at Google, is "threadsafe". static const char kDefaultDeathTestStyle[] = GTEST_DEFAULT_DEATH_TEST_STYLE; GTEST_DEFINE_string_( death_test_style, internal::StringFromGTestEnv("death_test_style", kDefaultDeathTestStyle), "Indicates how to run a death test in a forked child process: " "\"threadsafe\" (child process re-executes the test binary " "from the beginning, running only the specific death test) or " "\"fast\" (child process runs the death test immediately " "after forking)."); GTEST_DEFINE_bool_( death_test_use_fork, internal::BoolFromGTestEnv("death_test_use_fork", false), "Instructs to use fork()/_exit() instead of clone() in death tests. " "Ignored and always uses fork() on POSIX systems where clone() is not " "implemented. Useful when running under valgrind or similar tools if " "those do not support clone(). Valgrind 3.3.1 will just fail if " "it sees an unsupported combination of clone() flags. " "It is not recommended to use this flag w/o valgrind though it will " "work in 99% of the cases. Once valgrind is fixed, this flag will " "most likely be removed."); namespace internal { GTEST_DEFINE_string_( internal_run_death_test, "", "Indicates the file, line number, temporal index of " "the single death test to run, and a file descriptor to " "which a success code may be sent, all separated by " "the '|' characters. This flag is specified if and only if the current " "process is a sub-process launched for running a thread-safe " "death test. FOR INTERNAL USE ONLY."); } // namespace internal #if GTEST_HAS_DEATH_TEST namespace internal { // Valid only for fast death tests. Indicates the code is running in the // child process of a fast style death test. # if !GTEST_OS_WINDOWS && !GTEST_OS_FUCHSIA static bool g_in_fast_death_test_child = false; # endif // Returns a Boolean value indicating whether the caller is currently // executing in the context of the death test child process. Tools such as // Valgrind heap checkers may need this to modify their behavior in death // tests. IMPORTANT: This is an internal utility. Using it may break the // implementation of death tests. User code MUST NOT use it. bool InDeathTestChild() { # if GTEST_OS_WINDOWS || GTEST_OS_FUCHSIA // On Windows and Fuchsia, death tests are thread-safe regardless of the value // of the death_test_style flag. return !GTEST_FLAG(internal_run_death_test).empty(); # else if (GTEST_FLAG(death_test_style) == "threadsafe") return !GTEST_FLAG(internal_run_death_test).empty(); else return g_in_fast_death_test_child; #endif } } // namespace internal // ExitedWithCode constructor. ExitedWithCode::ExitedWithCode(int exit_code) : exit_code_(exit_code) { } // ExitedWithCode function-call operator. bool ExitedWithCode::operator()(int exit_status) const { # if GTEST_OS_WINDOWS || GTEST_OS_FUCHSIA return exit_status == exit_code_; # else return WIFEXITED(exit_status) && WEXITSTATUS(exit_status) == exit_code_; # endif // GTEST_OS_WINDOWS || GTEST_OS_FUCHSIA } # if !GTEST_OS_WINDOWS && !GTEST_OS_FUCHSIA // KilledBySignal constructor. KilledBySignal::KilledBySignal(int signum) : signum_(signum) { } // KilledBySignal function-call operator. bool KilledBySignal::operator()(int exit_status) const { # if defined(GTEST_KILLED_BY_SIGNAL_OVERRIDE_) { bool result; if (GTEST_KILLED_BY_SIGNAL_OVERRIDE_(signum_, exit_status, &result)) { return result; } } # endif // defined(GTEST_KILLED_BY_SIGNAL_OVERRIDE_) return WIFSIGNALED(exit_status) && WTERMSIG(exit_status) == signum_; } # endif // !GTEST_OS_WINDOWS && !GTEST_OS_FUCHSIA namespace internal { // Utilities needed for death tests. // Generates a textual description of a given exit code, in the format // specified by wait(2). static std::string ExitSummary(int exit_code) { Message m; # if GTEST_OS_WINDOWS || GTEST_OS_FUCHSIA m << "Exited with exit status " << exit_code; # else if (WIFEXITED(exit_code)) { m << "Exited with exit status " << WEXITSTATUS(exit_code); } else if (WIFSIGNALED(exit_code)) { m << "Terminated by signal " << WTERMSIG(exit_code); } # ifdef WCOREDUMP if (WCOREDUMP(exit_code)) { m << " (core dumped)"; } # endif # endif // GTEST_OS_WINDOWS || GTEST_OS_FUCHSIA return m.GetString(); } // Returns true if exit_status describes a process that was terminated // by a signal, or exited normally with a nonzero exit code. bool ExitedUnsuccessfully(int exit_status) { return !ExitedWithCode(0)(exit_status); } # if !GTEST_OS_WINDOWS && !GTEST_OS_FUCHSIA // Generates a textual failure message when a death test finds more than // one thread running, or cannot determine the number of threads, prior // to executing the given statement. It is the responsibility of the // caller not to pass a thread_count of 1. static std::string DeathTestThreadWarning(size_t thread_count) { Message msg; msg << "Death tests use fork(), which is unsafe particularly" << " in a threaded context. For this test, " << GTEST_NAME_ << " "; if (thread_count == 0) { msg << "couldn't detect the number of threads."; } else { msg << "detected " << thread_count << " threads."; } msg << " See " "https://github.com/google/googletest/blob/master/googletest/docs/" "advanced.md#death-tests-and-threads" << " for more explanation and suggested solutions, especially if" << " this is the last message you see before your test times out."; return msg.GetString(); } # endif // !GTEST_OS_WINDOWS && !GTEST_OS_FUCHSIA // Flag characters for reporting a death test that did not die. static const char kDeathTestLived = 'L'; static const char kDeathTestReturned = 'R'; static const char kDeathTestThrew = 'T'; static const char kDeathTestInternalError = 'I'; #if GTEST_OS_FUCHSIA // File descriptor used for the pipe in the child process. static const int kFuchsiaReadPipeFd = 3; #endif // An enumeration describing all of the possible ways that a death test can // conclude. DIED means that the process died while executing the test // code; LIVED means that process lived beyond the end of the test code; // RETURNED means that the test statement attempted to execute a return // statement, which is not allowed; THREW means that the test statement // returned control by throwing an exception. IN_PROGRESS means the test // has not yet concluded. // FIXME: Unify names and possibly values for // AbortReason, DeathTestOutcome, and flag characters above. enum DeathTestOutcome { IN_PROGRESS, DIED, LIVED, RETURNED, THREW }; // Routine for aborting the program which is safe to call from an // exec-style death test child process, in which case the error // message is propagated back to the parent process. Otherwise, the // message is simply printed to stderr. In either case, the program // then exits with status 1. static void DeathTestAbort(const std::string& message) { // On a POSIX system, this function may be called from a threadsafe-style // death test child process, which operates on a very small stack. Use // the heap for any additional non-minuscule memory requirements. const InternalRunDeathTestFlag* const flag = GetUnitTestImpl()->internal_run_death_test_flag(); if (flag != NULL) { FILE* parent = posix::FDOpen(flag->write_fd(), "w"); fputc(kDeathTestInternalError, parent); fprintf(parent, "%s", message.c_str()); fflush(parent); _exit(1); } else { fprintf(stderr, "%s", message.c_str()); fflush(stderr); posix::Abort(); } } // A replacement for CHECK that calls DeathTestAbort if the assertion // fails. # define GTEST_DEATH_TEST_CHECK_(expression) \ do { \ if (!::testing::internal::IsTrue(expression)) { \ DeathTestAbort( \ ::std::string("CHECK failed: File ") + __FILE__ + ", line " \ + ::testing::internal::StreamableToString(__LINE__) + ": " \ + #expression); \ } \ } while (::testing::internal::AlwaysFalse()) // This macro is similar to GTEST_DEATH_TEST_CHECK_, but it is meant for // evaluating any system call that fulfills two conditions: it must return // -1 on failure, and set errno to EINTR when it is interrupted and // should be tried again. The macro expands to a loop that repeatedly // evaluates the expression as long as it evaluates to -1 and sets // errno to EINTR. If the expression evaluates to -1 but errno is // something other than EINTR, DeathTestAbort is called. # define GTEST_DEATH_TEST_CHECK_SYSCALL_(expression) \ do { \ int gtest_retval; \ do { \ gtest_retval = (expression); \ } while (gtest_retval == -1 && errno == EINTR); \ if (gtest_retval == -1) { \ DeathTestAbort( \ ::std::string("CHECK failed: File ") + __FILE__ + ", line " \ + ::testing::internal::StreamableToString(__LINE__) + ": " \ + #expression + " != -1"); \ } \ } while (::testing::internal::AlwaysFalse()) // Returns the message describing the last system error in errno. std::string GetLastErrnoDescription() { return errno == 0 ? "" : posix::StrError(errno); } // This is called from a death test parent process to read a failure // message from the death test child process and log it with the FATAL // severity. On Windows, the message is read from a pipe handle. On other // platforms, it is read from a file descriptor. static void FailFromInternalError(int fd) { Message error; char buffer[256]; int num_read; do { while ((num_read = posix::Read(fd, buffer, 255)) > 0) { buffer[num_read] = '\0'; error << buffer; } } while (num_read == -1 && errno == EINTR); if (num_read == 0) { GTEST_LOG_(FATAL) << error.GetString(); } else { const int last_error = errno; GTEST_LOG_(FATAL) << "Error while reading death test internal: " << GetLastErrnoDescription() << " [" << last_error << "]"; } } // Death test constructor. Increments the running death test count // for the current test. DeathTest::DeathTest() { TestInfo* const info = GetUnitTestImpl()->current_test_info(); if (info == NULL) { DeathTestAbort("Cannot run a death test outside of a TEST or " "TEST_F construct"); } } // Creates and returns a death test by dispatching to the current // death test factory. bool DeathTest::Create(const char* statement, const RE* regex, const char* file, int line, DeathTest** test) { return GetUnitTestImpl()->death_test_factory()->Create( statement, regex, file, line, test); } const char* DeathTest::LastMessage() { return last_death_test_message_.c_str(); } void DeathTest::set_last_death_test_message(const std::string& message) { last_death_test_message_ = message; } std::string DeathTest::last_death_test_message_; // Provides cross platform implementation for some death functionality. class DeathTestImpl : public DeathTest { protected: DeathTestImpl(const char* a_statement, const RE* a_regex) : statement_(a_statement), regex_(a_regex), spawned_(false), status_(-1), outcome_(IN_PROGRESS), read_fd_(-1), write_fd_(-1) {} // read_fd_ is expected to be closed and cleared by a derived class. ~DeathTestImpl() { GTEST_DEATH_TEST_CHECK_(read_fd_ == -1); } void Abort(AbortReason reason); virtual bool Passed(bool status_ok); const char* statement() const { return statement_; } const RE* regex() const { return regex_; } bool spawned() const { return spawned_; } void set_spawned(bool is_spawned) { spawned_ = is_spawned; } int status() const { return status_; } void set_status(int a_status) { status_ = a_status; } DeathTestOutcome outcome() const { return outcome_; } void set_outcome(DeathTestOutcome an_outcome) { outcome_ = an_outcome; } int read_fd() const { return read_fd_; } void set_read_fd(int fd) { read_fd_ = fd; } int write_fd() const { return write_fd_; } void set_write_fd(int fd) { write_fd_ = fd; } // Called in the parent process only. Reads the result code of the death // test child process via a pipe, interprets it to set the outcome_ // member, and closes read_fd_. Outputs diagnostics and terminates in // case of unexpected codes. void ReadAndInterpretStatusByte(); private: // The textual content of the code this object is testing. This class // doesn't own this string and should not attempt to delete it. const char* const statement_; // The regular expression which test output must match. DeathTestImpl // doesn't own this object and should not attempt to delete it. const RE* const regex_; // True if the death test child process has been successfully spawned. bool spawned_; // The exit status of the child process. int status_; // How the death test concluded. DeathTestOutcome outcome_; // Descriptor to the read end of the pipe to the child process. It is // always -1 in the child process. The child keeps its write end of the // pipe in write_fd_. int read_fd_; // Descriptor to the child's write end of the pipe to the parent process. // It is always -1 in the parent process. The parent keeps its end of the // pipe in read_fd_. int write_fd_; }; // Called in the parent process only. Reads the result code of the death // test child process via a pipe, interprets it to set the outcome_ // member, and closes read_fd_. Outputs diagnostics and terminates in // case of unexpected codes. void DeathTestImpl::ReadAndInterpretStatusByte() { char flag; int bytes_read; // The read() here blocks until data is available (signifying the // failure of the death test) or until the pipe is closed (signifying // its success), so it's okay to call this in the parent before // the child process has exited. do { bytes_read = posix::Read(read_fd(), &flag, 1); } while (bytes_read == -1 && errno == EINTR); if (bytes_read == 0) { set_outcome(DIED); } else if (bytes_read == 1) { switch (flag) { case kDeathTestReturned: set_outcome(RETURNED); break; case kDeathTestThrew: set_outcome(THREW); break; case kDeathTestLived: set_outcome(LIVED); break; case kDeathTestInternalError: FailFromInternalError(read_fd()); // Does not return. break; default: GTEST_LOG_(FATAL) << "Death test child process reported " << "unexpected status byte (" << static_cast(flag) << ")"; } } else { GTEST_LOG_(FATAL) << "Read from death test child process failed: " << GetLastErrnoDescription(); } GTEST_DEATH_TEST_CHECK_SYSCALL_(posix::Close(read_fd())); set_read_fd(-1); } // Signals that the death test code which should have exited, didn't. // Should be called only in a death test child process. // Writes a status byte to the child's status file descriptor, then // calls _exit(1). void DeathTestImpl::Abort(AbortReason reason) { // The parent process considers the death test to be a failure if // it finds any data in our pipe. So, here we write a single flag byte // to the pipe, then exit. const char status_ch = reason == TEST_DID_NOT_DIE ? kDeathTestLived : reason == TEST_THREW_EXCEPTION ? kDeathTestThrew : kDeathTestReturned; GTEST_DEATH_TEST_CHECK_SYSCALL_(posix::Write(write_fd(), &status_ch, 1)); // We are leaking the descriptor here because on some platforms (i.e., // when built as Windows DLL), destructors of global objects will still // run after calling _exit(). On such systems, write_fd_ will be // indirectly closed from the destructor of UnitTestImpl, causing double // close if it is also closed here. On debug configurations, double close // may assert. As there are no in-process buffers to flush here, we are // relying on the OS to close the descriptor after the process terminates // when the destructors are not run. _exit(1); // Exits w/o any normal exit hooks (we were supposed to crash) } // Returns an indented copy of stderr output for a death test. // This makes distinguishing death test output lines from regular log lines // much easier. static ::std::string FormatDeathTestOutput(const ::std::string& output) { ::std::string ret; for (size_t at = 0; ; ) { const size_t line_end = output.find('\n', at); ret += "[ DEATH ] "; if (line_end == ::std::string::npos) { ret += output.substr(at); break; } ret += output.substr(at, line_end + 1 - at); at = line_end + 1; } return ret; } // Assesses the success or failure of a death test, using both private // members which have previously been set, and one argument: // // Private data members: // outcome: An enumeration describing how the death test // concluded: DIED, LIVED, THREW, or RETURNED. The death test // fails in the latter three cases. // status: The exit status of the child process. On *nix, it is in the // in the format specified by wait(2). On Windows, this is the // value supplied to the ExitProcess() API or a numeric code // of the exception that terminated the program. // regex: A regular expression object to be applied to // the test's captured standard error output; the death test // fails if it does not match. // // Argument: // status_ok: true if exit_status is acceptable in the context of // this particular death test, which fails if it is false // // Returns true iff all of the above conditions are met. Otherwise, the // first failing condition, in the order given above, is the one that is // reported. Also sets the last death test message string. bool DeathTestImpl::Passed(bool status_ok) { if (!spawned()) return false; const std::string error_message = GetCapturedStderr(); bool success = false; Message buffer; buffer << "Death test: " << statement() << "\n"; switch (outcome()) { case LIVED: buffer << " Result: failed to die.\n" << " Error msg:\n" << FormatDeathTestOutput(error_message); break; case THREW: buffer << " Result: threw an exception.\n" << " Error msg:\n" << FormatDeathTestOutput(error_message); break; case RETURNED: buffer << " Result: illegal return in test statement.\n" << " Error msg:\n" << FormatDeathTestOutput(error_message); break; case DIED: if (status_ok) { # if GTEST_USES_PCRE // PCRE regexes support embedded NULs. const bool matched = RE::PartialMatch(error_message, *regex()); # else const bool matched = RE::PartialMatch(error_message.c_str(), *regex()); # endif // GTEST_USES_PCRE if (matched) { success = true; } else { buffer << " Result: died but not with expected error.\n" << " Expected: " << regex()->pattern() << "\n" << "Actual msg:\n" << FormatDeathTestOutput(error_message); } } else { buffer << " Result: died but not with expected exit code:\n" << " " << ExitSummary(status()) << "\n" << "Actual msg:\n" << FormatDeathTestOutput(error_message); } break; case IN_PROGRESS: default: GTEST_LOG_(FATAL) << "DeathTest::Passed somehow called before conclusion of test"; } DeathTest::set_last_death_test_message(buffer.GetString()); return success; } # if GTEST_OS_WINDOWS // WindowsDeathTest implements death tests on Windows. Due to the // specifics of starting new processes on Windows, death tests there are // always threadsafe, and Google Test considers the // --gtest_death_test_style=fast setting to be equivalent to // --gtest_death_test_style=threadsafe there. // // A few implementation notes: Like the Linux version, the Windows // implementation uses pipes for child-to-parent communication. But due to // the specifics of pipes on Windows, some extra steps are required: // // 1. The parent creates a communication pipe and stores handles to both // ends of it. // 2. The parent starts the child and provides it with the information // necessary to acquire the handle to the write end of the pipe. // 3. The child acquires the write end of the pipe and signals the parent // using a Windows event. // 4. Now the parent can release the write end of the pipe on its side. If // this is done before step 3, the object's reference count goes down to // 0 and it is destroyed, preventing the child from acquiring it. The // parent now has to release it, or read operations on the read end of // the pipe will not return when the child terminates. // 5. The parent reads child's output through the pipe (outcome code and // any possible error messages) from the pipe, and its stderr and then // determines whether to fail the test. // // Note: to distinguish Win32 API calls from the local method and function // calls, the former are explicitly resolved in the global namespace. // class WindowsDeathTest : public DeathTestImpl { public: WindowsDeathTest(const char* a_statement, const RE* a_regex, const char* file, int line) : DeathTestImpl(a_statement, a_regex), file_(file), line_(line) {} // All of these virtual functions are inherited from DeathTest. virtual int Wait(); virtual TestRole AssumeRole(); private: // The name of the file in which the death test is located. const char* const file_; // The line number on which the death test is located. const int line_; // Handle to the write end of the pipe to the child process. AutoHandle write_handle_; // Child process handle. AutoHandle child_handle_; // Event the child process uses to signal the parent that it has // acquired the handle to the write end of the pipe. After seeing this // event the parent can release its own handles to make sure its // ReadFile() calls return when the child terminates. AutoHandle event_handle_; }; // Waits for the child in a death test to exit, returning its exit // status, or 0 if no child process exists. As a side effect, sets the // outcome data member. int WindowsDeathTest::Wait() { if (!spawned()) return 0; // Wait until the child either signals that it has acquired the write end // of the pipe or it dies. const HANDLE wait_handles[2] = { child_handle_.Get(), event_handle_.Get() }; switch (::WaitForMultipleObjects(2, wait_handles, FALSE, // Waits for any of the handles. INFINITE)) { case WAIT_OBJECT_0: case WAIT_OBJECT_0 + 1: break; default: GTEST_DEATH_TEST_CHECK_(false); // Should not get here. } // The child has acquired the write end of the pipe or exited. // We release the handle on our side and continue. write_handle_.Reset(); event_handle_.Reset(); ReadAndInterpretStatusByte(); // Waits for the child process to exit if it haven't already. This // returns immediately if the child has already exited, regardless of // whether previous calls to WaitForMultipleObjects synchronized on this // handle or not. GTEST_DEATH_TEST_CHECK_( WAIT_OBJECT_0 == ::WaitForSingleObject(child_handle_.Get(), INFINITE)); DWORD status_code; GTEST_DEATH_TEST_CHECK_( ::GetExitCodeProcess(child_handle_.Get(), &status_code) != FALSE); child_handle_.Reset(); set_status(static_cast(status_code)); return status(); } // The AssumeRole process for a Windows death test. It creates a child // process with the same executable as the current process to run the // death test. The child process is given the --gtest_filter and // --gtest_internal_run_death_test flags such that it knows to run the // current death test only. DeathTest::TestRole WindowsDeathTest::AssumeRole() { const UnitTestImpl* const impl = GetUnitTestImpl(); const InternalRunDeathTestFlag* const flag = impl->internal_run_death_test_flag(); const TestInfo* const info = impl->current_test_info(); const int death_test_index = info->result()->death_test_count(); if (flag != NULL) { // ParseInternalRunDeathTestFlag() has performed all the necessary // processing. set_write_fd(flag->write_fd()); return EXECUTE_TEST; } // WindowsDeathTest uses an anonymous pipe to communicate results of // a death test. SECURITY_ATTRIBUTES handles_are_inheritable = { sizeof(SECURITY_ATTRIBUTES), NULL, TRUE }; HANDLE read_handle, write_handle; GTEST_DEATH_TEST_CHECK_( ::CreatePipe(&read_handle, &write_handle, &handles_are_inheritable, 0) // Default buffer size. != FALSE); set_read_fd(::_open_osfhandle(reinterpret_cast(read_handle), O_RDONLY)); write_handle_.Reset(write_handle); event_handle_.Reset(::CreateEvent( &handles_are_inheritable, TRUE, // The event will automatically reset to non-signaled state. FALSE, // The initial state is non-signalled. NULL)); // The even is unnamed. GTEST_DEATH_TEST_CHECK_(event_handle_.Get() != NULL); const std::string filter_flag = std::string("--") + GTEST_FLAG_PREFIX_ + kFilterFlag + "=" + info->test_case_name() + "." + info->name(); const std::string internal_flag = std::string("--") + GTEST_FLAG_PREFIX_ + kInternalRunDeathTestFlag + "=" + file_ + "|" + StreamableToString(line_) + "|" + StreamableToString(death_test_index) + "|" + StreamableToString(static_cast(::GetCurrentProcessId())) + // size_t has the same width as pointers on both 32-bit and 64-bit // Windows platforms. // See http://msdn.microsoft.com/en-us/library/tcxf1dw6.aspx. "|" + StreamableToString(reinterpret_cast(write_handle)) + "|" + StreamableToString(reinterpret_cast(event_handle_.Get())); char executable_path[_MAX_PATH + 1]; // NOLINT GTEST_DEATH_TEST_CHECK_( _MAX_PATH + 1 != ::GetModuleFileNameA(NULL, executable_path, _MAX_PATH)); std::string command_line = std::string(::GetCommandLineA()) + " " + filter_flag + " \"" + internal_flag + "\""; DeathTest::set_last_death_test_message(""); CaptureStderr(); // Flush the log buffers since the log streams are shared with the child. FlushInfoLog(); // The child process will share the standard handles with the parent. STARTUPINFOA startup_info; memset(&startup_info, 0, sizeof(STARTUPINFO)); startup_info.dwFlags = STARTF_USESTDHANDLES; startup_info.hStdInput = ::GetStdHandle(STD_INPUT_HANDLE); startup_info.hStdOutput = ::GetStdHandle(STD_OUTPUT_HANDLE); startup_info.hStdError = ::GetStdHandle(STD_ERROR_HANDLE); PROCESS_INFORMATION process_info; GTEST_DEATH_TEST_CHECK_(::CreateProcessA( executable_path, const_cast(command_line.c_str()), NULL, // Retuned process handle is not inheritable. NULL, // Retuned thread handle is not inheritable. TRUE, // Child inherits all inheritable handles (for write_handle_). 0x0, // Default creation flags. NULL, // Inherit the parent's environment. UnitTest::GetInstance()->original_working_dir(), &startup_info, &process_info) != FALSE); child_handle_.Reset(process_info.hProcess); ::CloseHandle(process_info.hThread); set_spawned(true); return OVERSEE_TEST; } # elif GTEST_OS_FUCHSIA class FuchsiaDeathTest : public DeathTestImpl { public: FuchsiaDeathTest(const char* a_statement, const RE* a_regex, const char* file, int line) : DeathTestImpl(a_statement, a_regex), file_(file), line_(line) {} virtual ~FuchsiaDeathTest() { zx_status_t status = zx_handle_close(child_process_); GTEST_DEATH_TEST_CHECK_(status == ZX_OK); status = zx_handle_close(port_); GTEST_DEATH_TEST_CHECK_(status == ZX_OK); } // All of these virtual functions are inherited from DeathTest. virtual int Wait(); virtual TestRole AssumeRole(); private: // The name of the file in which the death test is located. const char* const file_; // The line number on which the death test is located. const int line_; zx_handle_t child_process_ = ZX_HANDLE_INVALID; zx_handle_t port_ = ZX_HANDLE_INVALID; }; // Utility class for accumulating command-line arguments. class Arguments { public: Arguments() { args_.push_back(NULL); } ~Arguments() { for (std::vector::iterator i = args_.begin(); i != args_.end(); ++i) { free(*i); } } void AddArgument(const char* argument) { args_.insert(args_.end() - 1, posix::StrDup(argument)); } template void AddArguments(const ::std::vector& arguments) { for (typename ::std::vector::const_iterator i = arguments.begin(); i != arguments.end(); ++i) { args_.insert(args_.end() - 1, posix::StrDup(i->c_str())); } } char* const* Argv() { return &args_[0]; } int size() { return args_.size() - 1; } private: std::vector args_; }; // Waits for the child in a death test to exit, returning its exit // status, or 0 if no child process exists. As a side effect, sets the // outcome data member. int FuchsiaDeathTest::Wait() { if (!spawned()) return 0; // Register to wait for the child process to terminate. zx_status_t status_zx; status_zx = zx_object_wait_async(child_process_, port_, 0 /* key */, ZX_PROCESS_TERMINATED, ZX_WAIT_ASYNC_ONCE); GTEST_DEATH_TEST_CHECK_(status_zx == ZX_OK); // Wait for it to terminate, or an exception to be received. zx_port_packet_t packet; status_zx = zx_port_wait(port_, ZX_TIME_INFINITE, &packet); GTEST_DEATH_TEST_CHECK_(status_zx == ZX_OK); if (ZX_PKT_IS_EXCEPTION(packet.type)) { // Process encountered an exception. Kill it directly rather than letting // other handlers process the event. status_zx = zx_task_kill(child_process_); GTEST_DEATH_TEST_CHECK_(status_zx == ZX_OK); // Now wait for |child_process_| to terminate. zx_signals_t signals = 0; status_zx = zx_object_wait_one( child_process_, ZX_PROCESS_TERMINATED, ZX_TIME_INFINITE, &signals); GTEST_DEATH_TEST_CHECK_(status_zx == ZX_OK); GTEST_DEATH_TEST_CHECK_(signals & ZX_PROCESS_TERMINATED); } else { // Process terminated. GTEST_DEATH_TEST_CHECK_(ZX_PKT_IS_SIGNAL_ONE(packet.type)); GTEST_DEATH_TEST_CHECK_(packet.signal.observed & ZX_PROCESS_TERMINATED); } ReadAndInterpretStatusByte(); zx_info_process_t buffer; status_zx = zx_object_get_info( child_process_, ZX_INFO_PROCESS, &buffer, sizeof(buffer), nullptr, nullptr); GTEST_DEATH_TEST_CHECK_(status_zx == ZX_OK); GTEST_DEATH_TEST_CHECK_(buffer.exited); set_status(buffer.return_code); return status(); } // The AssumeRole process for a Fuchsia death test. It creates a child // process with the same executable as the current process to run the // death test. The child process is given the --gtest_filter and // --gtest_internal_run_death_test flags such that it knows to run the // current death test only. DeathTest::TestRole FuchsiaDeathTest::AssumeRole() { const UnitTestImpl* const impl = GetUnitTestImpl(); const InternalRunDeathTestFlag* const flag = impl->internal_run_death_test_flag(); const TestInfo* const info = impl->current_test_info(); const int death_test_index = info->result()->death_test_count(); if (flag != NULL) { // ParseInternalRunDeathTestFlag() has performed all the necessary // processing. set_write_fd(kFuchsiaReadPipeFd); return EXECUTE_TEST; } CaptureStderr(); // Flush the log buffers since the log streams are shared with the child. FlushInfoLog(); // Build the child process command line. const std::string filter_flag = std::string("--") + GTEST_FLAG_PREFIX_ + kFilterFlag + "=" + info->test_case_name() + "." + info->name(); const std::string internal_flag = std::string("--") + GTEST_FLAG_PREFIX_ + kInternalRunDeathTestFlag + "=" + file_ + "|" + StreamableToString(line_) + "|" + StreamableToString(death_test_index); Arguments args; args.AddArguments(GetInjectableArgvs()); args.AddArgument(filter_flag.c_str()); args.AddArgument(internal_flag.c_str()); // Build the pipe for communication with the child. zx_status_t status; zx_handle_t child_pipe_handle; uint32_t type; status = fdio_pipe_half(&child_pipe_handle, &type); GTEST_DEATH_TEST_CHECK_(status >= 0); set_read_fd(status); // Set the pipe handle for the child. fdio_spawn_action_t add_handle_action = {}; add_handle_action.action = FDIO_SPAWN_ACTION_ADD_HANDLE; add_handle_action.h.id = PA_HND(type, kFuchsiaReadPipeFd); add_handle_action.h.handle = child_pipe_handle; // Spawn the child process. status = fdio_spawn_etc(ZX_HANDLE_INVALID, FDIO_SPAWN_CLONE_ALL, args.Argv()[0], args.Argv(), nullptr, 1, &add_handle_action, &child_process_, nullptr); GTEST_DEATH_TEST_CHECK_(status == ZX_OK); // Create an exception port and attach it to the |child_process_|, to allow // us to suppress the system default exception handler from firing. status = zx_port_create(0, &port_); GTEST_DEATH_TEST_CHECK_(status == ZX_OK); status = zx_task_bind_exception_port( child_process_, port_, 0 /* key */, 0 /*options */); GTEST_DEATH_TEST_CHECK_(status == ZX_OK); set_spawned(true); return OVERSEE_TEST; } #else // We are neither on Windows, nor on Fuchsia. // ForkingDeathTest provides implementations for most of the abstract // methods of the DeathTest interface. Only the AssumeRole method is // left undefined. class ForkingDeathTest : public DeathTestImpl { public: ForkingDeathTest(const char* statement, const RE* regex); // All of these virtual functions are inherited from DeathTest. virtual int Wait(); protected: void set_child_pid(pid_t child_pid) { child_pid_ = child_pid; } private: // PID of child process during death test; 0 in the child process itself. pid_t child_pid_; }; // Constructs a ForkingDeathTest. ForkingDeathTest::ForkingDeathTest(const char* a_statement, const RE* a_regex) : DeathTestImpl(a_statement, a_regex), child_pid_(-1) {} // Waits for the child in a death test to exit, returning its exit // status, or 0 if no child process exists. As a side effect, sets the // outcome data member. int ForkingDeathTest::Wait() { if (!spawned()) return 0; ReadAndInterpretStatusByte(); int status_value; GTEST_DEATH_TEST_CHECK_SYSCALL_(waitpid(child_pid_, &status_value, 0)); set_status(status_value); return status_value; } // A concrete death test class that forks, then immediately runs the test // in the child process. class NoExecDeathTest : public ForkingDeathTest { public: NoExecDeathTest(const char* a_statement, const RE* a_regex) : ForkingDeathTest(a_statement, a_regex) { } virtual TestRole AssumeRole(); }; // The AssumeRole process for a fork-and-run death test. It implements a // straightforward fork, with a simple pipe to transmit the status byte. DeathTest::TestRole NoExecDeathTest::AssumeRole() { const size_t thread_count = GetThreadCount(); if (thread_count != 1) { GTEST_LOG_(WARNING) << DeathTestThreadWarning(thread_count); } int pipe_fd[2]; GTEST_DEATH_TEST_CHECK_(pipe(pipe_fd) != -1); DeathTest::set_last_death_test_message(""); CaptureStderr(); // When we fork the process below, the log file buffers are copied, but the // file descriptors are shared. We flush all log files here so that closing // the file descriptors in the child process doesn't throw off the // synchronization between descriptors and buffers in the parent process. // This is as close to the fork as possible to avoid a race condition in case // there are multiple threads running before the death test, and another // thread writes to the log file. FlushInfoLog(); const pid_t child_pid = fork(); GTEST_DEATH_TEST_CHECK_(child_pid != -1); set_child_pid(child_pid); if (child_pid == 0) { GTEST_DEATH_TEST_CHECK_SYSCALL_(close(pipe_fd[0])); set_write_fd(pipe_fd[1]); // Redirects all logging to stderr in the child process to prevent // concurrent writes to the log files. We capture stderr in the parent // process and append the child process' output to a log. LogToStderr(); // Event forwarding to the listeners of event listener API mush be shut // down in death test subprocesses. GetUnitTestImpl()->listeners()->SuppressEventForwarding(); g_in_fast_death_test_child = true; return EXECUTE_TEST; } else { GTEST_DEATH_TEST_CHECK_SYSCALL_(close(pipe_fd[1])); set_read_fd(pipe_fd[0]); set_spawned(true); return OVERSEE_TEST; } } // A concrete death test class that forks and re-executes the main // program from the beginning, with command-line flags set that cause // only this specific death test to be run. class ExecDeathTest : public ForkingDeathTest { public: ExecDeathTest(const char* a_statement, const RE* a_regex, const char* file, int line) : ForkingDeathTest(a_statement, a_regex), file_(file), line_(line) { } virtual TestRole AssumeRole(); private: static ::std::vector GetArgvsForDeathTestChildProcess() { ::std::vector args = GetInjectableArgvs(); # if defined(GTEST_EXTRA_DEATH_TEST_COMMAND_LINE_ARGS_) ::std::vector extra_args = GTEST_EXTRA_DEATH_TEST_COMMAND_LINE_ARGS_(); args.insert(args.end(), extra_args.begin(), extra_args.end()); # endif // defined(GTEST_EXTRA_DEATH_TEST_COMMAND_LINE_ARGS_) return args; } // The name of the file in which the death test is located. const char* const file_; // The line number on which the death test is located. const int line_; }; // Utility class for accumulating command-line arguments. class Arguments { public: Arguments() { args_.push_back(NULL); } ~Arguments() { for (std::vector::iterator i = args_.begin(); i != args_.end(); ++i) { free(*i); } } void AddArgument(const char* argument) { args_.insert(args_.end() - 1, posix::StrDup(argument)); } template void AddArguments(const ::std::vector& arguments) { for (typename ::std::vector::const_iterator i = arguments.begin(); i != arguments.end(); ++i) { args_.insert(args_.end() - 1, posix::StrDup(i->c_str())); } } char* const* Argv() { return &args_[0]; } private: std::vector args_; }; // A struct that encompasses the arguments to the child process of a // threadsafe-style death test process. struct ExecDeathTestArgs { char* const* argv; // Command-line arguments for the child's call to exec int close_fd; // File descriptor to close; the read end of a pipe }; # if GTEST_OS_MAC inline char** GetEnviron() { // When Google Test is built as a framework on MacOS X, the environ variable // is unavailable. Apple's documentation (man environ) recommends using // _NSGetEnviron() instead. return *_NSGetEnviron(); } # else // Some POSIX platforms expect you to declare environ. extern "C" makes // it reside in the global namespace. extern "C" char** environ; inline char** GetEnviron() { return environ; } # endif // GTEST_OS_MAC # if !GTEST_OS_QNX // The main function for a threadsafe-style death test child process. // This function is called in a clone()-ed process and thus must avoid // any potentially unsafe operations like malloc or libc functions. static int ExecDeathTestChildMain(void* child_arg) { ExecDeathTestArgs* const args = static_cast(child_arg); GTEST_DEATH_TEST_CHECK_SYSCALL_(close(args->close_fd)); // We need to execute the test program in the same environment where // it was originally invoked. Therefore we change to the original // working directory first. const char* const original_dir = UnitTest::GetInstance()->original_working_dir(); // We can safely call chdir() as it's a direct system call. if (chdir(original_dir) != 0) { DeathTestAbort(std::string("chdir(\"") + original_dir + "\") failed: " + GetLastErrnoDescription()); return EXIT_FAILURE; } // We can safely call execve() as it's a direct system call. We // cannot use execvp() as it's a libc function and thus potentially // unsafe. Since execve() doesn't search the PATH, the user must // invoke the test program via a valid path that contains at least // one path separator. execve(args->argv[0], args->argv, GetEnviron()); DeathTestAbort(std::string("execve(") + args->argv[0] + ", ...) in " + original_dir + " failed: " + GetLastErrnoDescription()); return EXIT_FAILURE; } # endif // !GTEST_OS_QNX # if GTEST_HAS_CLONE // Two utility routines that together determine the direction the stack // grows. // This could be accomplished more elegantly by a single recursive // function, but we want to guard against the unlikely possibility of // a smart compiler optimizing the recursion away. // // GTEST_NO_INLINE_ is required to prevent GCC 4.6 from inlining // StackLowerThanAddress into StackGrowsDown, which then doesn't give // correct answer. static void StackLowerThanAddress(const void* ptr, bool* result) GTEST_NO_INLINE_; static void StackLowerThanAddress(const void* ptr, bool* result) { int dummy; *result = (&dummy < ptr); } // Make sure AddressSanitizer does not tamper with the stack here. GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_ static bool StackGrowsDown() { int dummy; bool result; StackLowerThanAddress(&dummy, &result); return result; } # endif // GTEST_HAS_CLONE // Spawns a child process with the same executable as the current process in // a thread-safe manner and instructs it to run the death test. The // implementation uses fork(2) + exec. On systems where clone(2) is // available, it is used instead, being slightly more thread-safe. On QNX, // fork supports only single-threaded environments, so this function uses // spawn(2) there instead. The function dies with an error message if // anything goes wrong. static pid_t ExecDeathTestSpawnChild(char* const* argv, int close_fd) { ExecDeathTestArgs args = { argv, close_fd }; pid_t child_pid = -1; # if GTEST_OS_QNX // Obtains the current directory and sets it to be closed in the child // process. const int cwd_fd = open(".", O_RDONLY); GTEST_DEATH_TEST_CHECK_(cwd_fd != -1); GTEST_DEATH_TEST_CHECK_SYSCALL_(fcntl(cwd_fd, F_SETFD, FD_CLOEXEC)); // We need to execute the test program in the same environment where // it was originally invoked. Therefore we change to the original // working directory first. const char* const original_dir = UnitTest::GetInstance()->original_working_dir(); // We can safely call chdir() as it's a direct system call. if (chdir(original_dir) != 0) { DeathTestAbort(std::string("chdir(\"") + original_dir + "\") failed: " + GetLastErrnoDescription()); return EXIT_FAILURE; } int fd_flags; // Set close_fd to be closed after spawn. GTEST_DEATH_TEST_CHECK_SYSCALL_(fd_flags = fcntl(close_fd, F_GETFD)); GTEST_DEATH_TEST_CHECK_SYSCALL_(fcntl(close_fd, F_SETFD, fd_flags | FD_CLOEXEC)); struct inheritance inherit = {0}; // spawn is a system call. child_pid = spawn(args.argv[0], 0, NULL, &inherit, args.argv, GetEnviron()); // Restores the current working directory. GTEST_DEATH_TEST_CHECK_(fchdir(cwd_fd) != -1); GTEST_DEATH_TEST_CHECK_SYSCALL_(close(cwd_fd)); # else // GTEST_OS_QNX # if GTEST_OS_LINUX // When a SIGPROF signal is received while fork() or clone() are executing, // the process may hang. To avoid this, we ignore SIGPROF here and re-enable // it after the call to fork()/clone() is complete. struct sigaction saved_sigprof_action; struct sigaction ignore_sigprof_action; memset(&ignore_sigprof_action, 0, sizeof(ignore_sigprof_action)); sigemptyset(&ignore_sigprof_action.sa_mask); ignore_sigprof_action.sa_handler = SIG_IGN; GTEST_DEATH_TEST_CHECK_SYSCALL_(sigaction( SIGPROF, &ignore_sigprof_action, &saved_sigprof_action)); # endif // GTEST_OS_LINUX # if GTEST_HAS_CLONE const bool use_fork = GTEST_FLAG(death_test_use_fork); if (!use_fork) { static const bool stack_grows_down = StackGrowsDown(); const size_t stack_size = getpagesize(); // MMAP_ANONYMOUS is not defined on Mac, so we use MAP_ANON instead. void* const stack = mmap(NULL, stack_size, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, -1, 0); GTEST_DEATH_TEST_CHECK_(stack != MAP_FAILED); // Maximum stack alignment in bytes: For a downward-growing stack, this // amount is subtracted from size of the stack space to get an address // that is within the stack space and is aligned on all systems we care // about. As far as I know there is no ABI with stack alignment greater // than 64. We assume stack and stack_size already have alignment of // kMaxStackAlignment. const size_t kMaxStackAlignment = 64; void* const stack_top = static_cast(stack) + (stack_grows_down ? stack_size - kMaxStackAlignment : 0); GTEST_DEATH_TEST_CHECK_(stack_size > kMaxStackAlignment && reinterpret_cast(stack_top) % kMaxStackAlignment == 0); child_pid = clone(&ExecDeathTestChildMain, stack_top, SIGCHLD, &args); GTEST_DEATH_TEST_CHECK_(munmap(stack, stack_size) != -1); } # else const bool use_fork = true; # endif // GTEST_HAS_CLONE if (use_fork && (child_pid = fork()) == 0) { ExecDeathTestChildMain(&args); _exit(0); } # endif // GTEST_OS_QNX # if GTEST_OS_LINUX GTEST_DEATH_TEST_CHECK_SYSCALL_( sigaction(SIGPROF, &saved_sigprof_action, NULL)); # endif // GTEST_OS_LINUX GTEST_DEATH_TEST_CHECK_(child_pid != -1); return child_pid; } // The AssumeRole process for a fork-and-exec death test. It re-executes the // main program from the beginning, setting the --gtest_filter // and --gtest_internal_run_death_test flags to cause only the current // death test to be re-run. DeathTest::TestRole ExecDeathTest::AssumeRole() { const UnitTestImpl* const impl = GetUnitTestImpl(); const InternalRunDeathTestFlag* const flag = impl->internal_run_death_test_flag(); const TestInfo* const info = impl->current_test_info(); const int death_test_index = info->result()->death_test_count(); if (flag != NULL) { set_write_fd(flag->write_fd()); return EXECUTE_TEST; } int pipe_fd[2]; GTEST_DEATH_TEST_CHECK_(pipe(pipe_fd) != -1); // Clear the close-on-exec flag on the write end of the pipe, lest // it be closed when the child process does an exec: GTEST_DEATH_TEST_CHECK_(fcntl(pipe_fd[1], F_SETFD, 0) != -1); const std::string filter_flag = std::string("--") + GTEST_FLAG_PREFIX_ + kFilterFlag + "=" + info->test_case_name() + "." + info->name(); const std::string internal_flag = std::string("--") + GTEST_FLAG_PREFIX_ + kInternalRunDeathTestFlag + "=" + file_ + "|" + StreamableToString(line_) + "|" + StreamableToString(death_test_index) + "|" + StreamableToString(pipe_fd[1]); Arguments args; args.AddArguments(GetArgvsForDeathTestChildProcess()); args.AddArgument(filter_flag.c_str()); args.AddArgument(internal_flag.c_str()); DeathTest::set_last_death_test_message(""); CaptureStderr(); // See the comment in NoExecDeathTest::AssumeRole for why the next line // is necessary. FlushInfoLog(); const pid_t child_pid = ExecDeathTestSpawnChild(args.Argv(), pipe_fd[0]); GTEST_DEATH_TEST_CHECK_SYSCALL_(close(pipe_fd[1])); set_child_pid(child_pid); set_read_fd(pipe_fd[0]); set_spawned(true); return OVERSEE_TEST; } # endif // !GTEST_OS_WINDOWS // Creates a concrete DeathTest-derived class that depends on the // --gtest_death_test_style flag, and sets the pointer pointed to // by the "test" argument to its address. If the test should be // skipped, sets that pointer to NULL. Returns true, unless the // flag is set to an invalid value. bool DefaultDeathTestFactory::Create(const char* statement, const RE* regex, const char* file, int line, DeathTest** test) { UnitTestImpl* const impl = GetUnitTestImpl(); const InternalRunDeathTestFlag* const flag = impl->internal_run_death_test_flag(); const int death_test_index = impl->current_test_info() ->increment_death_test_count(); if (flag != NULL) { if (death_test_index > flag->index()) { DeathTest::set_last_death_test_message( "Death test count (" + StreamableToString(death_test_index) + ") somehow exceeded expected maximum (" + StreamableToString(flag->index()) + ")"); return false; } if (!(flag->file() == file && flag->line() == line && flag->index() == death_test_index)) { *test = NULL; return true; } } # if GTEST_OS_WINDOWS if (GTEST_FLAG(death_test_style) == "threadsafe" || GTEST_FLAG(death_test_style) == "fast") { *test = new WindowsDeathTest(statement, regex, file, line); } # elif GTEST_OS_FUCHSIA if (GTEST_FLAG(death_test_style) == "threadsafe" || GTEST_FLAG(death_test_style) == "fast") { *test = new FuchsiaDeathTest(statement, regex, file, line); } # else if (GTEST_FLAG(death_test_style) == "threadsafe") { *test = new ExecDeathTest(statement, regex, file, line); } else if (GTEST_FLAG(death_test_style) == "fast") { *test = new NoExecDeathTest(statement, regex); } # endif // GTEST_OS_WINDOWS else { // NOLINT - this is more readable than unbalanced brackets inside #if. DeathTest::set_last_death_test_message( "Unknown death test style \"" + GTEST_FLAG(death_test_style) + "\" encountered"); return false; } return true; } # if GTEST_OS_WINDOWS // Recreates the pipe and event handles from the provided parameters, // signals the event, and returns a file descriptor wrapped around the pipe // handle. This function is called in the child process only. static int GetStatusFileDescriptor(unsigned int parent_process_id, size_t write_handle_as_size_t, size_t event_handle_as_size_t) { AutoHandle parent_process_handle(::OpenProcess(PROCESS_DUP_HANDLE, FALSE, // Non-inheritable. parent_process_id)); if (parent_process_handle.Get() == INVALID_HANDLE_VALUE) { DeathTestAbort("Unable to open parent process " + StreamableToString(parent_process_id)); } // FIXME: Replace the following check with a // compile-time assertion when available. GTEST_CHECK_(sizeof(HANDLE) <= sizeof(size_t)); const HANDLE write_handle = reinterpret_cast(write_handle_as_size_t); HANDLE dup_write_handle; // The newly initialized handle is accessible only in the parent // process. To obtain one accessible within the child, we need to use // DuplicateHandle. if (!::DuplicateHandle(parent_process_handle.Get(), write_handle, ::GetCurrentProcess(), &dup_write_handle, 0x0, // Requested privileges ignored since // DUPLICATE_SAME_ACCESS is used. FALSE, // Request non-inheritable handler. DUPLICATE_SAME_ACCESS)) { DeathTestAbort("Unable to duplicate the pipe handle " + StreamableToString(write_handle_as_size_t) + " from the parent process " + StreamableToString(parent_process_id)); } const HANDLE event_handle = reinterpret_cast(event_handle_as_size_t); HANDLE dup_event_handle; if (!::DuplicateHandle(parent_process_handle.Get(), event_handle, ::GetCurrentProcess(), &dup_event_handle, 0x0, FALSE, DUPLICATE_SAME_ACCESS)) { DeathTestAbort("Unable to duplicate the event handle " + StreamableToString(event_handle_as_size_t) + " from the parent process " + StreamableToString(parent_process_id)); } const int write_fd = ::_open_osfhandle(reinterpret_cast(dup_write_handle), O_APPEND); if (write_fd == -1) { DeathTestAbort("Unable to convert pipe handle " + StreamableToString(write_handle_as_size_t) + " to a file descriptor"); } // Signals the parent that the write end of the pipe has been acquired // so the parent can release its own write end. ::SetEvent(dup_event_handle); return write_fd; } # endif // GTEST_OS_WINDOWS // Returns a newly created InternalRunDeathTestFlag object with fields // initialized from the GTEST_FLAG(internal_run_death_test) flag if // the flag is specified; otherwise returns NULL. InternalRunDeathTestFlag* ParseInternalRunDeathTestFlag() { if (GTEST_FLAG(internal_run_death_test) == "") return NULL; // GTEST_HAS_DEATH_TEST implies that we have ::std::string, so we // can use it here. int line = -1; int index = -1; ::std::vector< ::std::string> fields; SplitString(GTEST_FLAG(internal_run_death_test).c_str(), '|', &fields); int write_fd = -1; # if GTEST_OS_WINDOWS unsigned int parent_process_id = 0; size_t write_handle_as_size_t = 0; size_t event_handle_as_size_t = 0; if (fields.size() != 6 || !ParseNaturalNumber(fields[1], &line) || !ParseNaturalNumber(fields[2], &index) || !ParseNaturalNumber(fields[3], &parent_process_id) || !ParseNaturalNumber(fields[4], &write_handle_as_size_t) || !ParseNaturalNumber(fields[5], &event_handle_as_size_t)) { DeathTestAbort("Bad --gtest_internal_run_death_test flag: " + GTEST_FLAG(internal_run_death_test)); } write_fd = GetStatusFileDescriptor(parent_process_id, write_handle_as_size_t, event_handle_as_size_t); # elif GTEST_OS_FUCHSIA if (fields.size() != 3 || !ParseNaturalNumber(fields[1], &line) || !ParseNaturalNumber(fields[2], &index)) { DeathTestAbort("Bad --gtest_internal_run_death_test flag: " + GTEST_FLAG(internal_run_death_test)); } # else if (fields.size() != 4 || !ParseNaturalNumber(fields[1], &line) || !ParseNaturalNumber(fields[2], &index) || !ParseNaturalNumber(fields[3], &write_fd)) { DeathTestAbort("Bad --gtest_internal_run_death_test flag: " + GTEST_FLAG(internal_run_death_test)); } # endif // GTEST_OS_WINDOWS return new InternalRunDeathTestFlag(fields[0], line, index, write_fd); } } // namespace internal #endif // GTEST_HAS_DEATH_TEST } // namespace testing iptux-0.9.4/src/googletest/src/gtest-filepath.cc000066400000000000000000000342151475473122500216750ustar00rootroot00000000000000// Copyright 2008, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "gtest/internal/gtest-filepath.h" #include #include "gtest/internal/gtest-port.h" #include "gtest/gtest-message.h" #if GTEST_OS_WINDOWS_MOBILE # include #elif GTEST_OS_WINDOWS # include # include #elif GTEST_OS_SYMBIAN // Symbian OpenC has PATH_MAX in sys/syslimits.h # include #else # include # include // Some Linux distributions define PATH_MAX here. #endif // GTEST_OS_WINDOWS_MOBILE #include "gtest/internal/gtest-string.h" #if GTEST_OS_WINDOWS # define GTEST_PATH_MAX_ _MAX_PATH #elif defined(PATH_MAX) # define GTEST_PATH_MAX_ PATH_MAX #elif defined(_XOPEN_PATH_MAX) # define GTEST_PATH_MAX_ _XOPEN_PATH_MAX #else # define GTEST_PATH_MAX_ _POSIX_PATH_MAX #endif // GTEST_OS_WINDOWS namespace testing { namespace internal { #if GTEST_OS_WINDOWS // On Windows, '\\' is the standard path separator, but many tools and the // Windows API also accept '/' as an alternate path separator. Unless otherwise // noted, a file path can contain either kind of path separators, or a mixture // of them. const char kPathSeparator = '\\'; const char kAlternatePathSeparator = '/'; const char kAlternatePathSeparatorString[] = "/"; # if GTEST_OS_WINDOWS_MOBILE // Windows CE doesn't have a current directory. You should not use // the current directory in tests on Windows CE, but this at least // provides a reasonable fallback. const char kCurrentDirectoryString[] = "\\"; // Windows CE doesn't define INVALID_FILE_ATTRIBUTES const DWORD kInvalidFileAttributes = 0xffffffff; # else const char kCurrentDirectoryString[] = ".\\"; # endif // GTEST_OS_WINDOWS_MOBILE #else const char kPathSeparator = '/'; const char kCurrentDirectoryString[] = "./"; #endif // GTEST_OS_WINDOWS // Returns whether the given character is a valid path separator. static bool IsPathSeparator(char c) { #if GTEST_HAS_ALT_PATH_SEP_ return (c == kPathSeparator) || (c == kAlternatePathSeparator); #else return c == kPathSeparator; #endif } // Returns the current working directory, or "" if unsuccessful. FilePath FilePath::GetCurrentDir() { #if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_WINDOWS_PHONE || GTEST_OS_WINDOWS_RT // Windows CE doesn't have a current directory, so we just return // something reasonable. return FilePath(kCurrentDirectoryString); #elif GTEST_OS_WINDOWS char cwd[GTEST_PATH_MAX_ + 1] = { '\0' }; return FilePath(_getcwd(cwd, sizeof(cwd)) == NULL ? "" : cwd); #else char cwd[GTEST_PATH_MAX_ + 1] = { '\0' }; char* result = getcwd(cwd, sizeof(cwd)); # if GTEST_OS_NACL // getcwd will likely fail in NaCl due to the sandbox, so return something // reasonable. The user may have provided a shim implementation for getcwd, // however, so fallback only when failure is detected. return FilePath(result == NULL ? kCurrentDirectoryString : cwd); # endif // GTEST_OS_NACL return FilePath(result == NULL ? "" : cwd); #endif // GTEST_OS_WINDOWS_MOBILE } // Returns a copy of the FilePath with the case-insensitive extension removed. // Example: FilePath("dir/file.exe").RemoveExtension("EXE") returns // FilePath("dir/file"). If a case-insensitive extension is not // found, returns a copy of the original FilePath. FilePath FilePath::RemoveExtension(const char* extension) const { const std::string dot_extension = std::string(".") + extension; if (String::EndsWithCaseInsensitive(pathname_, dot_extension)) { return FilePath(pathname_.substr( 0, pathname_.length() - dot_extension.length())); } return *this; } // Returns a pointer to the last occurrence of a valid path separator in // the FilePath. On Windows, for example, both '/' and '\' are valid path // separators. Returns NULL if no path separator was found. const char* FilePath::FindLastPathSeparator() const { const char* const last_sep = strrchr(c_str(), kPathSeparator); #if GTEST_HAS_ALT_PATH_SEP_ const char* const last_alt_sep = strrchr(c_str(), kAlternatePathSeparator); // Comparing two pointers of which only one is NULL is undefined. if (last_alt_sep != NULL && (last_sep == NULL || last_alt_sep > last_sep)) { return last_alt_sep; } #endif return last_sep; } // Returns a copy of the FilePath with the directory part removed. // Example: FilePath("path/to/file").RemoveDirectoryName() returns // FilePath("file"). If there is no directory part ("just_a_file"), it returns // the FilePath unmodified. If there is no file part ("just_a_dir/") it // returns an empty FilePath (""). // On Windows platform, '\' is the path separator, otherwise it is '/'. FilePath FilePath::RemoveDirectoryName() const { const char* const last_sep = FindLastPathSeparator(); return last_sep ? FilePath(last_sep + 1) : *this; } // RemoveFileName returns the directory path with the filename removed. // Example: FilePath("path/to/file").RemoveFileName() returns "path/to/". // If the FilePath is "a_file" or "/a_file", RemoveFileName returns // FilePath("./") or, on Windows, FilePath(".\\"). If the filepath does // not have a file, like "just/a/dir/", it returns the FilePath unmodified. // On Windows platform, '\' is the path separator, otherwise it is '/'. FilePath FilePath::RemoveFileName() const { const char* const last_sep = FindLastPathSeparator(); std::string dir; if (last_sep) { dir = std::string(c_str(), last_sep + 1 - c_str()); } else { dir = kCurrentDirectoryString; } return FilePath(dir); } // Helper functions for naming files in a directory for xml output. // Given directory = "dir", base_name = "test", number = 0, // extension = "xml", returns "dir/test.xml". If number is greater // than zero (e.g., 12), returns "dir/test_12.xml". // On Windows platform, uses \ as the separator rather than /. FilePath FilePath::MakeFileName(const FilePath& directory, const FilePath& base_name, int number, const char* extension) { std::string file; if (number == 0) { file = base_name.string() + "." + extension; } else { file = base_name.string() + "_" + StreamableToString(number) + "." + extension; } return ConcatPaths(directory, FilePath(file)); } // Given directory = "dir", relative_path = "test.xml", returns "dir/test.xml". // On Windows, uses \ as the separator rather than /. FilePath FilePath::ConcatPaths(const FilePath& directory, const FilePath& relative_path) { if (directory.IsEmpty()) return relative_path; const FilePath dir(directory.RemoveTrailingPathSeparator()); return FilePath(dir.string() + kPathSeparator + relative_path.string()); } // Returns true if pathname describes something findable in the file-system, // either a file, directory, or whatever. bool FilePath::FileOrDirectoryExists() const { #if GTEST_OS_WINDOWS_MOBILE LPCWSTR unicode = String::AnsiToUtf16(pathname_.c_str()); const DWORD attributes = GetFileAttributes(unicode); delete [] unicode; return attributes != kInvalidFileAttributes; #else posix::StatStruct file_stat; return posix::Stat(pathname_.c_str(), &file_stat) == 0; #endif // GTEST_OS_WINDOWS_MOBILE } // Returns true if pathname describes a directory in the file-system // that exists. bool FilePath::DirectoryExists() const { bool result = false; #if GTEST_OS_WINDOWS // Don't strip off trailing separator if path is a root directory on // Windows (like "C:\\"). const FilePath& path(IsRootDirectory() ? *this : RemoveTrailingPathSeparator()); #else const FilePath& path(*this); #endif #if GTEST_OS_WINDOWS_MOBILE LPCWSTR unicode = String::AnsiToUtf16(path.c_str()); const DWORD attributes = GetFileAttributes(unicode); delete [] unicode; if ((attributes != kInvalidFileAttributes) && (attributes & FILE_ATTRIBUTE_DIRECTORY)) { result = true; } #else posix::StatStruct file_stat; result = posix::Stat(path.c_str(), &file_stat) == 0 && posix::IsDir(file_stat); #endif // GTEST_OS_WINDOWS_MOBILE return result; } // Returns true if pathname describes a root directory. (Windows has one // root directory per disk drive.) bool FilePath::IsRootDirectory() const { #if GTEST_OS_WINDOWS // FIXME: on Windows a network share like // \\server\share can be a root directory, although it cannot be the // current directory. Handle this properly. return pathname_.length() == 3 && IsAbsolutePath(); #else return pathname_.length() == 1 && IsPathSeparator(pathname_.c_str()[0]); #endif } // Returns true if pathname describes an absolute path. bool FilePath::IsAbsolutePath() const { const char* const name = pathname_.c_str(); #if GTEST_OS_WINDOWS return pathname_.length() >= 3 && ((name[0] >= 'a' && name[0] <= 'z') || (name[0] >= 'A' && name[0] <= 'Z')) && name[1] == ':' && IsPathSeparator(name[2]); #else return IsPathSeparator(name[0]); #endif } // Returns a pathname for a file that does not currently exist. The pathname // will be directory/base_name.extension or // directory/base_name_.extension if directory/base_name.extension // already exists. The number will be incremented until a pathname is found // that does not already exist. // Examples: 'dir/foo_test.xml' or 'dir/foo_test_1.xml'. // There could be a race condition if two or more processes are calling this // function at the same time -- they could both pick the same filename. FilePath FilePath::GenerateUniqueFileName(const FilePath& directory, const FilePath& base_name, const char* extension) { FilePath full_pathname; int number = 0; do { full_pathname.Set(MakeFileName(directory, base_name, number++, extension)); } while (full_pathname.FileOrDirectoryExists()); return full_pathname; } // Returns true if FilePath ends with a path separator, which indicates that // it is intended to represent a directory. Returns false otherwise. // This does NOT check that a directory (or file) actually exists. bool FilePath::IsDirectory() const { return !pathname_.empty() && IsPathSeparator(pathname_.c_str()[pathname_.length() - 1]); } // Create directories so that path exists. Returns true if successful or if // the directories already exist; returns false if unable to create directories // for any reason. bool FilePath::CreateDirectoriesRecursively() const { if (!this->IsDirectory()) { return false; } if (pathname_.length() == 0 || this->DirectoryExists()) { return true; } const FilePath parent(this->RemoveTrailingPathSeparator().RemoveFileName()); return parent.CreateDirectoriesRecursively() && this->CreateFolder(); } // Create the directory so that path exists. Returns true if successful or // if the directory already exists; returns false if unable to create the // directory for any reason, including if the parent directory does not // exist. Not named "CreateDirectory" because that's a macro on Windows. bool FilePath::CreateFolder() const { #if GTEST_OS_WINDOWS_MOBILE FilePath removed_sep(this->RemoveTrailingPathSeparator()); LPCWSTR unicode = String::AnsiToUtf16(removed_sep.c_str()); int result = CreateDirectory(unicode, NULL) ? 0 : -1; delete [] unicode; #elif GTEST_OS_WINDOWS int result = _mkdir(pathname_.c_str()); #else int result = mkdir(pathname_.c_str(), 0777); #endif // GTEST_OS_WINDOWS_MOBILE if (result == -1) { return this->DirectoryExists(); // An error is OK if the directory exists. } return true; // No error. } // If input name has a trailing separator character, remove it and return the // name, otherwise return the name string unmodified. // On Windows platform, uses \ as the separator, other platforms use /. FilePath FilePath::RemoveTrailingPathSeparator() const { return IsDirectory() ? FilePath(pathname_.substr(0, pathname_.length() - 1)) : *this; } // Removes any redundant separators that might be in the pathname. // For example, "bar///foo" becomes "bar/foo". Does not eliminate other // redundancies that might be in a pathname involving "." or "..". // FIXME: handle Windows network shares (e.g. \\server\share). void FilePath::Normalize() { if (pathname_.c_str() == NULL) { pathname_ = ""; return; } const char* src = pathname_.c_str(); char* const dest = new char[pathname_.length() + 1]; char* dest_ptr = dest; memset(dest_ptr, 0, pathname_.length() + 1); while (*src != '\0') { *dest_ptr = *src; if (!IsPathSeparator(*src)) { src++; } else { #if GTEST_HAS_ALT_PATH_SEP_ if (*dest_ptr == kAlternatePathSeparator) { *dest_ptr = kPathSeparator; } #endif while (IsPathSeparator(*src)) src++; } dest_ptr++; } *dest_ptr = '\0'; pathname_ = dest; delete[] dest; } } // namespace internal } // namespace testing iptux-0.9.4/src/googletest/src/gtest-internal-inl.h000066400000000000000000001311071475473122500223350ustar00rootroot00000000000000// Copyright 2005, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // Utility functions and classes used by the Google C++ testing framework.// // This file contains purely Google Test's internal implementation. Please // DO NOT #INCLUDE IT IN A USER PROGRAM. #ifndef GTEST_SRC_GTEST_INTERNAL_INL_H_ #define GTEST_SRC_GTEST_INTERNAL_INL_H_ #ifndef _WIN32_WCE # include #endif // !_WIN32_WCE #include #include // For strtoll/_strtoul64/malloc/free. #include // For memmove. #include #include #include #include "gtest/internal/gtest-port.h" #if GTEST_CAN_STREAM_RESULTS_ # include // NOLINT # include // NOLINT #endif #if GTEST_OS_WINDOWS # include // NOLINT #endif // GTEST_OS_WINDOWS #include "gtest/gtest.h" #include "gtest/gtest-spi.h" GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \ /* class A needs to have dll-interface to be used by clients of class B */) namespace testing { // Declares the flags. // // We don't want the users to modify this flag in the code, but want // Google Test's own unit tests to be able to access it. Therefore we // declare it here as opposed to in gtest.h. GTEST_DECLARE_bool_(death_test_use_fork); namespace internal { // The value of GetTestTypeId() as seen from within the Google Test // library. This is solely for testing GetTestTypeId(). GTEST_API_ extern const TypeId kTestTypeIdInGoogleTest; // Names of the flags (needed for parsing Google Test flags). const char kAlsoRunDisabledTestsFlag[] = "also_run_disabled_tests"; const char kBreakOnFailureFlag[] = "break_on_failure"; const char kCatchExceptionsFlag[] = "catch_exceptions"; const char kColorFlag[] = "color"; const char kFilterFlag[] = "filter"; const char kListTestsFlag[] = "list_tests"; const char kOutputFlag[] = "output"; const char kPrintTimeFlag[] = "print_time"; const char kPrintUTF8Flag[] = "print_utf8"; const char kRandomSeedFlag[] = "random_seed"; const char kRepeatFlag[] = "repeat"; const char kShuffleFlag[] = "shuffle"; const char kStackTraceDepthFlag[] = "stack_trace_depth"; const char kStreamResultToFlag[] = "stream_result_to"; const char kThrowOnFailureFlag[] = "throw_on_failure"; const char kFlagfileFlag[] = "flagfile"; // A valid random seed must be in [1, kMaxRandomSeed]. const int kMaxRandomSeed = 99999; // g_help_flag is true iff the --help flag or an equivalent form is // specified on the command line. GTEST_API_ extern bool g_help_flag; // Returns the current time in milliseconds. GTEST_API_ TimeInMillis GetTimeInMillis(); // Returns true iff Google Test should use colors in the output. GTEST_API_ bool ShouldUseColor(bool stdout_is_tty); // Formats the given time in milliseconds as seconds. GTEST_API_ std::string FormatTimeInMillisAsSeconds(TimeInMillis ms); // Converts the given time in milliseconds to a date string in the ISO 8601 // format, without the timezone information. N.B.: due to the use the // non-reentrant localtime() function, this function is not thread safe. Do // not use it in any code that can be called from multiple threads. GTEST_API_ std::string FormatEpochTimeInMillisAsIso8601(TimeInMillis ms); // Parses a string for an Int32 flag, in the form of "--flag=value". // // On success, stores the value of the flag in *value, and returns // true. On failure, returns false without changing *value. GTEST_API_ bool ParseInt32Flag( const char* str, const char* flag, Int32* value); // Returns a random seed in range [1, kMaxRandomSeed] based on the // given --gtest_random_seed flag value. inline int GetRandomSeedFromFlag(Int32 random_seed_flag) { const unsigned int raw_seed = (random_seed_flag == 0) ? static_cast(GetTimeInMillis()) : static_cast(random_seed_flag); // Normalizes the actual seed to range [1, kMaxRandomSeed] such that // it's easy to type. const int normalized_seed = static_cast((raw_seed - 1U) % static_cast(kMaxRandomSeed)) + 1; return normalized_seed; } // Returns the first valid random seed after 'seed'. The behavior is // undefined if 'seed' is invalid. The seed after kMaxRandomSeed is // considered to be 1. inline int GetNextRandomSeed(int seed) { GTEST_CHECK_(1 <= seed && seed <= kMaxRandomSeed) << "Invalid random seed " << seed << " - must be in [1, " << kMaxRandomSeed << "]."; const int next_seed = seed + 1; return (next_seed > kMaxRandomSeed) ? 1 : next_seed; } // This class saves the values of all Google Test flags in its c'tor, and // restores them in its d'tor. class GTestFlagSaver { public: // The c'tor. GTestFlagSaver() { also_run_disabled_tests_ = GTEST_FLAG(also_run_disabled_tests); break_on_failure_ = GTEST_FLAG(break_on_failure); catch_exceptions_ = GTEST_FLAG(catch_exceptions); color_ = GTEST_FLAG(color); death_test_style_ = GTEST_FLAG(death_test_style); death_test_use_fork_ = GTEST_FLAG(death_test_use_fork); filter_ = GTEST_FLAG(filter); internal_run_death_test_ = GTEST_FLAG(internal_run_death_test); list_tests_ = GTEST_FLAG(list_tests); output_ = GTEST_FLAG(output); print_time_ = GTEST_FLAG(print_time); print_utf8_ = GTEST_FLAG(print_utf8); random_seed_ = GTEST_FLAG(random_seed); repeat_ = GTEST_FLAG(repeat); shuffle_ = GTEST_FLAG(shuffle); stack_trace_depth_ = GTEST_FLAG(stack_trace_depth); stream_result_to_ = GTEST_FLAG(stream_result_to); throw_on_failure_ = GTEST_FLAG(throw_on_failure); } // The d'tor is not virtual. DO NOT INHERIT FROM THIS CLASS. ~GTestFlagSaver() { GTEST_FLAG(also_run_disabled_tests) = also_run_disabled_tests_; GTEST_FLAG(break_on_failure) = break_on_failure_; GTEST_FLAG(catch_exceptions) = catch_exceptions_; GTEST_FLAG(color) = color_; GTEST_FLAG(death_test_style) = death_test_style_; GTEST_FLAG(death_test_use_fork) = death_test_use_fork_; GTEST_FLAG(filter) = filter_; GTEST_FLAG(internal_run_death_test) = internal_run_death_test_; GTEST_FLAG(list_tests) = list_tests_; GTEST_FLAG(output) = output_; GTEST_FLAG(print_time) = print_time_; GTEST_FLAG(print_utf8) = print_utf8_; GTEST_FLAG(random_seed) = random_seed_; GTEST_FLAG(repeat) = repeat_; GTEST_FLAG(shuffle) = shuffle_; GTEST_FLAG(stack_trace_depth) = stack_trace_depth_; GTEST_FLAG(stream_result_to) = stream_result_to_; GTEST_FLAG(throw_on_failure) = throw_on_failure_; } private: // Fields for saving the original values of flags. bool also_run_disabled_tests_; bool break_on_failure_; bool catch_exceptions_; std::string color_; std::string death_test_style_; bool death_test_use_fork_; std::string filter_; std::string internal_run_death_test_; bool list_tests_; std::string output_; bool print_time_; bool print_utf8_; internal::Int32 random_seed_; internal::Int32 repeat_; bool shuffle_; internal::Int32 stack_trace_depth_; std::string stream_result_to_; bool throw_on_failure_; } GTEST_ATTRIBUTE_UNUSED_; // Converts a Unicode code point to a narrow string in UTF-8 encoding. // code_point parameter is of type UInt32 because wchar_t may not be // wide enough to contain a code point. // If the code_point is not a valid Unicode code point // (i.e. outside of Unicode range U+0 to U+10FFFF) it will be converted // to "(Invalid Unicode 0xXXXXXXXX)". GTEST_API_ std::string CodePointToUtf8(UInt32 code_point); // Converts a wide string to a narrow string in UTF-8 encoding. // The wide string is assumed to have the following encoding: // UTF-16 if sizeof(wchar_t) == 2 (on Windows, Cygwin, Symbian OS) // UTF-32 if sizeof(wchar_t) == 4 (on Linux) // Parameter str points to a null-terminated wide string. // Parameter num_chars may additionally limit the number // of wchar_t characters processed. -1 is used when the entire string // should be processed. // If the string contains code points that are not valid Unicode code points // (i.e. outside of Unicode range U+0 to U+10FFFF) they will be output // as '(Invalid Unicode 0xXXXXXXXX)'. If the string is in UTF16 encoding // and contains invalid UTF-16 surrogate pairs, values in those pairs // will be encoded as individual Unicode characters from Basic Normal Plane. GTEST_API_ std::string WideStringToUtf8(const wchar_t* str, int num_chars); // Reads the GTEST_SHARD_STATUS_FILE environment variable, and creates the file // if the variable is present. If a file already exists at this location, this // function will write over it. If the variable is present, but the file cannot // be created, prints an error and exits. void WriteToShardStatusFileIfNeeded(); // Checks whether sharding is enabled by examining the relevant // environment variable values. If the variables are present, // but inconsistent (e.g., shard_index >= total_shards), prints // an error and exits. If in_subprocess_for_death_test, sharding is // disabled because it must only be applied to the original test // process. Otherwise, we could filter out death tests we intended to execute. GTEST_API_ bool ShouldShard(const char* total_shards_str, const char* shard_index_str, bool in_subprocess_for_death_test); // Parses the environment variable var as an Int32. If it is unset, // returns default_val. If it is not an Int32, prints an error and // and aborts. GTEST_API_ Int32 Int32FromEnvOrDie(const char* env_var, Int32 default_val); // Given the total number of shards, the shard index, and the test id, // returns true iff the test should be run on this shard. The test id is // some arbitrary but unique non-negative integer assigned to each test // method. Assumes that 0 <= shard_index < total_shards. GTEST_API_ bool ShouldRunTestOnShard( int total_shards, int shard_index, int test_id); // STL container utilities. // Returns the number of elements in the given container that satisfy // the given predicate. template inline int CountIf(const Container& c, Predicate predicate) { // Implemented as an explicit loop since std::count_if() in libCstd on // Solaris has a non-standard signature. int count = 0; for (typename Container::const_iterator it = c.begin(); it != c.end(); ++it) { if (predicate(*it)) ++count; } return count; } // Applies a function/functor to each element in the container. template void ForEach(const Container& c, Functor functor) { std::for_each(c.begin(), c.end(), functor); } // Returns the i-th element of the vector, or default_value if i is not // in range [0, v.size()). template inline E GetElementOr(const std::vector& v, int i, E default_value) { return (i < 0 || i >= static_cast(v.size())) ? default_value : v[i]; } // Performs an in-place shuffle of a range of the vector's elements. // 'begin' and 'end' are element indices as an STL-style range; // i.e. [begin, end) are shuffled, where 'end' == size() means to // shuffle to the end of the vector. template void ShuffleRange(internal::Random* random, int begin, int end, std::vector* v) { const int size = static_cast(v->size()); GTEST_CHECK_(0 <= begin && begin <= size) << "Invalid shuffle range start " << begin << ": must be in range [0, " << size << "]."; GTEST_CHECK_(begin <= end && end <= size) << "Invalid shuffle range finish " << end << ": must be in range [" << begin << ", " << size << "]."; // Fisher-Yates shuffle, from // http://en.wikipedia.org/wiki/Fisher-Yates_shuffle for (int range_width = end - begin; range_width >= 2; range_width--) { const int last_in_range = begin + range_width - 1; const int selected = begin + random->Generate(range_width); std::swap((*v)[selected], (*v)[last_in_range]); } } // Performs an in-place shuffle of the vector's elements. template inline void Shuffle(internal::Random* random, std::vector* v) { ShuffleRange(random, 0, static_cast(v->size()), v); } // A function for deleting an object. Handy for being used as a // functor. template static void Delete(T* x) { delete x; } // A predicate that checks the key of a TestProperty against a known key. // // TestPropertyKeyIs is copyable. class TestPropertyKeyIs { public: // Constructor. // // TestPropertyKeyIs has NO default constructor. explicit TestPropertyKeyIs(const std::string& key) : key_(key) {} // Returns true iff the test name of test property matches on key_. bool operator()(const TestProperty& test_property) const { return test_property.key() == key_; } private: std::string key_; }; // Class UnitTestOptions. // // This class contains functions for processing options the user // specifies when running the tests. It has only static members. // // In most cases, the user can specify an option using either an // environment variable or a command line flag. E.g. you can set the // test filter using either GTEST_FILTER or --gtest_filter. If both // the variable and the flag are present, the latter overrides the // former. class GTEST_API_ UnitTestOptions { public: // Functions for processing the gtest_output flag. // Returns the output format, or "" for normal printed output. static std::string GetOutputFormat(); // Returns the absolute path of the requested output file, or the // default (test_detail.xml in the original working directory) if // none was explicitly specified. static std::string GetAbsolutePathToOutputFile(); // Functions for processing the gtest_filter flag. // Returns true iff the wildcard pattern matches the string. The // first ':' or '\0' character in pattern marks the end of it. // // This recursive algorithm isn't very efficient, but is clear and // works well enough for matching test names, which are short. static bool PatternMatchesString(const char *pattern, const char *str); // Returns true iff the user-specified filter matches the test case // name and the test name. static bool FilterMatchesTest(const std::string &test_case_name, const std::string &test_name); #if GTEST_OS_WINDOWS // Function for supporting the gtest_catch_exception flag. // Returns EXCEPTION_EXECUTE_HANDLER if Google Test should handle the // given SEH exception, or EXCEPTION_CONTINUE_SEARCH otherwise. // This function is useful as an __except condition. static int GTestShouldProcessSEH(DWORD exception_code); #endif // GTEST_OS_WINDOWS // Returns true if "name" matches the ':' separated list of glob-style // filters in "filter". static bool MatchesFilter(const std::string& name, const char* filter); }; // Returns the current application's name, removing directory path if that // is present. Used by UnitTestOptions::GetOutputFile. GTEST_API_ FilePath GetCurrentExecutableName(); // The role interface for getting the OS stack trace as a string. class OsStackTraceGetterInterface { public: OsStackTraceGetterInterface() {} virtual ~OsStackTraceGetterInterface() {} // Returns the current OS stack trace as an std::string. Parameters: // // max_depth - the maximum number of stack frames to be included // in the trace. // skip_count - the number of top frames to be skipped; doesn't count // against max_depth. virtual std::string CurrentStackTrace(int max_depth, int skip_count) = 0; // UponLeavingGTest() should be called immediately before Google Test calls // user code. It saves some information about the current stack that // CurrentStackTrace() will use to find and hide Google Test stack frames. virtual void UponLeavingGTest() = 0; // This string is inserted in place of stack frames that are part of // Google Test's implementation. static const char* const kElidedFramesMarker; private: GTEST_DISALLOW_COPY_AND_ASSIGN_(OsStackTraceGetterInterface); }; // A working implementation of the OsStackTraceGetterInterface interface. class OsStackTraceGetter : public OsStackTraceGetterInterface { public: OsStackTraceGetter() {} virtual std::string CurrentStackTrace(int max_depth, int skip_count); virtual void UponLeavingGTest(); private: #if GTEST_HAS_ABSL Mutex mutex_; // Protects all internal state. // We save the stack frame below the frame that calls user code. // We do this because the address of the frame immediately below // the user code changes between the call to UponLeavingGTest() // and any calls to the stack trace code from within the user code. void* caller_frame_ = nullptr; #endif // GTEST_HAS_ABSL GTEST_DISALLOW_COPY_AND_ASSIGN_(OsStackTraceGetter); }; // Information about a Google Test trace point. struct TraceInfo { const char* file; int line; std::string message; }; // This is the default global test part result reporter used in UnitTestImpl. // This class should only be used by UnitTestImpl. class DefaultGlobalTestPartResultReporter : public TestPartResultReporterInterface { public: explicit DefaultGlobalTestPartResultReporter(UnitTestImpl* unit_test); // Implements the TestPartResultReporterInterface. Reports the test part // result in the current test. virtual void ReportTestPartResult(const TestPartResult& result); private: UnitTestImpl* const unit_test_; GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultGlobalTestPartResultReporter); }; // This is the default per thread test part result reporter used in // UnitTestImpl. This class should only be used by UnitTestImpl. class DefaultPerThreadTestPartResultReporter : public TestPartResultReporterInterface { public: explicit DefaultPerThreadTestPartResultReporter(UnitTestImpl* unit_test); // Implements the TestPartResultReporterInterface. The implementation just // delegates to the current global test part result reporter of *unit_test_. virtual void ReportTestPartResult(const TestPartResult& result); private: UnitTestImpl* const unit_test_; GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultPerThreadTestPartResultReporter); }; // The private implementation of the UnitTest class. We don't protect // the methods under a mutex, as this class is not accessible by a // user and the UnitTest class that delegates work to this class does // proper locking. class GTEST_API_ UnitTestImpl { public: explicit UnitTestImpl(UnitTest* parent); virtual ~UnitTestImpl(); // There are two different ways to register your own TestPartResultReporter. // You can register your own repoter to listen either only for test results // from the current thread or for results from all threads. // By default, each per-thread test result repoter just passes a new // TestPartResult to the global test result reporter, which registers the // test part result for the currently running test. // Returns the global test part result reporter. TestPartResultReporterInterface* GetGlobalTestPartResultReporter(); // Sets the global test part result reporter. void SetGlobalTestPartResultReporter( TestPartResultReporterInterface* reporter); // Returns the test part result reporter for the current thread. TestPartResultReporterInterface* GetTestPartResultReporterForCurrentThread(); // Sets the test part result reporter for the current thread. void SetTestPartResultReporterForCurrentThread( TestPartResultReporterInterface* reporter); // Gets the number of successful test cases. int successful_test_case_count() const; // Gets the number of failed test cases. int failed_test_case_count() const; // Gets the number of all test cases. int total_test_case_count() const; // Gets the number of all test cases that contain at least one test // that should run. int test_case_to_run_count() const; // Gets the number of successful tests. int successful_test_count() const; // Gets the number of failed tests. int failed_test_count() const; // Gets the number of disabled tests that will be reported in the XML report. int reportable_disabled_test_count() const; // Gets the number of disabled tests. int disabled_test_count() const; // Gets the number of tests to be printed in the XML report. int reportable_test_count() const; // Gets the number of all tests. int total_test_count() const; // Gets the number of tests that should run. int test_to_run_count() const; // Gets the time of the test program start, in ms from the start of the // UNIX epoch. TimeInMillis start_timestamp() const { return start_timestamp_; } // Gets the elapsed time, in milliseconds. TimeInMillis elapsed_time() const { return elapsed_time_; } // Returns true iff the unit test passed (i.e. all test cases passed). bool Passed() const { return !Failed(); } // Returns true iff the unit test failed (i.e. some test case failed // or something outside of all tests failed). bool Failed() const { return failed_test_case_count() > 0 || ad_hoc_test_result()->Failed(); } // Gets the i-th test case among all the test cases. i can range from 0 to // total_test_case_count() - 1. If i is not in that range, returns NULL. const TestCase* GetTestCase(int i) const { const int index = GetElementOr(test_case_indices_, i, -1); return index < 0 ? NULL : test_cases_[i]; } // Gets the i-th test case among all the test cases. i can range from 0 to // total_test_case_count() - 1. If i is not in that range, returns NULL. TestCase* GetMutableTestCase(int i) { const int index = GetElementOr(test_case_indices_, i, -1); return index < 0 ? NULL : test_cases_[index]; } // Provides access to the event listener list. TestEventListeners* listeners() { return &listeners_; } // Returns the TestResult for the test that's currently running, or // the TestResult for the ad hoc test if no test is running. TestResult* current_test_result(); // Returns the TestResult for the ad hoc test. const TestResult* ad_hoc_test_result() const { return &ad_hoc_test_result_; } // Sets the OS stack trace getter. // // Does nothing if the input and the current OS stack trace getter // are the same; otherwise, deletes the old getter and makes the // input the current getter. void set_os_stack_trace_getter(OsStackTraceGetterInterface* getter); // Returns the current OS stack trace getter if it is not NULL; // otherwise, creates an OsStackTraceGetter, makes it the current // getter, and returns it. OsStackTraceGetterInterface* os_stack_trace_getter(); // Returns the current OS stack trace as an std::string. // // The maximum number of stack frames to be included is specified by // the gtest_stack_trace_depth flag. The skip_count parameter // specifies the number of top frames to be skipped, which doesn't // count against the number of frames to be included. // // For example, if Foo() calls Bar(), which in turn calls // CurrentOsStackTraceExceptTop(1), Foo() will be included in the // trace but Bar() and CurrentOsStackTraceExceptTop() won't. std::string CurrentOsStackTraceExceptTop(int skip_count) GTEST_NO_INLINE_; // Finds and returns a TestCase with the given name. If one doesn't // exist, creates one and returns it. // // Arguments: // // test_case_name: name of the test case // type_param: the name of the test's type parameter, or NULL if // this is not a typed or a type-parameterized test. // set_up_tc: pointer to the function that sets up the test case // tear_down_tc: pointer to the function that tears down the test case TestCase* GetTestCase(const char* test_case_name, const char* type_param, Test::SetUpTestCaseFunc set_up_tc, Test::TearDownTestCaseFunc tear_down_tc); // Adds a TestInfo to the unit test. // // Arguments: // // set_up_tc: pointer to the function that sets up the test case // tear_down_tc: pointer to the function that tears down the test case // test_info: the TestInfo object void AddTestInfo(Test::SetUpTestCaseFunc set_up_tc, Test::TearDownTestCaseFunc tear_down_tc, TestInfo* test_info) { // In order to support thread-safe death tests, we need to // remember the original working directory when the test program // was first invoked. We cannot do this in RUN_ALL_TESTS(), as // the user may have changed the current directory before calling // RUN_ALL_TESTS(). Therefore we capture the current directory in // AddTestInfo(), which is called to register a TEST or TEST_F // before main() is reached. if (original_working_dir_.IsEmpty()) { original_working_dir_.Set(FilePath::GetCurrentDir()); GTEST_CHECK_(!original_working_dir_.IsEmpty()) << "Failed to get the current working directory."; } GetTestCase(test_info->test_case_name(), test_info->type_param(), set_up_tc, tear_down_tc)->AddTestInfo(test_info); } // Returns ParameterizedTestCaseRegistry object used to keep track of // value-parameterized tests and instantiate and register them. internal::ParameterizedTestCaseRegistry& parameterized_test_registry() { return parameterized_test_registry_; } // Sets the TestCase object for the test that's currently running. void set_current_test_case(TestCase* a_current_test_case) { current_test_case_ = a_current_test_case; } // Sets the TestInfo object for the test that's currently running. If // current_test_info is NULL, the assertion results will be stored in // ad_hoc_test_result_. void set_current_test_info(TestInfo* a_current_test_info) { current_test_info_ = a_current_test_info; } // Registers all parameterized tests defined using TEST_P and // INSTANTIATE_TEST_CASE_P, creating regular tests for each test/parameter // combination. This method can be called more then once; it has guards // protecting from registering the tests more then once. If // value-parameterized tests are disabled, RegisterParameterizedTests is // present but does nothing. void RegisterParameterizedTests(); // Runs all tests in this UnitTest object, prints the result, and // returns true if all tests are successful. If any exception is // thrown during a test, this test is considered to be failed, but // the rest of the tests will still be run. bool RunAllTests(); // Clears the results of all tests, except the ad hoc tests. void ClearNonAdHocTestResult() { ForEach(test_cases_, TestCase::ClearTestCaseResult); } // Clears the results of ad-hoc test assertions. void ClearAdHocTestResult() { ad_hoc_test_result_.Clear(); } // Adds a TestProperty to the current TestResult object when invoked in a // context of a test or a test case, or to the global property set. If the // result already contains a property with the same key, the value will be // updated. void RecordProperty(const TestProperty& test_property); enum ReactionToSharding { HONOR_SHARDING_PROTOCOL, IGNORE_SHARDING_PROTOCOL }; // Matches the full name of each test against the user-specified // filter to decide whether the test should run, then records the // result in each TestCase and TestInfo object. // If shard_tests == HONOR_SHARDING_PROTOCOL, further filters tests // based on sharding variables in the environment. // Returns the number of tests that should run. int FilterTests(ReactionToSharding shard_tests); // Prints the names of the tests matching the user-specified filter flag. void ListTestsMatchingFilter(); const TestCase* current_test_case() const { return current_test_case_; } TestInfo* current_test_info() { return current_test_info_; } const TestInfo* current_test_info() const { return current_test_info_; } // Returns the vector of environments that need to be set-up/torn-down // before/after the tests are run. std::vector& environments() { return environments_; } // Getters for the per-thread Google Test trace stack. std::vector& gtest_trace_stack() { return *(gtest_trace_stack_.pointer()); } const std::vector& gtest_trace_stack() const { return gtest_trace_stack_.get(); } #if GTEST_HAS_DEATH_TEST void InitDeathTestSubprocessControlInfo() { internal_run_death_test_flag_.reset(ParseInternalRunDeathTestFlag()); } // Returns a pointer to the parsed --gtest_internal_run_death_test // flag, or NULL if that flag was not specified. // This information is useful only in a death test child process. // Must not be called before a call to InitGoogleTest. const InternalRunDeathTestFlag* internal_run_death_test_flag() const { return internal_run_death_test_flag_.get(); } // Returns a pointer to the current death test factory. internal::DeathTestFactory* death_test_factory() { return death_test_factory_.get(); } void SuppressTestEventsIfInSubprocess(); friend class ReplaceDeathTestFactory; #endif // GTEST_HAS_DEATH_TEST // Initializes the event listener performing XML output as specified by // UnitTestOptions. Must not be called before InitGoogleTest. void ConfigureXmlOutput(); #if GTEST_CAN_STREAM_RESULTS_ // Initializes the event listener for streaming test results to a socket. // Must not be called before InitGoogleTest. void ConfigureStreamingOutput(); #endif // Performs initialization dependent upon flag values obtained in // ParseGoogleTestFlagsOnly. Is called from InitGoogleTest after the call to // ParseGoogleTestFlagsOnly. In case a user neglects to call InitGoogleTest // this function is also called from RunAllTests. Since this function can be // called more than once, it has to be idempotent. void PostFlagParsingInit(); // Gets the random seed used at the start of the current test iteration. int random_seed() const { return random_seed_; } // Gets the random number generator. internal::Random* random() { return &random_; } // Shuffles all test cases, and the tests within each test case, // making sure that death tests are still run first. void ShuffleTests(); // Restores the test cases and tests to their order before the first shuffle. void UnshuffleTests(); // Returns the value of GTEST_FLAG(catch_exceptions) at the moment // UnitTest::Run() starts. bool catch_exceptions() const { return catch_exceptions_; } private: friend class ::testing::UnitTest; // Used by UnitTest::Run() to capture the state of // GTEST_FLAG(catch_exceptions) at the moment it starts. void set_catch_exceptions(bool value) { catch_exceptions_ = value; } // The UnitTest object that owns this implementation object. UnitTest* const parent_; // The working directory when the first TEST() or TEST_F() was // executed. internal::FilePath original_working_dir_; // The default test part result reporters. DefaultGlobalTestPartResultReporter default_global_test_part_result_reporter_; DefaultPerThreadTestPartResultReporter default_per_thread_test_part_result_reporter_; // Points to (but doesn't own) the global test part result reporter. TestPartResultReporterInterface* global_test_part_result_repoter_; // Protects read and write access to global_test_part_result_reporter_. internal::Mutex global_test_part_result_reporter_mutex_; // Points to (but doesn't own) the per-thread test part result reporter. internal::ThreadLocal per_thread_test_part_result_reporter_; // The vector of environments that need to be set-up/torn-down // before/after the tests are run. std::vector environments_; // The vector of TestCases in their original order. It owns the // elements in the vector. std::vector test_cases_; // Provides a level of indirection for the test case list to allow // easy shuffling and restoring the test case order. The i-th // element of this vector is the index of the i-th test case in the // shuffled order. std::vector test_case_indices_; // ParameterizedTestRegistry object used to register value-parameterized // tests. internal::ParameterizedTestCaseRegistry parameterized_test_registry_; // Indicates whether RegisterParameterizedTests() has been called already. bool parameterized_tests_registered_; // Index of the last death test case registered. Initially -1. int last_death_test_case_; // This points to the TestCase for the currently running test. It // changes as Google Test goes through one test case after another. // When no test is running, this is set to NULL and Google Test // stores assertion results in ad_hoc_test_result_. Initially NULL. TestCase* current_test_case_; // This points to the TestInfo for the currently running test. It // changes as Google Test goes through one test after another. When // no test is running, this is set to NULL and Google Test stores // assertion results in ad_hoc_test_result_. Initially NULL. TestInfo* current_test_info_; // Normally, a user only writes assertions inside a TEST or TEST_F, // or inside a function called by a TEST or TEST_F. Since Google // Test keeps track of which test is current running, it can // associate such an assertion with the test it belongs to. // // If an assertion is encountered when no TEST or TEST_F is running, // Google Test attributes the assertion result to an imaginary "ad hoc" // test, and records the result in ad_hoc_test_result_. TestResult ad_hoc_test_result_; // The list of event listeners that can be used to track events inside // Google Test. TestEventListeners listeners_; // The OS stack trace getter. Will be deleted when the UnitTest // object is destructed. By default, an OsStackTraceGetter is used, // but the user can set this field to use a custom getter if that is // desired. OsStackTraceGetterInterface* os_stack_trace_getter_; // True iff PostFlagParsingInit() has been called. bool post_flag_parse_init_performed_; // The random number seed used at the beginning of the test run. int random_seed_; // Our random number generator. internal::Random random_; // The time of the test program start, in ms from the start of the // UNIX epoch. TimeInMillis start_timestamp_; // How long the test took to run, in milliseconds. TimeInMillis elapsed_time_; #if GTEST_HAS_DEATH_TEST // The decomposed components of the gtest_internal_run_death_test flag, // parsed when RUN_ALL_TESTS is called. internal::scoped_ptr internal_run_death_test_flag_; internal::scoped_ptr death_test_factory_; #endif // GTEST_HAS_DEATH_TEST // A per-thread stack of traces created by the SCOPED_TRACE() macro. internal::ThreadLocal > gtest_trace_stack_; // The value of GTEST_FLAG(catch_exceptions) at the moment RunAllTests() // starts. bool catch_exceptions_; GTEST_DISALLOW_COPY_AND_ASSIGN_(UnitTestImpl); }; // class UnitTestImpl // Convenience function for accessing the global UnitTest // implementation object. inline UnitTestImpl* GetUnitTestImpl() { return UnitTest::GetInstance()->impl(); } #if GTEST_USES_SIMPLE_RE // Internal helper functions for implementing the simple regular // expression matcher. GTEST_API_ bool IsInSet(char ch, const char* str); GTEST_API_ bool IsAsciiDigit(char ch); GTEST_API_ bool IsAsciiPunct(char ch); GTEST_API_ bool IsRepeat(char ch); GTEST_API_ bool IsAsciiWhiteSpace(char ch); GTEST_API_ bool IsAsciiWordChar(char ch); GTEST_API_ bool IsValidEscape(char ch); GTEST_API_ bool AtomMatchesChar(bool escaped, char pattern, char ch); GTEST_API_ bool ValidateRegex(const char* regex); GTEST_API_ bool MatchRegexAtHead(const char* regex, const char* str); GTEST_API_ bool MatchRepetitionAndRegexAtHead( bool escaped, char ch, char repeat, const char* regex, const char* str); GTEST_API_ bool MatchRegexAnywhere(const char* regex, const char* str); #endif // GTEST_USES_SIMPLE_RE // Parses the command line for Google Test flags, without initializing // other parts of Google Test. GTEST_API_ void ParseGoogleTestFlagsOnly(int* argc, char** argv); GTEST_API_ void ParseGoogleTestFlagsOnly(int* argc, wchar_t** argv); #if GTEST_HAS_DEATH_TEST // Returns the message describing the last system error, regardless of the // platform. GTEST_API_ std::string GetLastErrnoDescription(); // Attempts to parse a string into a positive integer pointed to by the // number parameter. Returns true if that is possible. // GTEST_HAS_DEATH_TEST implies that we have ::std::string, so we can use // it here. template bool ParseNaturalNumber(const ::std::string& str, Integer* number) { // Fail fast if the given string does not begin with a digit; // this bypasses strtoXXX's "optional leading whitespace and plus // or minus sign" semantics, which are undesirable here. if (str.empty() || !IsDigit(str[0])) { return false; } errno = 0; char* end; // BiggestConvertible is the largest integer type that system-provided // string-to-number conversion routines can return. # if GTEST_OS_WINDOWS && !defined(__GNUC__) // MSVC and C++ Builder define __int64 instead of the standard long long. typedef unsigned __int64 BiggestConvertible; const BiggestConvertible parsed = _strtoui64(str.c_str(), &end, 10); # else typedef unsigned long long BiggestConvertible; // NOLINT const BiggestConvertible parsed = strtoull(str.c_str(), &end, 10); # endif // GTEST_OS_WINDOWS && !defined(__GNUC__) const bool parse_success = *end == '\0' && errno == 0; // FIXME: Convert this to compile time assertion when it is // available. GTEST_CHECK_(sizeof(Integer) <= sizeof(parsed)); const Integer result = static_cast(parsed); if (parse_success && static_cast(result) == parsed) { *number = result; return true; } return false; } #endif // GTEST_HAS_DEATH_TEST // TestResult contains some private methods that should be hidden from // Google Test user but are required for testing. This class allow our tests // to access them. // // This class is supplied only for the purpose of testing Google Test's own // constructs. Do not use it in user tests, either directly or indirectly. class TestResultAccessor { public: static void RecordProperty(TestResult* test_result, const std::string& xml_element, const TestProperty& property) { test_result->RecordProperty(xml_element, property); } static void ClearTestPartResults(TestResult* test_result) { test_result->ClearTestPartResults(); } static const std::vector& test_part_results( const TestResult& test_result) { return test_result.test_part_results(); } }; #if GTEST_CAN_STREAM_RESULTS_ // Streams test results to the given port on the given host machine. class StreamingListener : public EmptyTestEventListener { public: // Abstract base class for writing strings to a socket. class AbstractSocketWriter { public: virtual ~AbstractSocketWriter() {} // Sends a string to the socket. virtual void Send(const std::string& message) = 0; // Closes the socket. virtual void CloseConnection() {} // Sends a string and a newline to the socket. void SendLn(const std::string& message) { Send(message + "\n"); } }; // Concrete class for actually writing strings to a socket. class SocketWriter : public AbstractSocketWriter { public: SocketWriter(const std::string& host, const std::string& port) : sockfd_(-1), host_name_(host), port_num_(port) { MakeConnection(); } virtual ~SocketWriter() { if (sockfd_ != -1) CloseConnection(); } // Sends a string to the socket. virtual void Send(const std::string& message) { GTEST_CHECK_(sockfd_ != -1) << "Send() can be called only when there is a connection."; const int len = static_cast(message.length()); if (write(sockfd_, message.c_str(), len) != len) { GTEST_LOG_(WARNING) << "stream_result_to: failed to stream to " << host_name_ << ":" << port_num_; } } private: // Creates a client socket and connects to the server. void MakeConnection(); // Closes the socket. void CloseConnection() { GTEST_CHECK_(sockfd_ != -1) << "CloseConnection() can be called only when there is a connection."; close(sockfd_); sockfd_ = -1; } int sockfd_; // socket file descriptor const std::string host_name_; const std::string port_num_; GTEST_DISALLOW_COPY_AND_ASSIGN_(SocketWriter); }; // class SocketWriter // Escapes '=', '&', '%', and '\n' characters in str as "%xx". static std::string UrlEncode(const char* str); StreamingListener(const std::string& host, const std::string& port) : socket_writer_(new SocketWriter(host, port)) { Start(); } explicit StreamingListener(AbstractSocketWriter* socket_writer) : socket_writer_(socket_writer) { Start(); } void OnTestProgramStart(const UnitTest& /* unit_test */) { SendLn("event=TestProgramStart"); } void OnTestProgramEnd(const UnitTest& unit_test) { // Note that Google Test current only report elapsed time for each // test iteration, not for the entire test program. SendLn("event=TestProgramEnd&passed=" + FormatBool(unit_test.Passed())); // Notify the streaming server to stop. socket_writer_->CloseConnection(); } void OnTestIterationStart(const UnitTest& /* unit_test */, int iteration) { SendLn("event=TestIterationStart&iteration=" + StreamableToString(iteration)); } void OnTestIterationEnd(const UnitTest& unit_test, int /* iteration */) { SendLn("event=TestIterationEnd&passed=" + FormatBool(unit_test.Passed()) + "&elapsed_time=" + StreamableToString(unit_test.elapsed_time()) + "ms"); } void OnTestCaseStart(const TestCase& test_case) { SendLn(std::string("event=TestCaseStart&name=") + test_case.name()); } void OnTestCaseEnd(const TestCase& test_case) { SendLn("event=TestCaseEnd&passed=" + FormatBool(test_case.Passed()) + "&elapsed_time=" + StreamableToString(test_case.elapsed_time()) + "ms"); } void OnTestStart(const TestInfo& test_info) { SendLn(std::string("event=TestStart&name=") + test_info.name()); } void OnTestEnd(const TestInfo& test_info) { SendLn("event=TestEnd&passed=" + FormatBool((test_info.result())->Passed()) + "&elapsed_time=" + StreamableToString((test_info.result())->elapsed_time()) + "ms"); } void OnTestPartResult(const TestPartResult& test_part_result) { const char* file_name = test_part_result.file_name(); if (file_name == NULL) file_name = ""; SendLn("event=TestPartResult&file=" + UrlEncode(file_name) + "&line=" + StreamableToString(test_part_result.line_number()) + "&message=" + UrlEncode(test_part_result.message())); } private: // Sends the given message and a newline to the socket. void SendLn(const std::string& message) { socket_writer_->SendLn(message); } // Called at the start of streaming to notify the receiver what // protocol we are using. void Start() { SendLn("gtest_streaming_protocol_version=1.0"); } std::string FormatBool(bool value) { return value ? "1" : "0"; } const scoped_ptr socket_writer_; GTEST_DISALLOW_COPY_AND_ASSIGN_(StreamingListener); }; // class StreamingListener #endif // GTEST_CAN_STREAM_RESULTS_ } // namespace internal } // namespace testing GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251 #endif // GTEST_SRC_GTEST_INTERNAL_INL_H_ iptux-0.9.4/src/googletest/src/gtest-port.cc000066400000000000000000001267531475473122500210760ustar00rootroot00000000000000// Copyright 2008, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "gtest/internal/gtest-port.h" #include #include #include #include #include #if GTEST_OS_WINDOWS # include # include # include # include // Used in ThreadLocal. #else # include #endif // GTEST_OS_WINDOWS #if GTEST_OS_MAC # include # include # include #endif // GTEST_OS_MAC #if GTEST_OS_QNX # include # include # include #endif // GTEST_OS_QNX #if GTEST_OS_AIX # include # include #endif // GTEST_OS_AIX #if GTEST_OS_FUCHSIA # include # include #endif // GTEST_OS_FUCHSIA #include "gtest/gtest-spi.h" #include "gtest/gtest-message.h" #include "gtest/internal/gtest-internal.h" #include "gtest/internal/gtest-string.h" #include "src/gtest-internal-inl.h" namespace testing { namespace internal { #if defined(_MSC_VER) || defined(__BORLANDC__) // MSVC and C++Builder do not provide a definition of STDERR_FILENO. const int kStdOutFileno = 1; const int kStdErrFileno = 2; #else const int kStdOutFileno = STDOUT_FILENO; const int kStdErrFileno = STDERR_FILENO; #endif // _MSC_VER #if GTEST_OS_LINUX namespace { template T ReadProcFileField(const std::string& filename, int field) { std::string dummy; std::ifstream file(filename.c_str()); while (field-- > 0) { file >> dummy; } T output = 0; file >> output; return output; } } // namespace // Returns the number of active threads, or 0 when there is an error. size_t GetThreadCount() { const std::string filename = (Message() << "/proc/" << getpid() << "/stat").GetString(); return ReadProcFileField(filename, 19); } #elif GTEST_OS_MAC size_t GetThreadCount() { const task_t task = mach_task_self(); mach_msg_type_number_t thread_count; thread_act_array_t thread_list; const kern_return_t status = task_threads(task, &thread_list, &thread_count); if (status == KERN_SUCCESS) { // task_threads allocates resources in thread_list and we need to free them // to avoid leaks. vm_deallocate(task, reinterpret_cast(thread_list), sizeof(thread_t) * thread_count); return static_cast(thread_count); } else { return 0; } } #elif GTEST_OS_QNX // Returns the number of threads running in the process, or 0 to indicate that // we cannot detect it. size_t GetThreadCount() { const int fd = open("/proc/self/as", O_RDONLY); if (fd < 0) { return 0; } procfs_info process_info; const int status = devctl(fd, DCMD_PROC_INFO, &process_info, sizeof(process_info), NULL); close(fd); if (status == EOK) { return static_cast(process_info.num_threads); } else { return 0; } } #elif GTEST_OS_AIX size_t GetThreadCount() { struct procentry64 entry; pid_t pid = getpid(); int status = getprocs64(&entry, sizeof(entry), NULL, 0, &pid, 1); if (status == 1) { return entry.pi_thcount; } else { return 0; } } #elif GTEST_OS_FUCHSIA size_t GetThreadCount() { int dummy_buffer; size_t avail; zx_status_t status = zx_object_get_info( zx_process_self(), ZX_INFO_PROCESS_THREADS, &dummy_buffer, 0, nullptr, &avail); if (status == ZX_OK) { return avail; } else { return 0; } } #else size_t GetThreadCount() { // There's no portable way to detect the number of threads, so we just // return 0 to indicate that we cannot detect it. return 0; } #endif // GTEST_OS_LINUX #if GTEST_IS_THREADSAFE && GTEST_OS_WINDOWS void SleepMilliseconds(int n) { ::Sleep(n); } AutoHandle::AutoHandle() : handle_(INVALID_HANDLE_VALUE) {} AutoHandle::AutoHandle(Handle handle) : handle_(handle) {} AutoHandle::~AutoHandle() { Reset(); } AutoHandle::Handle AutoHandle::Get() const { return handle_; } void AutoHandle::Reset() { Reset(INVALID_HANDLE_VALUE); } void AutoHandle::Reset(HANDLE handle) { // Resetting with the same handle we already own is invalid. if (handle_ != handle) { if (IsCloseable()) { ::CloseHandle(handle_); } handle_ = handle; } else { GTEST_CHECK_(!IsCloseable()) << "Resetting a valid handle to itself is likely a programmer error " "and thus not allowed."; } } bool AutoHandle::IsCloseable() const { // Different Windows APIs may use either of these values to represent an // invalid handle. return handle_ != NULL && handle_ != INVALID_HANDLE_VALUE; } Notification::Notification() : event_(::CreateEvent(NULL, // Default security attributes. TRUE, // Do not reset automatically. FALSE, // Initially unset. NULL)) { // Anonymous event. GTEST_CHECK_(event_.Get() != NULL); } void Notification::Notify() { GTEST_CHECK_(::SetEvent(event_.Get()) != FALSE); } void Notification::WaitForNotification() { GTEST_CHECK_( ::WaitForSingleObject(event_.Get(), INFINITE) == WAIT_OBJECT_0); } Mutex::Mutex() : owner_thread_id_(0), type_(kDynamic), critical_section_init_phase_(0), critical_section_(new CRITICAL_SECTION) { ::InitializeCriticalSection(critical_section_); } Mutex::~Mutex() { // Static mutexes are leaked intentionally. It is not thread-safe to try // to clean them up. // FIXME: Switch to Slim Reader/Writer (SRW) Locks, which requires // nothing to clean it up but is available only on Vista and later. // https://docs.microsoft.com/en-us/windows/desktop/Sync/slim-reader-writer--srw--locks if (type_ == kDynamic) { ::DeleteCriticalSection(critical_section_); delete critical_section_; critical_section_ = NULL; } } void Mutex::Lock() { ThreadSafeLazyInit(); ::EnterCriticalSection(critical_section_); owner_thread_id_ = ::GetCurrentThreadId(); } void Mutex::Unlock() { ThreadSafeLazyInit(); // We don't protect writing to owner_thread_id_ here, as it's the // caller's responsibility to ensure that the current thread holds the // mutex when this is called. owner_thread_id_ = 0; ::LeaveCriticalSection(critical_section_); } // Does nothing if the current thread holds the mutex. Otherwise, crashes // with high probability. void Mutex::AssertHeld() { ThreadSafeLazyInit(); GTEST_CHECK_(owner_thread_id_ == ::GetCurrentThreadId()) << "The current thread is not holding the mutex @" << this; } namespace { // Use the RAII idiom to flag mem allocs that are intentionally never // deallocated. The motivation is to silence the false positive mem leaks // that are reported by the debug version of MS's CRT which can only detect // if an alloc is missing a matching deallocation. // Example: // MemoryIsNotDeallocated memory_is_not_deallocated; // critical_section_ = new CRITICAL_SECTION; // class MemoryIsNotDeallocated { public: MemoryIsNotDeallocated() : old_crtdbg_flag_(0) { #ifdef _MSC_VER old_crtdbg_flag_ = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG); // Set heap allocation block type to _IGNORE_BLOCK so that MS debug CRT // doesn't report mem leak if there's no matching deallocation. _CrtSetDbgFlag(old_crtdbg_flag_ & ~_CRTDBG_ALLOC_MEM_DF); #endif // _MSC_VER } ~MemoryIsNotDeallocated() { #ifdef _MSC_VER // Restore the original _CRTDBG_ALLOC_MEM_DF flag _CrtSetDbgFlag(old_crtdbg_flag_); #endif // _MSC_VER } private: int old_crtdbg_flag_; GTEST_DISALLOW_COPY_AND_ASSIGN_(MemoryIsNotDeallocated); }; } // namespace // Initializes owner_thread_id_ and critical_section_ in static mutexes. void Mutex::ThreadSafeLazyInit() { // Dynamic mutexes are initialized in the constructor. if (type_ == kStatic) { switch ( ::InterlockedCompareExchange(&critical_section_init_phase_, 1L, 0L)) { case 0: // If critical_section_init_phase_ was 0 before the exchange, we // are the first to test it and need to perform the initialization. owner_thread_id_ = 0; { // Use RAII to flag that following mem alloc is never deallocated. MemoryIsNotDeallocated memory_is_not_deallocated; critical_section_ = new CRITICAL_SECTION; } ::InitializeCriticalSection(critical_section_); // Updates the critical_section_init_phase_ to 2 to signal // initialization complete. GTEST_CHECK_(::InterlockedCompareExchange( &critical_section_init_phase_, 2L, 1L) == 1L); break; case 1: // Somebody else is already initializing the mutex; spin until they // are done. while (::InterlockedCompareExchange(&critical_section_init_phase_, 2L, 2L) != 2L) { // Possibly yields the rest of the thread's time slice to other // threads. ::Sleep(0); } break; case 2: break; // The mutex is already initialized and ready for use. default: GTEST_CHECK_(false) << "Unexpected value of critical_section_init_phase_ " << "while initializing a static mutex."; } } } namespace { class ThreadWithParamSupport : public ThreadWithParamBase { public: static HANDLE CreateThread(Runnable* runnable, Notification* thread_can_start) { ThreadMainParam* param = new ThreadMainParam(runnable, thread_can_start); DWORD thread_id; // FIXME: Consider to use _beginthreadex instead. HANDLE thread_handle = ::CreateThread( NULL, // Default security. 0, // Default stack size. &ThreadWithParamSupport::ThreadMain, param, // Parameter to ThreadMainStatic 0x0, // Default creation flags. &thread_id); // Need a valid pointer for the call to work under Win98. GTEST_CHECK_(thread_handle != NULL) << "CreateThread failed with error " << ::GetLastError() << "."; if (thread_handle == NULL) { delete param; } return thread_handle; } private: struct ThreadMainParam { ThreadMainParam(Runnable* runnable, Notification* thread_can_start) : runnable_(runnable), thread_can_start_(thread_can_start) { } scoped_ptr runnable_; // Does not own. Notification* thread_can_start_; }; static DWORD WINAPI ThreadMain(void* ptr) { // Transfers ownership. scoped_ptr param(static_cast(ptr)); if (param->thread_can_start_ != NULL) param->thread_can_start_->WaitForNotification(); param->runnable_->Run(); return 0; } // Prohibit instantiation. ThreadWithParamSupport(); GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadWithParamSupport); }; } // namespace ThreadWithParamBase::ThreadWithParamBase(Runnable *runnable, Notification* thread_can_start) : thread_(ThreadWithParamSupport::CreateThread(runnable, thread_can_start)) { } ThreadWithParamBase::~ThreadWithParamBase() { Join(); } void ThreadWithParamBase::Join() { GTEST_CHECK_(::WaitForSingleObject(thread_.Get(), INFINITE) == WAIT_OBJECT_0) << "Failed to join the thread with error " << ::GetLastError() << "."; } // Maps a thread to a set of ThreadIdToThreadLocals that have values // instantiated on that thread and notifies them when the thread exits. A // ThreadLocal instance is expected to persist until all threads it has // values on have terminated. class ThreadLocalRegistryImpl { public: // Registers thread_local_instance as having value on the current thread. // Returns a value that can be used to identify the thread from other threads. static ThreadLocalValueHolderBase* GetValueOnCurrentThread( const ThreadLocalBase* thread_local_instance) { DWORD current_thread = ::GetCurrentThreadId(); MutexLock lock(&mutex_); ThreadIdToThreadLocals* const thread_to_thread_locals = GetThreadLocalsMapLocked(); ThreadIdToThreadLocals::iterator thread_local_pos = thread_to_thread_locals->find(current_thread); if (thread_local_pos == thread_to_thread_locals->end()) { thread_local_pos = thread_to_thread_locals->insert( std::make_pair(current_thread, ThreadLocalValues())).first; StartWatcherThreadFor(current_thread); } ThreadLocalValues& thread_local_values = thread_local_pos->second; ThreadLocalValues::iterator value_pos = thread_local_values.find(thread_local_instance); if (value_pos == thread_local_values.end()) { value_pos = thread_local_values .insert(std::make_pair( thread_local_instance, linked_ptr( thread_local_instance->NewValueForCurrentThread()))) .first; } return value_pos->second.get(); } static void OnThreadLocalDestroyed( const ThreadLocalBase* thread_local_instance) { std::vector > value_holders; // Clean up the ThreadLocalValues data structure while holding the lock, but // defer the destruction of the ThreadLocalValueHolderBases. { MutexLock lock(&mutex_); ThreadIdToThreadLocals* const thread_to_thread_locals = GetThreadLocalsMapLocked(); for (ThreadIdToThreadLocals::iterator it = thread_to_thread_locals->begin(); it != thread_to_thread_locals->end(); ++it) { ThreadLocalValues& thread_local_values = it->second; ThreadLocalValues::iterator value_pos = thread_local_values.find(thread_local_instance); if (value_pos != thread_local_values.end()) { value_holders.push_back(value_pos->second); thread_local_values.erase(value_pos); // This 'if' can only be successful at most once, so theoretically we // could break out of the loop here, but we don't bother doing so. } } } // Outside the lock, let the destructor for 'value_holders' deallocate the // ThreadLocalValueHolderBases. } static void OnThreadExit(DWORD thread_id) { GTEST_CHECK_(thread_id != 0) << ::GetLastError(); std::vector > value_holders; // Clean up the ThreadIdToThreadLocals data structure while holding the // lock, but defer the destruction of the ThreadLocalValueHolderBases. { MutexLock lock(&mutex_); ThreadIdToThreadLocals* const thread_to_thread_locals = GetThreadLocalsMapLocked(); ThreadIdToThreadLocals::iterator thread_local_pos = thread_to_thread_locals->find(thread_id); if (thread_local_pos != thread_to_thread_locals->end()) { ThreadLocalValues& thread_local_values = thread_local_pos->second; for (ThreadLocalValues::iterator value_pos = thread_local_values.begin(); value_pos != thread_local_values.end(); ++value_pos) { value_holders.push_back(value_pos->second); } thread_to_thread_locals->erase(thread_local_pos); } } // Outside the lock, let the destructor for 'value_holders' deallocate the // ThreadLocalValueHolderBases. } private: // In a particular thread, maps a ThreadLocal object to its value. typedef std::map > ThreadLocalValues; // Stores all ThreadIdToThreadLocals having values in a thread, indexed by // thread's ID. typedef std::map ThreadIdToThreadLocals; // Holds the thread id and thread handle that we pass from // StartWatcherThreadFor to WatcherThreadFunc. typedef std::pair ThreadIdAndHandle; static void StartWatcherThreadFor(DWORD thread_id) { // The returned handle will be kept in thread_map and closed by // watcher_thread in WatcherThreadFunc. HANDLE thread = ::OpenThread(SYNCHRONIZE | THREAD_QUERY_INFORMATION, FALSE, thread_id); GTEST_CHECK_(thread != NULL); // We need to pass a valid thread ID pointer into CreateThread for it // to work correctly under Win98. DWORD watcher_thread_id; HANDLE watcher_thread = ::CreateThread( NULL, // Default security. 0, // Default stack size &ThreadLocalRegistryImpl::WatcherThreadFunc, reinterpret_cast(new ThreadIdAndHandle(thread_id, thread)), CREATE_SUSPENDED, &watcher_thread_id); GTEST_CHECK_(watcher_thread != NULL); // Give the watcher thread the same priority as ours to avoid being // blocked by it. ::SetThreadPriority(watcher_thread, ::GetThreadPriority(::GetCurrentThread())); ::ResumeThread(watcher_thread); ::CloseHandle(watcher_thread); } // Monitors exit from a given thread and notifies those // ThreadIdToThreadLocals about thread termination. static DWORD WINAPI WatcherThreadFunc(LPVOID param) { const ThreadIdAndHandle* tah = reinterpret_cast(param); GTEST_CHECK_( ::WaitForSingleObject(tah->second, INFINITE) == WAIT_OBJECT_0); OnThreadExit(tah->first); ::CloseHandle(tah->second); delete tah; return 0; } // Returns map of thread local instances. static ThreadIdToThreadLocals* GetThreadLocalsMapLocked() { mutex_.AssertHeld(); MemoryIsNotDeallocated memory_is_not_deallocated; static ThreadIdToThreadLocals* map = new ThreadIdToThreadLocals(); return map; } // Protects access to GetThreadLocalsMapLocked() and its return value. static Mutex mutex_; // Protects access to GetThreadMapLocked() and its return value. static Mutex thread_map_mutex_; }; Mutex ThreadLocalRegistryImpl::mutex_(Mutex::kStaticMutex); Mutex ThreadLocalRegistryImpl::thread_map_mutex_(Mutex::kStaticMutex); ThreadLocalValueHolderBase* ThreadLocalRegistry::GetValueOnCurrentThread( const ThreadLocalBase* thread_local_instance) { return ThreadLocalRegistryImpl::GetValueOnCurrentThread( thread_local_instance); } void ThreadLocalRegistry::OnThreadLocalDestroyed( const ThreadLocalBase* thread_local_instance) { ThreadLocalRegistryImpl::OnThreadLocalDestroyed(thread_local_instance); } #endif // GTEST_IS_THREADSAFE && GTEST_OS_WINDOWS #if GTEST_USES_POSIX_RE // Implements RE. Currently only needed for death tests. RE::~RE() { if (is_valid_) { // regfree'ing an invalid regex might crash because the content // of the regex is undefined. Since the regex's are essentially // the same, one cannot be valid (or invalid) without the other // being so too. regfree(&partial_regex_); regfree(&full_regex_); } free(const_cast(pattern_)); } // Returns true iff regular expression re matches the entire str. bool RE::FullMatch(const char* str, const RE& re) { if (!re.is_valid_) return false; regmatch_t match; return regexec(&re.full_regex_, str, 1, &match, 0) == 0; } // Returns true iff regular expression re matches a substring of str // (including str itself). bool RE::PartialMatch(const char* str, const RE& re) { if (!re.is_valid_) return false; regmatch_t match; return regexec(&re.partial_regex_, str, 1, &match, 0) == 0; } // Initializes an RE from its string representation. void RE::Init(const char* regex) { pattern_ = posix::StrDup(regex); // Reserves enough bytes to hold the regular expression used for a // full match. const size_t full_regex_len = strlen(regex) + 10; char* const full_pattern = new char[full_regex_len]; snprintf(full_pattern, full_regex_len, "^(%s)$", regex); is_valid_ = regcomp(&full_regex_, full_pattern, REG_EXTENDED) == 0; // We want to call regcomp(&partial_regex_, ...) even if the // previous expression returns false. Otherwise partial_regex_ may // not be properly initialized can may cause trouble when it's // freed. // // Some implementation of POSIX regex (e.g. on at least some // versions of Cygwin) doesn't accept the empty string as a valid // regex. We change it to an equivalent form "()" to be safe. if (is_valid_) { const char* const partial_regex = (*regex == '\0') ? "()" : regex; is_valid_ = regcomp(&partial_regex_, partial_regex, REG_EXTENDED) == 0; } EXPECT_TRUE(is_valid_) << "Regular expression \"" << regex << "\" is not a valid POSIX Extended regular expression."; delete[] full_pattern; } #elif GTEST_USES_SIMPLE_RE // Returns true iff ch appears anywhere in str (excluding the // terminating '\0' character). bool IsInSet(char ch, const char* str) { return ch != '\0' && strchr(str, ch) != NULL; } // Returns true iff ch belongs to the given classification. Unlike // similar functions in , these aren't affected by the // current locale. bool IsAsciiDigit(char ch) { return '0' <= ch && ch <= '9'; } bool IsAsciiPunct(char ch) { return IsInSet(ch, "^-!\"#$%&'()*+,./:;<=>?@[\\]_`{|}~"); } bool IsRepeat(char ch) { return IsInSet(ch, "?*+"); } bool IsAsciiWhiteSpace(char ch) { return IsInSet(ch, " \f\n\r\t\v"); } bool IsAsciiWordChar(char ch) { return ('a' <= ch && ch <= 'z') || ('A' <= ch && ch <= 'Z') || ('0' <= ch && ch <= '9') || ch == '_'; } // Returns true iff "\\c" is a supported escape sequence. bool IsValidEscape(char c) { return (IsAsciiPunct(c) || IsInSet(c, "dDfnrsStvwW")); } // Returns true iff the given atom (specified by escaped and pattern) // matches ch. The result is undefined if the atom is invalid. bool AtomMatchesChar(bool escaped, char pattern_char, char ch) { if (escaped) { // "\\p" where p is pattern_char. switch (pattern_char) { case 'd': return IsAsciiDigit(ch); case 'D': return !IsAsciiDigit(ch); case 'f': return ch == '\f'; case 'n': return ch == '\n'; case 'r': return ch == '\r'; case 's': return IsAsciiWhiteSpace(ch); case 'S': return !IsAsciiWhiteSpace(ch); case 't': return ch == '\t'; case 'v': return ch == '\v'; case 'w': return IsAsciiWordChar(ch); case 'W': return !IsAsciiWordChar(ch); } return IsAsciiPunct(pattern_char) && pattern_char == ch; } return (pattern_char == '.' && ch != '\n') || pattern_char == ch; } // Helper function used by ValidateRegex() to format error messages. static std::string FormatRegexSyntaxError(const char* regex, int index) { return (Message() << "Syntax error at index " << index << " in simple regular expression \"" << regex << "\": ").GetString(); } // Generates non-fatal failures and returns false if regex is invalid; // otherwise returns true. bool ValidateRegex(const char* regex) { if (regex == NULL) { // FIXME: fix the source file location in the // assertion failures to match where the regex is used in user // code. ADD_FAILURE() << "NULL is not a valid simple regular expression."; return false; } bool is_valid = true; // True iff ?, *, or + can follow the previous atom. bool prev_repeatable = false; for (int i = 0; regex[i]; i++) { if (regex[i] == '\\') { // An escape sequence i++; if (regex[i] == '\0') { ADD_FAILURE() << FormatRegexSyntaxError(regex, i - 1) << "'\\' cannot appear at the end."; return false; } if (!IsValidEscape(regex[i])) { ADD_FAILURE() << FormatRegexSyntaxError(regex, i - 1) << "invalid escape sequence \"\\" << regex[i] << "\"."; is_valid = false; } prev_repeatable = true; } else { // Not an escape sequence. const char ch = regex[i]; if (ch == '^' && i > 0) { ADD_FAILURE() << FormatRegexSyntaxError(regex, i) << "'^' can only appear at the beginning."; is_valid = false; } else if (ch == '$' && regex[i + 1] != '\0') { ADD_FAILURE() << FormatRegexSyntaxError(regex, i) << "'$' can only appear at the end."; is_valid = false; } else if (IsInSet(ch, "()[]{}|")) { ADD_FAILURE() << FormatRegexSyntaxError(regex, i) << "'" << ch << "' is unsupported."; is_valid = false; } else if (IsRepeat(ch) && !prev_repeatable) { ADD_FAILURE() << FormatRegexSyntaxError(regex, i) << "'" << ch << "' can only follow a repeatable token."; is_valid = false; } prev_repeatable = !IsInSet(ch, "^$?*+"); } } return is_valid; } // Matches a repeated regex atom followed by a valid simple regular // expression. The regex atom is defined as c if escaped is false, // or \c otherwise. repeat is the repetition meta character (?, *, // or +). The behavior is undefined if str contains too many // characters to be indexable by size_t, in which case the test will // probably time out anyway. We are fine with this limitation as // std::string has it too. bool MatchRepetitionAndRegexAtHead( bool escaped, char c, char repeat, const char* regex, const char* str) { const size_t min_count = (repeat == '+') ? 1 : 0; const size_t max_count = (repeat == '?') ? 1 : static_cast(-1) - 1; // We cannot call numeric_limits::max() as it conflicts with the // max() macro on Windows. for (size_t i = 0; i <= max_count; ++i) { // We know that the atom matches each of the first i characters in str. if (i >= min_count && MatchRegexAtHead(regex, str + i)) { // We have enough matches at the head, and the tail matches too. // Since we only care about *whether* the pattern matches str // (as opposed to *how* it matches), there is no need to find a // greedy match. return true; } if (str[i] == '\0' || !AtomMatchesChar(escaped, c, str[i])) return false; } return false; } // Returns true iff regex matches a prefix of str. regex must be a // valid simple regular expression and not start with "^", or the // result is undefined. bool MatchRegexAtHead(const char* regex, const char* str) { if (*regex == '\0') // An empty regex matches a prefix of anything. return true; // "$" only matches the end of a string. Note that regex being // valid guarantees that there's nothing after "$" in it. if (*regex == '$') return *str == '\0'; // Is the first thing in regex an escape sequence? const bool escaped = *regex == '\\'; if (escaped) ++regex; if (IsRepeat(regex[1])) { // MatchRepetitionAndRegexAtHead() calls MatchRegexAtHead(), so // here's an indirect recursion. It terminates as the regex gets // shorter in each recursion. return MatchRepetitionAndRegexAtHead( escaped, regex[0], regex[1], regex + 2, str); } else { // regex isn't empty, isn't "$", and doesn't start with a // repetition. We match the first atom of regex with the first // character of str and recurse. return (*str != '\0') && AtomMatchesChar(escaped, *regex, *str) && MatchRegexAtHead(regex + 1, str + 1); } } // Returns true iff regex matches any substring of str. regex must be // a valid simple regular expression, or the result is undefined. // // The algorithm is recursive, but the recursion depth doesn't exceed // the regex length, so we won't need to worry about running out of // stack space normally. In rare cases the time complexity can be // exponential with respect to the regex length + the string length, // but usually it's must faster (often close to linear). bool MatchRegexAnywhere(const char* regex, const char* str) { if (regex == NULL || str == NULL) return false; if (*regex == '^') return MatchRegexAtHead(regex + 1, str); // A successful match can be anywhere in str. do { if (MatchRegexAtHead(regex, str)) return true; } while (*str++ != '\0'); return false; } // Implements the RE class. RE::~RE() { free(const_cast(pattern_)); free(const_cast(full_pattern_)); } // Returns true iff regular expression re matches the entire str. bool RE::FullMatch(const char* str, const RE& re) { return re.is_valid_ && MatchRegexAnywhere(re.full_pattern_, str); } // Returns true iff regular expression re matches a substring of str // (including str itself). bool RE::PartialMatch(const char* str, const RE& re) { return re.is_valid_ && MatchRegexAnywhere(re.pattern_, str); } // Initializes an RE from its string representation. void RE::Init(const char* regex) { pattern_ = full_pattern_ = NULL; if (regex != NULL) { pattern_ = posix::StrDup(regex); } is_valid_ = ValidateRegex(regex); if (!is_valid_) { // No need to calculate the full pattern when the regex is invalid. return; } const size_t len = strlen(regex); // Reserves enough bytes to hold the regular expression used for a // full match: we need space to prepend a '^', append a '$', and // terminate the string with '\0'. char* buffer = static_cast(malloc(len + 3)); full_pattern_ = buffer; if (*regex != '^') *buffer++ = '^'; // Makes sure full_pattern_ starts with '^'. // We don't use snprintf or strncpy, as they trigger a warning when // compiled with VC++ 8.0. memcpy(buffer, regex, len); buffer += len; if (len == 0 || regex[len - 1] != '$') *buffer++ = '$'; // Makes sure full_pattern_ ends with '$'. *buffer = '\0'; } #endif // GTEST_USES_POSIX_RE const char kUnknownFile[] = "unknown file"; // Formats a source file path and a line number as they would appear // in an error message from the compiler used to compile this code. GTEST_API_ ::std::string FormatFileLocation(const char* file, int line) { const std::string file_name(file == NULL ? kUnknownFile : file); if (line < 0) { return file_name + ":"; } #ifdef _MSC_VER return file_name + "(" + StreamableToString(line) + "):"; #else return file_name + ":" + StreamableToString(line) + ":"; #endif // _MSC_VER } // Formats a file location for compiler-independent XML output. // Although this function is not platform dependent, we put it next to // FormatFileLocation in order to contrast the two functions. // Note that FormatCompilerIndependentFileLocation() does NOT append colon // to the file location it produces, unlike FormatFileLocation(). GTEST_API_ ::std::string FormatCompilerIndependentFileLocation( const char* file, int line) { const std::string file_name(file == NULL ? kUnknownFile : file); if (line < 0) return file_name; else return file_name + ":" + StreamableToString(line); } GTestLog::GTestLog(GTestLogSeverity severity, const char* file, int line) : severity_(severity) { const char* const marker = severity == GTEST_INFO ? "[ INFO ]" : severity == GTEST_WARNING ? "[WARNING]" : severity == GTEST_ERROR ? "[ ERROR ]" : "[ FATAL ]"; GetStream() << ::std::endl << marker << " " << FormatFileLocation(file, line).c_str() << ": "; } // Flushes the buffers and, if severity is GTEST_FATAL, aborts the program. GTestLog::~GTestLog() { GetStream() << ::std::endl; if (severity_ == GTEST_FATAL) { fflush(stderr); posix::Abort(); } } // Disable Microsoft deprecation warnings for POSIX functions called from // this class (creat, dup, dup2, and close) GTEST_DISABLE_MSC_DEPRECATED_PUSH_() #if GTEST_HAS_STREAM_REDIRECTION // Object that captures an output stream (stdout/stderr). class CapturedStream { public: // The ctor redirects the stream to a temporary file. explicit CapturedStream(int fd) : fd_(fd), uncaptured_fd_(dup(fd)) { # if GTEST_OS_WINDOWS char temp_dir_path[MAX_PATH + 1] = { '\0' }; // NOLINT char temp_file_path[MAX_PATH + 1] = { '\0' }; // NOLINT ::GetTempPathA(sizeof(temp_dir_path), temp_dir_path); const UINT success = ::GetTempFileNameA(temp_dir_path, "gtest_redir", 0, // Generate unique file name. temp_file_path); GTEST_CHECK_(success != 0) << "Unable to create a temporary file in " << temp_dir_path; const int captured_fd = creat(temp_file_path, _S_IREAD | _S_IWRITE); GTEST_CHECK_(captured_fd != -1) << "Unable to open temporary file " << temp_file_path; filename_ = temp_file_path; # else // There's no guarantee that a test has write access to the current // directory, so we create the temporary file in the /tmp directory // instead. We use /tmp on most systems, and /sdcard on Android. // That's because Android doesn't have /tmp. # if GTEST_OS_LINUX_ANDROID // Note: Android applications are expected to call the framework's // Context.getExternalStorageDirectory() method through JNI to get // the location of the world-writable SD Card directory. However, // this requires a Context handle, which cannot be retrieved // globally from native code. Doing so also precludes running the // code as part of a regular standalone executable, which doesn't // run in a Dalvik process (e.g. when running it through 'adb shell'). // // The location /sdcard is directly accessible from native code // and is the only location (unofficially) supported by the Android // team. It's generally a symlink to the real SD Card mount point // which can be /mnt/sdcard, /mnt/sdcard0, /system/media/sdcard, or // other OEM-customized locations. Never rely on these, and always // use /sdcard. char name_template[] = "/sdcard/gtest_captured_stream.XXXXXX"; # else char name_template[] = "/tmp/captured_stream.XXXXXX"; # endif // GTEST_OS_LINUX_ANDROID const int captured_fd = mkstemp(name_template); filename_ = name_template; # endif // GTEST_OS_WINDOWS fflush(NULL); dup2(captured_fd, fd_); close(captured_fd); } ~CapturedStream() { remove(filename_.c_str()); } std::string GetCapturedString() { if (uncaptured_fd_ != -1) { // Restores the original stream. fflush(NULL); dup2(uncaptured_fd_, fd_); close(uncaptured_fd_); uncaptured_fd_ = -1; } FILE* const file = posix::FOpen(filename_.c_str(), "r"); const std::string content = ReadEntireFile(file); posix::FClose(file); return content; } private: const int fd_; // A stream to capture. int uncaptured_fd_; // Name of the temporary file holding the stderr output. ::std::string filename_; GTEST_DISALLOW_COPY_AND_ASSIGN_(CapturedStream); }; GTEST_DISABLE_MSC_DEPRECATED_POP_() static CapturedStream* g_captured_stderr = NULL; static CapturedStream* g_captured_stdout = NULL; // Starts capturing an output stream (stdout/stderr). static void CaptureStream(int fd, const char* stream_name, CapturedStream** stream) { if (*stream != NULL) { GTEST_LOG_(FATAL) << "Only one " << stream_name << " capturer can exist at a time."; } *stream = new CapturedStream(fd); } // Stops capturing the output stream and returns the captured string. static std::string GetCapturedStream(CapturedStream** captured_stream) { const std::string content = (*captured_stream)->GetCapturedString(); delete *captured_stream; *captured_stream = NULL; return content; } // Starts capturing stdout. void CaptureStdout() { CaptureStream(kStdOutFileno, "stdout", &g_captured_stdout); } // Starts capturing stderr. void CaptureStderr() { CaptureStream(kStdErrFileno, "stderr", &g_captured_stderr); } // Stops capturing stdout and returns the captured string. std::string GetCapturedStdout() { return GetCapturedStream(&g_captured_stdout); } // Stops capturing stderr and returns the captured string. std::string GetCapturedStderr() { return GetCapturedStream(&g_captured_stderr); } #endif // GTEST_HAS_STREAM_REDIRECTION size_t GetFileSize(FILE* file) { fseek(file, 0, SEEK_END); return static_cast(ftell(file)); } std::string ReadEntireFile(FILE* file) { const size_t file_size = GetFileSize(file); char* const buffer = new char[file_size]; size_t bytes_last_read = 0; // # of bytes read in the last fread() size_t bytes_read = 0; // # of bytes read so far fseek(file, 0, SEEK_SET); // Keeps reading the file until we cannot read further or the // pre-determined file size is reached. do { bytes_last_read = fread(buffer+bytes_read, 1, file_size-bytes_read, file); bytes_read += bytes_last_read; } while (bytes_last_read > 0 && bytes_read < file_size); const std::string content(buffer, bytes_read); delete[] buffer; return content; } #if GTEST_HAS_DEATH_TEST static const std::vector* g_injected_test_argvs = NULL; // Owned. std::vector GetInjectableArgvs() { if (g_injected_test_argvs != NULL) { return *g_injected_test_argvs; } return GetArgvs(); } void SetInjectableArgvs(const std::vector* new_argvs) { if (g_injected_test_argvs != new_argvs) delete g_injected_test_argvs; g_injected_test_argvs = new_argvs; } void SetInjectableArgvs(const std::vector& new_argvs) { SetInjectableArgvs( new std::vector(new_argvs.begin(), new_argvs.end())); } #if GTEST_HAS_GLOBAL_STRING void SetInjectableArgvs(const std::vector< ::string>& new_argvs) { SetInjectableArgvs( new std::vector(new_argvs.begin(), new_argvs.end())); } #endif // GTEST_HAS_GLOBAL_STRING void ClearInjectableArgvs() { delete g_injected_test_argvs; g_injected_test_argvs = NULL; } #endif // GTEST_HAS_DEATH_TEST #if GTEST_OS_WINDOWS_MOBILE namespace posix { void Abort() { DebugBreak(); TerminateProcess(GetCurrentProcess(), 1); } } // namespace posix #endif // GTEST_OS_WINDOWS_MOBILE // Returns the name of the environment variable corresponding to the // given flag. For example, FlagToEnvVar("foo") will return // "GTEST_FOO" in the open-source version. static std::string FlagToEnvVar(const char* flag) { const std::string full_flag = (Message() << GTEST_FLAG_PREFIX_ << flag).GetString(); Message env_var; for (size_t i = 0; i != full_flag.length(); i++) { env_var << ToUpper(full_flag.c_str()[i]); } return env_var.GetString(); } // Parses 'str' for a 32-bit signed integer. If successful, writes // the result to *value and returns true; otherwise leaves *value // unchanged and returns false. bool ParseInt32(const Message& src_text, const char* str, Int32* value) { // Parses the environment variable as a decimal integer. char* end = NULL; const long long_value = strtol(str, &end, 10); // NOLINT // Has strtol() consumed all characters in the string? if (*end != '\0') { // No - an invalid character was encountered. Message msg; msg << "WARNING: " << src_text << " is expected to be a 32-bit integer, but actually" << " has value \"" << str << "\".\n"; printf("%s", msg.GetString().c_str()); fflush(stdout); return false; } // Is the parsed value in the range of an Int32? const Int32 result = static_cast(long_value); if (long_value == LONG_MAX || long_value == LONG_MIN || // The parsed value overflows as a long. (strtol() returns // LONG_MAX or LONG_MIN when the input overflows.) result != long_value // The parsed value overflows as an Int32. ) { Message msg; msg << "WARNING: " << src_text << " is expected to be a 32-bit integer, but actually" << " has value " << str << ", which overflows.\n"; printf("%s", msg.GetString().c_str()); fflush(stdout); return false; } *value = result; return true; } // Reads and returns the Boolean environment variable corresponding to // the given flag; if it's not set, returns default_value. // // The value is considered true iff it's not "0". bool BoolFromGTestEnv(const char* flag, bool default_value) { #if defined(GTEST_GET_BOOL_FROM_ENV_) return GTEST_GET_BOOL_FROM_ENV_(flag, default_value); #else const std::string env_var = FlagToEnvVar(flag); const char* const string_value = posix::GetEnv(env_var.c_str()); return string_value == NULL ? default_value : strcmp(string_value, "0") != 0; #endif // defined(GTEST_GET_BOOL_FROM_ENV_) } // Reads and returns a 32-bit integer stored in the environment // variable corresponding to the given flag; if it isn't set or // doesn't represent a valid 32-bit integer, returns default_value. Int32 Int32FromGTestEnv(const char* flag, Int32 default_value) { #if defined(GTEST_GET_INT32_FROM_ENV_) return GTEST_GET_INT32_FROM_ENV_(flag, default_value); #else const std::string env_var = FlagToEnvVar(flag); const char* const string_value = posix::GetEnv(env_var.c_str()); if (string_value == NULL) { // The environment variable is not set. return default_value; } Int32 result = default_value; if (!ParseInt32(Message() << "Environment variable " << env_var, string_value, &result)) { printf("The default value %s is used.\n", (Message() << default_value).GetString().c_str()); fflush(stdout); return default_value; } return result; #endif // defined(GTEST_GET_INT32_FROM_ENV_) } // As a special case for the 'output' flag, if GTEST_OUTPUT is not // set, we look for XML_OUTPUT_FILE, which is set by the Bazel build // system. The value of XML_OUTPUT_FILE is a filename without the // "xml:" prefix of GTEST_OUTPUT. // Note that this is meant to be called at the call site so it does // not check that the flag is 'output' // In essence this checks an env variable called XML_OUTPUT_FILE // and if it is set we prepend "xml:" to its value, if it not set we return "" std::string OutputFlagAlsoCheckEnvVar(){ std::string default_value_for_output_flag = ""; const char* xml_output_file_env = posix::GetEnv("XML_OUTPUT_FILE"); if (NULL != xml_output_file_env) { default_value_for_output_flag = std::string("xml:") + xml_output_file_env; } return default_value_for_output_flag; } // Reads and returns the string environment variable corresponding to // the given flag; if it's not set, returns default_value. const char* StringFromGTestEnv(const char* flag, const char* default_value) { #if defined(GTEST_GET_STRING_FROM_ENV_) return GTEST_GET_STRING_FROM_ENV_(flag, default_value); #else const std::string env_var = FlagToEnvVar(flag); const char* const value = posix::GetEnv(env_var.c_str()); return value == NULL ? default_value : value; #endif // defined(GTEST_GET_STRING_FROM_ENV_) } } // namespace internal } // namespace testing iptux-0.9.4/src/googletest/src/gtest-printers.cc000066400000000000000000000354661475473122500217600ustar00rootroot00000000000000// Copyright 2007, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // Google Test - The Google C++ Testing and Mocking Framework // // This file implements a universal value printer that can print a // value of any type T: // // void ::testing::internal::UniversalPrinter::Print(value, ostream_ptr); // // It uses the << operator when possible, and prints the bytes in the // object otherwise. A user can override its behavior for a class // type Foo by defining either operator<<(::std::ostream&, const Foo&) // or void PrintTo(const Foo&, ::std::ostream*) in the namespace that // defines Foo. #include "gtest/gtest-printers.h" #include #include #include #include // NOLINT #include #include "gtest/internal/gtest-port.h" #include "src/gtest-internal-inl.h" namespace testing { namespace { using ::std::ostream; // Prints a segment of bytes in the given object. GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_ GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_ GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_ void PrintByteSegmentInObjectTo(const unsigned char* obj_bytes, size_t start, size_t count, ostream* os) { char text[5] = ""; for (size_t i = 0; i != count; i++) { const size_t j = start + i; if (i != 0) { // Organizes the bytes into groups of 2 for easy parsing by // human. if ((j % 2) == 0) *os << ' '; else *os << '-'; } GTEST_SNPRINTF_(text, sizeof(text), "%02X", obj_bytes[j]); *os << text; } } // Prints the bytes in the given value to the given ostream. void PrintBytesInObjectToImpl(const unsigned char* obj_bytes, size_t count, ostream* os) { // Tells the user how big the object is. *os << count << "-byte object <"; const size_t kThreshold = 132; const size_t kChunkSize = 64; // If the object size is bigger than kThreshold, we'll have to omit // some details by printing only the first and the last kChunkSize // bytes. // FIXME: let the user control the threshold using a flag. if (count < kThreshold) { PrintByteSegmentInObjectTo(obj_bytes, 0, count, os); } else { PrintByteSegmentInObjectTo(obj_bytes, 0, kChunkSize, os); *os << " ... "; // Rounds up to 2-byte boundary. const size_t resume_pos = (count - kChunkSize + 1)/2*2; PrintByteSegmentInObjectTo(obj_bytes, resume_pos, count - resume_pos, os); } *os << ">"; } } // namespace namespace internal2 { // Delegates to PrintBytesInObjectToImpl() to print the bytes in the // given object. The delegation simplifies the implementation, which // uses the << operator and thus is easier done outside of the // ::testing::internal namespace, which contains a << operator that // sometimes conflicts with the one in STL. void PrintBytesInObjectTo(const unsigned char* obj_bytes, size_t count, ostream* os) { PrintBytesInObjectToImpl(obj_bytes, count, os); } } // namespace internal2 namespace internal { // Depending on the value of a char (or wchar_t), we print it in one // of three formats: // - as is if it's a printable ASCII (e.g. 'a', '2', ' '), // - as a hexadecimal escape sequence (e.g. '\x7F'), or // - as a special escape sequence (e.g. '\r', '\n'). enum CharFormat { kAsIs, kHexEscape, kSpecialEscape }; // Returns true if c is a printable ASCII character. We test the // value of c directly instead of calling isprint(), which is buggy on // Windows Mobile. inline bool IsPrintableAscii(wchar_t c) { return 0x20 <= c && c <= 0x7E; } // Prints a wide or narrow char c as a character literal without the // quotes, escaping it when necessary; returns how c was formatted. // The template argument UnsignedChar is the unsigned version of Char, // which is the type of c. template static CharFormat PrintAsCharLiteralTo(Char c, ostream* os) { switch (static_cast(c)) { case L'\0': *os << "\\0"; break; case L'\'': *os << "\\'"; break; case L'\\': *os << "\\\\"; break; case L'\a': *os << "\\a"; break; case L'\b': *os << "\\b"; break; case L'\f': *os << "\\f"; break; case L'\n': *os << "\\n"; break; case L'\r': *os << "\\r"; break; case L'\t': *os << "\\t"; break; case L'\v': *os << "\\v"; break; default: if (IsPrintableAscii(c)) { *os << static_cast(c); return kAsIs; } else { ostream::fmtflags flags = os->flags(); *os << "\\x" << std::hex << std::uppercase << static_cast(static_cast(c)); os->flags(flags); return kHexEscape; } } return kSpecialEscape; } // Prints a wchar_t c as if it's part of a string literal, escaping it when // necessary; returns how c was formatted. static CharFormat PrintAsStringLiteralTo(wchar_t c, ostream* os) { switch (c) { case L'\'': *os << "'"; return kAsIs; case L'"': *os << "\\\""; return kSpecialEscape; default: return PrintAsCharLiteralTo(c, os); } } // Prints a char c as if it's part of a string literal, escaping it when // necessary; returns how c was formatted. static CharFormat PrintAsStringLiteralTo(char c, ostream* os) { return PrintAsStringLiteralTo( static_cast(static_cast(c)), os); } // Prints a wide or narrow character c and its code. '\0' is printed // as "'\\0'", other unprintable characters are also properly escaped // using the standard C++ escape sequence. The template argument // UnsignedChar is the unsigned version of Char, which is the type of c. template void PrintCharAndCodeTo(Char c, ostream* os) { // First, print c as a literal in the most readable form we can find. *os << ((sizeof(c) > 1) ? "L'" : "'"); const CharFormat format = PrintAsCharLiteralTo(c, os); *os << "'"; // To aid user debugging, we also print c's code in decimal, unless // it's 0 (in which case c was printed as '\\0', making the code // obvious). if (c == 0) return; *os << " (" << static_cast(c); // For more convenience, we print c's code again in hexadecimal, // unless c was already printed in the form '\x##' or the code is in // [1, 9]. if (format == kHexEscape || (1 <= c && c <= 9)) { // Do nothing. } else { *os << ", 0x" << String::FormatHexInt(static_cast(c)); } *os << ")"; } void PrintTo(unsigned char c, ::std::ostream* os) { PrintCharAndCodeTo(c, os); } void PrintTo(signed char c, ::std::ostream* os) { PrintCharAndCodeTo(c, os); } // Prints a wchar_t as a symbol if it is printable or as its internal // code otherwise and also as its code. L'\0' is printed as "L'\\0'". void PrintTo(wchar_t wc, ostream* os) { PrintCharAndCodeTo(wc, os); } // Prints the given array of characters to the ostream. CharType must be either // char or wchar_t. // The array starts at begin, the length is len, it may include '\0' characters // and may not be NUL-terminated. template GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_ GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_ GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_ static CharFormat PrintCharsAsStringTo( const CharType* begin, size_t len, ostream* os) { const char* const kQuoteBegin = sizeof(CharType) == 1 ? "\"" : "L\""; *os << kQuoteBegin; bool is_previous_hex = false; CharFormat print_format = kAsIs; for (size_t index = 0; index < len; ++index) { const CharType cur = begin[index]; if (is_previous_hex && IsXDigit(cur)) { // Previous character is of '\x..' form and this character can be // interpreted as another hexadecimal digit in its number. Break string to // disambiguate. *os << "\" " << kQuoteBegin; } is_previous_hex = PrintAsStringLiteralTo(cur, os) == kHexEscape; // Remember if any characters required hex escaping. if (is_previous_hex) { print_format = kHexEscape; } } *os << "\""; return print_format; } // Prints a (const) char/wchar_t array of 'len' elements, starting at address // 'begin'. CharType must be either char or wchar_t. template GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_ GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_ GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_ static void UniversalPrintCharArray( const CharType* begin, size_t len, ostream* os) { // The code // const char kFoo[] = "foo"; // generates an array of 4, not 3, elements, with the last one being '\0'. // // Therefore when printing a char array, we don't print the last element if // it's '\0', such that the output matches the string literal as it's // written in the source code. if (len > 0 && begin[len - 1] == '\0') { PrintCharsAsStringTo(begin, len - 1, os); return; } // If, however, the last element in the array is not '\0', e.g. // const char kFoo[] = { 'f', 'o', 'o' }; // we must print the entire array. We also print a message to indicate // that the array is not NUL-terminated. PrintCharsAsStringTo(begin, len, os); *os << " (no terminating NUL)"; } // Prints a (const) char array of 'len' elements, starting at address 'begin'. void UniversalPrintArray(const char* begin, size_t len, ostream* os) { UniversalPrintCharArray(begin, len, os); } // Prints a (const) wchar_t array of 'len' elements, starting at address // 'begin'. void UniversalPrintArray(const wchar_t* begin, size_t len, ostream* os) { UniversalPrintCharArray(begin, len, os); } // Prints the given C string to the ostream. void PrintTo(const char* s, ostream* os) { if (s == NULL) { *os << "NULL"; } else { *os << ImplicitCast_(s) << " pointing to "; PrintCharsAsStringTo(s, strlen(s), os); } } // MSVC compiler can be configured to define whar_t as a typedef // of unsigned short. Defining an overload for const wchar_t* in that case // would cause pointers to unsigned shorts be printed as wide strings, // possibly accessing more memory than intended and causing invalid // memory accesses. MSVC defines _NATIVE_WCHAR_T_DEFINED symbol when // wchar_t is implemented as a native type. #if !defined(_MSC_VER) || defined(_NATIVE_WCHAR_T_DEFINED) // Prints the given wide C string to the ostream. void PrintTo(const wchar_t* s, ostream* os) { if (s == NULL) { *os << "NULL"; } else { *os << ImplicitCast_(s) << " pointing to "; PrintCharsAsStringTo(s, std::wcslen(s), os); } } #endif // wchar_t is native namespace { bool ContainsUnprintableControlCodes(const char* str, size_t length) { const unsigned char *s = reinterpret_cast(str); for (size_t i = 0; i < length; i++) { unsigned char ch = *s++; if (std::iscntrl(ch)) { switch (ch) { case '\t': case '\n': case '\r': break; default: return true; } } } return false; } bool IsUTF8TrailByte(unsigned char t) { return 0x80 <= t && t<= 0xbf; } bool IsValidUTF8(const char* str, size_t length) { const unsigned char *s = reinterpret_cast(str); for (size_t i = 0; i < length;) { unsigned char lead = s[i++]; if (lead <= 0x7f) { continue; // single-byte character (ASCII) 0..7F } if (lead < 0xc2) { return false; // trail byte or non-shortest form } else if (lead <= 0xdf && (i + 1) <= length && IsUTF8TrailByte(s[i])) { ++i; // 2-byte character } else if (0xe0 <= lead && lead <= 0xef && (i + 2) <= length && IsUTF8TrailByte(s[i]) && IsUTF8TrailByte(s[i + 1]) && // check for non-shortest form and surrogate (lead != 0xe0 || s[i] >= 0xa0) && (lead != 0xed || s[i] < 0xa0)) { i += 2; // 3-byte character } else if (0xf0 <= lead && lead <= 0xf4 && (i + 3) <= length && IsUTF8TrailByte(s[i]) && IsUTF8TrailByte(s[i + 1]) && IsUTF8TrailByte(s[i + 2]) && // check for non-shortest form (lead != 0xf0 || s[i] >= 0x90) && (lead != 0xf4 || s[i] < 0x90)) { i += 3; // 4-byte character } else { return false; } } return true; } void ConditionalPrintAsText(const char* str, size_t length, ostream* os) { if (!ContainsUnprintableControlCodes(str, length) && IsValidUTF8(str, length)) { *os << "\n As Text: \"" << str << "\""; } } } // anonymous namespace // Prints a ::string object. #if GTEST_HAS_GLOBAL_STRING void PrintStringTo(const ::string& s, ostream* os) { if (PrintCharsAsStringTo(s.data(), s.size(), os) == kHexEscape) { if (GTEST_FLAG(print_utf8)) { ConditionalPrintAsText(s.data(), s.size(), os); } } } #endif // GTEST_HAS_GLOBAL_STRING void PrintStringTo(const ::std::string& s, ostream* os) { if (PrintCharsAsStringTo(s.data(), s.size(), os) == kHexEscape) { if (GTEST_FLAG(print_utf8)) { ConditionalPrintAsText(s.data(), s.size(), os); } } } // Prints a ::wstring object. #if GTEST_HAS_GLOBAL_WSTRING void PrintWideStringTo(const ::wstring& s, ostream* os) { PrintCharsAsStringTo(s.data(), s.size(), os); } #endif // GTEST_HAS_GLOBAL_WSTRING #if GTEST_HAS_STD_WSTRING void PrintWideStringTo(const ::std::wstring& s, ostream* os) { PrintCharsAsStringTo(s.data(), s.size(), os); } #endif // GTEST_HAS_STD_WSTRING } // namespace internal } // namespace testing iptux-0.9.4/src/googletest/src/gtest-test-part.cc000066400000000000000000000073111475473122500220210ustar00rootroot00000000000000// Copyright 2008, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // The Google C++ Testing and Mocking Framework (Google Test) #include "gtest/gtest-test-part.h" #include "src/gtest-internal-inl.h" namespace testing { using internal::GetUnitTestImpl; // Gets the summary of the failure message by omitting the stack trace // in it. std::string TestPartResult::ExtractSummary(const char* message) { const char* const stack_trace = strstr(message, internal::kStackTraceMarker); return stack_trace == NULL ? message : std::string(message, stack_trace); } // Prints a TestPartResult object. std::ostream& operator<<(std::ostream& os, const TestPartResult& result) { return os << result.file_name() << ":" << result.line_number() << ": " << (result.type() == TestPartResult::kSuccess ? "Success" : result.type() == TestPartResult::kFatalFailure ? "Fatal failure" : "Non-fatal failure") << ":\n" << result.message() << std::endl; } // Appends a TestPartResult to the array. void TestPartResultArray::Append(const TestPartResult& result) { array_.push_back(result); } // Returns the TestPartResult at the given index (0-based). const TestPartResult& TestPartResultArray::GetTestPartResult(int index) const { if (index < 0 || index >= size()) { printf("\nInvalid index (%d) into TestPartResultArray.\n", index); internal::posix::Abort(); } return array_[index]; } // Returns the number of TestPartResult objects in the array. int TestPartResultArray::size() const { return static_cast(array_.size()); } namespace internal { HasNewFatalFailureHelper::HasNewFatalFailureHelper() : has_new_fatal_failure_(false), original_reporter_(GetUnitTestImpl()-> GetTestPartResultReporterForCurrentThread()) { GetUnitTestImpl()->SetTestPartResultReporterForCurrentThread(this); } HasNewFatalFailureHelper::~HasNewFatalFailureHelper() { GetUnitTestImpl()->SetTestPartResultReporterForCurrentThread( original_reporter_); } void HasNewFatalFailureHelper::ReportTestPartResult( const TestPartResult& result) { if (result.fatally_failed()) has_new_fatal_failure_ = true; original_reporter_->ReportTestPartResult(result); } } // namespace internal } // namespace testing iptux-0.9.4/src/googletest/src/gtest-typed-test.cc000066400000000000000000000075161475473122500222070ustar00rootroot00000000000000// Copyright 2008 Google Inc. // All Rights Reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "gtest/gtest-typed-test.h" #include "gtest/gtest.h" namespace testing { namespace internal { #if GTEST_HAS_TYPED_TEST_P // Skips to the first non-space char in str. Returns an empty string if str // contains only whitespace characters. static const char* SkipSpaces(const char* str) { while (IsSpace(*str)) str++; return str; } static std::vector SplitIntoTestNames(const char* src) { std::vector name_vec; src = SkipSpaces(src); for (; src != NULL; src = SkipComma(src)) { name_vec.push_back(StripTrailingSpaces(GetPrefixUntilComma(src))); } return name_vec; } // Verifies that registered_tests match the test names in // registered_tests_; returns registered_tests if successful, or // aborts the program otherwise. const char* TypedTestCasePState::VerifyRegisteredTestNames( const char* file, int line, const char* registered_tests) { typedef RegisteredTestsMap::const_iterator RegisteredTestIter; registered_ = true; std::vector name_vec = SplitIntoTestNames(registered_tests); Message errors; std::set tests; for (std::vector::const_iterator name_it = name_vec.begin(); name_it != name_vec.end(); ++name_it) { const std::string& name = *name_it; if (tests.count(name) != 0) { errors << "Test " << name << " is listed more than once.\n"; continue; } bool found = false; for (RegisteredTestIter it = registered_tests_.begin(); it != registered_tests_.end(); ++it) { if (name == it->first) { found = true; break; } } if (found) { tests.insert(name); } else { errors << "No test named " << name << " can be found in this test case.\n"; } } for (RegisteredTestIter it = registered_tests_.begin(); it != registered_tests_.end(); ++it) { if (tests.count(it->first) == 0) { errors << "You forgot to list test " << it->first << ".\n"; } } const std::string& errors_str = errors.GetString(); if (errors_str != "") { fprintf(stderr, "%s %s", FormatFileLocation(file, line).c_str(), errors_str.c_str()); fflush(stderr); posix::Abort(); } return registered_tests; } #endif // GTEST_HAS_TYPED_TEST_P } // namespace internal } // namespace testing iptux-0.9.4/src/googletest/src/gtest.cc000066400000000000000000006513251475473122500201120ustar00rootroot00000000000000// Copyright 2005, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // The Google C++ Testing and Mocking Framework (Google Test) #include "gtest/gtest.h" #include "gtest/internal/custom/gtest.h" #include "gtest/gtest-spi.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include // NOLINT #include #include #if GTEST_OS_LINUX // FIXME: Use autoconf to detect availability of // gettimeofday(). # define GTEST_HAS_GETTIMEOFDAY_ 1 # include // NOLINT # include // NOLINT # include // NOLINT // Declares vsnprintf(). This header is not available on Windows. # include // NOLINT # include // NOLINT # include // NOLINT # include // NOLINT # include #elif GTEST_OS_SYMBIAN # define GTEST_HAS_GETTIMEOFDAY_ 1 # include // NOLINT #elif GTEST_OS_ZOS # define GTEST_HAS_GETTIMEOFDAY_ 1 # include // NOLINT // On z/OS we additionally need strings.h for strcasecmp. # include // NOLINT #elif GTEST_OS_WINDOWS_MOBILE // We are on Windows CE. # include // NOLINT # undef min #elif GTEST_OS_WINDOWS // We are on Windows proper. # include // NOLINT # include // NOLINT # include // NOLINT # include // NOLINT # if GTEST_OS_WINDOWS_MINGW // MinGW has gettimeofday() but not _ftime64(). // FIXME: Use autoconf to detect availability of // gettimeofday(). // FIXME: There are other ways to get the time on // Windows, like GetTickCount() or GetSystemTimeAsFileTime(). MinGW // supports these. consider using them instead. # define GTEST_HAS_GETTIMEOFDAY_ 1 # include // NOLINT # endif // GTEST_OS_WINDOWS_MINGW // cpplint thinks that the header is already included, so we want to // silence it. # include // NOLINT # undef min #else // Assume other platforms have gettimeofday(). // FIXME: Use autoconf to detect availability of // gettimeofday(). # define GTEST_HAS_GETTIMEOFDAY_ 1 // cpplint thinks that the header is already included, so we want to // silence it. # include // NOLINT # include // NOLINT #endif // GTEST_OS_LINUX #if GTEST_HAS_EXCEPTIONS # include #endif #if GTEST_CAN_STREAM_RESULTS_ # include // NOLINT # include // NOLINT # include // NOLINT # include // NOLINT #endif #include "src/gtest-internal-inl.h" #if GTEST_OS_WINDOWS # define vsnprintf _vsnprintf #endif // GTEST_OS_WINDOWS #if GTEST_OS_MAC #ifndef GTEST_OS_IOS #include #endif #endif #if GTEST_HAS_ABSL #include "absl/debugging/failure_signal_handler.h" #include "absl/debugging/stacktrace.h" #include "absl/debugging/symbolize.h" #include "absl/strings/str_cat.h" #endif // GTEST_HAS_ABSL namespace testing { using internal::CountIf; using internal::ForEach; using internal::GetElementOr; using internal::Shuffle; // Constants. // A test whose test case name or test name matches this filter is // disabled and not run. static const char kDisableTestFilter[] = "DISABLED_*:*/DISABLED_*"; // A test case whose name matches this filter is considered a death // test case and will be run before test cases whose name doesn't // match this filter. static const char kDeathTestCaseFilter[] = "*DeathTest:*DeathTest/*"; // A test filter that matches everything. static const char kUniversalFilter[] = "*"; // The default output format. static const char kDefaultOutputFormat[] = "xml"; // The default output file. static const char kDefaultOutputFile[] = "test_detail"; // The environment variable name for the test shard index. static const char kTestShardIndex[] = "GTEST_SHARD_INDEX"; // The environment variable name for the total number of test shards. static const char kTestTotalShards[] = "GTEST_TOTAL_SHARDS"; // The environment variable name for the test shard status file. static const char kTestShardStatusFile[] = "GTEST_SHARD_STATUS_FILE"; namespace internal { // The text used in failure messages to indicate the start of the // stack trace. const char kStackTraceMarker[] = "\nStack trace:\n"; // g_help_flag is true iff the --help flag or an equivalent form is // specified on the command line. bool g_help_flag = false; // Utilty function to Open File for Writing static FILE* OpenFileForWriting(const std::string& output_file) { FILE* fileout = NULL; FilePath output_file_path(output_file); FilePath output_dir(output_file_path.RemoveFileName()); if (output_dir.CreateDirectoriesRecursively()) { fileout = posix::FOpen(output_file.c_str(), "w"); } if (fileout == NULL) { GTEST_LOG_(FATAL) << "Unable to open file \"" << output_file << "\""; } return fileout; } } // namespace internal // Bazel passes in the argument to '--test_filter' via the TESTBRIDGE_TEST_ONLY // environment variable. static const char* GetDefaultFilter() { const char* const testbridge_test_only = internal::posix::GetEnv("TESTBRIDGE_TEST_ONLY"); if (testbridge_test_only != NULL) { return testbridge_test_only; } return kUniversalFilter; } GTEST_DEFINE_bool_( also_run_disabled_tests, internal::BoolFromGTestEnv("also_run_disabled_tests", false), "Run disabled tests too, in addition to the tests normally being run."); GTEST_DEFINE_bool_( break_on_failure, internal::BoolFromGTestEnv("break_on_failure", false), "True iff a failed assertion should be a debugger break-point."); GTEST_DEFINE_bool_( catch_exceptions, internal::BoolFromGTestEnv("catch_exceptions", true), "True iff " GTEST_NAME_ " should catch exceptions and treat them as test failures."); GTEST_DEFINE_string_( color, internal::StringFromGTestEnv("color", "auto"), "Whether to use colors in the output. Valid values: yes, no, " "and auto. 'auto' means to use colors if the output is " "being sent to a terminal and the TERM environment variable " "is set to a terminal type that supports colors."); GTEST_DEFINE_string_( filter, internal::StringFromGTestEnv("filter", GetDefaultFilter()), "A colon-separated list of glob (not regex) patterns " "for filtering the tests to run, optionally followed by a " "'-' and a : separated list of negative patterns (tests to " "exclude). A test is run if it matches one of the positive " "patterns and does not match any of the negative patterns."); GTEST_DEFINE_bool_( install_failure_signal_handler, internal::BoolFromGTestEnv("install_failure_signal_handler", false), "If true and supported on the current platform, " GTEST_NAME_ " should " "install a signal handler that dumps debugging information when fatal " "signals are raised."); GTEST_DEFINE_bool_(list_tests, false, "List all tests without running them."); // The net priority order after flag processing is thus: // --gtest_output command line flag // GTEST_OUTPUT environment variable // XML_OUTPUT_FILE environment variable // '' GTEST_DEFINE_string_( output, internal::StringFromGTestEnv("output", internal::OutputFlagAlsoCheckEnvVar().c_str()), "A format (defaults to \"xml\" but can be specified to be \"json\"), " "optionally followed by a colon and an output file name or directory. " "A directory is indicated by a trailing pathname separator. " "Examples: \"xml:filename.xml\", \"xml::directoryname/\". " "If a directory is specified, output files will be created " "within that directory, with file-names based on the test " "executable's name and, if necessary, made unique by adding " "digits."); GTEST_DEFINE_bool_( print_time, internal::BoolFromGTestEnv("print_time", true), "True iff " GTEST_NAME_ " should display elapsed time in text output."); GTEST_DEFINE_bool_( print_utf8, internal::BoolFromGTestEnv("print_utf8", true), "True iff " GTEST_NAME_ " prints UTF8 characters as text."); GTEST_DEFINE_int32_( random_seed, internal::Int32FromGTestEnv("random_seed", 0), "Random number seed to use when shuffling test orders. Must be in range " "[1, 99999], or 0 to use a seed based on the current time."); GTEST_DEFINE_int32_( repeat, internal::Int32FromGTestEnv("repeat", 1), "How many times to repeat each test. Specify a negative number " "for repeating forever. Useful for shaking out flaky tests."); GTEST_DEFINE_bool_( show_internal_stack_frames, false, "True iff " GTEST_NAME_ " should include internal stack frames when " "printing test failure stack traces."); GTEST_DEFINE_bool_( shuffle, internal::BoolFromGTestEnv("shuffle", false), "True iff " GTEST_NAME_ " should randomize tests' order on every run."); GTEST_DEFINE_int32_( stack_trace_depth, internal::Int32FromGTestEnv("stack_trace_depth", kMaxStackTraceDepth), "The maximum number of stack frames to print when an " "assertion fails. The valid range is 0 through 100, inclusive."); GTEST_DEFINE_string_( stream_result_to, internal::StringFromGTestEnv("stream_result_to", ""), "This flag specifies the host name and the port number on which to stream " "test results. Example: \"localhost:555\". The flag is effective only on " "Linux."); GTEST_DEFINE_bool_( throw_on_failure, internal::BoolFromGTestEnv("throw_on_failure", false), "When this flag is specified, a failed assertion will throw an exception " "if exceptions are enabled or exit the program with a non-zero code " "otherwise. For use with an external test framework."); #if GTEST_USE_OWN_FLAGFILE_FLAG_ GTEST_DEFINE_string_( flagfile, internal::StringFromGTestEnv("flagfile", ""), "This flag specifies the flagfile to read command-line flags from."); #endif // GTEST_USE_OWN_FLAGFILE_FLAG_ namespace internal { // Generates a random number from [0, range), using a Linear // Congruential Generator (LCG). Crashes if 'range' is 0 or greater // than kMaxRange. UInt32 Random::Generate(UInt32 range) { // These constants are the same as are used in glibc's rand(3). // Use wider types than necessary to prevent unsigned overflow diagnostics. state_ = static_cast(1103515245ULL*state_ + 12345U) % kMaxRange; GTEST_CHECK_(range > 0) << "Cannot generate a number in the range [0, 0)."; GTEST_CHECK_(range <= kMaxRange) << "Generation of a number in [0, " << range << ") was requested, " << "but this can only generate numbers in [0, " << kMaxRange << ")."; // Converting via modulus introduces a bit of downward bias, but // it's simple, and a linear congruential generator isn't too good // to begin with. return state_ % range; } // GTestIsInitialized() returns true iff the user has initialized // Google Test. Useful for catching the user mistake of not initializing // Google Test before calling RUN_ALL_TESTS(). static bool GTestIsInitialized() { return GetArgvs().size() > 0; } // Iterates over a vector of TestCases, keeping a running sum of the // results of calling a given int-returning method on each. // Returns the sum. static int SumOverTestCaseList(const std::vector& case_list, int (TestCase::*method)() const) { int sum = 0; for (size_t i = 0; i < case_list.size(); i++) { sum += (case_list[i]->*method)(); } return sum; } // Returns true iff the test case passed. static bool TestCasePassed(const TestCase* test_case) { return test_case->should_run() && test_case->Passed(); } // Returns true iff the test case failed. static bool TestCaseFailed(const TestCase* test_case) { return test_case->should_run() && test_case->Failed(); } // Returns true iff test_case contains at least one test that should // run. static bool ShouldRunTestCase(const TestCase* test_case) { return test_case->should_run(); } // AssertHelper constructor. AssertHelper::AssertHelper(TestPartResult::Type type, const char* file, int line, const char* message) : data_(new AssertHelperData(type, file, line, message)) { } AssertHelper::~AssertHelper() { delete data_; } // Message assignment, for assertion streaming support. void AssertHelper::operator=(const Message& message) const { UnitTest::GetInstance()-> AddTestPartResult(data_->type, data_->file, data_->line, AppendUserMessage(data_->message, message), UnitTest::GetInstance()->impl() ->CurrentOsStackTraceExceptTop(1) // Skips the stack frame for this function itself. ); // NOLINT } // Mutex for linked pointers. GTEST_API_ GTEST_DEFINE_STATIC_MUTEX_(g_linked_ptr_mutex); // A copy of all command line arguments. Set by InitGoogleTest(). static ::std::vector g_argvs; ::std::vector GetArgvs() { #if defined(GTEST_CUSTOM_GET_ARGVS_) // GTEST_CUSTOM_GET_ARGVS_() may return a container of std::string or // ::string. This code converts it to the appropriate type. const auto& custom = GTEST_CUSTOM_GET_ARGVS_(); return ::std::vector(custom.begin(), custom.end()); #else // defined(GTEST_CUSTOM_GET_ARGVS_) return g_argvs; #endif // defined(GTEST_CUSTOM_GET_ARGVS_) } // Returns the current application's name, removing directory path if that // is present. FilePath GetCurrentExecutableName() { FilePath result; #if GTEST_OS_WINDOWS result.Set(FilePath(GetArgvs()[0]).RemoveExtension("exe")); #else result.Set(FilePath(GetArgvs()[0])); #endif // GTEST_OS_WINDOWS return result.RemoveDirectoryName(); } // Functions for processing the gtest_output flag. // Returns the output format, or "" for normal printed output. std::string UnitTestOptions::GetOutputFormat() { const char* const gtest_output_flag = GTEST_FLAG(output).c_str(); const char* const colon = strchr(gtest_output_flag, ':'); return (colon == NULL) ? std::string(gtest_output_flag) : std::string(gtest_output_flag, colon - gtest_output_flag); } // Returns the name of the requested output file, or the default if none // was explicitly specified. std::string UnitTestOptions::GetAbsolutePathToOutputFile() { const char* const gtest_output_flag = GTEST_FLAG(output).c_str(); std::string format = GetOutputFormat(); if (format.empty()) format = std::string(kDefaultOutputFormat); const char* const colon = strchr(gtest_output_flag, ':'); if (colon == NULL) return internal::FilePath::MakeFileName( internal::FilePath( UnitTest::GetInstance()->original_working_dir()), internal::FilePath(kDefaultOutputFile), 0, format.c_str()).string(); internal::FilePath output_name(colon + 1); if (!output_name.IsAbsolutePath()) // FIXME: on Windows \some\path is not an absolute // path (as its meaning depends on the current drive), yet the // following logic for turning it into an absolute path is wrong. // Fix it. output_name = internal::FilePath::ConcatPaths( internal::FilePath(UnitTest::GetInstance()->original_working_dir()), internal::FilePath(colon + 1)); if (!output_name.IsDirectory()) return output_name.string(); internal::FilePath result(internal::FilePath::GenerateUniqueFileName( output_name, internal::GetCurrentExecutableName(), GetOutputFormat().c_str())); return result.string(); } // Returns true iff the wildcard pattern matches the string. The // first ':' or '\0' character in pattern marks the end of it. // // This recursive algorithm isn't very efficient, but is clear and // works well enough for matching test names, which are short. bool UnitTestOptions::PatternMatchesString(const char *pattern, const char *str) { switch (*pattern) { case '\0': case ':': // Either ':' or '\0' marks the end of the pattern. return *str == '\0'; case '?': // Matches any single character. return *str != '\0' && PatternMatchesString(pattern + 1, str + 1); case '*': // Matches any string (possibly empty) of characters. return (*str != '\0' && PatternMatchesString(pattern, str + 1)) || PatternMatchesString(pattern + 1, str); default: // Non-special character. Matches itself. return *pattern == *str && PatternMatchesString(pattern + 1, str + 1); } } bool UnitTestOptions::MatchesFilter( const std::string& name, const char* filter) { const char *cur_pattern = filter; for (;;) { if (PatternMatchesString(cur_pattern, name.c_str())) { return true; } // Finds the next pattern in the filter. cur_pattern = strchr(cur_pattern, ':'); // Returns if no more pattern can be found. if (cur_pattern == NULL) { return false; } // Skips the pattern separater (the ':' character). cur_pattern++; } } // Returns true iff the user-specified filter matches the test case // name and the test name. bool UnitTestOptions::FilterMatchesTest(const std::string &test_case_name, const std::string &test_name) { const std::string& full_name = test_case_name + "." + test_name.c_str(); // Split --gtest_filter at '-', if there is one, to separate into // positive filter and negative filter portions const char* const p = GTEST_FLAG(filter).c_str(); const char* const dash = strchr(p, '-'); std::string positive; std::string negative; if (dash == NULL) { positive = GTEST_FLAG(filter).c_str(); // Whole string is a positive filter negative = ""; } else { positive = std::string(p, dash); // Everything up to the dash negative = std::string(dash + 1); // Everything after the dash if (positive.empty()) { // Treat '-test1' as the same as '*-test1' positive = kUniversalFilter; } } // A filter is a colon-separated list of patterns. It matches a // test if any pattern in it matches the test. return (MatchesFilter(full_name, positive.c_str()) && !MatchesFilter(full_name, negative.c_str())); } #if GTEST_HAS_SEH // Returns EXCEPTION_EXECUTE_HANDLER if Google Test should handle the // given SEH exception, or EXCEPTION_CONTINUE_SEARCH otherwise. // This function is useful as an __except condition. int UnitTestOptions::GTestShouldProcessSEH(DWORD exception_code) { // Google Test should handle a SEH exception if: // 1. the user wants it to, AND // 2. this is not a breakpoint exception, AND // 3. this is not a C++ exception (VC++ implements them via SEH, // apparently). // // SEH exception code for C++ exceptions. // (see http://support.microsoft.com/kb/185294 for more information). const DWORD kCxxExceptionCode = 0xe06d7363; bool should_handle = true; if (!GTEST_FLAG(catch_exceptions)) should_handle = false; else if (exception_code == EXCEPTION_BREAKPOINT) should_handle = false; else if (exception_code == kCxxExceptionCode) should_handle = false; return should_handle ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH; } #endif // GTEST_HAS_SEH } // namespace internal // The c'tor sets this object as the test part result reporter used by // Google Test. The 'result' parameter specifies where to report the // results. Intercepts only failures from the current thread. ScopedFakeTestPartResultReporter::ScopedFakeTestPartResultReporter( TestPartResultArray* result) : intercept_mode_(INTERCEPT_ONLY_CURRENT_THREAD), result_(result) { Init(); } // The c'tor sets this object as the test part result reporter used by // Google Test. The 'result' parameter specifies where to report the // results. ScopedFakeTestPartResultReporter::ScopedFakeTestPartResultReporter( InterceptMode intercept_mode, TestPartResultArray* result) : intercept_mode_(intercept_mode), result_(result) { Init(); } void ScopedFakeTestPartResultReporter::Init() { internal::UnitTestImpl* const impl = internal::GetUnitTestImpl(); if (intercept_mode_ == INTERCEPT_ALL_THREADS) { old_reporter_ = impl->GetGlobalTestPartResultReporter(); impl->SetGlobalTestPartResultReporter(this); } else { old_reporter_ = impl->GetTestPartResultReporterForCurrentThread(); impl->SetTestPartResultReporterForCurrentThread(this); } } // The d'tor restores the test part result reporter used by Google Test // before. ScopedFakeTestPartResultReporter::~ScopedFakeTestPartResultReporter() { internal::UnitTestImpl* const impl = internal::GetUnitTestImpl(); if (intercept_mode_ == INTERCEPT_ALL_THREADS) { impl->SetGlobalTestPartResultReporter(old_reporter_); } else { impl->SetTestPartResultReporterForCurrentThread(old_reporter_); } } // Increments the test part result count and remembers the result. // This method is from the TestPartResultReporterInterface interface. void ScopedFakeTestPartResultReporter::ReportTestPartResult( const TestPartResult& result) { result_->Append(result); } namespace internal { // Returns the type ID of ::testing::Test. We should always call this // instead of GetTypeId< ::testing::Test>() to get the type ID of // testing::Test. This is to work around a suspected linker bug when // using Google Test as a framework on Mac OS X. The bug causes // GetTypeId< ::testing::Test>() to return different values depending // on whether the call is from the Google Test framework itself or // from user test code. GetTestTypeId() is guaranteed to always // return the same value, as it always calls GetTypeId<>() from the // gtest.cc, which is within the Google Test framework. TypeId GetTestTypeId() { return GetTypeId(); } // The value of GetTestTypeId() as seen from within the Google Test // library. This is solely for testing GetTestTypeId(). extern const TypeId kTestTypeIdInGoogleTest = GetTestTypeId(); // This predicate-formatter checks that 'results' contains a test part // failure of the given type and that the failure message contains the // given substring. static AssertionResult HasOneFailure(const char* /* results_expr */, const char* /* type_expr */, const char* /* substr_expr */, const TestPartResultArray& results, TestPartResult::Type type, const std::string& substr) { const std::string expected(type == TestPartResult::kFatalFailure ? "1 fatal failure" : "1 non-fatal failure"); Message msg; if (results.size() != 1) { msg << "Expected: " << expected << "\n" << " Actual: " << results.size() << " failures"; for (int i = 0; i < results.size(); i++) { msg << "\n" << results.GetTestPartResult(i); } return AssertionFailure() << msg; } const TestPartResult& r = results.GetTestPartResult(0); if (r.type() != type) { return AssertionFailure() << "Expected: " << expected << "\n" << " Actual:\n" << r; } if (strstr(r.message(), substr.c_str()) == NULL) { return AssertionFailure() << "Expected: " << expected << " containing \"" << substr << "\"\n" << " Actual:\n" << r; } return AssertionSuccess(); } // The constructor of SingleFailureChecker remembers where to look up // test part results, what type of failure we expect, and what // substring the failure message should contain. SingleFailureChecker::SingleFailureChecker(const TestPartResultArray* results, TestPartResult::Type type, const std::string& substr) : results_(results), type_(type), substr_(substr) {} // The destructor of SingleFailureChecker verifies that the given // TestPartResultArray contains exactly one failure that has the given // type and contains the given substring. If that's not the case, a // non-fatal failure will be generated. SingleFailureChecker::~SingleFailureChecker() { EXPECT_PRED_FORMAT3(HasOneFailure, *results_, type_, substr_); } DefaultGlobalTestPartResultReporter::DefaultGlobalTestPartResultReporter( UnitTestImpl* unit_test) : unit_test_(unit_test) {} void DefaultGlobalTestPartResultReporter::ReportTestPartResult( const TestPartResult& result) { unit_test_->current_test_result()->AddTestPartResult(result); unit_test_->listeners()->repeater()->OnTestPartResult(result); } DefaultPerThreadTestPartResultReporter::DefaultPerThreadTestPartResultReporter( UnitTestImpl* unit_test) : unit_test_(unit_test) {} void DefaultPerThreadTestPartResultReporter::ReportTestPartResult( const TestPartResult& result) { unit_test_->GetGlobalTestPartResultReporter()->ReportTestPartResult(result); } // Returns the global test part result reporter. TestPartResultReporterInterface* UnitTestImpl::GetGlobalTestPartResultReporter() { internal::MutexLock lock(&global_test_part_result_reporter_mutex_); return global_test_part_result_repoter_; } // Sets the global test part result reporter. void UnitTestImpl::SetGlobalTestPartResultReporter( TestPartResultReporterInterface* reporter) { internal::MutexLock lock(&global_test_part_result_reporter_mutex_); global_test_part_result_repoter_ = reporter; } // Returns the test part result reporter for the current thread. TestPartResultReporterInterface* UnitTestImpl::GetTestPartResultReporterForCurrentThread() { return per_thread_test_part_result_reporter_.get(); } // Sets the test part result reporter for the current thread. void UnitTestImpl::SetTestPartResultReporterForCurrentThread( TestPartResultReporterInterface* reporter) { per_thread_test_part_result_reporter_.set(reporter); } // Gets the number of successful test cases. int UnitTestImpl::successful_test_case_count() const { return CountIf(test_cases_, TestCasePassed); } // Gets the number of failed test cases. int UnitTestImpl::failed_test_case_count() const { return CountIf(test_cases_, TestCaseFailed); } // Gets the number of all test cases. int UnitTestImpl::total_test_case_count() const { return static_cast(test_cases_.size()); } // Gets the number of all test cases that contain at least one test // that should run. int UnitTestImpl::test_case_to_run_count() const { return CountIf(test_cases_, ShouldRunTestCase); } // Gets the number of successful tests. int UnitTestImpl::successful_test_count() const { return SumOverTestCaseList(test_cases_, &TestCase::successful_test_count); } // Gets the number of failed tests. int UnitTestImpl::failed_test_count() const { return SumOverTestCaseList(test_cases_, &TestCase::failed_test_count); } // Gets the number of disabled tests that will be reported in the XML report. int UnitTestImpl::reportable_disabled_test_count() const { return SumOverTestCaseList(test_cases_, &TestCase::reportable_disabled_test_count); } // Gets the number of disabled tests. int UnitTestImpl::disabled_test_count() const { return SumOverTestCaseList(test_cases_, &TestCase::disabled_test_count); } // Gets the number of tests to be printed in the XML report. int UnitTestImpl::reportable_test_count() const { return SumOverTestCaseList(test_cases_, &TestCase::reportable_test_count); } // Gets the number of all tests. int UnitTestImpl::total_test_count() const { return SumOverTestCaseList(test_cases_, &TestCase::total_test_count); } // Gets the number of tests that should run. int UnitTestImpl::test_to_run_count() const { return SumOverTestCaseList(test_cases_, &TestCase::test_to_run_count); } // Returns the current OS stack trace as an std::string. // // The maximum number of stack frames to be included is specified by // the gtest_stack_trace_depth flag. The skip_count parameter // specifies the number of top frames to be skipped, which doesn't // count against the number of frames to be included. // // For example, if Foo() calls Bar(), which in turn calls // CurrentOsStackTraceExceptTop(1), Foo() will be included in the // trace but Bar() and CurrentOsStackTraceExceptTop() won't. std::string UnitTestImpl::CurrentOsStackTraceExceptTop(int skip_count) { return os_stack_trace_getter()->CurrentStackTrace( static_cast(GTEST_FLAG(stack_trace_depth)), skip_count + 1 // Skips the user-specified number of frames plus this function // itself. ); // NOLINT } // Returns the current time in milliseconds. TimeInMillis GetTimeInMillis() { #if GTEST_OS_WINDOWS_MOBILE || defined(__BORLANDC__) // Difference between 1970-01-01 and 1601-01-01 in milliseconds. // http://analogous.blogspot.com/2005/04/epoch.html const TimeInMillis kJavaEpochToWinFileTimeDelta = static_cast(116444736UL) * 100000UL; const DWORD kTenthMicrosInMilliSecond = 10000; SYSTEMTIME now_systime; FILETIME now_filetime; ULARGE_INTEGER now_int64; // FIXME: Shouldn't this just use // GetSystemTimeAsFileTime()? GetSystemTime(&now_systime); if (SystemTimeToFileTime(&now_systime, &now_filetime)) { now_int64.LowPart = now_filetime.dwLowDateTime; now_int64.HighPart = now_filetime.dwHighDateTime; now_int64.QuadPart = (now_int64.QuadPart / kTenthMicrosInMilliSecond) - kJavaEpochToWinFileTimeDelta; return now_int64.QuadPart; } return 0; #elif GTEST_OS_WINDOWS && !GTEST_HAS_GETTIMEOFDAY_ __timeb64 now; // MSVC 8 deprecates _ftime64(), so we want to suppress warning 4996 // (deprecated function) there. // FIXME: Use GetTickCount()? Or use // SystemTimeToFileTime() GTEST_DISABLE_MSC_DEPRECATED_PUSH_() _ftime64(&now); GTEST_DISABLE_MSC_DEPRECATED_POP_() return static_cast(now.time) * 1000 + now.millitm; #elif GTEST_HAS_GETTIMEOFDAY_ struct timeval now; gettimeofday(&now, NULL); return static_cast(now.tv_sec) * 1000 + now.tv_usec / 1000; #else # error "Don't know how to get the current time on your system." #endif } // Utilities // class String. #if GTEST_OS_WINDOWS_MOBILE // Creates a UTF-16 wide string from the given ANSI string, allocating // memory using new. The caller is responsible for deleting the return // value using delete[]. Returns the wide string, or NULL if the // input is NULL. LPCWSTR String::AnsiToUtf16(const char* ansi) { if (!ansi) return NULL; const int length = strlen(ansi); const int unicode_length = MultiByteToWideChar(CP_ACP, 0, ansi, length, NULL, 0); WCHAR* unicode = new WCHAR[unicode_length + 1]; MultiByteToWideChar(CP_ACP, 0, ansi, length, unicode, unicode_length); unicode[unicode_length] = 0; return unicode; } // Creates an ANSI string from the given wide string, allocating // memory using new. The caller is responsible for deleting the return // value using delete[]. Returns the ANSI string, or NULL if the // input is NULL. const char* String::Utf16ToAnsi(LPCWSTR utf16_str) { if (!utf16_str) return NULL; const int ansi_length = WideCharToMultiByte(CP_ACP, 0, utf16_str, -1, NULL, 0, NULL, NULL); char* ansi = new char[ansi_length + 1]; WideCharToMultiByte(CP_ACP, 0, utf16_str, -1, ansi, ansi_length, NULL, NULL); ansi[ansi_length] = 0; return ansi; } #endif // GTEST_OS_WINDOWS_MOBILE // Compares two C strings. Returns true iff they have the same content. // // Unlike strcmp(), this function can handle NULL argument(s). A NULL // C string is considered different to any non-NULL C string, // including the empty string. bool String::CStringEquals(const char * lhs, const char * rhs) { if ( lhs == NULL ) return rhs == NULL; if ( rhs == NULL ) return false; return strcmp(lhs, rhs) == 0; } #if GTEST_HAS_STD_WSTRING || GTEST_HAS_GLOBAL_WSTRING // Converts an array of wide chars to a narrow string using the UTF-8 // encoding, and streams the result to the given Message object. static void StreamWideCharsToMessage(const wchar_t* wstr, size_t length, Message* msg) { for (size_t i = 0; i != length; ) { // NOLINT if (wstr[i] != L'\0') { *msg << WideStringToUtf8(wstr + i, static_cast(length - i)); while (i != length && wstr[i] != L'\0') i++; } else { *msg << '\0'; i++; } } } #endif // GTEST_HAS_STD_WSTRING || GTEST_HAS_GLOBAL_WSTRING void SplitString(const ::std::string& str, char delimiter, ::std::vector< ::std::string>* dest) { ::std::vector< ::std::string> parsed; ::std::string::size_type pos = 0; while (::testing::internal::AlwaysTrue()) { const ::std::string::size_type colon = str.find(delimiter, pos); if (colon == ::std::string::npos) { parsed.push_back(str.substr(pos)); break; } else { parsed.push_back(str.substr(pos, colon - pos)); pos = colon + 1; } } dest->swap(parsed); } } // namespace internal // Constructs an empty Message. // We allocate the stringstream separately because otherwise each use of // ASSERT/EXPECT in a procedure adds over 200 bytes to the procedure's // stack frame leading to huge stack frames in some cases; gcc does not reuse // the stack space. Message::Message() : ss_(new ::std::stringstream) { // By default, we want there to be enough precision when printing // a double to a Message. *ss_ << std::setprecision(std::numeric_limits::digits10 + 2); } // These two overloads allow streaming a wide C string to a Message // using the UTF-8 encoding. Message& Message::operator <<(const wchar_t* wide_c_str) { return *this << internal::String::ShowWideCString(wide_c_str); } Message& Message::operator <<(wchar_t* wide_c_str) { return *this << internal::String::ShowWideCString(wide_c_str); } #if GTEST_HAS_STD_WSTRING // Converts the given wide string to a narrow string using the UTF-8 // encoding, and streams the result to this Message object. Message& Message::operator <<(const ::std::wstring& wstr) { internal::StreamWideCharsToMessage(wstr.c_str(), wstr.length(), this); return *this; } #endif // GTEST_HAS_STD_WSTRING #if GTEST_HAS_GLOBAL_WSTRING // Converts the given wide string to a narrow string using the UTF-8 // encoding, and streams the result to this Message object. Message& Message::operator <<(const ::wstring& wstr) { internal::StreamWideCharsToMessage(wstr.c_str(), wstr.length(), this); return *this; } #endif // GTEST_HAS_GLOBAL_WSTRING // Gets the text streamed to this object so far as an std::string. // Each '\0' character in the buffer is replaced with "\\0". std::string Message::GetString() const { return internal::StringStreamToString(ss_.get()); } // AssertionResult constructors. // Used in EXPECT_TRUE/FALSE(assertion_result). AssertionResult::AssertionResult(const AssertionResult& other) : success_(other.success_), message_(other.message_.get() != NULL ? new ::std::string(*other.message_) : static_cast< ::std::string*>(NULL)) { } // Swaps two AssertionResults. void AssertionResult::swap(AssertionResult& other) { using std::swap; swap(success_, other.success_); swap(message_, other.message_); } // Returns the assertion's negation. Used with EXPECT/ASSERT_FALSE. AssertionResult AssertionResult::operator!() const { AssertionResult negation(!success_); if (message_.get() != NULL) negation << *message_; return negation; } // Makes a successful assertion result. AssertionResult AssertionSuccess() { return AssertionResult(true); } // Makes a failed assertion result. AssertionResult AssertionFailure() { return AssertionResult(false); } // Makes a failed assertion result with the given failure message. // Deprecated; use AssertionFailure() << message. AssertionResult AssertionFailure(const Message& message) { return AssertionFailure() << message; } namespace internal { namespace edit_distance { std::vector CalculateOptimalEdits(const std::vector& left, const std::vector& right) { std::vector > costs( left.size() + 1, std::vector(right.size() + 1)); std::vector > best_move( left.size() + 1, std::vector(right.size() + 1)); // Populate for empty right. for (size_t l_i = 0; l_i < costs.size(); ++l_i) { costs[l_i][0] = static_cast(l_i); best_move[l_i][0] = kRemove; } // Populate for empty left. for (size_t r_i = 1; r_i < costs[0].size(); ++r_i) { costs[0][r_i] = static_cast(r_i); best_move[0][r_i] = kAdd; } for (size_t l_i = 0; l_i < left.size(); ++l_i) { for (size_t r_i = 0; r_i < right.size(); ++r_i) { if (left[l_i] == right[r_i]) { // Found a match. Consume it. costs[l_i + 1][r_i + 1] = costs[l_i][r_i]; best_move[l_i + 1][r_i + 1] = kMatch; continue; } const double add = costs[l_i + 1][r_i]; const double remove = costs[l_i][r_i + 1]; const double replace = costs[l_i][r_i]; if (add < remove && add < replace) { costs[l_i + 1][r_i + 1] = add + 1; best_move[l_i + 1][r_i + 1] = kAdd; } else if (remove < add && remove < replace) { costs[l_i + 1][r_i + 1] = remove + 1; best_move[l_i + 1][r_i + 1] = kRemove; } else { // We make replace a little more expensive than add/remove to lower // their priority. costs[l_i + 1][r_i + 1] = replace + 1.00001; best_move[l_i + 1][r_i + 1] = kReplace; } } } // Reconstruct the best path. We do it in reverse order. std::vector best_path; for (size_t l_i = left.size(), r_i = right.size(); l_i > 0 || r_i > 0;) { EditType move = best_move[l_i][r_i]; best_path.push_back(move); l_i -= move != kAdd; r_i -= move != kRemove; } std::reverse(best_path.begin(), best_path.end()); return best_path; } namespace { // Helper class to convert string into ids with deduplication. class InternalStrings { public: size_t GetId(const std::string& str) { IdMap::iterator it = ids_.find(str); if (it != ids_.end()) return it->second; size_t id = ids_.size(); return ids_[str] = id; } private: typedef std::map IdMap; IdMap ids_; }; } // namespace std::vector CalculateOptimalEdits( const std::vector& left, const std::vector& right) { std::vector left_ids, right_ids; { InternalStrings intern_table; for (size_t i = 0; i < left.size(); ++i) { left_ids.push_back(intern_table.GetId(left[i])); } for (size_t i = 0; i < right.size(); ++i) { right_ids.push_back(intern_table.GetId(right[i])); } } return CalculateOptimalEdits(left_ids, right_ids); } namespace { // Helper class that holds the state for one hunk and prints it out to the // stream. // It reorders adds/removes when possible to group all removes before all // adds. It also adds the hunk header before printint into the stream. class Hunk { public: Hunk(size_t left_start, size_t right_start) : left_start_(left_start), right_start_(right_start), adds_(), removes_(), common_() {} void PushLine(char edit, const char* line) { switch (edit) { case ' ': ++common_; FlushEdits(); hunk_.push_back(std::make_pair(' ', line)); break; case '-': ++removes_; hunk_removes_.push_back(std::make_pair('-', line)); break; case '+': ++adds_; hunk_adds_.push_back(std::make_pair('+', line)); break; } } void PrintTo(std::ostream* os) { PrintHeader(os); FlushEdits(); for (std::list >::const_iterator it = hunk_.begin(); it != hunk_.end(); ++it) { *os << it->first << it->second << "\n"; } } bool has_edits() const { return adds_ || removes_; } private: void FlushEdits() { hunk_.splice(hunk_.end(), hunk_removes_); hunk_.splice(hunk_.end(), hunk_adds_); } // Print a unified diff header for one hunk. // The format is // "@@ -, +, @@" // where the left/right parts are omitted if unnecessary. void PrintHeader(std::ostream* ss) const { *ss << "@@ "; if (removes_) { *ss << "-" << left_start_ << "," << (removes_ + common_); } if (removes_ && adds_) { *ss << " "; } if (adds_) { *ss << "+" << right_start_ << "," << (adds_ + common_); } *ss << " @@\n"; } size_t left_start_, right_start_; size_t adds_, removes_, common_; std::list > hunk_, hunk_adds_, hunk_removes_; }; } // namespace // Create a list of diff hunks in Unified diff format. // Each hunk has a header generated by PrintHeader above plus a body with // lines prefixed with ' ' for no change, '-' for deletion and '+' for // addition. // 'context' represents the desired unchanged prefix/suffix around the diff. // If two hunks are close enough that their contexts overlap, then they are // joined into one hunk. std::string CreateUnifiedDiff(const std::vector& left, const std::vector& right, size_t context) { const std::vector edits = CalculateOptimalEdits(left, right); size_t l_i = 0, r_i = 0, edit_i = 0; std::stringstream ss; while (edit_i < edits.size()) { // Find first edit. while (edit_i < edits.size() && edits[edit_i] == kMatch) { ++l_i; ++r_i; ++edit_i; } // Find the first line to include in the hunk. const size_t prefix_context = std::min(l_i, context); Hunk hunk(l_i - prefix_context + 1, r_i - prefix_context + 1); for (size_t i = prefix_context; i > 0; --i) { hunk.PushLine(' ', left[l_i - i].c_str()); } // Iterate the edits until we found enough suffix for the hunk or the input // is over. size_t n_suffix = 0; for (; edit_i < edits.size(); ++edit_i) { if (n_suffix >= context) { // Continue only if the next hunk is very close. std::vector::const_iterator it = edits.begin() + edit_i; while (it != edits.end() && *it == kMatch) ++it; if (it == edits.end() || (it - edits.begin()) - edit_i >= context) { // There is no next edit or it is too far away. break; } } EditType edit = edits[edit_i]; // Reset count when a non match is found. n_suffix = edit == kMatch ? n_suffix + 1 : 0; if (edit == kMatch || edit == kRemove || edit == kReplace) { hunk.PushLine(edit == kMatch ? ' ' : '-', left[l_i].c_str()); } if (edit == kAdd || edit == kReplace) { hunk.PushLine('+', right[r_i].c_str()); } // Advance indices, depending on edit type. l_i += edit != kAdd; r_i += edit != kRemove; } if (!hunk.has_edits()) { // We are done. We don't want this hunk. break; } hunk.PrintTo(&ss); } return ss.str(); } } // namespace edit_distance namespace { // The string representation of the values received in EqFailure() are already // escaped. Split them on escaped '\n' boundaries. Leave all other escaped // characters the same. std::vector SplitEscapedString(const std::string& str) { std::vector lines; size_t start = 0, end = str.size(); if (end > 2 && str[0] == '"' && str[end - 1] == '"') { ++start; --end; } bool escaped = false; for (size_t i = start; i + 1 < end; ++i) { if (escaped) { escaped = false; if (str[i] == 'n') { lines.push_back(str.substr(start, i - start - 1)); start = i + 1; } } else { escaped = str[i] == '\\'; } } lines.push_back(str.substr(start, end - start)); return lines; } } // namespace // Constructs and returns the message for an equality assertion // (e.g. ASSERT_EQ, EXPECT_STREQ, etc) failure. // // The first four parameters are the expressions used in the assertion // and their values, as strings. For example, for ASSERT_EQ(foo, bar) // where foo is 5 and bar is 6, we have: // // lhs_expression: "foo" // rhs_expression: "bar" // lhs_value: "5" // rhs_value: "6" // // The ignoring_case parameter is true iff the assertion is a // *_STRCASEEQ*. When it's true, the string "Ignoring case" will // be inserted into the message. AssertionResult EqFailure(const char* lhs_expression, const char* rhs_expression, const std::string& lhs_value, const std::string& rhs_value, bool ignoring_case) { Message msg; msg << "Expected equality of these values:"; msg << "\n " << lhs_expression; if (lhs_value != lhs_expression) { msg << "\n Which is: " << lhs_value; } msg << "\n " << rhs_expression; if (rhs_value != rhs_expression) { msg << "\n Which is: " << rhs_value; } if (ignoring_case) { msg << "\nIgnoring case"; } if (!lhs_value.empty() && !rhs_value.empty()) { const std::vector lhs_lines = SplitEscapedString(lhs_value); const std::vector rhs_lines = SplitEscapedString(rhs_value); if (lhs_lines.size() > 1 || rhs_lines.size() > 1) { msg << "\nWith diff:\n" << edit_distance::CreateUnifiedDiff(lhs_lines, rhs_lines); } } return AssertionFailure() << msg; } // Constructs a failure message for Boolean assertions such as EXPECT_TRUE. std::string GetBoolAssertionFailureMessage( const AssertionResult& assertion_result, const char* expression_text, const char* actual_predicate_value, const char* expected_predicate_value) { const char* actual_message = assertion_result.message(); Message msg; msg << "Value of: " << expression_text << "\n Actual: " << actual_predicate_value; if (actual_message[0] != '\0') msg << " (" << actual_message << ")"; msg << "\nExpected: " << expected_predicate_value; return msg.GetString(); } // Helper function for implementing ASSERT_NEAR. AssertionResult DoubleNearPredFormat(const char* expr1, const char* expr2, const char* abs_error_expr, double val1, double val2, double abs_error) { const double diff = fabs(val1 - val2); if (diff <= abs_error) return AssertionSuccess(); // FIXME: do not print the value of an expression if it's // already a literal. return AssertionFailure() << "The difference between " << expr1 << " and " << expr2 << " is " << diff << ", which exceeds " << abs_error_expr << ", where\n" << expr1 << " evaluates to " << val1 << ",\n" << expr2 << " evaluates to " << val2 << ", and\n" << abs_error_expr << " evaluates to " << abs_error << "."; } // Helper template for implementing FloatLE() and DoubleLE(). template AssertionResult FloatingPointLE(const char* expr1, const char* expr2, RawType val1, RawType val2) { // Returns success if val1 is less than val2, if (val1 < val2) { return AssertionSuccess(); } // or if val1 is almost equal to val2. const FloatingPoint lhs(val1), rhs(val2); if (lhs.AlmostEquals(rhs)) { return AssertionSuccess(); } // Note that the above two checks will both fail if either val1 or // val2 is NaN, as the IEEE floating-point standard requires that // any predicate involving a NaN must return false. ::std::stringstream val1_ss; val1_ss << std::setprecision(std::numeric_limits::digits10 + 2) << val1; ::std::stringstream val2_ss; val2_ss << std::setprecision(std::numeric_limits::digits10 + 2) << val2; return AssertionFailure() << "Expected: (" << expr1 << ") <= (" << expr2 << ")\n" << " Actual: " << StringStreamToString(&val1_ss) << " vs " << StringStreamToString(&val2_ss); } } // namespace internal // Asserts that val1 is less than, or almost equal to, val2. Fails // otherwise. In particular, it fails if either val1 or val2 is NaN. AssertionResult FloatLE(const char* expr1, const char* expr2, float val1, float val2) { return internal::FloatingPointLE(expr1, expr2, val1, val2); } // Asserts that val1 is less than, or almost equal to, val2. Fails // otherwise. In particular, it fails if either val1 or val2 is NaN. AssertionResult DoubleLE(const char* expr1, const char* expr2, double val1, double val2) { return internal::FloatingPointLE(expr1, expr2, val1, val2); } namespace internal { // The helper function for {ASSERT|EXPECT}_EQ with int or enum // arguments. AssertionResult CmpHelperEQ(const char* lhs_expression, const char* rhs_expression, BiggestInt lhs, BiggestInt rhs) { if (lhs == rhs) { return AssertionSuccess(); } return EqFailure(lhs_expression, rhs_expression, FormatForComparisonFailureMessage(lhs, rhs), FormatForComparisonFailureMessage(rhs, lhs), false); } // A macro for implementing the helper functions needed to implement // ASSERT_?? and EXPECT_?? with integer or enum arguments. It is here // just to avoid copy-and-paste of similar code. #define GTEST_IMPL_CMP_HELPER_(op_name, op)\ AssertionResult CmpHelper##op_name(const char* expr1, const char* expr2, \ BiggestInt val1, BiggestInt val2) {\ if (val1 op val2) {\ return AssertionSuccess();\ } else {\ return AssertionFailure() \ << "Expected: (" << expr1 << ") " #op " (" << expr2\ << "), actual: " << FormatForComparisonFailureMessage(val1, val2)\ << " vs " << FormatForComparisonFailureMessage(val2, val1);\ }\ } // Implements the helper function for {ASSERT|EXPECT}_NE with int or // enum arguments. GTEST_IMPL_CMP_HELPER_(NE, !=) // Implements the helper function for {ASSERT|EXPECT}_LE with int or // enum arguments. GTEST_IMPL_CMP_HELPER_(LE, <=) // Implements the helper function for {ASSERT|EXPECT}_LT with int or // enum arguments. GTEST_IMPL_CMP_HELPER_(LT, < ) // Implements the helper function for {ASSERT|EXPECT}_GE with int or // enum arguments. GTEST_IMPL_CMP_HELPER_(GE, >=) // Implements the helper function for {ASSERT|EXPECT}_GT with int or // enum arguments. GTEST_IMPL_CMP_HELPER_(GT, > ) #undef GTEST_IMPL_CMP_HELPER_ // The helper function for {ASSERT|EXPECT}_STREQ. AssertionResult CmpHelperSTREQ(const char* lhs_expression, const char* rhs_expression, const char* lhs, const char* rhs) { if (String::CStringEquals(lhs, rhs)) { return AssertionSuccess(); } return EqFailure(lhs_expression, rhs_expression, PrintToString(lhs), PrintToString(rhs), false); } // The helper function for {ASSERT|EXPECT}_STRCASEEQ. AssertionResult CmpHelperSTRCASEEQ(const char* lhs_expression, const char* rhs_expression, const char* lhs, const char* rhs) { if (String::CaseInsensitiveCStringEquals(lhs, rhs)) { return AssertionSuccess(); } return EqFailure(lhs_expression, rhs_expression, PrintToString(lhs), PrintToString(rhs), true); } // The helper function for {ASSERT|EXPECT}_STRNE. AssertionResult CmpHelperSTRNE(const char* s1_expression, const char* s2_expression, const char* s1, const char* s2) { if (!String::CStringEquals(s1, s2)) { return AssertionSuccess(); } else { return AssertionFailure() << "Expected: (" << s1_expression << ") != (" << s2_expression << "), actual: \"" << s1 << "\" vs \"" << s2 << "\""; } } // The helper function for {ASSERT|EXPECT}_STRCASENE. AssertionResult CmpHelperSTRCASENE(const char* s1_expression, const char* s2_expression, const char* s1, const char* s2) { if (!String::CaseInsensitiveCStringEquals(s1, s2)) { return AssertionSuccess(); } else { return AssertionFailure() << "Expected: (" << s1_expression << ") != (" << s2_expression << ") (ignoring case), actual: \"" << s1 << "\" vs \"" << s2 << "\""; } } } // namespace internal namespace { // Helper functions for implementing IsSubString() and IsNotSubstring(). // This group of overloaded functions return true iff needle is a // substring of haystack. NULL is considered a substring of itself // only. bool IsSubstringPred(const char* needle, const char* haystack) { if (needle == NULL || haystack == NULL) return needle == haystack; return strstr(haystack, needle) != NULL; } bool IsSubstringPred(const wchar_t* needle, const wchar_t* haystack) { if (needle == NULL || haystack == NULL) return needle == haystack; return wcsstr(haystack, needle) != NULL; } // StringType here can be either ::std::string or ::std::wstring. template bool IsSubstringPred(const StringType& needle, const StringType& haystack) { return haystack.find(needle) != StringType::npos; } // This function implements either IsSubstring() or IsNotSubstring(), // depending on the value of the expected_to_be_substring parameter. // StringType here can be const char*, const wchar_t*, ::std::string, // or ::std::wstring. template AssertionResult IsSubstringImpl( bool expected_to_be_substring, const char* needle_expr, const char* haystack_expr, const StringType& needle, const StringType& haystack) { if (IsSubstringPred(needle, haystack) == expected_to_be_substring) return AssertionSuccess(); const bool is_wide_string = sizeof(needle[0]) > 1; const char* const begin_string_quote = is_wide_string ? "L\"" : "\""; return AssertionFailure() << "Value of: " << needle_expr << "\n" << " Actual: " << begin_string_quote << needle << "\"\n" << "Expected: " << (expected_to_be_substring ? "" : "not ") << "a substring of " << haystack_expr << "\n" << "Which is: " << begin_string_quote << haystack << "\""; } } // namespace // IsSubstring() and IsNotSubstring() check whether needle is a // substring of haystack (NULL is considered a substring of itself // only), and return an appropriate error message when they fail. AssertionResult IsSubstring( const char* needle_expr, const char* haystack_expr, const char* needle, const char* haystack) { return IsSubstringImpl(true, needle_expr, haystack_expr, needle, haystack); } AssertionResult IsSubstring( const char* needle_expr, const char* haystack_expr, const wchar_t* needle, const wchar_t* haystack) { return IsSubstringImpl(true, needle_expr, haystack_expr, needle, haystack); } AssertionResult IsNotSubstring( const char* needle_expr, const char* haystack_expr, const char* needle, const char* haystack) { return IsSubstringImpl(false, needle_expr, haystack_expr, needle, haystack); } AssertionResult IsNotSubstring( const char* needle_expr, const char* haystack_expr, const wchar_t* needle, const wchar_t* haystack) { return IsSubstringImpl(false, needle_expr, haystack_expr, needle, haystack); } AssertionResult IsSubstring( const char* needle_expr, const char* haystack_expr, const ::std::string& needle, const ::std::string& haystack) { return IsSubstringImpl(true, needle_expr, haystack_expr, needle, haystack); } AssertionResult IsNotSubstring( const char* needle_expr, const char* haystack_expr, const ::std::string& needle, const ::std::string& haystack) { return IsSubstringImpl(false, needle_expr, haystack_expr, needle, haystack); } #if GTEST_HAS_STD_WSTRING AssertionResult IsSubstring( const char* needle_expr, const char* haystack_expr, const ::std::wstring& needle, const ::std::wstring& haystack) { return IsSubstringImpl(true, needle_expr, haystack_expr, needle, haystack); } AssertionResult IsNotSubstring( const char* needle_expr, const char* haystack_expr, const ::std::wstring& needle, const ::std::wstring& haystack) { return IsSubstringImpl(false, needle_expr, haystack_expr, needle, haystack); } #endif // GTEST_HAS_STD_WSTRING namespace internal { #if GTEST_OS_WINDOWS namespace { // Helper function for IsHRESULT{SuccessFailure} predicates AssertionResult HRESULTFailureHelper(const char* expr, const char* expected, long hr) { // NOLINT # if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_WINDOWS_TV_TITLE // Windows CE doesn't support FormatMessage. const char error_text[] = ""; # else // Looks up the human-readable system message for the HRESULT code // and since we're not passing any params to FormatMessage, we don't // want inserts expanded. const DWORD kFlags = FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS; const DWORD kBufSize = 4096; // Gets the system's human readable message string for this HRESULT. char error_text[kBufSize] = { '\0' }; DWORD message_length = ::FormatMessageA(kFlags, 0, // no source, we're asking system hr, // the error 0, // no line width restrictions error_text, // output buffer kBufSize, // buf size NULL); // no arguments for inserts // Trims tailing white space (FormatMessage leaves a trailing CR-LF) for (; message_length && IsSpace(error_text[message_length - 1]); --message_length) { error_text[message_length - 1] = '\0'; } # endif // GTEST_OS_WINDOWS_MOBILE const std::string error_hex("0x" + String::FormatHexInt(hr)); return ::testing::AssertionFailure() << "Expected: " << expr << " " << expected << ".\n" << " Actual: " << error_hex << " " << error_text << "\n"; } } // namespace AssertionResult IsHRESULTSuccess(const char* expr, long hr) { // NOLINT if (SUCCEEDED(hr)) { return AssertionSuccess(); } return HRESULTFailureHelper(expr, "succeeds", hr); } AssertionResult IsHRESULTFailure(const char* expr, long hr) { // NOLINT if (FAILED(hr)) { return AssertionSuccess(); } return HRESULTFailureHelper(expr, "fails", hr); } #endif // GTEST_OS_WINDOWS // Utility functions for encoding Unicode text (wide strings) in // UTF-8. // A Unicode code-point can have up to 21 bits, and is encoded in UTF-8 // like this: // // Code-point length Encoding // 0 - 7 bits 0xxxxxxx // 8 - 11 bits 110xxxxx 10xxxxxx // 12 - 16 bits 1110xxxx 10xxxxxx 10xxxxxx // 17 - 21 bits 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx // The maximum code-point a one-byte UTF-8 sequence can represent. const UInt32 kMaxCodePoint1 = (static_cast(1) << 7) - 1; // The maximum code-point a two-byte UTF-8 sequence can represent. const UInt32 kMaxCodePoint2 = (static_cast(1) << (5 + 6)) - 1; // The maximum code-point a three-byte UTF-8 sequence can represent. const UInt32 kMaxCodePoint3 = (static_cast(1) << (4 + 2*6)) - 1; // The maximum code-point a four-byte UTF-8 sequence can represent. const UInt32 kMaxCodePoint4 = (static_cast(1) << (3 + 3*6)) - 1; // Chops off the n lowest bits from a bit pattern. Returns the n // lowest bits. As a side effect, the original bit pattern will be // shifted to the right by n bits. inline UInt32 ChopLowBits(UInt32* bits, int n) { const UInt32 low_bits = *bits & ((static_cast(1) << n) - 1); *bits >>= n; return low_bits; } // Converts a Unicode code point to a narrow string in UTF-8 encoding. // code_point parameter is of type UInt32 because wchar_t may not be // wide enough to contain a code point. // If the code_point is not a valid Unicode code point // (i.e. outside of Unicode range U+0 to U+10FFFF) it will be converted // to "(Invalid Unicode 0xXXXXXXXX)". std::string CodePointToUtf8(UInt32 code_point) { if (code_point > kMaxCodePoint4) { return "(Invalid Unicode 0x" + String::FormatHexInt(code_point) + ")"; } char str[5]; // Big enough for the largest valid code point. if (code_point <= kMaxCodePoint1) { str[1] = '\0'; str[0] = static_cast(code_point); // 0xxxxxxx } else if (code_point <= kMaxCodePoint2) { str[2] = '\0'; str[1] = static_cast(0x80 | ChopLowBits(&code_point, 6)); // 10xxxxxx str[0] = static_cast(0xC0 | code_point); // 110xxxxx } else if (code_point <= kMaxCodePoint3) { str[3] = '\0'; str[2] = static_cast(0x80 | ChopLowBits(&code_point, 6)); // 10xxxxxx str[1] = static_cast(0x80 | ChopLowBits(&code_point, 6)); // 10xxxxxx str[0] = static_cast(0xE0 | code_point); // 1110xxxx } else { // code_point <= kMaxCodePoint4 str[4] = '\0'; str[3] = static_cast(0x80 | ChopLowBits(&code_point, 6)); // 10xxxxxx str[2] = static_cast(0x80 | ChopLowBits(&code_point, 6)); // 10xxxxxx str[1] = static_cast(0x80 | ChopLowBits(&code_point, 6)); // 10xxxxxx str[0] = static_cast(0xF0 | code_point); // 11110xxx } return str; } // The following two functions only make sense if the system // uses UTF-16 for wide string encoding. All supported systems // with 16 bit wchar_t (Windows, Cygwin, Symbian OS) do use UTF-16. // Determines if the arguments constitute UTF-16 surrogate pair // and thus should be combined into a single Unicode code point // using CreateCodePointFromUtf16SurrogatePair. inline bool IsUtf16SurrogatePair(wchar_t first, wchar_t second) { return sizeof(wchar_t) == 2 && (first & 0xFC00) == 0xD800 && (second & 0xFC00) == 0xDC00; } // Creates a Unicode code point from UTF16 surrogate pair. inline UInt32 CreateCodePointFromUtf16SurrogatePair(wchar_t first, wchar_t second) { const UInt32 mask = (1 << 10) - 1; return (sizeof(wchar_t) == 2) ? (((first & mask) << 10) | (second & mask)) + 0x10000 : // This function should not be called when the condition is // false, but we provide a sensible default in case it is. static_cast(first); } // Converts a wide string to a narrow string in UTF-8 encoding. // The wide string is assumed to have the following encoding: // UTF-16 if sizeof(wchar_t) == 2 (on Windows, Cygwin, Symbian OS) // UTF-32 if sizeof(wchar_t) == 4 (on Linux) // Parameter str points to a null-terminated wide string. // Parameter num_chars may additionally limit the number // of wchar_t characters processed. -1 is used when the entire string // should be processed. // If the string contains code points that are not valid Unicode code points // (i.e. outside of Unicode range U+0 to U+10FFFF) they will be output // as '(Invalid Unicode 0xXXXXXXXX)'. If the string is in UTF16 encoding // and contains invalid UTF-16 surrogate pairs, values in those pairs // will be encoded as individual Unicode characters from Basic Normal Plane. std::string WideStringToUtf8(const wchar_t* str, int num_chars) { if (num_chars == -1) num_chars = static_cast(wcslen(str)); ::std::stringstream stream; for (int i = 0; i < num_chars; ++i) { UInt32 unicode_code_point; if (str[i] == L'\0') { break; } else if (i + 1 < num_chars && IsUtf16SurrogatePair(str[i], str[i + 1])) { unicode_code_point = CreateCodePointFromUtf16SurrogatePair(str[i], str[i + 1]); i++; } else { unicode_code_point = static_cast(str[i]); } stream << CodePointToUtf8(unicode_code_point); } return StringStreamToString(&stream); } // Converts a wide C string to an std::string using the UTF-8 encoding. // NULL will be converted to "(null)". std::string String::ShowWideCString(const wchar_t * wide_c_str) { if (wide_c_str == NULL) return "(null)"; return internal::WideStringToUtf8(wide_c_str, -1); } // Compares two wide C strings. Returns true iff they have the same // content. // // Unlike wcscmp(), this function can handle NULL argument(s). A NULL // C string is considered different to any non-NULL C string, // including the empty string. bool String::WideCStringEquals(const wchar_t * lhs, const wchar_t * rhs) { if (lhs == NULL) return rhs == NULL; if (rhs == NULL) return false; return wcscmp(lhs, rhs) == 0; } // Helper function for *_STREQ on wide strings. AssertionResult CmpHelperSTREQ(const char* lhs_expression, const char* rhs_expression, const wchar_t* lhs, const wchar_t* rhs) { if (String::WideCStringEquals(lhs, rhs)) { return AssertionSuccess(); } return EqFailure(lhs_expression, rhs_expression, PrintToString(lhs), PrintToString(rhs), false); } // Helper function for *_STRNE on wide strings. AssertionResult CmpHelperSTRNE(const char* s1_expression, const char* s2_expression, const wchar_t* s1, const wchar_t* s2) { if (!String::WideCStringEquals(s1, s2)) { return AssertionSuccess(); } return AssertionFailure() << "Expected: (" << s1_expression << ") != (" << s2_expression << "), actual: " << PrintToString(s1) << " vs " << PrintToString(s2); } // Compares two C strings, ignoring case. Returns true iff they have // the same content. // // Unlike strcasecmp(), this function can handle NULL argument(s). A // NULL C string is considered different to any non-NULL C string, // including the empty string. bool String::CaseInsensitiveCStringEquals(const char * lhs, const char * rhs) { if (lhs == NULL) return rhs == NULL; if (rhs == NULL) return false; return posix::StrCaseCmp(lhs, rhs) == 0; } // Compares two wide C strings, ignoring case. Returns true iff they // have the same content. // // Unlike wcscasecmp(), this function can handle NULL argument(s). // A NULL C string is considered different to any non-NULL wide C string, // including the empty string. // NB: The implementations on different platforms slightly differ. // On windows, this method uses _wcsicmp which compares according to LC_CTYPE // environment variable. On GNU platform this method uses wcscasecmp // which compares according to LC_CTYPE category of the current locale. // On MacOS X, it uses towlower, which also uses LC_CTYPE category of the // current locale. bool String::CaseInsensitiveWideCStringEquals(const wchar_t* lhs, const wchar_t* rhs) { if (lhs == NULL) return rhs == NULL; if (rhs == NULL) return false; #if GTEST_OS_WINDOWS return _wcsicmp(lhs, rhs) == 0; #elif GTEST_OS_LINUX && !GTEST_OS_LINUX_ANDROID return wcscasecmp(lhs, rhs) == 0; #else // Android, Mac OS X and Cygwin don't define wcscasecmp. // Other unknown OSes may not define it either. wint_t left, right; do { left = towlower(*lhs++); right = towlower(*rhs++); } while (left && left == right); return left == right; #endif // OS selector } // Returns true iff str ends with the given suffix, ignoring case. // Any string is considered to end with an empty suffix. bool String::EndsWithCaseInsensitive( const std::string& str, const std::string& suffix) { const size_t str_len = str.length(); const size_t suffix_len = suffix.length(); return (str_len >= suffix_len) && CaseInsensitiveCStringEquals(str.c_str() + str_len - suffix_len, suffix.c_str()); } // Formats an int value as "%02d". std::string String::FormatIntWidth2(int value) { std::stringstream ss; ss << std::setfill('0') << std::setw(2) << value; return ss.str(); } // Formats an int value as "%X". std::string String::FormatHexInt(int value) { std::stringstream ss; ss << std::hex << std::uppercase << value; return ss.str(); } // Formats a byte as "%02X". std::string String::FormatByte(unsigned char value) { std::stringstream ss; ss << std::setfill('0') << std::setw(2) << std::hex << std::uppercase << static_cast(value); return ss.str(); } // Converts the buffer in a stringstream to an std::string, converting NUL // bytes to "\\0" along the way. std::string StringStreamToString(::std::stringstream* ss) { const ::std::string& str = ss->str(); const char* const start = str.c_str(); const char* const end = start + str.length(); std::string result; result.reserve(2 * (end - start)); for (const char* ch = start; ch != end; ++ch) { if (*ch == '\0') { result += "\\0"; // Replaces NUL with "\\0"; } else { result += *ch; } } return result; } // Appends the user-supplied message to the Google-Test-generated message. std::string AppendUserMessage(const std::string& gtest_msg, const Message& user_msg) { // Appends the user message if it's non-empty. const std::string user_msg_string = user_msg.GetString(); if (user_msg_string.empty()) { return gtest_msg; } return gtest_msg + "\n" + user_msg_string; } } // namespace internal // class TestResult // Creates an empty TestResult. TestResult::TestResult() : death_test_count_(0), elapsed_time_(0) { } // D'tor. TestResult::~TestResult() { } // Returns the i-th test part result among all the results. i can // range from 0 to total_part_count() - 1. If i is not in that range, // aborts the program. const TestPartResult& TestResult::GetTestPartResult(int i) const { if (i < 0 || i >= total_part_count()) internal::posix::Abort(); return test_part_results_.at(i); } // Returns the i-th test property. i can range from 0 to // test_property_count() - 1. If i is not in that range, aborts the // program. const TestProperty& TestResult::GetTestProperty(int i) const { if (i < 0 || i >= test_property_count()) internal::posix::Abort(); return test_properties_.at(i); } // Clears the test part results. void TestResult::ClearTestPartResults() { test_part_results_.clear(); } // Adds a test part result to the list. void TestResult::AddTestPartResult(const TestPartResult& test_part_result) { test_part_results_.push_back(test_part_result); } // Adds a test property to the list. If a property with the same key as the // supplied property is already represented, the value of this test_property // replaces the old value for that key. void TestResult::RecordProperty(const std::string& xml_element, const TestProperty& test_property) { if (!ValidateTestProperty(xml_element, test_property)) { return; } internal::MutexLock lock(&test_properites_mutex_); const std::vector::iterator property_with_matching_key = std::find_if(test_properties_.begin(), test_properties_.end(), internal::TestPropertyKeyIs(test_property.key())); if (property_with_matching_key == test_properties_.end()) { test_properties_.push_back(test_property); return; } property_with_matching_key->SetValue(test_property.value()); } // The list of reserved attributes used in the element of XML // output. static const char* const kReservedTestSuitesAttributes[] = { "disabled", "errors", "failures", "name", "random_seed", "tests", "time", "timestamp" }; // The list of reserved attributes used in the element of XML // output. static const char* const kReservedTestSuiteAttributes[] = { "disabled", "errors", "failures", "name", "tests", "time" }; // The list of reserved attributes used in the element of XML output. static const char* const kReservedTestCaseAttributes[] = { "classname", "name", "status", "time", "type_param", "value_param", "file", "line"}; template std::vector ArrayAsVector(const char* const (&array)[kSize]) { return std::vector(array, array + kSize); } static std::vector GetReservedAttributesForElement( const std::string& xml_element) { if (xml_element == "testsuites") { return ArrayAsVector(kReservedTestSuitesAttributes); } else if (xml_element == "testsuite") { return ArrayAsVector(kReservedTestSuiteAttributes); } else if (xml_element == "testcase") { return ArrayAsVector(kReservedTestCaseAttributes); } else { GTEST_CHECK_(false) << "Unrecognized xml_element provided: " << xml_element; } // This code is unreachable but some compilers may not realizes that. return std::vector(); } static std::string FormatWordList(const std::vector& words) { Message word_list; for (size_t i = 0; i < words.size(); ++i) { if (i > 0 && words.size() > 2) { word_list << ", "; } if (i == words.size() - 1) { word_list << "and "; } word_list << "'" << words[i] << "'"; } return word_list.GetString(); } static bool ValidateTestPropertyName( const std::string& property_name, const std::vector& reserved_names) { if (std::find(reserved_names.begin(), reserved_names.end(), property_name) != reserved_names.end()) { ADD_FAILURE() << "Reserved key used in RecordProperty(): " << property_name << " (" << FormatWordList(reserved_names) << " are reserved by " << GTEST_NAME_ << ")"; return false; } return true; } // Adds a failure if the key is a reserved attribute of the element named // xml_element. Returns true if the property is valid. bool TestResult::ValidateTestProperty(const std::string& xml_element, const TestProperty& test_property) { return ValidateTestPropertyName(test_property.key(), GetReservedAttributesForElement(xml_element)); } // Clears the object. void TestResult::Clear() { test_part_results_.clear(); test_properties_.clear(); death_test_count_ = 0; elapsed_time_ = 0; } // Returns true iff the test failed. bool TestResult::Failed() const { for (int i = 0; i < total_part_count(); ++i) { if (GetTestPartResult(i).failed()) return true; } return false; } // Returns true iff the test part fatally failed. static bool TestPartFatallyFailed(const TestPartResult& result) { return result.fatally_failed(); } // Returns true iff the test fatally failed. bool TestResult::HasFatalFailure() const { return CountIf(test_part_results_, TestPartFatallyFailed) > 0; } // Returns true iff the test part non-fatally failed. static bool TestPartNonfatallyFailed(const TestPartResult& result) { return result.nonfatally_failed(); } // Returns true iff the test has a non-fatal failure. bool TestResult::HasNonfatalFailure() const { return CountIf(test_part_results_, TestPartNonfatallyFailed) > 0; } // Gets the number of all test parts. This is the sum of the number // of successful test parts and the number of failed test parts. int TestResult::total_part_count() const { return static_cast(test_part_results_.size()); } // Returns the number of the test properties. int TestResult::test_property_count() const { return static_cast(test_properties_.size()); } // class Test // Creates a Test object. // The c'tor saves the states of all flags. Test::Test() : gtest_flag_saver_(new GTEST_FLAG_SAVER_) { } // The d'tor restores the states of all flags. The actual work is // done by the d'tor of the gtest_flag_saver_ field, and thus not // visible here. Test::~Test() { } // Sets up the test fixture. // // A sub-class may override this. void Test::SetUp() { } // Tears down the test fixture. // // A sub-class may override this. void Test::TearDown() { } // Allows user supplied key value pairs to be recorded for later output. void Test::RecordProperty(const std::string& key, const std::string& value) { UnitTest::GetInstance()->RecordProperty(key, value); } // Allows user supplied key value pairs to be recorded for later output. void Test::RecordProperty(const std::string& key, int value) { Message value_message; value_message << value; RecordProperty(key, value_message.GetString().c_str()); } namespace internal { void ReportFailureInUnknownLocation(TestPartResult::Type result_type, const std::string& message) { // This function is a friend of UnitTest and as such has access to // AddTestPartResult. UnitTest::GetInstance()->AddTestPartResult( result_type, NULL, // No info about the source file where the exception occurred. -1, // We have no info on which line caused the exception. message, ""); // No stack trace, either. } } // namespace internal // Google Test requires all tests in the same test case to use the same test // fixture class. This function checks if the current test has the // same fixture class as the first test in the current test case. If // yes, it returns true; otherwise it generates a Google Test failure and // returns false. bool Test::HasSameFixtureClass() { internal::UnitTestImpl* const impl = internal::GetUnitTestImpl(); const TestCase* const test_case = impl->current_test_case(); // Info about the first test in the current test case. const TestInfo* const first_test_info = test_case->test_info_list()[0]; const internal::TypeId first_fixture_id = first_test_info->fixture_class_id_; const char* const first_test_name = first_test_info->name(); // Info about the current test. const TestInfo* const this_test_info = impl->current_test_info(); const internal::TypeId this_fixture_id = this_test_info->fixture_class_id_; const char* const this_test_name = this_test_info->name(); if (this_fixture_id != first_fixture_id) { // Is the first test defined using TEST? const bool first_is_TEST = first_fixture_id == internal::GetTestTypeId(); // Is this test defined using TEST? const bool this_is_TEST = this_fixture_id == internal::GetTestTypeId(); if (first_is_TEST || this_is_TEST) { // Both TEST and TEST_F appear in same test case, which is incorrect. // Tell the user how to fix this. // Gets the name of the TEST and the name of the TEST_F. Note // that first_is_TEST and this_is_TEST cannot both be true, as // the fixture IDs are different for the two tests. const char* const TEST_name = first_is_TEST ? first_test_name : this_test_name; const char* const TEST_F_name = first_is_TEST ? this_test_name : first_test_name; ADD_FAILURE() << "All tests in the same test case must use the same test fixture\n" << "class, so mixing TEST_F and TEST in the same test case is\n" << "illegal. In test case " << this_test_info->test_case_name() << ",\n" << "test " << TEST_F_name << " is defined using TEST_F but\n" << "test " << TEST_name << " is defined using TEST. You probably\n" << "want to change the TEST to TEST_F or move it to another test\n" << "case."; } else { // Two fixture classes with the same name appear in two different // namespaces, which is not allowed. Tell the user how to fix this. ADD_FAILURE() << "All tests in the same test case must use the same test fixture\n" << "class. However, in test case " << this_test_info->test_case_name() << ",\n" << "you defined test " << first_test_name << " and test " << this_test_name << "\n" << "using two different test fixture classes. This can happen if\n" << "the two classes are from different namespaces or translation\n" << "units and have the same name. You should probably rename one\n" << "of the classes to put the tests into different test cases."; } return false; } return true; } #if GTEST_HAS_SEH // Adds an "exception thrown" fatal failure to the current test. This // function returns its result via an output parameter pointer because VC++ // prohibits creation of objects with destructors on stack in functions // using __try (see error C2712). static std::string* FormatSehExceptionMessage(DWORD exception_code, const char* location) { Message message; message << "SEH exception with code 0x" << std::setbase(16) << exception_code << std::setbase(10) << " thrown in " << location << "."; return new std::string(message.GetString()); } #endif // GTEST_HAS_SEH namespace internal { #if GTEST_HAS_EXCEPTIONS // Adds an "exception thrown" fatal failure to the current test. static std::string FormatCxxExceptionMessage(const char* description, const char* location) { Message message; if (description != NULL) { message << "C++ exception with description \"" << description << "\""; } else { message << "Unknown C++ exception"; } message << " thrown in " << location << "."; return message.GetString(); } static std::string PrintTestPartResultToString( const TestPartResult& test_part_result); GoogleTestFailureException::GoogleTestFailureException( const TestPartResult& failure) : ::std::runtime_error(PrintTestPartResultToString(failure).c_str()) {} #endif // GTEST_HAS_EXCEPTIONS // We put these helper functions in the internal namespace as IBM's xlC // compiler rejects the code if they were declared static. // Runs the given method and handles SEH exceptions it throws, when // SEH is supported; returns the 0-value for type Result in case of an // SEH exception. (Microsoft compilers cannot handle SEH and C++ // exceptions in the same function. Therefore, we provide a separate // wrapper function for handling SEH exceptions.) template Result HandleSehExceptionsInMethodIfSupported( T* object, Result (T::*method)(), const char* location) { #if GTEST_HAS_SEH __try { return (object->*method)(); } __except (internal::UnitTestOptions::GTestShouldProcessSEH( // NOLINT GetExceptionCode())) { // We create the exception message on the heap because VC++ prohibits // creation of objects with destructors on stack in functions using __try // (see error C2712). std::string* exception_message = FormatSehExceptionMessage( GetExceptionCode(), location); internal::ReportFailureInUnknownLocation(TestPartResult::kFatalFailure, *exception_message); delete exception_message; return static_cast(0); } #else (void)location; return (object->*method)(); #endif // GTEST_HAS_SEH } // Runs the given method and catches and reports C++ and/or SEH-style // exceptions, if they are supported; returns the 0-value for type // Result in case of an SEH exception. template Result HandleExceptionsInMethodIfSupported( T* object, Result (T::*method)(), const char* location) { // NOTE: The user code can affect the way in which Google Test handles // exceptions by setting GTEST_FLAG(catch_exceptions), but only before // RUN_ALL_TESTS() starts. It is technically possible to check the flag // after the exception is caught and either report or re-throw the // exception based on the flag's value: // // try { // // Perform the test method. // } catch (...) { // if (GTEST_FLAG(catch_exceptions)) // // Report the exception as failure. // else // throw; // Re-throws the original exception. // } // // However, the purpose of this flag is to allow the program to drop into // the debugger when the exception is thrown. On most platforms, once the // control enters the catch block, the exception origin information is // lost and the debugger will stop the program at the point of the // re-throw in this function -- instead of at the point of the original // throw statement in the code under test. For this reason, we perform // the check early, sacrificing the ability to affect Google Test's // exception handling in the method where the exception is thrown. if (internal::GetUnitTestImpl()->catch_exceptions()) { #if GTEST_HAS_EXCEPTIONS try { return HandleSehExceptionsInMethodIfSupported(object, method, location); } catch (const AssertionException&) { // NOLINT // This failure was reported already. } catch (const internal::GoogleTestFailureException&) { // NOLINT // This exception type can only be thrown by a failed Google // Test assertion with the intention of letting another testing // framework catch it. Therefore we just re-throw it. throw; } catch (const std::exception& e) { // NOLINT internal::ReportFailureInUnknownLocation( TestPartResult::kFatalFailure, FormatCxxExceptionMessage(e.what(), location)); } catch (...) { // NOLINT internal::ReportFailureInUnknownLocation( TestPartResult::kFatalFailure, FormatCxxExceptionMessage(NULL, location)); } return static_cast(0); #else return HandleSehExceptionsInMethodIfSupported(object, method, location); #endif // GTEST_HAS_EXCEPTIONS } else { return (object->*method)(); } } } // namespace internal // Runs the test and updates the test result. void Test::Run() { if (!HasSameFixtureClass()) return; internal::UnitTestImpl* const impl = internal::GetUnitTestImpl(); impl->os_stack_trace_getter()->UponLeavingGTest(); internal::HandleExceptionsInMethodIfSupported(this, &Test::SetUp, "SetUp()"); // We will run the test only if SetUp() was successful. if (!HasFatalFailure()) { impl->os_stack_trace_getter()->UponLeavingGTest(); internal::HandleExceptionsInMethodIfSupported( this, &Test::TestBody, "the test body"); } // However, we want to clean up as much as possible. Hence we will // always call TearDown(), even if SetUp() or the test body has // failed. impl->os_stack_trace_getter()->UponLeavingGTest(); internal::HandleExceptionsInMethodIfSupported( this, &Test::TearDown, "TearDown()"); } // Returns true iff the current test has a fatal failure. bool Test::HasFatalFailure() { return internal::GetUnitTestImpl()->current_test_result()->HasFatalFailure(); } // Returns true iff the current test has a non-fatal failure. bool Test::HasNonfatalFailure() { return internal::GetUnitTestImpl()->current_test_result()-> HasNonfatalFailure(); } // class TestInfo // Constructs a TestInfo object. It assumes ownership of the test factory // object. TestInfo::TestInfo(const std::string& a_test_case_name, const std::string& a_name, const char* a_type_param, const char* a_value_param, internal::CodeLocation a_code_location, internal::TypeId fixture_class_id, internal::TestFactoryBase* factory) : test_case_name_(a_test_case_name), name_(a_name), type_param_(a_type_param ? new std::string(a_type_param) : NULL), value_param_(a_value_param ? new std::string(a_value_param) : NULL), location_(a_code_location), fixture_class_id_(fixture_class_id), should_run_(false), is_disabled_(false), matches_filter_(false), factory_(factory), result_() {} // Destructs a TestInfo object. TestInfo::~TestInfo() { delete factory_; } namespace internal { // Creates a new TestInfo object and registers it with Google Test; // returns the created object. // // Arguments: // // test_case_name: name of the test case // name: name of the test // type_param: the name of the test's type parameter, or NULL if // this is not a typed or a type-parameterized test. // value_param: text representation of the test's value parameter, // or NULL if this is not a value-parameterized test. // code_location: code location where the test is defined // fixture_class_id: ID of the test fixture class // set_up_tc: pointer to the function that sets up the test case // tear_down_tc: pointer to the function that tears down the test case // factory: pointer to the factory that creates a test object. // The newly created TestInfo instance will assume // ownership of the factory object. TestInfo* MakeAndRegisterTestInfo( const char* test_case_name, const char* name, const char* type_param, const char* value_param, CodeLocation code_location, TypeId fixture_class_id, SetUpTestCaseFunc set_up_tc, TearDownTestCaseFunc tear_down_tc, TestFactoryBase* factory) { TestInfo* const test_info = new TestInfo(test_case_name, name, type_param, value_param, code_location, fixture_class_id, factory); GetUnitTestImpl()->AddTestInfo(set_up_tc, tear_down_tc, test_info); return test_info; } void ReportInvalidTestCaseType(const char* test_case_name, CodeLocation code_location) { Message errors; errors << "Attempted redefinition of test case " << test_case_name << ".\n" << "All tests in the same test case must use the same test fixture\n" << "class. However, in test case " << test_case_name << ", you tried\n" << "to define a test using a fixture class different from the one\n" << "used earlier. This can happen if the two fixture classes are\n" << "from different namespaces and have the same name. You should\n" << "probably rename one of the classes to put the tests into different\n" << "test cases."; GTEST_LOG_(ERROR) << FormatFileLocation(code_location.file.c_str(), code_location.line) << " " << errors.GetString(); } } // namespace internal namespace { // A predicate that checks the test name of a TestInfo against a known // value. // // This is used for implementation of the TestCase class only. We put // it in the anonymous namespace to prevent polluting the outer // namespace. // // TestNameIs is copyable. class TestNameIs { public: // Constructor. // // TestNameIs has NO default constructor. explicit TestNameIs(const char* name) : name_(name) {} // Returns true iff the test name of test_info matches name_. bool operator()(const TestInfo * test_info) const { return test_info && test_info->name() == name_; } private: std::string name_; }; } // namespace namespace internal { // This method expands all parameterized tests registered with macros TEST_P // and INSTANTIATE_TEST_CASE_P into regular tests and registers those. // This will be done just once during the program runtime. void UnitTestImpl::RegisterParameterizedTests() { if (!parameterized_tests_registered_) { parameterized_test_registry_.RegisterTests(); parameterized_tests_registered_ = true; } } } // namespace internal // Creates the test object, runs it, records its result, and then // deletes it. void TestInfo::Run() { if (!should_run_) return; // Tells UnitTest where to store test result. internal::UnitTestImpl* const impl = internal::GetUnitTestImpl(); impl->set_current_test_info(this); TestEventListener* repeater = UnitTest::GetInstance()->listeners().repeater(); // Notifies the unit test event listeners that a test is about to start. repeater->OnTestStart(*this); const TimeInMillis start = internal::GetTimeInMillis(); impl->os_stack_trace_getter()->UponLeavingGTest(); // Creates the test object. Test* const test = internal::HandleExceptionsInMethodIfSupported( factory_, &internal::TestFactoryBase::CreateTest, "the test fixture's constructor"); // Runs the test if the constructor didn't generate a fatal failure. // Note that the object will not be null if (!Test::HasFatalFailure()) { // This doesn't throw as all user code that can throw are wrapped into // exception handling code. test->Run(); } // Deletes the test object. impl->os_stack_trace_getter()->UponLeavingGTest(); internal::HandleExceptionsInMethodIfSupported( test, &Test::DeleteSelf_, "the test fixture's destructor"); result_.set_elapsed_time(internal::GetTimeInMillis() - start); // Notifies the unit test event listener that a test has just finished. repeater->OnTestEnd(*this); // Tells UnitTest to stop associating assertion results to this // test. impl->set_current_test_info(NULL); } // class TestCase // Gets the number of successful tests in this test case. int TestCase::successful_test_count() const { return CountIf(test_info_list_, TestPassed); } // Gets the number of failed tests in this test case. int TestCase::failed_test_count() const { return CountIf(test_info_list_, TestFailed); } // Gets the number of disabled tests that will be reported in the XML report. int TestCase::reportable_disabled_test_count() const { return CountIf(test_info_list_, TestReportableDisabled); } // Gets the number of disabled tests in this test case. int TestCase::disabled_test_count() const { return CountIf(test_info_list_, TestDisabled); } // Gets the number of tests to be printed in the XML report. int TestCase::reportable_test_count() const { return CountIf(test_info_list_, TestReportable); } // Get the number of tests in this test case that should run. int TestCase::test_to_run_count() const { return CountIf(test_info_list_, ShouldRunTest); } // Gets the number of all tests. int TestCase::total_test_count() const { return static_cast(test_info_list_.size()); } // Creates a TestCase with the given name. // // Arguments: // // name: name of the test case // a_type_param: the name of the test case's type parameter, or NULL if // this is not a typed or a type-parameterized test case. // set_up_tc: pointer to the function that sets up the test case // tear_down_tc: pointer to the function that tears down the test case TestCase::TestCase(const char* a_name, const char* a_type_param, Test::SetUpTestCaseFunc set_up_tc, Test::TearDownTestCaseFunc tear_down_tc) : name_(a_name), type_param_(a_type_param ? new std::string(a_type_param) : NULL), set_up_tc_(set_up_tc), tear_down_tc_(tear_down_tc), should_run_(false), elapsed_time_(0) { } // Destructor of TestCase. TestCase::~TestCase() { // Deletes every Test in the collection. ForEach(test_info_list_, internal::Delete); } // Returns the i-th test among all the tests. i can range from 0 to // total_test_count() - 1. If i is not in that range, returns NULL. const TestInfo* TestCase::GetTestInfo(int i) const { const int index = GetElementOr(test_indices_, i, -1); return index < 0 ? NULL : test_info_list_[index]; } // Returns the i-th test among all the tests. i can range from 0 to // total_test_count() - 1. If i is not in that range, returns NULL. TestInfo* TestCase::GetMutableTestInfo(int i) { const int index = GetElementOr(test_indices_, i, -1); return index < 0 ? NULL : test_info_list_[index]; } // Adds a test to this test case. Will delete the test upon // destruction of the TestCase object. void TestCase::AddTestInfo(TestInfo * test_info) { test_info_list_.push_back(test_info); test_indices_.push_back(static_cast(test_indices_.size())); } // Runs every test in this TestCase. void TestCase::Run() { if (!should_run_) return; internal::UnitTestImpl* const impl = internal::GetUnitTestImpl(); impl->set_current_test_case(this); TestEventListener* repeater = UnitTest::GetInstance()->listeners().repeater(); repeater->OnTestCaseStart(*this); impl->os_stack_trace_getter()->UponLeavingGTest(); internal::HandleExceptionsInMethodIfSupported( this, &TestCase::RunSetUpTestCase, "SetUpTestCase()"); const internal::TimeInMillis start = internal::GetTimeInMillis(); for (int i = 0; i < total_test_count(); i++) { GetMutableTestInfo(i)->Run(); } elapsed_time_ = internal::GetTimeInMillis() - start; impl->os_stack_trace_getter()->UponLeavingGTest(); internal::HandleExceptionsInMethodIfSupported( this, &TestCase::RunTearDownTestCase, "TearDownTestCase()"); repeater->OnTestCaseEnd(*this); impl->set_current_test_case(NULL); } // Clears the results of all tests in this test case. void TestCase::ClearResult() { ad_hoc_test_result_.Clear(); ForEach(test_info_list_, TestInfo::ClearTestResult); } // Shuffles the tests in this test case. void TestCase::ShuffleTests(internal::Random* random) { Shuffle(random, &test_indices_); } // Restores the test order to before the first shuffle. void TestCase::UnshuffleTests() { for (size_t i = 0; i < test_indices_.size(); i++) { test_indices_[i] = static_cast(i); } } // Formats a countable noun. Depending on its quantity, either the // singular form or the plural form is used. e.g. // // FormatCountableNoun(1, "formula", "formuli") returns "1 formula". // FormatCountableNoun(5, "book", "books") returns "5 books". static std::string FormatCountableNoun(int count, const char * singular_form, const char * plural_form) { return internal::StreamableToString(count) + " " + (count == 1 ? singular_form : plural_form); } // Formats the count of tests. static std::string FormatTestCount(int test_count) { return FormatCountableNoun(test_count, "test", "tests"); } // Formats the count of test cases. static std::string FormatTestCaseCount(int test_case_count) { return FormatCountableNoun(test_case_count, "test case", "test cases"); } // Converts a TestPartResult::Type enum to human-friendly string // representation. Both kNonFatalFailure and kFatalFailure are translated // to "Failure", as the user usually doesn't care about the difference // between the two when viewing the test result. static const char * TestPartResultTypeToString(TestPartResult::Type type) { switch (type) { case TestPartResult::kSuccess: return "Success"; case TestPartResult::kNonFatalFailure: case TestPartResult::kFatalFailure: #ifdef _MSC_VER return "error: "; #else return "Failure\n"; #endif default: return "Unknown result type"; } } namespace internal { // Prints a TestPartResult to an std::string. static std::string PrintTestPartResultToString( const TestPartResult& test_part_result) { return (Message() << internal::FormatFileLocation(test_part_result.file_name(), test_part_result.line_number()) << " " << TestPartResultTypeToString(test_part_result.type()) << test_part_result.message()).GetString(); } // Prints a TestPartResult. static void PrintTestPartResult(const TestPartResult& test_part_result) { const std::string& result = PrintTestPartResultToString(test_part_result); printf("%s\n", result.c_str()); fflush(stdout); // If the test program runs in Visual Studio or a debugger, the // following statements add the test part result message to the Output // window such that the user can double-click on it to jump to the // corresponding source code location; otherwise they do nothing. #if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE // We don't call OutputDebugString*() on Windows Mobile, as printing // to stdout is done by OutputDebugString() there already - we don't // want the same message printed twice. ::OutputDebugStringA(result.c_str()); ::OutputDebugStringA("\n"); #endif } // class PrettyUnitTestResultPrinter enum GTestColor { COLOR_DEFAULT, COLOR_RED, COLOR_GREEN, COLOR_YELLOW }; #if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE && \ !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT && !GTEST_OS_WINDOWS_MINGW // Returns the character attribute for the given color. static WORD GetColorAttribute(GTestColor color) { switch (color) { case COLOR_RED: return FOREGROUND_RED; case COLOR_GREEN: return FOREGROUND_GREEN; case COLOR_YELLOW: return FOREGROUND_RED | FOREGROUND_GREEN; default: return 0; } } static int GetBitOffset(WORD color_mask) { if (color_mask == 0) return 0; int bitOffset = 0; while ((color_mask & 1) == 0) { color_mask >>= 1; ++bitOffset; } return bitOffset; } static WORD GetNewColor(GTestColor color, WORD old_color_attrs) { // Let's reuse the BG static const WORD background_mask = BACKGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_RED | BACKGROUND_INTENSITY; static const WORD foreground_mask = FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY; const WORD existing_bg = old_color_attrs & background_mask; WORD new_color = GetColorAttribute(color) | existing_bg | FOREGROUND_INTENSITY; static const int bg_bitOffset = GetBitOffset(background_mask); static const int fg_bitOffset = GetBitOffset(foreground_mask); if (((new_color & background_mask) >> bg_bitOffset) == ((new_color & foreground_mask) >> fg_bitOffset)) { new_color ^= FOREGROUND_INTENSITY; // invert intensity } return new_color; } #else // Returns the ANSI color code for the given color. COLOR_DEFAULT is // an invalid input. static const char* GetAnsiColorCode(GTestColor color) { switch (color) { case COLOR_RED: return "1"; case COLOR_GREEN: return "2"; case COLOR_YELLOW: return "3"; default: return NULL; }; } #endif // GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE // Returns true iff Google Test should use colors in the output. bool ShouldUseColor(bool stdout_is_tty) { const char* const gtest_color = GTEST_FLAG(color).c_str(); if (String::CaseInsensitiveCStringEquals(gtest_color, "auto")) { #if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MINGW // On Windows the TERM variable is usually not set, but the // console there does support colors. return stdout_is_tty; #else // On non-Windows platforms, we rely on the TERM variable. const char* const term = posix::GetEnv("TERM"); const bool term_supports_color = String::CStringEquals(term, "xterm") || String::CStringEquals(term, "xterm-color") || String::CStringEquals(term, "xterm-256color") || String::CStringEquals(term, "screen") || String::CStringEquals(term, "screen-256color") || String::CStringEquals(term, "tmux") || String::CStringEquals(term, "tmux-256color") || String::CStringEquals(term, "rxvt-unicode") || String::CStringEquals(term, "rxvt-unicode-256color") || String::CStringEquals(term, "linux") || String::CStringEquals(term, "cygwin"); return stdout_is_tty && term_supports_color; #endif // GTEST_OS_WINDOWS } return String::CaseInsensitiveCStringEquals(gtest_color, "yes") || String::CaseInsensitiveCStringEquals(gtest_color, "true") || String::CaseInsensitiveCStringEquals(gtest_color, "t") || String::CStringEquals(gtest_color, "1"); // We take "yes", "true", "t", and "1" as meaning "yes". If the // value is neither one of these nor "auto", we treat it as "no" to // be conservative. } // Helpers for printing colored strings to stdout. Note that on Windows, we // cannot simply emit special characters and have the terminal change colors. // This routine must actually emit the characters rather than return a string // that would be colored when printed, as can be done on Linux. static void ColoredPrintf(GTestColor color, const char* fmt, ...) { va_list args; va_start(args, fmt); #if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_SYMBIAN || GTEST_OS_ZOS || \ GTEST_OS_IOS || GTEST_OS_WINDOWS_PHONE || GTEST_OS_WINDOWS_RT const bool use_color = AlwaysFalse(); #else static const bool in_color_mode = ShouldUseColor(posix::IsATTY(posix::FileNo(stdout)) != 0); const bool use_color = in_color_mode && (color != COLOR_DEFAULT); #endif // GTEST_OS_WINDOWS_MOBILE || GTEST_OS_SYMBIAN || GTEST_OS_ZOS // The '!= 0' comparison is necessary to satisfy MSVC 7.1. if (!use_color) { vprintf(fmt, args); va_end(args); return; } #if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE && \ !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT && !GTEST_OS_WINDOWS_MINGW const HANDLE stdout_handle = GetStdHandle(STD_OUTPUT_HANDLE); // Gets the current text color. CONSOLE_SCREEN_BUFFER_INFO buffer_info; GetConsoleScreenBufferInfo(stdout_handle, &buffer_info); const WORD old_color_attrs = buffer_info.wAttributes; const WORD new_color = GetNewColor(color, old_color_attrs); // We need to flush the stream buffers into the console before each // SetConsoleTextAttribute call lest it affect the text that is already // printed but has not yet reached the console. fflush(stdout); SetConsoleTextAttribute(stdout_handle, new_color); vprintf(fmt, args); fflush(stdout); // Restores the text color. SetConsoleTextAttribute(stdout_handle, old_color_attrs); #else printf("\033[0;3%sm", GetAnsiColorCode(color)); vprintf(fmt, args); printf("\033[m"); // Resets the terminal to default. #endif // GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE va_end(args); } // Text printed in Google Test's text output and --gtest_list_tests // output to label the type parameter and value parameter for a test. static const char kTypeParamLabel[] = "TypeParam"; static const char kValueParamLabel[] = "GetParam()"; static void PrintFullTestCommentIfPresent(const TestInfo& test_info) { const char* const type_param = test_info.type_param(); const char* const value_param = test_info.value_param(); if (type_param != NULL || value_param != NULL) { printf(", where "); if (type_param != NULL) { printf("%s = %s", kTypeParamLabel, type_param); if (value_param != NULL) printf(" and "); } if (value_param != NULL) { printf("%s = %s", kValueParamLabel, value_param); } } } // This class implements the TestEventListener interface. // // Class PrettyUnitTestResultPrinter is copyable. class PrettyUnitTestResultPrinter : public TestEventListener { public: PrettyUnitTestResultPrinter() {} static void PrintTestName(const char * test_case, const char * test) { printf("%s.%s", test_case, test); } // The following methods override what's in the TestEventListener class. virtual void OnTestProgramStart(const UnitTest& /*unit_test*/) {} virtual void OnTestIterationStart(const UnitTest& unit_test, int iteration); virtual void OnEnvironmentsSetUpStart(const UnitTest& unit_test); virtual void OnEnvironmentsSetUpEnd(const UnitTest& /*unit_test*/) {} virtual void OnTestCaseStart(const TestCase& test_case); virtual void OnTestStart(const TestInfo& test_info); virtual void OnTestPartResult(const TestPartResult& result); virtual void OnTestEnd(const TestInfo& test_info); virtual void OnTestCaseEnd(const TestCase& test_case); virtual void OnEnvironmentsTearDownStart(const UnitTest& unit_test); virtual void OnEnvironmentsTearDownEnd(const UnitTest& /*unit_test*/) {} virtual void OnTestIterationEnd(const UnitTest& unit_test, int iteration); virtual void OnTestProgramEnd(const UnitTest& /*unit_test*/) {} private: static void PrintFailedTests(const UnitTest& unit_test); }; // Fired before each iteration of tests starts. void PrettyUnitTestResultPrinter::OnTestIterationStart( const UnitTest& unit_test, int iteration) { if (GTEST_FLAG(repeat) != 1) printf("\nRepeating all tests (iteration %d) . . .\n\n", iteration + 1); const char* const filter = GTEST_FLAG(filter).c_str(); // Prints the filter if it's not *. This reminds the user that some // tests may be skipped. if (!String::CStringEquals(filter, kUniversalFilter)) { ColoredPrintf(COLOR_YELLOW, "Note: %s filter = %s\n", GTEST_NAME_, filter); } if (internal::ShouldShard(kTestTotalShards, kTestShardIndex, false)) { const Int32 shard_index = Int32FromEnvOrDie(kTestShardIndex, -1); ColoredPrintf(COLOR_YELLOW, "Note: This is test shard %d of %s.\n", static_cast(shard_index) + 1, internal::posix::GetEnv(kTestTotalShards)); } if (GTEST_FLAG(shuffle)) { ColoredPrintf(COLOR_YELLOW, "Note: Randomizing tests' orders with a seed of %d .\n", unit_test.random_seed()); } ColoredPrintf(COLOR_GREEN, "[==========] "); printf("Running %s from %s.\n", FormatTestCount(unit_test.test_to_run_count()).c_str(), FormatTestCaseCount(unit_test.test_case_to_run_count()).c_str()); fflush(stdout); } void PrettyUnitTestResultPrinter::OnEnvironmentsSetUpStart( const UnitTest& /*unit_test*/) { ColoredPrintf(COLOR_GREEN, "[----------] "); printf("Global test environment set-up.\n"); fflush(stdout); } void PrettyUnitTestResultPrinter::OnTestCaseStart(const TestCase& test_case) { const std::string counts = FormatCountableNoun(test_case.test_to_run_count(), "test", "tests"); ColoredPrintf(COLOR_GREEN, "[----------] "); printf("%s from %s", counts.c_str(), test_case.name()); if (test_case.type_param() == NULL) { printf("\n"); } else { printf(", where %s = %s\n", kTypeParamLabel, test_case.type_param()); } fflush(stdout); } void PrettyUnitTestResultPrinter::OnTestStart(const TestInfo& test_info) { ColoredPrintf(COLOR_GREEN, "[ RUN ] "); PrintTestName(test_info.test_case_name(), test_info.name()); printf("\n"); fflush(stdout); } // Called after an assertion failure. void PrettyUnitTestResultPrinter::OnTestPartResult( const TestPartResult& result) { // If the test part succeeded, we don't need to do anything. if (result.type() == TestPartResult::kSuccess) return; // Print failure message from the assertion (e.g. expected this and got that). PrintTestPartResult(result); fflush(stdout); } void PrettyUnitTestResultPrinter::OnTestEnd(const TestInfo& test_info) { if (test_info.result()->Passed()) { ColoredPrintf(COLOR_GREEN, "[ OK ] "); } else { ColoredPrintf(COLOR_RED, "[ FAILED ] "); } PrintTestName(test_info.test_case_name(), test_info.name()); if (test_info.result()->Failed()) PrintFullTestCommentIfPresent(test_info); if (GTEST_FLAG(print_time)) { printf(" (%s ms)\n", internal::StreamableToString( test_info.result()->elapsed_time()).c_str()); } else { printf("\n"); } fflush(stdout); } void PrettyUnitTestResultPrinter::OnTestCaseEnd(const TestCase& test_case) { if (!GTEST_FLAG(print_time)) return; const std::string counts = FormatCountableNoun(test_case.test_to_run_count(), "test", "tests"); ColoredPrintf(COLOR_GREEN, "[----------] "); printf("%s from %s (%s ms total)\n\n", counts.c_str(), test_case.name(), internal::StreamableToString(test_case.elapsed_time()).c_str()); fflush(stdout); } void PrettyUnitTestResultPrinter::OnEnvironmentsTearDownStart( const UnitTest& /*unit_test*/) { ColoredPrintf(COLOR_GREEN, "[----------] "); printf("Global test environment tear-down\n"); fflush(stdout); } // Internal helper for printing the list of failed tests. void PrettyUnitTestResultPrinter::PrintFailedTests(const UnitTest& unit_test) { const int failed_test_count = unit_test.failed_test_count(); if (failed_test_count == 0) { return; } for (int i = 0; i < unit_test.total_test_case_count(); ++i) { const TestCase& test_case = *unit_test.GetTestCase(i); if (!test_case.should_run() || (test_case.failed_test_count() == 0)) { continue; } for (int j = 0; j < test_case.total_test_count(); ++j) { const TestInfo& test_info = *test_case.GetTestInfo(j); if (!test_info.should_run() || test_info.result()->Passed()) { continue; } ColoredPrintf(COLOR_RED, "[ FAILED ] "); printf("%s.%s", test_case.name(), test_info.name()); PrintFullTestCommentIfPresent(test_info); printf("\n"); } } } void PrettyUnitTestResultPrinter::OnTestIterationEnd(const UnitTest& unit_test, int /*iteration*/) { ColoredPrintf(COLOR_GREEN, "[==========] "); printf("%s from %s ran.", FormatTestCount(unit_test.test_to_run_count()).c_str(), FormatTestCaseCount(unit_test.test_case_to_run_count()).c_str()); if (GTEST_FLAG(print_time)) { printf(" (%s ms total)", internal::StreamableToString(unit_test.elapsed_time()).c_str()); } printf("\n"); ColoredPrintf(COLOR_GREEN, "[ PASSED ] "); printf("%s.\n", FormatTestCount(unit_test.successful_test_count()).c_str()); int num_failures = unit_test.failed_test_count(); if (!unit_test.Passed()) { const int failed_test_count = unit_test.failed_test_count(); ColoredPrintf(COLOR_RED, "[ FAILED ] "); printf("%s, listed below:\n", FormatTestCount(failed_test_count).c_str()); PrintFailedTests(unit_test); printf("\n%2d FAILED %s\n", num_failures, num_failures == 1 ? "TEST" : "TESTS"); } int num_disabled = unit_test.reportable_disabled_test_count(); if (num_disabled && !GTEST_FLAG(also_run_disabled_tests)) { if (!num_failures) { printf("\n"); // Add a spacer if no FAILURE banner is displayed. } ColoredPrintf(COLOR_YELLOW, " YOU HAVE %d DISABLED %s\n\n", num_disabled, num_disabled == 1 ? "TEST" : "TESTS"); } // Ensure that Google Test output is printed before, e.g., heapchecker output. fflush(stdout); } // End PrettyUnitTestResultPrinter // class TestEventRepeater // // This class forwards events to other event listeners. class TestEventRepeater : public TestEventListener { public: TestEventRepeater() : forwarding_enabled_(true) {} virtual ~TestEventRepeater(); void Append(TestEventListener *listener); TestEventListener* Release(TestEventListener* listener); // Controls whether events will be forwarded to listeners_. Set to false // in death test child processes. bool forwarding_enabled() const { return forwarding_enabled_; } void set_forwarding_enabled(bool enable) { forwarding_enabled_ = enable; } virtual void OnTestProgramStart(const UnitTest& unit_test); virtual void OnTestIterationStart(const UnitTest& unit_test, int iteration); virtual void OnEnvironmentsSetUpStart(const UnitTest& unit_test); virtual void OnEnvironmentsSetUpEnd(const UnitTest& unit_test); virtual void OnTestCaseStart(const TestCase& test_case); virtual void OnTestStart(const TestInfo& test_info); virtual void OnTestPartResult(const TestPartResult& result); virtual void OnTestEnd(const TestInfo& test_info); virtual void OnTestCaseEnd(const TestCase& test_case); virtual void OnEnvironmentsTearDownStart(const UnitTest& unit_test); virtual void OnEnvironmentsTearDownEnd(const UnitTest& unit_test); virtual void OnTestIterationEnd(const UnitTest& unit_test, int iteration); virtual void OnTestProgramEnd(const UnitTest& unit_test); private: // Controls whether events will be forwarded to listeners_. Set to false // in death test child processes. bool forwarding_enabled_; // The list of listeners that receive events. std::vector listeners_; GTEST_DISALLOW_COPY_AND_ASSIGN_(TestEventRepeater); }; TestEventRepeater::~TestEventRepeater() { ForEach(listeners_, Delete); } void TestEventRepeater::Append(TestEventListener *listener) { listeners_.push_back(listener); } // FIXME: Factor the search functionality into Vector::Find. TestEventListener* TestEventRepeater::Release(TestEventListener *listener) { for (size_t i = 0; i < listeners_.size(); ++i) { if (listeners_[i] == listener) { listeners_.erase(listeners_.begin() + i); return listener; } } return NULL; } // Since most methods are very similar, use macros to reduce boilerplate. // This defines a member that forwards the call to all listeners. #define GTEST_REPEATER_METHOD_(Name, Type) \ void TestEventRepeater::Name(const Type& parameter) { \ if (forwarding_enabled_) { \ for (size_t i = 0; i < listeners_.size(); i++) { \ listeners_[i]->Name(parameter); \ } \ } \ } // This defines a member that forwards the call to all listeners in reverse // order. #define GTEST_REVERSE_REPEATER_METHOD_(Name, Type) \ void TestEventRepeater::Name(const Type& parameter) { \ if (forwarding_enabled_) { \ for (int i = static_cast(listeners_.size()) - 1; i >= 0; i--) { \ listeners_[i]->Name(parameter); \ } \ } \ } GTEST_REPEATER_METHOD_(OnTestProgramStart, UnitTest) GTEST_REPEATER_METHOD_(OnEnvironmentsSetUpStart, UnitTest) GTEST_REPEATER_METHOD_(OnTestCaseStart, TestCase) GTEST_REPEATER_METHOD_(OnTestStart, TestInfo) GTEST_REPEATER_METHOD_(OnTestPartResult, TestPartResult) GTEST_REPEATER_METHOD_(OnEnvironmentsTearDownStart, UnitTest) GTEST_REVERSE_REPEATER_METHOD_(OnEnvironmentsSetUpEnd, UnitTest) GTEST_REVERSE_REPEATER_METHOD_(OnEnvironmentsTearDownEnd, UnitTest) GTEST_REVERSE_REPEATER_METHOD_(OnTestEnd, TestInfo) GTEST_REVERSE_REPEATER_METHOD_(OnTestCaseEnd, TestCase) GTEST_REVERSE_REPEATER_METHOD_(OnTestProgramEnd, UnitTest) #undef GTEST_REPEATER_METHOD_ #undef GTEST_REVERSE_REPEATER_METHOD_ void TestEventRepeater::OnTestIterationStart(const UnitTest& unit_test, int iteration) { if (forwarding_enabled_) { for (size_t i = 0; i < listeners_.size(); i++) { listeners_[i]->OnTestIterationStart(unit_test, iteration); } } } void TestEventRepeater::OnTestIterationEnd(const UnitTest& unit_test, int iteration) { if (forwarding_enabled_) { for (int i = static_cast(listeners_.size()) - 1; i >= 0; i--) { listeners_[i]->OnTestIterationEnd(unit_test, iteration); } } } // End TestEventRepeater // This class generates an XML output file. class XmlUnitTestResultPrinter : public EmptyTestEventListener { public: explicit XmlUnitTestResultPrinter(const char* output_file); virtual void OnTestIterationEnd(const UnitTest& unit_test, int iteration); void ListTestsMatchingFilter(const std::vector& test_cases); // Prints an XML summary of all unit tests. static void PrintXmlTestsList(std::ostream* stream, const std::vector& test_cases); private: // Is c a whitespace character that is normalized to a space character // when it appears in an XML attribute value? static bool IsNormalizableWhitespace(char c) { return c == 0x9 || c == 0xA || c == 0xD; } // May c appear in a well-formed XML document? static bool IsValidXmlCharacter(char c) { return IsNormalizableWhitespace(c) || c >= 0x20; } // Returns an XML-escaped copy of the input string str. If // is_attribute is true, the text is meant to appear as an attribute // value, and normalizable whitespace is preserved by replacing it // with character references. static std::string EscapeXml(const std::string& str, bool is_attribute); // Returns the given string with all characters invalid in XML removed. static std::string RemoveInvalidXmlCharacters(const std::string& str); // Convenience wrapper around EscapeXml when str is an attribute value. static std::string EscapeXmlAttribute(const std::string& str) { return EscapeXml(str, true); } // Convenience wrapper around EscapeXml when str is not an attribute value. static std::string EscapeXmlText(const char* str) { return EscapeXml(str, false); } // Verifies that the given attribute belongs to the given element and // streams the attribute as XML. static void OutputXmlAttribute(std::ostream* stream, const std::string& element_name, const std::string& name, const std::string& value); // Streams an XML CDATA section, escaping invalid CDATA sequences as needed. static void OutputXmlCDataSection(::std::ostream* stream, const char* data); // Streams an XML representation of a TestInfo object. static void OutputXmlTestInfo(::std::ostream* stream, const char* test_case_name, const TestInfo& test_info); // Prints an XML representation of a TestCase object static void PrintXmlTestCase(::std::ostream* stream, const TestCase& test_case); // Prints an XML summary of unit_test to output stream out. static void PrintXmlUnitTest(::std::ostream* stream, const UnitTest& unit_test); // Produces a string representing the test properties in a result as space // delimited XML attributes based on the property key="value" pairs. // When the std::string is not empty, it includes a space at the beginning, // to delimit this attribute from prior attributes. static std::string TestPropertiesAsXmlAttributes(const TestResult& result); // Streams an XML representation of the test properties of a TestResult // object. static void OutputXmlTestProperties(std::ostream* stream, const TestResult& result); // The output file. const std::string output_file_; GTEST_DISALLOW_COPY_AND_ASSIGN_(XmlUnitTestResultPrinter); }; // Creates a new XmlUnitTestResultPrinter. XmlUnitTestResultPrinter::XmlUnitTestResultPrinter(const char* output_file) : output_file_(output_file) { if (output_file_.empty()) { GTEST_LOG_(FATAL) << "XML output file may not be null"; } } // Called after the unit test ends. void XmlUnitTestResultPrinter::OnTestIterationEnd(const UnitTest& unit_test, int /*iteration*/) { FILE* xmlout = OpenFileForWriting(output_file_); std::stringstream stream; PrintXmlUnitTest(&stream, unit_test); fprintf(xmlout, "%s", StringStreamToString(&stream).c_str()); fclose(xmlout); } void XmlUnitTestResultPrinter::ListTestsMatchingFilter( const std::vector& test_cases) { FILE* xmlout = OpenFileForWriting(output_file_); std::stringstream stream; PrintXmlTestsList(&stream, test_cases); fprintf(xmlout, "%s", StringStreamToString(&stream).c_str()); fclose(xmlout); } // Returns an XML-escaped copy of the input string str. If is_attribute // is true, the text is meant to appear as an attribute value, and // normalizable whitespace is preserved by replacing it with character // references. // // Invalid XML characters in str, if any, are stripped from the output. // It is expected that most, if not all, of the text processed by this // module will consist of ordinary English text. // If this module is ever modified to produce version 1.1 XML output, // most invalid characters can be retained using character references. // FIXME: It might be nice to have a minimally invasive, human-readable // escaping scheme for invalid characters, rather than dropping them. std::string XmlUnitTestResultPrinter::EscapeXml( const std::string& str, bool is_attribute) { Message m; for (size_t i = 0; i < str.size(); ++i) { const char ch = str[i]; switch (ch) { case '<': m << "<"; break; case '>': m << ">"; break; case '&': m << "&"; break; case '\'': if (is_attribute) m << "'"; else m << '\''; break; case '"': if (is_attribute) m << """; else m << '"'; break; default: if (IsValidXmlCharacter(ch)) { if (is_attribute && IsNormalizableWhitespace(ch)) m << "&#x" << String::FormatByte(static_cast(ch)) << ";"; else m << ch; } break; } } return m.GetString(); } // Returns the given string with all characters invalid in XML removed. // Currently invalid characters are dropped from the string. An // alternative is to replace them with certain characters such as . or ?. std::string XmlUnitTestResultPrinter::RemoveInvalidXmlCharacters( const std::string& str) { std::string output; output.reserve(str.size()); for (std::string::const_iterator it = str.begin(); it != str.end(); ++it) if (IsValidXmlCharacter(*it)) output.push_back(*it); return output; } // The following routines generate an XML representation of a UnitTest // object. // GOOGLETEST_CM0009 DO NOT DELETE // // This is how Google Test concepts map to the DTD: // // <-- corresponds to a UnitTest object // <-- corresponds to a TestCase object // <-- corresponds to a TestInfo object // ... // ... // ... // <-- individual assertion failures // // // // Formats the given time in milliseconds as seconds. std::string FormatTimeInMillisAsSeconds(TimeInMillis ms) { ::std::stringstream ss; ss << (static_cast(ms) * 1e-3); return ss.str(); } static bool PortableLocaltime(time_t seconds, struct tm* out) { #if defined(_MSC_VER) return localtime_s(out, &seconds) == 0; #elif defined(__MINGW32__) || defined(__MINGW64__) // MINGW provides neither localtime_r nor localtime_s, but uses // Windows' localtime(), which has a thread-local tm buffer. struct tm* tm_ptr = localtime(&seconds); // NOLINT if (tm_ptr == NULL) return false; *out = *tm_ptr; return true; #else return localtime_r(&seconds, out) != NULL; #endif } // Converts the given epoch time in milliseconds to a date string in the ISO // 8601 format, without the timezone information. std::string FormatEpochTimeInMillisAsIso8601(TimeInMillis ms) { struct tm time_struct; if (!PortableLocaltime(static_cast(ms / 1000), &time_struct)) return ""; // YYYY-MM-DDThh:mm:ss return StreamableToString(time_struct.tm_year + 1900) + "-" + String::FormatIntWidth2(time_struct.tm_mon + 1) + "-" + String::FormatIntWidth2(time_struct.tm_mday) + "T" + String::FormatIntWidth2(time_struct.tm_hour) + ":" + String::FormatIntWidth2(time_struct.tm_min) + ":" + String::FormatIntWidth2(time_struct.tm_sec); } // Streams an XML CDATA section, escaping invalid CDATA sequences as needed. void XmlUnitTestResultPrinter::OutputXmlCDataSection(::std::ostream* stream, const char* data) { const char* segment = data; *stream << ""); if (next_segment != NULL) { stream->write( segment, static_cast(next_segment - segment)); *stream << "]]>]]>"); } else { *stream << segment; break; } } *stream << "]]>"; } void XmlUnitTestResultPrinter::OutputXmlAttribute( std::ostream* stream, const std::string& element_name, const std::string& name, const std::string& value) { const std::vector& allowed_names = GetReservedAttributesForElement(element_name); GTEST_CHECK_(std::find(allowed_names.begin(), allowed_names.end(), name) != allowed_names.end()) << "Attribute " << name << " is not allowed for element <" << element_name << ">."; *stream << " " << name << "=\"" << EscapeXmlAttribute(value) << "\""; } // Prints an XML representation of a TestInfo object. // FIXME: There is also value in printing properties with the plain printer. void XmlUnitTestResultPrinter::OutputXmlTestInfo(::std::ostream* stream, const char* test_case_name, const TestInfo& test_info) { const TestResult& result = *test_info.result(); const std::string kTestcase = "testcase"; if (test_info.is_in_another_shard()) { return; } *stream << " \n"; return; } OutputXmlAttribute(stream, kTestcase, "status", test_info.should_run() ? "run" : "notrun"); OutputXmlAttribute(stream, kTestcase, "time", FormatTimeInMillisAsSeconds(result.elapsed_time())); OutputXmlAttribute(stream, kTestcase, "classname", test_case_name); int failures = 0; for (int i = 0; i < result.total_part_count(); ++i) { const TestPartResult& part = result.GetTestPartResult(i); if (part.failed()) { if (++failures == 1) { *stream << ">\n"; } const std::string location = internal::FormatCompilerIndependentFileLocation(part.file_name(), part.line_number()); const std::string summary = location + "\n" + part.summary(); *stream << " "; const std::string detail = location + "\n" + part.message(); OutputXmlCDataSection(stream, RemoveInvalidXmlCharacters(detail).c_str()); *stream << "\n"; } } if (failures == 0 && result.test_property_count() == 0) { *stream << " />\n"; } else { if (failures == 0) { *stream << ">\n"; } OutputXmlTestProperties(stream, result); *stream << " \n"; } } // Prints an XML representation of a TestCase object void XmlUnitTestResultPrinter::PrintXmlTestCase(std::ostream* stream, const TestCase& test_case) { const std::string kTestsuite = "testsuite"; *stream << " <" << kTestsuite; OutputXmlAttribute(stream, kTestsuite, "name", test_case.name()); OutputXmlAttribute(stream, kTestsuite, "tests", StreamableToString(test_case.reportable_test_count())); if (!GTEST_FLAG(list_tests)) { OutputXmlAttribute(stream, kTestsuite, "failures", StreamableToString(test_case.failed_test_count())); OutputXmlAttribute( stream, kTestsuite, "disabled", StreamableToString(test_case.reportable_disabled_test_count())); OutputXmlAttribute(stream, kTestsuite, "errors", "0"); OutputXmlAttribute(stream, kTestsuite, "time", FormatTimeInMillisAsSeconds(test_case.elapsed_time())); *stream << TestPropertiesAsXmlAttributes(test_case.ad_hoc_test_result()); } *stream << ">\n"; for (int i = 0; i < test_case.total_test_count(); ++i) { if (test_case.GetTestInfo(i)->is_reportable()) OutputXmlTestInfo(stream, test_case.name(), *test_case.GetTestInfo(i)); } *stream << " \n"; } // Prints an XML summary of unit_test to output stream out. void XmlUnitTestResultPrinter::PrintXmlUnitTest(std::ostream* stream, const UnitTest& unit_test) { const std::string kTestsuites = "testsuites"; *stream << "\n"; *stream << "<" << kTestsuites; OutputXmlAttribute(stream, kTestsuites, "tests", StreamableToString(unit_test.reportable_test_count())); OutputXmlAttribute(stream, kTestsuites, "failures", StreamableToString(unit_test.failed_test_count())); OutputXmlAttribute( stream, kTestsuites, "disabled", StreamableToString(unit_test.reportable_disabled_test_count())); OutputXmlAttribute(stream, kTestsuites, "errors", "0"); OutputXmlAttribute( stream, kTestsuites, "timestamp", FormatEpochTimeInMillisAsIso8601(unit_test.start_timestamp())); OutputXmlAttribute(stream, kTestsuites, "time", FormatTimeInMillisAsSeconds(unit_test.elapsed_time())); if (GTEST_FLAG(shuffle)) { OutputXmlAttribute(stream, kTestsuites, "random_seed", StreamableToString(unit_test.random_seed())); } *stream << TestPropertiesAsXmlAttributes(unit_test.ad_hoc_test_result()); OutputXmlAttribute(stream, kTestsuites, "name", "AllTests"); *stream << ">\n"; for (int i = 0; i < unit_test.total_test_case_count(); ++i) { if (unit_test.GetTestCase(i)->reportable_test_count() > 0) PrintXmlTestCase(stream, *unit_test.GetTestCase(i)); } *stream << "\n"; } void XmlUnitTestResultPrinter::PrintXmlTestsList( std::ostream* stream, const std::vector& test_cases) { const std::string kTestsuites = "testsuites"; *stream << "\n"; *stream << "<" << kTestsuites; int total_tests = 0; for (size_t i = 0; i < test_cases.size(); ++i) { total_tests += test_cases[i]->total_test_count(); } OutputXmlAttribute(stream, kTestsuites, "tests", StreamableToString(total_tests)); OutputXmlAttribute(stream, kTestsuites, "name", "AllTests"); *stream << ">\n"; for (size_t i = 0; i < test_cases.size(); ++i) { PrintXmlTestCase(stream, *test_cases[i]); } *stream << "\n"; } // Produces a string representing the test properties in a result as space // delimited XML attributes based on the property key="value" pairs. std::string XmlUnitTestResultPrinter::TestPropertiesAsXmlAttributes( const TestResult& result) { Message attributes; for (int i = 0; i < result.test_property_count(); ++i) { const TestProperty& property = result.GetTestProperty(i); attributes << " " << property.key() << "=" << "\"" << EscapeXmlAttribute(property.value()) << "\""; } return attributes.GetString(); } void XmlUnitTestResultPrinter::OutputXmlTestProperties( std::ostream* stream, const TestResult& result) { const std::string kProperties = "properties"; const std::string kProperty = "property"; if (result.test_property_count() <= 0) { return; } *stream << "<" << kProperties << ">\n"; for (int i = 0; i < result.test_property_count(); ++i) { const TestProperty& property = result.GetTestProperty(i); *stream << "<" << kProperty; *stream << " name=\"" << EscapeXmlAttribute(property.key()) << "\""; *stream << " value=\"" << EscapeXmlAttribute(property.value()) << "\""; *stream << "/>\n"; } *stream << "\n"; } // End XmlUnitTestResultPrinter // This class generates an JSON output file. class JsonUnitTestResultPrinter : public EmptyTestEventListener { public: explicit JsonUnitTestResultPrinter(const char* output_file); virtual void OnTestIterationEnd(const UnitTest& unit_test, int iteration); // Prints an JSON summary of all unit tests. static void PrintJsonTestList(::std::ostream* stream, const std::vector& test_cases); private: // Returns an JSON-escaped copy of the input string str. static std::string EscapeJson(const std::string& str); //// Verifies that the given attribute belongs to the given element and //// streams the attribute as JSON. static void OutputJsonKey(std::ostream* stream, const std::string& element_name, const std::string& name, const std::string& value, const std::string& indent, bool comma = true); static void OutputJsonKey(std::ostream* stream, const std::string& element_name, const std::string& name, int value, const std::string& indent, bool comma = true); // Streams a JSON representation of a TestInfo object. static void OutputJsonTestInfo(::std::ostream* stream, const char* test_case_name, const TestInfo& test_info); // Prints a JSON representation of a TestCase object static void PrintJsonTestCase(::std::ostream* stream, const TestCase& test_case); // Prints a JSON summary of unit_test to output stream out. static void PrintJsonUnitTest(::std::ostream* stream, const UnitTest& unit_test); // Produces a string representing the test properties in a result as // a JSON dictionary. static std::string TestPropertiesAsJson(const TestResult& result, const std::string& indent); // The output file. const std::string output_file_; GTEST_DISALLOW_COPY_AND_ASSIGN_(JsonUnitTestResultPrinter); }; // Creates a new JsonUnitTestResultPrinter. JsonUnitTestResultPrinter::JsonUnitTestResultPrinter(const char* output_file) : output_file_(output_file) { if (output_file_.empty()) { GTEST_LOG_(FATAL) << "JSON output file may not be null"; } } void JsonUnitTestResultPrinter::OnTestIterationEnd(const UnitTest& unit_test, int /*iteration*/) { FILE* jsonout = OpenFileForWriting(output_file_); std::stringstream stream; PrintJsonUnitTest(&stream, unit_test); fprintf(jsonout, "%s", StringStreamToString(&stream).c_str()); fclose(jsonout); } // Returns an JSON-escaped copy of the input string str. std::string JsonUnitTestResultPrinter::EscapeJson(const std::string& str) { Message m; for (size_t i = 0; i < str.size(); ++i) { const char ch = str[i]; switch (ch) { case '\\': case '"': case '/': m << '\\' << ch; break; case '\b': m << "\\b"; break; case '\t': m << "\\t"; break; case '\n': m << "\\n"; break; case '\f': m << "\\f"; break; case '\r': m << "\\r"; break; default: if (ch < ' ') { m << "\\u00" << String::FormatByte(static_cast(ch)); } else { m << ch; } break; } } return m.GetString(); } // The following routines generate an JSON representation of a UnitTest // object. // Formats the given time in milliseconds as seconds. static std::string FormatTimeInMillisAsDuration(TimeInMillis ms) { ::std::stringstream ss; ss << (static_cast(ms) * 1e-3) << "s"; return ss.str(); } // Converts the given epoch time in milliseconds to a date string in the // RFC3339 format, without the timezone information. static std::string FormatEpochTimeInMillisAsRFC3339(TimeInMillis ms) { struct tm time_struct; if (!PortableLocaltime(static_cast(ms / 1000), &time_struct)) return ""; // YYYY-MM-DDThh:mm:ss return StreamableToString(time_struct.tm_year + 1900) + "-" + String::FormatIntWidth2(time_struct.tm_mon + 1) + "-" + String::FormatIntWidth2(time_struct.tm_mday) + "T" + String::FormatIntWidth2(time_struct.tm_hour) + ":" + String::FormatIntWidth2(time_struct.tm_min) + ":" + String::FormatIntWidth2(time_struct.tm_sec) + "Z"; } static inline std::string Indent(int width) { return std::string(width, ' '); } void JsonUnitTestResultPrinter::OutputJsonKey( std::ostream* stream, const std::string& element_name, const std::string& name, const std::string& value, const std::string& indent, bool comma) { const std::vector& allowed_names = GetReservedAttributesForElement(element_name); GTEST_CHECK_(std::find(allowed_names.begin(), allowed_names.end(), name) != allowed_names.end()) << "Key \"" << name << "\" is not allowed for value \"" << element_name << "\"."; *stream << indent << "\"" << name << "\": \"" << EscapeJson(value) << "\""; if (comma) *stream << ",\n"; } void JsonUnitTestResultPrinter::OutputJsonKey( std::ostream* stream, const std::string& element_name, const std::string& name, int value, const std::string& indent, bool comma) { const std::vector& allowed_names = GetReservedAttributesForElement(element_name); GTEST_CHECK_(std::find(allowed_names.begin(), allowed_names.end(), name) != allowed_names.end()) << "Key \"" << name << "\" is not allowed for value \"" << element_name << "\"."; *stream << indent << "\"" << name << "\": " << StreamableToString(value); if (comma) *stream << ",\n"; } // Prints a JSON representation of a TestInfo object. void JsonUnitTestResultPrinter::OutputJsonTestInfo(::std::ostream* stream, const char* test_case_name, const TestInfo& test_info) { const TestResult& result = *test_info.result(); const std::string kTestcase = "testcase"; const std::string kIndent = Indent(10); *stream << Indent(8) << "{\n"; OutputJsonKey(stream, kTestcase, "name", test_info.name(), kIndent); if (test_info.value_param() != NULL) { OutputJsonKey(stream, kTestcase, "value_param", test_info.value_param(), kIndent); } if (test_info.type_param() != NULL) { OutputJsonKey(stream, kTestcase, "type_param", test_info.type_param(), kIndent); } if (GTEST_FLAG(list_tests)) { OutputJsonKey(stream, kTestcase, "file", test_info.file(), kIndent); OutputJsonKey(stream, kTestcase, "line", test_info.line(), kIndent, false); *stream << "\n" << Indent(8) << "}"; return; } OutputJsonKey(stream, kTestcase, "status", test_info.should_run() ? "RUN" : "NOTRUN", kIndent); OutputJsonKey(stream, kTestcase, "time", FormatTimeInMillisAsDuration(result.elapsed_time()), kIndent); OutputJsonKey(stream, kTestcase, "classname", test_case_name, kIndent, false); *stream << TestPropertiesAsJson(result, kIndent); int failures = 0; for (int i = 0; i < result.total_part_count(); ++i) { const TestPartResult& part = result.GetTestPartResult(i); if (part.failed()) { *stream << ",\n"; if (++failures == 1) { *stream << kIndent << "\"" << "failures" << "\": [\n"; } const std::string location = internal::FormatCompilerIndependentFileLocation(part.file_name(), part.line_number()); const std::string message = EscapeJson(location + "\n" + part.message()); *stream << kIndent << " {\n" << kIndent << " \"failure\": \"" << message << "\",\n" << kIndent << " \"type\": \"\"\n" << kIndent << " }"; } } if (failures > 0) *stream << "\n" << kIndent << "]"; *stream << "\n" << Indent(8) << "}"; } // Prints an JSON representation of a TestCase object void JsonUnitTestResultPrinter::PrintJsonTestCase(std::ostream* stream, const TestCase& test_case) { const std::string kTestsuite = "testsuite"; const std::string kIndent = Indent(6); *stream << Indent(4) << "{\n"; OutputJsonKey(stream, kTestsuite, "name", test_case.name(), kIndent); OutputJsonKey(stream, kTestsuite, "tests", test_case.reportable_test_count(), kIndent); if (!GTEST_FLAG(list_tests)) { OutputJsonKey(stream, kTestsuite, "failures", test_case.failed_test_count(), kIndent); OutputJsonKey(stream, kTestsuite, "disabled", test_case.reportable_disabled_test_count(), kIndent); OutputJsonKey(stream, kTestsuite, "errors", 0, kIndent); OutputJsonKey(stream, kTestsuite, "time", FormatTimeInMillisAsDuration(test_case.elapsed_time()), kIndent, false); *stream << TestPropertiesAsJson(test_case.ad_hoc_test_result(), kIndent) << ",\n"; } *stream << kIndent << "\"" << kTestsuite << "\": [\n"; bool comma = false; for (int i = 0; i < test_case.total_test_count(); ++i) { if (test_case.GetTestInfo(i)->is_reportable()) { if (comma) { *stream << ",\n"; } else { comma = true; } OutputJsonTestInfo(stream, test_case.name(), *test_case.GetTestInfo(i)); } } *stream << "\n" << kIndent << "]\n" << Indent(4) << "}"; } // Prints a JSON summary of unit_test to output stream out. void JsonUnitTestResultPrinter::PrintJsonUnitTest(std::ostream* stream, const UnitTest& unit_test) { const std::string kTestsuites = "testsuites"; const std::string kIndent = Indent(2); *stream << "{\n"; OutputJsonKey(stream, kTestsuites, "tests", unit_test.reportable_test_count(), kIndent); OutputJsonKey(stream, kTestsuites, "failures", unit_test.failed_test_count(), kIndent); OutputJsonKey(stream, kTestsuites, "disabled", unit_test.reportable_disabled_test_count(), kIndent); OutputJsonKey(stream, kTestsuites, "errors", 0, kIndent); if (GTEST_FLAG(shuffle)) { OutputJsonKey(stream, kTestsuites, "random_seed", unit_test.random_seed(), kIndent); } OutputJsonKey(stream, kTestsuites, "timestamp", FormatEpochTimeInMillisAsRFC3339(unit_test.start_timestamp()), kIndent); OutputJsonKey(stream, kTestsuites, "time", FormatTimeInMillisAsDuration(unit_test.elapsed_time()), kIndent, false); *stream << TestPropertiesAsJson(unit_test.ad_hoc_test_result(), kIndent) << ",\n"; OutputJsonKey(stream, kTestsuites, "name", "AllTests", kIndent); *stream << kIndent << "\"" << kTestsuites << "\": [\n"; bool comma = false; for (int i = 0; i < unit_test.total_test_case_count(); ++i) { if (unit_test.GetTestCase(i)->reportable_test_count() > 0) { if (comma) { *stream << ",\n"; } else { comma = true; } PrintJsonTestCase(stream, *unit_test.GetTestCase(i)); } } *stream << "\n" << kIndent << "]\n" << "}\n"; } void JsonUnitTestResultPrinter::PrintJsonTestList( std::ostream* stream, const std::vector& test_cases) { const std::string kTestsuites = "testsuites"; const std::string kIndent = Indent(2); *stream << "{\n"; int total_tests = 0; for (size_t i = 0; i < test_cases.size(); ++i) { total_tests += test_cases[i]->total_test_count(); } OutputJsonKey(stream, kTestsuites, "tests", total_tests, kIndent); OutputJsonKey(stream, kTestsuites, "name", "AllTests", kIndent); *stream << kIndent << "\"" << kTestsuites << "\": [\n"; for (size_t i = 0; i < test_cases.size(); ++i) { if (i != 0) { *stream << ",\n"; } PrintJsonTestCase(stream, *test_cases[i]); } *stream << "\n" << kIndent << "]\n" << "}\n"; } // Produces a string representing the test properties in a result as // a JSON dictionary. std::string JsonUnitTestResultPrinter::TestPropertiesAsJson( const TestResult& result, const std::string& indent) { Message attributes; for (int i = 0; i < result.test_property_count(); ++i) { const TestProperty& property = result.GetTestProperty(i); attributes << ",\n" << indent << "\"" << property.key() << "\": " << "\"" << EscapeJson(property.value()) << "\""; } return attributes.GetString(); } // End JsonUnitTestResultPrinter #if GTEST_CAN_STREAM_RESULTS_ // Checks if str contains '=', '&', '%' or '\n' characters. If yes, // replaces them by "%xx" where xx is their hexadecimal value. For // example, replaces "=" with "%3D". This algorithm is O(strlen(str)) // in both time and space -- important as the input str may contain an // arbitrarily long test failure message and stack trace. std::string StreamingListener::UrlEncode(const char* str) { std::string result; result.reserve(strlen(str) + 1); for (char ch = *str; ch != '\0'; ch = *++str) { switch (ch) { case '%': case '=': case '&': case '\n': result.append("%" + String::FormatByte(static_cast(ch))); break; default: result.push_back(ch); break; } } return result; } void StreamingListener::SocketWriter::MakeConnection() { GTEST_CHECK_(sockfd_ == -1) << "MakeConnection() can't be called when there is already a connection."; addrinfo hints; memset(&hints, 0, sizeof(hints)); hints.ai_family = AF_UNSPEC; // To allow both IPv4 and IPv6 addresses. hints.ai_socktype = SOCK_STREAM; addrinfo* servinfo = NULL; // Use the getaddrinfo() to get a linked list of IP addresses for // the given host name. const int error_num = getaddrinfo( host_name_.c_str(), port_num_.c_str(), &hints, &servinfo); if (error_num != 0) { GTEST_LOG_(WARNING) << "stream_result_to: getaddrinfo() failed: " << gai_strerror(error_num); } // Loop through all the results and connect to the first we can. for (addrinfo* cur_addr = servinfo; sockfd_ == -1 && cur_addr != NULL; cur_addr = cur_addr->ai_next) { sockfd_ = socket( cur_addr->ai_family, cur_addr->ai_socktype, cur_addr->ai_protocol); if (sockfd_ != -1) { // Connect the client socket to the server socket. if (connect(sockfd_, cur_addr->ai_addr, cur_addr->ai_addrlen) == -1) { close(sockfd_); sockfd_ = -1; } } } freeaddrinfo(servinfo); // all done with this structure if (sockfd_ == -1) { GTEST_LOG_(WARNING) << "stream_result_to: failed to connect to " << host_name_ << ":" << port_num_; } } // End of class Streaming Listener #endif // GTEST_CAN_STREAM_RESULTS__ // class OsStackTraceGetter const char* const OsStackTraceGetterInterface::kElidedFramesMarker = "... " GTEST_NAME_ " internal frames ..."; std::string OsStackTraceGetter::CurrentStackTrace(int max_depth, int skip_count) GTEST_LOCK_EXCLUDED_(mutex_) { #if GTEST_HAS_ABSL std::string result; if (max_depth <= 0) { return result; } max_depth = std::min(max_depth, kMaxStackTraceDepth); std::vector raw_stack(max_depth); // Skips the frames requested by the caller, plus this function. const int raw_stack_size = absl::GetStackTrace(&raw_stack[0], max_depth, skip_count + 1); void* caller_frame = nullptr; { MutexLock lock(&mutex_); caller_frame = caller_frame_; } for (int i = 0; i < raw_stack_size; ++i) { if (raw_stack[i] == caller_frame && !GTEST_FLAG(show_internal_stack_frames)) { // Add a marker to the trace and stop adding frames. absl::StrAppend(&result, kElidedFramesMarker, "\n"); break; } char tmp[1024]; const char* symbol = "(unknown)"; if (absl::Symbolize(raw_stack[i], tmp, sizeof(tmp))) { symbol = tmp; } char line[1024]; snprintf(line, sizeof(line), " %p: %s\n", raw_stack[i], symbol); result += line; } return result; #else // !GTEST_HAS_ABSL static_cast(max_depth); static_cast(skip_count); return ""; #endif // GTEST_HAS_ABSL } void OsStackTraceGetter::UponLeavingGTest() GTEST_LOCK_EXCLUDED_(mutex_) { #if GTEST_HAS_ABSL void* caller_frame = nullptr; if (absl::GetStackTrace(&caller_frame, 1, 3) <= 0) { caller_frame = nullptr; } MutexLock lock(&mutex_); caller_frame_ = caller_frame; #endif // GTEST_HAS_ABSL } // A helper class that creates the premature-exit file in its // constructor and deletes the file in its destructor. class ScopedPrematureExitFile { public: explicit ScopedPrematureExitFile(const char* premature_exit_filepath) : premature_exit_filepath_(premature_exit_filepath ? premature_exit_filepath : "") { // If a path to the premature-exit file is specified... if (!premature_exit_filepath_.empty()) { // create the file with a single "0" character in it. I/O // errors are ignored as there's nothing better we can do and we // don't want to fail the test because of this. FILE* pfile = posix::FOpen(premature_exit_filepath, "w"); fwrite("0", 1, 1, pfile); fclose(pfile); } } ~ScopedPrematureExitFile() { if (!premature_exit_filepath_.empty()) { int retval = remove(premature_exit_filepath_.c_str()); if (retval) { GTEST_LOG_(ERROR) << "Failed to remove premature exit filepath \"" << premature_exit_filepath_ << "\" with error " << retval; } } } private: const std::string premature_exit_filepath_; GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedPrematureExitFile); }; } // namespace internal // class TestEventListeners TestEventListeners::TestEventListeners() : repeater_(new internal::TestEventRepeater()), default_result_printer_(NULL), default_xml_generator_(NULL) { } TestEventListeners::~TestEventListeners() { delete repeater_; } // Returns the standard listener responsible for the default console // output. Can be removed from the listeners list to shut down default // console output. Note that removing this object from the listener list // with Release transfers its ownership to the user. void TestEventListeners::Append(TestEventListener* listener) { repeater_->Append(listener); } // Removes the given event listener from the list and returns it. It then // becomes the caller's responsibility to delete the listener. Returns // NULL if the listener is not found in the list. TestEventListener* TestEventListeners::Release(TestEventListener* listener) { if (listener == default_result_printer_) default_result_printer_ = NULL; else if (listener == default_xml_generator_) default_xml_generator_ = NULL; return repeater_->Release(listener); } // Returns repeater that broadcasts the TestEventListener events to all // subscribers. TestEventListener* TestEventListeners::repeater() { return repeater_; } // Sets the default_result_printer attribute to the provided listener. // The listener is also added to the listener list and previous // default_result_printer is removed from it and deleted. The listener can // also be NULL in which case it will not be added to the list. Does // nothing if the previous and the current listener objects are the same. void TestEventListeners::SetDefaultResultPrinter(TestEventListener* listener) { if (default_result_printer_ != listener) { // It is an error to pass this method a listener that is already in the // list. delete Release(default_result_printer_); default_result_printer_ = listener; if (listener != NULL) Append(listener); } } // Sets the default_xml_generator attribute to the provided listener. The // listener is also added to the listener list and previous // default_xml_generator is removed from it and deleted. The listener can // also be NULL in which case it will not be added to the list. Does // nothing if the previous and the current listener objects are the same. void TestEventListeners::SetDefaultXmlGenerator(TestEventListener* listener) { if (default_xml_generator_ != listener) { // It is an error to pass this method a listener that is already in the // list. delete Release(default_xml_generator_); default_xml_generator_ = listener; if (listener != NULL) Append(listener); } } // Controls whether events will be forwarded by the repeater to the // listeners in the list. bool TestEventListeners::EventForwardingEnabled() const { return repeater_->forwarding_enabled(); } void TestEventListeners::SuppressEventForwarding() { repeater_->set_forwarding_enabled(false); } // class UnitTest // Gets the singleton UnitTest object. The first time this method is // called, a UnitTest object is constructed and returned. Consecutive // calls will return the same object. // // We don't protect this under mutex_ as a user is not supposed to // call this before main() starts, from which point on the return // value will never change. UnitTest* UnitTest::GetInstance() { // When compiled with MSVC 7.1 in optimized mode, destroying the // UnitTest object upon exiting the program messes up the exit code, // causing successful tests to appear failed. We have to use a // different implementation in this case to bypass the compiler bug. // This implementation makes the compiler happy, at the cost of // leaking the UnitTest object. // CodeGear C++Builder insists on a public destructor for the // default implementation. Use this implementation to keep good OO // design with private destructor. #if (_MSC_VER == 1310 && !defined(_DEBUG)) || defined(__BORLANDC__) static UnitTest* const instance = new UnitTest; return instance; #else static UnitTest instance; return &instance; #endif // (_MSC_VER == 1310 && !defined(_DEBUG)) || defined(__BORLANDC__) } // Gets the number of successful test cases. int UnitTest::successful_test_case_count() const { return impl()->successful_test_case_count(); } // Gets the number of failed test cases. int UnitTest::failed_test_case_count() const { return impl()->failed_test_case_count(); } // Gets the number of all test cases. int UnitTest::total_test_case_count() const { return impl()->total_test_case_count(); } // Gets the number of all test cases that contain at least one test // that should run. int UnitTest::test_case_to_run_count() const { return impl()->test_case_to_run_count(); } // Gets the number of successful tests. int UnitTest::successful_test_count() const { return impl()->successful_test_count(); } // Gets the number of failed tests. int UnitTest::failed_test_count() const { return impl()->failed_test_count(); } // Gets the number of disabled tests that will be reported in the XML report. int UnitTest::reportable_disabled_test_count() const { return impl()->reportable_disabled_test_count(); } // Gets the number of disabled tests. int UnitTest::disabled_test_count() const { return impl()->disabled_test_count(); } // Gets the number of tests to be printed in the XML report. int UnitTest::reportable_test_count() const { return impl()->reportable_test_count(); } // Gets the number of all tests. int UnitTest::total_test_count() const { return impl()->total_test_count(); } // Gets the number of tests that should run. int UnitTest::test_to_run_count() const { return impl()->test_to_run_count(); } // Gets the time of the test program start, in ms from the start of the // UNIX epoch. internal::TimeInMillis UnitTest::start_timestamp() const { return impl()->start_timestamp(); } // Gets the elapsed time, in milliseconds. internal::TimeInMillis UnitTest::elapsed_time() const { return impl()->elapsed_time(); } // Returns true iff the unit test passed (i.e. all test cases passed). bool UnitTest::Passed() const { return impl()->Passed(); } // Returns true iff the unit test failed (i.e. some test case failed // or something outside of all tests failed). bool UnitTest::Failed() const { return impl()->Failed(); } // Gets the i-th test case among all the test cases. i can range from 0 to // total_test_case_count() - 1. If i is not in that range, returns NULL. const TestCase* UnitTest::GetTestCase(int i) const { return impl()->GetTestCase(i); } // Returns the TestResult containing information on test failures and // properties logged outside of individual test cases. const TestResult& UnitTest::ad_hoc_test_result() const { return *impl()->ad_hoc_test_result(); } // Gets the i-th test case among all the test cases. i can range from 0 to // total_test_case_count() - 1. If i is not in that range, returns NULL. TestCase* UnitTest::GetMutableTestCase(int i) { return impl()->GetMutableTestCase(i); } // Returns the list of event listeners that can be used to track events // inside Google Test. TestEventListeners& UnitTest::listeners() { return *impl()->listeners(); } // Registers and returns a global test environment. When a test // program is run, all global test environments will be set-up in the // order they were registered. After all tests in the program have // finished, all global test environments will be torn-down in the // *reverse* order they were registered. // // The UnitTest object takes ownership of the given environment. // // We don't protect this under mutex_, as we only support calling it // from the main thread. Environment* UnitTest::AddEnvironment(Environment* env) { if (env == NULL) { return NULL; } impl_->environments().push_back(env); return env; } // Adds a TestPartResult to the current TestResult object. All Google Test // assertion macros (e.g. ASSERT_TRUE, EXPECT_EQ, etc) eventually call // this to report their results. The user code should use the // assertion macros instead of calling this directly. void UnitTest::AddTestPartResult( TestPartResult::Type result_type, const char* file_name, int line_number, const std::string& message, const std::string& os_stack_trace) GTEST_LOCK_EXCLUDED_(mutex_) { Message msg; msg << message; internal::MutexLock lock(&mutex_); if (impl_->gtest_trace_stack().size() > 0) { msg << "\n" << GTEST_NAME_ << " trace:"; for (int i = static_cast(impl_->gtest_trace_stack().size()); i > 0; --i) { const internal::TraceInfo& trace = impl_->gtest_trace_stack()[i - 1]; msg << "\n" << internal::FormatFileLocation(trace.file, trace.line) << " " << trace.message; } } if (os_stack_trace.c_str() != NULL && !os_stack_trace.empty()) { msg << internal::kStackTraceMarker << os_stack_trace; } const TestPartResult result = TestPartResult(result_type, file_name, line_number, msg.GetString().c_str()); impl_->GetTestPartResultReporterForCurrentThread()-> ReportTestPartResult(result); if (result_type != TestPartResult::kSuccess) { // gtest_break_on_failure takes precedence over // gtest_throw_on_failure. This allows a user to set the latter // in the code (perhaps in order to use Google Test assertions // with another testing framework) and specify the former on the // command line for debugging. if (GTEST_FLAG(break_on_failure)) { #if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT // Using DebugBreak on Windows allows gtest to still break into a debugger // when a failure happens and both the --gtest_break_on_failure and // the --gtest_catch_exceptions flags are specified. DebugBreak(); #elif (!defined(__native_client__)) && \ ((defined(__clang__) || defined(__GNUC__)) && \ (defined(__x86_64__) || defined(__i386__))) // with clang/gcc we can achieve the same effect on x86 by invoking int3 asm("int3"); #else // Dereference NULL through a volatile pointer to prevent the compiler // from removing. We use this rather than abort() or __builtin_trap() for // portability: Symbian doesn't implement abort() well, and some debuggers // don't correctly trap abort(). *static_cast(NULL) = 1; #endif // GTEST_OS_WINDOWS } else if (GTEST_FLAG(throw_on_failure)) { #if GTEST_HAS_EXCEPTIONS throw internal::GoogleTestFailureException(result); #else // We cannot call abort() as it generates a pop-up in debug mode // that cannot be suppressed in VC 7.1 or below. exit(1); #endif } } } // Adds a TestProperty to the current TestResult object when invoked from // inside a test, to current TestCase's ad_hoc_test_result_ when invoked // from SetUpTestCase or TearDownTestCase, or to the global property set // when invoked elsewhere. If the result already contains a property with // the same key, the value will be updated. void UnitTest::RecordProperty(const std::string& key, const std::string& value) { impl_->RecordProperty(TestProperty(key, value)); } // Runs all tests in this UnitTest object and prints the result. // Returns 0 if successful, or 1 otherwise. // // We don't protect this under mutex_, as we only support calling it // from the main thread. int UnitTest::Run() { const bool in_death_test_child_process = internal::GTEST_FLAG(internal_run_death_test).length() > 0; // Google Test implements this protocol for catching that a test // program exits before returning control to Google Test: // // 1. Upon start, Google Test creates a file whose absolute path // is specified by the environment variable // TEST_PREMATURE_EXIT_FILE. // 2. When Google Test has finished its work, it deletes the file. // // This allows a test runner to set TEST_PREMATURE_EXIT_FILE before // running a Google-Test-based test program and check the existence // of the file at the end of the test execution to see if it has // exited prematurely. // If we are in the child process of a death test, don't // create/delete the premature exit file, as doing so is unnecessary // and will confuse the parent process. Otherwise, create/delete // the file upon entering/leaving this function. If the program // somehow exits before this function has a chance to return, the // premature-exit file will be left undeleted, causing a test runner // that understands the premature-exit-file protocol to report the // test as having failed. const internal::ScopedPrematureExitFile premature_exit_file( in_death_test_child_process ? NULL : internal::posix::GetEnv("TEST_PREMATURE_EXIT_FILE")); // Captures the value of GTEST_FLAG(catch_exceptions). This value will be // used for the duration of the program. impl()->set_catch_exceptions(GTEST_FLAG(catch_exceptions)); #if GTEST_OS_WINDOWS // Either the user wants Google Test to catch exceptions thrown by the // tests or this is executing in the context of death test child // process. In either case the user does not want to see pop-up dialogs // about crashes - they are expected. if (impl()->catch_exceptions() || in_death_test_child_process) { # if !GTEST_OS_WINDOWS_MOBILE && !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT // SetErrorMode doesn't exist on CE. SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOALIGNMENTFAULTEXCEPT | SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX); # endif // !GTEST_OS_WINDOWS_MOBILE # if (defined(_MSC_VER) || GTEST_OS_WINDOWS_MINGW) && !GTEST_OS_WINDOWS_MOBILE // Death test children can be terminated with _abort(). On Windows, // _abort() can show a dialog with a warning message. This forces the // abort message to go to stderr instead. _set_error_mode(_OUT_TO_STDERR); # endif # if _MSC_VER >= 1400 && !GTEST_OS_WINDOWS_MOBILE // In the debug version, Visual Studio pops up a separate dialog // offering a choice to debug the aborted program. We need to suppress // this dialog or it will pop up for every EXPECT/ASSERT_DEATH statement // executed. Google Test will notify the user of any unexpected // failure via stderr. // // VC++ doesn't define _set_abort_behavior() prior to the version 8.0. // Users of prior VC versions shall suffer the agony and pain of // clicking through the countless debug dialogs. // FIXME: find a way to suppress the abort dialog() in the // debug mode when compiled with VC 7.1 or lower. if (!GTEST_FLAG(break_on_failure)) _set_abort_behavior( 0x0, // Clear the following flags: _WRITE_ABORT_MSG | _CALL_REPORTFAULT); // pop-up window, core dump. # endif } #endif // GTEST_OS_WINDOWS return internal::HandleExceptionsInMethodIfSupported( impl(), &internal::UnitTestImpl::RunAllTests, "auxiliary test code (environments or event listeners)") ? 0 : 1; } // Returns the working directory when the first TEST() or TEST_F() was // executed. const char* UnitTest::original_working_dir() const { return impl_->original_working_dir_.c_str(); } // Returns the TestCase object for the test that's currently running, // or NULL if no test is running. const TestCase* UnitTest::current_test_case() const GTEST_LOCK_EXCLUDED_(mutex_) { internal::MutexLock lock(&mutex_); return impl_->current_test_case(); } // Returns the TestInfo object for the test that's currently running, // or NULL if no test is running. const TestInfo* UnitTest::current_test_info() const GTEST_LOCK_EXCLUDED_(mutex_) { internal::MutexLock lock(&mutex_); return impl_->current_test_info(); } // Returns the random seed used at the start of the current test run. int UnitTest::random_seed() const { return impl_->random_seed(); } // Returns ParameterizedTestCaseRegistry object used to keep track of // value-parameterized tests and instantiate and register them. internal::ParameterizedTestCaseRegistry& UnitTest::parameterized_test_registry() GTEST_LOCK_EXCLUDED_(mutex_) { return impl_->parameterized_test_registry(); } // Creates an empty UnitTest. UnitTest::UnitTest() { impl_ = new internal::UnitTestImpl(this); } // Destructor of UnitTest. UnitTest::~UnitTest() { delete impl_; } // Pushes a trace defined by SCOPED_TRACE() on to the per-thread // Google Test trace stack. void UnitTest::PushGTestTrace(const internal::TraceInfo& trace) GTEST_LOCK_EXCLUDED_(mutex_) { internal::MutexLock lock(&mutex_); impl_->gtest_trace_stack().push_back(trace); } // Pops a trace from the per-thread Google Test trace stack. void UnitTest::PopGTestTrace() GTEST_LOCK_EXCLUDED_(mutex_) { internal::MutexLock lock(&mutex_); impl_->gtest_trace_stack().pop_back(); } namespace internal { UnitTestImpl::UnitTestImpl(UnitTest* parent) : parent_(parent), GTEST_DISABLE_MSC_WARNINGS_PUSH_(4355 /* using this in initializer */) default_global_test_part_result_reporter_(this), default_per_thread_test_part_result_reporter_(this), GTEST_DISABLE_MSC_WARNINGS_POP_() global_test_part_result_repoter_( &default_global_test_part_result_reporter_), per_thread_test_part_result_reporter_( &default_per_thread_test_part_result_reporter_), parameterized_test_registry_(), parameterized_tests_registered_(false), last_death_test_case_(-1), current_test_case_(NULL), current_test_info_(NULL), ad_hoc_test_result_(), os_stack_trace_getter_(NULL), post_flag_parse_init_performed_(false), random_seed_(0), // Will be overridden by the flag before first use. random_(0), // Will be reseeded before first use. start_timestamp_(0), elapsed_time_(0), #if GTEST_HAS_DEATH_TEST death_test_factory_(new DefaultDeathTestFactory), #endif // Will be overridden by the flag before first use. catch_exceptions_(false) { listeners()->SetDefaultResultPrinter(new PrettyUnitTestResultPrinter); } UnitTestImpl::~UnitTestImpl() { // Deletes every TestCase. ForEach(test_cases_, internal::Delete); // Deletes every Environment. ForEach(environments_, internal::Delete); delete os_stack_trace_getter_; } // Adds a TestProperty to the current TestResult object when invoked in a // context of a test, to current test case's ad_hoc_test_result when invoke // from SetUpTestCase/TearDownTestCase, or to the global property set // otherwise. If the result already contains a property with the same key, // the value will be updated. void UnitTestImpl::RecordProperty(const TestProperty& test_property) { std::string xml_element; TestResult* test_result; // TestResult appropriate for property recording. if (current_test_info_ != NULL) { xml_element = "testcase"; test_result = &(current_test_info_->result_); } else if (current_test_case_ != NULL) { xml_element = "testsuite"; test_result = &(current_test_case_->ad_hoc_test_result_); } else { xml_element = "testsuites"; test_result = &ad_hoc_test_result_; } test_result->RecordProperty(xml_element, test_property); } #if GTEST_HAS_DEATH_TEST // Disables event forwarding if the control is currently in a death test // subprocess. Must not be called before InitGoogleTest. void UnitTestImpl::SuppressTestEventsIfInSubprocess() { if (internal_run_death_test_flag_.get() != NULL) listeners()->SuppressEventForwarding(); } #endif // GTEST_HAS_DEATH_TEST // Initializes event listeners performing XML output as specified by // UnitTestOptions. Must not be called before InitGoogleTest. void UnitTestImpl::ConfigureXmlOutput() { const std::string& output_format = UnitTestOptions::GetOutputFormat(); if (output_format == "xml") { listeners()->SetDefaultXmlGenerator(new XmlUnitTestResultPrinter( UnitTestOptions::GetAbsolutePathToOutputFile().c_str())); } else if (output_format == "json") { listeners()->SetDefaultXmlGenerator(new JsonUnitTestResultPrinter( UnitTestOptions::GetAbsolutePathToOutputFile().c_str())); } else if (output_format != "") { GTEST_LOG_(WARNING) << "WARNING: unrecognized output format \"" << output_format << "\" ignored."; } } #if GTEST_CAN_STREAM_RESULTS_ // Initializes event listeners for streaming test results in string form. // Must not be called before InitGoogleTest. void UnitTestImpl::ConfigureStreamingOutput() { const std::string& target = GTEST_FLAG(stream_result_to); if (!target.empty()) { const size_t pos = target.find(':'); if (pos != std::string::npos) { listeners()->Append(new StreamingListener(target.substr(0, pos), target.substr(pos+1))); } else { GTEST_LOG_(WARNING) << "unrecognized streaming target \"" << target << "\" ignored."; } } } #endif // GTEST_CAN_STREAM_RESULTS_ // Performs initialization dependent upon flag values obtained in // ParseGoogleTestFlagsOnly. Is called from InitGoogleTest after the call to // ParseGoogleTestFlagsOnly. In case a user neglects to call InitGoogleTest // this function is also called from RunAllTests. Since this function can be // called more than once, it has to be idempotent. void UnitTestImpl::PostFlagParsingInit() { // Ensures that this function does not execute more than once. if (!post_flag_parse_init_performed_) { post_flag_parse_init_performed_ = true; #if defined(GTEST_CUSTOM_TEST_EVENT_LISTENER_) // Register to send notifications about key process state changes. listeners()->Append(new GTEST_CUSTOM_TEST_EVENT_LISTENER_()); #endif // defined(GTEST_CUSTOM_TEST_EVENT_LISTENER_) #if GTEST_HAS_DEATH_TEST InitDeathTestSubprocessControlInfo(); SuppressTestEventsIfInSubprocess(); #endif // GTEST_HAS_DEATH_TEST // Registers parameterized tests. This makes parameterized tests // available to the UnitTest reflection API without running // RUN_ALL_TESTS. RegisterParameterizedTests(); // Configures listeners for XML output. This makes it possible for users // to shut down the default XML output before invoking RUN_ALL_TESTS. ConfigureXmlOutput(); #if GTEST_CAN_STREAM_RESULTS_ // Configures listeners for streaming test results to the specified server. ConfigureStreamingOutput(); #endif // GTEST_CAN_STREAM_RESULTS_ #if GTEST_HAS_ABSL if (GTEST_FLAG(install_failure_signal_handler)) { absl::FailureSignalHandlerOptions options; absl::InstallFailureSignalHandler(options); } #endif // GTEST_HAS_ABSL } } // A predicate that checks the name of a TestCase against a known // value. // // This is used for implementation of the UnitTest class only. We put // it in the anonymous namespace to prevent polluting the outer // namespace. // // TestCaseNameIs is copyable. class TestCaseNameIs { public: // Constructor. explicit TestCaseNameIs(const std::string& name) : name_(name) {} // Returns true iff the name of test_case matches name_. bool operator()(const TestCase* test_case) const { return test_case != NULL && strcmp(test_case->name(), name_.c_str()) == 0; } private: std::string name_; }; // Finds and returns a TestCase with the given name. If one doesn't // exist, creates one and returns it. It's the CALLER'S // RESPONSIBILITY to ensure that this function is only called WHEN THE // TESTS ARE NOT SHUFFLED. // // Arguments: // // test_case_name: name of the test case // type_param: the name of the test case's type parameter, or NULL if // this is not a typed or a type-parameterized test case. // set_up_tc: pointer to the function that sets up the test case // tear_down_tc: pointer to the function that tears down the test case TestCase* UnitTestImpl::GetTestCase(const char* test_case_name, const char* type_param, Test::SetUpTestCaseFunc set_up_tc, Test::TearDownTestCaseFunc tear_down_tc) { // Can we find a TestCase with the given name? const std::vector::const_reverse_iterator test_case = std::find_if(test_cases_.rbegin(), test_cases_.rend(), TestCaseNameIs(test_case_name)); if (test_case != test_cases_.rend()) return *test_case; // No. Let's create one. TestCase* const new_test_case = new TestCase(test_case_name, type_param, set_up_tc, tear_down_tc); // Is this a death test case? if (internal::UnitTestOptions::MatchesFilter(test_case_name, kDeathTestCaseFilter)) { // Yes. Inserts the test case after the last death test case // defined so far. This only works when the test cases haven't // been shuffled. Otherwise we may end up running a death test // after a non-death test. ++last_death_test_case_; test_cases_.insert(test_cases_.begin() + last_death_test_case_, new_test_case); } else { // No. Appends to the end of the list. test_cases_.push_back(new_test_case); } test_case_indices_.push_back(static_cast(test_case_indices_.size())); return new_test_case; } // Helpers for setting up / tearing down the given environment. They // are for use in the ForEach() function. static void SetUpEnvironment(Environment* env) { env->SetUp(); } static void TearDownEnvironment(Environment* env) { env->TearDown(); } // Runs all tests in this UnitTest object, prints the result, and // returns true if all tests are successful. If any exception is // thrown during a test, the test is considered to be failed, but the // rest of the tests will still be run. // // When parameterized tests are enabled, it expands and registers // parameterized tests first in RegisterParameterizedTests(). // All other functions called from RunAllTests() may safely assume that // parameterized tests are ready to be counted and run. bool UnitTestImpl::RunAllTests() { // True iff Google Test is initialized before RUN_ALL_TESTS() is called. const bool gtest_is_initialized_before_run_all_tests = GTestIsInitialized(); // Do not run any test if the --help flag was specified. if (g_help_flag) return true; // Repeats the call to the post-flag parsing initialization in case the // user didn't call InitGoogleTest. PostFlagParsingInit(); // Even if sharding is not on, test runners may want to use the // GTEST_SHARD_STATUS_FILE to query whether the test supports the sharding // protocol. internal::WriteToShardStatusFileIfNeeded(); // True iff we are in a subprocess for running a thread-safe-style // death test. bool in_subprocess_for_death_test = false; #if GTEST_HAS_DEATH_TEST in_subprocess_for_death_test = (internal_run_death_test_flag_.get() != NULL); # if defined(GTEST_EXTRA_DEATH_TEST_CHILD_SETUP_) if (in_subprocess_for_death_test) { GTEST_EXTRA_DEATH_TEST_CHILD_SETUP_(); } # endif // defined(GTEST_EXTRA_DEATH_TEST_CHILD_SETUP_) #endif // GTEST_HAS_DEATH_TEST const bool should_shard = ShouldShard(kTestTotalShards, kTestShardIndex, in_subprocess_for_death_test); // Compares the full test names with the filter to decide which // tests to run. const bool has_tests_to_run = FilterTests(should_shard ? HONOR_SHARDING_PROTOCOL : IGNORE_SHARDING_PROTOCOL) > 0; // Lists the tests and exits if the --gtest_list_tests flag was specified. if (GTEST_FLAG(list_tests)) { // This must be called *after* FilterTests() has been called. ListTestsMatchingFilter(); return true; } random_seed_ = GTEST_FLAG(shuffle) ? GetRandomSeedFromFlag(GTEST_FLAG(random_seed)) : 0; // True iff at least one test has failed. bool failed = false; TestEventListener* repeater = listeners()->repeater(); start_timestamp_ = GetTimeInMillis(); repeater->OnTestProgramStart(*parent_); // How many times to repeat the tests? We don't want to repeat them // when we are inside the subprocess of a death test. const int repeat = in_subprocess_for_death_test ? 1 : GTEST_FLAG(repeat); // Repeats forever if the repeat count is negative. const bool forever = repeat < 0; for (int i = 0; forever || i != repeat; i++) { // We want to preserve failures generated by ad-hoc test // assertions executed before RUN_ALL_TESTS(). ClearNonAdHocTestResult(); const TimeInMillis start = GetTimeInMillis(); // Shuffles test cases and tests if requested. if (has_tests_to_run && GTEST_FLAG(shuffle)) { random()->Reseed(random_seed_); // This should be done before calling OnTestIterationStart(), // such that a test event listener can see the actual test order // in the event. ShuffleTests(); } // Tells the unit test event listeners that the tests are about to start. repeater->OnTestIterationStart(*parent_, i); // Runs each test case if there is at least one test to run. if (has_tests_to_run) { // Sets up all environments beforehand. repeater->OnEnvironmentsSetUpStart(*parent_); ForEach(environments_, SetUpEnvironment); repeater->OnEnvironmentsSetUpEnd(*parent_); // Runs the tests only if there was no fatal failure during global // set-up. if (!Test::HasFatalFailure()) { for (int test_index = 0; test_index < total_test_case_count(); test_index++) { GetMutableTestCase(test_index)->Run(); } } // Tears down all environments in reverse order afterwards. repeater->OnEnvironmentsTearDownStart(*parent_); std::for_each(environments_.rbegin(), environments_.rend(), TearDownEnvironment); repeater->OnEnvironmentsTearDownEnd(*parent_); } elapsed_time_ = GetTimeInMillis() - start; // Tells the unit test event listener that the tests have just finished. repeater->OnTestIterationEnd(*parent_, i); // Gets the result and clears it. if (!Passed()) { failed = true; } // Restores the original test order after the iteration. This // allows the user to quickly repro a failure that happens in the // N-th iteration without repeating the first (N - 1) iterations. // This is not enclosed in "if (GTEST_FLAG(shuffle)) { ... }", in // case the user somehow changes the value of the flag somewhere // (it's always safe to unshuffle the tests). UnshuffleTests(); if (GTEST_FLAG(shuffle)) { // Picks a new random seed for each iteration. random_seed_ = GetNextRandomSeed(random_seed_); } } repeater->OnTestProgramEnd(*parent_); if (!gtest_is_initialized_before_run_all_tests) { ColoredPrintf( COLOR_RED, "\nIMPORTANT NOTICE - DO NOT IGNORE:\n" "This test program did NOT call " GTEST_INIT_GOOGLE_TEST_NAME_ "() before calling RUN_ALL_TESTS(). This is INVALID. Soon " GTEST_NAME_ " will start to enforce the valid usage. " "Please fix it ASAP, or IT WILL START TO FAIL.\n"); // NOLINT #if GTEST_FOR_GOOGLE_ ColoredPrintf(COLOR_RED, "For more details, see http://wiki/Main/ValidGUnitMain.\n"); #endif // GTEST_FOR_GOOGLE_ } return !failed; } // Reads the GTEST_SHARD_STATUS_FILE environment variable, and creates the file // if the variable is present. If a file already exists at this location, this // function will write over it. If the variable is present, but the file cannot // be created, prints an error and exits. void WriteToShardStatusFileIfNeeded() { const char* const test_shard_file = posix::GetEnv(kTestShardStatusFile); if (test_shard_file != NULL) { FILE* const file = posix::FOpen(test_shard_file, "w"); if (file == NULL) { ColoredPrintf(COLOR_RED, "Could not write to the test shard status file \"%s\" " "specified by the %s environment variable.\n", test_shard_file, kTestShardStatusFile); fflush(stdout); exit(EXIT_FAILURE); } fclose(file); } } // Checks whether sharding is enabled by examining the relevant // environment variable values. If the variables are present, // but inconsistent (i.e., shard_index >= total_shards), prints // an error and exits. If in_subprocess_for_death_test, sharding is // disabled because it must only be applied to the original test // process. Otherwise, we could filter out death tests we intended to execute. bool ShouldShard(const char* total_shards_env, const char* shard_index_env, bool in_subprocess_for_death_test) { if (in_subprocess_for_death_test) { return false; } const Int32 total_shards = Int32FromEnvOrDie(total_shards_env, -1); const Int32 shard_index = Int32FromEnvOrDie(shard_index_env, -1); if (total_shards == -1 && shard_index == -1) { return false; } else if (total_shards == -1 && shard_index != -1) { const Message msg = Message() << "Invalid environment variables: you have " << kTestShardIndex << " = " << shard_index << ", but have left " << kTestTotalShards << " unset.\n"; ColoredPrintf(COLOR_RED, msg.GetString().c_str()); fflush(stdout); exit(EXIT_FAILURE); } else if (total_shards != -1 && shard_index == -1) { const Message msg = Message() << "Invalid environment variables: you have " << kTestTotalShards << " = " << total_shards << ", but have left " << kTestShardIndex << " unset.\n"; ColoredPrintf(COLOR_RED, msg.GetString().c_str()); fflush(stdout); exit(EXIT_FAILURE); } else if (shard_index < 0 || shard_index >= total_shards) { const Message msg = Message() << "Invalid environment variables: we require 0 <= " << kTestShardIndex << " < " << kTestTotalShards << ", but you have " << kTestShardIndex << "=" << shard_index << ", " << kTestTotalShards << "=" << total_shards << ".\n"; ColoredPrintf(COLOR_RED, msg.GetString().c_str()); fflush(stdout); exit(EXIT_FAILURE); } return total_shards > 1; } // Parses the environment variable var as an Int32. If it is unset, // returns default_val. If it is not an Int32, prints an error // and aborts. Int32 Int32FromEnvOrDie(const char* var, Int32 default_val) { const char* str_val = posix::GetEnv(var); if (str_val == NULL) { return default_val; } Int32 result; if (!ParseInt32(Message() << "The value of environment variable " << var, str_val, &result)) { exit(EXIT_FAILURE); } return result; } // Given the total number of shards, the shard index, and the test id, // returns true iff the test should be run on this shard. The test id is // some arbitrary but unique non-negative integer assigned to each test // method. Assumes that 0 <= shard_index < total_shards. bool ShouldRunTestOnShard(int total_shards, int shard_index, int test_id) { return (test_id % total_shards) == shard_index; } // Compares the name of each test with the user-specified filter to // decide whether the test should be run, then records the result in // each TestCase and TestInfo object. // If shard_tests == true, further filters tests based on sharding // variables in the environment - see // https://github.com/google/googletest/blob/master/googletest/docs/advanced.md // . Returns the number of tests that should run. int UnitTestImpl::FilterTests(ReactionToSharding shard_tests) { const Int32 total_shards = shard_tests == HONOR_SHARDING_PROTOCOL ? Int32FromEnvOrDie(kTestTotalShards, -1) : -1; const Int32 shard_index = shard_tests == HONOR_SHARDING_PROTOCOL ? Int32FromEnvOrDie(kTestShardIndex, -1) : -1; // num_runnable_tests are the number of tests that will // run across all shards (i.e., match filter and are not disabled). // num_selected_tests are the number of tests to be run on // this shard. int num_runnable_tests = 0; int num_selected_tests = 0; for (size_t i = 0; i < test_cases_.size(); i++) { TestCase* const test_case = test_cases_[i]; const std::string &test_case_name = test_case->name(); test_case->set_should_run(false); for (size_t j = 0; j < test_case->test_info_list().size(); j++) { TestInfo* const test_info = test_case->test_info_list()[j]; const std::string test_name(test_info->name()); // A test is disabled if test case name or test name matches // kDisableTestFilter. const bool is_disabled = internal::UnitTestOptions::MatchesFilter(test_case_name, kDisableTestFilter) || internal::UnitTestOptions::MatchesFilter(test_name, kDisableTestFilter); test_info->is_disabled_ = is_disabled; const bool matches_filter = internal::UnitTestOptions::FilterMatchesTest(test_case_name, test_name); test_info->matches_filter_ = matches_filter; const bool is_runnable = (GTEST_FLAG(also_run_disabled_tests) || !is_disabled) && matches_filter; const bool is_in_another_shard = shard_tests != IGNORE_SHARDING_PROTOCOL && !ShouldRunTestOnShard(total_shards, shard_index, num_runnable_tests); test_info->is_in_another_shard_ = is_in_another_shard; const bool is_selected = is_runnable && !is_in_another_shard; num_runnable_tests += is_runnable; num_selected_tests += is_selected; test_info->should_run_ = is_selected; test_case->set_should_run(test_case->should_run() || is_selected); } } return num_selected_tests; } // Prints the given C-string on a single line by replacing all '\n' // characters with string "\\n". If the output takes more than // max_length characters, only prints the first max_length characters // and "...". static void PrintOnOneLine(const char* str, int max_length) { if (str != NULL) { for (int i = 0; *str != '\0'; ++str) { if (i >= max_length) { printf("..."); break; } if (*str == '\n') { printf("\\n"); i += 2; } else { printf("%c", *str); ++i; } } } } // Prints the names of the tests matching the user-specified filter flag. void UnitTestImpl::ListTestsMatchingFilter() { // Print at most this many characters for each type/value parameter. const int kMaxParamLength = 250; for (size_t i = 0; i < test_cases_.size(); i++) { const TestCase* const test_case = test_cases_[i]; bool printed_test_case_name = false; for (size_t j = 0; j < test_case->test_info_list().size(); j++) { const TestInfo* const test_info = test_case->test_info_list()[j]; if (test_info->matches_filter_) { if (!printed_test_case_name) { printed_test_case_name = true; printf("%s.", test_case->name()); if (test_case->type_param() != NULL) { printf(" # %s = ", kTypeParamLabel); // We print the type parameter on a single line to make // the output easy to parse by a program. PrintOnOneLine(test_case->type_param(), kMaxParamLength); } printf("\n"); } printf(" %s", test_info->name()); if (test_info->value_param() != NULL) { printf(" # %s = ", kValueParamLabel); // We print the value parameter on a single line to make the // output easy to parse by a program. PrintOnOneLine(test_info->value_param(), kMaxParamLength); } printf("\n"); } } } fflush(stdout); const std::string& output_format = UnitTestOptions::GetOutputFormat(); if (output_format == "xml" || output_format == "json") { FILE* fileout = OpenFileForWriting( UnitTestOptions::GetAbsolutePathToOutputFile().c_str()); std::stringstream stream; if (output_format == "xml") { XmlUnitTestResultPrinter( UnitTestOptions::GetAbsolutePathToOutputFile().c_str()) .PrintXmlTestsList(&stream, test_cases_); } else if (output_format == "json") { JsonUnitTestResultPrinter( UnitTestOptions::GetAbsolutePathToOutputFile().c_str()) .PrintJsonTestList(&stream, test_cases_); } fprintf(fileout, "%s", StringStreamToString(&stream).c_str()); fclose(fileout); } } // Sets the OS stack trace getter. // // Does nothing if the input and the current OS stack trace getter are // the same; otherwise, deletes the old getter and makes the input the // current getter. void UnitTestImpl::set_os_stack_trace_getter( OsStackTraceGetterInterface* getter) { if (os_stack_trace_getter_ != getter) { delete os_stack_trace_getter_; os_stack_trace_getter_ = getter; } } // Returns the current OS stack trace getter if it is not NULL; // otherwise, creates an OsStackTraceGetter, makes it the current // getter, and returns it. OsStackTraceGetterInterface* UnitTestImpl::os_stack_trace_getter() { if (os_stack_trace_getter_ == NULL) { #ifdef GTEST_OS_STACK_TRACE_GETTER_ os_stack_trace_getter_ = new GTEST_OS_STACK_TRACE_GETTER_; #else os_stack_trace_getter_ = new OsStackTraceGetter; #endif // GTEST_OS_STACK_TRACE_GETTER_ } return os_stack_trace_getter_; } // Returns the most specific TestResult currently running. TestResult* UnitTestImpl::current_test_result() { if (current_test_info_ != NULL) { return ¤t_test_info_->result_; } if (current_test_case_ != NULL) { return ¤t_test_case_->ad_hoc_test_result_; } return &ad_hoc_test_result_; } // Shuffles all test cases, and the tests within each test case, // making sure that death tests are still run first. void UnitTestImpl::ShuffleTests() { // Shuffles the death test cases. ShuffleRange(random(), 0, last_death_test_case_ + 1, &test_case_indices_); // Shuffles the non-death test cases. ShuffleRange(random(), last_death_test_case_ + 1, static_cast(test_cases_.size()), &test_case_indices_); // Shuffles the tests inside each test case. for (size_t i = 0; i < test_cases_.size(); i++) { test_cases_[i]->ShuffleTests(random()); } } // Restores the test cases and tests to their order before the first shuffle. void UnitTestImpl::UnshuffleTests() { for (size_t i = 0; i < test_cases_.size(); i++) { // Unshuffles the tests in each test case. test_cases_[i]->UnshuffleTests(); // Resets the index of each test case. test_case_indices_[i] = static_cast(i); } } // Returns the current OS stack trace as an std::string. // // The maximum number of stack frames to be included is specified by // the gtest_stack_trace_depth flag. The skip_count parameter // specifies the number of top frames to be skipped, which doesn't // count against the number of frames to be included. // // For example, if Foo() calls Bar(), which in turn calls // GetCurrentOsStackTraceExceptTop(..., 1), Foo() will be included in // the trace but Bar() and GetCurrentOsStackTraceExceptTop() won't. std::string GetCurrentOsStackTraceExceptTop(UnitTest* /*unit_test*/, int skip_count) { // We pass skip_count + 1 to skip this wrapper function in addition // to what the user really wants to skip. return GetUnitTestImpl()->CurrentOsStackTraceExceptTop(skip_count + 1); } // Used by the GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_ macro to // suppress unreachable code warnings. namespace { class ClassUniqueToAlwaysTrue {}; } bool IsTrue(bool condition) { return condition; } bool AlwaysTrue() { #if GTEST_HAS_EXCEPTIONS // This condition is always false so AlwaysTrue() never actually throws, // but it makes the compiler think that it may throw. if (IsTrue(false)) throw ClassUniqueToAlwaysTrue(); #endif // GTEST_HAS_EXCEPTIONS return true; } // If *pstr starts with the given prefix, modifies *pstr to be right // past the prefix and returns true; otherwise leaves *pstr unchanged // and returns false. None of pstr, *pstr, and prefix can be NULL. bool SkipPrefix(const char* prefix, const char** pstr) { const size_t prefix_len = strlen(prefix); if (strncmp(*pstr, prefix, prefix_len) == 0) { *pstr += prefix_len; return true; } return false; } // Parses a string as a command line flag. The string should have // the format "--flag=value". When def_optional is true, the "=value" // part can be omitted. // // Returns the value of the flag, or NULL if the parsing failed. static const char* ParseFlagValue(const char* str, const char* flag, bool def_optional) { // str and flag must not be NULL. if (str == NULL || flag == NULL) return NULL; // The flag must start with "--" followed by GTEST_FLAG_PREFIX_. const std::string flag_str = std::string("--") + GTEST_FLAG_PREFIX_ + flag; const size_t flag_len = flag_str.length(); if (strncmp(str, flag_str.c_str(), flag_len) != 0) return NULL; // Skips the flag name. const char* flag_end = str + flag_len; // When def_optional is true, it's OK to not have a "=value" part. if (def_optional && (flag_end[0] == '\0')) { return flag_end; } // If def_optional is true and there are more characters after the // flag name, or if def_optional is false, there must be a '=' after // the flag name. if (flag_end[0] != '=') return NULL; // Returns the string after "=". return flag_end + 1; } // Parses a string for a bool flag, in the form of either // "--flag=value" or "--flag". // // In the former case, the value is taken as true as long as it does // not start with '0', 'f', or 'F'. // // In the latter case, the value is taken as true. // // On success, stores the value of the flag in *value, and returns // true. On failure, returns false without changing *value. static bool ParseBoolFlag(const char* str, const char* flag, bool* value) { // Gets the value of the flag as a string. const char* const value_str = ParseFlagValue(str, flag, true); // Aborts if the parsing failed. if (value_str == NULL) return false; // Converts the string value to a bool. *value = !(*value_str == '0' || *value_str == 'f' || *value_str == 'F'); return true; } // Parses a string for an Int32 flag, in the form of // "--flag=value". // // On success, stores the value of the flag in *value, and returns // true. On failure, returns false without changing *value. bool ParseInt32Flag(const char* str, const char* flag, Int32* value) { // Gets the value of the flag as a string. const char* const value_str = ParseFlagValue(str, flag, false); // Aborts if the parsing failed. if (value_str == NULL) return false; // Sets *value to the value of the flag. return ParseInt32(Message() << "The value of flag --" << flag, value_str, value); } // Parses a string for a string flag, in the form of // "--flag=value". // // On success, stores the value of the flag in *value, and returns // true. On failure, returns false without changing *value. template static bool ParseStringFlag(const char* str, const char* flag, String* value) { // Gets the value of the flag as a string. const char* const value_str = ParseFlagValue(str, flag, false); // Aborts if the parsing failed. if (value_str == NULL) return false; // Sets *value to the value of the flag. *value = value_str; return true; } // Determines whether a string has a prefix that Google Test uses for its // flags, i.e., starts with GTEST_FLAG_PREFIX_ or GTEST_FLAG_PREFIX_DASH_. // If Google Test detects that a command line flag has its prefix but is not // recognized, it will print its help message. Flags starting with // GTEST_INTERNAL_PREFIX_ followed by "internal_" are considered Google Test // internal flags and do not trigger the help message. static bool HasGoogleTestFlagPrefix(const char* str) { return (SkipPrefix("--", &str) || SkipPrefix("-", &str) || SkipPrefix("/", &str)) && !SkipPrefix(GTEST_FLAG_PREFIX_ "internal_", &str) && (SkipPrefix(GTEST_FLAG_PREFIX_, &str) || SkipPrefix(GTEST_FLAG_PREFIX_DASH_, &str)); } // Prints a string containing code-encoded text. The following escape // sequences can be used in the string to control the text color: // // @@ prints a single '@' character. // @R changes the color to red. // @G changes the color to green. // @Y changes the color to yellow. // @D changes to the default terminal text color. // // FIXME: Write tests for this once we add stdout // capturing to Google Test. static void PrintColorEncoded(const char* str) { GTestColor color = COLOR_DEFAULT; // The current color. // Conceptually, we split the string into segments divided by escape // sequences. Then we print one segment at a time. At the end of // each iteration, the str pointer advances to the beginning of the // next segment. for (;;) { const char* p = strchr(str, '@'); if (p == NULL) { ColoredPrintf(color, "%s", str); return; } ColoredPrintf(color, "%s", std::string(str, p).c_str()); const char ch = p[1]; str = p + 2; if (ch == '@') { ColoredPrintf(color, "@"); } else if (ch == 'D') { color = COLOR_DEFAULT; } else if (ch == 'R') { color = COLOR_RED; } else if (ch == 'G') { color = COLOR_GREEN; } else if (ch == 'Y') { color = COLOR_YELLOW; } else { --str; } } } static const char kColorEncodedHelpMessage[] = "This program contains tests written using " GTEST_NAME_ ". You can use the\n" "following command line flags to control its behavior:\n" "\n" "Test Selection:\n" " @G--" GTEST_FLAG_PREFIX_ "list_tests@D\n" " List the names of all tests instead of running them. The name of\n" " TEST(Foo, Bar) is \"Foo.Bar\".\n" " @G--" GTEST_FLAG_PREFIX_ "filter=@YPOSTIVE_PATTERNS" "[@G-@YNEGATIVE_PATTERNS]@D\n" " Run only the tests whose name matches one of the positive patterns but\n" " none of the negative patterns. '?' matches any single character; '*'\n" " matches any substring; ':' separates two patterns.\n" " @G--" GTEST_FLAG_PREFIX_ "also_run_disabled_tests@D\n" " Run all disabled tests too.\n" "\n" "Test Execution:\n" " @G--" GTEST_FLAG_PREFIX_ "repeat=@Y[COUNT]@D\n" " Run the tests repeatedly; use a negative count to repeat forever.\n" " @G--" GTEST_FLAG_PREFIX_ "shuffle@D\n" " Randomize tests' orders on every iteration.\n" " @G--" GTEST_FLAG_PREFIX_ "random_seed=@Y[NUMBER]@D\n" " Random number seed to use for shuffling test orders (between 1 and\n" " 99999, or 0 to use a seed based on the current time).\n" "\n" "Test Output:\n" " @G--" GTEST_FLAG_PREFIX_ "color=@Y(@Gyes@Y|@Gno@Y|@Gauto@Y)@D\n" " Enable/disable colored output. The default is @Gauto@D.\n" " -@G-" GTEST_FLAG_PREFIX_ "print_time=0@D\n" " Don't print the elapsed time of each test.\n" " @G--" GTEST_FLAG_PREFIX_ "output=@Y(@Gjson@Y|@Gxml@Y)[@G:@YDIRECTORY_PATH@G" GTEST_PATH_SEP_ "@Y|@G:@YFILE_PATH]@D\n" " Generate a JSON or XML report in the given directory or with the given\n" " file name. @YFILE_PATH@D defaults to @Gtest_details.xml@D.\n" # if GTEST_CAN_STREAM_RESULTS_ " @G--" GTEST_FLAG_PREFIX_ "stream_result_to=@YHOST@G:@YPORT@D\n" " Stream test results to the given server.\n" # endif // GTEST_CAN_STREAM_RESULTS_ "\n" "Assertion Behavior:\n" # if GTEST_HAS_DEATH_TEST && !GTEST_OS_WINDOWS " @G--" GTEST_FLAG_PREFIX_ "death_test_style=@Y(@Gfast@Y|@Gthreadsafe@Y)@D\n" " Set the default death test style.\n" # endif // GTEST_HAS_DEATH_TEST && !GTEST_OS_WINDOWS " @G--" GTEST_FLAG_PREFIX_ "break_on_failure@D\n" " Turn assertion failures into debugger break-points.\n" " @G--" GTEST_FLAG_PREFIX_ "throw_on_failure@D\n" " Turn assertion failures into C++ exceptions for use by an external\n" " test framework.\n" " @G--" GTEST_FLAG_PREFIX_ "catch_exceptions=0@D\n" " Do not report exceptions as test failures. Instead, allow them\n" " to crash the program or throw a pop-up (on Windows).\n" "\n" "Except for @G--" GTEST_FLAG_PREFIX_ "list_tests@D, you can alternatively set " "the corresponding\n" "environment variable of a flag (all letters in upper-case). For example, to\n" "disable colored text output, you can either specify @G--" GTEST_FLAG_PREFIX_ "color=no@D or set\n" "the @G" GTEST_FLAG_PREFIX_UPPER_ "COLOR@D environment variable to @Gno@D.\n" "\n" "For more information, please read the " GTEST_NAME_ " documentation at\n" "@G" GTEST_PROJECT_URL_ "@D. If you find a bug in " GTEST_NAME_ "\n" "(not one in your own code or tests), please report it to\n" "@G<" GTEST_DEV_EMAIL_ ">@D.\n"; static bool ParseGoogleTestFlag(const char* const arg) { return ParseBoolFlag(arg, kAlsoRunDisabledTestsFlag, >EST_FLAG(also_run_disabled_tests)) || ParseBoolFlag(arg, kBreakOnFailureFlag, >EST_FLAG(break_on_failure)) || ParseBoolFlag(arg, kCatchExceptionsFlag, >EST_FLAG(catch_exceptions)) || ParseStringFlag(arg, kColorFlag, >EST_FLAG(color)) || ParseStringFlag(arg, kDeathTestStyleFlag, >EST_FLAG(death_test_style)) || ParseBoolFlag(arg, kDeathTestUseFork, >EST_FLAG(death_test_use_fork)) || ParseStringFlag(arg, kFilterFlag, >EST_FLAG(filter)) || ParseStringFlag(arg, kInternalRunDeathTestFlag, >EST_FLAG(internal_run_death_test)) || ParseBoolFlag(arg, kListTestsFlag, >EST_FLAG(list_tests)) || ParseStringFlag(arg, kOutputFlag, >EST_FLAG(output)) || ParseBoolFlag(arg, kPrintTimeFlag, >EST_FLAG(print_time)) || ParseBoolFlag(arg, kPrintUTF8Flag, >EST_FLAG(print_utf8)) || ParseInt32Flag(arg, kRandomSeedFlag, >EST_FLAG(random_seed)) || ParseInt32Flag(arg, kRepeatFlag, >EST_FLAG(repeat)) || ParseBoolFlag(arg, kShuffleFlag, >EST_FLAG(shuffle)) || ParseInt32Flag(arg, kStackTraceDepthFlag, >EST_FLAG(stack_trace_depth)) || ParseStringFlag(arg, kStreamResultToFlag, >EST_FLAG(stream_result_to)) || ParseBoolFlag(arg, kThrowOnFailureFlag, >EST_FLAG(throw_on_failure)); } #if GTEST_USE_OWN_FLAGFILE_FLAG_ static void LoadFlagsFromFile(const std::string& path) { FILE* flagfile = posix::FOpen(path.c_str(), "r"); if (!flagfile) { GTEST_LOG_(FATAL) << "Unable to open file \"" << GTEST_FLAG(flagfile) << "\""; } std::string contents(ReadEntireFile(flagfile)); posix::FClose(flagfile); std::vector lines; SplitString(contents, '\n', &lines); for (size_t i = 0; i < lines.size(); ++i) { if (lines[i].empty()) continue; if (!ParseGoogleTestFlag(lines[i].c_str())) g_help_flag = true; } } #endif // GTEST_USE_OWN_FLAGFILE_FLAG_ // Parses the command line for Google Test flags, without initializing // other parts of Google Test. The type parameter CharType can be // instantiated to either char or wchar_t. template void ParseGoogleTestFlagsOnlyImpl(int* argc, CharType** argv) { for (int i = 1; i < *argc; i++) { const std::string arg_string = StreamableToString(argv[i]); const char* const arg = arg_string.c_str(); using internal::ParseBoolFlag; using internal::ParseInt32Flag; using internal::ParseStringFlag; bool remove_flag = false; if (ParseGoogleTestFlag(arg)) { remove_flag = true; #if GTEST_USE_OWN_FLAGFILE_FLAG_ } else if (ParseStringFlag(arg, kFlagfileFlag, >EST_FLAG(flagfile))) { LoadFlagsFromFile(GTEST_FLAG(flagfile)); remove_flag = true; #endif // GTEST_USE_OWN_FLAGFILE_FLAG_ } else if (arg_string == "--help" || arg_string == "-h" || arg_string == "-?" || arg_string == "/?" || HasGoogleTestFlagPrefix(arg)) { // Both help flag and unrecognized Google Test flags (excluding // internal ones) trigger help display. g_help_flag = true; } if (remove_flag) { // Shift the remainder of the argv list left by one. Note // that argv has (*argc + 1) elements, the last one always being // NULL. The following loop moves the trailing NULL element as // well. for (int j = i; j != *argc; j++) { argv[j] = argv[j + 1]; } // Decrements the argument count. (*argc)--; // We also need to decrement the iterator as we just removed // an element. i--; } } if (g_help_flag) { // We print the help here instead of in RUN_ALL_TESTS(), as the // latter may not be called at all if the user is using Google // Test with another testing framework. PrintColorEncoded(kColorEncodedHelpMessage); } } // Parses the command line for Google Test flags, without initializing // other parts of Google Test. void ParseGoogleTestFlagsOnly(int* argc, char** argv) { ParseGoogleTestFlagsOnlyImpl(argc, argv); // Fix the value of *_NSGetArgc() on macOS, but iff // *_NSGetArgv() == argv // Only applicable to char** version of argv #if GTEST_OS_MAC #ifndef GTEST_OS_IOS if (*_NSGetArgv() == argv) { *_NSGetArgc() = *argc; } #endif #endif } void ParseGoogleTestFlagsOnly(int* argc, wchar_t** argv) { ParseGoogleTestFlagsOnlyImpl(argc, argv); } // The internal implementation of InitGoogleTest(). // // The type parameter CharType can be instantiated to either char or // wchar_t. template void InitGoogleTestImpl(int* argc, CharType** argv) { // We don't want to run the initialization code twice. if (GTestIsInitialized()) return; if (*argc <= 0) return; g_argvs.clear(); for (int i = 0; i != *argc; i++) { g_argvs.push_back(StreamableToString(argv[i])); } #if GTEST_HAS_ABSL absl::InitializeSymbolizer(g_argvs[0].c_str()); #endif // GTEST_HAS_ABSL ParseGoogleTestFlagsOnly(argc, argv); GetUnitTestImpl()->PostFlagParsingInit(); } } // namespace internal // Initializes Google Test. This must be called before calling // RUN_ALL_TESTS(). In particular, it parses a command line for the // flags that Google Test recognizes. Whenever a Google Test flag is // seen, it is removed from argv, and *argc is decremented. // // No value is returned. Instead, the Google Test flag variables are // updated. // // Calling the function for the second time has no user-visible effect. void InitGoogleTest(int* argc, char** argv) { #if defined(GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_) GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_(argc, argv); #else // defined(GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_) internal::InitGoogleTestImpl(argc, argv); #endif // defined(GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_) } // This overloaded version can be used in Windows programs compiled in // UNICODE mode. void InitGoogleTest(int* argc, wchar_t** argv) { #if defined(GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_) GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_(argc, argv); #else // defined(GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_) internal::InitGoogleTestImpl(argc, argv); #endif // defined(GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_) } std::string TempDir() { #if defined(GTEST_CUSTOM_TEMPDIR_FUNCTION_) return GTEST_CUSTOM_TEMPDIR_FUNCTION_(); #endif #if GTEST_OS_WINDOWS_MOBILE return "\\temp\\"; #elif GTEST_OS_WINDOWS const char* temp_dir = internal::posix::GetEnv("TEMP"); if (temp_dir == NULL || temp_dir[0] == '\0') return "\\temp\\"; else if (temp_dir[strlen(temp_dir) - 1] == '\\') return temp_dir; else return std::string(temp_dir) + "\\"; #elif GTEST_OS_LINUX_ANDROID return "/sdcard/"; #else return "/tmp/"; #endif // GTEST_OS_WINDOWS_MOBILE } // Class ScopedTrace // Pushes the given source file location and message onto a per-thread // trace stack maintained by Google Test. void ScopedTrace::PushTrace(const char* file, int line, std::string message) { internal::TraceInfo trace; trace.file = file; trace.line = line; trace.message.swap(message); UnitTest::GetInstance()->PushGTestTrace(trace); } // Pops the info pushed by the c'tor. ScopedTrace::~ScopedTrace() GTEST_LOCK_EXCLUDED_(&UnitTest::mutex_) { UnitTest::GetInstance()->PopGTestTrace(); } } // namespace testing iptux-0.9.4/src/googletest/src/gtest_main.cc000066400000000000000000000033431475473122500211050ustar00rootroot00000000000000// Copyright 2006, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include "gtest/gtest.h" GTEST_API_ int main(int argc, char **argv) { printf("Running main() from %s\n", __FILE__); testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } iptux-0.9.4/src/iptux-core/000077500000000000000000000000001475473122500155755ustar00rootroot00000000000000iptux-0.9.4/src/iptux-core/Const.h000066400000000000000000000010111475473122500170250ustar00rootroot00000000000000#ifndef IPTUX_CONST_H #define IPTUX_CONST_H #include namespace iptux { const int MAX_PREVIEWSIZE = 150; const int MAX_BUFLEN = 1024; const int MAX_PATHLEN = 1024; const int MAX_ICONSIZE = 30; const int MAX_PHOTOSIZE = 300; const int MAX_UDPLEN = 8192; const int MAX_SHAREDFILE = 10000; const uint32_t IPTUX_REGULAROPT = 0x00000100UL; const uint32_t IPTUX_SEGMENTOPT = 0x00000200UL; const uint32_t IPTUX_GROUPOPT = 0x00000300UL; const uint32_t IPTUX_BROADCASTOPT = 0x00000400UL; } // namespace iptux #endifiptux-0.9.4/src/iptux-core/CoreThread.cpp000066400000000000000000000510741475473122500203300ustar00rootroot00000000000000#include "config.h" #include "iptux-core/CoreThread.h" #include "Const.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include "iptux-core/Exception.h" #include "iptux-core/internal/Command.h" #include "iptux-core/internal/RecvFileData.h" #include "iptux-core/internal/SendFile.h" #include "iptux-core/internal/TcpData.h" #include "iptux-core/internal/UdpData.h" #include "iptux-core/internal/UdpDataService.h" #include "iptux-core/internal/ipmsg.h" #include "iptux-core/internal/support.h" #include "iptux-utils/output.h" #include "iptux-utils/utils.h" using namespace std; using namespace std::placeholders; namespace iptux { namespace { /** * 初始化程序iptux的运行环境. * cache iptux {pic, photo, icon} \n * config iptux {log, photo, icon} \n */ void init_iptux_environment() { const char* env; char path[MAX_PATHLEN]; env = g_get_user_cache_dir(); if (access(env, F_OK) != 0) g_mkdir(env, 0755); snprintf(path, MAX_PATHLEN, "%s" IPTUX_PATH, env); if (access(path, F_OK) != 0) g_mkdir(path, 0755); snprintf(path, MAX_PATHLEN, "%s" PIC_PATH, env); if (access(path, F_OK) != 0) g_mkdir(path, 0755); snprintf(path, MAX_PATHLEN, "%s" PHOTO_PATH, env); if (access(path, F_OK) != 0) g_mkdir(path, 0755); snprintf(path, MAX_PATHLEN, "%s" ICON_PATH, env); if (access(path, F_OK) != 0) g_mkdir(path, 0755); snprintf(path, MAX_PATHLEN, "%s" LOG_PATH, env); if (access(path, F_OK) != 0) g_mkdir(path, 0755); snprintf(path, MAX_PATHLEN, "%s" SENT_IMAGE_PATH, env); if (access(path, F_OK) != 0) g_mkdir(path, 0755); env = g_get_user_config_dir(); if (access(env, F_OK) != 0) g_mkdir(env, 0777); snprintf(path, MAX_PATHLEN, "%s" IPTUX_PATH, env); if (access(path, F_OK) != 0) g_mkdir(path, 0777); snprintf(path, MAX_PATHLEN, "%s" LOG_PATH, env); if (access(path, F_OK) != 0) g_mkdir(path, 0777); snprintf(path, MAX_PATHLEN, "%s" PHOTO_PATH, env); if (access(path, F_OK) != 0) g_mkdir(path, 0777); snprintf(path, MAX_PATHLEN, "%s" ICON_PATH, env); if (access(path, F_OK) != 0) g_mkdir(path, 0777); snprintf(path, MAX_PATHLEN, "%s" LOG_PATH, env); if (access(path, F_OK) != 0) g_mkdir(path, 0777); } } // namespace struct CoreThread::Impl { uint16_t port; PPalInfo me; UdpDataService_U udp_data_service; GSList* blacklist{nullptr}; // 黑名单链表 bool debugDontBroadcast{false}; vector> pallist; // 好友链表(成员不能被删除) map> privateFiles; int lastTransTaskId{0}; int eventCount{0}; shared_ptr lastEvent{nullptr}; map> transTasks; deque> waitingEvents; std::mutex waitingEventsMutex; future udpFuture; future tcpFuture; future notifyToAllFuture; }; CoreThread::CoreThread(shared_ptr data) : programData(data), config(data->getConfig()), tcpSock(-1), udpSock(-1), started(false), pImpl(std::make_unique()) { if (config->GetBool("debug_dont_broadcast")) { pImpl->debugDontBroadcast = true; } pImpl->port = programData->port(); pImpl->udp_data_service = make_unique(*this); pImpl->me = make_shared("127.0.0.1", port()); (*pImpl->me) .setUser(g_get_user_name()) .setHost(g_get_host_name()) .setName(programData->nickname) .setGroup(programData->mygroup) .setEncode("utf-8") .setCompatible(true); } CoreThread::~CoreThread() { if (started) { stop(); } g_slist_free(pImpl->blacklist); } /** * 程序核心入口,主要任务服务将在此开启. */ void CoreThread::start() { if (started) { throw "CoreThread already started, can't start twice"; } started = true; init_iptux_environment(); bind_iptux_port(); pImpl->udpFuture = async([](CoreThread* ct) { RecvUdpData(ct); }, this); pImpl->tcpFuture = async([](CoreThread* ct) { RecvTcpData(ct); }, this); pImpl->notifyToAllFuture = async([](CoreThread* ct) { SendNotifyToAll(ct); }, this); } void CoreThread::bind_iptux_port() { uint16_t port = programData->port(); struct sockaddr_in addr; tcpSock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); socket_enable_reuse(tcpSock); udpSock = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP); socket_enable_reuse(udpSock); socket_enable_broadcast(udpSock); if ((tcpSock == -1) || (udpSock == -1)) { int ec = errno; const char* errmsg = g_strdup_printf( _("Fatal Error!! Failed to create new socket!\n%s"), strerror(ec)); LOG_WARN("%s", errmsg); throw Exception(SOCKET_CREATE_FAILED, errmsg); } memset(&addr, '\0', sizeof(addr)); addr.sin_family = AF_INET; addr.sin_port = htons(port); auto bind_ip = config->GetString("bind_ip", "0.0.0.0"); addr.sin_addr = inAddrFromString(bind_ip); if (::bind(tcpSock, (struct sockaddr*)&addr, sizeof(addr)) == -1) { int ec = errno; close(tcpSock); close(udpSock); auto errmsg = stringFormat(_("Fatal Error!! Failed to bind the TCP port(%s:%d)!\n%s"), bind_ip.c_str(), port, strerror(ec)); LOG_ERROR("%s", errmsg.c_str()); throw Exception(TCP_BIND_FAILED, errmsg); } else { LOG_INFO("bind TCP port(%s:%d) success.", bind_ip.c_str(), port); } if (::bind(udpSock, (struct sockaddr*)&addr, sizeof(addr)) == -1) { int ec = errno; close(tcpSock); close(udpSock); auto errmsg = stringFormat(_("Fatal Error!! Failed to bind the UDP port(%s:%d)!\n%s"), bind_ip.c_str(), port, strerror(ec)); LOG_ERROR("%s", errmsg.c_str()); throw Exception(UDP_BIND_FAILED, errmsg); } else { LOG_INFO("bind UDP port(%s:%d) success.", bind_ip.c_str(), port); } } /** * 监听UDP服务端口. * @param pcthrd 核心类 */ void CoreThread::RecvUdpData(CoreThread* self) { struct sockaddr_in addr; socklen_t len; char buf[MAX_UDPLEN]; ssize_t size; while (self->started) { struct pollfd pfd = {self->udpSock, POLLIN, 0}; int ret = poll(&pfd, 1, 10); if (ret == -1) { LOG_ERROR("poll udp socket failed: %s", strerror(errno)); return; } if (ret == 0) { continue; } CHECK(ret == 1); len = sizeof(addr); if ((size = recvfrom(self->udpSock, buf, MAX_UDPLEN, 0, (struct sockaddr*)&addr, &len)) == -1) continue; if (size != MAX_UDPLEN) buf[size] = '\0'; auto port = ntohs(addr.sin_port); self->pImpl->udp_data_service->process(addr.sin_addr, port, buf, size); } } /** * 监听TCP服务端口. * @param pcthrd 核心类 */ void CoreThread::RecvTcpData(CoreThread* pcthrd) { int subsock; listen(pcthrd->tcpSock, 5); while (pcthrd->started) { struct pollfd pfd = {pcthrd->tcpSock, POLLIN, 0}; int ret = poll(&pfd, 1, 10); if (ret == -1) { LOG_ERROR("poll udp socket failed: %s", strerror(errno)); return; } if (ret == 0) { continue; } CHECK(ret == 1); if ((subsock = accept(pcthrd->tcpSock, NULL, NULL)) == -1) continue; thread([](CoreThread* coreThread, int subsock) { TcpData::TcpDataEntry(coreThread, subsock); }, pcthrd, subsock) .detach(); } } void CoreThread::stop() { if (!started) { throw "CoreThread not started, or already stopped"; } started = false; ClearSublayer(); pImpl->udpFuture.wait(); pImpl->tcpFuture.wait(); pImpl->notifyToAllFuture.wait(); } uint16_t CoreThread::port() const { return pImpl->port; } void CoreThread::ClearSublayer() { /** * @note 必须在发送下线信息之后才能关闭套接口. */ for (auto palInfo : pImpl->pallist) { SendBroadcastExit(palInfo); } shutdown(tcpSock, SHUT_RDWR); shutdown(udpSock, SHUT_RDWR); } int CoreThread::getUdpSock() const { return udpSock; } shared_ptr CoreThread::getProgramData() { return programData; } /** * 向局域网内所有计算机发送上线信息. * @param pcthrd 核心类 */ void CoreThread::SendNotifyToAll(CoreThread* pcthrd) { Command cmd(*pcthrd); if (!pcthrd->pImpl->debugDontBroadcast) { cmd.BroadCast(pcthrd->udpSock, pcthrd->port()); } cmd.DialUp(pcthrd->udpSock, pcthrd->port()); } /** * 黑名单链表中是否包含此项. * @param ipv4 ipv4 * @return 是否包含 */ bool CoreThread::BlacklistContainItem(in_addr ipv4) const { return g_slist_find(pImpl->blacklist, GUINT_TO_POINTER(ipv4.s_addr)); } bool CoreThread::IsBlocked(in_addr ipv4) const { return programData->IsUsingBlacklist() and BlacklistContainItem(ipv4); } void CoreThread::Lock() const { mutex.lock(); } void CoreThread::Unlock() const { mutex.unlock(); } /** * 获取好友链表. * @return 好友链表 */ const vector>& CoreThread::GetPalList() { return pImpl->pallist; } /** * 从好友链表中移除所有好友数据(非UI线程安全). * @note 鉴于好友链表成员不能被删除,所以将成员改为下线标记即可 */ void CoreThread::ClearAllPalFromList() { /* 清除所有好友的在线标志 */ for (auto palInfo : pImpl->pallist) { palInfo->setOnline(false); } } shared_ptr CoreThread::GetPal(PalKey palKey) { for (auto palInfo : pImpl->pallist) { if (ipv4Equal(palInfo->ipv4(), palKey.GetIpv4())) { return palInfo; } } return {}; } shared_ptr CoreThread::GetPal(const string& ipv4) { return GetPal(PalKey(inAddrFromString(ipv4), port())); } /** * 从好友链表中删除指定的好友信息数据(非UI线程安全). * @param ipv4 ipv4 * @note 鉴于好友链表成员不能被删除,所以将成员改为下线标记即可; * 鉴于群组中只能包含在线的好友,所以若某群组中包含了此好友,则必须从此群组中删除此好友 */ void CoreThread::DelPalFromList(PalKey palKey) { PPalInfo pal; /* 获取好友信息数据,并将其置为下线状态 */ if (!(pal = GetPal(palKey))) return; pal->setOnline(false); emitEvent(make_shared(palKey)); } /** * 通告指定的好友信息数据已经被更新(非UI线程安全). * @param ipv4 ipv4 * @note 什么时候会用到?1、好友更新个人资料;2、好友下线后又上线了 * @note 鉴于群组中必须包含所有属于自己的成员,移除不属于自己的成员, * 所以好友信息更新后应该重新调整群组成员; * @note 群组中被更新的成员信息也应该在界面上做出相应更新 */ void CoreThread::UpdatePalToList(PalKey palKey) { PPalInfo pal; /* 如果好友链表中不存在此好友,则视为程序设计出错 */ if (!(pal = GetPal(palKey))) { return; } pal->setOnline(true); emitEvent(make_shared(pal)); } /** * 将好友信息数据加入到好友链表(非UI线程安全). * @param pal class PalInfo * @note 鉴于在线的好友必须被分配到它所属的群组,所以加入好友到好友链表的同时 * 也应该分配好友到相应的群组 */ void CoreThread::AttachPalToList(shared_ptr pal) { pImpl->pallist.push_back(pal); pal->setOnline(true); emitNewPalOnline(pal); } void CoreThread::emitNewPalOnline(PPalInfo palInfo) { emitEvent(make_shared(palInfo)); } void CoreThread::emitNewPalOnline(const PalKey& palKey) { auto palInfo = GetPal(palKey); if (palInfo) { NewPalOnlineEvent event(palInfo); emitEvent(make_shared(palInfo)); } else { LOG_ERROR("emitNewPalOnline meet a unknown key: %s", palKey.ToString().c_str()); } } void CoreThread::emitEvent(shared_ptr event) { lock_guard l(pImpl->waitingEventsMutex); pImpl->waitingEvents.push_back(event); this->pImpl->eventCount++; this->pImpl->lastEvent = event; signalEvent.emit(event); } /** * 向好友发送iptux特有的数据. * @param pal class PalInfo */ void CoreThread::sendFeatureData(PPalInfo pal) { Command cmd(*this); char path[MAX_PATHLEN]; const gchar* env; int sock; if (!programData->sign.empty()) { cmd.SendMySign(udpSock, pal); } env = g_get_user_config_dir(); snprintf(path, MAX_PATHLEN, "%s" ICON_PATH "/%s", env, programData->myicon.c_str()); if (access(path, F_OK) == 0) { ifstream ifs(path); cmd.SendMyIcon(udpSock, pal, ifs); } snprintf(path, MAX_PATHLEN, "%s" PHOTO_PATH "/photo", env); if (access(path, F_OK) == 0) { if ((sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1) { LOG_ERROR(_("Fatal Error!!\nFailed to create new socket!\n%s"), strerror(errno)); throw Exception(CREATE_TCP_SOCKET_FAILED); } cmd.SendSublayer(sock, pal, IPTUX_PHOTOPICOPT, path); close(sock); } } void CoreThread::SendMyIcon(PPalInfo pal, istream& iss) { Command(*this).SendMyIcon(udpSock, pal, iss); } void CoreThread::AddBlockIp(in_addr ipv4) { pImpl->blacklist = g_slist_append(pImpl->blacklist, GUINT_TO_POINTER(ipv4.s_addr)); } bool CoreThread::SendMessage(CPPalInfo palInfo, const string& message) { Command cmd(*this); cmd.SendMessage(getUdpSock(), palInfo, message.c_str()); return true; } bool CoreThread::SendMessage(CPPalInfo pal, const ChipData& chipData) { auto ptr = chipData.data.c_str(); switch (chipData.type) { case MessageContentType::STRING: /* 文本类型 */ return SendMessage(pal, chipData.data); case MESSAGE_CONTENT_TYPE_PICTURE: /* 图片类型 */ int sock; if ((sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1) { LOG_ERROR(_("Fatal Error!!\nFailed to create new socket!\n%s"), strerror(errno)); return false; } Command(*this).SendSublayer(sock, pal, IPTUX_MSGPICOPT, ptr); close(sock); // 关闭网络套接口 return true; default: g_assert_not_reached(); } } bool CoreThread::SendMsgPara(shared_ptr para) { for (int i = 0; i < int(para->dtlist.size()); ++i) { if (!SendMessage(para->getPal(), para->dtlist[i])) { LOG_ERROR("send message failed: %s", para->dtlist[i].ToString().c_str()); return false; } } return true; } void CoreThread::AsyncSendMsgPara(std::shared_ptr msgPara) { thread t(&CoreThread::SendMsgPara, this, msgPara); t.detach(); } void CoreThread::InsertMessage(const MsgPara& para) { MsgPara para2 = para; this->emitEvent(make_shared(std::move(para2))); } void CoreThread::InsertMessage(MsgPara&& para) { this->emitEvent(make_shared(std::move(para))); } bool CoreThread::SendAskShared(PPalInfo pal) { Command(*this).SendAskShared(getUdpSock(), pal, 0, NULL); return true; } void CoreThread::SendSharedFiles(PPalInfo pal) { SendFile::SendSharedInfoEntry(this, pal); } void CoreThread::UpdateMyInfo() { Command cmd(*this); Lock(); for (auto pal : pImpl->pallist) { if (pal->isOnline()) { cmd.SendAbsence(udpSock, pal); } if (pal->isOnline() and pal->isCompatible()) { thread t1(bind(&CoreThread::sendFeatureData, this, _1), pal); t1.detach(); } } Unlock(); emitEvent(make_shared()); } /** * 发送通告本计算机下线的信息. * @param pal class PalInfo */ void CoreThread::SendBroadcastExit(PPalInfo pal) { Command cmd(*this); cmd.SendExit(udpSock, pal); } int CoreThread::GetOnlineCount() const { int res = 0; for (auto pal : pImpl->pallist) { if (pal->isOnline()) { res++; } } return res; } void CoreThread::SendDetectPacket(const string& ipv4) { SendDetectPacket(inAddrFromString(ipv4)); } void CoreThread::SendDetectPacket(in_addr ipv4) { Command(*this).SendDetectPacket(udpSock, ipv4, port()); } void CoreThread::emitSomeoneExit(const PalKey& palKey) { if (!GetPal(palKey)) { return; } DelPalFromList(palKey); emitEvent(make_shared(palKey)); } void CoreThread::EmitIconUpdate(const PalKey& palKey) { UpdatePalToList(palKey); emitEvent(make_shared(palKey)); } void CoreThread::SendExit(PPalInfo palInfo) { Command(*this).SendExit(udpSock, palInfo); } const string& CoreThread::GetAccessPublicLimit() const { return programData->GetPasswd(); } void CoreThread::SetAccessPublicLimit(const string& val) { programData->SetPasswd(val); } void CoreThread::AddPrivateFile(PFileInfo file) { CHECK(file); CHECK(file->fileid >= MAX_SHAREDFILE); CHECK(pImpl->privateFiles.count(file->fileid) == 0); pImpl->privateFiles[file->fileid] = file; } bool CoreThread::DelPrivateFile(uint32_t id) { return pImpl->privateFiles.erase(id) >= 1; } PFileInfo CoreThread::GetPrivateFileById(uint32_t id) { if (id < MAX_SHAREDFILE) { FileInfo* f = programData->GetShareFileInfo(id); if (!f) return PFileInfo(); return make_shared(*f); } auto res = pImpl->privateFiles.find(id); if (res == pImpl->privateFiles.end()) { return PFileInfo(); } return res->second; } PFileInfo CoreThread::GetPrivateFileByPacketN(uint32_t packageNum, uint32_t filectime) { for (auto& i : pImpl->privateFiles) { if (i.second->packetn == packageNum && i.second->filenum == filectime) { return i.second; } } return PFileInfo(); } void CoreThread::RegisterTransTask(std::shared_ptr task) { int taskId = ++(pImpl->lastTransTaskId); task->SetTaskId(taskId); pImpl->transTasks[taskId] = task; LOG_INFO("add trans task %d", taskId); } bool CoreThread::TerminateTransTask(int taskId) { auto task = pImpl->transTasks.find(taskId); if (task == pImpl->transTasks.end()) { return false; } task->second->TerminateTrans(); return true; } void CoreThread::RecvFile(FileInfo* file) { auto rfdt = make_shared(this, file); RegisterTransTask(rfdt); rfdt->RecvFileDataEntry(); } void CoreThread::RecvFileAsync(FileInfo* file) { thread t(&CoreThread::RecvFile, this, file); t.detach(); } std::unique_ptr CoreThread::GetTransTaskStat(int taskId) const { auto task = pImpl->transTasks.find(taskId); if (task == pImpl->transTasks.end()) { return {}; } return make_unique(task->second->getTransFileModel()); } void CoreThread::clearFinishedTransTasks() { Lock(); bool changed = false; for (auto it = pImpl->transTasks.begin(); it != pImpl->transTasks.end();) { if (it->second->getTransFileModel().isFinished()) { it = pImpl->transTasks.erase(it); changed = true; } else { it++; } } Unlock(); if (changed) { emitEvent(make_shared()); } } bool CoreThread::SendAskSharedWithPassword(const PalKey& palKey, const std::string& password) { auto epasswd = g_base64_encode((const guchar*)(password.c_str()), password.size()); Command(*this).SendAskShared(udpSock, palKey, IPTUX_PASSWDOPT, epasswd); g_free(epasswd); return true; } void CoreThread::SendUnitMessage(const PalKey& palKey, uint32_t opttype, const string& message) { Command(*this).SendUnitMsg(udpSock, GetPal(palKey), opttype, message.c_str()); } void CoreThread::SendGroupMessage(const PalKey& palKey, const std::string& message) { Command(*this).SendGroupMsg(udpSock, GetPal(palKey), message.c_str()); } void CoreThread::BcstFileInfoEntry(const vector& pals, const vector& files) { SendFile::BcstFileInfoEntry(this, pals, files); } vector> CoreThread::listTransTasks() const { vector> res; Lock(); for (auto it = pImpl->transTasks.begin(); it != pImpl->transTasks.end(); it++) { res.push_back(make_unique(it->second->getTransFileModel())); } Unlock(); return res; } int CoreThread::getEventCount() const { return this->pImpl->eventCount; } shared_ptr CoreThread::getLastEvent() const { return this->pImpl->lastEvent; } PPalInfo CoreThread::getMe() { return this->pImpl->me; } string CoreThread::getUserIconPath() const { return stringFormat("%s%s", g_get_user_cache_dir(), ICON_PATH); } bool CoreThread::HasEvent() const { lock_guard l(pImpl->waitingEventsMutex); return !this->pImpl->waitingEvents.empty(); } shared_ptr CoreThread::PopEvent() { lock_guard l(pImpl->waitingEventsMutex); auto event = pImpl->waitingEvents.front(); pImpl->waitingEvents.pop_front(); return event; } } // namespace iptux iptux-0.9.4/src/iptux-core/CoreThreadTest.cpp000066400000000000000000000204421475473122500211630ustar00rootroot00000000000000#include "gtest/gtest.h" #include "iptux-core/Models.h" #include #include #include #include "iptux-core/CoreThread.h" #include "iptux-core/Exception.h" #include "iptux-core/TestHelper.h" #include "iptux-core/internal/ipmsg.h" #include "iptux-core/internal/support.h" #include "iptux-utils/output.h" #include "iptux-utils/utils.h" using namespace std; using namespace iptux; TEST(CoreThread, Constructor) { auto config = newTestIptuxConfig(); auto core = make_shared(config); core->sign = "abc"; CoreThread* thread = new CoreThread(core); thread->start(); thread->stop(); delete thread; } TEST(CoreThread, IsBlocked) { auto config = newTestIptuxConfig(); auto core = make_shared(config); core->sign = "abc"; CoreThread* thread = new CoreThread(core); EXPECT_FALSE(thread->IsBlocked(inAddrFromString("1.2.3.4"))); thread->AddBlockIp(inAddrFromString("1.2.3.4")); EXPECT_FALSE(thread->IsBlocked(inAddrFromString("1.2.3.4"))); core->SetUsingBlacklist(true); EXPECT_TRUE(thread->IsBlocked(inAddrFromString("1.2.3.4"))); core->SetUsingBlacklist(false); EXPECT_FALSE(thread->IsBlocked(inAddrFromString("1.2.3.4"))); delete thread; } TEST(CoreThread, GetPalList) { auto config = newTestIptuxConfig(); auto core = make_shared(config); core->sign = "abc"; CoreThread* thread = new CoreThread(core); EXPECT_EQ(int(thread->GetPalList().size()), 0); PPalInfo pal = make_shared("127.0.0.1", 2425); int eventCount = thread->getEventCount(); thread->AttachPalToList(pal); EXPECT_EQ(int(thread->GetPalList().size()), 1); EXPECT_EQ(thread->getEventCount(), eventCount + 1); EXPECT_EQ(thread->getLastEvent()->getType(), EventType::NEW_PAL_ONLINE); EXPECT_TRUE(thread->HasEvent()); thread->PopEvent(); delete thread; } TEST(CoreThread, SendMessage) { auto config = newTestIptuxConfig(); auto core = make_shared(config); core->sign = "abc"; CoreThread* thread = new CoreThread(core); auto pal = make_shared("127.0.0.1", 2425); try { thread->SendMessage(pal, "hello world"); EXPECT_TRUE(false); } catch (Exception& e) { EXPECT_EQ(e.getErrorCode(), PAL_KEY_NOT_EXIST); } thread->AttachPalToList(pal); EXPECT_TRUE(thread->SendMessage(pal, "hello world")); delete thread; } TEST(CoreThread, SendMessage_ChipData) { auto config = newTestIptuxConfig(); auto core = make_shared(config); core->sign = "abc"; CoreThread* thread = new CoreThread(core); auto pal = make_shared("127.0.0.1", 2425); thread->AttachPalToList(pal); ChipData chipData("hello world"); EXPECT_TRUE(thread->SendMessage(pal, chipData)); delete thread; } TEST(CoreThread, SendMsgPara) { auto config = newTestIptuxConfig(); auto core = make_shared(config); core->sign = "abc"; CoreThread* thread = new CoreThread(core); PPalInfo pal = make_shared("127.0.0.1", 2425); thread->AttachPalToList(pal); ChipData chipData("hello world"); auto para = make_shared(pal); para->dtlist.push_back(std::move(chipData)); EXPECT_TRUE(thread->SendMsgPara(para)); delete thread; } // TEST(CoreThread, AsyncSendMsgPara) { // auto config = newTestIptuxConfig(); // ProgramData* core = new ProgramData(*config); // core->sign = "abc"; // CoreThread* thread = new CoreThread(*core); // PalInfo pal; // ChipData chipData; // chipData.data = "hello world"; // MsgPara para; // para.pal = &pal; // para.dtlist.push_back(move(chipData)); // thread->AsyncSendMsgPara(move(para)); // delete thread; // delete core; // } TEST(CoreThread, SendAskShared) { auto config = newTestIptuxConfig(); auto core = make_shared(config); core->sign = "abc"; CoreThread* thread = new CoreThread(core); auto pal = make_shared("127.0.0.1", 2425); thread->SendAskShared(pal); delete thread; } TEST(CoreThread, FullCase) { using namespace std::chrono_literals; auto oldLogLevel = Log::getLogLevel(); Log::setLogLevel(LogLevel::INFO); auto config1 = IptuxConfig::newFromString("{}"); config1->SetString("bind_ip", "127.0.0.1"); auto config2 = IptuxConfig::newFromString( "{" "\"bind_ip\": \"127.0.0.2\"," "\"access_shared_limit\": \"qwert\"," "\"personal_sign\": \"smartboy\"" "}"); auto threads = initAndConnnectThreadsFromConfig(config1, config2); auto thread1 = get<0>(threads); auto thread2 = get<1>(threads); EXPECT_TRUE(thread2->GetPal("127.0.0.1")); EXPECT_EQ(thread1->GetOnlineCount(), 1); EXPECT_TRUE(thread1->GetPal("127.0.0.2")); vector> thread2Events; mutex thread2EventsMutex; thread2->signalEvent.connect([&](shared_ptr event) { lock_guard l(thread2EventsMutex); thread2Events.emplace_back(event); }); auto pal2InThread1 = thread1->GetPal("127.0.0.2"); auto pal1InThread2 = thread2->GetPal("127.0.0.1"); shared_ptr event; thread1->SendMessage(pal2InThread1, "hello world"); while (true) { lock_guard l(thread2EventsMutex); bool finished = false; for (auto e : thread2Events) { if (e->getType() == EventType::NEW_MESSAGE) { event = e; finished = true; break; } } if (finished) { break; } thread1->SendMessage(pal2InThread1, "hello world"); this_thread::sleep_for(10ms); } auto event2 = dynamic_pointer_cast(event); ASSERT_EQ(event2->getMsgPara().dtlist[0].ToString(), "ChipData(MessageContentType::STRING, hello world)"); { lock_guard l(thread2EventsMutex); thread2Events.clear(); } // send my icon while (thread2Events.size() < 1) { ifstream ifs(testDataPath("iptux.png")); thread1->SendMyIcon(pal2InThread1, ifs); this_thread::sleep_for(10ms); } { auto event = thread2Events[0]; EXPECT_EQ(event->getType(), EventType::PAL_UPDATE); auto event2 = dynamic_pointer_cast(event); EXPECT_TRUE(event2); EXPECT_EQ(event2->getPalInfo()->GetKey().ToString(), "127.0.0.1:2425"); } // send ask shared thread1->SendAskShared(pal2InThread1); // send picture ChipData chipData(MessageContentType::PICTURE, testDataPath("iptux.png")); thread1->SendMessage(pal2InThread1, chipData); // WARNING: does not work as expected, the message will be sent from // 127.0.0.2(expect 127.0.0.1) while(thread2Events.size() != 2) { // this_thread::sleep_for(10ms); // } thread1->SendExit(pal2InThread1); while (thread2->GetOnlineCount() != 0) { this_thread::sleep_for(10ms); } thread1->SendDetectPacket("127.0.0.2"); while (thread2->GetOnlineCount() != 1) { this_thread::sleep_for(10ms); } Log::setLogLevel(oldLogLevel); thread1->stop(); thread2->stop(); } TEST(CoreThread, FullCase_ShareWithPassword) { auto oldLogLevel = Log::getLogLevel(); Log::setLogLevel(LogLevel::INFO); auto config1 = IptuxConfig::newFromString("{}"); config1->SetString("bind_ip", "127.0.0.3"); auto config2 = IptuxConfig::newFromString("{}"); config2->SetString("bind_ip", "127.0.0.4"); config2->SetString("access_shared_limit", "qwert"); auto threads = initAndConnnectThreadsFromConfig(config1, config2); auto thread1 = get<0>(threads); auto thread2 = get<1>(threads); thread1->SendAskShared(thread1->GetPal("127.0.0.4")); Log::setLogLevel(oldLogLevel); thread1->stop(); thread2->stop(); } TEST(CoreThread, PrivateFiles) { auto thread = newCoreThreadOnIp("127.0.0.1"); auto file = make_shared(); file->fileid = MAX_SHAREDFILE; file->filepath = g_strdup("hello"); thread->AddPrivateFile(file); auto file2 = thread->GetPrivateFileById(file->fileid); EXPECT_STREQ(file2->filepath, "hello"); EXPECT_TRUE(thread->DelPrivateFile(file->fileid)); EXPECT_FALSE(thread->DelPrivateFile(file->fileid)); EXPECT_FALSE(thread->GetPrivateFileById(file->fileid)); auto file3 = make_shared(); file3->fileid = MAX_SHAREDFILE + 1; file3->filepath = g_strdup("world"); file3->packetn = 123; file3->filenum = 456; thread->AddPrivateFile(file3); auto file4 = thread->GetPrivateFileByPacketN(123, 456); EXPECT_STREQ(file4->filepath, file3->filepath); } TEST(CoreThread, clearFinishedTransTasks) { auto thread = newCoreThreadOnIp("127.0.0.1"); thread->clearFinishedTransTasks(); } iptux-0.9.4/src/iptux-core/Event.cpp000066400000000000000000000041701475473122500173640ustar00rootroot00000000000000#include "config.h" #include "iptux-core/Event.h" using namespace std; namespace iptux { Event::Event(EventType type) : type(type) {} static const char* event_type_strs[] = { [(int)EventType::NEW_PAL_ONLINE] = "NEW_PAL_ONLINE", [(int)EventType::PAL_UPDATE] = "PAL_UPDATE", [(int)EventType::PAL_OFFLINE] = "PAL_OFFLINE", [(int)EventType::NEW_MESSAGE] = "NEW_MESSAGE", [(int)EventType::ICON_UPDATE] = "ICON_UPDATE", [(int)EventType::PASSWORD_REQUIRED] = "PASSWORD_REQUIRED", [(int)EventType::PERMISSION_REQUIRED] = "PERMISSION_REQUIRED", [(int)EventType::NEW_SHARE_FILE_FROM_FRIEND] = "NEW_SHARE_FILE_FROM_FRIEND", [(int)EventType::SEND_FILE_STARTED] = "SEND_FILE_STARTED", [(int)EventType::SEND_FILE_FINISHED] = "SEND_FILE_FINISHED", [(int)EventType::RECV_FILE_STARTED] = "RECV_FILE_STARTED", [(int)EventType::RECV_FILE_FINISHED] = "RECV_FILE_FINISHED", [(int)EventType::TRANS_TASKS_CHANGED] = "TRANS_TASKS_CHANGED", [(int)EventType::CONFIG_CHANGED] = "CONFIG_CHANGED", }; const char* EventTypeToStr(EventType type) { if (type < EventType::NEW_PAL_ONLINE || type > EventType::CONFIG_CHANGED) { return "UNKNOWN"; } return event_type_strs[(int)type]; } EventType Event::getType() const { return type; } string Event::getSource() const { return "NOT IMPLEMENTED"; } string PalEvent::getSource() const { return GetPalKey().ToString(); } NewPalOnlineEvent::NewPalOnlineEvent(CPPalInfo palInfo) : PalEvent(palInfo->GetKey(), EventType::NEW_PAL_ONLINE), palInfo(palInfo) {} CPPalInfo NewPalOnlineEvent::getPalInfo() const { return palInfo; } PalUpdateEvent::PalUpdateEvent(CPPalInfo palInfo) : PalEvent(palInfo->GetKey(), EventType::PAL_UPDATE), palInfo(palInfo) {} CPPalInfo PalUpdateEvent::getPalInfo() const { return palInfo; } NewMessageEvent::NewMessageEvent(MsgPara&& msgPara) : PalEvent(msgPara.getPal()->GetKey(), EventType::NEW_MESSAGE), msgPara(msgPara) {} const MsgPara& NewMessageEvent::getMsgPara() const { return msgPara; } PalOfflineEvent::PalOfflineEvent(PalKey palKey) : PalEvent(palKey, EventType::PAL_OFFLINE) {} } // namespace iptux iptux-0.9.4/src/iptux-core/Exception.cpp000066400000000000000000000010521475473122500202350ustar00rootroot00000000000000#include "config.h" #include "iptux-core/Exception.h" #include #include "iptux-utils/utils.h" using namespace std; namespace iptux { const ErrorCode CREATE_TCP_SOCKET_FAILED(5001, "CREATE_TCP_SOCKET_FAILED"); const ErrorCode SOCKET_CREATE_FAILED(5002, "SOCKET_CREATE_FAILED"); const ErrorCode INVALID_FILE_ATTR(5003, "INVALID_FILE_ATTR"); const ErrorCode PAL_KEY_NOT_EXIST(5004, "PAL_KEY_NOT_EXIST"); const ErrorCode TCP_BIND_FAILED(5005, "TCP_BIND_FAILED"); const ErrorCode UDP_BIND_FAILED(5006, "UDP_BIND_FAILED"); } // namespace iptux iptux-0.9.4/src/iptux-core/IptuxConfig.cpp000066400000000000000000000111621475473122500205410ustar00rootroot00000000000000#include "config.h" #include "iptux-core/IptuxConfig.h" #include #include #include #include #include #include #include "iptux-utils/output.h" using namespace std; namespace iptux { shared_ptr IptuxConfig::newFromString(const string& str) { auto res = shared_ptr(new IptuxConfig()); istringstream iss(str); Json::CharReaderBuilder rbuilder; std::string errs; bool ok = Json::parseFromStream(rbuilder, iss, &res->root, &errs); if (!ok) { g_warning("invalid content in config:\n%s", errs.c_str()); return res; } int version = res->root.get("version", 1).asInt(); if (version != 1) { g_error("unknown config file version %d", version); return res; } return res; } IptuxConfig::IptuxConfig() {} IptuxConfig::IptuxConfig(const string& fname) : fname(fname) { ifstream ifs(fname.c_str()); if (!ifs.is_open()) { g_warning("config file %s not found", fname.c_str()); return; } Json::CharReaderBuilder rbuilder; std::string errs; bool ok = Json::parseFromStream(rbuilder, ifs, &root, &errs); if (!ok) { g_warning("invalid content in config file %s:\n%s", fname.c_str(), errs.c_str()); return; } int version = root.get("version", 1).asInt(); if (version != 1) { g_error("unknown config file version %d (from %s)", version, fname.c_str()); return; } } IptuxConfig::~IptuxConfig() {} const std::string& IptuxConfig::getFileName() const { return fname; } int IptuxConfig::GetInt(const string& key) const { return GetInt(key, 0); } int IptuxConfig::GetInt(const string& key, int defaultValue) const { try { return root.get(key, defaultValue).asInt(); } catch (const Json::LogicError& e) { LOG_WARN("get int value for key %s failed: %s", key.c_str(), e.what()); return defaultValue; } } void IptuxConfig::SetInt(const string& key, int value) { root[key] = value; } bool IptuxConfig::GetBool(const string& key) const { return GetBool(key, false); } bool IptuxConfig::GetBool(const string& key, bool defaultValue) const { try { return root.get(key, defaultValue).asBool(); } catch (const Json::LogicError& e) { LOG_WARN("get bool value for key %s failed: %s", key.c_str(), e.what()); return defaultValue; } } void IptuxConfig::SetBool(const string& key, bool value) { root[key] = value; } string IptuxConfig::GetString(const string& key) const { return GetString(key, ""); } string IptuxConfig::GetString(const string& key, const string& defaultValue) const { Json::Value value = root[key]; if (!value.isString()) { return defaultValue; } return value.asString(); } void IptuxConfig::SetString(const string& key, const string& value) { root[key] = value; } double IptuxConfig::GetDouble(const string& key) const { return root.get(key, 0.0).asDouble(); } void IptuxConfig::SetDouble(const string& key, double value) { root[key] = value; } vector IptuxConfig::GetStringList(const string& key) const { vector res; Json::Value value = root[key]; if (value.isNull()) { return res; } if (value.isArray()) { for (size_t i = 0; i < value.size(); ++i) { res.push_back(value.get(i, "").asString()); } } return res; } void IptuxConfig::SetStringList(const string& key, const vector& value) { root[key] = Json::arrayValue; for (size_t i = 0; i < value.size(); ++i) { root[key][int(i)] = value[i]; } } void IptuxConfig::SetVector(const string& key, const vector& value) { root[key] = Json::arrayValue; for (size_t i = 0; i < value.size(); ++i) { root[key][int(i)] = value[i]; } } vector IptuxConfig::GetVector(const string& key) const { vector res; Json::Value value = root[key]; if (value.isNull()) { return res; } if (value.isArray()) { for (size_t i = 0; i < value.size(); ++i) { res.push_back(value[int(i)]); } } return res; } IptuxConfig& IptuxConfig::Save() { if (!g_file_test(fname.c_str(), G_FILE_TEST_IS_REGULAR)) { const char* dirname = g_path_get_dirname(fname.c_str()); if (g_mkdir_with_parents(dirname, 0700) != 0) { g_error("create config dir %s failed: %s", dirname, strerror(errno)); } } root["version"] = 1; ofstream ofs(fname.c_str()); if (!ofs) { g_warning("open config file %s for write failed.", fname.c_str()); return *this; } ofs << root; if (!ofs) { g_warning("write to config file %s failed.", fname.c_str()); } return *this; } } // namespace iptux iptux-0.9.4/src/iptux-core/IptuxConfigTest.cpp000066400000000000000000000047721475473122500214120ustar00rootroot00000000000000#include #include #include "gtest/gtest.h" #include "iptux-core/IptuxConfig.h" #include "iptux-core/TestHelper.h" using namespace std; using namespace iptux; TEST(IptuxConfig, SetStringList) { auto config = newTestIptuxConfig(); config->SetStringList("key", vector()); EXPECT_EQ(int(config->GetStringList("key").size()), 0); config->SetStringList("key", vector{"hello", "world!"}); EXPECT_EQ(int(config->GetStringList("key").size()), 2); config->SetStringList("key", vector{"hello"}); EXPECT_EQ(int(config->GetStringList("key").size()), 1); config->SetString("key", "hello"); EXPECT_EQ(int(config->GetStringList("key").size()), 0); config->SetInt("key", 1); EXPECT_EQ(int(config->GetStringList("key").size()), 0); } TEST(IptuxConfig, GetBool) { auto config = newTestIptuxConfig(); const char* boolKey = "boolKey"; ASSERT_FALSE(config->GetBool(boolKey)); ASSERT_FALSE(config->GetBool(boolKey, false)); ASSERT_TRUE(config->GetBool(boolKey, true)); config->SetBool(boolKey, false); ASSERT_FALSE(config->GetBool(boolKey)); ASSERT_FALSE(config->GetBool(boolKey, false)); ASSERT_FALSE(config->GetBool(boolKey, true)); config->SetBool(boolKey, true); ASSERT_TRUE(config->GetBool(boolKey)); ASSERT_TRUE(config->GetBool(boolKey, false)); ASSERT_TRUE(config->GetBool(boolKey, true)); config->SetString(boolKey, "a"); ASSERT_FALSE(config->GetBool(boolKey)); } TEST(IptuxConfig, GetInt) { auto config = newTestIptuxConfig(); const char* intKey = "intKey"; config->SetString(intKey, "a"); ASSERT_EQ(config->GetInt(intKey, 1234), 1234); config->SetString(intKey, "1"); ASSERT_EQ(config->GetInt(intKey, 1234), 1234); } TEST(IptuxConfig, GetString) { auto config = newTestIptuxConfig(); const char* stringKey = "stringKey"; ASSERT_EQ(config->GetString(stringKey), ""); ASSERT_EQ(config->GetString(stringKey, "world"), "world"); config->SetString(stringKey, "hello"); ASSERT_EQ(config->GetString(stringKey), "hello"); ASSERT_EQ(config->GetString(stringKey, "world"), "hello"); config->SetInt(stringKey, 1); ASSERT_EQ(config->GetString(stringKey), ""); ASSERT_EQ(config->GetString(stringKey, "world"), "world"); config->SetBool(stringKey, false); ASSERT_EQ(config->GetString(stringKey), ""); ASSERT_EQ(config->GetString(stringKey, "world"), "world"); config->SetStringList(stringKey, vector{"hello", "world"}); ASSERT_EQ(config->GetString(stringKey), ""); ASSERT_EQ(config->GetString(stringKey, "world"), "world"); } iptux-0.9.4/src/iptux-core/Models.cpp000066400000000000000000000150501475473122500175250ustar00rootroot00000000000000// // C++ Implementation: mess // // Description: // // // Author: Jally , (C) 2009 // // Copyright: See COPYING file that comes with this distribution // // #include "config.h" #include "iptux-core/Models.h" #include #include #include #include #include #include "iptux-core/internal/AnalogFS.h" #include "iptux-core/internal/ipmsg.h" #include "iptux-utils/utils.h" using namespace std; namespace iptux { PalInfo::PalInfo(in_addr ipv4, uint16_t port) : segdes(NULL), photo(NULL), sign(NULL), packetn(0), rpacketn(0) { this->ipv4_ = ipv4; this->port_ = port; compatible = 0; online = 0; changed = 0; in_blacklist = 0; } PalInfo::PalInfo(const string& ipv4, uint16_t port) : segdes(NULL), photo(NULL), sign(NULL), packetn(0), rpacketn(0) { this->ipv4_ = inAddrFromString(ipv4); this->port_ = port; compatible = 0; online = 0; changed = 0; in_blacklist = 0; } PalInfo::~PalInfo() { g_free(segdes); g_free(photo); g_free(sign); } bool PalInfo::isCompatible() const { return compatible; } bool PalInfo::isOnline() const { return online; } bool PalInfo::isChanged() const { return changed; } PalInfo& PalInfo::setCompatible(bool value) { this->compatible = value; return *this; } PalInfo& PalInfo::setOnline(bool value) { this->online = value; return *this; } PalInfo& PalInfo::setChanged(bool value) { this->changed = value; return *this; } PalInfo& PalInfo::setName(const std::string& name) { this->name = utf8MakeValid(name); return *this; } PalInfo& PalInfo::setUser(const std::string& user) { this->user = utf8MakeValid(user); return *this; } PalInfo& PalInfo::setHost(const std::string& host) { this->host = utf8MakeValid(host); return *this; } PalInfo& PalInfo::setVersion(const std::string& version) { this->version = utf8MakeValid(version); return *this; } PalInfo& PalInfo::setEncode(const std::string& encode) { this->encode = utf8MakeValid(encode); return *this; } PalInfo& PalInfo::setGroup(const std::string& group) { this->group = utf8MakeValid(group); return *this; } string PalInfo::toString() const { return stringFormat( "PalInfo(IP=%s,name=%s,segdes=%s,version=%s,user=%s,host=%s,group=%s," "photo=%s,sign=%s,iconfile=%s,encode=%s,packetn=%d,rpacketn=%d," "compatible=%d,online=%d,changed=%d,in_blacklist=%d)", inAddrToString(ipv4()).c_str(), name.c_str(), segdes, version.c_str(), user.c_str(), host.c_str(), group.c_str(), photo ? photo : "(NULL)", sign ? sign : "(NULL)", icon_file_.c_str(), encode.c_str(), int(packetn), int(rpacketn), compatible, online, changed, in_blacklist); } FileInfo::FileInfo() : fileid(0), packetn(0), fileattr(FileAttr::UNKNOWN), filesize(-1), finishedsize(0), filepath(NULL), filectime(0), filemtime(0), filenum(0) {} FileInfo::~FileInfo() { g_free(filepath); } FileInfo::FileInfo(const FileInfo& f) : fileid(f.fileid), packetn(f.packetn), fileattr(f.fileattr), filesize(f.filesize), finishedsize(f.finishedsize), fileown(f.fileown), filectime(f.filectime), filemtime(f.filemtime), filenum(f.filenum) { filepath = g_strdup(f.filepath); } bool FileInfo::isExist() const { return g_access(filepath, F_OK) != -1; } void FileInfo::ensureFilesizeFilled() { if (filesize >= 0) { return; } AnalogFS afs; filesize = afs.ftwsize(filepath); } MsgPara::MsgPara(CPPalInfo pal) : stype(MessageSourceType::PAL), btype(GROUP_BELONG_TYPE_REGULAR), pal(pal) {} MsgPara::~MsgPara() {} string MsgPara::getSummary() const { if (this->dtlist.empty()) { return _("Empty Message"); } return this->dtlist[0].getSummary(); } ChipData::ChipData(const string& data) : type(MessageContentType::STRING), data(data) {} ChipData::ChipData(MessageContentType type, const string& data) : type(type), data(data) {} ChipData::~ChipData() {} NetSegment::NetSegment() {} NetSegment::NetSegment(string startip, string endip, string description) : startip(startip), endip(endip), description(description) {} NetSegment::~NetSegment() {} uint64_t NetSegment::Count() const { uint32_t start = inAddrToUint32(inAddrFromString(startip)); uint32_t end = inAddrToUint32(inAddrFromString(endip)); if (start > end) { return 0; } return uint64_t(end) - uint64_t(start) + 1; } std::string NetSegment::NthIp(uint64_t i) const { uint32_t start = inAddrToUint32(inAddrFromString(startip)); uint64_t res = start + i; return inAddrToString(inAddrFromUint32(res)); } bool NetSegment::ContainIP(in_addr ipv4) const { return ipv4Compare(inAddrFromString(startip), ipv4) <= 0 && ipv4Compare(ipv4, inAddrFromString(endip)) <= 0; } Json::Value NetSegment::ToJsonValue() const { Json::Value value; value["startip"] = startip; value["endip"] = endip; value["description"] = description; return value; } NetSegment NetSegment::fromJsonValue(Json::Value& value) { NetSegment res; res.startip = value["startip"].asString(); res.endip = value["endip"].asString(); res.description = value["description"].asString(); return res; } string ChipData::ToString() const { ostringstream oss; oss << "ChipData("; switch (type) { case MessageContentType::STRING: oss << "MessageContentType::STRING"; break; case MessageContentType::PICTURE: oss << "MessageContentType::PICTURE"; break; default: g_assert_not_reached(); } oss << ", "; oss << data; oss << ")"; return oss.str(); } string ChipData::getSummary() const { switch (type) { case MessageContentType::STRING: return data; case MessageContentType::PICTURE: return _("Received an image"); default: g_assert_not_reached(); } return ""; } PalKey::PalKey(in_addr ipv4, int port) : ipv4(ipv4), port(port) {} string PalKey::GetIpv4String() const { return inAddrToString(ipv4); } bool PalKey::operator==(const PalKey& rhs) const { return ipv4Equal(this->ipv4, rhs.ipv4) && this->port == rhs.port; } string PalKey::ToString() const { return stringFormat("%s:%d", inAddrToString(ipv4).c_str(), port); } bool FileInfo::operator==(const FileInfo& rhs) const { const FileInfo& lhs = *this; return lhs.fileid == rhs.fileid && lhs.packetn == rhs.packetn && lhs.fileattr == rhs.fileattr && lhs.filesize == rhs.filesize && lhs.finishedsize == rhs.finishedsize && lhs.filectime == rhs.filectime && lhs.filemtime == rhs.filemtime && lhs.filenum == rhs.filenum; } } // namespace iptux iptux-0.9.4/src/iptux-core/ModelsTest.cpp000066400000000000000000000054141475473122500203700ustar00rootroot00000000000000#include "gtest/gtest.h" #include "iptux-core/Models.h" #include "iptux-utils/TestHelper.h" #include "iptux-utils/utils.h" using namespace std; using namespace iptux; TEST(PalInfo, GetKey) { PalInfo info("127.0.0.1", 2425); ASSERT_EQ(info.GetKey().ToString(), "127.0.0.1:2425"); } TEST(PalKey, CopyConstructor) { PalKey key1(inAddrFromString("1.2.3.4"), 1234); PalKey key2 = key1; ASSERT_EQ(key1.ToString(), "1.2.3.4:1234"); ASSERT_EQ(key2.ToString(), "1.2.3.4:1234"); } TEST(PalKey, GetIpv4String) { PalKey key1(inAddrFromString("1.2.3.4"), 1234); ASSERT_EQ(key1.GetIpv4String(), "1.2.3.4"); } TEST(NetSegment, ContainIP) { NetSegment netSegment("1.2.3.4", "1.2.4.5", ""); vector ips = {"1.2.3.4", "1.2.4.5", "1.2.3.255", "1.2.4.0", "1.2.3.5", "1.2.4.4"}; for (const string& ip : ips) { in_addr ip1; ASSERT_EQ(inet_pton(AF_INET, ip.c_str(), &ip1.s_addr), 1) << ip; ASSERT_TRUE(netSegment.ContainIP(ip1)); } vector ips2 = { "1.2.3.3", "1.2.4.6", "0.0.0.0", "100.100.100.100", }; for (const string& ip : ips2) { in_addr ip1; ASSERT_EQ(inet_pton(AF_INET, ip.c_str(), &ip1), 1) << ip; ASSERT_FALSE(netSegment.ContainIP(ip1)); } } TEST(ChipData, ToString) { EXPECT_EQ(ChipData("").ToString(), "ChipData(MessageContentType::STRING, )"); } TEST(ChipData, getSummary) { EXPECT_EQ(ChipData("").getSummary(), ""); EXPECT_EQ(ChipData("foobar").getSummary(), "foobar"); EXPECT_EQ(ChipData(MessageContentType::PICTURE, "foobar").getSummary(), "Received an image"); } TEST(FileAttr, Convert) { EXPECT_EQ(FileAttr(0), FileAttr::UNKNOWN); EXPECT_EQ(FileAttr(1), FileAttr::REGULAR); EXPECT_EQ(FileAttr(2), FileAttr::DIRECTORY); EXPECT_EQ(FileAttr(3), FileAttr(3)); EXPECT_EQ(FileAttr(-1), FileAttr(-1)); } TEST(MsgPara, getSummary) { auto pal = make_shared("127.0.0.1", 2425); MsgPara msg(pal); EXPECT_EQ(msg.getSummary(), "Empty Message"); msg.dtlist.push_back(ChipData("foobar")); EXPECT_EQ(msg.getSummary(), "foobar"); msg.dtlist.push_back(ChipData("foobar2")); EXPECT_EQ(msg.getSummary(), "foobar"); msg.dtlist.clear(); msg.dtlist.push_back(ChipData(MessageContentType::PICTURE, "foobar")); EXPECT_EQ(msg.getSummary(), "Received an image"); } TEST(FileInfo, isExist) { auto path1 = testDataPath("hexdumptest.dat"); FileInfo f; f.filepath = g_strdup(path1.c_str()); ASSERT_TRUE(f.isExist()); auto path2 = testDataPath("hexdumptest-notexist.dat"); FileInfo f2; f2.filepath = g_strdup(path2.c_str()); ASSERT_FALSE(f2.isExist()); } TEST(FileInfo, ensureFilesizeFilled) { auto path1 = testDataPath("hexdumptest.dat"); FileInfo f; f.filepath = g_strdup(path1.c_str()); f.ensureFilesizeFilled(); ASSERT_EQ(f.filesize, 256); } iptux-0.9.4/src/iptux-core/ProgramData.cpp000066400000000000000000000165441475473122500205140ustar00rootroot00000000000000#include "config.h" #include "iptux-core/ProgramData.h" #include #include #include "iptux-core/internal/ipmsg.h" #include "iptux-utils/output.h" #include "iptux-utils/utils.h" using namespace std; namespace iptux { static const char* CONFIG_SHARED_FILE_LIST = "shared_file_list"; /** * 类构造函数. */ ProgramData::ProgramData(shared_ptr config) : palicon(NULL), font(NULL), config(config), need_restart_(0) { gettimeofday(×tamp, NULL); InitSublayer(); } /** * 类析构函数. */ ProgramData::~ProgramData() { g_free(palicon); g_free(font); } shared_ptr ProgramData::getConfig() { return config; } /** * 初始化相关类成员数据. */ void ProgramData::InitSublayer() { ReadProgData(); } /** * 写出程序数据. */ void ProgramData::WriteProgData() { gettimeofday(×tamp, NULL); // 更新时间戳 config->SetString("nick_name", nickname); config->SetString("belong_group", mygroup); config->SetString("my_icon", myicon); config->SetString("archive_path", path); config->SetString("personal_sign", sign); config->SetInt("port", port_); config->SetString("candidacy_encode", codeset); config->SetString("preference_encode", encode); config->SetString("pal_icon", palicon); config->SetString("panel_font", font); config->SetBool("open_chat", open_chat); config->SetBool("hide_startup", hide_startup); config->SetBool("open_transmission", open_transmission); config->SetBool("use_enter_key", use_enter_key); config->SetBool("clearup_history", clearup_history); config->SetBool("record_log", record_log); config->SetBool("open_blacklist", open_blacklist); config->SetBool("proof_shared", proof_shared); config->SetBool("hide_taskbar_when_main_window_iconified", hide_taskbar_when_main_window_iconified_); config->SetString("access_shared_limit", passwd); config->SetInt("send_message_retry_in_us", send_message_retry_in_us); WriteNetSegment(); vector sharedFileList; for (const FileInfo& fileInfo : sharedFileInfos) { sharedFileList.push_back(fileInfo.filepath); } config->SetStringList(CONFIG_SHARED_FILE_LIST, sharedFileList); config->Save(); } const std::vector& ProgramData::getNetSegments() const { return netseg; } void ProgramData::setNetSegments(std::vector&& netSegments) { netseg = netSegments; } void ProgramData::set_port(uint16_t port, bool is_init) { if (port == port_) return; uint16_t old_port = port_; port_ = port; if (port_ < 1024 || port_ > 65535) { LOG_WARN("Invalid port number: %d, use default port: %d", port_, IPTUX_DEFAULT_PORT); port_ = IPTUX_DEFAULT_PORT; } if (!is_init && old_port != port_) need_restart_ = true; } /** * 查询(ipv4)所在网段的描述串. * @param ipv4 ipv4 * @return 描述串 */ string ProgramData::FindNetSegDescription(in_addr ipv4) const { for (size_t i = 0; i < netseg.size(); ++i) { if (netseg[i].ContainIP(ipv4)) { return netseg[i].description; } } return ""; } /** * 读取程序数据. */ void ProgramData::ReadProgData() { nickname = config->GetString("nick_name", g_get_user_name()); mygroup = config->GetString("belong_group"); myicon = config->GetString("my_icon", "icon-tux.png"); path = config->GetString("archive_path", g_get_home_dir()); sign = config->GetString("personal_sign"); set_port(config->GetInt("port", IPTUX_DEFAULT_PORT), true); codeset = config->GetString("candidacy_encode", "gb18030,utf-16"); encode = config->GetString("preference_encode", "utf-8"); palicon = g_strdup(config->GetString("pal_icon", "icon-qq.png").c_str()); font = g_strdup(config->GetString("panel_font", "Sans Serif 10").c_str()); open_chat = config->GetBool("open_chat"); hide_startup = config->GetBool("hide_startup"); open_transmission = config->GetBool("open_transmission"); use_enter_key = config->GetBool("use_enter_key"); clearup_history = config->GetBool("clearup_history"); record_log = config->GetBool("record_log", true); open_blacklist = config->GetBool("open_blacklist"); proof_shared = config->GetBool("proof_shared"); hide_taskbar_when_main_window_iconified_ = config->GetBool("hide_taskbar_when_main_window_iconified"); passwd = config->GetString("access_shared_limit"); send_message_retry_in_us = config->GetInt("send_message_retry_in_us", 1000000); if (send_message_retry_in_us <= 0) { send_message_retry_in_us = 1000000; } ReadNetSegment(); /* 读取共享文件数据 */ vector sharedFileList = config->GetStringList(CONFIG_SHARED_FILE_LIST); /* 分析数据并加入文件链表 */ sharedFileInfos.clear(); int pbn = 1; for (size_t i = 0; i < sharedFileList.size(); ++i) { struct stat st; if (stat(sharedFileList[i].c_str(), &st) == -1 || !(S_ISREG(st.st_mode) || S_ISDIR(st.st_mode))) { continue; } /* 加入文件信息到链表 */ FileInfo fileInfo; fileInfo.fileid = pbn++; fileInfo.fileattr = S_ISREG(st.st_mode) ? FileAttr::REGULAR : FileAttr::DIRECTORY; fileInfo.filepath = strdup(sharedFileList[i].c_str()); sharedFileInfos.emplace_back(fileInfo); } } /** * 写出网段数据. */ void ProgramData::WriteNetSegment() { vector jsons; { lock_guard l(mutex); for (size_t i = 0; i < netseg.size(); ++i) { jsons.push_back(netseg[i].ToJsonValue()); } } config->SetVector("scan_net_segment", jsons); } /** * 读取网段数据. * @param client GConfClient */ void ProgramData::ReadNetSegment() { vector values = config->GetVector("scan_net_segment"); for (size_t i = 0; i < values.size(); ++i) { netseg.push_back(NetSegment::fromJsonValue(values[i])); } } void ProgramData::Lock() { mutex.lock(); } void ProgramData::Unlock() { mutex.unlock(); } bool ProgramData::IsAutoOpenChatDialog() const { return open_chat; } bool ProgramData::IsAutoHidePanelAfterLogin() const { return hide_startup; } bool ProgramData::IsAutoOpenFileTrans() const { return open_transmission; } bool ProgramData::IsEnterSendMessage() const { return use_enter_key; } bool ProgramData::IsAutoCleanChatHistory() const { return clearup_history; } bool ProgramData::IsSaveChatHistory() const { return record_log; } bool ProgramData::IsUsingBlacklist() const { return open_blacklist; } bool ProgramData::IsFilterFileShareRequest() const { return proof_shared; } bool ProgramData::isHideTaskbarWhenMainWindowIconified() const { #if HAVE_APPINDICATOR return hide_taskbar_when_main_window_iconified_; #else return false; #endif } ProgramData& ProgramData::SetUsingBlacklist(bool value) { open_blacklist = value; return *this; } FileInfo* ProgramData::GetShareFileInfo(uint32_t fileId) { for (const FileInfo& fileInfo : sharedFileInfos) { if (fileInfo.fileid == fileId) { return new FileInfo(fileInfo); } } return nullptr; } FileInfo* ProgramData::GetShareFileInfo(uint32_t packetn, uint32_t filenum) { for (const FileInfo& fileInfo : sharedFileInfos) { if (fileInfo.packetn == packetn && fileInfo.filenum == filenum) { return new FileInfo(fileInfo); } } return nullptr; } void ProgramData::ClearShareFileInfos() { sharedFileInfos.clear(); } void ProgramData::AddShareFileInfo(FileInfo fileInfo) { sharedFileInfos.emplace_back(std::move(fileInfo)); } } // namespace iptux iptux-0.9.4/src/iptux-core/ProgramDataTest.cpp000066400000000000000000000024471475473122500213510ustar00rootroot00000000000000#include "gtest/gtest.h" #include #include "iptux-core/ProgramData.h" #include "iptux-core/TestHelper.h" using namespace std; using namespace iptux; TEST(ProgramData, Constructor) { auto config = newTestIptuxConfig(); ProgramData* core = new ProgramData(config); ASSERT_TRUE(core->IsSaveChatHistory()); core->WriteProgData(); delete core; g_unlink(config->getFileName().c_str()); } TEST(ProgramData, WriteAndRead) { auto config = newTestIptuxConfigWithFile(); ProgramData* core = new ProgramData(config); NetSegment netSegment; netSegment.startip = "1.2.3.4"; netSegment.endip = "1.2.3.5"; netSegment.description = "foobar"; core->setNetSegments(vector(1, netSegment)); core->WriteProgData(); delete core; auto config2 = make_shared(config->getFileName()); ProgramData* core2 = new ProgramData(config2); ASSERT_EQ(int(core2->getNetSegments().size()), 1); ASSERT_EQ(core2->getNetSegments()[0].startip, "1.2.3.4"); ASSERT_EQ(core2->getNetSegments()[0].endip, "1.2.3.5"); ASSERT_EQ(core2->getNetSegments()[0].description, "foobar"); ASSERT_TRUE(core2->IsSaveChatHistory()); ASSERT_FALSE(core2->IsUsingBlacklist()); ASSERT_FALSE(core2->IsFilterFileShareRequest()); delete core2; g_unlink(config->getFileName().c_str()); } iptux-0.9.4/src/iptux-core/TestHelper.cpp000066400000000000000000000043431475473122500203640ustar00rootroot00000000000000#include "config.h" #include "TestHelper.h" #include "TestConfig.h" #include "iptux-utils/output.h" #include #include #include #include #include "iptux-core/Exception.h" #include "iptux-core/internal/support.h" #include "iptux-utils/utils.h" using namespace std; namespace iptux { shared_ptr newTestIptuxConfig() { auto res = IptuxConfig::newFromString("{}"); res->SetBool("debug_dont_broadcast", true); res->SetInt("send_message_retry_in_us", 1000 * 10); return res; } shared_ptr newTestIptuxConfigWithFile() { char* fname = g_strdup_printf("/tmp/iptux%d.json", g_random_int()); auto res = make_shared(fname); res->SetBool("debug_dont_broadcast", true); g_free(fname); return res; } std::shared_ptr newCoreThread() { auto config = newTestIptuxConfig(); return make_shared(make_shared(config)); } std::shared_ptr newCoreThreadOnIp(const std::string& ip) { auto config = newTestIptuxConfig(); config->SetString("bind_ip", ip); return make_shared(make_shared(config)); } std::tuple initAndConnnectThreadsFromConfig( PIptuxConfig c1, PIptuxConfig c2) { c1->SetBool("debug_dont_broadcast", true); c2->SetBool("debug_dont_broadcast", true); auto thread1 = make_shared(make_shared(c1)); auto thread2 = make_shared(make_shared(c2)); try { thread2->start(); } catch (Exception& e) { cerr << "bind to " << c2->GetString("bind_ip") << " failed.\n" << "if you are using mac, please run `sudo ifconfig lo0 alias " << c2->GetString("bind_ip") << " up` first.\n"; throw; } thread1->start(); while (thread2->GetOnlineCount() != 1) { LOG_INFO("thread2 online count: %d", thread2->GetOnlineCount()); thread1->SendDetectPacket(c2->GetString("bind_ip")); this_thread::sleep_for(10ms); } while (thread1->GetOnlineCount() != 1) { LOG_INFO("thread1 online count: %d", thread1->GetOnlineCount()); thread2->SendDetectPacket(c1->GetString("bind_ip")); this_thread::sleep_for(10ms); } return make_tuple(thread1, thread2); } } // namespace iptux iptux-0.9.4/src/iptux-core/TestHelper.h000066400000000000000000000013431475473122500200260ustar00rootroot00000000000000#ifndef IPTUX_CORE_TESTHELPER_H #define IPTUX_CORE_TESTHELPER_H #include #include #include "iptux-core/CoreThread.h" #include "iptux-core/IptuxConfig.h" namespace iptux { std::shared_ptr newTestIptuxConfig(); std::shared_ptr newTestIptuxConfigWithFile(); std::string testDataPath(const std::string& fname); std::shared_ptr newCoreThread(); std::shared_ptr newCoreThreadOnIp(const std::string& ip); using PIptuxConfig = std::shared_ptr; using PCoreThread = std::shared_ptr; std::tuple initAndConnnectThreadsFromConfig( PIptuxConfig c1, PIptuxConfig c2); } // namespace iptux #endif // IPTUX_TESTHELPER_H iptux-0.9.4/src/iptux-core/TestMain.cpp000066400000000000000000000002261475473122500200250ustar00rootroot00000000000000#include "config.h" #include "gtest/gtest.h" int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } iptux-0.9.4/src/iptux-core/TransFileModel.cpp000066400000000000000000000057161475473122500211620ustar00rootroot00000000000000#include "config.h" #include "iptux-core/TransFileModel.h" #include "iptux-utils/utils.h" #include namespace iptux { TransFileModel::TransFileModel() : fileLength(0), finishedLength(0), finished(false) {} TransFileModel& TransFileModel::setStatus(const std::string& value) { status = value; return *this; } TransFileModel& TransFileModel::setTask(const std::string& value) { task = value; return *this; } TransFileModel& TransFileModel::setPeer(const std::string& value) { peer = value; return *this; } TransFileModel& TransFileModel::setIp(const std::string& value) { ip = value; return *this; } TransFileModel& TransFileModel::setFilename(const std::string& value) { filename = value; return *this; } TransFileModel& TransFileModel::setFileLength(int64_t value) { fileLength = value; return *this; } TransFileModel& TransFileModel::setFinishedLength(int64_t value) { finishedLength = value; return *this; } TransFileModel& TransFileModel::setCost(const std::string& value) { cost = value; return *this; } TransFileModel& TransFileModel::setRemain(const std::string& value) { remain = value; return *this; } TransFileModel& TransFileModel::setRate(const std::string& value) { rate = value; return *this; } TransFileModel& TransFileModel::setFilePath(const std::string& value) { filePath = value; return *this; } TransFileModel& TransFileModel::setTaskId(int taskId) { this->taskId = taskId; return *this; } void TransFileModel::finish() { finished = true; } const std::string& TransFileModel::getStatus() const { return status; } const std::string& TransFileModel::getTask() const { return task; } const std::string& TransFileModel::getPeer() const { return peer; } const std::string& TransFileModel::getIp() const { return ip; } const std::string& TransFileModel::getFilename() const { return filename; } std::string TransFileModel::getFileLengthText() const { const char* t = numeric_to_size(fileLength); std::string res(t); g_free(gpointer(t)); return res; } std::string TransFileModel::getFinishedLengthText() const { const char* t = numeric_to_size(finishedLength); std::string res(t); g_free(gpointer(t)); return res; } double TransFileModel::getProgress() const { return percent(finishedLength, fileLength); } std::string TransFileModel::getProgressText() const { const char* t = g_strdup_printf("%.1f", getProgress()); std::string res(t); g_free(gpointer(t)); return res; } const std::string& TransFileModel::getCost() const { return cost; } const std::string& TransFileModel::getRemain() const { return remain; } const std::string& TransFileModel::getRate() const { return rate; } const std::string& TransFileModel::getFilePath() const { return filePath; } int64_t TransFileModel::getFileLength() const { return fileLength; } bool TransFileModel::isFinished() const { return finished; } int TransFileModel::getTaskId() const { return taskId; } } // namespace iptux iptux-0.9.4/src/iptux-core/internal/000077500000000000000000000000001475473122500174115ustar00rootroot00000000000000iptux-0.9.4/src/iptux-core/internal/AnalogFS.cpp000066400000000000000000000077431475473122500215620ustar00rootroot00000000000000// // C++ Implementation: AnalogFS // // Description: // // // Author: Jally , (C) 2008 // // Copyright: See COPYING file that comes with this distribution // // #include "config.h" #include "AnalogFS.h" #include #include #include #include #include #include "iptux-core/internal/ipmsg.h" #include "iptux-utils/output.h" #include "iptux-utils/utils.h" using namespace std; namespace iptux { static int mergepath(char tpath[], const char* npath); /** * 类构造函数. */ AnalogFS::AnalogFS() { if (!::getcwd(path, MAX_PATHLEN)) { strcpy(path, "/"); } } /** * 类析构函数. */ AnalogFS::~AnalogFS() {} /** * 更改当前工作目录. * @param dir 目录路径 * @return 成功与否 */ int AnalogFS::chdir(const char* dir) { size_t len; char* ptr; if (strcmp(dir, ".") == 0) return 0; if (*dir != '/') { if (strcmp(dir, "..") == 0) { ptr = strrchr(path, '/'); if (ptr != path) *ptr = '\0'; } else { len = strlen(path); ptr = (char*)(*(path + 1) != '\0' ? "/" : ""); snprintf(path + len, MAX_PATHLEN - len, "%s%s", ptr, dir); } } else snprintf(path, MAX_PATHLEN, "%s", dir); return 0; } int AnalogFS::open(const char* fn, int flags) { return open(fn, flags, 0); } /** * 打开文件. * @param fn 文件路径 * @param flags as in open() * @param ... as in open() * @return 文件描述符 */ int AnalogFS::open(const char* fn, int flags, mode_t mode) { char tpath[MAX_PATHLEN]; int fd; strcpy(tpath, path); mergepath(tpath, fn); if ((flags & O_ACCMODE) == O_WRONLY) { auto tfn = assert_filename_inexist(tpath); if ((fd = ::open(tfn.c_str(), flags, mode)) == -1) { pwarning(_("Open() file \"%s\" failed, %s"), tfn.c_str(), strerror(errno)); } } else { if ((fd = ::open(tpath, flags, mode)) == -1) { pwarning(_("Open() file \"%s\" failed, %s"), tpath, strerror(errno)); } } return fd; } /** * 获取文件状态. * @param fn 文件路径 * @param st a stat64 struct * @return 成功与否 */ int AnalogFS::stat(const char* fn, struct ::stat* st) { char tpath[MAX_PATHLEN]; int result; strcpy(tpath, path); mergepath(tpath, fn); if ((result = ::stat(tpath, st)) != 0) { pwarning(_("Stat64() file \"%s\" failed, %s"), tpath, strerror(errno)); } return result; } /** * 创建新的目录. * @param dir 目录路径 * @param mode as in mkdir() * @return 成功与否 */ int AnalogFS::makeDir(const char* dir, mode_t mode) { char tpath[MAX_PATHLEN]; int result; strcpy(tpath, path); mergepath(tpath, dir); if (::access(tpath, F_OK) == 0) return 0; if ((result = g_mkdir(tpath, mode)) != 0) { pwarning(_("Mkdir() directory \"%s\" failed, %s"), tpath, strerror(errno)); } return result; } /** * 获取目录总大小. * @param dir_name 目录路径 * @return 目录大小 */ int64_t AnalogFS::ftwsize(const char* dir_name) { return utils::fileOrDirectorySize(dir_name); } /** * 打开目录. * @param dir 目录路径 * @return DIR */ DIR* AnalogFS::opendir(const char* dir) { char tpath[MAX_PATHLEN]; DIR* dirs; strcpy(tpath, path); mergepath(tpath, dir); if (!(dirs = ::opendir(tpath))) { pwarning(_("Opendir() directory \"%s\" failed, %s"), tpath, strerror(errno)); } return dirs; } /** * 合并路径. * @param tpath[] 基路径 * @param npath 需要被合并的路径 * @return 成功与否 */ int mergepath(char tpath[], const char* npath) { size_t len; char* ptr; if (strcmp(npath, ".") == 0) return 0; if (*npath != '/') { if (strcmp(npath, "..") == 0) { ptr = strrchr(tpath, '/'); if (ptr != tpath) *ptr = '\0'; } else { len = strlen(tpath); ptr = (char*)(*(tpath + 1) != '\0' ? "/" : ""); snprintf(tpath + len, MAX_PATHLEN - len, "%s%s", ptr, npath); } } else snprintf(tpath, MAX_PATHLEN, "%s", npath); return 0; } } // namespace iptux iptux-0.9.4/src/iptux-core/internal/AnalogFS.h000066400000000000000000000017111475473122500212140ustar00rootroot00000000000000// // C++ Interface: AnalogFS // // Description: // 虚拟文件系统,接口函数使用方法尽量与库函数相同 // 意义在于使用此类操作文件可保证多线程安全 // // Author: Jally , (C) 2008 // // Copyright: See COPYING file that comes with this distribution // // #ifndef IPTUX_ANALOGFS_H #define IPTUX_ANALOGFS_H #include #include #include "iptux-core/Models.h" #include "iptux-core/internal/ipmsg.h" namespace iptux { class AnalogFS { public: AnalogFS(); ~AnalogFS(); int chdir(const char* dir); int open(const char* fn, int flags); int open(const char* fn, int flags, mode_t mode); int stat(const char* fn, struct ::stat* st); int makeDir(const char* dir, mode_t mode); int64_t ftwsize(const char* dir); DIR* opendir(const char* dir); private: char path[MAX_PATHLEN]; //当前工作路径 public: inline char* cwd() { return path; } }; } // namespace iptux #endif iptux-0.9.4/src/iptux-core/internal/Command.cpp000066400000000000000000000456331475473122500215060ustar00rootroot00000000000000// // C++ Implementation: Command // // Description: // // // Author: Jally , (C) 2008 // // Copyright: See COPYING file that comes with this distribution // // #include "config.h" #include "Command.h" #include #include #include #include #include #include #include "iptux-core/Exception.h" #include "iptux-core/Models.h" #include "iptux-core/internal/TransAbstract.h" #include "iptux-core/internal/support.h" #include "iptux-utils/output.h" #include "iptux-utils/utils.h" using namespace std; namespace iptux { uint32_t Command::packetn = 1; static PPalInfo getAndCheckPalInfo(CoreThread& coreThread, const PalKey& palKey) { auto res = coreThread.GetPal(palKey); if (!res) { throw Exception(PAL_KEY_NOT_EXIST, stringFormat("palkey not exist: %s", palKey.ToString().c_str())); } return res; } /** * @brief * * @param sockfd * @param buf * @param len * @param flags * @param dest_addr * @param addrlen * @return true means success * @return false means failed */ static bool commandSendTo(int sockfd, const void* buf, size_t len, int flags, in_addr ipv4, int port) { if (Log::IsDebugEnabled()) { LOG_DEBUG("send udp message to %s:%d, size %d\n%s", inAddrToString(ipv4).c_str(), port, int(len), stringDump(string((const char*)buf, len)).c_str()); } else if (Log::IsInfoEnabled()) { LOG_INFO("send udp message to %s:%d, size %d", inAddrToString(ipv4).c_str(), port, int(len)); } struct sockaddr_in addr; memset(&addr, '\0', sizeof(addr)); addr.sin_family = AF_INET; addr.sin_port = htons(port); addr.sin_addr = ipv4; return sendto(sockfd, buf, len, flags, (struct sockaddr*)(&addr), sizeof(struct sockaddr_in)) != -1; } static bool commandSendTo(int sockfd, const void* buf, size_t len, int flags, CPPalInfo pal) { return commandSendTo(sockfd, buf, len, flags, pal->ipv4(), pal->port()); } /** * 类构造函数. */ Command::Command(CoreThread& coreThread) : coreThread(coreThread), size(0), buf("") {} /** * 类析构函数. */ Command::~Command() {} /** * 向局域网所有计算机广播上线信息. * @param sock udp socket */ void Command::BroadCast(int sock, uint16_t port) { auto programData = coreThread.getProgramData(); CreateCommand(IPMSG_ABSENCEOPT | IPMSG_BR_ENTRY, programData->nickname.c_str()); ConvertEncode(programData->encode); CreateIptuxExtra(programData->encode); auto addrs = get_sys_broadcast_addr(sock); for (auto& addr : addrs) { in_addr ipv4 = inAddrFromString(addr); commandSendTo(sock, buf, size, 0, ipv4, port); g_usleep(9999); } } /** * 向局域网某些计算机单独发送上线信息. * @param sock udp socket */ void Command::DialUp(int sock, uint16_t port) { auto programData = coreThread.getProgramData(); CreateCommand(IPMSG_DIALUPOPT | IPMSG_ABSENCEOPT | IPMSG_BR_ENTRY, programData->nickname.c_str()); ConvertEncode(programData->encode); CreateIptuxExtra(programData->encode); // 与某些代码片段的获取网段描述相冲突,必须复制出来使用 programData->Lock(); vector list = programData->getNetSegments(); programData->Unlock(); for (const NetSegment& ns : list) { uint64_t c = ns.Count(); for (uint64_t j = 0; j < c; ++j) { auto ip = ns.NthIp(j); commandSendTo(sock, buf, size, 0, inAddrFromString(ip), port); g_usleep(999); } } } /** * 回复好友本人在线. * @param sock udp socket * @param pal class PalInfo */ void Command::SendAnsentry(int sock, CPPalInfo pal) { auto programData = coreThread.getProgramData(); CreateCommand(IPMSG_ABSENCEOPT | IPMSG_ANSENTRY, programData->nickname.c_str()); ConvertEncode(pal->getEncode()); CreateIptuxExtra(pal->getEncode()); commandSendTo(sock, buf, size, 0, pal); } /** * 通告好友本人下线. * @param sock udp socket * @param pal class PalInfo */ void Command::SendExit(int sock, CPPalInfo pal) { CreateCommand(IPMSG_DIALUPOPT | IPMSG_BR_EXIT, NULL); ConvertEncode(pal->getEncode()); commandSendTo(sock, buf, size, 0, pal); } /** * 通告好友本人个人信息已变. * @param sock udp socket * @param pal class PalInfo */ void Command::SendAbsence(int sock, CPPalInfo pal) { auto programData = coreThread.getProgramData(); CreateCommand(IPMSG_ABSENCEOPT | IPMSG_BR_ABSENCE, programData->nickname.c_str()); ConvertEncode(pal->getEncode()); CreateIptuxExtra(pal->getEncode()); commandSendTo(sock, buf, size, 0, pal); } /** * 尝试着给某计算机发送一个上线信息数据包. * @param sock udp socket * @param ipv4 ipv4 address */ void Command::SendDetectPacket(int sock, in_addr ipv4, uint16_t port) { auto programData = coreThread.getProgramData(); CreateCommand(IPMSG_DIALUPOPT | IPMSG_ABSENCEOPT | IPMSG_BR_ENTRY, programData->nickname.c_str()); ConvertEncode(programData->encode); CreateIptuxExtra(programData->encode); commandSendTo(sock, buf, size, 0, ipv4, port); } /** * 给好友发送消息. * @param sock udp socket * @param pal class PalInfo * @param msg 消息数据 */ void Command::SendMessage(int sock, CPPalInfo pal, const char* msg) { uint32_t packetno; uint8_t count; auto pal2 = coreThread.GetPal(pal->GetKey()); if (!pal2) { throw Exception(PAL_KEY_NOT_EXIST); } pal2->rpacketn = packetno = packetn; // 此数据包需要检验回复 CreateCommand(IPMSG_SENDCHECKOPT | IPMSG_SENDMSG, msg); ConvertEncode(pal->getEncode()); count = 0; do { commandSendTo(sock, buf, size, 0, pal); g_usleep(coreThread.getProgramData()->getSendMessageRetryInUs()); count++; } while (pal->rpacketn == packetno && count < MAX_RETRYTIMES); if (pal->rpacketn == packetno) { FeedbackError( pal, GROUP_BELONG_TYPE_REGULAR, _("Your pal didn't receive the packet. He or she is offline maybe.")); } } /** * 回复已收到消息. * @param sock udp socket * @param pal class PalInfo * @param packetno 好友消息的包编号 */ void Command::SendReply(int sock, CPPalInfo pal, uint32_t packetno) { char packetstr[11]; // 10 +1 =11 snprintf(packetstr, 11, "%" PRIu32, packetno); CreateCommand(IPMSG_SENDCHECKOPT | IPMSG_RECVMSG, packetstr); ConvertEncode(pal->getEncode()); commandSendTo(sock, buf, size, 0, pal); } void Command::SendReply(int sock, const PalKey& palKey, uint32_t packetno) { auto palInfo = getAndCheckPalInfo(coreThread, palKey); SendReply(sock, palInfo, packetno); } /** * 群发消息(被其他函数调用). * @param sock udp socket * @param pal class PalInfo * @param msg 消息数据 */ void Command::SendGroupMsg(int sock, CPPalInfo pal, const char* msg) { CreateCommand(IPMSG_BROADCASTOPT | IPMSG_SENDMSG, msg); ConvertEncode(pal->getEncode()); commandSendTo(sock, buf, size, 0, pal); } /** * 发送群组消息(被其他函数调用). * @param sock udp socket * @param pal class PalInfo * @param opttype 命令额外选项 * @param msg 消息数据 */ void Command::SendUnitMsg(int sock, CPPalInfo pal, uint32_t opttype, const char* msg) { CreateCommand(opttype | IPTUX_SENDMSG, msg); ConvertEncode(pal->getEncode()); commandSendTo(sock, buf, size, 0, pal); } /** * 向好友请求文件数据. * @param sock tcp socket * @param pal class PalInfo * @param packetno 好友消息的包编号 * @param fileid 文件ID标识 * @param offset 文件偏移量 * @return 消息发送成功与否 */ bool Command::SendAskData(int sock, CPPalInfo pal, uint32_t packetno, uint32_t fileid, int64_t offset) { char attrstr[35]; // 8+1+8+1+16 +1 =35 struct sockaddr_in addr; const char* iptuxstr = "iptux"; snprintf(attrstr, 35, "%" PRIx32 ":%" PRIx32 ":%" PRIx64, packetno, fileid, offset); // IPMSG和Feiq的命令字段都是只有IPMSG_GETFILEDATA,使用(IPMSG_FILEATTACHOPT | // IPMSG_GETFILEDATA) // 会产生一些潜在的不兼容问题,所以在发往非iptux时只使用IPMSG_GETFILEDATA if (strstr(pal->getVersion().c_str(), iptuxstr)) CreateCommand(IPMSG_FILEATTACHOPT | IPMSG_GETFILEDATA, attrstr); else CreateCommand(IPMSG_GETFILEDATA, attrstr); ConvertEncode(pal->getEncode()); memset(&addr, '\0', sizeof(addr)); addr.sin_family = AF_INET; addr.sin_port = htons(pal->port()); addr.sin_addr = pal->ipv4(); if (((connect(sock, (struct sockaddr*)&addr, sizeof(addr)) == -1) && (errno != EINTR)) || (xsend(sock, buf, size) == -1)) return false; return true; } bool Command::SendAskData(int sock, const PalKey& palKey, uint32_t packetno, uint32_t fileid, int64_t offset) { auto palInfo = getAndCheckPalInfo(coreThread, palKey); return SendAskData(sock, palInfo, packetno, fileid, offset); } /** * 向好友请求目录文件. * @param sock tcp socket * @param pal class PalInfo * @param packetno 好友消息的包编号 * @param fileid 文件ID标识 * @return 消息发送成功与否 */ bool Command::SendAskFiles(int sock, const PalKey& palKey, uint32_t packetno, uint32_t fileid) { auto palInfo = getAndCheckPalInfo(coreThread, palKey); return SendAskFiles(sock, palInfo, packetno, fileid); } bool Command::SendAskFiles(int sock, CPPalInfo pal, uint32_t packetno, uint32_t fileid) { char attrstr[20]; // 8+1+8+1+1 +1 =20 struct sockaddr_in addr; snprintf(attrstr, 20, "%" PRIx32 ":%" PRIx32 ":0", packetno, fileid); // 兼容LanQQ软件 CreateCommand(IPMSG_FILEATTACHOPT | IPMSG_GETDIRFILES, attrstr); ConvertEncode(pal->getEncode()); memset(&addr, '\0', sizeof(addr)); addr.sin_family = AF_INET; addr.sin_port = htons(pal->port()); addr.sin_addr = pal->ipv4(); if (((connect(sock, (struct sockaddr*)&addr, sizeof(addr)) == -1) && (errno != EINTR)) || (xsend(sock, buf, size) == -1)) return false; return true; } /** * 向好友请求共享文件信息. * @param sock udp socket * @param pal class PalInfo * @param opttype 命令额外选项 * @param attach 附加数据,即密码 */ void Command::SendAskShared(int sock, CPPalInfo pal, uint32_t opttype, const char* attach) { CreateCommand(opttype | IPTUX_ASKSHARED, attach); ConvertEncode(pal->getEncode()); commandSendTo(sock, buf, size, 0, pal); } void Command::SendAskShared(int sock, const PalKey& palKey, uint32_t opttype, const char* attach) { auto palInfo = getAndCheckPalInfo(coreThread, palKey); SendAskShared(sock, palInfo, opttype, attach); } /** * 向好友发送文件信息. * @param sock udp socket * @param pal class PalInfo * @param opttype 命令额外选项 * @param extra 扩展数据,即文件信息 */ void Command::SendFileInfo(int sock, CPPalInfo pal, uint32_t opttype, const char* extra) { CreateCommand(opttype | IPMSG_FILEATTACHOPT | IPMSG_SENDMSG, NULL); ConvertEncode(pal->getEncode()); CreateIpmsgExtra(extra, pal->getEncode().c_str()); commandSendTo(sock, buf, size, 0, pal); } void Command::SendFileInfo(int sock, const PalKey& palKey, uint32_t opttype, const char* extra) { auto palInfo = getAndCheckPalInfo(coreThread, palKey); return SendFileInfo(sock, palInfo, opttype, extra); } /** * 发送本人的头像数据. * @param sock udp socket * @param pal class PalInfo */ void Command::SendMyIcon(int sock, CPPalInfo pal, istream& iss) { CreateCommand(IPTUX_SENDICON, NULL); ConvertEncode(pal->getEncode()); CreateIconExtra(iss); commandSendTo(sock, buf, size, 0, pal); } /** * 发送本人的签名信息. * @param sock udp socket * @param pal class PalInfo */ void Command::SendMySign(int sock, CPPalInfo pal) { auto programData = coreThread.getProgramData(); CreateCommand(IPTUX_SEND_SIGN, programData->sign.c_str()); ConvertEncode(pal->getEncode()); commandSendTo(sock, buf, size, 0, pal); } /** * 发送底层数据(即发送为最终用户所不能察觉的文件数据). * @param sock tcp socket * @param pal class PalInfo * @param opttype 命令额外选项 * @param path 文件路径 */ void Command::SendSublayer(int sock, CPPalInfo pal, uint32_t opttype, const char* path) { LOG_DEBUG("send tcp message to %s, op %d, file %s", pal->GetKey().ToString().c_str(), int(opttype), path); struct sockaddr_in addr; int fd; CreateCommand(opttype | IPTUX_SENDSUBLAYER, NULL); ConvertEncode(pal->getEncode()); memset(&addr, '\0', sizeof(addr)); addr.sin_family = AF_INET; addr.sin_port = htons(pal->port()); addr.sin_addr = pal->ipv4(); if (((connect(sock, (struct sockaddr*)&addr, sizeof(addr)) == -1) && (errno != EINTR)) || (xsend(sock, buf, size) == -1) || ((fd = open(path, O_RDONLY)) == -1)) { LOG_WARN("send tcp message failed"); return; } SendSublayerData(sock, fd); close(fd); } /** * 回馈错误消息. * @param pal class PalInfo * @param btype 消息归属类型 * @param error 错误串 */ void Command::FeedbackError(CPPalInfo pal, GroupBelongType btype, const char* error) { MsgPara para(coreThread.GetPal(pal->GetKey())); para.stype = MessageSourceType::ERROR; para.btype = btype; ChipData chip(MESSAGE_CONTENT_TYPE_STRING, error); para.dtlist.push_back(std::move(chip)); /* 交给某人处理吧 */ coreThread.InsertMessage(std::move(para)); } /** * 将文件描述符数据写入网络套接口. * @param sock tcp socket * @param fd file descriptor */ void Command::SendSublayerData(int sock, int fd) { ssize_t len; do { if ((len = xread(fd, buf, MAX_UDPLEN)) <= 0) break; if ((len = xsend(sock, buf, len)) <= 0) break; } while (1); } /** * 将缓冲区中的字符串转换为指定的编码. * @param encode 字符集编码 */ void Command::ConvertEncode(const string& encode) { char* ptr; if (encode.empty()) { return; } if (strcasecmp(encode.c_str(), "utf-8") != 0 && (ptr = convert_encode(buf, encode.c_str(), "utf-8"))) { size = strlen(ptr) + 1; memcpy(buf, ptr, size); g_free(ptr); } } /** * 创建命令数据. * @param command 命令字 * @param attach 附加数据 */ void Command::CreateCommand(uint32_t command, const char* attach) { const gchar* env; char* ptr; snprintf(buf, MAX_UDPLEN, "%s", IPTUX_VERSION); size = strlen(buf); ptr = buf + size; snprintf(ptr, MAX_UDPLEN - size, ":%" PRIu32, packetn); packetn++; size += strlen(ptr); ptr = buf + size; env = g_get_user_name(); snprintf(ptr, MAX_UDPLEN - size, ":%s", env); size += strlen(ptr); ptr = buf + size; env = g_get_host_name(); snprintf(ptr, MAX_UDPLEN - size, ":%s", env); size += strlen(ptr); ptr = buf + size; if (command == IPMSG_GETFILEDATA) { snprintf(ptr, MAX_UDPLEN - size, ":%u", command); } else { snprintf(ptr, MAX_UDPLEN - size, ":%u", command); } size += strlen(ptr); ptr = buf + size; snprintf(ptr, MAX_UDPLEN - size, ":%s", attach ? attach : ""); size += strlen(ptr) + 1; } /** * 创建ipmsg的扩展数据(即文件信息). * @param extra 扩展数据 * @param encode 字符集编码 */ void Command::CreateIpmsgExtra(const char* extra, const char* encode) { char *pptr, *ptr; pptr = buf + size; if (encode && strcasecmp(encode, "utf-8") != 0 && (ptr = convert_encode(extra, encode, "utf-8"))) { snprintf(pptr, MAX_UDPLEN - size, "%s", ptr); g_free(ptr); } else snprintf(pptr, MAX_UDPLEN - size, "%s", extra); if ((ptr = strrchr(pptr, '\a'))) *(ptr + 1) = '\0'; size += strlen(pptr) + 1; } /** * 创建iptux程序独有的扩展数据. * @param encode 字符集编码 */ void Command::CreateIptuxExtra(const string& encode) { char *pptr, *ptr; auto programData = coreThread.getProgramData(); pptr = buf + size; if (!encode.empty() && strcasecmp(encode.c_str(), "utf-8") != 0 && (ptr = convert_encode(programData->mygroup.c_str(), encode.c_str(), "utf-8"))) { snprintf(pptr, MAX_UDPLEN - size, "%s", ptr); g_free(ptr); } else snprintf(pptr, MAX_UDPLEN - size, "%s", programData->mygroup.c_str()); size += strlen(pptr) + 1; pptr = buf + size; snprintf(pptr, MAX_UDPLEN - size, "%s", programData->myicon.c_str()); size += strlen(pptr) + 1; pptr = buf + size; snprintf(pptr, MAX_UDPLEN - size, "utf-8"); size += strlen(pptr) + 1; } /** * 创建个人头像的扩展数据. */ void Command::CreateIconExtra(istream& iss) { iss.read(buf + size, MAX_UDPLEN - size); size += iss.gcount(); } namespace { FileInfo decodeFileInfo(char** extra) { FileInfo file; auto s = *extra; file.fileid = iptux_get_dec_number(*extra, ':', 0); file.fileattr = FileAttr(iptux_get_hex_number(*extra, ':', 4)); file.filesize = iptux_get_hex64_number(*extra, ':', 2); file.filepath = ipmsg_get_filename(*extra, ':', 1); file.filectime = iptux_get_hex_number(*extra, ':', 3); file.finishedsize = 0; if (!FileAttrIsValid(file.fileattr)) { throw Exception(INVALID_FILE_ATTR, stringFormat("decode failed: %s", s)); } // 分割,格式1(\a) 格式2(:\a) 格式3(\a:) 格式4(:\a:) *extra = strchr(*extra, '\a'); if (*extra) // 跳过'\a'字符 (*extra)++; if (*extra && (**extra == ':')) // 跳过可能存在的':'字符 (*extra)++; return file; } } // namespace vector Command::decodeFileInfos(const string& s) { vector res; auto extra2 = g_strdup(s.c_str()); auto extra3 = extra2; while (extra3 && *extra3) { try { res.push_back(decodeFileInfo(&extra3)); } catch (Exception& e) { LOG_WARN("%s", e.what()); break; } } g_free(extra2); return res; } string Command::encodeFileInfo(const FileInfo& fileInfo) { auto name = ipmsg_get_filename_pal(fileInfo.filepath); // 获取面向好友的文件名 auto res = stringFormat( "%" PRIu32 ":%s:%" PRIx64 ":%" PRIx32 ":%x:\a:", fileInfo.fileid, name, fileInfo.filesize, fileInfo.filectime, (unsigned int)fileInfo.fileattr); g_free(name); return res; } } // namespace iptux iptux-0.9.4/src/iptux-core/internal/Command.h000066400000000000000000000067571475473122500211570ustar00rootroot00000000000000// // C++ Interface: Command // // Description: // 创建命令并发送 // // Author: Jally , (C) 2008 // // Copyright: See COPYING file that comes with this distribution // // #ifndef IPTUX_COMMAND_H #define IPTUX_COMMAND_H #include #include #include "iptux-core/CoreThread.h" #include "iptux-core/Models.h" #include "iptux-core/internal/ipmsg.h" namespace iptux { class Command { public: explicit Command(CoreThread& coreThread); ~Command(); Command(const Command&) = delete; Command& operator=(const Command&) = delete; /// Const Pointer to PalInfo using CPPalInfo = std::shared_ptr; void BroadCast(int sock, uint16_t port); void DialUp(int sock, uint16_t port); void SendAnsentry(int sock, CPPalInfo pal); void SendExit(int sock, CPPalInfo pal); void SendAbsence(int sock, CPPalInfo pal); void SendDetectPacket(int sock, in_addr ipv4, uint16_t port); void SendMessage(int sock, CPPalInfo pal, const char* msg); void SendReply(int sock, CPPalInfo pal, uint32_t packetno); void SendReply(int sock, const PalKey& pal, uint32_t packetno); void SendGroupMsg(int sock, CPPalInfo pal, const char* msg); void SendUnitMsg(int sock, CPPalInfo pal, uint32_t opttype, const char* msg); bool SendAskData(int sock, CPPalInfo pal, uint32_t packetno, uint32_t fileid, int64_t offset); bool SendAskData(int sock, const PalKey& pal, uint32_t packetno, uint32_t fileid, int64_t offset); bool SendAskFiles(int sock, CPPalInfo pal, uint32_t packetno, uint32_t fileid); bool SendAskFiles(int sock, const PalKey& pal, uint32_t packetno, uint32_t fileid); void SendAskShared(int sock, CPPalInfo pal, uint32_t opttype, const char* attach); void SendAskShared(int sock, const PalKey& pal, uint32_t opttype, const char* attach); void SendFileInfo(int sock, CPPalInfo pal, uint32_t opttype, const char* extra); void SendFileInfo(int sock, const PalKey& pal, uint32_t opttype, const char* extra); void SendMyIcon(int sock, CPPalInfo pal, std::istream& iss); void SendMySign(int sock, CPPalInfo pal); void SendSublayer(int sock, CPPalInfo pal, uint32_t opttype, const char* path); static std::string encodeFileInfo(const FileInfo& fileInfo); static std::vector decodeFileInfos(const std::string& s); private: void FeedbackError(CPPalInfo pal, GroupBelongType btype, const char* error); void SendSublayerData(int sock, int fd); void ConvertEncode(const std::string& encode); void CreateCommand(uint32_t command, const char* attach); void CreateIpmsgExtra(const char* extra, const char* encode); void CreateIptuxExtra(const std::string& encode); void CreateIconExtra(std::istream& iss); private: CoreThread& coreThread; size_t size; // 当前已使用缓冲区的长度 char buf[MAX_UDPLEN]; // 数据缓冲区 static uint32_t packetn; // 包编号 public: inline uint32_t& Packetn() { return packetn; } }; } // namespace iptux #endif iptux-0.9.4/src/iptux-core/internal/CommandMode.cpp000066400000000000000000000016771475473122500223130ustar00rootroot00000000000000#include "config.h" #include "CommandMode.h" #include #include "iptux-core/internal/ipmsg.h" #include "iptux-utils/utils.h" using namespace std; namespace iptux { string CommandMode::toString() const { switch (mode) { case IPMSG_BR_ENTRY: return "BR_ENTRY"; case IPMSG_BR_EXIT: return "BR_EXIT"; case IPMSG_ANSENTRY: return "ANSENTRY"; case IPMSG_BR_ABSENCE: return "BR_ABSENCE"; case IPMSG_SENDMSG: return "SENDMSG"; case IPMSG_RECVMSG: return "RECVMSG"; case IPTUX_ASKSHARED: return "ASKSHARED"; case IPTUX_SENDICON: return "SENDICON"; case IPTUX_SEND_SIGN: return "SEND_SIGN"; case IPTUX_SENDMSG: return "SENDMSG"; case IPMSG_GETFILEDATA: return "GETFILEDATA"; case IPTUX_SENDSUBLAYER: return "SEND_SUBLAYER"; default: return stringFormat(_("unknown command mode: %d"), mode); } } } // namespace iptux iptux-0.9.4/src/iptux-core/internal/CommandMode.h000066400000000000000000000004571475473122500217530ustar00rootroot00000000000000#ifndef IPTUX_COMMAND_MODE_H #define IPTUX_COMMAND_MODE_H #include namespace iptux { class CommandMode { public: explicit CommandMode(int mode) : mode(mode) {} std::string toString() const; int getMode() const { return mode; } private: int mode; }; } // namespace iptux #endif iptux-0.9.4/src/iptux-core/internal/CommandModeTest.cpp000066400000000000000000000006751475473122500231500ustar00rootroot00000000000000#include "gtest/gtest.h" #include "CommandMode.h" #include "iptux-core/internal/ipmsg.h" using namespace iptux; using namespace std; TEST(CommandMode, toString) { EXPECT_EQ(CommandMode(0).toString(), "unknown command mode: 0"); EXPECT_EQ(CommandMode(1).toString(), "BR_ENTRY"); EXPECT_EQ(CommandMode(2).toString(), "BR_EXIT"); EXPECT_EQ(CommandMode(3).toString(), "ANSENTRY"); EXPECT_EQ(CommandMode(4).toString(), "BR_ABSENCE"); } iptux-0.9.4/src/iptux-core/internal/CommandTest.cpp000066400000000000000000000014671475473122500223430ustar00rootroot00000000000000#include "gtest/gtest.h" #include "Command.h" #include "iptux-core/internal/ipmsg.h" #include using namespace iptux; using namespace std; TEST(Command, encodeFileInfo) { FileInfo fileInfo; fileInfo.filepath = g_strdup("/etc/bashrc"); fileInfo.fileattr = FileAttr::REGULAR; auto a = Command::encodeFileInfo(fileInfo); ASSERT_EQ(a, "0:bashrc:ffffffffffffffff:0:1:\a:"); vector fileInfos = Command::decodeFileInfos(a); ASSERT_EQ(int(fileInfos.size()), 1); ASSERT_EQ(fileInfos[0], fileInfo); fileInfos = Command::decodeFileInfos(a + a); ASSERT_EQ(int(fileInfos.size()), 2); ASSERT_EQ(fileInfos[0], fileInfo); ASSERT_EQ(fileInfos[1], fileInfo); string b = "0:bashrc:ffffffffffffffff:0:0:\a:"; fileInfos = Command::decodeFileInfos(b); ASSERT_EQ(int(fileInfos.size()), 0); } iptux-0.9.4/src/iptux-core/internal/RecvFile.cpp000066400000000000000000000023261475473122500216170ustar00rootroot00000000000000// // C++ Implementation: RecvFile // // Description: // // // Author: cwll ,(C) 2012.02 // Jally , (C) 2008 // 2012.02:把文件接收确认和选择放在了聊天窗口,所以这个类的大部分功能都不用了 // // Copyright: See COPYING file that comes with this distribution // // #include "config.h" #include "RecvFile.h" #include #include "iptux-core/Exception.h" #include "iptux-core/internal/Command.h" #include "iptux-core/internal/TransAbstract.h" #include "iptux-utils/utils.h" using namespace std; namespace iptux { /** * 类构造函数. */ RecvFile::RecvFile() {} /** * 类析构函数. */ RecvFile::~RecvFile() {} FileInfo* DivideFileinfo(char** extra); /** * 文件接受入口. * @param para 文件参数 */ void RecvFile::RecvEntry(CoreThread* coreThread, PPalInfo pal, const std::string extra, int packetno) { auto fileInfos = Command::decodeFileInfos(extra); for (auto fileInfo : fileInfos) { fileInfo.packetn = packetno; fileInfo.fileown = pal; coreThread->emitEvent(make_shared(fileInfo)); } } } // namespace iptux iptux-0.9.4/src/iptux-core/internal/RecvFile.h000066400000000000000000000016251475473122500212650ustar00rootroot00000000000000// // C++ Interface: RecvFile // // Description: // 接受相关的文件信息,不包含文件数据 // // Author: cwll ,(C) 2012.02 // Jally , (C) 2008 // 2012.02:把文件接收确认和选择放在了聊天窗口,所以这个类的大部分功能都不用了 // // Copyright: See COPYING file that comes with this distribution // // #ifndef IPTUX_RECVFILE_H #define IPTUX_RECVFILE_H #include #include #include "iptux-core/CoreThread.h" #include "iptux-core/Models.h" namespace iptux { class RecvFile { private: RecvFile(); ~RecvFile(); public: static void RecvEntry(CoreThread* coreThread, PPalInfo pal, const std::string extra, int packeno); private: void ParseFilePara(GData** para); FileInfo* DivideFileinfo(char** extra); }; } // namespace iptux #endif iptux-0.9.4/src/iptux-core/internal/RecvFileData.cpp000066400000000000000000000270371475473122500224170ustar00rootroot00000000000000// // C++ Implementation: RecvFileData // // Description: // // // Author: Jally , (C) 2009 // // Copyright: See COPYING file that comes with this distribution // // #include "config.h" #include "RecvFileData.h" #include #include #include #include #include #include #include #include #include "iptux-core/Event.h" #include "iptux-core/Exception.h" #include "iptux-core/internal/AnalogFS.h" #include "iptux-core/internal/Command.h" #include "iptux-core/internal/ipmsg.h" #include "iptux-utils/output.h" #include "iptux-utils/utils.h" using namespace std; namespace iptux { /** * 类构造函数. * @param fl 文件信息数据 */ RecvFileData::RecvFileData(CoreThread* coreThread, FileInfo* fl) : coreThread(coreThread), file(fl), terminate(false), sumsize(0) { buf[0] = '\0'; gettimeofday(&tasktime, NULL); /* gettimeofday(&filetime, NULL);//个人感觉没必要 */ } /** * 类析构函数. */ RecvFileData::~RecvFileData() {} /** * 接收文件数据入口. */ void RecvFileData::RecvFileDataEntry() { CHECK(GetTaskId() > 0); CreateUIPara(); coreThread->emitEvent(make_shared(GetTaskId())); /* 创建UI参考数据,并将数据主动加入UI */ // gdk_threads_enter(); // g_mwin->UpdateItemToTransTree(para); // auto g_progdt = g_cthrd->getUiProgramData(); // if (g_progdt->IsAutoOpenFileTrans()) { // g_mwin->OpenTransWindow(); // } // gdk_threads_leave(); /* 分类处理 */ switch (file->fileattr) { case FileAttr::REGULAR: RecvRegularFile(); break; case FileAttr::DIRECTORY: RecvDirFiles(); break; default: break; } UpdateUIParaToOver(); coreThread->emitEvent(make_shared(GetTaskId())); // /* 主动更新UI */ // gdk_threads_enter(); // g_mwin->UpdateItemToTransTree(para); // gdk_threads_leave(); // /* 处理成功则播放提示音 */ // if (!terminate && FLAG_ISSET(g_progdt->sndfgs, 2)) // g_sndsys->Playing(g_progdt->transtip); } /** * 获取UI参考数据. * @return UI参考数据 */ const TransFileModel& RecvFileData::getTransFileModel() const { return para; } /** * 终止过程处理. */ void RecvFileData::TerminateTrans() { terminate = true; } /** * 创建UI参考数据. */ void RecvFileData::CreateUIPara() { struct in_addr addr = file->fileown->ipv4(); para.setStatus("tip-recv") .setTask(_("receive")) .setPeer(file->fileown->getName()) .setIp(inet_ntoa(addr)) .setFilename(ipmsg_get_filename_me(file->filepath, NULL)) .setFileLength(file->filesize) .setFinishedLength(0) .setCost("00:00:00") .setRemain(_("Unknown")) .setRate("0 B/s") .setFilePath(file->filepath) .setTaskId(GetTaskId()); } /** * 接收常规文件. */ void RecvFileData::RecvRegularFile() { AnalogFS afs; Command cmd(*coreThread); int64_t finishsize; int sock, fd; struct utimbuf timebuf; /* 创建文件传输套接口 */ if ((sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1) { LOG_ERROR(_("Fatal Error!!\nFailed to create new socket!\n%s"), strerror(errno)); throw Exception(CREATE_TCP_SOCKET_FAILED); } /* 请求文件数据 */ if (!cmd.SendAskData(sock, file->fileown->GetKey(), file->packetn, file->fileid, 0)) { close(sock); terminate = true; // 标记处理过程失败 return; } /* 打开文件 */ if ((fd = afs.open(file->filepath, O_WRONLY | O_CREAT | O_TRUNC | O_LARGEFILE, 00644)) == -1) { close(sock); terminate = true; return; } /* 接收文件数据 */ gettimeofday(&filetime, NULL); finishsize = RecvData(sock, fd, file->filesize, 0); close(fd); if (file->filectime != 0) { timebuf.actime = int(file->filectime); timebuf.modtime = int(file->filectime); utime(file->filepath, &timebuf); } // sumsize += finishsize; /* 考察处理结果 */ if (finishsize < file->filesize) { terminate = true; LOG_ERROR(_("Failed to receive the file \"%s\" from %s! expect length %jd, " "received %jd"), file->filepath, file->fileown->getName().c_str(), (intmax_t)file->filesize, (intmax_t)finishsize); } else { LOG_INFO(_("Receive the file \"%s\" from %s successfully!"), file->filepath, file->fileown->getName().c_str()); } /* 关闭文件传输套接口 */ close(sock); } /** * 接收目录文件. */ void RecvFileData::RecvDirFiles() { AnalogFS afs; Command cmd(*coreThread); gchar *dirname, *pathname, *filename, *filectime, *filemtime; int64_t filesize, finishsize; uint32_t headsize, fileattr; int sock, fd; ssize_t size; size_t len; bool result; struct utimbuf timebuf; /* 创建文件传输套接口 */ if ((sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1) { LOG_ERROR(_("Fatal Error!!\nFailed to create new socket!\n%s"), strerror(errno)); throw Exception(CREATE_TCP_SOCKET_FAILED); } /* 请求目录文件 */ if (!cmd.SendAskFiles(sock, file->fileown->GetKey(), file->packetn, file->fileid)) { close(sock); terminate = true; // 标记处理过程失败 return; } /* 转到文件存档目录 */ g_free(ipmsg_get_filename_me(file->filepath, &pathname)); afs.makeDir(pathname, 0777); afs.chdir(pathname); g_free(pathname); /* 接收目录数据 */ result = false; // 预设任务处理失败 len = 0; // 预设缓冲区有效数据量为0 while (!terminate) { /* 读取足够的数据,并分析数据头 */ if ((size = read_ipmsg_fileinfo(sock, buf, MAX_SOCKLEN, len)) == -1) break; headsize = iptux_get_hex_number(buf, ':', 0); filename = ipmsg_get_filename(buf, ':', 1); filesize = iptux_get_hex64_number(buf, ':', 2); fileattr = iptux_get_hex_number(buf, ':', 3); filectime = iptux_get_section_string(buf, ':', 4); filemtime = iptux_get_section_string(buf, ':', 5); if (filectime != NULL) timebuf.actime = int(iptux_get_hex_number(filectime, '=', 1)); if (filemtime != NULL) timebuf.modtime = int(iptux_get_hex_number(filemtime, '=', 1)); len = size - headsize; // 更新缓冲区有效数据量 /* 转码(如果好友不兼容iptux协议) */ if (!file->fileown->isCompatible() && strcasecmp(file->fileown->getEncode().c_str(), "utf-8") != 0 && (dirname = convert_encode(filename, "utf-8", file->fileown->getEncode().c_str()))) g_free(filename); else dirname = filename; /* 更新UI参考值 */ para.setFilename(dirname) .setFileLength(filesize) .setFinishedLength(0) .setCost("00:00:00") .setRemain(_("Unknown")) .setRate("0 B/s"); /* 选择处理方案 */ gettimeofday(&filetime, NULL); switch (GET_MODE(fileattr)) { case IPMSG_FILE_RETPARENT: afs.chdir(".."); if (len) memmove(buf, buf + headsize, len); if (strlen(afs.cwd()) < strlen(file->filepath)) { // 如果这时候还不成功结束就会陷入while开关第1句的死循环 result = true; goto end; } continue; case IPMSG_FILE_DIR: afs.makeDir(dirname, 0777); afs.chdir(dirname); if (len) memmove(buf, buf + headsize, len); continue; case IPMSG_FILE_REGULAR: if ((fd = afs.open(dirname, O_WRONLY | O_CREAT | O_TRUNC | O_LARGEFILE, 00644)) == -1) goto end; break; default: if ((fd = open("/dev/null", O_WRONLY)) == -1) goto end; break; } /* 处理缓冲区剩余数据&读取文件数据 */ size = int64_t(len) < filesize ? int64_t(len) : filesize; if (xwrite(fd, buf + headsize, size) == -1) { close(fd); goto end; } if (size == filesize) { // 文件数据读取已完成 len -= size; if (len) memmove(buf, buf + headsize + size, len); finishsize = size; } else { // 尚需继续读取文件数据 len = 0; // 首先标记缓冲区已无有效数据 finishsize = RecvData(sock, fd, filesize, size); if (finishsize < filesize) { close(fd); goto end; } } close(fd); if (GET_MODE(fileattr) == IPMSG_FILE_REGULAR) { pathname = ipmsg_get_pathname_full(afs.cwd(), dirname); if (utime(pathname, &timebuf) < 0) g_print("Error to modify the file %s's filetime!\n", pathname); g_free(pathname); } // sumsize += filesize; } result = true; /* 考察处理结果 */ end: if (!result) { terminate = true; LOG_ERROR(_("Failed to receive the directory \"%s\" from %s!"), file->filepath, file->fileown->getName().c_str()); } else { LOG_INFO(_("Receive the directory \"%s\" from %s successfully!"), file->filepath, file->fileown->getName().c_str()); } /* 关闭文件传输套接口 */ close(sock); } /** * 接收文件数据. * @param sock tcp socket * @param fd file descriptor * @param filesize 文件总长度 * @param offset 已读取数据量 * @return 完成数据量 */ int64_t RecvFileData::RecvData(int sock, int fd, int64_t filesize, int64_t offset) { int64_t tmpsize, finishsize; struct timeval val1, val2; float difftime; uint32_t rate; ssize_t size; /* 如果文件数据已经完全被接收,则直接返回 */ if (offset == filesize) return filesize; /* 接收数据 */ tmpsize = finishsize = offset; // 初始化已读取数据量 gettimeofday(&val1, NULL); // 初始化起始时间 do { /* 接收数据并写入磁盘 */ size = MAX_SOCKLEN < filesize - finishsize ? MAX_SOCKLEN : filesize - finishsize; if ((size = xread(sock, buf, size)) == -1) return finishsize; if (size > 0 && xwrite(fd, buf, size) == -1) return finishsize; finishsize += size; sumsize += size; file->finishedsize = sumsize; /* 判断是否需要更新UI参考值 */ gettimeofday(&val2, NULL); difftime = difftimeval(val2, val1); if (difftime >= 1) { /* 更新UI参考值 */ rate = (uint32_t)((finishsize - tmpsize) / difftime); para.setFinishedLength(finishsize) .setCost(numeric_to_time((uint32_t)(difftimeval(val2, filetime)))) .setRemain( numeric_to_time((uint32_t)((filesize - finishsize) / rate))) .setRate(numeric_to_rate(rate)); val1 = val2; // 更新时间参考点 tmpsize = finishsize; // 更新下载量 } } while (!terminate && size && finishsize < filesize); return finishsize; } /** * 更新UI参考数据到任务结束. */ void RecvFileData::UpdateUIParaToOver() { struct timeval time; const char* statusfile; statusfile = terminate ? "tip-error" : "tip-finish"; para.setStatus(statusfile); if (!terminate && file->fileattr == FileAttr::DIRECTORY) { para.setFilename(ipmsg_get_filename_me(file->filepath, NULL)); para.setFileLength(sumsize); file->finishedsize = file->filesize; } if (!terminate) { gettimeofday(&time, NULL); para.setFinishedLength(para.getFileLength()) .setCost(numeric_to_time((uint32_t)(difftimeval(time, tasktime)))) .setRemain("") .setRate(""); file->finishedsize = file->filesize; } para.finish(); } } // namespace iptux iptux-0.9.4/src/iptux-core/internal/RecvFileData.h000066400000000000000000000023561475473122500220610ustar00rootroot00000000000000// // C++ Interface: RecvFileData // // Description: // 接收文件数据 // // Author: Jally , (C) 2009 // // Copyright: See COPYING file that comes with this distribution // // #ifndef IPTUX_RECVFILEDATA_H #define IPTUX_RECVFILEDATA_H #include "iptux-core/CoreThread.h" #include "iptux-core/Models.h" #include "iptux-core/internal/TransAbstract.h" #include "iptux-core/internal/ipmsg.h" namespace iptux { class RecvFileData : public TransAbstract { public: RecvFileData(CoreThread* coreThread, FileInfo* fl); virtual ~RecvFileData(); void RecvFileDataEntry(); virtual const TransFileModel& getTransFileModel() const; virtual void TerminateTrans(); private: void CreateUIPara(); void RecvRegularFile(); void RecvDirFiles(); int64_t RecvData(int sock, int fd, int64_t filesize, int64_t offset); void UpdateUIParaToOver(); CoreThread* coreThread; FileInfo* file; //文件信息 TransFileModel para; bool terminate; //终止标志(也作处理结果标识) int64_t sumsize; //文件(目录)总大小 char buf[MAX_SOCKLEN]; //数据缓冲区 struct timeval tasktime, filetime; //任务开始时间&文件开始时间 }; } // namespace iptux #endif iptux-0.9.4/src/iptux-core/internal/SendFile.cpp000066400000000000000000000120551475473122500216110ustar00rootroot00000000000000// // C++ Implementation: SendFile // // Description: // // // Author: Jally , (C) 2008 // // Copyright: See COPYING file that comes with this distribution // // #include "config.h" #include "SendFile.h" #include #include #include #include #include #include "iptux-core/internal/Command.h" #include "iptux-core/internal/SendFileData.h" #include "iptux-utils/output.h" #include "iptux-utils/utils.h" using namespace std; namespace iptux { SendFile::SendFile(CoreThread* coreThread) : coreThread(coreThread) {} SendFile::~SendFile() {} /** * 发送本机共享文件信息入口. * @param pal class PalInfo */ void SendFile::SendSharedInfoEntry(CoreThread* coreThread, PPalInfo pal) { coreThread->Lock(); auto fileInfos = coreThread->getProgramData()->GetSharedFileInfos(); SendFile(coreThread).SendFileInfo(pal, IPTUX_SHAREDOPT, fileInfos); coreThread->Unlock(); } /** * 广播文件信息入口. * @param plist 好友链表 * @param flist 文件信息链表 * @note 文件路径链表中的数据将被本函数处理掉 */ void SendFile::BcstFileInfoEntry(CoreThread* coreThread, const vector& pals, const std::vector& files) { SendFile(coreThread).BcstFileInfo(pals, 0, files); } /** * 请求文件数据入口. * @param sock tcp socket * @param fileattr 文件类型 * @param attach 附加数据 */ void SendFile::RequestDataEntry(CoreThread* coreThread, int sock, FileAttr fileattr, char* attach) { struct sockaddr_in addr; socklen_t len; uint32_t fileid; uint32_t filectime; /* 检查文件属性是否匹配 */ fileid = iptux_get_hex_number(attach, ':', 1); auto file = coreThread->GetPrivateFileById(fileid); /* 兼容windows版信鸽(IPMSG) ,这里的信鸽不是飞鸽传书(IPMSG)*/ if (!file) { fileid = iptux_get_dec_number(attach, ':', 1); file = coreThread->GetPrivateFileById(fileid); } /* 兼容adroid版信鸽(IPMSG) */ if (!file) { fileid = iptux_get_hex_number(attach, ':', 0); filectime = iptux_get_dec_number(attach, ':', 1); file = coreThread->GetPrivateFileByPacketN(fileid, filectime); } if (!file || file->fileattr != fileattr) return; /* 检查好友数据是否存在 */ len = sizeof(addr); getpeername(sock, (struct sockaddr*)&addr, &len); if (!(coreThread->GetPal(addr.sin_addr))) { LOG_INFO("Pal not exist: %s", inAddrToString(addr.sin_addr).c_str()); return; } if (!file->fileown) { // for public shared file, there need one owner file->fileown = coreThread->getMe(); } SendFile(coreThread).ThreadSendFile(sock, file); } /** * 发送文件信息. * @param pal class PalInfo * @param opttype 命令字选项 * @param filist 文件信息链表 */ void SendFile::SendFileInfo(PPalInfo pal, uint32_t opttype, vector& fileInfos) { Command cmd(*coreThread); char buf[MAX_UDPLEN]; size_t len; char *ptr, *name; /* 初始化 */ len = 0; ptr = buf; buf[0] = '\0'; /* 将文件信息写入缓冲区 */ for (FileInfo& fileInfo : fileInfos) { auto file = &fileInfo; if (!fileInfo.isExist()) { continue; } fileInfo.ensureFilesizeFilled(); name = ipmsg_get_filename_pal(file->filepath); //获取面向好友的文件名 file->packetn = cmd.Packetn(); snprintf(ptr, MAX_UDPLEN - len, "%" PRIu32 ":%s:%" PRIx64 ":%" PRIx32 ":%x:\a", file->fileid, name, file->filesize, file->filectime, (unsigned int)file->fileattr); g_free(name); len += strlen(ptr); ptr = buf + len; } /* 发送文件信息 */ cmd.SendFileInfo(coreThread->getUdpSock(), pal->GetKey(), opttype, buf); } /** * 广播文件信息. * @param plist 好友链表 * @param opttype 命令字选项 * @param filist 文件信息链表 */ void SendFile::BcstFileInfo(const std::vector& pals, uint32_t opttype, const std::vector& files) { Command cmd(*coreThread); for (auto pal : pals) { vector buffer; for (auto file : files) { if (!(file->fileown->GetKey() == pal->GetKey())) continue; if (!file->isExist()) continue; file->ensureFilesizeFilled(); file->packetn = cmd.Packetn(); buffer.push_back(Command::encodeFileInfo(*file)); } string res; for (auto b : buffer) { if (res.length() + b.length() > MAX_UDPLEN) break; res += b; } cmd.SendFileInfo(coreThread->getUdpSock(), pal->GetKey(), opttype, res.c_str()); } } /** * 发送文件数据. * @param sock tcp socket * @param file 文件信息 */ void SendFile::ThreadSendFile(int sock, PFileInfo file) { auto sfdt = make_shared(coreThread, sock, file); coreThread->RegisterTransTask(sfdt); sfdt->SendFileDataEntry(); } } // namespace iptux iptux-0.9.4/src/iptux-core/internal/SendFile.h000066400000000000000000000025101475473122500212510ustar00rootroot00000000000000// // C++ Interface: SendFile // // Description: // 发送相关的文件信息,不包含文件数据 // // Author: Jally , (C) 2008 // // Copyright: See COPYING file that comes with this distribution // // #ifndef IPTUX_SENDFILE_H #define IPTUX_SENDFILE_H #include #include "iptux-core/CoreThread.h" #include "iptux-core/Models.h" namespace iptux { class SendFile { private: explicit SendFile(CoreThread* coreThread); ~SendFile(); public: static void SendSharedInfoEntry(CoreThread* coreThread, PPalInfo pal); static void BcstFileInfoEntry(CoreThread* coreThread, const std::vector& pals, const std::vector& files); static void RequestDataEntry(CoreThread* coreThread, int sock, FileAttr fileattr, char* attach); private: void SendFileInfo(PPalInfo pal, uint32_t opttype, std::vector& filist); void BcstFileInfo(const std::vector& pals, uint32_t opttype, const std::vector& files); void ThreadSendFile(int sock, PFileInfo file); private: CoreThread* coreThread; }; } // namespace iptux #endif iptux-0.9.4/src/iptux-core/internal/SendFileData.cpp000066400000000000000000000235531475473122500224100ustar00rootroot00000000000000// // C++ Implementation: SendFileData // // Description: // // // Author: Jally , (C) 2009 // // Copyright: See COPYING file that comes with this distribution // // #include "config.h" #include "SendFileData.h" #include #include #include #include #include #include #include #include #include #include #include #include "iptux-core/internal/AnalogFS.h" #include "iptux-core/Event.h" #include "iptux-utils/output.h" #include "iptux-utils/utils.h" using namespace std; namespace iptux { /** * 类构造函数. * @param sk tcp socket * @param fl 文件信息数据 */ SendFileData::SendFileData(CoreThread* coreThread, int sk, PFileInfo fl) : coreThread(coreThread), sock(sk), file(fl), terminate(false), sumsize(0) { buf[0] = '\0'; gettimeofday(&tasktime, NULL); } /** * 类析构函数. */ SendFileData::~SendFileData() {} /** * 发送文件数据入口. */ void SendFileData::SendFileDataEntry() { CHECK(GetTaskId() > 0); CreateUIPara(); coreThread->emitEvent(make_shared(GetTaskId())); /* 分类处理 */ switch (file->fileattr) { case FileAttr::REGULAR: SendRegularFile(); break; case FileAttr::DIRECTORY: SendDirFiles(); break; default: CHECK(false); break; } UpdateUIParaToOver(); coreThread->emitEvent(make_shared(GetTaskId())); } /** * 获取UI参考数据. * @return UI参考数据 */ const TransFileModel& SendFileData::getTransFileModel() const { return para; } /** * 终止过程处理. */ void SendFileData::TerminateTrans() { terminate = true; } /** * 创建UI参考数据. */ void SendFileData::CreateUIPara() { struct in_addr addr = file->fileown->ipv4(); para.setStatus("tip-send") .setTask(_("send")) .setPeer(file->fileown->getName()) .setIp(inet_ntoa(addr)) .setFilename(ipmsg_get_filename_me(file->filepath, NULL)) .setFileLength(file->filesize) .setFinishedLength(0) .setCost("00:00:00") .setRemain(_("Unknown")) .setRate("0B/s") .setTaskId(GetTaskId()); } /** * 发送常规文件. */ void SendFileData::SendRegularFile() { int64_t finishsize; int fd; /* 打开文件 */ if ((fd = open(file->filepath, O_RDONLY | O_LARGEFILE)) == -1) { terminate = true; // 标记处理过程失败 return; } file->ensureFilesizeFilled(); /* 发送文件数据 */ gettimeofday(&filetime, NULL); finishsize = SendData(fd, file->filesize); close(fd); // sumsize += finishsize; /* 考察处理结果 */ if (finishsize < file->filesize) { terminate = true; LOG_INFO(_("Failed to send the file \"%s\" to %s!"), file->filepath, file->fileown->getName().c_str()); // g_cthrd->SystemLog(_("Failed to send the file \"%s\" to %s!"), // file->filepath, file->fileown->name); } else { LOG_INFO(_("Send the file \"%s\" to %s successfully!"), file->filepath, file->fileown->getName().c_str()); // g_cthrd->SystemLog(_("Send the file \"%s\" to %s successfully!"), // file->filepath, file->fileown->name); } } /** * 发送目录文件. */ void SendFileData::SendDirFiles() { AnalogFS afs; GQueue dirstack = G_QUEUE_INIT; struct stat st; struct dirent *dirt, vdirt; DIR* dir; gchar *dirname, *pathname, *filename; int64_t finishsize; uint32_t headsize; int fd; bool result; /* 转到上传目录位置 */ dirname = ipmsg_get_filename_me(file->filepath, &pathname); afs.chdir(pathname); g_free(pathname); strcpy(vdirt.d_name, dirname); dirt = &vdirt; g_free(dirname); result = false; // 预设任务处理失败 dir = NULL; // 预设当前目录流无效 goto start; while (!g_queue_is_empty(&dirstack)) { /* 取出最后一次压入堆栈的目录流 */ dir = (DIR*)g_queue_pop_head(&dirstack); /* 发送目录流中的下属数据 */ while (dir && (dirt = readdir(dir))) { if (strcmp(dirt->d_name, ".") == 0 || strcmp(dirt->d_name, "..") == 0) continue; /* 检查文件是否可用 */ start: if (afs.stat(dirt->d_name, &st) == -1 || !(S_ISREG(st.st_mode) || S_ISDIR(st.st_mode))) continue; /* 更新UI参考值 */ para.setFilename(dirt->d_name) .setFileLength(st.st_size) .setFinishedLength(0) .setCost("00:00:00") .setRemain(_("Unknown")) .setRate("0B/s"); /* 转码 */ if (strcasecmp(file->fileown->getEncode().c_str(), "utf-8") != 0 && (filename = convert_encode( dirt->d_name, file->fileown->getEncode().c_str(), "utf-8"))) { dirname = ipmsg_get_filename_pal(filename); g_free(filename); } else dirname = ipmsg_get_filename_pal(dirt->d_name); /* 构造数据头并发送 */ snprintf(buf, MAX_SOCKLEN, "0000:%s:%.9jx:%lx:%lx=%jx:%lx=%jx:", dirname, (uintmax_t)(S_ISREG(st.st_mode) ? st.st_size : 0), S_ISREG(st.st_mode) ? IPMSG_FILE_REGULAR : IPMSG_FILE_DIR, IPMSG_FILE_MTIME, (uintmax_t)st.st_mtime, IPMSG_FILE_CREATETIME, (uintmax_t)st.st_ctime); g_free(dirname); headsize = strlen(buf); snprintf(buf, MAX_SOCKLEN, "%.4" PRIx32, headsize); *(buf + 4) = ':'; if (xwrite(sock, buf, headsize) == -1) goto end; /* 选择处理方案 */ gettimeofday(&filetime, NULL); if (S_ISREG(st.st_mode)) { // 常规文件 if ((fd = afs.open(dirt->d_name, O_RDONLY | O_LARGEFILE)) == -1) goto end; finishsize = SendData(fd, st.st_size); close(fd); if (finishsize < st.st_size) goto end; // sumsize += finishsize; } else if (S_ISDIR(st.st_mode)) { // 目录文件 if (dir) // 若当前目录流有效则须压入堆栈 g_queue_push_head(&dirstack, dir); /* 打开下属目录 */ if (!(dir = afs.opendir(dirt->d_name))) goto end; /* 本地端也须转至下属目录 */ afs.chdir(dirt->d_name); } } /* 目录流有效才可向上转 */ if (dir) { /* 关闭当前操作的目录流 */ closedir(dir); dir = NULL; /* 构造向上转的数据头并发送 */ snprintf(buf, MAX_SOCKLEN, "0000:.:0:%lx:%lx=%jx:%lx=%jx:", IPMSG_FILE_RETPARENT, IPMSG_FILE_MTIME, (uintmax_t)st.st_mtime, IPMSG_FILE_CREATETIME, (uintmax_t)st.st_ctime); headsize = strlen(buf); snprintf(buf, MAX_SOCKLEN, "%.4" PRIx32, headsize); *(buf + 4) = ':'; if (xwrite(sock, buf, headsize) == -1) goto end; /* 本地端也须向上转一层 */ afs.chdir(".."); } } result = true; /* 考察处理结果 */ end: if (!result) { /* 若当前目录流有效,则必须关闭 */ if (dir) closedir(dir); /* 关闭堆栈中所有的目录流,并清空堆栈 */ g_queue_foreach(&dirstack, GFunc(closedir), NULL); g_queue_clear(&dirstack); LOG_INFO(_("Failed to send the directory \"%s\" to %s!"), file->filepath, file->fileown->getName().c_str()); // g_cthrd->SystemLog(_("Failed to send the directory \"%s\" to %s!"), // file->filepath, file->fileown->name); } else { LOG_INFO(_("Send the directory \"%s\" to %s successfully!"), file->filepath, file->fileown->getName().c_str()); // g_cthrd->SystemLog(_("Send the directory \"%s\" to %s successfully!"), // file->filepath, file->fileown->name); } } /** * 发送文件数据. * @param fd file descriptor * @param filesize 文件总长度 * @return 完成数据量 */ int64_t SendFileData::SendData(int fd, int64_t filesize) { int64_t tmpsize, finishsize; struct timeval val1, val2; float difftime; uint32_t rate; ssize_t size; /* 如果文件长度为0,则无须再进一步处理 */ if (filesize == 0) return 0; tmpsize = finishsize = 0; // 初始化已完成数据量 gettimeofday(&val1, NULL); // 初始化起始时间 do { /* 读取文件数据并发送 */ size = MAX_SOCKLEN < filesize - finishsize ? MAX_SOCKLEN : filesize - finishsize; if ((size = xread(fd, buf, MAX_SOCKLEN)) == -1) return finishsize; if (size > 0 && xwrite(sock, buf, size) == -1) return finishsize; finishsize += size; sumsize += size; file->finishedsize = sumsize; /* 判断是否需要更新UI参考值 */ gettimeofday(&val2, NULL); difftime = difftimeval(val2, val1); if (difftime >= 1) { /* 更新UI参考值 */ rate = (uint32_t)((finishsize - tmpsize) / difftime); para.setFinishedLength(finishsize) .setCost(numeric_to_time((uint32_t)(difftimeval(val2, filetime)))) .setRemain( numeric_to_time((uint32_t)((filesize - finishsize) / rate))) .setRate(numeric_to_rate(rate)); val1 = val2; // 更新时间参考点 tmpsize = finishsize; // 更新下载量 } } while (!terminate && size && finishsize < filesize); return finishsize; } /** * 更新UI参考数据到任务结束. */ void SendFileData::UpdateUIParaToOver() { struct timeval time; const char* statusfile; statusfile = terminate ? "tip-error" : "tip-finish"; para.setStatus(statusfile); if (!terminate && file->fileattr == FileAttr::REGULAR) { para.setFilename(ipmsg_get_filename_me(file->filepath, NULL)) .setFileLength(sumsize); } if (!terminate) { gettimeofday(&time, NULL); para.setFinishedLength(sumsize) .setCost(numeric_to_time((uint32_t)(difftimeval(time, tasktime)))) .setRemain("") .setRate(""); } para.finish(); } } // namespace iptux iptux-0.9.4/src/iptux-core/internal/SendFileData.h000066400000000000000000000023711475473122500220500ustar00rootroot00000000000000// // C++ Interface: SendFileData // // Description: // 发送文件数据 // // Author: Jally , (C) 2009 // // Copyright: See COPYING file that comes with this distribution // // #ifndef IPTUX_SENDFILEDATA_H #define IPTUX_SENDFILEDATA_H #include "iptux-core/CoreThread.h" #include "iptux-core/Models.h" #include "iptux-core/internal/TransAbstract.h" #include "iptux-core/internal/ipmsg.h" namespace iptux { class SendFileData : public TransAbstract { public: SendFileData(CoreThread* coreThread, int sk, PFileInfo fl); ~SendFileData(); void SendFileDataEntry(); virtual const TransFileModel& getTransFileModel() const; virtual void TerminateTrans(); private: void CreateUIPara(); void SendRegularFile(); void SendDirFiles(); int64_t SendData(int fd, int64_t filesize); void UpdateUIParaToOver(); CoreThread* coreThread; int sock; //数据套接口 PFileInfo file; //文件信息 TransFileModel para; bool terminate; //终止标志(也作处理结果标识) int64_t sumsize; //文件(目录)总大小 char buf[MAX_SOCKLEN]; //数据缓冲区 struct timeval tasktime, filetime; //任务开始时间&文件开始时间 }; } // namespace iptux #endif iptux-0.9.4/src/iptux-core/internal/TcpData.cpp000066400000000000000000000127461475473122500214470ustar00rootroot00000000000000// // C++ Implementation: TcpData // // Description: // // // Author: Jally , (C) 2008 // // Copyright: See COPYING file that comes with this distribution // // #include "config.h" #include "TcpData.h" #include #include #include #include #include "iptux-core/internal/CommandMode.h" #include "iptux-core/internal/SendFile.h" #include "iptux-utils/output.h" #include "iptux-utils/utils.h" using namespace std; namespace iptux { /** * 类构造函数. */ TcpData::TcpData() : sock(-1), size(0) {} /** * 类析构函数. */ TcpData::~TcpData() { close(sock); } /** * TCP连接处理入口. * @param sock tcp socket */ void TcpData::TcpDataEntry(CoreThread* coreThread, int sock) { TcpData tdata; tdata.coreThread = coreThread; tdata.sock = sock; tdata.DispatchTcpData(); } /** * 分派TCP数据处理方案. */ void TcpData::DispatchTcpData() { struct sockaddr_in addr; socklen_t socklen; socklen = sizeof(addr); getpeername(sock, (struct sockaddr*)&addr, &socklen); LOG_DEBUG("received tcp message from %s:%d", inAddrToString(addr.sin_addr).c_str(), int(addr.sin_port)); uint32_t commandno; ssize_t len; /* 读取消息前缀 */ if ((len = read_ipmsg_prefix(sock, buf, MAX_SOCKLEN)) <= 0) { return; } /* 分派消息 */ size = len; // 设置缓冲区数据的有效长度 commandno = iptux_get_dec_number(buf, ':', 4); // 获取命令字 LOG_INFO("recv TCP request from %s, command NO.: [0x%x] %s", inAddrToString(addr.sin_addr).c_str(), commandno, CommandMode(GET_MODE(commandno)).toString().c_str()); switch (GET_MODE(commandno)) { case IPMSG_GETFILEDATA: RequestData(FileAttr::REGULAR); break; case IPMSG_GETDIRFILES: RequestData(FileAttr::DIRECTORY); break; case IPTUX_SENDSUBLAYER: RecvSublayer(GET_OPT(commandno)); break; default: break; } } /** * 请求文件(目录)数据. * @param fileattr 文件类型 */ void TcpData::RequestData(FileAttr fileattr) { const char* attachptr; char* attach; attachptr = iptux_skip_section(buf, ':', 5); switch (fileattr) { case FileAttr::REGULAR: read_ipmsg_filedata(sock, (void*)attachptr, buf + MAX_SOCKLEN - attachptr, buf + size - attachptr); break; case FileAttr::DIRECTORY: read_ipmsg_dirfiles(sock, (void*)attachptr, buf + MAX_SOCKLEN - attachptr, buf + size - attachptr); break; default: break; } attach = ipmsg_get_attach(buf, ':', 5); SendFile::RequestDataEntry(coreThread, sock, fileattr, attach); g_free(attach); } /** * 接收底层数据. * @param cmdopt 命令字选项 */ void TcpData::RecvSublayer(uint32_t cmdopt) { static uint32_t count = 0; char path[MAX_PATHLEN]; struct sockaddr_in addr; socklen_t len; PPalInfo pal; int fd; /* 检查好友是否存在 */ len = sizeof(addr); getpeername(sock, (struct sockaddr*)&addr, &len); if (!(pal = coreThread->GetPal(addr.sin_addr))) { return; } /* 创建即将接收的数据文件路径 */ switch (GET_OPT(cmdopt)) { case IPTUX_PHOTOPICOPT: snprintf(path, MAX_PATHLEN, "%s" PHOTO_PATH "/%" PRIx32, g_get_user_cache_dir(), inAddrToUint32(pal->ipv4())); break; case IPTUX_MSGPICOPT: snprintf(path, MAX_PATHLEN, "%s" PIC_PATH "/%" PRIx32 "-%" PRIx32 "-%jx", g_get_user_cache_dir(), inAddrToUint32(pal->ipv4()), count++, (uintmax_t)time(NULL)); break; default: snprintf(path, MAX_PATHLEN, "%s" IPTUX_PATH "/%" PRIx32 "-%" PRIx32 "-%jx", g_get_user_cache_dir(), inAddrToUint32(pal->ipv4()), count++, (uintmax_t)time(NULL)); break; } LOG_INFO("recv sublayer data from %s, save to %s", inAddrToString(pal->ipv4()).c_str(), path); /* 终于可以接收数据了^_^ */ if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0644)) == -1) { LOG_ERROR("open file %s failed: %s", path, strerror(errno)); return; } RecvSublayerData(fd, strlen(buf) + 1); close(fd); /* 分派数据 */ switch (GET_OPT(cmdopt)) { case IPTUX_PHOTOPICOPT: RecvPhotoPic(pal.get(), path); break; case IPTUX_MSGPICOPT: RecvMsgPic(pal.get(), path); break; default: break; } } /** * 接收数据. * @param fd file descriptor * @param len 缓冲区无效数据长度 */ void TcpData::RecvSublayerData(int fd, size_t len) { ssize_t ssize; if (size != len) xwrite(fd, buf + len, size - len); do { if ((ssize = xread(sock, buf, MAX_SOCKLEN)) <= 0) break; if ((ssize = xwrite(fd, buf, ssize)) <= 0) break; } while (1); } /** * 接收好友形象照片. * @param pal class PalInfo * @param path file path */ void TcpData::RecvPhotoPic(PalInfo* pal, const char* path) { g_free(pal->photo); pal->photo = g_strdup(path); coreThread->Lock(); coreThread->UpdatePalToList(pal->GetKey()); coreThread->Unlock(); } /** * 接收消息图片. * @param pal class PalInfo * @param path file path */ void TcpData::RecvMsgPic(PalInfo* pal, const char* path) { MsgPara para(coreThread->GetPal(pal->GetKey())); /* 构建消息封装包 */ para.stype = MessageSourceType::PAL; para.btype = GROUP_BELONG_TYPE_REGULAR; ChipData chip(MESSAGE_CONTENT_TYPE_PICTURE, path); para.dtlist.push_back(chip); /* 交给某人处理吧 */ coreThread->InsertMessage(std::move(para)); } } // namespace iptux iptux-0.9.4/src/iptux-core/internal/TcpData.h000066400000000000000000000016711475473122500211070ustar00rootroot00000000000000// // C++ Interface: TcpData // // Description: // 对TCP连接进行处理 // // Author: Jally , (C) 2008 // // Copyright: See COPYING file that comes with this distribution // // #ifndef IPTUX_TCPDATA_H #define IPTUX_TCPDATA_H #include "iptux-core/CoreThread.h" #include "iptux-core/Models.h" #include "iptux-core/internal/ipmsg.h" namespace iptux { class TcpData { public: TcpData(); ~TcpData(); static void TcpDataEntry(CoreThread* coreThread, int sock); private: void DispatchTcpData(); void RequestData(FileAttr fileattr); void RecvSublayer(uint32_t cmdopt); void RecvSublayerData(int fd, size_t len); void RecvPhotoPic(PalInfo* pal, const char* path); void RecvMsgPic(PalInfo* pal, const char* path); CoreThread* coreThread; int sock; //数据交流套接口 size_t size; //缓冲区已使用长度 char buf[MAX_SOCKLEN]; //缓冲区 }; } // namespace iptux #endif iptux-0.9.4/src/iptux-core/internal/TransAbstract.cpp000066400000000000000000000004331475473122500226700ustar00rootroot00000000000000#include "config.h" #include "TransAbstract.h" namespace iptux { TransAbstract::TransAbstract() {} TransAbstract::~TransAbstract() {} void TransAbstract::SetTaskId(int taskId) { this->taskId = taskId; } int TransAbstract::GetTaskId() { return taskId; } } // namespace iptux iptux-0.9.4/src/iptux-core/internal/TransAbstract.h000066400000000000000000000011141475473122500223320ustar00rootroot00000000000000#ifndef IPTUX_TRANSABSTRACT_H #define IPTUX_TRANSABSTRACT_H #include "iptux-core/TransFileModel.h" namespace iptux { /** * 传输抽象类. * 提供文件传输类必需的公共接口. */ class TransAbstract { public: TransAbstract(); virtual ~TransAbstract(); virtual const TransFileModel& getTransFileModel() const = 0; ///< 获取更新UI的数据 virtual void TerminateTrans() = 0; ///< 终止过程处理 int GetTaskId(); void SetTaskId(int taskId); private: int taskId; }; } // namespace iptux #endif // IPTUX_TRANSABSTRACT_H iptux-0.9.4/src/iptux-core/internal/UdpData.cpp000066400000000000000000000435071475473122500214500ustar00rootroot00000000000000// // C++ Implementation: UdpData // // Description: // // // Author: cwll ,(C)2012 // Jally , (C) 2008 // // Copyright: See COPYING file that comes with this distribution // 2012.02 在接收消息中去掉了群组模式,群组模式只用来发消息 // #include "config.h" #include "UdpData.h" #include #include #include #include #include #include #include #include "iptux-core/CoreThread.h" #include "iptux-core/internal/Command.h" #include "iptux-core/internal/CommandMode.h" #include "iptux-core/internal/RecvFile.h" #include "iptux-core/internal/SendFile.h" #include "iptux-utils/output.h" #include "iptux-utils/utils.h" #define NULL_OBJECT 0x02 using namespace std; using namespace std::placeholders; namespace iptux { /** * 类构造函数. */ UdpData::UdpData(CoreThread& coreThread, in_addr ipv4, const char buf_[], size_t size_) : coreThread(coreThread), ipv4(ipv4), size(size_ < MAX_UDPLEN ? size_ : MAX_UDPLEN), encode(NULL) { memcpy(buf, buf_, size); if (size != MAX_UDPLEN) { buf[size] = '\0'; } } UdpData::UdpData(const string& buf_, const string& ipv4String) : coreThread(*(CoreThread*)NULL), size(buf_.size()), encode(nullptr) { this->ipv4 = inAddrFromString(ipv4String); memcpy(buf, &buf_[0], buf_.size()); } /** * 类析构函数. */ UdpData::~UdpData() { g_free(encode); } /** * 好友信息数据丢失默认处理函数. * 若xx并不在好友列表中,但是程序却期望能够接受xx的本次会话, * 所以必须以默认数据构建好友信息数据并插入好友列表 \n */ void UdpData::SomeoneLost() { PalInfo* pal; auto g_progdt = coreThread.getProgramData(); /* 创建好友数据 */ pal = new PalInfo(ipv4, coreThread.port()); pal->segdes = g_strdup(g_progdt->FindNetSegDescription(ipv4).c_str()); auto version = iptux_get_section_string(buf, ':', 0); auto user = iptux_get_section_string(buf, ':', 2); auto host = iptux_get_section_string(buf, ':', 3); (*pal) .setVersion(version ? version : "?") .setUser(user ? user : "???") .setHost(host ? host : "???") .setEncode(encode ? encode : "utf-8") .setName(_("mysterious")) .setGroup(_("mysterious")) .set_icon_file(g_progdt->palicon); pal->photo = NULL; pal->sign = NULL; pal->setOnline(true); pal->packetn = 0; pal->rpacketn = 0; /* 加入好友列表 */ coreThread.Lock(); coreThread.AttachPalToList(PPalInfo(pal)); coreThread.Unlock(); // coreThread.AttachItemToPaltree(ipv4); } /** * 好友上线. */ void UdpData::SomeoneEntry() { using namespace std::placeholders; Command cmd(coreThread); shared_ptr pal; auto programData = coreThread.getProgramData(); /* 转换缓冲区数据编码 */ ConvertEncode(programData->encode); /* 加入或更新好友列表 */ coreThread.Lock(); if ((pal = coreThread.GetPal(ipv4))) { UpdatePalInfo(pal.get()); coreThread.UpdatePalToList(ipv4); } else { pal = CreatePalInfo(); coreThread.AttachPalToList(pal); } coreThread.Unlock(); coreThread.emitNewPalOnline(pal); /* 通知好友本大爷在线 */ cmd.SendAnsentry(coreThread.getUdpSock(), pal); if (pal->isCompatible()) { thread t1(bind(&CoreThread::sendFeatureData, &coreThread, _1), pal); t1.detach(); } } /** * 好友退出. */ void UdpData::SomeoneExit() { coreThread.emitSomeoneExit(PalKey(ipv4, coreThread.port())); } /** * 好友在线. */ void UdpData::SomeoneAnsEntry() { Command cmd(coreThread); const char* ptr; auto g_progdt = coreThread.getProgramData(); /* 若好友不兼容iptux协议,则需转码 */ ptr = iptux_skip_string(buf, size, 3); if (!ptr || *ptr == '\0') ConvertEncode(g_progdt->encode); /* 加入或更新好友列表 */ coreThread.Lock(); shared_ptr pal; if ((pal = coreThread.GetPal(ipv4))) { UpdatePalInfo(pal.get()); coreThread.UpdatePalToList(ipv4); } else { pal = CreatePalInfo(); coreThread.AttachPalToList(pal); } coreThread.Unlock(); coreThread.emitNewPalOnline(pal); /* 更新本大爷的数据信息 */ if (pal->isCompatible()) { thread t1(bind(&CoreThread::sendFeatureData, &coreThread, _1), pal); t1.detach(); } else if (strcasecmp(g_progdt->encode.c_str(), pal->getEncode().c_str()) != 0) { cmd.SendAnsentry(coreThread.getUdpSock(), pal); } } /** * 好友更改个人信息. */ void UdpData::SomeoneAbsence() { PPalInfo pal; const char* ptr; auto g_progdt = coreThread.getProgramData(); /* 若好友不兼容iptux协议,则需转码 */ pal = coreThread.GetPal(ipv4); // 利用好友链表只增不减的特性,无须加锁 ptr = iptux_skip_string(buf, size, 3); if (!ptr || *ptr == '\0') { if (pal) { string s(pal->getEncode()); ConvertEncode(s); } else { ConvertEncode(g_progdt->encode); } } /* 加入或更新好友列表 */ coreThread.Lock(); if (pal) { UpdatePalInfo(pal.get()); coreThread.UpdatePalToList(ipv4); } else { coreThread.AttachPalToList(CreatePalInfo()); } coreThread.Unlock(); } /** * 好友发送消息. * */ void UdpData::SomeoneSendmsg() { Command cmd(coreThread); uint32_t commandno, packetno; char* text; auto g_progdt = coreThread.getProgramData(); /* 如果对方兼容iptux协议,则无须再转换编码 */ auto pal = coreThread.GetPal(ipv4); if (!pal || !pal->isCompatible()) { if (pal) { ConvertEncode(pal->getEncode()); } else { ConvertEncode(g_progdt->encode); } } /* 确保好友在线,并对编码作出适当调整 */ pal = AssertPalOnline(); if (strcasecmp(pal->getEncode().c_str(), encode ? encode : "utf-8") != 0) { pal->setEncode(encode ? encode : "utf-8"); } /* 回复好友并检查此消息是否过时 */ commandno = iptux_get_dec_number(buf, ':', 4); packetno = iptux_get_dec_number(buf, ':', 1); if (commandno & IPMSG_SENDCHECKOPT) { cmd.SendReply(coreThread.getUdpSock(), pal->GetKey(), packetno); } if (packetno <= pal->packetn) return; pal->packetn = packetno; /* 插入消息&在消息队列中注册 */ text = ipmsg_get_attach(buf, ':', 5); if (text && *text != '\0') { InsertMessage(pal, GROUP_BELONG_TYPE_REGULAR, text); } g_free(text); /* 标记位处理 先处理底层数据,后面显示窗口*/ if (commandno & IPMSG_FILEATTACHOPT) { if ((commandno & IPTUX_SHAREDOPT) && (commandno & IPTUX_PASSWDOPT)) { coreThread.emitEvent(make_shared(pal->GetKey())); } else { RecvPalFile(); } } // if (grpinf->dialog) { // auto window = GTK_WIDGET(grpinf->dialog); // auto dlgpr = (DialogPeer *)(g_object_get_data(G_OBJECT(window), // "dialog")); dlgpr->ShowDialogPeer(dlgpr); // } } /** * 好友接收到消息. */ void UdpData::SomeoneRecvmsg() { uint32_t packetno; PPalInfo pal; if ((pal = coreThread.GetPal(ipv4))) { packetno = iptux_get_dec_number(buf, ':', 5); if (packetno == pal->rpacketn) pal->rpacketn = 0; // 标记此包编号已经被回复 } else { LOG_WARN("message from unknown pal: %s", inAddrToString(ipv4).c_str()); } } /** * 好友请求本计算机的共享文件. */ void UdpData::SomeoneAskShared() { Command cmd(coreThread); PPalInfo pal; char* passwd; if (!(pal = coreThread.GetPal(ipv4))) return; auto limit = coreThread.GetAccessPublicLimit(); if (limit.empty()) { thread([](CoreThread* coreThread, PPalInfo pal) { ThreadAskSharedFile(coreThread, pal); }, &coreThread, pal) .detach(); } else if (!(iptux_get_dec_number(buf, ':', 4) & IPTUX_PASSWDOPT)) { cmd.SendFileInfo(coreThread.getUdpSock(), pal->GetKey(), IPTUX_SHAREDOPT | IPTUX_PASSWDOPT, ""); } else if ((passwd = ipmsg_get_attach(buf, ':', 5))) { if (limit == passwd) { thread([](CoreThread* coreThread, PPalInfo pal) { ThreadAskSharedFile(coreThread, pal); }, &coreThread, pal) .detach(); } g_free(passwd); } } /** * 好友发送头像数据. */ void UdpData::SomeoneSendIcon() { PPalInfo pal; string iconfile; if (!(pal = coreThread.GetPal(ipv4)) || pal->isChanged()) { return; } /* 接收并更新数据 */ iconfile = RecvPalIcon(); if (!iconfile.empty()) { pal->set_icon_file(iconfile); coreThread.EmitIconUpdate(PalKey(ipv4, coreThread.port())); } } /** * 好友发送个性签名. */ void UdpData::SomeoneSendSign() { PPalInfo pal; char* sign; if (!(pal = coreThread.GetPal(ipv4))) return; /* 若好友不兼容iptux协议,则需转码 */ if (!pal->isCompatible()) { ConvertEncode(pal->getEncode()); } /* 对编码作适当调整 */ if (strcasecmp(pal->getEncode().c_str(), encode ? encode : "utf-8") != 0) { pal->setEncode(encode ? encode : "utf-8"); } /* 更新 */ if ((sign = ipmsg_get_attach(buf, ':', 5))) { g_free(pal->sign); pal->sign = sign; coreThread.Lock(); coreThread.UpdatePalToList(ipv4); coreThread.Unlock(); coreThread.emitNewPalOnline(pal->GetKey()); } } /** * 好友广播消息. */ void UdpData::SomeoneBcstmsg() { uint32_t commandno, packetno; char* text; auto g_progdt = coreThread.getProgramData(); /* 如果对方兼容iptux协议,则无须再转换编码 */ auto pal = coreThread.GetPal(ipv4); if (!pal || !pal->isCompatible()) { if (pal) { ConvertEncode(pal->getEncode()); } else { ConvertEncode(g_progdt->encode); } } /* 确保好友在线,并对编码作出适当调整 */ pal = AssertPalOnline(); if (strcasecmp(pal->getEncode().c_str(), encode ? encode : "utf-8") != 0) { pal->setEncode(encode ? encode : "utf-8"); } /* 检查此消息是否过时 */ packetno = iptux_get_dec_number(buf, ':', 1); if (packetno <= pal->packetn) { return; } pal->packetn = packetno; /* 插入消息&在消息队列中注册 */ text = ipmsg_get_attach(buf, ':', 5); if (text && *text != '\0') { commandno = iptux_get_dec_number(buf, ':', 4); /* 插入消息 */ switch (GET_OPT(commandno)) { case IPTUX_BROADCASTOPT: InsertMessage(pal, GROUP_BELONG_TYPE_BROADCAST, text); break; case IPTUX_GROUPOPT: InsertMessage(pal, GROUP_BELONG_TYPE_GROUP, text); break; case IPTUX_SEGMENTOPT: InsertMessage(pal, GROUP_BELONG_TYPE_SEGMENT, text); break; case IPTUX_REGULAROPT: default: InsertMessage(pal, GROUP_BELONG_TYPE_REGULAR, text); break; } } g_free(text); } /** * 创建好友信息数据. * @return 好友数据 */ shared_ptr UdpData::CreatePalInfo() { auto programData = coreThread.getProgramData(); auto pal = make_shared(ipv4, coreThread.port()); pal->segdes = g_strdup(programData->FindNetSegDescription(ipv4).c_str()); auto version = iptux_get_section_string(buf, ':', 0); auto user = iptux_get_section_string(buf, ':', 2); auto host = iptux_get_section_string(buf, ':', 3); (*pal) .setVersion(version ? version : "?") .setUser(user ? user : "???") .setHost(host ? host : "???"); auto name = ipmsg_get_attach(buf, ':', 5); if (!name) { pal->setName(_("mysterious")); } else { pal->setName(name); } pal->setGroup(GetPalGroup()); pal->photo = NULL; pal->sign = NULL; pal->set_icon_file(GetPalIcon(), programData->palicon); auto localEncode = GetPalEncode(); if (localEncode) { pal->setEncode(localEncode); pal->setCompatible(true); } else { pal->setEncode(encode ? encode : "utf-8"); } pal->setOnline(true); pal->packetn = 0; pal->rpacketn = 0; return pal; } /** * 更新好友信息数据. * @param pal 好友数据 */ void UdpData::UpdatePalInfo(PalInfo* pal) { auto g_progdt = coreThread.getProgramData(); g_free(pal->segdes); pal->segdes = g_strdup(g_progdt->FindNetSegDescription(ipv4).c_str()); auto version = iptux_get_section_string(buf, ':', 0); auto user = iptux_get_section_string(buf, ':', 2); auto host = iptux_get_section_string(buf, ':', 3); (*pal) .setVersion(version ? version : "?") .setUser(user ? user : "???") .setHost(host ? host : "???"); if (!pal->isChanged()) { auto name = ipmsg_get_attach(buf, ':', 5); if (!name) { pal->setName(_("mysterious")); } else { pal->setName(name); } pal->setGroup(GetPalGroup()); pal->set_icon_file(GetPalIcon(), g_progdt->palicon); pal->setCompatible(false); auto localEncode = GetPalEncode(); if (localEncode) { pal->setEncode(localEncode); pal->setCompatible(true); } else { pal->setEncode(encode ? encode : "utf-8"); } } pal->setOnline(true); pal->packetn = 0; pal->rpacketn = 0; } /** * 插入消息. * @param pal class PalInfo * @param btype 消息所属类型 * @param msg 消息 */ void UdpData::InsertMessage(PPalInfo pal, GroupBelongType btype, const char* msg) { MsgPara para(coreThread.GetPal(pal->GetKey())); /* 构建消息封装包 */ para.stype = MessageSourceType::PAL; para.btype = btype; ChipData chip(MESSAGE_CONTENT_TYPE_STRING, msg); para.dtlist.push_back(std::move(chip)); /* 交给某人处理吧 */ coreThread.InsertMessage(std::move(para)); } void UdpData::ConvertEncode(const char* enc) { string encode(enc); ConvertEncode(encode); } /** * 将缓冲区中的数据转换为utf8编码. * @param enc 原数据首选编码 */ void UdpData::ConvertEncode(const string& enc) { char* ptr; size_t len; /* 将缓冲区内有效的'\0'字符转换为ASCII字符 */ ptr = buf + strlen(buf) + 1; while ((size_t)(ptr - buf) <= size) { *(ptr - 1) = NULL_OBJECT; ptr += strlen(ptr) + 1; } /* 转换字符集编码 */ /** * @note 请不要采用以下做法,它在某些环境下将导致致命错误: \n * if (g_utf8_validate(buf, -1, NULL)) {encode = g_strdup("utf-8")} \n * e.g. 系统编码为GB18030的xx发送来纯ASCII字符串 \n */ if (!enc.empty() && strcasecmp(enc.c_str(), "utf-8") != 0 && (ptr = convert_encode(buf, "utf-8", enc.c_str()))) encode = g_strdup(enc.c_str()); else ptr = iptux_string_validate(buf, coreThread.getProgramData()->codeset, &encode); if (ptr) { len = strlen(ptr); size = len < MAX_UDPLEN ? len : MAX_UDPLEN; memcpy(buf, ptr, size); if (size < MAX_UDPLEN) buf[size] = '\0'; g_free(ptr); } /* 将缓冲区内的ASCII字符还原为'\0'字符 */ ptr = buf; while ((ptr = (char*)memchr(ptr, NULL_OBJECT, buf + size - ptr))) { *ptr = '\0'; ptr++; } } /** * 获取好友群组名称. * @return 群组 */ string UdpData::GetPalGroup() { const char* ptr; if ((ptr = iptux_skip_string(buf, size, 1)) && *ptr != '\0') return ptr; return ""; } /** * 获取好友头像图标. * @return 头像 */ string UdpData::GetPalIcon() { const char* ptr; if ((ptr = iptux_skip_string(buf, size, 2)) && *ptr != '\0') { string res = stringFormat(__PIXMAPS_PATH "/icon/%s", ptr); if (access(res.c_str(), F_OK) == 0) return ptr; } return ""; } /** * 获取好友系统编码. * @return 编码 */ char* UdpData::GetPalEncode() { const char* ptr; if ((ptr = iptux_skip_string(buf, size, 3)) && *ptr != '\0') return g_strdup(ptr); return NULL; } /** * 接收好友头像数据. * @return 头像文件名 */ string UdpData::RecvPalIcon() { size_t len; int fd; /* 若无头像数据则返回null */ if ((len = strlen(buf) + 1) >= size) return ""; auto hash = sha256(buf + len, size - len); /* 将头像数据刷入磁盘 */ auto path = stringFormat("%s" ICON_PATH "/%s.png", g_get_user_cache_dir(), hash.c_str()); Helper::prepareDir(path); if ((fd = open(path.c_str(), O_WRONLY | O_CREAT | O_TRUNC, 0644)) == -1) { LOG_ERROR("write icon to path failed: %s", path.c_str()); return ""; } xwrite(fd, buf + len, size - len); close(fd); return hash; } /** * 确保好友一定在线. * @return 好友数据 */ PPalInfo UdpData::AssertPalOnline() { PPalInfo pal; if ((pal = coreThread.GetPal(ipv4))) { /* 既然好友不在线,那么他自然不在列表中 */ if (!pal->isOnline()) { pal->setOnline(true); coreThread.Lock(); coreThread.UpdatePalToList(ipv4); coreThread.Unlock(); coreThread.emitNewPalOnline(pal->GetKey()); } } else { SomeoneLost(); pal = coreThread.GetPal(ipv4); } return pal; } /** * 接收好友文件信息. */ void UdpData::RecvPalFile() { uint32_t packetno, commandno; const char* ptr; packetno = iptux_get_dec_number(buf, ':', 1); commandno = iptux_get_dec_number(buf, ':', 4); ptr = iptux_skip_string(buf, size, 1); /* 只有当此为共享文件信息或文件信息不为空才需要接收 */ if ((commandno & IPTUX_SHAREDOPT) || (ptr && *ptr != '\0')) { thread( [](CoreThread* coreThread, PPalInfo pal, string data, int packetno) { RecvFile::RecvEntry(coreThread, pal, data, packetno); }, &coreThread, coreThread.GetPal(ipv4), ptr, packetno) .detach(); } } /** * 某好友请求本计算机的共享文件. * @param pal class PalInfo */ void UdpData::ThreadAskSharedFile(CoreThread* coreThread, PPalInfo pal) { auto g_progdt = coreThread->getProgramData(); if (g_progdt->IsFilterFileShareRequest()) { coreThread->emitEvent(make_shared(pal->GetKey())); } else { SendFile::SendSharedInfoEntry(coreThread, pal); } } uint32_t UdpData::getCommandNo() const { return iptux_get_dec_number(buf, ':', 4); } string UdpData::getIpv4String() const { return inAddrToString(ipv4); } CommandMode UdpData::getCommandMode() const { return CommandMode(GET_MODE(getCommandNo())); } } // namespace iptux iptux-0.9.4/src/iptux-core/internal/UdpData.h000066400000000000000000000035261475473122500211120ustar00rootroot00000000000000// // C++ Interface: UdpData // // Description: // 处理接收到的UDP数据 // // Author: Jally , (C) 2008 // // Copyright: See COPYING file that comes with this distribution // // #ifndef IPTUX_UDPDATA_H #define IPTUX_UDPDATA_H #include #include "iptux-core/CoreThread.h" #include "iptux-core/IptuxConfig.h" #include "iptux-core/Models.h" #include "iptux-core/internal/CommandMode.h" #include "iptux-core/internal/ipmsg.h" namespace iptux { class UdpData { public: UdpData(CoreThread& coreThread, in_addr ipv4, const char buf[], size_t size); UdpData(const std::string& buf, const std::string& ipv4String); ~UdpData(); in_addr getIpv4() const { return ipv4; } std::string getIpv4String() const; uint32_t getCommandNo() const; CommandMode getCommandMode() const; public: std::shared_ptr CreatePalInfo(); public: void SomeoneLost(); void SomeoneEntry(); void SomeoneExit(); void SomeoneAnsEntry(); void SomeoneAbsence(); void SomeoneSendmsg(); void SomeoneRecvmsg(); void SomeoneAskShared(); void SomeoneSendIcon(); void SomeoneSendSign(); void SomeoneBcstmsg(); private: void UpdatePalInfo(PalInfo* pal); void InsertMessage(PPalInfo pal, GroupBelongType btype, const char* msg); void ConvertEncode(const std::string& enc); void ConvertEncode(const char* enc); std::string GetPalGroup(); std::string GetPalIcon(); char* GetPalEncode(); std::string RecvPalIcon(); PPalInfo AssertPalOnline(); void RecvPalFile(); private: CoreThread& coreThread; in_addr ipv4; // 数据来自 size_t size; // 缓冲区数据有效长度 char buf[MAX_UDPLEN]; // 数据缓冲区 char* encode; // 原数据编码(NULL意味着utf8) private: static void ThreadAskSharedFile(CoreThread* coreThread, PPalInfo pal); }; } // namespace iptux #endif iptux-0.9.4/src/iptux-core/internal/UdpDataService.cpp000066400000000000000000000047621475473122500227710ustar00rootroot00000000000000#include "UdpDataService.h" #include "iptux-utils/output.h" #include "iptux-utils/utils.h" using namespace std; namespace iptux { UdpDataService::UdpDataService(CoreThread& coreThread) : core_thread_(coreThread) {} unique_ptr UdpDataService::process(in_addr ipv4, int port, const char buf[], size_t size) { return process(ipv4, port, buf, size, true); } unique_ptr UdpDataService::process(in_addr ipv4, int port, const char buf[], size_t size, bool run) { if (Log::IsDebugEnabled()) { LOG_DEBUG("received udp message from %s:%d, size %zu\n%s", inAddrToString(ipv4).c_str(), port, size, stringDumpAsCString(string(buf, size)).c_str()); } else { LOG_INFO("received udp message from %s:%d, size %zu", inAddrToString(ipv4).c_str(), port, size); } auto udata = make_unique(core_thread_, ipv4, buf, size); if (run) { process(*udata); } return udata; } void UdpDataService::process(UdpData& udata) { /* 如果开启了黑名单处理功能,且此地址正好被列入了黑名单 */ if (core_thread_.IsBlocked(udata.getIpv4())) { LOG_INFO("address is blocked: %s", udata.getIpv4String().c_str()); return; } /* 决定消息去向 */ auto commandMode = udata.getCommandMode(); LOG_INFO("command NO.: [0x%x] %s", udata.getCommandNo(), commandMode.toString().c_str()); switch (commandMode.getMode()) { case IPMSG_BR_ENTRY: udata.SomeoneEntry(); break; case IPMSG_BR_EXIT: udata.SomeoneExit(); break; case IPMSG_ANSENTRY: udata.SomeoneAnsEntry(); break; case IPMSG_BR_ABSENCE: udata.SomeoneAbsence(); break; case IPMSG_SENDMSG: udata.SomeoneSendmsg(); break; case IPMSG_RECVMSG: udata.SomeoneRecvmsg(); break; case IPTUX_ASKSHARED: udata.SomeoneAskShared(); break; case IPTUX_SENDICON: udata.SomeoneSendIcon(); break; case IPTUX_SEND_SIGN: udata.SomeoneSendSign(); break; case IPTUX_SENDMSG: udata.SomeoneBcstmsg(); break; default: LOG_WARN("unknown command mode: 0x%x", commandMode.getMode()); break; } } } // namespace iptux iptux-0.9.4/src/iptux-core/internal/UdpDataService.h000066400000000000000000000015241475473122500224270ustar00rootroot00000000000000#ifndef IPTUX_UDP_DATA_SERVICE_H #define IPTUX_UDP_DATA_SERVICE_H #include "iptux-core/CoreThread.h" #include "iptux-core/internal/UdpData.h" namespace iptux { class UdpDataService { public: explicit UdpDataService(CoreThread& coreThread); std::unique_ptr process(in_addr ipv4, int port, const char buf[], size_t size); std::unique_ptr process(in_addr ipv4, int port, const char buf[], size_t size, bool run); void process(UdpData& udpData); private: CoreThread& core_thread_; }; using UdpDataService_U = std::unique_ptr; } // namespace iptux #endif iptux-0.9.4/src/iptux-core/internal/UdpDataServiceTest.cpp000066400000000000000000000043611475473122500236240ustar00rootroot00000000000000#include "gtest/gtest.h" #include #include "iptux-core/TestHelper.h" #include "iptux-core/internal/UdpDataService.h" #include "iptux-utils/utils.h" using namespace std; using namespace iptux; TEST(UdpDataService, process) { auto core = newCoreThread(); auto service = make_unique(*core.get()); service->process(inAddrFromString("127.0.0.1"), 1234, "", 0, true); } TEST(UdpDataService, SomeoneEntry) { auto core = newCoreThread(); auto service = make_unique(*core.get()); const char* data = "iptux 0.8.0:1:lidaobing:lidaobing.lan:257:lidaobing"; service->process(inAddrFromString("127.0.0.1"), 1234, data, strlen(data), true); } TEST(UdpDataService, CreatePalInfo) { auto core = newCoreThread(); { const char* data = "1_iptux " "0.8.0-b1:6:lidaobing:LIs-MacBook-Pro.local:259:中\xe4\xb8\x00\x00icon-" "tux.png\x00utf-8\x00"; auto service = make_unique(*core.get()); auto udp = service->process(inAddrFromString("127.0.0.1"), 1234, data, strlen(data), false); auto pal = udp->CreatePalInfo(); ASSERT_EQ(pal->toString(), "PalInfo(IP=127.0.0.1,name=中��,segdes=,version=1_iptux " "0.8.0-b1,user=lidaobing,host=LIs-MacBook-Pro.local," "group=,photo=(NULL),sign=(NULL),iconfile=icon-qq.png," "encode=utf-8,packetn=0,rpacketn=0,compatible=0,online=1," "changed=0,in_blacklist=0)"); } { const char* data = "1_iptux " "0.8.0-b1:6:中\xe4\xb8:LIs-MacBook-Pro.local:259:" "中\xe4\xb8\x00\x00icon-tux.png\x00utf-8\x00"; auto service = make_unique(*core.get()); auto udp = service->process(inAddrFromString("127.0.0.1"), 1234, data, strlen(data), false); auto pal = udp->CreatePalInfo(); ASSERT_EQ(pal->toString(), "PalInfo(IP=127.0.0.1,name=中��,segdes=,version=1_iptux " "0.8.0-b1,user=中��,host=LIs-MacBook-Pro.local," "group=,photo=(NULL),sign=(NULL),iconfile=icon-qq.png,encode=utf-" "8,packetn=0,rpacketn=0,compatible=0,online=1,changed=0,in_" "blacklist=0)"); } } iptux-0.9.4/src/iptux-core/internal/UdpDataTest.cpp000066400000000000000000000004141475473122500222760ustar00rootroot00000000000000#include "gtest/gtest.h" #include "iptux-core/TestHelper.h" #include "iptux-core/internal/UdpData.h" #include "iptux-utils/utils.h" using namespace std; using namespace iptux; TEST(UdpData, getCommandNo) { ASSERT_EQ(UdpData("", "127.0.0.1").getCommandNo(), 0); } iptux-0.9.4/src/iptux-core/internal/ipmsg.h000066400000000000000000000155601475473122500207100ustar00rootroot00000000000000/* * Copyright (C) 2006 Takeharu KATO * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #ifndef IPTUX_IPMSG_H #define IPTUX_IPMSG_H #include "iptux-core/Const.h" #define IPMSG_VERSION 0x001 #define IPMSG_PORT 2425 /* command */ #define IPMSG_NOOPERATION 0x00000000UL #define IPMSG_BR_ENTRY 0x00000001UL #define IPMSG_BR_EXIT 0x00000002UL #define IPMSG_ANSENTRY 0x00000003UL #define IPMSG_BR_ABSENCE 0x00000004UL #define IPMSG_BR_ISGETLIST 0x00000010UL #define IPMSG_OKGETLIST 0x00000011UL #define IPMSG_GETLIST 0x00000012UL #define IPMSG_ANSLIST 0x00000013UL #define IPMSG_BR_ISGETLIST2 0x00000018UL #define IPMSG_SENDMSG 0x00000020UL #define IPMSG_RECVMSG 0x00000021UL #define IPMSG_READMSG 0x00000030UL #define IPMSG_DELMSG 0x00000031UL #define IPMSG_ANSREADMSG 0x00000032UL #define IPMSG_GETINFO 0x00000040UL #define IPMSG_SENDINFO 0x00000041UL #define IPMSG_GETABSENCEINFO 0x00000050UL #define IPMSG_SENDABSENCEINFO 0x00000051UL #define IPMSG_GETFILEDATA 0x00000060UL #define IPMSG_RELEASEFILES 0x00000061UL #define IPMSG_GETDIRFILES 0x00000062UL #define IPMSG_GETPUBKEY 0x00000072UL #define IPMSG_ANSPUBKEY 0x00000073UL /* option for all command */ #define IPMSG_ABSENCEOPT 0x00000100UL #define IPMSG_SERVEROPT 0x00000200UL #define IPMSG_DIALUPOPT 0x00010000UL #define IPMSG_FILEATTACHOPT 0x00200000UL #define IPMSG_ENCRYPTOPT 0x00400000UL #define IPMSG_UTF8OPT 0x00800000UL /* option for send command */ #define IPMSG_SENDCHECKOPT 0x00000100UL #define IPMSG_SECRETOPT 0x00000200UL #define IPMSG_BROADCASTOPT 0x00000400UL #define IPMSG_MULTICASTOPT 0x00000800UL #define IPMSG_NOPOPUPOPT 0x00001000UL #define IPMSG_AUTORETOPT 0x00002000UL #define IPMSG_RETRYOPT 0x00004000UL #define IPMSG_PASSWORDOPT 0x00008000UL #define IPMSG_NOLOGOPT 0x00020000UL #define IPMSG_NEWMUTIOPT 0x00040000UL #define IPMSG_NOADDLISTOPT 0x00080000UL #define IPMSG_READCHECKOPT 0x00100000UL #define IPMSG_SECRETEXOPT (IPMSG_READCHECKOPT | IPMSG_SECRETOPT) #define IPMSG_NO_REPLY_OPTS (IPMSG_BROADCASTOPT | IPMSG_AUTORETOPT) /* encryption flags for encrypt command */ #define IPMSG_RSA_512 0x00000001UL #define IPMSG_RSA_1024 0x00000002UL #define IPMSG_RSA_2048 0x00000004UL #define IPMSG_RC2_40 0x00001000UL #define IPMSG_RC2_128 0x00004000UL #define IPMSG_RC2_256 0x00008000UL #define IPMSG_BLOWFISH_128 0x00020000UL #define IPMSG_BLOWFISH_256 0x00040000UL #define IPMSG_AES_128 0x00100000UL #define IPMSG_AES_192 0x00200000UL #define IPMSG_AES_256 0x00400000UL #define IPMSG_SIGN_STAMPOPT 0x01000000UL #define IPMSG_SIGN_MD5 0x10000000UL #define IPMSG_SIGN_SHA1 0x20000000UL /* compatibility for Win beta version */ #define IPMSG_RC2_40OLD 0x00000010UL // for beta1-4 only #define IPMSG_RC2_128OLD 0x00000040UL // for beta1-4 only #define IPMSG_BLOWFISH_128OLD 0x00000400UL // for beta1-4 only #define IPMSG_RC2_40ALL (IPMSG_RC2_40 | IPMSG_RC2_40OLD) #define IPMSG_RC2_128ALL (IPMSG_RC2_128 | IPMSG_RC2_128OLD) #define IPMSG_BLOWFISH_128ALL (IPMSG_BLOWFISH_128 | IPMSG_BLOWFISH_128OLD) /* file types for fileattach command */ #define IPMSG_FILE_REGULAR 0x00000001UL #define IPMSG_FILE_DIR 0x00000002UL #define IPMSG_FILE_RETPARENT 0x00000003UL // return parent directory #define IPMSG_FILE_SYMLINK 0x00000004UL #define IPMSG_FILE_CDEV 0x00000005UL // for UNIX #define IPMSG_FILE_BDEV 0x00000006UL // for UNIX #define IPMSG_FILE_FIFO 0x00000007UL // for UNIX #define IPMSG_FILE_RESFORK 0x00000010UL // for Mac /* file attribute options for fileattach command */ #define IPMSG_FILE_RONLYOPT 0x00000100UL #define IPMSG_FILE_HIDDENOPT 0x00001000UL #define IPMSG_FILE_EXHIDDENOPT 0x00002000UL // for MacOS X #define IPMSG_FILE_ARCHIVEOPT 0x00004000UL #define IPMSG_FILE_SYSTEMOPT 0x00008000UL /* extend attribute types for fileattach command */ #define IPMSG_FILE_UID 0x00000001UL #define IPMSG_FILE_USERNAME 0x00000002UL // uid by string #define IPMSG_FILE_GID 0x00000003UL #define IPMSG_FILE_GROUPNAME 0x00000004UL // gid by string #define IPMSG_FILE_PERM 0x00000010UL // for UNIX #define IPMSG_FILE_MAJORNO 0x00000011UL // for UNIX devfile #define IPMSG_FILE_MINORNO 0x00000012UL // for UNIX devfile #define IPMSG_FILE_CTIME 0x00000013UL // for UNIX #define IPMSG_FILE_MTIME 0x00000014UL #define IPMSG_FILE_ATIME 0x00000015UL #define IPMSG_FILE_CREATETIME 0x00000016UL #define IPMSG_FILE_CREATOR 0x00000020UL // for Mac #define IPMSG_FILE_FILETYPE 0x00000021UL // for Mac #define IPMSG_FILE_FINDERINFO 0x00000022UL // for Mac #define IPMSG_FILE_ACL 0x00000030UL #define IPMSG_FILE_ALIASFNAME 0x00000040UL // alias fname #define IPMSG_FILE_UNICODEFNAME 0x00000041UL // UNICODE fname #define HLIST_ENTRY_SEPARATOR ':' /* macro */ #define GET_MODE(command) ((command)&0x000000ffUL) #define GET_OPT(command) ((command)&0xffffff00UL) /* header */ #define IPTUX_DEFAULT_PORT IPMSG_PORT /* command */ #define IPTUX_ASKSHARED 0x000000FFUL #define IPTUX_SENDICON 0x000000FEUL #define IPTUX_SENDSUBLAYER 0x000000FDUL #define IPTUX_SEND_SIGN 0x000000FCUL #define IPTUX_SENDMSG 0x000000FBUL /* option for IPTUX_SENDSUBLAYER */ #define IPTUX_PHOTOPICOPT 0x00000100UL #define IPTUX_MSGPICOPT 0x00000200UL /* option for IPMSG_SENDMSG */ #define IPTUX_SHAREDOPT 0x80000000UL /* option for IPMSG_SENDMSG & IPTUX_ASKSHARED */ #define IPTUX_PASSWDOPT 0x40000000UL /* option for IPTUX_SENDMSG */ // #define IPTUX_REGULAROPT 0x00000100UL // #define IPTUX_SEGMENTOPT 0x00000200UL // #define IPTUX_GROUPOPT 0x00000300UL // #define IPTUX_BROADCASTOPT 0x00000400UL /* data */ // #define MAX_PREVIEWSIZE 150 #define MAX_SOCKLEN 8192 // #define MAX_UDPLEN 8192 // #define MAX_BUFLEN 1024 // #define MAX_PATHLEN 1024 // #define MAX_SHAREDFILE 10000 // #define MAX_ICONSIZE 30 // #define MAX_PHOTOSIZE 300 #define MAX_RETRYTIMES 4 #endif iptux-0.9.4/src/iptux-core/internal/support.cpp000066400000000000000000000045421475473122500216360ustar00rootroot00000000000000// // C++ Implementation: support // // Description: // // // Author: Jally , (C) 2008 // // Copyright: See COPYING file that comes with this distribution // // #include "config.h" #include "support.h" #include #include #include #include #include #include "iptux-core/internal/ipmsg.h" #include "iptux-utils/output.h" #include "iptux-utils/utils.h" using namespace std; namespace iptux { /** * 让套接口支持广播. * @param sock socket */ void socket_enable_broadcast(int sock) { socklen_t len; int optval; optval = 1; len = sizeof(optval); if (setsockopt(sock, SOL_SOCKET, SO_BROADCAST, &optval, len) != 0) { LOG_WARN("setsockopt for SO_BROADCAST failed: %s", strerror(errno)); } } /** * 让套接口监听端口可重用. * @param sock socket */ void socket_enable_reuse(int sock) { socklen_t len; int optval; optval = 1; len = sizeof(optval); #ifndef __CYGWIN__ if (setsockopt(sock, SOL_SOCKET, SO_REUSEPORT, &optval, len) != 0) { LOG_WARN("setsockopt for SO_REUSEPORT failed: %s", strerror(errno)); } #else if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &optval, len) != 0) { LOG_WARN("setsockopt for SO_REUSEADDR failed: %s", strerror(errno)); } #endif } /** * 获取系统主机的广播地址. * @param sock socket * @return 广播地址链表 * @note 链表数据不是指针而是实际的IP */ vector get_sys_broadcast_addr(int sock) { const uint8_t amount = 5; //支持5个IP地址 uint8_t count, sum; struct ifconf ifc; struct ifreq* ifr; struct sockaddr_in* addr; vector res; res.push_back("255.255.255.255"); ifc.ifc_len = amount * sizeof(struct ifreq); ifc.ifc_buf = (caddr_t)g_malloc(ifc.ifc_len); if (ioctl(sock, SIOCGIFCONF, &ifc) == -1) { g_free(ifc.ifc_buf); return res; } sum = ifc.ifc_len / sizeof(struct ifreq); count = 0; while (count < sum) { ifr = ifc.ifc_req + count; count++; if (ioctl(sock, SIOCGIFFLAGS, ifr) == -1 || !(ifr->ifr_flags & IFF_BROADCAST) || ioctl(sock, SIOCGIFBRDADDR, ifr) == -1) continue; addr = (struct sockaddr_in*)&ifr->ifr_broadaddr; res.push_back(inAddrToString(addr->sin_addr)); } g_free(ifc.ifc_buf); if (res.size() == 1) { res.push_back("127.0.0.1"); } return res; } } // namespace iptux iptux-0.9.4/src/iptux-core/internal/support.h000066400000000000000000000006731475473122500213040ustar00rootroot00000000000000// // C++ Interface: support // // Description: // // // Author: Jally , (C) 2008 // // Copyright: See COPYING file that comes with this distribution // // #ifndef IPTUX_SUPPORT_H #define IPTUX_SUPPORT_H #include #include namespace iptux { void socket_enable_broadcast(int sock); void socket_enable_reuse(int sock); std::vector get_sys_broadcast_addr(int sock); } // namespace iptux #endif iptux-0.9.4/src/iptux-core/internal/supportTest.cpp000066400000000000000000000005401475473122500224700ustar00rootroot00000000000000#include "gtest/gtest.h" #include "support.h" #include #include using namespace iptux; using namespace std; TEST(Support, get_sys_broadcast_addr) { int udpSock = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP); auto ips = get_sys_broadcast_addr(udpSock); ASSERT_GE(int(ips.size()), 2); shutdown(udpSock, SHUT_RDWR); } iptux-0.9.4/src/iptux-core/meson.build000066400000000000000000000056101475473122500177410ustar00rootroot00000000000000glib_dep = dependency('glib-2.0', version: '>=2.35') jsoncpp_dep = dependency('jsoncpp', version: '>=1.0') glog_dep = dependency('libglog') gflags_dep = dependency('gflags') sigc_dep = dependency('sigc++-2.0') core_sources = files([ 'CoreThread.cpp', 'Event.cpp', 'Exception.cpp', 'IptuxConfig.cpp', 'Models.cpp', 'ProgramData.cpp', 'TransFileModel.cpp', ]) core_sources += files([ 'internal/AnalogFS.cpp', 'internal/Command.cpp', 'internal/CommandMode.cpp', 'internal/RecvFile.cpp', 'internal/RecvFileData.cpp', 'internal/SendFile.cpp', 'internal/SendFileData.cpp', 'internal/support.cpp', 'internal/TcpData.cpp', 'internal/TransAbstract.cpp', 'internal/UdpData.cpp', 'internal/UdpDataService.cpp', ]) inc = include_directories('..', '../api') thread_dep = dependency('threads') if get_option('static-link') libiptux_core = static_library('iptux-core', core_sources, dependencies: [glib_dep, jsoncpp_dep, glog_dep, gflags_dep, sigc_dep, thread_dep], link_with: [libiptux_utils], include_directories: inc, ) else libiptux_core = shared_library('iptux-core', core_sources, dependencies: [glib_dep, jsoncpp_dep, glog_dep, gflags_dep, sigc_dep, thread_dep], link_with: [libiptux_utils], include_directories: inc, install: true, version: meson.project_version(), soversion: so_version, ) pkg = import('pkgconfig') pkg.generate( description: 'Communicate and Share File in LAN', name: 'iptux-core', version: meson.project_version(), requires: [jsoncpp_dep, glib_dep, sigc_dep, thread_dep], requires_private: [glog_dep, gflags_dep], libraries: [libiptux_core, glog_dep], ) endif core_test_helper_sources = files([ 'TestHelper.cpp', ]) libiptux_core_test_helper = static_library('iptux-test-helper', core_test_helper_sources, dependencies: [glib_dep, jsoncpp_dep, sigc_dep, glog_dep], link_with: [libiptux_core, libiptux_utils_test_helper], include_directories: inc ) gtest_inc = include_directories('../googletest/include') core_test_sources = files([ 'CoreThreadTest.cpp', 'internal/CommandModeTest.cpp', 'internal/CommandTest.cpp', 'internal/supportTest.cpp', 'internal/UdpDataTest.cpp', 'internal/UdpDataServiceTest.cpp', 'IptuxConfigTest.cpp', 'ModelsTest.cpp', 'ProgramDataTest.cpp', 'TestMain.cpp', ]) libiptux_core_test = executable('libiptux_core_test', core_test_sources, dependencies: [glib_dep, jsoncpp_dep, sigc_dep, thread_dep], link_with: [libiptux_core, libgtest, libiptux_core_test_helper], include_directories: [inc, gtest_inc] ) if meson.version().version_compare('>=0.55') test('core', libiptux_core_test, is_parallel : false, protocol: 'gtest') else test('core', libiptux_core_test, is_parallel : false) endif iptux-0.9.4/src/iptux-utils/000077500000000000000000000000001475473122500160055ustar00rootroot00000000000000iptux-0.9.4/src/iptux-utils/Exception.cpp000066400000000000000000000007501475473122500204510ustar00rootroot00000000000000#include "config.h" #include "iptux-core/Exception.h" #include #include "iptux-utils/utils.h" using namespace std; namespace iptux { const ErrorCode INVALID_IP_ADDRESS(4001, "INVALID_IP_ADDRESS"); Exception::Exception(const ErrorCode& ec) : Exception(ec, ec.getMessage()) {} const ErrorCode& Exception::getErrorCode() const { return ec; } Exception::Exception(const ErrorCode& ec, const std::string& reason) : runtime_error(reason), ec(ec) {} } // namespace iptux iptux-0.9.4/src/iptux-utils/TestHelper.cpp000066400000000000000000000012421475473122500205670ustar00rootroot00000000000000#include "config.h" #include "TestHelper.h" #include "TestConfig.h" #include #include #include #include #include "iptux-utils/utils.h" using namespace std; namespace iptux { string readTestData(const string& fname) { ifstream ifs(testDataPath(fname)); if (!ifs) { throw runtime_error(stringFormat("Cannot open file %s", fname.c_str())); } return string(std::istreambuf_iterator(ifs), std::istreambuf_iterator()); } string testDataPath(const string& fname) { return stringFormat("%s/iptux/testdata/%s", CURRENT_SOURCE_PATH, fname.c_str()); } } // namespace iptux iptux-0.9.4/src/iptux-utils/TestHelper.h000066400000000000000000000004051475473122500202340ustar00rootroot00000000000000#ifndef IPTUX_UTILS_TESTHELPER_H #define IPTUX_UTILS_TESTHELPER_H #include namespace iptux { std::string readTestData(const std::string& fname); std::string testDataPath(const std::string& fname); } // namespace iptux #endif // IPTUX_TESTHELPER_H iptux-0.9.4/src/iptux-utils/TestMain.cpp000066400000000000000000000002261475473122500202350ustar00rootroot00000000000000#include "config.h" #include "gtest/gtest.h" int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } iptux-0.9.4/src/iptux-utils/UtilsTest.cpp000066400000000000000000000115761475473122500204630ustar00rootroot00000000000000#include "gtest/gtest.h" #include "iptux-core/Exception.h" #include "iptux-utils/TestHelper.h" #include "iptux-utils/utils.h" using namespace iptux; using namespace std; TEST(Utils, numeric_to_size) { EXPECT_STREQ(numeric_to_size(0), "0B"); EXPECT_STREQ(numeric_to_size(1), "1B"); EXPECT_STREQ(numeric_to_size(1000), "1000B"); EXPECT_STREQ(numeric_to_size(1 << 10), "1.0KiB"); EXPECT_STREQ(numeric_to_size(1000000), "976.6KiB"); EXPECT_STREQ(numeric_to_size(1 << 20), "1.0MiB"); EXPECT_STREQ(numeric_to_size(1000000000), "953.7MiB"); EXPECT_STREQ(numeric_to_size(1 << 30), "1.0GiB"); EXPECT_STREQ(numeric_to_size(1000000000000L), "931.3GiB"); EXPECT_STREQ(numeric_to_size((int64_t)1 << 40), "1.0TiB"); EXPECT_STREQ(numeric_to_size(-1), "-1B"); EXPECT_STREQ(numeric_to_size(-1024), "-1024B"); } TEST(Utils, inAddrFromString) { EXPECT_EQ(inAddrToString(inAddrFromString("127.0.0.1")), "127.0.0.1"); EXPECT_EQ(inAddrToString(inAddrFromString("1.2.3.4")), "1.2.3.4"); EXPECT_EQ(inAddrToString(inAddrFromString("1.2.3.255")), "1.2.3.255"); EXPECT_EQ(inAddrToString(inAddrFromString("255.2.3.4")), "255.2.3.4"); vector cases = { "", "123", "123.234", "123.234.2", "123.235.0.256", "1.2.3.4.5", "hello world", }; for (const string& c : cases) { try { inAddrFromString(c); EXPECT_TRUE(false) << c; } catch (Exception& e) { ASSERT_EQ(e.getErrorCode(), INVALID_IP_ADDRESS); } } } TEST(Utils, stringFormat) { EXPECT_EQ(stringFormat("hello"), "hello"); EXPECT_EQ(stringFormat("hello %s", "world"), "hello world"); EXPECT_EQ(stringFormat("hello %d", 3), "hello 3"); // following will SIGSEGV // EXPECT_EQ(stringFormat("hello%s"), "hello"); // EXPECT_EQ(stringFormat("hello %d", "world"), "hello 3"); } TEST(Utils, stringDump) { EXPECT_EQ(stringDump(""), ""); EXPECT_EQ(stringDump("\n"), "00000000 0a " "|.|\n00000001\n"); EXPECT_EQ(stringDump(readTestData("hexdumptest.dat")), readTestData("hexdumptest.out.dat")); } string construct00ToFF() { ostringstream oss; for (int i = 0; i < 256; ++i) { oss << char(i); } return oss.str(); } TEST(Utils, stringDumpAsCString) { EXPECT_EQ(stringDumpAsCString(""), "\"\""); EXPECT_EQ(stringDumpAsCString("\""), "\"\\\"\""); auto out = readTestData("hexcstringtest.out.dat"); EXPECT_EQ(stringDumpAsCString(construct00ToFF()), out.substr(0, out.length() - 1)); auto input = "\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12" "\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f " "!\"#$%&'()*+,-./" "0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`" "abcdefghijklmnopqrstuvwxyz{|}~" "\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90" "\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2" "\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4" "\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6" "\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8" "\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea" "\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc" "\xfd\xfe\xff"; EXPECT_EQ(stringDumpAsCString(string(input, 256)), out.substr(0, out.length() - 1)); } TEST(Utils, ipv4Compare) { EXPECT_LT( ipv4Compare(inAddrFromString("1.2.3.4"), inAddrFromString("1.2.3.5")), 0); EXPECT_LT( ipv4Compare(inAddrFromString("1.2.3.4"), inAddrFromString("1.2.4.0")), 0); EXPECT_EQ( ipv4Compare(inAddrFromString("1.2.3.5"), inAddrFromString("1.2.3.5")), 0); EXPECT_GT( ipv4Compare(inAddrFromString("1.2.3.5"), inAddrFromString("1.2.3.4")), 0); EXPECT_GT( ipv4Compare(inAddrFromString("1.2.4.0"), inAddrFromString("1.2.3.4")), 0); } TEST(Utils, utf8MakeValid) { ASSERT_EQ(utf8MakeValid(""), ""); ASSERT_EQ(utf8MakeValid("中文"), "中文"); ASSERT_EQ(utf8MakeValid("\xe4\xb8\xad\xe6\x96\x87"), "中文"); ASSERT_EQ(utf8MakeValid("\xe4\xb8\xe6\x96\x87"), "��文"); ASSERT_EQ(utf8MakeValid("\xe4\xb8\xad\xe6\x96"), "中��"); ASSERT_EQ(utf8MakeValid("\xe4\xe6\x96\x87"), "�文"); ASSERT_EQ(utf8MakeValid("\xe4\xb8\xad\xe6"), "中�"); } TEST(Utils, dupPath) { ASSERT_EQ(dupPath("/", 1), "/(1)"); ASSERT_EQ(dupPath("/a.b", 1), "/a (1).b"); ASSERT_EQ(dupPath("/a.b/.", 1), "/a.b/(1)"); ASSERT_EQ(dupPath("/a.b/c.d", 1), "/a.b/c (1).d"); ASSERT_EQ(dupPath("a.b/.", 1), "a.b/(1)"); ASSERT_EQ(dupPath("a.b/c.d", 1), "a.b/c (1).d"); ASSERT_EQ(dupPath("", 1), "(1)"); ASSERT_EQ(dupPath("a", 1), "a (1)"); ASSERT_EQ(dupPath("a.b", 1), "a (1).b"); ASSERT_EQ(dupPath("a.b.c", 1), "a.b (1).c"); ASSERT_EQ(dupPath("a.b", 2), "a (2).b"); ASSERT_EQ(dupPath("a.b", 10), "a (10).b"); } iptux-0.9.4/src/iptux-utils/meson.build000066400000000000000000000021241475473122500201460ustar00rootroot00000000000000glib_dep = dependency('glib-2.0', version: '>=2.35') thread_dep = dependency('threads') sources = files([ 'output.cpp', 'utils.cpp', 'Exception.cpp', ]) inc = include_directories('..', '../api') libiptux_utils = static_library('iptux-utils', sources, dependencies: [glib_dep], include_directories: inc, ) utils_test_helper_sources = files([ 'TestHelper.cpp', ]) libiptux_utils_test_helper = static_library('iptux-utils-test-helper', utils_test_helper_sources, dependencies: [glib_dep], link_with: [libiptux_utils], include_directories: inc ) gtest_inc = include_directories('../googletest/include') utils_test_sources = files([ 'UtilsTest.cpp', 'TestMain.cpp', ]) libiptux_utils_test = executable('libiptux_utils_test', utils_test_sources, dependencies: [glib_dep, thread_dep], link_with: [libiptux_utils, libgtest, libiptux_utils_test_helper], include_directories: [inc, gtest_inc] ) if meson.version().version_compare('>=0.55') test('utils', libiptux_utils_test, protocol: 'gtest') else test('utils', libiptux_utils_test) endif iptux-0.9.4/src/iptux-utils/output.cpp000066400000000000000000000041161475473122500200530ustar00rootroot00000000000000// // C++ Implementation: output // // Description: // // // Author: Jally , (C) 2008 // // Copyright: See COPYING file that comes with this distribution // // #include "config.h" #include "output.h" #include #include #include #include #include "iptux-utils/utils.h" #include using namespace std; namespace iptux { static LogLevel _level = LogLevel::WARN; static string getThreadName() { ostringstream oss; oss << pthread_self(); return oss.str(); } static char logLevelAsChar(GLogLevelFlags logLevel) { switch (logLevel) { case G_LOG_LEVEL_DEBUG: return 'D'; case G_LOG_LEVEL_INFO: return 'I'; case G_LOG_LEVEL_MESSAGE: return 'M'; case G_LOG_LEVEL_WARNING: return 'W'; case G_LOG_LEVEL_ERROR: return 'E'; default: return 'U'; } } static string nowAsString() { struct timeval tv; gettimeofday(&tv, nullptr); struct tm timeinfo; char buffer[80]; localtime_r(&tv.tv_sec, &timeinfo); strftime(buffer, sizeof(buffer), "%H:%M:%S", &timeinfo); return stringFormat("%s.%03d", buffer, int(tv.tv_usec / 1000)); } string pretty_fname(const string& fname) { size_t pos = fname.rfind("/"); if (pos == string::npos) { return fname; } else { return fname.substr(pos + 1); } } void DoLog(const char* fname, int line, const char* func, GLogLevelFlags level, const char* format, ...) { if (int(level) > int(_level)) { return; } va_list ap; va_start(ap, format); gchar* msg = g_strdup_vprintf(format, ap); va_end(ap); fprintf(stderr, "[%s][%s][%c]%s:%d:%s:%s\n", nowAsString().c_str(), getThreadName().c_str(), logLevelAsChar(level), pretty_fname(fname).c_str(), line, func, msg); g_free(msg); } bool Log::IsDebugEnabled() { return LogLevel::DEBUG <= _level; } bool Log::IsInfoEnabled() { return LogLevel::INFO <= _level; } void Log::setLogLevel(LogLevel level) { _level = level; } LogLevel Log::getLogLevel() { return _level; } } // namespace iptux iptux-0.9.4/src/iptux-utils/output.h000066400000000000000000000027321475473122500175220ustar00rootroot00000000000000// // C++ Interface: output // // Description: // // // Author: Jally , (C) 2008 // // Copyright: See COPYING file that comes with this distribution // // #ifndef IPTUX_OUTPUT_H #define IPTUX_OUTPUT_H #include namespace iptux { #define LOG_DEBUG(...) \ DoLog(__FILE__, __LINE__, __func__, G_LOG_LEVEL_DEBUG, __VA_ARGS__) #define LOG_INFO(...) \ DoLog(__FILE__, __LINE__, __func__, G_LOG_LEVEL_INFO, __VA_ARGS__) #define LOG_WARN(...) \ DoLog(__FILE__, __LINE__, __func__, G_LOG_LEVEL_WARNING, __VA_ARGS__) #define LOG_CRIT(...) \ DoLog(__FILE__, __LINE__, __func__, G_LOG_LEVEL_CRITICAL, __VA_ARGS__) #define LOG_ERROR(...) \ DoLog(__FILE__, __LINE__, __func__, G_LOG_LEVEL_ERROR, __VA_ARGS__) /* 警告信息输出 */ #ifndef WARNING #define pwarning(format, ...) /*warnx(format,##__VA_ARGS__)*/ #else #define pwarning(format, ...) warnx(format, ##__VA_ARGS__) #endif enum class LogLevel { WARN = G_LOG_LEVEL_WARNING, INFO = G_LOG_LEVEL_INFO, DEBUG = G_LOG_LEVEL_DEBUG }; class Log { public: /** * @brief Set the Log Level object * * @param level */ static void setLogLevel(LogLevel level); static LogLevel getLogLevel(); static bool IsDebugEnabled(); static bool IsInfoEnabled(); static bool IsWarnEnabled(); }; void DoLog(const char* fname, int line, const char* func, GLogLevelFlags level, const char* format, ...) G_GNUC_PRINTF(5, 6); } // namespace iptux #endif iptux-0.9.4/src/iptux-utils/utils.cpp000066400000000000000000000544411475473122500176610ustar00rootroot00000000000000// // C++ Implementation: utils // // Description: // // // Author: Jally , (C) 2008 // // Copyright: See COPYING file that comes with this distribution // // #include "config.h" #include "utils.h" #include #include #include #include #include #include #include #include #include #include #include #ifndef __APPLE__ #include #endif #include "iptux-core/Exception.h" #include "iptux-utils/output.h" using namespace std; namespace iptux { static const int MAX_PATHLEN = 1024; static const int MAX_BUFLEN = 1024; /** * 检查串(string)是否为有效的utf8串,若不是则根据字符集(codeset)来进行转码. * @param string 待检查的字符串 * @param codeset 字符集编码,e.g. * @retval encode 正确的字符集编码由此返回 * @return 有效的utf8串 * @note * 若(string)为utf8编码,或(codeset)中不存在(string)的正确编码,函数将返回NULL * @see iptux_string_validate_copy() */ char* iptux_string_validate(const char* s, const string& codeset, char** encode) { const char *pptr, *ptr; char *tstring, *cset; gsize rbytes, wbytes; *encode = NULL; // 设置字符集编码未知 tstring = NULL; // 设置utf8有效串尚未成功获取 if (!g_utf8_validate(s, -1, NULL) && !codeset.empty()) { cset = NULL; ptr = codeset.c_str(); do { if (*(pptr = ptr + strspn(ptr, ",;\x20\t")) == '\0') break; if (!(ptr = strpbrk(pptr, ",;\x20\t"))) ptr = pptr + strlen(pptr); g_free(cset); cset = g_strndup(pptr, ptr - pptr); if (strcasecmp(cset, "utf-8") == 0) continue; } while ( !(tstring = g_convert(s, -1, "utf-8", cset, &rbytes, &wbytes, NULL))); *encode = cset; } return tstring; } /** * 转换字符串编码. * @param string 字符串 * @param tocode 目标编码 * @param fromcode 源编码 * @return 新串 * @note 若函数执行出错,将返回NULL */ char* convert_encode(const char* string, const char* tocode, const char* fromcode) { gsize rbytes, wbytes; char* tstring; GError* err = nullptr; tstring = g_convert(string, -1, tocode, fromcode, &rbytes, &wbytes, &err); if (err != nullptr) { LOG_INFO("g_convert failed: %s-%d-%s", g_quark_to_string(err->domain), err->code, err->message); g_clear_error(&err); return nullptr; } return tstring; } /** * 确保(path)所指向的文件不存在. * @param path 文件路径 * @return 新文件路径 * */ string assert_filename_inexist(const char* path) { if (access(path, F_OK) != 0) return path; int idx = 1; while (true) { string newPath = dupPath(path, idx); if (access(newPath.c_str(), F_OK) != 0) { return newPath; } idx++; } } string dupFilename(const string& filename, int idx) { if (filename == "." || filename == "/") { return stringFormat("(%d)", idx); } auto pos = filename.find_last_of('.'); if (pos == string::npos) { return stringFormat("%s (%d)", filename.c_str(), idx); } return stringFormat("%s (%d).%s", filename.substr(0, pos).c_str(), idx, filename.substr(pos + 1, filename.size()).c_str()); } string dupPath(const string& path, int idx) { auto basename_ = g_path_get_basename(path.c_str()); auto dirname_ = g_path_get_dirname(path.c_str()); string basename = basename_; string dirname = dirname_; g_free(basename_); g_free(dirname_); if (dirname == ".") { return dupFilename(basename, idx); } if (dirname == "/") { return "/" + dupFilename(basename, idx); } return stringFormat("%s/%s", dirname.c_str(), dupFilename(basename, idx).c_str()); } /** * 获取包含指定数据的格式化时间串. * @param date 是否需要包含日期 * @param format as in printf() * @param ... as in printf() * @return 时间串 */ char* getformattime(gboolean date, const char* format, ...) { char buf[MAX_BUFLEN], *msg, *ptr; time_t tt; va_list ap; va_start(ap, format); msg = g_strdup_vprintf(format, ap); va_end(ap); time(&tt); struct tm tm; localtime_r(&tt, &tm); if (date) strftime(buf, MAX_BUFLEN, "%c", &tm); else strftime(buf, MAX_BUFLEN, "%X", &tm); ptr = g_strdup_printf("(%s) %s:", buf, msg); g_free(msg); return ptr; } char* getformattime2(time_t tt, gboolean date, const char* format, ...) { char buf[MAX_BUFLEN], *msg, *ptr; va_list ap; va_start(ap, format); msg = g_strdup_vprintf(format, ap); va_end(ap); struct tm tm; localtime_r(&tt, &tm); if (date) strftime(buf, MAX_BUFLEN, "%c", &tm); else strftime(buf, MAX_BUFLEN, "%X", &tm); ptr = g_strdup_printf("(%s) %s:", buf, msg); g_free(msg); return ptr; } gboolean ig_unichar_is_atomic(gunichar ch) { return ch == 0xFFFC; } /** * 把数值(numeric)转换为文件长度描述串. * @param numeric 需要转换的数值 * @return 描述串 */ char* numeric_to_size(int64_t numeric) { gchar* ptr; if (numeric >= ((int64_t)1 << 40)) ptr = g_strdup_printf("%.1fTiB", (double)numeric / ((int64_t)1 << 40)); else if (numeric >= (1 << 30)) ptr = g_strdup_printf("%.1fGiB", (double)numeric / (1 << 30)); else if (numeric >= (1 << 20)) ptr = g_strdup_printf("%.1fMiB", (double)numeric / (1 << 20)); else if (numeric >= (1 << 10)) ptr = g_strdup_printf("%.1fKiB", (double)numeric / (1 << 10)); else ptr = g_strdup_printf("%" PRId64 "B", numeric); return ptr; } /** * 把数值(numeric)转换为速度大小描述串. * @param numeric 需要转换的数值 * @return 描述串 */ char* numeric_to_rate(uint32_t numeric) { gchar* ptr; if (numeric >= (1 << 30)) ptr = g_strdup_printf("%.1fG/s", (float)numeric / (1 << 30)); else if (numeric >= (1 << 20)) ptr = g_strdup_printf("%.1fM/s", (float)numeric / (1 << 20)); else if (numeric >= (1 << 10)) ptr = g_strdup_printf("%.1fK/s", (float)numeric / (1 << 10)); else ptr = g_strdup_printf("%" PRIu32 "B/s", numeric); return ptr; } /** * 把数值(numeric)转换为时间长度描述串. * @param numeric 需要转换的数值 * @return 描述串 */ char* numeric_to_time(uint32_t numeric) { uint32_t hour, minute; gchar* ptr; hour = numeric / 3600; numeric %= 3600; minute = numeric / 60; numeric %= 60; ptr = g_strdup_printf("%.2" PRIu32 ":%.2" PRIu32 ":%.2" PRIu32, hour, minute, numeric); return ptr; } /** * 查询以(string)为起始点,(times)个字符串后的指针位置. * @param string 串起始点 * @param size 串有效长度 * @param times 跳跃次数 * @return 指针位置 */ const char* iptux_skip_string(const char* string, size_t size, uint8_t times) { const char* ptr; uint8_t count; ptr = string; count = 0; while (count < times) { ptr += strlen(ptr) + 1; if ((size_t)(ptr - string) >= size) { ptr = NULL; break; } count++; } return ptr; } /** * 查询以(string)为起始点,跳跃(times)次(ch)字符后的指针位置. * @param string 串起始点 * @param ch 分割字符 * @param times 跳跃次数 * @return 指针位置 */ const char* iptux_skip_section(const char* string, char ch, uint8_t times) { const char* ptr; uint8_t count; ptr = string; count = 0; while (count < times) { if (!(ptr = strchr(ptr, ch))) break; ptr++; // 跳过当前分割字符 count++; } return ptr; } /** * 读取以(msg)为起始点,跳跃(times)次(ch)字符后的16进制数值. * @param msg 串起始点 * @param ch 分割字符 * @param times 跳跃次数 * @return 数值 */ int64_t iptux_get_hex64_number(const char* msg, char ch, uint8_t times) { const char* ptr; uint64_t number; if (!(ptr = iptux_skip_section(msg, ch, times))) return 0; if (sscanf(ptr, "%" SCNx64, &number) == 1) return (int64_t)number; return 0; } /** * 读取以(msg)为起始点,跳跃(times)次(ch)字符后的16进制数值. * @param msg 串起始点 * @param ch 分割字符 * @param times 跳跃次数 * @return 数值 */ uint32_t iptux_get_hex_number(const char* msg, char ch, uint8_t times) { const char* ptr; uint32_t number; if (!(ptr = iptux_skip_section(msg, ch, times))) return 0; if (sscanf(ptr, "%" SCNx32, &number) == 1) return number; return 0; } /** * 读取以(msg)为起始点,跳跃(times)次(ch)字符后的10进制数值. * @param msg 串起始点 * @param ch 分割字符 * @param times 跳跃次数 * @return 数值 */ uint32_t iptux_get_dec_number(const char* msg, char ch, uint8_t times) { const char* ptr; uint32_t number; if (!(ptr = iptux_skip_section(msg, ch, times))) return 0; if (sscanf(ptr, "%" SCNu32, &number) == 1) return number; return 0; } /** * 读取以(msg)为起始点,跳跃(times)次(ch)字符后的一个字段. * @param msg 串起始点 * @param ch 分割字符 * @param times 跳跃次数 * @return 新串 */ char* iptux_get_section_string(const char* msg, char ch, uint8_t times) { const char *pptr, *ptr; char* string; size_t len; if (!(pptr = iptux_skip_section(msg, ch, times))) return NULL; ptr = strchr(pptr, ch); if ((len = ptr ? ptr - pptr : strlen(pptr)) == 0) return NULL; string = g_strndup(pptr, len); return string; } /** * 读取以(msg)为起始点,跳跃(times)次(ch)字符后的一个文件名. * @param msg 串起始点 * @param ch 分割字符 * @param times 跳跃次数 * @return 新串 * * @note 文件名特殊格式请参考IPMsg协议 * @note (msg)串会被修改 */ char* ipmsg_get_filename(const char* msg, char ch, uint8_t times) { char filename[256]; // 文件最大长度为255 const char* ptr; if ((ptr = iptux_skip_section(msg, ch, times))) { size_t len = 0; while (*ptr != ':' || strncmp(ptr, "::", 2) == 0) { if (len < 255) { // 防止缓冲区溢出 filename[len] = *ptr; len++; } if (*ptr == ':') { // 抹除分割符 memcpy((void*)ptr, "xx", 2); ptr++; } ptr++; } filename[len] = '\0'; } else { static uint32_t serial = 1; snprintf(filename, 256, "%" PRIu32 "_file", serial++); } return g_strdup(filename); } /** * 读取以(msg)为起始点,跳跃(times)次(ch)字符后的完整串. * @param msg 串起始点 * @param ch 分割字符 * @param times 跳跃次数 * @return 新串 */ char* ipmsg_get_attach(const char* msg, char ch, uint8_t times) { const char* ptr; if (!(ptr = iptux_skip_section(msg, ch, times))) return NULL; return g_strdup(ptr); } /** * 从文件路径中分离出文件名,并转化为(IPMsg)格式的文件名. * @param pathname 文件路径 * @return 文件名 * * @note 文件名特殊格式请参考IPMsg协议 */ char* ipmsg_get_filename_pal(const char* pathname) { char filename[512]; // 文件最大长度为255 const char* ptr; size_t len; ptr = strrchr(pathname, '/'); ptr = ptr ? ptr + 1 : pathname; len = 0; while (*ptr && len < 510) { if (*ptr == ':') { memcpy(filename + len, "::", 2); len += 2; } else { filename[len] = *ptr; len++; } ptr++; } filename[len] = '\0'; return g_strdup(filename); } /** * 从文件路径中分离出文件名以及路径. * @param pathname 文件路径 * @retval path 路径由此返回 * @return 文件名 * * @note 路径可能为NULL */ char* ipmsg_get_filename_me(const char* pathname, char** path) { const char* ptr; char* file; ptr = strrchr(pathname, '/'); if (ptr && ptr != pathname) { file = g_strdup(ptr + 1); if (path) *path = g_strndup(pathname, ptr - pathname); } else { file = g_strdup(pathname); if (path) *path = NULL; } return file; } /** * 从文件名中移除后缀. * @param filename 文件名 * @return 文件 * */ char* iptux_erase_filename_suffix(const char* filename) { const char* ptr; char* file; ptr = strrchr(filename, '.'); if (ptr && ptr != filename) file = g_strndup(filename, ptr - filename); else file = g_strdup(filename); return file; } /** * 从给定的文件路径和文件名返回全文件名. * @param path 文件路径 * @param name 文件名 * @return 带路径的文件名 * */ char* ipmsg_get_pathname_full(const char* path, const char* name) { char filename[MAX_PATHLEN]; strcpy(filename, path); strcat(filename, "/"); strcat(filename, name); return g_strdup(filename); } std::string inAddrToString(in_addr inAddr) { char res[INET_ADDRSTRLEN]; inet_ntop(AF_INET, &inAddr.s_addr, res, INET_ADDRSTRLEN); return res; } in_addr inAddrFromString(const std::string& s) { in_addr res; if (inet_pton(AF_INET, s.c_str(), &res.s_addr) == 1) { return res; } throw Exception(INVALID_IP_ADDRESS); } std::string stringDump(const std::string& str) { if (str.empty()) { return ""; } ostringstream oss; for (int i = 0; i < int(str.size()); i += 16) { oss << stringFormat("%08x ", i); for (int j = 0; j < 8; ++j) { if (i + j < int(str.size())) { oss << stringFormat("%02x ", uint8_t(str[i + j])); } else { oss << " "; } } oss << ' '; for (int j = 8; j < 16; ++j) { if (i + j < int(str.size())) { oss << stringFormat("%02x ", uint8_t(str[i + j])); } else { oss << " "; } } oss << " |"; for (int j = 0; j < 16; ++j) { if (i + j >= int(str.size())) { break; } char c = str[i + j]; if (c >= ' ' && c <= '\x7e') { oss << c; } else { oss << '.'; } } oss << "|\n"; } oss << stringFormat("%08jx\n", (uintmax_t)str.size()); return oss.str(); } std::string stringDumpAsCString(const std::string& str) { static const char* tables[32] = { "\\x00", "\\x01", "\\x02", "\\x03", "\\x04", "\\x05", "\\x06", "\\x07", "\\x08", "\\t", "\\n", "\\x0b", "\\x0c", "\\r", "\\x0e", "\\x0f", "\\x10", "\\x11", "\\x12", "\\x13", "\\x14", "\\x15", "\\x16", "\\x17", "\\x18", "\\x19", "\\x1a", "\\x1b", "\\x1c", "\\x1d", "\\x1e", "\\x1f"}; ostringstream oss; oss << '"'; for (int i = 0; i < int(str.size()); ++i) { if (uint8_t(str[i]) < 0x20) { oss << tables[int(str[i])]; } else if (str[i] == '"') { oss << "\\\""; } else if (str[i] == '\\') { oss << "\\\\"; } else if (uint8_t(str[i]) < 0x7f) { oss << str[i]; } else { oss << stringFormat("\\x%02x", uint8_t(str[i])); } } oss << '"'; return oss.str(); } void Helper::prepareDir(const std::string& fname) { auto path = g_path_get_dirname(fname.c_str()); if (g_mkdir_with_parents(path, 0755) != 0) { LOG_ERROR("g_mkdir_with_parents failed: %s, %s", path, strerror(errno)); } g_free(path); } /** * 写出数据. * @param fd 文件描述符 * @param buf 缓冲区 * @param count 缓冲区有效数据长度 * @return 成功写出的数据长度 */ ssize_t xwrite(int fd, const void* buf, size_t count) { size_t offset; ssize_t size; size = -1; offset = 0; while (offset < count) { if ((size = write(fd, (char*)buf + offset, count - offset)) == -1) { if (errno == EINTR || errno == EAGAIN) continue; LOG_ERROR("write to %d failed on %zu/%zu: %s", fd, offset, count, strerror(errno)); return -1; } offset += size; } return offset; } ssize_t xsend(int fd, const void* buf, size_t count) { size_t offset; ssize_t size; size = -1; offset = 0; while (offset < count) { if ((size = send(fd, (char*)buf + offset, count - offset, MSG_NOSIGNAL)) == -1) { if (errno == EINTR || errno == EAGAIN) continue; LOG_ERROR("send to %d failed on %zu/%zu: %s", fd, offset, count, strerror(errno)); return -1; } offset += size; } return offset; } /** * 读取数据. * @param fd 文件描述符 * @param buf 缓冲区 * @param count 缓冲区长度 * @return 成功读取的数据长度 */ ssize_t xread(int fd, void* buf, size_t count) { size_t offset; ssize_t size; size = -1; offset = 0; while ((offset != count) && (size != 0)) { if ((size = read(fd, (char*)buf + offset, count - offset)) == -1) { if (errno == EINTR) continue; return -1; } offset += size; } return offset; } /** * 读取ipmsg消息前缀. * Ver(1):PacketNo:SenderName:SenderHost:CommandNo:AdditionalSection.\n * @param fd 文件描述符 * @param buf 缓冲区 * @param count 缓冲区长度 * @return 成功读取的消息长度,-1表示读取消息出错 */ ssize_t read_ipmsg_prefix(int fd, void* buf, size_t count) { uint number; size_t offset; ssize_t size; size = -1; offset = 0; number = 0; while ((offset != count) && (size != 0)) { if ((size = read(fd, (char*)buf + offset, count - offset)) == -1) { if (errno == EINTR) continue; return -1; } offset += size; const char* endptr = (const char*)buf + offset; for (const char* curptr = endptr - size; curptr < endptr; ++curptr) { if (*curptr == ':') ++number; } if (number >= 5) break; } return offset; } /** * 读取ipmsg文件请求消息前缀. * packetID:fileID:offset.\n * @param fd 文件描述符 * @param buf 缓冲区 * @param count 缓冲区长度 * @param offset 缓冲区无效数据偏移量 * @return 成功读取的消息长度,-1表示读取消息出错 */ ssize_t read_ipmsg_filedata(int fd, void* buf, size_t count, size_t offset) { const char* curptr; uint number; ssize_t size; size = -1; number = 0; curptr = (const char*)buf; while ((offset != count) && (size != 0)) { const char* endptr = (const char*)buf + offset; for (; curptr < endptr; ++curptr) { if (*curptr == ':') ++number; } if (number > 2 || (number == 2 && *(curptr - 1) != ':')) break; if ((size = read(fd, (char*)buf + offset, count - offset)) == -1) { if (errno == EINTR) continue; return -1; } offset += size; } return offset; } /** * 读取ipmsg目录请求消息前缀. * packetID:fileID.\n * @param fd 文件描述符 * @param buf 缓冲区 * @param count 缓冲区长度 * @param offset 缓冲区无效数据偏移量 * @return 成功读取的消息长度,-1表示读取消息出错 */ ssize_t read_ipmsg_dirfiles(int fd, void* buf, size_t count, size_t offset) { const char* curptr; uint number; ssize_t size; size = -1; number = 0; curptr = (const char*)buf; while ((offset != count) && (size != 0)) { const char* endptr = (const char*)buf + offset; for (; curptr < endptr; ++curptr) { if (*curptr == ':') ++number; } if (number > 1 || (number == 1 && *(curptr - 1) != ':')) break; if ((size = read(fd, (char*)buf + offset, count - offset)) == -1) { if (errno == EINTR) continue; return -1; } offset += size; } return offset; } /** * 读取ipmsg文件头信息. * 本函数的退出条件为: \n * 1.缓冲区内必须要有数据; \n * 2.文件头长度必须能够被获得; \n * 3.文件头长度必须小于或等于缓冲区内已有数据长度; \n * 4.读取数据出错(晕,这还值得怀疑吗?). \n * @param fd 文件描述符 * @param buf 缓冲区 * @param count 缓冲区长度 * @param offset 缓冲区无效数据偏移量 * @return 成功读取的信息长度 */ ssize_t read_ipmsg_fileinfo(int fd, void* buf, size_t count, size_t offset) { ssize_t size; uint32_t headsize; if (offset < count) // 注意不要写到缓冲区外了 ((char*)buf)[offset] = '\0'; while (!offset || !strchr((char*)buf, ':') || sscanf((char*)buf, "%" SCNx32, &headsize) != 1 || headsize > offset) { mark: if ((size = read(fd, (char*)buf + offset, count - offset)) == -1) { if (errno == EINTR) goto mark; return -1; } else if (size == 0) return -1; if ((offset += size) == count) break; ((char*)buf)[offset] = '\0'; } return offset; } int ipv4Compare(const in_addr& ip1, const in_addr& ip2) { uint32_t i1 = inAddrToUint32(ip1); uint32_t i2 = inAddrToUint32(ip2); if (i1 < i2) { return -1; } if (i1 == i2) { return 0; } return 1; } bool ipv4Equal(const in_addr& ip1, const in_addr& ip2) { return ip1.s_addr == ip2.s_addr; } uint32_t inAddrToUint32(in_addr ipv4) { return ntohl(ipv4.s_addr); } in_addr inAddrFromUint32(uint32_t value) { in_addr res; res.s_addr = htonl(value); return res; } string utf8MakeValid(const string& str) { auto res1 = g_utf8_make_valid(str.c_str(), str.size()); string res(res1); g_free(res1); return res; } namespace utils { int64_t fileOrDirectorySize(const string& fileOrDirName) { // 由于系统中存在使用此方法读取文件的大小的调用,因此需要判断文件dir_name是文件还是目录 struct stat st; int result = stat(fileOrDirName.c_str(), &st); if (result != 0) { // Fail to determine file type, return 0 (判断文件类型失败,直接返回 0) LOG_WARN(_("stat file \"%s\" failed: %s"), fileOrDirName.c_str(), strerror(errno)); return 0; } if (S_ISREG(st.st_mode)) { return st.st_size; } if (!S_ISDIR(st.st_mode)) { LOG_WARN(_("path %s is not file or directory: st_mode(%x)"), fileOrDirName.c_str(), st.st_mode); return 0; } // 到了这里就一定是目录了 DIR* dir = opendir(fileOrDirName.c_str()); if (dir == NULL) { LOG_WARN(_("opendir on \"%s\" failed: %s"), fileOrDirName.c_str(), strerror(errno)); return 0; } struct dirent* dirt; int64_t sumsize = 0; while ((dirt = readdir(dir))) { if (strcmp(dirt->d_name, ".") == 0) { continue; } if (strcmp(dirt->d_name, "..") == 0) { continue; } string tpath = fileOrDirName + "/" + dirt->d_name; struct stat st; if (stat(tpath.c_str(), &st) == -1) { continue; } if (S_ISDIR(st.st_mode)) { sumsize += fileOrDirectorySize(tpath); } else if (S_ISREG(st.st_mode)) { sumsize += st.st_size; } else { // ignore other files } } return sumsize; } } // namespace utils std::string sha256(const char* s, int length) { auto res1 = g_compute_checksum_for_string(G_CHECKSUM_SHA256, s, length); string res(res1); g_free(res1); return res; } } // namespace iptux iptux-0.9.4/src/iptux-utils/utils.h000066400000000000000000000111541475473122500173200ustar00rootroot00000000000000// // C++ Interface: utils // // Description: // // // Author: Jally , (C) 2008 // // Copyright: See COPYING file that comes with this distribution // // #ifndef IPTUX_UTILS_H #define IPTUX_UTILS_H #include #include #include #include namespace iptux { #define difftimeval(val2, val1) \ ((((val2).tv_sec - (val1).tv_sec) * 1000000 + (val2).tv_usec - \ (val1).tv_usec) / \ 1000000.0f) #define percent(num1, num2) (100.0f * (num1) / (num2)) #define URL_REGEX \ "(http|ftp|https|sftp):\\/\\/[\\w\\-_]+(\\.[\\w\\-_]+)+" \ "([\\w\\-\\.,@?^=%&:/~\\+#]*[\\w\\-\\@?^=%&/~\\+#])?" #define NO_OPERATION_C \ while (0) \ ; typedef void* (*ThreadFunc)(void*); char* iptux_string_validate(const char* s, const std::string& codeset, char** encode); char* convert_encode(const char* string, const char* tocode, const char* fromcode); std::string assert_filename_inexist(const char* path); std::string dupPath(const std::string& fname, int idx); char* getformattime(gboolean date, const char* format, ...) G_GNUC_PRINTF(2, 3); char* getformattime2(time_t now, gboolean date, const char* format, ...) G_GNUC_PRINTF(3, 4); gboolean ig_unichar_is_atomic(gunichar ch); char* numeric_to_size(int64_t numeric); char* numeric_to_rate(uint32_t numeric); char* numeric_to_time(uint32_t numeric); /* 以下函数调用的(ch)参数字符不应为('\0') */ const char* iptux_skip_string(const char* string, size_t size, uint8_t times); const char* iptux_skip_section(const char* string, char ch, uint8_t times); int64_t iptux_get_hex64_number(const char* msg, char ch, uint8_t times); uint32_t iptux_get_hex_number(const char* msg, char ch, uint8_t times); uint32_t iptux_get_dec_number(const char* msg, char ch, uint8_t times); char* iptux_get_section_string(const char* msg, char ch, uint8_t times); char* ipmsg_get_filename(const char* msg, char ch, uint8_t times); char* ipmsg_get_attach(const char* msg, char ch, uint8_t times); char* ipmsg_get_filename_pal(const char* pathname); char* ipmsg_get_filename_me(const char* pathname, char** path); char* iptux_erase_filename_suffix(const char* filename); char* ipmsg_get_pathname_full(const char* path, const char* name); bool ipv4Equal(const in_addr& ip1, const in_addr& ip2); int ipv4Compare(const in_addr& ip1, const in_addr& ip2); std::string inAddrToString(in_addr ipv4); in_addr inAddrFromString(const std::string& s); uint32_t inAddrToUint32(in_addr ipv4); in_addr inAddrFromUint32(uint32_t value); template std::string stringFormat(const char* format, ...) G_GNUC_PRINTF(1, 2); template std::string stringFormat(const char* format, ...) { va_list args; va_start(args, format); gchar* buf = g_strdup_vprintf(format, args); va_end(args); std::string res(buf, strlen(buf)); g_free(buf); return res; } /** * @brief dump string like hexdump -C * * @param str source * @return std::string result */ std::string stringDump(const std::string& str); /** * @brief dump string like C String * * @param str * @return std::string */ std::string stringDumpAsCString(const std::string& str); class Helper { public: static void prepareDir(const std::string& fname); }; ssize_t xwrite(int fd, const void* buf, size_t count); ssize_t xsend(int fd, const void* buf, size_t count); ssize_t xread(int fd, void* buf, size_t count); ssize_t read_ipmsg_prefix(int fd, void* buf, size_t count); ssize_t read_ipmsg_filedata(int fd, void* buf, size_t count, size_t offset); ssize_t read_ipmsg_dirfiles(int fd, void* buf, size_t count, size_t offset); ssize_t read_ipmsg_fileinfo(int fd, void* buf, size_t count, size_t offset); /** * @brief wrapper for g_utf8_make_valid * * @param str * @return std::string */ std::string utf8MakeValid(const std::string& str); namespace utils { /** * @brief calculate the file or directory size; * * return 0 if not exist. * * @param fileOrDirName * @return int64_t */ int64_t fileOrDirectorySize(const std::string& fileOrDirName); } // namespace utils /** * @brief calculate the sha256 of string s, in hexadecimal format * * @param s * @return std::string */ std::string sha256(const std::string& s); /** * @brief calculate the sha256 of string, in hexadecimal format * * @param s the start of the string * @param length the length of the string * @return std::string */ std::string sha256(const char* s, int length); } // namespace iptux #endif iptux-0.9.4/src/iptux/000077500000000000000000000000001475473122500146475ustar00rootroot00000000000000iptux-0.9.4/src/iptux/AboutDialog.cpp000066400000000000000000000045671475473122500175610ustar00rootroot00000000000000// // Description: // // // Author: Jally , (C) 2008 // Jally & ManPT , (C) 2009 // // Copyright: See COPYING file that comes with this distribution // // #include "config.h" #include "AboutDialog.h" #include #include #include #include "iptux/UiHelper.h" using namespace std; namespace iptux { static gboolean iptux_on_activate_link(GtkAboutDialog*, gchar* uri, gpointer) { iptux_open_url(uri); return TRUE; } /** * 创建关于对话框. */ void CreateAboutDialog(AboutDialog* dialog) { if (g_object_get_data(G_OBJECT(dialog), "inited")) { return; } g_object_set_data(G_OBJECT(dialog), "inited", GINT_TO_POINTER(TRUE)); // gtk_window_set_transient_for(GTK_WINDOW(dialog), parent); gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(dialog), VERSION); const char* translator = _("TRANSLATOR NAME"); string originTranslator = "TRANSLATOR NAME"; if (originTranslator != translator) { gtk_about_dialog_set_translator_credits(GTK_ABOUT_DIALOG(dialog), translator); } const char* credits[] = { "ChenGang", "", "", "", "", nullptr, }; gtk_about_dialog_add_credit_section(GTK_ABOUT_DIALOG(dialog), _("Thanks to"), credits); g_signal_connect(dialog, "activate-link", G_CALLBACK(iptux_on_activate_link), nullptr); } /** * 关于对话框入口. */ AboutDialog* aboutDialogNew() { auto builder = gtk_builder_new_from_resource(IPTUX_RESOURCE "gtk/AboutDialog.ui"); gtk_builder_connect_signals(builder, nullptr); auto aboutDialog = GTK_ABOUT_DIALOG( CHECK_NOTNULL(gtk_builder_get_object(builder, "about_dialog"))); g_object_unref(builder); CreateAboutDialog(aboutDialog); return aboutDialog; } void aboutDialogRun(AboutDialog* aboutDialog, GtkWindow* parent) { gtk_window_set_transient_for(GTK_WINDOW(aboutDialog), parent); gtk_dialog_run(GTK_DIALOG(aboutDialog)); gtk_widget_hide(GTK_WIDGET(aboutDialog)); } void aboutDialogEntry(GtkWindow* parent) { AboutDialog* aboutDialog = aboutDialogNew(); g_object_ref_sink(G_OBJECT(aboutDialog)); aboutDialogRun(aboutDialog, parent); g_object_unref(aboutDialog); } } // namespace iptux iptux-0.9.4/src/iptux/AboutDialog.h000066400000000000000000000007401475473122500172130ustar00rootroot00000000000000// // // Description: // 创建帮助相关对话框 // // Author: Jally , (C) 2008 // // Copyright: See COPYING file that comes with this distribution // // #ifndef IPTUX_ABOUT_DIALOG_H #define IPTUX_ABOUT_DIALOG_H #include namespace iptux { typedef GtkAboutDialog AboutDialog; AboutDialog* aboutDialogNew(); void aboutDialogRun(AboutDialog* aboutDialog, GtkWindow* parent); void aboutDialogEntry(GtkWindow* parent); } // namespace iptux #endif iptux-0.9.4/src/iptux/AboutDialogTest.cpp000066400000000000000000000005761475473122500204150ustar00rootroot00000000000000#include "gtest/gtest.h" #include "iptux-core/TestHelper.h" #include "iptux/AboutDialog.h" #include "iptux/IptuxResource.h" using namespace std; using namespace iptux; TEST(AboutDialog, aboutDialogNew) { gtk_init(nullptr, nullptr); iptux_register_resource(); auto aboutDialog = aboutDialogNew(); g_object_ref_sink(G_OBJECT(aboutDialog)); g_object_unref(aboutDialog); } iptux-0.9.4/src/iptux/AppIndicator.cpp000066400000000000000000000042351475473122500177340ustar00rootroot00000000000000#include "config.h" #include "AppIndicator.h" #include #include #include "iptux/Application.h" #include "iptux/UiCoreThread.h" namespace iptux { class IptuxAppIndicatorPrivate { public: IptuxAppIndicatorPrivate(Application* app) : app(app) {} ~IptuxAppIndicatorPrivate() { if (indicator) { g_object_unref(indicator); } if (menuBuilder) { g_object_unref(menuBuilder); } } Application* app; AppIndicator* indicator; GtkBuilder* menuBuilder; static void onScrollEvent(IptuxAppIndicatorPrivate* self) { g_action_group_activate_action(G_ACTION_GROUP(self->app->getApp()), "open_main_window", NULL); } }; IptuxAppIndicator::IptuxAppIndicator(Application* app) { this->priv = std::make_shared(app); priv->indicator = app_indicator_new("io.github.iptux_src.iptux", "iptux-icon", APP_INDICATOR_CATEGORY_COMMUNICATIONS); app_indicator_set_status(priv->indicator, APP_INDICATOR_STATUS_ACTIVE); app_indicator_set_attention_icon(priv->indicator, "iptux-attention"); app_indicator_set_title(priv->indicator, _("Iptux")); priv->menuBuilder = gtk_builder_new_from_resource(IPTUX_RESOURCE "gtk/AppIndicator.ui"); GtkMenu* menu = GTK_MENU(gtk_menu_new_from_model(G_MENU_MODEL( gtk_builder_get_object(priv->menuBuilder, "app-indicator-menu")))); gtk_widget_insert_action_group(GTK_WIDGET(menu), "app", G_ACTION_GROUP(app->getApp())); app_indicator_set_menu(priv->indicator, menu); g_signal_connect_swapped(priv->indicator, "scroll-event", G_CALLBACK(IptuxAppIndicatorPrivate::onScrollEvent), priv.get()); app->getCoreThread()->sigUnreadMsgCountUpdated.connect( sigc::mem_fun(*this, &IptuxAppIndicator::SetUnreadCount)); } void IptuxAppIndicator::SetUnreadCount(int i) { if (i > 0) { app_indicator_set_status(priv->indicator, APP_INDICATOR_STATUS_ATTENTION); } else { app_indicator_set_status(priv->indicator, APP_INDICATOR_STATUS_ACTIVE); } } } // namespace iptux iptux-0.9.4/src/iptux/AppIndicator.h000066400000000000000000000004421475473122500173750ustar00rootroot00000000000000#pragma once #include "iptux/Application.h" namespace iptux { class IptuxAppIndicatorPrivate; class IptuxAppIndicator { public: IptuxAppIndicator(Application* app); void SetUnreadCount(int count); private: std::shared_ptr priv; }; } // namespace iptux iptux-0.9.4/src/iptux/AppIndicatorDummy.cpp000066400000000000000000000002241475473122500207420ustar00rootroot00000000000000#include "AppIndicator.h" namespace iptux { IptuxAppIndicator::IptuxAppIndicator(Application*) { // Dummy implementation } } // namespace iptux iptux-0.9.4/src/iptux/Application.cpp000066400000000000000000000327051475473122500176250ustar00rootroot00000000000000#include "config.h" #include "Application.h" #include #include #include #include "iptux-core/Exception.h" #include "iptux-utils/output.h" #include "iptux-utils/utils.h" #include "iptux/AboutDialog.h" #include "iptux/AppIndicator.h" #include "iptux/DataSettings.h" #include "iptux/DialogPeer.h" #include "iptux/IptuxResource.h" #include "iptux/LogSystem.h" #include "iptux/MainWindow.h" #include "iptux/ShareFile.h" #include "iptux/TransWindow.h" #include "iptux/UiCoreThread.h" #include "iptux/UiHelper.h" #include "iptux/dialog.h" #if SYSTEM_DARWIN #include "iptux/TerminalNotifierNotificationService.h" #else #include "iptux/GioNotificationService.h" #endif #if SYSTEM_DARWIN #include "iptux/Darwin.h" #endif using namespace std; typedef void (*GActionCallback)(GSimpleAction* action, GVariant* parameter, gpointer user_data); #define G_ACTION_CALLBACK(f) ((GActionCallback)(f)) namespace iptux { namespace { void onReportBug() { iptux_open_url("https://github.com/iptux-src/iptux/issues/new"); } void onWhatsNew() { iptux_open_url("https://github.com/iptux-src/iptux/blob/master/NEWS"); } void iptux_init(LogSystem* logSystem) { signal(SIGPIPE, SIG_IGN); logSystem->systemLog("%s", _("Loading the process successfully!")); } void init_theme(Application* app) { auto theme = gtk_icon_theme_get_default(); gtk_icon_theme_prepend_search_path(theme, __PIXMAPS_PATH "/icon"); gtk_icon_theme_prepend_search_path(theme, __PIXMAPS_PATH "/menu"); gtk_icon_theme_prepend_search_path(theme, __PIXMAPS_PATH "/tip"); gtk_icon_theme_prepend_search_path( theme, app->getCoreThread()->getUserIconPath().c_str()); } } // namespace Application::Application(shared_ptr config) : config(config), data(nullptr), window(nullptr), shareFile(nullptr) { auto application_id = config->GetString("debug_application_id", "io.github.iptux_src.iptux"); transModel = transModelNew(); menuBuilder = nullptr; logSystem = nullptr; app = gtk_application_new(application_id.c_str(), G_APPLICATION_FLAGS_NONE); g_signal_connect_swapped(app, "startup", G_CALLBACK(onStartup), this); g_signal_connect_swapped(app, "activate", G_CALLBACK(onActivate), this); #if SYSTEM_DARWIN notificationService = new TerminalNotifierNoticationService(); #else notificationService = new GioNotificationService(); use_header_bar_ = true; // GError* error = nullptr; // if(!g_application_register(G_APPLICATION(app), nullptr, &error)) { // LOG_WARN("g_application_register failed: %s-%d-%s", // g_quark_to_string(error->domain), // error->code, error->message); // } #endif } Application::~Application() { g_object_unref(app); if (menuBuilder) { g_object_unref(menuBuilder); } transModelDelete(transModel); if (logSystem) { delete logSystem; } delete window; delete notificationService; } int Application::run(int argc, char** argv) { return g_application_run(G_APPLICATION(app), argc, argv); } void Application::startup() { Application::onStartup(*this); } void Application::activate() { Application::onActivate(*this); } void Application::onStartup(Application& self) { init_theme(&self); iptux_register_resource(); self.menuBuilder = gtk_builder_new_from_resource(IPTUX_RESOURCE "gtk/menus.ui"); self.data = make_shared(self.config); self.logSystem = new LogSystem(self.data); self.cthrd = make_shared(&self, self.data); if (self.enable_app_indicator_) { self.app_indicator = make_shared(&self); } bool use_app_menu = true; #if SYSTEM_DARWIN #else use_app_menu = gtk_application_prefers_app_menu(self.app); #endif if (use_app_menu) { auto app_menu = G_MENU_MODEL(gtk_builder_get_object(self.menuBuilder, "appmenu")); gtk_application_set_app_menu(GTK_APPLICATION(self.app), app_menu); self.menu_ = G_MENU_MODEL( gtk_builder_get_object(self.menuBuilder, "menubar-when-app-menu")); if (!self.use_header_bar()) { gtk_application_set_menubar(GTK_APPLICATION(self.app), self.menu()); } } else { self.menu_ = G_MENU_MODEL( gtk_builder_get_object(self.menuBuilder, "menubar-when-no-app-menu")); if (!self.use_header_bar()) { gtk_application_set_menubar(GTK_APPLICATION(self.app), self.menu()); } } self.window = new MainWindow(&self, *self.cthrd); GActionEntry app_entries[] = { makeActionEntry("quit", G_ACTION_CALLBACK(onQuit)), makeActionEntry("preferences", G_ACTION_CALLBACK(onPreferences)), makeActionEntry("help.report_bug", G_ACTION_CALLBACK(onReportBug)), makeActionEntry("help.whats_new", G_ACTION_CALLBACK(onWhatsNew)), makeActionEntry("tools.transmission", G_ACTION_CALLBACK(onToolsTransmission)), makeActionEntry("tools.shared_management", G_ACTION_CALLBACK(onToolsSharedManagement)), makeActionEntry("tools.open_chat_log", G_ACTION_CALLBACK(onOpenChatLog)), makeActionEntry("tools.open_system_log", G_ACTION_CALLBACK(onOpenSystemLog)), makeActionEntry("trans_model.changed", nullptr), makeActionEntry("trans_model.clear", G_ACTION_CALLBACK(onTransModelClear)), makeActionEntry("about", G_ACTION_CALLBACK(onAbout)), makeParamActionEntry("open-chat", G_ACTION_CALLBACK(onOpenChat), "s"), makeActionEntry("window.close", G_ACTION_CALLBACK(onWindowClose)), makeActionEntry("open_main_window", G_ACTION_CALLBACK(onOpenMainWindow)), }; g_action_map_add_action_entries(G_ACTION_MAP(self.app), app_entries, G_N_ELEMENTS(app_entries), &self); add_accelerator(self.app, "app.quit", "Q"); add_accelerator(self.app, "win.refresh", "F5"); add_accelerator(self.app, "win.detect", "D"); add_accelerator(self.app, "win.find", "F"); add_accelerator(self.app, "win.attach_file", "S"); add_accelerator(self.app, "win.attach_folder", "D"); add_accelerator(self.app, "win.request_shared_resources", "R"); add_accelerator(self.app, "app.window.close", "W"); self.onConfigChanged(); #if SYSTEM_DARWIN install_darwin_icon(); #endif } void Application::onActivate(Application& self) { if (self.started) { return; } self.started = true; try { self.cthrd->start(); } catch (const Exception& e) { pop_warning(self.window->getWindow(), "%s", e.what()); exit(1); } iptux_init(self.logSystem); g_idle_add(G_SOURCE_FUNC(Application::ProcessEvents), &self); } void Application::onQuit(void*, void*, Application& self) { if (!transModelIsFinished(self.transModel)) { if (!pop_request_quit(GTK_WINDOW(self.window->getWindow()))) { return; } } g_application_quit(G_APPLICATION(self.app)); } void Application::onPreferences(void*, void*, Application& self) { DataSettings::ResetDataEntry(&self, GTK_WIDGET(self.window->getWindow())); } void Application::onOpenMainWindow(void*, void*, Application& self) { self.getMainWindow()->Show(); } void Application::onToolsTransmission(void*, void*, Application& self) { self.openTransWindow(); } void Application::onToolsSharedManagement(void*, void*, Application& self) { if (!self.shareFile) { self.shareFile = shareFileNew(&self); } shareFileRun(self.shareFile, GTK_WINDOW(self.window->getWindow())); } void Application::onOpenChatLog(void*, void*, Application& self) { auto path = self.getCoreThread()->getLogSystem()->getChatLogPath(); iptux_open_url(path.c_str()); } void Application::onOpenSystemLog(void*, void*, Application& self) { auto path = self.getCoreThread()->getLogSystem()->getSystemLogPath(); iptux_open_url(path.c_str()); } void Application::onTransModelClear(void*, void*, Application& self) { self.getCoreThread()->clearFinishedTransTasks(); } void Application::onWindowClose(void*, void*, Application& self) { auto window = gtk_application_get_active_window(self.app); if (window) { gtk_window_close(window); } } void Application::onAbout(void*, void*, Application& self) { aboutDialogEntry(GTK_WINDOW(self.window->getWindow())); } void Application::refreshTransTasks() { auto transModels = getCoreThread()->listTransTasks(); transModelLoadFromTransFileModels(transModel, transModels); } void Application::onEvent(shared_ptr _event) { EventType type = _event->getType(); if (type == EventType::NEW_MESSAGE) { const NewMessageEvent* event = dynamic_cast(_event.get()); auto title = stringFormat(_("New Message from %s"), event->getMsgPara().getPal()->getName().c_str()); auto summary = event->getMsgPara().getSummary(); auto action = stringFormat( "app.open-chat::%s", event->getMsgPara().getPal()->GetKey().GetIpv4String().c_str()); notificationService->sendNotification( G_APPLICATION(app), "iptux-new-message", title, summary, action, G_NOTIFICATION_PRIORITY_NORMAL, nullptr); } if (type == EventType::NEW_SHARE_FILE_FROM_FRIEND) { const NewShareFileFromFriendEvent* event = dynamic_cast(_event.get()); auto title = stringFormat(_("New File from %s"), event->GetFileInfo().fileown->getName().c_str()); auto summary = event->GetFileInfo().filepath; notificationService->sendNotification( G_APPLICATION(app), "iptux-new-file", title, summary, "", G_NOTIFICATION_PRIORITY_NORMAL, nullptr); } if (type == EventType::RECV_FILE_FINISHED) { auto event = dynamic_pointer_cast(_event); auto title = _("Receiving File Finished"); auto taskStat = getCoreThread()->GetTransTaskStat(event->GetTaskId()); string summary; if (!taskStat) { summary = _("file info no longer exist"); } else { summary = taskStat->getFilename(); } notificationService->sendNotification( G_APPLICATION(app), "iptux-recv-file-finished", title, summary, "", G_NOTIFICATION_PRIORITY_NORMAL, nullptr); } if (type == EventType::CONFIG_CHANGED) { this->onConfigChanged(); } if (type == EventType::SEND_FILE_STARTED || type == EventType::RECV_FILE_STARTED) { auto event = CHECK_NOTNULL(dynamic_cast(_event.get())); auto taskId = event->GetTaskId(); auto para = cthrd->GetTransTaskStat(taskId); if (!para.get()) { LOG_WARN("got task id %d, but no info in CoreThread", taskId); return; } this->updateItemToTransTree(*para); auto g_progdt = cthrd->getProgramData(); if (g_progdt->IsAutoOpenFileTrans()) { this->openTransWindow(); } return; } if (type == EventType::SEND_FILE_FINISHED || type == EventType::RECV_FILE_FINISHED) { auto event = CHECK_NOTNULL(dynamic_cast(_event.get())); auto taskId = event->GetTaskId(); auto para = cthrd->GetTransTaskStat(taskId); this->updateItemToTransTree(*para); return; } if (type == EventType::TRANS_TASKS_CHANGED) { this->refreshTransTasks(); return; } } PPalInfo Application::getMe() { return this->getCoreThread()->getMe(); } void Application::openTransWindow() { if (transWindow == nullptr) { transWindow = trans_window_new(this, GTK_WINDOW(window->getWindow())); gtk_widget_show_all(GTK_WIDGET(transWindow)); gtk_widget_hide(GTK_WIDGET(transWindow)); g_signal_connect_swapped(transWindow, "delete-event", G_CALLBACK(onTransWindowDelete), this); } gtk_window_present(GTK_WINDOW(transWindow)); } gboolean Application::onTransWindowDelete(iptux::Application& self) { self.transWindow = nullptr; return FALSE; } void Application::onConfigChanged() { if (getCoreThread()->getProgramData()->IsEnterSendMessage()) { add_accelerator(app, "win.send_message", "Return"); } else { add_accelerator(app, "win.send_message", "Return"); } } void Application::updateItemToTransTree(const TransFileModel& para) { transModelUpdateFromTransFileModel(transModel, para); g_action_group_activate_action(G_ACTION_GROUP(this->getApp()), "trans_model.changed", nullptr); } void Application::onOpenChat(GSimpleAction*, GVariant* value, Application& self) { string ipv4 = g_variant_get_string(value, nullptr); auto pal = self.cthrd->GetPal(ipv4); if (!pal) { return; } auto groupInfo = self.cthrd->GetPalRegularItem(pal.get()); if (!groupInfo) { return; } if (groupInfo->getDialog()) { gtk_window_present(GTK_WINDOW(groupInfo->getDialog())); return; } DialogPeer::PeerDialogEntry(&self, groupInfo); } gboolean Application::ProcessEvents(gpointer data) { auto self = static_cast(data); if (self->getCoreThread()->HasEvent()) { auto start = chrono::high_resolution_clock::now(); auto e = self->getCoreThread()->PopEvent(); self->onEvent(e); self->getMainWindow()->ProcessEvent(e); auto elapsed = std::chrono::high_resolution_clock::now() - start; LOG_INFO( "type: %s, from: %s, time: %jdus", EventTypeToStr(e->getType()), e->getSource().c_str(), (intmax_t)chrono::duration_cast(elapsed).count()); g_idle_add(Application::ProcessEvents, data); } else { g_timeout_add(100, Application::ProcessEvents, data); // 100ms } return G_SOURCE_REMOVE; } } // namespace iptux iptux-0.9.4/src/iptux/Application.h000066400000000000000000000062221475473122500172650ustar00rootroot00000000000000#ifndef IPTUX_APPLICATION_H #define IPTUX_APPLICATION_H #include #include #include "iptux-core/Event.h" #include "iptux-core/IptuxConfig.h" #include "iptux-core/Models.h" #include "iptux/NotificationService.h" #include "iptux/UiModels.h" namespace iptux { class MainWindow; class UiCoreThread; class IptuxAppIndicator; typedef GtkWindow TransWindow; typedef GtkDialog ShareFile; class Application { public: explicit Application(std::shared_ptr config); ~Application(); int run(int argc, char** argv); void openTransWindow(); GtkApplication* getApp() { return app; } std::shared_ptr getConfig() { return config; } TransModel* getTransModel() { return transModel; } MainWindow* getMainWindow() { return window; } GtkBuilder* getMenuBuilder() { return menuBuilder; } LogSystem* getLogSystem() { return logSystem; } std::shared_ptr getProgramData() { return data; } std::shared_ptr getCoreThread() { return cthrd; } bool use_header_bar() { return use_header_bar_; } void refreshTransTasks(); PPalInfo getMe(); GMenuModel* menu() { return menu_; } GtkWidget* getPreferenceDialog() { return preference_dialog_; } void setPreferenceDialog(GtkWidget* dialog) { preference_dialog_ = dialog; } private: std::shared_ptr config; std::shared_ptr data; std::shared_ptr cthrd; std::shared_ptr app_indicator; bool enable_app_indicator_ = true; GtkApplication* app; GtkBuilder* menuBuilder; TransModel* transModel; MainWindow* window = 0; ShareFile* shareFile = 0; TransWindow* transWindow = 0; LogSystem* logSystem = 0; NotificationService* notificationService = 0; GMenuModel* menu_ = 0; GtkWidget* preference_dialog_ = 0; bool use_header_bar_ = false; bool started{false}; public: // for test void startup(); void activate(); void set_enable_app_indicator(bool enable) { enable_app_indicator_ = enable; } void _ForTestProcessEvents() { ProcessEvents(this); } private: void onEvent(std::shared_ptr event); void onConfigChanged(); void updateItemToTransTree(const TransFileModel& para); static gboolean ProcessEvents(gpointer data); static void onAbout(void*, void*, Application& self); static void onActivate(Application& self); static void onOpenMainWindow(void*, void*, Application& self); static void onPreferences(void*, void*, Application& self); static void onQuit(void*, void*, Application& self); static void onStartup(Application& self); static void onToolsSharedManagement(void*, void*, Application& self); static void onToolsTransmission(void*, void*, Application& self); static void onOpenChatLog(void*, void*, Application& self); static void onOpenSystemLog(void*, void*, Application& self); static void onTransModelClear(void*, void*, Application& self); static void onOpenChat(GSimpleAction* action, GVariant* value, Application& self); static void onWindowClose(void*, void*, Application& self); static gboolean onTransWindowDelete(Application& self); }; } // namespace iptux #endif iptux-0.9.4/src/iptux/ApplicationTest.cpp000066400000000000000000000014251475473122500204600ustar00rootroot00000000000000#include "UiHelper.h" #include "gtest/gtest.h" #include "iptux/Application.h" #include "iptux/TestHelper.h" #include "iptux/UiCoreThread.h" using namespace std; using namespace iptux; void do_action(Application* app, const string& name) { GActionMap* m = G_ACTION_MAP(app->getApp()); g_action_activate(g_action_map_lookup_action(m, name.c_str()), NULL); } TEST(Application, Constructor) { _ForTestToggleOpenUrl(false); Application* app = CreateApplication(); do_action(app, "help.whats_new"); do_action(app, "tools.open_chat_log"); do_action(app, "tools.open_system_log"); PPalInfo pal = make_shared("127.0.0.1", 2425); app->getCoreThread()->AttachPalToList(pal); app->_ForTestProcessEvents(); app->_ForTestProcessEvents(); DestroyApplication(app); } iptux-0.9.4/src/iptux/Darwin.cpp000066400000000000000000000011561475473122500166020ustar00rootroot00000000000000#include "Darwin.h" #include #include using namespace std; namespace iptux { void install_darwin_icon() { auto app = gtkosx_application_get(); auto theme = gtk_icon_theme_get_default(); GError* error = nullptr; auto pixbuf = gtk_icon_theme_load_icon(theme, "iptux-icon", 64, GtkIconLookupFlags(0), &error); if (!pixbuf) { g_warning(_("Couldn’t load icon: %s"), error->message); g_error_free(error); return; } gtkosx_application_set_dock_icon_pixbuf(app, pixbuf); g_object_unref(pixbuf); } } // namespace iptux iptux-0.9.4/src/iptux/Darwin.h000066400000000000000000000001471475473122500162460ustar00rootroot00000000000000#ifndef IPTUX_DARWIN_H #define IPTUX_DARWIN_H namespace iptux { void install_darwin_icon(); } #endif iptux-0.9.4/src/iptux/DataSettings.cpp000066400000000000000000001420231475473122500177470ustar00rootroot00000000000000// // C++ Implementation: DataSettings // // Description: // // // Author: Jally , (C) 2008 // // Copyright: See COPYING file that comes with this distribution // // #include "config.h" #include "DataSettings.h" #include #include #include #include "iptux-core/Const.h" #include "iptux-utils/output.h" #include "iptux-utils/utils.h" #include "iptux/UiCoreThread.h" #include "iptux/UiHelper.h" #include "iptux/callback.h" using namespace std; namespace iptux { /** * 类构造函数. */ DataSettings::DataSettings(Application* app, GtkWidget* parent) : app(app), widset(NULL), mdlset(NULL) { InitSublayer(); dialog_ = GTK_DIALOG(CreateMainDialog(parent)); g_object_ref_sink(G_OBJECT(dialog_)); /* 创建相关数据设置标签 */ GtkWidget* note = gtk_notebook_new(); gtk_notebook_set_tab_pos(GTK_NOTEBOOK(note), GTK_POS_TOP); gtk_notebook_set_scrollable(GTK_NOTEBOOK(note), TRUE); gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(dialog_)), note, TRUE, TRUE, 0); GtkWidget* label = gtk_label_new(_("Personal")); gtk_notebook_append_page(GTK_NOTEBOOK(note), CreatePersonal(), label); label = gtk_label_new(_("System")); gtk_notebook_append_page(GTK_NOTEBOOK(note), CreateSystem(), label); label = gtk_label_new(_("Network")); gtk_notebook_append_page(GTK_NOTEBOOK(note), CreateNetwork(), label); /* 设置相关数据默认值 */ SetPersonalValue(); SetSystemValue(); } /** * 类析构函数. */ DataSettings::~DataSettings() { gtk_widget_destroy(GTK_WIDGET(dialog_)); ClearSublayer(); } /** * 程序数据设置入口. * @param parent 父窗口指针 */ void DataSettings::ResetDataEntry(Application* app, GtkWidget* parent) { if (app->getPreferenceDialog()) { gtk_window_present(GTK_WINDOW(app->getPreferenceDialog())); return; } DataSettings dset(app, parent); GtkWidget* dialog = GTK_WIDGET(dset.dialog()); app->setPreferenceDialog(dialog); /* 运行对话框 */ gtk_widget_show_all(dialog); bool done = false; while (!done) { switch (gtk_dialog_run(GTK_DIALOG(dialog))) { case GTK_RESPONSE_OK: if (dset.Save()) { if (app->getProgramData()->need_restart()) { pop_warning(dialog, _("The program needs to be restarted to take effect!")); } done = true; } break; case GTK_RESPONSE_APPLY: if (dset.Save()) { if (app->getProgramData()->need_restart()) { pop_warning(dialog, _("The program needs to be restarted to take effect!")); } } break; default: done = true; break; } } app->setPreferenceDialog(NULL); } /** * 初始化底层数据. */ void DataSettings::InitSublayer() { g_datalist_init(&widset); g_datalist_init(&mdlset); iconModel = iconModelNew(); FillIconModel(GTK_TREE_MODEL(iconModel)); auto model = CreateNetworkModel(); g_datalist_set_data_full(&mdlset, "network-model", model, GDestroyNotify(g_object_unref)); FillNetworkModel(model); } /** * 清空底层数据. */ void DataSettings::ClearSublayer() { g_datalist_clear(&widset); g_datalist_clear(&mdlset); g_object_unref(iconModel); } /** * 创建主对话框. * @param parent 父窗口指针 * @return 对话框 */ GtkWidget* DataSettings::CreateMainDialog(GtkWidget* parent) { GtkWidget* dialog; dialog = gtk_dialog_new_with_buttons( _("Preferences"), GTK_WINDOW(parent), GTK_DIALOG_MODAL, _("_OK"), GTK_RESPONSE_OK, _("_Apply"), GTK_RESPONSE_APPLY, _("_Cancel"), GTK_RESPONSE_CANCEL, NULL); gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK); gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); gtk_container_set_border_width(GTK_CONTAINER(dialog), 5); gtk_widget_set_size_request(dialog, 520, -1); g_datalist_set_data(&widset, "dialog-widget", dialog); return dialog; } /** * 创建与个人相关的数据设置窗体. * @return 主窗体 */ GtkWidget* DataSettings::CreatePersonal() { GtkWidget *box, *hbox; GtkWidget *frame, *sw; GtkWidget *label, *button, *widget; GtkTreeModel* model; box = gtk_grid_new(); g_object_set(box, "margin", 10, "column-spacing", 10, "row-spacing", 10, NULL); /* 昵称 */ label = gtk_label_new_with_mnemonic(_("Your _nickname:")); gtk_widget_set_halign(label, GTK_ALIGN_END); gtk_grid_attach(GTK_GRID(box), label, 0, 0, 1, 1); widget = gtk_entry_new(); g_object_set(widget, "has-tooltip", TRUE, "hexpand", TRUE, NULL); g_signal_connect(widget, "query-tooltip", G_CALLBACK(entry_query_tooltip), _("Please input your nickname!")); g_datalist_set_data(&widset, "nickname-entry-widget", widget); gtk_label_set_mnemonic_widget(GTK_LABEL(label), widget); gtk_grid_attach(GTK_GRID(box), widget, 1, 0, 1, 1); /* 群组 */ label = gtk_label_new_with_mnemonic(_("Your _group name:")); gtk_widget_set_halign(label, GTK_ALIGN_END); gtk_grid_attach(GTK_GRID(box), label, 0, 1, 1, 1); widget = gtk_entry_new(); g_object_set(widget, "has-tooltip", TRUE, NULL); g_signal_connect(widget, "query-tooltip", G_CALLBACK(entry_query_tooltip), _("Please input your group name!")); g_datalist_set_data(&widset, "mygroup-entry-widget", widget); gtk_label_set_mnemonic_widget(GTK_LABEL(label), widget); gtk_grid_attach(GTK_GRID(box), widget, 1, 1, 1, 1); /* 头像 */ label = gtk_label_new_with_mnemonic(_("Your _face picture:")); gtk_widget_set_halign(label, GTK_ALIGN_END); gtk_grid_attach(GTK_GRID(box), label, 0, 2, 1, 1); hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5); model = GTK_TREE_MODEL(iconModel); widget = CreateIconTree(model); g_datalist_set_data(&widset, "myicon-combo-widget", widget); gtk_label_set_mnemonic_widget(GTK_LABEL(label), widget); gtk_box_pack_start(GTK_BOX(hbox), widget, TRUE, TRUE, 0); button = gtk_button_new_with_label("..."); g_object_set_data(G_OBJECT(button), "icon-combo-widget", widget); g_signal_connect(button, "clicked", G_CALLBACK(AddNewIcon), &widset); gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); gtk_grid_attach(GTK_GRID(box), hbox, 1, 2, 1, 1); /* 文件存档 */ label = gtk_label_new_with_mnemonic(_("_Save files to: ")); gtk_widget_set_halign(label, GTK_ALIGN_END); gtk_grid_attach(GTK_GRID(box), label, 0, 3, 1, 1); widget = CreateArchiveChooser(); gtk_label_set_mnemonic_widget(GTK_LABEL(label), widget); g_datalist_set_data(&widset, "archive-chooser-widget", widget); gtk_grid_attach(GTK_GRID(box), widget, 1, 3, 1, 1); hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_grid_attach(GTK_GRID(box), hbox, 0, 4, 2, 1); /* 个人形象照片 */ NO_OPERATION_C frame = gtk_frame_new(_("Photo")); gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_ETCHED_IN); gtk_box_pack_start(GTK_BOX(hbox), frame, FALSE, FALSE, 0); button = gtk_button_new(); gtk_widget_set_size_request(button, MAX_PREVIEWSIZE, MAX_PREVIEWSIZE); gtk_container_add(GTK_CONTAINER(frame), button); g_signal_connect_swapped(button, "clicked", G_CALLBACK(ChoosePhoto), &widset); widget = gtk_image_new(); gtk_container_add(GTK_CONTAINER(button), widget); g_datalist_set_data(&widset, "photo-image-widget", widget); /* 个性签名 */ NO_OPERATION_C frame = gtk_frame_new(_("Signature")); gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_ETCHED_IN); gtk_box_pack_end(GTK_BOX(hbox), frame, TRUE, TRUE, 0); sw = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_ETCHED_IN); gtk_container_add(GTK_CONTAINER(frame), sw); widget = gtk_text_view_new(); gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(widget), GTK_WRAP_WORD_CHAR); gtk_container_add(GTK_CONTAINER(sw), widget); g_datalist_set_data(&widset, "sign-textview-widget", widget); return box; } /** * 创建与系统相关的数据设置窗体. * @return 主窗体 */ GtkWidget* DataSettings::CreateSystem() { GtkGrid* box; GtkWidget* hbox; GtkWidget *label, *button, *widget; GtkTreeModel* model; box = GTK_GRID(gtk_grid_new()); g_object_set(box, "margin", 10, "column-spacing", 10, "row-spacing", 5, NULL); int row = 0; /* port */ label = gtk_label_new(_("Port:")); gtk_widget_set_halign(label, GTK_ALIGN_END); gtk_grid_attach(box, label, 0, row, 1, 1); widget = gtk_entry_new(); g_object_set(widget, "has-tooltip", TRUE, "hexpand", TRUE, "input-purpose", GTK_INPUT_PURPOSE_DIGITS, "max-length", 5, "tooltip-text", _("Any port number between 1024 and 65535, default is 2425"), NULL); g_datalist_set_data(&widset, "port-entry-widget", widget); gtk_grid_attach(GTK_GRID(box), widget, 1, row, 1, 1); gtk_label_set_mnemonic_widget(GTK_LABEL(label), widget); row++; /* 候选编码 */ label = gtk_label_new(_("Candidate network encodings:")); gtk_widget_set_halign(label, GTK_ALIGN_END); gtk_grid_attach(GTK_GRID(box), label, 0, row, 1, 1); widget = gtk_entry_new(); g_object_set(widget, "has-tooltip", TRUE, "hexpand", TRUE, NULL); g_signal_connect(widget, "query-tooltip", G_CALLBACK(entry_query_tooltip), _("Candidate network encodings, separated by \",\"")); g_datalist_set_data(&widset, "codeset-entry-widget", widget); gtk_grid_attach(GTK_GRID(box), widget, 1, row, 1, 1); row++; /* 首选编码 */ label = gtk_label_new(_("Preferred network encoding:")); gtk_widget_set_halign(label, GTK_ALIGN_END); gtk_grid_attach(GTK_GRID(box), label, 0, row, 1, 1); widget = gtk_entry_new(); g_object_set(widget, "has-tooltip", TRUE, NULL); g_signal_connect(widget, "query-tooltip", G_CALLBACK(entry_query_tooltip), _("Preference network coding (You should be aware of " "what you are doing if you want to modify it.)")); g_datalist_set_data(&widset, "encode-entry-widget", widget); gtk_grid_attach(GTK_GRID(box), widget, 1, row, 1, 1); row++; /* 好友头像 */ label = gtk_label_new(_("Pal's default face picture:")); gtk_widget_set_halign(label, GTK_ALIGN_END); gtk_grid_attach(GTK_GRID(box), label, 0, row, 1, 1); hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); model = GTK_TREE_MODEL(this->iconModel); widget = CreateIconTree(model); gtk_box_pack_start(GTK_BOX(hbox), widget, TRUE, TRUE, 0); g_datalist_set_data(&widset, "palicon-combo-widget", widget); button = gtk_button_new_with_label("..."); g_object_set_data(G_OBJECT(button), "icon-combo-widget", widget); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); g_signal_connect(button, "clicked", G_CALLBACK(AddNewIcon), &widset); gtk_grid_attach(GTK_GRID(box), hbox, 1, row, 1, 1); row++; /* 面板字体 */ label = gtk_label_new(_("Panel font:")); gtk_widget_set_halign(label, GTK_ALIGN_END); gtk_grid_attach(GTK_GRID(box), label, 0, row, 1, 1); widget = CreateFontChooser(); g_datalist_set_data(&widset, "font-chooser-widget", widget); gtk_grid_attach(GTK_GRID(box), widget, 1, row, 1, 1); row++; /* 有消息时直接弹出聊天窗口 */ widget = gtk_check_button_new_with_label(_("Automatically open the chat dialog")); gtk_grid_attach(GTK_GRID(box), widget, 0, row, 2, 1); g_datalist_set_data(&widset, "chat-check-widget", widget); row++; /* 隐藏面板,只显示状态图标 */ widget = gtk_check_button_new_with_label( _("Automatically hide the panel after login")); gtk_grid_attach(GTK_GRID(box), widget, 0, row, 2, 1); g_datalist_set_data(&widset, "statusicon-check-widget", widget); row++; /* 打开文件传输管理器 */ widget = gtk_check_button_new_with_label( _("Automatically open the File Transmission Management")); gtk_grid_attach(GTK_GRID(box), widget, 0, row, 2, 1); g_datalist_set_data(&widset, "transmission-check-widget", widget); row++; /* enter键发送消息 */ widget = gtk_check_button_new_with_label(_("Use the 'Enter' key to send message")); gtk_grid_attach(GTK_GRID(box), widget, 0, row, 2, 1); g_datalist_set_data(&widset, "enterkey-check-widget", widget); row++; /* 清空聊天历史记录 */ widget = gtk_check_button_new_with_label( _("Automatically clean up the chat history")); gtk_grid_attach(GTK_GRID(box), widget, 0, row, 2, 1); g_datalist_set_data(&widset, "history-check-widget", widget); row++; /* 记录日志 */ widget = gtk_check_button_new_with_label(_("Save the chat history")); gtk_grid_attach(GTK_GRID(box), widget, 0, row, 2, 1); g_datalist_set_data(&widset, "log-check-widget", widget); row++; /* 黑名单 */ widget = gtk_check_button_new_with_label(_("Use the Blacklist (NOT recommended)")); gtk_grid_attach(GTK_GRID(box), widget, 0, row, 2, 1); g_datalist_set_data(&widset, "blacklist-check-widget", widget); row++; /* 过滤共享文件请求 */ widget = gtk_check_button_new_with_label(_("Filter the request of sharing files")); gtk_grid_attach(GTK_GRID(box), widget, 0, row, 2, 1); g_datalist_set_data(&widset, "shared-check-widget", widget); #if HAVE_APPINDICATOR row++; widget = gtk_check_button_new_with_label( _("Hide the taskbar when the main window is minimized")); gtk_grid_attach(GTK_GRID(box), widget, 0, row, 2, 1); g_datalist_set_data(&widset, "taskbar-check-widget", widget); #endif return GTK_WIDGET(box); } /** * 创建与网络相关的数据设置窗体. * @return 主窗体 */ GtkWidget* DataSettings::CreateNetwork() { char buf[MAX_BUFLEN]; GtkWidget *box, *hbox, *vbox; GtkWidget *frame, *sw; GtkWidget *label, *button, *widget; GtkTreeModel* model; box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); g_object_set(box, "margin", 10, NULL); /* 接受输入 */ hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 0); label = gtk_label_new(_("From:")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); widget = gtk_entry_new(); g_object_set(widget, "has-tooltip", TRUE, NULL); gtk_box_pack_start(GTK_BOX(hbox), widget, TRUE, TRUE, 0); g_signal_connect(widget, "query-tooltip", G_CALLBACK(entry_query_tooltip), _("Beginning of the IP(v4) section")); g_signal_connect(widget, "insert-text", G_CALLBACK(entry_insert_numeric), NULL); g_datalist_set_data(&widset, "startip-entry-widget", widget); label = gtk_label_new(_("To:")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); widget = gtk_entry_new(); g_object_set(widget, "has-tooltip", TRUE, NULL); gtk_box_pack_start(GTK_BOX(hbox), widget, TRUE, TRUE, 0); g_signal_connect(widget, "query-tooltip", G_CALLBACK(entry_query_tooltip), _("End of the IP(v4) section")); g_signal_connect(widget, "insert-text", G_CALLBACK(entry_insert_numeric), NULL); g_datalist_set_data(&widset, "endip-entry-widget", widget); /* 增加&删除按钮 */ hbox = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL); gtk_button_box_set_layout(GTK_BUTTON_BOX(hbox), GTK_BUTTONBOX_SPREAD); gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 0); snprintf(buf, MAX_BUFLEN, "%s↓↓", _("Add")); button = gtk_button_new_with_label(buf); gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); g_signal_connect_swapped(button, "clicked", G_CALLBACK(ClickAddIpseg), &widset); snprintf(buf, MAX_BUFLEN, "%s↑↑", _("Delete")); button = gtk_button_new_with_label(buf); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); g_signal_connect_swapped(button, "clicked", G_CALLBACK(ClickDelIpseg), &widset); /* 网段树&实用性按钮 */ NO_OPERATION_C frame = gtk_frame_new(_("Added IP(v4) Section:")); gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_ETCHED_IN); gtk_box_pack_start(GTK_BOX(box), frame, TRUE, TRUE, 5); hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_container_add(GTK_CONTAINER(frame), hbox); /*/* 网段树 */ sw = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_ETCHED_IN); gtk_box_pack_start(GTK_BOX(hbox), sw, TRUE, TRUE, 0); model = GTK_TREE_MODEL(g_datalist_get_data(&mdlset, "network-model")); widget = CreateNetworkTree(model); gtk_container_add(GTK_CONTAINER(sw), widget); g_datalist_set_data(&widset, "network-treeview-widget", widget); /*/* 实用性按钮 */ vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0); button = gtk_button_new_with_label(_("Import")); gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0); g_signal_connect_swapped(button, "clicked", G_CALLBACK(ImportNetSegment), this); button = gtk_button_new_with_label(_("Export")); gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0); g_signal_connect_swapped(button, "clicked", G_CALLBACK(ExportNetSegment), this); button = gtk_button_new_with_label(_("Clear")); gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0); g_signal_connect_swapped(button, "clicked", G_CALLBACK(ClearNetSegment), &mdlset); return box; } GtkWidget* DataSettings::GetWidget(const char* name) { return GTK_WIDGET(g_datalist_get_data(&widset, name)); } /** * 为界面设置与个人相关的数据 */ void DataSettings::SetPersonalValue() { char path[MAX_PATHLEN]; GtkWidget* widget; GtkTreeModel* model; GtkTextBuffer* buffer; GdkPixbuf* pixbuf; gint active; auto g_cthrd = app->getCoreThread(); auto g_progdt = g_cthrd->getProgramData(); widget = GTK_WIDGET(g_datalist_get_data(&widset, "nickname-entry-widget")); gtk_entry_set_text(GTK_ENTRY(widget), g_progdt->nickname.c_str()); widget = GTK_WIDGET(g_datalist_get_data(&widset, "mygroup-entry-widget")); gtk_entry_set_text(GTK_ENTRY(widget), g_progdt->mygroup.c_str()); widget = GTK_WIDGET(g_datalist_get_data(&widset, "myicon-combo-widget")); model = gtk_combo_box_get_model(GTK_COMBO_BOX(widget)); active = IconfileGetItemPos(model, g_progdt->myicon.c_str()); gtk_combo_box_set_active(GTK_COMBO_BOX(widget), active); widget = GTK_WIDGET(g_datalist_get_data(&widset, "archive-chooser-widget")); gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(widget), g_progdt->path.c_str()); widget = GTK_WIDGET(g_datalist_get_data(&widset, "photo-image-widget")); snprintf(path, MAX_PATHLEN, "%s" PHOTO_PATH "/photo", g_get_user_config_dir()); if ((pixbuf = gdk_pixbuf_new_from_file_at_size(path, MAX_PREVIEWSIZE, MAX_PREVIEWSIZE, NULL))) { gtk_image_set_from_pixbuf(GTK_IMAGE(widget), pixbuf); g_object_unref(pixbuf); } widget = GTK_WIDGET(g_datalist_get_data(&widset, "sign-textview-widget")); buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(widget)); gtk_text_buffer_set_text(buffer, g_progdt->sign.c_str(), -1); } /** * 为界面设置与系统相关的数据 */ void DataSettings::SetSystemValue() { GtkWidget* widget; GtkTreeModel* model; gint active; auto g_cthrd = app->getCoreThread(); auto g_progdt = g_cthrd->getProgramData(); widget = GTK_WIDGET(g_datalist_get_data(&widset, "port-entry-widget")); gtk_entry_set_text(GTK_ENTRY(widget), stringFormat("%d", g_progdt->port()).c_str()); widget = GTK_WIDGET(g_datalist_get_data(&widset, "codeset-entry-widget")); gtk_entry_set_text(GTK_ENTRY(widget), g_progdt->codeset.c_str()); widget = GTK_WIDGET(g_datalist_get_data(&widset, "encode-entry-widget")); gtk_entry_set_text(GTK_ENTRY(widget), g_progdt->encode.c_str()); widget = GTK_WIDGET(g_datalist_get_data(&widset, "palicon-combo-widget")); model = gtk_combo_box_get_model(GTK_COMBO_BOX(widget)); active = IconfileGetItemPos(model, g_progdt->palicon); gtk_combo_box_set_active(GTK_COMBO_BOX(widget), active); widget = GTK_WIDGET(g_datalist_get_data(&widset, "font-chooser-widget")); gtk_font_chooser_set_font(GTK_FONT_CHOOSER(widget), g_progdt->font); widget = GTK_WIDGET(g_datalist_get_data(&widset, "chat-check-widget")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), g_progdt->IsAutoOpenChatDialog()); widget = GTK_WIDGET(g_datalist_get_data(&widset, "statusicon-check-widget")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), g_progdt->IsAutoHidePanelAfterLogin()); widget = GTK_WIDGET(g_datalist_get_data(&widset, "transmission-check-widget")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), g_progdt->IsAutoOpenFileTrans()); widget = GTK_WIDGET(g_datalist_get_data(&widset, "enterkey-check-widget")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), g_progdt->IsEnterSendMessage()); widget = GTK_WIDGET(g_datalist_get_data(&widset, "history-check-widget")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), g_progdt->IsAutoCleanChatHistory()); widget = GTK_WIDGET(g_datalist_get_data(&widset, "log-check-widget")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), g_progdt->IsSaveChatHistory()); widget = GTK_WIDGET(g_datalist_get_data(&widset, "blacklist-check-widget")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), g_progdt->IsUsingBlacklist()); widget = GTK_WIDGET(g_datalist_get_data(&widset, "shared-check-widget")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), g_progdt->IsFilterFileShareRequest()); #if HAVE_APPINDICATOR widget = GTK_WIDGET(g_datalist_get_data(&widset, "taskbar-check-widget")); gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(widget), g_progdt->isHideTaskbarWhenMainWindowIconified()); #endif } /** * 网络树(network-tree)底层数据结构. * 3,0 startip,1 endip,2 description \n * 起始IP;终止IP;描述 \n * @return network-model */ GtkTreeModel* DataSettings::CreateNetworkModel() { GtkListStore* model; model = gtk_list_store_new(3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING); gtk_tree_sortable_set_default_sort_func( GTK_TREE_SORTABLE(model), GtkTreeIterCompareFunc(NetworkTreeCompareFunc), NULL, NULL); gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(model), GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, GTK_SORT_ASCENDING); return GTK_TREE_MODEL(model); } /** * 为头像树(icon-tree)填充底层数据. * @param model icon-model */ void DataSettings::FillIconModel(GtkTreeModel* model) { GtkIconTheme* theme; GdkPixbuf* pixbuf; GtkTreeIter iter; struct dirent* dirt; DIR* dir; char* file; theme = gtk_icon_theme_get_default(); if ((dir = opendir(__PIXMAPS_PATH "/icon"))) { while ((dirt = readdir(dir))) { if (strcmp(dirt->d_name, ".") == 0 || strcmp(dirt->d_name, "..") == 0) continue; file = iptux_erase_filename_suffix(dirt->d_name); if ((pixbuf = gtk_icon_theme_load_icon(theme, file, MAX_ICONSIZE, GtkIconLookupFlags(0), NULL))) { gtk_list_store_append(GTK_LIST_STORE(model), &iter); gtk_list_store_set(GTK_LIST_STORE(model), &iter, 0, pixbuf, 1, dirt->d_name, -1); g_object_unref(pixbuf); } g_free(file); } closedir(dir); } } /** * 为网络树(network-tree)填充底层数据. * @param model network-model * @note 与修改此链表的代码段是串行关系,无需加锁 */ void DataSettings::FillNetworkModel(GtkTreeModel* model) { auto g_cthrd = app->getCoreThread(); auto g_progdt = g_cthrd->getProgramData(); for (const NetSegment& pns : g_progdt->getNetSegments()) { GtkTreeIter iter; gtk_list_store_append(GTK_LIST_STORE(model), &iter); gtk_list_store_set(GTK_LIST_STORE(model), &iter, 0, pns.startip.c_str(), 1, pns.endip.c_str(), 2, pns.description.c_str(), -1); } } /** * 创建头像树(icon-tree). * @param model icon-model * @return 头像树 */ GtkWidget* DataSettings::CreateIconTree(GtkTreeModel* model) { GtkWidget* combo; GtkCellRenderer* cell; combo = gtk_combo_box_new_with_model(model); gtk_combo_box_set_wrap_width(GTK_COMBO_BOX(combo), 5); cell = gtk_cell_renderer_pixbuf_new(); gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo), cell, FALSE); gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo), cell, "pixbuf", 0, NULL); return combo; } /** * 创建网络树(network-tree). * @param model network-model * @return 网络树 */ GtkWidget* DataSettings::CreateNetworkTree(GtkTreeModel* model) { GtkWidget* view; GtkCellRenderer* cell; GtkTreeViewColumn* column; GtkTreeSelection* selection; view = gtk_tree_view_new_with_model(model); gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(view), TRUE); gtk_tree_view_set_rubber_banding(GTK_TREE_VIEW(view), TRUE); selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view)); gtk_tree_selection_set_mode(selection, GTK_SELECTION_MULTIPLE); cell = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes(_("From"), cell, "text", 0, NULL); gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_append_column(GTK_TREE_VIEW(view), column); cell = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes(_("To"), cell, "text", 1, NULL); gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_append_column(GTK_TREE_VIEW(view), column); cell = gtk_cell_renderer_text_new(); g_object_set(cell, "editable", TRUE, NULL); g_object_set_data(G_OBJECT(cell), "column-number", GINT_TO_POINTER(2)); column = gtk_tree_view_column_new_with_attributes(_("Description"), cell, "text", 2, NULL); gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_append_column(GTK_TREE_VIEW(view), column); g_signal_connect(cell, "edited", G_CALLBACK(CellEditText), model); return view; } /** * 创建文件归档选择器. * @return 选择器 */ GtkWidget* DataSettings::CreateArchiveChooser() { GtkWidget* chooser; chooser = gtk_file_chooser_button_new(_("Please select download folder"), GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER); gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(chooser), FALSE); gtk_file_chooser_set_show_hidden(GTK_FILE_CHOOSER(chooser), FALSE); gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(chooser), TRUE); return chooser; } /** * 创建字体选择器. * @return 选择器 */ GtkWidget* DataSettings::CreateFontChooser() { GtkWidget* chooser; chooser = gtk_font_button_new(); gtk_font_button_set_show_style(GTK_FONT_BUTTON(chooser), TRUE); gtk_font_button_set_show_size(GTK_FONT_BUTTON(chooser), TRUE); gtk_font_button_set_use_font(GTK_FONT_BUTTON(chooser), TRUE); gtk_font_button_set_use_size(GTK_FONT_BUTTON(chooser), TRUE); gtk_font_button_set_title(GTK_FONT_BUTTON(chooser), _("Select Font")); return chooser; } string DataSettings::Check() { return ObtainSystemValue(true); } bool DataSettings::Save() { string err_info = Check(); if (!err_info.empty()) { pop_warning(GTK_WIDGET(dialog_), "%s", err_info.c_str()); return false; } ObtainPersonalValue(); ObtainSystemValue(); ObtainNetworkValue(); app->getProgramData()->WriteProgData(); app->getCoreThread()->UpdateMyInfo(); return true; } /** * 获取与个人相关的数据. */ void DataSettings::ObtainPersonalValue() { GtkWidget* widget; GdkPixbuf* pixbuf; GtkTextBuffer* buffer; GtkTextIter start, end; GtkTreeModel* model; GtkTreeIter iter; char path[MAX_PATHLEN], *file; const gchar* text; gint active; auto g_cthrd = app->getCoreThread(); auto g_progdt = g_cthrd->getProgramData(); widget = GTK_WIDGET(g_datalist_get_data(&widset, "nickname-entry-widget")); if (*(text = gtk_entry_get_text(GTK_ENTRY(widget))) != '\0') { g_progdt->nickname = text; } widget = GTK_WIDGET(g_datalist_get_data(&widset, "mygroup-entry-widget")); if (*(text = gtk_entry_get_text(GTK_ENTRY(widget))) != '\0') { g_progdt->mygroup = text; } else { g_progdt->mygroup = ""; } widget = GTK_WIDGET(g_datalist_get_data(&widset, "myicon-combo-widget")); model = gtk_combo_box_get_model(GTK_COMBO_BOX(widget)); active = gtk_combo_box_get_active(GTK_COMBO_BOX(widget)); if (active != -1) { snprintf(path, MAX_PATHLEN, "%d", active); gtk_tree_model_get_iter_from_string(model, &iter, path); gtk_tree_model_get(model, &iter, 1, &file, -1); if (file) { if (strcmp(g_progdt->myicon.c_str(), file) != 0) { snprintf(path, MAX_PATHLEN, __PIXMAPS_PATH "/icon/%s", file); if (access(path, F_OK) != 0) { g_progdt->myicon = "my-icon"; snprintf(path, MAX_PATHLEN, "%s" ICON_PATH "/my-icon", g_get_user_config_dir()); gtk_tree_model_get(model, &iter, 0, &pixbuf, -1); gdk_pixbuf_save(pixbuf, path, "png", NULL, NULL); gtk_icon_theme_add_builtin_icon(g_progdt->myicon.c_str(), MAX_ICONSIZE, pixbuf); g_object_unref(pixbuf); } else { g_progdt->myicon = file; } } g_free(file); } } widget = GTK_WIDGET(g_datalist_get_data(&widset, "archive-chooser-widget")); g_progdt->path = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(widget)); widget = GTK_WIDGET(g_datalist_get_data(&widset, "sign-textview-widget")); buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(widget)); gtk_text_buffer_get_bounds(buffer, &start, &end); g_progdt->sign = gtk_text_buffer_get_text(buffer, &start, &end, FALSE); } /** * 获取与系统相关的数据. */ string DataSettings::ObtainSystemValue(bool dryrun) { GtkWidget* widget; GdkPixbuf* pixbuf; GtkTreeModel* model; GtkTreeIter iter; char path[MAX_PATHLEN], *file; gchar* text; gint active; auto g_cthrd = app->getCoreThread(); auto progdt = g_cthrd->getProgramData(); ostringstream oss; widget = GTK_WIDGET(g_datalist_get_data(&widset, "port-entry-widget")); text = gtk_editable_get_chars(GTK_EDITABLE(widget), 0, -1); int port; bool port_valid = false; try { port = stoi(text); port_valid = true; } catch (const invalid_argument& e) { oss << _("Port must be a number between 1024 and 65535") << endl; } catch (const out_of_range& e) { oss << _("Port must be a number between 1024 and 65535") << endl; } if (port_valid && (port < 1024 || port > 65535)) { oss << _("Port must be a number between 1024 and 65535") << endl; port_valid = false; } if (port_valid && port != progdt->port()) { if (!dryrun) { progdt->set_port(port); } } // only port need to check if (dryrun) { return oss.str(); } widget = GTK_WIDGET(g_datalist_get_data(&widset, "codeset-entry-widget")); text = gtk_editable_get_chars(GTK_EDITABLE(widget), 0, -1); g_strstrip(text); if (*text != '\0') { progdt->codeset = text; } else g_free(text); widget = GTK_WIDGET(g_datalist_get_data(&widset, "encode-entry-widget")); text = gtk_editable_get_chars(GTK_EDITABLE(widget), 0, -1); g_strstrip(text); if (*text != '\0') { progdt->encode = text; } else g_free(text); widget = GTK_WIDGET(g_datalist_get_data(&widset, "palicon-combo-widget")); model = gtk_combo_box_get_model(GTK_COMBO_BOX(widget)); active = gtk_combo_box_get_active(GTK_COMBO_BOX(widget)); if (active != -1) { snprintf(path, MAX_PATHLEN, "%d", active); gtk_tree_model_get_iter_from_string(model, &iter, path); gtk_tree_model_get(model, &iter, 1, &file, -1); if (strcmp(progdt->palicon, file) != 0) { snprintf(path, MAX_PATHLEN, __PIXMAPS_PATH "/icon/%s", file); if (access(path, F_OK) != 0) { g_free(file); g_free(progdt->palicon); progdt->palicon = g_strdup("pal-icon"); snprintf(path, MAX_PATHLEN, "%s" ICON_PATH "/pal-icon", g_get_user_config_dir()); gtk_tree_model_get(model, &iter, 0, &pixbuf, -1); gdk_pixbuf_save(pixbuf, path, "png", NULL, NULL); gtk_icon_theme_add_builtin_icon(progdt->palicon, MAX_ICONSIZE, pixbuf); g_object_unref(pixbuf); } else { g_free(progdt->palicon); progdt->palicon = file; } } else g_free(file); } widget = GTK_WIDGET(g_datalist_get_data(&widset, "font-chooser-widget")); g_free(progdt->font); progdt->font = g_strdup(gtk_font_chooser_get_font(GTK_FONT_CHOOSER(widget))); widget = GTK_WIDGET(g_datalist_get_data(&widset, "chat-check-widget")); progdt->setOpenChat(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))); widget = GTK_WIDGET(g_datalist_get_data(&widset, "statusicon-check-widget")); progdt->setHideStartup( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))); widget = GTK_WIDGET(g_datalist_get_data(&widset, "transmission-check-widget")); progdt->setOpenTransmission( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))); widget = GTK_WIDGET(g_datalist_get_data(&widset, "enterkey-check-widget")); progdt->setUseEnterKey( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))); widget = GTK_WIDGET(g_datalist_get_data(&widset, "history-check-widget")); progdt->setClearupHistory( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))); widget = GTK_WIDGET(g_datalist_get_data(&widset, "log-check-widget")); progdt->setRecordLog(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))); widget = GTK_WIDGET(g_datalist_get_data(&widset, "blacklist-check-widget")); progdt->setOpenBlacklist( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))); widget = GTK_WIDGET(g_datalist_get_data(&widset, "shared-check-widget")); progdt->setProofShared( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))); #if HAVE_APPINDICATOR widget = GTK_WIDGET(g_datalist_get_data(&widset, "taskbar-check-widget")); progdt->setHideTaskbarWhenMainWindowIconified( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))); #endif return oss.str(); } /** * 获取与网络相关的数据. */ void DataSettings::ObtainNetworkValue() { GtkWidget* widget; GtkTreeModel* model; GtkTreeIter iter; widget = GTK_WIDGET(g_datalist_get_data(&widset, "network-treeview-widget")); model = gtk_tree_view_get_model(GTK_TREE_VIEW(widget)); vector netSegments; if (gtk_tree_model_get_iter_first(model, &iter)) { do { char* startip = nullptr; char* endip = nullptr; char* description = nullptr; gtk_tree_model_get(model, &iter, 0, &startip, 1, &endip, 2, &description, -1); NetSegment ns; if (startip) ns.startip = startip; if (endip) ns.endip = endip; if (description) ns.description = description; netSegments.push_back(std::move(ns)); } while (gtk_tree_model_iter_next(model, &iter)); } auto g_cthrd = app->getCoreThread(); auto g_progdt = g_cthrd->getProgramData(); g_progdt->Lock(); g_progdt->setNetSegments(std::move(netSegments)); g_progdt->Unlock(); } /** * 写出网段数据到指定文件. * @param filename 文件名 * @param list 网段数据链表 */ void DataSettings::WriteNetSegment(const char* filename, GSList* list) { GtkWidget* parent; GSList* tlist; NetSegment* pns; FILE* stream; if (!(stream = fopen(filename, "w"))) { parent = GTK_WIDGET(g_datalist_get_data(&widset, "dialog-widget")); pop_warning(parent, _("Fopen() file \"%s\" failed!\n%s"), filename, strerror(errno)); return; } fprintf(stream, "#format (startIP - endIP //description)"); tlist = list; while (tlist) { pns = (NetSegment*)tlist->data; fprintf(stream, "\n%s - %s //%s\n", pns->startip.c_str(), pns->endip.c_str(), pns->description.c_str()); tlist = g_slist_next(tlist); } fclose(stream); } /** * 从指定文件读取网段数据. * @param filename 文件名 * @retval list 网段数据链表指针,数据由此返回 */ void DataSettings::ReadNetSegment(const char* filename, GSList** list) { GtkWidget* parent; char buf[3][MAX_BUFLEN], *lineptr; in_addr_t ipv4; NetSegment* ns; FILE* stream; size_t n; if (!(stream = fopen(filename, "r"))) { parent = GTK_WIDGET(g_datalist_get_data(&widset, "dialog-widget")); pop_warning(parent, _("Fopen() file \"%s\" failed!\n%s"), filename, strerror(errno)); return; } n = 0; lineptr = NULL; while (getline(&lineptr, &n, stream) != -1) { if (*(lineptr + strspn(lineptr, "\t\x20")) == '#') continue; switch (sscanf(lineptr, "%s - %s //%s", buf[0], buf[1], buf[2])) { case 3: if (inet_pton(AF_INET, buf[0], &ipv4) <= 0 || inet_pton(AF_INET, buf[1], &ipv4) <= 0) break; ns = new NetSegment; *list = g_slist_append(*list, ns); ns->startip = g_strdup(buf[0]); ns->endip = g_strdup(buf[1]); ns->description = g_strdup(buf[2]); break; case 2: if (inet_pton(AF_INET, buf[0], &ipv4) <= 0 || inet_pton(AF_INET, buf[1], &ipv4) <= 0) break; ns = new NetSegment; *list = g_slist_append(*list, ns); ns->startip = g_strdup(buf[0]); ns->endip = g_strdup(buf[1]); break; default: break; } } g_free(lineptr); fclose(stream); } /** * 查询(pathname)文件在(model)中的位置,若没有则加入到后面. * @param model model * @param pathname 文件路径 * @return 位置 */ gint DataSettings::IconfileGetItemPos(GtkTreeModel* model, const char* pathname) { GtkIconTheme* theme; GdkPixbuf* pixbuf; GtkTreeIter iter; const char* ptr; gchar* file; gint result, pos; /* 让ptr指向文件名 */ ptr = strrchr(pathname, '/'); ptr = ptr ? ptr + 1 : pathname; /* 查询model中是否已经存在此文件 */ pos = 0; if (gtk_tree_model_get_iter_first(model, &iter)) { do { gtk_tree_model_get(model, &iter, 1, &file, -1); result = strcmp(ptr, file); g_free(file); if (result == 0) return pos; pos++; } while (gtk_tree_model_iter_next(model, &iter)); } /* 将文件加入model */ if (access(pathname, F_OK) != 0) { theme = gtk_icon_theme_get_default(); file = iptux_erase_filename_suffix(pathname); pixbuf = gtk_icon_theme_load_icon(theme, file, MAX_ICONSIZE, GtkIconLookupFlags(0), NULL); g_free(file); } else pixbuf = gdk_pixbuf_new_from_file_at_size(pathname, MAX_ICONSIZE, MAX_ICONSIZE, NULL); if (pixbuf) { gtk_list_store_append(GTK_LIST_STORE(model), &iter); gtk_list_store_set(GTK_LIST_STORE(model), &iter, 0, pixbuf, 1, ptr, -1); g_object_unref(pixbuf); } else pos = -1; return pos; } /** * 添加新的头像数据. * @param button button * @param widset widget set */ void DataSettings::AddNewIcon(GtkWidget* button, GData** widset) { GtkWidget *parent, *combo; GtkTreeModel* model; gchar* filename; gint active; parent = GTK_WIDGET(g_datalist_get_data(widset, "dialog-widget")); if (!(filename = choose_file_with_preview(_("Please select a face picture"), parent))) return; combo = GTK_WIDGET(g_object_get_data(G_OBJECT(button), "icon-combo-widget")); model = gtk_combo_box_get_model(GTK_COMBO_BOX(combo)); active = IconfileGetItemPos(model, filename); gtk_combo_box_set_active(GTK_COMBO_BOX(combo), active); g_free(filename); } /** * 选择个人形象照片. * @param widset widget set */ void DataSettings::ChoosePhoto(GData** widset) { GtkWidget *image, *parent; GdkPixbuf* pixbuf; gchar path[MAX_PATHLEN]; gchar* filename; parent = GTK_WIDGET(g_datalist_get_data(widset, "dialog-widget")); if (!(filename = choose_file_with_preview(_("Please select a personal photo"), parent))) return; if ((pixbuf = gdk_pixbuf_new_from_file(filename, NULL))) { snprintf(path, MAX_PATHLEN, "%s" PHOTO_PATH "/photo", g_get_user_config_dir()); pixbuf_shrink_scale_1(&pixbuf, MAX_PHOTOSIZE, MAX_PHOTOSIZE); gdk_pixbuf_save(pixbuf, path, "bmp", NULL, NULL); // 命中率极高,不妨直接保存 image = GTK_WIDGET(g_datalist_get_data(widset, "photo-image-widget")); pixbuf_shrink_scale_1(&pixbuf, MAX_PREVIEWSIZE, MAX_PREVIEWSIZE); gtk_image_set_from_pixbuf(GTK_IMAGE(image), pixbuf); g_object_unref(pixbuf); } g_free(filename); } /** * 根据(chkbutton)的状态来设置(widget)的灵敏度. * @param chkbutton check-button * @param widget widget */ void DataSettings::AdjustSensitive(GtkWidget* chkbutton, GtkWidget* widget) { if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(chkbutton))) gtk_widget_set_sensitive(widget, TRUE); else gtk_widget_set_sensitive(widget, FALSE); } /** * 网络树(network-tree)排序比较函数. * @param model network-model * @param a A GtkTreeIter in model * @param b Another GtkTreeIter in model * @return 比较值 */ gint DataSettings::NetworkTreeCompareFunc(GtkTreeModel* model, GtkTreeIter* a, GtkTreeIter* b) { gchar *atext, *btext; gint result; gtk_tree_model_get(model, a, 0, &atext, -1); gtk_tree_model_get(model, b, 0, &btext, -1); result = strcmp(atext, btext); g_free(atext); g_free(btext); return result; } /** * 增加一个IP网段. * @param widset widget set */ void DataSettings::ClickAddIpseg(GData** widset) { GtkWidget *startentry, *endentry, *treeview, *parent; GtkTreeModel* model; GtkTreeIter iter; const gchar *starttext, *endtext; in_addr_t startip, endip; /* 合法性检查 */ parent = GTK_WIDGET(g_datalist_get_data(widset, "dialog-widget")); startentry = GTK_WIDGET(g_datalist_get_data(widset, "startip-entry-widget")); starttext = gtk_entry_get_text(GTK_ENTRY(startentry)); if (inet_pton(AF_INET, starttext, &startip) <= 0) { gtk_widget_grab_focus(startentry); pop_warning(parent, _("\nIllegal IP(v4) address: %s!"), starttext); return; } endentry = GTK_WIDGET(g_datalist_get_data(widset, "endip-entry-widget")); endtext = gtk_entry_get_text(GTK_ENTRY(endentry)); if (inet_pton(AF_INET, endtext, &endip) <= 0) { gtk_widget_grab_focus(endentry); pop_warning(parent, _("\nIllegal IP(v4) address: %s!"), endtext); return; } /* 加入网段树 */ startip = ntohl(startip); endip = ntohl(endip); treeview = GTK_WIDGET(g_datalist_get_data(widset, "network-treeview-widget")); model = gtk_tree_view_get_model(GTK_TREE_VIEW(treeview)); gtk_list_store_append(GTK_LIST_STORE(model), &iter); if (startip <= endip) gtk_list_store_set(GTK_LIST_STORE(model), &iter, 0, starttext, 1, endtext, -1); else gtk_list_store_set(GTK_LIST_STORE(model), &iter, 0, endtext, 1, starttext, -1); /* 扫尾 */ gtk_widget_grab_focus(startentry); gtk_entry_set_text(GTK_ENTRY(startentry), "\0"); gtk_entry_set_text(GTK_ENTRY(endentry), "\0"); } /** * 删除一个IP网段. * @param widset widget set */ void DataSettings::ClickDelIpseg(GData** widset) { GtkWidget *startentry, *endentry, *treeview; GtkTreeSelection* selection; GtkTreeModel* model; GtkTreeIter iter; gchar *starttext, *endtext; treeview = GTK_WIDGET(g_datalist_get_data(widset, "network-treeview-widget")); selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)); model = gtk_tree_view_get_model(GTK_TREE_VIEW(treeview)); if (!gtk_tree_model_get_iter_first(model, &iter)) return; /* 删除所有被选中的项,并提取第一项数据 */ starttext = endtext = NULL; do { mark: if (gtk_tree_selection_iter_is_selected(selection, &iter)) { if (!starttext) gtk_tree_model_get(model, &iter, 0, &starttext, 1, &endtext, -1); if (gtk_list_store_remove(GTK_LIST_STORE(model), &iter)) goto mark; break; } } while (gtk_tree_model_iter_next(model, &iter)); /* 把第一项数据填入输入框 */ if (!starttext) return; startentry = GTK_WIDGET(g_datalist_get_data(widset, "startip-entry-widget")); gtk_entry_set_text(GTK_ENTRY(startentry), starttext); g_free(starttext); endentry = GTK_WIDGET(g_datalist_get_data(widset, "endip-entry-widget")); gtk_entry_set_text(GTK_ENTRY(endentry), endtext); g_free(endtext); } /** * 编辑cell. * @param renderer cell-renderer-text * @param path item-path * @param newtext new-text * @param model model */ void DataSettings::CellEditText(GtkCellRendererText* renderer, gchar* path, gchar* newtext, GtkTreeModel* model) { GtkTreeIter iter; gint number; gtk_tree_model_get_iter_from_string(model, &iter, path); number = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(renderer), "column-number")); gtk_list_store_set(GTK_LIST_STORE(model), &iter, number, newtext, -1); } /** * 导入网段数据. * @param dset 数据设置类 */ void DataSettings::ImportNetSegment(DataSettings* dset) { GtkWidget *dialog, *parent; GtkTreeModel* model; GtkTreeIter iter; gchar* filename; GSList *list, *tlist; NetSegment* pns; parent = GTK_WIDGET(g_datalist_get_data(&dset->widset, "dialog-widget")); dialog = gtk_file_chooser_dialog_new( _("Please select a file to import data"), GTK_WINDOW(parent), GTK_FILE_CHOOSER_ACTION_OPEN, _("_Open"), GTK_RESPONSE_ACCEPT, _("_Cancel"), GTK_RESPONSE_CANCEL, NULL); gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT); gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), g_get_home_dir()); switch (gtk_dialog_run(GTK_DIALOG(dialog))) { case GTK_RESPONSE_ACCEPT: model = GTK_TREE_MODEL(g_datalist_get_data(&dset->mdlset, "network-model")); gtk_list_store_clear(GTK_LIST_STORE(model)); list = NULL; filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); dset->ReadNetSegment(filename, &list); g_free(filename); tlist = list; while (tlist) { pns = (NetSegment*)tlist->data; gtk_list_store_append(GTK_LIST_STORE(model), &iter); gtk_list_store_set(GTK_LIST_STORE(model), &iter, 0, pns->startip.c_str(), 1, pns->endip.c_str(), 2, pns->description.c_str(), -1); tlist = g_slist_next(tlist); } for (tlist = list; tlist; tlist = g_slist_next(tlist)) delete (NetSegment*)tlist->data; g_slist_free(list); default: break; } gtk_widget_destroy(dialog); } /** * 导出网段数据. * @param dset 数据设置类 */ void DataSettings::ExportNetSegment(DataSettings* dset) { GtkWidget *dialog, *parent; GtkTreeModel* model; GtkTreeIter iter; gchar* filename; GSList *list, *tlist; NetSegment* ns; parent = GTK_WIDGET(g_datalist_get_data(&dset->widset, "dialog-widget")); dialog = gtk_file_chooser_dialog_new( _("Save data to file"), GTK_WINDOW(parent), GTK_FILE_CHOOSER_ACTION_SAVE, _("_Save"), GTK_RESPONSE_ACCEPT, _("_Cancel"), GTK_RESPONSE_CANCEL, NULL); gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT); gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), g_get_home_dir()); switch (gtk_dialog_run(GTK_DIALOG(dialog))) { case GTK_RESPONSE_ACCEPT: model = GTK_TREE_MODEL(g_datalist_get_data(&dset->mdlset, "network-model")); if (!gtk_tree_model_get_iter_first(model, &iter)) break; list = NULL; do { char* startip; char* endip; char* description; gtk_tree_model_get(model, &iter, 0, &startip, 1, &endip, 2, &description, -1); ns = new NetSegment; if (startip) ns->startip = startip; if (endip) ns->endip = endip; if (description) ns->description = description; list = g_slist_append(list, ns); } while (gtk_tree_model_iter_next(model, &iter)); filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); dset->WriteNetSegment(filename, list); g_free(filename); for (tlist = list; tlist; tlist = g_slist_next(tlist)) delete (NetSegment*)tlist->data; g_slist_free(list); default: break; } gtk_widget_destroy(dialog); } /** * 清空网段数据. * @param mdlset model set */ void DataSettings::ClearNetSegment(GData** mdlset) { GtkTreeModel* model; model = GTK_TREE_MODEL(g_datalist_get_data(mdlset, "network-model")); gtk_list_store_clear(GTK_LIST_STORE(model)); } } // namespace iptux iptux-0.9.4/src/iptux/DataSettings.h000066400000000000000000000051631475473122500174170ustar00rootroot00000000000000// // C++ Interface: DataSettings // // Description:程序功能、数据设置 // // // Author: Jally , (C) 2008 // // Copyright: See COPYING file that comes with this distribution // // #ifndef IPTUX_DATASETTINGS_H #define IPTUX_DATASETTINGS_H #include #include "iptux-core/Models.h" #include "iptux/Application.h" namespace iptux { class DataSettings { public: explicit DataSettings(Application* app, GtkWidget* parent); ~DataSettings(); bool Save(); GtkDialog* dialog() { return dialog_; } static void ResetDataEntry(Application* app, GtkWidget* parent); // only for test GtkWidget* GetWidget(const char* name); private: Application* app; GtkDialog* dialog_; GData* widset; // 窗体集 GData* mdlset; // 数据model集 IconModel* iconModel = 0; /** * @brief check all the fields. * * @return std::string error info is check failed, otherwise empty string. */ std::string Check(); void InitSublayer(); void ClearSublayer(); GtkWidget* CreateMainDialog(GtkWidget* parent); GtkWidget* CreatePersonal(); GtkWidget* CreateSystem(); GtkWidget* CreateNetwork(); void SetPersonalValue(); void SetSystemValue(); GtkTreeModel* CreateNetworkModel(); static void FillIconModel(GtkTreeModel* model); void FillNetworkModel(GtkTreeModel* model); GtkWidget* CreateIconTree(GtkTreeModel* model); GtkWidget* CreateNetworkTree(GtkTreeModel* model); GtkWidget* CreateArchiveChooser(); GtkWidget* CreateFontChooser(); void ObtainPersonalValue(); std::string ObtainSystemValue(bool dryrun = false); void ObtainNetworkValue(); void WriteNetSegment(const char* filename, GSList* list); void ReadNetSegment(const char* filename, GSList** list); static gint IconfileGetItemPos(GtkTreeModel* model, const char* pathname); // 回调处理部分 private: static void AddNewIcon(GtkWidget* button, GData** widset); static void ChoosePhoto(GData** widset); static void AdjustSensitive(GtkWidget* chkbutton, GtkWidget* widget); static gint NetworkTreeCompareFunc(GtkTreeModel* model, GtkTreeIter* a, GtkTreeIter* b); static void ClickAddIpseg(GData** widset); static void ClickDelIpseg(GData** widset); static void CellEditText(GtkCellRendererText* renderer, gchar* path, gchar* newtext, GtkTreeModel* model); static void ImportNetSegment(DataSettings* dset); static void ExportNetSegment(DataSettings* dset); static void ClearNetSegment(GData** mdlset); }; } // namespace iptux #endif iptux-0.9.4/src/iptux/DataSettingsTest.cpp000066400000000000000000000011541475473122500206060ustar00rootroot00000000000000#include "UiHelper.h" #include "gtest/gtest.h" #include "iptux/Application.h" #include "iptux/DataSettings.h" #include "iptux/TestHelper.h" using namespace std; using namespace iptux; TEST(DataSettings, Constructor) { Application* app = CreateApplication(); DataSettings ds(app, nullptr); ASSERT_TRUE(ds.Save()); DestroyApplication(app); } TEST(DataSettings, Constructor2) { pop_disable(); Application* app = CreateApplication(); DataSettings ds(app, nullptr); GtkEntry* port_entry = GTK_ENTRY(ds.GetWidget("port-entry-widget")); gtk_entry_set_text(port_entry, "abc"); ASSERT_FALSE(ds.Save()); } iptux-0.9.4/src/iptux/DetectPal.cpp000066400000000000000000000051731475473122500172260ustar00rootroot00000000000000// // C++ Implementation: DetectPal // // Description: // // // Author: Jally , (C) 2008 // // Copyright: See COPYING file that comes with this distribution // // #include "config.h" #include "DetectPal.h" #include #include #include "iptux-core/Exception.h" #include "iptux/UiCoreThread.h" #include "iptux/UiHelper.h" #include "iptux/callback.h" using namespace std; namespace iptux { static gboolean iptux_on_detect_pal_ipv4_entry_escape(GtkWidget* widget, GdkEventKey* event, gpointer) { if (event->keyval == GDK_KEY_Escape) { gtk_dialog_response(GTK_DIALOG(gtk_widget_get_toplevel(widget)), GTK_RESPONSE_CLOSE); } return FALSE; } DetectPal::DetectPal(Application* app, GtkWindow* window) : app(app) { auto builder = gtk_builder_new_from_resource(IPTUX_RESOURCE "gtk/DetectPal.ui"); g_set_object(&detectPalDialog, CHECK_NOTNULL(GTK_DIALOG( gtk_builder_get_object(builder, "detect_pal_dialog")))); gtk_window_set_transient_for(GTK_WINDOW(this->detectPalDialog), window); g_set_object(&detectPalIpv4Entry, CHECK_NOTNULL(GTK_ENTRY( gtk_builder_get_object(builder, "detect_pal_ipv4_entry")))); g_signal_connect(detectPalIpv4Entry, "insert-text", G_CALLBACK(entry_insert_numeric), nullptr); g_signal_connect(detectPalIpv4Entry, "key-release-event", G_CALLBACK(iptux_on_detect_pal_ipv4_entry_escape), nullptr); g_object_unref(builder); } DetectPal::~DetectPal() { g_clear_object(&detectPalDialog); g_clear_object(&detectPalIpv4Entry); } void DetectPal::run() { bool loop = true; while (loop) { const char* ipv4Text = nullptr; switch (gtk_dialog_run(detectPalDialog)) { case GTK_RESPONSE_ACCEPT: ipv4Text = gtk_entry_get_text(detectPalIpv4Entry); try { app->getCoreThread()->SendDetectPacket(ipv4Text); pop_info(GTK_WIDGET(detectPalDialog), _("The notification has been sent to %s."), ipv4Text); gtk_entry_set_text(GTK_ENTRY(detectPalIpv4Entry), ""); } catch (Exception& e) { if (e.getErrorCode() == INVALID_IP_ADDRESS) { pop_warning(GTK_WIDGET(detectPalDialog), _("\nIllegal IP(v4) address: %s!"), ipv4Text); } else { throw e; } } break; default: loop = false; break; } } gtk_widget_hide(GTK_WIDGET(detectPalDialog)); } } // namespace iptux iptux-0.9.4/src/iptux/DetectPal.h000066400000000000000000000010521475473122500166630ustar00rootroot00000000000000// // C++ Interface: DetectPal // // Description:探测好友 // // // Author: Jally , (C) 2008 // // Copyright: See COPYING file that comes with this distribution // // #ifndef IPTUX_DETECTPAL_H #define IPTUX_DETECTPAL_H #include #include "iptux/Application.h" namespace iptux { class DetectPal { public: DetectPal(Application* app, GtkWindow* parent); ~DetectPal(); void run(); private: Application* app; GtkDialog* detectPalDialog = 0; GtkEntry* detectPalIpv4Entry = 0; }; } // namespace iptux #endif iptux-0.9.4/src/iptux/DetectPalTest.cpp000066400000000000000000000004411475473122500200570ustar00rootroot00000000000000#include "Application.h" #include "gtest/gtest.h" #include "iptux/DetectPal.h" #include "iptux/TestHelper.h" using namespace std; using namespace iptux; TEST(DetectPal, Constructor) { Application* app = CreateApplication(); DetectPal pal(app, nullptr); DestroyApplication(app); } iptux-0.9.4/src/iptux/DialogBase.cpp000066400000000000000000000763311475473122500173570ustar00rootroot00000000000000// // C++ Implementation: DialogBase // // Description: // 这个类是DialogPeer和DialogGroup的相同部分。尽量把相同的部分放在一起。 // // Author: Jiejing.Zhang , (C) 2010 // Jally , (C) 2008 // // Copyright: See COPYING file that comes with this distribution // // #include "config.h" #include "DialogBase.h" #include "UiModels.h" #include #include #include #include "iptux-utils/output.h" #include "iptux-utils/utils.h" #include "iptux/UiCoreThread.h" #include "iptux/UiHelper.h" #include "iptux/callback.h" using namespace std; namespace iptux { DialogBase::DialogBase(Application* app, GroupInfo* grp) : app(app), progdt(app->getProgramData()), widset(NULL), mdlset(NULL), dtset(NULL), grpinf(grp), totalsendsize(0), timersend(0) { InitSublayerGeneral(); } DialogBase::~DialogBase() { if (timersend > 0) g_source_remove(timersend); ClearSublayerGeneral(); if (grpinf) grpinf->clearDialog(); } /** * 初始化底层数据. */ void DialogBase::InitSublayerGeneral() { g_datalist_init(&widset); g_datalist_init(&mdlset); g_datalist_init(&dtset); } /** * 清空底层数据. */ void DialogBase::ClearSublayerGeneral() { if (progdt->IsAutoCleanChatHistory()) { ClearHistoryTextView(); } g_datalist_clear(&widset); g_datalist_clear(&mdlset); g_datalist_clear(&dtset); } /** * 清空聊天历史记录. */ void DialogBase::ClearHistoryTextView() { GtkTextBuffer* buffer; GtkTextTagTable* table; GtkTextIter start, end; GSList *taglist, *tlist; buffer = gtk_text_view_get_buffer(chat_history_widget); table = gtk_text_buffer_get_tag_table(buffer); /* 清除用于局部标记的GtkTextTag */ gtk_text_buffer_get_bounds(buffer, &start, &end); while (!gtk_text_iter_equal(&start, &end)) { tlist = taglist = gtk_text_iter_get_tags(&start); while (tlist) { /* 如果没有"global"标记,则表明此tag为局部标记,可以移除 */ if (!g_object_get_data(G_OBJECT(tlist->data), "global")) gtk_text_tag_table_remove(table, GTK_TEXT_TAG(tlist->data)); tlist = g_slist_next(tlist); } g_slist_free(taglist); gtk_text_iter_forward_char(&start); } /* 清除内容 */ gtk_text_buffer_get_bounds(buffer, &start, &end); gtk_text_buffer_delete(buffer, &start, &end); } /** * 滚动聊天历史记录区. */ void DialogBase::ScrollHistoryTextview() { GtkTextBuffer* buffer; GtkTextIter end; GtkTextMark* mark; buffer = gtk_text_view_get_buffer(chat_history_widget); gtk_text_buffer_get_end_iter(buffer, &end); mark = gtk_text_buffer_create_mark(buffer, NULL, &end, FALSE); gtk_text_view_scroll_to_mark(chat_history_widget, mark, 0.0, TRUE, 0.0, 0.0); gtk_text_buffer_delete_mark(buffer, mark); } /** * 窗口打开情况下,新消息来到以后的接口 */ void DialogBase::OnNewMessageComing() { this->NotifyUser(); this->ScrollHistoryTextview(); } /** * 在窗口打开并且没有设置为最顶端的窗口时候,用窗口在任务栏的闪动来提示用户 */ void DialogBase::NotifyUser() { GtkWindow* window; window = GTK_WINDOW(g_datalist_get_data(&widset, "window-widget")); if (!gtk_window_has_toplevel_focus(window)) gtk_window_set_urgency_hint(window, TRUE); } /** * 添加附件. * @param list 文件链表 */ void DialogBase::AttachEnclosure(const GSList* list) { GtkWidget *widget, *pbar; GtkTreeModel* model; GtkTreeIter iter; const char* iconname; struct stat st; const GSList *tlist, *pallist; int64_t filesize; char *filename, *filepath, *progresstip; FileInfo* file; uint32_t filenum = 0; /* 插入附件树 */ widget = GTK_WIDGET(g_datalist_get_data(&widset, "file-send-treeview-widget")); model = gtk_tree_view_get_model(GTK_TREE_VIEW(widget)); tlist = list; auto g_cthrd = app->getCoreThread(); while (tlist) { if (stat((const char*)tlist->data, &st) == -1 || !(S_ISREG(st.st_mode) || S_ISDIR(st.st_mode))) { tlist = g_slist_next(tlist); continue; } /* 获取文件类型图标 */ if (S_ISREG(st.st_mode)) { iconname = "text-x-generic-symbolic"; } else if (S_ISDIR(st.st_mode)) { iconname = "folder-symbolic"; } else { iconname = NULL; } filesize = utils::fileOrDirectorySize((char*)tlist->data); filename = ipmsg_get_filename_me((char*)tlist->data, &filepath); pallist = GetSelPal(); while (pallist) { file = new FileInfo; file->fileid = g_cthrd->PrnQuote()++; /* file->packetn = 0;//没必要设置此字段 */ file->fileattr = S_ISREG(st.st_mode) ? FileAttr::REGULAR : FileAttr::DIRECTORY; file->filesize = filesize; file->filepath = g_strdup((char*)tlist->data); file->filectime = uint32_t(st.st_ctime); file->filenum = filenum; file->fileown = g_cthrd->GetPal(((PalInfo*)(pallist->data))->GetKey()); /* 加入文件信息到中心节点 */ g_cthrd->Lock(); g_cthrd->AddPrivateFile(PFileInfo(file)); g_cthrd->Unlock(); /* 添加数据 */ gtk_list_store_append(GTK_LIST_STORE(model), &iter); gtk_list_store_set(GTK_LIST_STORE(model), &iter, 0, iconname, 1, filename, 2, numeric_to_size(filesize), 3, tlist->data, 4, file, 5, file->fileown->getName().c_str(), -1); pallist = g_slist_next(pallist); } filenum++; /* 转到下一个文件节点 */ tlist = g_slist_next(tlist); } // 计算待发送文件总计大小 totalsendsize = 0; if (gtk_tree_model_get_iter_first(model, &iter)) { do { // 遍历待发送model gtk_tree_model_get(model, &iter, 4, &file, -1); totalsendsize += file->filesize; } while (gtk_tree_model_iter_next(model, &iter)); } pbar = GTK_WIDGET(g_datalist_get_data(&widset, "file-send-progress-bar-widget")); progresstip = g_strdup_printf(_("%s To Send."), numeric_to_size(totalsendsize)); gtk_progress_bar_set_text(GTK_PROGRESS_BAR(pbar), _(progresstip)); g_free(progresstip); } /* * 主窗口的信号连接 */ void DialogBase::MainWindowSignalSetup(GtkWindow* window) { g_object_set_data(G_OBJECT(window), "session-class", this); g_signal_connect_swapped(window, "destroy", G_CALLBACK(DialogDestory), this); g_signal_connect_swapped(window, "drag-data-received", G_CALLBACK(DragDataReceived), this); g_signal_connect(window, "configure-event", G_CALLBACK(WindowConfigureEvent), &dtset); g_signal_connect(window, "focus-in-event", G_CALLBACK(ClearNotify), NULL); } /** * 创建消息输入区域. * @return 主窗体 */ GtkWidget* DialogBase::CreateInputArea() { GtkWidget *frame, *box, *sw; GtkWidget *hbb, *button; GtkWidget *widget, *window; frame = gtk_frame_new(NULL); gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_ETCHED_IN); box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_container_add(GTK_CONTAINER(frame), box); /* 接受输入 */ sw = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_ETCHED_IN); gtk_box_pack_start(GTK_BOX(box), sw, TRUE, TRUE, 0); widget = gtk_text_view_new_with_buffer(grpinf->getInputBuffer()); inputTextviewWidget = GTK_TEXT_VIEW(widget); gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(widget), GTK_WRAP_WORD_CHAR); gtk_drag_dest_add_uri_targets(widget); gtk_container_add(GTK_CONTAINER(sw), widget); g_signal_connect_swapped(widget, "drag-data-received", G_CALLBACK(DragDataReceived), this); g_signal_connect_swapped(widget, "paste-clipboard", G_CALLBACK(DialogBase::OnPasteClipboard), this); g_signal_connect_swapped(widget, "populate-popup", G_CALLBACK(DialogBase::onInputPopulatePopup), this); g_datalist_set_data(&widset, "input-textview-widget", widget); /* 功能按钮 */ window = GTK_WIDGET(g_datalist_get_data(&widset, "window-widget")); hbb = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL); gtk_button_box_set_layout(GTK_BUTTON_BOX(hbb), GTK_BUTTONBOX_END); gtk_box_pack_start(GTK_BOX(box), hbb, FALSE, FALSE, 0); button = gtk_button_new_with_label(_("Close")); gtk_box_pack_end(GTK_BOX(hbb), button, FALSE, FALSE, 0); g_signal_connect_swapped(button, "clicked", G_CALLBACK(gtk_widget_destroy), window); button = gtk_button_new_with_label(_("Send")); gtk_box_pack_end(GTK_BOX(hbb), button, FALSE, FALSE, 0); gtk_actionable_set_action_name(GTK_ACTIONABLE(button), "win.send_message"); return frame; } static void iptux_dlg_refresh_anchors(DialogBase* dialog, GtkTextBuffer* buffer) { GtkTextIter start, end; gtk_text_buffer_get_bounds(buffer, &start, &end); GtkTextIter iter = start; while (!gtk_text_iter_equal(&iter, &end)) { GtkTextChildAnchor* anchor = gtk_text_iter_get_child_anchor(&iter); if (anchor) { dialog->onChatHistoryInsertChildAnchor(anchor); } gtk_text_iter_forward_char(&iter); } } /** * 创建聊天历史记录区域. * @return 主窗体. */ GtkWidget* DialogBase::CreateHistoryArea() { GtkWidget *frame, *sw; frame = gtk_frame_new(_("Chat History")); gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_ETCHED_IN); sw = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_ETCHED_IN); gtk_container_add(GTK_CONTAINER(frame), sw); chat_history_widget = GTK_TEXT_VIEW(gtk_text_view_new_with_buffer(grpinf->buffer)); gtk_text_view_set_cursor_visible(chat_history_widget, FALSE); gtk_text_view_set_editable(chat_history_widget, FALSE); gtk_text_view_set_wrap_mode(chat_history_widget, GTK_WRAP_WORD_CHAR); gtk_container_add(GTK_CONTAINER(sw), GTK_WIDGET(chat_history_widget)); g_signal_connect(chat_history_widget, "key-press-event", G_CALLBACK(textview_key_press_event), NULL); g_signal_connect(chat_history_widget, "event-after", G_CALLBACK(textview_event_after), NULL); g_signal_connect(chat_history_widget, "motion-notify-event", G_CALLBACK(textview_motion_notify_event), NULL); if (grpinf->buffer) { iptux_dlg_refresh_anchors(this, grpinf->buffer); } /* 滚动消息到最末位置 */ ScrollHistoryTextview(); return frame; } /** * 选择附件. * @param fileattr 文件类型 * @return 文件链表 */ GSList* DialogBase::PickEnclosure(FileAttr fileattr) { GtkWidget* dialog; GtkFileChooserAction action; const char* title; GSList* list; if (fileattr == FileAttr::REGULAR) { action = GTK_FILE_CHOOSER_ACTION_OPEN; title = _("Choose enclosure files"); } else if (fileattr == FileAttr::DIRECTORY) { action = GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER; title = _("Choose enclosure folders"); } else { CHECK(false); } dialog = gtk_file_chooser_dialog_new(title, GTK_WINDOW(getWindow()), action, _("_Open"), GTK_RESPONSE_ACCEPT, _("_Cancel"), GTK_RESPONSE_CANCEL, NULL); gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT); gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(dialog), FALSE); gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), TRUE); gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), g_get_home_dir()); switch (gtk_dialog_run(GTK_DIALOG(dialog))) { case GTK_RESPONSE_ACCEPT: list = gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(dialog)); break; case GTK_RESPONSE_CANCEL: default: list = NULL; break; } gtk_widget_destroy(dialog); return list; } /** * 发送附件消息. * @return 是否发送数据 */ bool DialogBase::SendEnclosureMsg() { GtkWidget* treeview; GtkTreeModel* model; GtkTreeIter iter; gchar* filepath; FileInfo* file; treeview = GTK_WIDGET(g_datalist_get_data(&widset, "file-send-treeview-widget")); model = gtk_tree_view_get_model(GTK_TREE_VIEW(treeview)); if (!gtk_tree_model_get_iter_first(model, &iter)) return false; /* 获取文件并发送 */ vector files; do { gtk_tree_model_get(model, &iter, 3, &filepath, 4, &file, -1); files.push_back(file); } while (gtk_tree_model_iter_next(model, &iter)); gtk_list_store_clear(GTK_LIST_STORE(model)); BroadcastEnclosureMsg(files); if (!timersend) { timersend = g_timeout_add(400, (GSourceFunc)UpdateFileSendUI, this); } return true; } /** * 回馈消息. * @param msg 消息 */ void DialogBase::FeedbackMsg(const gchar* msg) { MsgPara para(this->app->getMe()); para.stype = MessageSourceType::SELF; para.btype = grpinf->getType(); ChipData chip(msg); para.dtlist.push_back(std::move(chip)); grpinf->addMsgPara(para); } /** * 添加常规文件附件. * @param dlgpr 对话框类 */ void DialogBase::AttachRegular(DialogBase* dlgpr) { GSList* list; if (!(list = dlgpr->PickEnclosure(FileAttr::REGULAR))) return; dlgpr->AttachEnclosure(list); g_slist_foreach(list, GFunc(g_free), NULL); g_slist_free(list); } /** * 添加目录文件附件. * @param dlgpr 对话框类 */ void DialogBase::AttachFolder(DialogBase* dlgpr) { GSList* list; if (!(list = dlgpr->PickEnclosure(FileAttr::DIRECTORY))) return; dlgpr->AttachEnclosure(list); g_slist_foreach(list, GFunc(g_free), NULL); g_slist_free(list); } /** * 发送消息. * @param dlgpr 对话框类 */ void DialogBase::SendMessage(DialogBase* dlgpr) { dlgpr->SendEnclosureMsg(); dlgpr->SendTextMsg(); dlgpr->ScrollHistoryTextview(); } /** * 对话框被摧毁的回调函数 * @param dialog */ void DialogBase::DialogDestory(DialogBase* dialog) { delete dialog; } /** * 清除提示,这个提示只是窗口闪动的提示 */ gboolean DialogBase::ClearNotify(GtkWidget* window, GdkEventConfigure*) { if (gtk_window_get_urgency_hint(GTK_WINDOW(window))) gtk_window_set_urgency_hint(GTK_WINDOW(window), FALSE); DialogBase* self = (DialogBase*)g_object_get_data(G_OBJECT(window), "session-class"); self->grpinf->readAllMsg(); return FALSE; } /** * 拖拽事件响应函数. * @param dlgpr 对话框类 * @param context the drag context * @param x where the drop happened * @param y where the drop happened * @param data the received data * @param info the info that has been registered with the target in the * GtkTargetList * @param time the timestamp at which the data was received */ void DialogBase::DragDataReceived(DialogBase* dlgpr, GdkDragContext* context, gint, gint, GtkSelectionData* data, guint, guint time) { GSList* list; if (!ValidateDragData(data, context, time)) { return; } list = selection_data_get_path(data); // 获取所有文件 dlgpr->AttachEnclosure(list); g_slist_foreach(list, GFunc(g_free), NULL); g_slist_free(list); gtk_drag_finish(context, TRUE, FALSE, time); } /** * 主对话框位置&大小改变的响应处理函数. * @param window 主窗口 * @param event the GdkEventConfigure which triggered this signal * @param dtset data set * @return Gtk+库所需 */ gboolean DialogBase::WindowConfigureEvent(GtkWidget*, GdkEventConfigure* event, GData** dtset) { g_datalist_set_data(dtset, "window-width", GINT_TO_POINTER(event->width)); g_datalist_set_data(dtset, "window-height", GINT_TO_POINTER(event->height)); return FALSE; } /** * 分割面板的分割位置改变的响应处理函数. * @param paned paned * @param pspec he GParamSpec of the property which changed * @param dtset data set */ void DialogBase::PanedDivideChanged(GtkWidget* paned, GParamSpec* /*pspec*/, GData** dtset) { const gchar* identify; gint position; identify = (const gchar*)g_object_get_data(G_OBJECT(paned), "position-name"); position = gtk_paned_get_position(GTK_PANED(paned)); g_datalist_set_data(dtset, identify, GINT_TO_POINTER(position)); } /** *删除选定附件. * @param dlgpr 对话框类 */ void DialogBase::RemoveSelectedFromTree(GtkWidget* widget) { GList* list; GtkTreeSelection* TreeSel; GtkTreePath* path; GtkTreeModel* model; gchar* str_data; gboolean valid = 0; GtkTreeIter iter; model = gtk_tree_view_get_model(GTK_TREE_VIEW(widget)); TreeSel = gtk_tree_view_get_selection(GTK_TREE_VIEW(widget)); list = gtk_tree_selection_get_selected_rows(TreeSel, NULL); if (!list) return; while (list) { gtk_tree_model_get_iter(GTK_TREE_MODEL(model), &iter, (GtkTreePath*)g_list_nth(list, 0)->data); gtk_list_store_set(GTK_LIST_STORE(model), &iter, 2, "delete", -1); list = g_list_next(list); } g_list_free(list); valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter); path = gtk_tree_model_get_path(GTK_TREE_MODEL(model), &iter); while (valid) { gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 2, &str_data, -1); if (!g_strcmp0(str_data, "delete")) gtk_list_store_remove(GTK_LIST_STORE(model), &iter); else gtk_tree_path_next(path); valid = gtk_tree_model_get_iter(GTK_TREE_MODEL(model), &iter, path); } } /** *显示附件的TreeView的弹出菜单回调函数. * @param widget TreeView * @param event 事件 */ gint DialogBase::EnclosureTreePopup(DialogBase* self, GdkEvent* event) { GtkWidget *menu, *menuitem; menu = gtk_menu_new(); menuitem = gtk_menu_item_new_with_label(_("Remove Selected")); g_signal_connect_swapped(menuitem, "activate", G_CALLBACK(RemoveSelectedEnclosure), self); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); if (event->type == GDK_BUTTON_PRESS) { if (gdk_event_triggers_context_menu(event)) { gtk_widget_show(menuitem); gtk_menu_popup_at_pointer(GTK_MENU(menu), nullptr); return TRUE; } } return FALSE; } /** *从显示附件的TreeView删除选定行. * @param widget TreeView */ void DialogBase::RemoveSelectedEnclosure(DialogBase* self) { GtkTreeModel* model; GtkTreeSelection* TreeSel; GtkTreeIter iter; FileInfo* file; GList* list; auto widget = self->fileSendTree; auto dlg = self; model = gtk_tree_view_get_model(GTK_TREE_VIEW(widget)); // 从中心结点删除 TreeSel = gtk_tree_view_get_selection(GTK_TREE_VIEW(widget)); list = gtk_tree_selection_get_selected_rows(TreeSel, NULL); if (!list) return; while (list) { gtk_tree_model_get_iter(GTK_TREE_MODEL(model), &iter, (GtkTreePath*)g_list_nth(list, 0)->data); gtk_tree_model_get(model, &iter, 4, &file, -1); dlg->totalsendsize -= file->filesize; self->app->getCoreThread()->DelPrivateFile(file->fileid); list = g_list_next(list); } g_list_free(list); // 从列表中删除 RemoveSelectedFromTree(GTK_WIDGET(widget)); // 重新计算待发送文件大小 dlg->UpdateFileSendUI(dlg); } /** * 创建文件发送区域. * @return 主窗体 */ GtkWidget* DialogBase::CreateFileSendArea() { GtkWidget *frame, *hbox, *vbox, *button, *pbar, *sw, *treeview; GtkTreeModel* model; frame = gtk_frame_new(_("File to send.")); g_datalist_set_data(&widset, "file-send-frame-widget", frame); gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_ETCHED_IN); pbar = gtk_progress_bar_new(); g_datalist_set_data(&widset, "file-send-progress-bar-widget", pbar); gtk_progress_bar_set_text(GTK_PROGRESS_BAR(pbar), _("Sending progress.")); hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 1); gtk_box_pack_start(GTK_BOX(hbox), pbar, TRUE, TRUE, 0); button = gtk_button_new_with_label(_("Dirs")); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, TRUE, 0); g_signal_connect_swapped(button, "clicked", G_CALLBACK(AttachFolder), this); button = gtk_button_new_with_label(_("Files")); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, TRUE, 0); g_signal_connect_swapped(button, "clicked", G_CALLBACK(AttachRegular), this); button = gtk_button_new_with_label(_("Detail")); gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, TRUE, 0); gtk_actionable_set_action_name(GTK_ACTIONABLE(button), "app.tools.transmission"); vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); sw = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_ETCHED_IN); model = CreateFileSendModel(); fileSendModel = GTK_LIST_STORE(model); treeview = CreateFileSendTree(model); g_datalist_set_data_full(&mdlset, "enclosure-model", model, GDestroyNotify(g_object_unref)); g_datalist_set_data(&widset, "file-send-treeview-widget", treeview); // 保存this指针,在后面消息响应函数中用到 g_object_set_data(G_OBJECT(treeview), "dialog", this); gtk_container_add(GTK_CONTAINER(sw), treeview); gtk_box_pack_end(GTK_BOX(vbox), sw, TRUE, TRUE, 0); gtk_container_add(GTK_CONTAINER(frame), vbox); return frame; } /** * 创建待发送文件树(FileSend-tree). * @param model FileSend-model * @return 待发送文件树 */ GtkWidget* DialogBase::CreateFileSendTree(GtkTreeModel* model) { GtkWidget* view; GtkTreeSelection* selection; GtkCellRenderer* cell; GtkTreeViewColumn* column; view = gtk_tree_view_new_with_model(model); this->fileSendTree = GTK_TREE_VIEW(view); gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(view), TRUE); selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view)); gtk_tree_selection_set_mode(selection, GTK_SELECTION_MULTIPLE); cell = gtk_cell_renderer_pixbuf_new(); column = gtk_tree_view_column_new_with_attributes("", cell, "icon-name", 0, NULL); gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_append_column(GTK_TREE_VIEW(view), column); if (grpinf->getType() != GROUP_BELONG_TYPE_REGULAR) { cell = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes(_("PeerName"), cell, "text", 5, NULL); gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_append_column(GTK_TREE_VIEW(view), column); } cell = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes(_("Name"), cell, "text", 1, NULL); gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_append_column(GTK_TREE_VIEW(view), column); cell = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes(_("Size"), cell, "text", 2, NULL); gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_append_column(GTK_TREE_VIEW(view), column); cell = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes(_("Path"), cell, "text", 3, NULL); gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_append_column(GTK_TREE_VIEW(view), column); g_signal_connect_swapped(GTK_WIDGET(view), "button_press_event", G_CALLBACK(EnclosureTreePopup), this); return view; } /** * 创建待发送文件树底层数据结构. * @return FileSend-model * 0:图标 1:文件名 2:大小(string) 3:全文件名 4:文件信息(指针) 5:接收者 * 没有专门加删除标记,用第2列作删除标记,(某行反正要删除,改就改了) */ GtkTreeModel* DialogBase::CreateFileSendModel() { GtkListStore* model; model = gtk_list_store_new(6, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_STRING); return GTK_TREE_MODEL(model); } /** * 更新本窗口文件发送UI. * @param treeview FileSend-treeview * @return FileSend-model * 让传输聊天窗口从传输状态窗口去取数据,而没有让文件数据发送类把数据传送到聊天窗口, * 这是因为考虑数据要发到本窗口,会存在窗口未打开或群聊状态等不确定因素,处理过程太复杂 */ gboolean DialogBase::UpdateFileSendUI(DialogBase* dlggrp) { GtkTreeModel* model; GtkTreeIter iter; string progresstip; GtkTreeView* treeview; GtkWidget* pbar; float progress; int64_t sentsize; FileInfo* file; treeview = GTK_TREE_VIEW( g_datalist_get_data(&(dlggrp->widset), "file-send-treeview-widget")); model = gtk_tree_view_get_model(GTK_TREE_VIEW(treeview)); sentsize = 0; if (gtk_tree_model_get_iter_first(model, &iter)) { do { // 遍历待发送model gtk_tree_model_get(model, &iter, 4, &file, -1); if (file->finishedsize == file->filesize) { gtk_list_store_set(GTK_LIST_STORE(model), &iter, 0, "tip-finish", -1); } sentsize += file->finishedsize; } while (gtk_tree_model_iter_next(model, &iter)); } /* 调整进度显示UI */ gtk_tree_view_columns_autosize(GTK_TREE_VIEW(treeview)); pbar = GTK_WIDGET( g_datalist_get_data(&(dlggrp->widset), "file-send-progress-bar-widget")); if (dlggrp->totalsendsize == 0) { progress = 0; progresstip = _("Sending Progress."); } else { progress = percent(sentsize, dlggrp->totalsendsize) / 100; progresstip = stringFormat(_("%s of %s Sent."), numeric_to_size(sentsize), numeric_to_size(dlggrp->totalsendsize)); } if (progress == 1) { g_source_remove(dlggrp->timersend); dlggrp->timersend = 0; gtk_list_store_clear(GTK_LIST_STORE(model)); progresstip = _("Mission Completed!"); } gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(pbar), progress); gtk_progress_bar_set_text(GTK_PROGRESS_BAR(pbar), progresstip.c_str()); return TRUE; } GtkTextBuffer* DialogBase::getInputBuffer() { return grpinf->getInputBuffer(); } void DialogBase::OnPasteClipboard(DialogBase*, GtkTextView* textview) { GtkClipboard* clipboard; GtkTextBuffer* buffer; GtkTextIter iter; clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD); buffer = gtk_text_view_get_buffer(textview); gtk_text_buffer_get_iter_at_mark(buffer, &iter, gtk_text_buffer_get_insert(buffer)); if (gtk_clipboard_wait_is_image_available(clipboard)) { GdkPixbuf* pixbuf = gtk_clipboard_wait_for_image(clipboard); if (pixbuf) { gtk_text_buffer_insert_pixbuf(buffer, &iter, pixbuf); g_object_unref(pixbuf); } } } void DialogBase::onInputPopulatePopup(DialogBase* self, GtkWidget* popup, GtkTextView* textview) { if (!GTK_IS_MENU(popup)) return; self->populateInputPopup(GTK_MENU(popup)); } void DialogBase::afterWindowCreated() { g_return_if_fail(!m_imagePopupMenu); m_imagePopupMenu = GTK_MENU(gtk_menu_new()); GtkWidget* menu_item = gtk_menu_item_new_with_label(_("Save Image")); gtk_menu_shell_append(GTK_MENU_SHELL(m_imagePopupMenu), menu_item); g_signal_connect_swapped(menu_item, "activate", G_CALLBACK(DialogBase::OnSaveImage), this); menu_item = gtk_menu_item_new_with_label(_("Copy Image")); gtk_menu_shell_append(GTK_MENU_SHELL(m_imagePopupMenu), menu_item); g_signal_connect_swapped(menu_item, "activate", G_CALLBACK(DialogBase::OnCopyImage), this); gtk_menu_attach_to_widget(m_imagePopupMenu, GTK_WIDGET(getWindow()), NULL); } gboolean DialogBase::OnImageButtonPress(DialogBase* self, GdkEventButton* event, GtkEventBox* event_box) { if (event->type != GDK_BUTTON_PRESS || event->button != 3) { return FALSE; } GtkWidget* image = gtk_bin_get_child(GTK_BIN(event_box)); if (!GTK_IS_IMAGE(image)) { LOG_ERROR("image not found in event box."); return FALSE; } self->m_activeImage = GTK_IMAGE(image); gtk_widget_show_all(GTK_WIDGET(self->m_imagePopupMenu)); gtk_menu_popup_at_pointer(self->m_imagePopupMenu, (GdkEvent*)event); return TRUE; } void DialogBase::onChatHistoryInsertChildAnchor(GtkTextChildAnchor* anchor) { const char* path = (const char*)g_object_get_data(G_OBJECT(anchor), kObjectKeyImagePath); if (!path) { LOG_ERROR("No image path found in anchor."); return; } GtkWidget* event_box = gtk_event_box_new(); gtk_widget_set_focus_on_click(event_box, TRUE); GtkImage* image = igtk_image_new_with_size(path, 300, 300); if (!image) { LOG_ERROR("Failed to create image widget."); return; } g_object_set_data_full(G_OBJECT(image), kObjectKeyImagePath, g_strdup(path), g_free); gtk_container_add(GTK_CONTAINER(event_box), GTK_WIDGET(image)); g_signal_connect_swapped(event_box, "button-press-event", G_CALLBACK(DialogBase::OnImageButtonPress), this); gtk_text_view_add_child_at_anchor(this->chat_history_widget, event_box, anchor); gtk_widget_show_all(event_box); } void DialogBase::OnSaveImage(DialogBase* self) { GtkImage* image = self->m_activeImage; g_return_if_fail(!!image); const char* path = (const char*)g_object_get_data(G_OBJECT(image), kObjectKeyImagePath); if (!path) { LOG_ERROR("No image path found in image widget."); return; } GtkWidget* dialog = gtk_file_chooser_dialog_new( _("Save Image"), GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(image))), GTK_FILE_CHOOSER_ACTION_SAVE, _("_Cancel"), GTK_RESPONSE_CANCEL, _("_Save"), GTK_RESPONSE_ACCEPT, NULL); gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(dialog), TRUE); gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(dialog), "image.png"); if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) { char* save_path = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); GError* error = NULL; GFile* source = g_file_new_for_path(path); GFile* destination = g_file_new_for_path(save_path); gboolean success = g_file_copy(source, destination, G_FILE_COPY_OVERWRITE, NULL, NULL, NULL, &error); if (!success) { LOG_ERROR("Failed to save image: %s", error->message); g_error_free(error); } g_object_unref(source); g_object_unref(destination); g_free(save_path); } gtk_widget_destroy(dialog); } void DialogBase::OnCopyImage(DialogBase* self) { GtkImage* image = self->m_activeImage; g_return_if_fail(!!image); GdkPixbuf* pixbuf = gtk_image_get_pixbuf(image); if (!pixbuf) { LOG_ERROR("Failed to create pixbuf from image."); return; } GtkClipboard* clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD); gtk_clipboard_set_image(clipboard, pixbuf); } } // namespace iptux iptux-0.9.4/src/iptux/DialogBase.h000066400000000000000000000101131475473122500170060ustar00rootroot00000000000000// // C++ Interface: DialogBase // // Description: // 这个类是DialogPeer和DialogGroup的相同部分。尽量把相同的部分放在一起。 // // Author: // Author: cwll ,(C) 2012.02 // Jiejing.Zhang , (C) 2010 // Jally , (C) 2008 // // Copyright: See COPYING file that comes with this distribution // // #ifndef IPTUX_DIALOGBASE_H #define IPTUX_DIALOGBASE_H #include #include "iptux-core/Models.h" #include "iptux/Application.h" #include "iptux/UiModels.h" namespace iptux { class DialogBase : public SessionAbstract, public sigc::trackable { public: DialogBase(Application* app, GroupInfo* grp); virtual ~DialogBase(); virtual GtkWindow* getWindow() = 0; void ClearHistoryTextView(); void onChatHistoryInsertChildAnchor(GtkTextChildAnchor* anchor); protected: void InitSublayerGeneral(); void ClearSublayerGeneral(); void afterWindowCreated(); void ScrollHistoryTextview(); virtual void OnNewMessageComing(); void NotifyUser(); void AttachEnclosure(const GSList* list); /* UI general */ GtkWidget* CreateInputArea(); virtual GtkWidget* CreateHistoryArea(); virtual GtkWidget* CreateFileSendArea(); virtual GtkWidget* CreateFileSendTree(GtkTreeModel* model); virtual GSList* GetSelPal() { return NULL; }; void MainWindowSignalSetup(GtkWindow* window); GtkTreeModel* CreateFileSendModel(); GSList* PickEnclosure(FileAttr fileattr); GtkTextBuffer* getInputBuffer(); bool SendEnclosureMsg(); virtual bool SendTextMsg() = 0; /* TODO: Group SendTextMsg need add Picture */ void FeedbackMsg(const gchar* msg); virtual void BroadcastEnclosureMsg(const std::vector& files) = 0; virtual void populateInputPopup(GtkMenu* popup){}; // 回调部分 static void DialogDestory(DialogBase*); static gboolean ClearNotify(GtkWidget* window, GdkEventConfigure* event); static void DragDataReceived(DialogBase* dlgpr, GdkDragContext* context, gint x, gint y, GtkSelectionData* data, guint info, guint time); static void AttachRegular(DialogBase* dlgpr); static void AttachFolder(DialogBase* dlgpr); static void RemoveSelectedFromTree(GtkWidget* widget); static void SendMessage(DialogBase* dlggrp); static gboolean WindowConfigureEvent(GtkWidget* window, GdkEventConfigure* event, GData** dtset); static void PanedDivideChanged(GtkWidget* paned, GParamSpec* pspec, GData** dtset); static gint EnclosureTreePopup(DialogBase* self, GdkEvent* event); static gboolean UpdateFileSendUI(DialogBase* dlggrp); static void RemoveSelectedEnclosure(DialogBase* self); static void OnPasteClipboard(DialogBase* self, GtkTextView* textview); static void onInputPopulatePopup(DialogBase* self, GtkWidget* popup, GtkTextView* textview); static gboolean OnImageButtonPress(DialogBase* self, GdkEventButton* event, GtkEventBox* eventbox); static void OnSaveImage(DialogBase* self); static void OnCopyImage(DialogBase* self); protected: Application* app; std::shared_ptr progdt; GtkTextView* chat_history_widget = 0; GtkTreeView* fileSendTree = 0; GtkTextView* inputTextviewWidget = 0; GtkListStore* fileSendModel = 0; GData* widset; // 窗体集 GData* mdlset; // 数据model集 GData* dtset; // 通用数据集 GroupInfo* grpinf; // 群组信息 int64_t totalsendsize; // 总计待发送大小(包括已发送) struct timeval lasktime; // 上一次更新UI的时间 guint timersend; // 发送文件界面更新计时器ID private: GtkMenu* m_imagePopupMenu = 0; GtkImage* m_activeImage = 0; }; } // namespace iptux #endif iptux-0.9.4/src/iptux/DialogGroup.cpp000066400000000000000000000547271475473122500176060ustar00rootroot00000000000000// // C++ Implementation: DialogGroup // // Description: // // // Author: Jally , (C) 2008 // // Copyright: See COPYING file that comes with this distribution // // #include "config.h" #include "DialogGroup.h" #include #include #include "iptux-core/Const.h" #include "iptux-utils/output.h" #include "iptux-utils/utils.h" #include "iptux/DialogPeer.h" #include "iptux/UiCoreThread.h" #include "iptux/UiHelper.h" #include "iptux/callback.h" using namespace std; namespace iptux { /** * 类构造函数. * @param grp 群组信息 */ DialogGroup::DialogGroup(Application* app, GroupInfo* grp) : DialogBase(CHECK_NOTNULL(app), CHECK_NOTNULL(grp)), config(app->getConfig()) { InitSublayerSpecify(); } /** * 类析构函数. */ DialogGroup::~DialogGroup() { SaveUILayout(); } /** * 群组对话框入口. * @param grpinf 群组信息 */ DialogGroup* DialogGroup::GroupDialogEntry(Application* app, GroupInfo* grpinf) { CHECK_NOTNULL(grpinf); CHECK_NE(grpinf->getType(), GROUP_BELONG_TYPE_REGULAR); DialogGroup* dlggrp; GtkWidget *window, *widget; dlggrp = new DialogGroup(app, grpinf); window = GTK_WIDGET(dlggrp->CreateMainWindow()); dlggrp->CreateTitle(); gtk_container_add(GTK_CONTAINER(window), dlggrp->CreateAllArea()); gtk_widget_show_all(window); /* 将焦点置于文本输入框 */ widget = GTK_WIDGET(g_datalist_get_data(&dlggrp->widset, "input-textview-widget")); gtk_widget_grab_focus(widget); return dlggrp; } /** * 更新群组成员树(member-tree)指定项. * @param pal class PalInfo */ void DialogGroup::UpdatePalData(PalInfo* pal) { GtkIconTheme* theme; GdkPixbuf* pixbuf; GtkWidget* widget; GtkTreeModel* model; GtkTreeIter iter; gpointer data; gchar* file; /* 查询项所在的位置,若没有则添加 */ widget = GTK_WIDGET(g_datalist_get_data(&widset, "member-treeview-widget")); model = gtk_tree_view_get_model(GTK_TREE_VIEW(widget)); data = NULL; // 防止可能出现的(data == pal) if (gtk_tree_model_get_iter_first(model, &iter)) { do { gtk_tree_model_get(model, &iter, 3, &data, -1); if (data == pal) break; } while (gtk_tree_model_iter_next(model, &iter)); } if (data != pal) { gtk_list_store_append(GTK_LIST_STORE(model), &iter); gtk_list_store_set(GTK_LIST_STORE(model), &iter, 0, FALSE, 3, pal, -1); } /* 更新数据 */ theme = gtk_icon_theme_get_default(); file = iptux_erase_filename_suffix(pal->icon_file().c_str()); pixbuf = gtk_icon_theme_load_icon(theme, file, MAX_ICONSIZE, GtkIconLookupFlags(0), NULL); g_free(file); gtk_list_store_set(GTK_LIST_STORE(model), &iter, 1, pixbuf, 2, pal->getName().c_str(), -1); if (pixbuf) g_object_unref(pixbuf); } /** * 插入项到群组成员树(member-tree). * @param pal class PalInfo */ void DialogGroup::InsertPalData(PalInfo* pal) { GtkIconTheme* theme; GdkPixbuf* pixbuf; GtkWidget* widget; GtkTreeModel* model; GtkTreeIter iter; gchar* file; theme = gtk_icon_theme_get_default(); file = iptux_erase_filename_suffix(pal->icon_file().c_str()); pixbuf = gtk_icon_theme_load_icon(theme, file, MAX_ICONSIZE, GtkIconLookupFlags(0), NULL); g_free(file); widget = GTK_WIDGET(g_datalist_get_data(&widset, "member-treeview-widget")); model = gtk_tree_view_get_model(GTK_TREE_VIEW(widget)); gtk_list_store_append(GTK_LIST_STORE(model), &iter); gtk_list_store_set(GTK_LIST_STORE(model), &iter, 0, FALSE, 1, pixbuf, 2, pal->getName().c_str(), 3, pal, -1); if (pixbuf) g_object_unref(pixbuf); } /** * 从群组成员树(member-tree)删除指定项. * @param pal class PalInfo */ void DialogGroup::DelPalData(PalInfo* pal) { GtkWidget* widget; GtkTreeModel* model; GtkTreeIter iter; gpointer data; widget = GTK_WIDGET(g_datalist_get_data(&widset, "member-treeview-widget")); model = gtk_tree_view_get_model(GTK_TREE_VIEW(widget)); if (gtk_tree_model_get_iter_first(model, &iter)) { do { gtk_tree_model_get(model, &iter, 3, &data, -1); if (data == pal) { gtk_list_store_remove(GTK_LIST_STORE(model), &iter); break; } } while (gtk_tree_model_iter_next(model, &iter)); } } /** * 清除本群组所有好友数据. */ void DialogGroup::ClearAllPalData() { GtkWidget* widget; GtkTreeModel* model; widget = GTK_WIDGET(g_datalist_get_data(&widset, "member-treeview-widget")); model = gtk_tree_view_get_model(GTK_TREE_VIEW(widget)); gtk_list_store_clear(GTK_LIST_STORE(model)); } /** * 初始化底层数据. */ void DialogGroup::InitSublayerSpecify() { GtkTreeModel* model; model = CreateMemberModel(); g_datalist_set_data_full(&mdlset, "member-model", model, GDestroyNotify(g_object_unref)); FillMemberModel(model); } /** * 写出对话框的UI布局数据. */ void DialogGroup::SaveUILayout() { config->SetInt("group_window_width", GPOINTER_TO_INT(g_datalist_get_data(&dtset, "window-width"))); config->SetInt("group_window_height", GPOINTER_TO_INT(g_datalist_get_data(&dtset, "window-height"))); } /** * 创建主窗口. * @return 窗口 */ GtkWindow* DialogGroup::CreateMainWindow() { window = GTK_APPLICATION_WINDOW(gtk_application_window_new(app->getApp())); gtk_window_set_title(GTK_WINDOW(window), GetTitle().c_str()); gtk_window_set_default_size(GTK_WINDOW(window), config->GetInt("group_window_width", 500), config->GetInt("group_window_height", 350)); gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); g_datalist_set_data(&widset, "window-widget", window); widget_enable_dnd_uri(GTK_WIDGET(window)); grpinf->setDialogBase(this); MainWindowSignalSetup(GTK_WINDOW(window)); GActionEntry win_entries[] = { makeActionEntry("clear_chat_history", G_ACTION_CALLBACK(onClearChatHistory)), makeActionEntry("attach_file", G_ACTION_CALLBACK(onAttachFile)), makeActionEntry("attach_folder", G_ACTION_CALLBACK(onAttachFolder)), makeStateActionEntry("sort_type", G_ACTION_CALLBACK(onSortType), "s", "'ascending'"), makeStateActionEntry("sort_by", G_ACTION_CALLBACK(onSortBy), "s", "'nickname'"), makeActionEntry("send_message", G_ACTION_CALLBACK(onSendMessage)), }; g_action_map_add_action_entries(G_ACTION_MAP(window), win_entries, G_N_ELEMENTS(win_entries), this); afterWindowCreated(); return GTK_WINDOW(window); } /** * 创建所有区域. * @return 主窗体 */ GtkWidget* DialogGroup::CreateAllArea() { GtkWidget* box; box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); /* 加入主区域 */ mainPaned = gtk_paned_new(GTK_ORIENTATION_HORIZONTAL); gtk_paned_set_position(GTK_PANED(mainPaned), config->GetInt("group_main_paned_divide", 200)); gtk_box_pack_start(GTK_BOX(box), mainPaned, TRUE, TRUE, 0); g_signal_connect_swapped(mainPaned, "notify::position", G_CALLBACK(onUIChanged), this); /* 加入组成员&附件区域 */ memberEnclosurePaned = gtk_paned_new(GTK_ORIENTATION_VERTICAL); gtk_paned_set_position( GTK_PANED(memberEnclosurePaned), config->GetInt("group_memberenclosure_paned_divide", 100)); gtk_paned_pack1(GTK_PANED(mainPaned), memberEnclosurePaned, FALSE, FALSE); g_signal_connect_swapped(memberEnclosurePaned, "notify::position", G_CALLBACK(onUIChanged), this); gtk_paned_pack1(GTK_PANED(memberEnclosurePaned), CreateMemberArea(), TRUE, TRUE); gtk_paned_pack2(GTK_PANED(memberEnclosurePaned), CreateFileSendArea(), FALSE, TRUE); /* 加入聊天历史记录&输入区域 */ historyInputPaned = gtk_paned_new(GTK_ORIENTATION_VERTICAL); gtk_paned_set_position( GTK_PANED(historyInputPaned), config->GetInt("group_historyinput_paned_divide", 100)); gtk_paned_pack2(GTK_PANED(mainPaned), historyInputPaned, TRUE, TRUE); g_signal_connect_swapped(historyInputPaned, "notify::position", G_CALLBACK(onUIChanged), this); gtk_paned_pack1(GTK_PANED(historyInputPaned), CreateHistoryArea(), TRUE, TRUE); gtk_paned_pack2(GTK_PANED(historyInputPaned), DialogBase::CreateInputArea(), FALSE, TRUE); return box; } /** * 创建组成员区域. * @return 主窗体 */ GtkWidget* DialogGroup::CreateMemberArea() { GtkWidget *frame, *sw; GtkWidget* widget; GtkTreeModel* model; frame = gtk_frame_new(_("Member")); gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_ETCHED_IN); sw = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_ETCHED_IN); gtk_container_add(GTK_CONTAINER(frame), sw); model = GTK_TREE_MODEL(g_datalist_get_data(&mdlset, "member-model")); widget = CreateMemberTree(model); gtk_container_add(GTK_CONTAINER(sw), widget); g_signal_connect(widget, "button-press-event", G_CALLBACK(PopupPickMenu), NULL); g_signal_connect(widget, "row-activated", G_CALLBACK(MembertreeItemActivated), this); g_datalist_set_data(&widset, "member-treeview-widget", widget); return frame; } /** * 群组成员树(member-tree)底层数据结构. * 4,0 toggled,1 icon,2 nickname,3 data \n * 是否被选中;好友头像;好友昵称;好友数据 \n * @return member-model */ GtkTreeModel* DialogGroup::CreateMemberModel() { GtkListStore* model; model = gtk_list_store_new(4, G_TYPE_BOOLEAN, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_POINTER); gtk_tree_sortable_set_default_sort_func( GTK_TREE_SORTABLE(model), GtkTreeIterCompareFunc(MemberTreeCompareByNameFunc), NULL, NULL); gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(model), GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, GTK_SORT_ASCENDING); return GTK_TREE_MODEL(model); } /** * 为群组成员树(member-tree)填充底层数据. * @param model member-model */ void DialogGroup::FillMemberModel(GtkTreeModel* model) { GtkIconTheme* theme; GdkPixbuf* pixbuf; GtkTreeIter iter; PalInfo* pal; char* file; theme = gtk_icon_theme_get_default(); auto g_cthrd = app->getCoreThread(); g_cthrd->Lock(); for (auto ppal : grpinf->getMembers()) { pal = ppal.get(); file = iptux_erase_filename_suffix(pal->icon_file().c_str()); pixbuf = gtk_icon_theme_load_icon(theme, file, MAX_ICONSIZE, GtkIconLookupFlags(0), NULL); g_free(file); gtk_list_store_append(GTK_LIST_STORE(model), &iter); gtk_list_store_set(GTK_LIST_STORE(model), &iter, 0, TRUE, 1, pixbuf, 2, pal->getName().c_str(), 3, pal, -1); if (pixbuf) g_object_unref(pixbuf); } g_cthrd->Unlock(); } /** * 创建群组成员树(member-tree). * @param model member-model * @return 群组树 */ GtkWidget* DialogGroup::CreateMemberTree(GtkTreeModel* model) { GtkWidget* view; GtkTreeSelection* selection; GtkCellRenderer* cell; GtkTreeViewColumn* column; view = gtk_tree_view_new_with_model(model); gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(view), TRUE); selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view)); gtk_tree_selection_set_mode(selection, GTK_SELECTION_NONE); cell = gtk_cell_renderer_toggle_new(); g_signal_connect_swapped(cell, "toggled", G_CALLBACK(model_turn_select), model); column = gtk_tree_view_column_new_with_attributes(_("Send"), cell, "active", 0, NULL); gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_append_column(GTK_TREE_VIEW(view), column); column = gtk_tree_view_column_new(); gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_column_set_title(column, _("Pals")); cell = gtk_cell_renderer_pixbuf_new(); gtk_tree_view_column_pack_start(column, cell, FALSE); gtk_tree_view_column_set_attributes(column, cell, "pixbuf", 1, NULL); cell = gtk_cell_renderer_text_new(); gtk_tree_view_column_pack_start(column, cell, FALSE); gtk_tree_view_column_set_attributes(column, cell, "text", 2, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(view), column); return view; } /** * 向选中的好友广播附件消息. * @param list 文件链表 */ void DialogGroup::BroadcastEnclosureMsg(const vector& files) { GtkWidget* widget; GtkTreeModel* model; GtkTreeIter iter; gboolean active; PalInfo* pal; vector pals; /* 考察是否有成员 */ widget = GTK_WIDGET(g_datalist_get_data(&widset, "member-treeview-widget")); model = gtk_tree_view_get_model(GTK_TREE_VIEW(widget)); if (!gtk_tree_model_get_iter_first(model, &iter)) { return; } /* 向选中的成员发送附件 */ do { gtk_tree_model_get(model, &iter, 0, &active, 3, &pal, -1); if (active) { pals.push_back(pal); } } while (gtk_tree_model_iter_next(model, &iter)); app->getCoreThread()->BcstFileInfoEntry(pals, files); } /** * 向选中的好友广播文本消息. * @param msg 文本消息 */ void DialogGroup::BroadcastTextMsg(const gchar* msg) { GtkWidget* widget; GtkTreeModel* model; GtkTreeIter iter; gboolean active; uint32_t opttype; PalInfo* pal; /* 考察是否有成员 */ widget = GTK_WIDGET(g_datalist_get_data(&widset, "member-treeview-widget")); model = gtk_tree_view_get_model(GTK_TREE_VIEW(widget)); if (!gtk_tree_model_get_iter_first(model, &iter)) return; /* 向选中的成员发送数据 */ do { gtk_tree_model_get(model, &iter, 0, &active, 3, &pal, -1); if (active) { if (pal->isCompatible()) { switch (grpinf->getType()) { case GROUP_BELONG_TYPE_BROADCAST: opttype = IPTUX_BROADCASTOPT; break; case GROUP_BELONG_TYPE_GROUP: opttype = IPTUX_GROUPOPT; break; case GROUP_BELONG_TYPE_SEGMENT: opttype = IPTUX_SEGMENTOPT; break; case GROUP_BELONG_TYPE_REGULAR: default: opttype = IPTUX_REGULAROPT; break; } app->getCoreThread()->SendUnitMessage(pal->GetKey(), opttype, msg); } else { app->getCoreThread()->SendGroupMessage(pal->GetKey(), msg); } } } while (gtk_tree_model_iter_next(model, &iter)); } /** * 创建选择项的弹出菜单. * @param model model * @return 菜单 */ GtkWidget* DialogGroup::CreatePopupMenu(GtkTreeModel* model) { GtkWidget *menu, *menuitem; menu = gtk_menu_new(); menuitem = gtk_menu_item_new_with_label(_("Select All")); g_signal_connect_swapped(menuitem, "activate", G_CALLBACK(model_select_all), model); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); menuitem = gtk_menu_item_new_with_label(_("Reverse Select")); g_signal_connect_swapped(menuitem, "activate", G_CALLBACK(model_turn_all), model); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); menuitem = gtk_menu_item_new_with_label(_("Clear Up")); g_signal_connect_swapped(menuitem, "activate", G_CALLBACK(model_clear_all), model); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); return menu; } /** * 群组成员树(member-tree)按昵称排序的比较函数. * @param model member-model * @param a A GtkTreeIter in model * @param b Another GtkTreeIter in model * @return 比较值 */ gint DialogGroup::MemberTreeCompareByNameFunc(GtkTreeModel* model, GtkTreeIter* a, GtkTreeIter* b) { PalInfo *apal, *bpal; gint result; gtk_tree_model_get(model, a, 3, &apal, -1); gtk_tree_model_get(model, b, 3, &bpal, -1); result = strcmp(apal->getName().c_str(), bpal->getName().c_str()); return result; } /** * 设置群组成员树(member-tree)的比较函数. * @param menuitem radio-menu-item * @param model member-model */ void DialogGroup::SetMemberTreeSortFunc(GtkWidget* menuitem, GtkTreeModel* model) { GtkTreeIterCompareFunc func; if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(menuitem))) return; func = (GtkTreeIterCompareFunc)(g_object_get_data(G_OBJECT(menuitem), "compare-func")); gtk_tree_sortable_set_default_sort_func(GTK_TREE_SORTABLE(model), func, NULL, NULL); } /** * 设置群组成员树(member-tree)的排序方式. * @param menuitem radio-menu-item * @param model member-model */ void DialogGroup::SetMemberTreeSortType(GtkWidget* menuitem, GtkTreeModel* model) { GtkSortType type; if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(menuitem))) return; type = (GtkSortType)GPOINTER_TO_INT( g_object_get_data(G_OBJECT(menuitem), "sort-type")); gtk_tree_sortable_set_sort_column_id( GTK_TREE_SORTABLE(model), GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, type); } /** * 弹出选择项的菜单. * @param treeview tree-view * @param event event * @return Gtk+库所需 */ gboolean DialogGroup::PopupPickMenu(GtkWidget* treeview, GdkEventButton* event) { GtkWidget* menu; GtkTreeModel* model; if (!gdk_event_triggers_context_menu((GdkEvent*)event)) { return FALSE; } model = gtk_tree_view_get_model(GTK_TREE_VIEW(treeview)); menu = CreatePopupMenu(model); gtk_widget_show_all(menu); gtk_menu_popup_at_pointer(GTK_MENU(menu), NULL); return TRUE; } /** * 群组成员树(member-tree)项被激活. * @param treeview tree-view * @param path path * @param column column */ void DialogGroup::MembertreeItemActivated(GtkWidget* treeview, GtkTreePath* path, GtkTreeViewColumn*, DialogGroup* self) { GtkTreeModel* model; GtkTreeIter iter; PalInfo* pal; GroupInfo* grpinf; model = gtk_tree_view_get_model(GTK_TREE_VIEW(treeview)); gtk_tree_model_get_iter(model, &iter, path); gtk_tree_model_get(model, &iter, 3, &pal, -1); if ((grpinf = self->app->getCoreThread()->GetPalRegularItem(pal))) { if ((grpinf->getDialog())) gtk_window_present(GTK_WINDOW(grpinf->getDialog())); else DialogPeer::PeerDialogEntry(self->app, grpinf); } } bool DialogGroup::SendTextMsg() { GtkWidget* textview; GtkTextBuffer* buffer; GtkTextIter start, end; gchar* msg; /* 考察缓冲区内是否存在数据 */ textview = GTK_WIDGET(g_datalist_get_data(&widset, "input-textview-widget")); gtk_widget_grab_focus(textview); // 为下一次任务做准备 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview)); gtk_text_buffer_get_bounds(buffer, &start, &end); if (gtk_text_iter_equal(&start, &end)) return false; /* 获取数据并发送 */ msg = gtk_text_buffer_get_text(buffer, &start, &end, FALSE); gtk_text_buffer_delete(buffer, &start, &end); FeedbackMsg(msg); BroadcastTextMsg(msg); MsgPara msgpara(this->app->getMe()); msgpara.stype = MessageSourceType::SELF; app->getLogSystem()->communicateLog(&msgpara, "[STRING]%s", msg); g_free(msg); return true; } /** * 发送消息. * @param dlggrp 对话框类 */ void DialogGroup::SendMessage(DialogGroup* dlggrp) { dlggrp->SendEnclosureMsg(); dlggrp->SendTextMsg(); } /** * 获取待发送成员列表. * @return plist 获取待发送成员列表 * 调用该函数后须free plist */ GSList* DialogGroup::GetSelPal() { GtkWidget* widget; GtkTreeModel* model; GtkTreeIter iter; gboolean active; PalInfo* pal; GSList* plist; /* 考察是否有成员 */ widget = GTK_WIDGET(g_datalist_get_data(&widset, "member-treeview-widget")); model = gtk_tree_view_get_model(GTK_TREE_VIEW(widget)); if (!gtk_tree_model_get_iter_first(model, &iter)) return NULL; plist = NULL; do { gtk_tree_model_get(model, &iter, 0, &active, 3, &pal, -1); if (active) plist = g_slist_append(plist, pal); } while (gtk_tree_model_iter_next(model, &iter)); return plist; } void DialogGroup::onUIChanged(DialogGroup& self) { self.config->SetInt("group_main_paned_divide", gtk_paned_get_position(GTK_PANED(self.mainPaned))); self.config->SetInt( "group_memberenclosure_paned_divide", gtk_paned_get_position(GTK_PANED(self.memberEnclosurePaned))); self.config->SetInt( "group_historyinput_paned_divide", gtk_paned_get_position(GTK_PANED(self.historyInputPaned))); self.config->Save(); } void DialogGroup::onSortBy(GSimpleAction* action, GVariant* value, DialogGroup& self) { string sortBy = g_variant_get_string(value, nullptr); PalTreeModelSortKey key; if (sortBy == "nickname") { key = PalTreeModelSortKey::NICKNAME; } else if (sortBy == "ip") { key = PalTreeModelSortKey::IP; } else { LOG_WARN("unknown sort by: %s", sortBy.c_str()); return; } auto model = GTK_TREE_MODEL(g_datalist_get_data(&self.mdlset, "member-model")); palTreeModelSetSortKey(model, key); g_simple_action_set_state(action, value); } void DialogGroup::onSortType(GSimpleAction* action, GVariant* value, DialogGroup& self) { string sortType = g_variant_get_string(value, nullptr); GtkSortType type; if (sortType == "ascending") { type = GTK_SORT_ASCENDING; } else if (sortType == "descending") { type = GTK_SORT_DESCENDING; } else { LOG_WARN("unknown sorttype: %s", sortType.c_str()); return; } auto model = GTK_TREE_MODEL(g_datalist_get_data(&self.mdlset, "member-model")); gtk_tree_sortable_set_sort_column_id( GTK_TREE_SORTABLE(model), GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, type); g_simple_action_set_state(action, value); } void DialogGroup::CreateTitle() { if (app->use_header_bar()) { GtkHeaderBar* header_bar = CreateHeaderBar(GTK_WINDOW(window), app->menu()); gtk_header_bar_set_title(header_bar, GetTitle().c_str()); } } string DialogGroup::GetTitle() { return stringFormat(_("Talk with the group %s"), grpinf->name().c_str()); } } // namespace iptux iptux-0.9.4/src/iptux/DialogGroup.h000066400000000000000000000070741475473122500172440ustar00rootroot00000000000000// // C++ Interface: DialogGroup // // Description: // 与多人对话 // // Author: Jally , (C) 2008 // // Copyright: See COPYING file that comes with this distribution // // #ifndef IPTUX_DIALOGGROUP_H #define IPTUX_DIALOGGROUP_H #include "iptux-core/IptuxConfig.h" #include "iptux-core/Models.h" #include "iptux/Application.h" #include "iptux/DialogBase.h" namespace iptux { class DialogGroup : public DialogBase { public: DialogGroup(Application* app, GroupInfo* grp); virtual ~DialogGroup(); static DialogGroup* GroupDialogEntry(Application* app, GroupInfo* grpinf); void UpdatePalData(PalInfo* pal) override; void InsertPalData(PalInfo* pal) override; void DelPalData(PalInfo* pal) override; void ClearAllPalData() override; GSList* GetSelPal() override; GtkWindow* getWindow() override { return GTK_WINDOW(window); } private: GtkApplicationWindow* window; std::shared_ptr config; GtkWidget* mainPaned; GtkWidget* memberEnclosurePaned; GtkWidget* historyInputPaned; private: void InitSublayerSpecify(); void ReadUILayout(); void SaveUILayout(); GtkWindow* CreateMainWindow(); void CreateTitle(); GtkWidget* CreateAllArea(); GtkWidget* CreateMemberArea(); GtkWidget* CreateInputArea(); GtkTreeModel* CreateMemberModel(); void FillMemberModel(GtkTreeModel* model); GtkWidget* CreateMemberTree(GtkTreeModel* model); bool SendTextMsg() override; void BroadcastEnclosureMsg(const std::vector& files) override; void BroadcastTextMsg(const gchar* msg); std::string GetTitle(); static GtkWidget* CreatePopupMenu(GtkTreeModel* model); //回调处理部分 private: static void onUIChanged(DialogGroup& self); static gint MemberTreeCompareByNameFunc(GtkTreeModel* model, GtkTreeIter* a, GtkTreeIter* b); static gint MemberTreeCompareByIPFunc(GtkTreeModel* model, GtkTreeIter* a, GtkTreeIter* b); static void SetMemberTreeSortFunc(GtkWidget* menuitem, GtkTreeModel* model); static void SetMemberTreeSortType(GtkWidget* menuitem, GtkTreeModel* model); static void DragDataReceived(DialogGroup* dlggrp, GdkDragContext* context, gint x, gint y, GtkSelectionData* data, guint info, guint time); static gboolean PopupPickMenu(GtkWidget* treeview, GdkEventButton* event); static void MembertreeItemActivated(GtkWidget* treeview, GtkTreePath* path, GtkTreeViewColumn* column, DialogGroup* self); static void SendMessage(DialogGroup* dlggrp); static void onClearChatHistory(void*, void*, DialogGroup& self) { self.ClearHistoryTextView(); } static void onAttachFile(void*, void*, DialogGroup& self) { DialogBase::AttachRegular(&self); } static void onAttachFolder(void*, void*, DialogGroup& self) { DialogBase::AttachFolder(&self); } static void onSortType(GSimpleAction* action, GVariant* value, DialogGroup& self); static void onSortBy(GSimpleAction* action, GVariant* value, DialogGroup& self); static void onSendMessage(void*, void*, DialogGroup& self) { DialogBase::SendMessage(&self); } }; } // namespace iptux #endif iptux-0.9.4/src/iptux/DialogGroupTest.cpp000066400000000000000000000010731475473122500204300ustar00rootroot00000000000000#include "Application.h" #include "gtest/gtest.h" #include "iptux/DialogGroup.h" #include "iptux/TestHelper.h" using namespace std; using namespace iptux; TEST(DialogGroup, Constructor) { Application* app = CreateApplication(); auto pal = make_shared("127.0.0.1", 2425); pal->set_icon_file("pig"); GroupInfo groupInfo(GROUP_BELONG_TYPE_SEGMENT, vector({pal}), app->getMe(), "groupname", nullptr); DialogGroup* dialog = DialogGroup::GroupDialogEntry(app, &groupInfo); delete dialog; DestroyApplication(app); } iptux-0.9.4/src/iptux/DialogPeer.cpp000066400000000000000000001125031475473122500173700ustar00rootroot00000000000000// // C++ Implementation: DialogPeer // // Description: // // // Author: cwll ,(C) 2012.02 // Jally , (C) 2008 // // Copyright: See COPYING file that comes with this distribution // // #include "config.h" #include "DialogPeer.h" #include "UiModels.h" #include "iptux-core/Models.h" #include #include #include #include #include #include #include "iptux-core/Const.h" #include "iptux-utils/output.h" #include "iptux-utils/utils.h" #include "iptux/UiCoreThread.h" #include "iptux/UiHelper.h" #include "iptux/callback.h" #include "iptux/dialog.h" using namespace std; namespace iptux { /** * 类构造函数. * @param grp 好友群组信息 */ DialogPeer::DialogPeer(Application* app, GroupInfo* grp) : DialogBase(CHECK_NOTNULL(app), CHECK_NOTNULL(grp)), config(app->getConfig()), torcvsize(0), rcvdsize(0), timerrcv(0) { ReadUILayout(); grp->signalNewFileReceived.connect( sigc::mem_fun(*this, &DialogPeer::onNewFileReceived)); app->getCoreThread()->sigGroupInfoUpdated.connect( sigc::mem_fun(*this, &DialogPeer::onGroupInfoUpdated)); init(); } /** * 类析构函数. */ DialogPeer::~DialogPeer() { g_signal_handler_disconnect(G_OBJECT(grpinf->getInputBuffer()), sigId); /* 非常重要,必须在窗口析构之前把定时触发事件停止,不然会出现意想不到的情况 */ if (timerrcv > 0) g_source_remove(timerrcv); WriteUILayout(); } /** * 好友对话框入口. * @param grpinf 好友群组信息 */ void DialogPeer::PeerDialogEntry(Application* app, GroupInfo* grpinf) { if (grpinf->getDialog()) return; new DialogPeer(app, grpinf); } void DialogPeer::init() { auto dlgpr = this; auto window = GTK_WIDGET(dlgpr->CreateMainWindow()); grpinf->setDialogBase(this); CreateTitle(); gtk_container_add(GTK_CONTAINER(window), dlgpr->CreateAllArea()); gtk_widget_show_all(window); gtk_widget_grab_focus(GTK_WIDGET(inputTextviewWidget)); GActionEntry win_entries[] = { makeActionEntry("attach_file", G_ACTION_CALLBACK(onAttachFile)), makeActionEntry("attach_folder", G_ACTION_CALLBACK(onAttachFolder)), makeActionEntry("clear_chat_history", G_ACTION_CALLBACK(onClearChatHistory)), makeActionEntry("refuse", G_ACTION_CALLBACK(onRefuse)), makeActionEntry("refuse_all", G_ACTION_CALLBACK(onRefuseAll)), makeActionEntry("insert_image", G_ACTION_CALLBACK(onInsertImage)), makeActionEntry("request_shared_resources", G_ACTION_CALLBACK(onRequestSharedResources)), makeActionEntry("send_message", G_ACTION_CALLBACK(onSendMessage)), makeActionEntry("paste", G_ACTION_CALLBACK(onPaste)), }; g_action_map_add_action_entries(G_ACTION_MAP(window), win_entries, G_N_ELEMENTS(win_entries), this); g_action_map_disable_actions(G_ACTION_MAP(window), "refuse", nullptr); sigId = g_signal_connect(G_OBJECT(getInputBuffer()), "changed", G_CALLBACK(onInputBufferChanged), this); g_signal_connect_swapped(G_OBJECT(fileSendModel), "row-deleted", G_CALLBACK(onSendFileModelChanged), this); g_signal_connect_swapped(G_OBJECT(fileSendModel), "row-inserted", G_CALLBACK(onSendFileModelChanged), this); refreshSendAction(); } /** * 更新好友信息. * @param pal 好友信息 */ void DialogPeer::UpdatePalData(PalInfo* pal) { GtkWidget* textview; GtkTextBuffer* buffer; GtkTextIter start, end; textview = GTK_WIDGET(g_datalist_get_data(&widset, "info-textview-widget")); buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview)); gtk_text_buffer_get_bounds(buffer, &start, &end); gtk_text_buffer_delete(buffer, &start, &end); FillPalInfoToBuffer(buffer, pal); refreshTitle(); } string DialogPeer::GetTitle() { auto palinfor = grpinf->getMembers()[0].get(); return stringFormat(_("Talk with %s(%s) IP:%s"), palinfor->getName().c_str(), palinfor->getHost().c_str(), inAddrToString(palinfor->ipv4()).c_str()); } void DialogPeer::refreshTitle() { gtk_window_set_title(GTK_WINDOW(window), GetTitle().c_str()); } /** * 插入好友数据. * @param pal 好友信息 */ void DialogPeer::InsertPalData(PalInfo*) { // 此函数暂且无须实现 } /** * 删除好友数据. * @param pal 好友信息 */ void DialogPeer::DelPalData(PalInfo*) { // 此函数暂且无须实现 } /** * 清除本群组所有好友数据. */ void DialogPeer::ClearAllPalData() { // 此函数暂且无须实现 } /** * 读取对话框的UI布局数据. */ void DialogPeer::ReadUILayout() { g_datalist_set_data( &dtset, "window-width", GINT_TO_POINTER(config->GetInt("peer_window_width", 570))); g_datalist_set_data( &dtset, "window-height", GINT_TO_POINTER(config->GetInt("peer_window_height", 420))); g_datalist_set_data( &dtset, "main-paned-divide", GINT_TO_POINTER(config->GetInt("peer_main_paned_divide", 375))); g_datalist_set_data( &dtset, "historyinput-paned-divide", GINT_TO_POINTER(config->GetInt("peer_historyinput_paned_divide", 255))); g_datalist_set_data( &dtset, "infoenclosure-paned-divide", GINT_TO_POINTER(config->GetInt("peer_infoenclosure_paned_divide", 255))); g_datalist_set_data( &dtset, "enclosure-paned-divide", GINT_TO_POINTER(config->GetInt("peer_enclosure_paned_divide", 280))); g_datalist_set_data( &dtset, "file-receive-paned-divide", GINT_TO_POINTER(config->GetInt("peer_file_recieve_paned_divide", 140))); } /** * 保存对话框的UI布局数据. */ void DialogPeer::WriteUILayout() { config->SetInt("peer_window_width", GPOINTER_TO_INT(g_datalist_get_data(&dtset, "window-width"))); config->SetInt("peer_window_height", GPOINTER_TO_INT(g_datalist_get_data(&dtset, "window-height"))); config->SetInt("peer_main_paned_divide", GPOINTER_TO_INT(g_datalist_get_data( &dtset, "main-paned-divide"))); config->SetInt("peer_historyinput_paned_divide", GPOINTER_TO_INT( g_datalist_get_data(&dtset, "historyinput-paned-divide"))); config->SetInt("peer_infoenclosure_paned_divide", GPOINTER_TO_INT(g_datalist_get_data( &dtset, "infoenclosure-paned-divide"))); config->SetInt( "peer_enclosure_paned_divide", GPOINTER_TO_INT(g_datalist_get_data(&dtset, "enclosure-paned-divide"))); config->SetInt("peer_file_recieve_paned_divide", GPOINTER_TO_INT( g_datalist_get_data(&dtset, "file-receive-paned-divide"))); config->Save(); } /** * 创建主窗口. * @return 窗口 */ GtkWindow* DialogPeer::CreateMainWindow() { gint width, height; window = GTK_APPLICATION_WINDOW(gtk_application_window_new(app->getApp())); refreshTitle(); width = GPOINTER_TO_INT(g_datalist_get_data(&dtset, "window-width")); height = GPOINTER_TO_INT(g_datalist_get_data(&dtset, "window-height")); gtk_window_set_default_size(GTK_WINDOW(window), width, height); gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); widget_enable_dnd_uri(GTK_WIDGET(window)); g_datalist_set_data(&widset, "window-widget", window); g_object_set_data(G_OBJECT(window), "dialog", this); MainWindowSignalSetup(GTK_WINDOW(window)); g_signal_connect_swapped(GTK_WIDGET(window), "show", G_CALLBACK(ShowDialogPeer), this); afterWindowCreated(); return GTK_WINDOW(window); } void DialogPeer::CreateTitle() { if (app->use_header_bar()) { GtkHeaderBar* headerBar = CreateHeaderBar(GTK_WINDOW(window), app->menu()); gtk_header_bar_set_title(headerBar, GetTitle().c_str()); } } /** * 创建所有区域. * @return 主窗体 */ GtkWidget* DialogPeer::CreateAllArea() { GtkWidget* box; GtkWidget *hpaned, *vpaned; gint position; box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); /* 加入主区域 */ hpaned = gtk_paned_new(GTK_ORIENTATION_HORIZONTAL); g_datalist_set_data(&widset, "main-paned", hpaned); g_object_set_data(G_OBJECT(hpaned), "position-name", (gpointer) "main-paned-divide"); position = GPOINTER_TO_INT(g_datalist_get_data(&dtset, "main-paned-divide")); gtk_paned_set_position(GTK_PANED(hpaned), position); gtk_box_pack_start(GTK_BOX(box), hpaned, TRUE, TRUE, 0); g_signal_connect(hpaned, "notify::position", G_CALLBACK(PanedDivideChanged), &dtset); /* 加入聊天历史记录&输入区域 */ vpaned = gtk_paned_new(GTK_ORIENTATION_VERTICAL); g_object_set_data(G_OBJECT(vpaned), "position-name", (gpointer) "historyinput-paned-divide"); position = GPOINTER_TO_INT(g_datalist_get_data(&dtset, "historyinput-paned-divide")); gtk_paned_set_position(GTK_PANED(vpaned), position); gtk_paned_pack1(GTK_PANED(hpaned), vpaned, TRUE, TRUE); g_signal_connect(vpaned, "notify::position", G_CALLBACK(PanedDivideChanged), &dtset); gtk_paned_pack1(GTK_PANED(vpaned), CreateHistoryArea(), TRUE, TRUE); gtk_paned_pack2(GTK_PANED(vpaned), CreateInputArea(), FALSE, TRUE); /* 加入好友信息&附件区域 */ vpaned = gtk_paned_new(GTK_ORIENTATION_VERTICAL); g_object_set_data(G_OBJECT(vpaned), "position-name", (gpointer) "infoenclosure-paned-divide"); position = GPOINTER_TO_INT( g_datalist_get_data(&dtset, "infoenclosure-paned-divide")); gtk_paned_set_position(GTK_PANED(vpaned), position); gtk_paned_pack2(GTK_PANED(hpaned), vpaned, FALSE, TRUE); g_signal_connect(vpaned, "notify::position", G_CALLBACK(PanedDivideChanged), &dtset); gtk_paned_pack1(GTK_PANED(vpaned), CreateInfoArea(), TRUE, TRUE); gtk_paned_pack2(GTK_PANED(vpaned), CreateFileArea(), FALSE, TRUE); return box; } /** * 创建好友信息区域. * @return 主窗体 */ GtkWidget* DialogPeer::CreateInfoArea() { GtkWidget *frame, *sw; GtkWidget* widget; GtkTextBuffer* buffer; frame = gtk_frame_new(_("Info.")); g_datalist_set_data(&widset, "info-frame", frame); gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_ETCHED_IN); sw = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_ETCHED_IN); gtk_container_add(GTK_CONTAINER(frame), sw); buffer = gtk_text_buffer_new(app->getCoreThread()->tag_table()); FillPalInfoToBuffer(buffer, grpinf->getMembers()[0].get()); widget = gtk_text_view_new_with_buffer(buffer); gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(widget), FALSE); gtk_text_view_set_editable(GTK_TEXT_VIEW(widget), FALSE); gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(widget), GTK_WRAP_WORD_CHAR); gtk_container_add(GTK_CONTAINER(sw), widget); g_datalist_set_data(&widset, "info-textview-widget", widget); return frame; } /** * 将好友信息数据写入指定的缓冲区. * @param buffer text-buffer * @param pal class PalInfo */ void DialogPeer::FillPalInfoToBuffer(GtkTextBuffer* buffer, PalInfo* pal) { GdkPixbuf* pixbuf; GtkTextIter iter; string buf; buf += stringFormat(_("Version: %s\n"), pal->getVersion().c_str()); if (!pal->getGroup().empty()) buf += stringFormat(_("Nickname: %s@%s\n"), pal->getName().c_str(), pal->getGroup().c_str()); else buf += stringFormat(_("Nickname: %s\n"), pal->getName().c_str()); buf += stringFormat(_("User: %s\n"), pal->getUser().c_str()); buf += stringFormat(_("Host: %s\n"), pal->getHost().c_str()); string ipstr = inAddrToString(pal->ipv4()); if (pal->segdes && *pal->segdes != '\0') buf += stringFormat(_("Address: %s(%s)\n"), pal->segdes, ipstr.c_str()); else buf += stringFormat(_("Address: %s\n"), ipstr.c_str()); if (!pal->isCompatible()) { buf += _("Compatibility: Microsoft\n"); } else { buf += _("Compatibility: GNU/Linux\n"); } buf += stringFormat(_("System coding: %s\n"), pal->getEncode().c_str()); gtk_text_buffer_set_text(buffer, buf.c_str(), -1); gtk_text_buffer_get_end_iter(buffer, &iter); if (pal->sign && *pal->sign != '\0') { gtk_text_buffer_insert(buffer, &iter, _("Signature:\n"), -1); gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, pal->sign, -1, "sign-words", NULL); } if (pal->photo && *pal->photo != '\0' && (pixbuf = gdk_pixbuf_new_from_file(pal->photo, NULL))) { gtk_text_buffer_insert(buffer, &iter, _("\nPhoto:\n"), -1); // TODO 缩放多少才合适 pixbuf_shrink_scale_1(&pixbuf, 200, -1); gtk_text_buffer_insert_pixbuf(buffer, &iter, pixbuf); g_object_unref(pixbuf); } } /** * 发送附件给好友 */ void DialogPeer::BroadcastEnclosureMsg(const vector& files) { vector pals; pals.push_back(grpinf->getMembers()[0].get()); this->app->getCoreThread()->BcstFileInfoEntry(pals, files); } /** * 发送文本消息. * @return 是否发送数据 */ bool DialogPeer::SendTextMsg() { gtk_widget_grab_focus(GTK_WIDGET(inputTextviewWidget)); // 为下一次任务做准备 if (grpinf->isInputEmpty()) { return false; } shared_ptr para = grpinf->genMsgParaFromInput(); grpinf->clearInputBuffer(); /* 清空缓冲区并发送数据 */ FeedbackMsg(para); app->getCoreThread()->AsyncSendMsgPara(para); return true; } /** * 回馈消息. * @param dtlist 数据链表 * @note 请不要修改链表(dtlist)中的数据 */ void DialogPeer::FeedbackMsg(shared_ptr msgPara) { MsgPara para(grpinf->getMembers()[0]); para.stype = MessageSourceType::SELF; para.btype = grpinf->getType(); para.dtlist = msgPara->dtlist; grpinf->addMsgPara(para); } /** * 封装消息. * @param dtlist 数据链表 * @return 消息封装包 */ MsgPara* DialogPeer::PackageMsg(const std::vector& dtlist) { MsgPara* para; auto g_cthrd = app->getCoreThread(); para = new MsgPara(grpinf->getMembers()[0]); para->stype = MessageSourceType::SELF; para->btype = grpinf->getType(); para->dtlist = dtlist; return para; } /** * 请求获取此好友的共享文件. * @param grpinf 好友群组信息 */ void DialogPeer::onRequestSharedResources(void*, void*, DialogPeer& self) { auto g_cthrd = self.app->getCoreThread(); g_cthrd->SendAskShared(self.grpinf->getMembers()[0]); } void DialogPeer::onPaste(void*, void*, DialogPeer* self) { GtkTextView* textview = GTK_TEXT_VIEW(self->inputTextviewWidget); g_signal_emit_by_name(textview, "paste-clipboard"); } void DialogPeer::insertImage() { GtkWidget* widget; GtkTextBuffer* buffer; GtkTextIter iter; GdkPixbuf* pixbuf; gchar* filename; gint position; GError* error = nullptr; if (!(filename = choose_file_with_preview( _("Please select a picture to insert the buffer"), GTK_WIDGET(window)))) return; if (!(pixbuf = gdk_pixbuf_new_from_file(filename, &error))) { LOG_WARN("failed to load image: %s", error->message); g_error_free(error); error = nullptr; g_free(filename); return; } g_free(filename); widget = GTK_WIDGET(g_datalist_get_data(&widset, "input-textview-widget")); buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(widget)); g_object_get(buffer, "cursor-position", &position, NULL); gtk_text_buffer_get_iter_at_offset(buffer, &iter, position); gtk_text_buffer_insert_pixbuf(buffer, &iter, pixbuf); g_object_unref(pixbuf); } void DialogPeer::populateInputPopup(GtkMenu* popup) { GtkWidget* menuitem = gtk_separator_menu_item_new(); gtk_widget_show(menuitem); gtk_menu_shell_append(GTK_MENU_SHELL(popup), menuitem); menuitem = gtk_menu_item_new_with_label(_("Insert Image")); g_signal_connect_swapped(menuitem, "activate", G_CALLBACK(DialogPeer::onInsertImageFromPopup), this); gtk_widget_show(menuitem); gtk_menu_shell_append(GTK_MENU_SHELL(popup), menuitem); } /** * 创建文件接收和发送区域. * @return 主窗体 */ GtkWidget* DialogPeer::CreateFileArea() { GtkWidget *frame, *vpaned; gint position; frame = gtk_frame_new(_("Enclosure.")); g_datalist_set_data(&widset, "file-enclosure-frame-widget", frame); gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_ETCHED_IN); vpaned = gtk_paned_new(GTK_ORIENTATION_VERTICAL); g_object_set_data(G_OBJECT(vpaned), "position-name", (gpointer) "enclosure-paned-divide"); position = GPOINTER_TO_INT(g_datalist_get_data(&dtset, "enclosure-paned-divide")); gtk_paned_set_position(GTK_PANED(vpaned), position); g_signal_connect(vpaned, "notify::position", G_CALLBACK(PanedDivideChanged), &dtset); gtk_container_add(GTK_CONTAINER(frame), vpaned); gtk_paned_pack1(GTK_PANED(vpaned), CreateFileReceiveArea(), TRUE, TRUE); gtk_paned_pack2(GTK_PANED(vpaned), CreateFileSendArea(), FALSE, TRUE); return frame; } /** * 创建文件接收区域. * @return 主窗体 */ GtkWidget* DialogPeer::CreateFileReceiveArea() { GtkWidget* vpaned; gint position; vpaned = gtk_paned_new(GTK_ORIENTATION_VERTICAL); g_datalist_set_data(&widset, "file-receive-paned-widget", vpaned); g_object_set_data(G_OBJECT(vpaned), "position-name", (gpointer) "file-receive-paned-divide"); position = GPOINTER_TO_INT(g_datalist_get_data(&dtset, "file-receive-paned-divide")); gtk_paned_set_position(GTK_PANED(vpaned), position); g_signal_connect(vpaned, "notify::position", G_CALLBACK(PanedDivideChanged), &dtset); gtk_paned_pack1(GTK_PANED(vpaned), CreateFileToReceiveArea(), TRUE, FALSE); gtk_paned_pack2(GTK_PANED(vpaned), CreateFileReceivedArea(), TRUE, FALSE); return vpaned; } /** * 创建待接收文件区域. * @return 主窗体 */ GtkWidget* DialogPeer::CreateFileToReceiveArea() { GtkWidget *frame, *hbox, *vbox, *button, *pbar, *sw, *treeview; GtkTreeModel* model; frame = gtk_frame_new(_("Files to be received")); gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_ETCHED_IN); pbar = gtk_progress_bar_new(); g_datalist_set_data(&widset, "file-receive-progress-bar-widget", pbar); gtk_progress_bar_set_text(GTK_PROGRESS_BAR(pbar), _("Receiving progress.")); hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 1); gtk_box_pack_start(GTK_BOX(hbox), pbar, TRUE, TRUE, 0); button = gtk_button_new_with_label(_("Accept")); g_signal_connect_swapped(button, "clicked", G_CALLBACK(onAcceptButtonClicked), this); g_datalist_set_data(&widset, "file-receive-accept-button", button); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, TRUE, 0); button = gtk_button_new_with_label(_("Refuse")); gtk_actionable_set_action_name(GTK_ACTIONABLE(button), "win.refuse"); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, TRUE, 0); g_datalist_set_data(&widset, "file-receive-refuse-button", button); button = gtk_button_new_with_label(_("Detail")); gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, TRUE, 0); gtk_actionable_set_action_name(GTK_ACTIONABLE(button), "app.tools.transmission"); vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); sw = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_ETCHED_IN); model = CreateFileToReceiveModel(); g_datalist_set_data_full(&mdlset, "file-to-receive-model", model, GDestroyNotify(g_object_unref)); treeview = CreateFileToReceiveTree(model); this->fileToReceiveTreeviewWidget = treeview; g_object_set_data(G_OBJECT(treeview), "dialog", this); gtk_container_add(GTK_CONTAINER(sw), treeview); gtk_box_pack_end(GTK_BOX(vbox), sw, TRUE, TRUE, 0); gtk_container_add(GTK_CONTAINER(frame), vbox); return frame; } /** * 创建已接收文件区域. * @return 主窗体 */ GtkWidget* DialogPeer::CreateFileReceivedArea() { GtkWidget *frame, *sw, *treeview; GtkTreeModel* model; frame = gtk_frame_new(_("File received.")); gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_ETCHED_IN); sw = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_ETCHED_IN); model = CreateFileReceivedModel(); g_datalist_set_data_full(&mdlset, "file-received-model", model, GDestroyNotify(g_object_unref)); treeview = CreateFileReceivedTree(model); g_datalist_set_data(&widset, "file-received-treeview-widget", treeview); g_object_set_data(G_OBJECT(treeview), "dialog", this); gtk_container_add(GTK_CONTAINER(sw), treeview); gtk_container_add(GTK_CONTAINER(frame), sw); return frame; } /** * 创建待接收文件树(FileToReceive-tree). * @param model FileToReceive-model * @return 待接收文件树 */ GtkWidget* DialogPeer::CreateFileToReceiveTree(GtkTreeModel* model) { GtkWidget* view; GtkTreeSelection* selection; GtkCellRenderer* cell; GtkTreeViewColumn* column; view = gtk_tree_view_new_with_model(model); this->fileToReceiveTree = GTK_TREE_VIEW(view); gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(view), TRUE); selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view)); gtk_tree_selection_set_mode(selection, GTK_SELECTION_MULTIPLE); cell = gtk_cell_renderer_pixbuf_new(); column = gtk_tree_view_column_new_with_attributes("", cell, "icon-name", 0, NULL); gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_append_column(GTK_TREE_VIEW(view), column); cell = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes(_("Source"), cell, "text", 1, NULL); gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_append_column(GTK_TREE_VIEW(view), column); cell = gtk_cell_renderer_text_new(); g_object_set(cell, "editable", TRUE, NULL); column = gtk_tree_view_column_new_with_attributes(_("SaveAs"), cell, "text", 2, NULL); gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_append_column(GTK_TREE_VIEW(view), column); cell = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes(_("Size"), cell, "text", 3, NULL); gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_append_column(GTK_TREE_VIEW(view), column); g_signal_connect(GTK_WIDGET(view), "button_press_event", G_CALLBACK(RcvTreePopup), this); g_signal_connect_swapped(selection, "changed", G_CALLBACK(onRecvTreeSelectionChanged), this); return view; } void DialogPeer::onRecvTreeSelectionChanged(DialogPeer& self, GtkTreeSelection* selection) { gint count = gtk_tree_selection_count_selected_rows(selection); if (count > 0) { g_action_map_enable_actions(G_ACTION_MAP(self.window), "refuse", nullptr); } else { g_action_map_disable_actions(G_ACTION_MAP(self.window), "refuse", nullptr); } } /** * 创建待接收文件树底层数据结构. * @return FileToReceive-model */ GtkTreeModel* DialogPeer::CreateFileToReceiveModel() { GtkListStore* model; model = gtk_list_store_new(6, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER); return GTK_TREE_MODEL(model); } /** * 创建已接收文件树(FileReceived-tree). * @param model FileReceived-model * @return 已接收文件树 */ GtkWidget* DialogPeer::CreateFileReceivedTree(GtkTreeModel* model) { GtkWidget* view; GtkTreeSelection* selection; GtkCellRenderer* cell; GtkTreeViewColumn* column; view = gtk_tree_view_new_with_model(model); gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(view), TRUE); selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view)); gtk_tree_selection_set_mode(selection, GTK_SELECTION_SINGLE); cell = gtk_cell_renderer_pixbuf_new(); column = gtk_tree_view_column_new_with_attributes("", cell, "icon-name", 0, NULL); gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_append_column(GTK_TREE_VIEW(view), column); cell = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes(_("Source"), cell, "text", 1, NULL); gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_append_column(GTK_TREE_VIEW(view), column); cell = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes(_("Name"), cell, "text", 2, NULL); gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_append_column(GTK_TREE_VIEW(view), column); cell = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes(_("Size"), cell, "text", 3, NULL); gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_append_column(GTK_TREE_VIEW(view), column); g_signal_connect(GTK_WIDGET(view), "button_press_event", G_CALLBACK(RcvTreePopup), this); return view; } /** * 创建已接收文件树底层数据结构. * @return FileReceived-model */ GtkTreeModel* DialogPeer::CreateFileReceivedModel() { GtkListStore* model; model = gtk_list_store_new(6, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER); return GTK_TREE_MODEL(model); } /** * 显示信息/文件接收UI(是否显示信息或文件接收). * */ void DialogPeer::ShowInfoEnclosure(DialogPeer* dlgpr) { PalInfo* palinfor; GtkTreeModel *mdltorcv, *mdlrcvd, *mdltmp; GSList* ecslist; GtkWidget *widget, *hpaned, *pbar; float progress = 0.0; const char* iconname; FileInfo* file; gchar *filesize, *path; char progresstip[MAX_BUFLEN]; GtkTreeIter iter; gint receiving; // 标记是不是窗口在正传送文件时被关闭,又打开的。 receiving = 0; // 设置界面显示 palinfor = dlgpr->grpinf->getMembers()[0].get(); mdltorcv = (GtkTreeModel*)g_datalist_get_data(&(dlgpr->mdlset), "file-to-receive-model"); gtk_list_store_clear(GTK_LIST_STORE(mdltorcv)); mdlrcvd = (GtkTreeModel*)g_datalist_get_data(&(dlgpr->mdlset), "file-received-model"); gtk_list_store_clear(GTK_LIST_STORE(mdlrcvd)); ecslist = dlgpr->app->getCoreThread()->GetPalEnclosure(palinfor); if (ecslist) { // 只要有该好友的接收文件信息(不分待接收和未接收),就显示 hpaned = GTK_WIDGET(g_datalist_get_data(&(dlgpr->widset), "main-paned")); widget = GTK_WIDGET(g_datalist_get_data(&(dlgpr->widset), "info-frame")); gtk_widget_hide(widget); widget = GTK_WIDGET( g_datalist_get_data(&(dlgpr->widset), "file-enclosure-frame-widget")); gtk_paned_pack2(GTK_PANED(hpaned), widget, FALSE, TRUE); widget = GTK_WIDGET( g_datalist_get_data(&(dlgpr->widset), "file-receive-paned-widget")); gtk_widget_show(widget); // 将从中心节点取到的数据向附件接收列表填充 dlgpr->torcvsize = 0; while (ecslist) { file = (FileInfo*)ecslist->data; filesize = numeric_to_size(file->filesize); switch (file->fileattr) { case FileAttr::REGULAR: iconname = "text-x-generic-symbolic"; break; case FileAttr::DIRECTORY: iconname = "folder-symbolic"; break; default: iconname = NULL; break; } if (file->finishedsize < file->filesize) { file->filepath = ipmsg_get_filename_me(file->filepath, &path); if (file->finishedsize > 0) receiving += 1; mdltmp = mdltorcv; dlgpr->torcvsize += file->filesize; } else mdltmp = mdlrcvd; gtk_list_store_append(GTK_LIST_STORE(mdltmp), &iter); gtk_list_store_set(GTK_LIST_STORE(mdltmp), &iter, 0, iconname, 1, file->fileown->getName().c_str(), 2, file->filepath, 3, filesize, 5, file, -1); g_free(filesize); ecslist = g_slist_next(ecslist); } g_slist_free(ecslist); // 设置进度条,如果接收完成重新载入待接收和已接收列表 if (dlgpr->torcvsize == 0) { progress = 0; snprintf(progresstip, MAX_BUFLEN, "%s", _("Receiving Progress.")); } else { if (dlgpr->rcvdsize == 0) snprintf(progresstip, MAX_BUFLEN, _("%s to Receive."), numeric_to_size(dlgpr->torcvsize)); else { progress = percent(dlgpr->rcvdsize, dlgpr->torcvsize) / 100; snprintf(progresstip, MAX_BUFLEN, _("%s Of %s Received."), numeric_to_size(dlgpr->rcvdsize), numeric_to_size(dlgpr->torcvsize)); } } if (progress == 1.0) { if (dlgpr->timerrcv > 0) { g_source_remove(dlgpr->timerrcv); dlgpr->timerrcv = 0; } snprintf(progresstip, MAX_BUFLEN, "%s", _("Mission Completed!")); } pbar = GTK_WIDGET(g_datalist_get_data(&(dlgpr->widset), "file-receive-progress-bar-widget")); gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(pbar), progress); gtk_progress_bar_set_text(GTK_PROGRESS_BAR(pbar), progresstip); } else { widget = GTK_WIDGET( g_datalist_get_data(&(dlgpr->widset), "file-receive-paned-widget")); gtk_widget_hide(widget); } if (receiving > 0) dlgpr->onAcceptButtonClicked(dlgpr); } /** * 显示窗口事件响应函数. *@param dlgpr 对话框类 * */ bool DialogPeer::UpdataEnclosureRcvUI(DialogPeer* dlgpr) { GtkTreeModel* model; GtkWidget *pbar, *button; float progress = 0.0; FileInfo* file; GtkTreeIter iter; char progresstip[MAX_BUFLEN]; // 处理待接收文件界面显示 model = (GtkTreeModel*)g_datalist_get_data(&(dlgpr->mdlset), "file-to-receive-model"); if (!model) { g_source_remove(dlgpr->timerrcv); dlgpr->timerrcv = 0; return FALSE; } dlgpr->rcvdsize = 0; if (gtk_tree_model_get_iter_first(model, &iter)) { do { // 遍历待接收model gtk_tree_model_get(model, &iter, 5, &file, -1); if (file->finishedsize == file->filesize) { gtk_list_store_set(GTK_LIST_STORE(model), &iter, 0, "tip-finish", -1); } dlgpr->rcvdsize += file->finishedsize; } while (gtk_tree_model_iter_next(model, &iter)); } // 设置进度条,如果接收完成重新载入待接收和已接收列表 if (dlgpr->torcvsize == 0) { progress = 0; snprintf(progresstip, MAX_BUFLEN, "%s", _("Receiving Progress.")); } else { if (dlgpr->rcvdsize == 0) snprintf(progresstip, MAX_BUFLEN, _("%s to Receive."), numeric_to_size(dlgpr->torcvsize)); else { progress = percent(dlgpr->rcvdsize, dlgpr->torcvsize) / 100; snprintf(progresstip, MAX_BUFLEN, _("%s Of %s Received."), numeric_to_size(dlgpr->rcvdsize), numeric_to_size(dlgpr->torcvsize)); } } pbar = GTK_WIDGET(g_datalist_get_data(&(dlgpr->widset), "file-receive-progress-bar-widget")); gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(pbar), progress); gtk_progress_bar_set_text(GTK_PROGRESS_BAR(pbar), progresstip); if ((progress == 1) || (progress == 0)) { if (progress == 1) { g_source_remove(dlgpr->timerrcv); dlgpr->timerrcv = 0; dlgpr->ShowInfoEnclosure(dlgpr); } // 只要不是在接收过程中,恢复接收和拒收按键 button = GTK_WIDGET( g_datalist_get_data(&(dlgpr->widset), "file-receive-accept-button")); gtk_widget_set_sensitive(button, TRUE); button = GTK_WIDGET( g_datalist_get_data(&(dlgpr->widset), "file-receive-refuse-button")); gtk_widget_set_sensitive(button, TRUE); } else { // 接收过程中,禁止点接收和拒收按键 button = GTK_WIDGET( g_datalist_get_data(&(dlgpr->widset), "file-receive-accept-button")); gtk_widget_set_sensitive(button, FALSE); button = GTK_WIDGET( g_datalist_get_data(&(dlgpr->widset), "file-receive-refuse-button")); gtk_widget_set_sensitive(button, FALSE); } return TRUE; } /** * 显示窗口事件响应函数. *@param dlgpr 对话框类 * */ void DialogPeer::ShowDialogPeer(DialogPeer* dlgpr) { // 这个事件有可能需要触发其它功能,暂没有直接用ShowInfoEnclosure来执行 ShowInfoEnclosure(dlgpr); } /** * 接收文件函数. *@param dlgpr 对话框类 * */ void DialogPeer::onAcceptButtonClicked(DialogPeer* self) { GtkWidget* widget; GtkTreeModel* model; GtkTreeIter iter; gchar* filename; FileInfo* file; auto g_progdt = self->app->getCoreThread()->getProgramData(); const gchar* filepath = pop_save_path(GTK_WIDGET(self->grpinf->getDialog()), g_progdt->path.c_str()); if (filepath == nullptr) { return; } self->progdt->path = filepath; /* 考察数据集中是否存在项 */ widget = self->fileToReceiveTreeviewWidget; model = gtk_tree_view_get_model(GTK_TREE_VIEW(widget)); if (!model) return; if (!gtk_tree_model_get_iter_first(model, &iter)) return; self->torcvsize = 0; /* 将选中的项投入文件数据接收类 */ do { gtk_tree_model_get(model, &iter, 2, &filename, 5, &file, -1); g_free(file->filepath); file->filepath = g_strdup_printf( "%s%s%s", filepath, *(filepath + 1) != '\0' ? "/" : "", filename); self->app->getCoreThread()->RecvFileAsync(file); g_free(filename); self->torcvsize += file->filesize; } while (gtk_tree_model_iter_next(model, &iter)); self->rcvdsize = 0; if (!self->timerrcv) { self->timerrcv = g_timeout_add(300, GSourceFunc(UpdataEnclosureRcvUI), self); } } /** * 获取待发送成员列表. * @return plist 获取待发送成员列表 * 调用该函数后须free plist */ GSList* DialogPeer::GetSelPal() { PalInfo* pal; GSList* plist; pal = grpinf->getMembers()[0].get(); plist = NULL; plist = g_slist_append(plist, pal); return plist; } /** *从接收文件的TreeView删除选定行(待接收和已接收都用此函数). * @param widget TreeView */ void DialogPeer::onRefuse(void*, void*, DialogPeer& self) { GtkTreeModel* model; GtkTreeSelection* TreeSel; GtkTreeIter iter; FileInfo* file; GList* list; GtkWidget* widget = self.fileToReceiveTreeviewWidget; model = gtk_tree_view_get_model(GTK_TREE_VIEW(widget)); // 从中心结点删除 TreeSel = gtk_tree_view_get_selection(GTK_TREE_VIEW(widget)); list = gtk_tree_selection_get_selected_rows(TreeSel, NULL); if (!list) return; while (list) { gtk_tree_model_get_iter(GTK_TREE_MODEL(model), &iter, (GtkTreePath*)g_list_nth(list, 0)->data); gtk_tree_model_get(model, &iter, 5, &file, -1); self.app->getCoreThread()->PopItemFromEnclosureList(file); list = g_list_next(list); } g_list_free(list); // 从列表中删除 RemoveSelectedFromTree(widget); // 重新刷新窗口显示 self.ShowInfoEnclosure(&self); } void DialogPeer::onRefuseAll(void*, void*, DialogPeer& self) { GtkTreeModel* model; GtkTreeIter iter; FileInfo* file; GtkWidget* widget = self.fileToReceiveTreeviewWidget; model = gtk_tree_view_get_model(GTK_TREE_VIEW(widget)); if (gtk_tree_model_get_iter_first(model, &iter)) { do { gtk_tree_model_get(model, &iter, 5, &file, -1); self.app->getCoreThread()->PopItemFromEnclosureList(file); } while (gtk_tree_model_iter_next(model, &iter)); } gtk_list_store_clear(GTK_LIST_STORE(model)); } /** *显示接收附件的TreeView的弹出菜单回调函数.(待接收和已接收都用此函数) * @param widget TreeView * @param event 事件 */ gint DialogPeer::RcvTreePopup(GtkWidget* widget, GdkEvent* event, DialogPeer* self) { GtkWidget* menu; menu = gtk_menu_new_from_model(G_MENU_MODEL( gtk_builder_get_object(self->app->getMenuBuilder(), "peer-recv-popup"))); gtk_menu_attach_to_widget(GTK_MENU(menu), widget, nullptr); if (event->type == GDK_BUTTON_PRESS) { if (gdk_event_triggers_context_menu(event)) { gtk_menu_popup_at_pointer(GTK_MENU(menu), NULL); return TRUE; } } return FALSE; } void DialogPeer::onNewFileReceived(GroupInfo*) { this->ShowInfoEnclosure(this); } void DialogPeer::onGroupInfoUpdated(GroupInfo* groupInfo) { if (groupInfo != this->grpinf) return; if (gtk_window_is_active(GTK_WINDOW(this->window))) { ClearNotify(GTK_WIDGET(this->window), nullptr); } } void DialogPeer::refreshSendAction() { bool can_send = false; if (gtk_text_buffer_get_char_count(getInputBuffer()) > 0) { can_send = true; } else { GtkTreeIter iter; if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(fileSendModel), &iter)) { can_send = true; } } if (can_send) { g_action_map_enable_actions(G_ACTION_MAP(window), "send_message", nullptr); } else { g_action_map_disable_actions(G_ACTION_MAP(window), "send_message", nullptr); } } } // namespace iptux iptux-0.9.4/src/iptux/DialogPeer.h000066400000000000000000000074011475473122500170350ustar00rootroot00000000000000// // C++ Interface: DialogPeer // // Description: // 与单个好友对话 // // Author: cwll ,(C) 2012.02 // Jally , (C) 2008 // // Copyright: See COPYING file that comes with this distribution // // #ifndef IPTUX_DIALOGPEER_H #define IPTUX_DIALOGPEER_H #include "iptux-core/IptuxConfig.h" #include "iptux-core/Models.h" #include "iptux/Application.h" #include "iptux/DialogBase.h" #include namespace iptux { class DialogPeer : public DialogBase { public: DialogPeer(Application* app, GroupInfo* grp); virtual ~DialogPeer(); static void PeerDialogEntry(Application* app, GroupInfo* grpinf); void UpdatePalData(PalInfo* pal) override; void InsertPalData(PalInfo* pal) override; void DelPalData(PalInfo* pal) override; void ClearAllPalData() override; GSList* GetSelPal() override; static void ShowDialogPeer(DialogPeer* dlgpr); void insertImage(); GtkWindow* getWindow() override { return GTK_WINDOW(window); } private: GtkTreeView* fileToReceiveTree = 0; private: void ReadUILayout(); void WriteUILayout(); void init(); GtkWindow* CreateMainWindow(); void CreateTitle(); GtkWidget* CreateAllArea(); GtkWidget* CreateInfoArea(); GtkWidget* CreateFileArea(); GtkWidget* CreateFileReceiveArea(); GtkWidget* CreateFileToReceiveArea(); GtkWidget* CreateFileReceivedArea(); GtkWidget* CreateFileToReceiveTree(GtkTreeModel* model); GtkTreeModel* CreateFileToReceiveModel(); GtkWidget* CreateFileReceivedTree(GtkTreeModel* model); GtkTreeModel* CreateFileReceivedModel(); void refreshTitle(); void FillPalInfoToBuffer(GtkTextBuffer* buffer, PalInfo* pal); void BroadcastEnclosureMsg(const std::vector& files) override; void populateInputPopup(GtkMenu* popup) override; bool SendTextMsg() override; void FeedbackMsg(std::shared_ptr msgPara); MsgPara* PackageMsg(const std::vector& dtlist); void refreshSendAction(); std::string GetTitle(); // 回调处理部分 private: static void onRecvTreeSelectionChanged(DialogPeer& self, GtkTreeSelection*); static void onAcceptButtonClicked(DialogPeer* self); static void ShowInfoEnclosure(DialogPeer* dlgpr); static bool UpdataEnclosureRcvUI(DialogPeer* dlgpr); static gint RcvTreePopup(GtkWidget*, GdkEvent* event, DialogPeer* self); static void onRefuse(void*, void*, DialogPeer& self); static void onRefuseAll(void*, void*, DialogPeer& self); void onNewFileReceived(GroupInfo*); static void onClearChatHistory(void*, void*, DialogPeer& self) { self.ClearHistoryTextView(); } static void onInsertImage(void*, void*, DialogPeer& self) { self.insertImage(); } static void onInsertImageFromPopup(DialogPeer* self, GtkMenuItem*) { self->insertImage(); } static void onAttachFile(void*, void*, DialogPeer& self) { DialogBase::AttachRegular(&self); } static void onAttachFolder(void*, void*, DialogPeer& self) { DialogBase::AttachFolder(&self); } static void onRequestSharedResources(void*, void*, DialogPeer& self); static void onPaste(void*, void*, DialogPeer* self); static void onSendMessage(void*, void*, DialogPeer& self) { DialogBase::SendMessage(&self); } void onGroupInfoUpdated(GroupInfo* groupInfo); static void onInputBufferChanged(GtkTextBuffer*, DialogPeer& self) { self.refreshSendAction(); } static void onSendFileModelChanged(DialogPeer& self) { self.refreshSendAction(); } protected: GtkApplicationWindow* window; std::shared_ptr config; int64_t torcvsize; // 总计待接收大小(包括已接收) int64_t rcvdsize; // 总计已接收大小 guint timerrcv; // 接收文件界面更新计时器ID GtkWidget* fileToReceiveTreeviewWidget = nullptr; gulong sigId = 0; }; } // namespace iptux #endif iptux-0.9.4/src/iptux/DialogPeerTest.cpp000066400000000000000000000031501475473122500202250ustar00rootroot00000000000000#include "Application.h" #include "UiHelper.h" #include "gtest/gtest.h" #include "iptux-utils/TestHelper.h" #include "iptux/DialogPeer.h" #include "iptux/TestHelper.h" #include "iptux/UiCoreThread.h" using namespace std; using namespace iptux; static void do_action(DialogPeer* w, const char* name) { GActionMap* m = G_ACTION_MAP(w->getWindow()); g_action_activate(g_action_map_lookup_action(m, name), NULL); } TEST(DialogPeer, Constructor) { Application* app = CreateApplication(); PPalInfo pal = make_shared("127.0.0.1", 2425); app->getCoreThread()->AttachPalToList(pal); GroupInfo* grpinf = app->getCoreThread()->GetPalRegularItem(pal.get()); grpinf->initBuffer(NULL); DialogPeer* dlgpr = new DialogPeer(app, grpinf); ASSERT_EQ(igtk_text_buffer_get_text(grpinf->getInputBuffer()), ""); auto clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD); gtk_clipboard_set_text(clipboard, "hello world", -1); do_action(dlgpr, "paste"); ASSERT_EQ(igtk_text_buffer_get_text(grpinf->getInputBuffer()), "hello world"); GError* error = NULL; auto pixbuf = gdk_pixbuf_new_from_file(testDataPath("iptux.png").c_str(), &error); if (error != nullptr) { ASSERT_TRUE(false) << error->message; g_error_free(error); } gtk_clipboard_set_image(clipboard, pixbuf); do_action(dlgpr, "paste"); g_object_unref(pixbuf); MsgPara msg(pal); msg.dtlist.push_back(ChipData("helloworld")); grpinf->addMsgPara(msg); msg = MsgPara(pal); msg.dtlist.push_back( ChipData(MessageContentType::PICTURE, testDataPath("iptux.png"))); grpinf->addMsgPara(msg); DestroyApplication(app); } iptux-0.9.4/src/iptux/GioNotificationService.cpp000066400000000000000000000020341475473122500217600ustar00rootroot00000000000000#include "config.h" #include "GioNotificationService.h" namespace iptux { void GioNotificationService::sendNotification(GApplication* app, const std::string& id, const std::string& title, const std::string& body, const std::string& detailedAction, GNotificationPriority priority, GIcon* icon) { GNotification* notification = g_notification_new(title.c_str()); g_notification_set_body(notification, body.c_str()); g_notification_set_priority(notification, priority); if(icon) { g_notification_set_icon(notification, icon); } if(!detailedAction.empty()) { g_notification_set_default_action(notification, detailedAction.c_str()); } g_application_send_notification(app, id.c_str(), notification); g_object_unref(notification); } } // namespace iptux iptux-0.9.4/src/iptux/GioNotificationService.h000066400000000000000000000012011475473122500214200ustar00rootroot00000000000000#ifndef IPTUX_GIO_NOTIFICATION_SERVICE #define IPTUX_GIO_NOTIFICATION_SERVICE #include "iptux/NotificationService.h" namespace iptux { class GioNotificationService : public NotificationService { public: ~GioNotificationService() override = default; void sendNotification(GApplication* app, const std::string& id, const std::string& title, const std::string& body, const std::string& detailedAction, GNotificationPriority priority, GIcon* icon) override; }; } // namespace iptux #endif iptux-0.9.4/src/iptux/LogSystem.cpp000066400000000000000000000061721475473122500173070ustar00rootroot00000000000000// // C++ Implementation: LogSystem // // Description: // 实时写入日志信息 // // Author: Jally , (C) 2008 // // Copyright: See COPYING file that comes with this distribution // // #include "config.h" #include "LogSystem.h" #include #include #include #include "iptux-core/Const.h" #include "iptux-utils/utils.h" #define LOG_START_HEADER "=====================================" #define LOG_END_HEADER "-------------------------------------" using namespace std; namespace iptux { LogSystem::LogSystem(shared_ptr programData) : programData(programData), fdc(-1), fds(-1) { CHECK_NOTNULL(programData.get()); InitSublayer(); } LogSystem::~LogSystem() { close(fdc); close(fds); } void LogSystem::InitSublayer() { fdc = open(getChatLogPath().c_str(), O_WRONLY | O_CREAT | O_APPEND, 0644); fds = open(getSystemLogPath().c_str(), O_WRONLY | O_CREAT | O_APPEND, 0644); } void LogSystem::communicateLog(const MsgPara* msgpara, const char* fmt, ...) { va_list args; va_start(args, fmt); communicateLogv(msgpara, fmt, args); va_end(args); } void LogSystem::systemLog(const char* fmt, ...) { va_list args; va_start(args, fmt); systemLogv(fmt, args); va_end(args); } void LogSystem::communicateLogv(const MsgPara* msgpara, const char* fmt, va_list ap) { gchar *log, *msg, *ptr; if (!programData->IsSaveChatHistory()) { return; } auto pal = msgpara->getPal(); if (msgpara->stype == MessageSourceType::PAL) ptr = getformattime(TRUE, _("Recevied-From: Nickname:%s User:%s Host:%s"), pal->getName().c_str(), pal->getUser().c_str(), pal->getHost().c_str()); else if (msgpara->stype == MessageSourceType::SELF) { if (msgpara->getPal()) ptr = getformattime(TRUE, _("Send-To: Nickname:%s User:%s Host:%s"), pal->getName().c_str(), pal->getUser().c_str(), pal->getHost().c_str()); else ptr = getformattime(TRUE, _("Send-Broadcast")); } else return; msg = g_strdup_vprintf(fmt, ap); log = g_strdup_printf("%s\n%s\n%s\n%s\n\n", LOG_START_HEADER, ptr, msg, LOG_END_HEADER); write(fdc, log, strlen(log)); g_free(log); g_free(ptr); g_free(msg); } void LogSystem::systemLogv(const char* fmt, va_list ap) { gchar *log, *msg, *ptr; if (!programData->IsSaveChatHistory()) { return; } ptr = getformattime(TRUE, _("User:%s Host:%s"), g_get_user_name(), g_get_host_name()); msg = g_strdup_vprintf(fmt, ap); log = g_strdup_printf("%s\n%s\n%s\n%s\n\n", LOG_START_HEADER, ptr, msg, LOG_END_HEADER); g_free(ptr); g_free(msg); write(fds, log, strlen(log)); g_free(log); } string LogSystem::getChatLogPath() const { auto env = g_get_user_config_dir(); return stringFormat("%s" LOG_PATH "/communicate.log", env); } string LogSystem::getSystemLogPath() const { auto env = g_get_user_config_dir(); return stringFormat("%s" LOG_PATH "/system.log", env); } } // namespace iptux iptux-0.9.4/src/iptux/LogSystem.h000066400000000000000000000017401475473122500167500ustar00rootroot00000000000000// // C++ Interface: LogSystem // // Description: // 相关日志记录 // // Author: Jally , (C) 2008 // // Copyright: See COPYING file that comes with this distribution // // #ifndef IPTUX_LOGSYSTEM_H #define IPTUX_LOGSYSTEM_H #include #include #include "iptux-core/Models.h" #include "iptux-core/ProgramData.h" namespace iptux { class LogSystem { public: explicit LogSystem(std::shared_ptr programData); ~LogSystem(); void communicateLog(const MsgPara* msgpara, const char* fmt, ...) G_GNUC_PRINTF(3, 4); void systemLog(const char* fmt, ...) G_GNUC_PRINTF(2, 3); void communicateLogv(const MsgPara* msgpara, const char* fmt, va_list args); void systemLogv(const char* fmt, va_list args); std::string getChatLogPath() const; std::string getSystemLogPath() const; private: std::shared_ptr programData; int fdc, fds; private: void InitSublayer(); }; } // namespace iptux #endif iptux-0.9.4/src/iptux/LogSystemTest.cpp000066400000000000000000000005011475473122500201350ustar00rootroot00000000000000#include "gtest/gtest.h" #include "iptux-core/TestHelper.h" #include "iptux/LogSystem.h" using namespace std; using namespace iptux; TEST(LogSystem, Constructor) { auto config = newTestIptuxConfig(); auto core = make_shared(config); LogSystem* logSystem = new LogSystem(core); delete logSystem; } iptux-0.9.4/src/iptux/MainWindow.cpp000066400000000000000000001703161475473122500174370ustar00rootroot00000000000000// // C++ Implementation: MainWindow // // Description: // // // Author: Jally , (C) 2008 // // Copyright: See COPYING file that comes with this distribution // // #include "config.h" #include "MainWindow.h" #include "iptux-core/Const.h" #include "iptux-utils/output.h" #include "iptux-utils/utils.h" #include "iptux/Application.h" #include "iptux/DetectPal.h" #include "iptux/DialogGroup.h" #include "iptux/DialogPeer.h" #include "iptux/RevisePal.h" #include "iptux/UiHelper.h" #include "iptux/UiModels.h" #include "iptux/callback.h" #include "iptux/dialog.h" #include #include #include #include #include using namespace std; namespace iptux { enum config_key { CFG_MAIN_PANED_DIVIDE, CFG_SORT_BY, CFG_SORT_TYPE, CFG_INFO_STYLE, }; static const char* config_names[] = { [CFG_MAIN_PANED_DIVIDE] = "mwin_main_paned_divide", [CFG_SORT_BY] = "mwin_sort_by", [CFG_SORT_TYPE] = "mwin_sort_type", [CFG_INFO_STYLE] = "mwin_info_style", }; static void main_window_on_state_event(GtkWidget* self, GdkEvent* event, gpointer user_data) { GdkWindowState event_state = event->window_state.new_window_state; MainWindow* mwin = (MainWindow*)user_data; auto progdt = mwin->getApp()->getProgramData(); if (!progdt->isHideTaskbarWhenMainWindowIconified()) return; if (event_state & GDK_WINDOW_STATE_ICONIFIED) { gtk_window_set_skip_taskbar_hint(GTK_WINDOW(self), TRUE); } else { gtk_window_set_skip_taskbar_hint(GTK_WINDOW(self), FALSE); } } /** * 类构造函数. */ MainWindow::MainWindow(Application* app, UiCoreThread& coreThread) : app(app), coreThread(coreThread), window(nullptr), progdt(coreThread.getProgramData()), config(progdt->getConfig()), widset(NULL), mdlset(NULL), tmdllist(NULL), timerid(0), windowConfig(250, 510, "main_window"), palPopupMenu(0) { time_t now = time(nullptr); localtime_r(&now, &info_refresh_tm); windowConfig.LoadFromConfig(config); builder = gtk_builder_new_from_resource(IPTUX_RESOURCE "gtk/MainWindow.ui"); gtk_builder_connect_signals(builder, nullptr); coreThread.sigGroupInfoUpdated.connect( sigc::mem_fun(*this, &MainWindow::onGroupInfoUpdated)); CreateWindow(); } /** * 类析构函数. */ MainWindow::~MainWindow() { ClearSublayer(); } GtkWidget* MainWindow::getWindow() { return window; } void MainWindow::Show() { gtk_window_present(GTK_WINDOW(window)); } /** * 创建程序主窗口入口. */ void MainWindow::CreateWindow() { GtkWidget* widget; InitSublayer(); /* 创建主窗口 */ window = CreateMainWindow(); CreateActions(); CreateTitle(); gtk_container_add(GTK_CONTAINER(window), CreateAllArea()); gtk_widget_show_all(window); /* 聚焦到好友树(paltree)区域 */ widget = GTK_WIDGET(g_datalist_get_data(&widset, "paltree-treeview-widget")); gtk_widget_grab_focus(widget); /* 隐藏好友清单 */ widget = GTK_WIDGET(g_datalist_get_data(&widset, "pallist-box-widget")); gtk_widget_hide(widget); if (progdt->IsAutoHidePanelAfterLogin()) { gtk_widget_hide(window); } palPopupMenu = GTK_MENU(gtk_menu_new_from_model( G_MENU_MODEL(gtk_builder_get_object(builder, "pal-popup")))); gtk_menu_attach_to_widget(palPopupMenu, window, nullptr); } void MainWindow::CreateActions() { GActionEntry win_entries[] = { makeActionEntry("refresh", G_ACTION_CALLBACK(onRefresh)), makeStateActionEntry("sort_type", G_ACTION_CALLBACK(onSortType), "s", "'ascending'"), makeStateActionEntry("sort_by", G_ACTION_CALLBACK(onSortBy), "s", "'nickname'"), makeStateActionEntry("info_style", G_ACTION_CALLBACK(onInfoStyle), "s", "'ip'"), makeActionEntry("detect", G_ACTION_CALLBACK(onDetect)), makeActionEntry("find", G_ACTION_CALLBACK(onFind)), makeActionEntry("pal.send_message", G_ACTION_CALLBACK(onPalSendMessage)), makeActionEntry("pal.request_shared_resources", G_ACTION_CALLBACK(onPalRequestSharedResources)), makeActionEntry("pal.change_info", G_ACTION_CALLBACK(onPalChangeInfo)), makeActionEntry("pal.delete_pal", G_ACTION_CALLBACK(onDeletePal)), }; GActionMap* m = G_ACTION_MAP(window); g_action_map_add_action_entries(m, win_entries, G_N_ELEMENTS(win_entries), this); g_simple_action_set_state( G_SIMPLE_ACTION(g_action_map_lookup_action(m, "info_style")), g_variant_new_string(GroupInfoStyleToStr(info_style_))); g_simple_action_set_state( G_SIMPLE_ACTION(g_action_map_lookup_action(m, "sort_type")), g_variant_new_string(GtkSortTypeToStr(sort_type_))); g_simple_action_set_state( G_SIMPLE_ACTION(g_action_map_lookup_action(m, "sort_by")), g_variant_new_string(PalTreeModelSortKeyToStr(sort_key_))); } /** * 好友树(paltree)中是否已经包含此IP地址的好友信息数据. * @param ipv4 ipv4 * @return 是否包含 */ bool MainWindow::PaltreeContainItem(in_addr ipv4) { GtkTreeModel* model; GtkTreeIter iter; auto pal = app->getCoreThread()->GetPal(ipv4); if (!pal) return false; auto groupInfo = app->getCoreThread()->GetPalRegularItem(pal.get()); if (!groupInfo) return false; model = GTK_TREE_MODEL(g_datalist_get_data(&mdlset, "regular-paltree-model")); return GroupGetPaltreeItem(model, &iter, groupInfo); } /** * 更新此IP地址好友在好友树(paltree)中的信息数据. * @param ipv4 ipv4 */ void MainWindow::UpdateItemToPaltree(in_addr ipv4) { GtkTreeModel* model; GtkTreeIter parent, iter; GroupInfo* pgrpinf; auto ppal = app->getCoreThread()->GetPal(ipv4); if (!ppal) return; auto pal = ppal.get(); auto grpinf = app->getCoreThread()->GetPalRegularItem(pal); if (!grpinf) return; /* 更新常规模式树 */ model = GTK_TREE_MODEL(g_datalist_get_data(&mdlset, "regular-paltree-model")); if (GroupGetPaltreeItem(model, &iter, grpinf)) { FillGroupInfoToPaltree(model, &iter, grpinf); } else { LOG_WARN("GroupGetPaltreeItem return false"); } /* 更新网段模式树 */ model = GTK_TREE_MODEL(g_datalist_get_data(&mdlset, "segment-paltree-model")); pgrpinf = coreThread.GetPalSegmentItem(pal); if (GroupGetPaltreeItem(model, &iter, pgrpinf) && GroupGetPaltreeItemWithParent(model, &iter, grpinf)) { FillGroupInfoToPaltree(model, &iter, grpinf); } /* 更新分组模式树 */ model = GTK_TREE_MODEL(g_datalist_get_data(&mdlset, "group-paltree-model")); pgrpinf = coreThread.GetPalGroupItem(pal); if (pgrpinf) { GroupGetPrevPaltreeItem(model, &iter, grpinf); gtk_tree_model_iter_parent(model, &parent, &iter); if (gtk_tree_model_iter_n_children(model, &parent) == 1) gtk_tree_store_remove(GTK_TREE_STORE(model), &parent); else gtk_tree_store_remove(GTK_TREE_STORE(model), &iter); if (!GroupGetPaltreeItem(model, &parent, pgrpinf)) { gtk_tree_store_append(GTK_TREE_STORE(model), &parent, NULL); FillGroupInfoToPaltree(model, &parent, pgrpinf); } gtk_tree_store_append(GTK_TREE_STORE(model), &iter, &parent); FillGroupInfoToPaltree(model, &iter, grpinf); FillGroupInfoToPaltree(model, &parent, pgrpinf); } /* 更新广播模式树 */ model = GTK_TREE_MODEL(g_datalist_get_data(&mdlset, "broadcast-paltree-model")); pgrpinf = coreThread.GetPalBroadcastItem(pal); GroupGetPaltreeItem(model, &iter, pgrpinf); GroupGetPaltreeItemWithParent(model, &iter, grpinf); FillGroupInfoToPaltree(model, &iter, grpinf); } /** * 附加此IP地址的好友到好友树(paltree). * @param ipv4 ipv4 */ void MainWindow::AttachItemToPaltree(in_addr ipv4) { GtkTreeModel* model; GtkTreeIter parent, iter; GroupInfo* pgrpinf; auto ppal = app->getCoreThread()->GetPal(ipv4); if (!ppal) return; auto pal = ppal.get(); auto grpinf = app->getCoreThread()->GetPalRegularItem(pal); if (!grpinf) return; /* 添加到常规模式树 */ model = GTK_TREE_MODEL(g_datalist_get_data(&mdlset, "regular-paltree-model")); gtk_tree_store_append(GTK_TREE_STORE(model), &iter, NULL); FillGroupInfoToPaltree(model, &iter, grpinf); /* 添加到网段模式树 */ model = GTK_TREE_MODEL(g_datalist_get_data(&mdlset, "segment-paltree-model")); pgrpinf = coreThread.GetPalSegmentItem(pal); if (!GroupGetPaltreeItem(model, &parent, pgrpinf)) { gtk_tree_store_append(GTK_TREE_STORE(model), &parent, NULL); FillGroupInfoToPaltree(model, &parent, pgrpinf); } gtk_tree_store_append(GTK_TREE_STORE(model), &iter, &parent); FillGroupInfoToPaltree(model, &iter, grpinf); /* 添加到分组模式树 */ model = GTK_TREE_MODEL(g_datalist_get_data(&mdlset, "group-paltree-model")); pgrpinf = coreThread.GetPalGroupItem(pal); if (pgrpinf) { if (!GroupGetPaltreeItem(model, &parent, pgrpinf)) { gtk_tree_store_append(GTK_TREE_STORE(model), &parent, NULL); FillGroupInfoToPaltree(model, &parent, pgrpinf); } gtk_tree_store_append(GTK_TREE_STORE(model), &iter, &parent); FillGroupInfoToPaltree(model, &iter, grpinf); FillGroupInfoToPaltree(model, &parent, pgrpinf); } /* 添加到广播模式树 */ model = GTK_TREE_MODEL(g_datalist_get_data(&mdlset, "broadcast-paltree-model")); pgrpinf = coreThread.GetPalBroadcastItem(pal); if (!GroupGetPaltreeItem(model, &parent, pgrpinf)) { gtk_tree_store_append(GTK_TREE_STORE(model), &parent, NULL); FillGroupInfoToPaltree(model, &parent, pgrpinf); } gtk_tree_store_append(GTK_TREE_STORE(model), &iter, &parent); FillGroupInfoToPaltree(model, &iter, grpinf); FillGroupInfoToPaltree(model, &parent, pgrpinf); } /** * 从好友树(paltree)中删除此IP地址的好友. * @param ipv4 ipv4 */ void MainWindow::DelItemFromPaltree(in_addr ipv4) { GtkTreeModel* model; GtkTreeIter parent, iter; GroupInfo* pgrpinf; auto ppal = app->getCoreThread()->GetPal(ipv4); if (!ppal) return; auto pal = ppal.get(); auto grpinf = app->getCoreThread()->GetPalRegularItem(pal); if (!grpinf) return; /* 从常规模式树移除 */ model = GTK_TREE_MODEL(g_datalist_get_data(&mdlset, "regular-paltree-model")); GroupGetPaltreeItem(model, &iter, grpinf); gtk_tree_store_remove(GTK_TREE_STORE(model), &iter); /* 从网段模式树移除 */ model = GTK_TREE_MODEL(g_datalist_get_data(&mdlset, "segment-paltree-model")); auto g_cthrd = &coreThread; pgrpinf = g_cthrd->GetPalSegmentItem(pal); GroupGetPaltreeItem(model, &parent, pgrpinf); if (pgrpinf->getMembers().size() != 1) { iter = parent; GroupGetPaltreeItemWithParent(model, &iter, grpinf); gtk_tree_store_remove(GTK_TREE_STORE(model), &iter); FillGroupInfoToPaltree(model, &parent, pgrpinf); } else gtk_tree_store_remove(GTK_TREE_STORE(model), &parent); /* 从分组模式树移除 */ model = GTK_TREE_MODEL(g_datalist_get_data(&mdlset, "group-paltree-model")); pgrpinf = g_cthrd->GetPalGroupItem(pal); if (pgrpinf) { GroupGetPaltreeItem(model, &parent, pgrpinf); if (pgrpinf->getMembers().size() != 1) { iter = parent; GroupGetPaltreeItemWithParent(model, &iter, grpinf); gtk_tree_store_remove(GTK_TREE_STORE(model), &iter); FillGroupInfoToPaltree(model, &parent, pgrpinf); } else gtk_tree_store_remove(GTK_TREE_STORE(model), &parent); } /* 从广播模式树移除 */ model = GTK_TREE_MODEL(g_datalist_get_data(&mdlset, "broadcast-paltree-model")); pgrpinf = g_cthrd->GetPalBroadcastItem(pal); GroupGetPaltreeItem(model, &parent, pgrpinf); if (pgrpinf->getMembers().size() != 1) { iter = parent; GroupGetPaltreeItemWithParent(model, &iter, grpinf); gtk_tree_store_remove(GTK_TREE_STORE(model), &iter); FillGroupInfoToPaltree(model, &parent, pgrpinf); } else gtk_tree_store_remove(GTK_TREE_STORE(model), &parent); } /** * 从好友树(paltree)中删除所有好友数据. */ void MainWindow::ClearAllItemFromPaltree() { GtkTreeModel* model; model = GTK_TREE_MODEL(g_datalist_get_data(&mdlset, "regular-paltree-model")); gtk_tree_store_clear(GTK_TREE_STORE(model)); model = GTK_TREE_MODEL(g_datalist_get_data(&mdlset, "segment-paltree-model")); gtk_tree_store_clear(GTK_TREE_STORE(model)); model = GTK_TREE_MODEL(g_datalist_get_data(&mdlset, "group-paltree-model")); gtk_tree_store_clear(GTK_TREE_STORE(model)); model = GTK_TREE_MODEL(g_datalist_get_data(&mdlset, "broadcast-paltree-model")); gtk_tree_store_clear(GTK_TREE_STORE(model)); } void MainWindow::LoadConfig() { GroupInfoStyle info_style = GroupInfoStyleFromStr( this->config->GetString(config_names[CFG_INFO_STYLE])); if (info_style != GroupInfoStyle::INVALID) { this->info_style_ = info_style; } GtkSortType sort_type = GtkSortTypeFromStr(this->config->GetString(config_names[CFG_SORT_TYPE])); if (sort_type != GTK_SORT_TYPE_INVALID) { this->sort_type_ = sort_type; } PalTreeModelSortKey sort_key = PalTreeModelSortKeyFromStr( this->config->GetString(config_names[CFG_SORT_BY])); if (sort_key != PalTreeModelSortKey::INVALID) { this->sort_key_ = sort_key; } } void MainWindow::SaveConfig() { this->config->SetString(config_names[CFG_INFO_STYLE], GroupInfoStyleToStr(info_style_)); this->config->SetString(config_names[CFG_SORT_TYPE], GtkSortTypeToStr(sort_type_)); this->config->SetString(config_names[CFG_SORT_BY], PalTreeModelSortKeyToStr(sort_key_)); this->config->Save(); } /** * 初始化底层数据. */ void MainWindow::InitSublayer() { GtkTreeModel* model; LoadConfig(); g_datalist_init(&widset); g_datalist_init(&mdlset); CHECK_EQ(int(timerid), 0); timerid = g_timeout_add_seconds(1, GSourceFunc(UpdateUI), this); model = palTreeModelNew(sort_key_, sort_type_); this->regular_model = model; g_datalist_set_data_full(&mdlset, "regular-paltree-model", model, GDestroyNotify(g_object_unref)); tmdllist = g_list_append(tmdllist, model); model = palTreeModelNew(sort_key_, sort_type_); g_datalist_set_data_full(&mdlset, "segment-paltree-model", model, GDestroyNotify(g_object_unref)); tmdllist = g_list_append(tmdllist, model); model = palTreeModelNew(sort_key_, sort_type_); g_datalist_set_data_full(&mdlset, "group-paltree-model", model, GDestroyNotify(g_object_unref)); tmdllist = g_list_append(tmdllist, model); model = palTreeModelNew(sort_key_, sort_type_); g_datalist_set_data_full(&mdlset, "broadcast-paltree-model", model, GDestroyNotify(g_object_unref)); tmdllist = g_list_append(tmdllist, model); model = CreatePallistModel(); g_datalist_set_data_full(&mdlset, "pallist-model", model, GDestroyNotify(g_object_unref)); } /** * 清空底层数据. */ void MainWindow::ClearSublayer() { g_datalist_clear(&widset); g_datalist_clear(&mdlset); g_list_free(tmdllist); if (timerid > 0) g_source_remove(timerid); g_object_unref(builder); } /** * 创建主窗口. * @return 主窗口 */ GtkWidget* MainWindow::CreateMainWindow() { GdkGeometry geometry = {50, 200, G_MAXINT, G_MAXINT, 0, 0, 2, 5, 0.0, 0.0, GDK_GRAVITY_NORTH_WEST}; GdkWindowHints hints = GdkWindowHints( GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE | GDK_HINT_BASE_SIZE | /*GDK_HINT_RESIZE_INC |*/ GDK_HINT_WIN_GRAVITY | GDK_HINT_USER_POS | GDK_HINT_USER_SIZE); window = gtk_application_window_new(app->getApp()); gtk_window_set_icon_name(GTK_WINDOW(window), "iptux"); gtk_window_set_title(GTK_WINDOW(window), getTitle().c_str()); gtk_window_set_default_size(GTK_WINDOW(window), windowConfig.GetWidth(), windowConfig.GetHeight()); gtk_window_set_geometry_hints(GTK_WINDOW(window), window, &geometry, hints); gtk_window_set_default_icon_name("iptux"); g_signal_connect(window, "configure-event", G_CALLBACK(MWinConfigureEvent), this); g_signal_connect(window, "delete-event", G_CALLBACK(gtk_window_iconify_on_delete), nullptr); g_signal_connect(window, "window-state-event", G_CALLBACK(main_window_on_state_event), this); return window; } string MainWindow::getTitle() const { if (config->GetString("bind_ip").empty()) { return _("Iptux"); } else { return stringFormat("%s - %s", _("Iptux"), config->GetString("bind_ip").c_str()); } } void MainWindow::CreateTitle() { if (app->use_header_bar()) { GtkHeaderBar* headerBar = CreateHeaderBar(GTK_WINDOW(window), app->menu()); gtk_header_bar_set_title(headerBar, getTitle().c_str()); } } /** * 创建所有区域. * @return 主窗体 */ GtkWidget* MainWindow::CreateAllArea() { GtkWidget *box, *paned; box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_box_pack_start(GTK_BOX(box), CreateToolBar(), FALSE, FALSE, 0); paned = gtk_paned_new(GTK_ORIENTATION_VERTICAL); g_object_set_data(G_OBJECT(paned), "position-name", (gpointer) "mwin-main-paned-divide"); gtk_paned_set_position( GTK_PANED(paned), config->GetInt(config_names[CFG_MAIN_PANED_DIVIDE], 210)); gtk_container_set_border_width(GTK_CONTAINER(paned), 4); gtk_box_pack_start(GTK_BOX(box), paned, TRUE, TRUE, 0); g_signal_connect(paned, "notify::position", G_CALLBACK(PanedDivideChanged), this); gtk_paned_pack1(GTK_PANED(paned), CreatePaltreeArea(), TRUE, TRUE); gtk_paned_pack2(GTK_PANED(paned), CreatePallistArea(), FALSE, TRUE); return box; } /** * 创建工具条. * @return 工具条 */ GtkWidget* MainWindow::CreateToolBar() { GtkWidget* toolbar; GtkToolItem* toolitem; GtkWidget* widget; toolbar = gtk_toolbar_new(); g_object_set(toolbar, "icon-size", 1, NULL); gtk_toolbar_set_style(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_ICONS); toolitem = gtk_tool_button_new( gtk_image_new_from_icon_name("go-previous-symbolic", GTK_ICON_SIZE_SMALL_TOOLBAR), "Go previous"); gtk_toolbar_insert(GTK_TOOLBAR(toolbar), toolitem, -1); g_signal_connect_swapped(toolitem, "clicked", G_CALLBACK(GoPrevTreeModel), this); toolitem = gtk_tool_item_new(); gtk_tool_item_set_expand(toolitem, TRUE); gtk_toolbar_insert(GTK_TOOLBAR(toolbar), toolitem, -1); widget = gtk_label_new(_("Pals Online: 0")); gtk_container_add(GTK_CONTAINER(toolitem), widget); g_datalist_set_data(&widset, "online-label-widget", widget); toolitem = gtk_tool_button_new(gtk_image_new_from_icon_name( "go-next-symbolic", GTK_ICON_SIZE_SMALL_TOOLBAR), "Go next"); gtk_toolbar_insert(GTK_TOOLBAR(toolbar), toolitem, -1); g_signal_connect_swapped(toolitem, "clicked", G_CALLBACK(GoNextTreeModel), this); return toolbar; } /** * 创建好友树区域. * @return 主窗体 */ GtkWidget* MainWindow::CreatePaltreeArea() { GtkWidget* sw; GtkWidget* widget; GtkTreeModel* model; sw = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_ETCHED_IN); model = GTK_TREE_MODEL(g_datalist_get_data(&mdlset, "regular-paltree-model")); widget = CreatePaltreeTree(model); g_object_set_data(G_OBJECT(widget), "paltree-model", model); gtk_container_add(GTK_CONTAINER(sw), widget); g_datalist_set_data(&widset, "paltree-treeview-widget", widget); return sw; } /** * 创建好友清单区域. * @return 主窗体 */ GtkWidget* MainWindow::CreatePallistArea() { GtkWidget *box, *hbox; GtkWidget *sw, *button, *widget; GtkTreeModel* model; box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); g_datalist_set_data(&widset, "pallist-box-widget", box); /* 创建好友清单部分 */ sw = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_ETCHED_IN); gtk_box_pack_start(GTK_BOX(box), sw, TRUE, TRUE, 0); model = GTK_TREE_MODEL(g_datalist_get_data(&mdlset, "pallist-model")); widget = CreatePallistTree(model); gtk_container_add(GTK_CONTAINER(sw), widget); g_datalist_set_data(&widset, "pallist-treeview-widget", widget); /* 创建接受搜索输入部分 */ hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 0); /* 关闭按钮 */ button = gtk_button_new(); widget = gtk_image_new_from_icon_name("window-close-symbolic", GTK_ICON_SIZE_BUTTON); gtk_button_set_image(GTK_BUTTON(button), widget); g_object_set(button, "relief", GTK_RELIEF_NONE, NULL); gtk_widget_set_size_request(button, -1, 1); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); g_signal_connect_swapped(button, "clicked", G_CALLBACK(HidePallistArea), &widset); /* 输入框 */ widget = gtk_entry_new(); gtk_entry_set_activates_default(GTK_ENTRY(widget), TRUE); gtk_entry_set_icon_from_icon_name(GTK_ENTRY(widget), GTK_ENTRY_ICON_SECONDARY, "edit-find-symbolic"); gtk_widget_add_events(widget, GDK_KEY_PRESS_MASK); g_object_set(widget, "has-tooltip", TRUE, NULL); gtk_box_pack_start(GTK_BOX(hbox), widget, TRUE, TRUE, 0); g_signal_connect(widget, "query-tooltip", G_CALLBACK(entry_query_tooltip), _("Search Pals")); g_signal_connect(widget, "key-press-event", G_CALLBACK(ClearPallistEntry), NULL); g_signal_connect(widget, "changed", G_CALLBACK(PallistEntryChanged), this); g_datalist_set_data(&widset, "pallist-entry-widget", widget); return box; } /** * 好友清单(pallist)底层数据结构. * 7,0 icon,1 name,2 group,3 ipstr,4 user,5 host,6 data \n * 好友头像;好友昵称;好友群组;IP地址串;好友用户;好友主机;好友数据 \n * @return pallist-model * @note 鉴于好友清单(pallist)常年保持隐藏状态,所以请不要有事没事就往 * 此model中填充数据,好友清单也无须与好友最新状态保持同步. */ GtkTreeModel* MainWindow::CreatePallistModel() { GtkListStore* model; model = gtk_list_store_new(7, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER); return GTK_TREE_MODEL(model); } /** * 创建好友树(paltree). * @param model paltree-model * @return 好友树 */ GtkWidget* MainWindow::CreatePaltreeTree(GtkTreeModel* model) { GtkWidget* view; GtkTreeSelection* selection; GtkTreeViewColumn* column; GtkCellRenderer* cell; view = gtk_tree_view_new_with_model(model); gtk_tree_view_set_level_indentation(GTK_TREE_VIEW(view), 10); gtk_tree_view_set_show_expanders(GTK_TREE_VIEW(view), FALSE); gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(view), FALSE); widget_enable_dnd_uri(view); g_object_set(view, "has-tooltip", TRUE, NULL); selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view)); gtk_tree_selection_set_mode(GTK_TREE_SELECTION(selection), GTK_SELECTION_NONE); column = gtk_tree_view_column_new(); gtk_tree_view_append_column(GTK_TREE_VIEW(view), column); g_object_set_data(G_OBJECT(view), "info-column", column); /* 展开器区域 */ cell = gtk_cell_renderer_pixbuf_new(); gtk_tree_view_column_pack_start(column, cell, FALSE); gtk_tree_view_column_set_attributes( GTK_TREE_VIEW_COLUMN(column), cell, "pixbuf", PalTreeModelColumn ::CLOSED_EXPANDER, "pixbuf-expander-closed", PalTreeModelColumn ::CLOSED_EXPANDER, "pixbuf-expander-open", PalTreeModelColumn ::OPEN_EXPANDER, NULL); g_object_set_data(G_OBJECT(column), "expander-cell", cell); /* 群组信息区域 */ cell = gtk_cell_renderer_text_new(); g_object_set(cell, "xalign", 0.0, "wrap-mode", PANGO_WRAP_WORD, "ellipsize", PANGO_ELLIPSIZE_END, NULL); gtk_tree_view_column_pack_start(column, cell, FALSE); gtk_tree_view_column_set_attributes( GTK_TREE_VIEW_COLUMN(column), cell, "markup", PalTreeModelColumn ::INFO, "attributes", PalTreeModelColumn ::STYLE, "foreground-rgba", PalTreeModelColumn ::COLOR, NULL); /* 扩展信息区域 */ cell = gtk_cell_renderer_text_new(); g_object_set(cell, "xalign", 0.0, "wrap-mode", PANGO_WRAP_WORD, NULL); gtk_tree_view_column_pack_start(column, cell, FALSE); gtk_tree_view_column_set_attributes( GTK_TREE_VIEW_COLUMN(column), cell, "text", PalTreeModelColumn ::EXTRAS, "attributes", PalTreeModelColumn ::STYLE, "foreground-rgba", PalTreeModelColumn ::COLOR, NULL); /* 连接信号 */ g_signal_connect(view, "query-tooltip", G_CALLBACK(PaltreeQueryTooltip), this); g_signal_connect(view, "row-activated", G_CALLBACK(onPaltreeItemActivated), this); g_signal_connect(view, "drag-data-received", G_CALLBACK(PaltreeDragDataReceived), this); g_signal_connect(view, "button-press-event", G_CALLBACK(PaltreePopupMenu), this); g_signal_connect(view, "button-release-event", G_CALLBACK(PaltreeChangeStatus), NULL); return view; } /** * 创建好友清单(pallist). * @param model pallist-model * @return 好友清单 */ GtkWidget* MainWindow::CreatePallistTree(GtkTreeModel* model) { GtkWidget* view; GtkTreeViewColumn* column; GtkCellRenderer* cell; GtkTreeSelection* selection; view = gtk_tree_view_new_with_model(model); gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(view), TRUE); widget_enable_dnd_uri(view); selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view)); gtk_tree_selection_set_mode(GTK_TREE_SELECTION(selection), GTK_SELECTION_NONE); column = gtk_tree_view_column_new(); gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_column_set_title(column, _("Nickname")); cell = gtk_cell_renderer_pixbuf_new(); gtk_tree_view_column_pack_start(column, cell, FALSE); gtk_tree_view_column_set_attributes(column, cell, "pixbuf", 0, NULL); cell = gtk_cell_renderer_text_new(); gtk_tree_view_column_pack_start(column, cell, FALSE); gtk_tree_view_column_set_attributes(column, cell, "text", 1, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(view), column); cell = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes(_("Group"), cell, "text", 2, NULL); gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_append_column(GTK_TREE_VIEW(view), column); cell = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes(_("IPv4"), cell, "text", 3, NULL); gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_append_column(GTK_TREE_VIEW(view), column); cell = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes(_("User"), cell, "text", 4, NULL); gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_append_column(GTK_TREE_VIEW(view), column); cell = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes(_("Host"), cell, "text", 5, NULL); gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_append_column(GTK_TREE_VIEW(view), column); g_signal_connect(view, "row-activated", G_CALLBACK(PallistItemActivated), this); g_signal_connect(view, "drag-data-received", G_CALLBACK(PallistDragDataReceived), this); return view; } /** * 获取项(grpinf)在数据集(model)中的当前位置. * @param model model * @param iter 位置由此返回 * @param grpinf class GroupInfo * @return 是否查找成功 */ bool MainWindow::GroupGetPrevPaltreeItem(GtkTreeModel* model, GtkTreeIter* iter, GroupInfo* grpinf) { GroupInfo* pgrpinf; GtkTreeIter parent; if (!gtk_tree_model_get_iter_first(model, &parent)) return false; do { gtk_tree_model_get(model, &parent, 6, &pgrpinf, -1); if (pgrpinf->grpid == grpinf->grpid) { *iter = parent; break; } if (!gtk_tree_model_iter_children(model, iter, &parent)) continue; do { gtk_tree_model_get(model, iter, 6, &pgrpinf, -1); if (pgrpinf->grpid == grpinf->grpid) break; } while (gtk_tree_model_iter_next(model, iter)); if (pgrpinf->grpid == grpinf->grpid) break; } while (gtk_tree_model_iter_next(model, &parent)); return (pgrpinf->grpid == grpinf->grpid); } /** * 获取项(grpinf)在数据集(model)中的位置. * @param model model * @param iter 位置由此返回 * @param grpinf class GroupInfo * @return 是否查找成功 */ bool MainWindow::GroupGetPaltreeItem(GtkTreeModel* model, GtkTreeIter* iter, GroupInfo* grpinf) { if (!gtk_tree_model_get_iter_first(model, iter)) return false; do { GroupInfo* pgrpinf; gtk_tree_model_get(model, iter, 6, &pgrpinf, -1); if (pgrpinf == nullptr) { LOG_WARN("don't have pgrpinf in this model and iter: %p, %p", (void*)model, (void*)iter); continue; } if (pgrpinf->grpid == grpinf->grpid) { return true; } } while (gtk_tree_model_iter_next(model, iter)); return false; } /** * 获取项(grpinf)在数据集(model)中的位置. * @param model model * @param iter 父节点位置/位置由此返回 * @param grpinf class GroupInfo * @return 是否查找成功 */ bool MainWindow::GroupGetPaltreeItemWithParent(GtkTreeModel* model, GtkTreeIter* iter, GroupInfo* grpinf) { GtkTreeIter parent; GroupInfo* pgrpinf; parent = *iter; if (!gtk_tree_model_iter_children(model, iter, &parent)) return false; do { gtk_tree_model_get(model, iter, 6, &pgrpinf, -1); if (pgrpinf->grpid == grpinf->grpid) break; } while (gtk_tree_model_iter_next(model, iter)); return (pgrpinf->grpid == grpinf->grpid); } /** * 闪烁指定项. * @param model model * @param iter iter * @param blinking 是否继续闪烁 */ void MainWindow::BlinkGroupItemToPaltree(GtkTreeModel* model, GtkTreeIter* iter, bool blinking) { static GdkRGBA color1 = {0.3216, 0.7216, 0.2196, 0.0}, color2 = {0.0, 0.0, 1.0, 0.0}; GdkRGBA* color; if (blinking) { gtk_tree_model_get(model, iter, 5, &color, -1); if (gdk_rgba_equal(color, &color1)) { gtk_tree_store_set(GTK_TREE_STORE(model), iter, 5, &color2, -1); } else { gtk_tree_store_set(GTK_TREE_STORE(model), iter, 5, &color1, -1); } } else gtk_tree_store_set(GTK_TREE_STORE(model), iter, 5, &color1, -1); } /** * 更新UI. * @param mwin 主窗口类 * @return Gtk+库所需 */ gboolean MainWindow::UpdateUI(MainWindow* mwin) { static int sumonline = 0; // 避免每次都作一次设置 GtkWidget* widget; int sum; /* 统计当前在线人数 */ sum = mwin->coreThread.GetOnlineCount(); /* 更新UI */ if (sumonline != sum) { auto label = stringFormat(_("Pals Online: %d"), sum); widget = GTK_WIDGET(g_datalist_get_data(&mwin->widset, "online-label-widget")); gtk_label_set_text(GTK_LABEL(widget), label.c_str()); sumonline = sum; } // after midnight, refresh the last activity display if (mwin->info_style_ == GroupInfoStyle::LAST_ACTIVITY) { time_t now = time(nullptr); struct tm now_tm; localtime_r(&now, &now_tm); if (mwin->info_refresh_tm.tm_year != now_tm.tm_year || mwin->info_refresh_tm.tm_mon != now_tm.tm_mon || mwin->info_refresh_tm.tm_mday != now_tm.tm_mday) { mwin->info_refresh_tm = now_tm; mwin->RefreshPalList(); } } return TRUE; } /** * 转到上一类结构树. * @param mwin 主窗口类 */ void MainWindow::GoPrevTreeModel(MainWindow* mwin) { GtkWidget* widget; GtkTreeModel* model; GtkTreeViewColumn* column; GList* tlist; widget = GTK_WIDGET(g_datalist_get_data(&mwin->widset, "paltree-treeview-widget")); model = gtk_tree_view_get_model(GTK_TREE_VIEW(widget)); if ((tlist = g_list_find(mwin->tmdllist, model))) { if (tlist->prev) model = GTK_TREE_MODEL(tlist->prev->data); else model = GTK_TREE_MODEL(g_list_last(mwin->tmdllist)->data); gtk_tree_view_set_model(GTK_TREE_VIEW(widget), model); } column = GTK_TREE_VIEW_COLUMN(g_object_get_data(G_OBJECT(widget), "info-column")); gtk_tree_view_column_queue_resize(column); } /** * 转到下一类结构树. * @param mwin 主窗口类 */ void MainWindow::GoNextTreeModel(MainWindow* mwin) { GtkWidget* widget; GtkTreeModel* model; GtkTreeViewColumn* column; GList* tlist; widget = GTK_WIDGET(g_datalist_get_data(&mwin->widset, "paltree-treeview-widget")); model = gtk_tree_view_get_model(GTK_TREE_VIEW(widget)); if ((tlist = g_list_find(mwin->tmdllist, model))) { if (tlist->next) model = GTK_TREE_MODEL(tlist->next->data); else model = GTK_TREE_MODEL(mwin->tmdllist->data); gtk_tree_view_set_model(GTK_TREE_VIEW(widget), model); } column = GTK_TREE_VIEW_COLUMN(g_object_get_data(G_OBJECT(widget), "info-column")); gtk_tree_view_column_queue_resize(column); } /** * 更新好友树. * @param mwin 主窗口类 */ void MainWindow::onRefresh(void*, void*, MainWindow& self) { auto mwin = &self; self.coreThread.Lock(); mwin->ClearAllItemFromPaltree(); self.coreThread.ClearAllPalFromList(); self.coreThread.Unlock(); thread([](CoreThread* thread) { CoreThread::SendNotifyToAll(thread); }, &self.coreThread) .detach(); } void MainWindow::onDetect(void*, void*, MainWindow& self) { DetectPal pal(self.app, GTK_WINDOW(self.window)); pal.run(); } void MainWindow::onSortBy(GSimpleAction* action, GVariant* value, MainWindow& self) { string sortBy = g_variant_get_string(value, nullptr); PalTreeModelSortKey key = PalTreeModelSortKeyFromStr(sortBy); if (key == PalTreeModelSortKey::INVALID) { LOG_WARN("unknown sort by: %s", sortBy.c_str()); return; } self.sort_key_ = key; GtkTreeModel* model; model = GTK_TREE_MODEL( g_datalist_get_data(&self.mdlset, "regular-paltree-model")); palTreeModelSetSortKey(model, key); model = GTK_TREE_MODEL( g_datalist_get_data(&self.mdlset, "segment-paltree-model")); palTreeModelSetSortKey(model, key); model = GTK_TREE_MODEL(g_datalist_get_data(&self.mdlset, "group-paltree-model")); palTreeModelSetSortKey(model, key); model = GTK_TREE_MODEL( g_datalist_get_data(&self.mdlset, "broadcast-paltree-model")); palTreeModelSetSortKey(model, key); g_simple_action_set_state(action, value); self.SaveConfig(); } void MainWindow::onSortType(GSimpleAction* action, GVariant* value, MainWindow& self) { string sortType = g_variant_get_string(value, nullptr); GtkSortType sort_type = GtkSortTypeFromStr(sortType); if (sort_type == GTK_SORT_TYPE_INVALID) { LOG_WARN("unknown sorttype: %s", sortType.c_str()); return; } self.sort_type_ = sort_type; GtkTreeModel* model; model = GTK_TREE_MODEL( g_datalist_get_data(&self.mdlset, "regular-paltree-model")); gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(model), GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, self.sort_type_); model = GTK_TREE_MODEL( g_datalist_get_data(&self.mdlset, "segment-paltree-model")); gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(model), GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, self.sort_type_); model = GTK_TREE_MODEL(g_datalist_get_data(&self.mdlset, "group-paltree-model")); gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(model), GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, self.sort_type_); model = GTK_TREE_MODEL( g_datalist_get_data(&self.mdlset, "broadcast-paltree-model")); gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(model), GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, self.sort_type_); g_simple_action_set_state(action, value); self.SaveConfig(); } void MainWindow::onInfoStyle(GSimpleAction* action, GVariant* value, MainWindow& self) { string s = g_variant_get_string(value, nullptr); GroupInfoStyle style = GroupInfoStyleFromStr(s); if (style == GroupInfoStyle::INVALID) { LOG_WARN("invalid info style: %s", s.c_str()); return; } self.info_style_ = style; self.RefreshPalList(); g_simple_action_set_state(action, value); self.SaveConfig(); } /** * 删除好友项. * @param grpinf 好友群组信息 */ void MainWindow::DeletePalItem(GroupInfo* grpinf) { /* 从UI中移除 */ if (this->PaltreeContainItem(inAddrFromUint32(grpinf->grpid))) { this->DelItemFromPaltree(inAddrFromUint32(grpinf->grpid)); } auto g_cthrd = &coreThread; g_cthrd->Lock(); auto ppal = g_cthrd->GetPal(inAddrFromUint32(grpinf->grpid)); /* 从数据中心点移除 */ if (ppal) { g_cthrd->DelPalFromList(inAddrFromUint32(grpinf->grpid)); ppal->setOnline(false); } /* 加入黑名单 */ if (!g_cthrd->BlacklistContainItem(inAddrFromUint32(grpinf->grpid))) { g_cthrd->AddBlockIp(inAddrFromUint32(grpinf->grpid)); } g_cthrd->Unlock(); } /** * 好友树(paltree)信息提示查询请求. * @param treeview the object which received the signal * @param x the x coordinate of the cursor position * @param y the y coordinate of the cursor position * @param keyboard_mode TRUE if the tooltip was triggered using the keyboard * @param tooltip a GtkTooltip * @return Gtk+库所需 */ gboolean MainWindow::PaltreeQueryTooltip(GtkWidget* treeview, gint x, gint y, gboolean keyboard_mode, GtkTooltip* tooltip, MainWindow*) { GtkTreePath* path; GtkTreeModel* model; GtkTreeIter iter; gint bx, by; GroupInfo* grpinf; gtk_tree_view_convert_widget_to_bin_window_coords(GTK_TREE_VIEW(treeview), x, y, &bx, &by); if (keyboard_mode || !gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(treeview), bx, by, &path, NULL, NULL, NULL)) { return FALSE; } model = gtk_tree_view_get_model(GTK_TREE_VIEW(treeview)); gtk_tree_model_get_iter(model, &iter, path); gtk_tree_path_free(path); gtk_tree_model_get(model, &iter, 6, &grpinf, -1); if (grpinf->getType() != GROUP_BELONG_TYPE_REGULAR) return FALSE; gtk_tooltip_set_markup(tooltip, grpinf->GetHintAsMarkup().c_str()); return TRUE; } /** * 好友树(paltree)项被激活. * @param treeview the object on which the signal is emitted * @param path the GtkTreePath for the activated row * @param column the GtkTreeViewColumn in which the activation occurred */ void MainWindow::onPaltreeItemActivated(GtkWidget* treeview, GtkTreePath* path, GtkTreeViewColumn*, MainWindow* self) { GtkTreeModel* model; GtkTreeIter iter; GroupInfo* grpinf; /* 获取项关联的群组数据 */ model = gtk_tree_view_get_model(GTK_TREE_VIEW(treeview)); gtk_tree_model_get_iter(model, &iter, path); gtk_tree_model_get(model, &iter, 6, &grpinf, -1); /* 检查是否需要新建对话框 */ if (grpinf->getDialog()) { gtk_window_present(GTK_WINDOW(grpinf->getDialog())); return; } /* 根据需求建立对应的对话框 */ switch (grpinf->getType()) { case GROUP_BELONG_TYPE_REGULAR: DialogPeer::PeerDialogEntry(self->app, grpinf); break; case GROUP_BELONG_TYPE_SEGMENT: case GROUP_BELONG_TYPE_GROUP: case GROUP_BELONG_TYPE_BROADCAST: DialogGroup::GroupDialogEntry(self->app, grpinf); default: break; } } /** * 好友树(paltree)弹出操作菜单. * @param treeview tree-view * @param event event * @return Gtk+库所需 */ gboolean MainWindow::PaltreePopupMenu(GtkWidget* treeview, GdkEventButton* event, MainWindow* self) { GtkTreeModel* model; GtkTreePath* path; GtkTreeIter iter; GroupInfo* grpinf; /* 检查事件是否可用 */ if (!gdk_event_triggers_context_menu((GdkEvent*)event) || !gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(treeview), (event->x), (event->y), &path, NULL, NULL, NULL)) { return FALSE; } /* 获取好友群组信息数据 */ model = gtk_tree_view_get_model(GTK_TREE_VIEW(treeview)); gtk_tree_model_get_iter(model, &iter, path); gtk_tree_path_free(path); gtk_tree_model_get(model, &iter, 6, &grpinf, -1); self->setCurrentGroupInfo(grpinf); gtk_widget_show_all(GTK_WIDGET(self->palPopupMenu)); gtk_menu_popup_at_pointer(GTK_MENU(self->palPopupMenu), NULL); return TRUE; } /** * 展开或隐藏某行. * @param treeview text-view * @param event event * @return Gtk+库所需 */ gboolean MainWindow::PaltreeChangeStatus(GtkWidget* treeview, GdkEventButton* event) { GtkTreeModel* model; GtkCellRenderer* cell; GtkTreeViewColumn* column; GtkTreePath* path; GtkTreeIter iter; gint cellx, startpos, width; GroupInfo* grpinf; /* 检查事件的合法性 */ if (event->button != 1 || !gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(treeview), (event->x), (event->y), &path, &column, &cellx, NULL)) return FALSE; /* 检查此行是否可展开 */ model = gtk_tree_view_get_model(GTK_TREE_VIEW(treeview)); gtk_tree_model_get_iter(model, &iter, path); gtk_tree_model_get(model, &iter, 6, &grpinf, -1); if (grpinf->getType() == GROUP_BELONG_TYPE_REGULAR) { gtk_tree_path_free(path); return FALSE; } /* 检查事件所发生的位置是否正确 */ cell = GTK_CELL_RENDERER(g_object_get_data(G_OBJECT(column), "expander-cell")); gtk_tree_view_column_cell_get_position(column, cell, &startpos, &width); if ((cellx < startpos) || (cellx > startpos + width)) { gtk_tree_path_free(path); return FALSE; } /* 展开或隐藏行 */ if (gtk_tree_view_row_expanded(GTK_TREE_VIEW(treeview), path)) gtk_tree_view_collapse_row(GTK_TREE_VIEW(treeview), path); else gtk_tree_view_expand_row(GTK_TREE_VIEW(treeview), path, FALSE); gtk_tree_path_free(path); return TRUE; } /** * 好友树(paltree)拖拽事件响应处理函数. * @param treeview tree-view * @param context the drag context * @param x where the drop happened * @param y where the drop happened * @param data the received data * @param info the info that has been registered with the target in the * GtkTargetList * @param time the timestamp at which the data was received */ void MainWindow::PaltreeDragDataReceived(GtkWidget* treeview, GdkDragContext*, gint x, gint y, GtkSelectionData* data, guint, guint, MainWindow* self) { GtkTreeModel* model; GtkTreePath* path; GtkTreeIter iter; gint bx, by; GroupInfo* grpinf; SessionAbstract* session; GSList* list; /* 事件是否可用 */ gtk_tree_view_convert_widget_to_bin_window_coords(GTK_TREE_VIEW(treeview), x, y, &bx, &by); if (!gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(treeview), bx, by, &path, NULL, NULL, NULL)) return; /* 获取好友群组信息数据 */ model = gtk_tree_view_get_model(GTK_TREE_VIEW(treeview)); gtk_tree_model_get_iter(model, &iter, path); gtk_tree_path_free(path); gtk_tree_model_get(model, &iter, 6, &grpinf, -1); /* 如果好友群组对话框尚未创建,则先创建对话框 */ if (!(grpinf->getDialog())) { switch (grpinf->getType()) { case GROUP_BELONG_TYPE_REGULAR: DialogPeer::PeerDialogEntry(self->app, grpinf); break; case GROUP_BELONG_TYPE_SEGMENT: case GROUP_BELONG_TYPE_GROUP: case GROUP_BELONG_TYPE_BROADCAST: DialogGroup::GroupDialogEntry(self->app, grpinf); default: break; } } else gtk_window_present(GTK_WINDOW(grpinf->getDialog())); /* 获取会话对象,并将数据添加到会话对象 */ session = (SessionAbstract*)g_object_get_data(G_OBJECT(grpinf->getDialog()), "session-class"); list = selection_data_get_path(data); // 获取所有文件 session->AttachEnclosure(list); g_slist_foreach(list, GFunc(g_free), NULL); g_slist_free(list); // session->ShowEnclosure(); } /** * 显示好友清单区域. * @param widset widget set */ void MainWindow::onFind(void*, void*, MainWindow& self) { GtkWidget* widget; widget = GTK_WIDGET(g_datalist_get_data(&self.widset, "pallist-box-widget")); gtk_widget_show(widget); widget = GTK_WIDGET(g_datalist_get_data(&self.widset, "pallist-entry-widget")); gtk_widget_grab_focus(widget); PallistEntryChanged(widget, &self); } void MainWindow::onDeletePal(void*, void*, MainWindow& self) { GroupInfo* groupInfo = CHECK_NOTNULL(self.currentGroupInfo); switch (groupInfo->getType()) { case GROUP_BELONG_TYPE_REGULAR: self.DeletePalItem(groupInfo); break; default: CHECK(false); break; } } void MainWindow::onPalChangeInfo(void*, void*, MainWindow& self) { GroupInfo* groupInfo = CHECK_NOTNULL(self.currentGroupInfo); switch (groupInfo->getType()) { case GROUP_BELONG_TYPE_REGULAR: RevisePal::ReviseEntry(self.app, GTK_WINDOW(self.window), groupInfo->getMembers()[0].get()); break; default: CHECK(false); break; } } void MainWindow::onPalSendMessage(void*, void*, MainWindow& self) { GroupInfo* groupInfo = CHECK_NOTNULL(self.currentGroupInfo); if (groupInfo->getDialog()) { gtk_window_present(GTK_WINDOW(groupInfo->getDialog())); return; } switch (groupInfo->getType()) { case GROUP_BELONG_TYPE_REGULAR: DialogPeer::PeerDialogEntry(self.app, groupInfo); break; case GROUP_BELONG_TYPE_SEGMENT: case GROUP_BELONG_TYPE_GROUP: case GROUP_BELONG_TYPE_BROADCAST: DialogGroup::GroupDialogEntry(self.app, groupInfo); break; default: CHECK(false); break; } } void MainWindow::onPalRequestSharedResources(void*, void*, MainWindow& self) { GroupInfo* groupInfo = CHECK_NOTNULL(self.currentGroupInfo); switch (groupInfo->getType()) { case GROUP_BELONG_TYPE_REGULAR: self.coreThread.SendAskShared(groupInfo->getMembers()[0]); break; default: CHECK(false); break; } } /** * 隐藏好友清单区域. * @param widset widget set */ void MainWindow::HidePallistArea(GData** widset) { GtkWidget* widget; GtkTreeModel* model; widget = GTK_WIDGET(g_datalist_get_data(widset, "pallist-box-widget")); gtk_widget_hide(widget); widget = GTK_WIDGET(g_datalist_get_data(widset, "pallist-treeview-widget")); model = gtk_tree_view_get_model(GTK_TREE_VIEW(widget)); gtk_list_store_clear(GTK_LIST_STORE(model)); widget = GTK_WIDGET(g_datalist_get_data(widset, "pallist-entry-widget")); gtk_editable_delete_text(GTK_EDITABLE(widget), 0, -1); } /** * 清空好友清单搜索输入框. * @param entry entry * @param event event * @return Gtk+库所需 */ gboolean MainWindow::ClearPallistEntry(GtkWidget* entry, GdkEventKey* event) { if (event->keyval != GDK_KEY_Escape) return FALSE; gtk_editable_delete_text(GTK_EDITABLE(entry), 0, -1); return TRUE; } /** * 好友清单搜索输入框内容变更响应处理函数. * @param entry entry * @param widset widget set */ void MainWindow::PallistEntryChanged(GtkWidget* entry, MainWindow* self) { GtkIconTheme* theme; GdkPixbuf* pixbuf; GtkWidget* treeview; GtkTreeModel* model; GtkTreeIter iter; char* file; const gchar* text; auto widset = self->widset; /* 获取默认主题 */ theme = gtk_icon_theme_get_default(); /* 获取搜索内容 */ text = gtk_entry_get_text(GTK_ENTRY(entry)); /* 获取好友清单,并清空 */ treeview = GTK_WIDGET(g_datalist_get_data(&widset, "pallist-treeview-widget")); model = gtk_tree_view_get_model(GTK_TREE_VIEW(treeview)); gtk_list_store_clear(GTK_LIST_STORE(model)); /* 将符合条件的好友加入好友清单 */ for (auto pal : self->coreThread.GetPalList()) { string ipstr = inAddrToString(pal->ipv4()); /* Search friends case ignore is better. */ if (*text == '\0' || strcasestr(pal->getName().c_str(), text) || strcasestr(pal->getGroup().c_str(), text) || strcasestr(ipstr.c_str(), text) || strcasestr(pal->getUser().c_str(), text) || strcasestr(pal->getHost().c_str(), text)) { file = iptux_erase_filename_suffix(pal->icon_file().c_str()); pixbuf = gtk_icon_theme_load_icon(theme, file, MAX_ICONSIZE, GtkIconLookupFlags(0), NULL); g_free(file); gtk_list_store_append(GTK_LIST_STORE(model), &iter); gtk_list_store_set(GTK_LIST_STORE(model), &iter, 0, pixbuf, 1, pal->getName().c_str(), 2, pal->getGroup().c_str(), 3, ipstr.c_str(), 4, pal->getUser().c_str(), 5, pal->getHost().c_str(), 6, pal.get(), -1); if (pixbuf) g_object_unref(pixbuf); } } /* 重新调整好友清单UI */ gtk_tree_view_columns_autosize(GTK_TREE_VIEW(treeview)); } /** * 好友清单(pallist)项被激活. * @param treeview the object on which the signal is emitted * @param path the GtkTreePath for the activated row * @param column the GtkTreeViewColumn in which the activation occurred */ void MainWindow::PallistItemActivated(GtkWidget* treeview, GtkTreePath* path, GtkTreeViewColumn*, MainWindow* self) { GtkTreeModel* model; GtkTreeIter iter; GroupInfo* grpinf; PalInfo* pal; model = gtk_tree_view_get_model(GTK_TREE_VIEW(treeview)); gtk_tree_model_get_iter(model, &iter, path); gtk_tree_model_get(model, &iter, 6, &pal, -1); if ((grpinf = self->coreThread.GetPalRegularItem(pal))) { if (!(grpinf->getDialog())) DialogPeer::PeerDialogEntry(self->app, grpinf); else gtk_window_present(GTK_WINDOW(grpinf->getDialog())); } } /** * 好友清单(pallist)拖拽事件响应处理函数. * @param treeview tree-view * @param context the drag context * @param x where the drop happened * @param y where the drop happened * @param data the received data * @param info the info that has been registered with the target in the * GtkTargetList * @param time the timestamp at which the data was received */ void MainWindow::PallistDragDataReceived(GtkWidget* treeview, GdkDragContext*, gint x, gint y, GtkSelectionData* data, guint, guint, MainWindow* self) { GtkTreeModel* model; GtkTreePath* path; GtkTreeIter iter; gint bx, by; GroupInfo* grpinf; PalInfo* pal; SessionAbstract* session; GSList* list; /* 事件是否可用 */ gtk_tree_view_convert_widget_to_bin_window_coords(GTK_TREE_VIEW(treeview), x, y, &bx, &by); if (!gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(treeview), bx, by, &path, NULL, NULL, NULL)) return; /* 获取好友群组信息数据 */ model = gtk_tree_view_get_model(GTK_TREE_VIEW(treeview)); gtk_tree_model_get_iter(model, &iter, path); gtk_tree_path_free(path); gtk_tree_model_get(model, &iter, 6, &pal, -1); if (!(grpinf = self->coreThread.GetPalRegularItem(pal))) return; /* 如果好友群组对话框尚未创建,则先创建对话框 */ if (!(grpinf->getDialog())) DialogPeer::PeerDialogEntry(self->app, grpinf); else gtk_window_present(GTK_WINDOW(grpinf->getDialog())); /* 获取会话对象,并将数据添加到会话对象 */ session = (SessionAbstract*)g_object_get_data(G_OBJECT(grpinf->getDialog()), "session-class"); list = selection_data_get_path(data); // 获取所有文件 session->AttachEnclosure(list); g_slist_foreach(list, GFunc(g_free), NULL); g_slist_free(list); // session->ShowEnclosure(); } /** * 主窗口位置&大小改变的响应处理函数. * @param window 主窗口 * @param event the GdkEventConfigure which triggered this signal * @param dtset data set * @return Gtk+库所需 */ gboolean MainWindow::MWinConfigureEvent(GtkWidget*, GdkEventConfigure* event, MainWindow* self) { self->windowConfig.SetWidth(event->width) .SetHeight(event->height) .SaveToConfig(self->config); return FALSE; } /** * 分割面板的分割位置改变的响应处理函数. * @param paned paned * @param pspec he GParamSpec of the property which changed * @param dtset data set */ void MainWindow::PanedDivideChanged(GtkWidget* paned, GParamSpec*, MainWindow* self) { self->config->SetInt(config_names[CFG_MAIN_PANED_DIVIDE], gtk_paned_get_position(GTK_PANED(paned))); self->config->Save(); } void MainWindow::ProcessEvent(shared_ptr _event) { EventType type = _event->getType(); if (type == EventType::NEW_PAL_ONLINE) { auto event = (const NewPalOnlineEvent*)(_event.get()); auto ipv4 = event->getPalInfo()->ipv4(); if (PaltreeContainItem(ipv4)) { UpdateItemToPaltree(ipv4); } else { AttachItemToPaltree(ipv4); } return; } if (type == EventType::PAL_UPDATE) { auto event = dynamic_pointer_cast(_event); auto ipv4 = event->getPalInfo()->ipv4(); if (PaltreeContainItem(ipv4)) { UpdateItemToPaltree(ipv4); } else { AttachItemToPaltree(ipv4); } return; } if (type == EventType::PAL_OFFLINE) { auto event = dynamic_pointer_cast(_event); auto ipv4 = event->GetPalKey().GetIpv4(); if (PaltreeContainItem(ipv4)) { DelItemFromPaltree(ipv4); } } if (type == EventType::ICON_UPDATE) { auto event = (const IconUpdateEvent*)(_event.get()); auto ipv4 = event->GetPalKey().GetIpv4(); UpdateItemToPaltree(ipv4); } if (type == EventType::NEW_MESSAGE) { auto event = (const NewMessageEvent*)(_event.get()); auto para = event->getMsgPara(); GroupInfo* grpinf = nullptr; SessionAbstract* session; /* 获取群组信息 */ switch (para.btype) { case GROUP_BELONG_TYPE_REGULAR: grpinf = coreThread.GetPalRegularItem(para.getPal().get()); if (coreThread.getProgramData()->IsAutoOpenChatDialog()) { if (!(grpinf->getDialog())) { DialogPeer::PeerDialogEntry(this->app, grpinf); } else { gtk_window_present(GTK_WINDOW(grpinf->getDialog())); } } break; case GROUP_BELONG_TYPE_SEGMENT: grpinf = coreThread.GetPalSegmentItem(para.getPal().get()); break; case GROUP_BELONG_TYPE_GROUP: grpinf = coreThread.GetPalGroupItem(para.getPal().get()); break; case GROUP_BELONG_TYPE_BROADCAST: grpinf = coreThread.GetPalBroadcastItem(para.getPal().get()); break; default: grpinf = nullptr; break; } /* 如果群组存在则插入消息 */ /* 群组不存在是编程上的错误,请发送Bug报告 */ if (grpinf) { grpinf->addMsgPara(para); if (grpinf->getDialog()) { session = (SessionAbstract*)g_object_get_data( G_OBJECT(grpinf->getDialog()), "session-class"); session->OnNewMessageComing(); } } return; } if (type == EventType::PASSWORD_REQUIRED) { auto event = (const PasswordRequiredEvent*)(_event.get()); auto palKey = event->GetPalKey(); auto pal = coreThread.GetPal(palKey); auto passwd = pop_obtain_shared_passwd(GTK_WINDOW(this->getWindow()), pal.get()); if (passwd && *passwd != '\0') { coreThread.SendAskSharedWithPassword(palKey, passwd); } return; } if (type == EventType::PERMISSION_REQUIRED) { auto event = (const PermissionRequiredEvent*)(_event.get()); auto pal = coreThread.GetPal(event->GetPalKey()); auto permit = pop_request_shared_file(GTK_WINDOW(this->getWindow()), pal.get()); if (permit) { coreThread.SendSharedFiles(pal); } return; } if (type == EventType::NEW_SHARE_FILE_FROM_FRIEND) { auto event = dynamic_cast(_event.get()); CHECK_NOTNULL(event); auto file = new FileInfo(event->GetFileInfo()); coreThread.PushItemToEnclosureList(file); return; } LOG_DEBUG("event type %d is ignored by `MainWindow`", int(type)); } void MainWindow::setCurrentGroupInfo(GroupInfo* groupInfo) { this->currentGroupInfo = CHECK_NOTNULL(groupInfo); switch (currentGroupInfo->getType()) { case GROUP_BELONG_TYPE_REGULAR: g_action_map_enable_actions(G_ACTION_MAP(window), "pal.send_message", "pal.request_shared_resources", "pal.change_info", "pal.delete_pal", nullptr); break; case GROUP_BELONG_TYPE_SEGMENT: case GROUP_BELONG_TYPE_GROUP: case GROUP_BELONG_TYPE_BROADCAST: g_action_map_enable_actions(G_ACTION_MAP(window), "pal.send_message", nullptr); g_action_map_disable_actions( G_ACTION_MAP(window), "pal.request_shared_resources", "pal.change_info", "pal.delete_pal", nullptr); break; default: g_action_map_disable_actions(G_ACTION_MAP(window), "pal.send_message", "pal.request_shared_resources", "pal.change_info", "pal.delete_pal", nullptr); break; } } void MainWindow::onGroupInfoUpdated(GroupInfo* groupInfo) { GtkTreeIter iter; if (GroupGetPaltreeItem(regular_model, &iter, groupInfo)) { FillGroupInfoToPaltree(regular_model, &iter, groupInfo); } } void MainWindow::RefreshPalList() { RefreshPalListRegular(); } void MainWindow::RefreshPalListRegular() { auto model = regular_model; GtkTreeIter iter; if (!gtk_tree_model_get_iter_first(model, &iter)) return; do { GroupInfo* grpinf = PalTreeModelGetGroupInfo(model, &iter); if (grpinf == nullptr) { LOG_WARN("don't have pgrpinf in this model and iter: %p, %p", (void*)model, (void*)&iter); continue; } FillGroupInfoToPaltree(model, &iter, grpinf); } while (gtk_tree_model_iter_next(model, &iter)); } void MainWindow::FillGroupInfoToPaltree(GtkTreeModel* model, GtkTreeIter* iter, GroupInfo* grpinf) { palTreeModelFillFromGroupInfo(model, iter, grpinf, info_style_, progdt->font); } } // namespace iptux iptux-0.9.4/src/iptux/MainWindow.h000066400000000000000000000165741475473122500171110ustar00rootroot00000000000000// // C++ Interface: MainWindow // // Description: // 创建程序主窗口 // // Author: Jally , (C) 2008 // // Copyright: See COPYING file that comes with this distribution // // #ifndef IPTUX_MAINWINDOW_H #define IPTUX_MAINWINDOW_H #include "iptux-core/Event.h" #include "iptux-core/IptuxConfig.h" #include "iptux-core/Models.h" #include "iptux/Application.h" #include "iptux/UiCoreThread.h" #include "iptux/UiModels.h" #include "iptux/WindowConfig.h" namespace iptux { class StatusIcon; /** * @note 鉴于本类成员函数所访问的(CoreThread)类成员链表都具有只增不减的特性, * 所以无须加锁访问,若有例外,请于注释中说明,否则应当bug处理.\n * 若此特性不可被如此利用,请报告bug. */ class MainWindow : public sigc::trackable { public: MainWindow(Application* app, UiCoreThread& coreThread); ~MainWindow(); GtkWidget* getWindow(); void Show(); bool PaltreeContainItem(in_addr ipv4); void UpdateItemToPaltree(in_addr ipv4); void AttachItemToPaltree(in_addr ipv4); void DelItemFromPaltree(in_addr ipv4); void ClearAllItemFromPaltree(); std::shared_ptr GetProgramData() { return progdt; } std::shared_ptr getConfig() { return config; } Application* getApp() { return app; } PalTreeModelSortKey sort_key() const { return sort_key_; } GtkSortType sort_type() const { return sort_type_; } GroupInfoStyle info_style() const { return info_style_; } void ProcessEvent(std::shared_ptr event); private: Application* app; UiCoreThread& coreThread; GtkWidget* window; std::shared_ptr progdt; std::shared_ptr config; GData* widset; // 窗体集 GData* mdlset; // 数据model集 PalTreeModel* regular_model = 0; GList* tmdllist; // model链表,用于构建model循环结构 guint timerid; // UI更新定时器ID struct tm info_refresh_tm; WindowConfig windowConfig; GtkBuilder* builder; GtkMenu* palPopupMenu; GroupInfo* currentGroupInfo = 0; GtkSortType sort_type_ = GTK_SORT_DESCENDING; PalTreeModelSortKey sort_key_ = PalTreeModelSortKey::NICKNAME; GroupInfoStyle info_style_ = GroupInfoStyle::IP; private: void setCurrentGroupInfo(GroupInfo* groupInfo); void InitSublayer(); void LoadConfig(); void SaveConfig(); void ClearSublayer(); void CreateWindow(); GtkWidget* CreateMainWindow(); void CreateActions(); void CreateTitle(); GtkWidget* CreateAllArea(); GtkWidget* CreateToolBar(); GtkWidget* CreatePaltreeArea(); GtkWidget* CreatePallistArea(); GtkTreeModel* CreatePallistModel(); GtkWidget* CreatePaltreeTree(GtkTreeModel* model); GtkWidget* CreatePallistTree(GtkTreeModel* model); /** * @brief refresh pal list, used when change view options. */ void RefreshPalList(); void RefreshPalListRegular(); bool GroupGetPrevPaltreeItem(GtkTreeModel* model, GtkTreeIter* iter, GroupInfo* grpinf); bool GroupGetPaltreeItem(GtkTreeModel* model, GtkTreeIter* iter, GroupInfo* grpinf); bool GroupGetPaltreeItemWithParent(GtkTreeModel* model, GtkTreeIter* iter, GroupInfo* grpinf); void FillGroupInfoToPaltree(GtkTreeModel* model, GtkTreeIter* iter, GroupInfo* grpinf); void BlinkGroupItemToPaltree(GtkTreeModel* model, GtkTreeIter* iter, bool blinking); static void FillPalInfoToBuffer(GtkTextBuffer* buffer, PalInfo* pal); private: std::string getTitle() const; static gboolean UpdateUI(MainWindow* mwin); static void GoPrevTreeModel(MainWindow* mwin); static void GoNextTreeModel(MainWindow* mwin); void DeletePalItem(GroupInfo* grpinf); static gboolean PaltreeQueryTooltip(GtkWidget* treeview, gint x, gint y, gboolean key, GtkTooltip* tooltip, MainWindow* self); static void onPaltreeItemActivated(GtkWidget* treeview, GtkTreePath* path, GtkTreeViewColumn* column, MainWindow* self); static gboolean PaltreePopupMenu(GtkWidget* treeview, GdkEventButton* event, MainWindow* self); static gboolean PaltreeChangeStatus(GtkWidget* treeview, GdkEventButton* event); static void PaltreeDragDataReceived(GtkWidget* treeview, GdkDragContext* context, gint x, gint y, GtkSelectionData* data, guint info, guint time, MainWindow* self); static void HidePallistArea(GData** widset); static gboolean ClearPallistEntry(GtkWidget* entry, GdkEventKey* event); static void PallistEntryChanged(GtkWidget* entry, MainWindow* self); static void PallistItemActivated(GtkWidget* treeview, GtkTreePath* path, GtkTreeViewColumn* column, MainWindow* self); static void PallistDragDataReceived(GtkWidget* treeview, GdkDragContext* context, gint x, gint y, GtkSelectionData* data, guint info, guint time, MainWindow* self); static gboolean MWinConfigureEvent(GtkWidget* window, GdkEventConfigure* event, MainWindow* self); static gboolean TWinConfigureEvent(GtkWidget* window, GdkEventConfigure* event, MainWindow* self); static void PanedDivideChanged(GtkWidget* paned, GParamSpec* pspec, MainWindow* self); static void onRefresh(void*, void*, MainWindow& self); static void onDetect(void*, void*, MainWindow& self); static void onFind(void*, void*, MainWindow& self); static void onPalSendMessage(void*, void*, MainWindow& self); static void onPalRequestSharedResources(void*, void*, MainWindow& self); static void onPalChangeInfo(void*, void*, MainWindow& self); static void onDeletePal(void*, void*, MainWindow& self); static void onSortType(GSimpleAction* action, GVariant* value, MainWindow& self); static void onSortBy(GSimpleAction* action, GVariant* value, MainWindow& self); static void onInfoStyle(GSimpleAction* action, GVariant* value, MainWindow& self); static gboolean onNewPalOnlineEvent(gpointer data); void onGroupInfoUpdated(GroupInfo* groupInfo); }; } // namespace iptux #endif iptux-0.9.4/src/iptux/MainWindowTest.cpp000066400000000000000000000035731475473122500202770ustar00rootroot00000000000000#include "Application.h" #include "UiModels.h" #include "gtest/gtest.h" #include "iptux-core/TestHelper.h" #include "iptux/MainWindow.h" #include "iptux/TestHelper.h" using namespace std; using namespace iptux; void do_action(MainWindow* w, const string& name, const string& val) { GActionMap* m = G_ACTION_MAP(w->getWindow()); g_action_change_state(g_action_map_lookup_action(m, name.c_str()), g_variant_new_string(val.c_str())); } TEST(MainWindow, Constructor) { Application* app = CreateApplication(); MainWindow mw(app, *app->getCoreThread()); mw.getWindow(); do_action(&mw, "sort_by", "nickname"); ASSERT_EQ(mw.sort_key(), PalTreeModelSortKey::NICKNAME); do_action(&mw, "sort_by", "username"); ASSERT_EQ(mw.sort_key(), PalTreeModelSortKey::USERNAME); do_action(&mw, "sort_by", "ip"); ASSERT_EQ(mw.sort_key(), PalTreeModelSortKey::IP); do_action(&mw, "sort_by", "host"); ASSERT_EQ(mw.sort_key(), PalTreeModelSortKey::HOST); do_action(&mw, "sort_by", "last_activity"); ASSERT_EQ(mw.sort_key(), PalTreeModelSortKey::LAST_ACTIVITY); do_action(&mw, "sort_type", "ascending"); ASSERT_EQ(mw.sort_type(), GTK_SORT_ASCENDING); do_action(&mw, "sort_type", "descending"); ASSERT_EQ(mw.sort_type(), GTK_SORT_DESCENDING); do_action(&mw, "info_style", "ip"); ASSERT_EQ(mw.info_style(), GroupInfoStyle::IP); do_action(&mw, "info_style", "username"); ASSERT_EQ(mw.info_style(), GroupInfoStyle::USERNAME); do_action(&mw, "info_style", "host"); ASSERT_EQ(mw.info_style(), GroupInfoStyle::HOST); do_action(&mw, "info_style", "version"); ASSERT_EQ(mw.info_style(), GroupInfoStyle::VERSION_NAME); do_action(&mw, "info_style", "last_activity"); ASSERT_EQ(mw.info_style(), GroupInfoStyle::LAST_ACTIVITY); do_action(&mw, "info_style", "last_message"); ASSERT_EQ(mw.info_style(), GroupInfoStyle::LAST_MESSAGE); DestroyApplication(app); } iptux-0.9.4/src/iptux/NotificationService.h000066400000000000000000000012111475473122500207620ustar00rootroot00000000000000#ifndef IPTUX_NOTIFICATION_SERVICE #define IPTUX_NOTIFICATION_SERVICE #include #include namespace iptux { class NotificationService { public: virtual ~NotificationService() = default; virtual void sendNotification(GApplication* app, const std::string& id, const std::string& title, const std::string& body, const std::string& detailedAction, GNotificationPriority priority, GIcon* icon) = 0; }; } // namespace iptux #endif iptux-0.9.4/src/iptux/RevisePal.cpp000066400000000000000000000316311475473122500172510ustar00rootroot00000000000000// // C++ Implementation: RevisePal // // Description: // // // Author: Jally , (C) 2008 // // Copyright: See COPYING file that comes with this distribution // // #include "config.h" #include "RevisePal.h" #include #include #include #include #include "iptux-core/Const.h" #include "iptux-utils/utils.h" #include "iptux/UiCoreThread.h" #include "iptux/callback.h" namespace iptux { /** * 类构造函数. * @param pl */ RevisePal::RevisePal(Application* app, GtkWindow* parent, PalInfo* pl) : widset(NULL), mdlset(NULL), app(CHECK_NOTNULL(app)), parent(parent), pal(CHECK_NOTNULL(pl)) { InitSublayer(); } /** * 类析构函数. */ RevisePal::~RevisePal() { ClearSublayer(); } /** * 修正好友数据入口. * @param pal class PalInfo */ void RevisePal::ReviseEntryDo(Application* app, GtkWindow* parent, PalInfo* pal, bool run) { RevisePal rpal(app, parent, pal); GtkWidget* dialog; /* 创建对话框 */ dialog = rpal.CreateMainDialog(); gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), rpal.CreateAllArea(), TRUE, TRUE, 0); rpal.SetAllValue(); /* 运行对话框 */ gtk_widget_show_all(dialog); if (run) { switch (gtk_dialog_run(GTK_DIALOG(dialog))) { case GTK_RESPONSE_OK: rpal.ApplyReviseData(); break; default: break; } } gtk_widget_destroy(dialog); } /** * 初始化底层数据. */ void RevisePal::InitSublayer() { GtkTreeModel* model; g_datalist_init(&widset); g_datalist_init(&mdlset); model = CreateIconModel(); g_datalist_set_data_full(&mdlset, "icon-model", model, GDestroyNotify(g_object_unref)); FillIconModel(model); } /** * 清空底层数据. */ void RevisePal::ClearSublayer() { g_datalist_clear(&widset); g_datalist_clear(&mdlset); } /** * 创建主对话框窗体. * @return 对话框 */ GtkWidget* RevisePal::CreateMainDialog() { GtkWidget* dialog; dialog = gtk_dialog_new_with_buttons( _("Change Pal's Information"), parent, GTK_DIALOG_MODAL, _("_OK"), GTK_RESPONSE_OK, _("_Cancel"), GTK_RESPONSE_CANCEL, NULL); gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK); gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); gtk_container_set_border_width(GTK_CONTAINER(dialog), 5); gtk_widget_set_size_request(dialog, 400, -1); g_datalist_set_data(&widset, "dialog-widget", dialog); return dialog; } /** * 创建所有区域窗体. * @return 主窗体 */ GtkWidget* RevisePal::CreateAllArea() { GtkWidget *box, *hbox; GtkWidget *label, *button, *widget; GtkTreeModel* model; box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); /* 好友昵称 */ hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 0); label = gtk_label_new(_("Pal's nickname:")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); widget = gtk_entry_new(); g_object_set(widget, "has-tooltip", TRUE, NULL); gtk_box_pack_start(GTK_BOX(hbox), widget, TRUE, TRUE, 0); g_signal_connect(widget, "query-tooltip", G_CALLBACK(entry_query_tooltip), _("Please input pal's new nickname!")); g_datalist_set_data(&widset, "nickname-entry-widget", widget); /* 好友群组 */ hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 0); label = gtk_label_new(_("Pal's group name:")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); widget = gtk_entry_new(); g_object_set(widget, "has-tooltip", TRUE, NULL); gtk_box_pack_start(GTK_BOX(hbox), widget, TRUE, TRUE, 0); g_signal_connect(widget, "query-tooltip", G_CALLBACK(entry_query_tooltip), _("Please input pal's new group name!")); g_datalist_set_data(&widset, "group-entry-widget", widget); /* 好友系统编码 */ hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 0); label = gtk_label_new(_("System coding:")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); widget = gtk_entry_new(); g_object_set(widget, "has-tooltip", TRUE, NULL); gtk_box_pack_start(GTK_BOX(hbox), widget, TRUE, TRUE, 0); g_signal_connect(widget, "query-tooltip", G_CALLBACK(entry_query_tooltip), _("Be SURE to know what you are doing!")); g_datalist_set_data(&widset, "encode-entry-widget", widget); /* 好友头像 */ hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 0); label = gtk_label_new(_("Pal's face picture:")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); model = GTK_TREE_MODEL(g_datalist_get_data(&mdlset, "icon-model")); widget = CreateIconTree(model); gtk_box_pack_start(GTK_BOX(hbox), widget, TRUE, TRUE, 0); g_datalist_set_data(&widset, "icon-combo-widget", widget); button = gtk_button_new_with_label("..."); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); g_signal_connect(button, "clicked", G_CALLBACK(AddNewIcon), &widset); /* 协议兼容性 */ hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 0); widget = gtk_check_button_new_with_label( _("Be compatible with iptux's protocol (DANGEROUS)")); gtk_box_pack_start(GTK_BOX(hbox), widget, FALSE, FALSE, 0); g_datalist_set_data(&widset, "compatible-check-widget", widget); return box; } /** * 给界面预设数据. */ void RevisePal::SetAllValue() { GtkWidget* widget; GtkTreeModel* model; gint active; /* 预置昵称 */ widget = GTK_WIDGET(g_datalist_get_data(&widset, "nickname-entry-widget")); gtk_entry_set_text(GTK_ENTRY(widget), pal->getName().c_str()); /* 预置群组 */ widget = GTK_WIDGET(g_datalist_get_data(&widset, "group-entry-widget")); gtk_entry_set_text(GTK_ENTRY(widget), pal->getGroup().c_str()); /* 预置编码 */ widget = GTK_WIDGET(g_datalist_get_data(&widset, "encode-entry-widget")); gtk_entry_set_text(GTK_ENTRY(widget), pal->getEncode().c_str()); /* 预置头像 */ widget = GTK_WIDGET(g_datalist_get_data(&widset, "icon-combo-widget")); model = gtk_combo_box_get_model(GTK_COMBO_BOX(widget)); if (!pal->icon_file().empty()) { active = IconfileGetItemPos(model, pal->icon_file().c_str()); gtk_combo_box_set_active(GTK_COMBO_BOX(widget), active); } /* 预置兼容性 */ widget = GTK_WIDGET(g_datalist_get_data(&widset, "compatible-check-widget")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), pal->isCompatible()); } /** * 应用修正后的数据. */ void RevisePal::ApplyReviseData() { GtkWidget* widget; GdkPixbuf* pixbuf; GtkTreeModel* model; GtkTreeIter iter; char path[MAX_PATHLEN]; gchar *text, *file; const gchar* consttext; gint active; /* 获取昵称 */ widget = GTK_WIDGET(g_datalist_get_data(&widset, "nickname-entry-widget")); if (*(consttext = gtk_entry_get_text(GTK_ENTRY(widget))) != '\0') { pal->setName(consttext); } /* 获取群组 */ widget = GTK_WIDGET(g_datalist_get_data(&widset, "group-entry-widget")); if (*(consttext = gtk_entry_get_text(GTK_ENTRY(widget))) != '\0') pal->setGroup(consttext); else pal->setGroup(""); /* 获取编码 */ widget = GTK_WIDGET(g_datalist_get_data(&widset, "encode-entry-widget")); text = gtk_editable_get_chars(GTK_EDITABLE(widget), 0, -1); g_strstrip(text); if (*text != '\0') { pal->setEncode(text); } else g_free(text); /* 获取头像 */ widget = GTK_WIDGET(g_datalist_get_data(&widset, "icon-combo-widget")); model = gtk_combo_box_get_model(GTK_COMBO_BOX(widget)); active = gtk_combo_box_get_active(GTK_COMBO_BOX(widget)); snprintf(path, MAX_PATHLEN, "%d", active); gtk_tree_model_get_iter_from_string(model, &iter, path); gtk_tree_model_get(model, &iter, 1, &file, -1); if (pal->icon_file() != file) { snprintf(path, MAX_PATHLEN, __PIXMAPS_PATH "/icon/%s", file); if (access(path, F_OK) != 0) { g_free(file); snprintf(path, MAX_PATHLEN, "%s" ICON_PATH "/%" PRIx32, g_get_user_cache_dir(), ntohl(pal->ipv4().s_addr)); pal->set_icon_file(stringFormat("%" PRIx32, ntohl(pal->ipv4().s_addr))); gtk_tree_model_get(model, &iter, 0, &pixbuf, -1); gdk_pixbuf_save(pixbuf, path, "png", NULL, NULL); gtk_icon_theme_add_builtin_icon(pal->icon_file().c_str(), MAX_ICONSIZE, pixbuf); g_object_unref(pixbuf); } else { pal->set_icon_file(file); } } else g_free(file); /* 获取兼容性 */ widget = GTK_WIDGET(g_datalist_get_data(&widset, "compatible-check-widget")); pal->setCompatible(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))); /* 设置好友信息已被手工修改 */ pal->setChanged(true); auto g_cthrd = app->getCoreThread(); /* 更新好友信息 */ g_cthrd->Lock(); g_cthrd->UpdatePalToList(pal->ipv4()); g_cthrd->Unlock(); } /** * 头像树(icon-tree)底层数据结构. * 2,0 icon,1 iconfile \n * 头像;文件名(带后缀) \n * @return icon-model */ GtkTreeModel* RevisePal::CreateIconModel() { GtkListStore* model; model = gtk_list_store_new(2, GDK_TYPE_PIXBUF, G_TYPE_STRING); return GTK_TREE_MODEL(model); } /** * 为头像树(icon-tree)填充底层数据. * @param model icon-model */ void RevisePal::FillIconModel(GtkTreeModel* model) { GtkIconTheme* theme; GdkPixbuf* pixbuf; GtkTreeIter iter; struct dirent* dirt; DIR* dir; char* file; theme = gtk_icon_theme_get_default(); if ((dir = opendir(__PIXMAPS_PATH "/icon"))) { while ((dirt = readdir(dir))) { if (strcmp(dirt->d_name, ".") == 0 || strcmp(dirt->d_name, "..") == 0) continue; file = iptux_erase_filename_suffix(dirt->d_name); if ((pixbuf = gtk_icon_theme_load_icon(theme, file, MAX_ICONSIZE, GtkIconLookupFlags(0), NULL))) { gtk_list_store_append(GTK_LIST_STORE(model), &iter); gtk_list_store_set(GTK_LIST_STORE(model), &iter, 0, pixbuf, 1, dirt->d_name, -1); g_object_unref(pixbuf); } g_free(file); } closedir(dir); } } /** * 创建头像树(icon-tree). * @param model icon-model * @return 头像树 */ GtkWidget* RevisePal::CreateIconTree(GtkTreeModel* model) { GtkWidget* combo; GtkCellRenderer* cell; combo = gtk_combo_box_new_with_model(model); gtk_combo_box_set_wrap_width(GTK_COMBO_BOX(combo), 5); cell = gtk_cell_renderer_pixbuf_new(); gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo), cell, FALSE); gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo), cell, "pixbuf", 0, NULL); return combo; } /** * 查询(pathname)文件在(model)中的位置,若没有则加入到后面. * @param model model * @param pathname 文件路径 * @return 位置 */ gint RevisePal::IconfileGetItemPos(GtkTreeModel* model, const char* pathname) { GtkIconTheme* theme; GdkPixbuf* pixbuf; GtkTreeIter iter; const char* ptr; gchar* file; gint result, pos; /* 让ptr指向文件名 */ ptr = strrchr(pathname, '/'); ptr = ptr ? ptr + 1 : pathname; /* 查询model中是否已经存在此文件 */ pos = 0; if (gtk_tree_model_get_iter_first(model, &iter)) { do { gtk_tree_model_get(model, &iter, 1, &file, -1); result = strcmp(ptr, file); g_free(file); if (result == 0) return pos; pos++; } while (gtk_tree_model_iter_next(model, &iter)); } /* 将文件加入model */ if (access(pathname, F_OK) != 0) { theme = gtk_icon_theme_get_default(); file = iptux_erase_filename_suffix(pathname); pixbuf = gtk_icon_theme_load_icon(theme, file, MAX_ICONSIZE, GtkIconLookupFlags(0), NULL); g_free(file); } else pixbuf = gdk_pixbuf_new_from_file_at_size(pathname, MAX_ICONSIZE, MAX_ICONSIZE, NULL); if (pixbuf) { gtk_list_store_append(GTK_LIST_STORE(model), &iter); gtk_list_store_set(GTK_LIST_STORE(model), &iter, 0, pixbuf, 1, ptr, -1); g_object_unref(pixbuf); } else pos = -1; return pos; } /** * 添加新的头像数据. * @param button button * @param widset widget set */ void RevisePal::AddNewIcon(GtkWidget* button, GData** widset) { GtkWidget *parent, *combo; GtkTreeModel* model; gchar* filename; gint active; parent = GTK_WIDGET(g_datalist_get_data(widset, "dialog-widget")); if (!(filename = choose_file_with_preview(_("Please select a face picture"), parent))) return; combo = GTK_WIDGET(g_object_get_data(G_OBJECT(button), "icon-combo-widget")); model = gtk_combo_box_get_model(GTK_COMBO_BOX(combo)); active = IconfileGetItemPos(model, filename); gtk_combo_box_set_active(GTK_COMBO_BOX(combo), active); g_free(filename); } } // namespace iptux iptux-0.9.4/src/iptux/RevisePal.h000066400000000000000000000025311475473122500167130ustar00rootroot00000000000000// // C++ Interface: RevisePal // // Description:手动更改好友数据 // // // Author: Jally , (C) 2008 // // Copyright: See COPYING file that comes with this distribution // // #ifndef IPTUX_REVISEPAL_H #define IPTUX_REVISEPAL_H #include #include "iptux-core/Models.h" #include "iptux/Application.h" namespace iptux { class RevisePal { public: RevisePal(Application* app, GtkWindow* parent, PalInfo* pl); ~RevisePal(); static void ReviseEntryDo(Application* app, GtkWindow* parent, PalInfo* pal, bool run); static void ReviseEntry(Application* app, GtkWindow* parent, PalInfo* pal) { ReviseEntryDo(app, parent, pal, true); } private: void InitSublayer(); void ClearSublayer(); GtkWidget* CreateMainDialog(); GtkWidget* CreateAllArea(); void SetAllValue(); void ApplyReviseData(); GtkTreeModel* CreateIconModel(); void FillIconModel(GtkTreeModel* model); GtkWidget* CreateIconTree(GtkTreeModel* model); GData* widset; GData* mdlset; Application* app; GtkWindow* parent; PalInfo* pal; private: static gint IconfileGetItemPos(GtkTreeModel* model, const char* pathname); //回调处理部分 private: static void AddNewIcon(GtkWidget* button, GData** widset); }; } // namespace iptux #endif iptux-0.9.4/src/iptux/RevisePalTest.cpp000066400000000000000000000011101475473122500200760ustar00rootroot00000000000000#include "gtest/gtest.h" #include "iptux-core/TestHelper.h" #include "iptux/Application.h" #include "iptux/RevisePal.h" #include "iptux/TestHelper.h" using namespace std; using namespace iptux; TEST(RevisePal, Constructor) { Application* app = CreateApplication(); PalInfo palInfo("127.0.0.1", 2425); RevisePal pal(app, nullptr, &palInfo); DestroyApplication(app); } TEST(RevisePal, ReviseEntryDo) { Application* app = CreateApplication(); PalInfo palInfo("127.0.0.1", 2425); RevisePal::ReviseEntryDo(app, nullptr, &palInfo, false); DestroyApplication(app); } iptux-0.9.4/src/iptux/ShareFile.cpp000066400000000000000000000425551475473122500172300ustar00rootroot00000000000000// // C++ Implementation: ShareFile // // Description: // // // Author: Jally , (C) 2008 // // Copyright: See COPYING file that comes with this distribution // // #include "config.h" #include "ShareFile.h" #include #include #include #include "iptux-utils/utils.h" #include "iptux/UiCoreThread.h" #include "iptux/UiHelper.h" #include "iptux/dialog.h" using namespace std; #define IPTUX_PRIVATE "iptux-private" namespace iptux { class ShareFilePrivate { public: Application* app = 0; GtkTreeModel* model = 0; public: ~ShareFilePrivate() { g_clear_object(&model); } static void destroy(ShareFilePrivate* priv) { delete priv; } void FillFileModel(GtkTreeModel* model); }; static void DragDataReceived(ShareFile* sfile, GdkDragContext* context, gint x, gint y, GtkSelectionData* data, guint info, guint time); static GtkTreeModel* CreateFileModel(); static GtkWidget* CreateAllArea(ShareFile* self); static void ApplySharedData(ShareFile* self); static GtkWidget* CreateFileTree(GtkTreeModel* model); static void AddRegular(ShareFile* sfile); static void DeleteFiles(ShareFile* self); static void AddFolder(ShareFile* sfile); static void ClearPassword(ShareFile* self); static void SetPassword(ShareFile* self); static gint FileTreeCompareFunc(GtkTreeModel* model, GtkTreeIter* a, GtkTreeIter* b); ShareFilePrivate* getPriv(ShareFile* window) { return (ShareFilePrivate*)g_object_get_data(G_OBJECT(window), IPTUX_PRIVATE); } void shareFileRun(ShareFile* dialog, GtkWindow* parent) { gtk_window_set_transient_for(GTK_WINDOW(dialog), parent); switch (gtk_dialog_run(GTK_DIALOG(dialog))) { case GTK_RESPONSE_OK: ApplySharedData(dialog); break; case GTK_RESPONSE_APPLY: ApplySharedData(dialog); shareFileRun(dialog, parent); break; default: break; } gtk_widget_hide(GTK_WIDGET(dialog)); } /** * 初始化底层数据. */ void InitSublayer(ShareFile* self) { GtkTreeModel* model; model = CreateFileModel(); auto priv = getPriv(self); g_set_object(&priv->model, model); priv->FillFileModel(model); } /** * 创建主对话框窗口. * @param parent 父窗口指针 * @return 对话框 */ ShareFile* shareFileNew(Application* app) { ShareFile* dialog; dialog = GTK_DIALOG(gtk_dialog_new_with_buttons( _("Shared Files Management"), nullptr, GTK_DIALOG_MODAL, // _("OK"), GTK_RESPONSE_OK, // _("Apply"), GTK_RESPONSE_APPLY, // _("Cancel"), GTK_RESPONSE_CANCEL, // NULL)); ShareFilePrivate* priv = new ShareFilePrivate(); priv->app = app; g_object_set_data_full(G_OBJECT(dialog), IPTUX_PRIVATE, priv, GDestroyNotify(ShareFilePrivate::destroy)); InitSublayer(dialog); gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK); gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER); gtk_container_set_border_width(GTK_CONTAINER(dialog), 5); gtk_widget_set_size_request(GTK_WIDGET(dialog), 500, 350); widget_enable_dnd_uri(GTK_WIDGET(dialog)); g_signal_connect(dialog, "drag-data-received", G_CALLBACK(DragDataReceived), NULL); gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), CreateAllArea(dialog), TRUE, TRUE, 0); return dialog; } /** * 创建对话框中所有的窗体. * @return 主窗体 */ GtkWidget* CreateAllArea(ShareFile* self) { GtkWidget *box, *vbox; GtkWidget *sw, *button, *widget; box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); /* 加入文件树 */ sw = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_ETCHED_IN); gtk_box_pack_end(GTK_BOX(box), sw, TRUE, TRUE, 0); auto model = getPriv(self)->model; widget = CreateFileTree(model); gtk_container_add(GTK_CONTAINER(sw), widget); g_object_set_data(G_OBJECT(self), "file-treeview-widget", widget); /* 加入N多按钮 */ vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_box_pack_start(GTK_BOX(box), vbox, FALSE, FALSE, 0); button = gtk_button_new_with_label(_("Add Files")); gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0); g_signal_connect_swapped(button, "clicked", G_CALLBACK(AddRegular), self); button = gtk_button_new_with_label(_("Add Folders")); gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0); g_signal_connect_swapped(button, "clicked", G_CALLBACK(AddFolder), self); button = gtk_button_new_with_label(_("Delete Resources")); gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0); g_signal_connect_swapped(button, "clicked", G_CALLBACK(DeleteFiles), self); button = gtk_button_new_with_label(_("Clear Password")); gtk_box_pack_end(GTK_BOX(vbox), button, FALSE, FALSE, 0); g_signal_connect_swapped(button, "clicked", G_CALLBACK(ClearPassword), self); button = gtk_button_new_with_label(_("Set Password")); gtk_box_pack_end(GTK_BOX(vbox), button, FALSE, FALSE, 0); g_signal_connect_swapped(button, "clicked", G_CALLBACK(SetPassword), self); g_object_set_data(G_OBJECT(self), "password-button-widget", button); gtk_widget_show_all(box); return box; } enum { COLUMN_ICONNAME, COLUMN_FILENAME, COLUMN_FILESIZE, COLUMN_FILETYPE, COLUMN_TYPE, N_COLUMNS }; /** * 文件树(file-tree)底层数据结构. * 5,0 logo,1 filepath,2 filesize,3 filetype,4 type * 文件图标;文件路径;文件大小;文件类型(串);文件类型(数值) * @return file-model */ GtkTreeModel* CreateFileModel() { GtkListStore* model; model = gtk_list_store_new(N_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT); gtk_tree_sortable_set_default_sort_func( GTK_TREE_SORTABLE(model), GtkTreeIterCompareFunc(FileTreeCompareFunc), NULL, NULL); gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(model), GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, GTK_SORT_ASCENDING); return GTK_TREE_MODEL(model); } /** * 为文件树(file-tree)填充底层数据. * @param model file-model */ void ShareFilePrivate::FillFileModel(GtkTreeModel* model) { const char* iconname; GtkTreeIter iter; char* filesize; const char* filetype; /* 将现在的共享文件填入model */ for (FileInfo& file : app->getCoreThread()->getProgramData()->GetSharedFileInfos()) { /* 获取文件大小 */ file.filesize = utils::fileOrDirectorySize(file.filepath); filesize = numeric_to_size(file.filesize); /* 获取文件类型 */ switch (file.fileattr) { case FileAttr::REGULAR: filetype = _("regular"); iconname = "text-x-generic-symbolic"; break; case FileAttr::DIRECTORY: filetype = _("directory"); iconname = "folder-symbolic"; break; default: filetype = _("unknown"); iconname = NULL; break; } /* 填入数据 */ gtk_list_store_append(GTK_LIST_STORE(model), &iter); gtk_list_store_set(GTK_LIST_STORE(model), &iter, 0, iconname, 1, file.filepath, 2, filesize, 3, filetype, 4, file.fileattr, -1); /* 烦,释放资源 */ g_free(filesize); } } /** * 创建文件树(file-tree). * @param model file-model * @return 文件树 */ GtkWidget* CreateFileTree(GtkTreeModel* model) { GtkWidget* view; GtkTreeViewColumn* column; GtkCellRenderer* cell; GtkTreeSelection* selection; view = gtk_tree_view_new_with_model(model); gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(view), TRUE); gtk_tree_view_set_rubber_banding(GTK_TREE_VIEW(view), TRUE); selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view)); gtk_tree_selection_set_mode(selection, GTK_SELECTION_MULTIPLE); column = gtk_tree_view_column_new(); gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_column_set_title(column, _("File")); cell = gtk_cell_renderer_pixbuf_new(); gtk_tree_view_column_pack_start(column, cell, FALSE); gtk_tree_view_column_set_attributes(column, cell, "icon-name", 0, NULL); cell = gtk_cell_renderer_text_new(); gtk_tree_view_column_pack_start(column, cell, FALSE); gtk_tree_view_column_set_attributes(column, cell, "text", 1, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(view), column); cell = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes(_("Size"), cell, "text", 2, NULL); gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_append_column(GTK_TREE_VIEW(view), column); cell = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes(_("Type"), cell, "text", 3, NULL); gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_append_column(GTK_TREE_VIEW(view), column); return view; } /** * 应用共享文件数据. */ void ApplySharedData(ShareFile* self) { GtkWidget* widget; GtkTreeModel* model; GtkTreeIter iter; gchar* filepath; const gchar* passwd; struct stat st; /* 更新共享文件链表 */ auto g_cthrd = getPriv(self)->app->getCoreThread(); g_cthrd->Lock(); g_cthrd->getProgramData()->ClearShareFileInfos(); g_cthrd->PbnQuote() = 1; widget = GTK_WIDGET(g_object_get_data(G_OBJECT(self), "file-treeview-widget")); model = gtk_tree_view_get_model(GTK_TREE_VIEW(widget)); if (gtk_tree_model_get_iter_first(model, &iter)) { do { FileAttr fileattr; gtk_tree_model_get(model, &iter, 1, &filepath, 4, &fileattr, -1); FileInfo file; file.fileid = g_cthrd->PbnQuote()++; file.fileattr = fileattr; file.filepath = filepath; if (::stat(filepath, &st) == 0) { file.filectime = st.st_ctime; } g_cthrd->getProgramData()->AddShareFileInfo(move(file)); } while (gtk_tree_model_iter_next(model, &iter)); } g_cthrd->Unlock(); /* 更新密码 */ widget = GTK_WIDGET(g_object_get_data(G_OBJECT(self), "password-button-widget")); passwd = (const gchar*)g_object_get_data(G_OBJECT(widget), "password"); if (!passwd) { g_cthrd->SetAccessPublicLimit(""); } else { g_cthrd->SetAccessPublicLimit(passwd); } g_cthrd->getProgramData()->WriteProgData(); } /** * 增加新的共享文件. * @param list 文件链表 */ void AttachSharedFiles(ShareFile* self, GSList* list) { GtkWidget* widget; GtkTreeModel* model; GtkTreeIter iter; const char* iconname; struct stat st; int64_t pathsize; GSList* tlist; char* filesize; const char* filetype; FileAttr fileattr; /* 插入文件树 */ widget = GTK_WIDGET(g_object_get_data(G_OBJECT(self), "file-treeview-widget")); model = gtk_tree_view_get_model(GTK_TREE_VIEW(widget)); tlist = list; while (tlist) { if (stat((const char*)tlist->data, &st) == -1 || !(S_ISREG(st.st_mode) || S_ISDIR(st.st_mode))) { tlist = g_slist_next(tlist); continue; } /* 获取文件大小 */ pathsize = utils::fileOrDirectorySize((const char*)tlist->data); filesize = numeric_to_size(pathsize); /* 获取文件类型 */ if (S_ISREG(st.st_mode)) { filetype = _("regular"); fileattr = FileAttr::REGULAR; iconname = "text-x-generic-symbolic"; } else if (S_ISDIR(st.st_mode)) { filetype = _("directory"); fileattr = FileAttr::DIRECTORY; iconname = "folder-symbolic"; } else { filetype = _("unknown"); fileattr = FileAttr::UNKNOWN; iconname = NULL; } /* 添加数据 */ gtk_list_store_append(GTK_LIST_STORE(model), &iter); gtk_list_store_set(GTK_LIST_STORE(model), &iter, 0, iconname, 1, tlist->data, 2, filesize, 3, filetype, 4, fileattr, -1); /* 释放资源 */ g_free(filesize); /* 转到下一个节点 */ tlist = g_slist_next(tlist); } } /** * 选择新的共享文件. * @param fileattr 文件类型 * @return 文件链表 */ GSList* PickSharedFile(ShareFile* self, FileAttr fileattr) { GtkWidget* dialog; GtkFileChooserAction action; const char* title; GSList* list; CHECK(FileAttrIsValid(fileattr)); if (fileattr == FileAttr::REGULAR) { action = GTK_FILE_CHOOSER_ACTION_OPEN; title = _("Choose the files to share"); } else { action = GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER; title = _("Choose the folders to share"); } dialog = gtk_file_chooser_dialog_new(title, GTK_WINDOW(self), action, _("_Open"), GTK_RESPONSE_ACCEPT, _("_Cancel"), GTK_RESPONSE_CANCEL, NULL); gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT); gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(dialog), FALSE); gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), TRUE); gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), g_get_home_dir()); switch (gtk_dialog_run(GTK_DIALOG(dialog))) { case GTK_RESPONSE_ACCEPT: list = gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(dialog)); break; case GTK_RESPONSE_CANCEL: default: list = NULL; break; } gtk_widget_destroy(dialog); return list; } /** * 增添常规文件. * @param sfile 共享文件类 */ void AddRegular(ShareFile* sfile) { GSList* list; list = PickSharedFile(sfile, FileAttr::REGULAR); AttachSharedFiles(sfile, list); g_slist_foreach(list, GFunc(g_free), NULL); g_slist_free(list); } /** * 增添目录文件. * @param sfile 共享文件类 */ void AddFolder(ShareFile* sfile) { GSList* list; list = PickSharedFile(sfile, FileAttr::DIRECTORY); AttachSharedFiles(sfile, list); g_slist_foreach(list, GFunc(g_free), NULL); g_slist_free(list); } /** * 删除被选中的共享文件. * @param widset widget set */ void DeleteFiles(ShareFile* self) { GtkWidget* widget; GtkTreeSelection* selection; GtkTreeModel* model; widget = GTK_WIDGET(g_object_get_data(G_OBJECT(self), "file-treeview-widget")); selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(widget)); model = gtk_tree_view_get_model(GTK_TREE_VIEW(widget)); auto rows = gtk_tree_selection_get_selected_rows(selection, &model); auto it = rows; vector refs; while (it) { refs.push_back(gtk_tree_row_reference_new(model, (GtkTreePath*)(it->data))); it = g_list_next(it); } g_list_free_full(rows, (GDestroyNotify)gtk_tree_path_free); for (auto ref : refs) { auto path = gtk_tree_row_reference_get_path(ref); GtkTreeIter iter; if (gtk_tree_model_get_iter(model, &iter, path)) { gtk_list_store_remove(GTK_LIST_STORE(model), &iter); } gtk_tree_path_free(path); gtk_tree_row_reference_free(ref); } } void SetPassword(ShareFile* self) { GtkWidget* widget; char *passwd, *epasswd; if (!(passwd = pop_password_settings(GTK_WIDGET(self)))) { return; } widget = GTK_WIDGET(g_object_get_data(G_OBJECT(self), "password-button-widget")); epasswd = g_base64_encode((guchar*)passwd, strlen(passwd)); g_object_set_data_full(G_OBJECT(widget), "password", epasswd, GDestroyNotify(g_free)); g_free(passwd); } void ClearPassword(ShareFile* self) { GtkWidget* widget; widget = GTK_WIDGET(g_object_get_data(G_OBJECT(self), "password-button-widget")); g_object_set_data(G_OBJECT(widget), "password", NULL); } /** * 接收拖拽文件信息. * @param sfile 共享文件类 * @param context the drag context * @param x where the drop happened * @param y where the drop happened * @param data the received data * @param info the info that has been registered with the target in the * GtkTargetList * @param time the timestamp at which the data was received */ void DragDataReceived(ShareFile* sfile, GdkDragContext* context, gint, gint, GtkSelectionData* data, guint, guint time) { GSList* list; if (!ValidateDragData(data, context, time)) { return; } list = selection_data_get_path(data); AttachSharedFiles(sfile, list); g_slist_foreach(list, GFunc(g_free), NULL); g_slist_free(list); gtk_drag_finish(context, TRUE, FALSE, time); } /** * 文件树(file-tree)排序比较函数. * @param model network-model * @param a A GtkTreeIter in model * @param b Another GtkTreeIter in model * @return 比较值 */ gint FileTreeCompareFunc(GtkTreeModel* model, GtkTreeIter* a, GtkTreeIter* b) { gchar *afilepath, *bfilepath; FileAttr afileattr, bfileattr; gint result; gtk_tree_model_get(model, a, 1, &afilepath, 4, &afileattr, -1); gtk_tree_model_get(model, b, 1, &bfilepath, 4, &bfileattr, -1); if (afileattr == bfileattr) { result = strcmp(afilepath, bfilepath); } else if (afileattr == FileAttr::REGULAR) { result = 1; } else { result = -1; } g_free(afilepath); g_free(bfilepath); return result; } } // namespace iptux iptux-0.9.4/src/iptux/ShareFile.h000066400000000000000000000007761475473122500166740ustar00rootroot00000000000000// // C++ Interface: ShareFile // // Description: // 添加或删除共享文件,即管理共享文件 // // Author: Jally , (C) 2008 // // Copyright: See COPYING file that comes with this distribution // // #ifndef IPTUX_SHAREFILE_H #define IPTUX_SHAREFILE_H #include #include "iptux/Application.h" namespace iptux { using ShareFile = GtkDialog; ShareFile* shareFileNew(Application* app); void shareFileRun(ShareFile* dialog, GtkWindow* parent); } // namespace iptux #endif iptux-0.9.4/src/iptux/ShareFileTest.cpp000066400000000000000000000005421475473122500200560ustar00rootroot00000000000000#include "gtest/gtest.h" #include "iptux/Application.h" #include "iptux/ShareFile.h" #include "iptux/TestHelper.h" using namespace std; using namespace iptux; TEST(ShareFile, Constructor) { Application* app = CreateApplication(); ShareFile* shareFile = shareFileNew(app); gtk_widget_destroy(GTK_WIDGET(shareFile)); DestroyApplication(app); } iptux-0.9.4/src/iptux/TerminalNotifierNotificationService.cpp000066400000000000000000000031321475473122500245150ustar00rootroot00000000000000#include "config.h" #include "iptux/TerminalNotifierNotificationService.h" #include "iptux-utils/output.h" #include "iptux-utils/utils.h" #include using namespace std; namespace iptux { void TerminalNotifierNoticationService::sendNotification( GApplication* app, const std::string& id, const std::string& title, const std::string& body, const std::string&, GNotificationPriority, GIcon*) { vector args = {"terminal-notifier", "-group", id, "-title", title, "-subtitle", g_application_get_application_id(app), "-message", body}; char** args2 = new char*[args.size() + 1]; for (int i = 0; i < int(args.size()); ++i) { args2[i] = g_strdup(args[i].c_str()); } args2[args.size()] = nullptr; GError* error = nullptr; gint exit_status = 0; gboolean res = g_spawn_sync( nullptr, args2, nullptr, (GSpawnFlags)(G_SPAWN_SEARCH_PATH | G_SPAWN_FILE_AND_ARGV_ZERO | G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_STDERR_TO_DEV_NULL), nullptr, nullptr, nullptr, nullptr, &exit_status, &error); if (!res) { LOG_WARN("g_spawn_sync failed: %s-%d-%s", g_quark_to_string(error->domain), error->code, error->message); } if (!g_spawn_check_exit_status(exit_status, &error)) { LOG_WARN("g_spawn_sync failed: %s-%d-%s", g_quark_to_string(error->domain), error->code, error->message); } } } // namespace iptux iptux-0.9.4/src/iptux/TerminalNotifierNotificationService.h000066400000000000000000000012631475473122500241650ustar00rootroot00000000000000#ifndef IPTUX_TERMINAL_NOTIFIER_NOTIFICATION_SERVICE #define IPTUX_TERMINAL_NOTIFIER_NOTIFICATION_SERVICE #include "iptux/NotificationService.h" namespace iptux { class TerminalNotifierNoticationService : public NotificationService { public: ~TerminalNotifierNoticationService() override = default; void sendNotification(GApplication* app, const std::string& id, const std::string& title, const std::string& body, const std::string& detailedAction, GNotificationPriority priority, GIcon* icon) override; }; } // namespace iptux #endif iptux-0.9.4/src/iptux/TestHelper.cpp000066400000000000000000000013041475473122500174300ustar00rootroot00000000000000#include "config.h" #include "Application.h" #include "gtest/gtest.h" #include "iptux-core/TestHelper.h" #include "iptux/TestHelper.h" namespace iptux { Application* CreateApplication() { gtk_init(nullptr, nullptr); auto config = newTestIptuxConfig(); Application* app = new Application(config); // g_application_register(G_APPLICATION(app->getApp()), nullptr, nullptr); // auto i = g_application_get_is_registered(G_APPLICATION(app->getApp())); // EXPECT_TRUE(i); app->set_enable_app_indicator(false); app->startup(); app->activate(); return app; } void DestroyApplication(Application* app) { g_application_quit(G_APPLICATION(app->getApp())); delete app; } } // namespace iptux iptux-0.9.4/src/iptux/TestHelper.h000066400000000000000000000003451475473122500171010ustar00rootroot00000000000000#ifndef IPTUX_TESTHELPER_H #define IPTUX_TESTHELPER_H #include "Application.h" #include namespace iptux { Application* CreateApplication(); void DestroyApplication(Application* app); } // namespace iptux #endif iptux-0.9.4/src/iptux/TestMain.cpp000066400000000000000000000002261475473122500170770ustar00rootroot00000000000000#include "config.h" #include "gtest/gtest.h" int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } iptux-0.9.4/src/iptux/TransWindow.cpp000066400000000000000000000356671475473122500176530ustar00rootroot00000000000000#include "config.h" #include "TransWindow.h" #include #include #include "iptux-core/IptuxConfig.h" #include "iptux-utils/output.h" #include "iptux-utils/utils.h" #include "iptux/UiCoreThread.h" #include "iptux/UiHelper.h" #include "iptux/UiModels.h" #define IPTUX_PRIVATE "iptux-private" using namespace std; namespace iptux { class TransWindowPrivate { public: Application* app; GtkWidget* transTreeviewWidget; GtkMenu* popupMenu; vector signals; GtkTreeModel* model; GtkApplicationWindow* window; public: static void destroy(TransWindowPrivate* self) { for (gulong i : self->signals) { g_signal_handler_disconnect( g_action_map_lookup_action(G_ACTION_MAP(self->app->getApp()), "trans_model.changed"), i); } delete self; } void setCurrentTaskFinished(bool finished) { currentTaskFinished = finished; if (finished) { g_action_map_enable_actions(G_ACTION_MAP(window), "trans.open_file", nullptr); g_action_map_disable_actions(G_ACTION_MAP(window), "trans.terminate_task", nullptr); } else { g_action_map_disable_actions(G_ACTION_MAP(window), "trans.open_file", nullptr); g_action_map_enable_actions(G_ACTION_MAP(window), "trans.terminate_task", nullptr); } } private: bool currentTaskFinished = false; }; static gboolean TWinConfigureEvent(GtkWindow* window); static GtkWidget* CreateTransArea(GtkWindow* window); static GtkWidget* CreateTransTree(TransWindow* window); static gboolean UpdateTransUI(GtkWindow* window); static TransWindowPrivate& getPriv(TransWindow* window); static shared_ptr trans_window_get_config(GtkWindow* pWindow); static void onOpenFile(void*, void*, TransWindowPrivate* self); static void onOpenFolder(void*, void*, TransWindowPrivate* self); static void onTerminateTask(void*, void*, TransWindowPrivate* self); static void onTerminateAllTasks(void*, void*, TransWindowPrivate* self); TransWindow* trans_window_new(Application* app, GtkWindow* parent) { g_assert(app != nullptr); GtkWindow* window; window = GTK_WINDOW(gtk_application_window_new(app->getApp())); TransWindowPrivate* priv = new TransWindowPrivate; priv->app = app; priv->window = GTK_APPLICATION_WINDOW(window); g_object_set_data_full(G_OBJECT(window), IPTUX_PRIVATE, priv, GDestroyNotify(TransWindowPrivate::destroy)); if (parent) { gtk_window_set_transient_for(window, parent); gtk_window_set_destroy_with_parent(window, true); } auto config = trans_window_get_config(window); gtk_window_set_title(GTK_WINDOW(window), _("Files Transmission Management")); gtk_window_set_default_size(GTK_WINDOW(window), config->GetInt("trans_window_width", 500), config->GetInt("trans_window_height", 350)); gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); gtk_container_set_border_width(GTK_CONTAINER(window), 5); gtk_container_add(GTK_CONTAINER(window), CreateTransArea(window)); g_signal_connect(window, "delete-event", G_CALLBACK(gtk_widget_hide), NULL); g_signal_connect(window, "configure-event", G_CALLBACK(TWinConfigureEvent), NULL); auto signalHandler = g_signal_connect_swapped( g_action_map_lookup_action(G_ACTION_MAP(app->getApp()), "trans_model.changed"), "activate", G_CALLBACK(UpdateTransUI), window); priv->signals.push_back(signalHandler); GActionEntry win_entries[] = { makeActionEntry("trans.open_file", G_ACTION_CALLBACK(onOpenFile)), makeActionEntry("trans.open_folder", G_ACTION_CALLBACK(onOpenFolder)), makeActionEntry("trans.terminate_task", G_ACTION_CALLBACK(onTerminateTask)), makeActionEntry("trans.terminate_all", G_ACTION_CALLBACK(onTerminateAllTasks)), }; g_action_map_add_action_entries(G_ACTION_MAP(window), win_entries, G_N_ELEMENTS(win_entries), priv); priv->popupMenu = GTK_MENU(gtk_menu_new_from_model(G_MENU_MODEL( gtk_builder_get_object(app->getMenuBuilder(), "trans-popup")))); gtk_menu_attach_to_widget(priv->popupMenu, GTK_WIDGET(window), nullptr); return window; } /** * 文件传输窗口位置&大小改变的响应处理函数. * @param window 文件传输窗口 * @param event the GdkEventConfigure which triggered this signal * @param dtset data set * @return Gtk+库所需 */ gboolean TWinConfigureEvent(GtkWindow* window) { int width, height; gtk_window_get_size(window, &width, &height); auto config = trans_window_get_config(window); config->SetInt("trans_window_width", width); config->SetInt("trans_window_height", height); config->Save(); return FALSE; } shared_ptr trans_window_get_config(GtkWindow* window) { return getPriv(window).app->getConfig(); } TransModel* trans_window_get_trans_model(GtkWindow* window) { return getPriv(window).app->getTransModel(); } /** * 创建文件传输窗口其他区域. * @return 主窗体 */ GtkWidget* CreateTransArea(GtkWindow* window) { GtkWidget *box, *hbb; GtkWidget *sw, *button, *widget; box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); sw = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_ETCHED_IN); gtk_box_pack_start(GTK_BOX(box), sw, TRUE, TRUE, 0); widget = CreateTransTree(window); gtk_container_add(GTK_CONTAINER(sw), widget); getPriv(window).transTreeviewWidget = widget; getPriv(window).model = gtk_tree_view_get_model(GTK_TREE_VIEW(widget)); hbb = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL); gtk_button_box_set_layout(GTK_BUTTON_BOX(hbb), GTK_BUTTONBOX_END); gtk_box_pack_start(GTK_BOX(box), hbb, FALSE, FALSE, 0); button = gtk_button_new_with_label(_("Clear")); gtk_button_set_image(GTK_BUTTON(button), gtk_image_new_from_icon_name("edit-clear-symbolic", GTK_ICON_SIZE_BUTTON)); gtk_box_pack_start(GTK_BOX(hbb), button, FALSE, FALSE, 0); gtk_actionable_set_action_name(GTK_ACTIONABLE(button), "app.trans_model.clear"); gtk_widget_show_all(box); return box; } /** * 文件传输树(trans-tree)弹出操作菜单. * @param treeview tree-view * @param event event * @return Gtk+库所需 */ static gboolean TransPopupMenu(GtkWidget* treeview, GdkEventButton* event, TransWindowPrivate* priv) { GtkTreeModel* model; GtkTreePath* path; /* 检查事件是否可用 */ if (!gdk_event_triggers_context_menu((GdkEvent*)event)) { return FALSE; } /* 确定当前被选中的路径 */ model = gtk_tree_view_get_model(GTK_TREE_VIEW(treeview)); if (gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(treeview), (event->x), (event->y), &path, NULL, NULL, NULL)) { g_object_set_data_full(G_OBJECT(model), "selected-path", path, GDestroyNotify(gtk_tree_path_free)); } else { g_object_set_data(G_OBJECT(model), "selected-path", NULL); return TRUE; } GtkTreeIter iter; gtk_tree_model_get_iter(model, &iter, path); bool finished; gtk_tree_model_get(model, &iter, TransModelColumn ::FINISHED, &finished, -1); priv->setCurrentTaskFinished(finished); gtk_menu_popup_at_pointer(GTK_MENU(priv->popupMenu), NULL); return TRUE; } /** * 创建文件传输树(trans-tree). * @param model trans-model * @return 传输树 */ GtkWidget* CreateTransTree(TransWindow* window) { GtkWidget* view; GtkTreeViewColumn* column; GtkCellRenderer* cell; GtkTreeSelection* selection; auto model = trans_window_get_trans_model(window); view = gtk_tree_view_new_with_model(model); gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(view), TRUE); gtk_tree_view_set_rubber_banding(GTK_TREE_VIEW(view), TRUE); selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view)); gtk_tree_selection_set_mode(selection, GTK_SELECTION_MULTIPLE); g_signal_connect(view, "button-press-event", G_CALLBACK(TransPopupMenu), &getPriv(window)); cell = gtk_cell_renderer_pixbuf_new(); column = gtk_tree_view_column_new_with_attributes( _("State"), cell, "icon-name", TransModelColumn::STATUS, NULL); gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_append_column(GTK_TREE_VIEW(view), column); cell = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes( _("Task"), cell, "text", TransModelColumn::TASK, NULL); gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_append_column(GTK_TREE_VIEW(view), column); cell = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes( _("Peer"), cell, "text", TransModelColumn::PEER, NULL); gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_append_column(GTK_TREE_VIEW(view), column); cell = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes(_("IPv4"), cell, "text", TransModelColumn::IP, NULL); gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_append_column(GTK_TREE_VIEW(view), column); cell = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes( _("Filename"), cell, "text", TransModelColumn::FILENAME, NULL); gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_append_column(GTK_TREE_VIEW(view), column); cell = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes( _("Size"), cell, "text", TransModelColumn::FILE_LENGTH_TEXT, NULL); gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_append_column(GTK_TREE_VIEW(view), column); cell = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes( _("Completed"), cell, "text", TransModelColumn::FINISHED_LENGTH_TEXT, NULL); gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_append_column(GTK_TREE_VIEW(view), column); cell = gtk_cell_renderer_progress_new(); column = gtk_tree_view_column_new_with_attributes( _("Progress"), cell, "value", TransModelColumn::PROGRESS, "text", TransModelColumn::PROGRESS_TEXT, NULL); gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_append_column(GTK_TREE_VIEW(view), column); cell = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes( _("Cost"), cell, "text", TransModelColumn::COST, NULL); gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_append_column(GTK_TREE_VIEW(view), column); cell = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes( _("Remaining"), cell, "text", TransModelColumn::REMAIN, NULL); gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_append_column(GTK_TREE_VIEW(view), column); cell = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes( _("Rate"), cell, "text", TransModelColumn::RATE, NULL); gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_append_column(GTK_TREE_VIEW(view), column); return view; } /** * 打开接收文件所在文件夹. * @param model trans-model */ void onOpenFolder(void*, void*, TransWindowPrivate* self) { GtkTreePath* path; GtkTreeIter iter; gchar *filename, *filepath, *name; auto model = self->model; if (!(path = (GtkTreePath*)(g_object_get_data(G_OBJECT(model), "selected-path")))) return; gtk_tree_model_get_iter(model, &iter, path); gtk_tree_model_get(model, &iter, TransModelColumn::FILE_PATH, &filename, -1); if (filename) { name = ipmsg_get_filename_me(filename, &filepath); if (!g_file_test(filepath, G_FILE_TEST_EXISTS)) { GtkWidget* dialog = gtk_message_dialog_new( NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "%s", _("The path you want to open not exist!")); gtk_window_set_title(GTK_WINDOW(dialog), "Iptux Error"); gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); return; } iptux_open_url(filepath); g_free(name); g_free(filepath); } } /** * 终止单个传输任务. * @param model trans-model */ void onTerminateTask(void*, void*, TransWindowPrivate* self) { GtkTreePath* path; GtkTreeIter iter; gboolean finished; int taskId; auto model = self->model; if (!(path = (GtkTreePath*)(g_object_get_data(G_OBJECT(model), "selected-path")))) return; gtk_tree_model_get_iter(model, &iter, path); gtk_tree_model_get(model, &iter, TransModelColumn::TASK_ID, &taskId, TransModelColumn::FINISHED, &finished, -1); if (finished) { return; } self->app->getCoreThread()->TerminateTransTask(taskId); } /** * 终止所有传输任务. * @param model trans-model */ void onTerminateAllTasks(void*, void*, TransWindowPrivate* self) { GtkTreeIter iter; int taskId; auto model = self->model; if (!gtk_tree_model_get_iter_first(model, &iter)) return; do { gtk_tree_model_get(model, &iter, TransModelColumn ::TASK_ID, &taskId, -1); self->app->getCoreThread()->TerminateTransTask(taskId); } while (gtk_tree_model_iter_next(model, &iter)); } /** * 打开接收的文件. * @param model trans-model */ void onOpenFile(void*, void*, TransWindowPrivate* self) { GtkTreePath* path; GtkTreeIter iter; gchar* filename; auto model = self->model; if (!(path = (GtkTreePath*)(g_object_get_data(G_OBJECT(model), "selected-path")))) return; gtk_tree_model_get_iter(model, &iter, path); gtk_tree_model_get(model, &iter, TransModelColumn ::FILE_PATH, &filename, -1); if (filename) { if (!g_file_test(filename, G_FILE_TEST_EXISTS)) { GtkWidget* dialog = gtk_message_dialog_new( NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "%s", _("The file you want to open not exist!")); gtk_window_set_title(GTK_WINDOW(dialog), _("iptux Error")); gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); return; } iptux_open_url(filename); } } /** * 更新文件传输窗口UI. * @param treeview tree-view * @return GLib库所需 */ gboolean UpdateTransUI(GtkWindow* window) { GtkWidget* treeview = getPriv(window).transTreeviewWidget; /* 重新调整UI */ gtk_tree_view_columns_autosize(GTK_TREE_VIEW(treeview)); return TRUE; } TransWindowPrivate& getPriv(TransWindow* window) { return *( (TransWindowPrivate*)g_object_get_data(G_OBJECT(window), IPTUX_PRIVATE)); } } // namespace iptux iptux-0.9.4/src/iptux/TransWindow.h000066400000000000000000000004341475473122500173000ustar00rootroot00000000000000#ifndef IPTUX_TRANSWINDOW_H #define IPTUX_TRANSWINDOW_H #include #include "iptux/Application.h" namespace iptux { typedef GtkWindow TransWindow; TransWindow* trans_window_new(Application* app, GtkWindow* parent); } // namespace iptux #endif // IPTUX_TRANSWINDOW_H iptux-0.9.4/src/iptux/TransWindowTest.cpp000066400000000000000000000005331475473122500204730ustar00rootroot00000000000000#include "gtest/gtest.h" #include "iptux/TestHelper.h" #include "iptux/TransWindow.h" using namespace std; using namespace iptux; TEST(TransWindow, Constructor) { Application* app = CreateApplication(); TransWindow* transWindow = trans_window_new(app, nullptr); gtk_widget_destroy(GTK_WIDGET(transWindow)); DestroyApplication(app); } iptux-0.9.4/src/iptux/UiCoreThread.cpp000066400000000000000000000407611475473122500177010ustar00rootroot00000000000000// // C++ Implementation: CoreThread // // Description: // // // Author: Jally , (C) 2008 // // Copyright: See COPYING file that comes with this distribution // // #include "config.h" #include "UiCoreThread.h" #include #include #include #include #include #include "iptux-core/Const.h" #include "iptux-utils/output.h" #include "iptux-utils/utils.h" #include "iptux/LogSystem.h" #include "iptux/UiHelper.h" using namespace std; namespace iptux { /** * 类构造函数. */ UiCoreThread::UiCoreThread(Application* app, shared_ptr data) : CoreThread(data), programData(data), groupInfos(NULL), sgmlist(NULL), grplist(NULL), brdlist(NULL), pbn(1), prn(MAX_SHAREDFILE), ecsList(NULL) { tag_table_ = CreateTagTable(); CheckIconTheme(); logSystem = app->getLogSystem(); InitSublayer(); } /** * 类析构函数. */ UiCoreThread::~UiCoreThread() { g_object_unref(tag_table_); } /** * 从好友链表中移除所有好友数据(非UI线程安全). * @note 鉴于好友链表成员不能被删除,所以将成员改为下线标记即可 */ void UiCoreThread::ClearAllPalFromList() { CoreThread::ClearAllPalFromList(); SessionAbstract* session; GroupInfo* grpinf; GSList* tlist; /* 清空常规模式下所有群组的成员 */ tlist = groupInfos; while (tlist) { grpinf = (GroupInfo*)tlist->data; if (grpinf->getDialog()) { session = (SessionAbstract*)g_object_get_data( G_OBJECT(grpinf->getDialog()), "session-class"); session->ClearAllPalData(); } tlist = g_slist_next(tlist); } /* 清空网段模式下所有群组的成员 */ tlist = sgmlist; while (tlist) { grpinf = (GroupInfo*)tlist->data; if (grpinf->getDialog()) { session = (SessionAbstract*)g_object_get_data( G_OBJECT(grpinf->getDialog()), "session-class"); session->ClearAllPalData(); } tlist = g_slist_next(tlist); } /* 清空分组模式下所有群组的成员 */ tlist = grplist; while (tlist) { grpinf = (GroupInfo*)tlist->data; if (grpinf->getDialog()) { session = (SessionAbstract*)g_object_get_data( G_OBJECT(grpinf->getDialog()), "session-class"); session->ClearAllPalData(); } tlist = g_slist_next(tlist); } /* 清空广播模式下所有群组的成员 */ tlist = brdlist; while (tlist) { grpinf = (GroupInfo*)tlist->data; if (grpinf->getDialog()) { session = (SessionAbstract*)g_object_get_data( G_OBJECT(grpinf->getDialog()), "session-class"); session->ClearAllPalData(); } tlist = g_slist_next(tlist); } } /** * 通告指定的好友信息数据已经被更新(非UI线程安全). * @param ipv4 ipv4 * @note 什么时候会用到?1、好友更新个人资料;2、好友下线后又上线了 * @note 鉴于群组中必须包含所有属于自己的成员,移除不属于自己的成员, * 所以好友信息更新后应该重新调整群组成员; * @note 群组中被更新的成员信息也应该在界面上做出相应更新 */ void UiCoreThread::UpdatePalToList(PalKey palKey) { CoreThread::UpdatePalToList(palKey); PPalInfo ppal; GroupInfo* grpinf; SessionAbstract* session; /* 如果好友链表中不存在此好友,则视为程序设计出错 */ if (!(ppal = GetPal(palKey))) { return; } auto pal = ppal.get(); /* 更新好友所在的群组,以及它在UI上的信息 */ /*/* 更新常规模式下的群组 */ if ((grpinf = GetPalRegularItem(pal))) { if (!grpinf->hasPal(pal)) { AttachPalToGroupInfoItem(grpinf, ppal); } else if (grpinf->getDialog()) { session = (SessionAbstract*)g_object_get_data( G_OBJECT(grpinf->getDialog()), "session-class"); session->UpdatePalData(pal); } } else { if (!(grpinf = GetPalRegularItem(pal))) grpinf = AttachPalRegularItem(ppal); AttachPalToGroupInfoItem(grpinf, ppal); } /*/* 更新网段模式下的群组 */ if ((grpinf = GetPalSegmentItem(pal))) { if (!grpinf->hasPal(pal)) { AttachPalToGroupInfoItem(grpinf, ppal); } else if (grpinf->getDialog()) { session = (SessionAbstract*)g_object_get_data( G_OBJECT(grpinf->getDialog()), "session-class"); session->UpdatePalData(pal); } } else { if (!(grpinf = GetPalSegmentItem(pal))) grpinf = AttachPalSegmentItem(ppal); AttachPalToGroupInfoItem(grpinf, ppal); } /*/* 更新分组模式下的群组 */ if ((grpinf = GetPalPrevGroupItem(pal))) { if (strcmp(grpinf->name().c_str(), pal->getGroup().c_str()) != 0) { DelPalFromGroupInfoItem(grpinf, pal); if (!(grpinf = GetPalGroupItem(pal))) grpinf = AttachPalGroupItem(ppal); AttachPalToGroupInfoItem(grpinf, ppal); } else if (grpinf->getDialog()) { session = (SessionAbstract*)g_object_get_data( G_OBJECT(grpinf->getDialog()), "session-class"); session->UpdatePalData(pal); } } else { if (!(grpinf = GetPalGroupItem(pal))) grpinf = AttachPalGroupItem(ppal); AttachPalToGroupInfoItem(grpinf, ppal); } /*/* 更新广播模式下的群组 */ if ((grpinf = GetPalBroadcastItem(pal))) { if (!grpinf->hasPal(pal)) { AttachPalToGroupInfoItem(grpinf, ppal); } else if (grpinf->getDialog()) { session = (SessionAbstract*)g_object_get_data( G_OBJECT(grpinf->getDialog()), "session-class"); session->UpdatePalData(pal); } } else { if (!(grpinf = GetPalBroadcastItem(pal))) grpinf = AttachPalBroadcastItem(ppal); AttachPalToGroupInfoItem(grpinf, ppal); } } /** * 将好友信息数据加入到好友链表(非UI线程安全). * @param pal class PalInfo * @note 鉴于在线的好友必须被分配到它所属的群组,所以加入好友到好友链表的同时 * 也应该分配好友到相应的群组 */ void UiCoreThread::AttachPalToList(shared_ptr pal2) { CoreThread::AttachPalToList(pal2); GroupInfo* grpinf; auto pal = pal2.get(); /* 将好友加入到相应的群组 */ if (!(grpinf = GetPalRegularItem(pal))) grpinf = AttachPalRegularItem(pal2); if (!(grpinf = GetPalSegmentItem(pal))) grpinf = AttachPalSegmentItem(pal2); AttachPalToGroupInfoItem(grpinf, pal2); if (!(grpinf = GetPalGroupItem(pal))) grpinf = AttachPalGroupItem(pal2); AttachPalToGroupInfoItem(grpinf, pal2); if (!(grpinf = GetPalBroadcastItem(pal))) grpinf = AttachPalBroadcastItem(pal2); AttachPalToGroupInfoItem(grpinf, pal2); } /** * 获取(pal)在常规模式下的群组信息. * @param pal class PalInfo * @return 群组信息 */ GroupInfo* UiCoreThread::GetPalRegularItem(const PalInfo* pal) { GSList* tlist; tlist = groupInfos; while (tlist) { if (((GroupInfo*)tlist->data)->grpid == inAddrToUint32(pal->ipv4())) break; tlist = g_slist_next(tlist); } return (GroupInfo*)(tlist ? tlist->data : NULL); } /** * 获取(pal)在网段模式下的群组信息. * @param pal class PalInfo * @return 群组信息 */ GroupInfo* UiCoreThread::GetPalSegmentItem(const PalInfo* pal) { GSList* tlist; GQuark grpid; /* 获取局域网网段ID */ auto name = ipv4_get_lan_name(pal->ipv4()); grpid = g_quark_from_string(name.empty() ? _("Others") : name.c_str()); tlist = sgmlist; while (tlist) { if (((GroupInfo*)tlist->data)->grpid == grpid) break; tlist = g_slist_next(tlist); } return (GroupInfo*)(tlist ? tlist->data : NULL); } /** * 获取(pal)在分组模式下的群组信息. * @param pal class PalInfo * @return 群组信息 */ GroupInfo* UiCoreThread::GetPalGroupItem(const PalInfo* pal) { GSList* tlist; GQuark grpid; /* 获取组ID */ NO_OPERATION_C auto group = pal->getGroup(); grpid = g_quark_from_string(group.empty() ? _("Others") : group.c_str()); tlist = grplist; while (tlist) { if (((GroupInfo*)tlist->data)->grpid == grpid) break; tlist = g_slist_next(tlist); } return (GroupInfo*)(tlist ? tlist->data : NULL); } /** * 获取(pal)在广播模式下的群组信息. * @param pal class PalInfo * @return 群组信息 */ GroupInfo* UiCoreThread::GetPalBroadcastItem(const PalInfo*) { return (GroupInfo*)(brdlist ? brdlist->data : NULL); } /** * 初始化底层数据. */ void UiCoreThread::InitSublayer() {} /** * 清空底层数据. */ void UiCoreThread::ClearSublayer() { GSList* tlist; CoreThread::ClearSublayer(); for (tlist = groupInfos; tlist; tlist = g_slist_next(tlist)) delete (GroupInfo*)tlist->data; g_slist_free(groupInfos); for (tlist = sgmlist; tlist; tlist = g_slist_next(tlist)) delete (GroupInfo*)tlist->data; g_slist_free(sgmlist); for (tlist = grplist; tlist; tlist = g_slist_next(tlist)) delete (GroupInfo*)tlist->data; g_slist_free(grplist); for (tlist = brdlist; tlist; tlist = g_slist_next(tlist)) delete (GroupInfo*)tlist->data; g_slist_free(brdlist); for (tlist = ecsList; tlist; tlist = g_slist_next(tlist)) delete (FileInfo*)tlist->data; g_slist_free(ecsList); } /** * 获取(pal)在分组模式下当前所在的群组. * @param pal class PalInfo * @return 群组信息 */ GroupInfo* UiCoreThread::GetPalPrevGroupItem(PalInfo* pal) { GSList* tlist; tlist = grplist; while (tlist) { if (((GroupInfo*)tlist->data)->hasPal(pal)) break; tlist = g_slist_next(tlist); } return (GroupInfo*)(tlist ? tlist->data : NULL); } /** * 增加新项到常规模式群组链表(非UI线程安全). * @param pal class PalInfo * @return 新加入的群组 */ GroupInfo* UiCoreThread::AttachPalRegularItem(PPalInfo pal) { GroupInfo* grpinf; grpinf = new GroupInfo(pal, getMe(), logSystem); grpinf->grpid = inAddrToUint32(pal->ipv4()); grpinf->initBuffer(tag_table_); grpinf->clearDialog(); grpinf->signalUnreadMsgCountUpdated.connect( sigc::mem_fun(*this, &UiCoreThread::onGroupInfoMsgCountUpdate)); groupInfos = g_slist_append(groupInfos, grpinf); return grpinf; } /** * 增加新项到网段模式群组链表(非UI线程安全). * @param pal class PalInfo * @return 新加入的群组 */ GroupInfo* UiCoreThread::AttachPalSegmentItem(PPalInfo pal) { GroupInfo* grpinf; /* 获取局域网网段名称 */ auto name = ipv4_get_lan_name(pal->ipv4()); if (name.empty()) { name = _("Others"); } grpinf = new GroupInfo(GROUP_BELONG_TYPE_SEGMENT, vector(), getMe(), name, logSystem); grpinf->grpid = g_quark_from_static_string(name.c_str()); grpinf->initBuffer(tag_table_); grpinf->clearDialog(); sgmlist = g_slist_append(sgmlist, grpinf); return grpinf; } /** * 增加新项到分组模式群组链表(非UI线程安全). * @param pal class PalInfo * @return 新加入的群组 */ GroupInfo* UiCoreThread::AttachPalGroupItem(PPalInfo pal) { GroupInfo* grpinf; auto name = pal->getGroup(); if (name.empty()) { name = _("Others"); } grpinf = new GroupInfo(GROUP_BELONG_TYPE_GROUP, vector(), getMe(), name, logSystem); grpinf->initBuffer(tag_table_); grpinf->clearDialog(); grplist = g_slist_append(grplist, grpinf); return grpinf; } /** * 增加新项到广播模式群组链表(非UI线程安全). * @param pal class PalInfo * @return 新加入的群组 */ GroupInfo* UiCoreThread::AttachPalBroadcastItem(PPalInfo) { GroupInfo* grpinf; char* name; name = g_strdup(_("Broadcast")); grpinf = new GroupInfo(GROUP_BELONG_TYPE_BROADCAST, vector(), getMe(), name, logSystem); grpinf->grpid = g_quark_from_static_string(name); grpinf->initBuffer(tag_table_); grpinf->clearDialog(); brdlist = g_slist_append(brdlist, grpinf); return grpinf; } /** * 从群组中移除指定的好友(非UI线程安全). * @param grpinf class GroupInfo * @param pal class PalInfo */ void UiCoreThread::DelPalFromGroupInfoItem(GroupInfo* grpinf, PalInfo* pal) { SessionAbstract* session; grpinf->delPal(pal); if (grpinf->getDialog()) { session = (SessionAbstract*)g_object_get_data(G_OBJECT(grpinf->getDialog()), "session-class"); session->DelPalData(pal); } } /** * 添加好友到指定的群组(非UI线程安全). * @param grpinf class GroupInfo * @param pal class PalInfo */ void UiCoreThread::AttachPalToGroupInfoItem(GroupInfo* grpinf, PPalInfo pal) { SessionAbstract* session; grpinf->addPal(pal); if (grpinf->getDialog()) { session = (SessionAbstract*)g_object_get_data(G_OBJECT(grpinf->getDialog()), "session-class"); session->InsertPalData(pal.get()); } } /** * 获取特定好友发过来的文件(非UI线程安全). * @param pal class PalInfo * @return palecslist 该好友发过来待接收的文件列表 */ GSList* UiCoreThread::GetPalEnclosure(PalInfo* pal) { GSList *tlist, *palecslist; palecslist = NULL; for (tlist = ecsList; tlist; tlist = g_slist_next(tlist)) { if (((FileInfo*)tlist->data)->fileown->GetKey() == pal->GetKey()) { palecslist = g_slist_append(palecslist, tlist->data); } } return palecslist; } /** * 压入项进接收文件列表(非UI线程安全). * @param file 文件类指针 */ void UiCoreThread::PushItemToEnclosureList(FileInfo* file) { ecsList = g_slist_append(ecsList, file); auto groupInfo = this->GetPalRegularItem(file->fileown.get()); if (groupInfo) { groupInfo->newFileReceived(); } } /** * 从接收文件列表删除项(非UI线程安全). * @param file 文件类指针 */ void UiCoreThread::PopItemFromEnclosureList(FileInfo* file) { ecsList = g_slist_remove(ecsList, file); delete file; } void UiCoreThread::onGroupInfoMsgCountUpdate(GroupInfo* grpinf, int, int) { sigGroupInfoUpdated.emit(grpinf); sigUnreadMsgCountUpdated.emit(unread_msg_count()); } /** * 创建用于(text-view)的一些通用tag. * @note 给这些tag一个"global"标记,表示这些对象是全局共享的 */ GtkTextTagTable* UiCoreThread::CreateTagTable() { GtkTextTag* tag; GtkTextTagTable* table = gtk_text_tag_table_new(); tag = gtk_text_tag_new("pal-color"); g_object_set(tag, "foreground", "blue", NULL); g_object_set_data(G_OBJECT(tag), "global", GINT_TO_POINTER(TRUE)); gtk_text_tag_table_add(table, tag); g_object_unref(tag); tag = gtk_text_tag_new("me-color"); g_object_set(tag, "foreground", "green", NULL); g_object_set_data(G_OBJECT(tag), "global", GINT_TO_POINTER(TRUE)); gtk_text_tag_table_add(table, tag); g_object_unref(tag); tag = gtk_text_tag_new("error-color"); g_object_set(tag, "foreground", "red", NULL); g_object_set_data(G_OBJECT(tag), "global", GINT_TO_POINTER(TRUE)); gtk_text_tag_table_add(table, tag); g_object_unref(tag); tag = gtk_text_tag_new("sign-words"); g_object_set(tag, "indent", 10, "foreground", "#1005F0", "font", "Sans Italic 8", NULL); g_object_set_data(G_OBJECT(tag), "global", GINT_TO_POINTER(TRUE)); gtk_text_tag_table_add(table, tag); g_object_unref(tag); tag = gtk_text_tag_new("url-link"); g_object_set(tag, "foreground", "blue", "underline", PANGO_UNDERLINE_SINGLE, NULL); g_object_set_data(G_OBJECT(tag), "global", GINT_TO_POINTER(TRUE)); gtk_text_tag_table_add(table, tag); g_object_unref(tag); return table; } /** * 确保头像数据被存放在主题库中. */ void UiCoreThread::CheckIconTheme() { char pathbuf[MAX_PATHLEN]; GdkPixbuf* pixbuf; snprintf(pathbuf, MAX_PATHLEN, __PIXMAPS_PATH "/icon/%s", programData->myicon.c_str()); if (access(pathbuf, F_OK) != 0) { snprintf(pathbuf, MAX_PATHLEN, "%s" ICON_PATH "/%s", g_get_user_config_dir(), programData->myicon.c_str()); if ((pixbuf = gdk_pixbuf_new_from_file(pathbuf, NULL))) { gtk_icon_theme_add_builtin_icon(programData->myicon.c_str(), MAX_ICONSIZE, pixbuf); g_object_unref(pixbuf); } } snprintf(pathbuf, MAX_PATHLEN, __PIXMAPS_PATH "/icon/%s", programData->palicon); if (access(pathbuf, F_OK) != 0) { snprintf(pathbuf, MAX_PATHLEN, "%s" ICON_PATH "/%s", g_get_user_config_dir(), programData->palicon); if ((pixbuf = gdk_pixbuf_new_from_file(pathbuf, NULL))) { gtk_icon_theme_add_builtin_icon(programData->palicon, MAX_ICONSIZE, pixbuf); g_object_unref(pixbuf); } } } int UiCoreThread::unread_msg_count() const { int count = 0; GSList* tlist; for (tlist = groupInfos; tlist; tlist = g_slist_next(tlist)) { count += ((GroupInfo*)tlist->data)->getUnreadMsgCount(); } return count; } } // namespace iptux iptux-0.9.4/src/iptux/UiCoreThread.h000066400000000000000000000072321475473122500173420ustar00rootroot00000000000000// // C++ Interface: CoreThread // // Description: // 程序中的核心线程类,实际上也被设计成了所有底层核心数据的中心点, // 所有数据的更新、查询、插入、删除都必须通过本类接口才能完成。 // ----------------------------------------------------- // 2012.02:把文件传送的核心数据全部放在CoreThread类。 // prlist不变,增加ecsList来存放好友发来文件. //------------------------------------------------------ // Author: cwll , (C) 2012 // Jally , (C) 2008 // // Copyright: See COPYING file that comes with this distribution // // #ifndef IPTUX_UICORETHREAD_H #define IPTUX_UICORETHREAD_H #include #include #include #include "iptux-core/CoreThread.h" #include "iptux-core/Models.h" #include "iptux/Application.h" #include "iptux/UiModels.h" namespace iptux { class LogSystem; /** * @note 请保证插入或更新某成员时,底层优先于UI;删除某成员时,UI优先于底层, * 否则你会把所有事情都搞砸. \n * @note 鉴于(GroupInfo::member)成员发生变动时必须保证函数处于UI线程安全的环境, * 所以UI线程安全的函数对(GroupInfo::member)的访问无须加锁.\n * 若此特性不可被如此利用,请报告bug. \n * @note 如果本程序编码中的某处没有遵循以上规则,请报告bug. */ class UiCoreThread : public CoreThread { public: UiCoreThread(Application* app, std::shared_ptr data); ~UiCoreThread() override; std::shared_ptr getProgramData() { return programData; } void ClearAllPalFromList() override; void UpdatePalToList(PalKey palKey) override; void UpdatePalToList(in_addr ipv4) override { UpdatePalToList(PalKey(ipv4, port())); } void AttachPalToList(std::shared_ptr pal) override; GroupInfo* GetPalRegularItem(const PalInfo* pal); GroupInfo* GetPalSegmentItem(const PalInfo* pal); GroupInfo* GetPalGroupItem(const PalInfo* pal); GroupInfo* GetPalBroadcastItem(const PalInfo* pal); GSList* GetPalEnclosure(PalInfo* pal); void PushItemToEnclosureList(FileInfo* file); void PopItemFromEnclosureList(FileInfo* file); LogSystem* getLogSystem() { return logSystem; } GtkTextTagTable* tag_table() { return tag_table_; } int unread_msg_count() const; public: sigc::signal sigGroupInfoUpdated; sigc::signal sigUnreadMsgCountUpdated; private: void InitSublayer(); void ClearSublayer() override; GroupInfo* GetPalPrevGroupItem(PalInfo* pal); GroupInfo* AttachPalRegularItem(PPalInfo pal); GroupInfo* AttachPalSegmentItem(PPalInfo pal); GroupInfo* AttachPalGroupItem(PPalInfo pal); GroupInfo* AttachPalBroadcastItem(PPalInfo pal); static void DelPalFromGroupInfoItem(GroupInfo* grpinf, PalInfo* pal); static void AttachPalToGroupInfoItem(GroupInfo* grpinf, PPalInfo pal); void onGroupInfoMsgCountUpdate(GroupInfo* grpinf, int oldCount, int newCount); GtkTextTagTable* CreateTagTable(); void CheckIconTheme(); private: std::shared_ptr programData; LogSystem* logSystem; std::queue messages; GSList *groupInfos, *sgmlist, *grplist, *brdlist; // 群组链表(成员不能被删除) uint32_t pbn, prn; // 当前已使用的文件编号(共享/私有) GSList* ecsList; // 文件链表(好友发过来) GtkTextTagTable* tag_table_; // tag table // GSList *rcvdList; //文件链表(好友发过来已接收) // 内联成员函数 public: inline uint32_t& PbnQuote() { return pbn; } inline uint32_t& PrnQuote() { return prn; } }; } // namespace iptux #endif iptux-0.9.4/src/iptux/UiCoreThreadTest.cpp000066400000000000000000000007041475473122500205320ustar00rootroot00000000000000#include "Application.h" #include "gtest/gtest.h" #include "iptux/TestHelper.h" #include "iptux/UiCoreThread.h" using namespace std; using namespace iptux; TEST(UiCoreThread, Constructor) { Application* app = CreateApplication(); auto core = make_shared(app->getConfig()); core->sign = "abc"; UiCoreThread* thread = new UiCoreThread(app, core); thread->start(); thread->stop(); delete thread; DestroyApplication(app); } iptux-0.9.4/src/iptux/UiHelper.cpp000066400000000000000000000254631475473122500171020ustar00rootroot00000000000000#include "config.h" #include "UiHelper.h" #include #include #include #include #include #include #include "iptux-core/Models.h" #include "iptux-utils/output.h" #include "iptux-utils/utils.h" using namespace std; namespace iptux { static atomic_bool open_url_enabled(true); static bool pop_disabled = false; void iptux_open_path(const char* path) { g_return_if_fail(!!path); GError* error = nullptr; gchar* uri = g_filename_to_uri(path, nullptr, &error); if (error) { LOG_WARN(_("Can't convert path to uri: %s, reason: %s"), path, error->message); g_error_free(error); return; } if (!open_url_enabled) { LOG_INFO("iptux_open_path %s", path); } else { g_app_info_launch_default_for_uri(uri, nullptr, &error); } if (error) { LOG_WARN(_("Can't open path: %s, reason: %s"), path, error->message); g_error_free(error); } g_free(uri); } void _ForTestToggleOpenUrl(bool enable) { open_url_enabled = enable; } /** * 打开URL. * @param url url */ void iptux_open_url(const char* url) { g_return_if_fail(!!url); if (url[0] == '/') { iptux_open_path(url); return; } GError* error = nullptr; if (!open_url_enabled) { LOG_INFO("iptux_open_url %s", url); } else { g_app_info_launch_default_for_uri(url, nullptr, &error); } if (error) { LOG_WARN(_("Can't open URL: %s, reason: %s"), url, error->message); g_error_free(error); } } bool ValidateDragData(GtkSelectionData* data, GdkDragContext* context, guint time) { if (gtk_selection_data_get_length(data) <= 0 || gtk_selection_data_get_format(data) != 8) { gtk_drag_finish(context, FALSE, FALSE, time); return false; } return true; } void add_accelerator(GtkApplication* app, const char* action, const char* accel) { const char* accels[] = {accel, NULL}; gtk_application_set_accels_for_action(app, action, accels); } /** * 按照1:1的比例对图片做缩小(请注意,没有放大)处理. * @param pixbuf pixbuf * @param width width * @param height height * @note 原pixbuf将被本函数释放 */ void pixbuf_shrink_scale_1(GdkPixbuf** pixbuf, int width, int height) { gdouble scale_x, scale_y, scale; gint _width, _height; width = (width != -1) ? width : G_MAXINT; height = (height != -1) ? height : G_MAXINT; _width = gdk_pixbuf_get_width(*pixbuf); _height = gdk_pixbuf_get_height(*pixbuf); if (_width > width || _height > height) { scale = ((scale_x = (gdouble)width / _width) < (scale_y = (gdouble)height / _height)) ? scale_x : scale_y; _width = (gint)(_width * scale); _height = (gint)(_height * scale); auto tpixbuf = *pixbuf; *pixbuf = gdk_pixbuf_scale_simple(tpixbuf, _width, _height, GDK_INTERP_BILINEAR); g_object_unref(tpixbuf); } } /** * 让窗体(widget)支持uri拖拽操作. * @param widget widget */ void widget_enable_dnd_uri(GtkWidget* widget) { static const GtkTargetEntry target = {(gchar*)"text/uri-list", 0, 0}; gtk_drag_dest_set(widget, GTK_DEST_DEFAULT_ALL, &target, 1, GDK_ACTION_MOVE); } /** * 由(GtkSelectionData)获取(uri)文件链表. * @param data selection data * @return 文件链表 */ GSList* selection_data_get_path(GtkSelectionData* data) { const char* prl = "file://"; gchar **uris, **ptr; GSList* filelist; if (!(uris = gtk_selection_data_get_uris(data))) return NULL; filelist = NULL; ptr = uris; while (*ptr) { auto uri = g_uri_unescape_string(*ptr, NULL); if (strncasecmp(uri, prl, strlen(prl)) == 0) filelist = g_slist_append(filelist, g_strdup(uri + strlen(prl))); else filelist = g_slist_append(filelist, g_strdup(uri)); g_free(uri); ptr++; } g_strfreev(uris); return filelist; } void pop_disable() { pop_disabled = true; } /** * 弹出消息提示. * @param parent parent window * @param format as in printf() * @param ... */ void pop_info(GtkWidget* parent, const gchar* format, ...) { GtkWidget* dialog; gchar* msg; va_list ap; va_start(ap, format); msg = g_strdup_vprintf(format, ap); va_end(ap); if (pop_disabled) { LOG_INFO("%s\n", msg); g_free(msg); return; } dialog = gtk_message_dialog_new(GTK_WINDOW(parent), GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, NULL); gtk_message_dialog_set_markup(GTK_MESSAGE_DIALOG(dialog), msg); g_free(msg); gtk_window_set_title(GTK_WINDOW(dialog), _("Information")); gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); } /** * 弹出警告信息. * @param parent parent window * @param format as in printf() * @param ... */ void pop_warning(GtkWidget* parent, const gchar* format, ...) { GtkWidget* dialog; gchar* msg; va_list ap; va_start(ap, format); msg = g_strdup_vprintf(format, ap); va_end(ap); if (pop_disabled) { LOG_WARN("%s\n", msg); g_free(msg); return; } dialog = gtk_message_dialog_new(GTK_WINDOW(parent), GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, NULL); gtk_message_dialog_set_markup(GTK_MESSAGE_DIALOG(dialog), msg); g_free(msg); gtk_window_set_title(GTK_WINDOW(dialog), _("Warning")); gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); } /** * 获取局域网网段名称. * @param ipv4 ipv4 * @return name */ string ipv4_get_lan_name(in_addr ipv4) { /** * @note 局域网网段划分,每两个为一组,以NULL标识结束. */ static const char* localgroup[] = { "10.0.0.0", "10.255.255.255", "172.16.0.0", "172.31.255.255", "192.168.0.0", "192.168.255.255", NULL}; for (int i = 0; i < 6; i += 2) { if (NetSegment(localgroup[i], localgroup[i + 1], "").ContainIP(ipv4)) { return stringFormat("%s~%s", localgroup[i], localgroup[i + 1]); } } return ""; } void g_action_map_set_action_sensitive(GActionMap* map, const char* action_name, bool sensitive) { GAction* action = g_action_map_lookup_action(G_ACTION_MAP(map), action_name); if (!action) { return; } if (!G_IS_SIMPLE_ACTION(action)) { return; } g_simple_action_set_enabled(G_SIMPLE_ACTION(action), sensitive); } void g_action_map_set_actions(GActionMap* map, bool sensitive, const char* action_name, va_list args) { g_action_map_set_action_sensitive(map, action_name, sensitive); const char* action_name2 = va_arg(args, const char*); while (action_name2) { g_action_map_set_action_sensitive(map, action_name2, sensitive); action_name2 = va_arg(args, const char*); } } void g_action_map_enable_actions(GActionMap* map, const char* action_name, ...) { va_list args; va_start(args, action_name); g_action_map_set_actions(map, true, action_name, args); va_end(args); } void g_action_map_disable_actions(GActionMap* map, const char* action_name, ...) { va_list args; va_start(args, action_name); g_action_map_set_actions(map, false, action_name, args); va_end(args); } string markupEscapeText(const string& str) { auto res1 = g_markup_escape_text(str.c_str(), str.size()); string res(res1); g_free(res1); return res; } const GRegex* getUrlRegex() { static GRegex* res = nullptr; if (!res) { res = g_regex_new(URL_REGEX, GRegexCompileFlags(0), GRegexMatchFlags(0), NULL); } return res; } GActionEntry makeActionEntry(const string& name, GActionCallback f) { return GActionEntry( {g_strdup(name.c_str()), f, nullptr, nullptr, nullptr, {0, 0, 0}}); } GActionEntry makeParamActionEntry(const string& name, GActionCallback f, const string& paramType) { return GActionEntry({g_strdup(name.c_str()), f, g_strdup(paramType.c_str()), nullptr, nullptr, {0, 0, 0}}); } GActionEntry makeStateActionEntry(const string& name, GActionCallback f, const string& paramType, const string& state) { return GActionEntry({g_strdup(name.c_str()), nullptr, g_strdup(paramType.c_str()), g_strdup(state.c_str()), f, {0, 0, 0}}); } gboolean gtk_window_iconify_on_delete(GtkWindow* window) { gtk_window_iconify(window); return TRUE; } GtkHeaderBar* CreateHeaderBar(GtkWindow* window, GMenuModel* menu) { GtkBuilder* builder = gtk_builder_new_from_resource(IPTUX_RESOURCE "gtk/HeaderBar.ui"); GtkHeaderBar* headerBar = GTK_HEADER_BAR(gtk_builder_get_object(builder, "header_bar")); gtk_header_bar_set_has_subtitle(headerBar, FALSE); auto menuButton = gtk_builder_get_object(builder, "menu_button"); gtk_menu_button_set_menu_model(GTK_MENU_BUTTON(menuButton), menu); gtk_window_set_titlebar(window, GTK_WIDGET(headerBar)); g_object_unref(builder); return headerBar; } std::string TimeToStr(time_t t) { time_t now = time(nullptr); return TimeToStr_(t, now); } std::string TimeToStr_(time_t t, time_t now) { struct tm tm_t; struct tm tm_now; localtime_r(&t, &tm_t); localtime_r(&now, &tm_now); char res[11]; if (tm_t.tm_year == tm_now.tm_year && tm_t.tm_yday == tm_now.tm_yday) { strftime(res, sizeof(res), "%H:%M", &tm_t); } else { strftime(res, sizeof(res), "%F", &tm_t); } return res; } string StrFirstNonEmptyLine(const string& s) { size_t pos = s.find_first_not_of(" \r\n"); if (pos == string::npos) { return ""; } size_t pos2 = s.find_first_of("\r\n", pos); if (pos2 == string::npos) { return s.substr(pos); } return s.substr(pos, pos2 - pos); } GtkImage* igtk_image_new_with_size(const char* filename, int width, int height) { GError* error = NULL; GdkPixbuf* pixbuf = gdk_pixbuf_new_from_file(filename, &error); if (!pixbuf) { LOG_ERROR("Error loading image '%s': [%d]%s", filename, error->code, error->message); g_error_free(error); return NULL; } pixbuf_shrink_scale_1(&pixbuf, width, height); return GTK_IMAGE(gtk_image_new_from_pixbuf(pixbuf)); } string igtk_text_buffer_get_text(GtkTextBuffer* buffer) { GtkTextIter start, end; gtk_text_buffer_get_bounds(buffer, &start, &end); char* res1 = gtk_text_buffer_get_text(buffer, &start, &end, FALSE); string res(res1); g_free(res1); return res; } } // namespace iptux iptux-0.9.4/src/iptux/UiHelper.h000066400000000000000000000066211475473122500165420ustar00rootroot00000000000000#ifndef IPTUX_UIHELPER_H #define IPTUX_UIHELPER_H #include #include #include namespace iptux { typedef void (*GActionCallback)(GSimpleAction* action, GVariant* parameter, gpointer user_data); #define G_ACTION_CALLBACK(f) ((GActionCallback)(f)) bool ValidateDragData(GtkSelectionData* data, GdkDragContext* context, guint time); const GRegex* getUrlRegex(); gboolean gtk_window_iconify_on_delete(GtkWindow* window); void add_accelerator(GtkApplication* app, const char* action, const char* accel); void pixbuf_shrink_scale_1(GdkPixbuf** pixbuf, int width, int height); void widget_enable_dnd_uri(GtkWidget* widget); GSList* selection_data_get_path(GtkSelectionData* data); /** * @brief create GtkImage with width and height * * @param filename image file name * @param width max width, -1 for no limit * @param height max height, -1 for no limit * @return GtkImage* null if failed */ GtkImage* igtk_image_new_with_size(const char* filename, int width, int height); std::string igtk_text_buffer_get_text(GtkTextBuffer* buffer); /** * @brief only used for test, after call this, pop_info, pop_warning, * and iptux_open_url will only print log */ void pop_disable(); void pop_info(GtkWidget* parent, const gchar* format, ...) G_GNUC_PRINTF(2, 3); void pop_warning(GtkWidget* parent, const gchar* format, ...) G_GNUC_PRINTF(2, 3); void iptux_open_url(const char* url); void _ForTestToggleOpenUrl(bool enable); std::string ipv4_get_lan_name(in_addr ipv4); void g_action_map_enable_actions(GActionMap* map, const char* action_name, ...) G_GNUC_NULL_TERMINATED; void g_action_map_disable_actions(GActionMap* map, const char* action_name, ...) G_GNUC_NULL_TERMINATED; GActionEntry makeActionEntry(const std::string& name, GActionCallback f); GActionEntry makeParamActionEntry(const std::string& name, GActionCallback f, const std::string& paramType); GActionEntry makeStateActionEntry(const std::string& name, GActionCallback f, const std::string& paramType, const std::string& state); std::string StrFirstNonEmptyLine(const std::string& s); /** * @brief wrapper for g_makeup_escape_text * * @param str * @return std::string */ std::string markupEscapeText(const std::string& str); template std::string MarkupPrintf(const char* format, ...) G_GNUC_PRINTF(1, 2); template std::string MarkupPrintf(const char* format, ...) { va_list args; va_start(args, format); gchar* buf = g_markup_vprintf_escaped(format, args); va_end(args); std::string res(buf, strlen(buf)); g_free(buf); return res; } /** * @brief create a headerbar with menu, and set this headerbar to the window * * we need to set to window inside this func, otherwise we need manage the * refcount manually. * */ GtkHeaderBar* CreateHeaderBar(GtkWindow* window, GMenuModel* menu); std::string TimeToStr(time_t t); /* only used for test */ std::string TimeToStr_(time_t t, time_t now); } // namespace iptux #endif // IPTUX_UIHELPER_H iptux-0.9.4/src/iptux/UiHelperTest.cpp000066400000000000000000000045541475473122500177400ustar00rootroot00000000000000#include "gtest/gtest.h" #include "iptux-utils/TestHelper.h" #include "iptux/UiHelper.h" #include #include using namespace std; using namespace iptux; TEST(UiHelper, markupEscapeText) { ASSERT_EQ(markupEscapeText(""), ""); ASSERT_EQ(markupEscapeText("中文"), "中文"); ASSERT_EQ(markupEscapeText(""), "<span>"); ASSERT_EQ(markupEscapeText("\"hello\""), ""hello""); } TEST(UiHelper, TimeToStr) { setenv("TZ", "PST8PDT,M3.2.0/2,M11.1.0/2", 1); tzset(); ASSERT_EQ(TimeToStr_(1713583969, 1713583969), "20:32"); ASSERT_EQ(TimeToStr_(1713583969 - 86400, 1713583969), "2024-04-18"); ASSERT_EQ(TimeToStr_(1713583969 + 86400, 1713583969), "2024-04-20"); setenv("TZ", "GMT", 1); tzset(); ASSERT_EQ(TimeToStr_(1713583969, 1713583969), "03:32"); ASSERT_EQ(TimeToStr_(1713583969 / 86400 * 86400, 1713583969), "00:00"); ASSERT_EQ(TimeToStr_((1713583969 / 86400 + 1) * 86400 - 1, 1713583969), "23:59"); ASSERT_EQ(TimeToStr_(1713583969 / 86400 * 86400 - 1, 1713583969), "2024-04-19"); ASSERT_EQ(TimeToStr_((1713583969 / 86400 + 1) * 86400, 1713583969), "2024-04-21"); } TEST(UiHelper, StrFirstNonEmptyLine) { ASSERT_EQ(StrFirstNonEmptyLine(""), ""); ASSERT_EQ(StrFirstNonEmptyLine("a"), "a"); ASSERT_EQ(StrFirstNonEmptyLine(" a"), "a"); ASSERT_EQ(StrFirstNonEmptyLine(" a\n"), "a"); ASSERT_EQ(StrFirstNonEmptyLine(" a \n"), "a "); ASSERT_EQ(StrFirstNonEmptyLine(" a \n b"), "a "); ASSERT_EQ(StrFirstNonEmptyLine("\n b"), "b"); ASSERT_EQ(StrFirstNonEmptyLine("\n b"), "b"); ASSERT_EQ(StrFirstNonEmptyLine(" \n b\n"), "b"); } struct a { int width; int height; int res_width; int res_height; }; TEST(UiHelper, igtk_image_new_with_size) { struct a cases[] = { {100, 100, 48, 48}, {20, 30, 20, 20}, {50, 40, 40, 40}, }; for (size_t i = 0; i < sizeof(cases) / sizeof(cases[0]); ++i) { struct a* tc = &cases[i]; GtkImage* image = igtk_image_new_with_size( testDataPath("iptux.png").c_str(), tc->width, tc->height); ASSERT_NE(image, nullptr); g_object_ref_sink(image); GdkPixbuf* pixbuf = gtk_image_get_pixbuf(image); if (tc->res_width) { ASSERT_EQ(gdk_pixbuf_get_width(pixbuf), tc->res_width); } if (tc->res_height) { ASSERT_EQ(gdk_pixbuf_get_height(pixbuf), tc->res_height); } g_object_unref(image); } } iptux-0.9.4/src/iptux/UiModels.cpp000066400000000000000000000672031475473122500171040ustar00rootroot00000000000000#include "config.h" #include "UiModels.h" #include #include #include #include "iptux-core/Const.h" #include "iptux-core/Models.h" #include "iptux-utils/output.h" #include "iptux-utils/utils.h" #include "iptux/DialogBase.h" #include "iptux/UiHelper.h" #include using namespace std; namespace iptux { const char* const kObjectKeyImagePath = "image-path"; /** * 文件传输树(trans-tree)底层数据结构. * 14,0 status,1 task,2 peer,3 ip,4 filename,5 filelength,6 finishlength,7 * progress, 8 pro-text,9 cost,10 remain,11 rate,12,pathname,13 data,14 para, 15 * finished * * 任务状态;任务类型;任务对端;文件名(如果当前是文件夹,该项指正在传输的文件夹内单个文件, * 整个文件夹传输完成后,该项指向当前是文件夹);文件长度;完成长度;完成进度; * 进度串;已花费时间;任务剩余时间;传输速度;带路径文件名(不显示);文件传输类;参数指针值 * * @return trans-model */ TransModel* transModelNew() { GtkListStore* model; model = gtk_list_store_new(int(TransModelColumn::N_COLUMNS), G_TYPE_STRING, // STATUS G_TYPE_STRING, // TASK G_TYPE_STRING, // PEER G_TYPE_STRING, // IP G_TYPE_STRING, // FILENAME G_TYPE_STRING, // FILE_LENGTH_TEXT G_TYPE_STRING, // FINISHED_LENGTH_TEXT G_TYPE_INT, // PROGRESS G_TYPE_STRING, // PROGRESS_TEXT G_TYPE_STRING, // COST G_TYPE_STRING, // REMAIN G_TYPE_STRING, // RATE G_TYPE_STRING, // FILE_PATH G_TYPE_BOOLEAN, // FINISHED G_TYPE_INT // TASK_ID ); return GTK_TREE_MODEL(model); } void transModelDelete(TransModel* model) { g_object_unref(model); } static void transModelFillFromTransFileModel(TransModel* model, GtkTreeIter* iter, const TransFileModel& para) { gtk_list_store_set( GTK_LIST_STORE(model), iter, // TransModelColumn::STATUS, para.getStatus().c_str(), // TransModelColumn::TASK, para.getTask().c_str(), // TransModelColumn::PEER, para.getPeer().c_str(), // TransModelColumn::IP, para.getIp().c_str(), // TransModelColumn::FILENAME, para.getFilename().c_str(), // TransModelColumn::FILE_LENGTH_TEXT, para.getFileLengthText().c_str(), // TransModelColumn::FINISHED_LENGTH_TEXT, para.getFinishedLengthText().c_str(), // TransModelColumn::PROGRESS, int(para.getProgress()), // TransModelColumn::PROGRESS_TEXT, para.getProgressText().c_str(), // TransModelColumn::COST, para.getCost().c_str(), // TransModelColumn::REMAIN, para.getRemain().c_str(), // TransModelColumn::RATE, para.getRate().c_str(), // TransModelColumn::FILE_PATH, para.getFilePath().c_str(), // TransModelColumn::FINISHED, para.isFinished(), // TransModelColumn::TASK_ID, para.getTaskId(), // -1); } void transModelUpdateFromTransFileModel(TransModel* model, const TransFileModel& transFileModel) { GtkTreeIter iter; bool found = false; if (gtk_tree_model_get_iter_first(model, &iter)) { do { int taskId = 0; gtk_tree_model_get(model, &iter, TransModelColumn::TASK_ID, &taskId, -1); if (taskId == transFileModel.getTaskId()) { found = true; break; } } while (gtk_tree_model_iter_next(model, &iter)); } if (!found) { gtk_list_store_append(GTK_LIST_STORE(model), &iter); } /* 重设数据 */ transModelFillFromTransFileModel(model, &iter, transFileModel); } void transModelLoadFromTransFileModels( TransModel* model, const vector>& fileModels) { gtk_list_store_clear(GTK_LIST_STORE(model)); for (auto& it : fileModels) { GtkTreeIter iter; gtk_list_store_append(GTK_LIST_STORE(model), &iter); transModelFillFromTransFileModel(model, &iter, *(it.get())); } } /** * 好友树(paltree)按昵称排序的比较函数. * @param model paltree-model * @param a A GtkTreeIter in model * @param b Another GtkTreeIter in model * @return 比较值 */ gint paltreeCompareByNameFunc(GtkTreeModel* model, GtkTreeIter* a, GtkTreeIter* b) { GroupInfo *agrpinf, *bgrpinf; gint result; gtk_tree_model_get(model, a, PalTreeModelColumn::DATA, &agrpinf, -1); gtk_tree_model_get(model, b, PalTreeModelColumn::DATA, &bgrpinf, -1); result = strcmp(agrpinf->name().c_str(), bgrpinf->name().c_str()); return result; } gint paltreeCompareByUserNameFunc(GtkTreeModel* model, GtkTreeIter* a, GtkTreeIter* b) { GroupInfo *agrpinf, *bgrpinf; gint result; gtk_tree_model_get(model, a, PalTreeModelColumn::DATA, &agrpinf, -1); gtk_tree_model_get(model, b, PalTreeModelColumn::DATA, &bgrpinf, -1); result = strcmp(agrpinf->user_name().c_str(), bgrpinf->user_name().c_str()); return result; } /** * 好友树(paltree)按IP排序的比较函数. * @param model paltree-model * @param a A GtkTreeIter in model * @param b Another GtkTreeIter in model * @return 比较值 */ gint paltreeCompareByIPFunc(GtkTreeModel* model, GtkTreeIter* a, GtkTreeIter* b) { GroupInfo *agrpinf, *bgrpinf; gtk_tree_model_get(model, a, PalTreeModelColumn::DATA, &agrpinf, -1); gtk_tree_model_get(model, b, PalTreeModelColumn::DATA, &bgrpinf, -1); if (agrpinf->getType() == GROUP_BELONG_TYPE_REGULAR && bgrpinf->getType() == GROUP_BELONG_TYPE_REGULAR) { if (agrpinf->grpid < bgrpinf->grpid) { return -1; } if (agrpinf->grpid == bgrpinf->grpid) { return 0; } return 1; } return 0; } gint paltreeCompareByHostFunc(GtkTreeModel* model, GtkTreeIter* a, GtkTreeIter* b) { GroupInfo *agrpinf, *bgrpinf; gtk_tree_model_get(model, a, PalTreeModelColumn::DATA, &agrpinf, -1); gtk_tree_model_get(model, b, PalTreeModelColumn::DATA, &bgrpinf, -1); return strcmp(agrpinf->host().c_str(), bgrpinf->host().c_str()); } gint paltreeCompareByLastActivityFunc(GtkTreeModel* model, GtkTreeIter* a, GtkTreeIter* b) { GroupInfo *agrpinf, *bgrpinf; gtk_tree_model_get(model, a, PalTreeModelColumn::DATA, &agrpinf, -1); gtk_tree_model_get(model, b, PalTreeModelColumn::DATA, &bgrpinf, -1); if (agrpinf->last_activity() < bgrpinf->last_activity()) { return -1; } else if (agrpinf->last_activity() == bgrpinf->last_activity()) { return 0; } else { return 1; } } /** * 好友树(paltree)底层数据结构. * 7,0 closed-expander,1 open-expander,2 info.,3 extras,4 style,5 color,6 data * \n 关闭的展开器;打开的展开器;群组信息;扩展信息;字体风格;字体颜色;群组数据 \n * @return paltree-model */ PalTreeModel* palTreeModelNew() { return palTreeModelNew(PalTreeModelSortKey::IP, GTK_SORT_ASCENDING); } PalTreeModel* palTreeModelNew(PalTreeModelSortKey sort_key, GtkSortType sort_type) { GtkTreeStore* model; model = gtk_tree_store_new(int(PalTreeModelColumn::N_COLUMNS), GDK_TYPE_PIXBUF, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING, PANGO_TYPE_ATTR_LIST, GDK_TYPE_RGBA, G_TYPE_POINTER); palTreeModelSetSortKey(GTK_TREE_MODEL(model), sort_key); gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(model), GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, sort_type); return GTK_TREE_MODEL(model); } void palTreeModelSetSortKey(PalTreeModel* model, PalTreeModelSortKey key) { GtkTreeIterCompareFunc f = PalTreeModelSortKeyToCompareFunc(key); if (!f) { LOG_WARN("unknown PalTreeModelSortKey: %d", int(key)); return; } gtk_tree_sortable_set_default_sort_func(GTK_TREE_SORTABLE(model), f, NULL, NULL); } GroupInfo* PalTreeModelGetGroupInfo(PalTreeModel* model, GtkTreeIter* iter) { GroupInfo* pgrpinf; gtk_tree_model_get(model, iter, PalTreeModelColumn::DATA, &pgrpinf, -1); return pgrpinf; } static const GdkRGBA color = {0.3216, 0.7216, 0.2196, 0.0}; /** * 填充群组数据(grpinf)到数据集(model)指定位置(iter). * @param model model * @param iter iter * @param grpinf class GroupInfo */ void palTreeModelFillFromGroupInfo(GtkTreeModel* model, GtkTreeIter* iter, const GroupInfo* grpinf, GroupInfoStyle style, const string& font) { GtkIconTheme* theme; GdkPixbuf *cpixbuf, *opixbuf = nullptr; PangoAttrList* attrs; PangoAttribute* attr; string extra; PalInfo* pal; GError* error = nullptr; /* 创建图标 */ theme = gtk_icon_theme_get_default(); if (grpinf->getType() == GROUP_BELONG_TYPE_REGULAR) { pal = grpinf->getMembers()[0].get(); auto file = iptux_erase_filename_suffix(pal->icon_file().c_str()); cpixbuf = gtk_icon_theme_load_icon(theme, file, MAX_ICONSIZE, GtkIconLookupFlags(0), &error); if (cpixbuf == nullptr) { LOG_WARN("gtk_icon_theme_load_icon failed: [%d] %s", error->code, error->message); g_error_free(error); error = nullptr; } else { opixbuf = GDK_PIXBUF(g_object_ref(cpixbuf)); } g_free(file); } else { cpixbuf = gtk_icon_theme_load_icon(theme, "tip-hide", MAX_ICONSIZE, GtkIconLookupFlags(0), NULL); opixbuf = gtk_icon_theme_load_icon(theme, "tip-show", MAX_ICONSIZE, GtkIconLookupFlags(0), NULL); } /* 创建扩展信息 */ if (grpinf->getType() != GROUP_BELONG_TYPE_REGULAR) { extra = stringFormat("(%d)", (int)(grpinf->getMembers().size())); } /* 创建字体风格 */ attrs = pango_attr_list_new(); if (grpinf->getType() == GROUP_BELONG_TYPE_REGULAR) { auto dspt = pango_font_description_from_string(font.c_str()); attr = pango_attr_font_desc_new(dspt); pango_attr_list_insert(attrs, attr); pango_font_description_free(dspt); } else { attr = pango_attr_size_new(8192); pango_attr_list_insert(attrs, attr); attr = pango_attr_style_new(PANGO_STYLE_ITALIC); pango_attr_list_insert(attrs, attr); attr = pango_attr_weight_new(PANGO_WEIGHT_BOLD); pango_attr_list_insert(attrs, attr); } /* 设置相应的数据 */ gtk_tree_store_set( GTK_TREE_STORE(model), iter, PalTreeModelColumn ::CLOSED_EXPANDER, cpixbuf, PalTreeModelColumn ::OPEN_EXPANDER, opixbuf, PalTreeModelColumn ::INFO, grpinf->GetInfoAsMarkup(style).c_str(), PalTreeModelColumn ::EXTRAS, extra.c_str(), PalTreeModelColumn ::STYLE, attrs, PalTreeModelColumn ::COLOR, &color, PalTreeModelColumn ::DATA, grpinf, -1); /* 释放资源 */ if (cpixbuf) g_object_unref(cpixbuf); if (opixbuf) g_object_unref(opixbuf); pango_attr_list_unref(attrs); } static const char* group_info_style_names[] = { [(int)GroupInfoStyle::IP] = "ip", [(int)GroupInfoStyle::HOST] = "host", [(int)GroupInfoStyle::USERNAME] = "username", [(int)GroupInfoStyle::VERSION_NAME] = "version", [(int)GroupInfoStyle::LAST_ACTIVITY] = "last_activity", [(int)GroupInfoStyle::LAST_MESSAGE] = "last_message", [(int)GroupInfoStyle::IP_PORT] = "ip_port", }; GroupInfoStyle GroupInfoStyleFromStr(const std::string& s) { for (int i = 0; i < (int)GroupInfoStyle::INVALID; ++i) { if (s == group_info_style_names[i]) { return (GroupInfoStyle)i; } } return GroupInfoStyle::INVALID; } const char* GroupInfoStyleToStr(GroupInfoStyle style) { if (style >= GroupInfoStyle::IP && style < GroupInfoStyle::INVALID) { return group_info_style_names[(int)style]; } return ""; } static const char* gtk_sort_type_names[] = { [GTK_SORT_ASCENDING] = "ascending", [GTK_SORT_DESCENDING] = "descending", }; GtkSortType GtkSortTypeFromStr(const std::string& s) { for (int i = GTK_SORT_ASCENDING; i <= GTK_SORT_DESCENDING; ++i) { if (s == gtk_sort_type_names[i]) { return (GtkSortType)i; } } return GTK_SORT_TYPE_INVALID; } const char* GtkSortTypeToStr(GtkSortType t) { if (GTK_SORT_ASCENDING <= t && t <= GTK_SORT_DESCENDING) { return gtk_sort_type_names[t]; } return ""; } // GroupInfo::GroupInfo() // : grpid(0), // type(GROUP_BELONG_TYPE_REGULAR), // member(NULL), // buffer(NULL), // dialog(NULL) {} GroupInfo::~GroupInfo() { if (buffer) g_object_unref(buffer); } bool GroupInfo::hasPal(PalInfo* pal) const { for (auto i : members) { if (i.get() == pal) { return true; } } return false; } bool GroupInfo::hasPal(PPalInfo pal) const { return hasPal(pal.get()); } string GroupInfo::user_name() const { if (getType() == GROUP_BELONG_TYPE_REGULAR) { auto pal = this->getMembers()[0].get(); return pal->getUser(); } return ""; } GroupInfo::GroupInfo(PPalInfo pal, CPPalInfo me, LogSystem* logSystem) : grpid(0), buffer(NULL), dialogBase(NULL), me(me), type(GROUP_BELONG_TYPE_REGULAR), logSystem(logSystem) { members.push_back(pal); inputBuffer = gtk_text_buffer_new(NULL); name_ = pal->getName(); host_ = pal->getHost(); } GroupInfo::GroupInfo(iptux::GroupBelongType t, const vector& pals, CPPalInfo me, const string& name, LogSystem* logSystem) : grpid(0), buffer(NULL), dialogBase(NULL), me(me), members(pals), type(t), logSystem(logSystem) { inputBuffer = gtk_text_buffer_new(NULL); name_ = name; } GtkWidget* GroupInfo::getDialog() const { return dialogBase ? GTK_WIDGET(dialogBase->getWindow()) : nullptr; } bool GroupInfo::addPal(PPalInfo pal) { if (type == GROUP_BELONG_TYPE_REGULAR) { LOG_WARN("should not call addPal on GROUP_BELONG_TYPE_REGULAR"); return false; } if (hasPal(pal)) { return false; } members.push_back(pal); return true; } bool GroupInfo::delPal(PalInfo* pal) { if (type == GROUP_BELONG_TYPE_REGULAR) { LOG_WARN("should not call delPal on GROUP_BELONG_TYPE_REGULAR"); return false; } for (auto it = members.begin(); it != members.end(); ++it) { if (it->get() == pal) { members.erase(it); return true; } } return false; } void GroupInfo::newFileReceived() { this->signalNewFileReceived.emit(this); } bool GroupInfo::isInputEmpty() const { GtkTextIter start, end; gtk_text_buffer_get_bounds(inputBuffer, &start, &end); return gtk_text_iter_equal(&start, &end); } shared_ptr GroupInfo::genMsgParaFromInput() const { static unsigned int count = 0; GtkTextIter start; GdkPixbuf* pixbuf; char buf[7]; gchar* chipmsg; std::vector dtlist; gtk_text_buffer_get_start_iter(inputBuffer, &start); ostringstream oss; while (1) { gunichar c = gtk_text_iter_get_char(&start); if (!c) break; if (ig_unichar_is_atomic(c)) { if (!oss.str().empty()) { ChipData chip(MESSAGE_CONTENT_TYPE_STRING, oss.str()); dtlist.push_back(std::move(chip)); oss.str(""); } pixbuf = gtk_text_iter_get_pixbuf(&start); chipmsg = g_strdup_printf("%s" SENT_IMAGE_PATH "/%d.png", g_get_user_cache_dir(), g_atomic_int_add(&count, 1)); GError* error = nullptr; gdk_pixbuf_save(pixbuf, chipmsg, "png", &error, NULL); if (error) { LOG_ERROR("failed to save image: %s", error->message); g_error_free(error); } else { /* 新建一个碎片数据(图片),并加入数据链表 */ ChipData chip(MESSAGE_CONTENT_TYPE_PICTURE, chipmsg); dtlist.push_back(std::move(chip)); } } else { int size = g_unichar_to_utf8(c, buf); oss.write(buf, size); } gtk_text_iter_forward_char(&start); } if (!oss.str().empty()) { ChipData chip(MESSAGE_CONTENT_TYPE_STRING, oss.str()); dtlist.push_back(std::move(chip)); } auto para = make_shared(this->getMembers()[0]); para->stype = MessageSourceType::SELF; para->btype = type; para->dtlist = dtlist; return para; } void GroupInfo::clearInputBuffer() { gtk_text_buffer_set_text(inputBuffer, "", 0); } void GroupInfo::addMsgCount(int i) { int oldCount = getUnreadMsgCount(); allMsgCount += i; signalUnreadMsgCountUpdated.emit(this, oldCount, getUnreadMsgCount()); } void GroupInfo::readAllMsg() { int oldCount = getUnreadMsgCount(); if (oldCount != 0) { readMsgCount = allMsgCount; signalUnreadMsgCountUpdated.emit(this, oldCount, getUnreadMsgCount()); } } int GroupInfo::getUnreadMsgCount() const { g_assert(allMsgCount >= readMsgCount); return allMsgCount - readMsgCount; } string GroupInfo::GetInfoAsMarkup(GroupInfoStyle style) const { string info; /* 创建主信息 */ if (getType() == GROUP_BELONG_TYPE_REGULAR) { string line2; auto pal = this->getMembers()[0].get(); switch (style) { case GroupInfoStyle::HOST: line2 = this->host(); break; case GroupInfoStyle::VERSION_NAME: line2 = pal->getVersion(); break; case GroupInfoStyle::USERNAME: line2 = user_name(); break; case GroupInfoStyle::LAST_ACTIVITY: line2 = last_activity_ ? TimeToStr(last_activity_) : ""; break; case GroupInfoStyle::LAST_MESSAGE: line2 = last_message_; break; case GroupInfoStyle::IP_PORT: line2 = stringFormat("%s:%d", inAddrToString(pal->ipv4()).c_str(), pal->port()); break; case GroupInfoStyle::IP: default: auto pal = this->getMembers()[0].get(); line2 = inAddrToString(pal->ipv4()); } int unreadMsgCount = this->getUnreadMsgCount(); if (unreadMsgCount > 0) { return stringFormat("%s (%d)\n%s", markupEscapeText(pal->getName()).c_str(), unreadMsgCount, markupEscapeText(line2).c_str()); } else { return stringFormat("%s\n%s", markupEscapeText(pal->getName()).c_str(), markupEscapeText(line2).c_str()); } } else { return markupEscapeText(this->name()); } } string GroupInfo::GetHintAsMarkup() const { if (this->type != GROUP_BELONG_TYPE_REGULAR) { return ""; } auto pal = this->members[0]; ostringstream res; res << MarkupPrintf(_("Version: %s"), pal->getVersion().c_str()); res << "\n"; if (!pal->getGroup().empty()) { res << MarkupPrintf(_("Nickname: %s@%s"), pal->getName().c_str(), pal->getGroup().c_str()); } else { res << MarkupPrintf(_("Nickname: %s"), pal->getName().c_str()); } res << "\n"; res << MarkupPrintf(_("User: %s"), pal->getUser().c_str()); res << "\n"; res << MarkupPrintf(_("Host: %s"), pal->getHost().c_str()); res << "\n"; string ipstr = inAddrToString(pal->ipv4()); if (pal->segdes && *pal->segdes != '\0') { res << MarkupPrintf(_("Address: %s(%s)"), pal->segdes, ipstr.c_str()); } else { res << MarkupPrintf(_("Address: %s"), ipstr.c_str()); } res << "\n"; if (!pal->isCompatible()) { res << markupEscapeText(_("Compatibility: Microsoft")); } else { res << markupEscapeText(_("Compatibility: GNU/Linux")); } res << "\n"; res << MarkupPrintf(_("System coding: %s"), pal->getEncode().c_str()); if (pal->sign && pal->sign[0]) { string signature1; string signature2; signature1 = markupEscapeText(_("Signature:")); signature2 = markupEscapeText(pal->sign); res << stringFormat( "\n%s\n%s", signature1.c_str(), signature2.c_str()); } return res.str(); } void GroupInfo::initBuffer(GtkTextTagTable* tag_table) { this->buffer = gtk_text_buffer_new(tag_table); g_signal_connect_data(this->buffer, "insert-child-anchor", G_CALLBACK(GroupInfo::OnBufferInsertChildAnchor), this, NULL, (GConnectFlags)(G_CONNECT_AFTER | G_CONNECT_SWAPPED)); } void GroupInfo::OnBufferInsertChildAnchor(GroupInfo* self, const GtkTextIter*, GtkTextChildAnchor* anchor, GtkTextBuffer*) { if (!self->dialogBase) return; self->dialogBase->onChatHistoryInsertChildAnchor(anchor); } /** * 插入字符串到TextBuffer(非UI线程安全). * @param buffer text-buffer * @param string 字符串 */ static void InsertStringToBuffer(GtkTextBuffer* buffer, const gchar* s) { static uint32_t count = 0; GtkTextIter iter; GtkTextTag* tag; GMatchInfo* matchinfo; gchar* substring; char name[9]; // 8 +1 =9 gint startp, endp; gint urlendp; auto s2 = utf8MakeValid(s); auto string = s2.c_str(); urlendp = 0; matchinfo = NULL; gtk_text_buffer_get_end_iter(buffer, &iter); g_regex_match_full(getUrlRegex(), string, -1, 0, GRegexMatchFlags(0), &matchinfo, NULL); while (g_match_info_matches(matchinfo)) { snprintf(name, 9, "%" PRIx32, count++); tag = gtk_text_buffer_create_tag(buffer, name, NULL); substring = g_match_info_fetch(matchinfo, 0); g_object_set_data_full(G_OBJECT(tag), "url", substring, GDestroyNotify(g_free)); g_match_info_fetch_pos(matchinfo, 0, &startp, &endp); gtk_text_buffer_insert(buffer, &iter, string + urlendp, startp - urlendp); gtk_text_buffer_insert_with_tags_by_name( buffer, &iter, string + startp, endp - startp, "url-link", name, NULL); urlendp = endp; g_match_info_next(matchinfo, NULL); } g_match_info_free(matchinfo); gtk_text_buffer_insert(buffer, &iter, string + urlendp, -1); gtk_text_buffer_get_end_iter(buffer, &iter); gtk_text_buffer_insert(buffer, &iter, "\n", -1); } /** * 插入消息头到TextBuffer(非UI线程安全). * @param buffer text-buffer * @param para 消息参数 */ static void InsertHeaderToBuffer(GtkTextBuffer* buffer, const MsgPara* para, CPPalInfo me, time_t now) { GtkTextIter iter; gchar* header; /** * @note (para->pal)可能为null. */ switch (para->stype) { case MessageSourceType::PAL: header = getformattime2(now, FALSE, "%s", para->getPal()->getName().c_str()); gtk_text_buffer_get_end_iter(buffer, &iter); gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, header, -1, "pal-color", NULL); g_free(header); break; case MessageSourceType::SELF: header = getformattime2(now, FALSE, "%s", me->getName().c_str()); gtk_text_buffer_get_end_iter(buffer, &iter); gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, header, -1, "me-color", NULL); g_free(header); break; case MessageSourceType::ERROR: header = getformattime2(now, FALSE, "%s", _("")); gtk_text_buffer_get_end_iter(buffer, &iter); gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, header, -1, "error-color", NULL); g_free(header); break; default: break; } gtk_text_buffer_get_end_iter(buffer, &iter); gtk_text_buffer_insert(buffer, &iter, "\n", -1); } /** * 插入图片到TextBuffer. * @param buffer text-buffer * @param path 图片路径 */ static void InsertPixbufToBuffer(GtkTextBuffer* buffer, const gchar* path) { GtkTextIter iter; gtk_text_buffer_get_end_iter(buffer, &iter); GtkTextChildAnchor* anchor = gtk_text_child_anchor_new(); g_object_set_data_full(G_OBJECT(anchor), kObjectKeyImagePath, g_strdup(path), GDestroyNotify(g_free)); gtk_text_buffer_insert_child_anchor(buffer, &iter, anchor); gtk_text_buffer_get_end_iter(buffer, &iter); gtk_text_buffer_insert(buffer, &iter, "\n", -1); } void GroupInfo::addMsgPara(const MsgPara& para) { time_t now = time(NULL); _addMsgPara(para, now); } void GroupInfo::_addMsgPara(const MsgPara& para, time_t now) { const gchar* data; time(&last_activity_); for (size_t i = 0; i < para.dtlist.size(); ++i) { const ChipData* chipData = ¶.dtlist[i]; data = chipData->data.c_str(); switch (chipData->type) { case MESSAGE_CONTENT_TYPE_STRING: InsertHeaderToBuffer(buffer, ¶, me, now); InsertStringToBuffer(buffer, data); last_message_ = StrFirstNonEmptyLine(chipData->data); if (logSystem) { logSystem->communicateLog(¶, "[STRING]%s", data); } break; case MESSAGE_CONTENT_TYPE_PICTURE: InsertHeaderToBuffer(buffer, ¶, me, now); InsertPixbufToBuffer(buffer, data); last_message_ = _("[IMG]"); if (logSystem) { logSystem->communicateLog(¶, "[PICTURE]%s", data); } break; default: break; } } addMsgCount(1); } bool transModelIsFinished(TransModel* model) { GtkTreeIter iter; if (gtk_tree_model_get_iter_first(model, &iter)) { do { gboolean finished = false; gtk_tree_model_get(model, &iter, TransModelColumn::FINISHED, &finished, -1); if (!finished) return false; } while (gtk_tree_model_iter_next(model, &iter)); } return true; } IconModel* iconModelNew() { return gtk_list_store_new(2, GDK_TYPE_PIXBUF, G_TYPE_STRING); } const char* pal_tree_model_sort_key_names[] = { [(int)PalTreeModelSortKey::NICKNAME] = "nickname", [(int)PalTreeModelSortKey::USERNAME] = "username", [(int)PalTreeModelSortKey::IP] = "ip", [(int)PalTreeModelSortKey::HOST] = "host", [(int)PalTreeModelSortKey::LAST_ACTIVITY] = "last_activity", }; PalTreeModelSortKey PalTreeModelSortKeyFromStr(const std::string& s) { for (int i = 0; i < (int)PalTreeModelSortKey::INVALID; ++i) { if (s == pal_tree_model_sort_key_names[i]) { return (PalTreeModelSortKey)i; } } return PalTreeModelSortKey::INVALID; } const char* PalTreeModelSortKeyToStr(PalTreeModelSortKey k) { if (PalTreeModelSortKey::NICKNAME <= k && k < PalTreeModelSortKey::INVALID) { return pal_tree_model_sort_key_names[(int)k]; } return ""; } GtkTreeIterCompareFunc PalTreeModelSortKeyToCompareFunc(PalTreeModelSortKey k) { switch (k) { case PalTreeModelSortKey::NICKNAME: return GtkTreeIterCompareFunc(paltreeCompareByNameFunc); case PalTreeModelSortKey::USERNAME: return GtkTreeIterCompareFunc(paltreeCompareByNameFunc); case PalTreeModelSortKey::IP: return GtkTreeIterCompareFunc(paltreeCompareByIPFunc); case PalTreeModelSortKey::HOST: return GtkTreeIterCompareFunc(paltreeCompareByHostFunc); case PalTreeModelSortKey::LAST_ACTIVITY: return GtkTreeIterCompareFunc(paltreeCompareByLastActivityFunc); default: return nullptr; } } } // namespace iptux iptux-0.9.4/src/iptux/UiModels.h000066400000000000000000000143351475473122500165470ustar00rootroot00000000000000#ifndef IPTUX_UIMODELS_H #define IPTUX_UIMODELS_H #include #include #include "iptux-core/Models.h" #include "iptux-core/TransFileModel.h" #include "iptux/LogSystem.h" namespace iptux { extern const char* const kObjectKeyImagePath; typedef void (*GActionCallback)(GSimpleAction* action, GVariant* parameter, gpointer user_data); #define G_ACTION_CALLBACK(f) ((GActionCallback)(f)) /** * 会话抽象类. * 提供好友会话类必需的公共接口. */ class SessionAbstract { public: SessionAbstract(){}; virtual ~SessionAbstract(){}; virtual void UpdatePalData(PalInfo* pal) = 0; ///< 更新好友数据 virtual void InsertPalData(PalInfo* pal) = 0; ///< 插入好友数据 virtual void DelPalData(PalInfo* pal) = 0; ///< 删除好友数据 virtual void ClearAllPalData() = 0; ///< 清除所有好友数据 // virtual void ShowEnclosure() = 0; ///< 显示附件 virtual void AttachEnclosure(const GSList* list) = 0; ///< 添加附件 virtual void OnNewMessageComing() = 0; ///< 窗口打开情况下有新消息 }; /** * 群组信息. */ class DialogBase; enum class GroupInfoStyle { IP, HOST, USERNAME, VERSION_NAME, LAST_ACTIVITY, LAST_MESSAGE, IP_PORT, INVALID }; GroupInfoStyle GroupInfoStyleFromStr(const std::string& s); const char* GroupInfoStyleToStr(GroupInfoStyle style); const GtkSortType GTK_SORT_TYPE_INVALID = (GtkSortType)-1; GtkSortType GtkSortTypeFromStr(const std::string& s); const char* GtkSortTypeToStr(GtkSortType t); class GroupInfo { public: GroupInfo(PPalInfo pal, CPPalInfo me, LogSystem* logSystem); GroupInfo(GroupBelongType type, const std::vector& pals, CPPalInfo me, const std::string& name, LogSystem* logSystem); ~GroupInfo(); const std::vector& getMembers() const { return members; } GroupBelongType getType() const { return type; } /** return true if successful added, noop for regular group */ bool addPal(PPalInfo pal); /** return true if successful deleted, noop for regular group */ bool delPal(PalInfo* pal); /** return true if successful deleted, noop for regulat group */ bool delPal(PPalInfo pal); bool hasPal(PalInfo* pal) const; bool hasPal(PPalInfo pal) const; void addMsgPara(const MsgPara& msg); void _addMsgPara(const MsgPara& msg, time_t t); void readAllMsg(); int getUnreadMsgCount() const; std::string GetInfoAsMarkup(GroupInfoStyle style) const; std::string GetHintAsMarkup() const; void newFileReceived(); GtkTextBuffer* getInputBuffer() const { return inputBuffer; } bool isInputEmpty() const; std::shared_ptr genMsgParaFromInput() const; void clearInputBuffer(); void setDialogBase(DialogBase* dialogBase) { this->dialogBase = dialogBase; } GtkWidget* getDialog() const; void clearDialog() { dialogBase = nullptr; } const std::string& name() const { return name_; } std::string user_name() const; const std::string& host() const { return host_; } time_t last_activity() const { return last_activity_; } const std::string& last_message() const { return last_message_; } void initBuffer(GtkTextTagTable* tag_table); public: sigc::signal signalUnreadMsgCountUpdated; sigc::signal signalNewFileReceived; private: static void OnBufferInsertChildAnchor(GroupInfo* self, const GtkTextIter* location, GtkTextChildAnchor* anchor, GtkTextBuffer* buffer); public: GQuark grpid; ///< 唯一标识 GtkTextBuffer* buffer; ///< 历史消息缓冲区 * private: std::string name_; ///< 群组名称 * std::string host_; DialogBase* dialogBase; GtkTextBuffer* inputBuffer; /// 输入缓冲 time_t last_activity_ = 0; std::string last_message_; private: CPPalInfo me; std::vector members; GroupBelongType type; ///< 群组类型 LogSystem* logSystem; int allMsgCount = 0; /* all received message count */ int readMsgCount = 0; /* already read message count */ private: void addMsgCount(int i); }; enum class TransModelColumn { STATUS, TASK, PEER, IP, FILENAME, FILE_LENGTH_TEXT, FINISHED_LENGTH_TEXT, PROGRESS, PROGRESS_TEXT, COST, REMAIN, RATE, FILE_PATH, FINISHED, TASK_ID, N_COLUMNS }; typedef GtkTreeModel TransModel; TransModel* transModelNew(); void transModelDelete(TransModel*); void transModelUpdateFromTransFileModel(TransModel* model, const TransFileModel&); void transModelLoadFromTransFileModels( TransModel* model, const std::vector>& fileModels); bool transModelIsFinished(TransModel*); enum class PalTreeModelSortKey { NICKNAME, USERNAME, IP, HOST, LAST_ACTIVITY, INVALID, }; PalTreeModelSortKey PalTreeModelSortKeyFromStr(const std::string& s); const char* PalTreeModelSortKeyToStr(PalTreeModelSortKey k); GtkTreeIterCompareFunc PalTreeModelSortKeyToCompareFunc(PalTreeModelSortKey k); enum class PalTreeModelColumn { CLOSED_EXPANDER, OPEN_EXPANDER, INFO, EXTRAS, STYLE, COLOR, DATA, N_COLUMNS }; typedef GtkTreeModel PalTreeModel; PalTreeModel* palTreeModelNew(); PalTreeModel* palTreeModelNew(PalTreeModelSortKey sort_key, GtkSortType sort_type); GroupInfo* PalTreeModelGetGroupInfo(PalTreeModel* model, GtkTreeIter* iter); void palTreeModelSetSortKey(PalTreeModel* model, PalTreeModelSortKey key); /** * 填充群组数据(grpinf)到数据集(model)指定位置(iter). * @param model model * @param iter iter * @param grpinf class GroupInfo * @param style info style * @param font font */ void palTreeModelFillFromGroupInfo(PalTreeModel* model, GtkTreeIter* iter, const GroupInfo* grpinf, GroupInfoStyle style, const std::string& font); enum class IconModelColumn { ICON, ICON_NAME, N_COLUMNS }; typedef GtkListStore IconModel; IconModel* iconModelNew(); } // namespace iptux #endif // IPTUX_UIMODELS_H iptux-0.9.4/src/iptux/UiModelsTest.cpp000066400000000000000000000127171475473122500177440ustar00rootroot00000000000000#include "gtest/gtest.h" #include "iptux-utils/TestHelper.h" #include #include #include #include "iptux-core/Models.h" #include "iptux-utils/utils.h" #include "iptux/UiModels.h" using namespace std; using namespace iptux; TEST(TransModel, transModelIsFinished) { TransModel* transModel = transModelNew(); ASSERT_TRUE(transModelIsFinished(transModel)); TransFileModel transFileModel; transFileModel.setTaskId(1); ASSERT_FALSE(transFileModel.isFinished()); transModelUpdateFromTransFileModel(transModel, transFileModel); ASSERT_FALSE(transModelIsFinished(transModel)); ASSERT_EQ(gtk_tree_model_iter_n_children(transModel, nullptr), 1); transFileModel.finish(); ASSERT_TRUE(transFileModel.isFinished()); transModelUpdateFromTransFileModel(transModel, transFileModel); ASSERT_TRUE(transModelIsFinished(transModel)); TransFileModel transFileModel2; transFileModel2.setTaskId(2); ASSERT_FALSE(transFileModel2.isFinished()); ASSERT_NE(transFileModel.getTaskId(), transFileModel2.getTaskId()); transModelUpdateFromTransFileModel(transModel, transFileModel2); ASSERT_EQ(gtk_tree_model_iter_n_children(transModel, nullptr), 2); ASSERT_FALSE(transModelIsFinished(transModel)); } TEST(GroupInfo, GetInfoAsMarkup) { PalInfo pal("127.0.0.1", 2425); pal.setName("palname"); PalInfo me("127.0.0.2", 2425); PPalInfo cpal = make_shared(pal); CPPalInfo cme = make_shared(me); GroupInfo gi(cpal, cme, nullptr); ASSERT_EQ(gi.GetInfoAsMarkup(GroupInfoStyle::IP), "palname\n127.0.0.1"); ASSERT_EQ(gi.GetInfoAsMarkup(GroupInfoStyle::IP_PORT), "palname\n127.0.0.1:2425"); MsgPara msg(cpal); gi.addMsgPara(msg); ASSERT_EQ(gi.GetInfoAsMarkup(GroupInfoStyle::IP), "palname (1)\n127.0.0.1"); vector pals; pals.push_back(cpal); GroupInfo gi2(GROUP_BELONG_TYPE_SEGMENT, pals, cme, "group_name", nullptr); ASSERT_EQ(gi2.GetInfoAsMarkup(GroupInfoStyle::IP), "group_name"); } TEST(GroupInfo, GetHintAsMarkup) { PalInfo pal("127.0.0.1", 2425); pal.setVersion("1_iptux"); pal.setName("palname"); PalInfo me("127.0.0.2", 2425); PPalInfo cpal = make_shared(pal); CPPalInfo cme = make_shared(me); GroupInfo gi(cpal, cme, nullptr); ASSERT_EQ(gi.GetHintAsMarkup(), "Version: 1_iptux\nNickname: palname\nUser: \nHost: \nAddress: " "127.0.0.1\nCompatibility: Microsoft\nSystem coding: "); cpal->sign = strdup("hello"); ASSERT_EQ(gi.GetHintAsMarkup(), "Version: 1_iptux\nNickname: palname\nUser: \nHost: \nAddress: " "127.0.0.1\nCompatibility: Microsoft\nSystem coding: " "\nSignature:\nhello"); } static string igtk_text_get_all_text(GtkTextBuffer* buffer) { GtkTextIter start, end; gtk_text_buffer_get_start_iter(buffer, &start); gtk_text_buffer_get_end_iter(buffer, &end); char* s = gtk_text_buffer_get_slice(buffer, &start, &end, true); string ret(s); g_free(s); return ret; } TEST(GroupInfo, addMsgPara) { setlocale(LC_ALL, "C"); PalInfo pal("127.0.0.1", 2425); pal.setVersion("1_iptux"); pal.setName("palname"); PalInfo me("127.0.0.2", 2425); PPalInfo cpal = make_shared(pal); CPPalInfo cme = make_shared(me); GroupInfo gi(cpal, cme, nullptr); gi.initBuffer(NULL); MsgPara msg(cpal); msg.dtlist.push_back(ChipData("helloworld")); time_t now = 1716533706; setenv("TZ", "GMT", 1); tzset(); gi._addMsgPara(msg, now); ASSERT_EQ(igtk_text_get_all_text(gi.buffer), "(06:55:06) palname:\nhelloworld\n"); msg = MsgPara(cpal); msg.dtlist.push_back( ChipData(MessageContentType::PICTURE, testDataPath("iptux.png"))); gi._addMsgPara(msg, now + 1); ASSERT_EQ( igtk_text_get_all_text(gi.buffer), "(06:55:06) palname:\nhelloworld\n(06:55:07) palname:\n\xEF\xBF\xBC\n"); } TEST(GroupInfo, genMsgParaFromInput) { PalInfo pal("127.0.0.1", 2425); pal.setVersion("1_iptux"); pal.setName("palname"); PalInfo me("127.0.0.2", 2425); PPalInfo cpal = make_shared(pal); CPPalInfo cme = make_shared(me); GroupInfo gi(cpal, cme, nullptr); GtkTextBuffer* buffer = gi.getInputBuffer(); ASSERT_TRUE(gi.isInputEmpty()); auto para = gi.genMsgParaFromInput(); ASSERT_EQ(para->dtlist.size(), 0u); GtkTextIter end; gtk_text_buffer_get_end_iter(buffer, &end); gtk_text_buffer_insert(buffer, &end, "hello", -1); para = gi.genMsgParaFromInput(); ASSERT_EQ(para->dtlist.size(), 1u); ASSERT_EQ(para->dtlist[0].type, MessageContentType::STRING); ASSERT_EQ(para->dtlist[0].data, "hello"); GError* error = NULL; auto pixbuf = gdk_pixbuf_new_from_file(testDataPath("iptux.png").c_str(), &error); if (error != nullptr) { ASSERT_TRUE(false) << error->message; g_error_free(error); } gtk_text_buffer_get_end_iter(buffer, &end); gtk_text_buffer_insert_pixbuf(buffer, &end, pixbuf); para = gi.genMsgParaFromInput(); ASSERT_EQ(para->dtlist.size(), 2u); ASSERT_EQ(para->dtlist[1].type, MessageContentType::PICTURE); gtk_text_buffer_get_end_iter(buffer, &end); gtk_text_buffer_insert(buffer, &end, "world", -1); para = gi.genMsgParaFromInput(); ASSERT_EQ(para->dtlist.size(), 3u); ASSERT_EQ(para->dtlist[2].type, MessageContentType::STRING); ASSERT_EQ(para->dtlist[2].data, "world"); ASSERT_FALSE(gi.isInputEmpty()); gi.clearInputBuffer(); ASSERT_TRUE(gi.isInputEmpty()); } iptux-0.9.4/src/iptux/WindowConfig.cpp000066400000000000000000000010601475473122500177450ustar00rootroot00000000000000#include "config.h" #include "WindowConfig.h" using namespace std; namespace iptux { void WindowConfig::LoadFromConfig(shared_ptr config) { int width = config->GetInt(prefix + "_width"); if (width != 0) { this->width = width; } int height = config->GetInt(prefix + "_height"); if (height != 0) { this->height = height; } } void WindowConfig::SaveToConfig(shared_ptr config) { config->SetInt(prefix + "_width", width); config->SetInt(prefix + "_height", height); config->Save(); } } // namespace iptux iptux-0.9.4/src/iptux/WindowConfig.h000066400000000000000000000015061475473122500174170ustar00rootroot00000000000000#ifndef IPTUX_WINDOW_CONFIG_H #define IPTUX_WINDOW_CONFIG_H #include #include #include "iptux-core/IptuxConfig.h" namespace iptux { class WindowConfig { public: WindowConfig(int defaultWidth, int defaultHeight, const std::string& prefix) : width(defaultWidth), height(defaultHeight), prefix(prefix) {} virtual ~WindowConfig() {} int GetWidth() const { return width; } WindowConfig& SetWidth(int width) { this->width = width; return *this; } int GetHeight() const { return height; } WindowConfig& SetHeight(int height) { this->height = height; return *this; } void LoadFromConfig(std::shared_ptr config); void SaveToConfig(std::shared_ptr config); private: int width; int height; std::string prefix; }; } // namespace iptux #endif iptux-0.9.4/src/iptux/callback.cpp000066400000000000000000000221761475473122500171170ustar00rootroot00000000000000// // C++ Implementation: callback // // Description: // // // Author: Jally , (C) 2009 // // Copyright: See COPYING file that comes with this distribution // // #include "config.h" #include "callback.h" #include #include #include #include "iptux-core/Const.h" #include "iptux/UiHelper.h" using namespace std; namespace iptux { /** * 给entry控件设置提示信息. * @param entry entry * @param x the x coordinate of the cursor position * @param y the y coordinate of the cursor position * @param key TRUE if the tooltip was triggered using the keyboard * @param tooltip a GtkTooltip * @param text text string * @return Gtk+库所需 */ gboolean entry_query_tooltip(GtkWidget* /* entry */, gint /* x */, gint /* y */, gboolean /* key */, GtkTooltip* tooltip, char* text) { GtkWidget* label; label = gtk_label_new(text); gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); gtk_label_set_line_wrap_mode(GTK_LABEL(label), PANGO_WRAP_WORD_CHAR); gtk_tooltip_set_custom(tooltip, label); return TRUE; } /** * 保证entry控件只接收数字字符. * @param entry entry * @param text the new text to insert * @param length the length of the new text, in bytes, or -1 if new_text is * nul-terminated */ void entry_insert_numeric(GtkWidget* entry, gchar* text, gint length) { gint count; if (length == -1) length = strlen(text); count = 0; while (count < length) { if (!isdigit(*(text + count)) && !(*(text + count) == '.')) { g_signal_stop_emission_by_name(entry, "insert-text"); return; } count++; } } /** * 以可预览的方式选择文件. * @param title file chooser dialog title * @param parent parent * @return 文件名 */ gchar* choose_file_with_preview(const gchar* title, GtkWidget* parent) { GtkWidget *chooser, *preview; gchar* filename; chooser = gtk_file_chooser_dialog_new( title, GTK_WINDOW(parent), GTK_FILE_CHOOSER_ACTION_OPEN, _("_Open"), GTK_RESPONSE_ACCEPT, _("_Cancel"), GTK_RESPONSE_CANCEL, NULL); gtk_dialog_set_default_response(GTK_DIALOG(chooser), GTK_RESPONSE_ACCEPT); gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(chooser), TRUE); gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(chooser), FALSE); gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(chooser), TRUE); gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(chooser), g_get_home_dir()); preview = gtk_image_new(); gtk_widget_set_size_request(preview, MAX_PREVIEWSIZE, MAX_PREVIEWSIZE); gtk_file_chooser_set_preview_widget(GTK_FILE_CHOOSER(chooser), preview); gtk_file_chooser_set_preview_widget_active(GTK_FILE_CHOOSER(chooser), FALSE); g_signal_connect(chooser, "update-preview", G_CALLBACK(chooser_update_preview), preview); gtk_widget_show_all(chooser); filename = NULL; switch (gtk_dialog_run(GTK_DIALOG(chooser))) { case GTK_RESPONSE_ACCEPT: filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(chooser)); break; default: break; } gtk_widget_destroy(chooser); return filename; } /** * 更新文件选择器的预览控件. * @param chooser a file chooser * @param preview preview widget */ void chooser_update_preview(GtkFileChooser* chooser, GtkWidget* preview) { gchar* filename; GdkPixbuf* pixbuf; if (!(filename = gtk_file_chooser_get_preview_filename(chooser))) { gtk_file_chooser_set_preview_widget_active(chooser, FALSE); return; } pixbuf = gdk_pixbuf_new_from_file(filename, NULL); g_free(filename); if (!pixbuf) { gtk_file_chooser_set_preview_widget_active(chooser, FALSE); return; } pixbuf_shrink_scale_1(&pixbuf, MAX_PREVIEWSIZE, MAX_PREVIEWSIZE); gtk_image_set_from_pixbuf(GTK_IMAGE(preview), pixbuf); g_object_unref(pixbuf); gtk_file_chooser_set_preview_widget_active(chooser, TRUE); } void model_select_all(GtkTreeModel* model) { GtkTreeIter iter; if (!gtk_tree_model_get_iter_first(model, &iter)) return; do { if (gtk_tree_model_get_flags(model) & GTK_TREE_MODEL_LIST_ONLY) gtk_list_store_set(GTK_LIST_STORE(model), &iter, 0, TRUE, -1); else gtk_tree_store_set(GTK_TREE_STORE(model), &iter, 0, TRUE, -1); } while (gtk_tree_model_iter_next(model, &iter)); } void model_turn_all(GtkTreeModel* model) { GtkTreeIter iter; gboolean active; if (!gtk_tree_model_get_iter_first(model, &iter)) return; do { gtk_tree_model_get(model, &iter, 0, &active, -1); if (gtk_tree_model_get_flags(model) & GTK_TREE_MODEL_LIST_ONLY) gtk_list_store_set(GTK_LIST_STORE(model), &iter, 0, !active, -1); else gtk_tree_store_set(GTK_TREE_STORE(model), &iter, 0, !active, -1); } while (gtk_tree_model_iter_next(model, &iter)); } void model_clear_all(GtkTreeModel* model) { GtkTreeIter iter; if (!gtk_tree_model_get_iter_first(model, &iter)) return; do { if (gtk_tree_model_get_flags(model) & GTK_TREE_MODEL_LIST_ONLY) gtk_list_store_set(GTK_LIST_STORE(model), &iter, 0, FALSE, -1); else gtk_tree_store_set(GTK_TREE_STORE(model), &iter, 0, FALSE, -1); } while (gtk_tree_model_iter_next(model, &iter)); } void model_turn_select(GtkTreeModel* model, gchar* path) { GtkTreeIter iter; gboolean active; if (!gtk_tree_model_get_iter_from_string(model, &iter, path)) return; gtk_tree_model_get(model, &iter, 0, &active, -1); if (gtk_tree_model_get_flags(model) & GTK_TREE_MODEL_LIST_ONLY) gtk_list_store_set(GTK_LIST_STORE(model), &iter, 0, !active, -1); else gtk_tree_store_set(GTK_TREE_STORE(model), &iter, 0, !active, -1); } void textview_follow_if_link(GtkWidget* textview, GtkTextIter* iter) { GSList *tags, *tmp; tmp = tags = gtk_text_iter_get_tags(iter); while (tmp) { auto tag = (GtkTextTag*)tmp->data; gchar* url; if ((url = (gchar*)g_object_get_data(G_OBJECT(tag), "url"))) { if (!gtk_show_uri_on_window(GTK_WINDOW(gtk_widget_get_toplevel(textview)), url, GDK_CURRENT_TIME, NULL)) { iptux_open_url(url); } break; } tmp = tmp->next; } g_slist_free(tags); } void textview_set_cursor_if_appropriate(GtkTextView* textview, gint x, gint y) { GSList *tags, *tmp; GtkTextIter iter; gboolean hovering; hovering = FALSE; gtk_text_view_get_iter_at_location(textview, &iter, x, y); tmp = tags = gtk_text_iter_get_tags(&iter); while (tmp) { auto tag = (GtkTextTag*)tmp->data; if (g_object_get_data(G_OBJECT(tag), "url")) { hovering = TRUE; break; } tmp = tmp->next; } g_slist_free(tags); if (hovering != GPOINTER_TO_INT(g_object_get_data(G_OBJECT(textview), "hovering-over-link"))) { auto window = gtk_text_view_get_window(textview, GTK_TEXT_WINDOW_TEXT); if (hovering) { gdk_window_set_cursor(window, gdk_cursor_new_for_display( gdk_display_get_default(), GDK_HAND2)); } else { gdk_window_set_cursor(window, gdk_cursor_new_for_display( gdk_display_get_default(), GDK_XTERM)); } g_object_set_data(G_OBJECT(textview), "hovering-over-link", GINT_TO_POINTER(hovering)); } } gboolean textview_key_press_event(GtkWidget* textview, GdkEventKey* event) { GtkTextBuffer* buffer; GtkTextIter iter; gint position; switch (event->keyval) { case GDK_KEY_Return: case GDK_KEY_KP_Enter: buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview)); g_object_get(buffer, "cursor-position", &position, NULL); gtk_text_buffer_get_iter_at_offset(buffer, &iter, position); textview_follow_if_link(textview, &iter); break; default: break; } return FALSE; } void textview_event_after(GtkWidget* textview, GdkEvent* ev) { GtkTextBuffer* buffer; GdkEventButton* event; GtkTextIter iter; gboolean selected; gint x, y; if (ev->type != GDK_BUTTON_RELEASE) return; event = (GdkEventButton*)ev; if (event->button != 1) return; /* we shouldn't follow a link if the user has selected something */ buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview)); g_object_get(buffer, "has-selection", &selected, NULL); if (selected) return; gtk_text_view_window_to_buffer_coords(GTK_TEXT_VIEW(textview), GTK_TEXT_WINDOW_WIDGET, event->x, event->y, &x, &y); gtk_text_view_get_iter_at_location(GTK_TEXT_VIEW(textview), &iter, x, y); textview_follow_if_link(textview, &iter); } gboolean textview_motion_notify_event(GtkWidget* textview, GdkEventMotion* event) { gint x, y; gtk_text_view_window_to_buffer_coords(GTK_TEXT_VIEW(textview), GTK_TEXT_WINDOW_WIDGET, event->x, event->y, &x, &y); textview_set_cursor_if_appropriate(GTK_TEXT_VIEW(textview), x, y); return FALSE; } } // namespace iptux iptux-0.9.4/src/iptux/callback.h000066400000000000000000000031741475473122500165610ustar00rootroot00000000000000// // C++ Interface: callback // // Description: // 共用构建界面函数及回调函数集合 // // Author: Jally , (C) 2009 // // Copyright: See COPYING file that comes with this distribution // // #ifndef IPTUX_CALLBACK_H #define IPTUX_CALLBACK_H #include #include "iptux-core/Models.h" namespace iptux { /* entry */ gboolean entry_query_tooltip(GtkWidget* entry, gint x, gint y, gboolean key, GtkTooltip* tooltip, char* text); void entry_insert_numeric(GtkWidget* entry, gchar* text, gint length); /* file-chooser */ gchar* choose_file_with_preview(const gchar* title, GtkWidget* parent); void chooser_update_preview(GtkFileChooser* chooser, GtkWidget* preview); /* model:0 G_TYPE_BOOLEAN */ void model_select_all(GtkTreeModel* model); void model_turn_all(GtkTreeModel* model); void model_clear_all(GtkTreeModel* model); void model_turn_select(GtkTreeModel* model, gchar* path); /* text view link */ void textview_follow_if_link(GtkWidget* textview, GtkTextIter* iter); void textview_set_cursor_if_appropriate(GtkTextView* textview, gint x, gint y); gboolean textview_key_press_event(GtkWidget* textview, GdkEventKey* event); void textview_event_after(GtkWidget* textview, GdkEvent* ev); gboolean textview_motion_notify_event(GtkWidget* textview, GdkEventMotion* event); gboolean textview_visibility_notify_event(GtkWidget* textview, GdkEventVisibility* event); } // namespace iptux #endif iptux-0.9.4/src/iptux/dialog.cpp000066400000000000000000000200171475473122500166120ustar00rootroot00000000000000// // C++ Implementation: dialog // // Description: // // // Author: Jally , (C) 2009 // // Copyright: See COPYING file that comes with this distribution // // #include "config.h" #include "dialog.h" #include "iptux-utils/utils.h" #include #include #include "iptux/callback.h" #include "iptux-utils/output.h" #include "iptux/UiHelper.h" using namespace std; namespace iptux { /** * 弹出请求程序退出的对话框. * @return true|false */ bool pop_request_quit(GtkWindow* parent) { GtkWidget* dialog; gint result; dialog = gtk_message_dialog_new(parent, GTK_DIALOG_MODAL, GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL, "%s", _("File transfer has not been completed.\n" "Are you sure to cancel and quit?")); gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_CANCEL); gtk_window_set_title(GTK_WINDOW(dialog), _("Confirm Exit")); result = gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); return (result == GTK_RESPONSE_OK); } /** * 弹出好友请求获取本机共享文件的对话框. * @param pal class PalInfo * @return true|false */ bool pop_request_shared_file(GtkWindow* parent, PalInfo* pal) { GtkWidget *dialog, *box; GtkWidget *label, *image; char* ptr; gint result; dialog = gtk_dialog_new_with_buttons( _("Request Shared Resources"), parent, GTK_DIALOG_MODAL, _("Agree"), GTK_RESPONSE_ACCEPT, _("Refuse"), GTK_RESPONSE_CANCEL, NULL); gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT); gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), box, TRUE, TRUE, 0); image = gtk_image_new_from_icon_name("dialog-question-symbolic", GTK_ICON_SIZE_DIALOG); gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 0); image = gtk_separator_new(GTK_ORIENTATION_VERTICAL); gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 0); string ipstr = inAddrToString(pal->ipv4()); ptr = g_strdup_printf(_("Your pal (%s)[%s]\n" "is requesting to get your shared resources,\n" "Do you agree?"), pal->getName().c_str(), ipstr.c_str()); label = gtk_label_new(ptr); g_free(ptr); gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); gtk_label_set_line_wrap_mode(GTK_LABEL(label), PANGO_WRAP_WORD_CHAR); gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 4); gtk_widget_show_all(dialog); result = gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); return (result == GTK_RESPONSE_ACCEPT); } /** * 弹出请求获取好友共享文件的密码. * @param pal class PalInfo * @return password string */ char* pop_obtain_shared_passwd(GtkWindow* parent, PalInfo* pal) { GtkWidget *dialog, *frame, *box; GtkWidget *image, *passwd; char* text; gint result; dialog = gtk_dialog_new_with_buttons(_("Access Password"), parent, GTK_DIALOG_MODAL, _("_OK"), GTK_RESPONSE_OK, NULL); gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK); gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); frame = gtk_frame_new(_("Please input the password for " "the shared files behind")); gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_ETCHED_IN); gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), frame, FALSE, FALSE, 0); box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_container_add(GTK_CONTAINER(frame), box); image = gtk_image_new_from_icon_name("dialog-password-symbolic", GTK_ICON_SIZE_DIALOG); gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 0); image = gtk_separator_new(GTK_ORIENTATION_VERTICAL); gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 0); string ipstr = inAddrToString(pal->ipv4()); text = g_strdup_printf(_("(%s)[%s]Password:"), pal->getName().c_str(), ipstr.c_str()); frame = gtk_frame_new(text); gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_NONE); gtk_box_pack_start(GTK_BOX(box), frame, TRUE, TRUE, 0); g_free(text); passwd = gtk_entry_new(); gtk_entry_set_activates_default(GTK_ENTRY(passwd), TRUE); gtk_entry_set_visibility(GTK_ENTRY(passwd), FALSE); gtk_container_add(GTK_CONTAINER(frame), passwd); gtk_widget_show_all(dialog); text = NULL; // 并无多大用处,主要用来避免编译警告 mark: switch (result = gtk_dialog_run(GTK_DIALOG(dialog))) { case GTK_RESPONSE_OK: if (*(text = gtk_editable_get_chars(GTK_EDITABLE(passwd), 0, -1)) == '\0') { gtk_widget_grab_focus(passwd); pop_warning(dialog, _("\nEmpty Password!")); g_free(text); goto mark; } default: break; } gtk_widget_destroy(dialog); return (result == GTK_RESPONSE_OK ? text : NULL); } /** * 弹出密码设定的对话框. * @param parent parent window * @return password string */ char* pop_password_settings(GtkWidget* parent) { CHECK_NOTNULL(parent); GtkWidget *dialog, *hbox, *passwd, *repeat; gchar *text1, *text2; gint result; dialog = gtk_dialog_new_with_buttons( _("Enter a New Password"), GTK_WINDOW(parent), GTK_DIALOG_MODAL, _("_OK"), GTK_RESPONSE_OK, _("_Cancel"), GTK_RESPONSE_CANCEL, NULL); gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK); gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), hbox, FALSE, FALSE, 0); passwd = gtk_label_new(_("Password: ")); gtk_box_pack_start(GTK_BOX(hbox), passwd, FALSE, FALSE, 0); passwd = gtk_entry_new(); gtk_entry_set_activates_default(GTK_ENTRY(passwd), TRUE); gtk_entry_set_visibility(GTK_ENTRY(passwd), FALSE); gtk_box_pack_start(GTK_BOX(hbox), passwd, TRUE, TRUE, 0); hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), hbox, FALSE, FALSE, 0); repeat = gtk_label_new(_("Repeat: ")); gtk_box_pack_start(GTK_BOX(hbox), repeat, FALSE, FALSE, 0); repeat = gtk_entry_new(); gtk_entry_set_visibility(GTK_ENTRY(repeat), FALSE); gtk_box_pack_start(GTK_BOX(hbox), repeat, TRUE, TRUE, 0); gtk_widget_show_all(dialog); text1 = text2 = NULL; // 并无多大用处,主要用来避免编译警告 mark: switch (result = gtk_dialog_run(GTK_DIALOG(dialog))) { case GTK_RESPONSE_OK: text1 = gtk_editable_get_chars(GTK_EDITABLE(passwd), 0, -1); text2 = gtk_editable_get_chars(GTK_EDITABLE(repeat), 0, -1); gtk_widget_grab_focus(passwd); if (strcmp(text1, text2) != 0) { pop_warning(dialog, _("\nPassword Mismatched!")); g_free(text1); g_free(text2); goto mark; } else if (*text1 == '\0') { pop_warning(dialog, _("\nEmpty Password!")); g_free(text1); g_free(text2); goto mark; } default: break; } gtk_widget_destroy(dialog); if (result == GTK_RESPONSE_OK) { g_free(text1); return text2; } return NULL; } const char* pop_save_path(GtkWidget* parent, const char* defaultPath) { const char* path = nullptr; GtkWidget* dialog; dialog = gtk_file_chooser_dialog_new( _("Please select a folder to save files."), GTK_WINDOW(parent), GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, _("_Cancel"), GTK_RESPONSE_CANCEL, _("_Save"), GTK_RESPONSE_ACCEPT, NULL); gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), defaultPath); if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) { path = gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER(dialog)); } gtk_widget_destroy(dialog); return path; } } // namespace iptux iptux-0.9.4/src/iptux/dialog.h000066400000000000000000000014251475473122500162610ustar00rootroot00000000000000// // C++ Interface: dialog // // Description: // 常见对话框构建 // // Author: Jally , (C) 2009 // // Copyright: See COPYING file that comes with this distribution // // #ifndef IPTUX_DIALOG_H #define IPTUX_DIALOG_H #include #include "iptux-core/Models.h" namespace iptux { bool pop_request_quit(GtkWindow* parent); bool pop_request_shared_file(GtkWindow* parent, PalInfo* pal); char* pop_obtain_shared_passwd(GtkWindow* parent, PalInfo* pal); char* pop_password_settings(GtkWidget* parent); /** * 弹出接收文件存放位置的对话框. * @param parent parent window * @return path const char*, if user does not accept, return nullptr */ const char* pop_save_path(GtkWidget* parent, const char* defaultPath); } // namespace iptux #endif iptux-0.9.4/src/iptux/meson.build000066400000000000000000000071321475473122500170140ustar00rootroot00000000000000gtk_dep = dependency('gtk+-3.0', version: '>=3.22') jsoncpp_dep = dependency('jsoncpp', version: '>=1.0') glog_dep = dependency('libglog') gflags_dep = dependency('gflags') sigc_dep = dependency('sigc++-2.0') sources = files([ 'AboutDialog.cpp', 'Application.cpp', 'callback.cpp', 'DataSettings.cpp', 'DetectPal.cpp', 'dialog.cpp', 'DialogBase.cpp', 'DialogGroup.cpp', 'DialogPeer.cpp', 'GioNotificationService.cpp', 'LogSystem.cpp', 'MainWindow.cpp', 'RevisePal.cpp', 'ShareFile.cpp', 'TerminalNotifierNotificationService.cpp', 'TransWindow.cpp', 'UiCoreThread.cpp', 'UiHelper.cpp', 'UiModels.cpp', 'WindowConfig.cpp', ]) dependencies = [gtk_dep, jsoncpp_dep, glog_dep, gflags_dep, sigc_dep] if appindicator_dep.found() sources += ['AppIndicator.cpp'] dependencies += [appindicator_dep] else sources += ['AppIndicatorDummy.cpp'] endif glib_compile_resources = find_program('glib-compile-resources') ui_files = [ 'resources/gtk/AboutDialog.ui', 'resources/gtk/AppIndicator.ui', 'resources/gtk/MainWindow.ui', 'resources/gtk/HeaderBar.ui', 'resources/gtk/DetectPal.ui', 'resources/gtk/menus.ui', ] iptux_resource_h = custom_target('iptux_resource_h', output : 'IptuxResource.h', input : 'resources/iptux.gresource.xml', depend_files: ui_files, command : [glib_compile_resources, '--generate-header', '--manual-register', '--target=@OUTPUT@', '--sourcedir=' + join_paths(meson.current_source_dir(), 'resources'), '@INPUT@']) iptux_resource_cpp = custom_target('iptux_resource_cpp', output : 'IptuxResource.cpp', input : 'resources/iptux.gresource.xml', depend_files: ui_files, command : [glib_compile_resources, '--generate-source', '--manual-register', '--target=@OUTPUT@', '--sourcedir=' + join_paths(meson.current_source_dir(), 'resources'), '@INPUT@']) # TODO: How to support C++? # gnome = import('gnome') # iptux_resource = gnome.compile_resources( # 'IptuxResource', # 'resources/iptux.gresource.xml', # source_dir: join_paths(meson.current_source_dir(), 'resources'), # ) sources += [iptux_resource_cpp, iptux_resource_h] inc = include_directories('..', '../api') if host_machine.system() == 'darwin' gtk_mac_integration_dep = dependency('gtk-mac-integration-gtk3') dependencies += [gtk_mac_integration_dep] sources += ['Darwin.cpp'] endif libiptux = static_library('iptux', sources, dependencies: dependencies, link_with: [libiptux_core], include_directories: inc, ) gtest_inc = include_directories('../googletest/include') thread_dep = dependency('threads') test_sources = files([ 'AboutDialogTest.cpp', 'ApplicationTest.cpp', 'DataSettingsTest.cpp', 'DetectPalTest.cpp', 'DialogGroupTest.cpp', 'DialogPeerTest.cpp', 'LogSystemTest.cpp', 'MainWindowTest.cpp', 'RevisePalTest.cpp', 'ShareFileTest.cpp', 'TestHelper.cpp', 'TestMain.cpp', 'TransWindowTest.cpp', 'UiCoreThreadTest.cpp', 'UiHelperTest.cpp', 'UiModelsTest.cpp', ]) test_sources += [iptux_resource_h] libiptux_test = executable('libiptux_test', test_sources, dependencies: [gtk_dep, jsoncpp_dep, thread_dep, sigc_dep], cpp_args: ['-fno-lto'], # https://github.com/iptux-src/iptux/issues/651 link_with: [libiptux, libgtest,libiptux_core_test_helper], link_args: ['-fno-lto'], include_directories: [inc, gtest_inc] ) if meson.version().version_compare('>=0.55') test('gui', libiptux_test, is_parallel : false, protocol: 'gtest') else test('gui', libiptux_test, is_parallel : false) endif iptux-0.9.4/src/iptux/resources/000077500000000000000000000000001475473122500166615ustar00rootroot00000000000000iptux-0.9.4/src/iptux/resources/gtk/000077500000000000000000000000001475473122500174465ustar00rootroot00000000000000iptux-0.9.4/src/iptux/resources/gtk/AboutDialog.ui000066400000000000000000000040321475473122500221760ustar00rootroot00000000000000 False True dialog iptux VERSION Copyright © 2008–2009, Jally Copyright © 2013–2015,2017–2021, LI Daobing A GTK based LAN messenger. https://github.com/iptux-src/iptux Jally <jallyx@163.com> ManPT <pentie@gmail.com> LI Daobing https://github.com/lidaobing Jally <jallyx@163.com> LiWeijian <weijian_li88@qq.com> ManPT <pentie@gmail.com> iptux-icon gpl-2-0 False vertical 2 False end False False 0 iptux-0.9.4/src/iptux/resources/gtk/AppIndicator.ui000066400000000000000000000012061475473122500223610ustar00rootroot00000000000000
Open Iptux app.open_main_window
_Preferences app.preferences _Quit app.quit
iptux-0.9.4/src/iptux/resources/gtk/DetectPal.ui000066400000000000000000000061161475473122500216560ustar00rootroot00000000000000 False Detect pal False True dialog 5 True Detect True True Cancel detect_pal_dialog_cancel detect_pal_dialog_detect False vertical 2 True False 0 none True False 6 12 True True True 16 1.2.3.4 True False Please input an IP address (IPv4 only): False True 1 iptux-0.9.4/src/iptux/resources/gtk/HeaderBar.ui000066400000000000000000000013701475473122500216230ustar00rootroot00000000000000 True True True False menu_image end True open-menu-symbolic iptux-0.9.4/src/iptux/resources/gtk/MainWindow.ui000066400000000000000000000106201475473122500220600ustar00rootroot00000000000000
Send Message win.pal.send_message Request Shared Resources win.pal.request_shared_resources Change Info win.pal.change_info Delete Pal win.pal.delete_pal
Sort
By Nickname win.sort_by nickname By Username win.sort_by username By IP win.sort_by ip By Host win.sort_by host By Last Activity win.sort_by last_activity
Ascending win.sort_type ascending Descending win.sort_type descending
Info Style
IP win.info_style ip IP:PORT win.info_style ip_port Host win.info_style host Username win.info_style username Version win.info_style version Last Activity win.info_style last_activity Last Message win.info_style last_message
iptux-0.9.4/src/iptux/resources/gtk/menus.ui000066400000000000000000000332701475473122500211410ustar00rootroot00000000000000
_Preferences app.preferences _Quit app.quit
_File _Detect win.detect _Find win.find _View
Sort
By Nickname win.sort_by nickname By Username win.sort_by username By IP win.sort_by ip By Host win.sort_by host By Last Activity win.sort_by last_activity
Ascending win.sort_type ascending Descending win.sort_type descending
_Refresh win.refresh view-refresh-symbolic
_Chat
Insert Image win.insert_image insert-image-symbolic Attach File win.attach_file Attach Folder win.attach_folder
Request Shared Resources win.request_shared_resources Clear Chat History win.clear_chat_history edit-clear-all-symbolic
Send Message win.send_message
_Window
_Transmission app.tools.transmission _Shared Management app.tools.shared_management _Chat Log app.tools.open_chat_log _System Log app.tools.open_system_log
Close Window app.window.close
_Help
_About app.about Report Bug app.help.report_bug What's New app.help.whats_new
_File _Detect win.detect _Find win.find _View
Sort
By Nickname win.sort_by nickname By Username win.sort_by username By IP win.sort_by ip By Host win.sort_by host By Last Activity win.sort_by last_activity
Ascending win.sort_type ascending Descending win.sort_type descending
_Refresh win.refresh view-refresh-symbolic
_Chat
Insert Image win.insert_image insert-image-symbolic Attach File win.attach_file Attach Folder win.attach_folder
Request Shared Resources win.request_shared_resources Clear Chat History win.clear_chat_history edit-clear-all-symbolic
Send Message win.send_message
_Window
_Transmission app.tools.transmission _Shared Management app.tools.shared_management _Chat Log app.tools.open_chat_log _System Log app.tools.open_system_log
Close Window app.window.close
_Help
_About app.about Report Bug app.help.report_bug What's New app.help.whats_new
_Preferences app.preferences _Quit app.quit
Open This File win.trans.open_file Open Containing Folder win.trans.open_folder Terminate Task win.trans.terminate_task Terminate All win.trans.terminate_all Clear Tasklist app.trans_model.clear
Refuse win.refuse Refuse All win.refuse_all
iptux-0.9.4/src/iptux/resources/iptux.gresource.xml000066400000000000000000000010341475473122500225470ustar00rootroot00000000000000 gtk/AboutDialog.ui gtk/AppIndicator.ui gtk/DetectPal.ui gtk/HeaderBar.ui gtk/MainWindow.ui gtk/menus.ui iptux-0.9.4/src/iptux/testdata/000077500000000000000000000000001475473122500164605ustar00rootroot00000000000000iptux-0.9.4/src/iptux/testdata/hexcstringtest.out.dat000066400000000000000000000013421475473122500230360ustar00rootroot00000000000000"\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff" iptux-0.9.4/src/iptux/testdata/hexdumptest.dat000066400000000000000000000004001475473122500215160ustar00rootroot00000000000000  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~iptux-0.9.4/src/iptux/testdata/hexdumptest.out.dat000066400000000000000000000023711475473122500223350ustar00rootroot0000000000000000000000 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f |................| 00000010 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f |................| 00000020 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f | !"#$%&'()*+,-./| 00000030 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f |0123456789:;<=>?| 00000040 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f |@ABCDEFGHIJKLMNO| 00000050 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f |PQRSTUVWXYZ[\]^_| 00000060 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f |`abcdefghijklmno| 00000070 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f |pqrstuvwxyz{|}~.| 00000080 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f |................| 00000090 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d 9e 9f |................| 000000a0 a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af |................| 000000b0 b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf |................| 000000c0 c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf |................| 000000d0 d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de df |................| 000000e0 e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef |................| 000000f0 f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc fd fe ff |................| 00000100 iptux-0.9.4/src/iptux/testdata/iptux.png000066400000000000000000000131061475473122500203400ustar00rootroot00000000000000PNG  IHDR00WgAMA a cHRMz&u0`:pQ<bKGD pHYs.#.#x?vtIME5IDAThޭy\u?^K﫺jIhA$ !ð C139gq#3vBb80f1AYT^7Və_wթ櫯/Th%k7]XfMC: D…XEe"Zs2 㣣xP{x=zӦMFO[?/>[PX~-w-ojn&NnnY[&x EFDStH&JNOFFF?p۷o?~Mg^|;oJE/،^|_)ˑ|}ku m;wՂ-kWVBA1 Zcl"$,J5syG>C^ /?oq lKPz*} ڸiqu۲/,`뢆+6eP(6]>db&E>[.no,oz"!!?"4'Odϛog>. XPGT\O~Ogڣ[q/=o]  :.D"͓IH HŸm yKp8KzbVSYN̰>xNw{=q晆J`ǎX~uGGzeRyv}c4\\zͭͫ7t@xx*;=06dt&C:[ֆآ}C~F'&95[=&QU!дp!-}・vzg!;ؿ?;wl~3\{\Ֆ+vu/X ǭ=cMϠ.h05FkFw5u\ڪ(2H Oe*:= [ϡ2;y9g빉ѯ9p8_=Db>L67G_U\xŗZοx I%΢d~v.6P߶ß]K.e7б5KY0F 3kQliQ[4_v͞TSUU5@gg'>(L߲{ɾ\qymlQ3$c vQ" 4|:m Q,5_p"|5:g8bFB HTf5:4Q):{yOt|ǎ[ool'ԟ)C䢫:l*3"}#d%gAIA%BJh+6 >3Q,xf:CYڌmHB {T%'^(?N$aٲene3a[[I*[`pp|:3gZ0"sJ65~NZ^EnƦRhcM.NkS B.Tޚ~1Y}u-&:lw|64l+ MPno(k! |qMտ&&g (KUR" [p~/|ṃOKyV,Eg0~x#U Z _D)5?IBDFlZ+"4FL|42EO`3!0Fkjg]IEF&]M(` @~2n׏kښU!-b( عEP#Aܰ-leoT e4ZhWU f  O}m+&dr9[/YO%8vkBGWʳКYunlnٸ-781]R, K4d-,/ȶɼha! UPǯ^Uu7E-mDYŔ\3*Q>Q¥m\|<~KRF+)YVT< )5;%W%| Џl=W56F\mJ %YWF圅BgM{&(`ѳ7⡔$,/*-P=k<~m CZtJJ"Yfn>E|ܱ5USC}zmf_Jf0%"J3$1h}^!)>-{77,Ţ [OLԇ} >HiqWR!!hl[` Nڃ1DlKh9QƕT_p4/h,EB ˪ln)&/w`]E,KAi]h,eQS([PnXv_"ݵ0k6%/ -ca @,h&:oCC!_@lܲn [x 8l1`)o@蘩=Ce\'f< Xfa*6-2Vd'?&ƹhށ ^=9E "Up8<<5 >edY;EL@48!ͤkם0T^\ЈQlnJ's\vv3*`sC{3Kkc` '3 ]Z6GSic)*rs {GXĠdffvmYV N>;*XL w`<0W}*yd$h`]Cں8*L&`[l[X5+[O71KyZʲf8!݇{|v$dEl/("sf6--:+tǙ aE3 lh[[iA6/%}= 0LٮBghA332.#;7CkW`ۖy>2HBNE8SShs^}hûOb[[ְ0.\Xy-oƔ2kOdgF{E[Ɉ 4%6n?e}b_ 1+'A1PXS%;4'IR"Ջ||46'8>dUmb2  +,R/Z >R^ LafJLGm{{+L,ƮNvȭ\GzvA|JYg.Mrj&GosZD]^/GiSFxk\7eq1( JW?bQN7u~:xdoױЬQ ZG{[ )Gs*O34{#3X!.hVã vMW ڊ RD}>˚Mծm qm.;qB3|32cN8r퉃;u|ݖk+hEP >%HϢ=RBhI:RmJq .~KQnuA# y"e),Q gt)tQ}j#ġnO&㺮hG1jAI拈1(c0ڠ0,H]YD'k#[j) !H)}jW3Ȼ^꯮h(|\@wvyw2N>+UkM^{[%xΡ7p 89e(ǧ\Yќ%-Ǥ6^ Ν;/~ľؾ}'n+Ŏ/돏I$bp}#c_pEpTZ/@]cp xʹF'N{mJCaj,;ҁ#ϴ?ٿ?v޽{Ϻn##GO7~+KZT |x%6do1.6sSnKK )C='W]񮩮w|Qxɧ+n::Tyg<:4#WpSAkF08\(PRDզ8Fp9 \ġ]O xO`*W~8^#xWmZH 8>*e;NMFp#;\_xzةoOƵw}y>xso~aogt]r犅œ3W_wesuMUvCKP~q]]ŀ;'cpBg|Xz|7#'TANjwz,殇kG}n=cWTnhvj->Z+Lu#cbD jϢdžD#Lr*2ə-ܬSH%|EEǥ[7wns8& Tj3)a=r`߭3w}w$'znl}g-Xy%tEXtdate:create2018-01-26T21:04:26+08:00B'N%tEXtdate:modify2018-01-26T21:04:26+08:003zIENDB`iptux-0.9.4/src/main/000077500000000000000000000000001475473122500144225ustar00rootroot00000000000000iptux-0.9.4/src/main/iptux.cpp000066400000000000000000000124321475473122500163010ustar00rootroot00000000000000/*************************************************************************** * Copyright (C) 2008 by Jally * * jallyx@163.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include "config.h" #include #include #include #include #include "iptux/Application.h" #include "iptux-utils/output.h" #include "iptux-utils/utils.h" #include "iptux_crash_utils.h" using namespace std; using namespace iptux; static gboolean version = FALSE; static gchar* configFilename = nullptr; static gchar* logger = nullptr; static gchar* bindIp = nullptr; static GLogLevelFlags logLevel = G_LOG_LEVEL_WARNING; string getConfigPath() { const char* res1; if (bindIp == nullptr) { res1 = g_build_path("/", g_getenv("HOME"), ".iptux", "config.json", NULL); } else { res1 = g_build_path("/", g_getenv("HOME"), ".iptux", stringFormat("config.%s.json", bindIp).c_str(), NULL); } string res2(res1); g_free(gpointer(res1)); return res2; } static GOptionEntry entries[] = { {"version", 'v', 0, G_OPTION_ARG_NONE, &version, "Output version information and exit", NULL}, {"config", 'c', 0, G_OPTION_ARG_FILENAME, &configFilename, "Specify config path", "CONFIG_PATH"}, {"log", 'l', 0, G_OPTION_ARG_STRING, &logger, "Specify log level: DEBUG, INFO, WARN, default is WARN", "LEVEL"}, {"bind", 'b', 0, G_OPTION_ARG_STRING, &bindIp, "Specify bind IP, like 127.0.0.2", "IP"}, {nullptr, 0, 0, G_OPTION_ARG_NONE, nullptr, nullptr, nullptr}}; static string nowAsString() { time_t rawtime; struct tm timeinfo; char buffer[80]; time(&rawtime); localtime_r(&rawtime, &timeinfo); strftime(buffer, sizeof(buffer), "%Y-%m-%d %H:%M:%S", &timeinfo); return buffer; } static const char* logLevelAsString(GLogLevelFlags logLevel) { switch (logLevel) { case G_LOG_LEVEL_DEBUG: return "DEBUG"; case G_LOG_LEVEL_INFO: return "INFO "; case G_LOG_LEVEL_MESSAGE: return "MESSA"; case G_LOG_LEVEL_WARNING: return "WARN "; case G_LOG_LEVEL_ERROR: return "ERROR"; default: return "UNKNO"; } } static void logHandler(const gchar* log_domain, GLogLevelFlags log_level, const gchar* message, gpointer) { if (log_level > logLevel) { return; } fprintf(stderr, "[%s][%s][%s]%s\n", nowAsString().c_str(), log_domain, logLevelAsString(log_level), message); } static void dealLog(const IptuxConfig& config) { string logStr = "WARN"; if (!config.GetString("log_level").empty()) { logStr = config.GetString("log_level"); } if (logger != nullptr) { logStr = logger; } g_log_set_handler("iptux", GLogLevelFlags(G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION), logHandler, NULL); if (logStr == "DEBUG") { Log::setLogLevel(LogLevel::DEBUG); logLevel = G_LOG_LEVEL_DEBUG; } else if (logStr == "INFO") { Log::setLogLevel(LogLevel::INFO); logLevel = G_LOG_LEVEL_INFO; } else if (logStr == "WARN") { Log::setLogLevel(LogLevel::WARN); logLevel = G_LOG_LEVEL_WARNING; } else { LOG_ERROR("unknown log level: %s", logger); } } int main(int argc, char** argv) { installCrashHandler(); setlocale(LC_ALL, ""); bindtextdomain(GETTEXT_PACKAGE, __LOCALE_PATH); bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); textdomain(GETTEXT_PACKAGE); GError* error = NULL; GOptionContext* context; context = g_option_context_new(_("- A software for sharing in LAN")); g_option_context_add_main_entries(context, entries, GETTEXT_PACKAGE); if (!g_option_context_parse(context, &argc, &argv, &error)) { g_print(_("option parsing failed: %s\n"), error->message); exit(1); } if (version) { printf("iptux: " VERSION "\n"); exit(0); } string configPath = configFilename ? configFilename : getConfigPath(); auto config = make_shared(configPath); dealLog(*config); if (bindIp) { config->SetString("bind_ip", bindIp); } Application app(config); return app.run(argc, argv); } iptux-0.9.4/src/main/iptux_crash_utils.cpp000066400000000000000000000030271475473122500207010ustar00rootroot00000000000000#include "iptux_crash_utils.h" #include #include #include #include #include #include #include #include using namespace std; namespace iptux { #define MAX_DEPTH 99 static void segvHandler(int sig) { void* trace[MAX_DEPTH]; int stack_depth = backtrace(trace, MAX_DEPTH); fprintf(stderr, "Error: signal %d:\n", sig); for (int i = 0; i < stack_depth; i++) { Dl_info dlinfo; if (!dladdr(trace[i], &dlinfo)) { fprintf(stderr, "[%p]\n", trace[i]); continue; } const char* symname = dlinfo.dli_sname; char* demangled = 0; if (symname) { int status; demangled = abi::__cxa_demangle(symname, NULL, 0, &status); if (status == 0 && demangled) { symname = demangled; } } const char* fname = dlinfo.dli_fname; if (fname) { const char* p = strrchr(fname, '/'); if (p) { fname = p + 1; } } else { fname = "null"; } off_t offset = 0; if (dlinfo.dli_saddr) { offset = (off_t)(trace[i]) - (off_t)(dlinfo.dli_saddr); } else { offset = (off_t)(trace[i]) - (off_t)(dlinfo.dli_fbase); } fprintf(stderr, "%-3d %-40s %p %s + 0x%jx\n", i, fname, trace[i], symname ? symname : "", (uintmax_t)offset); if (demangled) { free(demangled); } } exit(1); } void installCrashHandler() { signal(SIGSEGV, segvHandler); signal(SIGABRT, segvHandler); signal(SIGTRAP, segvHandler); } } // namespace iptux iptux-0.9.4/src/main/iptux_crash_utils.h000066400000000000000000000001001475473122500203330ustar00rootroot00000000000000#pragma once namespace iptux { void installCrashHandler(); } iptux-0.9.4/src/main/meson.build000066400000000000000000000004741475473122500165710ustar00rootroot00000000000000iptux_sources = files(['iptux.cpp', 'iptux_crash_utils.cpp']) executable('iptux', iptux_sources, include_directories: inc, dependencies: [gtk_dep, jsoncpp_dep, thread_dep, glog_dep, gflags_dep, sigc_dep], link_with: [libiptux], export_dynamic: true, install: true, link_args: ['-ldl'], ) iptux-0.9.4/src/meson.build000066400000000000000000000030201475473122500156330ustar00rootroot00000000000000libgtest_sources = files('googletest/src/gtest-all.cc') libgtest = static_library( 'gtest', libgtest_sources, include_directories: include_directories('googletest/include', 'googletest'), ) conf_data = configuration_data() conf_data.set_quoted('VERSION', meson.project_version()) # the 1_ prefix is used for compatible with FeiQ conf_data.set_quoted('IPTUX_VERSION', '1_iptux ' + meson.project_version()) conf_data.set_quoted('GETTEXT_PACKAGE', meson.project_name()) conf_data.set( 'SHARE_DIR', join_paths(get_option('prefix'), get_option('datadir')), ) if get_option('dev') conf_data.set( 'SHARE_IPTUX_DIR', join_paths(meson.current_source_dir(), '../share'), ) else conf_data.set( 'SHARE_IPTUX_DIR', join_paths(get_option('prefix'), get_option('datadir'), 'iptux'), ) endif if host_machine.system() == 'darwin' conf_data.set('SYSTEM_DARWIN', 1) else conf_data.set('SYSTEM_DARWIN', 0) endif appindicator_dep = dependency('ayatana-appindicator3-0.1', required: get_option('appindicator')) if appindicator_dep.found() conf_data.set('HAVE_APPINDICATOR', 1) else conf_data.set('HAVE_APPINDICATOR', 0) endif configure_file( input: 'config.h.in', output: 'config.h', configuration: conf_data, ) test_conf_data = configuration_data() test_conf_data.set_quoted('CURRENT_SOURCE_PATH', meson.current_source_dir()) configure_file( input: 'TestConfig.h.in', output: 'TestConfig.h', configuration: test_conf_data, ) subdir('api') subdir('iptux-utils') subdir('iptux-core') subdir('iptux') subdir('main')